/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ "use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __async = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { step(generator.next(value)); } catch (e) { reject(e); } }; var rejected = (value) => { try { step(generator.throw(value)); } catch (e) { reject(e); } }; var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); step((generator = generator.apply(__this, __arguments)).next()); }); }; // node_modules/moment/moment.js var require_moment = __commonJS({ "node_modules/moment/moment.js"(exports, module2) { (function(global2, factory) { typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.moment = factory(); })(exports, function() { "use strict"; var hookCallback; function hooks() { return hookCallback.apply(null, arguments); } function setHookCallback(callback) { hookCallback = callback; } function isArray2(input) { return input instanceof Array || Object.prototype.toString.call(input) === "[object Array]"; } function isObject(input) { return input != null && Object.prototype.toString.call(input) === "[object Object]"; } function hasOwnProp(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } function isObjectEmpty(obj) { if (Object.getOwnPropertyNames) { return Object.getOwnPropertyNames(obj).length === 0; } else { var k; for (k in obj) { if (hasOwnProp(obj, k)) { return false; } } return true; } } function isUndefined(input) { return input === void 0; } function isNumber2(input) { return typeof input === "number" || Object.prototype.toString.call(input) === "[object Number]"; } function isDate(input) { return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]"; } function map(arr, fn) { var res = [], i, arrLen = arr.length; for (i = 0; i < arrLen; ++i) { res.push(fn(arr[i], i)); } return res; } function extend(a, b) { for (var i in b) { if (hasOwnProp(b, i)) { a[i] = b[i]; } } if (hasOwnProp(b, "toString")) { a.toString = b.toString; } if (hasOwnProp(b, "valueOf")) { a.valueOf = b.valueOf; } return a; } function createUTC(input, format2, locale2, strict) { return createLocalOrUTC(input, format2, locale2, strict, true).utc(); } function defaultParsingFlags() { return { empty: false, unusedTokens: [], unusedInput: [], overflow: -2, charsLeftOver: 0, nullInput: false, invalidEra: null, invalidMonth: null, invalidFormat: false, userInvalidated: false, iso: false, parsedDateParts: [], era: null, meridiem: null, rfc2822: false, weekdayMismatch: false }; } function getParsingFlags(m) { if (m._pf == null) { m._pf = defaultParsingFlags(); } return m._pf; } var some; if (Array.prototype.some) { some = Array.prototype.some; } else { some = function(fun) { var t = Object(this), len = t.length >>> 0, i; for (i = 0; i < len; i++) { if (i in t && fun.call(this, t[i], i, t)) { return true; } } return false; }; } function isValid(m) { if (m._isValid == null) { var flags = getParsingFlags(m), parsedParts = some.call(flags.parsedDateParts, function(i) { return i != null; }), isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts); if (m._strict) { isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0; } if (Object.isFrozen == null || !Object.isFrozen(m)) { m._isValid = isNowValid; } else { return isNowValid; } } return m._isValid; } function createInvalid(flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; } var momentProperties = hooks.momentProperties = [], updateInProgress = false; function copyConfig(to2, from2) { var i, prop, val, momentPropertiesLen = momentProperties.length; if (!isUndefined(from2._isAMomentObject)) { to2._isAMomentObject = from2._isAMomentObject; } if (!isUndefined(from2._i)) { to2._i = from2._i; } if (!isUndefined(from2._f)) { to2._f = from2._f; } if (!isUndefined(from2._l)) { to2._l = from2._l; } if (!isUndefined(from2._strict)) { to2._strict = from2._strict; } if (!isUndefined(from2._tzm)) { to2._tzm = from2._tzm; } if (!isUndefined(from2._isUTC)) { to2._isUTC = from2._isUTC; } if (!isUndefined(from2._offset)) { to2._offset = from2._offset; } if (!isUndefined(from2._pf)) { to2._pf = getParsingFlags(from2); } if (!isUndefined(from2._locale)) { to2._locale = from2._locale; } if (momentPropertiesLen > 0) { for (i = 0; i < momentPropertiesLen; i++) { prop = momentProperties[i]; val = from2[prop]; if (!isUndefined(val)) { to2[prop] = val; } } } return to2; } function Moment2(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); if (!this.isValid()) { this._d = new Date(NaN); } if (updateInProgress === false) { updateInProgress = true; hooks.updateOffset(this); updateInProgress = false; } } function isMoment(obj) { return obj instanceof Moment2 || obj != null && obj._isAMomentObject != null; } function warn(msg) { if (hooks.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) { console.warn("Deprecation warning: " + msg); } } function deprecate(msg, fn) { var firstTime = true; return extend(function() { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = [], arg, i, key, argLen = arguments.length; for (i = 0; i < argLen; i++) { arg = ""; if (typeof arguments[i] === "object") { arg += "\n[" + i + "] "; for (key in arguments[0]) { if (hasOwnProp(arguments[0], key)) { arg += key + ": " + arguments[0][key] + ", "; } } arg = arg.slice(0, -2); } else { arg = arguments[i]; } args.push(arg); } warn( msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack ); firstTime = false; } return fn.apply(this, arguments); }, fn); } var deprecations = {}; function deprecateSimple(name, msg) { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(name, msg); } if (!deprecations[name]) { warn(msg); deprecations[name] = true; } } hooks.suppressDeprecationWarnings = false; hooks.deprecationHandler = null; function isFunction(input) { return typeof Function !== "undefined" && input instanceof Function || Object.prototype.toString.call(input) === "[object Function]"; } function set(config) { var prop, i; for (i in config) { if (hasOwnProp(config, i)) { prop = config[i]; if (isFunction(prop)) { this[i] = prop; } else { this["_" + i] = prop; } } } this._config = config; this._dayOfMonthOrdinalParseLenient = new RegExp( (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source ); } function mergeConfigs(parentConfig, childConfig) { var res = extend({}, parentConfig), prop; for (prop in childConfig) { if (hasOwnProp(childConfig, prop)) { if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { res[prop] = {}; extend(res[prop], parentConfig[prop]); extend(res[prop], childConfig[prop]); } else if (childConfig[prop] != null) { res[prop] = childConfig[prop]; } else { delete res[prop]; } } } for (prop in parentConfig) { if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) { res[prop] = extend({}, res[prop]); } } return res; } function Locale(config) { if (config != null) { this.set(config); } } var keys; if (Object.keys) { keys = Object.keys; } else { keys = function(obj) { var i, res = []; for (i in obj) { if (hasOwnProp(obj, i)) { res.push(i); } } return res; }; } var defaultCalendar = { sameDay: "[Today at] LT", nextDay: "[Tomorrow at] LT", nextWeek: "dddd [at] LT", lastDay: "[Yesterday at] LT", lastWeek: "[Last] dddd [at] LT", sameElse: "L" }; function calendar(key, mom, now2) { var output = this._calendar[key] || this._calendar["sameElse"]; return isFunction(output) ? output.call(mom, now2) : output; } function zeroFill(number, targetLength, forceSign) { var absNumber = "" + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign2 = number >= 0; return (sign2 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; } var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {}; function addFormatToken(token2, padded, ordinal2, callback) { var func = callback; if (typeof callback === "string") { func = function() { return this[callback](); }; } if (token2) { formatTokenFunctions[token2] = func; } if (padded) { formatTokenFunctions[padded[0]] = function() { return zeroFill(func.apply(this, arguments), padded[1], padded[2]); }; } if (ordinal2) { formatTokenFunctions[ordinal2] = function() { return this.localeData().ordinal( func.apply(this, arguments), token2 ); }; } } function removeFormattingTokens(input) { if (input.match(/\[[\s\S]/)) { return input.replace(/^\[|\]$/g, ""); } return input.replace(/\\/g, ""); } function makeFormatFunction(format2) { var array = format2.match(formattingTokens), i, length; for (i = 0, length = array.length; i < length; i++) { if (formatTokenFunctions[array[i]]) { array[i] = formatTokenFunctions[array[i]]; } else { array[i] = removeFormattingTokens(array[i]); } } return function(mom) { var output = "", i2; for (i2 = 0; i2 < length; i2++) { output += isFunction(array[i2]) ? array[i2].call(mom, format2) : array[i2]; } return output; }; } function formatMoment(m, format2) { if (!m.isValid()) { return m.localeData().invalidDate(); } format2 = expandFormat(format2, m.localeData()); formatFunctions[format2] = formatFunctions[format2] || makeFormatFunction(format2); return formatFunctions[format2](m); } function expandFormat(format2, locale2) { var i = 5; function replaceLongDateFormatTokens(input) { return locale2.longDateFormat(input) || input; } localFormattingTokens.lastIndex = 0; while (i >= 0 && localFormattingTokens.test(format2)) { format2 = format2.replace( localFormattingTokens, replaceLongDateFormatTokens ); localFormattingTokens.lastIndex = 0; i -= 1; } return format2; } var defaultLongDateFormat = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }; function longDateFormat(key) { var format2 = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()]; if (format2 || !formatUpper) { return format2; } this._longDateFormat[key] = formatUpper.match(formattingTokens).map(function(tok) { if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") { return tok.slice(1); } return tok; }).join(""); return this._longDateFormat[key]; } var defaultInvalidDate = "Invalid date"; function invalidDate() { return this._invalidDate; } var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/; function ordinal(number) { return this._ordinal.replace("%d", number); } var defaultRelativeTime = { future: "in %s", past: "%s ago", s: "a few seconds", ss: "%d seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", w: "a week", ww: "%d weeks", M: "a month", MM: "%d months", y: "a year", yy: "%d years" }; function relativeTime(number, withoutSuffix, string, isFuture) { var output = this._relativeTime[string]; return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); } function pastFuture(diff2, output) { var format2 = this._relativeTime[diff2 > 0 ? "future" : "past"]; return isFunction(format2) ? format2(output) : format2.replace(/%s/i, output); } var aliases = {}; function addUnitAlias(unit, shorthand) { var lowerCase = unit.toLowerCase(); aliases[lowerCase] = aliases[lowerCase + "s"] = aliases[shorthand] = unit; } function normalizeUnits(units) { return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0; } function normalizeObjectUnits(inputObject) { var normalizedInput = {}, normalizedProp, prop; for (prop in inputObject) { if (hasOwnProp(inputObject, prop)) { normalizedProp = normalizeUnits(prop); if (normalizedProp) { normalizedInput[normalizedProp] = inputObject[prop]; } } } return normalizedInput; } var priorities = {}; function addUnitPriority(unit, priority) { priorities[unit] = priority; } function getPrioritizedUnits(unitsObj) { var units = [], u; for (u in unitsObj) { if (hasOwnProp(unitsObj, u)) { units.push({ unit: u, priority: priorities[u] }); } } units.sort(function(a, b) { return a.priority - b.priority; }); return units; } function isLeapYear(year) { return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; } function absFloor(number) { if (number < 0) { return Math.ceil(number) || 0; } else { return Math.floor(number); } } function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { value = absFloor(coercedNumber); } return value; } function makeGetSet(unit, keepTime) { return function(value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }; } function get(mom, unit) { return mom.isValid() ? mom._d["get" + (mom._isUTC ? "UTC" : "") + unit]() : NaN; } function set$1(mom, unit, value) { if (mom.isValid() && !isNaN(value)) { if (unit === "FullYear" && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) { value = toInt(value); mom._d["set" + (mom._isUTC ? "UTC" : "") + unit]( value, mom.month(), daysInMonth(value, mom.month()) ); } else { mom._d["set" + (mom._isUTC ? "UTC" : "") + unit](value); } } } function stringGet(units) { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](); } return this; } function stringSet(units, value) { if (typeof units === "object") { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units), i, prioritizedLen = prioritized.length; for (i = 0; i < prioritizedLen; i++) { this[prioritized[i].unit](units[prioritized[i].unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; } var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, regexes; regexes = {}; function addRegexToken(token2, regex, strictRegex) { regexes[token2] = isFunction(regex) ? regex : function(isStrict, localeData2) { return isStrict && strictRegex ? strictRegex : regex; }; } function getParseRegexForToken(token2, config) { if (!hasOwnProp(regexes, token2)) { return new RegExp(unescapeFormat(token2)); } return regexes[token2](config._strict, config._locale); } function unescapeFormat(s) { return regexEscape( s.replace("\\", "").replace( /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(matched, p1, p2, p3, p4) { return p1 || p2 || p3 || p4; } ) ); } function regexEscape(s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); } var tokens = {}; function addParseToken(token2, callback) { var i, func = callback, tokenLen; if (typeof token2 === "string") { token2 = [token2]; } if (isNumber2(callback)) { func = function(input, array) { array[callback] = toInt(input); }; } tokenLen = token2.length; for (i = 0; i < tokenLen; i++) { tokens[token2[i]] = func; } } function addWeekParseToken(token2, callback) { addParseToken(token2, function(input, array, config, token3) { config._w = config._w || {}; callback(input, config._w, config, token3); }); } function addTimeToArrayFromToken(token2, input, config) { if (input != null && hasOwnProp(tokens, token2)) { tokens[token2](input, config._a, config, token2); } } var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8; function mod(n, x) { return (n % x + x) % x; } var indexOf; if (Array.prototype.indexOf) { indexOf = Array.prototype.indexOf; } else { indexOf = function(o) { var i; for (i = 0; i < this.length; ++i) { if (this[i] === o) { return i; } } return -1; }; } function daysInMonth(year, month) { if (isNaN(year) || isNaN(month)) { return NaN; } var modMonth = mod(month, 12); year += (month - modMonth) / 12; return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2; } addFormatToken("M", ["MM", 2], "Mo", function() { return this.month() + 1; }); addFormatToken("MMM", 0, 0, function(format2) { return this.localeData().monthsShort(this, format2); }); addFormatToken("MMMM", 0, 0, function(format2) { return this.localeData().months(this, format2); }); addUnitAlias("month", "M"); addUnitPriority("month", 8); addRegexToken("M", match1to2); addRegexToken("MM", match1to2, match2); addRegexToken("MMM", function(isStrict, locale2) { return locale2.monthsShortRegex(isStrict); }); addRegexToken("MMMM", function(isStrict, locale2) { return locale2.monthsRegex(isStrict); }); addParseToken(["M", "MM"], function(input, array) { array[MONTH] = toInt(input) - 1; }); addParseToken(["MMM", "MMMM"], function(input, array, config, token2) { var month = config._locale.monthsParse(input, token2, config._strict); if (month != null) { array[MONTH] = month; } else { getParsingFlags(config).invalidMonth = input; } }); var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split( "_" ), defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord; function localeMonths(m, format2) { if (!m) { return isArray2(this._months) ? this._months : this._months["standalone"]; } return isArray2(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format2) ? "format" : "standalone"][m.month()]; } function localeMonthsShort(m, format2) { if (!m) { return isArray2(this._monthsShort) ? this._monthsShort : this._monthsShort["standalone"]; } return isArray2(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format2) ? "format" : "standalone"][m.month()]; } function handleStrictParse(monthName, format2, strict) { var i, ii, mom, llc = monthName.toLocaleLowerCase(); if (!this._monthsParse) { this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; for (i = 0; i < 12; ++i) { mom = createUTC([2e3, i]); this._shortMonthsParse[i] = this.monthsShort( mom, "" ).toLocaleLowerCase(); this._longMonthsParse[i] = this.months(mom, "").toLocaleLowerCase(); } } if (strict) { if (format2 === "MMM") { ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } } else { if (format2 === "MMM") { ii = indexOf.call(this._shortMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._longMonthsParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._longMonthsParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortMonthsParse, llc); return ii !== -1 ? ii : null; } } } function localeMonthsParse(monthName, format2, strict) { var i, mom, regex; if (this._monthsParseExact) { return handleStrictParse.call(this, monthName, format2, strict); } if (!this._monthsParse) { this._monthsParse = []; this._longMonthsParse = []; this._shortMonthsParse = []; } for (i = 0; i < 12; i++) { mom = createUTC([2e3, i]); if (strict && !this._longMonthsParse[i]) { this._longMonthsParse[i] = new RegExp( "^" + this.months(mom, "").replace(".", "") + "$", "i" ); this._shortMonthsParse[i] = new RegExp( "^" + this.monthsShort(mom, "").replace(".", "") + "$", "i" ); } if (!strict && !this._monthsParse[i]) { regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, ""); this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i"); } if (strict && format2 === "MMMM" && this._longMonthsParse[i].test(monthName)) { return i; } else if (strict && format2 === "MMM" && this._shortMonthsParse[i].test(monthName)) { return i; } else if (!strict && this._monthsParse[i].test(monthName)) { return i; } } } function setMonth(mom, value) { var dayOfMonth; if (!mom.isValid()) { return mom; } if (typeof value === "string") { if (/^\d+$/.test(value)) { value = toInt(value); } else { value = mom.localeData().monthsParse(value); if (!isNumber2(value)) { return mom; } } } dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); mom._d["set" + (mom._isUTC ? "UTC" : "") + "Month"](value, dayOfMonth); return mom; } function getSetMonth(value) { if (value != null) { setMonth(this, value); hooks.updateOffset(this, true); return this; } else { return get(this, "Month"); } } function getDaysInMonth() { return daysInMonth(this.year(), this.month()); } function monthsShortRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, "_monthsRegex")) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsShortStrictRegex; } else { return this._monthsShortRegex; } } else { if (!hasOwnProp(this, "_monthsShortRegex")) { this._monthsShortRegex = defaultMonthsShortRegex; } return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; } } function monthsRegex(isStrict) { if (this._monthsParseExact) { if (!hasOwnProp(this, "_monthsRegex")) { computeMonthsParse.call(this); } if (isStrict) { return this._monthsStrictRegex; } else { return this._monthsRegex; } } else { if (!hasOwnProp(this, "_monthsRegex")) { this._monthsRegex = defaultMonthsRegex; } return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; } } function computeMonthsParse() { function cmpLenRev(a, b) { return b.length - a.length; } var shortPieces = [], longPieces = [], mixedPieces = [], i, mom; for (i = 0; i < 12; i++) { mom = createUTC([2e3, i]); shortPieces.push(this.monthsShort(mom, "")); longPieces.push(this.months(mom, "")); mixedPieces.push(this.months(mom, "")); mixedPieces.push(this.monthsShort(mom, "")); } shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); for (i = 0; i < 12; i++) { shortPieces[i] = regexEscape(shortPieces[i]); longPieces[i] = regexEscape(longPieces[i]); } for (i = 0; i < 24; i++) { mixedPieces[i] = regexEscape(mixedPieces[i]); } this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"); this._monthsShortRegex = this._monthsRegex; this._monthsStrictRegex = new RegExp( "^(" + longPieces.join("|") + ")", "i" ); this._monthsShortStrictRegex = new RegExp( "^(" + shortPieces.join("|") + ")", "i" ); } addFormatToken("Y", 0, 0, function() { var y = this.year(); return y <= 9999 ? zeroFill(y, 4) : "+" + y; }); addFormatToken(0, ["YY", 2], 0, function() { return this.year() % 100; }); addFormatToken(0, ["YYYY", 4], 0, "year"); addFormatToken(0, ["YYYYY", 5], 0, "year"); addFormatToken(0, ["YYYYYY", 6, true], 0, "year"); addUnitAlias("year", "y"); addUnitPriority("year", 1); 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) { array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); }); addParseToken("YY", function(input, array) { array[YEAR] = hooks.parseTwoDigitYear(input); }); addParseToken("Y", function(input, array) { array[YEAR] = parseInt(input, 10); }); function daysInYear(year) { return isLeapYear(year) ? 366 : 365; } hooks.parseTwoDigitYear = function(input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3); }; var getSetYear = makeGetSet("FullYear", true); function getIsLeapYear() { return isLeapYear(this.year()); } function createDate(y, m, d, h, M, s, ms) { var date; if (y < 100 && y >= 0) { date = new Date(y + 400, m, d, h, M, s, ms); if (isFinite(date.getFullYear())) { date.setFullYear(y); } } else { date = new Date(y, m, d, h, M, s, ms); } return date; } function createUTCDate(y) { var date, args; if (y < 100 && y >= 0) { args = Array.prototype.slice.call(arguments); args[0] = y + 400; date = new Date(Date.UTC.apply(null, args)); if (isFinite(date.getUTCFullYear())) { date.setUTCFullYear(y); } } else { date = new Date(Date.UTC.apply(null, arguments)); } return date; } function firstWeekOffset(year, dow, doy) { var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; return -fwdlw + fwd - 1; } function dayOfYearFromWeeks(year, week, weekday, dow, doy) { var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear; if (dayOfYear <= 0) { resYear = year - 1; resDayOfYear = daysInYear(resYear) + dayOfYear; } else if (dayOfYear > daysInYear(year)) { resYear = year + 1; resDayOfYear = dayOfYear - daysInYear(year); } else { resYear = year; resDayOfYear = dayOfYear; } return { year: resYear, dayOfYear: resDayOfYear }; } function weekOfYear(mom, dow, doy) { var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear; if (week < 1) { resYear = mom.year() - 1; resWeek = week + weeksInYear(resYear, dow, doy); } else if (week > weeksInYear(mom.year(), dow, doy)) { resWeek = week - weeksInYear(mom.year(), dow, doy); resYear = mom.year() + 1; } else { resYear = mom.year(); resWeek = week; } return { week: resWeek, year: resYear }; } function weeksInYear(year, dow, doy) { var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy); return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; } addFormatToken("w", ["ww", 2], "wo", "week"); addFormatToken("W", ["WW", 2], "Wo", "isoWeek"); addUnitAlias("week", "w"); addUnitAlias("isoWeek", "W"); addUnitPriority("week", 5); addUnitPriority("isoWeek", 5); addRegexToken("w", match1to2); addRegexToken("ww", match1to2, match2); addRegexToken("W", match1to2); addRegexToken("WW", match1to2, match2); addWeekParseToken( ["w", "ww", "W", "WW"], function(input, week, config, token2) { week[token2.substr(0, 1)] = toInt(input); } ); function localeWeek(mom) { return weekOfYear(mom, this._week.dow, this._week.doy).week; } var defaultLocaleWeek = { dow: 0, doy: 6 }; function localeFirstDayOfWeek() { return this._week.dow; } function localeFirstDayOfYear() { return this._week.doy; } function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, "d"); } function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, "d"); } addFormatToken("d", 0, "do", "day"); addFormatToken("dd", 0, 0, function(format2) { return this.localeData().weekdaysMin(this, format2); }); addFormatToken("ddd", 0, 0, function(format2) { return this.localeData().weekdaysShort(this, format2); }); addFormatToken("dddd", 0, 0, function(format2) { return this.localeData().weekdays(this, format2); }); addFormatToken("e", 0, 0, "weekday"); addFormatToken("E", 0, 0, "isoWeekday"); addUnitAlias("day", "d"); addUnitAlias("weekday", "e"); addUnitAlias("isoWeekday", "E"); addUnitPriority("day", 11); addUnitPriority("weekday", 11); addUnitPriority("isoWeekday", 11); addRegexToken("d", match1to2); addRegexToken("e", match1to2); addRegexToken("E", match1to2); addRegexToken("dd", function(isStrict, locale2) { return locale2.weekdaysMinRegex(isStrict); }); addRegexToken("ddd", function(isStrict, locale2) { return locale2.weekdaysShortRegex(isStrict); }); addRegexToken("dddd", function(isStrict, locale2) { return locale2.weekdaysRegex(isStrict); }); addWeekParseToken(["dd", "ddd", "dddd"], function(input, week, config, token2) { var weekday = config._locale.weekdaysParse(input, token2, config._strict); if (weekday != null) { week.d = weekday; } else { getParsingFlags(config).invalidWeekday = input; } }); addWeekParseToken(["d", "e", "E"], function(input, week, config, token2) { week[token2] = toInt(input); }); function parseWeekday2(input, locale2) { if (typeof input !== "string") { return input; } if (!isNaN(input)) { return parseInt(input, 10); } input = locale2.weekdaysParse(input); if (typeof input === "number") { return input; } return null; } function parseIsoWeekday(input, locale2) { if (typeof input === "string") { return locale2.weekdaysParse(input) % 7 || 7; } return isNaN(input) ? null : input; } function shiftWeekdays(ws, n) { return ws.slice(n, 7).concat(ws.slice(0, n)); } var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord; function localeWeekdays(m, format2) { var weekdays = isArray2(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format2) ? "format" : "standalone"]; return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays; } function localeWeekdaysShort(m) { return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort; } function localeWeekdaysMin(m) { return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin; } function handleStrictParse$1(weekdayName, format2, strict) { var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); if (!this._weekdaysParse) { this._weekdaysParse = []; this._shortWeekdaysParse = []; this._minWeekdaysParse = []; for (i = 0; i < 7; ++i) { mom = createUTC([2e3, 1]).day(i); this._minWeekdaysParse[i] = this.weekdaysMin( mom, "" ).toLocaleLowerCase(); this._shortWeekdaysParse[i] = this.weekdaysShort( mom, "" ).toLocaleLowerCase(); this._weekdaysParse[i] = this.weekdays(mom, "").toLocaleLowerCase(); } } if (strict) { if (format2 === "dddd") { ii = indexOf.call(this._weekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format2 === "ddd") { ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } } else { if (format2 === "dddd") { ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else if (format2 === "ddd") { ii = indexOf.call(this._shortWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._minWeekdaysParse, llc); return ii !== -1 ? ii : null; } else { ii = indexOf.call(this._minWeekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._weekdaysParse, llc); if (ii !== -1) { return ii; } ii = indexOf.call(this._shortWeekdaysParse, llc); return ii !== -1 ? ii : null; } } } function localeWeekdaysParse(weekdayName, format2, strict) { var i, mom, regex; if (this._weekdaysParseExact) { return handleStrictParse$1.call(this, weekdayName, format2, strict); } if (!this._weekdaysParse) { this._weekdaysParse = []; this._minWeekdaysParse = []; this._shortWeekdaysParse = []; this._fullWeekdaysParse = []; } for (i = 0; i < 7; i++) { mom = createUTC([2e3, 1]).day(i); if (strict && !this._fullWeekdaysParse[i]) { this._fullWeekdaysParse[i] = new RegExp( "^" + this.weekdays(mom, "").replace(".", "\\.?") + "$", "i" ); this._shortWeekdaysParse[i] = new RegExp( "^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$", "i" ); this._minWeekdaysParse[i] = new RegExp( "^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$", "i" ); } if (!this._weekdaysParse[i]) { regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, ""); this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i"); } if (strict && format2 === "dddd" && this._fullWeekdaysParse[i].test(weekdayName)) { return i; } else if (strict && format2 === "ddd" && this._shortWeekdaysParse[i].test(weekdayName)) { return i; } else if (strict && format2 === "dd" && this._minWeekdaysParse[i].test(weekdayName)) { return i; } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { return i; } } } function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday2(input, this.localeData()); return this.add(input - day, "d"); } else { return day; } } function getSetLocaleDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; return input == null ? weekday : this.add(input - weekday, "d"); } function getSetISODayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { var weekday = parseIsoWeekday(input, this.localeData()); return this.day(this.day() % 7 ? weekday : weekday - 7); } else { return this.day() || 7; } } function weekdaysRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, "_weekdaysRegex")) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysStrictRegex; } else { return this._weekdaysRegex; } } else { if (!hasOwnProp(this, "_weekdaysRegex")) { this._weekdaysRegex = defaultWeekdaysRegex; } return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; } } function weekdaysShortRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, "_weekdaysRegex")) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysShortStrictRegex; } else { return this._weekdaysShortRegex; } } else { if (!hasOwnProp(this, "_weekdaysShortRegex")) { this._weekdaysShortRegex = defaultWeekdaysShortRegex; } return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; } } function weekdaysMinRegex(isStrict) { if (this._weekdaysParseExact) { if (!hasOwnProp(this, "_weekdaysRegex")) { computeWeekdaysParse.call(this); } if (isStrict) { return this._weekdaysMinStrictRegex; } else { return this._weekdaysMinRegex; } } else { if (!hasOwnProp(this, "_weekdaysMinRegex")) { this._weekdaysMinRegex = defaultWeekdaysMinRegex; } return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; } } function computeWeekdaysParse() { function cmpLenRev(a, b) { return b.length - a.length; } var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp; for (i = 0; i < 7; i++) { mom = createUTC([2e3, 1]).day(i); minp = regexEscape(this.weekdaysMin(mom, "")); shortp = regexEscape(this.weekdaysShort(mom, "")); longp = regexEscape(this.weekdays(mom, "")); minPieces.push(minp); shortPieces.push(shortp); longPieces.push(longp); mixedPieces.push(minp); mixedPieces.push(shortp); mixedPieces.push(longp); } minPieces.sort(cmpLenRev); shortPieces.sort(cmpLenRev); longPieces.sort(cmpLenRev); mixedPieces.sort(cmpLenRev); this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"); this._weekdaysShortRegex = this._weekdaysRegex; this._weekdaysMinRegex = this._weekdaysRegex; this._weekdaysStrictRegex = new RegExp( "^(" + longPieces.join("|") + ")", "i" ); this._weekdaysShortStrictRegex = new RegExp( "^(" + shortPieces.join("|") + ")", "i" ); this._weekdaysMinStrictRegex = new RegExp( "^(" + minPieces.join("|") + ")", "i" ); } function hFormat() { return this.hours() % 12 || 12; } function kFormat() { return this.hours() || 24; } addFormatToken("H", ["HH", 2], 0, "hour"); addFormatToken("h", ["hh", 2], 0, hFormat); addFormatToken("k", ["kk", 2], 0, kFormat); addFormatToken("hmm", 0, 0, function() { return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2); }); addFormatToken("hmmss", 0, 0, function() { return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); }); addFormatToken("Hmm", 0, 0, function() { return "" + this.hours() + zeroFill(this.minutes(), 2); }); addFormatToken("Hmmss", 0, 0, function() { return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); }); function meridiem(token2, lowercase) { addFormatToken(token2, 0, 0, function() { return this.localeData().meridiem( this.hours(), this.minutes(), lowercase ); }); } meridiem("a", true); meridiem("A", false); addUnitAlias("hour", "h"); addUnitPriority("hour", 13); function matchMeridiem(isStrict, locale2) { return locale2._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; }); addParseToken(["a", "A"], function(input, array, config) { config._isPm = config._locale.isPM(input); config._meridiem = input; }); addParseToken(["h", "hh"], function(input, array, config) { array[HOUR] = toInt(input); getParsingFlags(config).bigHour = true; }); 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; }); addParseToken("hmmss", function(input, array, config) { var pos1 = input.length - 4, 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; }); addParseToken("Hmm", function(input, array, config) { var pos = input.length - 2; array[HOUR] = toInt(input.substr(0, pos)); array[MINUTE] = toInt(input.substr(pos)); }); addParseToken("Hmmss", function(input, array, config) { var pos1 = input.length - 4, pos2 = input.length - 2; array[HOUR] = toInt(input.substr(0, pos1)); array[MINUTE] = toInt(input.substr(pos1, 2)); array[SECOND] = toInt(input.substr(pos2)); }); function localeIsPM(input) { return (input + "").toLowerCase().charAt(0) === "p"; } var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, getSetHour = makeGetSet("Hours", true); function localeMeridiem(hours2, minutes2, isLower) { if (hours2 > 11) { return isLower ? "pm" : "PM"; } else { return isLower ? "am" : "AM"; } } var baseConfig = { calendar: defaultCalendar, longDateFormat: defaultLongDateFormat, invalidDate: defaultInvalidDate, ordinal: defaultOrdinal, dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, relativeTime: defaultRelativeTime, months: defaultLocaleMonths, monthsShort: defaultLocaleMonthsShort, week: defaultLocaleWeek, weekdays: defaultLocaleWeekdays, weekdaysMin: defaultLocaleWeekdaysMin, weekdaysShort: defaultLocaleWeekdaysShort, meridiemParse: defaultLocaleMeridiemParse }; var locales = {}, localeFamilies = {}, globalLocale; function commonPrefix(arr1, arr2) { var i, minl = Math.min(arr1.length, arr2.length); for (i = 0; i < minl; i += 1) { if (arr1[i] !== arr2[i]) { return i; } } return minl; } function normalizeLocale(key) { return key ? key.toLowerCase().replace("_", "-") : key; } function chooseLocale(names) { var i = 0, j, next, locale2, split2; while (i < names.length) { split2 = normalizeLocale(names[i]).split("-"); j = split2.length; next = normalizeLocale(names[i + 1]); next = next ? next.split("-") : null; while (j > 0) { locale2 = loadLocale(split2.slice(0, j).join("-")); if (locale2) { return locale2; } if (next && next.length >= j && commonPrefix(split2, next) >= j - 1) { break; } j--; } i++; } return globalLocale; } function isLocaleNameSane(name) { return name.match("^[^/\\\\]*$") != null; } function loadLocale(name) { var oldLocale = null, aliasedRequire; if (locales[name] === void 0 && typeof module2 !== "undefined" && module2 && module2.exports && isLocaleNameSane(name)) { try { oldLocale = globalLocale._abbr; aliasedRequire = require; aliasedRequire("./locale/" + name); getSetGlobalLocale(oldLocale); } catch (e) { locales[name] = null; } } return locales[name]; } function getSetGlobalLocale(key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { globalLocale = data; } else { if (typeof console !== "undefined" && console.warn) { console.warn( "Locale " + key + " not found. Did you forget to load it?" ); } } } return globalLocale._abbr; } function defineLocale(name, config) { if (config !== null) { var locale2, parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple( "defineLocaleOverride", "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info." ); parentConfig = locales[name]._config; } else if (config.parentLocale != null) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { locale2 = loadLocale(config.parentLocale); if (locale2 != null) { parentConfig = locale2._config; } else { if (!localeFamilies[config.parentLocale]) { localeFamilies[config.parentLocale] = []; } localeFamilies[config.parentLocale].push({ name, config }); return null; } } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); if (localeFamilies[name]) { localeFamilies[name].forEach(function(x) { defineLocale(x.name, x.config); }); } getSetGlobalLocale(name); return locales[name]; } else { delete locales[name]; return null; } } function updateLocale(name, config) { if (config != null) { var locale2, tmpLocale, parentConfig = baseConfig; if (locales[name] != null && locales[name].parentLocale != null) { locales[name].set(mergeConfigs(locales[name]._config, config)); } else { tmpLocale = loadLocale(name); if (tmpLocale != null) { parentConfig = tmpLocale._config; } config = mergeConfigs(parentConfig, config); if (tmpLocale == null) { config.abbr = name; } locale2 = new Locale(config); locale2.parentLocale = locales[name]; locales[name] = locale2; } getSetGlobalLocale(name); } else { if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; if (name === getSetGlobalLocale()) { getSetGlobalLocale(name); } } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; } function getLocale(key) { var locale2; if (key && key._locale && key._locale._abbr) { key = key._locale._abbr; } if (!key) { return globalLocale; } if (!isArray2(key)) { locale2 = loadLocale(key); if (locale2) { return locale2; } key = [key]; } return chooseLocale(key); } function listLocales() { return keys(locales); } function checkOverflow(m) { var overflow, a = m._a; if (a && getParsingFlags(m).overflow === -2) { overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { overflow = DATE; } if (getParsingFlags(m)._overflowWeeks && overflow === -1) { overflow = WEEK; } if (getParsingFlags(m)._overflowWeekday && overflow === -1) { overflow = WEEKDAY; } getParsingFlags(m).overflow = overflow; } return m; } 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)?)?$/, 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)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [ ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/], ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/], ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/], ["GGGG-[W]WW", /\d{4}-W\d\d/, false], ["YYYY-DDD", /\d{4}-\d{3}/], ["YYYY-MM", /\d{4}-\d\d/, false], ["YYYYYYMMDD", /[+-]\d{10}/], ["YYYYMMDD", /\d{8}/], ["GGGG[W]WWE", /\d{4}W\d{3}/], ["GGGG[W]WW", /\d{4}W\d{2}/, false], ["YYYYDDD", /\d{7}/], ["YYYYMM", /\d{6}/, false], ["YYYY", /\d{4}/, false] ], 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/] ], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, 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}))$/, 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 }; function configFromISO(config) { var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length; if (match) { getParsingFlags(config).iso = true; for (i = 0, l = isoDatesLen; 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; } if (match[3]) { for (i = 0, l = isoTimesLen; i < l; i++) { if (isoTimes[i][1].exec(match[3])) { timeFormat = (match[2] || " ") + isoTimes[i][0]; break; } } if (timeFormat == null) { config._isValid = false; return; } } if (!allowTime && timeFormat != null) { config._isValid = false; return; } if (match[4]) { if (tzRegex.exec(match[4])) { tzFormat = "Z"; } else { config._isValid = false; return; } } config._f = dateFormat + (timeFormat || "") + (tzFormat || ""); configFromStringAndFormat(config); } else { config._isValid = false; } } 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); if (year <= 49) { return 2e3 + year; } else if (year <= 999) { return 1900 + year; } return year; } function preprocessRFC2822(s) { return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, ""); } function checkWeekday(weekdayStr, parsedInput, config) { if (weekdayStr) { var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), 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) { return 0; } else { var hm = parseInt(numOffset, 10), m = hm % 100, h = (hm - m) / 100; return h * 60 + m; } } function configFromRFC2822(config) { var match = rfc2822.exec(preprocessRFC2822(config._i)), parsedArray; if (match) { parsedArray = extractFromRFC2822Strings( match[4], match[3], match[2], match[5], match[6], match[7] ); if (!checkWeekday(match[1], parsedArray, config)) { return; } 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; } else { config._isValid = false; } } function configFromString(config) { var matched = aspNetJsonRegex.exec(config._i); if (matched !== null) { config._d = new Date(+matched[1]); return; } configFromISO(config); if (config._isValid === false) { delete config._isValid; } else { return; } configFromRFC2822(config); if (config._isValid === false) { delete config._isValid; } else { return; } if (config._strict) { config._isValid = false; } else { hooks.createFromInputFallback(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. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", function(config) { config._d = new Date(config._i + (config._useUTC ? " UTC" : "")); } ); function defaults(a, b, c) { if (a != null) { return a; } if (b != null) { return b; } return c; } function currentDateArray(config) { var nowValue = new Date(hooks.now()); if (config._useUTC) { return [ nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate() ]; } return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; } function configFromArray(config) { var i, date, input = [], currentDate, expectedWeekday, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } if (config._dayOfYear != null) { yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { getParsingFlags(config)._overflowDayOfYear = true; } date = createUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } for (; i < 7; i++) { config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i]; } if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? createUTCDate : createDate).apply( null, input ); expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } if (config._w && typeof config._w.d !== "undefined" && config._w.d !== expectedWeekday) { getParsingFlags(config).weekdayMismatch = true; } } function dayOfYearFromWeekInfo(config) { var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; w = config._w; if (w.GG != null || w.W != null || w.E != null) { dow = 1; doy = 4; weekYear = defaults( w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year ); week = defaults(w.W, 1); weekday = defaults(w.E, 1); if (weekday < 1 || weekday > 7) { weekdayOverflow = true; } } else { dow = config._locale._week.dow; doy = config._locale._week.doy; curWeek = weekOfYear(createLocal(), dow, doy); weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); week = defaults(w.w, curWeek.week); if (w.d != null) { weekday = w.d; if (weekday < 0 || weekday > 6) { weekdayOverflow = true; } } else if (w.e != null) { weekday = w.e + dow; if (w.e < 0 || w.e > 6) { weekdayOverflow = true; } } else { weekday = dow; } } if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { getParsingFlags(config)._overflowWeeks = true; } else if (weekdayOverflow != null) { getParsingFlags(config)._overflowWeekday = true; } else { temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); config._a[YEAR] = temp.year; config._dayOfYear = temp.dayOfYear; } } hooks.ISO_8601 = function() { }; hooks.RFC_2822 = function() { }; function configFromStringAndFormat(config) { if (config._f === hooks.ISO_8601) { configFromISO(config); return; } if (config._f === hooks.RFC_2822) { configFromRFC2822(config); return; } config._a = []; getParsingFlags(config).empty = true; var string = "" + config._i, i, parsedInput, tokens2, token2, skipped, stringLength = string.length, totalParsedInputLength = 0, era, tokenLen; tokens2 = expandFormat(config._f, config._locale).match(formattingTokens) || []; tokenLen = tokens2.length; for (i = 0; i < tokenLen; i++) { token2 = tokens2[i]; parsedInput = (string.match(getParseRegexForToken(token2, config)) || [])[0]; if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { getParsingFlags(config).unusedInput.push(skipped); } string = string.slice( string.indexOf(parsedInput) + parsedInput.length ); totalParsedInputLength += parsedInput.length; } if (formatTokenFunctions[token2]) { if (parsedInput) { getParsingFlags(config).empty = false; } else { getParsingFlags(config).unusedTokens.push(token2); } addTimeToArrayFromToken(token2, parsedInput, config); } else if (config._strict && !parsedInput) { getParsingFlags(config).unusedTokens.push(token2); } } getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { getParsingFlags(config).unusedInput.push(string); } if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) { getParsingFlags(config).bigHour = void 0; } getParsingFlags(config).parsedDateParts = config._a.slice(0); getParsingFlags(config).meridiem = config._meridiem; config._a[HOUR] = meridiemFixWrap( config._locale, config._a[HOUR], config._meridiem ); era = getParsingFlags(config).era; if (era !== null) { config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); } configFromArray(config); checkOverflow(config); } function meridiemFixWrap(locale2, hour, meridiem2) { var isPm; if (meridiem2 == null) { return hour; } if (locale2.meridiemHour != null) { return locale2.meridiemHour(hour, meridiem2); } else if (locale2.isPM != null) { isPm = locale2.isPM(meridiem2); if (isPm && hour < 12) { hour += 12; } if (!isPm && hour === 12) { hour = 0; } return hour; } else { return hour; } } function configFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config._f.length; if (configfLen === 0) { getParsingFlags(config).invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < configfLen; i++) { currentScore = 0; validFormatFound = false; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._f = config._f[i]; configFromStringAndFormat(tempConfig); if (isValid(tempConfig)) { validFormatFound = true; } currentScore += getParsingFlags(tempConfig).charsLeftOver; currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; getParsingFlags(tempConfig).score = currentScore; if (!bestFormatIsValid) { if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) { scoreToBeat = currentScore; bestMoment = tempConfig; if (validFormatFound) { bestFormatIsValid = true; } } } else { if (currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } } extend(config, bestMoment || tempConfig); } function configFromObject(config) { if (config._d) { return; } var i = normalizeObjectUnits(config._i), dayOrDate = i.day === void 0 ? i.date : i.day; config._a = map( [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], function(obj) { return obj && parseInt(obj, 10); } ); configFromArray(config); } function createFromConfig(config) { var res = new Moment2(checkOverflow(prepareConfig(config))); if (res._nextDay) { res.add(1, "d"); res._nextDay = void 0; } return res; } function prepareConfig(config) { var input = config._i, format2 = config._f; config._locale = config._locale || getLocale(config._l); if (input === null || format2 === void 0 && input === "") { return createInvalid({ nullInput: true }); } if (typeof input === "string") { config._i = input = config._locale.preparse(input); } if (isMoment(input)) { return new Moment2(checkOverflow(input)); } else if (isDate(input)) { config._d = input; } else if (isArray2(format2)) { configFromStringAndArray(config); } else if (format2) { configFromStringAndFormat(config); } else { configFromInput(config); } if (!isValid(config)) { config._d = null; } return config; } function configFromInput(config) { var input = config._i; if (isUndefined(input)) { config._d = new Date(hooks.now()); } else if (isDate(input)) { config._d = new Date(input.valueOf()); } else if (typeof input === "string") { configFromString(config); } else if (isArray2(input)) { config._a = map(input.slice(0), function(obj) { return parseInt(obj, 10); }); configFromArray(config); } else if (isObject(input)) { configFromObject(config); } else if (isNumber2(input)) { config._d = new Date(input); } else { hooks.createFromInputFallback(config); } } function createLocalOrUTC(input, format2, locale2, strict, isUTC) { var c = {}; if (format2 === true || format2 === false) { strict = format2; format2 = void 0; } if (locale2 === true || locale2 === false) { strict = locale2; locale2 = void 0; } if (isObject(input) && isObjectEmpty(input) || isArray2(input) && input.length === 0) { input = void 0; } c._isAMomentObject = true; c._useUTC = c._isUTC = isUTC; c._l = locale2; c._i = input; c._f = format2; c._strict = strict; return createFromConfig(c); } function createLocal(input, format2, locale2, strict) { return createLocalOrUTC(input, format2, locale2, strict, false); } var prototypeMin = deprecate( "moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", function() { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other < this ? this : other; } else { return createInvalid(); } } ), prototypeMax = deprecate( "moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", function() { var other = createLocal.apply(null, arguments); if (this.isValid() && other.isValid()) { return other > this ? this : other; } else { return createInvalid(); } } ); function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray2(moments[0])) { moments = moments[0]; } if (!moments.length) { return createLocal(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (!moments[i].isValid() || moments[i][fn](res)) { res = moments[i]; } } return res; } function min() { var args = [].slice.call(arguments, 0); return pickBy("isBefore", args); } function max() { var args = [].slice.call(arguments, 0); return pickBy("isAfter", args); } var now = function() { return Date.now ? Date.now() : +new Date(); }; var ordering = [ "year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond" ]; function isDurationValid(m) { var key, unitHasDecimal = false, i, orderLen = ordering.length; for (key in m) { if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { return false; } } for (i = 0; i < orderLen; ++i) { if (m[ordering[i]]) { if (unitHasDecimal) { return false; } if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { unitHasDecimal = true; } } } return true; } function isValid$1() { return this._isValid; } function createInvalid$1() { return createDuration(NaN); } function Duration(duration) { var normalizedInput = normalizeObjectUnits(duration), years2 = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months2 = normalizedInput.month || 0, weeks2 = normalizedInput.week || normalizedInput.isoWeek || 0, days2 = normalizedInput.day || 0, hours2 = normalizedInput.hour || 0, minutes2 = normalizedInput.minute || 0, seconds2 = normalizedInput.second || 0, milliseconds2 = normalizedInput.millisecond || 0; this._isValid = isDurationValid(normalizedInput); this._milliseconds = +milliseconds2 + seconds2 * 1e3 + minutes2 * 6e4 + hours2 * 1e3 * 60 * 60; this._days = +days2 + weeks2 * 7; this._months = +months2 + quarters * 3 + years2 * 12; this._data = {}; this._locale = getLocale(); this._bubble(); } function isDuration(obj) { return obj instanceof Duration; } function absRound(number) { if (number < 0) { return Math.round(-1 * number) * -1; } else { return Math.round(number); } } function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) { diffs++; } } return diffs + lengthDiff; } function offset(token2, separator) { addFormatToken(token2, 0, 0, function() { var offset2 = this.utcOffset(), sign2 = "+"; if (offset2 < 0) { offset2 = -offset2; sign2 = "-"; } return sign2 + zeroFill(~~(offset2 / 60), 2) + separator + zeroFill(~~offset2 % 60, 2); }); } offset("Z", ":"); offset("ZZ", ""); addRegexToken("Z", matchShortOffset); addRegexToken("ZZ", matchShortOffset); addParseToken(["Z", "ZZ"], function(input, array, config) { config._useUTC = true; config._tzm = offsetFromString(matchShortOffset, input); }); var chunkOffset = /([\+\-]|\d\d)/gi; function offsetFromString(matcher, string) { var matches = (string || "").match(matcher), chunk, parts, minutes2; if (matches === null) { return null; } chunk = matches[matches.length - 1] || []; parts = (chunk + "").match(chunkOffset) || ["-", 0, 0]; minutes2 = +(parts[1] * 60) + toInt(parts[2]); return minutes2 === 0 ? 0 : parts[0] === "+" ? minutes2 : -minutes2; } function cloneWithOffset(input, model) { var res, diff2; if (model._isUTC) { res = model.clone(); diff2 = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); res._d.setTime(res._d.valueOf() + diff2); hooks.updateOffset(res, false); return res; } else { return createLocal(input).local(); } } function getDateOffset(m) { return -Math.round(m._d.getTimezoneOffset()); } hooks.updateOffset = function() { }; function getSetOffset(input, keepLocalTime, keepMinutes) { var offset2 = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === "string") { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, "m"); } if (offset2 !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract( this, createDuration(input - offset2, "m"), 1, false ); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset2 : getDateOffset(this); } } function getSetZone(input, keepLocalTime) { if (input != null) { if (typeof input !== "string") { input = -input; } this.utcOffset(input, keepLocalTime); return this; } else { return -this.utcOffset(); } } function setOffsetToUTC(keepLocalTime) { return this.utcOffset(0, keepLocalTime); } function setOffsetToLocal(keepLocalTime) { if (this._isUTC) { this.utcOffset(0, keepLocalTime); this._isUTC = false; if (keepLocalTime) { this.subtract(getDateOffset(this), "m"); } } return this; } function setOffsetToParsedOffset() { if (this._tzm != null) { this.utcOffset(this._tzm, false, true); } else if (typeof this._i === "string") { var tZone = offsetFromString(matchOffset, this._i); if (tZone != null) { this.utcOffset(tZone); } else { this.utcOffset(0, true); } } return this; } function hasAlignedHourOffset(input) { if (!this.isValid()) { return false; } input = input ? createLocal(input).utcOffset() : 0; return (this.utcOffset() - input) % 60 === 0; } function isDaylightSavingTime() { return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset(); } function isDaylightSavingTimeShifted() { if (!isUndefined(this._isDSTShifted)) { return this._isDSTShifted; } var c = {}, other; copyConfig(c, this); c = prepareConfig(c); if (c._a) { other = c._isUTC ? createUTC(c._a) : createLocal(c._a); this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; } else { this._isDSTShifted = false; } return this._isDSTShifted; } function isLocal() { return this.isValid() ? !this._isUTC : false; } function isUtcOffset() { return this.isValid() ? this._isUTC : false; } function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; } var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; function createDuration(input, key) { var duration = input, match = null, sign2, ret, diffRes; if (isDuration(input)) { duration = { ms: input._milliseconds, d: input._days, M: input._months }; } else if (isNumber2(input) || !isNaN(+input)) { duration = {}; if (key) { duration[key] = +input; } else { duration.milliseconds = +input; } } else if (match = aspNetRegex.exec(input)) { sign2 = match[1] === "-" ? -1 : 1; duration = { y: 0, d: toInt(match[DATE]) * sign2, h: toInt(match[HOUR]) * sign2, m: toInt(match[MINUTE]) * sign2, s: toInt(match[SECOND]) * sign2, ms: toInt(absRound(match[MILLISECOND] * 1e3)) * sign2 }; } else if (match = isoRegex.exec(input)) { sign2 = match[1] === "-" ? -1 : 1; duration = { y: parseIso(match[2], sign2), M: parseIso(match[3], sign2), w: parseIso(match[4], sign2), d: parseIso(match[5], sign2), h: parseIso(match[6], sign2), m: parseIso(match[7], sign2), s: parseIso(match[8], sign2) }; } else if (duration == null) { duration = {}; } else if (typeof duration === "object" && ("from" in duration || "to" in duration)) { diffRes = momentsDifference( createLocal(duration.from), createLocal(duration.to) ); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, "_locale")) { ret._locale = input._locale; } if (isDuration(input) && hasOwnProp(input, "_isValid")) { ret._isValid = input._isValid; } return ret; } createDuration.fn = Duration.prototype; createDuration.invalid = createInvalid$1; function parseIso(inp, sign2) { var res = inp && parseFloat(inp.replace(",", ".")); return (isNaN(res) ? 0 : res) * sign2; } function positiveMomentsDifference(base, other) { var res = {}; res.months = other.month() - base.month() + (other.year() - base.year()) * 12; if (base.clone().add(res.months, "M").isAfter(other)) { --res.months; } res.milliseconds = +other - +base.clone().add(res.months, "M"); return res; } function momentsDifference(base, other) { var res; if (!(base.isValid() && other.isValid())) { return { milliseconds: 0, months: 0 }; } other = cloneWithOffset(other, base); if (base.isBefore(other)) { res = positiveMomentsDifference(base, other); } else { res = positiveMomentsDifference(other, base); res.milliseconds = -res.milliseconds; res.months = -res.months; } return res; } function createAdder(direction, name) { return function(val, period) { var dur, tmp; if (period !== null && !isNaN(+period)) { deprecateSimple( name, "moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info." ); tmp = val; val = period; period = tmp; } dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }; } function addSubtract(mom, duration, isAdding, updateOffset) { var milliseconds2 = duration._milliseconds, days2 = absRound(duration._days), months2 = absRound(duration._months); if (!mom.isValid()) { return; } updateOffset = updateOffset == null ? true : updateOffset; if (months2) { setMonth(mom, get(mom, "Month") + months2 * isAdding); } if (days2) { set$1(mom, "Date", get(mom, "Date") + days2 * isAdding); } if (milliseconds2) { mom._d.setTime(mom._d.valueOf() + milliseconds2 * isAdding); } if (updateOffset) { hooks.updateOffset(mom, days2 || months2); } } var add2 = createAdder(1, "add"), subtract = createAdder(-1, "subtract"); function isString(input) { return typeof input === "string" || input instanceof String; } function isMomentInput(input) { return isMoment(input) || isDate(input) || isString(input) || isNumber2(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === void 0; } function isMomentInputObject(input) { var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [ "years", "year", "y", "months", "month", "M", "days", "day", "d", "dates", "date", "D", "hours", "hour", "h", "minutes", "minute", "m", "seconds", "second", "s", "milliseconds", "millisecond", "ms" ], i, property, propertyLen = properties.length; for (i = 0; i < propertyLen; i += 1) { property = properties[i]; propertyTest = propertyTest || hasOwnProp(input, property); } return objectTest && propertyTest; } function isNumberOrStringArray(input) { var arrayTest = isArray2(input), dataTypeTest = false; if (arrayTest) { dataTypeTest = input.filter(function(item) { return !isNumber2(item) && isString(input); }).length === 0; } return arrayTest && dataTypeTest; } function isCalendarSpec(input) { var objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = false, properties = [ "sameDay", "nextDay", "lastDay", "nextWeek", "lastWeek", "sameElse" ], i, property; for (i = 0; i < properties.length; i += 1) { property = properties[i]; propertyTest = propertyTest || hasOwnProp(input, property); } return objectTest && propertyTest; } function getCalendarFormat(myMoment, now2) { var diff2 = myMoment.diff(now2, "days", true); return diff2 < -6 ? "sameElse" : diff2 < -1 ? "lastWeek" : diff2 < 0 ? "lastDay" : diff2 < 1 ? "sameDay" : diff2 < 2 ? "nextDay" : diff2 < 7 ? "nextWeek" : "sameElse"; } function calendar$1(time, formats) { if (arguments.length === 1) { if (!arguments[0]) { time = void 0; formats = void 0; } else if (isMomentInput(arguments[0])) { time = arguments[0]; formats = void 0; } else if (isCalendarSpec(arguments[0])) { formats = arguments[0]; time = void 0; } } var now2 = time || createLocal(), sod = cloneWithOffset(now2, this).startOf("day"), format2 = hooks.calendarFormat(this, sod) || "sameElse", output = formats && (isFunction(formats[format2]) ? formats[format2].call(this, now2) : formats[format2]); return this.format( output || this.localeData().calendar(format2, this, createLocal(now2)) ); } function clone() { return new Moment2(this); } function isAfter(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || "millisecond"; if (units === "millisecond") { return this.valueOf() > localInput.valueOf(); } else { return localInput.valueOf() < this.clone().startOf(units).valueOf(); } } function isBefore(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || "millisecond"; if (units === "millisecond") { return this.valueOf() < localInput.valueOf(); } else { return this.clone().endOf(units).valueOf() < localInput.valueOf(); } } function isBetween(from2, to2, units, inclusivity) { var localFrom = isMoment(from2) ? from2 : createLocal(from2), localTo = isMoment(to2) ? to2 : createLocal(to2); if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { return false; } inclusivity = inclusivity || "()"; return (inclusivity[0] === "(" ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ")" ? this.isBefore(localTo, units) : !this.isAfter(localTo, units)); } function isSame(input, units) { var localInput = isMoment(input) ? input : createLocal(input), inputMs; if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units) || "millisecond"; if (units === "millisecond") { return this.valueOf() === localInput.valueOf(); } else { inputMs = localInput.valueOf(); return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); } } function isSameOrAfter(input, units) { return this.isSame(input, units) || this.isAfter(input, units); } function isSameOrBefore(input, units) { return this.isSame(input, units) || this.isBefore(input, units); } function diff(input, units, asFloat) { var that, zoneDelta, output; if (!this.isValid()) { return NaN; } that = cloneWithOffset(input, this); if (!that.isValid()) { return NaN; } zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; units = normalizeUnits(units); switch (units) { case "year": output = monthDiff(this, that) / 12; break; case "month": output = monthDiff(this, that); break; case "quarter": output = monthDiff(this, that) / 3; break; case "second": output = (this - that) / 1e3; break; case "minute": output = (this - that) / 6e4; break; case "hour": output = (this - that) / 36e5; break; case "day": output = (this - that - zoneDelta) / 864e5; break; case "week": output = (this - that - zoneDelta) / 6048e5; break; default: output = this - that; } return asFloat ? output : absFloor(output); } function monthDiff(a, b) { if (a.date() < b.date()) { return -monthDiff(b, a); } var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), anchor = a.clone().add(wholeMonthDiff, "months"), anchor2, adjust; if (b - anchor < 0) { anchor2 = a.clone().add(wholeMonthDiff - 1, "months"); adjust = (b - anchor) / (anchor - anchor2); } else { anchor2 = a.clone().add(wholeMonthDiff + 1, "months"); adjust = (b - anchor) / (anchor2 - anchor); } return -(wholeMonthDiff + adjust) || 0; } hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ"; hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]"; function toString() { return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ"); } function toISOString(keepOffset) { if (!this.isValid()) { return null; } var utc = keepOffset !== true, m = utc ? this.clone().utc() : this; if (m.year() < 0 || m.year() > 9999) { return formatMoment( m, utc ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ" ); } if (isFunction(Date.prototype.toISOString)) { if (utc) { return this.toDate().toISOString(); } else { return new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", formatMoment(m, "Z")); } } return formatMoment( m, utc ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ" ); } function inspect() { if (!this.isValid()) { return "moment.invalid(/* " + this._i + " */)"; } var func = "moment", zone = "", prefix, year, datetime, suffix; if (!this.isLocal()) { func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone"; zone = "Z"; } prefix = "[" + func + '("]'; year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY"; datetime = "-MM-DD[T]HH:mm:ss.SSS"; suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); } function format(inputString) { if (!inputString) { inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; } var output = formatMoment(this, inputString); return this.localeData().postformat(output); } function from(time, withoutSuffix) { if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) { return createDuration({ to: this, from: time }).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function fromNow(withoutSuffix) { return this.from(createLocal(), withoutSuffix); } function to(time, withoutSuffix) { if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) { return createDuration({ from: this, to: time }).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } } function toNow(withoutSuffix) { return this.to(createLocal(), withoutSuffix); } function locale(key) { var newLocaleData; if (key === void 0) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } } var lang = deprecate( "moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function(key) { if (key === void 0) { return this.localeData(); } else { return this.locale(key); } } ); function localeData() { return this._locale; } var MS_PER_SECOND = 1e3, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; function mod$1(dividend, divisor) { return (dividend % divisor + divisor) % divisor; } function localStartOfDate(y, m, d) { if (y < 100 && y >= 0) { return new Date(y + 400, m, d) - MS_PER_400_YEARS; } else { return new Date(y, m, d).valueOf(); } } function utcStartOfDate(y, m, d) { if (y < 100 && y >= 0) { return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; } else { return Date.UTC(y, m, d); } } function startOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === void 0 || units === "millisecond" || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case "year": time = startOfDate(this.year(), 0, 1); break; case "quarter": time = startOfDate( this.year(), this.month() - this.month() % 3, 1 ); break; case "month": time = startOfDate(this.year(), this.month(), 1); break; case "week": time = startOfDate( this.year(), this.month(), this.date() - this.weekday() ); break; case "isoWeek": time = startOfDate( this.year(), this.month(), this.date() - (this.isoWeekday() - 1) ); break; case "day": case "date": time = startOfDate(this.year(), this.month(), this.date()); break; case "hour": time = this._d.valueOf(); time -= mod$1( time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR ); break; case "minute": time = this._d.valueOf(); time -= mod$1(time, MS_PER_MINUTE); break; case "second": time = this._d.valueOf(); time -= mod$1(time, MS_PER_SECOND); break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function endOf(units) { var time, startOfDate; units = normalizeUnits(units); if (units === void 0 || units === "millisecond" || !this.isValid()) { return this; } startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; switch (units) { case "year": time = startOfDate(this.year() + 1, 0, 1) - 1; break; case "quarter": time = startOfDate( this.year(), this.month() - this.month() % 3 + 3, 1 ) - 1; break; case "month": time = startOfDate(this.year(), this.month() + 1, 1) - 1; break; case "week": time = startOfDate( this.year(), this.month(), this.date() - this.weekday() + 7 ) - 1; break; case "isoWeek": time = startOfDate( this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7 ) - 1; break; case "day": case "date": time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; break; case "hour": time = this._d.valueOf(); time += MS_PER_HOUR - mod$1( time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR ) - 1; break; case "minute": time = this._d.valueOf(); time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; break; case "second": time = this._d.valueOf(); time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; break; } this._d.setTime(time); hooks.updateOffset(this, true); return this; } function valueOf() { return this._d.valueOf() - (this._offset || 0) * 6e4; } function unix() { return Math.floor(this.valueOf() / 1e3); } function toDate() { return new Date(this.valueOf()); } function toArray2() { var m = this; return [ m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond() ]; } function toObject() { var m = this; return { years: m.year(), months: m.month(), date: m.date(), hours: m.hours(), minutes: m.minutes(), seconds: m.seconds(), milliseconds: m.milliseconds() }; } function toJSON() { return this.isValid() ? this.toISOString() : null; } function isValid$2() { return isValid(this); } function parsingFlags() { return extend({}, getParsingFlags(this)); } function invalidAt() { return getParsingFlags(this).overflow; } function creationData() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict }; } addFormatToken("N", 0, 0, "eraAbbr"); addFormatToken("NN", 0, 0, "eraAbbr"); addFormatToken("NNN", 0, 0, "eraAbbr"); addFormatToken("NNNN", 0, 0, "eraName"); addFormatToken("NNNNN", 0, 0, "eraNarrow"); addFormatToken("y", ["y", 1], "yo", "eraYear"); addFormatToken("y", ["yy", 2], 0, "eraYear"); addFormatToken("y", ["yyy", 3], 0, "eraYear"); addFormatToken("y", ["yyyy", 4], 0, "eraYear"); addRegexToken("N", matchEraAbbr); addRegexToken("NN", matchEraAbbr); addRegexToken("NNN", matchEraAbbr); addRegexToken("NNNN", matchEraName); addRegexToken("NNNNN", matchEraNarrow); addParseToken( ["N", "NN", "NNN", "NNNN", "NNNNN"], function(input, array, config, token2) { var era = config._locale.erasParse(input, token2, config._strict); if (era) { getParsingFlags(config).era = era; } else { getParsingFlags(config).invalidEra = input; } } ); addRegexToken("y", matchUnsigned); addRegexToken("yy", matchUnsigned); addRegexToken("yyy", matchUnsigned); addRegexToken("yyyy", matchUnsigned); addRegexToken("yo", matchEraYearOrdinal); addParseToken(["y", "yy", "yyy", "yyyy"], YEAR); addParseToken(["yo"], function(input, array, config, token2) { var match; if (config._locale._eraYearOrdinalRegex) { match = input.match(config._locale._eraYearOrdinalRegex); } if (config._locale.eraYearOrdinalParse) { array[YEAR] = config._locale.eraYearOrdinalParse(input, match); } else { array[YEAR] = parseInt(input, 10); } }); function localeEras(m, format2) { var i, l, date, eras = this._eras || getLocale("en")._eras; for (i = 0, l = eras.length; i < l; ++i) { switch (typeof eras[i].since) { case "string": date = hooks(eras[i].since).startOf("day"); eras[i].since = date.valueOf(); break; } switch (typeof eras[i].until) { case "undefined": eras[i].until = Infinity; break; case "string": date = hooks(eras[i].until).startOf("day").valueOf(); eras[i].until = date.valueOf(); break; } } return eras; } function localeErasParse(eraName, format2, strict) { var i, l, eras = this.eras(), name, abbr, narrow; eraName = eraName.toUpperCase(); for (i = 0, l = eras.length; i < l; ++i) { name = eras[i].name.toUpperCase(); abbr = eras[i].abbr.toUpperCase(); narrow = eras[i].narrow.toUpperCase(); if (strict) { switch (format2) { case "N": case "NN": case "NNN": if (abbr === eraName) { return eras[i]; } break; case "NNNN": if (name === eraName) { return eras[i]; } break; case "NNNNN": if (narrow === eraName) { return eras[i]; } break; } } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { return eras[i]; } } } function localeErasConvertYear(era, year) { var dir = era.since <= era.until ? 1 : -1; if (year === void 0) { return hooks(era.since).year(); } else { return hooks(era.since).year() + (year - era.offset) * dir; } } function getEraName() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { val = this.clone().startOf("day").valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].name; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].name; } } return ""; } function getEraNarrow() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { val = this.clone().startOf("day").valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].narrow; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].narrow; } } return ""; } function getEraAbbr() { var i, l, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { val = this.clone().startOf("day").valueOf(); if (eras[i].since <= val && val <= eras[i].until) { return eras[i].abbr; } if (eras[i].until <= val && val <= eras[i].since) { return eras[i].abbr; } } return ""; } function getEraYear() { var i, l, dir, val, eras = this.localeData().eras(); for (i = 0, l = eras.length; i < l; ++i) { dir = eras[i].since <= eras[i].until ? 1 : -1; val = this.clone().startOf("day").valueOf(); if (eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) { return (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset; } } return this.year(); } function erasNameRegex(isStrict) { if (!hasOwnProp(this, "_erasNameRegex")) { computeErasParse.call(this); } return isStrict ? this._erasNameRegex : this._erasRegex; } function erasAbbrRegex(isStrict) { if (!hasOwnProp(this, "_erasAbbrRegex")) { computeErasParse.call(this); } return isStrict ? this._erasAbbrRegex : this._erasRegex; } function erasNarrowRegex(isStrict) { if (!hasOwnProp(this, "_erasNarrowRegex")) { computeErasParse.call(this); } return isStrict ? this._erasNarrowRegex : this._erasRegex; } function matchEraAbbr(isStrict, locale2) { return locale2.erasAbbrRegex(isStrict); } function matchEraName(isStrict, locale2) { return locale2.erasNameRegex(isStrict); } function matchEraNarrow(isStrict, locale2) { return locale2.erasNarrowRegex(isStrict); } function matchEraYearOrdinal(isStrict, locale2) { return locale2._eraYearOrdinalRegex || matchUnsigned; } function computeErasParse() { var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, eras = this.eras(); for (i = 0, l = eras.length; i < l; ++i) { namePieces.push(regexEscape(eras[i].name)); abbrPieces.push(regexEscape(eras[i].abbr)); narrowPieces.push(regexEscape(eras[i].narrow)); mixedPieces.push(regexEscape(eras[i].name)); mixedPieces.push(regexEscape(eras[i].abbr)); mixedPieces.push(regexEscape(eras[i].narrow)); } this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"); this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i"); this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i"); this._erasNarrowRegex = new RegExp( "^(" + narrowPieces.join("|") + ")", "i" ); } addFormatToken(0, ["gg", 2], 0, function() { return this.weekYear() % 100; }); addFormatToken(0, ["GG", 2], 0, function() { return this.isoWeekYear() % 100; }); function addWeekYearFormatToken(token2, getter) { addFormatToken(0, [token2, token2.length], 0, getter); } addWeekYearFormatToken("gggg", "weekYear"); addWeekYearFormatToken("ggggg", "weekYear"); addWeekYearFormatToken("GGGG", "isoWeekYear"); addWeekYearFormatToken("GGGGG", "isoWeekYear"); addUnitAlias("weekYear", "gg"); addUnitAlias("isoWeekYear", "GG"); addUnitPriority("weekYear", 1); addUnitPriority("isoWeekYear", 1); addRegexToken("G", matchSigned); addRegexToken("g", matchSigned); addRegexToken("GG", match1to2, match2); addRegexToken("gg", match1to2, match2); addRegexToken("GGGG", match1to4, match4); addRegexToken("gggg", match1to4, match4); addRegexToken("GGGGG", match1to6, match6); addRegexToken("ggggg", match1to6, match6); addWeekParseToken( ["gggg", "ggggg", "GGGG", "GGGGG"], function(input, week, config, token2) { week[token2.substr(0, 2)] = toInt(input); } ); addWeekParseToken(["gg", "GG"], function(input, week, config, token2) { week[token2] = hooks.parseTwoDigitYear(input); }); function getSetWeekYear(input) { return getSetWeekYearHelper.call( this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy ); } function getSetISOWeekYear(input) { return getSetWeekYearHelper.call( this, input, this.isoWeek(), this.isoWeekday(), 1, 4 ); } function getISOWeeksInYear() { return weeksInYear(this.year(), 1, 4); } function getISOWeeksInISOWeekYear() { return weeksInYear(this.isoWeekYear(), 1, 4); } function getWeeksInYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); } function getWeeksInWeekYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); } function getSetWeekYearHelper(input, week, weekday, dow, doy) { var weeksTarget; if (input == null) { return weekOfYear(this, dow, doy).year; } else { weeksTarget = weeksInYear(input, dow, doy); if (week > weeksTarget) { week = weeksTarget; } return setWeekAll.call(this, input, week, weekday, dow, doy); } } function setWeekAll(weekYear, week, weekday, dow, doy) { var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); this.year(date.getUTCFullYear()); this.month(date.getUTCMonth()); this.date(date.getUTCDate()); return this; } addFormatToken("Q", 0, "Qo", "quarter"); addUnitAlias("quarter", "Q"); addUnitPriority("quarter", 7); addRegexToken("Q", match1); addParseToken("Q", function(input, array) { array[MONTH] = (toInt(input) - 1) * 3; }); function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); } addFormatToken("D", ["DD", 2], "Do", "date"); addUnitAlias("date", "D"); addUnitPriority("date", 9); addRegexToken("D", match1to2); addRegexToken("DD", match1to2, match2); addRegexToken("Do", function(isStrict, locale2) { return isStrict ? locale2._dayOfMonthOrdinalParse || locale2._ordinalParse : locale2._dayOfMonthOrdinalParseLenient; }); addParseToken(["D", "DD"], DATE); addParseToken("Do", function(input, array) { array[DATE] = toInt(input.match(match1to2)[0]); }); var getSetDayOfMonth = makeGetSet("Date", true); addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear"); addUnitAlias("dayOfYear", "DDD"); addUnitPriority("dayOfYear", 4); addRegexToken("DDD", match1to3); addRegexToken("DDDD", match3); addParseToken(["DDD", "DDDD"], function(input, array, config) { config._dayOfYear = toInt(input); }); function getSetDayOfYear(input) { var dayOfYear = Math.round( (this.clone().startOf("day") - this.clone().startOf("year")) / 864e5 ) + 1; return input == null ? dayOfYear : this.add(input - dayOfYear, "d"); } addFormatToken("m", ["mm", 2], 0, "minute"); addUnitAlias("minute", "m"); addUnitPriority("minute", 14); addRegexToken("m", match1to2); addRegexToken("mm", match1to2, match2); addParseToken(["m", "mm"], MINUTE); var getSetMinute = makeGetSet("Minutes", false); addFormatToken("s", ["ss", 2], 0, "second"); addUnitAlias("second", "s"); addUnitPriority("second", 15); addRegexToken("s", match1to2); addRegexToken("ss", match1to2, match2); addParseToken(["s", "ss"], SECOND); var getSetSecond = makeGetSet("Seconds", false); addFormatToken("S", 0, 0, function() { return ~~(this.millisecond() / 100); }); addFormatToken(0, ["SS", 2], 0, function() { return ~~(this.millisecond() / 10); }); addFormatToken(0, ["SSS", 3], 0, "millisecond"); addFormatToken(0, ["SSSS", 4], 0, function() { return this.millisecond() * 10; }); addFormatToken(0, ["SSSSS", 5], 0, function() { return this.millisecond() * 100; }); addFormatToken(0, ["SSSSSS", 6], 0, function() { return this.millisecond() * 1e3; }); addFormatToken(0, ["SSSSSSS", 7], 0, function() { return this.millisecond() * 1e4; }); addFormatToken(0, ["SSSSSSSS", 8], 0, function() { return this.millisecond() * 1e5; }); addFormatToken(0, ["SSSSSSSSS", 9], 0, function() { return this.millisecond() * 1e6; }); addUnitAlias("millisecond", "ms"); addUnitPriority("millisecond", 16); addRegexToken("S", match1to3, match1); addRegexToken("SS", match1to3, match2); addRegexToken("SSS", match1to3, match3); var token, getSetMillisecond; for (token = "SSSS"; token.length <= 9; token += "S") { addRegexToken(token, matchUnsigned); } function parseMs(input, array) { array[MILLISECOND] = toInt(("0." + input) * 1e3); } for (token = "S"; token.length <= 9; token += "S") { addParseToken(token, parseMs); } getSetMillisecond = makeGetSet("Milliseconds", false); addFormatToken("z", 0, 0, "zoneAbbr"); addFormatToken("zz", 0, 0, "zoneName"); function getZoneAbbr() { return this._isUTC ? "UTC" : ""; } function getZoneName() { return this._isUTC ? "Coordinated Universal Time" : ""; } var proto = Moment2.prototype; proto.add = add2; proto.calendar = calendar$1; proto.clone = clone; proto.diff = diff; proto.endOf = endOf; proto.format = format; proto.from = from; proto.fromNow = fromNow; proto.to = to; proto.toNow = toNow; proto.get = stringGet; proto.invalidAt = invalidAt; proto.isAfter = isAfter; proto.isBefore = isBefore; proto.isBetween = isBetween; proto.isSame = isSame; proto.isSameOrAfter = isSameOrAfter; proto.isSameOrBefore = isSameOrBefore; proto.isValid = isValid$2; proto.lang = lang; proto.locale = locale; proto.localeData = localeData; proto.max = prototypeMax; proto.min = prototypeMin; proto.parsingFlags = parsingFlags; proto.set = stringSet; proto.startOf = startOf; proto.subtract = subtract; proto.toArray = toArray2; proto.toObject = toObject; proto.toDate = toDate; proto.toISOString = toISOString; proto.inspect = inspect; if (typeof Symbol !== "undefined" && Symbol.for != null) { proto[Symbol.for("nodejs.util.inspect.custom")] = function() { return "Moment<" + this.format() + ">"; }; } proto.toJSON = toJSON; proto.toString = toString; proto.unix = unix; proto.valueOf = valueOf; proto.creationData = creationData; proto.eraName = getEraName; proto.eraNarrow = getEraNarrow; proto.eraAbbr = getEraAbbr; proto.eraYear = getEraYear; proto.year = getSetYear; proto.isLeapYear = getIsLeapYear; proto.weekYear = getSetWeekYear; proto.isoWeekYear = getSetISOWeekYear; proto.quarter = proto.quarters = getSetQuarter; proto.month = getSetMonth; proto.daysInMonth = getDaysInMonth; proto.week = proto.weeks = getSetWeek; proto.isoWeek = proto.isoWeeks = getSetISOWeek; proto.weeksInYear = getWeeksInYear; proto.weeksInWeekYear = getWeeksInWeekYear; proto.isoWeeksInYear = getISOWeeksInYear; proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; proto.date = getSetDayOfMonth; proto.day = proto.days = getSetDayOfWeek; proto.weekday = getSetLocaleDayOfWeek; proto.isoWeekday = getSetISODayOfWeek; proto.dayOfYear = getSetDayOfYear; proto.hour = proto.hours = getSetHour; proto.minute = proto.minutes = getSetMinute; proto.second = proto.seconds = getSetSecond; proto.millisecond = proto.milliseconds = getSetMillisecond; proto.utcOffset = getSetOffset; proto.utc = setOffsetToUTC; proto.local = setOffsetToLocal; proto.parseZone = setOffsetToParsedOffset; proto.hasAlignedHourOffset = hasAlignedHourOffset; proto.isDST = isDaylightSavingTime; proto.isLocal = isLocal; proto.isUtcOffset = isUtcOffset; proto.isUtc = isUtc; proto.isUTC = isUtc; proto.zoneAbbr = getZoneAbbr; proto.zoneName = getZoneName; proto.dates = deprecate( "dates accessor is deprecated. Use date instead.", getSetDayOfMonth ); proto.months = deprecate( "months accessor is deprecated. Use month instead", getSetMonth ); proto.years = deprecate( "years accessor is deprecated. Use year instead", getSetYear ); proto.zone = deprecate( "moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", getSetZone ); proto.isDSTShifted = deprecate( "isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", isDaylightSavingTimeShifted ); function createUnix(input) { return createLocal(input * 1e3); } function createInZone() { return createLocal.apply(null, arguments).parseZone(); } function preParsePostFormat(string) { return string; } var proto$1 = Locale.prototype; proto$1.calendar = calendar; proto$1.longDateFormat = longDateFormat; proto$1.invalidDate = invalidDate; proto$1.ordinal = ordinal; proto$1.preparse = preParsePostFormat; proto$1.postformat = preParsePostFormat; proto$1.relativeTime = relativeTime; proto$1.pastFuture = pastFuture; proto$1.set = set; proto$1.eras = localeEras; proto$1.erasParse = localeErasParse; proto$1.erasConvertYear = localeErasConvertYear; proto$1.erasAbbrRegex = erasAbbrRegex; proto$1.erasNameRegex = erasNameRegex; proto$1.erasNarrowRegex = erasNarrowRegex; proto$1.months = localeMonths; proto$1.monthsShort = localeMonthsShort; proto$1.monthsParse = localeMonthsParse; proto$1.monthsRegex = monthsRegex; proto$1.monthsShortRegex = monthsShortRegex; proto$1.week = localeWeek; proto$1.firstDayOfYear = localeFirstDayOfYear; proto$1.firstDayOfWeek = localeFirstDayOfWeek; proto$1.weekdays = localeWeekdays; proto$1.weekdaysMin = localeWeekdaysMin; proto$1.weekdaysShort = localeWeekdaysShort; proto$1.weekdaysParse = localeWeekdaysParse; proto$1.weekdaysRegex = weekdaysRegex; proto$1.weekdaysShortRegex = weekdaysShortRegex; proto$1.weekdaysMinRegex = weekdaysMinRegex; proto$1.isPM = localeIsPM; proto$1.meridiem = localeMeridiem; function get$1(format2, index, field, setter) { var locale2 = getLocale(), utc = createUTC().set(setter, index); return locale2[field](utc, format2); } function listMonthsImpl(format2, index, field) { if (isNumber2(format2)) { index = format2; format2 = void 0; } format2 = format2 || ""; if (index != null) { return get$1(format2, index, field, "month"); } var i, out = []; for (i = 0; i < 12; i++) { out[i] = get$1(format2, i, field, "month"); } return out; } function listWeekdaysImpl(localeSorted, format2, index, field) { if (typeof localeSorted === "boolean") { if (isNumber2(format2)) { index = format2; format2 = void 0; } format2 = format2 || ""; } else { format2 = localeSorted; index = format2; localeSorted = false; if (isNumber2(format2)) { index = format2; format2 = void 0; } format2 = format2 || ""; } var locale2 = getLocale(), shift = localeSorted ? locale2._week.dow : 0, i, out = []; if (index != null) { return get$1(format2, (index + shift) % 7, field, "day"); } for (i = 0; i < 7; i++) { out[i] = get$1(format2, (i + shift) % 7, field, "day"); } return out; } function listMonths(format2, index) { return listMonthsImpl(format2, index, "months"); } function listMonthsShort(format2, index) { return listMonthsImpl(format2, index, "monthsShort"); } function listWeekdays(localeSorted, format2, index) { return listWeekdaysImpl(localeSorted, format2, index, "weekdays"); } function listWeekdaysShort(localeSorted, format2, index) { return listWeekdaysImpl(localeSorted, format2, index, "weekdaysShort"); } function listWeekdaysMin(localeSorted, format2, index) { return listWeekdaysImpl(localeSorted, format2, index, "weekdaysMin"); } getSetGlobalLocale("en", { eras: [ { since: "0001-01-01", until: Infinity, offset: 1, name: "Anno Domini", narrow: "AD", abbr: "AD" }, { since: "0000-12-31", until: -Infinity, offset: 1, name: "Before Christ", narrow: "BC", abbr: "BC" } ], dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: function(number) { var b = number % 10, output = toInt(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th"; return number + output; } }); hooks.lang = deprecate( "moment.lang is deprecated. Use moment.locale instead.", getSetGlobalLocale ); hooks.langData = deprecate( "moment.langData is deprecated. Use moment.localeData instead.", getLocale ); var mathAbs = Math.abs; function 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.months = mathAbs(data.months); data.years = mathAbs(data.years); return this; } function addSubtract$1(duration, input, value, direction) { var other = createDuration(input, value); duration._milliseconds += direction * other._milliseconds; duration._days += direction * other._days; duration._months += direction * other._months; return duration._bubble(); } function add$1(input, value) { return addSubtract$1(this, input, value, 1); } function subtract$1(input, value) { return addSubtract$1(this, input, value, -1); } function absCeil(number) { if (number < 0) { return Math.floor(number); } else { return Math.ceil(number); } } function bubble() { var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data = this._data, seconds2, minutes2, hours2, years2, monthsFromDays; if (!(milliseconds2 >= 0 && days2 >= 0 && months2 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months2 <= 0)) { milliseconds2 += absCeil(monthsToDays(months2) + days2) * 864e5; days2 = 0; months2 = 0; } data.milliseconds = milliseconds2 % 1e3; seconds2 = absFloor(milliseconds2 / 1e3); data.seconds = seconds2 % 60; minutes2 = absFloor(seconds2 / 60); data.minutes = minutes2 % 60; hours2 = absFloor(minutes2 / 60); data.hours = hours2 % 24; days2 += absFloor(hours2 / 24); monthsFromDays = absFloor(daysToMonths(days2)); months2 += monthsFromDays; days2 -= absCeil(monthsToDays(monthsFromDays)); years2 = absFloor(months2 / 12); months2 %= 12; data.days = days2; data.months = months2; data.years = years2; return this; } function daysToMonths(days2) { return days2 * 4800 / 146097; } function monthsToDays(months2) { return months2 * 146097 / 4800; } function as(units) { if (!this.isValid()) { return NaN; } var days2, months2, milliseconds2 = this._milliseconds; units = normalizeUnits(units); if (units === "month" || units === "quarter" || units === "year") { days2 = this._days + milliseconds2 / 864e5; months2 = this._months + daysToMonths(days2); switch (units) { case "month": return months2; case "quarter": return months2 / 3; case "year": return months2 / 12; } } else { days2 = this._days + Math.round(monthsToDays(this._months)); switch (units) { case "week": return days2 / 7 + milliseconds2 / 6048e5; case "day": return days2 + milliseconds2 / 864e5; case "hour": return days2 * 24 + milliseconds2 / 36e5; case "minute": return days2 * 1440 + milliseconds2 / 6e4; case "second": return days2 * 86400 + milliseconds2 / 1e3; case "millisecond": return Math.floor(days2 * 864e5) + milliseconds2; default: throw new Error("Unknown unit " + units); } } } function valueOf$1() { if (!this.isValid()) { return NaN; } return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6; } function makeAs(alias) { return function() { return this.as(alias); }; } var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asQuarters = makeAs("Q"), asYears = makeAs("y"); function clone$1() { return createDuration(this); } function get$2(units) { units = normalizeUnits(units); return this.isValid() ? this[units + "s"]() : NaN; } function makeGetter(name) { return function() { return this.isValid() ? this._data[name] : NaN; }; } var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years"); function weeks() { return absFloor(this.days() / 7); } var round = Math.round, thresholds = { ss: 44, s: 45, m: 45, h: 22, d: 26, w: null, M: 11 }; function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale2) { return locale2.relativeTime(number || 1, !!withoutSuffix, string, isFuture); } function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale2) { var duration = createDuration(posNegDuration).abs(), seconds2 = round(duration.as("s")), minutes2 = round(duration.as("m")), hours2 = round(duration.as("h")), days2 = round(duration.as("d")), months2 = round(duration.as("M")), weeks2 = round(duration.as("w")), years2 = round(duration.as("y")), a = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2]; if (thresholds2.w != null) { a = a || weeks2 <= 1 && ["w"] || weeks2 < thresholds2.w && ["ww", weeks2]; } a = a || months2 <= 1 && ["M"] || months2 < thresholds2.M && ["MM", months2] || years2 <= 1 && ["y"] || ["yy", years2]; a[2] = withoutSuffix; a[3] = +posNegDuration > 0; a[4] = locale2; return substituteTimeAgo.apply(null, a); } function getSetRelativeTimeRounding(roundingFunction) { if (roundingFunction === void 0) { return round; } if (typeof roundingFunction === "function") { round = roundingFunction; return true; } return false; } function getSetRelativeTimeThreshold(threshold, limit) { if (thresholds[threshold] === void 0) { return false; } if (limit === void 0) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === "s") { thresholds.ss = limit - 1; } return true; } function humanize(argWithSuffix, argThresholds) { if (!this.isValid()) { return this.localeData().invalidDate(); } var withSuffix = false, th = thresholds, locale2, output; if (typeof argWithSuffix === "object") { argThresholds = argWithSuffix; argWithSuffix = false; } if (typeof argWithSuffix === "boolean") { withSuffix = argWithSuffix; } if (typeof argThresholds === "object") { th = Object.assign({}, thresholds, argThresholds); if (argThresholds.s != null && argThresholds.ss == null) { th.ss = argThresholds.s - 1; } } locale2 = this.localeData(); output = relativeTime$1(this, !withSuffix, th, locale2); if (withSuffix) { output = locale2.pastFuture(+this, output); } return locale2.postformat(output); } var abs$1 = Math.abs; function sign(x) { return (x > 0) - (x < 0) || +x; } function toISOString$1() { if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds2 = abs$1(this._milliseconds) / 1e3, days2 = abs$1(this._days), months2 = abs$1(this._months), minutes2, hours2, years2, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign; if (!total) { return "P0D"; } minutes2 = absFloor(seconds2 / 60); hours2 = absFloor(minutes2 / 60); seconds2 %= 60; minutes2 %= 60; years2 = absFloor(months2 / 12); months2 %= 12; s = seconds2 ? seconds2.toFixed(3).replace(/\.?0+$/, "") : ""; totalSign = total < 0 ? "-" : ""; ymSign = sign(this._months) !== sign(total) ? "-" : ""; daysSign = sign(this._days) !== sign(total) ? "-" : ""; hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : ""; return totalSign + "P" + (years2 ? ymSign + years2 + "Y" : "") + (months2 ? ymSign + months2 + "M" : "") + (days2 ? daysSign + days2 + "D" : "") + (hours2 || minutes2 || seconds2 ? "T" : "") + (hours2 ? hmsSign + hours2 + "H" : "") + (minutes2 ? hmsSign + minutes2 + "M" : "") + (seconds2 ? hmsSign + s + "S" : ""); } var proto$2 = Duration.prototype; proto$2.isValid = isValid$1; proto$2.abs = abs; proto$2.add = add$1; proto$2.subtract = subtract$1; proto$2.as = as; proto$2.asMilliseconds = asMilliseconds; proto$2.asSeconds = asSeconds; proto$2.asMinutes = asMinutes; proto$2.asHours = asHours; proto$2.asDays = asDays; proto$2.asWeeks = asWeeks; proto$2.asMonths = asMonths; proto$2.asQuarters = asQuarters; proto$2.asYears = asYears; proto$2.valueOf = valueOf$1; proto$2._bubble = bubble; proto$2.clone = clone$1; proto$2.get = get$2; proto$2.milliseconds = milliseconds; proto$2.seconds = seconds; proto$2.minutes = minutes; proto$2.hours = hours; proto$2.days = days; proto$2.weeks = weeks; proto$2.months = months; proto$2.years = years; proto$2.humanize = humanize; proto$2.toISOString = toISOString$1; proto$2.toString = toISOString$1; proto$2.toJSON = toISOString$1; proto$2.locale = locale; proto$2.localeData = localeData; proto$2.toIsoString = deprecate( "toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", toISOString$1 ); proto$2.lang = lang; addFormatToken("X", 0, 0, "unix"); addFormatToken("x", 0, 0, "valueOf"); addRegexToken("x", matchSigned); addRegexToken("X", matchTimestamp); addParseToken("X", function(input, array, config) { config._d = new Date(parseFloat(input) * 1e3); }); addParseToken("x", function(input, array, config) { config._d = new Date(toInt(input)); }); hooks.version = "2.29.4"; setHookCallback(createLocal); hooks.fn = proto; hooks.min = min; hooks.max = max; hooks.now = now; hooks.utc = createUTC; hooks.unix = createUnix; hooks.months = listMonths; hooks.isDate = isDate; hooks.locale = getSetGlobalLocale; hooks.invalid = createInvalid; hooks.duration = createDuration; hooks.isMoment = isMoment; hooks.weekdays = listWeekdays; hooks.parseZone = createInZone; hooks.localeData = getLocale; hooks.isDuration = isDuration; hooks.monthsShort = listMonthsShort; hooks.weekdaysMin = listWeekdaysMin; hooks.defineLocale = defineLocale; hooks.updateLocale = updateLocale; hooks.locales = listLocales; hooks.weekdaysShort = listWeekdaysShort; hooks.normalizeUnits = normalizeUnits; hooks.relativeTimeRounding = getSetRelativeTimeRounding; hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; hooks.calendarFormat = getCalendarFormat; hooks.prototype = proto; hooks.HTML5_FMT = { DATETIME_LOCAL: "YYYY-MM-DDTHH:mm", DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss", DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS", DATE: "YYYY-MM-DD", TIME: "HH:mm", TIME_SECONDS: "HH:mm:ss", TIME_MS: "HH:mm:ss.SSS", WEEK: "GGGG-[W]WW", MONTH: "YYYY-MM" }; return hooks; }); } }); // node_modules/rrule/node_modules/tslib/tslib.js var require_tslib = __commonJS({ "node_modules/rrule/node_modules/tslib/tslib.js"(exports, module2) { var __extends2; var __assign2; var __rest2; var __decorate2; var __param2; var __metadata2; var __awaiter2; var __generator2; var __exportStar2; var __values2; var __read2; var __spread2; var __spreadArrays2; var __await2; var __asyncGenerator2; var __asyncDelegator2; var __asyncValues2; var __makeTemplateObject2; var __importStar2; var __importDefault2; var __classPrivateFieldGet2; var __classPrivateFieldSet2; var __createBinding2; (function(factory) { var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; if (typeof define === "function" && define.amd) { define("tslib", ["exports"], function(exports2) { factory(createExporter(root, createExporter(exports2))); }); } else if (typeof module2 === "object" && typeof module2.exports === "object") { factory(createExporter(root, createExporter(module2.exports))); } else { factory(createExporter(root)); } function createExporter(exports2, previous) { if (exports2 !== root) { if (typeof Object.create === "function") { Object.defineProperty(exports2, "__esModule", { value: true }); } else { exports2.__esModule = true; } } return function(id, v) { return exports2[id] = previous ? previous(id, v) : v; }; } })(function(exporter) { var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) { d.__proto__ = b; } || function(d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; __extends2 = function(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; __assign2 = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; __rest2 = function(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; __decorate2 = function(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; __param2 = function(paramIndex, decorator) { return function(target, key) { decorator(target, key, paramIndex); }; }; __metadata2 = function(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); }; __awaiter2 = function(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); }); } return new (P || (P = Promise))(function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; __generator2 = function(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function(v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; __createBinding2 = function(o, m, k, k2) { if (k2 === void 0) k2 = k; o[k2] = m[k]; }; __exportStar2 = function(m, exports2) { for (var p in m) if (p !== "default" && !exports2.hasOwnProperty(p)) exports2[p] = m[p]; }; __values2 = function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function() { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; __read2 = function(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; __spread2 = function() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read2(arguments[i])); return ar; }; __spreadArrays2 = function() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; __await2 = function(v) { return this instanceof __await2 ? (this.v = v, this) : new __await2(v); }; __asyncGenerator2 = function(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { return this; }, i; function verb(n) { if (g[n]) i[n] = function(v) { return new Promise(function(a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await2 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; __asyncDelegator2 = function(o) { var i, p; return i = {}, verb("next"), verb("throw", function(e) { throw e; }), verb("return"), i[Symbol.iterator] = function() { return this; }, i; function verb(n, f) { i[n] = o[n] ? function(v) { return (p = !p) ? { value: __await2(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } }; __asyncValues2 = function(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values2 === "function" ? __values2(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { return this; }, i); function verb(n) { i[n] = o[n] && function(v) { return new Promise(function(resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v2) { resolve({ value: v2, done: d }); }, reject); } }; __makeTemplateObject2 = function(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; __importStar2 = function(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) { for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; } result["default"] = mod; return result; }; __importDefault2 = function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; __classPrivateFieldGet2 = function(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); }; __classPrivateFieldSet2 = function(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; }; exporter("__extends", __extends2); exporter("__assign", __assign2); exporter("__rest", __rest2); exporter("__decorate", __decorate2); exporter("__param", __param2); exporter("__metadata", __metadata2); exporter("__awaiter", __awaiter2); exporter("__generator", __generator2); exporter("__exportStar", __exportStar2); exporter("__createBinding", __createBinding2); exporter("__values", __values2); exporter("__read", __read2); exporter("__spread", __spread2); exporter("__spreadArrays", __spreadArrays2); exporter("__await", __await2); exporter("__asyncGenerator", __asyncGenerator2); exporter("__asyncDelegator", __asyncDelegator2); exporter("__asyncValues", __asyncValues2); exporter("__makeTemplateObject", __makeTemplateObject2); exporter("__importStar", __importStar2); exporter("__importDefault", __importDefault2); exporter("__classPrivateFieldGet", __classPrivateFieldGet2); exporter("__classPrivateFieldSet", __classPrivateFieldSet2); }); } }); // node_modules/luxon/build/cjs-browser/luxon.js var require_luxon = __commonJS({ "node_modules/luxon/build/cjs-browser/luxon.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) { return o2.__proto__ || Object.getPrototypeOf(o2); }; return _getPrototypeOf(o); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { o2.__proto__ = p2; return o2; }; return _setPrototypeOf(o, p); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function() { })); return true; } catch (e) { return false; } } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct2(Parent2, args2, Class2) { var a = [null]; a.push.apply(a, args2); var Constructor = Function.bind.apply(Parent2, a); var instance8 = new Constructor(); if (Class2) _setPrototypeOf(instance8, Class2.prototype); return instance8; }; } return _construct.apply(null, arguments); } function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; _wrapNativeSuper = function _wrapNativeSuper2(Class2) { if (Class2 === null || !_isNativeFunction(Class2)) return Class2; if (typeof Class2 !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class2)) return _cache.get(Class2); _cache.set(Class2, Wrapper); } function Wrapper() { return _construct(Class2, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class2.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class2); }; return _wrapNativeSuper(Class); } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n2 = Object.prototype.toString.call(o).slice(8, -1); if (n2 === "Object" && o.constructor) n2 = o.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(n2); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _createForOfIteratorHelperLoose(o) { var i = 0; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) return function() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } i = o[Symbol.iterator](); return i.next.bind(i); } var LuxonError = /* @__PURE__ */ function(_Error) { _inheritsLoose(LuxonError2, _Error); function LuxonError2() { return _Error.apply(this, arguments) || this; } return LuxonError2; }(/* @__PURE__ */ _wrapNativeSuper(Error)); var InvalidDateTimeError = /* @__PURE__ */ function(_LuxonError) { _inheritsLoose(InvalidDateTimeError2, _LuxonError); function InvalidDateTimeError2(reason) { return _LuxonError.call(this, "Invalid DateTime: " + reason.toMessage()) || this; } return InvalidDateTimeError2; }(LuxonError); var InvalidIntervalError = /* @__PURE__ */ function(_LuxonError2) { _inheritsLoose(InvalidIntervalError2, _LuxonError2); function InvalidIntervalError2(reason) { return _LuxonError2.call(this, "Invalid Interval: " + reason.toMessage()) || this; } return InvalidIntervalError2; }(LuxonError); var InvalidDurationError = /* @__PURE__ */ function(_LuxonError3) { _inheritsLoose(InvalidDurationError2, _LuxonError3); function InvalidDurationError2(reason) { return _LuxonError3.call(this, "Invalid Duration: " + reason.toMessage()) || this; } return InvalidDurationError2; }(LuxonError); var ConflictingSpecificationError = /* @__PURE__ */ function(_LuxonError4) { _inheritsLoose(ConflictingSpecificationError2, _LuxonError4); function ConflictingSpecificationError2() { return _LuxonError4.apply(this, arguments) || this; } return ConflictingSpecificationError2; }(LuxonError); var InvalidUnitError = /* @__PURE__ */ function(_LuxonError5) { _inheritsLoose(InvalidUnitError2, _LuxonError5); function InvalidUnitError2(unit) { return _LuxonError5.call(this, "Invalid unit " + unit) || this; } return InvalidUnitError2; }(LuxonError); var InvalidArgumentError = /* @__PURE__ */ function(_LuxonError6) { _inheritsLoose(InvalidArgumentError2, _LuxonError6); function InvalidArgumentError2() { return _LuxonError6.apply(this, arguments) || this; } return InvalidArgumentError2; }(LuxonError); var ZoneIsAbstractError = /* @__PURE__ */ function(_LuxonError7) { _inheritsLoose(ZoneIsAbstractError2, _LuxonError7); function ZoneIsAbstractError2() { return _LuxonError7.call(this, "Zone is an abstract class") || this; } return ZoneIsAbstractError2; }(LuxonError); var n = "numeric"; var s = "short"; var l = "long"; var DATE_SHORT = { year: n, month: n, day: n }; var DATE_MED = { year: n, month: s, day: n }; var DATE_MED_WITH_WEEKDAY = { year: n, month: s, day: n, weekday: s }; var DATE_FULL = { year: n, month: l, day: n }; var DATE_HUGE = { year: n, month: l, day: n, weekday: l }; var TIME_SIMPLE = { hour: n, minute: n }; var TIME_WITH_SECONDS = { hour: n, minute: n, second: n }; var TIME_WITH_SHORT_OFFSET = { hour: n, minute: n, second: n, timeZoneName: s }; var TIME_WITH_LONG_OFFSET = { hour: n, minute: n, second: n, timeZoneName: l }; var TIME_24_SIMPLE = { hour: n, minute: n, hour12: false }; var TIME_24_WITH_SECONDS = { hour: n, minute: n, second: n, hour12: false }; var TIME_24_WITH_SHORT_OFFSET = { hour: n, minute: n, second: n, hour12: false, timeZoneName: s }; var TIME_24_WITH_LONG_OFFSET = { hour: n, minute: n, second: n, hour12: false, timeZoneName: l }; var DATETIME_SHORT = { year: n, month: n, day: n, hour: n, minute: n }; var DATETIME_SHORT_WITH_SECONDS = { year: n, month: n, day: n, hour: n, minute: n, second: n }; var DATETIME_MED = { year: n, month: s, day: n, hour: n, minute: n }; var DATETIME_MED_WITH_SECONDS = { year: n, month: s, day: n, hour: n, minute: n, second: n }; var DATETIME_MED_WITH_WEEKDAY = { year: n, month: s, day: n, weekday: s, hour: n, minute: n }; var DATETIME_FULL = { year: n, month: l, day: n, hour: n, minute: n, timeZoneName: s }; var DATETIME_FULL_WITH_SECONDS = { year: n, month: l, day: n, hour: n, minute: n, second: n, timeZoneName: s }; var DATETIME_HUGE = { year: n, month: l, day: n, weekday: l, hour: n, minute: n, timeZoneName: l }; var DATETIME_HUGE_WITH_SECONDS = { year: n, month: l, day: n, weekday: l, hour: n, minute: n, second: n, timeZoneName: l }; function isUndefined(o) { return typeof o === "undefined"; } function isNumber2(o) { return typeof o === "number"; } function isInteger(o) { return typeof o === "number" && o % 1 === 0; } function isString(o) { return typeof o === "string"; } function isDate(o) { return Object.prototype.toString.call(o) === "[object Date]"; } function hasIntl() { try { return typeof Intl !== "undefined" && Intl.DateTimeFormat; } catch (e) { return false; } } function hasFormatToParts() { return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts); } function hasRelative() { try { return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; } catch (e) { return false; } } function maybeArray(thing) { return Array.isArray(thing) ? thing : [thing]; } function bestBy(arr, by, compare) { if (arr.length === 0) { return void 0; } return arr.reduce(function(best, next) { var pair = [by(next), next]; if (!best) { return pair; } else if (compare(best[0], pair[0]) === best[0]) { return best; } else { return pair; } }, null)[1]; } function pick(obj, keys) { return keys.reduce(function(a, k) { a[k] = obj[k]; return a; }, {}); } function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } function integerBetween(thing, bottom, top) { return isInteger(thing) && thing >= bottom && thing <= top; } function floorMod(x, n2) { return x - n2 * Math.floor(x / n2); } function padStart2(input, n2) { if (n2 === void 0) { n2 = 2; } var minus = input < 0 ? "-" : ""; var target = minus ? input * -1 : input; var result; if (target.toString().length < n2) { result = ("0".repeat(n2) + target).slice(-n2); } else { result = target.toString(); } return "" + minus + result; } function parseInteger(string) { if (isUndefined(string) || string === null || string === "") { return void 0; } else { return parseInt(string, 10); } } function parseMillis(fraction) { if (isUndefined(fraction) || fraction === null || fraction === "") { return void 0; } else { var f = parseFloat("0." + fraction) * 1e3; return Math.floor(f); } } function roundTo(number, digits, towardZero) { if (towardZero === void 0) { towardZero = false; } var factor = Math.pow(10, digits), rounder = towardZero ? Math.trunc : Math.round; return rounder(number * factor) / factor; } function isLeapYear(year) { return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); } function daysInYear(year) { return isLeapYear(year) ? 366 : 365; } function daysInMonth(year, month) { var modMonth = floorMod(month - 1, 12) + 1, modYear = year + (month - modMonth) / 12; if (modMonth === 2) { return isLeapYear(modYear) ? 29 : 28; } else { return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; } } function objToLocalTS(obj) { var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); if (obj.year < 100 && obj.year >= 0) { d = new Date(d); d.setUTCFullYear(d.getUTCFullYear() - 1900); } return +d; } function weeksInWeekYear(weekYear) { var p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, last = weekYear - 1, p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7; return p1 === 4 || p2 === 3 ? 53 : 52; } function untruncateYear(year) { if (year > 99) { return year; } else return year > 60 ? 1900 + year : 2e3 + year; } function parseZoneInfo(ts, offsetFormat, locale, timeZone) { if (timeZone === void 0) { timeZone = null; } var date = new Date(ts), intlOpts = { hour12: false, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }; if (timeZone) { intlOpts.timeZone = timeZone; } var modified = Object.assign({ timeZoneName: offsetFormat }, intlOpts), intl = hasIntl(); if (intl && hasFormatToParts()) { var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function(m) { return m.type.toLowerCase() === "timezonename"; }); return parsed ? parsed.value : null; } else if (intl) { var without = new Intl.DateTimeFormat(locale, intlOpts).format(date), included = new Intl.DateTimeFormat(locale, modified).format(date), diffed = included.substring(without.length), trimmed = diffed.replace(/^[, \u200e]+/, ""); return trimmed; } else { return null; } } function signedOffset(offHourStr, offMinuteStr) { var offHour = parseInt(offHourStr, 10); if (Number.isNaN(offHour)) { offHour = 0; } var offMin = parseInt(offMinuteStr, 10) || 0, offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; return offHour * 60 + offMinSigned; } function asNumber(value) { var numericValue = Number(value); if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) throw new InvalidArgumentError("Invalid unit value " + value); return numericValue; } function normalizeObject(obj, normalizer, nonUnitKeys) { var normalized = {}; for (var u in obj) { if (hasOwnProperty(obj, u)) { if (nonUnitKeys.indexOf(u) >= 0) continue; var v = obj[u]; if (v === void 0 || v === null) continue; normalized[normalizer(u)] = asNumber(v); } } return normalized; } function formatOffset(offset2, format) { var hours = Math.trunc(Math.abs(offset2 / 60)), minutes = Math.trunc(Math.abs(offset2 % 60)), sign = offset2 >= 0 ? "+" : "-"; switch (format) { case "short": return "" + sign + padStart2(hours, 2) + ":" + padStart2(minutes, 2); case "narrow": return "" + sign + hours + (minutes > 0 ? ":" + minutes : ""); case "techie": return "" + sign + padStart2(hours, 2) + padStart2(minutes, 2); default: throw new RangeError("Value format " + format + " is out of range for property format"); } } function timeObject(obj) { return pick(obj, ["hour", "minute", "second", "millisecond"]); } var ianaRegex = /[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/; function stringify(obj) { return JSON.stringify(obj, Object.keys(obj).sort()); } var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; function months(length) { switch (length) { case "narrow": return [].concat(monthsNarrow); case "short": return [].concat(monthsShort); case "long": return [].concat(monthsLong); case "numeric": return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; case "2-digit": return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; default: return null; } } var weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; function weekdays(length) { switch (length) { case "narrow": return [].concat(weekdaysNarrow); case "short": return [].concat(weekdaysShort); case "long": return [].concat(weekdaysLong); case "numeric": return ["1", "2", "3", "4", "5", "6", "7"]; default: return null; } } var meridiems = ["AM", "PM"]; var erasLong = ["Before Christ", "Anno Domini"]; var erasShort = ["BC", "AD"]; var erasNarrow = ["B", "A"]; function eras(length) { switch (length) { case "narrow": return [].concat(erasNarrow); case "short": return [].concat(erasShort); case "long": return [].concat(erasLong); default: return null; } } function meridiemForDateTime(dt) { return meridiems[dt.hour < 12 ? 0 : 1]; } function weekdayForDateTime(dt, length) { return weekdays(length)[dt.weekday - 1]; } function monthForDateTime(dt, length) { return months(length)[dt.month - 1]; } function eraForDateTime(dt, length) { return eras(length)[dt.year < 0 ? 0 : 1]; } function formatRelativeTime(unit, count, numeric, narrow) { if (numeric === void 0) { numeric = "always"; } if (narrow === void 0) { narrow = false; } var units = { years: ["year", "yr."], quarters: ["quarter", "qtr."], months: ["month", "mo."], weeks: ["week", "wk."], days: ["day", "day", "days"], hours: ["hour", "hr."], minutes: ["minute", "min."], seconds: ["second", "sec."] }; var lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; if (numeric === "auto" && lastable) { var isDay = unit === "days"; switch (count) { case 1: return isDay ? "tomorrow" : "next " + units[unit][0]; case -1: return isDay ? "yesterday" : "last " + units[unit][0]; case 0: return isDay ? "today" : "this " + units[unit][0]; } } var isInPast = Object.is(count, -0) || count < 0, fmtValue = Math.abs(count), singular = fmtValue === 1, lilUnits = units[unit], fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; return isInPast ? fmtValue + " " + fmtUnit + " ago" : "in " + fmtValue + " " + fmtUnit; } function formatString(knownFormat) { var filtered = pick(knownFormat, ["weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName", "hour12"]), key = stringify(filtered), dateTimeHuge = "EEEE, LLLL d, yyyy, h:mm a"; switch (key) { case stringify(DATE_SHORT): return "M/d/yyyy"; case stringify(DATE_MED): return "LLL d, yyyy"; case stringify(DATE_MED_WITH_WEEKDAY): return "EEE, LLL d, yyyy"; case stringify(DATE_FULL): return "LLLL d, yyyy"; case stringify(DATE_HUGE): return "EEEE, LLLL d, yyyy"; case stringify(TIME_SIMPLE): return "h:mm a"; case stringify(TIME_WITH_SECONDS): return "h:mm:ss a"; case stringify(TIME_WITH_SHORT_OFFSET): return "h:mm a"; case stringify(TIME_WITH_LONG_OFFSET): return "h:mm a"; case stringify(TIME_24_SIMPLE): return "HH:mm"; case stringify(TIME_24_WITH_SECONDS): return "HH:mm:ss"; case stringify(TIME_24_WITH_SHORT_OFFSET): return "HH:mm"; case stringify(TIME_24_WITH_LONG_OFFSET): return "HH:mm"; case stringify(DATETIME_SHORT): return "M/d/yyyy, h:mm a"; case stringify(DATETIME_MED): return "LLL d, yyyy, h:mm a"; case stringify(DATETIME_FULL): return "LLLL d, yyyy, h:mm a"; case stringify(DATETIME_HUGE): return dateTimeHuge; case stringify(DATETIME_SHORT_WITH_SECONDS): return "M/d/yyyy, h:mm:ss a"; case stringify(DATETIME_MED_WITH_SECONDS): return "LLL d, yyyy, h:mm:ss a"; case stringify(DATETIME_MED_WITH_WEEKDAY): return "EEE, d LLL yyyy, h:mm a"; case stringify(DATETIME_FULL_WITH_SECONDS): return "LLLL d, yyyy, h:mm:ss a"; case stringify(DATETIME_HUGE_WITH_SECONDS): return "EEEE, LLLL d, yyyy, h:mm:ss a"; default: return dateTimeHuge; } } function stringifyTokens(splits, tokenToString) { var s2 = ""; for (var _iterator = _createForOfIteratorHelperLoose(splits), _step; !(_step = _iterator()).done; ) { var token = _step.value; if (token.literal) { s2 += token.val; } else { s2 += tokenToString(token.val); } } return s2; } var _macroTokenToFormatOpts = { D: DATE_SHORT, DD: DATE_MED, DDD: DATE_FULL, DDDD: DATE_HUGE, t: TIME_SIMPLE, tt: TIME_WITH_SECONDS, ttt: TIME_WITH_SHORT_OFFSET, tttt: TIME_WITH_LONG_OFFSET, T: TIME_24_SIMPLE, TT: TIME_24_WITH_SECONDS, TTT: TIME_24_WITH_SHORT_OFFSET, TTTT: TIME_24_WITH_LONG_OFFSET, f: DATETIME_SHORT, ff: DATETIME_MED, fff: DATETIME_FULL, ffff: DATETIME_HUGE, F: DATETIME_SHORT_WITH_SECONDS, FF: DATETIME_MED_WITH_SECONDS, FFF: DATETIME_FULL_WITH_SECONDS, FFFF: DATETIME_HUGE_WITH_SECONDS }; var Formatter = /* @__PURE__ */ function() { Formatter2.create = function create(locale, opts) { if (opts === void 0) { opts = {}; } return new Formatter2(locale, opts); }; Formatter2.parseFormat = function parseFormat(fmt) { var current = null, currentFull = "", bracketed = false; var splits = []; for (var i = 0; i < fmt.length; i++) { var c = fmt.charAt(i); if (c === "'") { if (currentFull.length > 0) { splits.push({ literal: bracketed, val: currentFull }); } current = null; currentFull = ""; bracketed = !bracketed; } else if (bracketed) { currentFull += c; } else if (c === current) { currentFull += c; } else { if (currentFull.length > 0) { splits.push({ literal: false, val: currentFull }); } currentFull = c; current = c; } } if (currentFull.length > 0) { splits.push({ literal: bracketed, val: currentFull }); } return splits; }; Formatter2.macroTokenToFormatOpts = function macroTokenToFormatOpts(token) { return _macroTokenToFormatOpts[token]; }; function Formatter2(locale, formatOpts) { this.opts = formatOpts; this.loc = locale; this.systemLoc = null; } var _proto = Formatter2.prototype; _proto.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) { if (this.systemLoc === null) { this.systemLoc = this.loc.redefaultToSystem(); } var df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts)); return df.format(); }; _proto.formatDateTime = function formatDateTime(dt, opts) { if (opts === void 0) { opts = {}; } var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); return df.format(); }; _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) { if (opts === void 0) { opts = {}; } var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); return df.formatToParts(); }; _proto.resolvedOptions = function resolvedOptions(dt, opts) { if (opts === void 0) { opts = {}; } var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); return df.resolvedOptions(); }; _proto.num = function num(n2, p) { if (p === void 0) { p = 0; } if (this.opts.forceSimple) { return padStart2(n2, p); } var opts = Object.assign({}, this.opts); if (p > 0) { opts.padTo = p; } return this.loc.numberFormatter(opts).format(n2); }; _proto.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) { var _this = this; var knownEnglish = this.loc.listingMode() === "en", useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory" && hasFormatToParts(), string = function string2(opts, extract) { return _this.loc.extract(dt, opts, extract); }, formatOffset2 = function formatOffset3(opts) { if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { return "Z"; } return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; }, meridiem = function meridiem2() { return knownEnglish ? meridiemForDateTime(dt) : string({ hour: "numeric", hour12: true }, "dayperiod"); }, month = function month2(length, standalone) { return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { month: length } : { month: length, day: "numeric" }, "month"); }, weekday = function weekday2(length, standalone) { return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { weekday: length } : { weekday: length, month: "long", day: "numeric" }, "weekday"); }, maybeMacro = function maybeMacro2(token) { var formatOpts = Formatter2.macroTokenToFormatOpts(token); if (formatOpts) { return _this.formatWithSystemDefault(dt, formatOpts); } else { return token; } }, era = function era2(length) { return knownEnglish ? eraForDateTime(dt, length) : string({ era: length }, "era"); }, tokenToString = function tokenToString2(token) { switch (token) { case "S": return _this.num(dt.millisecond); case "u": case "SSS": return _this.num(dt.millisecond, 3); case "s": return _this.num(dt.second); case "ss": return _this.num(dt.second, 2); case "m": return _this.num(dt.minute); case "mm": return _this.num(dt.minute, 2); case "h": return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); case "hh": return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); case "H": return _this.num(dt.hour); case "HH": return _this.num(dt.hour, 2); case "Z": return formatOffset2({ format: "narrow", allowZ: _this.opts.allowZ }); case "ZZ": return formatOffset2({ format: "short", allowZ: _this.opts.allowZ }); case "ZZZ": return formatOffset2({ format: "techie", allowZ: _this.opts.allowZ }); case "ZZZZ": return dt.zone.offsetName(dt.ts, { format: "short", locale: _this.loc.locale }); case "ZZZZZ": return dt.zone.offsetName(dt.ts, { format: "long", locale: _this.loc.locale }); case "z": return dt.zoneName; case "a": return meridiem(); case "d": return useDateTimeFormatter ? string({ day: "numeric" }, "day") : _this.num(dt.day); case "dd": return useDateTimeFormatter ? string({ day: "2-digit" }, "day") : _this.num(dt.day, 2); case "c": return _this.num(dt.weekday); case "ccc": return weekday("short", true); case "cccc": return weekday("long", true); case "ccccc": return weekday("narrow", true); case "E": return _this.num(dt.weekday); case "EEE": return weekday("short", false); case "EEEE": return weekday("long", false); case "EEEEE": return weekday("narrow", false); case "L": return useDateTimeFormatter ? string({ month: "numeric", day: "numeric" }, "month") : _this.num(dt.month); case "LL": return useDateTimeFormatter ? string({ month: "2-digit", day: "numeric" }, "month") : _this.num(dt.month, 2); case "LLL": return month("short", true); case "LLLL": return month("long", true); case "LLLLL": return month("narrow", true); case "M": return useDateTimeFormatter ? string({ month: "numeric" }, "month") : _this.num(dt.month); case "MM": return useDateTimeFormatter ? string({ month: "2-digit" }, "month") : _this.num(dt.month, 2); case "MMM": return month("short", false); case "MMMM": return month("long", false); case "MMMMM": return month("narrow", false); case "y": return useDateTimeFormatter ? string({ year: "numeric" }, "year") : _this.num(dt.year); case "yy": return useDateTimeFormatter ? string({ year: "2-digit" }, "year") : _this.num(dt.year.toString().slice(-2), 2); case "yyyy": return useDateTimeFormatter ? string({ year: "numeric" }, "year") : _this.num(dt.year, 4); case "yyyyyy": return useDateTimeFormatter ? string({ year: "numeric" }, "year") : _this.num(dt.year, 6); case "G": return era("short"); case "GG": return era("long"); case "GGGGG": return era("narrow"); case "kk": return _this.num(dt.weekYear.toString().slice(-2), 2); case "kkkk": return _this.num(dt.weekYear, 4); case "W": return _this.num(dt.weekNumber); case "WW": return _this.num(dt.weekNumber, 2); case "o": return _this.num(dt.ordinal); case "ooo": return _this.num(dt.ordinal, 3); case "q": return _this.num(dt.quarter); case "qq": return _this.num(dt.quarter, 2); case "X": return _this.num(Math.floor(dt.ts / 1e3)); case "x": return _this.num(dt.ts); default: return maybeMacro(token); } }; return stringifyTokens(Formatter2.parseFormat(fmt), tokenToString); }; _proto.formatDurationFromString = function formatDurationFromString(dur, fmt) { var _this2 = this; var tokenToField = function tokenToField2(token) { switch (token[0]) { case "S": return "millisecond"; case "s": return "second"; case "m": return "minute"; case "h": return "hour"; case "d": return "day"; case "M": return "month"; case "y": return "year"; default: return null; } }, tokenToString = function tokenToString2(lildur) { return function(token) { var mapped = tokenToField(token); if (mapped) { return _this2.num(lildur.get(mapped), token.length); } else { return token; } }; }, tokens = Formatter2.parseFormat(fmt), realTokens = tokens.reduce(function(found, _ref) { var literal = _ref.literal, val = _ref.val; return literal ? found : found.concat(val); }, []), collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function(t) { return t; })); return stringifyTokens(tokens, tokenToString(collapsed)); }; return Formatter2; }(); var Invalid = /* @__PURE__ */ function() { function Invalid2(reason, explanation) { this.reason = reason; this.explanation = explanation; } var _proto = Invalid2.prototype; _proto.toMessage = function toMessage() { if (this.explanation) { return this.reason + ": " + this.explanation; } else { return this.reason; } }; return Invalid2; }(); var Zone = /* @__PURE__ */ function() { function Zone2() { } var _proto = Zone2.prototype; _proto.offsetName = function offsetName(ts, opts) { throw new ZoneIsAbstractError(); }; _proto.formatOffset = function formatOffset2(ts, format) { throw new ZoneIsAbstractError(); }; _proto.offset = function offset2(ts) { throw new ZoneIsAbstractError(); }; _proto.equals = function equals(otherZone) { throw new ZoneIsAbstractError(); }; _createClass(Zone2, [{ key: "type", get: function get() { throw new ZoneIsAbstractError(); } }, { key: "name", get: function get() { throw new ZoneIsAbstractError(); } }, { key: "universal", get: function get() { throw new ZoneIsAbstractError(); } }, { key: "isValid", get: function get() { throw new ZoneIsAbstractError(); } }]); return Zone2; }(); var singleton = null; var LocalZone = /* @__PURE__ */ function(_Zone) { _inheritsLoose(LocalZone2, _Zone); function LocalZone2() { return _Zone.apply(this, arguments) || this; } var _proto = LocalZone2.prototype; _proto.offsetName = function offsetName(ts, _ref) { var format = _ref.format, locale = _ref.locale; return parseZoneInfo(ts, format, locale); }; _proto.formatOffset = function formatOffset$1(ts, format) { return formatOffset(this.offset(ts), format); }; _proto.offset = function offset2(ts) { return -new Date(ts).getTimezoneOffset(); }; _proto.equals = function equals(otherZone) { return otherZone.type === "local"; }; _createClass(LocalZone2, [{ key: "type", get: function get() { return "local"; } }, { key: "name", get: function get() { if (hasIntl()) { return new Intl.DateTimeFormat().resolvedOptions().timeZone; } else return "local"; } }, { key: "universal", get: function get() { return false; } }, { key: "isValid", get: function get() { return true; } }], [{ key: "instance", get: function get() { if (singleton === null) { singleton = new LocalZone2(); } return singleton; } }]); return LocalZone2; }(Zone); var matchingRegex = RegExp("^" + ianaRegex.source + "$"); var dtfCache = {}; function makeDTF(zone) { if (!dtfCache[zone]) { dtfCache[zone] = new Intl.DateTimeFormat("en-US", { hour12: false, timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit" }); } return dtfCache[zone]; } var typeToPos = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }; function hackyOffset(dtf, date) { var formatted = dtf.format(date).replace(/\u200E/g, ""), parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted), fMonth = parsed[1], fDay = parsed[2], fYear = parsed[3], fHour = parsed[4], fMinute = parsed[5], fSecond = parsed[6]; return [fYear, fMonth, fDay, fHour, fMinute, fSecond]; } function partsOffset(dtf, date) { var formatted = dtf.formatToParts(date), filled = []; for (var i = 0; i < formatted.length; i++) { var _formatted$i = formatted[i], type = _formatted$i.type, value = _formatted$i.value, pos = typeToPos[type]; if (!isUndefined(pos)) { filled[pos] = parseInt(value, 10); } } return filled; } var ianaZoneCache = {}; var IANAZone = /* @__PURE__ */ function(_Zone) { _inheritsLoose(IANAZone2, _Zone); IANAZone2.create = function create(name) { if (!ianaZoneCache[name]) { ianaZoneCache[name] = new IANAZone2(name); } return ianaZoneCache[name]; }; IANAZone2.resetCache = function resetCache() { ianaZoneCache = {}; dtfCache = {}; }; IANAZone2.isValidSpecifier = function isValidSpecifier(s2) { return !!(s2 && s2.match(matchingRegex)); }; IANAZone2.isValidZone = function isValidZone(zone) { try { new Intl.DateTimeFormat("en-US", { timeZone: zone }).format(); return true; } catch (e) { return false; } }; IANAZone2.parseGMTOffset = function parseGMTOffset(specifier) { if (specifier) { var match2 = specifier.match(/^Etc\/GMT(0|[+-]\d{1,2})$/i); if (match2) { return -60 * parseInt(match2[1]); } } return null; }; function IANAZone2(name) { var _this; _this = _Zone.call(this) || this; _this.zoneName = name; _this.valid = IANAZone2.isValidZone(name); return _this; } var _proto = IANAZone2.prototype; _proto.offsetName = function offsetName(ts, _ref) { var format = _ref.format, locale = _ref.locale; return parseZoneInfo(ts, format, locale, this.name); }; _proto.formatOffset = function formatOffset$1(ts, format) { return formatOffset(this.offset(ts), format); }; _proto.offset = function offset2(ts) { var date = new Date(ts); if (isNaN(date)) return NaN; var dtf = makeDTF(this.name), _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), year = _ref2[0], month = _ref2[1], day = _ref2[2], hour = _ref2[3], minute = _ref2[4], second = _ref2[5], adjustedHour = hour === 24 ? 0 : hour; var asUTC = objToLocalTS({ year, month, day, hour: adjustedHour, minute, second, millisecond: 0 }); var asTS = +date; var over = asTS % 1e3; asTS -= over >= 0 ? over : 1e3 + over; return (asUTC - asTS) / (60 * 1e3); }; _proto.equals = function equals(otherZone) { return otherZone.type === "iana" && otherZone.name === this.name; }; _createClass(IANAZone2, [{ key: "type", get: function get() { return "iana"; } }, { key: "name", get: function get() { return this.zoneName; } }, { key: "universal", get: function get() { return false; } }, { key: "isValid", get: function get() { return this.valid; } }]); return IANAZone2; }(Zone); var singleton$1 = null; var FixedOffsetZone = /* @__PURE__ */ function(_Zone) { _inheritsLoose(FixedOffsetZone2, _Zone); FixedOffsetZone2.instance = function instance8(offset2) { return offset2 === 0 ? FixedOffsetZone2.utcInstance : new FixedOffsetZone2(offset2); }; FixedOffsetZone2.parseSpecifier = function parseSpecifier(s2) { if (s2) { var r = s2.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); if (r) { return new FixedOffsetZone2(signedOffset(r[1], r[2])); } } return null; }; _createClass(FixedOffsetZone2, null, [{ key: "utcInstance", get: function get() { if (singleton$1 === null) { singleton$1 = new FixedOffsetZone2(0); } return singleton$1; } }]); function FixedOffsetZone2(offset2) { var _this; _this = _Zone.call(this) || this; _this.fixed = offset2; return _this; } var _proto = FixedOffsetZone2.prototype; _proto.offsetName = function offsetName() { return this.name; }; _proto.formatOffset = function formatOffset$1(ts, format) { return formatOffset(this.fixed, format); }; _proto.offset = function offset2() { return this.fixed; }; _proto.equals = function equals(otherZone) { return otherZone.type === "fixed" && otherZone.fixed === this.fixed; }; _createClass(FixedOffsetZone2, [{ key: "type", get: function get() { return "fixed"; } }, { key: "name", get: function get() { return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow"); } }, { key: "universal", get: function get() { return true; } }, { key: "isValid", get: function get() { return true; } }]); return FixedOffsetZone2; }(Zone); var InvalidZone = /* @__PURE__ */ function(_Zone) { _inheritsLoose(InvalidZone2, _Zone); function InvalidZone2(zoneName) { var _this; _this = _Zone.call(this) || this; _this.zoneName = zoneName; return _this; } var _proto = InvalidZone2.prototype; _proto.offsetName = function offsetName() { return null; }; _proto.formatOffset = function formatOffset2() { return ""; }; _proto.offset = function offset2() { return NaN; }; _proto.equals = function equals() { return false; }; _createClass(InvalidZone2, [{ key: "type", get: function get() { return "invalid"; } }, { key: "name", get: function get() { return this.zoneName; } }, { key: "universal", get: function get() { return false; } }, { key: "isValid", get: function get() { return false; } }]); return InvalidZone2; }(Zone); function normalizeZone(input, defaultZone2) { var offset2; if (isUndefined(input) || input === null) { return defaultZone2; } else if (input instanceof Zone) { return input; } else if (isString(input)) { var lowered = input.toLowerCase(); if (lowered === "local") return defaultZone2; else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance; else if ((offset2 = IANAZone.parseGMTOffset(input)) != null) { return FixedOffsetZone.instance(offset2); } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input); else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input); } else if (isNumber2(input)) { return FixedOffsetZone.instance(input); } else if (typeof input === "object" && input.offset && typeof input.offset === "number") { return input; } else { return new InvalidZone(input); } } var now = function now2() { return Date.now(); }; var defaultZone = null; var defaultLocale = null; var defaultNumberingSystem = null; var defaultOutputCalendar = null; var throwOnInvalid = false; var Settings2 = /* @__PURE__ */ function() { function Settings3() { } Settings3.resetCaches = function resetCaches() { Locale.resetCache(); IANAZone.resetCache(); }; _createClass(Settings3, null, [{ key: "now", get: function get() { return now; }, set: function set(n2) { now = n2; } }, { key: "defaultZoneName", get: function get() { return Settings3.defaultZone.name; }, set: function set(z) { if (!z) { defaultZone = null; } else { defaultZone = normalizeZone(z); } } }, { key: "defaultZone", get: function get() { return defaultZone || LocalZone.instance; } }, { key: "defaultLocale", get: function get() { return defaultLocale; }, set: function set(locale) { defaultLocale = locale; } }, { key: "defaultNumberingSystem", get: function get() { return defaultNumberingSystem; }, set: function set(numberingSystem) { defaultNumberingSystem = numberingSystem; } }, { key: "defaultOutputCalendar", get: function get() { return defaultOutputCalendar; }, set: function set(outputCalendar) { defaultOutputCalendar = outputCalendar; } }, { key: "throwOnInvalid", get: function get() { return throwOnInvalid; }, set: function set(t) { throwOnInvalid = t; } }]); return Settings3; }(); var intlDTCache = {}; function getCachedDTF(locString, opts) { if (opts === void 0) { opts = {}; } var key = JSON.stringify([locString, opts]); var dtf = intlDTCache[key]; if (!dtf) { dtf = new Intl.DateTimeFormat(locString, opts); intlDTCache[key] = dtf; } return dtf; } var intlNumCache = {}; function getCachedINF(locString, opts) { if (opts === void 0) { opts = {}; } var key = JSON.stringify([locString, opts]); var inf = intlNumCache[key]; if (!inf) { inf = new Intl.NumberFormat(locString, opts); intlNumCache[key] = inf; } return inf; } var intlRelCache = {}; function getCachedRTF(locString, opts) { if (opts === void 0) { opts = {}; } var _opts = opts, base = _opts.base, cacheKeyOpts = _objectWithoutPropertiesLoose(_opts, ["base"]); var key = JSON.stringify([locString, cacheKeyOpts]); var inf = intlRelCache[key]; if (!inf) { inf = new Intl.RelativeTimeFormat(locString, opts); intlRelCache[key] = inf; } return inf; } var sysLocaleCache = null; function systemLocale() { if (sysLocaleCache) { return sysLocaleCache; } else if (hasIntl()) { var computedSys = new Intl.DateTimeFormat().resolvedOptions().locale; sysLocaleCache = !computedSys || computedSys === "und" ? "en-US" : computedSys; return sysLocaleCache; } else { sysLocaleCache = "en-US"; return sysLocaleCache; } } function parseLocaleString(localeStr) { var uIndex = localeStr.indexOf("-u-"); if (uIndex === -1) { return [localeStr]; } else { var options; var smaller = localeStr.substring(0, uIndex); try { options = getCachedDTF(localeStr).resolvedOptions(); } catch (e) { options = getCachedDTF(smaller).resolvedOptions(); } var _options = options, numberingSystem = _options.numberingSystem, calendar = _options.calendar; return [smaller, numberingSystem, calendar]; } } function intlConfigString(localeStr, numberingSystem, outputCalendar) { if (hasIntl()) { if (outputCalendar || numberingSystem) { localeStr += "-u"; if (outputCalendar) { localeStr += "-ca-" + outputCalendar; } if (numberingSystem) { localeStr += "-nu-" + numberingSystem; } return localeStr; } else { return localeStr; } } else { return []; } } function mapMonths(f) { var ms = []; for (var i = 1; i <= 12; i++) { var dt = DateTime5.utc(2016, i, 1); ms.push(f(dt)); } return ms; } function mapWeekdays(f) { var ms = []; for (var i = 1; i <= 7; i++) { var dt = DateTime5.utc(2016, 11, 13 + i); ms.push(f(dt)); } return ms; } function listStuff(loc, length, defaultOK, englishFn, intlFn) { var mode = loc.listingMode(defaultOK); if (mode === "error") { return null; } else if (mode === "en") { return englishFn(length); } else { return intlFn(length); } } function supportsFastNumbers(loc) { if (loc.numberingSystem && loc.numberingSystem !== "latn") { return false; } else { return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn"; } } var PolyNumberFormatter = /* @__PURE__ */ function() { function PolyNumberFormatter2(intl, forceSimple, opts) { this.padTo = opts.padTo || 0; this.floor = opts.floor || false; if (!forceSimple && hasIntl()) { var intlOpts = { useGrouping: false }; if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; this.inf = getCachedINF(intl, intlOpts); } } var _proto = PolyNumberFormatter2.prototype; _proto.format = function format(i) { if (this.inf) { var fixed = this.floor ? Math.floor(i) : i; return this.inf.format(fixed); } else { var _fixed = this.floor ? Math.floor(i) : roundTo(i, 3); return padStart2(_fixed, this.padTo); } }; return PolyNumberFormatter2; }(); var PolyDateFormatter = /* @__PURE__ */ function() { function PolyDateFormatter2(dt, intl, opts) { this.opts = opts; this.hasIntl = hasIntl(); var z; if (dt.zone.universal && this.hasIntl) { var gmtOffset = -1 * (dt.offset / 60); var offsetZ = gmtOffset >= 0 ? "Etc/GMT+" + gmtOffset : "Etc/GMT" + gmtOffset; var isOffsetZoneSupported = IANAZone.isValidZone(offsetZ); if (dt.offset !== 0 && isOffsetZoneSupported) { z = offsetZ; this.dt = dt; } else { z = "UTC"; if (opts.timeZoneName) { this.dt = dt; } else { this.dt = dt.offset === 0 ? dt : DateTime5.fromMillis(dt.ts + dt.offset * 60 * 1e3); } } } else if (dt.zone.type === "local") { this.dt = dt; } else { this.dt = dt; z = dt.zone.name; } if (this.hasIntl) { var intlOpts = Object.assign({}, this.opts); if (z) { intlOpts.timeZone = z; } this.dtf = getCachedDTF(intl, intlOpts); } } var _proto2 = PolyDateFormatter2.prototype; _proto2.format = function format() { if (this.hasIntl) { return this.dtf.format(this.dt.toJSDate()); } else { var tokenFormat = formatString(this.opts), loc = Locale.create("en-US"); return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat); } }; _proto2.formatToParts = function formatToParts() { if (this.hasIntl && hasFormatToParts()) { return this.dtf.formatToParts(this.dt.toJSDate()); } else { return []; } }; _proto2.resolvedOptions = function resolvedOptions() { if (this.hasIntl) { return this.dtf.resolvedOptions(); } else { return { locale: "en-US", numberingSystem: "latn", outputCalendar: "gregory" }; } }; return PolyDateFormatter2; }(); var PolyRelFormatter = /* @__PURE__ */ function() { function PolyRelFormatter2(intl, isEnglish, opts) { this.opts = Object.assign({ style: "long" }, opts); if (!isEnglish && hasRelative()) { this.rtf = getCachedRTF(intl, opts); } } var _proto3 = PolyRelFormatter2.prototype; _proto3.format = function format(count, unit) { if (this.rtf) { return this.rtf.format(count, unit); } else { return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); } }; _proto3.formatToParts = function formatToParts(count, unit) { if (this.rtf) { return this.rtf.formatToParts(count, unit); } else { return []; } }; return PolyRelFormatter2; }(); var Locale = /* @__PURE__ */ function() { Locale2.fromOpts = function fromOpts(opts) { return Locale2.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN); }; Locale2.create = function create(locale, numberingSystem, outputCalendar, defaultToEN) { if (defaultToEN === void 0) { defaultToEN = false; } var specifiedLocale = locale || Settings2.defaultLocale, localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()), numberingSystemR = numberingSystem || Settings2.defaultNumberingSystem, outputCalendarR = outputCalendar || Settings2.defaultOutputCalendar; return new Locale2(localeR, numberingSystemR, outputCalendarR, specifiedLocale); }; Locale2.resetCache = function resetCache() { sysLocaleCache = null; intlDTCache = {}; intlNumCache = {}; intlRelCache = {}; }; Locale2.fromObject = function fromObject(_temp) { var _ref = _temp === void 0 ? {} : _temp, locale = _ref.locale, numberingSystem = _ref.numberingSystem, outputCalendar = _ref.outputCalendar; return Locale2.create(locale, numberingSystem, outputCalendar); }; function Locale2(locale, numbering, outputCalendar, specifiedLocale) { var _parseLocaleString = parseLocaleString(locale), parsedLocale = _parseLocaleString[0], parsedNumberingSystem = _parseLocaleString[1], parsedOutputCalendar = _parseLocaleString[2]; this.locale = parsedLocale; this.numberingSystem = numbering || parsedNumberingSystem || null; this.outputCalendar = outputCalendar || parsedOutputCalendar || null; this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); this.weekdaysCache = { format: {}, standalone: {} }; this.monthsCache = { format: {}, standalone: {} }; this.meridiemCache = null; this.eraCache = {}; this.specifiedLocale = specifiedLocale; this.fastNumbersCached = null; } var _proto4 = Locale2.prototype; _proto4.listingMode = function listingMode(defaultOK) { if (defaultOK === void 0) { defaultOK = true; } var intl = hasIntl(), hasFTP = intl && hasFormatToParts(), isActuallyEn = this.isEnglish(), hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) { return "error"; } else if (!hasFTP || isActuallyEn && hasNoWeirdness) { return "en"; } else { return "intl"; } }; _proto4.clone = function clone2(alts) { if (!alts || Object.getOwnPropertyNames(alts).length === 0) { return this; } else { return Locale2.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false); } }; _proto4.redefaultToEN = function redefaultToEN(alts) { if (alts === void 0) { alts = {}; } return this.clone(Object.assign({}, alts, { defaultToEN: true })); }; _proto4.redefaultToSystem = function redefaultToSystem(alts) { if (alts === void 0) { alts = {}; } return this.clone(Object.assign({}, alts, { defaultToEN: false })); }; _proto4.months = function months$1(length, format, defaultOK) { var _this = this; if (format === void 0) { format = false; } if (defaultOK === void 0) { defaultOK = true; } return listStuff(this, length, defaultOK, months, function() { var intl = format ? { month: length, day: "numeric" } : { month: length }, formatStr = format ? "format" : "standalone"; if (!_this.monthsCache[formatStr][length]) { _this.monthsCache[formatStr][length] = mapMonths(function(dt) { return _this.extract(dt, intl, "month"); }); } return _this.monthsCache[formatStr][length]; }); }; _proto4.weekdays = function weekdays$1(length, format, defaultOK) { var _this2 = this; if (format === void 0) { format = false; } if (defaultOK === void 0) { defaultOK = true; } return listStuff(this, length, defaultOK, weekdays, function() { var intl = format ? { weekday: length, year: "numeric", month: "long", day: "numeric" } : { weekday: length }, formatStr = format ? "format" : "standalone"; if (!_this2.weekdaysCache[formatStr][length]) { _this2.weekdaysCache[formatStr][length] = mapWeekdays(function(dt) { return _this2.extract(dt, intl, "weekday"); }); } return _this2.weekdaysCache[formatStr][length]; }); }; _proto4.meridiems = function meridiems$1(defaultOK) { var _this3 = this; if (defaultOK === void 0) { defaultOK = true; } return listStuff(this, void 0, defaultOK, function() { return meridiems; }, function() { if (!_this3.meridiemCache) { var intl = { hour: "numeric", hour12: true }; _this3.meridiemCache = [DateTime5.utc(2016, 11, 13, 9), DateTime5.utc(2016, 11, 13, 19)].map(function(dt) { return _this3.extract(dt, intl, "dayperiod"); }); } return _this3.meridiemCache; }); }; _proto4.eras = function eras$1(length, defaultOK) { var _this4 = this; if (defaultOK === void 0) { defaultOK = true; } return listStuff(this, length, defaultOK, eras, function() { var intl = { era: length }; if (!_this4.eraCache[length]) { _this4.eraCache[length] = [DateTime5.utc(-40, 1, 1), DateTime5.utc(2017, 1, 1)].map(function(dt) { return _this4.extract(dt, intl, "era"); }); } return _this4.eraCache[length]; }); }; _proto4.extract = function extract(dt, intlOpts, field) { var df = this.dtFormatter(dt, intlOpts), results = df.formatToParts(), matching = results.find(function(m) { return m.type.toLowerCase() === field; }); return matching ? matching.value : null; }; _proto4.numberFormatter = function numberFormatter(opts) { if (opts === void 0) { opts = {}; } return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); }; _proto4.dtFormatter = function dtFormatter(dt, intlOpts) { if (intlOpts === void 0) { intlOpts = {}; } return new PolyDateFormatter(dt, this.intl, intlOpts); }; _proto4.relFormatter = function relFormatter(opts) { if (opts === void 0) { opts = {}; } return new PolyRelFormatter(this.intl, this.isEnglish(), opts); }; _proto4.isEnglish = function isEnglish() { return this.locale === "en" || this.locale.toLowerCase() === "en-us" || hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us"); }; _proto4.equals = function equals(other) { return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; }; _createClass(Locale2, [{ key: "fastNumbers", get: function get() { if (this.fastNumbersCached == null) { this.fastNumbersCached = supportsFastNumbers(this); } return this.fastNumbersCached; } }]); return Locale2; }(); function combineRegexes() { for (var _len = arguments.length, regexes = new Array(_len), _key = 0; _key < _len; _key++) { regexes[_key] = arguments[_key]; } var full = regexes.reduce(function(f, r) { return f + r.source; }, ""); return RegExp("^" + full + "$"); } function combineExtractors() { for (var _len2 = arguments.length, extractors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { extractors[_key2] = arguments[_key2]; } return function(m) { return extractors.reduce(function(_ref, ex) { var mergedVals = _ref[0], mergedZone = _ref[1], cursor = _ref[2]; var _ex = ex(m, cursor), val = _ex[0], zone = _ex[1], next = _ex[2]; return [Object.assign(mergedVals, val), mergedZone || zone, next]; }, [{}, null, 1]).slice(0, 2); }; } function parse(s2) { if (s2 == null) { return [null, null]; } for (var _len3 = arguments.length, patterns = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { patterns[_key3 - 1] = arguments[_key3]; } for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) { var _patterns$_i = _patterns[_i], regex = _patterns$_i[0], extractor = _patterns$_i[1]; var m = regex.exec(s2); if (m) { return extractor(m); } } return [null, null]; } function simpleParse() { for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { keys[_key4] = arguments[_key4]; } return function(match2, cursor) { var ret = {}; var i; for (i = 0; i < keys.length; i++) { ret[keys[i]] = parseInteger(match2[cursor + i]); } return [ret, null, cursor + i]; }; } var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/; var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/; var isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + offsetRegex.source + "?"); var isoTimeExtensionRegex = RegExp("(?:T" + isoTimeRegex.source + ")?"); var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/; var isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/; var isoOrdinalRegex = /(\d{4})-?(\d{3})/; var extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"); var extractISOOrdinalData = simpleParse("year", "ordinal"); var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; var sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?"); var sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?"); function int(match2, pos, fallback) { var m = match2[pos]; return isUndefined(m) ? fallback : parseInteger(m); } function extractISOYmd(match2, cursor) { var item = { year: int(match2, cursor), month: int(match2, cursor + 1, 1), day: int(match2, cursor + 2, 1) }; return [item, null, cursor + 3]; } function extractISOTime(match2, cursor) { var item = { hours: int(match2, cursor, 0), minutes: int(match2, cursor + 1, 0), seconds: int(match2, cursor + 2, 0), milliseconds: parseMillis(match2[cursor + 3]) }; return [item, null, cursor + 4]; } function extractISOOffset(match2, cursor) { var local = !match2[cursor] && !match2[cursor + 1], fullOffset = signedOffset(match2[cursor + 1], match2[cursor + 2]), zone = local ? null : FixedOffsetZone.instance(fullOffset); return [{}, zone, cursor + 3]; } function extractIANAZone(match2, cursor) { var zone = match2[cursor] ? IANAZone.create(match2[cursor]) : null; return [{}, zone, cursor + 1]; } var isoTimeOnly = RegExp("^T?" + isoTimeBaseRegex.source + "$"); var isoDuration = /^-?P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,9}))?S)?)?)$/; function extractISODuration(match2) { var s2 = match2[0], yearStr = match2[1], monthStr = match2[2], weekStr = match2[3], dayStr = match2[4], hourStr = match2[5], minuteStr = match2[6], secondStr = match2[7], millisecondsStr = match2[8]; var hasNegativePrefix = s2[0] === "-"; var negativeSeconds = secondStr && secondStr[0] === "-"; var maybeNegate = function maybeNegate2(num, force) { if (force === void 0) { force = false; } return num !== void 0 && (force || num && hasNegativePrefix) ? -num : num; }; return [{ years: maybeNegate(parseInteger(yearStr)), months: maybeNegate(parseInteger(monthStr)), weeks: maybeNegate(parseInteger(weekStr)), days: maybeNegate(parseInteger(dayStr)), hours: maybeNegate(parseInteger(hourStr)), minutes: maybeNegate(parseInteger(minuteStr)), seconds: maybeNegate(parseInteger(secondStr), secondStr === "-0"), milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds) }]; } var obsOffsets = { 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 }; function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { var result = { year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), month: monthsShort.indexOf(monthStr) + 1, day: parseInteger(dayStr), hour: parseInteger(hourStr), minute: parseInteger(minuteStr) }; if (secondStr) result.second = parseInteger(secondStr); if (weekdayStr) { result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; } return result; } 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\d)(\d\d)))$/; function extractRFC2822(match2) { var weekdayStr = match2[1], dayStr = match2[2], monthStr = match2[3], yearStr = match2[4], hourStr = match2[5], minuteStr = match2[6], secondStr = match2[7], obsOffset = match2[8], milOffset = match2[9], offHourStr = match2[10], offMinuteStr = match2[11], result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); var offset2; if (obsOffset) { offset2 = obsOffsets[obsOffset]; } else if (milOffset) { offset2 = 0; } else { offset2 = signedOffset(offHourStr, offMinuteStr); } return [result, new FixedOffsetZone(offset2)]; } function preprocessRFC2822(s2) { return s2.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); } var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/; var rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/; var ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; function extractRFC1123Or850(match2) { var weekdayStr = match2[1], dayStr = match2[2], monthStr = match2[3], yearStr = match2[4], hourStr = match2[5], minuteStr = match2[6], secondStr = match2[7], result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); return [result, FixedOffsetZone.utcInstance]; } function extractASCII(match2) { var weekdayStr = match2[1], monthStr = match2[2], dayStr = match2[3], hourStr = match2[4], minuteStr = match2[5], secondStr = match2[6], yearStr = match2[7], result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); return [result, FixedOffsetZone.utcInstance]; } var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); var isoTimeCombinedRegex = combineRegexes(isoTimeRegex); var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset); var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset); var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset); var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset); function parseISODate(s2) { return parse(s2, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); } function parseRFC2822Date(s2) { return parse(preprocessRFC2822(s2), [rfc2822, extractRFC2822]); } function parseHTTPDate(s2) { return parse(s2, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); } function parseISODuration(s2) { return parse(s2, [isoDuration, extractISODuration]); } var extractISOTimeOnly = combineExtractors(extractISOTime); function parseISOTimeOnly(s2) { return parse(s2, [isoTimeOnly, extractISOTimeOnly]); } var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); var extractISOYmdTimeOffsetAndIANAZone = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); function parseSQL(s2) { return parse(s2, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); } var INVALID = "Invalid Duration"; var lowOrderMatrix = { weeks: { days: 7, hours: 7 * 24, minutes: 7 * 24 * 60, seconds: 7 * 24 * 60 * 60, milliseconds: 7 * 24 * 60 * 60 * 1e3 }, days: { hours: 24, minutes: 24 * 60, seconds: 24 * 60 * 60, milliseconds: 24 * 60 * 60 * 1e3 }, hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1e3 }, minutes: { seconds: 60, milliseconds: 60 * 1e3 }, seconds: { milliseconds: 1e3 } }; var casualMatrix = Object.assign({ years: { quarters: 4, months: 12, weeks: 52, days: 365, hours: 365 * 24, minutes: 365 * 24 * 60, seconds: 365 * 24 * 60 * 60, milliseconds: 365 * 24 * 60 * 60 * 1e3 }, quarters: { months: 3, weeks: 13, days: 91, hours: 91 * 24, minutes: 91 * 24 * 60, seconds: 91 * 24 * 60 * 60, milliseconds: 91 * 24 * 60 * 60 * 1e3 }, months: { weeks: 4, days: 30, hours: 30 * 24, minutes: 30 * 24 * 60, seconds: 30 * 24 * 60 * 60, milliseconds: 30 * 24 * 60 * 60 * 1e3 } }, lowOrderMatrix); var daysInYearAccurate = 146097 / 400; var daysInMonthAccurate = 146097 / 4800; var accurateMatrix = Object.assign({ years: { quarters: 4, months: 12, weeks: daysInYearAccurate / 7, days: daysInYearAccurate, hours: daysInYearAccurate * 24, minutes: daysInYearAccurate * 24 * 60, seconds: daysInYearAccurate * 24 * 60 * 60, milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3 }, quarters: { months: 3, weeks: daysInYearAccurate / 28, days: daysInYearAccurate / 4, hours: daysInYearAccurate * 24 / 4, minutes: daysInYearAccurate * 24 * 60 / 4, seconds: daysInYearAccurate * 24 * 60 * 60 / 4, milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3 / 4 }, months: { weeks: daysInMonthAccurate / 7, days: daysInMonthAccurate, hours: daysInMonthAccurate * 24, minutes: daysInMonthAccurate * 24 * 60, seconds: daysInMonthAccurate * 24 * 60 * 60, milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1e3 } }, lowOrderMatrix); var orderedUnits = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; var reverseUnits = orderedUnits.slice(0).reverse(); function clone(dur, alts, clear) { if (clear === void 0) { clear = false; } var conf = { values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}), loc: dur.loc.clone(alts.loc), conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy }; return new Duration(conf); } function antiTrunc(n2) { return n2 < 0 ? Math.floor(n2) : Math.ceil(n2); } function convert(matrix, fromMap, fromUnit, toMap, toUnit) { var conv = matrix[toUnit][fromUnit], raw = fromMap[fromUnit] / conv, sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw); toMap[toUnit] += added; fromMap[fromUnit] -= added * conv; } function normalizeValues(matrix, vals) { reverseUnits.reduce(function(previous, current) { if (!isUndefined(vals[current])) { if (previous) { convert(matrix, vals, previous, vals, current); } return current; } else { return previous; } }, null); } var Duration = /* @__PURE__ */ function() { function Duration2(config) { var accurate = config.conversionAccuracy === "longterm" || false; this.values = config.values; this.loc = config.loc || Locale.create(); this.conversionAccuracy = accurate ? "longterm" : "casual"; this.invalid = config.invalid || null; this.matrix = accurate ? accurateMatrix : casualMatrix; this.isLuxonDuration = true; } Duration2.fromMillis = function fromMillis(count, opts) { return Duration2.fromObject(Object.assign({ milliseconds: count }, opts)); }; Duration2.fromObject = function fromObject(obj) { if (obj == null || typeof obj !== "object") { throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got " + (obj === null ? "null" : typeof obj)); } return new Duration2({ values: normalizeObject(obj, Duration2.normalizeUnit, [ "locale", "numberingSystem", "conversionAccuracy", "zone" ]), loc: Locale.fromObject(obj), conversionAccuracy: obj.conversionAccuracy }); }; Duration2.fromISO = function fromISO(text2, opts) { var _parseISODuration = parseISODuration(text2), parsed = _parseISODuration[0]; if (parsed) { var obj = Object.assign(parsed, opts); return Duration2.fromObject(obj); } else { return Duration2.invalid("unparsable", 'the input "' + text2 + `" can't be parsed as ISO 8601`); } }; Duration2.fromISOTime = function fromISOTime(text2, opts) { var _parseISOTimeOnly = parseISOTimeOnly(text2), parsed = _parseISOTimeOnly[0]; if (parsed) { var obj = Object.assign(parsed, opts); return Duration2.fromObject(obj); } else { return Duration2.invalid("unparsable", 'the input "' + text2 + `" can't be parsed as ISO 8601`); } }; Duration2.invalid = function invalid(reason, explanation) { if (explanation === void 0) { explanation = null; } if (!reason) { throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); } var invalid2 = reason instanceof Invalid ? reason : new Invalid(reason, explanation); if (Settings2.throwOnInvalid) { throw new InvalidDurationError(invalid2); } else { return new Duration2({ invalid: invalid2 }); } }; Duration2.normalizeUnit = function normalizeUnit2(unit) { var normalized = { year: "years", years: "years", quarter: "quarters", quarters: "quarters", month: "months", months: "months", week: "weeks", weeks: "weeks", day: "days", days: "days", hour: "hours", hours: "hours", minute: "minutes", minutes: "minutes", second: "seconds", seconds: "seconds", millisecond: "milliseconds", milliseconds: "milliseconds" }[unit ? unit.toLowerCase() : unit]; if (!normalized) throw new InvalidUnitError(unit); return normalized; }; Duration2.isDuration = function isDuration(o) { return o && o.isLuxonDuration || false; }; var _proto = Duration2.prototype; _proto.toFormat = function toFormat(fmt, opts) { if (opts === void 0) { opts = {}; } var fmtOpts = Object.assign({}, opts, { floor: opts.round !== false && opts.floor !== false }); return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID; }; _proto.toObject = function toObject(opts) { if (opts === void 0) { opts = {}; } if (!this.isValid) return {}; var base = Object.assign({}, this.values); if (opts.includeConfig) { base.conversionAccuracy = this.conversionAccuracy; base.numberingSystem = this.loc.numberingSystem; base.locale = this.loc.locale; } return base; }; _proto.toISO = function toISO() { if (!this.isValid) return null; var s2 = "P"; if (this.years !== 0) s2 += this.years + "Y"; if (this.months !== 0 || this.quarters !== 0) s2 += this.months + this.quarters * 3 + "M"; if (this.weeks !== 0) s2 += this.weeks + "W"; if (this.days !== 0) s2 += this.days + "D"; if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s2 += "T"; if (this.hours !== 0) s2 += this.hours + "H"; if (this.minutes !== 0) s2 += this.minutes + "M"; if (this.seconds !== 0 || this.milliseconds !== 0) s2 += roundTo(this.seconds + this.milliseconds / 1e3, 3) + "S"; if (s2 === "P") s2 += "T0S"; return s2; }; _proto.toISOTime = function toISOTime(opts) { if (opts === void 0) { opts = {}; } if (!this.isValid) return null; var millis = this.toMillis(); if (millis < 0 || millis >= 864e5) return null; opts = Object.assign({ suppressMilliseconds: false, suppressSeconds: false, includePrefix: false, format: "extended" }, opts); var value = this.shiftTo("hours", "minutes", "seconds", "milliseconds"); var fmt = opts.format === "basic" ? "hhmm" : "hh:mm"; if (!opts.suppressSeconds || value.seconds !== 0 || value.milliseconds !== 0) { fmt += opts.format === "basic" ? "ss" : ":ss"; if (!opts.suppressMilliseconds || value.milliseconds !== 0) { fmt += ".SSS"; } } var str = value.toFormat(fmt); if (opts.includePrefix) { str = "T" + str; } return str; }; _proto.toJSON = function toJSON() { return this.toISO(); }; _proto.toString = function toString() { return this.toISO(); }; _proto.toMillis = function toMillis() { return this.as("milliseconds"); }; _proto.valueOf = function valueOf() { return this.toMillis(); }; _proto.plus = function plus(duration) { if (!this.isValid) return this; var dur = friendlyDuration(duration), result = {}; for (var _iterator = _createForOfIteratorHelperLoose(orderedUnits), _step; !(_step = _iterator()).done; ) { var k = _step.value; if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { result[k] = dur.get(k) + this.get(k); } } return clone(this, { values: result }, true); }; _proto.minus = function minus(duration) { if (!this.isValid) return this; var dur = friendlyDuration(duration); return this.plus(dur.negate()); }; _proto.mapUnits = function mapUnits(fn) { if (!this.isValid) return this; var result = {}; for (var _i = 0, _Object$keys = Object.keys(this.values); _i < _Object$keys.length; _i++) { var k = _Object$keys[_i]; result[k] = asNumber(fn(this.values[k], k)); } return clone(this, { values: result }, true); }; _proto.get = function get(unit) { return this[Duration2.normalizeUnit(unit)]; }; _proto.set = function set(values) { if (!this.isValid) return this; var mixed = Object.assign(this.values, normalizeObject(values, Duration2.normalizeUnit, [])); return clone(this, { values: mixed }); }; _proto.reconfigure = function reconfigure(_temp) { var _ref = _temp === void 0 ? {} : _temp, locale = _ref.locale, numberingSystem = _ref.numberingSystem, conversionAccuracy = _ref.conversionAccuracy; var loc = this.loc.clone({ locale, numberingSystem }), opts = { loc }; if (conversionAccuracy) { opts.conversionAccuracy = conversionAccuracy; } return clone(this, opts); }; _proto.as = function as(unit) { return this.isValid ? this.shiftTo(unit).get(unit) : NaN; }; _proto.normalize = function normalize() { if (!this.isValid) return this; var vals = this.toObject(); normalizeValues(this.matrix, vals); return clone(this, { values: vals }, true); }; _proto.shiftTo = function shiftTo() { for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) { units[_key] = arguments[_key]; } if (!this.isValid) return this; if (units.length === 0) { return this; } units = units.map(function(u) { return Duration2.normalizeUnit(u); }); var built = {}, accumulated = {}, vals = this.toObject(); var lastUnit; for (var _iterator2 = _createForOfIteratorHelperLoose(orderedUnits), _step2; !(_step2 = _iterator2()).done; ) { var k = _step2.value; if (units.indexOf(k) >= 0) { lastUnit = k; var own = 0; for (var ak in accumulated) { own += this.matrix[ak][k] * accumulated[ak]; accumulated[ak] = 0; } if (isNumber2(vals[k])) { own += vals[k]; } var i = Math.trunc(own); built[k] = i; accumulated[k] = own - i; for (var down in vals) { if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) { convert(this.matrix, vals, down, built, k); } } } else if (isNumber2(vals[k])) { accumulated[k] = vals[k]; } } for (var key in accumulated) { if (accumulated[key] !== 0) { built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; } } return clone(this, { values: built }, true).normalize(); }; _proto.negate = function negate() { if (!this.isValid) return this; var negated = {}; for (var _i2 = 0, _Object$keys2 = Object.keys(this.values); _i2 < _Object$keys2.length; _i2++) { var k = _Object$keys2[_i2]; negated[k] = -this.values[k]; } return clone(this, { values: negated }, true); }; _proto.equals = function equals(other) { if (!this.isValid || !other.isValid) { return false; } if (!this.loc.equals(other.loc)) { return false; } function eq(v1, v2) { if (v1 === void 0 || v1 === 0) return v2 === void 0 || v2 === 0; return v1 === v2; } for (var _iterator3 = _createForOfIteratorHelperLoose(orderedUnits), _step3; !(_step3 = _iterator3()).done; ) { var u = _step3.value; if (!eq(this.values[u], other.values[u])) { return false; } } return true; }; _createClass(Duration2, [{ key: "locale", get: function get() { return this.isValid ? this.loc.locale : null; } }, { key: "numberingSystem", get: function get() { return this.isValid ? this.loc.numberingSystem : null; } }, { key: "years", get: function get() { return this.isValid ? this.values.years || 0 : NaN; } }, { key: "quarters", get: function get() { return this.isValid ? this.values.quarters || 0 : NaN; } }, { key: "months", get: function get() { return this.isValid ? this.values.months || 0 : NaN; } }, { key: "weeks", get: function get() { return this.isValid ? this.values.weeks || 0 : NaN; } }, { key: "days", get: function get() { return this.isValid ? this.values.days || 0 : NaN; } }, { key: "hours", get: function get() { return this.isValid ? this.values.hours || 0 : NaN; } }, { key: "minutes", get: function get() { return this.isValid ? this.values.minutes || 0 : NaN; } }, { key: "seconds", get: function get() { return this.isValid ? this.values.seconds || 0 : NaN; } }, { key: "milliseconds", get: function get() { return this.isValid ? this.values.milliseconds || 0 : NaN; } }, { key: "isValid", get: function get() { return this.invalid === null; } }, { key: "invalidReason", get: function get() { return this.invalid ? this.invalid.reason : null; } }, { key: "invalidExplanation", get: function get() { return this.invalid ? this.invalid.explanation : null; } }]); return Duration2; }(); function friendlyDuration(durationish) { if (isNumber2(durationish)) { return Duration.fromMillis(durationish); } else if (Duration.isDuration(durationish)) { return durationish; } else if (typeof durationish === "object") { return Duration.fromObject(durationish); } else { throw new InvalidArgumentError("Unknown duration argument " + durationish + " of type " + typeof durationish); } } var INVALID$1 = "Invalid Interval"; function validateStartEnd(start, end) { if (!start || !start.isValid) { return Interval.invalid("missing or invalid start"); } else if (!end || !end.isValid) { return Interval.invalid("missing or invalid end"); } else if (end < start) { return Interval.invalid("end before start", "The end of an interval must be after its start, but you had start=" + start.toISO() + " and end=" + end.toISO()); } else { return null; } } var Interval = /* @__PURE__ */ function() { function Interval2(config) { this.s = config.start; this.e = config.end; this.invalid = config.invalid || null; this.isLuxonInterval = true; } Interval2.invalid = function invalid(reason, explanation) { if (explanation === void 0) { explanation = null; } if (!reason) { throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); } var invalid2 = reason instanceof Invalid ? reason : new Invalid(reason, explanation); if (Settings2.throwOnInvalid) { throw new InvalidIntervalError(invalid2); } else { return new Interval2({ invalid: invalid2 }); } }; Interval2.fromDateTimes = function fromDateTimes(start, end) { var builtStart = friendlyDateTime(start), builtEnd = friendlyDateTime(end); var validateError = validateStartEnd(builtStart, builtEnd); if (validateError == null) { return new Interval2({ start: builtStart, end: builtEnd }); } else { return validateError; } }; Interval2.after = function after(start, duration) { var dur = friendlyDuration(duration), dt = friendlyDateTime(start); return Interval2.fromDateTimes(dt, dt.plus(dur)); }; Interval2.before = function before(end, duration) { var dur = friendlyDuration(duration), dt = friendlyDateTime(end); return Interval2.fromDateTimes(dt.minus(dur), dt); }; Interval2.fromISO = function fromISO(text2, opts) { var _split = (text2 || "").split("/", 2), s2 = _split[0], e = _split[1]; if (s2 && e) { var start, startIsValid; try { start = DateTime5.fromISO(s2, opts); startIsValid = start.isValid; } catch (e2) { startIsValid = false; } var end, endIsValid; try { end = DateTime5.fromISO(e, opts); endIsValid = end.isValid; } catch (e2) { endIsValid = false; } if (startIsValid && endIsValid) { return Interval2.fromDateTimes(start, end); } if (startIsValid) { var dur = Duration.fromISO(e, opts); if (dur.isValid) { return Interval2.after(start, dur); } } else if (endIsValid) { var _dur = Duration.fromISO(s2, opts); if (_dur.isValid) { return Interval2.before(end, _dur); } } } return Interval2.invalid("unparsable", 'the input "' + text2 + `" can't be parsed as ISO 8601`); }; Interval2.isInterval = function isInterval(o) { return o && o.isLuxonInterval || false; }; var _proto = Interval2.prototype; _proto.length = function length(unit) { if (unit === void 0) { unit = "milliseconds"; } return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN; }; _proto.count = function count(unit) { if (unit === void 0) { unit = "milliseconds"; } if (!this.isValid) return NaN; var start = this.start.startOf(unit), end = this.end.startOf(unit); return Math.floor(end.diff(start, unit).get(unit)) + 1; }; _proto.hasSame = function hasSame(unit) { return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false; }; _proto.isEmpty = function isEmpty() { return this.s.valueOf() === this.e.valueOf(); }; _proto.isAfter = function isAfter(dateTime) { if (!this.isValid) return false; return this.s > dateTime; }; _proto.isBefore = function isBefore(dateTime) { if (!this.isValid) return false; return this.e <= dateTime; }; _proto.contains = function contains2(dateTime) { if (!this.isValid) return false; return this.s <= dateTime && this.e > dateTime; }; _proto.set = function set(_temp) { var _ref = _temp === void 0 ? {} : _temp, start = _ref.start, end = _ref.end; if (!this.isValid) return this; return Interval2.fromDateTimes(start || this.s, end || this.e); }; _proto.splitAt = function splitAt() { var _this = this; if (!this.isValid) return []; for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { dateTimes[_key] = arguments[_key]; } var sorted = dateTimes.map(friendlyDateTime).filter(function(d) { return _this.contains(d); }).sort(), results = []; var s2 = this.s, i = 0; while (s2 < this.e) { var added = sorted[i] || this.e, next = +added > +this.e ? this.e : added; results.push(Interval2.fromDateTimes(s2, next)); s2 = next; i += 1; } return results; }; _proto.splitBy = function splitBy(duration) { var dur = friendlyDuration(duration); if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { return []; } var s2 = this.s, idx = 1, next; var results = []; while (s2 < this.e) { var added = this.start.plus(dur.mapUnits(function(x) { return x * idx; })); next = +added > +this.e ? this.e : added; results.push(Interval2.fromDateTimes(s2, next)); s2 = next; idx += 1; } return results; }; _proto.divideEqually = function divideEqually(numberOfParts) { if (!this.isValid) return []; return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); }; _proto.overlaps = function overlaps(other) { return this.e > other.s && this.s < other.e; }; _proto.abutsStart = function abutsStart(other) { if (!this.isValid) return false; return +this.e === +other.s; }; _proto.abutsEnd = function abutsEnd(other) { if (!this.isValid) return false; return +other.e === +this.s; }; _proto.engulfs = function engulfs(other) { if (!this.isValid) return false; return this.s <= other.s && this.e >= other.e; }; _proto.equals = function equals(other) { if (!this.isValid || !other.isValid) { return false; } return this.s.equals(other.s) && this.e.equals(other.e); }; _proto.intersection = function intersection(other) { if (!this.isValid) return this; var s2 = this.s > other.s ? this.s : other.s, e = this.e < other.e ? this.e : other.e; if (s2 >= e) { return null; } else { return Interval2.fromDateTimes(s2, e); } }; _proto.union = function union(other) { if (!this.isValid) return this; var s2 = this.s < other.s ? this.s : other.s, e = this.e > other.e ? this.e : other.e; return Interval2.fromDateTimes(s2, e); }; Interval2.merge = function merge(intervals) { var _intervals$sort$reduc = intervals.sort(function(a, b) { return a.s - b.s; }).reduce(function(_ref2, item) { var sofar = _ref2[0], current = _ref2[1]; if (!current) { return [sofar, item]; } else if (current.overlaps(item) || current.abutsStart(item)) { return [sofar, current.union(item)]; } else { return [sofar.concat([current]), item]; } }, [[], null]), found = _intervals$sort$reduc[0], final = _intervals$sort$reduc[1]; if (final) { found.push(final); } return found; }; Interval2.xor = function xor(intervals) { var _Array$prototype; var start = null, currentCount = 0; var results = [], ends = intervals.map(function(i2) { return [{ time: i2.s, type: "s" }, { time: i2.e, type: "e" }]; }), flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends), arr = flattened.sort(function(a, b) { return a.time - b.time; }); for (var _iterator = _createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done; ) { var i = _step.value; currentCount += i.type === "s" ? 1 : -1; if (currentCount === 1) { start = i.time; } else { if (start && +start !== +i.time) { results.push(Interval2.fromDateTimes(start, i.time)); } start = null; } } return Interval2.merge(results); }; _proto.difference = function difference() { var _this2 = this; for (var _len2 = arguments.length, intervals = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { intervals[_key2] = arguments[_key2]; } return Interval2.xor([this].concat(intervals)).map(function(i) { return _this2.intersection(i); }).filter(function(i) { return i && !i.isEmpty(); }); }; _proto.toString = function toString() { if (!this.isValid) return INVALID$1; return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")"; }; _proto.toISO = function toISO(opts) { if (!this.isValid) return INVALID$1; return this.s.toISO(opts) + "/" + this.e.toISO(opts); }; _proto.toISODate = function toISODate() { if (!this.isValid) return INVALID$1; return this.s.toISODate() + "/" + this.e.toISODate(); }; _proto.toISOTime = function toISOTime(opts) { if (!this.isValid) return INVALID$1; return this.s.toISOTime(opts) + "/" + this.e.toISOTime(opts); }; _proto.toFormat = function toFormat(dateFormat, _temp2) { var _ref3 = _temp2 === void 0 ? {} : _temp2, _ref3$separator = _ref3.separator, separator = _ref3$separator === void 0 ? " \u2013 " : _ref3$separator; if (!this.isValid) return INVALID$1; return "" + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat); }; _proto.toDuration = function toDuration(unit, opts) { if (!this.isValid) { return Duration.invalid(this.invalidReason); } return this.e.diff(this.s, unit, opts); }; _proto.mapEndpoints = function mapEndpoints(mapFn) { return Interval2.fromDateTimes(mapFn(this.s), mapFn(this.e)); }; _createClass(Interval2, [{ key: "start", get: function get() { return this.isValid ? this.s : null; } }, { key: "end", get: function get() { return this.isValid ? this.e : null; } }, { key: "isValid", get: function get() { return this.invalidReason === null; } }, { key: "invalidReason", get: function get() { return this.invalid ? this.invalid.reason : null; } }, { key: "invalidExplanation", get: function get() { return this.invalid ? this.invalid.explanation : null; } }]); return Interval2; }(); var Info = /* @__PURE__ */ function() { function Info2() { } Info2.hasDST = function hasDST(zone) { if (zone === void 0) { zone = Settings2.defaultZone; } var proto = DateTime5.now().setZone(zone).set({ month: 12 }); return !zone.universal && proto.offset !== proto.set({ month: 6 }).offset; }; Info2.isValidIANAZone = function isValidIANAZone(zone) { return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone); }; Info2.normalizeZone = function normalizeZone$1(input) { return normalizeZone(input, Settings2.defaultZone); }; Info2.months = function months2(length, _temp) { if (length === void 0) { length = "long"; } var _ref = _temp === void 0 ? {} : _temp, _ref$locale = _ref.locale, locale = _ref$locale === void 0 ? null : _ref$locale, _ref$numberingSystem = _ref.numberingSystem, numberingSystem = _ref$numberingSystem === void 0 ? null : _ref$numberingSystem, _ref$locObj = _ref.locObj, locObj = _ref$locObj === void 0 ? null : _ref$locObj, _ref$outputCalendar = _ref.outputCalendar, outputCalendar = _ref$outputCalendar === void 0 ? "gregory" : _ref$outputCalendar; return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length); }; Info2.monthsFormat = function monthsFormat(length, _temp2) { if (length === void 0) { length = "long"; } var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$locale = _ref2.locale, locale = _ref2$locale === void 0 ? null : _ref2$locale, _ref2$numberingSystem = _ref2.numberingSystem, numberingSystem = _ref2$numberingSystem === void 0 ? null : _ref2$numberingSystem, _ref2$locObj = _ref2.locObj, locObj = _ref2$locObj === void 0 ? null : _ref2$locObj, _ref2$outputCalendar = _ref2.outputCalendar, outputCalendar = _ref2$outputCalendar === void 0 ? "gregory" : _ref2$outputCalendar; return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true); }; Info2.weekdays = function weekdays2(length, _temp3) { if (length === void 0) { length = "long"; } var _ref3 = _temp3 === void 0 ? {} : _temp3, _ref3$locale = _ref3.locale, locale = _ref3$locale === void 0 ? null : _ref3$locale, _ref3$numberingSystem = _ref3.numberingSystem, numberingSystem = _ref3$numberingSystem === void 0 ? null : _ref3$numberingSystem, _ref3$locObj = _ref3.locObj, locObj = _ref3$locObj === void 0 ? null : _ref3$locObj; return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length); }; Info2.weekdaysFormat = function weekdaysFormat(length, _temp4) { if (length === void 0) { length = "long"; } var _ref4 = _temp4 === void 0 ? {} : _temp4, _ref4$locale = _ref4.locale, locale = _ref4$locale === void 0 ? null : _ref4$locale, _ref4$numberingSystem = _ref4.numberingSystem, numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem, _ref4$locObj = _ref4.locObj, locObj = _ref4$locObj === void 0 ? null : _ref4$locObj; return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true); }; Info2.meridiems = function meridiems2(_temp5) { var _ref5 = _temp5 === void 0 ? {} : _temp5, _ref5$locale = _ref5.locale, locale = _ref5$locale === void 0 ? null : _ref5$locale; return Locale.create(locale).meridiems(); }; Info2.eras = function eras2(length, _temp6) { if (length === void 0) { length = "short"; } var _ref6 = _temp6 === void 0 ? {} : _temp6, _ref6$locale = _ref6.locale, locale = _ref6$locale === void 0 ? null : _ref6$locale; return Locale.create(locale, null, "gregory").eras(length); }; Info2.features = function features() { var intl = false, intlTokens = false, zones = false, relative = false; if (hasIntl()) { intl = true; intlTokens = hasFormatToParts(); relative = hasRelative(); try { zones = new Intl.DateTimeFormat("en", { timeZone: "America/New_York" }).resolvedOptions().timeZone === "America/New_York"; } catch (e) { zones = false; } } return { intl, intlTokens, zones, relative }; }; return Info2; }(); function dayDiff(earlier, later) { var utcDayStart = function utcDayStart2(dt) { return dt.toUTC(0, { keepLocalTime: true }).startOf("day").valueOf(); }, ms = utcDayStart(later) - utcDayStart(earlier); return Math.floor(Duration.fromMillis(ms).as("days")); } function highOrderDiffs(cursor, later, units) { var differs = [["years", function(a, b) { return b.year - a.year; }], ["quarters", function(a, b) { return b.quarter - a.quarter; }], ["months", function(a, b) { return b.month - a.month + (b.year - a.year) * 12; }], ["weeks", function(a, b) { var days = dayDiff(a, b); return (days - days % 7) / 7; }], ["days", dayDiff]]; var results = {}; var lowestOrder, highWater; for (var _i = 0, _differs = differs; _i < _differs.length; _i++) { var _differs$_i = _differs[_i], unit = _differs$_i[0], differ = _differs$_i[1]; if (units.indexOf(unit) >= 0) { var _cursor$plus; lowestOrder = unit; var delta = differ(cursor, later); highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[unit] = delta, _cursor$plus)); if (highWater > later) { var _cursor$plus2; cursor = cursor.plus((_cursor$plus2 = {}, _cursor$plus2[unit] = delta - 1, _cursor$plus2)); delta -= 1; } else { cursor = highWater; } results[unit] = delta; } } return [cursor, results, highWater, lowestOrder]; } function _diff(earlier, later, units, opts) { var _highOrderDiffs = highOrderDiffs(earlier, later, units), cursor = _highOrderDiffs[0], results = _highOrderDiffs[1], highWater = _highOrderDiffs[2], lowestOrder = _highOrderDiffs[3]; var remainingMillis = later - cursor; var lowerOrderUnits = units.filter(function(u) { return ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0; }); if (lowerOrderUnits.length === 0) { if (highWater < later) { var _cursor$plus3; highWater = cursor.plus((_cursor$plus3 = {}, _cursor$plus3[lowestOrder] = 1, _cursor$plus3)); } if (highWater !== cursor) { results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); } } var duration = Duration.fromObject(Object.assign(results, opts)); if (lowerOrderUnits.length > 0) { var _Duration$fromMillis; return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration); } else { return duration; } } var numberingSystems = { arab: "[\u0660-\u0669]", arabext: "[\u06F0-\u06F9]", bali: "[\u1B50-\u1B59]", beng: "[\u09E6-\u09EF]", deva: "[\u0966-\u096F]", fullwide: "[\uFF10-\uFF19]", gujr: "[\u0AE6-\u0AEF]", hanidec: "[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]", khmr: "[\u17E0-\u17E9]", knda: "[\u0CE6-\u0CEF]", laoo: "[\u0ED0-\u0ED9]", limb: "[\u1946-\u194F]", mlym: "[\u0D66-\u0D6F]", mong: "[\u1810-\u1819]", mymr: "[\u1040-\u1049]", orya: "[\u0B66-\u0B6F]", tamldec: "[\u0BE6-\u0BEF]", telu: "[\u0C66-\u0C6F]", thai: "[\u0E50-\u0E59]", tibt: "[\u0F20-\u0F29]", latn: "\\d" }; var numberingSystemsUTF16 = { arab: [1632, 1641], arabext: [1776, 1785], bali: [6992, 7001], beng: [2534, 2543], deva: [2406, 2415], fullwide: [65296, 65303], gujr: [2790, 2799], khmr: [6112, 6121], knda: [3302, 3311], laoo: [3792, 3801], limb: [6470, 6479], mlym: [3430, 3439], mong: [6160, 6169], mymr: [4160, 4169], orya: [2918, 2927], tamldec: [3046, 3055], telu: [3174, 3183], thai: [3664, 3673], tibt: [3872, 3881] }; var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); function parseDigits(str) { var value = parseInt(str, 10); if (isNaN(value)) { value = ""; for (var i = 0; i < str.length; i++) { var code = str.charCodeAt(i); if (str[i].search(numberingSystems.hanidec) !== -1) { value += hanidecChars.indexOf(str[i]); } else { for (var key in numberingSystemsUTF16) { var _numberingSystemsUTF = numberingSystemsUTF16[key], min = _numberingSystemsUTF[0], max = _numberingSystemsUTF[1]; if (code >= min && code <= max) { value += code - min; } } } } return parseInt(value, 10); } else { return value; } } function digitRegex(_ref, append2) { var numberingSystem = _ref.numberingSystem; if (append2 === void 0) { append2 = ""; } return new RegExp("" + numberingSystems[numberingSystem || "latn"] + append2); } var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; function intUnit(regex, post) { if (post === void 0) { post = function post2(i) { return i; }; } return { regex, deser: function deser(_ref) { var s2 = _ref[0]; return post(parseDigits(s2)); } }; } var NBSP = String.fromCharCode(160); var spaceOrNBSP = "( |" + NBSP + ")"; var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); function fixListRegex(s2) { return s2.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP); } function stripInsensitivities(s2) { return s2.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase(); } function oneOf(strings, startIndex) { if (strings === null) { return null; } else { return { regex: RegExp(strings.map(fixListRegex).join("|")), deser: function deser(_ref2) { var s2 = _ref2[0]; return strings.findIndex(function(i) { return stripInsensitivities(s2) === stripInsensitivities(i); }) + startIndex; } }; } } function offset(regex, groups) { return { regex, deser: function deser(_ref3) { var h = _ref3[1], m = _ref3[2]; return signedOffset(h, m); }, groups }; } function simple(regex) { return { regex, deser: function deser(_ref4) { var s2 = _ref4[0]; return s2; } }; } function escapeToken(value) { return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); } function unitForToken(token, loc) { var one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = function literal2(t) { return { regex: RegExp(escapeToken(t.val)), deser: function deser(_ref5) { var s2 = _ref5[0]; return s2; }, literal: true }; }, unitate = function unitate2(t) { if (token.literal) { return literal(t); } switch (t.val) { case "G": return oneOf(loc.eras("short", false), 0); case "GG": return oneOf(loc.eras("long", false), 0); case "y": return intUnit(oneToSix); case "yy": return intUnit(twoToFour, untruncateYear); case "yyyy": return intUnit(four); case "yyyyy": return intUnit(fourToSix); case "yyyyyy": return intUnit(six); case "M": return intUnit(oneOrTwo); case "MM": return intUnit(two); case "MMM": return oneOf(loc.months("short", true, false), 1); case "MMMM": return oneOf(loc.months("long", true, false), 1); case "L": return intUnit(oneOrTwo); case "LL": return intUnit(two); case "LLL": return oneOf(loc.months("short", false, false), 1); case "LLLL": return oneOf(loc.months("long", false, false), 1); case "d": return intUnit(oneOrTwo); case "dd": return intUnit(two); case "o": return intUnit(oneToThree); case "ooo": return intUnit(three); case "HH": return intUnit(two); case "H": return intUnit(oneOrTwo); case "hh": return intUnit(two); case "h": return intUnit(oneOrTwo); case "mm": return intUnit(two); case "m": return intUnit(oneOrTwo); case "q": return intUnit(oneOrTwo); case "qq": return intUnit(two); case "s": return intUnit(oneOrTwo); case "ss": return intUnit(two); case "S": return intUnit(oneToThree); case "SSS": return intUnit(three); case "u": return simple(oneToNine); case "a": return oneOf(loc.meridiems(), 0); case "kkkk": return intUnit(four); case "kk": return intUnit(twoToFour, untruncateYear); case "W": return intUnit(oneOrTwo); case "WW": return intUnit(two); case "E": case "c": return intUnit(one); case "EEE": return oneOf(loc.weekdays("short", false, false), 1); case "EEEE": return oneOf(loc.weekdays("long", false, false), 1); case "ccc": return oneOf(loc.weekdays("short", true, false), 1); case "cccc": return oneOf(loc.weekdays("long", true, false), 1); case "Z": case "ZZ": return offset(new RegExp("([+-]" + oneOrTwo.source + ")(?::(" + two.source + "))?"), 2); case "ZZZ": return offset(new RegExp("([+-]" + oneOrTwo.source + ")(" + two.source + ")?"), 2); case "z": return simple(/[a-z_+-/]{1,256}?/i); default: return literal(t); } }; var unit = unitate(token) || { invalidReason: MISSING_FTP }; unit.token = token; return unit; } var partTypeStyleToTokenVal = { year: { "2-digit": "yy", numeric: "yyyyy" }, month: { numeric: "M", "2-digit": "MM", short: "MMM", long: "MMMM" }, day: { numeric: "d", "2-digit": "dd" }, weekday: { short: "EEE", long: "EEEE" }, dayperiod: "a", dayPeriod: "a", hour: { numeric: "h", "2-digit": "hh" }, minute: { numeric: "m", "2-digit": "mm" }, second: { numeric: "s", "2-digit": "ss" } }; function tokenForPart(part, locale, formatOpts) { var type = part.type, value = part.value; if (type === "literal") { return { literal: true, val: value }; } var style = formatOpts[type]; var val = partTypeStyleToTokenVal[type]; if (typeof val === "object") { val = val[style]; } if (val) { return { literal: false, val }; } return void 0; } function buildRegex(units) { var re = units.map(function(u) { return u.regex; }).reduce(function(f, r) { return f + "(" + r.source + ")"; }, ""); return ["^" + re + "$", units]; } function match(input, regex, handlers) { var matches = input.match(regex); if (matches) { var all = {}; var matchIndex = 1; for (var i in handlers) { if (hasOwnProperty(handlers, i)) { var h = handlers[i], groups = h.groups ? h.groups + 1 : 1; if (!h.literal && h.token) { all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); } matchIndex += groups; } } return [matches, all]; } else { return [matches, {}]; } } function dateTimeFromMatches(matches) { var toField = function toField2(token) { switch (token) { case "S": return "millisecond"; case "s": return "second"; case "m": return "minute"; case "h": case "H": return "hour"; case "d": return "day"; case "o": return "ordinal"; case "L": case "M": return "month"; case "y": return "year"; case "E": case "c": return "weekday"; case "W": return "weekNumber"; case "k": return "weekYear"; case "q": return "quarter"; default: return null; } }; var zone; if (!isUndefined(matches.Z)) { zone = new FixedOffsetZone(matches.Z); } else if (!isUndefined(matches.z)) { zone = IANAZone.create(matches.z); } else { zone = null; } if (!isUndefined(matches.q)) { matches.M = (matches.q - 1) * 3 + 1; } if (!isUndefined(matches.h)) { if (matches.h < 12 && matches.a === 1) { matches.h += 12; } else if (matches.h === 12 && matches.a === 0) { matches.h = 0; } } if (matches.G === 0 && matches.y) { matches.y = -matches.y; } if (!isUndefined(matches.u)) { matches.S = parseMillis(matches.u); } var vals = Object.keys(matches).reduce(function(r, k) { var f = toField(k); if (f) { r[f] = matches[k]; } return r; }, {}); return [vals, zone]; } var dummyDateTimeCache = null; function getDummyDateTime() { if (!dummyDateTimeCache) { dummyDateTimeCache = DateTime5.fromMillis(1555555555555); } return dummyDateTimeCache; } function maybeExpandMacroToken(token, locale) { if (token.literal) { return token; } var formatOpts = Formatter.macroTokenToFormatOpts(token.val); if (!formatOpts) { return token; } var formatter = Formatter.create(locale, formatOpts); var parts = formatter.formatDateTimeParts(getDummyDateTime()); var tokens = parts.map(function(p) { return tokenForPart(p, locale, formatOpts); }); if (tokens.includes(void 0)) { return token; } return tokens; } function expandMacroTokens(tokens, locale) { var _Array$prototype; return (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, tokens.map(function(t) { return maybeExpandMacroToken(t, locale); })); } function explainFromTokens(locale, input, format) { var tokens = expandMacroTokens(Formatter.parseFormat(format), locale), units = tokens.map(function(t) { return unitForToken(t, locale); }), disqualifyingUnit = units.find(function(t) { return t.invalidReason; }); if (disqualifyingUnit) { return { input, tokens, invalidReason: disqualifyingUnit.invalidReason }; } else { var _buildRegex = buildRegex(units), regexString = _buildRegex[0], handlers = _buildRegex[1], regex = RegExp(regexString, "i"), _match = match(input, regex, handlers), rawMatches = _match[0], matches = _match[1], _ref6 = matches ? dateTimeFromMatches(matches) : [null, null], result = _ref6[0], zone = _ref6[1]; if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); } return { input, tokens, regex, rawMatches, matches, result, zone }; } } function parseFromTokens(locale, input, format) { var _explainFromTokens = explainFromTokens(locale, input, format), result = _explainFromTokens.result, zone = _explainFromTokens.zone, invalidReason = _explainFromTokens.invalidReason; return [result, zone, invalidReason]; } var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; var leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; function unitOutOfRange(unit, value) { return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid"); } function dayOfWeek(year, month, day) { var js = new Date(Date.UTC(year, month - 1, day)).getUTCDay(); return js === 0 ? 7 : js; } function computeOrdinal(year, month, day) { return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; } function uncomputeOrdinal(year, ordinal) { var table = isLeapYear(year) ? leapLadder : nonLeapLadder, month0 = table.findIndex(function(i) { return i < ordinal; }), day = ordinal - table[month0]; return { month: month0 + 1, day }; } function gregorianToWeek(gregObj) { var year = gregObj.year, month = gregObj.month, day = gregObj.day, ordinal = computeOrdinal(year, month, day), weekday = dayOfWeek(year, month, day); var weekNumber = Math.floor((ordinal - weekday + 10) / 7), weekYear; if (weekNumber < 1) { weekYear = year - 1; weekNumber = weeksInWeekYear(weekYear); } else if (weekNumber > weeksInWeekYear(year)) { weekYear = year + 1; weekNumber = 1; } else { weekYear = year; } return Object.assign({ weekYear, weekNumber, weekday }, timeObject(gregObj)); } function weekToGregorian(weekData) { var weekYear = weekData.weekYear, weekNumber = weekData.weekNumber, weekday = weekData.weekday, weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), yearInDays = daysInYear(weekYear); var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, year; if (ordinal < 1) { year = weekYear - 1; ordinal += daysInYear(year); } else if (ordinal > yearInDays) { year = weekYear + 1; ordinal -= daysInYear(weekYear); } else { year = weekYear; } var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal), month = _uncomputeOrdinal.month, day = _uncomputeOrdinal.day; return Object.assign({ year, month, day }, timeObject(weekData)); } function gregorianToOrdinal(gregData) { var year = gregData.year, month = gregData.month, day = gregData.day, ordinal = computeOrdinal(year, month, day); return Object.assign({ year, ordinal }, timeObject(gregData)); } function ordinalToGregorian(ordinalData) { var year = ordinalData.year, ordinal = ordinalData.ordinal, _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal), month = _uncomputeOrdinal2.month, day = _uncomputeOrdinal2.day; return Object.assign({ year, month, day }, timeObject(ordinalData)); } function hasInvalidWeekData(obj) { var validYear = isInteger(obj.weekYear), validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), validWeekday = integerBetween(obj.weekday, 1, 7); if (!validYear) { return unitOutOfRange("weekYear", obj.weekYear); } else if (!validWeek) { return unitOutOfRange("week", obj.week); } else if (!validWeekday) { return unitOutOfRange("weekday", obj.weekday); } else return false; } function hasInvalidOrdinalData(obj) { var validYear = isInteger(obj.year), validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); if (!validYear) { return unitOutOfRange("year", obj.year); } else if (!validOrdinal) { return unitOutOfRange("ordinal", obj.ordinal); } else return false; } function hasInvalidGregorianData(obj) { var validYear = isInteger(obj.year), validMonth = integerBetween(obj.month, 1, 12), validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); if (!validYear) { return unitOutOfRange("year", obj.year); } else if (!validMonth) { return unitOutOfRange("month", obj.month); } else if (!validDay) { return unitOutOfRange("day", obj.day); } else return false; } function hasInvalidTimeData(obj) { var hour = obj.hour, minute = obj.minute, second = obj.second, millisecond = obj.millisecond; var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, validMinute = integerBetween(minute, 0, 59), validSecond = integerBetween(second, 0, 59), validMillisecond = integerBetween(millisecond, 0, 999); if (!validHour) { return unitOutOfRange("hour", hour); } else if (!validMinute) { return unitOutOfRange("minute", minute); } else if (!validSecond) { return unitOutOfRange("second", second); } else if (!validMillisecond) { return unitOutOfRange("millisecond", millisecond); } else return false; } var INVALID$2 = "Invalid DateTime"; var MAX_DATE = 864e13; function unsupportedZone(zone) { return new Invalid("unsupported zone", 'the zone "' + zone.name + '" is not supported'); } function possiblyCachedWeekData(dt) { if (dt.weekData === null) { dt.weekData = gregorianToWeek(dt.c); } return dt.weekData; } function clone$1(inst, alts) { var current = { ts: inst.ts, zone: inst.zone, c: inst.c, o: inst.o, loc: inst.loc, invalid: inst.invalid }; return new DateTime5(Object.assign({}, current, alts, { old: current })); } function fixOffset(localTS, o, tz) { var utcGuess = localTS - o * 60 * 1e3; var o2 = tz.offset(utcGuess); if (o === o2) { return [utcGuess, o]; } utcGuess -= (o2 - o) * 60 * 1e3; var o3 = tz.offset(utcGuess); if (o2 === o3) { return [utcGuess, o2]; } return [localTS - Math.min(o2, o3) * 60 * 1e3, Math.max(o2, o3)]; } function tsToObj(ts, offset2) { ts += offset2 * 60 * 1e3; var d = new Date(ts); return { year: d.getUTCFullYear(), month: d.getUTCMonth() + 1, day: d.getUTCDate(), hour: d.getUTCHours(), minute: d.getUTCMinutes(), second: d.getUTCSeconds(), millisecond: d.getUTCMilliseconds() }; } function objToTS(obj, offset2, zone) { return fixOffset(objToLocalTS(obj), offset2, zone); } function adjustTime(inst, dur) { var oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, c = Object.assign({}, inst.c, { year, month, day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7 }), millisToAdd = Duration.fromObject({ years: dur.years - Math.trunc(dur.years), quarters: dur.quarters - Math.trunc(dur.quarters), months: dur.months - Math.trunc(dur.months), weeks: dur.weeks - Math.trunc(dur.weeks), days: dur.days - Math.trunc(dur.days), hours: dur.hours, minutes: dur.minutes, seconds: dur.seconds, milliseconds: dur.milliseconds }).as("milliseconds"), localTS = objToLocalTS(c); var _fixOffset = fixOffset(localTS, oPre, inst.zone), ts = _fixOffset[0], o = _fixOffset[1]; if (millisToAdd !== 0) { ts += millisToAdd; o = inst.zone.offset(ts); } return { ts, o }; } function parseDataToDateTime(parsed, parsedZone, opts, format, text2) { var setZone = opts.setZone, zone = opts.zone; if (parsed && Object.keys(parsed).length !== 0) { var interpretationZone = parsedZone || zone, inst = DateTime5.fromObject(Object.assign(parsed, opts, { zone: interpretationZone, setZone: void 0 })); return setZone ? inst : inst.setZone(zone); } else { return DateTime5.invalid(new Invalid("unparsable", 'the input "' + text2 + `" can't be parsed as ` + format)); } } function toTechFormat(dt, format, allowZ) { if (allowZ === void 0) { allowZ = true; } return dt.isValid ? Formatter.create(Locale.create("en-US"), { allowZ, forceSimple: true }).formatDateTimeFromString(dt, format) : null; } function toTechTimeFormat(dt, _ref) { var _ref$suppressSeconds = _ref.suppressSeconds, suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds, _ref$suppressMillisec = _ref.suppressMilliseconds, suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec, includeOffset = _ref.includeOffset, _ref$includePrefix = _ref.includePrefix, includePrefix = _ref$includePrefix === void 0 ? false : _ref$includePrefix, _ref$includeZone = _ref.includeZone, includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone, _ref$spaceZone = _ref.spaceZone, spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone, _ref$format = _ref.format, format = _ref$format === void 0 ? "extended" : _ref$format; var fmt = format === "basic" ? "HHmm" : "HH:mm"; if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) { fmt += format === "basic" ? "ss" : ":ss"; if (!suppressMilliseconds || dt.millisecond !== 0) { fmt += ".SSS"; } } if ((includeZone || includeOffset) && spaceZone) { fmt += " "; } if (includeZone) { fmt += "z"; } else if (includeOffset) { fmt += format === "basic" ? "ZZZ" : "ZZ"; } var str = toTechFormat(dt, fmt); if (includePrefix) { str = "T" + str; } return str; } var defaultUnitValues = { month: 1, day: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }; var defaultWeekUnitValues = { weekNumber: 1, weekday: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }; var defaultOrdinalUnitValues = { ordinal: 1, hour: 0, minute: 0, second: 0, millisecond: 0 }; var orderedUnits$1 = ["year", "month", "day", "hour", "minute", "second", "millisecond"]; var orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"]; var orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; function normalizeUnit(unit) { var normalized = { year: "year", years: "year", month: "month", months: "month", day: "day", days: "day", hour: "hour", hours: "hour", minute: "minute", minutes: "minute", quarter: "quarter", quarters: "quarter", second: "second", seconds: "second", millisecond: "millisecond", milliseconds: "millisecond", weekday: "weekday", weekdays: "weekday", weeknumber: "weekNumber", weeksnumber: "weekNumber", weeknumbers: "weekNumber", weekyear: "weekYear", weekyears: "weekYear", ordinal: "ordinal" }[unit.toLowerCase()]; if (!normalized) throw new InvalidUnitError(unit); return normalized; } function quickDT(obj, zone) { for (var _iterator = _createForOfIteratorHelperLoose(orderedUnits$1), _step; !(_step = _iterator()).done; ) { var u = _step.value; if (isUndefined(obj[u])) { obj[u] = defaultUnitValues[u]; } } var invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); if (invalid) { return DateTime5.invalid(invalid); } var tsNow = Settings2.now(), offsetProvis = zone.offset(tsNow), _objToTS = objToTS(obj, offsetProvis, zone), ts = _objToTS[0], o = _objToTS[1]; return new DateTime5({ ts, zone, o }); } function diffRelative(start, end, opts) { var round = isUndefined(opts.round) ? true : opts.round, format = function format2(c, unit2) { c = roundTo(c, round || opts.calendary ? 0 : 2, true); var formatter = end.loc.clone(opts).relFormatter(opts); return formatter.format(c, unit2); }, differ = function differ2(unit2) { if (opts.calendary) { if (!end.hasSame(start, unit2)) { return end.startOf(unit2).diff(start.startOf(unit2), unit2).get(unit2); } else return 0; } else { return end.diff(start, unit2).get(unit2); } }; if (opts.unit) { return format(differ(opts.unit), opts.unit); } for (var _iterator2 = _createForOfIteratorHelperLoose(opts.units), _step2; !(_step2 = _iterator2()).done; ) { var unit = _step2.value; var count = differ(unit); if (Math.abs(count) >= 1) { return format(count, unit); } } return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]); } var DateTime5 = /* @__PURE__ */ function() { function DateTime6(config) { var zone = config.zone || Settings2.defaultZone; var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); this.ts = isUndefined(config.ts) ? Settings2.now() : config.ts; var c = null, o = null; if (!invalid) { var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); if (unchanged) { var _ref2 = [config.old.c, config.old.o]; c = _ref2[0]; o = _ref2[1]; } else { var ot = zone.offset(this.ts); c = tsToObj(this.ts, ot); invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; c = invalid ? null : c; o = invalid ? null : ot; } } this._zone = zone; this.loc = config.loc || Locale.create(); this.invalid = invalid; this.weekData = null; this.c = c; this.o = o; this.isLuxonDateTime = true; } DateTime6.now = function now2() { return new DateTime6({}); }; DateTime6.local = function local(year, month, day, hour, minute, second, millisecond) { if (isUndefined(year)) { return DateTime6.now(); } else { return quickDT({ year, month, day, hour, minute, second, millisecond }, Settings2.defaultZone); } }; DateTime6.utc = function utc(year, month, day, hour, minute, second, millisecond) { if (isUndefined(year)) { return new DateTime6({ ts: Settings2.now(), zone: FixedOffsetZone.utcInstance }); } else { return quickDT({ year, month, day, hour, minute, second, millisecond }, FixedOffsetZone.utcInstance); } }; DateTime6.fromJSDate = function fromJSDate(date, options) { if (options === void 0) { options = {}; } var ts = isDate(date) ? date.valueOf() : NaN; if (Number.isNaN(ts)) { return DateTime6.invalid("invalid input"); } var zoneToUse = normalizeZone(options.zone, Settings2.defaultZone); if (!zoneToUse.isValid) { return DateTime6.invalid(unsupportedZone(zoneToUse)); } return new DateTime6({ ts, zone: zoneToUse, loc: Locale.fromObject(options) }); }; DateTime6.fromMillis = function fromMillis(milliseconds, options) { if (options === void 0) { options = {}; } if (!isNumber2(milliseconds)) { throw new InvalidArgumentError("fromMillis requires a numerical input, but received a " + typeof milliseconds + " with value " + milliseconds); } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { return DateTime6.invalid("Timestamp out of range"); } else { return new DateTime6({ ts: milliseconds, zone: normalizeZone(options.zone, Settings2.defaultZone), loc: Locale.fromObject(options) }); } }; DateTime6.fromSeconds = function fromSeconds(seconds, options) { if (options === void 0) { options = {}; } if (!isNumber2(seconds)) { throw new InvalidArgumentError("fromSeconds requires a numerical input"); } else { return new DateTime6({ ts: seconds * 1e3, zone: normalizeZone(options.zone, Settings2.defaultZone), loc: Locale.fromObject(options) }); } }; DateTime6.fromObject = function fromObject(obj) { var zoneToUse = normalizeZone(obj.zone, Settings2.defaultZone); if (!zoneToUse.isValid) { return DateTime6.invalid(unsupportedZone(zoneToUse)); } var tsNow = Settings2.now(), offsetProvis = zoneToUse.offset(tsNow), normalized = normalizeObject(obj, normalizeUnit, ["zone", "locale", "outputCalendar", "numberingSystem"]), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber, loc = Locale.fromObject(obj); if ((containsGregor || containsOrdinal) && definiteWeekDef) { throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); } if (containsGregorMD && containsOrdinal) { throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); } var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; var units, defaultValues, objNow = tsToObj(tsNow, offsetProvis); if (useWeekData) { units = orderedWeekUnits; defaultValues = defaultWeekUnitValues; objNow = gregorianToWeek(objNow); } else if (containsOrdinal) { units = orderedOrdinalUnits; defaultValues = defaultOrdinalUnitValues; objNow = gregorianToOrdinal(objNow); } else { units = orderedUnits$1; defaultValues = defaultUnitValues; } var foundFirst = false; for (var _iterator3 = _createForOfIteratorHelperLoose(units), _step3; !(_step3 = _iterator3()).done; ) { var u = _step3.value; var v = normalized[u]; if (!isUndefined(v)) { foundFirst = true; } else if (foundFirst) { normalized[u] = defaultValues[u]; } else { normalized[u] = objNow[u]; } } var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized); if (invalid) { return DateTime6.invalid(invalid); } var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), tsFinal = _objToTS2[0], offsetFinal = _objToTS2[1], inst = new DateTime6({ ts: tsFinal, zone: zoneToUse, o: offsetFinal, loc }); if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { return DateTime6.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO()); } return inst; }; DateTime6.fromISO = function fromISO(text2, opts) { if (opts === void 0) { opts = {}; } var _parseISODate = parseISODate(text2), vals = _parseISODate[0], parsedZone = _parseISODate[1]; return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text2); }; DateTime6.fromRFC2822 = function fromRFC2822(text2, opts) { if (opts === void 0) { opts = {}; } var _parseRFC2822Date = parseRFC2822Date(text2), vals = _parseRFC2822Date[0], parsedZone = _parseRFC2822Date[1]; return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text2); }; DateTime6.fromHTTP = function fromHTTP(text2, opts) { if (opts === void 0) { opts = {}; } var _parseHTTPDate = parseHTTPDate(text2), vals = _parseHTTPDate[0], parsedZone = _parseHTTPDate[1]; return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); }; DateTime6.fromFormat = function fromFormat(text2, fmt, opts) { if (opts === void 0) { opts = {}; } if (isUndefined(text2) || isUndefined(fmt)) { throw new InvalidArgumentError("fromFormat requires an input string and a format"); } var _opts = opts, _opts$locale = _opts.locale, locale = _opts$locale === void 0 ? null : _opts$locale, _opts$numberingSystem = _opts.numberingSystem, numberingSystem = _opts$numberingSystem === void 0 ? null : _opts$numberingSystem, localeToUse = Locale.fromOpts({ locale, numberingSystem, defaultToEN: true }), _parseFromTokens = parseFromTokens(localeToUse, text2, fmt), vals = _parseFromTokens[0], parsedZone = _parseFromTokens[1], invalid = _parseFromTokens[2]; if (invalid) { return DateTime6.invalid(invalid); } else { return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text2); } }; DateTime6.fromString = function fromString(text2, fmt, opts) { if (opts === void 0) { opts = {}; } return DateTime6.fromFormat(text2, fmt, opts); }; DateTime6.fromSQL = function fromSQL(text2, opts) { if (opts === void 0) { opts = {}; } var _parseSQL = parseSQL(text2), vals = _parseSQL[0], parsedZone = _parseSQL[1]; return parseDataToDateTime(vals, parsedZone, opts, "SQL", text2); }; DateTime6.invalid = function invalid(reason, explanation) { if (explanation === void 0) { explanation = null; } if (!reason) { throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); } var invalid2 = reason instanceof Invalid ? reason : new Invalid(reason, explanation); if (Settings2.throwOnInvalid) { throw new InvalidDateTimeError(invalid2); } else { return new DateTime6({ invalid: invalid2 }); } }; DateTime6.isDateTime = function isDateTime(o) { return o && o.isLuxonDateTime || false; }; var _proto = DateTime6.prototype; _proto.get = function get(unit) { return this[unit]; }; _proto.resolvedLocaleOpts = function resolvedLocaleOpts(opts) { if (opts === void 0) { opts = {}; } var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this), locale = _Formatter$create$res.locale, numberingSystem = _Formatter$create$res.numberingSystem, calendar = _Formatter$create$res.calendar; return { locale, numberingSystem, outputCalendar: calendar }; }; _proto.toUTC = function toUTC(offset2, opts) { if (offset2 === void 0) { offset2 = 0; } if (opts === void 0) { opts = {}; } return this.setZone(FixedOffsetZone.instance(offset2), opts); }; _proto.toLocal = function toLocal() { return this.setZone(Settings2.defaultZone); }; _proto.setZone = function setZone(zone, _temp) { var _ref3 = _temp === void 0 ? {} : _temp, _ref3$keepLocalTime = _ref3.keepLocalTime, keepLocalTime = _ref3$keepLocalTime === void 0 ? false : _ref3$keepLocalTime, _ref3$keepCalendarTim = _ref3.keepCalendarTime, keepCalendarTime = _ref3$keepCalendarTim === void 0 ? false : _ref3$keepCalendarTim; zone = normalizeZone(zone, Settings2.defaultZone); if (zone.equals(this.zone)) { return this; } else if (!zone.isValid) { return DateTime6.invalid(unsupportedZone(zone)); } else { var newTS = this.ts; if (keepLocalTime || keepCalendarTime) { var offsetGuess = zone.offset(this.ts); var asObj = this.toObject(); var _objToTS3 = objToTS(asObj, offsetGuess, zone); newTS = _objToTS3[0]; } return clone$1(this, { ts: newTS, zone }); } }; _proto.reconfigure = function reconfigure(_temp2) { var _ref4 = _temp2 === void 0 ? {} : _temp2, locale = _ref4.locale, numberingSystem = _ref4.numberingSystem, outputCalendar = _ref4.outputCalendar; var loc = this.loc.clone({ locale, numberingSystem, outputCalendar }); return clone$1(this, { loc }); }; _proto.setLocale = function setLocale(locale) { return this.reconfigure({ locale }); }; _proto.set = function set(values) { if (!this.isValid) return this; var normalized = normalizeObject(values, normalizeUnit, []), settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber; if ((containsGregor || containsOrdinal) && definiteWeekDef) { throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); } if (containsGregorMD && containsOrdinal) { throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); } var mixed; if (settingWeekStuff) { mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized)); } else if (!isUndefined(normalized.ordinal)) { mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized)); } else { mixed = Object.assign(this.toObject(), normalized); if (isUndefined(normalized.day)) { mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); } } var _objToTS4 = objToTS(mixed, this.o, this.zone), ts = _objToTS4[0], o = _objToTS4[1]; return clone$1(this, { ts, o }); }; _proto.plus = function plus(duration) { if (!this.isValid) return this; var dur = friendlyDuration(duration); return clone$1(this, adjustTime(this, dur)); }; _proto.minus = function minus(duration) { if (!this.isValid) return this; var dur = friendlyDuration(duration).negate(); return clone$1(this, adjustTime(this, dur)); }; _proto.startOf = function startOf(unit) { if (!this.isValid) return this; var o = {}, normalizedUnit = Duration.normalizeUnit(unit); switch (normalizedUnit) { case "years": o.month = 1; case "quarters": case "months": o.day = 1; case "weeks": case "days": o.hour = 0; case "hours": o.minute = 0; case "minutes": o.second = 0; case "seconds": o.millisecond = 0; break; } if (normalizedUnit === "weeks") { o.weekday = 1; } if (normalizedUnit === "quarters") { var q = Math.ceil(this.month / 3); o.month = (q - 1) * 3 + 1; } return this.set(o); }; _proto.endOf = function endOf(unit) { var _this$plus; return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit).minus(1) : this; }; _proto.toFormat = function toFormat(fmt, opts) { if (opts === void 0) { opts = {}; } return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID$2; }; _proto.toLocaleString = function toLocaleString(opts) { if (opts === void 0) { opts = DATE_SHORT; } return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) : INVALID$2; }; _proto.toLocaleParts = function toLocaleParts(opts) { if (opts === void 0) { opts = {}; } return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; }; _proto.toISO = function toISO(opts) { if (opts === void 0) { opts = {}; } if (!this.isValid) { return null; } return this.toISODate(opts) + "T" + this.toISOTime(opts); }; _proto.toISODate = function toISODate(_temp3) { var _ref5 = _temp3 === void 0 ? {} : _temp3, _ref5$format = _ref5.format, format = _ref5$format === void 0 ? "extended" : _ref5$format; var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd"; if (this.year > 9999) { fmt = "+" + fmt; } return toTechFormat(this, fmt); }; _proto.toISOWeekDate = function toISOWeekDate() { return toTechFormat(this, "kkkk-'W'WW-c"); }; _proto.toISOTime = function toISOTime(_temp4) { var _ref6 = _temp4 === void 0 ? {} : _temp4, _ref6$suppressMillise = _ref6.suppressMilliseconds, suppressMilliseconds = _ref6$suppressMillise === void 0 ? false : _ref6$suppressMillise, _ref6$suppressSeconds = _ref6.suppressSeconds, suppressSeconds = _ref6$suppressSeconds === void 0 ? false : _ref6$suppressSeconds, _ref6$includeOffset = _ref6.includeOffset, includeOffset = _ref6$includeOffset === void 0 ? true : _ref6$includeOffset, _ref6$includePrefix = _ref6.includePrefix, includePrefix = _ref6$includePrefix === void 0 ? false : _ref6$includePrefix, _ref6$format = _ref6.format, format = _ref6$format === void 0 ? "extended" : _ref6$format; return toTechTimeFormat(this, { suppressSeconds, suppressMilliseconds, includeOffset, includePrefix, format }); }; _proto.toRFC2822 = function toRFC2822() { return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); }; _proto.toHTTP = function toHTTP() { return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); }; _proto.toSQLDate = function toSQLDate() { return toTechFormat(this, "yyyy-MM-dd"); }; _proto.toSQLTime = function toSQLTime(_temp5) { var _ref7 = _temp5 === void 0 ? {} : _temp5, _ref7$includeOffset = _ref7.includeOffset, includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset, _ref7$includeZone = _ref7.includeZone, includeZone = _ref7$includeZone === void 0 ? false : _ref7$includeZone; return toTechTimeFormat(this, { includeOffset, includeZone, spaceZone: true }); }; _proto.toSQL = function toSQL(opts) { if (opts === void 0) { opts = {}; } if (!this.isValid) { return null; } return this.toSQLDate() + " " + this.toSQLTime(opts); }; _proto.toString = function toString() { return this.isValid ? this.toISO() : INVALID$2; }; _proto.valueOf = function valueOf() { return this.toMillis(); }; _proto.toMillis = function toMillis() { return this.isValid ? this.ts : NaN; }; _proto.toSeconds = function toSeconds() { return this.isValid ? this.ts / 1e3 : NaN; }; _proto.toJSON = function toJSON() { return this.toISO(); }; _proto.toBSON = function toBSON() { return this.toJSDate(); }; _proto.toObject = function toObject(opts) { if (opts === void 0) { opts = {}; } if (!this.isValid) return {}; var base = Object.assign({}, this.c); if (opts.includeConfig) { base.outputCalendar = this.outputCalendar; base.numberingSystem = this.loc.numberingSystem; base.locale = this.loc.locale; } return base; }; _proto.toJSDate = function toJSDate() { return new Date(this.isValid ? this.ts : NaN); }; _proto.diff = function diff(otherDateTime, unit, opts) { if (unit === void 0) { unit = "milliseconds"; } if (opts === void 0) { opts = {}; } if (!this.isValid || !otherDateTime.isValid) { return Duration.invalid(this.invalid || otherDateTime.invalid, "created by diffing an invalid DateTime"); } var durOpts = Object.assign({ locale: this.locale, numberingSystem: this.numberingSystem }, opts); var units = maybeArray(unit).map(Duration.normalizeUnit), otherIsLater = otherDateTime.valueOf() > this.valueOf(), earlier = otherIsLater ? this : otherDateTime, later = otherIsLater ? otherDateTime : this, diffed = _diff(earlier, later, units, durOpts); return otherIsLater ? diffed.negate() : diffed; }; _proto.diffNow = function diffNow(unit, opts) { if (unit === void 0) { unit = "milliseconds"; } if (opts === void 0) { opts = {}; } return this.diff(DateTime6.now(), unit, opts); }; _proto.until = function until(otherDateTime) { return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; }; _proto.hasSame = function hasSame(otherDateTime, unit) { if (!this.isValid) return false; var inputMs = otherDateTime.valueOf(); var otherZoneDateTime = this.setZone(otherDateTime.zone, { keepLocalTime: true }); return otherZoneDateTime.startOf(unit) <= inputMs && inputMs <= otherZoneDateTime.endOf(unit); }; _proto.equals = function equals(other) { return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); }; _proto.toRelative = function toRelative(options) { if (options === void 0) { options = {}; } if (!this.isValid) return null; var base = options.base || DateTime6.fromObject({ zone: this.zone }), padding = options.padding ? this < base ? -options.padding : options.padding : 0; var units = ["years", "months", "days", "hours", "minutes", "seconds"]; var unit = options.unit; if (Array.isArray(options.unit)) { units = options.unit; unit = void 0; } return diffRelative(base, this.plus(padding), Object.assign(options, { numeric: "always", units, unit })); }; _proto.toRelativeCalendar = function toRelativeCalendar(options) { if (options === void 0) { options = {}; } if (!this.isValid) return null; return diffRelative(options.base || DateTime6.fromObject({ zone: this.zone }), this, Object.assign(options, { numeric: "auto", units: ["years", "months", "days"], calendary: true })); }; DateTime6.min = function min() { for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { dateTimes[_key] = arguments[_key]; } if (!dateTimes.every(DateTime6.isDateTime)) { throw new InvalidArgumentError("min requires all arguments be DateTimes"); } return bestBy(dateTimes, function(i) { return i.valueOf(); }, Math.min); }; DateTime6.max = function max() { for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { dateTimes[_key2] = arguments[_key2]; } if (!dateTimes.every(DateTime6.isDateTime)) { throw new InvalidArgumentError("max requires all arguments be DateTimes"); } return bestBy(dateTimes, function(i) { return i.valueOf(); }, Math.max); }; DateTime6.fromFormatExplain = function fromFormatExplain(text2, fmt, options) { if (options === void 0) { options = {}; } var _options = options, _options$locale = _options.locale, locale = _options$locale === void 0 ? null : _options$locale, _options$numberingSys = _options.numberingSystem, numberingSystem = _options$numberingSys === void 0 ? null : _options$numberingSys, localeToUse = Locale.fromOpts({ locale, numberingSystem, defaultToEN: true }); return explainFromTokens(localeToUse, text2, fmt); }; DateTime6.fromStringExplain = function fromStringExplain(text2, fmt, options) { if (options === void 0) { options = {}; } return DateTime6.fromFormatExplain(text2, fmt, options); }; _createClass(DateTime6, [{ key: "isValid", get: function get() { return this.invalid === null; } }, { key: "invalidReason", get: function get() { return this.invalid ? this.invalid.reason : null; } }, { key: "invalidExplanation", get: function get() { return this.invalid ? this.invalid.explanation : null; } }, { key: "locale", get: function get() { return this.isValid ? this.loc.locale : null; } }, { key: "numberingSystem", get: function get() { return this.isValid ? this.loc.numberingSystem : null; } }, { key: "outputCalendar", get: function get() { return this.isValid ? this.loc.outputCalendar : null; } }, { key: "zone", get: function get() { return this._zone; } }, { key: "zoneName", get: function get() { return this.isValid ? this.zone.name : null; } }, { key: "year", get: function get() { return this.isValid ? this.c.year : NaN; } }, { key: "quarter", get: function get() { return this.isValid ? Math.ceil(this.c.month / 3) : NaN; } }, { key: "month", get: function get() { return this.isValid ? this.c.month : NaN; } }, { key: "day", get: function get() { return this.isValid ? this.c.day : NaN; } }, { key: "hour", get: function get() { return this.isValid ? this.c.hour : NaN; } }, { key: "minute", get: function get() { return this.isValid ? this.c.minute : NaN; } }, { key: "second", get: function get() { return this.isValid ? this.c.second : NaN; } }, { key: "millisecond", get: function get() { return this.isValid ? this.c.millisecond : NaN; } }, { key: "weekYear", get: function get() { return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; } }, { key: "weekNumber", get: function get() { return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; } }, { key: "weekday", get: function get() { return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; } }, { key: "ordinal", get: function get() { return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; } }, { key: "monthShort", get: function get() { return this.isValid ? Info.months("short", { locObj: this.loc })[this.month - 1] : null; } }, { key: "monthLong", get: function get() { return this.isValid ? Info.months("long", { locObj: this.loc })[this.month - 1] : null; } }, { key: "weekdayShort", get: function get() { return this.isValid ? Info.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null; } }, { key: "weekdayLong", get: function get() { return this.isValid ? Info.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null; } }, { key: "offset", get: function get() { return this.isValid ? +this.o : NaN; } }, { key: "offsetNameShort", get: function get() { if (this.isValid) { return this.zone.offsetName(this.ts, { format: "short", locale: this.locale }); } else { return null; } } }, { key: "offsetNameLong", get: function get() { if (this.isValid) { return this.zone.offsetName(this.ts, { format: "long", locale: this.locale }); } else { return null; } } }, { key: "isOffsetFixed", get: function get() { return this.isValid ? this.zone.universal : null; } }, { key: "isInDST", get: function get() { if (this.isOffsetFixed) { return false; } else { return this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset; } } }, { key: "isInLeapYear", get: function get() { return isLeapYear(this.year); } }, { key: "daysInMonth", get: function get() { return daysInMonth(this.year, this.month); } }, { key: "daysInYear", get: function get() { return this.isValid ? daysInYear(this.year) : NaN; } }, { key: "weeksInWeekYear", get: function get() { return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; } }], [{ key: "DATE_SHORT", get: function get() { return DATE_SHORT; } }, { key: "DATE_MED", get: function get() { return DATE_MED; } }, { key: "DATE_MED_WITH_WEEKDAY", get: function get() { return DATE_MED_WITH_WEEKDAY; } }, { key: "DATE_FULL", get: function get() { return DATE_FULL; } }, { key: "DATE_HUGE", get: function get() { return DATE_HUGE; } }, { key: "TIME_SIMPLE", get: function get() { return TIME_SIMPLE; } }, { key: "TIME_WITH_SECONDS", get: function get() { return TIME_WITH_SECONDS; } }, { key: "TIME_WITH_SHORT_OFFSET", get: function get() { return TIME_WITH_SHORT_OFFSET; } }, { key: "TIME_WITH_LONG_OFFSET", get: function get() { return TIME_WITH_LONG_OFFSET; } }, { key: "TIME_24_SIMPLE", get: function get() { return TIME_24_SIMPLE; } }, { key: "TIME_24_WITH_SECONDS", get: function get() { return TIME_24_WITH_SECONDS; } }, { key: "TIME_24_WITH_SHORT_OFFSET", get: function get() { return TIME_24_WITH_SHORT_OFFSET; } }, { key: "TIME_24_WITH_LONG_OFFSET", get: function get() { return TIME_24_WITH_LONG_OFFSET; } }, { key: "DATETIME_SHORT", get: function get() { return DATETIME_SHORT; } }, { key: "DATETIME_SHORT_WITH_SECONDS", get: function get() { return DATETIME_SHORT_WITH_SECONDS; } }, { key: "DATETIME_MED", get: function get() { return DATETIME_MED; } }, { key: "DATETIME_MED_WITH_SECONDS", get: function get() { return DATETIME_MED_WITH_SECONDS; } }, { key: "DATETIME_MED_WITH_WEEKDAY", get: function get() { return DATETIME_MED_WITH_WEEKDAY; } }, { key: "DATETIME_FULL", get: function get() { return DATETIME_FULL; } }, { key: "DATETIME_FULL_WITH_SECONDS", get: function get() { return DATETIME_FULL_WITH_SECONDS; } }, { key: "DATETIME_HUGE", get: function get() { return DATETIME_HUGE; } }, { key: "DATETIME_HUGE_WITH_SECONDS", get: function get() { return DATETIME_HUGE_WITH_SECONDS; } }]); return DateTime6; }(); function friendlyDateTime(dateTimeish) { if (DateTime5.isDateTime(dateTimeish)) { return dateTimeish; } else if (dateTimeish && dateTimeish.valueOf && isNumber2(dateTimeish.valueOf())) { return DateTime5.fromJSDate(dateTimeish); } else if (dateTimeish && typeof dateTimeish === "object") { return DateTime5.fromObject(dateTimeish); } else { throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish); } } var VERSION = "1.28.0"; exports.DateTime = DateTime5; exports.Duration = Duration; exports.FixedOffsetZone = FixedOffsetZone; exports.IANAZone = IANAZone; exports.Info = Info; exports.Interval = Interval; exports.InvalidZone = InvalidZone; exports.LocalZone = LocalZone; exports.Settings = Settings2; exports.VERSION = VERSION; exports.Zone = Zone; } }); // src/main.ts var main_exports = {}; __export(main_exports, { default: () => ReminderPlugin }); module.exports = __toCommonJS(main_exports); // src/controller.ts var import_obsidian3 = require("obsidian"); // src/model/format/markdown.ts var _Todo = class { constructor(lineIndex, prefix, check, suffix, body) { this.lineIndex = lineIndex; this.prefix = prefix; this.check = check; this.suffix = suffix; this.body = body; } static parse(lineIndex, line) { const match = _Todo.regexp.exec(line); if (match) { return new _Todo( lineIndex, match.groups["prefix"], match.groups["check"], match.groups["suffix"], match.groups["body"] ); } return null; } toMarkdown() { return `${this.prefix}${this.check}${this.suffix}${this.body}`; } isChecked() { return this.check === "x"; } setChecked(checked) { this.check = checked ? "x" : " "; } getHeaderLength() { return this.prefix.length + this.check.length + this.suffix.length; } clone() { return _Todo.parse(this.lineIndex, this.toMarkdown()); } }; var Todo = _Todo; Todo.regexp = new RegExp("^(?((> ?)*)?\\s*[\\-\\*] \\[)(?.)(?\\]\\s+)(?.*)$"); var MarkdownDocument = class { constructor(file, content) { this.file = file; this.lines = []; this.todos = []; this.parse(content); } parse(content) { this.lines = content.split("\n"); this.todos = []; this.lines.forEach((line, lineIndex) => { const todo = Todo.parse(lineIndex, line); if (todo) { this.todos.push(todo); } }); } getTodos() { return this.todos; } insertTodo(lineIndex, todo) { todo.lineIndex = lineIndex; this.lines.splice(lineIndex, 0, todo.toMarkdown()); let todoIndex = -1; for (const i in this.todos) { const todo2 = this.todos[i]; if (todo2.lineIndex >= lineIndex) { if (todoIndex < 0) { todoIndex = parseInt(i); } todo2.lineIndex++; } } if (todoIndex <= 0) { this.todos.splice(0, 0, todo); } else { this.todos.splice(todoIndex, 0, todo); } } getTodo(lineIndex) { const found = this.todos.find((todo) => todo.lineIndex === lineIndex); if (found == null) { return null; } return found; } applyChanges() { this.todos.forEach((todo) => { this.lines[todo.lineIndex] = todo.toMarkdown(); }); } toMarkdown() { this.applyChanges(); return this.lines.join("\n"); } }; // src/model/ref.ts var ConstantReference = class { constructor(_value) { this._value = _value; } get value() { return this._value; } }; var Reference = class { constructor(_value) { this._value = _value; this.onChangeFunctions = []; } onChanged(listener) { this.onChangeFunctions.push(listener); } get value() { return this._value; } set value(value) { const oldValue = this._value; this._value = value; this.onChangeFunctions.forEach((f) => { f(oldValue, value); }); } }; // src/model/time.ts var import_moment = __toESM(require_moment()); var DateTime = class { constructor(time, _hasTimePart) { this.time = time; this._hasTimePart = _hasTimePart; } static now() { return new DateTime((0, import_moment.default)(), true); } static parse(time) { if (time.length > 10) { return new DateTime((0, import_moment.default)(time, "YYYY-MM-DD HH:mm"), true); } else { return new DateTime((0, import_moment.default)(time, "YYYY-MM-DD"), false); } } static duration(from, to, unit, defaultTime) { return to.fixedTime(defaultTime).diff(from.fixedTime(defaultTime), unit); } getTimeInMillis(defaultTime) { return this.fixedTime(defaultTime).valueOf(); } format(format, defaultTime) { return this.fixedTime(defaultTime).format(format); } toYYYYMMMM(defaultTime) { return this.fixedTime(defaultTime).format("YYYY, MMMM"); } toYYYYMMDD(defaultTime) { return this.fixedTime(defaultTime).format("YYYY-MM-DD"); } add(amount, unit, defaultTime) { return new DateTime( this.fixedTime(defaultTime).clone().add(amount, unit), this._hasTimePart ); } fixedTime(defaultTime) { if (this._hasTimePart) { return this.time; } if (defaultTime === void 0) { return this.time; } return this.time.clone().add(defaultTime.minutes, "minutes"); } get hasTimePart() { return this._hasTimePart; } moment() { return this.time; } isValid() { return this.time.isValid(); } clone(hasTimePart) { const withTimePart = hasTimePart == null ? this._hasTimePart : hasTimePart; const clone = this.time.clone(); return new DateTime(clone, withTimePart); } toString() { if (this._hasTimePart) { return this.format("YYYY-MM-DD HH:mm"); } else { return this.format("YYYY-MM-DD"); } } equals(time) { return this._hasTimePart === time._hasTimePart && this.time.isSame(time.time); } }; var Time = class { constructor(hour, minute) { this.hour = hour; this.minute = minute; } static parse(text2) { if (!text2.match(/^\d{1,2}:\d{1,2}$/)) { throw `Unexpected format time(${text2}). Time must be HH:mm.`; } const s = text2.split(":"); if (s.length !== 2) { throw `Unexpected format time(${text2}). time must be HH:mm.`; } const hour = parseInt(s[0]); const minute = parseInt(s[1]); if (hour > 23 || hour < 0) { throw `hour must be 0~23`; } if (minute > 59 || minute < 0) { throw `minute must be 0~59`; } return new Time(hour, minute); } get minutes() { return this.hour * 60 + this.minute; } toString() { const pad = (n) => { if (n < 10) { return "0" + n; } return "" + n; }; return `${pad(this.hour)}:${pad(this.minute)}`; } }; function add(amount, unit) { return () => { return new DateTime((0, import_moment.default)(), true).add(amount, unit); }; } function inMinutes(minutes) { return add(minutes, "minutes"); } function inHours(hours) { return add(hours, "hours"); } function inDays(days) { return add(days, "days"); } function inWeeks(weeks) { return add(weeks, "weeks"); } function inMonths(months) { return add(months, "months"); } function inYears(years) { return add(years, "years"); } function nextWeekday(weekday) { return () => { const today = (0, import_moment.default)(); if (today.isoWeekday() <= weekday) { return new DateTime(today.isoWeekday(weekday), false); } else { return new DateTime(today.add(1, "weeks").isoWeekday(weekday), false); } }; } function tomorrow() { return () => { return new DateTime((0, import_moment.default)().add(1, "days"), false); }; } function nextWeek() { return () => { return new DateTime((0, import_moment.default)().add(1, "weeks"), false); }; } function nextMonth() { return () => { return new DateTime((0, import_moment.default)().add(1, "months"), false); }; } function nextYear() { return () => { return new DateTime((0, import_moment.default)().add(1, "years"), false); }; } var Later = class { constructor(label, later) { this.label = label; this.later = later; } }; function parseLaters(laters) { return laters.split("\n").map((l) => parseLater(l.trim())); } function parseLater(later) { later = later.toLowerCase(); if (later.startsWith("in")) { const tokens = later.split(" "); if (tokens.length !== 3) { throw `Unsupported format. Should be 'In N (minutes|hours)'`; } const n = tokens[1] === "a" || tokens[1] === "an" ? 1 : parseInt(tokens[1]); switch (tokens[2]) { case "minute": case "minutes": { const unit = n == 1 ? "minute" : "minutes"; return new Later(`In ${n} ${unit}`, inMinutes(n)); } case "hour": case "hours": { const unit = n == 1 ? "hour" : "hours"; return new Later(`In ${n} ${unit}`, inHours(n)); } case "day": case "days": { const unit = n == 1 ? "day" : "days"; return new Later(`In ${n} ${unit}`, inDays(n)); } case "week": case "weeks": { const unit = n == 1 ? "week" : "weeks"; return new Later(`In ${n} ${unit}`, inWeeks(n)); } case "month": case "months": { const unit = n == 1 ? "month" : "months"; return new Later(`In ${n} ${unit}`, inMonths(n)); } case "year": case "years": { const unit = n == 1 ? "year" : "years"; return new Later(`In ${n} ${unit}`, inYears(n)); } } } else if (later.startsWith("next")) { const weekday = later.substring(5); switch (weekday) { case "sunday": return new Later("Next Sunday", nextWeekday(0)); case "monday": return new Later("Next Monday", nextWeekday(1)); case "tuesday": return new Later("Next Tuesday", nextWeekday(2)); case "wednesday": return new Later("Next Wednesday", nextWeekday(3)); case "thursday": return new Later("Next Thursday", nextWeekday(4)); case "friday": return new Later("Next Friday", nextWeekday(5)); case "saturday": return new Later("Next Saturday", nextWeekday(6)); case "day": return new Later("Tomorrow", tomorrow()); case "week": return new Later("Next week", nextWeek()); case "month": return new Later("Next month", nextMonth()); case "year": return new Later("Next year", nextYear()); default: throw `Unsupported weekday: ${weekday}`; } } else if (later === "tomorrow") { return new Later("Tomorrow", tomorrow()); } throw `Unsupported format: ${later}`; } var DEFAULT_LATERS = [ new Later("In 30 minutes", inMinutes(30)), new Later("In 1 hours", inHours(1)), new Later("In 3 hours", inHours(3)), new Later("Tomorrow", tomorrow()), new Later("Next week", nextWeek()) ]; var DateTimeFormatter = class { constructor() { this.dateFormat = new ConstantReference("YYYY-MM-DD"); this.dateTimeFormat = new ConstantReference("YYYY-MM-DD HH:mm"); this.strict = new ConstantReference(false); } setTimeFormat(dateFormat, dateTimeFormat, strict) { this.dateFormat = dateFormat; this.dateTimeFormat = dateTimeFormat; this.strict = strict; } parse(text2) { const parsed = this.doParse(text2, true); if (parsed != null) { return parsed; } if (this.strict.value) { return null; } return this.doParse(text2, false); } doParse(text2, strict) { const dateTime = (0, import_moment.default)(text2, this.dateTimeFormat.value, strict); if (dateTime.isValid()) { return new DateTime(dateTime, true); } const date = (0, import_moment.default)(text2, this.dateFormat.value, strict); if (date.isValid()) { return new DateTime(date, false); } return null; } toString(time) { if (time.hasTimePart) { return time.format(this.dateTimeFormat.value); } else { return time.format(this.dateFormat.value); } } }; var DATE_TIME_FORMATTER = new DateTimeFormatter(); // src/model/reminder.ts var Reminder = class { constructor(file, title, time, rowNumber, done) { this.file = file; this.title = title; this.time = time; this.rowNumber = rowNumber; this.done = done; this.muteNotification = false; this.beingDisplayed = false; } key() { return this.file + this.title + this.time.toString(); } equals(reminder) { return this.rowNumber === reminder.rowNumber && this.title === reminder.title && this.time.equals(reminder.time) && this.file === reminder.file; } getFileName() { const p = this.file.split(/[\/\\]/); return p[p.length - 1].replace(/^(.*?)(\..+)?$/, "$1"); } static extractFileName(path) { const p = path.split(/[\/\\]/); return p[p.length - 1].replace(/^(.*?)(\..+)?$/, "$1"); } }; var Reminders = class { constructor(onChange) { this.onChange = onChange; this.fileToReminders = /* @__PURE__ */ new Map(); this.reminders = []; } getExpiredReminders(defaultTime) { const now = new Date().getTime(); const result = []; for (let i = 0; i < this.reminders.length; i++) { const reminder = this.reminders[i]; if (reminder.time.getTimeInMillis(defaultTime) <= now) { result.push(reminder); } else { break; } } return result; } byDate(date) { return this.reminders.filter((reminder) => reminder.time.toYYYYMMDD() === date.toYYYYMMDD()); } removeReminder(reminder) { console.debug("Remove reminder: %o", reminder); this.reminders.remove(reminder); const file = this.fileToReminders.get(reminder.file); if (file) { file.remove(reminder); if (file.length === 0) { this.fileToReminders.delete(reminder.file); } } this.onChange(); } clear() { this.fileToReminders.clear(); this.reminders = []; this.onChange(); } removeFile(filePath) { if (this.fileToReminders.delete(filePath)) { this.sortReminders(); return true; } return false; } replaceFile(filePath, reminders) { const oldReminders = this.fileToReminders.get(filePath); if (oldReminders) { if (this.equals(oldReminders, reminders)) { return false; } const reminderToNotificationVisible = /* @__PURE__ */ new Map(); for (const reminder of oldReminders) { reminderToNotificationVisible.set(reminder.key(), reminder.muteNotification); } for (const reminder of reminders) { const visible = reminderToNotificationVisible.get(reminder.key()); reminderToNotificationVisible.set(reminder.key(), reminder.muteNotification); if (visible !== void 0) { reminder.muteNotification = visible; } } } this.fileToReminders.set(filePath, reminders); this.sortReminders(); return true; } equals(r1, r2) { if (r1.length !== r2.length) { return false; } this.sort(r1); this.sort(r2); for (const i in r1) { const reminder1 = r1[i]; const reminder2 = r2[i]; if (reminder1 == null && reminder2 != null) { return false; } if (reminder2 == null && reminder1 != null) { return false; } if (reminder1 == null && reminder2 == null) { continue; } if (!reminder1.equals(reminder2)) { return false; } } return true; } sortReminders() { const reminders = []; for (const r of this.fileToReminders.values()) { reminders.push(...r); } this.sort(reminders); this.reminders = reminders; this.onChange(); } sort(reminders) { reminders.sort((a, b) => { var _a, _b; const d = a.time.getTimeInMillis((_a = this.reminderTime) == null ? void 0 : _a.value) - b.time.getTimeInMillis((_b = this.reminderTime) == null ? void 0 : _b.value); return d > 0 ? 1 : d < 0 ? -1 : 0; }); } }; function generateGroup(time, now, reminderTime) { const days = DateTime.duration(now, time, "days", reminderTime); if (days > 30) { return new Group( time.toYYYYMMMM(reminderTime), (time2) => time2.format("MM/DD", reminderTime) ); } if (days >= 7) { return new Group( "Over 1 week", (time2) => time2.format("MM/DD", reminderTime) ); } if (time.toYYYYMMDD(reminderTime) === now.toYYYYMMDD(reminderTime)) { const todaysGroup = new Group( "Today", (time2) => time2.format("HH:mm", reminderTime) ); todaysGroup.isToday = true; return todaysGroup; } if (time.toYYYYMMDD(reminderTime) === now.add(1, "days", reminderTime).toYYYYMMDD()) { return new Group("Tomorrow", (time2) => time2.format("HH:mm", reminderTime)); } return new Group( time.format("M/DD (ddd)", reminderTime), (time2) => time2.format("HH:mm", reminderTime) ); } var Group = class { constructor(name, timeToStringFunc) { this.name = name; this.timeToStringFunc = timeToStringFunc; this.isToday = false; this.isOverdue = false; } timeToString(time) { return this.timeToStringFunc(time); } }; function groupReminders(sortedReminders, reminderTime) { const now = DateTime.now(); const result = []; let currentReminders = []; const overdueReminders = []; let previousGroup = generateGroup(now, now, reminderTime); for (let i = 0; i < sortedReminders.length; i++) { const r = sortedReminders[i]; if (r.muteNotification) { overdueReminders.push(r); continue; } const group = generateGroup(r.time, now, reminderTime); if (group.name !== previousGroup.name) { if (currentReminders.length > 0 || previousGroup.isToday) { result.push(new GroupedReminder(previousGroup, currentReminders)); } currentReminders = []; } currentReminders.push(r); previousGroup = group; } if (currentReminders.length > 0) { result.push(new GroupedReminder(previousGroup, currentReminders)); } if (overdueReminders.length > 0) { const overdueGroup = new Group("Overdue", (time) => time.format("HH:mm", reminderTime)); overdueGroup.isOverdue = true; result.splice(0, 0, new GroupedReminder(overdueGroup, overdueReminders)); console.log(overdueGroup); console.log(result); } return result; } var GroupedReminder = class { constructor(group, reminders) { this.group = group; this.reminders = reminders; } get name() { return this.group.name; } get isOverdue() { return this.group.isOverdue; } timeToString(time) { return this.group.timeToString(time); } }; // src/model/format/reminder-base.ts var _ReminderFormatParameterKey = class { constructor(key, defaultValue) { this.key = key; this.defaultValue = defaultValue; } }; var ReminderFormatParameterKey = _ReminderFormatParameterKey; ReminderFormatParameterKey.now = new _ReminderFormatParameterKey("now", DateTime.now()); ReminderFormatParameterKey.useCustomEmojiForTasksPlugin = new _ReminderFormatParameterKey("useCustomEmojiForTasksPlugin", false); ReminderFormatParameterKey.removeTagsForTasksPlugin = new _ReminderFormatParameterKey("removeTagsForTasksPlugin", false); ReminderFormatParameterKey.linkDatesToDailyNotes = new _ReminderFormatParameterKey("linkDatesToDailyNotes", false); ReminderFormatParameterKey.strictDateFormat = new _ReminderFormatParameterKey("strictDateFormat", false); var ReminderFormatConfig = class { constructor() { this.parameters = /* @__PURE__ */ new Map(); } setParameter(key, value) { this.parameters.set(key.key, () => value.value); } setParameterFunc(key, f) { this.parameters.set(key.key, f); } setParameterValue(key, value) { this.parameters.set(key.key, () => value); } getParameter(key) { const value = this.parameters.get(key.key); if (value == null) { return key.defaultValue; } return value(); } }; var TodoBasedReminderFormat = class { constructor() { this.config = new ReminderFormatConfig(); } setConfig(config) { this.config = config; } parse(doc) { return doc.getTodos().map((todo) => { const parsed = this.parseValidReminder(todo); if (parsed == null) { return null; } const title = parsed.getTitle(); if (title == null) { return null; } const time = parsed.getTime(); if (time == null) { return null; } return new Reminder(doc.file, title, time, todo.lineIndex, todo.isChecked()); }).filter((reminder) => reminder != null); } modify(doc, reminder, edit) { return __async(this, null, function* () { const todo = doc.getTodo(reminder.rowNumber); if (todo === null) { console.warn("Not a todo: reminder=%o", reminder); return false; } const parsed = this.parseValidReminder(todo); if (parsed === null) { return false; } if (!this.modifyReminder(doc, todo, parsed, edit)) { return false; } todo.body = parsed.toMarkdown(); return true; }); } parseValidReminder(todo) { const parsed = this.parseReminder(todo); if (parsed === null) { return null; } if (!this.isValidReminder(parsed)) { return null; } return parsed; } isValidReminder(reminder) { return reminder.getTime() !== null; } modifyReminder(doc, todo, parsed, edit) { if (edit.rawTime !== void 0) { if (!parsed.setRawTime(edit.rawTime)) { console.warn("The reminder doesn't support raw time: parsed=%o", parsed); return false; } } else if (edit.time !== void 0) { parsed.setTime(edit.time); } if (edit.checked !== void 0) { todo.setChecked(edit.checked); } return true; } appendReminder(line, time, insertAt) { const todo = Todo.parse(0, line); if (todo == null) { return null; } let parsed = this.parseReminder(todo); const todoHeaderLength = todo.getHeaderLength(); if (insertAt != null) { insertAt -= todoHeaderLength; } if (parsed != null) { parsed.setTime(time, insertAt); } else { parsed = this.newReminder(todo.body, time, insertAt); parsed.setTime(time); } todo.body = parsed.toMarkdown(); return { insertedLine: todo.toMarkdown(), caretPosition: todoHeaderLength + parsed.getEndOfTimeTextIndex() }; } isStrictDateFormat() { return this.config.getParameter(ReminderFormatParameterKey.strictDateFormat); } }; var CompositeReminderFormat = class { constructor() { this.formats = []; } setConfig(config) { this.config = config; this.syncConfig(); } parse(doc) { const reminders = []; for (const format of this.formats) { const parsed = format.parse(doc); if (parsed == null) { continue; } reminders.push(...parsed); } return reminders; } modify(doc, reminder, edit) { return __async(this, null, function* () { for (const format of this.formats) { const modified = yield format.modify(doc, reminder, edit); if (modified) { return true; } } return false; }); } resetFormat(formats) { this.formats = formats; this.syncConfig(); } syncConfig() { if (this.config == null) { return; } this.formats.forEach((f) => f.setConfig(this.config)); } appendReminder(line, time) { if (this.formats[0] == null) { return null; } return this.formats[0].appendReminder(line, time); } }; // src/model/format/reminder-default.ts var _DefaultReminderModel = class { constructor(linkDatesToDailyNotes, title1, time, title2) { this.linkDatesToDailyNotes = linkDatesToDailyNotes; this.title1 = title1; this.time = time; this.title2 = title2; } static parse(line, linkDatesToDailyNotes) { if (linkDatesToDailyNotes == null) { linkDatesToDailyNotes = false; } const result = _DefaultReminderModel.regexp.exec(line); if (result == null) { return null; } const title1 = result.groups["title1"]; let time = result.groups["time"]; if (time == null) { return null; } const title2 = result.groups["title2"]; if (linkDatesToDailyNotes) { time = time.replace("[[", ""); time = time.replace("]]", ""); } return new _DefaultReminderModel(linkDatesToDailyNotes, title1, time, title2); } getTitle() { return `${this.title1.trim()} ${this.title2.trim()}`.trim(); } getTime() { return DATE_TIME_FORMATTER.parse(this.time); } setTime(time) { this.time = DATE_TIME_FORMATTER.toString(time); } setRawTime(rawTime) { this.time = rawTime; return true; } getEndOfTimeTextIndex() { return this.toMarkdown().length - this.title2.length; } toMarkdown() { let result = `${this.title1}(@${this.time})${this.title2}`; if (!this.linkDatesToDailyNotes) { return result; } let time = DATE_TIME_FORMATTER.parse(this.time); if (!time) { return result; } const date = DATE_TIME_FORMATTER.toString(time.clone(false)); return result.replace(date, `[[${date}]]`); } }; var DefaultReminderModel = _DefaultReminderModel; DefaultReminderModel.regexp = new RegExp("^(?.*?)\\(@(?