1
0
Fork 0
obsidian-vault-starter/.obsidian/plugins/obsidian-tasks-plugin/main.js

17353 lines
600 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository
*/
/*
License obsidian-tasks:
MIT License
Copyright (c) 2021 Martin Schenck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
License rrule (included library):
rrule.js: Library for working with recurrence rules for calendar dates.
=======================================================================
Copyright 2010, Jakub Roztocil <jakub@roztocil.name> and Lars Schöning
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of The author nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
./rrule.js and ./test/tests.js is based on python-dateutil. LICENCE:
python-dateutil - Extensions to the standard Python datetime module.
====================================================================
Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
License chrono-node (included library):
The MIT License
Copyright (c) 2014, Wanasit Tanakitrungruang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
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/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 instance2 = new Constructor();
if (Class2)
_setPrototypeOf(instance2, Class2.prototype);
return instance2;
};
}
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" ? 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 instance2(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 Settings = /* @__PURE__ */ function() {
function Settings2() {
}
Settings2.resetCaches = function resetCaches() {
Locale.resetCache();
IANAZone.resetCache();
};
_createClass(Settings2, null, [{
key: "now",
get: function get() {
return now;
},
set: function set(n2) {
now = n2;
}
}, {
key: "defaultZoneName",
get: function get() {
return Settings2.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 Settings2;
}();
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 = DateTime3.utc(2016, i, 1);
ms.push(f(dt));
}
return ms;
}
function mapWeekdays(f) {
var ms = [];
for (var i = 1; i <= 7; i++) {
var dt = DateTime3.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 : DateTime3.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 || Settings.defaultLocale, localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()), numberingSystemR = numberingSystem || Settings.defaultNumberingSystem, outputCalendarR = outputCalendar || Settings.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 = [DateTime3.utc(2016, 11, 13, 9), DateTime3.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] = [DateTime3.utc(-40, 1, 1), DateTime3.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 (Settings.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 (Settings.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 = DateTime3.fromISO(s2, opts);
startIsValid = start.isValid;
} catch (e2) {
startIsValid = false;
}
var end, endIsValid;
try {
end = DateTime3.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 = Settings.defaultZone;
}
var proto = DateTime3.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, Settings.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 = DateTime3.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 DateTime3(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 = DateTime3.fromObject(Object.assign(parsed, opts, {
zone: interpretationZone,
setZone: void 0
}));
return setZone ? inst : inst.setZone(zone);
} else {
return DateTime3.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 DateTime3.invalid(invalid);
}
var tsNow = Settings.now(), offsetProvis = zone.offset(tsNow), _objToTS = objToTS(obj, offsetProvis, zone), ts = _objToTS[0], o = _objToTS[1];
return new DateTime3({
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 DateTime3 = /* @__PURE__ */ function() {
function DateTime4(config) {
var zone = config.zone || Settings.defaultZone;
var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null);
this.ts = isUndefined(config.ts) ? Settings.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;
}
DateTime4.now = function now2() {
return new DateTime4({});
};
DateTime4.local = function local(year, month, day, hour, minute, second, millisecond) {
if (isUndefined(year)) {
return DateTime4.now();
} else {
return quickDT({
year,
month,
day,
hour,
minute,
second,
millisecond
}, Settings.defaultZone);
}
};
DateTime4.utc = function utc(year, month, day, hour, minute, second, millisecond) {
if (isUndefined(year)) {
return new DateTime4({
ts: Settings.now(),
zone: FixedOffsetZone.utcInstance
});
} else {
return quickDT({
year,
month,
day,
hour,
minute,
second,
millisecond
}, FixedOffsetZone.utcInstance);
}
};
DateTime4.fromJSDate = function fromJSDate(date, options) {
if (options === void 0) {
options = {};
}
var ts = isDate(date) ? date.valueOf() : NaN;
if (Number.isNaN(ts)) {
return DateTime4.invalid("invalid input");
}
var zoneToUse = normalizeZone(options.zone, Settings.defaultZone);
if (!zoneToUse.isValid) {
return DateTime4.invalid(unsupportedZone(zoneToUse));
}
return new DateTime4({
ts,
zone: zoneToUse,
loc: Locale.fromObject(options)
});
};
DateTime4.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 DateTime4.invalid("Timestamp out of range");
} else {
return new DateTime4({
ts: milliseconds,
zone: normalizeZone(options.zone, Settings.defaultZone),
loc: Locale.fromObject(options)
});
}
};
DateTime4.fromSeconds = function fromSeconds(seconds, options) {
if (options === void 0) {
options = {};
}
if (!isNumber2(seconds)) {
throw new InvalidArgumentError("fromSeconds requires a numerical input");
} else {
return new DateTime4({
ts: seconds * 1e3,
zone: normalizeZone(options.zone, Settings.defaultZone),
loc: Locale.fromObject(options)
});
}
};
DateTime4.fromObject = function fromObject(obj) {
var zoneToUse = normalizeZone(obj.zone, Settings.defaultZone);
if (!zoneToUse.isValid) {
return DateTime4.invalid(unsupportedZone(zoneToUse));
}
var tsNow = Settings.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 DateTime4.invalid(invalid);
}
var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), tsFinal = _objToTS2[0], offsetFinal = _objToTS2[1], inst = new DateTime4({
ts: tsFinal,
zone: zoneToUse,
o: offsetFinal,
loc
});
if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {
return DateTime4.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO());
}
return inst;
};
DateTime4.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);
};
DateTime4.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);
};
DateTime4.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);
};
DateTime4.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 DateTime4.invalid(invalid);
} else {
return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text2);
}
};
DateTime4.fromString = function fromString(text2, fmt, opts) {
if (opts === void 0) {
opts = {};
}
return DateTime4.fromFormat(text2, fmt, opts);
};
DateTime4.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);
};
DateTime4.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 (Settings.throwOnInvalid) {
throw new InvalidDateTimeError(invalid2);
} else {
return new DateTime4({
invalid: invalid2
});
}
};
DateTime4.isDateTime = function isDateTime(o) {
return o && o.isLuxonDateTime || false;
};
var _proto = DateTime4.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(Settings.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, Settings.defaultZone);
if (zone.equals(this.zone)) {
return this;
} else if (!zone.isValid) {
return DateTime4.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(DateTime4.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 || DateTime4.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 || DateTime4.fromObject({
zone: this.zone
}), this, Object.assign(options, {
numeric: "auto",
units: ["years", "months", "days"],
calendary: true
}));
};
DateTime4.min = function min() {
for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) {
dateTimes[_key] = arguments[_key];
}
if (!dateTimes.every(DateTime4.isDateTime)) {
throw new InvalidArgumentError("min requires all arguments be DateTimes");
}
return bestBy(dateTimes, function(i) {
return i.valueOf();
}, Math.min);
};
DateTime4.max = function max() {
for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
dateTimes[_key2] = arguments[_key2];
}
if (!dateTimes.every(DateTime4.isDateTime)) {
throw new InvalidArgumentError("max requires all arguments be DateTimes");
}
return bestBy(dateTimes, function(i) {
return i.valueOf();
}, Math.max);
};
DateTime4.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);
};
DateTime4.fromStringExplain = function fromStringExplain(text2, fmt, options) {
if (options === void 0) {
options = {};
}
return DateTime4.fromFormatExplain(text2, fmt, options);
};
_createClass(DateTime4, [{
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 DateTime4;
}();
function friendlyDateTime(dateTimeish) {
if (DateTime3.isDateTime(dateTimeish)) {
return dateTimeish;
} else if (dateTimeish && dateTimeish.valueOf && isNumber2(dateTimeish.valueOf())) {
return DateTime3.fromJSDate(dateTimeish);
} else if (dateTimeish && typeof dateTimeish === "object") {
return DateTime3.fromObject(dateTimeish);
} else {
throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish);
}
}
var VERSION = "1.28.0";
exports.DateTime = DateTime3;
exports.Duration = Duration;
exports.FixedOffsetZone = FixedOffsetZone;
exports.IANAZone = IANAZone;
exports.Info = Info;
exports.Interval = Interval;
exports.InvalidZone = InvalidZone;
exports.LocalZone = LocalZone;
exports.Settings = Settings;
exports.VERSION = VERSION;
exports.Zone = Zone;
}
});
// node_modules/chrono-node/dist/utils/pattern.js
var require_pattern = __commonJS({
"node_modules/chrono-node/dist/utils/pattern.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.matchAnyPattern = exports.extractTerms = exports.repeatedTimeunitPattern = void 0;
function repeatedTimeunitPattern(prefix, singleTimeunitPattern) {
const singleTimeunitPatternNoCapture = singleTimeunitPattern.replace(/\((?!\?)/g, "(?:");
return `${prefix}${singleTimeunitPatternNoCapture}\\s*(?:,?\\s{0,5}${singleTimeunitPatternNoCapture}){0,10}`;
}
exports.repeatedTimeunitPattern = repeatedTimeunitPattern;
function extractTerms(dictionary) {
let keys;
if (dictionary instanceof Array) {
keys = [...dictionary];
} else if (dictionary instanceof Map) {
keys = Array.from(dictionary.keys());
} else {
keys = Object.keys(dictionary);
}
return keys;
}
exports.extractTerms = extractTerms;
function matchAnyPattern(dictionary) {
const joinedTerms = extractTerms(dictionary).sort((a, b) => b.length - a.length).join("|").replace(/\./g, "\\.");
return `(?:${joinedTerms})`;
}
exports.matchAnyPattern = matchAnyPattern;
}
});
// node_modules/dayjs/dayjs.min.js
var require_dayjs_min = __commonJS({
"node_modules/dayjs/dayjs.min.js"(exports, module2) {
!function(t, e) {
typeof exports == "object" && typeof module2 != "undefined" ? module2.exports = e() : typeof define == "function" && define.amd ? define(e) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs = e();
}(exports, function() {
"use strict";
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", $ = "Invalid Date", l = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_") }, m = function(t2, e2, n2) {
var r2 = String(t2);
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
}, g = { s: m, z: function(t2) {
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
}, m: function t2(e2, n2) {
if (e2.date() < n2.date())
return -t2(n2, e2);
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
}, a: function(t2) {
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
}, p: function(t2) {
return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
}, u: function(t2) {
return t2 === void 0;
} }, D = "en", v = {};
v[D] = M;
var p = function(t2) {
return t2 instanceof _;
}, S = function(t2, e2, n2) {
var r2;
if (!t2)
return D;
if (typeof t2 == "string")
v[t2] && (r2 = t2), e2 && (v[t2] = e2, r2 = t2);
else {
var i2 = t2.name;
v[i2] = t2, r2 = i2;
}
return !n2 && r2 && (D = r2), r2 || !n2 && D;
}, w = function(t2, e2) {
if (p(t2))
return t2.clone();
var n2 = typeof e2 == "object" ? e2 : {};
return n2.date = t2, n2.args = arguments, new _(n2);
}, O = g;
O.l = S, O.i = p, O.w = function(t2, e2) {
return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
};
var _ = function() {
function M2(t2) {
this.$L = S(t2.locale, null, true), this.parse(t2);
}
var m2 = M2.prototype;
return m2.parse = function(t2) {
this.$d = function(t3) {
var e2 = t3.date, n2 = t3.utc;
if (e2 === null)
return new Date(NaN);
if (O.u(e2))
return new Date();
if (e2 instanceof Date)
return new Date(e2);
if (typeof e2 == "string" && !/Z$/i.test(e2)) {
var r2 = e2.match(l);
if (r2) {
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
}
}
return new Date(e2);
}(t2), this.$x = t2.x || {}, this.init();
}, m2.init = function() {
var t2 = this.$d;
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
}, m2.$utils = function() {
return O;
}, m2.isValid = function() {
return !(this.$d.toString() === $);
}, m2.isSame = function(t2, e2) {
var n2 = w(t2);
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
}, m2.isAfter = function(t2, e2) {
return w(t2) < this.startOf(e2);
}, m2.isBefore = function(t2, e2) {
return this.endOf(e2) < w(t2);
}, m2.$g = function(t2, e2, n2) {
return O.u(t2) ? this[e2] : this.set(n2, t2);
}, m2.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, m2.valueOf = function() {
return this.$d.getTime();
}, m2.startOf = function(t2, e2) {
var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) {
var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
return r2 ? i2 : i2.endOf(a);
}, l2 = function(t3, e3) {
return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
switch (h2) {
case c:
return r2 ? $2(1, 0) : $2(31, 11);
case f:
return r2 ? $2(1, M3) : $2(0, M3 + 1);
case o:
var D2 = this.$locale().weekStart || 0, v2 = (y2 < D2 ? y2 + 7 : y2) - D2;
return $2(r2 ? m3 - v2 : m3 + (6 - v2), M3);
case a:
case d:
return l2(g2 + "Hours", 0);
case u:
return l2(g2 + "Minutes", 1);
case s:
return l2(g2 + "Seconds", 2);
case i:
return l2(g2 + "Milliseconds", 3);
default:
return this.clone();
}
}, m2.endOf = function(t2) {
return this.startOf(t2, false);
}, m2.$set = function(t2, e2) {
var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], l2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
if (o2 === f || o2 === c) {
var y2 = this.clone().set(d, 1);
y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
} else
$2 && this.$d[$2](l2);
return this.init(), this;
}, m2.set = function(t2, e2) {
return this.clone().$set(t2, e2);
}, m2.get = function(t2) {
return this[O.p(t2)]();
}, m2.add = function(r2, h2) {
var d2, $2 = this;
r2 = Number(r2);
var l2 = O.p(h2), y2 = function(t2) {
var e2 = w($2);
return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
};
if (l2 === f)
return this.set(f, this.$M + r2);
if (l2 === c)
return this.set(c, this.$y + r2);
if (l2 === a)
return y2(1);
if (l2 === o)
return y2(7);
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3;
return O.w(m3, this);
}, m2.subtract = function(t2, e2) {
return this.add(-1 * t2, e2);
}, m2.format = function(t2) {
var e2 = this, n2 = this.$locale();
if (!this.isValid())
return n2.invalidDate || $;
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].substr(0, s3);
}, c2 = function(t3) {
return O.s(s2 % 12 || 12, t3, "0");
}, d2 = n2.meridiem || function(t3, e3, n3) {
var r3 = t3 < 12 ? "AM" : "PM";
return n3 ? r3.toLowerCase() : r3;
}, l2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
return r2.replace(y, function(t3, e3) {
return e3 || l2[t3] || i2.replace(":", "");
});
}, m2.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, m2.diff = function(r2, d2, $2) {
var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, D2 = O.m(this, M3);
return D2 = (l2 = {}, l2[c] = D2 / 12, l2[f] = D2, l2[h] = D2 / 3, l2[o] = (g2 - m3) / 6048e5, l2[a] = (g2 - m3) / 864e5, l2[u] = g2 / n, l2[s] = g2 / e, l2[i] = g2 / t, l2)[y2] || g2, $2 ? D2 : O.a(D2);
}, m2.daysInMonth = function() {
return this.endOf(f).$D;
}, m2.$locale = function() {
return v[this.$L];
}, m2.locale = function(t2, e2) {
if (!t2)
return this.$L;
var n2 = this.clone(), r2 = S(t2, e2, true);
return r2 && (n2.$L = r2), n2;
}, m2.clone = function() {
return O.w(this.$d, this);
}, m2.toDate = function() {
return new Date(this.valueOf());
}, m2.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, m2.toISOString = function() {
return this.$d.toISOString();
}, m2.toString = function() {
return this.$d.toUTCString();
}, M2;
}(), b = _.prototype;
return w.prototype = b, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
b[t2[1]] = function(e2) {
return this.$g(e2, t2[0], t2[1]);
};
}), w.extend = function(t2, e2) {
return t2.$i || (t2(e2, _, w), t2.$i = true), w;
}, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
return w(1e3 * t2);
}, w.en = v[D], w.Ls = v, w.p = {}, w;
});
}
});
// node_modules/chrono-node/dist/calculation/years.js
var require_years = __commonJS({
"node_modules/chrono-node/dist/calculation/years.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.findYearClosestToRef = exports.findMostLikelyADYear = void 0;
var dayjs_1 = __importDefault2(require_dayjs_min());
function findMostLikelyADYear(yearNumber) {
if (yearNumber < 100) {
if (yearNumber > 50) {
yearNumber = yearNumber + 1900;
} else {
yearNumber = yearNumber + 2e3;
}
}
return yearNumber;
}
exports.findMostLikelyADYear = findMostLikelyADYear;
function findYearClosestToRef(refDate, day, month) {
const refMoment = dayjs_1.default(refDate);
let dateMoment = refMoment;
dateMoment = dateMoment.month(month - 1);
dateMoment = dateMoment.date(day);
dateMoment = dateMoment.year(refMoment.year());
const nextYear = dateMoment.add(1, "y");
const lastYear = dateMoment.add(-1, "y");
if (Math.abs(nextYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) {
dateMoment = nextYear;
} else if (Math.abs(lastYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) {
dateMoment = lastYear;
}
return dateMoment.year();
}
exports.findYearClosestToRef = findYearClosestToRef;
}
});
// node_modules/chrono-node/dist/locales/en/constants.js
var require_constants = __commonJS({
"node_modules/chrono-node/dist/locales/en/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.FULL_MONTH_NAME_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
var pattern_1 = require_pattern();
var years_1 = require_years();
exports.WEEKDAY_DICTIONARY = {
sunday: 0,
sun: 0,
"sun.": 0,
monday: 1,
mon: 1,
"mon.": 1,
tuesday: 2,
tue: 2,
"tue.": 2,
wednesday: 3,
wed: 3,
"wed.": 3,
thursday: 4,
thurs: 4,
"thurs.": 4,
thur: 4,
"thur.": 4,
thu: 4,
"thu.": 4,
friday: 5,
fri: 5,
"fri.": 5,
saturday: 6,
sat: 6,
"sat.": 6
};
exports.FULL_MONTH_NAME_DICTIONARY = {
january: 1,
february: 2,
march: 3,
april: 4,
may: 5,
june: 6,
july: 7,
august: 8,
september: 9,
october: 10,
november: 11,
december: 12
};
exports.MONTH_DICTIONARY = Object.assign(Object.assign({}, exports.FULL_MONTH_NAME_DICTIONARY), { jan: 1, "jan.": 1, feb: 2, "feb.": 2, mar: 3, "mar.": 3, apr: 4, "apr.": 4, jun: 6, "jun.": 6, jul: 7, "jul.": 7, aug: 8, "aug.": 8, sep: 9, "sep.": 9, sept: 9, "sept.": 9, oct: 10, "oct.": 10, nov: 11, "nov.": 11, dec: 12, "dec.": 12 });
exports.INTEGER_WORD_DICTIONARY = {
one: 1,
two: 2,
three: 3,
four: 4,
five: 5,
six: 6,
seven: 7,
eight: 8,
nine: 9,
ten: 10,
eleven: 11,
twelve: 12
};
exports.ORDINAL_WORD_DICTIONARY = {
first: 1,
second: 2,
third: 3,
fourth: 4,
fifth: 5,
sixth: 6,
seventh: 7,
eighth: 8,
ninth: 9,
tenth: 10,
eleventh: 11,
twelfth: 12,
thirteenth: 13,
fourteenth: 14,
fifteenth: 15,
sixteenth: 16,
seventeenth: 17,
eighteenth: 18,
nineteenth: 19,
twentieth: 20,
"twenty first": 21,
"twenty-first": 21,
"twenty second": 22,
"twenty-second": 22,
"twenty third": 23,
"twenty-third": 23,
"twenty fourth": 24,
"twenty-fourth": 24,
"twenty fifth": 25,
"twenty-fifth": 25,
"twenty sixth": 26,
"twenty-sixth": 26,
"twenty seventh": 27,
"twenty-seventh": 27,
"twenty eighth": 28,
"twenty-eighth": 28,
"twenty ninth": 29,
"twenty-ninth": 29,
"thirtieth": 30,
"thirty first": 31,
"thirty-first": 31
};
exports.TIME_UNIT_DICTIONARY = {
sec: "second",
second: "second",
seconds: "second",
min: "minute",
mins: "minute",
minute: "minute",
minutes: "minute",
h: "hour",
hr: "hour",
hrs: "hour",
hour: "hour",
hours: "hour",
day: "d",
days: "d",
week: "week",
weeks: "week",
month: "month",
months: "month",
y: "year",
yr: "year",
year: "year",
years: "year"
};
exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`;
function parseNumberPattern(match) {
const num = match.toLowerCase();
if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) {
return exports.INTEGER_WORD_DICTIONARY[num];
} else if (num === "a" || num === "an") {
return 1;
} else if (num.match(/few/)) {
return 3;
} else if (num.match(/half/)) {
return 0.5;
} else if (num.match(/couple/)) {
return 2;
} else if (num.match(/several/)) {
return 7;
}
return parseFloat(num);
}
exports.parseNumberPattern = parseNumberPattern;
exports.ORDINAL_NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;
function parseOrdinalNumberPattern(match) {
let num = match.toLowerCase();
if (exports.ORDINAL_WORD_DICTIONARY[num] !== void 0) {
return exports.ORDINAL_WORD_DICTIONARY[num];
}
num = num.replace(/(?:st|nd|rd|th)$/i, "");
return parseInt(num);
}
exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern;
exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:BE|AD|BC)|[1-2][0-9]{3}|[5-9][0-9])`;
function parseYear(match) {
if (/BE/i.test(match)) {
match = match.replace(/BE/i, "");
return parseInt(match) - 543;
}
if (/BC/i.test(match)) {
match = match.replace(/BC/i, "");
return -parseInt(match);
}
if (/AD/i.test(match)) {
match = match.replace(/AD/i, "");
return parseInt(match);
}
const rawYearNumber = parseInt(match);
return years_1.findMostLikelyADYear(rawYearNumber);
}
exports.parseYear = parseYear;
var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`;
var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern(`(?:(?:about|around)\\s*)?`, SINGLE_TIME_UNIT_PATTERN);
function parseTimeUnits(timeunitText) {
const fragments = {};
let remainingText = timeunitText;
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
while (match) {
collectDateTimeFragment(fragments, match);
remainingText = remainingText.substring(match[0].length);
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
}
return fragments;
}
exports.parseTimeUnits = parseTimeUnits;
function collectDateTimeFragment(fragments, match) {
const num = parseNumberPattern(match[1]);
const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
fragments[unit] = num;
}
}
});
// node_modules/dayjs/plugin/quarterOfYear.js
var require_quarterOfYear = __commonJS({
"node_modules/dayjs/plugin/quarterOfYear.js"(exports, module2) {
!function(t, n) {
typeof exports == "object" && typeof module2 != "undefined" ? module2.exports = n() : typeof define == "function" && define.amd ? define(n) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs_plugin_quarterOfYear = n();
}(exports, function() {
"use strict";
var t = "month", n = "quarter";
return function(e, i) {
var r = i.prototype;
r.quarter = function(t2) {
return this.$utils().u(t2) ? Math.ceil((this.month() + 1) / 3) : this.month(this.month() % 3 + 3 * (t2 - 1));
};
var s = r.add;
r.add = function(e2, i2) {
return e2 = Number(e2), this.$utils().p(i2) === n ? this.add(3 * e2, t) : s.bind(this)(e2, i2);
};
var u = r.startOf;
r.startOf = function(e2, i2) {
var r2 = this.$utils(), s2 = !!r2.u(i2) || i2;
if (r2.p(e2) === n) {
var o = this.quarter() - 1;
return s2 ? this.month(3 * o).startOf(t).startOf("day") : this.month(3 * o + 2).endOf(t).endOf("day");
}
return u.bind(this)(e2, i2);
};
};
});
}
});
// node_modules/chrono-node/dist/utils/dayjs.js
var require_dayjs = __commonJS({
"node_modules/chrono-node/dist/utils/dayjs.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.implySimilarTime = exports.assignSimilarTime = exports.assignSimilarDate = exports.assignTheNextDay = void 0;
function assignTheNextDay(component, targetDayJs) {
targetDayJs = targetDayJs.add(1, "day");
assignSimilarDate(component, targetDayJs);
implySimilarTime(component, targetDayJs);
}
exports.assignTheNextDay = assignTheNextDay;
function assignSimilarDate(component, targetDayJs) {
component.assign("day", targetDayJs.date());
component.assign("month", targetDayJs.month() + 1);
component.assign("year", targetDayJs.year());
}
exports.assignSimilarDate = assignSimilarDate;
function assignSimilarTime(component, targetDayJs) {
component.assign("hour", targetDayJs.hour());
component.assign("minute", targetDayJs.minute());
component.assign("second", targetDayJs.second());
component.assign("millisecond", targetDayJs.millisecond());
component.assign("timezoneOffset", targetDayJs.utcOffset());
}
exports.assignSimilarTime = assignSimilarTime;
function implySimilarTime(component, targetDayJs) {
component.imply("hour", targetDayJs.hour());
component.imply("minute", targetDayJs.minute());
component.imply("second", targetDayJs.second());
component.imply("millisecond", targetDayJs.millisecond());
component.imply("timezoneOffset", targetDayJs.utcOffset());
}
exports.implySimilarTime = implySimilarTime;
}
});
// node_modules/chrono-node/dist/results.js
var require_results = __commonJS({
"node_modules/chrono-node/dist/results.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParsingResult = exports.ParsingComponents = void 0;
var quarterOfYear_1 = __importDefault2(require_quarterOfYear());
var dayjs_1 = __importDefault2(require_dayjs_min());
var dayjs_2 = require_dayjs();
dayjs_1.default.extend(quarterOfYear_1.default);
var ParsingComponents = class {
constructor(refDate, knownComponents) {
this.knownValues = {};
this.impliedValues = {};
if (knownComponents) {
for (const key in knownComponents) {
this.knownValues[key] = knownComponents[key];
}
}
const refDayJs = dayjs_1.default(refDate);
this.imply("day", refDayJs.date());
this.imply("month", refDayJs.month() + 1);
this.imply("year", refDayJs.year());
this.imply("hour", 12);
this.imply("minute", 0);
this.imply("second", 0);
this.imply("millisecond", 0);
}
get(component) {
if (component in this.knownValues) {
return this.knownValues[component];
}
if (component in this.impliedValues) {
return this.impliedValues[component];
}
return null;
}
isCertain(component) {
return component in this.knownValues;
}
getCertainComponents() {
return Object.keys(this.knownValues);
}
imply(component, value) {
if (component in this.knownValues) {
return this;
}
this.impliedValues[component] = value;
return this;
}
assign(component, value) {
this.knownValues[component] = value;
delete this.impliedValues[component];
return this;
}
delete(component) {
delete this.knownValues[component];
delete this.impliedValues[component];
}
clone() {
const component = new ParsingComponents(new Date());
component.knownValues = {};
component.impliedValues = {};
for (const key in this.knownValues) {
component.knownValues[key] = this.knownValues[key];
}
for (const key in this.impliedValues) {
component.impliedValues[key] = this.impliedValues[key];
}
return component;
}
isOnlyDate() {
return !this.isCertain("hour") && !this.isCertain("minute") && !this.isCertain("second");
}
isOnlyTime() {
return !this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month");
}
isOnlyWeekdayComponent() {
return this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month");
}
isOnlyDayMonthComponent() {
return this.isCertain("day") && this.isCertain("month") && !this.isCertain("year");
}
isValidDate() {
const date = this.isCertain("timezoneOffset") ? this.dateWithoutTimezoneAdjustment() : this.date();
if (date.getFullYear() !== this.get("year"))
return false;
if (date.getMonth() !== this.get("month") - 1)
return false;
if (date.getDate() !== this.get("day"))
return false;
if (this.get("hour") != null && date.getHours() != this.get("hour"))
return false;
if (this.get("minute") != null && date.getMinutes() != this.get("minute"))
return false;
return true;
}
toString() {
return `[ParsingComponents {knownValues: ${JSON.stringify(this.knownValues)}, impliedValues: ${JSON.stringify(this.impliedValues)}}]`;
}
dayjs() {
return dayjs_1.default(this.date());
}
date() {
const date = this.dateWithoutTimezoneAdjustment();
return new Date(date.getTime() + this.getTimezoneAdjustmentMinute(date) * 6e4);
}
dateWithoutTimezoneAdjustment() {
const date = new Date(this.get("year"), this.get("month") - 1, this.get("day"), this.get("hour"), this.get("minute"), this.get("second"), this.get("millisecond"));
date.setFullYear(this.get("year"));
return date;
}
getTimezoneAdjustmentMinute(date) {
var _a;
date = date !== null && date !== void 0 ? date : new Date();
const currentTimezoneOffset = -date.getTimezoneOffset();
const targetTimezoneOffset = (_a = this.get("timezoneOffset")) !== null && _a !== void 0 ? _a : currentTimezoneOffset;
return currentTimezoneOffset - targetTimezoneOffset;
}
static createRelativeFromRefDate(refDate, fragments) {
let date = dayjs_1.default(refDate);
for (const key in fragments) {
date = date.add(fragments[key], key);
}
const components = new ParsingComponents(refDate);
if (fragments["hour"] || fragments["minute"] || fragments["second"]) {
dayjs_2.assignSimilarTime(components, date);
dayjs_2.assignSimilarDate(components, date);
} else {
dayjs_2.implySimilarTime(components, date);
if (fragments["d"]) {
components.assign("day", date.date());
components.assign("month", date.month() + 1);
components.assign("year", date.year());
} else {
if (fragments["week"]) {
components.imply("weekday", date.day());
}
components.imply("day", date.date());
if (fragments["month"]) {
components.assign("month", date.month() + 1);
components.assign("year", date.year());
} else {
components.imply("month", date.month() + 1);
if (fragments["year"]) {
components.assign("year", date.year());
} else {
components.imply("year", date.year());
}
}
}
}
return components;
}
};
exports.ParsingComponents = ParsingComponents;
var ParsingResult = class {
constructor(refDate, index, text2, start, end) {
this.refDate = refDate;
this.index = index;
this.text = text2;
this.start = start || new ParsingComponents(this.refDate);
this.end = end;
}
clone() {
const result = new ParsingResult(this.refDate, this.index, this.text);
result.start = this.start ? this.start.clone() : null;
result.end = this.end ? this.end.clone() : null;
return result;
}
date() {
return this.start.date();
}
toString() {
return `[ParsingResult {index: ${this.index}, text: '${this.text}', ...}]`;
}
};
exports.ParsingResult = ParsingResult;
}
});
// node_modules/chrono-node/dist/common/parsers/AbstractParserWithWordBoundary.js
var require_AbstractParserWithWordBoundary = __commonJS({
"node_modules/chrono-node/dist/common/parsers/AbstractParserWithWordBoundary.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractParserWithWordBoundaryChecking = void 0;
var AbstractParserWithWordBoundaryChecking = class {
constructor() {
this.cachedInnerPattern = null;
this.cachedPattern = null;
}
pattern(context) {
const innerPattern = this.innerPattern(context);
if (innerPattern == this.cachedInnerPattern) {
return this.cachedPattern;
}
this.cachedPattern = new RegExp(`(\\W|^)${innerPattern.source}`, innerPattern.flags);
this.cachedInnerPattern = innerPattern;
return this.cachedPattern;
}
extract(context, match) {
const header = match[1];
match.index = match.index + header.length;
match[0] = match[0].substring(header.length);
for (let i = 2; i < match.length; i++) {
match[i - 1] = match[i];
}
return this.innerExtract(context, match);
}
};
exports.AbstractParserWithWordBoundaryChecking = AbstractParserWithWordBoundaryChecking;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitWithinFormatParser.js
var require_ENTimeUnitWithinFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitWithinFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants();
var results_1 = require_results();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN_WITH_PREFIX = new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
var PATTERN_WITHOUT_PREFIX = new RegExp(`(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
var ENTimeUnitWithinFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return context.option.forwardDate ? PATTERN_WITHOUT_PREFIX : PATTERN_WITH_PREFIX;
}
innerExtract(context, match) {
const timeUnits = constants_1.parseTimeUnits(match[1]);
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
}
};
exports.default = ENTimeUnitWithinFormatParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameLittleEndianParser.js
var require_ENMonthNameLittleEndianParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameLittleEndianParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var years_1 = require_years();
var constants_1 = require_constants();
var constants_2 = require_constants();
var constants_3 = require_constants();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`(?:on\\s*?)?(${constants_3.ORDINAL_NUMBER_PATTERN})(?:\\s*(?:to|\\-|\\\u2013|until|through|till|\\s)\\s*(${constants_3.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s*(?:of)?\\s*)(` + pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY) + `)(?:(?:-|/|,?\\s*)(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`, "i");
var DATE_GROUP = 1;
var DATE_TO_GROUP = 2;
var MONTH_NAME_GROUP = 3;
var YEAR_GROUP = 4;
var ENMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const result = context.createParsingResult(match.index, match[0]);
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
const day = constants_3.parseOrdinalNumberPattern(match[DATE_GROUP]);
if (day > 31) {
match.index = match.index + match[DATE_GROUP].length;
return null;
}
result.start.assign("month", month);
result.start.assign("day", day);
if (match[YEAR_GROUP]) {
const yearNumber = constants_2.parseYear(match[YEAR_GROUP]);
result.start.assign("year", yearNumber);
} else {
const year = years_1.findYearClosestToRef(context.refDate, day, month);
result.start.imply("year", year);
}
if (match[DATE_TO_GROUP]) {
const endDate = constants_3.parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
result.end = result.start.clone();
result.end.assign("day", endDate);
}
return result;
}
};
exports.default = ENMonthNameLittleEndianParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameMiddleEndianParser.js
var require_ENMonthNameMiddleEndianParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameMiddleEndianParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var years_1 = require_years();
var constants_1 = require_constants();
var constants_2 = require_constants();
var constants_3 = require_constants();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:-|/|\\s*,?\\s*)(${constants_2.ORDINAL_NUMBER_PATTERN})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${constants_2.ORDINAL_NUMBER_PATTERN})\\s*)?(?:(?:-|/|\\s*,?\\s*)(${constants_3.YEAR_PATTERN}))?(?=\\W|$)(?!\\:\\d)`, "i");
var MONTH_NAME_GROUP = 1;
var DATE_GROUP = 2;
var DATE_TO_GROUP = 3;
var YEAR_GROUP = 4;
var ENMonthNameMiddleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
const day = constants_2.parseOrdinalNumberPattern(match[DATE_GROUP]);
if (day > 31) {
return null;
}
const components = context.createParsingComponents({
day,
month
});
if (match[YEAR_GROUP]) {
const year = constants_3.parseYear(match[YEAR_GROUP]);
components.assign("year", year);
} else {
const year = years_1.findYearClosestToRef(context.refDate, day, month);
components.imply("year", year);
}
if (!match[DATE_TO_GROUP]) {
return components;
}
const endDate = constants_2.parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
const result = context.createParsingResult(match.index, match[0]);
result.start = components;
result.end = components.clone();
result.end.assign("day", endDate);
return result;
}
};
exports.default = ENMonthNameMiddleEndianParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameParser.js
var require_ENMonthNameParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENMonthNameParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants();
var years_1 = require_years();
var pattern_1 = require_pattern();
var constants_2 = require_constants();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`((?:in)\\s*)?(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})\\s*(?:[,-]?\\s*(${constants_2.YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`, "i");
var PREFIX_GROUP = 1;
var MONTH_NAME_GROUP = 2;
var YEAR_GROUP = 3;
var ENMonthNameParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const monthName = match[MONTH_NAME_GROUP].toLowerCase();
if (match[0].length <= 3 && !constants_1.FULL_MONTH_NAME_DICTIONARY[monthName]) {
return null;
}
const result = context.createParsingResult(match.index + (match[PREFIX_GROUP] || "").length, match.index + match[0].length);
result.start.imply("day", 1);
const month = constants_1.MONTH_DICTIONARY[monthName];
result.start.assign("month", month);
if (match[YEAR_GROUP]) {
const year = constants_2.parseYear(match[YEAR_GROUP]);
result.start.assign("year", year);
} else {
const year = years_1.findYearClosestToRef(context.refDate, 1, month);
result.start.imply("year", year);
}
return result;
}
};
exports.default = ENMonthNameParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENCasualYearMonthDayParser.js
var require_ENCasualYearMonthDayParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENCasualYearMonthDayParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`, "i");
var YEAR_NUMBER_GROUP = 1;
var MONTH_NAME_GROUP = 2;
var MONTH_NUMBER_GROUP = 3;
var DATE_NUMBER_GROUP = 4;
var ENCasualYearMonthDayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const month = match[MONTH_NUMBER_GROUP] ? parseInt(match[MONTH_NUMBER_GROUP]) : constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
if (month < 1 || month > 12) {
return null;
}
const year = parseInt(match[YEAR_NUMBER_GROUP]);
const day = parseInt(match[DATE_NUMBER_GROUP]);
return {
day,
month,
year
};
}
};
exports.default = ENCasualYearMonthDayParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENSlashMonthFormatParser.js
var require_ENSlashMonthFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENSlashMonthFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})", "i");
var MONTH_GROUP = 1;
var YEAR_GROUP = 2;
var ENSlashMonthFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const year = parseInt(match[YEAR_GROUP]);
const month = parseInt(match[MONTH_GROUP]);
return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year);
}
};
exports.default = ENSlashMonthFormatParser;
}
});
// node_modules/chrono-node/dist/common/parsers/AbstractTimeExpressionParser.js
var require_AbstractTimeExpressionParser = __commonJS({
"node_modules/chrono-node/dist/common/parsers/AbstractTimeExpressionParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractTimeExpressionParser = void 0;
var index_1 = require_dist();
function primaryTimePattern(primaryPrefix, primarySuffix) {
return new RegExp(`(^|\\s|T|\\b)${primaryPrefix}(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\:|\\\uFF1A)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${primarySuffix}`, "i");
}
function followingTimePatten(followingPhase, followingSuffix) {
return new RegExp(`^(${followingPhase})(\\d{1,4})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:(?:\\.|\\:|\\\uFF1A)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${followingSuffix}`, "i");
}
var HOUR_GROUP = 2;
var MINUTE_GROUP = 3;
var SECOND_GROUP = 4;
var MILLI_SECOND_GROUP = 5;
var AM_PM_HOUR_GROUP = 6;
var AbstractTimeExpressionParser = class {
constructor(strictMode = false) {
this.cachedPrimaryPrefix = null;
this.cachedPrimarySuffix = null;
this.cachedPrimaryTimePattern = null;
this.cachedFollowingPhase = null;
this.cachedFollowingSuffix = null;
this.cachedFollowingTimePatten = null;
this.strictMode = strictMode;
}
primarySuffix() {
return "(?=\\W|$)";
}
followingSuffix() {
return "(?=\\W|$)";
}
pattern(context) {
return this.getPrimaryTimePatternThroughCache();
}
extract(context, match) {
const startComponents = this.extractPrimaryTimeComponents(context, match);
if (!startComponents) {
match.index += match[0].length;
return null;
}
const index = match.index + match[1].length;
const text2 = match[0].substring(match[1].length);
const result = context.createParsingResult(index, text2, startComponents);
match.index += match[0].length;
const remainingText = context.text.substring(match.index);
const followingPattern = this.getFollowingTimePatternThroughCache();
const followingMatch = followingPattern.exec(remainingText);
if (!followingMatch || followingMatch[0].match(/^\s*([+-])\s*\d{3,4}$/)) {
return this.checkAndReturnWithoutFollowingPattern(result);
}
result.end = this.extractFollowingTimeComponents(context, followingMatch, result);
if (result.end) {
result.text += followingMatch[0];
}
return this.checkAndReturnWithFollowingPattern(result);
}
extractPrimaryTimeComponents(context, match, strict = false) {
const components = context.createParsingComponents();
let minute = 0;
let meridiem = null;
let hour = parseInt(match[HOUR_GROUP]);
if (hour > 100) {
if (this.strictMode || match[MINUTE_GROUP] != null) {
return null;
}
minute = hour % 100;
hour = Math.floor(hour / 100);
}
if (hour > 24) {
return null;
}
if (match[MINUTE_GROUP] != null) {
if (match[MINUTE_GROUP].length == 1 && !match[AM_PM_HOUR_GROUP]) {
return null;
}
minute = parseInt(match[MINUTE_GROUP]);
}
if (minute >= 60) {
return null;
}
if (hour > 12) {
meridiem = index_1.Meridiem.PM;
}
if (match[AM_PM_HOUR_GROUP] != null) {
if (hour > 12)
return null;
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
if (ampm == "a") {
meridiem = index_1.Meridiem.AM;
if (hour == 12) {
hour = 0;
}
}
if (ampm == "p") {
meridiem = index_1.Meridiem.PM;
if (hour != 12) {
hour += 12;
}
}
}
components.assign("hour", hour);
components.assign("minute", minute);
if (meridiem !== null) {
components.assign("meridiem", meridiem);
} else {
if (hour < 12) {
components.imply("meridiem", index_1.Meridiem.AM);
} else {
components.imply("meridiem", index_1.Meridiem.PM);
}
}
if (match[MILLI_SECOND_GROUP] != null) {
const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3));
if (millisecond >= 1e3)
return null;
components.assign("millisecond", millisecond);
}
if (match[SECOND_GROUP] != null) {
const second = parseInt(match[SECOND_GROUP]);
if (second >= 60)
return null;
components.assign("second", second);
}
return components;
}
extractFollowingTimeComponents(context, match, result) {
const components = context.createParsingComponents();
if (match[MILLI_SECOND_GROUP] != null) {
const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3));
if (millisecond >= 1e3)
return null;
components.assign("millisecond", millisecond);
}
if (match[SECOND_GROUP] != null) {
const second = parseInt(match[SECOND_GROUP]);
if (second >= 60)
return null;
components.assign("second", second);
}
let hour = parseInt(match[HOUR_GROUP]);
let minute = 0;
let meridiem = -1;
if (match[MINUTE_GROUP] != null) {
minute = parseInt(match[MINUTE_GROUP]);
} else if (hour > 100) {
minute = hour % 100;
hour = Math.floor(hour / 100);
}
if (minute >= 60 || hour > 24) {
return null;
}
if (hour >= 12) {
meridiem = index_1.Meridiem.PM;
}
if (match[AM_PM_HOUR_GROUP] != null) {
if (hour > 12) {
return null;
}
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
if (ampm == "a") {
meridiem = index_1.Meridiem.AM;
if (hour == 12) {
hour = 0;
if (!components.isCertain("day")) {
components.imply("day", components.get("day") + 1);
}
}
}
if (ampm == "p") {
meridiem = index_1.Meridiem.PM;
if (hour != 12)
hour += 12;
}
if (!result.start.isCertain("meridiem")) {
if (meridiem == index_1.Meridiem.AM) {
result.start.imply("meridiem", index_1.Meridiem.AM);
if (result.start.get("hour") == 12) {
result.start.assign("hour", 0);
}
} else {
result.start.imply("meridiem", index_1.Meridiem.PM);
if (result.start.get("hour") != 12) {
result.start.assign("hour", result.start.get("hour") + 12);
}
}
}
}
components.assign("hour", hour);
components.assign("minute", minute);
if (meridiem >= 0) {
components.assign("meridiem", meridiem);
} else {
const startAtPM = result.start.isCertain("meridiem") && result.start.get("hour") > 12;
if (startAtPM) {
if (result.start.get("hour") - 12 > hour) {
components.imply("meridiem", index_1.Meridiem.AM);
} else if (hour <= 12) {
components.assign("hour", hour + 12);
components.assign("meridiem", index_1.Meridiem.PM);
}
} else if (hour > 12) {
components.imply("meridiem", index_1.Meridiem.PM);
} else if (hour <= 12) {
components.imply("meridiem", index_1.Meridiem.AM);
}
}
if (components.date().getTime() < result.start.date().getTime()) {
components.imply("day", components.get("day") + 1);
}
return components;
}
checkAndReturnWithoutFollowingPattern(result) {
if (result.text.match(/^\d$/)) {
return null;
}
const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)$/);
if (endingWithNumbers) {
const endingNumbers = endingWithNumbers[1];
if (this.strictMode) {
return null;
}
if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) {
return null;
}
const endingNumberVal = parseInt(endingNumbers);
if (endingNumberVal > 24) {
return null;
}
}
return result;
}
checkAndReturnWithFollowingPattern(result) {
if (result.text.match(/^\d+-\d+$/)) {
return null;
}
const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);
if (endingWithNumbers) {
if (this.strictMode) {
return null;
}
const startingNumbers = endingWithNumbers[1];
const endingNumbers = endingWithNumbers[2];
if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) {
return null;
}
const endingNumberVal = parseInt(endingNumbers);
const startingNumberVal = parseInt(startingNumbers);
if (endingNumberVal > 24 || startingNumberVal > 24) {
return null;
}
}
return result;
}
getPrimaryTimePatternThroughCache() {
const primaryPrefix = this.primaryPrefix();
const primarySuffix = this.primarySuffix();
if (this.cachedPrimaryPrefix === primaryPrefix && this.cachedPrimarySuffix === primarySuffix) {
return this.cachedPrimaryTimePattern;
}
this.cachedPrimaryTimePattern = primaryTimePattern(primaryPrefix, primarySuffix);
this.cachedPrimaryPrefix = primaryPrefix;
this.cachedPrimarySuffix = primarySuffix;
return this.cachedPrimaryTimePattern;
}
getFollowingTimePatternThroughCache() {
const followingPhase = this.followingPhase();
const followingSuffix = this.followingSuffix();
if (this.cachedFollowingPhase === followingPhase && this.cachedFollowingSuffix === followingSuffix) {
return this.cachedFollowingTimePatten;
}
this.cachedFollowingTimePatten = followingTimePatten(followingPhase, followingSuffix);
this.cachedFollowingPhase = followingPhase;
this.cachedFollowingSuffix = followingSuffix;
return this.cachedFollowingTimePatten;
}
};
exports.AbstractTimeExpressionParser = AbstractTimeExpressionParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENTimeExpressionParser.js
var require_ENTimeExpressionParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENTimeExpressionParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require_dist();
var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser();
var ENTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
constructor(strictMode) {
super(strictMode);
}
followingPhase() {
return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|to|\\?)\\s*";
}
primaryPrefix() {
return "(?:(?:at|from)\\s*)??";
}
primarySuffix() {
return "(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)";
}
extractPrimaryTimeComponents(context, match) {
const components = super.extractPrimaryTimeComponents(context, match);
if (components) {
if (match[0].endsWith("night")) {
const hour = components.get("hour");
if (hour >= 6 && hour < 12) {
components.assign("hour", components.get("hour") + 12);
components.assign("meridiem", index_1.Meridiem.PM);
} else if (hour < 6) {
components.assign("meridiem", index_1.Meridiem.AM);
}
}
if (match[0].endsWith("afternoon")) {
components.assign("meridiem", index_1.Meridiem.PM);
const hour = components.get("hour");
if (hour >= 0 && hour <= 6) {
components.assign("hour", components.get("hour") + 12);
}
}
if (match[0].endsWith("morning")) {
components.assign("meridiem", index_1.Meridiem.AM);
const hour = components.get("hour");
if (hour < 12) {
components.assign("hour", components.get("hour"));
}
}
}
return components;
}
};
exports.default = ENTimeExpressionParser;
}
});
// node_modules/chrono-node/dist/utils/timeunits.js
var require_timeunits = __commonJS({
"node_modules/chrono-node/dist/utils/timeunits.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addImpliedTimeUnits = exports.reverseTimeUnits = void 0;
function reverseTimeUnits(timeUnits) {
const reversed = {};
for (const key in timeUnits) {
reversed[key] = -timeUnits[key];
}
return reversed;
}
exports.reverseTimeUnits = reverseTimeUnits;
function addImpliedTimeUnits(components, timeUnits) {
const output = components.clone();
let date = components.dayjs();
for (const key in timeUnits) {
date = date.add(timeUnits[key], key);
}
if ("day" in timeUnits || "d" in timeUnits || "week" in timeUnits || "month" in timeUnits || "year" in timeUnits) {
output.imply("day", date.date());
output.imply("month", date.month() + 1);
output.imply("year", date.year());
}
if ("second" in timeUnits || "minute" in timeUnits || "hour" in timeUnits) {
output.imply("second", date.second());
output.imply("minute", date.minute());
output.imply("hour", date.hour());
}
return output;
}
exports.addImpliedTimeUnits = addImpliedTimeUnits;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitAgoFormatParser.js
var require_ENTimeUnitAgoFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitAgoFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants();
var results_1 = require_results();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var timeunits_1 = require_timeunits();
var PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")(?:ago|before|earlier)(?=(?:\\W|$))", "i");
var STRICT_PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")ago(?=(?:\\W|$))", "i");
var ENTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
constructor(strictMode) {
super();
this.strictMode = strictMode;
}
innerPattern() {
return this.strictMode ? STRICT_PATTERN : PATTERN;
}
innerExtract(context, match) {
const timeUnits = constants_1.parseTimeUnits(match[1]);
const outputTimeUnits = timeunits_1.reverseTimeUnits(timeUnits);
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, outputTimeUnits);
}
};
exports.default = ENTimeUnitAgoFormatParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitLaterFormatParser.js
var require_ENTimeUnitLaterFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitLaterFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants();
var results_1 = require_results();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")(later|after|from now|henceforth|forward|out)(?=(?:\\W|$))", "i");
var STRICT_PATTERN = new RegExp("(" + constants_1.TIME_UNITS_PATTERN + ")(later|from now)(?=(?:\\W|$))", "i");
var GROUP_NUM_TIMEUNITS = 1;
var ENTimeUnitLaterFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
constructor(strictMode) {
super();
this.strictMode = strictMode;
}
innerPattern() {
return this.strictMode ? STRICT_PATTERN : PATTERN;
}
innerExtract(context, match) {
const fragments = constants_1.parseTimeUnits(match[GROUP_NUM_TIMEUNITS]);
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, fragments);
}
};
exports.default = ENTimeUnitLaterFormatParser;
}
});
// node_modules/chrono-node/dist/common/abstractRefiners.js
var require_abstractRefiners = __commonJS({
"node_modules/chrono-node/dist/common/abstractRefiners.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MergingRefiner = exports.Filter = void 0;
var Filter = class {
refine(context, results) {
return results.filter((r) => this.isValid(context, r));
}
};
exports.Filter = Filter;
var MergingRefiner = class {
refine(context, results) {
if (results.length < 2) {
return results;
}
const mergedResults = [];
let curResult = results[0];
let nextResult = null;
for (let i = 1; i < results.length; i++) {
nextResult = results[i];
const textBetween = context.text.substring(curResult.index + curResult.text.length, nextResult.index);
if (!this.shouldMergeResults(textBetween, curResult, nextResult, context)) {
mergedResults.push(curResult);
curResult = nextResult;
} else {
const left = curResult;
const right = nextResult;
const mergedResult = this.mergeResults(textBetween, left, right, context);
context.debug(() => {
console.log(`${this.constructor.name} merged ${left} and ${right} into ${mergedResult}`);
});
curResult = mergedResult;
}
}
if (curResult != null) {
mergedResults.push(curResult);
}
return mergedResults;
}
};
exports.MergingRefiner = MergingRefiner;
}
});
// node_modules/chrono-node/dist/common/refiners/AbstractMergeDateRangeRefiner.js
var require_AbstractMergeDateRangeRefiner = __commonJS({
"node_modules/chrono-node/dist/common/refiners/AbstractMergeDateRangeRefiner.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var abstractRefiners_1 = require_abstractRefiners();
var AbstractMergeDateRangeRefiner = class extends abstractRefiners_1.MergingRefiner {
shouldMergeResults(textBetween, currentResult, nextResult) {
return !currentResult.end && !nextResult.end && textBetween.match(this.patternBetween()) != null;
}
mergeResults(textBetween, fromResult, toResult) {
if (!fromResult.start.isOnlyWeekdayComponent() && !toResult.start.isOnlyWeekdayComponent()) {
toResult.start.getCertainComponents().forEach((key) => {
if (!fromResult.start.isCertain(key)) {
fromResult.start.assign(key, toResult.start.get(key));
}
});
fromResult.start.getCertainComponents().forEach((key) => {
if (!toResult.start.isCertain(key)) {
toResult.start.assign(key, fromResult.start.get(key));
}
});
}
if (fromResult.start.date().getTime() > toResult.start.date().getTime()) {
let fromMoment = fromResult.start.dayjs();
let toMoment = toResult.start.dayjs();
if (fromResult.start.isOnlyWeekdayComponent() && fromMoment.add(-7, "days").isBefore(toMoment)) {
fromMoment = fromMoment.add(-7, "days");
fromResult.start.imply("day", fromMoment.date());
fromResult.start.imply("month", fromMoment.month() + 1);
fromResult.start.imply("year", fromMoment.year());
} else if (toResult.start.isOnlyWeekdayComponent() && toMoment.add(7, "days").isAfter(fromMoment)) {
toMoment = toMoment.add(7, "days");
toResult.start.imply("day", toMoment.date());
toResult.start.imply("month", toMoment.month() + 1);
toResult.start.imply("year", toMoment.year());
} else {
[toResult, fromResult] = [fromResult, toResult];
}
}
const result = fromResult.clone();
result.start = fromResult.start;
result.end = toResult.start;
result.index = Math.min(fromResult.index, toResult.index);
if (fromResult.index < toResult.index) {
result.text = fromResult.text + textBetween + toResult.text;
} else {
result.text = toResult.text + textBetween + fromResult.text;
}
return result;
}
};
exports.default = AbstractMergeDateRangeRefiner;
}
});
// node_modules/chrono-node/dist/locales/en/refiners/ENMergeDateRangeRefiner.js
var require_ENMergeDateRangeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/en/refiners/ENMergeDateRangeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateRangeRefiner_1 = __importDefault2(require_AbstractMergeDateRangeRefiner());
var ENMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default {
patternBetween() {
return /^\s*(to|-)\s*$/i;
}
};
exports.default = ENMergeDateRangeRefiner;
}
});
// node_modules/chrono-node/dist/calculation/mergingCalculation.js
var require_mergingCalculation = __commonJS({
"node_modules/chrono-node/dist/calculation/mergingCalculation.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeDateTimeComponent = exports.mergeDateTimeResult = void 0;
var index_1 = require_dist();
function mergeDateTimeResult(dateResult, timeResult) {
const result = dateResult.clone();
const beginDate = dateResult.start;
const beginTime = timeResult.start;
result.start = mergeDateTimeComponent(beginDate, beginTime);
if (dateResult.end != null || timeResult.end != null) {
const endDate = dateResult.end == null ? dateResult.start : dateResult.end;
const endTime = timeResult.end == null ? timeResult.start : timeResult.end;
const endDateTime = mergeDateTimeComponent(endDate, endTime);
if (dateResult.end == null && endDateTime.date().getTime() < result.start.date().getTime()) {
if (endDateTime.isCertain("day")) {
endDateTime.assign("day", endDateTime.get("day") + 1);
} else {
endDateTime.imply("day", endDateTime.get("day") + 1);
}
}
result.end = endDateTime;
}
return result;
}
exports.mergeDateTimeResult = mergeDateTimeResult;
function mergeDateTimeComponent(dateComponent, timeComponent) {
const dateTimeComponent = dateComponent.clone();
if (timeComponent.isCertain("hour")) {
dateTimeComponent.assign("hour", timeComponent.get("hour"));
dateTimeComponent.assign("minute", timeComponent.get("minute"));
if (timeComponent.isCertain("second")) {
dateTimeComponent.assign("second", timeComponent.get("second"));
if (timeComponent.isCertain("millisecond")) {
dateTimeComponent.assign("millisecond", timeComponent.get("millisecond"));
} else {
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
}
} else {
dateTimeComponent.imply("second", timeComponent.get("second"));
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
}
} else {
dateTimeComponent.imply("hour", timeComponent.get("hour"));
dateTimeComponent.imply("minute", timeComponent.get("minute"));
dateTimeComponent.imply("second", timeComponent.get("second"));
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
}
if (timeComponent.isCertain("timezoneOffset")) {
dateTimeComponent.assign("timezoneOffset", timeComponent.get("timezoneOffset"));
}
if (timeComponent.isCertain("meridiem")) {
dateTimeComponent.assign("meridiem", timeComponent.get("meridiem"));
} else if (timeComponent.get("meridiem") != null && dateTimeComponent.get("meridiem") == null) {
dateTimeComponent.imply("meridiem", timeComponent.get("meridiem"));
}
if (dateTimeComponent.get("meridiem") == index_1.Meridiem.PM && dateTimeComponent.get("hour") < 12) {
if (timeComponent.isCertain("hour")) {
dateTimeComponent.assign("hour", dateTimeComponent.get("hour") + 12);
} else {
dateTimeComponent.imply("hour", dateTimeComponent.get("hour") + 12);
}
}
return dateTimeComponent;
}
exports.mergeDateTimeComponent = mergeDateTimeComponent;
}
});
// node_modules/chrono-node/dist/common/refiners/AbstractMergeDateTimeRefiner.js
var require_AbstractMergeDateTimeRefiner = __commonJS({
"node_modules/chrono-node/dist/common/refiners/AbstractMergeDateTimeRefiner.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var abstractRefiners_1 = require_abstractRefiners();
var mergingCalculation_1 = require_mergingCalculation();
var ENMergeDateTimeRefiner = class extends abstractRefiners_1.MergingRefiner {
shouldMergeResults(textBetween, currentResult, nextResult) {
return (currentResult.start.isOnlyDate() && nextResult.start.isOnlyTime() || nextResult.start.isOnlyDate() && currentResult.start.isOnlyTime()) && textBetween.match(this.patternBetween()) != null;
}
mergeResults(textBetween, currentResult, nextResult) {
const result = currentResult.start.isOnlyDate() ? mergingCalculation_1.mergeDateTimeResult(currentResult, nextResult) : mergingCalculation_1.mergeDateTimeResult(nextResult, currentResult);
result.index = currentResult.index;
result.text = currentResult.text + textBetween + nextResult.text;
return result;
}
};
exports.default = ENMergeDateTimeRefiner;
}
});
// node_modules/chrono-node/dist/locales/en/refiners/ENMergeDateTimeRefiner.js
var require_ENMergeDateTimeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/en/refiners/ENMergeDateTimeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateTimeRefiner_1 = __importDefault2(require_AbstractMergeDateTimeRefiner());
var ENMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default {
patternBetween() {
return new RegExp("^\\s*(T|at|after|before|on|of|,|-)?\\s*$");
}
};
exports.default = ENMergeDateTimeRefiner;
}
});
// node_modules/chrono-node/dist/common/refiners/ExtractTimezoneAbbrRefiner.js
var require_ExtractTimezoneAbbrRefiner = __commonJS({
"node_modules/chrono-node/dist/common/refiners/ExtractTimezoneAbbrRefiner.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TIMEZONE_NAME_PATTERN = new RegExp("^\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i");
var DEFAULT_TIMEZONE_ABBR_MAP = {
ACDT: 630,
ACST: 570,
ADT: -180,
AEDT: 660,
AEST: 600,
AFT: 270,
AKDT: -480,
AKST: -540,
ALMT: 360,
AMST: -180,
AMT: -240,
ANAST: 720,
ANAT: 720,
AQTT: 300,
ART: -180,
AST: -240,
AWDT: 540,
AWST: 480,
AZOST: 0,
AZOT: -60,
AZST: 300,
AZT: 240,
BNT: 480,
BOT: -240,
BRST: -120,
BRT: -180,
BST: 60,
BTT: 360,
CAST: 480,
CAT: 120,
CCT: 390,
CDT: -300,
CEST: 120,
CET: 60,
CHADT: 825,
CHAST: 765,
CKT: -600,
CLST: -180,
CLT: -240,
COT: -300,
CST: -360,
CVT: -60,
CXT: 420,
ChST: 600,
DAVT: 420,
EASST: -300,
EAST: -360,
EAT: 180,
ECT: -300,
EDT: -240,
EEST: 180,
EET: 120,
EGST: 0,
EGT: -60,
EST: -300,
ET: -300,
FJST: 780,
FJT: 720,
FKST: -180,
FKT: -240,
FNT: -120,
GALT: -360,
GAMT: -540,
GET: 240,
GFT: -180,
GILT: 720,
GMT: 0,
GST: 240,
GYT: -240,
HAA: -180,
HAC: -300,
HADT: -540,
HAE: -240,
HAP: -420,
HAR: -360,
HAST: -600,
HAT: -90,
HAY: -480,
HKT: 480,
HLV: -210,
HNA: -240,
HNC: -360,
HNE: -300,
HNP: -480,
HNR: -420,
HNT: -150,
HNY: -540,
HOVT: 420,
ICT: 420,
IDT: 180,
IOT: 360,
IRDT: 270,
IRKST: 540,
IRKT: 540,
IRST: 210,
IST: 330,
JST: 540,
KGT: 360,
KRAST: 480,
KRAT: 480,
KST: 540,
KUYT: 240,
LHDT: 660,
LHST: 630,
LINT: 840,
MAGST: 720,
MAGT: 720,
MART: -510,
MAWT: 300,
MDT: -360,
MESZ: 120,
MEZ: 60,
MHT: 720,
MMT: 390,
MSD: 240,
MSK: 240,
MST: -420,
MUT: 240,
MVT: 300,
MYT: 480,
NCT: 660,
NDT: -90,
NFT: 690,
NOVST: 420,
NOVT: 360,
NPT: 345,
NST: -150,
NUT: -660,
NZDT: 780,
NZST: 720,
OMSST: 420,
OMST: 420,
PDT: -420,
PET: -300,
PETST: 720,
PETT: 720,
PGT: 600,
PHOT: 780,
PHT: 480,
PKT: 300,
PMDT: -120,
PMST: -180,
PONT: 660,
PST: -480,
PT: -480,
PWT: 540,
PYST: -180,
PYT: -240,
RET: 240,
SAMT: 240,
SAST: 120,
SBT: 660,
SCT: 240,
SGT: 480,
SRT: -180,
SST: -660,
TAHT: -600,
TFT: 300,
TJT: 300,
TKT: 780,
TLT: 540,
TMT: 300,
TVT: 720,
ULAT: 480,
UTC: 0,
UYST: -120,
UYT: -180,
UZT: 300,
VET: -210,
VLAST: 660,
VLAT: 660,
VUT: 660,
WAST: 120,
WAT: 60,
WEST: 60,
WESZ: 60,
WET: 0,
WEZ: 0,
WFT: 720,
WGST: -120,
WGT: -180,
WIB: 420,
WIT: 540,
WITA: 480,
WST: 780,
WT: 0,
YAKST: 600,
YAKT: 600,
YAPT: 600,
YEKST: 360,
YEKT: 360
};
var ExtractTimezoneAbbrRefiner = class {
constructor(timezoneOverrides) {
this.timezone = Object.assign(Object.assign({}, DEFAULT_TIMEZONE_ABBR_MAP), timezoneOverrides);
}
refine(context, results) {
var _a;
const timezoneOverrides = (_a = context.option.timezones) !== null && _a !== void 0 ? _a : {};
results.forEach((result) => {
var _a2, _b;
const suffix = context.text.substring(result.index + result.text.length);
const match = TIMEZONE_NAME_PATTERN.exec(suffix);
if (!match) {
return;
}
const timezoneAbbr = match[1].toUpperCase();
const extractedTimezoneOffset = (_b = (_a2 = timezoneOverrides[timezoneAbbr]) !== null && _a2 !== void 0 ? _a2 : this.timezone[timezoneAbbr]) !== null && _b !== void 0 ? _b : null;
if (extractedTimezoneOffset === null) {
return;
}
context.debug(() => {
console.log(`Extracting timezone: '${timezoneAbbr}' into : ${extractedTimezoneOffset}`);
});
const currentTimezoneOffset = result.start.get("timezoneOffset");
if (currentTimezoneOffset !== null && extractedTimezoneOffset != currentTimezoneOffset) {
return;
}
result.text += match[0];
if (!result.start.isCertain("timezoneOffset")) {
result.start.assign("timezoneOffset", extractedTimezoneOffset);
}
if (result.end != null && !result.end.isCertain("timezoneOffset")) {
result.end.assign("timezoneOffset", extractedTimezoneOffset);
}
});
return results;
}
};
exports.default = ExtractTimezoneAbbrRefiner;
}
});
// node_modules/chrono-node/dist/common/refiners/ExtractTimezoneOffsetRefiner.js
var require_ExtractTimezoneOffsetRefiner = __commonJS({
"node_modules/chrono-node/dist/common/refiners/ExtractTimezoneOffsetRefiner.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TIMEZONE_OFFSET_PATTERN = new RegExp("^\\s*(?:(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?", "i");
var TIMEZONE_OFFSET_SIGN_GROUP = 1;
var TIMEZONE_OFFSET_HOUR_OFFSET_GROUP = 2;
var TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP = 3;
var ExtractTimezoneOffsetRefiner = class {
refine(context, results) {
results.forEach(function(result) {
if (result.start.isCertain("timezoneOffset")) {
return;
}
const suffix = context.text.substring(result.index + result.text.length);
const match = TIMEZONE_OFFSET_PATTERN.exec(suffix);
if (!match) {
return;
}
context.debug(() => {
console.log(`Extracting timezone: '${match[0]}' into : ${result}`);
});
const hourOffset = parseInt(match[TIMEZONE_OFFSET_HOUR_OFFSET_GROUP]);
const minuteOffset = parseInt(match[TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP] || "0");
let timezoneOffset = hourOffset * 60 + minuteOffset;
if (match[TIMEZONE_OFFSET_SIGN_GROUP] === "-") {
timezoneOffset = -timezoneOffset;
}
if (result.end != null) {
result.end.assign("timezoneOffset", timezoneOffset);
}
result.start.assign("timezoneOffset", timezoneOffset);
result.text += match[0];
});
return results;
}
};
exports.default = ExtractTimezoneOffsetRefiner;
}
});
// node_modules/chrono-node/dist/common/refiners/OverlapRemovalRefiner.js
var require_OverlapRemovalRefiner = __commonJS({
"node_modules/chrono-node/dist/common/refiners/OverlapRemovalRefiner.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var OverlapRemovalRefiner = class {
refine(context, results) {
if (results.length < 2) {
return results;
}
const filteredResults = [];
let prevResult = results[0];
for (let i = 1; i < results.length; i++) {
const result = results[i];
if (result.index < prevResult.index + prevResult.text.length) {
if (result.text.length > prevResult.text.length) {
prevResult = result;
}
} else {
filteredResults.push(prevResult);
prevResult = result;
}
}
if (prevResult != null) {
filteredResults.push(prevResult);
}
return filteredResults;
}
};
exports.default = OverlapRemovalRefiner;
}
});
// node_modules/chrono-node/dist/common/refiners/ForwardDateRefiner.js
var require_ForwardDateRefiner = __commonJS({
"node_modules/chrono-node/dist/common/refiners/ForwardDateRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dayjs_1 = __importDefault2(require_dayjs_min());
var ForwardDateRefiner = class {
refine(context, results) {
if (!context.option.forwardDate) {
return results;
}
results.forEach(function(result) {
let refMoment = dayjs_1.default(context.refDate);
if (result.start.isOnlyDayMonthComponent() && refMoment.isAfter(result.start.dayjs())) {
for (let i = 0; i < 3 && refMoment.isAfter(result.start.dayjs()); i++) {
result.start.imply("year", result.start.get("year") + 1);
context.debug(() => {
console.log(`Forward yearly adjusted for ${result} (${result.start})`);
});
if (result.end && !result.end.isCertain("year")) {
result.end.imply("year", result.end.get("year") + 1);
context.debug(() => {
console.log(`Forward yearly adjusted for ${result} (${result.end})`);
});
}
}
}
if (result.start.isOnlyWeekdayComponent() && refMoment.isAfter(result.start.dayjs())) {
if (refMoment.day() > result.start.get("weekday")) {
refMoment = refMoment.day(result.start.get("weekday") + 7);
} else {
refMoment = refMoment.day(result.start.get("weekday"));
}
result.start.imply("day", refMoment.date());
result.start.imply("month", refMoment.month() + 1);
result.start.imply("year", refMoment.year());
context.debug(() => {
console.log(`Forward weekly adjusted for ${result} (${result.start})`);
});
if (result.end && result.end.isOnlyWeekdayComponent()) {
if (refMoment.day() > result.end.get("weekday")) {
refMoment = refMoment.day(result.end.get("weekday") + 7);
} else {
refMoment = refMoment.day(result.end.get("weekday"));
}
result.end.imply("day", refMoment.date());
result.end.imply("month", refMoment.month() + 1);
result.end.imply("year", refMoment.year());
context.debug(() => {
console.log(`Forward weekly adjusted for ${result} (${result.end})`);
});
}
}
});
return results;
}
};
exports.default = ForwardDateRefiner;
}
});
// node_modules/chrono-node/dist/common/refiners/UnlikelyFormatFilter.js
var require_UnlikelyFormatFilter = __commonJS({
"node_modules/chrono-node/dist/common/refiners/UnlikelyFormatFilter.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var abstractRefiners_1 = require_abstractRefiners();
var UnlikelyFormatFilter = class extends abstractRefiners_1.Filter {
constructor(strictMode) {
super();
this.strictMode = strictMode;
}
isValid(context, result) {
if (result.text.replace(" ", "").match(/^\d*(\.\d*)?$/)) {
context.debug(() => {
console.log(`Removing unlikely result '${result.text}'`);
});
return false;
}
if (!result.start.isValidDate()) {
context.debug(() => {
console.log(`Removing invalid result: ${result} (${result.start})`);
});
return false;
}
if (result.end && !result.end.isValidDate()) {
context.debug(() => {
console.log(`Removing invalid result: ${result} (${result.end})`);
});
return false;
}
if (this.strictMode) {
return this.isStrictModeValid(context, result);
}
return true;
}
isStrictModeValid(context, result) {
if (result.start.isOnlyWeekdayComponent()) {
context.debug(() => {
console.log(`(Strict) Removing weekday only component: ${result} (${result.end})`);
});
return false;
}
if (result.start.isOnlyTime() && (!result.start.isCertain("hour") || !result.start.isCertain("minute"))) {
context.debug(() => {
console.log(`(Strict) Removing uncertain time component: ${result} (${result.end})`);
});
return false;
}
return true;
}
};
exports.default = UnlikelyFormatFilter;
}
});
// node_modules/chrono-node/dist/common/parsers/ISOFormatParser.js
var require_ISOFormatParser = __commonJS({
"node_modules/chrono-node/dist/common/parsers/ISOFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(?:Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)", "i");
var YEAR_NUMBER_GROUP = 1;
var MONTH_NUMBER_GROUP = 2;
var DATE_NUMBER_GROUP = 3;
var HOUR_NUMBER_GROUP = 4;
var MINUTE_NUMBER_GROUP = 5;
var SECOND_NUMBER_GROUP = 6;
var MILLISECOND_NUMBER_GROUP = 7;
var TZD_HOUR_OFFSET_GROUP = 8;
var TZD_MINUTE_OFFSET_GROUP = 9;
var ISOFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const components = {};
components["year"] = parseInt(match[YEAR_NUMBER_GROUP]);
components["month"] = parseInt(match[MONTH_NUMBER_GROUP]);
components["day"] = parseInt(match[DATE_NUMBER_GROUP]);
if (match[HOUR_NUMBER_GROUP] != null) {
components["hour"] = parseInt(match[HOUR_NUMBER_GROUP]);
components["minute"] = parseInt(match[MINUTE_NUMBER_GROUP]);
if (match[SECOND_NUMBER_GROUP] != null) {
components["second"] = parseInt(match[SECOND_NUMBER_GROUP]);
}
if (match[MILLISECOND_NUMBER_GROUP] != null) {
components["millisecond"] = parseInt(match[MILLISECOND_NUMBER_GROUP]);
}
if (match[TZD_HOUR_OFFSET_GROUP] == null) {
components["timezoneOffset"] = 0;
} else {
const hourOffset = parseInt(match[TZD_HOUR_OFFSET_GROUP]);
let minuteOffset = 0;
if (match[TZD_MINUTE_OFFSET_GROUP] != null) {
minuteOffset = parseInt(match[TZD_MINUTE_OFFSET_GROUP]);
}
let offset = hourOffset * 60;
if (offset < 0) {
offset -= minuteOffset;
} else {
offset += minuteOffset;
}
components["timezoneOffset"] = offset;
}
}
return components;
}
};
exports.default = ISOFormatParser;
}
});
// node_modules/chrono-node/dist/common/refiners/MergeWeekdayComponentRefiner.js
var require_MergeWeekdayComponentRefiner = __commonJS({
"node_modules/chrono-node/dist/common/refiners/MergeWeekdayComponentRefiner.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var abstractRefiners_1 = require_abstractRefiners();
var MergeWeekdayComponentRefiner = class extends abstractRefiners_1.MergingRefiner {
mergeResults(textBetween, currentResult, nextResult) {
const newResult = nextResult.clone();
newResult.index = currentResult.index;
newResult.text = currentResult.text + textBetween + newResult.text;
newResult.start.assign("weekday", currentResult.start.get("weekday"));
if (newResult.end) {
newResult.end.assign("weekday", currentResult.start.get("weekday"));
}
return newResult;
}
shouldMergeResults(textBetween, currentResult, nextResult) {
const weekdayThenNormalDate = currentResult.start.isOnlyWeekdayComponent() && !currentResult.start.isCertain("hour") && nextResult.start.isCertain("day");
return weekdayThenNormalDate && textBetween.match(/^,?\s*$/) != null;
}
};
exports.default = MergeWeekdayComponentRefiner;
}
});
// node_modules/chrono-node/dist/configurations.js
var require_configurations = __commonJS({
"node_modules/chrono-node/dist/configurations.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.includeCommonConfiguration = void 0;
var ExtractTimezoneAbbrRefiner_1 = __importDefault2(require_ExtractTimezoneAbbrRefiner());
var ExtractTimezoneOffsetRefiner_1 = __importDefault2(require_ExtractTimezoneOffsetRefiner());
var OverlapRemovalRefiner_1 = __importDefault2(require_OverlapRemovalRefiner());
var ForwardDateRefiner_1 = __importDefault2(require_ForwardDateRefiner());
var UnlikelyFormatFilter_1 = __importDefault2(require_UnlikelyFormatFilter());
var ISOFormatParser_1 = __importDefault2(require_ISOFormatParser());
var MergeWeekdayComponentRefiner_1 = __importDefault2(require_MergeWeekdayComponentRefiner());
function includeCommonConfiguration(configuration, strictMode = false) {
configuration.parsers.unshift(new ISOFormatParser_1.default());
configuration.refiners.unshift(new MergeWeekdayComponentRefiner_1.default());
configuration.refiners.unshift(new ExtractTimezoneAbbrRefiner_1.default());
configuration.refiners.unshift(new ExtractTimezoneOffsetRefiner_1.default());
configuration.refiners.unshift(new OverlapRemovalRefiner_1.default());
configuration.refiners.push(new OverlapRemovalRefiner_1.default());
configuration.refiners.push(new ForwardDateRefiner_1.default());
configuration.refiners.push(new UnlikelyFormatFilter_1.default(strictMode));
return configuration;
}
exports.includeCommonConfiguration = includeCommonConfiguration;
}
});
// node_modules/chrono-node/dist/common/casualReferences.js
var require_casualReferences = __commonJS({
"node_modules/chrono-node/dist/common/casualReferences.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.tonight = exports.tomorrow = exports.yesterday = exports.today = exports.now = void 0;
var results_1 = require_results();
var dayjs_1 = __importDefault2(require_dayjs_min());
var dayjs_2 = require_dayjs();
var index_1 = require_dist();
function now(refDate) {
const targetDate = dayjs_1.default(refDate);
const component = new results_1.ParsingComponents(refDate, {});
dayjs_2.assignSimilarDate(component, targetDate);
dayjs_2.assignSimilarTime(component, targetDate);
return component;
}
exports.now = now;
function today(refDate) {
const targetDate = dayjs_1.default(refDate);
const component = new results_1.ParsingComponents(refDate, {});
dayjs_2.assignSimilarDate(component, targetDate);
dayjs_2.implySimilarTime(component, targetDate);
return component;
}
exports.today = today;
function yesterday(refDate) {
let targetDate = dayjs_1.default(refDate);
const component = new results_1.ParsingComponents(refDate, {});
targetDate = targetDate.add(-1, "day");
dayjs_2.assignSimilarDate(component, targetDate);
dayjs_2.implySimilarTime(component, targetDate);
return component;
}
exports.yesterday = yesterday;
function tomorrow(refDate) {
const targetDate = dayjs_1.default(refDate);
const component = new results_1.ParsingComponents(refDate, {});
dayjs_2.assignTheNextDay(component, targetDate);
return component;
}
exports.tomorrow = tomorrow;
function tonight(refDate, implyHour = 22) {
const targetDate = dayjs_1.default(refDate);
const component = new results_1.ParsingComponents(refDate, {});
component.imply("hour", implyHour);
component.imply("meridiem", index_1.Meridiem.PM);
dayjs_2.assignSimilarDate(component, targetDate);
return component;
}
exports.tonight = tonight;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENCasualDateParser.js
var require_ENCasualDateParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENCasualDateParser.js"(exports) {
"use strict";
var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar2 = exports && exports.__importStar || function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dayjs_1 = __importDefault2(require_dayjs_min());
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var dayjs_2 = require_dayjs();
var references = __importStar2(require_casualReferences());
var PATTERN = /(now|today|tonight|tomorrow|tmr|yesterday|last\s*night)(?=\W|$)/i;
var ENCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return PATTERN;
}
innerExtract(context, match) {
let targetDate = dayjs_1.default(context.refDate);
const lowerText = match[0].toLowerCase();
const component = context.createParsingComponents();
switch (lowerText) {
case "now":
return references.now(context.refDate);
case "today":
return references.today(context.refDate);
case "yesterday":
return references.yesterday(context.refDate);
case "tomorrow":
case "tmr":
return references.tomorrow(context.refDate);
case "tonight":
return references.tonight(context.refDate);
default:
if (lowerText.match(/last\s*night/)) {
if (targetDate.hour() > 6) {
targetDate = targetDate.add(-1, "day");
}
dayjs_2.assignSimilarDate(component, targetDate);
component.imply("hour", 0);
}
break;
}
return component;
}
};
exports.default = ENCasualDateParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENCasualTimeParser.js
var require_ENCasualTimeParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENCasualTimeParser.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require_dist();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var dayjs_1 = __importDefault2(require_dayjs_min());
var dayjs_2 = require_dayjs();
var PATTERN = /(?:this)?\s*(morning|afternoon|evening|night|midnight|noon)(?=\W|$)/i;
var ENCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const targetDate = dayjs_1.default(context.refDate);
const component = context.createParsingComponents();
switch (match[1].toLowerCase()) {
case "afternoon":
component.imply("meridiem", index_1.Meridiem.PM);
component.imply("hour", 15);
break;
case "evening":
case "night":
component.imply("meridiem", index_1.Meridiem.PM);
component.imply("hour", 20);
break;
case "midnight":
dayjs_2.assignTheNextDay(component, targetDate);
component.imply("hour", 0);
component.imply("minute", 0);
component.imply("second", 0);
break;
case "morning":
component.imply("meridiem", index_1.Meridiem.AM);
component.imply("hour", 6);
break;
case "noon":
component.imply("meridiem", index_1.Meridiem.AM);
component.imply("hour", 12);
break;
}
return component;
}
};
exports.default = ENCasualTimeParser;
}
});
// node_modules/chrono-node/dist/calculation/weeks.js
var require_weeks = __commonJS({
"node_modules/chrono-node/dist/calculation/weeks.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.toDayJSClosestWeekday = exports.toDayJSWeekday = void 0;
var dayjs_1 = __importDefault2(require_dayjs_min());
function toDayJSWeekday(refDate, offset, modifier) {
if (!modifier) {
return toDayJSClosestWeekday(refDate, offset);
}
let date = dayjs_1.default(refDate);
switch (modifier) {
case "this":
date = date.day(offset);
break;
case "next":
date = date.day(offset + 7);
break;
case "last":
date = date.day(offset - 7);
break;
}
return date;
}
exports.toDayJSWeekday = toDayJSWeekday;
function toDayJSClosestWeekday(refDate, offset) {
let date = dayjs_1.default(refDate);
const refOffset = date.day();
if (Math.abs(offset - 7 - refOffset) < Math.abs(offset - refOffset)) {
date = date.day(offset - 7);
} else if (Math.abs(offset + 7 - refOffset) < Math.abs(offset - refOffset)) {
date = date.day(offset + 7);
} else {
date = date.day(offset);
}
return date;
}
exports.toDayJSClosestWeekday = toDayJSClosestWeekday;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENWeekdayParser.js
var require_ENWeekdayParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENWeekdayParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var weeks_1 = require_weeks();
var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`, "i");
var PREFIX_GROUP = 1;
var WEEKDAY_GROUP = 2;
var POSTFIX_GROUP = 3;
var ENWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
const prefix = match[PREFIX_GROUP];
const postfix = match[POSTFIX_GROUP];
let modifierWord = prefix || postfix;
modifierWord = modifierWord || "";
modifierWord = modifierWord.toLowerCase();
let modifier = null;
if (modifierWord == "last" || modifierWord == "past") {
modifier = "last";
} else if (modifierWord == "next") {
modifier = "next";
} else if (modifierWord == "this") {
modifier = "this";
}
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
return context.createParsingComponents().assign("weekday", offset).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year());
}
};
exports.default = ENWeekdayParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENRelativeDateFormatParser.js
var require_ENRelativeDateFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENRelativeDateFormatParser.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants();
var results_1 = require_results();
var dayjs_1 = __importDefault2(require_dayjs_min());
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var pattern_1 = require_pattern();
var PATTERN = new RegExp(`(this|next|last|past)\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})(?=\\s*)(?=\\W|$)`, "i");
var MODIFIER_WORD_GROUP = 1;
var RELATIVE_WORD_GROUP = 2;
var ENRelativeDateFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const modifier = match[MODIFIER_WORD_GROUP].toLowerCase();
const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase();
const timeunit = constants_1.TIME_UNIT_DICTIONARY[unitWord];
if (modifier == "next") {
const timeUnits = {};
timeUnits[timeunit] = 1;
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
}
if (modifier == "last" || modifier == "past") {
const timeUnits = {};
timeUnits[timeunit] = -1;
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
}
const components = context.createParsingComponents();
let date = dayjs_1.default(context.refDate);
if (unitWord.match(/week/i)) {
date = date.add(-date.get("d"), "d");
components.imply("day", date.date());
components.imply("month", date.month() + 1);
components.imply("year", date.year());
} else if (unitWord.match(/month/i)) {
date = date.add(-date.date() + 1, "d");
components.imply("day", date.date());
components.assign("year", date.year());
components.assign("month", date.month() + 1);
} else if (unitWord.match(/year/i)) {
date = date.add(-date.date() + 1, "d");
date = date.add(-date.month(), "month");
components.imply("day", date.date());
components.imply("month", date.month() + 1);
components.assign("year", date.year());
}
return components;
}
};
exports.default = ENRelativeDateFormatParser;
}
});
// node_modules/chrono-node/dist/chrono.js
var require_chrono = __commonJS({
"node_modules/chrono-node/dist/chrono.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParsingContext = exports.Chrono = void 0;
var results_1 = require_results();
var en_1 = require_en();
var Chrono = class {
constructor(configuration) {
configuration = configuration || en_1.createCasualConfiguration();
this.parsers = [...configuration.parsers];
this.refiners = [...configuration.refiners];
}
clone() {
return new Chrono({
parsers: [...this.parsers],
refiners: [...this.refiners]
});
}
parseDate(text2, referenceDate, option) {
const results = this.parse(text2, referenceDate, option);
return results.length > 0 ? results[0].start.date() : null;
}
parse(text2, referenceDate, option) {
const context = new ParsingContext(text2, referenceDate || new Date(), option || {});
let results = [];
this.parsers.forEach((parser) => {
const parsedResults = Chrono.executeParser(context, parser);
results = results.concat(parsedResults);
});
results.sort((a, b) => {
return a.index - b.index;
});
this.refiners.forEach(function(refiner) {
results = refiner.refine(context, results);
});
return results;
}
static executeParser(context, parser) {
const results = [];
const pattern = parser.pattern(context);
const originalText = context.text;
let remainingText = context.text;
let match = pattern.exec(remainingText);
while (match) {
const index = match.index + originalText.length - remainingText.length;
match.index = index;
const result = parser.extract(context, match);
if (!result) {
remainingText = originalText.substring(match.index + 1);
match = pattern.exec(remainingText);
continue;
}
let parsedResult = null;
if (result instanceof results_1.ParsingResult) {
parsedResult = result;
} else if (result instanceof results_1.ParsingComponents) {
parsedResult = context.createParsingResult(match.index, match[0]);
parsedResult.start = result;
} else {
parsedResult = context.createParsingResult(match.index, match[0], result);
}
context.debug(() => console.log(`${parser.constructor.name} extracted result ${parsedResult}`));
results.push(parsedResult);
remainingText = originalText.substring(index + parsedResult.text.length);
match = pattern.exec(remainingText);
}
return results;
}
};
exports.Chrono = Chrono;
var ParsingContext = class {
constructor(text2, refDate, option) {
this.text = text2;
this.refDate = refDate;
this.option = option;
}
createParsingComponents(components) {
if (components instanceof results_1.ParsingComponents) {
return components;
}
return new results_1.ParsingComponents(this.refDate, components);
}
createParsingResult(index, textOrEndIndex, startComponents, endComponents) {
const text2 = typeof textOrEndIndex === "string" ? textOrEndIndex : this.text.substring(index, textOrEndIndex);
const start = startComponents ? this.createParsingComponents(startComponents) : null;
const end = endComponents ? this.createParsingComponents(endComponents) : null;
return new results_1.ParsingResult(this.refDate, index, text2, start, end);
}
debug(block) {
if (this.option.debug) {
if (this.option.debug instanceof Function) {
this.option.debug(block);
} else {
const handler = this.option.debug;
handler.debug(block);
}
}
}
};
exports.ParsingContext = ParsingContext;
}
});
// node_modules/chrono-node/dist/common/parsers/SlashDateFormatParser.js
var require_SlashDateFormatParser = __commonJS({
"node_modules/chrono-node/dist/common/parsers/SlashDateFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var years_1 = require_years();
var PATTERN = new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)", "i");
var OPENING_GROUP = 1;
var ENDING_GROUP = 5;
var FIRST_NUMBERS_GROUP = 2;
var SECOND_NUMBERS_GROUP = 3;
var YEAR_GROUP = 4;
var SlashDateFormatParser = class {
constructor(littleEndian) {
this.groupNumberMonth = littleEndian ? SECOND_NUMBERS_GROUP : FIRST_NUMBERS_GROUP;
this.groupNumberDay = littleEndian ? FIRST_NUMBERS_GROUP : SECOND_NUMBERS_GROUP;
}
pattern() {
return PATTERN;
}
extract(context, match) {
if (match[OPENING_GROUP] == "/" || match[ENDING_GROUP] == "/") {
match.index += match[0].length;
return;
}
const index = match.index + match[OPENING_GROUP].length;
const text2 = match[0].substr(match[OPENING_GROUP].length, match[0].length - match[OPENING_GROUP].length - match[ENDING_GROUP].length);
if (text2.match(/^\d\.\d$/) || text2.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)) {
return;
}
if (!match[YEAR_GROUP] && match[0].indexOf("/") < 0) {
return;
}
const result = context.createParsingResult(index, text2);
let month = parseInt(match[this.groupNumberMonth]);
let day = parseInt(match[this.groupNumberDay]);
if (month < 1 || month > 12) {
if (month > 12) {
if (day >= 1 && day <= 12 && month <= 31) {
[day, month] = [month, day];
} else {
return null;
}
}
}
if (day < 1 || day > 31) {
return null;
}
result.start.assign("day", day);
result.start.assign("month", month);
if (match[YEAR_GROUP]) {
const rawYearNumber = parseInt(match[YEAR_GROUP]);
const year = years_1.findMostLikelyADYear(rawYearNumber);
result.start.assign("year", year);
} else {
const year = years_1.findYearClosestToRef(context.refDate, day, month);
result.start.imply("year", year);
}
return result;
}
};
exports.default = SlashDateFormatParser;
}
});
// node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitCasualRelativeFormatParser.js
var require_ENTimeUnitCasualRelativeFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/en/parsers/ENTimeUnitCasualRelativeFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants();
var results_1 = require_results();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var timeunits_1 = require_timeunits();
var PATTERN = new RegExp(`(this|last|past|next|\\+|-)\\s*(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
var ENTimeUnitCasualRelativeFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const prefix = match[1].toLowerCase();
let timeUnits = constants_1.parseTimeUnits(match[2]);
switch (prefix) {
case "last":
case "past":
case "-":
timeUnits = timeunits_1.reverseTimeUnits(timeUnits);
break;
}
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
}
};
exports.default = ENTimeUnitCasualRelativeFormatParser;
}
});
// node_modules/chrono-node/dist/locales/en/index.js
var require_en = __commonJS({
"node_modules/chrono-node/dist/locales/en/index.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.GB = exports.strict = exports.casual = void 0;
var ENTimeUnitWithinFormatParser_1 = __importDefault2(require_ENTimeUnitWithinFormatParser());
var ENMonthNameLittleEndianParser_1 = __importDefault2(require_ENMonthNameLittleEndianParser());
var ENMonthNameMiddleEndianParser_1 = __importDefault2(require_ENMonthNameMiddleEndianParser());
var ENMonthNameParser_1 = __importDefault2(require_ENMonthNameParser());
var ENCasualYearMonthDayParser_1 = __importDefault2(require_ENCasualYearMonthDayParser());
var ENSlashMonthFormatParser_1 = __importDefault2(require_ENSlashMonthFormatParser());
var ENTimeExpressionParser_1 = __importDefault2(require_ENTimeExpressionParser());
var ENTimeUnitAgoFormatParser_1 = __importDefault2(require_ENTimeUnitAgoFormatParser());
var ENTimeUnitLaterFormatParser_1 = __importDefault2(require_ENTimeUnitLaterFormatParser());
var ENMergeDateRangeRefiner_1 = __importDefault2(require_ENMergeDateRangeRefiner());
var ENMergeDateTimeRefiner_1 = __importDefault2(require_ENMergeDateTimeRefiner());
var configurations_1 = require_configurations();
var ENCasualDateParser_1 = __importDefault2(require_ENCasualDateParser());
var ENCasualTimeParser_1 = __importDefault2(require_ENCasualTimeParser());
var ENWeekdayParser_1 = __importDefault2(require_ENWeekdayParser());
var ENRelativeDateFormatParser_1 = __importDefault2(require_ENRelativeDateFormatParser());
var chrono_1 = require_chrono();
var SlashDateFormatParser_1 = __importDefault2(require_SlashDateFormatParser());
var ENTimeUnitCasualRelativeFormatParser_1 = __importDefault2(require_ENTimeUnitCasualRelativeFormatParser());
exports.casual = new chrono_1.Chrono(createCasualConfiguration(false));
exports.strict = new chrono_1.Chrono(createConfiguration(true, false));
exports.GB = new chrono_1.Chrono(createConfiguration(false, true));
function parse(text2, ref, option) {
return exports.casual.parse(text2, ref, option);
}
exports.parse = parse;
function parseDate2(text2, ref, option) {
return exports.casual.parseDate(text2, ref, option);
}
exports.parseDate = parseDate2;
function createCasualConfiguration(littleEndian = false) {
const option = createConfiguration(false, littleEndian);
option.parsers.unshift(new ENCasualDateParser_1.default());
option.parsers.unshift(new ENCasualTimeParser_1.default());
option.parsers.unshift(new ENMonthNameParser_1.default());
option.parsers.unshift(new ENRelativeDateFormatParser_1.default());
option.parsers.unshift(new ENTimeUnitCasualRelativeFormatParser_1.default());
return option;
}
exports.createCasualConfiguration = createCasualConfiguration;
function createConfiguration(strictMode = true, littleEndian = false) {
return configurations_1.includeCommonConfiguration({
parsers: [
new SlashDateFormatParser_1.default(littleEndian),
new ENTimeUnitWithinFormatParser_1.default(),
new ENMonthNameLittleEndianParser_1.default(),
new ENMonthNameMiddleEndianParser_1.default(),
new ENWeekdayParser_1.default(),
new ENCasualYearMonthDayParser_1.default(),
new ENSlashMonthFormatParser_1.default(),
new ENTimeExpressionParser_1.default(strictMode),
new ENTimeUnitAgoFormatParser_1.default(strictMode),
new ENTimeUnitLaterFormatParser_1.default(strictMode)
],
refiners: [new ENMergeDateTimeRefiner_1.default(), new ENMergeDateRangeRefiner_1.default()]
}, strictMode);
}
exports.createConfiguration = createConfiguration;
}
});
// node_modules/chrono-node/dist/locales/de/parsers/DETimeExpressionParser.js
var require_DETimeExpressionParser = __commonJS({
"node_modules/chrono-node/dist/locales/de/parsers/DETimeExpressionParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser();
var index_1 = require_dist();
var DETimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
primaryPrefix() {
return "(?:(?:um|von)\\s*)?";
}
followingPhase() {
return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|bis)\\s*";
}
primarySuffix() {
return "(?:\\s*uhr)?(?:\\s*(?:morgens|vormittags|nachmittags|abends|nachts))?(?=\\W|$)";
}
extractPrimaryTimeComponents(context, match) {
const components = super.extractPrimaryTimeComponents(context, match);
if (components) {
if (match[0].endsWith("morgens") || match[0].endsWith("vormittags")) {
components.assign("meridiem", index_1.Meridiem.AM);
const hour = components.get("hour");
if (hour < 12) {
components.assign("hour", components.get("hour"));
}
}
if (match[0].endsWith("nachmittags") || match[0].endsWith("abends") || match[0].endsWith("nachts")) {
components.assign("meridiem", index_1.Meridiem.PM);
const hour = components.get("hour");
if (hour < 12) {
components.assign("hour", components.get("hour") + 12);
}
}
}
return components;
}
};
exports.default = DETimeExpressionParser;
}
});
// node_modules/chrono-node/dist/locales/de/constants.js
var require_constants2 = __commonJS({
"node_modules/chrono-node/dist/locales/de/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
var pattern_1 = require_pattern();
var years_1 = require_years();
exports.WEEKDAY_DICTIONARY = {
"sonntag": 0,
"so": 0,
"montag": 1,
"mo": 1,
"dienstag": 2,
"di": 2,
"mittwoch": 3,
"mi": 3,
"donnerstag": 4,
"do": 4,
"freitag": 5,
"fr": 5,
"samstag": 6,
"sa": 6
};
exports.MONTH_DICTIONARY = {
"januar": 1,
"jan": 1,
"jan.": 1,
"februar": 2,
"feb": 2,
"feb.": 2,
"m\xE4rz": 3,
"maerz": 3,
"m\xE4r": 3,
"m\xE4r.": 3,
"mrz": 3,
"mrz.": 3,
"april": 4,
"apr": 4,
"apr.": 4,
"mai": 5,
"juni": 6,
"jun": 6,
"jun.": 6,
"juli": 7,
"jul": 7,
"jul.": 7,
"august": 8,
"aug": 8,
"aug.": 8,
"september": 9,
"sep": 9,
"sep.": 9,
"sept": 9,
"sept.": 9,
"oktober": 10,
"okt": 10,
"okt.": 10,
"november": 11,
"nov": 11,
"nov.": 11,
"dezember": 12,
"dez": 12,
"dez.": 12
};
exports.INTEGER_WORD_DICTIONARY = {
"eins": 1,
"zwei": 2,
"drei": 3,
"vier": 4,
"f\xFCnf": 5,
"fuenf": 5,
"sechs": 6,
"sieben": 7,
"acht": 8,
"neun": 9,
"zehn": 10,
"elf": 11,
"zw\xF6lf": 12,
"zwoelf": 12
};
exports.TIME_UNIT_DICTIONARY = {
sec: "second",
second: "second",
seconds: "second",
min: "minute",
mins: "minute",
minute: "minute",
minutes: "minute",
h: "hour",
hr: "hour",
hrs: "hour",
hour: "hour",
hours: "hour",
day: "d",
days: "d",
week: "week",
weeks: "week",
month: "month",
months: "month",
y: "year",
yr: "year",
year: "year",
years: "year"
};
exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s*an?)?|an?(?:\\s*few)?|few|several|a?\\s*couple\\s*(?:of)?)`;
function parseNumberPattern(match) {
const num = match.toLowerCase();
if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) {
return exports.INTEGER_WORD_DICTIONARY[num];
} else if (num === "a" || num === "an") {
return 1;
} else if (num.match(/few/)) {
return 3;
} else if (num.match(/half/)) {
return 0.5;
} else if (num.match(/couple/)) {
return 2;
} else if (num.match(/several/)) {
return 7;
}
return parseFloat(num);
}
exports.parseNumberPattern = parseNumberPattern;
exports.YEAR_PATTERN = `(?:[0-9]{1,4}(?:\\s*[vn]\\.?\\s*C(?:hr)?\\.?)?)`;
function parseYear(match) {
if (/v/i.test(match)) {
return -parseInt(match.replace(/[^0-9]+/gi, ""));
}
if (/n/i.test(match)) {
return parseInt(match.replace(/[^0-9]+/gi, ""));
}
const rawYearNumber = parseInt(match);
return years_1.findMostLikelyADYear(rawYearNumber);
}
exports.parseYear = parseYear;
var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`;
var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern("", SINGLE_TIME_UNIT_PATTERN);
function parseTimeUnits(timeunitText) {
const fragments = {};
let remainingText = timeunitText;
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
while (match) {
collectDateTimeFragment(fragments, match);
remainingText = remainingText.substring(match[0].length);
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
}
return fragments;
}
exports.parseTimeUnits = parseTimeUnits;
function collectDateTimeFragment(fragments, match) {
const num = parseNumberPattern(match[1]);
const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
fragments[unit] = num;
}
}
});
// node_modules/chrono-node/dist/locales/de/parsers/DEWeekdayParser.js
var require_DEWeekdayParser = __commonJS({
"node_modules/chrono-node/dist/locales/de/parsers/DEWeekdayParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants2();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var weeks_1 = require_weeks();
var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:a[mn]\\s*?)?(?:(diese[mn]|letzte[mn]|n(?:\xE4|ae)chste[mn])\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(diese|letzte|n(?:\xE4|ae)chste)\\s*woche)?(?=\\W|$)`, "i");
var PREFIX_GROUP = 1;
var SUFFIX_GROUP = 3;
var WEEKDAY_GROUP = 2;
var DEWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
const prefix = match[PREFIX_GROUP];
const postfix = match[SUFFIX_GROUP];
let modifierWord = prefix || postfix;
modifierWord = modifierWord || "";
modifierWord = modifierWord.toLowerCase();
let modifier = null;
if (modifierWord.match(/letzte/)) {
modifier = "last";
} else if (modifierWord.match(/chste/)) {
modifier = "next";
} else if (modifierWord.match(/diese/)) {
modifier = "this";
}
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
return context.createParsingComponents().assign("weekday", offset).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year());
}
};
exports.default = DEWeekdayParser;
}
});
// node_modules/chrono-node/dist/locales/de/refiners/DEMergeDateRangeRefiner.js
var require_DEMergeDateRangeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/de/refiners/DEMergeDateRangeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateRangeRefiner_1 = __importDefault2(require_AbstractMergeDateRangeRefiner());
var DEMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default {
patternBetween() {
return /^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i;
}
};
exports.default = DEMergeDateRangeRefiner;
}
});
// node_modules/chrono-node/dist/locales/de/refiners/DEMergeDateTimeRefiner.js
var require_DEMergeDateTimeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/de/refiners/DEMergeDateTimeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateTimeRefiner_1 = __importDefault2(require_AbstractMergeDateTimeRefiner());
var DEMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default {
patternBetween() {
return new RegExp("^\\s*(T|um|am|,|-)?\\s*$");
}
};
exports.default = DEMergeDateTimeRefiner;
}
});
// node_modules/chrono-node/dist/locales/de/parsers/DECasualTimeParser.js
var require_DECasualTimeParser = __commonJS({
"node_modules/chrono-node/dist/locales/de/parsers/DECasualTimeParser.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dayjs_1 = __importDefault2(require_dayjs_min());
var index_1 = require_dist();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var dayjs_2 = require_dayjs();
var timeunits_1 = require_timeunits();
var DECasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return /(diesen)?\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht)(?=\W|$)/i;
}
innerExtract(context, match) {
const targetDate = dayjs_1.default(context.refDate);
const timeKeywordPattern = match[2].toLowerCase();
const component = context.createParsingComponents();
dayjs_2.implySimilarTime(component, targetDate);
return DECasualTimeParser.extractTimeComponents(component, timeKeywordPattern);
}
static extractTimeComponents(component, timeKeywordPattern) {
switch (timeKeywordPattern) {
case "morgen":
component.imply("hour", 6);
component.imply("minute", 0);
component.imply("second", 0);
component.imply("meridiem", index_1.Meridiem.AM);
break;
case "vormittag":
component.imply("hour", 9);
component.imply("minute", 0);
component.imply("second", 0);
component.imply("meridiem", index_1.Meridiem.AM);
break;
case "mittag":
case "mittags":
component.imply("hour", 12);
component.imply("minute", 0);
component.imply("second", 0);
component.imply("meridiem", index_1.Meridiem.AM);
break;
case "nachmittag":
component.imply("hour", 15);
component.imply("minute", 0);
component.imply("second", 0);
component.imply("meridiem", index_1.Meridiem.PM);
break;
case "abend":
component.imply("hour", 18);
component.imply("minute", 0);
component.imply("second", 0);
component.imply("meridiem", index_1.Meridiem.PM);
break;
case "nacht":
component.imply("hour", 22);
component.imply("minute", 0);
component.imply("second", 0);
component.imply("meridiem", index_1.Meridiem.PM);
break;
case "mitternacht":
if (component.get("hour") > 1) {
component = timeunits_1.addImpliedTimeUnits(component, { "day": 1 });
}
component.imply("hour", 0);
component.imply("minute", 0);
component.imply("second", 0);
component.imply("meridiem", index_1.Meridiem.AM);
break;
}
return component;
}
};
exports.default = DECasualTimeParser;
}
});
// node_modules/chrono-node/dist/locales/de/parsers/DECasualDateParser.js
var require_DECasualDateParser = __commonJS({
"node_modules/chrono-node/dist/locales/de/parsers/DECasualDateParser.js"(exports) {
"use strict";
var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar2 = exports && exports.__importStar || function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dayjs_1 = __importDefault2(require_dayjs_min());
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var dayjs_2 = require_dayjs();
var DECasualTimeParser_1 = __importDefault2(require_DECasualTimeParser());
var references = __importStar2(require_casualReferences());
var PATTERN = new RegExp(`(jetzt|heute|morgen|\xFCbermorgen|uebermorgen|gestern|vorgestern|letzte\\s*nacht)(?:\\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht))?(?=\\W|$)`, "i");
var DATE_GROUP = 1;
var TIME_GROUP = 2;
var DECasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return PATTERN;
}
innerExtract(context, match) {
let targetDate = dayjs_1.default(context.refDate);
const dateKeyword = (match[DATE_GROUP] || "").toLowerCase();
const timeKeyword = (match[TIME_GROUP] || "").toLowerCase();
let component = context.createParsingComponents();
switch (dateKeyword) {
case "jetzt":
component = references.now(context.refDate);
break;
case "heute":
component = references.today(context.refDate);
break;
case "morgen":
dayjs_2.assignTheNextDay(component, targetDate);
break;
case "\xFCbermorgen":
case "uebermorgen":
targetDate = targetDate.add(1, "day");
dayjs_2.assignTheNextDay(component, targetDate);
break;
case "gestern":
targetDate = targetDate.add(-1, "day");
dayjs_2.assignSimilarDate(component, targetDate);
dayjs_2.implySimilarTime(component, targetDate);
break;
case "vorgestern":
targetDate = targetDate.add(-2, "day");
dayjs_2.assignSimilarDate(component, targetDate);
dayjs_2.implySimilarTime(component, targetDate);
break;
default:
if (dateKeyword.match(/letzte\s*nacht/)) {
if (targetDate.hour() > 6) {
targetDate = targetDate.add(-1, "day");
}
dayjs_2.assignSimilarDate(component, targetDate);
component.imply("hour", 0);
}
break;
}
if (timeKeyword) {
component = DECasualTimeParser_1.default.extractTimeComponents(component, timeKeyword);
}
return component;
}
};
exports.default = DECasualDateParser;
}
});
// node_modules/chrono-node/dist/locales/de/parsers/DEMonthNameLittleEndianParser.js
var require_DEMonthNameLittleEndianParser = __commonJS({
"node_modules/chrono-node/dist/locales/de/parsers/DEMonthNameLittleEndianParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var years_1 = require_years();
var constants_1 = require_constants2();
var constants_2 = require_constants2();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`(?:am\\s*?)?(?:den\\s*?)?([0-9]{1,2})\\.(?:\\s*(?:bis(?:\\s*(?:am|zum))?|\\-|\\\u2013|\\s)\\s*([0-9]{1,2})\\.?)?\\s*(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:(?:-|/|,?\\s*)(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`, "i");
var DATE_GROUP = 1;
var DATE_TO_GROUP = 2;
var MONTH_NAME_GROUP = 3;
var YEAR_GROUP = 4;
var DEMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const result = context.createParsingResult(match.index, match[0]);
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
const day = parseInt(match[DATE_GROUP]);
if (day > 31) {
match.index = match.index + match[DATE_GROUP].length;
return null;
}
result.start.assign("month", month);
result.start.assign("day", day);
if (match[YEAR_GROUP]) {
const yearNumber = constants_2.parseYear(match[YEAR_GROUP]);
result.start.assign("year", yearNumber);
} else {
const year = years_1.findYearClosestToRef(context.refDate, day, month);
result.start.imply("year", year);
}
if (match[DATE_TO_GROUP]) {
const endDate = parseInt(match[DATE_TO_GROUP]);
result.end = result.start.clone();
result.end.assign("day", endDate);
}
return result;
}
};
exports.default = DEMonthNameLittleEndianParser;
}
});
// node_modules/chrono-node/dist/locales/de/index.js
var require_de = __commonJS({
"node_modules/chrono-node/dist/locales/de/index.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
var configurations_1 = require_configurations();
var chrono_1 = require_chrono();
var SlashDateFormatParser_1 = __importDefault2(require_SlashDateFormatParser());
var ISOFormatParser_1 = __importDefault2(require_ISOFormatParser());
var DETimeExpressionParser_1 = __importDefault2(require_DETimeExpressionParser());
var DEWeekdayParser_1 = __importDefault2(require_DEWeekdayParser());
var DEMergeDateRangeRefiner_1 = __importDefault2(require_DEMergeDateRangeRefiner());
var DEMergeDateTimeRefiner_1 = __importDefault2(require_DEMergeDateTimeRefiner());
var DECasualDateParser_1 = __importDefault2(require_DECasualDateParser());
var DECasualTimeParser_1 = __importDefault2(require_DECasualTimeParser());
var DEMonthNameLittleEndianParser_1 = __importDefault2(require_DEMonthNameLittleEndianParser());
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
exports.strict = new chrono_1.Chrono(createConfiguration(true));
function parse(text2, ref, option) {
return exports.casual.parse(text2, ref, option);
}
exports.parse = parse;
function parseDate2(text2, ref, option) {
return exports.casual.parseDate(text2, ref, option);
}
exports.parseDate = parseDate2;
function createCasualConfiguration(littleEndian = true) {
const option = createConfiguration(false, littleEndian);
option.parsers.unshift(new DECasualTimeParser_1.default());
option.parsers.unshift(new DECasualDateParser_1.default());
return option;
}
exports.createCasualConfiguration = createCasualConfiguration;
function createConfiguration(strictMode = true, littleEndian = true) {
return configurations_1.includeCommonConfiguration({
parsers: [
new ISOFormatParser_1.default(),
new SlashDateFormatParser_1.default(littleEndian),
new DETimeExpressionParser_1.default(),
new DEMonthNameLittleEndianParser_1.default(),
new DEWeekdayParser_1.default()
],
refiners: [new DEMergeDateRangeRefiner_1.default(), new DEMergeDateTimeRefiner_1.default()]
}, strictMode);
}
exports.createConfiguration = createConfiguration;
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRCasualDateParser.js
var require_FRCasualDateParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRCasualDateParser.js"(exports) {
"use strict";
var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar2 = exports && exports.__importStar || function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dayjs_1 = __importDefault2(require_dayjs_min());
var index_1 = require_dist();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var dayjs_2 = require_dayjs();
var references = __importStar2(require_casualReferences());
var FRCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return /(maintenant|aujourd'hui|demain|hier|cette\s*nuit|la\s*veille)(?=\W|$)/i;
}
innerExtract(context, match) {
let targetDate = dayjs_1.default(context.refDate);
const lowerText = match[0].toLowerCase();
const component = context.createParsingComponents();
switch (lowerText) {
case "maintenant":
return references.now(context.refDate);
case "aujourd'hui":
return references.today(context.refDate);
case "hier":
return references.yesterday(context.refDate);
case "demain":
return references.tomorrow(context.refDate);
default:
if (lowerText.match(/cette\s*nuit/)) {
dayjs_2.assignSimilarDate(component, targetDate);
component.imply("hour", 22);
component.imply("meridiem", index_1.Meridiem.PM);
} else if (lowerText.match(/la\s*veille/)) {
targetDate = targetDate.add(-1, "day");
dayjs_2.assignSimilarDate(component, targetDate);
component.imply("hour", 0);
}
}
return component;
}
};
exports.default = FRCasualDateParser;
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRCasualTimeParser.js
var require_FRCasualTimeParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRCasualTimeParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require_dist();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var FRCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return /(cet?)?\s*(matin|soir|après-midi|aprem|a midi|à minuit)(?=\W|$)/i;
}
innerExtract(context, match) {
const suffixLower = match[2].toLowerCase();
const component = context.createParsingComponents();
switch (suffixLower) {
case "apr\xE8s-midi":
case "aprem":
component.imply("hour", 14);
component.imply("minute", 0);
component.imply("meridiem", index_1.Meridiem.PM);
break;
case "soir":
component.imply("hour", 18);
component.imply("minute", 0);
component.imply("meridiem", index_1.Meridiem.PM);
break;
case "matin":
component.imply("hour", 8);
component.imply("minute", 0);
component.imply("meridiem", index_1.Meridiem.AM);
break;
case "a midi":
component.imply("hour", 12);
component.imply("minute", 0);
component.imply("meridiem", index_1.Meridiem.AM);
break;
case "\xE0 minuit":
component.imply("hour", 0);
component.imply("meridiem", index_1.Meridiem.AM);
break;
}
return component;
}
};
exports.default = FRCasualTimeParser;
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRTimeExpressionParser.js
var require_FRTimeExpressionParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRTimeExpressionParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser();
var FRTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
primaryPrefix() {
return "(?:(?:[\xE0a])\\s*)?";
}
followingPhase() {
return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*";
}
extractPrimaryTimeComponents(context, match) {
if (match[0].match(/^\s*\d{4}\s*$/)) {
return null;
}
return super.extractPrimaryTimeComponents(context, match);
}
};
exports.default = FRTimeExpressionParser;
}
});
// node_modules/chrono-node/dist/locales/fr/refiners/FRMergeDateTimeRefiner.js
var require_FRMergeDateTimeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/fr/refiners/FRMergeDateTimeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateTimeRefiner_1 = __importDefault2(require_AbstractMergeDateTimeRefiner());
var FRMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default {
patternBetween() {
return new RegExp("^\\s*(T|\xE0|a|vers|de|,|-)?\\s*$");
}
};
exports.default = FRMergeDateTimeRefiner;
}
});
// node_modules/chrono-node/dist/locales/fr/refiners/FRMergeDateRangeRefiner.js
var require_FRMergeDateRangeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/fr/refiners/FRMergeDateRangeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateRangeRefiner_1 = __importDefault2(require_AbstractMergeDateRangeRefiner());
var FRMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default {
patternBetween() {
return /^\s*(à|a|-)\s*$/i;
}
};
exports.default = FRMergeDateRangeRefiner;
}
});
// node_modules/chrono-node/dist/locales/fr/constants.js
var require_constants3 = __commonJS({
"node_modules/chrono-node/dist/locales/fr/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
var pattern_1 = require_pattern();
exports.WEEKDAY_DICTIONARY = {
"dimanche": 0,
"dim": 0,
"lundi": 1,
"lun": 1,
"mardi": 2,
"mar": 2,
"mercredi": 3,
"mer": 3,
"jeudi": 4,
"jeu": 4,
"vendredi": 5,
"ven": 5,
"samedi": 6,
"sam": 6
};
exports.MONTH_DICTIONARY = {
"janvier": 1,
"jan": 1,
"jan.": 1,
"f\xE9vrier": 2,
"f\xE9v": 2,
"f\xE9v.": 2,
"fevrier": 2,
"fev": 2,
"fev.": 2,
"mars": 3,
"mar": 3,
"mar.": 3,
"avril": 4,
"avr": 4,
"avr.": 4,
"mai": 5,
"juin": 6,
"jun": 6,
"juillet": 7,
"juil": 7,
"jul": 7,
"jul.": 7,
"ao\xFBt": 8,
"aout": 8,
"septembre": 9,
"sep": 9,
"sep.": 9,
"sept": 9,
"sept.": 9,
"octobre": 10,
"oct": 10,
"oct.": 10,
"novembre": 11,
"nov": 11,
"nov.": 11,
"d\xE9cembre": 12,
"decembre": 12,
"dec": 12,
"dec.": 12
};
exports.INTEGER_WORD_DICTIONARY = {
"un": 1,
"deux": 2,
"trois": 3,
"quatre": 4,
"cinq": 5,
"six": 6,
"sept": 7,
"huit": 8,
"neuf": 9,
"dix": 10,
"onze": 11,
"douze": 12,
"treize": 13
};
exports.TIME_UNIT_DICTIONARY = {
"sec": "second",
"seconde": "second",
"secondes": "second",
"min": "minute",
"mins": "minute",
"minute": "minute",
"minutes": "minute",
"h": "hour",
"hr": "hour",
"hrs": "hour",
"heure": "hour",
"heures": "hour",
"jour": "d",
"jours": "d",
"semaine": "week",
"semaines": "week",
"mois": "month",
"trimestre": "quarter",
"trimestres": "quarter",
"ans": "year",
"ann\xE9e": "year",
"ann\xE9es": "year"
};
exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|une?|quelques?|demi-?)`;
function parseNumberPattern(match) {
const num = match.toLowerCase();
if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) {
return exports.INTEGER_WORD_DICTIONARY[num];
} else if (num === "une" || num === "un") {
return 1;
} else if (num.match(/quelques?/)) {
return 3;
} else if (num.match(/demi-?/)) {
return 0.5;
}
return parseFloat(num);
}
exports.parseNumberPattern = parseNumberPattern;
exports.ORDINAL_NUMBER_PATTERN = `(?:[0-9]{1,2}(?:er)?)`;
function parseOrdinalNumberPattern(match) {
let num = match.toLowerCase();
num = num.replace(/(?:er)$/i, "");
return parseInt(num);
}
exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern;
exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:AC|AD|p\\.\\s*C(?:hr?)?\\.\\s*n\\.)|[1-2][0-9]{3}|[5-9][0-9])`;
function parseYear(match) {
if (/AC/i.test(match)) {
match = match.replace(/BC/i, "");
return -parseInt(match);
}
if (/AD/i.test(match) || /C/i.test(match)) {
match = match.replace(/[^\d]+/i, "");
return parseInt(match);
}
let yearNumber = parseInt(match);
if (yearNumber < 100) {
if (yearNumber > 50) {
yearNumber = yearNumber + 1900;
} else {
yearNumber = yearNumber + 2e3;
}
}
return yearNumber;
}
exports.parseYear = parseYear;
var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`;
var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern("", SINGLE_TIME_UNIT_PATTERN);
function parseTimeUnits(timeunitText) {
const fragments = {};
let remainingText = timeunitText;
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
while (match) {
collectDateTimeFragment(fragments, match);
remainingText = remainingText.substring(match[0].length);
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
}
return fragments;
}
exports.parseTimeUnits = parseTimeUnits;
function collectDateTimeFragment(fragments, match) {
const num = parseNumberPattern(match[1]);
const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
fragments[unit] = num;
}
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRWeekdayParser.js
var require_FRWeekdayParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRWeekdayParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants3();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var weeks_1 = require_weeks();
var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(?:ce)\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(dernier|prochain)\\s*)?(?=\\W|\\d|$)`, "i");
var WEEKDAY_GROUP = 1;
var POSTFIX_GROUP = 2;
var FRWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
if (offset === void 0) {
return null;
}
let suffix = match[POSTFIX_GROUP];
suffix = suffix || "";
suffix = suffix.toLowerCase();
let modifier = null;
if (suffix == "dernier") {
modifier = "last";
} else if (suffix == "prochain") {
modifier = "next";
}
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
return context.createParsingComponents().assign("weekday", offset).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year());
}
};
exports.default = FRWeekdayParser;
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRSpecificTimeExpressionParser.js
var require_FRSpecificTimeExpressionParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRSpecificTimeExpressionParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require_dist();
var FIRST_REG_PATTERN = new RegExp("(^|\\s|T)(?:(?:[\xE0a])\\s*)?(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)", "i");
var SECOND_REG_PATTERN = new RegExp("^\\s*(\\-|\\\u2013|\\~|\\\u301C|[\xE0a]|\\?)\\s*(\\d{1,2})(?:h|:)?(?:(\\d{1,2})(?:m|:)?)?(?:(\\d{1,2})(?:s|:)?)?(?:\\s*(A\\.M\\.|P\\.M\\.|AM?|PM?))?(?=\\W|$)", "i");
var HOUR_GROUP = 2;
var MINUTE_GROUP = 3;
var SECOND_GROUP = 4;
var AM_PM_HOUR_GROUP = 5;
var FRSpecificTimeExpressionParser = class {
pattern(context) {
return FIRST_REG_PATTERN;
}
extract(context, match) {
const result = context.createParsingResult(match.index + match[1].length, match[0].substring(match[1].length));
if (result.text.match(/^\d{4}$/)) {
match.index += match[0].length;
return null;
}
result.start = FRSpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), match);
if (!result.start) {
match.index += match[0].length;
return null;
}
const remainingText = context.text.substring(match.index + match[0].length);
const secondMatch = SECOND_REG_PATTERN.exec(remainingText);
if (secondMatch) {
result.end = FRSpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), secondMatch);
if (result.end) {
result.text += secondMatch[0];
}
}
return result;
}
static extractTimeComponent(extractingComponents, match) {
let hour = 0;
let minute = 0;
let meridiem = null;
hour = parseInt(match[HOUR_GROUP]);
if (match[MINUTE_GROUP] != null) {
minute = parseInt(match[MINUTE_GROUP]);
}
if (minute >= 60 || hour > 24) {
return null;
}
if (hour >= 12) {
meridiem = index_1.Meridiem.PM;
}
if (match[AM_PM_HOUR_GROUP] != null) {
if (hour > 12)
return null;
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
if (ampm == "a") {
meridiem = index_1.Meridiem.AM;
if (hour == 12) {
hour = 0;
}
}
if (ampm == "p") {
meridiem = index_1.Meridiem.PM;
if (hour != 12) {
hour += 12;
}
}
}
extractingComponents.assign("hour", hour);
extractingComponents.assign("minute", minute);
if (meridiem !== null) {
extractingComponents.assign("meridiem", meridiem);
} else {
if (hour < 12) {
extractingComponents.imply("meridiem", index_1.Meridiem.AM);
} else {
extractingComponents.imply("meridiem", index_1.Meridiem.PM);
}
}
if (match[SECOND_GROUP] != null) {
const second = parseInt(match[SECOND_GROUP]);
if (second >= 60)
return null;
extractingComponents.assign("second", second);
}
return extractingComponents;
}
};
exports.default = FRSpecificTimeExpressionParser;
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRMonthNameLittleEndianParser.js
var require_FRMonthNameLittleEndianParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRMonthNameLittleEndianParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var years_1 = require_years();
var constants_1 = require_constants3();
var constants_2 = require_constants3();
var constants_3 = require_constants3();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`(?:on\\s*?)?(${constants_3.ORDINAL_NUMBER_PATTERN})(?:\\s*(?:au|\\-|\\\u2013|jusqu'au?|\\s)\\s*(${constants_3.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s*(?:de)?\\s*)(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:(?:-|/|,?\\s*)(${constants_2.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`, "i");
var DATE_GROUP = 1;
var DATE_TO_GROUP = 2;
var MONTH_NAME_GROUP = 3;
var YEAR_GROUP = 4;
var FRMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const result = context.createParsingResult(match.index, match[0]);
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
const day = constants_3.parseOrdinalNumberPattern(match[DATE_GROUP]);
if (day > 31) {
match.index = match.index + match[DATE_GROUP].length;
return null;
}
result.start.assign("month", month);
result.start.assign("day", day);
if (match[YEAR_GROUP]) {
const yearNumber = constants_2.parseYear(match[YEAR_GROUP]);
result.start.assign("year", yearNumber);
} else {
const year = years_1.findYearClosestToRef(context.refDate, day, month);
result.start.imply("year", year);
}
if (match[DATE_TO_GROUP]) {
const endDate = constants_3.parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
result.end = result.start.clone();
result.end.assign("day", endDate);
}
return result;
}
};
exports.default = FRMonthNameLittleEndianParser;
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitAgoFormatParser.js
var require_FRTimeUnitAgoFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitAgoFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants3();
var results_1 = require_results();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var timeunits_1 = require_timeunits();
var FRTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
constructor() {
super();
}
innerPattern() {
return new RegExp(`il y a\\s*(${constants_1.TIME_UNITS_PATTERN})(?=(?:\\W|$))`, "i");
}
innerExtract(context, match) {
const timeUnits = constants_1.parseTimeUnits(match[1]);
const outputTimeUnits = timeunits_1.reverseTimeUnits(timeUnits);
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, outputTimeUnits);
}
};
exports.default = FRTimeUnitAgoFormatParser;
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitWithinFormatParser.js
var require_FRTimeUnitWithinFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitWithinFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants3();
var results_1 = require_results();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var FRTimeUnitWithinFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return new RegExp(`(?:dans|en|pour|pendant)\\s*(${constants_1.TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
}
innerExtract(context, match) {
const timeUnits = constants_1.parseTimeUnits(match[1]);
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
}
};
exports.default = FRTimeUnitWithinFormatParser;
}
});
// node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitRelativeFormatParser.js
var require_FRTimeUnitRelativeFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/fr/parsers/FRTimeUnitRelativeFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants3();
var results_1 = require_results();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var timeunits_1 = require_timeunits();
var pattern_1 = require_pattern();
var FRTimeUnitAgoFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
constructor() {
super();
}
innerPattern() {
return new RegExp(`(?:les?|la|l'|du|des?)\\s*(${constants_1.NUMBER_PATTERN})?(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?\\s*(${pattern_1.matchAnyPattern(constants_1.TIME_UNIT_DICTIONARY)})(?:\\s*(prochaine?s?|derni[e\xE8]re?s?|pass[\xE9e]e?s?|pr[\xE9e]c[\xE9e]dents?|suivante?s?))?`, "i");
}
innerExtract(context, match) {
const num = match[1] ? constants_1.parseNumberPattern(match[1]) : 1;
const unit = constants_1.TIME_UNIT_DICTIONARY[match[3].toLowerCase()];
let timeUnits = {};
timeUnits[unit] = num;
let modifier = match[2] || match[4] || "";
modifier = modifier.toLowerCase();
if (!modifier) {
return;
}
if (/derni[eè]re?s?/.test(modifier) || /pass[ée]e?s?/.test(modifier) || /pr[ée]c[ée]dents?/.test(modifier)) {
timeUnits = timeunits_1.reverseTimeUnits(timeUnits);
}
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
}
};
exports.default = FRTimeUnitAgoFormatParser;
}
});
// node_modules/chrono-node/dist/locales/fr/index.js
var require_fr = __commonJS({
"node_modules/chrono-node/dist/locales/fr/index.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
var configurations_1 = require_configurations();
var chrono_1 = require_chrono();
var FRCasualDateParser_1 = __importDefault2(require_FRCasualDateParser());
var FRCasualTimeParser_1 = __importDefault2(require_FRCasualTimeParser());
var SlashDateFormatParser_1 = __importDefault2(require_SlashDateFormatParser());
var FRTimeExpressionParser_1 = __importDefault2(require_FRTimeExpressionParser());
var FRMergeDateTimeRefiner_1 = __importDefault2(require_FRMergeDateTimeRefiner());
var FRMergeDateRangeRefiner_1 = __importDefault2(require_FRMergeDateRangeRefiner());
var FRWeekdayParser_1 = __importDefault2(require_FRWeekdayParser());
var FRSpecificTimeExpressionParser_1 = __importDefault2(require_FRSpecificTimeExpressionParser());
var FRMonthNameLittleEndianParser_1 = __importDefault2(require_FRMonthNameLittleEndianParser());
var FRTimeUnitAgoFormatParser_1 = __importDefault2(require_FRTimeUnitAgoFormatParser());
var FRTimeUnitWithinFormatParser_1 = __importDefault2(require_FRTimeUnitWithinFormatParser());
var FRTimeUnitRelativeFormatParser_1 = __importDefault2(require_FRTimeUnitRelativeFormatParser());
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
exports.strict = new chrono_1.Chrono(createConfiguration(true));
function parse(text2, ref, option) {
return exports.casual.parse(text2, ref, option);
}
exports.parse = parse;
function parseDate2(text2, ref, option) {
return exports.casual.parseDate(text2, ref, option);
}
exports.parseDate = parseDate2;
function createCasualConfiguration(littleEndian = true) {
const option = createConfiguration(false, littleEndian);
option.parsers.unshift(new FRCasualDateParser_1.default());
option.parsers.unshift(new FRCasualTimeParser_1.default());
option.parsers.unshift(new FRTimeUnitRelativeFormatParser_1.default());
return option;
}
exports.createCasualConfiguration = createCasualConfiguration;
function createConfiguration(strictMode = true, littleEndian = true) {
return configurations_1.includeCommonConfiguration({
parsers: [
new SlashDateFormatParser_1.default(littleEndian),
new FRMonthNameLittleEndianParser_1.default(),
new FRTimeExpressionParser_1.default(),
new FRSpecificTimeExpressionParser_1.default(),
new FRTimeUnitAgoFormatParser_1.default(),
new FRTimeUnitWithinFormatParser_1.default(),
new FRWeekdayParser_1.default()
],
refiners: [new FRMergeDateTimeRefiner_1.default(), new FRMergeDateRangeRefiner_1.default()]
}, strictMode);
}
exports.createConfiguration = createConfiguration;
}
});
// node_modules/chrono-node/dist/locales/ja/constants.js
var require_constants4 = __commonJS({
"node_modules/chrono-node/dist/locales/ja/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toHankaku = void 0;
function toHankaku(text2) {
return String(text2).replace(/\u2019/g, "'").replace(/\u201D/g, '"').replace(/\u3000/g, " ").replace(/\uFFE5/g, "\xA5").replace(/[\uFF01\uFF03-\uFF06\uFF08\uFF09\uFF0C-\uFF19\uFF1C-\uFF1F\uFF21-\uFF3B\uFF3D\uFF3F\uFF41-\uFF5B\uFF5D\uFF5E]/g, alphaNum);
}
exports.toHankaku = toHankaku;
function alphaNum(token) {
return String.fromCharCode(token.charCodeAt(0) - 65248);
}
}
});
// node_modules/chrono-node/dist/locales/ja/parsers/JPStandardParser.js
var require_JPStandardParser = __commonJS({
"node_modules/chrono-node/dist/locales/ja/parsers/JPStandardParser.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants4();
var years_1 = require_years();
var dayjs_1 = __importDefault2(require_dayjs_min());
var PATTERN = /(?:(?:([同今本])|((昭和|平成|令和)?([0-9-]{1,4}|元)))年\s*)?([0-9-]{1,2})月\s*([0-9-]{1,2})日/i;
var SPECIAL_YEAR_GROUP = 1;
var TYPICAL_YEAR_GROUP = 2;
var ERA_GROUP = 3;
var YEAR_NUMBER_GROUP = 4;
var MONTH_GROUP = 5;
var DAY_GROUP = 6;
var JPStandardParser = class {
pattern() {
return PATTERN;
}
extract(context, match) {
const month = parseInt(constants_1.toHankaku(match[MONTH_GROUP]));
const day = parseInt(constants_1.toHankaku(match[DAY_GROUP]));
const components = context.createParsingComponents({
day,
month
});
if (match[SPECIAL_YEAR_GROUP] && match[SPECIAL_YEAR_GROUP].match("\u540C|\u4ECA|\u672C")) {
const moment = dayjs_1.default(context.refDate);
components.assign("year", moment.year());
}
if (match[TYPICAL_YEAR_GROUP]) {
const yearNumText = match[YEAR_NUMBER_GROUP];
let year = yearNumText == "\u5143" ? 1 : parseInt(constants_1.toHankaku(yearNumText));
if (match[ERA_GROUP] == "\u4EE4\u548C") {
year += 2018;
} else if (match[ERA_GROUP] == "\u5E73\u6210") {
year += 1988;
} else if (match[ERA_GROUP] == "\u662D\u548C") {
year += 1925;
}
components.assign("year", year);
} else {
const year = years_1.findYearClosestToRef(context.refDate, day, month);
components.imply("year", year);
}
return components;
}
};
exports.default = JPStandardParser;
}
});
// node_modules/chrono-node/dist/locales/ja/refiners/JPMergeDateRangeRefiner.js
var require_JPMergeDateRangeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/ja/refiners/JPMergeDateRangeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateRangeRefiner_1 = __importDefault2(require_AbstractMergeDateRangeRefiner());
var JPMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default {
patternBetween() {
return /^\s*(から|ー|-)\s*$/i;
}
};
exports.default = JPMergeDateRangeRefiner;
}
});
// node_modules/chrono-node/dist/locales/ja/parsers/JPCasualDateParser.js
var require_JPCasualDateParser = __commonJS({
"node_modules/chrono-node/dist/locales/ja/parsers/JPCasualDateParser.js"(exports) {
"use strict";
var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar2 = exports && exports.__importStar || function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var dayjs_1 = __importDefault2(require_dayjs_min());
var index_1 = require_dist();
var references = __importStar2(require_casualReferences());
var PATTERN = /今日|当日|昨日|明日|今夜|今夕|今晩|今朝/i;
var JPCasualDateParser = class {
pattern() {
return PATTERN;
}
extract(context, match) {
const text2 = match[0];
const date = dayjs_1.default(context.refDate);
const components = context.createParsingComponents();
switch (text2) {
case "\u6628\u65E5":
return references.yesterday(context.refDate);
case "\u660E\u65E5":
return references.tomorrow(context.refDate);
case "\u4ECA\u65E5":
case "\u5F53\u65E5":
return references.today(context.refDate);
}
if (text2 == "\u4ECA\u591C" || text2 == "\u4ECA\u5915" || text2 == "\u4ECA\u6669") {
components.imply("hour", 22);
components.assign("meridiem", index_1.Meridiem.PM);
} else if (text2.match("\u4ECA\u671D")) {
components.imply("hour", 6);
components.assign("meridiem", index_1.Meridiem.AM);
}
components.assign("day", date.date());
components.assign("month", date.month() + 1);
components.assign("year", date.year());
return components;
}
};
exports.default = JPCasualDateParser;
}
});
// node_modules/chrono-node/dist/locales/ja/index.js
var require_ja = __commonJS({
"node_modules/chrono-node/dist/locales/ja/index.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
var JPStandardParser_1 = __importDefault2(require_JPStandardParser());
var JPMergeDateRangeRefiner_1 = __importDefault2(require_JPMergeDateRangeRefiner());
var JPCasualDateParser_1 = __importDefault2(require_JPCasualDateParser());
var chrono_1 = require_chrono();
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
exports.strict = new chrono_1.Chrono(createConfiguration());
function parse(text2, ref, option) {
return exports.casual.parse(text2, ref, option);
}
exports.parse = parse;
function parseDate2(text2, ref, option) {
return exports.casual.parseDate(text2, ref, option);
}
exports.parseDate = parseDate2;
function createCasualConfiguration() {
const option = createConfiguration();
option.parsers.unshift(new JPCasualDateParser_1.default());
return option;
}
exports.createCasualConfiguration = createCasualConfiguration;
function createConfiguration() {
return {
parsers: [new JPStandardParser_1.default()],
refiners: [new JPMergeDateRangeRefiner_1.default()]
};
}
exports.createConfiguration = createConfiguration;
}
});
// node_modules/chrono-node/dist/locales/pt/constants.js
var require_constants5 = __commonJS({
"node_modules/chrono-node/dist/locales/pt/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseYear = exports.YEAR_PATTERN = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
exports.WEEKDAY_DICTIONARY = {
"domingo": 0,
"dom": 0,
"segunda": 1,
"segunda-feira": 1,
"seg": 1,
"ter\xE7a": 2,
"ter\xE7a-feira": 2,
"ter": 2,
"quarta": 3,
"quarta-feira": 3,
"qua": 3,
"quinta": 4,
"quinta-feira": 4,
"qui": 4,
"sexta": 5,
"sexta-feira": 5,
"sex": 5,
"s\xE1bado": 6,
"sabado": 6,
"sab": 6
};
exports.MONTH_DICTIONARY = {
"janeiro": 1,
"jan": 1,
"jan.": 1,
"fevereiro": 2,
"fev": 2,
"fev.": 2,
"mar\xE7o": 3,
"mar": 3,
"mar.": 3,
"abril": 4,
"abr": 4,
"abr.": 4,
"maio": 5,
"mai": 5,
"mai.": 5,
"junho": 6,
"jun": 6,
"jun.": 6,
"julho": 7,
"jul": 7,
"jul.": 7,
"agosto": 8,
"ago": 8,
"ago.": 8,
"setembro": 9,
"set": 9,
"set.": 9,
"outubro": 10,
"out": 10,
"out.": 10,
"novembro": 11,
"nov": 11,
"nov.": 11,
"dezembro": 12,
"dez": 12,
"dez.": 12
};
exports.YEAR_PATTERN = "[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?";
function parseYear(match) {
if (match.match(/^[0-9]{1,4}$/)) {
let yearNumber = parseInt(match);
if (yearNumber < 100) {
if (yearNumber > 50) {
yearNumber = yearNumber + 1900;
} else {
yearNumber = yearNumber + 2e3;
}
}
return yearNumber;
}
if (match.match(/a\.?\s*c\.?/i)) {
match = match.replace(/a\.?\s*c\.?/i, "");
return -parseInt(match);
}
return parseInt(match);
}
exports.parseYear = parseYear;
}
});
// node_modules/chrono-node/dist/locales/pt/parsers/PTWeekdayParser.js
var require_PTWeekdayParser = __commonJS({
"node_modules/chrono-node/dist/locales/pt/parsers/PTWeekdayParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants5();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var weeks_1 = require_weeks();
var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:(este|esta|passado|pr[o\xF3]ximo)\\s*)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(este|esta|passado|pr[\xF3o]ximo)\\s*semana)?(?=\\W|\\d|$)`, "i");
var PREFIX_GROUP = 1;
var WEEKDAY_GROUP = 2;
var POSTFIX_GROUP = 3;
var PTWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
if (offset === void 0) {
return null;
}
const prefix = match[PREFIX_GROUP];
const postfix = match[POSTFIX_GROUP];
let norm = prefix || postfix || "";
norm = norm.toLowerCase();
let modifier = null;
if (norm == "passado") {
modifier = "this";
} else if (norm == "pr\xF3ximo" || norm == "proximo") {
modifier = "next";
} else if (norm == "este") {
modifier = "this";
}
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
return context.createParsingComponents().assign("weekday", offset).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year());
}
};
exports.default = PTWeekdayParser;
}
});
// node_modules/chrono-node/dist/locales/pt/parsers/PTTimeExpressionParser.js
var require_PTTimeExpressionParser = __commonJS({
"node_modules/chrono-node/dist/locales/pt/parsers/PTTimeExpressionParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser();
var PTTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
primaryPrefix() {
return "(?:(?:ao?|\xE0s?|das|da|de|do)\\s*)?";
}
followingPhase() {
return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|a(?:o)?|\\?)\\s*";
}
};
exports.default = PTTimeExpressionParser;
}
});
// node_modules/chrono-node/dist/locales/pt/refiners/PTMergeDateTimeRefiner.js
var require_PTMergeDateTimeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/pt/refiners/PTMergeDateTimeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateTimeRefiner_1 = __importDefault2(require_AbstractMergeDateTimeRefiner());
var PTMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default {
patternBetween() {
return new RegExp("^\\s*(?:,|\xE0)?\\s*$");
}
};
exports.default = PTMergeDateTimeRefiner;
}
});
// node_modules/chrono-node/dist/locales/pt/refiners/PTMergeDateRangeRefiner.js
var require_PTMergeDateRangeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/pt/refiners/PTMergeDateRangeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateRangeRefiner_1 = __importDefault2(require_AbstractMergeDateRangeRefiner());
var PTMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default {
patternBetween() {
return /^\s*(?:-)\s*$/i;
}
};
exports.default = PTMergeDateRangeRefiner;
}
});
// node_modules/chrono-node/dist/locales/pt/parsers/PTMonthNameLittleEndianParser.js
var require_PTMonthNameLittleEndianParser = __commonJS({
"node_modules/chrono-node/dist/locales/pt/parsers/PTMonthNameLittleEndianParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var years_1 = require_years();
var constants_1 = require_constants5();
var constants_2 = require_constants5();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`([0-9]{1,2})(?:\xBA|\xAA|\xB0)?(?:\\s*(?:desde|de|\\-|\\\u2013|ao?|\\s)\\s*([0-9]{1,2})(?:\xBA|\xAA|\xB0)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})(?:\\s*(?:de|,)?\\s*(${constants_2.YEAR_PATTERN}))?(?=\\W|$)`, "i");
var DATE_GROUP = 1;
var DATE_TO_GROUP = 2;
var MONTH_NAME_GROUP = 3;
var YEAR_GROUP = 4;
var PTMonthNameLittleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const result = context.createParsingResult(match.index, match[0]);
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
const day = parseInt(match[DATE_GROUP]);
if (day > 31) {
match.index = match.index + match[DATE_GROUP].length;
return null;
}
result.start.assign("month", month);
result.start.assign("day", day);
if (match[YEAR_GROUP]) {
const yearNumber = constants_2.parseYear(match[YEAR_GROUP]);
result.start.assign("year", yearNumber);
} else {
const year = years_1.findYearClosestToRef(context.refDate, day, month);
result.start.imply("year", year);
}
if (match[DATE_TO_GROUP]) {
const endDate = parseInt(match[DATE_TO_GROUP]);
result.end = result.start.clone();
result.end.assign("day", endDate);
}
return result;
}
};
exports.default = PTMonthNameLittleEndianParser;
}
});
// node_modules/chrono-node/dist/locales/pt/parsers/PTCasualDateParser.js
var require_PTCasualDateParser = __commonJS({
"node_modules/chrono-node/dist/locales/pt/parsers/PTCasualDateParser.js"(exports) {
"use strict";
var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar2 = exports && exports.__importStar || function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var references = __importStar2(require_casualReferences());
var PTCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return /(agora|hoje|amanha|amanhã|ontem)(?=\W|$)/i;
}
innerExtract(context, match) {
const lowerText = match[0].toLowerCase();
const component = context.createParsingComponents();
switch (lowerText) {
case "agora":
return references.now(context.refDate);
case "hoje":
return references.today(context.refDate);
case "amanha":
case "amanh\xE3":
return references.tomorrow(context.refDate);
case "ontem":
return references.yesterday(context.refDate);
}
return component;
}
};
exports.default = PTCasualDateParser;
}
});
// node_modules/chrono-node/dist/locales/pt/parsers/PTCasualTimeParser.js
var require_PTCasualTimeParser = __commonJS({
"node_modules/chrono-node/dist/locales/pt/parsers/PTCasualTimeParser.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require_dist();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var dayjs_1 = require_dayjs();
var dayjs_2 = __importDefault2(require_dayjs_min());
var PTCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return /(?:esta\s*)?(manha|manhã|tarde|meia-noite|meio-dia|noite)(?=\W|$)/i;
}
innerExtract(context, match) {
const targetDate = dayjs_2.default(context.refDate);
const component = context.createParsingComponents();
switch (match[1].toLowerCase()) {
case "tarde":
component.imply("meridiem", index_1.Meridiem.PM);
component.imply("hour", 15);
break;
case "noite":
component.imply("meridiem", index_1.Meridiem.PM);
component.imply("hour", 22);
break;
case "manha":
case "manh\xE3":
component.imply("meridiem", index_1.Meridiem.AM);
component.imply("hour", 6);
break;
case "meia-noite":
dayjs_1.assignTheNextDay(component, targetDate);
component.imply("hour", 0);
component.imply("minute", 0);
component.imply("second", 0);
break;
case "meio-dia":
component.imply("meridiem", index_1.Meridiem.AM);
component.imply("hour", 12);
break;
}
return component;
}
};
exports.default = PTCasualTimeParser;
}
});
// node_modules/chrono-node/dist/locales/pt/index.js
var require_pt = __commonJS({
"node_modules/chrono-node/dist/locales/pt/index.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
var configurations_1 = require_configurations();
var chrono_1 = require_chrono();
var SlashDateFormatParser_1 = __importDefault2(require_SlashDateFormatParser());
var PTWeekdayParser_1 = __importDefault2(require_PTWeekdayParser());
var PTTimeExpressionParser_1 = __importDefault2(require_PTTimeExpressionParser());
var PTMergeDateTimeRefiner_1 = __importDefault2(require_PTMergeDateTimeRefiner());
var PTMergeDateRangeRefiner_1 = __importDefault2(require_PTMergeDateRangeRefiner());
var PTMonthNameLittleEndianParser_1 = __importDefault2(require_PTMonthNameLittleEndianParser());
var PTCasualDateParser_1 = __importDefault2(require_PTCasualDateParser());
var PTCasualTimeParser_1 = __importDefault2(require_PTCasualTimeParser());
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
exports.strict = new chrono_1.Chrono(createConfiguration(true));
function parse(text2, ref, option) {
return exports.casual.parse(text2, ref, option);
}
exports.parse = parse;
function parseDate2(text2, ref, option) {
return exports.casual.parseDate(text2, ref, option);
}
exports.parseDate = parseDate2;
function createCasualConfiguration(littleEndian = true) {
const option = createConfiguration(false, littleEndian);
option.parsers.push(new PTCasualDateParser_1.default());
option.parsers.push(new PTCasualTimeParser_1.default());
return option;
}
exports.createCasualConfiguration = createCasualConfiguration;
function createConfiguration(strictMode = true, littleEndian = true) {
return configurations_1.includeCommonConfiguration({
parsers: [
new SlashDateFormatParser_1.default(littleEndian),
new PTWeekdayParser_1.default(),
new PTTimeExpressionParser_1.default(),
new PTMonthNameLittleEndianParser_1.default()
],
refiners: [new PTMergeDateTimeRefiner_1.default(), new PTMergeDateRangeRefiner_1.default()]
}, strictMode);
}
exports.createConfiguration = createConfiguration;
}
});
// node_modules/chrono-node/dist/locales/nl/refiners/NLMergeDateRangeRefiner.js
var require_NLMergeDateRangeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/nl/refiners/NLMergeDateRangeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateRangeRefiner_1 = __importDefault2(require_AbstractMergeDateRangeRefiner());
var NLMergeDateRangeRefiner = class extends AbstractMergeDateRangeRefiner_1.default {
patternBetween() {
return /^\s*(tot|-)\s*$/i;
}
};
exports.default = NLMergeDateRangeRefiner;
}
});
// node_modules/chrono-node/dist/locales/nl/refiners/NLMergeDateTimeRefiner.js
var require_NLMergeDateTimeRefiner = __commonJS({
"node_modules/chrono-node/dist/locales/nl/refiners/NLMergeDateTimeRefiner.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractMergeDateTimeRefiner_1 = __importDefault2(require_AbstractMergeDateTimeRefiner());
var NLMergeDateTimeRefiner = class extends AbstractMergeDateTimeRefiner_1.default {
patternBetween() {
return new RegExp("^\\s*(om|na|voor|in de|,|-)?\\s*$");
}
};
exports.default = NLMergeDateTimeRefiner;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLCasualDateParser.js
var require_NLCasualDateParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLCasualDateParser.js"(exports) {
"use strict";
var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar2 = exports && exports.__importStar || function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var references = __importStar2(require_casualReferences());
var NLCasualDateParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return /(nu|vandaag|morgen|morgend|gisteren)(?=\W|$)/i;
}
innerExtract(context, match) {
const lowerText = match[0].toLowerCase();
const component = context.createParsingComponents();
switch (lowerText) {
case "nu":
return references.now(context.refDate);
case "vandaag":
return references.today(context.refDate);
case "morgen":
case "morgend":
return references.tomorrow(context.refDate);
case "gisteren":
return references.yesterday(context.refDate);
}
return component;
}
};
exports.default = NLCasualDateParser;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLCasualTimeParser.js
var require_NLCasualTimeParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLCasualTimeParser.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require_dist();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var dayjs_1 = __importDefault2(require_dayjs_min());
var dayjs_2 = require_dayjs();
var DAY_GROUP = 1;
var MOMENT_GROUP = 2;
var NLCasualTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return /(deze)?\s*(namiddag|avond|middernacht|ochtend|middag|'s middags|'s avonds|'s ochtends)(?=\W|$)/i;
}
innerExtract(context, match) {
const targetDate = dayjs_1.default(context.refDate);
const component = context.createParsingComponents();
if (match[DAY_GROUP] === "deze") {
component.assign("day", context.refDate.getDate());
component.assign("month", context.refDate.getMonth() + 1);
component.assign("year", context.refDate.getFullYear());
}
switch (match[MOMENT_GROUP].toLowerCase()) {
case "namiddag":
case "'s namiddags":
component.imply("meridiem", index_1.Meridiem.PM);
component.imply("hour", 15);
break;
case "avond":
case "'s avonds'":
component.imply("meridiem", index_1.Meridiem.PM);
component.imply("hour", 20);
break;
case "middernacht":
dayjs_2.assignTheNextDay(component, targetDate);
component.imply("hour", 0);
component.imply("minute", 0);
component.imply("second", 0);
break;
case "ochtend":
case "'s ochtends":
component.imply("meridiem", index_1.Meridiem.AM);
component.imply("hour", 6);
break;
case "middag":
case "'s middags":
component.imply("meridiem", index_1.Meridiem.AM);
component.imply("hour", 12);
break;
}
return component;
}
};
exports.default = NLCasualTimeParser;
}
});
// node_modules/chrono-node/dist/locales/nl/constants.js
var require_constants6 = __commonJS({
"node_modules/chrono-node/dist/locales/nl/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseTimeUnits = exports.TIME_UNITS_PATTERN = exports.parseYear = exports.YEAR_PATTERN = exports.parseOrdinalNumberPattern = exports.ORDINAL_NUMBER_PATTERN = exports.parseNumberPattern = exports.NUMBER_PATTERN = exports.TIME_UNIT_DICTIONARY = exports.ORDINAL_WORD_DICTIONARY = exports.INTEGER_WORD_DICTIONARY = exports.MONTH_DICTIONARY = exports.WEEKDAY_DICTIONARY = void 0;
var pattern_1 = require_pattern();
var years_1 = require_years();
exports.WEEKDAY_DICTIONARY = {
zondag: 0,
zon: 0,
"zon.": 0,
zo: 0,
"zo.": 0,
maandag: 1,
ma: 1,
"ma.": 1,
dinsdag: 2,
din: 2,
"din.": 2,
di: 2,
"di.": 2,
woensdag: 3,
woe: 3,
"woe.": 3,
wo: 3,
"wo.": 3,
donderdag: 4,
dond: 4,
"dond.": 4,
do: 4,
"do.": 4,
vrijdag: 5,
vrij: 5,
"vrij.": 5,
vr: 5,
"vr.": 5,
zaterdag: 6,
zat: 6,
"zat.": 6,
"za": 6,
"za.": 6
};
exports.MONTH_DICTIONARY = {
januari: 1,
jan: 1,
"jan.": 1,
februari: 2,
feb: 2,
"feb.": 2,
maart: 3,
mar: 3,
"mar.": 3,
april: 4,
apr: 4,
"apr.": 4,
mei: 5,
juni: 6,
jun: 6,
"jun.": 6,
juli: 7,
jul: 7,
"jul.": 7,
augustus: 8,
aug: 8,
"aug.": 8,
september: 9,
sep: 9,
"sep.": 9,
sept: 9,
"sept.": 9,
oktober: 10,
okt: 10,
"okt.": 10,
november: 11,
nov: 11,
"nov.": 11,
december: 12,
dec: 12,
"dec.": 12
};
exports.INTEGER_WORD_DICTIONARY = {
een: 1,
twee: 2,
drie: 3,
vier: 4,
vijf: 5,
zes: 6,
zeven: 7,
acht: 8,
negen: 9,
tien: 10,
elf: 11,
twaalf: 12
};
exports.ORDINAL_WORD_DICTIONARY = {
eerste: 1,
tweede: 2,
derde: 3,
vierde: 4,
vijfde: 5,
zesde: 6,
zevende: 7,
achtste: 8,
negende: 9,
tiende: 10,
elfde: 11,
twaalfde: 12,
dertiende: 13,
veertiende: 14,
vijftiende: 15,
zestiende: 16,
zeventiende: 17,
achttiende: 18,
negentiende: 19,
twintigste: 20,
"eenentwintigste": 21,
"twee\xEBntwintigste": 22,
"drieentwintigste": 23,
"vierentwintigste": 24,
"vijfentwintigste": 25,
"zesentwintigste": 26,
"zevenentwintigste": 27,
"achtentwintig": 28,
"negenentwintig": 29,
"dertigste": 30,
"eenendertigste": 31
};
exports.TIME_UNIT_DICTIONARY = {
sec: "second",
second: "second",
seconden: "second",
min: "minute",
mins: "minute",
minute: "minute",
minuten: "minute",
h: "hour",
hr: "hour",
hrs: "hour",
uur: "hour",
uren: "hour",
dag: "d",
dagen: "d",
week: "week",
weken: "week",
maand: "month",
maanden: "month",
jaar: "year",
jr: "year",
jaren: "year"
};
exports.NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|een?|halve?)`;
function parseNumberPattern(match) {
const num = match.toLowerCase();
if (exports.INTEGER_WORD_DICTIONARY[num] !== void 0) {
return exports.INTEGER_WORD_DICTIONARY[num];
} else if (num === "een") {
return 1;
} else if (num.match(/halve?/)) {
return 0.5;
}
return parseFloat(num);
}
exports.parseNumberPattern = parseNumberPattern;
exports.ORDINAL_NUMBER_PATTERN = `(?:${pattern_1.matchAnyPattern(exports.ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:ste|de)?)`;
function parseOrdinalNumberPattern(match) {
let num = match.toLowerCase();
if (exports.ORDINAL_WORD_DICTIONARY[num] !== void 0) {
return exports.ORDINAL_WORD_DICTIONARY[num];
}
num = num.replace(/(?:ste|de)$/i, "");
return parseInt(num);
}
exports.parseOrdinalNumberPattern = parseOrdinalNumberPattern;
exports.YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s*(?:voor Christus|na Christus)|[1-2][0-9]{3}|[5-9][0-9])`;
function parseYear(match) {
if (/voor Christus/i.test(match)) {
match = match.replace(/voor Christus/i, "");
return -parseInt(match);
}
if (/na Christus/i.test(match)) {
match = match.replace(/na Christus/i, "");
return parseInt(match);
}
const rawYearNumber = parseInt(match);
return years_1.findMostLikelyADYear(rawYearNumber);
}
exports.parseYear = parseYear;
var SINGLE_TIME_UNIT_PATTERN = `(${exports.NUMBER_PATTERN})\\s{0,5}(${pattern_1.matchAnyPattern(exports.TIME_UNIT_DICTIONARY)})\\s{0,5}`;
var SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
exports.TIME_UNITS_PATTERN = pattern_1.repeatedTimeunitPattern(`(?:(?:binnen|in)\\s*)?`, SINGLE_TIME_UNIT_PATTERN);
function parseTimeUnits(timeunitText) {
const fragments = {};
let remainingText = timeunitText;
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
while (match) {
collectDateTimeFragment(fragments, match);
remainingText = remainingText.substring(match[0].length);
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
}
return fragments;
}
exports.parseTimeUnits = parseTimeUnits;
function collectDateTimeFragment(fragments, match) {
const num = parseNumberPattern(match[1]);
const unit = exports.TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
fragments[unit] = num;
}
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitWithinFormatParser.js
var require_NLTimeUnitWithinFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLTimeUnitWithinFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants6();
var results_1 = require_results();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var NLTimeUnitWithinFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return new RegExp(`(?:binnen|in|binnen de|voor)\\s*(` + constants_1.TIME_UNITS_PATTERN + `)(?=\\W|$)`, "i");
}
innerExtract(context, match) {
const timeUnits = constants_1.parseTimeUnits(match[1]);
return results_1.ParsingComponents.createRelativeFromRefDate(context.refDate, timeUnits);
}
};
exports.default = NLTimeUnitWithinFormatParser;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLWeekdayParser.js
var require_NLWeekdayParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLWeekdayParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants6();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var weeks_1 = require_weeks();
var PATTERN = new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:op\\s*?)?(?:(deze|vorige|volgende)\\s*(?:week\\s*)?)?(${pattern_1.matchAnyPattern(constants_1.WEEKDAY_DICTIONARY)})(?=\\W|$)`, "i");
var PREFIX_GROUP = 1;
var WEEKDAY_GROUP = 2;
var POSTFIX_GROUP = 3;
var NLWeekdayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
const offset = constants_1.WEEKDAY_DICTIONARY[dayOfWeek];
const prefix = match[PREFIX_GROUP];
const postfix = match[POSTFIX_GROUP];
let modifierWord = prefix || postfix;
modifierWord = modifierWord || "";
modifierWord = modifierWord.toLowerCase();
let modifier = null;
if (modifierWord == "vorige") {
modifier = "last";
} else if (modifierWord == "volgende") {
modifier = "next";
} else if (modifierWord == "deze") {
modifier = "this";
}
const date = weeks_1.toDayJSWeekday(context.refDate, offset, modifier);
return context.createParsingComponents().assign("weekday", offset).imply("day", date.date()).imply("month", date.month() + 1).imply("year", date.year());
}
};
exports.default = NLWeekdayParser;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLMonthNameMiddleEndianParser.js
var require_NLMonthNameMiddleEndianParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLMonthNameMiddleEndianParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var years_1 = require_years();
var constants_1 = require_constants6();
var constants_2 = require_constants6();
var constants_3 = require_constants6();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`(?:on\\s*?)?(${constants_2.ORDINAL_NUMBER_PATTERN})(?:\\s*(?:tot|\\-|\\\u2013|until|through|till|\\s)\\s*(${constants_2.ORDINAL_NUMBER_PATTERN}))?(?:-|/|\\s*(?:of)?\\s*)(` + pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY) + `)(?:(?:-|/|,?\\s*)(${constants_3.YEAR_PATTERN}(?![^\\s]\\d)))?(?=\\W|$)`, "i");
var MONTH_NAME_GROUP = 3;
var DATE_GROUP = 1;
var DATE_TO_GROUP = 2;
var YEAR_GROUP = 4;
var NLMonthNameMiddleEndianParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const month = constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
const day = constants_2.parseOrdinalNumberPattern(match[DATE_GROUP]);
if (day > 31) {
match.index = match.index + match[DATE_GROUP].length;
return null;
}
const components = context.createParsingComponents({
day,
month
});
if (match[YEAR_GROUP]) {
const year = constants_3.parseYear(match[YEAR_GROUP]);
components.assign("year", year);
} else {
const year = years_1.findYearClosestToRef(context.refDate, day, month);
components.imply("year", year);
}
if (!match[DATE_TO_GROUP]) {
return components;
}
const endDate = constants_2.parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
const result = context.createParsingResult(match.index, match[0]);
result.start = components;
result.end = components.clone();
result.end.assign("day", endDate);
return result;
}
};
exports.default = NLMonthNameMiddleEndianParser;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLMonthNameParser.js
var require_NLMonthNameParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLMonthNameParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants6();
var years_1 = require_years();
var pattern_1 = require_pattern();
var constants_2 = require_constants6();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})\\s*(?:[,-]?\\s*(${constants_2.YEAR_PATTERN})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`, "i");
var MONTH_NAME_GROUP = 1;
var YEAR_GROUP = 2;
var NLMonthNameParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const components = context.createParsingComponents();
components.imply("day", 1);
const monthName = match[MONTH_NAME_GROUP];
const month = constants_1.MONTH_DICTIONARY[monthName.toLowerCase()];
components.assign("month", month);
if (match[YEAR_GROUP]) {
const year = constants_2.parseYear(match[YEAR_GROUP]);
components.assign("year", year);
} else {
const year = years_1.findYearClosestToRef(context.refDate, 1, month);
components.imply("year", year);
}
return components;
}
};
exports.default = NLMonthNameParser;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLSlashMonthFormatParser.js
var require_NLSlashMonthFormatParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLSlashMonthFormatParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})", "i");
var MONTH_GROUP = 1;
var YEAR_GROUP = 2;
var NLSlashMonthFormatParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const year = parseInt(match[YEAR_GROUP]);
const month = parseInt(match[MONTH_GROUP]);
return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year);
}
};
exports.default = NLSlashMonthFormatParser;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLTimeExpressionParser.js
var require_NLTimeExpressionParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLTimeExpressionParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractTimeExpressionParser_1 = require_AbstractTimeExpressionParser();
var NLTimeExpressionParser = class extends AbstractTimeExpressionParser_1.AbstractTimeExpressionParser {
primaryPrefix() {
return "(?:(?:om)\\s*)?";
}
followingPhase() {
return "\\s*(?:\\-|\\\u2013|\\~|\\\u301C|om|\\?)\\s*";
}
extractPrimaryTimeComponents(context, match) {
if (match[0].match(/^\s*\d{4}\s*$/)) {
return null;
}
return super.extractPrimaryTimeComponents(context, match);
}
};
exports.default = NLTimeExpressionParser;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLCasualYearMonthDayParser.js
var require_NLCasualYearMonthDayParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLCasualYearMonthDayParser.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require_constants6();
var pattern_1 = require_pattern();
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var PATTERN = new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${pattern_1.matchAnyPattern(constants_1.MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`, "i");
var YEAR_NUMBER_GROUP = 1;
var MONTH_NAME_GROUP = 2;
var MONTH_NUMBER_GROUP = 3;
var DATE_NUMBER_GROUP = 4;
var NLCasualYearMonthDayParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern() {
return PATTERN;
}
innerExtract(context, match) {
const month = match[MONTH_NUMBER_GROUP] ? parseInt(match[MONTH_NUMBER_GROUP]) : constants_1.MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
if (month < 1 || month > 12) {
return null;
}
const year = parseInt(match[YEAR_NUMBER_GROUP]);
const day = parseInt(match[DATE_NUMBER_GROUP]);
return {
day,
month,
year
};
}
};
exports.default = NLCasualYearMonthDayParser;
}
});
// node_modules/chrono-node/dist/locales/nl/parsers/NLCasualDateTimeParser.js
var require_NLCasualDateTimeParser = __commonJS({
"node_modules/chrono-node/dist/locales/nl/parsers/NLCasualDateTimeParser.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var AbstractParserWithWordBoundary_1 = require_AbstractParserWithWordBoundary();
var index_1 = require_dist();
var dayjs_1 = require_dayjs();
var dayjs_2 = __importDefault2(require_dayjs_min());
var DATE_GROUP = 1;
var TIME_OF_DAY_GROUP = 2;
var NLCasualDateTimeParser = class extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
innerPattern(context) {
return /(gisteren|morgen|van)(ochtend|middag|namiddag|avond|nacht)(?=\W|$)/i;
}
innerExtract(context, match) {
const dateText = match[DATE_GROUP].toLowerCase();
const timeText = match[TIME_OF_DAY_GROUP].toLowerCase();
const component = context.createParsingComponents();
const targetDate = dayjs_2.default(context.refDate);
switch (dateText) {
case "gisteren":
dayjs_1.assignSimilarDate(component, targetDate.add(-1, "day"));
break;
case "van":
dayjs_1.assignSimilarDate(component, targetDate);
break;
case "morgen":
dayjs_1.assignTheNextDay(component, targetDate);
break;
}
switch (timeText) {
case "ochtend":
component.imply("meridiem", index_1.Meridiem.AM);
component.imply("hour", 6);
break;
case "middag":
component.imply("meridiem", index_1.Meridiem.AM);
component.imply("hour", 12);
break;
case "namiddag":
component.imply("meridiem", index_1.Meridiem.PM);
component.imply("hour", 15);
break;
case "avond":
component.imply("meridiem", index_1.Meridiem.PM);
component.imply("hour", 20);
break;
}
return component;
}
};
exports.default = NLCasualDateTimeParser;
}
});
// node_modules/chrono-node/dist/locales/nl/index.js
var require_nl = __commonJS({
"node_modules/chrono-node/dist/locales/nl/index.js"(exports) {
"use strict";
var __importDefault2 = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConfiguration = exports.createCasualConfiguration = exports.parseDate = exports.parse = exports.strict = exports.casual = void 0;
var configurations_1 = require_configurations();
var chrono_1 = require_chrono();
var NLMergeDateRangeRefiner_1 = __importDefault2(require_NLMergeDateRangeRefiner());
var NLMergeDateTimeRefiner_1 = __importDefault2(require_NLMergeDateTimeRefiner());
var NLCasualDateParser_1 = __importDefault2(require_NLCasualDateParser());
var NLCasualTimeParser_1 = __importDefault2(require_NLCasualTimeParser());
var SlashDateFormatParser_1 = __importDefault2(require_SlashDateFormatParser());
var NLTimeUnitWithinFormatParser_1 = __importDefault2(require_NLTimeUnitWithinFormatParser());
var NLWeekdayParser_1 = __importDefault2(require_NLWeekdayParser());
var NLMonthNameMiddleEndianParser_1 = __importDefault2(require_NLMonthNameMiddleEndianParser());
var NLMonthNameParser_1 = __importDefault2(require_NLMonthNameParser());
var NLSlashMonthFormatParser_1 = __importDefault2(require_NLSlashMonthFormatParser());
var NLTimeExpressionParser_1 = __importDefault2(require_NLTimeExpressionParser());
var NLCasualYearMonthDayParser_1 = __importDefault2(require_NLCasualYearMonthDayParser());
var NLCasualDateTimeParser_1 = __importDefault2(require_NLCasualDateTimeParser());
exports.casual = new chrono_1.Chrono(createCasualConfiguration());
exports.strict = new chrono_1.Chrono(createConfiguration(true));
function parse(text2, ref, option) {
return exports.casual.parse(text2, ref, option);
}
exports.parse = parse;
function parseDate2(text2, ref, option) {
return exports.casual.parseDate(text2, ref, option);
}
exports.parseDate = parseDate2;
function createCasualConfiguration(littleEndian = true) {
const option = createConfiguration(false, littleEndian);
option.parsers.unshift(new NLCasualDateParser_1.default());
option.parsers.unshift(new NLCasualTimeParser_1.default());
option.parsers.unshift(new NLCasualDateTimeParser_1.default());
return option;
}
exports.createCasualConfiguration = createCasualConfiguration;
function createConfiguration(strictMode = true, littleEndian = true) {
return configurations_1.includeCommonConfiguration({
parsers: [
new SlashDateFormatParser_1.default(littleEndian),
new NLMonthNameMiddleEndianParser_1.default(),
new NLMonthNameParser_1.default(),
new NLTimeExpressionParser_1.default(),
new NLTimeUnitWithinFormatParser_1.default(),
new NLSlashMonthFormatParser_1.default(),
new NLWeekdayParser_1.default(),
new NLCasualYearMonthDayParser_1.default()
],
refiners: [new NLMergeDateTimeRefiner_1.default(), new NLMergeDateRangeRefiner_1.default()]
}, strictMode);
}
exports.createConfiguration = createConfiguration;
}
});
// node_modules/chrono-node/dist/index.js
var require_dist = __commonJS({
"node_modules/chrono-node/dist/index.js"(exports) {
"use strict";
var __createBinding2 = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar2 = exports && exports.__importStar || function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseDate = exports.parse = exports.casual = exports.strict = exports.nl = exports.pt = exports.ja = exports.fr = exports.de = exports.Meridiem = exports.Chrono = exports.en = void 0;
var en = __importStar2(require_en());
exports.en = en;
var chrono_1 = require_chrono();
Object.defineProperty(exports, "Chrono", { enumerable: true, get: function() {
return chrono_1.Chrono;
} });
var Meridiem;
(function(Meridiem2) {
Meridiem2[Meridiem2["AM"] = 0] = "AM";
Meridiem2[Meridiem2["PM"] = 1] = "PM";
})(Meridiem = exports.Meridiem || (exports.Meridiem = {}));
var de = __importStar2(require_de());
exports.de = de;
var fr = __importStar2(require_fr());
exports.fr = fr;
var ja = __importStar2(require_ja());
exports.ja = ja;
var pt = __importStar2(require_pt());
exports.pt = pt;
var nl = __importStar2(require_nl());
exports.nl = nl;
exports.strict = en.strict;
exports.casual = en.casual;
function parse(text2, ref, option) {
return exports.casual.parse(text2, ref, option);
}
exports.parse = parse;
function parseDate2(text2, ref, option) {
return exports.casual.parseDate(text2, ref, option);
}
exports.parseDate = parseDate2;
}
});
// src/main.ts
__export(exports, {
default: () => TasksPlugin
});
var import_obsidian9 = __toModule(require("obsidian"));
// src/Cache.ts
var import_obsidian3 = __toModule(require("obsidian"));
// node_modules/async-mutex/index.mjs
var E_TIMEOUT = new Error("timeout while waiting for mutex to become available");
var E_ALREADY_LOCKED = new Error("mutex already locked");
var E_CANCELED = new Error("request for lock canceled");
var __awaiter$2 = 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());
});
};
var Semaphore = class {
constructor(_maxConcurrency, _cancelError = E_CANCELED) {
this._maxConcurrency = _maxConcurrency;
this._cancelError = _cancelError;
this._queue = [];
this._waiters = [];
if (_maxConcurrency <= 0) {
throw new Error("semaphore must be initialized to a positive value");
}
this._value = _maxConcurrency;
}
acquire() {
const locked = this.isLocked();
const ticketPromise = new Promise((resolve, reject) => this._queue.push({ resolve, reject }));
if (!locked)
this._dispatch();
return ticketPromise;
}
runExclusive(callback) {
return __awaiter$2(this, void 0, void 0, function* () {
const [value, release] = yield this.acquire();
try {
return yield callback(value);
} finally {
release();
}
});
}
waitForUnlock() {
return __awaiter$2(this, void 0, void 0, function* () {
if (!this.isLocked()) {
return Promise.resolve();
}
const waitPromise = new Promise((resolve) => this._waiters.push({ resolve }));
return waitPromise;
});
}
isLocked() {
return this._value <= 0;
}
release() {
if (this._maxConcurrency > 1) {
throw new Error("this method is unavailable on semaphores with concurrency > 1; use the scoped release returned by acquire instead");
}
if (this._currentReleaser) {
const releaser = this._currentReleaser;
this._currentReleaser = void 0;
releaser();
}
}
cancel() {
this._queue.forEach((ticket) => ticket.reject(this._cancelError));
this._queue = [];
}
_dispatch() {
const nextTicket = this._queue.shift();
if (!nextTicket)
return;
let released = false;
this._currentReleaser = () => {
if (released)
return;
released = true;
this._value++;
this._resolveWaiters();
this._dispatch();
};
nextTicket.resolve([this._value--, this._currentReleaser]);
}
_resolveWaiters() {
this._waiters.forEach((waiter) => waiter.resolve());
this._waiters = [];
}
};
var __awaiter$1 = 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());
});
};
var Mutex = class {
constructor(cancelError) {
this._semaphore = new Semaphore(1, cancelError);
}
acquire() {
return __awaiter$1(this, void 0, void 0, function* () {
const [, releaser] = yield this._semaphore.acquire();
return releaser;
});
}
runExclusive(callback) {
return this._semaphore.runExclusive(() => callback());
}
isLocked() {
return this._semaphore.isLocked();
}
waitForUnlock() {
return this._semaphore.waitForUnlock();
}
release() {
this._semaphore.release();
}
cancel() {
return this._semaphore.cancel();
}
};
// src/Task.ts
var import_obsidian2 = __toModule(require("obsidian"));
// src/File.ts
var import_obsidian = __toModule(require("obsidian"));
// src/Settings.ts
var defaultSettings = {
globalFilter: "",
removeGlobalFilter: false,
setDoneDate: true
};
var settings = __spreadValues({}, defaultSettings);
var getSettings = () => {
return __spreadValues({}, settings);
};
var updateSettings = (newSettings) => {
settings = __spreadValues(__spreadValues({}, settings), newSettings);
return getSettings();
};
// src/File.ts
var metadataCache;
var vault;
var initializeFile = ({
metadataCache: newMetadataCache,
vault: newVault
}) => {
metadataCache = newMetadataCache;
vault = newVault;
};
var replaceTaskWithTasks = (_0) => __async(void 0, [_0], function* ({
originalTask,
newTasks
}) {
if (vault === void 0 || metadataCache === void 0) {
console.error("Tasks: cannot use File before initializing it.");
return;
}
if (!Array.isArray(newTasks)) {
newTasks = [newTasks];
}
tryRepetitive({
originalTask,
newTasks,
vault,
metadataCache,
previousTries: 0
});
});
var tryRepetitive = (_0) => __async(void 0, [_0], function* ({
originalTask,
newTasks,
vault: vault2,
metadataCache: metadataCache2,
previousTries
}) {
const retry = () => {
if (previousTries > 10) {
console.error("Tasks: Too many retries. File update not possible ...");
return;
}
const timeout = Math.min(Math.pow(10, previousTries), 100);
setTimeout(() => {
tryRepetitive({
originalTask,
newTasks,
vault: vault2,
metadataCache: metadataCache2,
previousTries: previousTries + 1
});
}, timeout);
};
const file = vault2.getAbstractFileByPath(originalTask.path);
if (!(file instanceof import_obsidian.TFile)) {
console.warn(`Tasks: No file found for task ${originalTask.description}. Retrying ...`);
return retry();
}
if (file.extension !== "md") {
console.error("Tasks: Only supporting files with the .md file extension.");
return;
}
const fileCache = metadataCache2.getFileCache(file);
if (fileCache == void 0 || fileCache === null) {
console.warn(`Tasks: No file cache found for file ${file.path}. Retrying ...`);
return retry();
}
const listItemsCache = fileCache.listItems;
if (listItemsCache === void 0 || listItemsCache.length === 0) {
console.warn(`Tasks: No list items found in file cache of ${file.path}. Retrying ...`);
return retry();
}
const fileContent = yield vault2.read(file);
const fileLines = fileContent.split("\n");
const { globalFilter } = getSettings();
let listItem;
let sectionIndex = 0;
for (const listItemCache of listItemsCache) {
if (listItemCache.position.start.line < originalTask.sectionStart) {
continue;
}
if (listItemCache.task === void 0) {
continue;
}
const line = fileLines[listItemCache.position.start.line];
if (line.includes(globalFilter)) {
if (sectionIndex === originalTask.sectionIndex) {
listItem = listItemCache;
break;
}
sectionIndex++;
}
}
if (listItem === void 0) {
console.error("Tasks: could not find task to toggle in the file.");
return;
}
const updatedFileLines = [
...fileLines.slice(0, listItem.position.start.line),
...newTasks.map((task) => task.toFileLineString()),
...fileLines.slice(listItem.position.start.line + 1)
];
yield vault2.modify(file, updatedFileLines.join("\n"));
});
// src/LayoutOptions.ts
var LayoutOptions = class {
constructor() {
this.hideTaskCount = false;
this.hideBacklinks = false;
this.hidePriority = false;
this.hideStartDate = false;
this.hideScheduledDate = false;
this.hideDoneDate = false;
this.hideDueDate = false;
this.hideRecurrenceRule = false;
this.hideEditButton = false;
this.shortMode = false;
}
};
// node_modules/rrule/dist/esm/src/weekday.js
var ALL_WEEKDAYS = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"];
var Weekday = function() {
function Weekday2(weekday, n) {
if (n === 0)
throw new Error("Can't create weekday with n == 0");
this.weekday = weekday;
this.n = n;
}
Weekday2.fromStr = function(str) {
return new Weekday2(ALL_WEEKDAYS.indexOf(str));
};
Weekday2.prototype.nth = function(n) {
return this.n === n ? this : new Weekday2(this.weekday, n);
};
Weekday2.prototype.equals = function(other) {
return this.weekday === other.weekday && this.n === other.n;
};
Weekday2.prototype.toString = function() {
var s = ALL_WEEKDAYS[this.weekday];
if (this.n)
s = (this.n > 0 ? "+" : "") + String(this.n) + s;
return s;
};
Weekday2.prototype.getJsWeekday = function() {
return this.weekday === 6 ? 0 : this.weekday + 1;
};
return Weekday2;
}();
// node_modules/rrule/dist/esm/src/helpers.js
var isPresent = function(value) {
return value !== null && value !== void 0;
};
var isNumber = function(value) {
return typeof value === "number";
};
var isWeekdayStr = function(value) {
return ALL_WEEKDAYS.indexOf(value) >= 0;
};
var isArray = Array.isArray;
var range = function(start, end) {
if (end === void 0) {
end = start;
}
if (arguments.length === 1) {
end = start;
start = 0;
}
var rang = [];
for (var i = start; i < end; i++)
rang.push(i);
return rang;
};
var repeat = function(value, times) {
var i = 0;
var array = [];
if (isArray(value)) {
for (; i < times; i++)
array[i] = [].concat(value);
} else {
for (; i < times; i++)
array[i] = value;
}
return array;
};
var toArray = function(item) {
if (isArray(item)) {
return item;
}
return [item];
};
function padStart(item, targetLength, padString) {
if (padString === void 0) {
padString = " ";
}
var str = String(item);
targetLength = targetLength >> 0;
if (str.length > targetLength) {
return String(str);
}
targetLength = targetLength - str.length;
if (targetLength > padString.length) {
padString += repeat(padString, targetLength / padString.length);
}
return padString.slice(0, targetLength) + String(str);
}
var split = function(str, sep, num) {
var splits = str.split(sep);
return num ? splits.slice(0, num).concat([splits.slice(num).join(sep)]) : splits;
};
var pymod = function(a, b) {
var r = a % b;
return r * b < 0 ? r + b : r;
};
var divmod = function(a, b) {
return { div: Math.floor(a / b), mod: pymod(a, b) };
};
var empty = function(obj) {
return !isPresent(obj) || obj.length === 0;
};
var notEmpty = function(obj) {
return !empty(obj);
};
var includes = function(arr, val) {
return notEmpty(arr) && arr.indexOf(val) !== -1;
};
// node_modules/rrule/dist/esm/src/dateutil.js
var dateutil;
(function(dateutil2) {
dateutil2.MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
dateutil2.ONE_DAY = 1e3 * 60 * 60 * 24;
dateutil2.MAXYEAR = 9999;
dateutil2.ORDINAL_BASE = new Date(Date.UTC(1970, 0, 1));
dateutil2.PY_WEEKDAYS = [6, 0, 1, 2, 3, 4, 5];
dateutil2.getYearDay = function(date) {
var dateNoTime = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
return Math.ceil((dateNoTime.valueOf() - new Date(date.getUTCFullYear(), 0, 1).valueOf()) / dateutil2.ONE_DAY) + 1;
};
dateutil2.isLeapYear = function(year) {
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
};
dateutil2.isDate = function(value) {
return value instanceof Date;
};
dateutil2.isValidDate = function(value) {
return dateutil2.isDate(value) && !isNaN(value.getTime());
};
dateutil2.tzOffset = function(date) {
return date.getTimezoneOffset() * 60 * 1e3;
};
dateutil2.daysBetween = function(date1, date2) {
var date1ms = date1.getTime() - dateutil2.tzOffset(date1);
var date2ms = date2.getTime() - dateutil2.tzOffset(date2);
var differencems = date1ms - date2ms;
return Math.round(differencems / dateutil2.ONE_DAY);
};
dateutil2.toOrdinal = function(date) {
return dateutil2.daysBetween(date, dateutil2.ORDINAL_BASE);
};
dateutil2.fromOrdinal = function(ordinal) {
return new Date(dateutil2.ORDINAL_BASE.getTime() + ordinal * dateutil2.ONE_DAY);
};
dateutil2.getMonthDays = function(date) {
var month = date.getUTCMonth();
return month === 1 && dateutil2.isLeapYear(date.getUTCFullYear()) ? 29 : dateutil2.MONTH_DAYS[month];
};
dateutil2.getWeekday = function(date) {
return dateutil2.PY_WEEKDAYS[date.getUTCDay()];
};
dateutil2.monthRange = function(year, month) {
var date = new Date(Date.UTC(year, month, 1));
return [dateutil2.getWeekday(date), dateutil2.getMonthDays(date)];
};
dateutil2.combine = function(date, time) {
time = time || date;
return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds()));
};
dateutil2.clone = function(date) {
var dolly = new Date(date.getTime());
return dolly;
};
dateutil2.cloneDates = function(dates) {
var clones = [];
for (var i = 0; i < dates.length; i++) {
clones.push(dateutil2.clone(dates[i]));
}
return clones;
};
dateutil2.sort = function(dates) {
dates.sort(function(a, b) {
return a.getTime() - b.getTime();
});
};
dateutil2.timeToUntilString = function(time, utc) {
if (utc === void 0) {
utc = true;
}
var date = new Date(time);
return [
padStart(date.getUTCFullYear().toString(), 4, "0"),
padStart(date.getUTCMonth() + 1, 2, "0"),
padStart(date.getUTCDate(), 2, "0"),
"T",
padStart(date.getUTCHours(), 2, "0"),
padStart(date.getUTCMinutes(), 2, "0"),
padStart(date.getUTCSeconds(), 2, "0"),
utc ? "Z" : ""
].join("");
};
dateutil2.untilStringToDate = function(until) {
var re = /^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/;
var bits = re.exec(until);
if (!bits)
throw new Error("Invalid UNTIL value: " + until);
return new Date(Date.UTC(parseInt(bits[1], 10), parseInt(bits[2], 10) - 1, parseInt(bits[3], 10), parseInt(bits[5], 10) || 0, parseInt(bits[6], 10) || 0, parseInt(bits[7], 10) || 0));
};
})(dateutil || (dateutil = {}));
var dateutil_default = dateutil;
// node_modules/rrule/dist/esm/src/iterresult.js
var IterResult = function() {
function IterResult2(method, args) {
this.minDate = null;
this.maxDate = null;
this._result = [];
this.total = 0;
this.method = method;
this.args = args;
if (method === "between") {
this.maxDate = args.inc ? args.before : new Date(args.before.getTime() - 1);
this.minDate = args.inc ? args.after : new Date(args.after.getTime() + 1);
} else if (method === "before") {
this.maxDate = args.inc ? args.dt : new Date(args.dt.getTime() - 1);
} else if (method === "after") {
this.minDate = args.inc ? args.dt : new Date(args.dt.getTime() + 1);
}
}
IterResult2.prototype.accept = function(date) {
++this.total;
var tooEarly = this.minDate && date < this.minDate;
var tooLate = this.maxDate && date > this.maxDate;
if (this.method === "between") {
if (tooEarly)
return true;
if (tooLate)
return false;
} else if (this.method === "before") {
if (tooLate)
return false;
} else if (this.method === "after") {
if (tooEarly)
return true;
this.add(date);
return false;
}
return this.add(date);
};
IterResult2.prototype.add = function(date) {
this._result.push(date);
return true;
};
IterResult2.prototype.getValue = function() {
var res = this._result;
switch (this.method) {
case "all":
case "between":
return res;
case "before":
case "after":
default:
return res.length ? res[res.length - 1] : null;
}
};
IterResult2.prototype.clone = function() {
return new IterResult2(this.method, this.args);
};
return IterResult2;
}();
var iterresult_default = IterResult;
// node_modules/rrule/node_modules/tslib/modules/index.js
var import_tslib = __toModule(require_tslib());
var {
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet
} = import_tslib.default;
// node_modules/rrule/dist/esm/src/callbackiterresult.js
var CallbackIterResult = function(_super) {
__extends(CallbackIterResult2, _super);
function CallbackIterResult2(method, args, iterator) {
var _this = _super.call(this, method, args) || this;
_this.iterator = iterator;
return _this;
}
CallbackIterResult2.prototype.add = function(date) {
if (this.iterator(date, this._result.length)) {
this._result.push(date);
return true;
}
return false;
};
return CallbackIterResult2;
}(iterresult_default);
var callbackiterresult_default = CallbackIterResult;
// node_modules/rrule/dist/esm/src/nlp/i18n.js
var ENGLISH = {
dayNames: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
monthNames: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
tokens: {
"SKIP": /^[ \r\n\t]+|^\.$/,
"number": /^[1-9][0-9]*/,
"numberAsText": /^(one|two|three)/i,
"every": /^every/i,
"day(s)": /^days?/i,
"weekday(s)": /^weekdays?/i,
"week(s)": /^weeks?/i,
"hour(s)": /^hours?/i,
"minute(s)": /^minutes?/i,
"month(s)": /^months?/i,
"year(s)": /^years?/i,
"on": /^(on|in)/i,
"at": /^(at)/i,
"the": /^the/i,
"first": /^first/i,
"second": /^second/i,
"third": /^third/i,
"nth": /^([1-9][0-9]*)(\.|th|nd|rd|st)/i,
"last": /^last/i,
"for": /^for/i,
"time(s)": /^times?/i,
"until": /^(un)?til/i,
"monday": /^mo(n(day)?)?/i,
"tuesday": /^tu(e(s(day)?)?)?/i,
"wednesday": /^we(d(n(esday)?)?)?/i,
"thursday": /^th(u(r(sday)?)?)?/i,
"friday": /^fr(i(day)?)?/i,
"saturday": /^sa(t(urday)?)?/i,
"sunday": /^su(n(day)?)?/i,
"january": /^jan(uary)?/i,
"february": /^feb(ruary)?/i,
"march": /^mar(ch)?/i,
"april": /^apr(il)?/i,
"may": /^may/i,
"june": /^june?/i,
"july": /^july?/i,
"august": /^aug(ust)?/i,
"september": /^sep(t(ember)?)?/i,
"october": /^oct(ober)?/i,
"november": /^nov(ember)?/i,
"december": /^dec(ember)?/i,
"comma": /^(,\s*|(and|or)\s*)+/i
}
};
var i18n_default = ENGLISH;
// node_modules/rrule/dist/esm/src/nlp/totext.js
var contains = function(arr, val) {
return arr.indexOf(val) !== -1;
};
var defaultGetText = function(id) {
return id.toString();
};
var defaultDateFormatter = function(year, month, day) {
return month + " " + day + ", " + year;
};
var ToText = function() {
function ToText2(rrule, gettext, language, dateFormatter) {
if (gettext === void 0) {
gettext = defaultGetText;
}
if (language === void 0) {
language = i18n_default;
}
if (dateFormatter === void 0) {
dateFormatter = defaultDateFormatter;
}
this.text = [];
this.language = language || i18n_default;
this.gettext = gettext;
this.dateFormatter = dateFormatter;
this.rrule = rrule;
this.options = rrule.options;
this.origOptions = rrule.origOptions;
if (this.origOptions.bymonthday) {
var bymonthday = [].concat(this.options.bymonthday);
var bynmonthday = [].concat(this.options.bynmonthday);
bymonthday.sort(function(a, b) {
return a - b;
});
bynmonthday.sort(function(a, b) {
return b - a;
});
this.bymonthday = bymonthday.concat(bynmonthday);
if (!this.bymonthday.length)
this.bymonthday = null;
}
if (isPresent(this.origOptions.byweekday)) {
var byweekday = !isArray(this.origOptions.byweekday) ? [this.origOptions.byweekday] : this.origOptions.byweekday;
var days = String(byweekday);
this.byweekday = {
allWeeks: byweekday.filter(function(weekday) {
return !weekday.n;
}),
someWeeks: byweekday.filter(function(weekday) {
return Boolean(weekday.n);
}),
isWeekdays: days.indexOf("MO") !== -1 && days.indexOf("TU") !== -1 && days.indexOf("WE") !== -1 && days.indexOf("TH") !== -1 && days.indexOf("FR") !== -1 && days.indexOf("SA") === -1 && days.indexOf("SU") === -1,
isEveryDay: days.indexOf("MO") !== -1 && days.indexOf("TU") !== -1 && days.indexOf("WE") !== -1 && days.indexOf("TH") !== -1 && days.indexOf("FR") !== -1 && days.indexOf("SA") !== -1 && days.indexOf("SU") !== -1
};
var sortWeekDays = function(a, b) {
return a.weekday - b.weekday;
};
this.byweekday.allWeeks.sort(sortWeekDays);
this.byweekday.someWeeks.sort(sortWeekDays);
if (!this.byweekday.allWeeks.length)
this.byweekday.allWeeks = null;
if (!this.byweekday.someWeeks.length)
this.byweekday.someWeeks = null;
} else {
this.byweekday = null;
}
}
ToText2.isFullyConvertible = function(rrule) {
var canConvert = true;
if (!(rrule.options.freq in ToText2.IMPLEMENTED))
return false;
if (rrule.origOptions.until && rrule.origOptions.count)
return false;
for (var key in rrule.origOptions) {
if (contains(["dtstart", "wkst", "freq"], key))
return true;
if (!contains(ToText2.IMPLEMENTED[rrule.options.freq], key))
return false;
}
return canConvert;
};
ToText2.prototype.isFullyConvertible = function() {
return ToText2.isFullyConvertible(this.rrule);
};
ToText2.prototype.toString = function() {
var gettext = this.gettext;
if (!(this.options.freq in ToText2.IMPLEMENTED)) {
return gettext("RRule error: Unable to fully convert this rrule to text");
}
this.text = [gettext("every")];
this[src_default.FREQUENCIES[this.options.freq]]();
if (this.options.until) {
this.add(gettext("until"));
var until = this.options.until;
this.add(this.dateFormatter(until.getUTCFullYear(), this.language.monthNames[until.getUTCMonth()], until.getUTCDate()));
} else if (this.options.count) {
this.add(gettext("for")).add(this.options.count.toString()).add(this.plural(this.options.count) ? gettext("times") : gettext("time"));
}
if (!this.isFullyConvertible())
this.add(gettext("(~ approximate)"));
return this.text.join("");
};
ToText2.prototype.HOURLY = function() {
var gettext = this.gettext;
if (this.options.interval !== 1)
this.add(this.options.interval.toString());
this.add(this.plural(this.options.interval) ? gettext("hours") : gettext("hour"));
};
ToText2.prototype.MINUTELY = function() {
var gettext = this.gettext;
if (this.options.interval !== 1)
this.add(this.options.interval.toString());
this.add(this.plural(this.options.interval) ? gettext("minutes") : gettext("minute"));
};
ToText2.prototype.DAILY = function() {
var gettext = this.gettext;
if (this.options.interval !== 1)
this.add(this.options.interval.toString());
if (this.byweekday && this.byweekday.isWeekdays) {
this.add(this.plural(this.options.interval) ? gettext("weekdays") : gettext("weekday"));
} else {
this.add(this.plural(this.options.interval) ? gettext("days") : gettext("day"));
}
if (this.origOptions.bymonth) {
this.add(gettext("in"));
this._bymonth();
}
if (this.bymonthday) {
this._bymonthday();
} else if (this.byweekday) {
this._byweekday();
} else if (this.origOptions.byhour) {
this._byhour();
}
};
ToText2.prototype.WEEKLY = function() {
var gettext = this.gettext;
if (this.options.interval !== 1) {
this.add(this.options.interval.toString()).add(this.plural(this.options.interval) ? gettext("weeks") : gettext("week"));
}
if (this.byweekday && this.byweekday.isWeekdays) {
if (this.options.interval === 1) {
this.add(this.plural(this.options.interval) ? gettext("weekdays") : gettext("weekday"));
} else {
this.add(gettext("on")).add(gettext("weekdays"));
}
} else if (this.byweekday && this.byweekday.isEveryDay) {
this.add(this.plural(this.options.interval) ? gettext("days") : gettext("day"));
} else {
if (this.options.interval === 1)
this.add(gettext("week"));
if (this.origOptions.bymonth) {
this.add(gettext("in"));
this._bymonth();
}
if (this.bymonthday) {
this._bymonthday();
} else if (this.byweekday) {
this._byweekday();
}
}
};
ToText2.prototype.MONTHLY = function() {
var gettext = this.gettext;
if (this.origOptions.bymonth) {
if (this.options.interval !== 1) {
this.add(this.options.interval.toString()).add(gettext("months"));
if (this.plural(this.options.interval))
this.add(gettext("in"));
} else {
}
this._bymonth();
} else {
if (this.options.interval !== 1)
this.add(this.options.interval.toString());
this.add(this.plural(this.options.interval) ? gettext("months") : gettext("month"));
}
if (this.bymonthday) {
this._bymonthday();
} else if (this.byweekday && this.byweekday.isWeekdays) {
this.add(gettext("on")).add(gettext("weekdays"));
} else if (this.byweekday) {
this._byweekday();
}
};
ToText2.prototype.YEARLY = function() {
var gettext = this.gettext;
if (this.origOptions.bymonth) {
if (this.options.interval !== 1) {
this.add(this.options.interval.toString());
this.add(gettext("years"));
} else {
}
this._bymonth();
} else {
if (this.options.interval !== 1)
this.add(this.options.interval.toString());
this.add(this.plural(this.options.interval) ? gettext("years") : gettext("year"));
}
if (this.bymonthday) {
this._bymonthday();
} else if (this.byweekday) {
this._byweekday();
}
if (this.options.byyearday) {
this.add(gettext("on the")).add(this.list(this.options.byyearday, this.nth, gettext("and"))).add(gettext("day"));
}
if (this.options.byweekno) {
this.add(gettext("in")).add(this.plural(this.options.byweekno.length) ? gettext("weeks") : gettext("week")).add(this.list(this.options.byweekno, void 0, gettext("and")));
}
};
ToText2.prototype._bymonthday = function() {
var gettext = this.gettext;
if (this.byweekday && this.byweekday.allWeeks) {
this.add(gettext("on")).add(this.list(this.byweekday.allWeeks, this.weekdaytext, gettext("or"))).add(gettext("the")).add(this.list(this.bymonthday, this.nth, gettext("or")));
} else {
this.add(gettext("on the")).add(this.list(this.bymonthday, this.nth, gettext("and")));
}
};
ToText2.prototype._byweekday = function() {
var gettext = this.gettext;
if (this.byweekday.allWeeks && !this.byweekday.isWeekdays) {
this.add(gettext("on")).add(this.list(this.byweekday.allWeeks, this.weekdaytext));
}
if (this.byweekday.someWeeks) {
if (this.byweekday.allWeeks)
this.add(gettext("and"));
this.add(gettext("on the")).add(this.list(this.byweekday.someWeeks, this.weekdaytext, gettext("and")));
}
};
ToText2.prototype._byhour = function() {
var gettext = this.gettext;
this.add(gettext("at")).add(this.list(this.origOptions.byhour, void 0, gettext("and")));
};
ToText2.prototype._bymonth = function() {
this.add(this.list(this.options.bymonth, this.monthtext, this.gettext("and")));
};
ToText2.prototype.nth = function(n) {
n = parseInt(n.toString(), 10);
var nth;
var npos;
var gettext = this.gettext;
if (n === -1)
return gettext("last");
npos = Math.abs(n);
switch (npos) {
case 1:
case 21:
case 31:
nth = npos + gettext("st");
break;
case 2:
case 22:
nth = npos + gettext("nd");
break;
case 3:
case 23:
nth = npos + gettext("rd");
break;
default:
nth = npos + gettext("th");
}
return n < 0 ? nth + " " + gettext("last") : nth;
};
ToText2.prototype.monthtext = function(m) {
return this.language.monthNames[m - 1];
};
ToText2.prototype.weekdaytext = function(wday) {
var weekday = isNumber(wday) ? (wday + 1) % 7 : wday.getJsWeekday();
return (wday.n ? this.nth(wday.n) + " " : "") + this.language.dayNames[weekday];
};
ToText2.prototype.plural = function(n) {
return n % 100 !== 1;
};
ToText2.prototype.add = function(s) {
this.text.push(" ");
this.text.push(s);
return this;
};
ToText2.prototype.list = function(arr, callback, finalDelim, delim) {
if (delim === void 0) {
delim = ",";
}
if (!isArray(arr)) {
arr = [arr];
}
var delimJoin = function(array, delimiter, finalDelimiter) {
var list = "";
for (var i = 0; i < array.length; i++) {
if (i !== 0) {
if (i === array.length - 1) {
list += " " + finalDelimiter + " ";
} else {
list += delimiter + " ";
}
}
list += array[i];
}
return list;
};
callback = callback || function(o) {
return o.toString();
};
var self2 = this;
var realCallback = function(arg) {
return callback && callback.call(self2, arg);
};
if (finalDelim) {
return delimJoin(arr.map(realCallback), delim, finalDelim);
} else {
return arr.map(realCallback).join(delim + " ");
}
};
return ToText2;
}();
var totext_default = ToText;
// node_modules/rrule/dist/esm/src/nlp/parsetext.js
var Parser = function() {
function Parser2(rules) {
this.done = true;
this.rules = rules;
}
Parser2.prototype.start = function(text2) {
this.text = text2;
this.done = false;
return this.nextSymbol();
};
Parser2.prototype.isDone = function() {
return this.done && this.symbol === null;
};
Parser2.prototype.nextSymbol = function() {
var best;
var bestSymbol;
var p = this;
this.symbol = null;
this.value = null;
do {
if (this.done)
return false;
var rule = void 0;
best = null;
for (var name_1 in this.rules) {
rule = this.rules[name_1];
var match = rule.exec(p.text);
if (match) {
if (best === null || match[0].length > best[0].length) {
best = match;
bestSymbol = name_1;
}
}
}
if (best != null) {
this.text = this.text.substr(best[0].length);
if (this.text === "")
this.done = true;
}
if (best == null) {
this.done = true;
this.symbol = null;
this.value = null;
return;
}
} while (bestSymbol === "SKIP");
this.symbol = bestSymbol;
this.value = best;
return true;
};
Parser2.prototype.accept = function(name) {
if (this.symbol === name) {
if (this.value) {
var v = this.value;
this.nextSymbol();
return v;
}
this.nextSymbol();
return true;
}
return false;
};
Parser2.prototype.acceptNumber = function() {
return this.accept("number");
};
Parser2.prototype.expect = function(name) {
if (this.accept(name))
return true;
throw new Error("expected " + name + " but found " + this.symbol);
};
return Parser2;
}();
function parseText(text2, language) {
if (language === void 0) {
language = i18n_default;
}
var options = {};
var ttr = new Parser(language.tokens);
if (!ttr.start(text2))
return null;
S();
return options;
function S() {
ttr.expect("every");
var n = ttr.acceptNumber();
if (n)
options.interval = parseInt(n[0], 10);
if (ttr.isDone())
throw new Error("Unexpected end");
switch (ttr.symbol) {
case "day(s)":
options.freq = src_default.DAILY;
if (ttr.nextSymbol()) {
AT();
F();
}
break;
case "weekday(s)":
options.freq = src_default.WEEKLY;
options.byweekday = [
src_default.MO,
src_default.TU,
src_default.WE,
src_default.TH,
src_default.FR
];
ttr.nextSymbol();
F();
break;
case "week(s)":
options.freq = src_default.WEEKLY;
if (ttr.nextSymbol()) {
ON();
F();
}
break;
case "hour(s)":
options.freq = src_default.HOURLY;
if (ttr.nextSymbol()) {
ON();
F();
}
break;
case "minute(s)":
options.freq = src_default.MINUTELY;
if (ttr.nextSymbol()) {
ON();
F();
}
break;
case "month(s)":
options.freq = src_default.MONTHLY;
if (ttr.nextSymbol()) {
ON();
F();
}
break;
case "year(s)":
options.freq = src_default.YEARLY;
if (ttr.nextSymbol()) {
ON();
F();
}
break;
case "monday":
case "tuesday":
case "wednesday":
case "thursday":
case "friday":
case "saturday":
case "sunday":
options.freq = src_default.WEEKLY;
var key = ttr.symbol.substr(0, 2).toUpperCase();
options.byweekday = [src_default[key]];
if (!ttr.nextSymbol())
return;
while (ttr.accept("comma")) {
if (ttr.isDone())
throw new Error("Unexpected end");
var wkd = decodeWKD();
if (!wkd) {
throw new Error("Unexpected symbol " + ttr.symbol + ", expected weekday");
}
options.byweekday.push(src_default[wkd]);
ttr.nextSymbol();
}
MDAYs();
F();
break;
case "january":
case "february":
case "march":
case "april":
case "may":
case "june":
case "july":
case "august":
case "september":
case "october":
case "november":
case "december":
options.freq = src_default.YEARLY;
options.bymonth = [decodeM()];
if (!ttr.nextSymbol())
return;
while (ttr.accept("comma")) {
if (ttr.isDone())
throw new Error("Unexpected end");
var m = decodeM();
if (!m) {
throw new Error("Unexpected symbol " + ttr.symbol + ", expected month");
}
options.bymonth.push(m);
ttr.nextSymbol();
}
ON();
F();
break;
default:
throw new Error("Unknown symbol");
}
}
function ON() {
var on = ttr.accept("on");
var the = ttr.accept("the");
if (!(on || the))
return;
do {
var nth = decodeNTH();
var wkd = decodeWKD();
var m = decodeM();
if (nth) {
if (wkd) {
ttr.nextSymbol();
if (!options.byweekday)
options.byweekday = [];
options.byweekday.push(src_default[wkd].nth(nth));
} else {
if (!options.bymonthday)
options.bymonthday = [];
options.bymonthday.push(nth);
ttr.accept("day(s)");
}
} else if (wkd) {
ttr.nextSymbol();
if (!options.byweekday)
options.byweekday = [];
options.byweekday.push(src_default[wkd]);
} else if (ttr.symbol === "weekday(s)") {
ttr.nextSymbol();
if (!options.byweekday) {
options.byweekday = [
src_default.MO,
src_default.TU,
src_default.WE,
src_default.TH,
src_default.FR
];
}
} else if (ttr.symbol === "week(s)") {
ttr.nextSymbol();
var n = ttr.acceptNumber();
if (!n) {
throw new Error("Unexpected symbol " + ttr.symbol + ", expected week number");
}
options.byweekno = [parseInt(n[0], 10)];
while (ttr.accept("comma")) {
n = ttr.acceptNumber();
if (!n) {
throw new Error("Unexpected symbol " + ttr.symbol + "; expected monthday");
}
options.byweekno.push(parseInt(n[0], 10));
}
} else if (m) {
ttr.nextSymbol();
if (!options.bymonth)
options.bymonth = [];
options.bymonth.push(m);
} else {
return;
}
} while (ttr.accept("comma") || ttr.accept("the") || ttr.accept("on"));
}
function AT() {
var at = ttr.accept("at");
if (!at)
return;
do {
var n = ttr.acceptNumber();
if (!n) {
throw new Error("Unexpected symbol " + ttr.symbol + ", expected hour");
}
options.byhour = [parseInt(n[0], 10)];
while (ttr.accept("comma")) {
n = ttr.acceptNumber();
if (!n) {
throw new Error("Unexpected symbol " + ttr.symbol + "; expected hour");
}
options.byhour.push(parseInt(n[0], 10));
}
} while (ttr.accept("comma") || ttr.accept("at"));
}
function decodeM() {
switch (ttr.symbol) {
case "january":
return 1;
case "february":
return 2;
case "march":
return 3;
case "april":
return 4;
case "may":
return 5;
case "june":
return 6;
case "july":
return 7;
case "august":
return 8;
case "september":
return 9;
case "october":
return 10;
case "november":
return 11;
case "december":
return 12;
default:
return false;
}
}
function decodeWKD() {
switch (ttr.symbol) {
case "monday":
case "tuesday":
case "wednesday":
case "thursday":
case "friday":
case "saturday":
case "sunday":
return ttr.symbol.substr(0, 2).toUpperCase();
default:
return false;
}
}
function decodeNTH() {
switch (ttr.symbol) {
case "last":
ttr.nextSymbol();
return -1;
case "first":
ttr.nextSymbol();
return 1;
case "second":
ttr.nextSymbol();
return ttr.accept("last") ? -2 : 2;
case "third":
ttr.nextSymbol();
return ttr.accept("last") ? -3 : 3;
case "nth":
var v = parseInt(ttr.value[1], 10);
if (v < -366 || v > 366)
throw new Error("Nth out of range: " + v);
ttr.nextSymbol();
return ttr.accept("last") ? -v : v;
default:
return false;
}
}
function MDAYs() {
ttr.accept("on");
ttr.accept("the");
var nth = decodeNTH();
if (!nth)
return;
options.bymonthday = [nth];
ttr.nextSymbol();
while (ttr.accept("comma")) {
nth = decodeNTH();
if (!nth) {
throw new Error("Unexpected symbol " + ttr.symbol + "; expected monthday");
}
options.bymonthday.push(nth);
ttr.nextSymbol();
}
}
function F() {
if (ttr.symbol === "until") {
var date = Date.parse(ttr.text);
if (!date)
throw new Error("Cannot parse until date:" + ttr.text);
options.until = new Date(date);
} else if (ttr.accept("for")) {
options.count = parseInt(ttr.value[0], 10);
ttr.expect("number");
}
}
}
// node_modules/rrule/dist/esm/src/types.js
var Frequency;
(function(Frequency2) {
Frequency2[Frequency2["YEARLY"] = 0] = "YEARLY";
Frequency2[Frequency2["MONTHLY"] = 1] = "MONTHLY";
Frequency2[Frequency2["WEEKLY"] = 2] = "WEEKLY";
Frequency2[Frequency2["DAILY"] = 3] = "DAILY";
Frequency2[Frequency2["HOURLY"] = 4] = "HOURLY";
Frequency2[Frequency2["MINUTELY"] = 5] = "MINUTELY";
Frequency2[Frequency2["SECONDLY"] = 6] = "SECONDLY";
})(Frequency || (Frequency = {}));
function freqIsDailyOrGreater(freq) {
return freq < Frequency.HOURLY;
}
// node_modules/rrule/dist/esm/src/nlp/index.js
var fromText = function(text2, language) {
if (language === void 0) {
language = i18n_default;
}
return new src_default(parseText(text2, language) || void 0);
};
var common = [
"count",
"until",
"interval",
"byweekday",
"bymonthday",
"bymonth"
];
totext_default.IMPLEMENTED = [];
totext_default.IMPLEMENTED[Frequency.HOURLY] = common;
totext_default.IMPLEMENTED[Frequency.MINUTELY] = common;
totext_default.IMPLEMENTED[Frequency.DAILY] = ["byhour"].concat(common);
totext_default.IMPLEMENTED[Frequency.WEEKLY] = common;
totext_default.IMPLEMENTED[Frequency.MONTHLY] = common;
totext_default.IMPLEMENTED[Frequency.YEARLY] = ["byweekno", "byyearday"].concat(common);
var toText = function(rrule, gettext, language, dateFormatter) {
return new totext_default(rrule, gettext, language, dateFormatter).toString();
};
var isFullyConvertible = totext_default.isFullyConvertible;
// node_modules/rrule/dist/esm/src/datetime.js
var Time = function() {
function Time2(hour, minute, second, millisecond) {
this.hour = hour;
this.minute = minute;
this.second = second;
this.millisecond = millisecond || 0;
}
Time2.prototype.getHours = function() {
return this.hour;
};
Time2.prototype.getMinutes = function() {
return this.minute;
};
Time2.prototype.getSeconds = function() {
return this.second;
};
Time2.prototype.getMilliseconds = function() {
return this.millisecond;
};
Time2.prototype.getTime = function() {
return (this.hour * 60 * 60 + this.minute * 60 + this.second) * 1e3 + this.millisecond;
};
return Time2;
}();
var DateTime = function(_super) {
__extends(DateTime3, _super);
function DateTime3(year, month, day, hour, minute, second, millisecond) {
var _this = _super.call(this, hour, minute, second, millisecond) || this;
_this.year = year;
_this.month = month;
_this.day = day;
return _this;
}
DateTime3.fromDate = function(date) {
return new this(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.valueOf() % 1e3);
};
DateTime3.prototype.getWeekday = function() {
return dateutil.getWeekday(new Date(this.getTime()));
};
DateTime3.prototype.getTime = function() {
return new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)).getTime();
};
DateTime3.prototype.getDay = function() {
return this.day;
};
DateTime3.prototype.getMonth = function() {
return this.month;
};
DateTime3.prototype.getYear = function() {
return this.year;
};
DateTime3.prototype.addYears = function(years) {
this.year += years;
};
DateTime3.prototype.addMonths = function(months) {
this.month += months;
if (this.month > 12) {
var yearDiv = Math.floor(this.month / 12);
var monthMod = pymod(this.month, 12);
this.month = monthMod;
this.year += yearDiv;
if (this.month === 0) {
this.month = 12;
--this.year;
}
}
};
DateTime3.prototype.addWeekly = function(days, wkst) {
if (wkst > this.getWeekday()) {
this.day += -(this.getWeekday() + 1 + (6 - wkst)) + days * 7;
} else {
this.day += -(this.getWeekday() - wkst) + days * 7;
}
this.fixDay();
};
DateTime3.prototype.addDaily = function(days) {
this.day += days;
this.fixDay();
};
DateTime3.prototype.addHours = function(hours, filtered, byhour) {
if (filtered) {
this.hour += Math.floor((23 - this.hour) / hours) * hours;
}
while (true) {
this.hour += hours;
var _a = divmod(this.hour, 24), dayDiv = _a.div, hourMod = _a.mod;
if (dayDiv) {
this.hour = hourMod;
this.addDaily(dayDiv);
}
if (empty(byhour) || includes(byhour, this.hour))
break;
}
};
DateTime3.prototype.addMinutes = function(minutes, filtered, byhour, byminute) {
if (filtered) {
this.minute += Math.floor((1439 - (this.hour * 60 + this.minute)) / minutes) * minutes;
}
while (true) {
this.minute += minutes;
var _a = divmod(this.minute, 60), hourDiv = _a.div, minuteMod = _a.mod;
if (hourDiv) {
this.minute = minuteMod;
this.addHours(hourDiv, false, byhour);
}
if ((empty(byhour) || includes(byhour, this.hour)) && (empty(byminute) || includes(byminute, this.minute))) {
break;
}
}
};
DateTime3.prototype.addSeconds = function(seconds, filtered, byhour, byminute, bysecond) {
if (filtered) {
this.second += Math.floor((86399 - (this.hour * 3600 + this.minute * 60 + this.second)) / seconds) * seconds;
}
while (true) {
this.second += seconds;
var _a = divmod(this.second, 60), minuteDiv = _a.div, secondMod = _a.mod;
if (minuteDiv) {
this.second = secondMod;
this.addMinutes(minuteDiv, false, byhour, byminute);
}
if ((empty(byhour) || includes(byhour, this.hour)) && (empty(byminute) || includes(byminute, this.minute)) && (empty(bysecond) || includes(bysecond, this.second))) {
break;
}
}
};
DateTime3.prototype.fixDay = function() {
if (this.day <= 28) {
return;
}
var daysinmonth = dateutil.monthRange(this.year, this.month - 1)[1];
if (this.day <= daysinmonth) {
return;
}
while (this.day > daysinmonth) {
this.day -= daysinmonth;
++this.month;
if (this.month === 13) {
this.month = 1;
++this.year;
if (this.year > dateutil.MAXYEAR) {
return;
}
}
daysinmonth = dateutil.monthRange(this.year, this.month - 1)[1];
}
};
DateTime3.prototype.add = function(options, filtered) {
var freq = options.freq, interval = options.interval, wkst = options.wkst, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;
switch (freq) {
case Frequency.YEARLY:
return this.addYears(interval);
case Frequency.MONTHLY:
return this.addMonths(interval);
case Frequency.WEEKLY:
return this.addWeekly(interval, wkst);
case Frequency.DAILY:
return this.addDaily(interval);
case Frequency.HOURLY:
return this.addHours(interval, filtered, byhour);
case Frequency.MINUTELY:
return this.addMinutes(interval, filtered, byhour, byminute);
case Frequency.SECONDLY:
return this.addSeconds(interval, filtered, byhour, byminute, bysecond);
}
};
return DateTime3;
}(Time);
// node_modules/rrule/dist/esm/src/parseoptions.js
function initializeOptions(options) {
var invalid = [];
var keys = Object.keys(options);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var key = keys_1[_i];
if (!includes(defaultKeys, key))
invalid.push(key);
if (dateutil_default.isDate(options[key]) && !dateutil_default.isValidDate(options[key]))
invalid.push(key);
}
if (invalid.length) {
throw new Error("Invalid options: " + invalid.join(", "));
}
return __assign({}, options);
}
function parseOptions(options) {
var opts = __assign(__assign({}, DEFAULT_OPTIONS), initializeOptions(options));
if (isPresent(opts.byeaster))
opts.freq = rrule_default.YEARLY;
if (!(isPresent(opts.freq) && rrule_default.FREQUENCIES[opts.freq])) {
throw new Error("Invalid frequency: " + opts.freq + " " + options.freq);
}
if (!opts.dtstart)
opts.dtstart = new Date(new Date().setMilliseconds(0));
if (!isPresent(opts.wkst)) {
opts.wkst = rrule_default.MO.weekday;
} else if (isNumber(opts.wkst)) {
} else {
opts.wkst = opts.wkst.weekday;
}
if (isPresent(opts.bysetpos)) {
if (isNumber(opts.bysetpos))
opts.bysetpos = [opts.bysetpos];
for (var i = 0; i < opts.bysetpos.length; i++) {
var v = opts.bysetpos[i];
if (v === 0 || !(v >= -366 && v <= 366)) {
throw new Error("bysetpos must be between 1 and 366, or between -366 and -1");
}
}
}
if (!(Boolean(opts.byweekno) || notEmpty(opts.byweekno) || notEmpty(opts.byyearday) || Boolean(opts.bymonthday) || notEmpty(opts.bymonthday) || isPresent(opts.byweekday) || isPresent(opts.byeaster))) {
switch (opts.freq) {
case rrule_default.YEARLY:
if (!opts.bymonth)
opts.bymonth = opts.dtstart.getUTCMonth() + 1;
opts.bymonthday = opts.dtstart.getUTCDate();
break;
case rrule_default.MONTHLY:
opts.bymonthday = opts.dtstart.getUTCDate();
break;
case rrule_default.WEEKLY:
opts.byweekday = [dateutil_default.getWeekday(opts.dtstart)];
break;
}
}
if (isPresent(opts.bymonth) && !isArray(opts.bymonth)) {
opts.bymonth = [opts.bymonth];
}
if (isPresent(opts.byyearday) && !isArray(opts.byyearday) && isNumber(opts.byyearday)) {
opts.byyearday = [opts.byyearday];
}
if (!isPresent(opts.bymonthday)) {
opts.bymonthday = [];
opts.bynmonthday = [];
} else if (isArray(opts.bymonthday)) {
var bymonthday = [];
var bynmonthday = [];
for (var i = 0; i < opts.bymonthday.length; i++) {
var v = opts.bymonthday[i];
if (v > 0) {
bymonthday.push(v);
} else if (v < 0) {
bynmonthday.push(v);
}
}
opts.bymonthday = bymonthday;
opts.bynmonthday = bynmonthday;
} else if (opts.bymonthday < 0) {
opts.bynmonthday = [opts.bymonthday];
opts.bymonthday = [];
} else {
opts.bynmonthday = [];
opts.bymonthday = [opts.bymonthday];
}
if (isPresent(opts.byweekno) && !isArray(opts.byweekno)) {
opts.byweekno = [opts.byweekno];
}
if (!isPresent(opts.byweekday)) {
opts.bynweekday = null;
} else if (isNumber(opts.byweekday)) {
opts.byweekday = [opts.byweekday];
opts.bynweekday = null;
} else if (isWeekdayStr(opts.byweekday)) {
opts.byweekday = [Weekday.fromStr(opts.byweekday).weekday];
opts.bynweekday = null;
} else if (opts.byweekday instanceof Weekday) {
if (!opts.byweekday.n || opts.freq > rrule_default.MONTHLY) {
opts.byweekday = [opts.byweekday.weekday];
opts.bynweekday = null;
} else {
opts.bynweekday = [[opts.byweekday.weekday, opts.byweekday.n]];
opts.byweekday = null;
}
} else {
var byweekday = [];
var bynweekday = [];
for (var i = 0; i < opts.byweekday.length; i++) {
var wday = opts.byweekday[i];
if (isNumber(wday)) {
byweekday.push(wday);
continue;
} else if (isWeekdayStr(wday)) {
byweekday.push(Weekday.fromStr(wday).weekday);
continue;
}
if (!wday.n || opts.freq > rrule_default.MONTHLY) {
byweekday.push(wday.weekday);
} else {
bynweekday.push([wday.weekday, wday.n]);
}
}
opts.byweekday = notEmpty(byweekday) ? byweekday : null;
opts.bynweekday = notEmpty(bynweekday) ? bynweekday : null;
}
if (!isPresent(opts.byhour)) {
opts.byhour = opts.freq < rrule_default.HOURLY ? [opts.dtstart.getUTCHours()] : null;
} else if (isNumber(opts.byhour)) {
opts.byhour = [opts.byhour];
}
if (!isPresent(opts.byminute)) {
opts.byminute = opts.freq < rrule_default.MINUTELY ? [opts.dtstart.getUTCMinutes()] : null;
} else if (isNumber(opts.byminute)) {
opts.byminute = [opts.byminute];
}
if (!isPresent(opts.bysecond)) {
opts.bysecond = opts.freq < rrule_default.SECONDLY ? [opts.dtstart.getUTCSeconds()] : null;
} else if (isNumber(opts.bysecond)) {
opts.bysecond = [opts.bysecond];
}
return { parsedOptions: opts };
}
function buildTimeset(opts) {
var millisecondModulo = opts.dtstart.getTime() % 1e3;
if (!freqIsDailyOrGreater(opts.freq)) {
return [];
}
var timeset = [];
opts.byhour.forEach(function(hour) {
opts.byminute.forEach(function(minute) {
opts.bysecond.forEach(function(second) {
timeset.push(new Time(hour, minute, second, millisecondModulo));
});
});
});
return timeset;
}
// node_modules/rrule/dist/esm/src/parsestring.js
function parseString(rfcString) {
var options = rfcString.split("\n").map(parseLine).filter(function(x) {
return x !== null;
});
return __assign(__assign({}, options[0]), options[1]);
}
function parseDtstart(line) {
var options = {};
var dtstartWithZone = /DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(line);
if (!dtstartWithZone) {
return options;
}
var _ = dtstartWithZone[0], tzid = dtstartWithZone[1], dtstart = dtstartWithZone[2];
if (tzid) {
options.tzid = tzid;
}
options.dtstart = dateutil_default.untilStringToDate(dtstart);
return options;
}
function parseLine(rfcString) {
rfcString = rfcString.replace(/^\s+|\s+$/, "");
if (!rfcString.length)
return null;
var header = /^([A-Z]+?)[:;]/.exec(rfcString.toUpperCase());
if (!header) {
return parseRrule(rfcString);
}
var _ = header[0], key = header[1];
switch (key.toUpperCase()) {
case "RRULE":
case "EXRULE":
return parseRrule(rfcString);
case "DTSTART":
return parseDtstart(rfcString);
default:
throw new Error("Unsupported RFC prop " + key + " in " + rfcString);
}
}
function parseRrule(line) {
var strippedLine = line.replace(/^RRULE:/i, "");
var options = parseDtstart(strippedLine);
var attrs = line.replace(/^(?:RRULE|EXRULE):/i, "").split(";");
attrs.forEach(function(attr2) {
var _a = attr2.split("="), key = _a[0], value = _a[1];
switch (key.toUpperCase()) {
case "FREQ":
options.freq = Frequency[value.toUpperCase()];
break;
case "WKST":
options.wkst = Days[value.toUpperCase()];
break;
case "COUNT":
case "INTERVAL":
case "BYSETPOS":
case "BYMONTH":
case "BYMONTHDAY":
case "BYYEARDAY":
case "BYWEEKNO":
case "BYHOUR":
case "BYMINUTE":
case "BYSECOND":
var num = parseNumber(value);
var optionKey = key.toLowerCase();
options[optionKey] = num;
break;
case "BYWEEKDAY":
case "BYDAY":
options.byweekday = parseWeekday(value);
break;
case "DTSTART":
case "TZID":
var dtstart = parseDtstart(line);
options.tzid = dtstart.tzid;
options.dtstart = dtstart.dtstart;
break;
case "UNTIL":
options.until = dateutil_default.untilStringToDate(value);
break;
case "BYEASTER":
options.byeaster = Number(value);
break;
default:
throw new Error("Unknown RRULE property '" + key + "'");
}
});
return options;
}
function parseNumber(value) {
if (value.indexOf(",") !== -1) {
var values = value.split(",");
return values.map(parseIndividualNumber);
}
return parseIndividualNumber(value);
}
function parseIndividualNumber(value) {
if (/^[+-]?\d+$/.test(value)) {
return Number(value);
}
return value;
}
function parseWeekday(value) {
var days = value.split(",");
return days.map(function(day) {
if (day.length === 2) {
return Days[day];
}
var parts = day.match(/^([+-]?\d{1,2})([A-Z]{2})$/);
var n = Number(parts[1]);
var wdaypart = parts[2];
var wday = Days[wdaypart].weekday;
return new Weekday(wday, n);
});
}
// node_modules/rrule/dist/esm/src/datewithzone.js
var import_luxon = __toModule(require_luxon());
var DateWithZone = function() {
function DateWithZone2(date, tzid) {
this.date = date;
this.tzid = tzid;
}
Object.defineProperty(DateWithZone2.prototype, "isUTC", {
get: function() {
return !this.tzid || this.tzid.toUpperCase() === "UTC";
},
enumerable: true,
configurable: true
});
DateWithZone2.prototype.toString = function() {
var datestr = dateutil_default.timeToUntilString(this.date.getTime(), this.isUTC);
if (!this.isUTC) {
return ";TZID=" + this.tzid + ":" + datestr;
}
return ":" + datestr;
};
DateWithZone2.prototype.getTime = function() {
return this.date.getTime();
};
DateWithZone2.prototype.rezonedDate = function() {
if (this.isUTC) {
return this.date;
}
try {
var datetime = import_luxon.DateTime.fromJSDate(this.date);
var rezoned = datetime.setZone(this.tzid, { keepLocalTime: true });
return rezoned.toJSDate();
} catch (e) {
if (e instanceof TypeError) {
console.error("Using TZID without Luxon available is unsupported. Returned times are in UTC, not the requested time zone");
}
return this.date;
}
};
return DateWithZone2;
}();
// node_modules/rrule/dist/esm/src/optionstostring.js
function optionsToString(options) {
var rrule = [];
var dtstart = "";
var keys = Object.keys(options);
var defaultKeys2 = Object.keys(DEFAULT_OPTIONS);
for (var i = 0; i < keys.length; i++) {
if (keys[i] === "tzid")
continue;
if (!includes(defaultKeys2, keys[i]))
continue;
var key = keys[i].toUpperCase();
var value = options[keys[i]];
var outValue = "";
if (!isPresent(value) || isArray(value) && !value.length)
continue;
switch (key) {
case "FREQ":
outValue = rrule_default.FREQUENCIES[options.freq];
break;
case "WKST":
if (isNumber(value)) {
outValue = new Weekday(value).toString();
} else {
outValue = value.toString();
}
break;
case "BYWEEKDAY":
key = "BYDAY";
outValue = toArray(value).map(function(wday) {
if (wday instanceof Weekday) {
return wday;
}
if (isArray(wday)) {
return new Weekday(wday[0], wday[1]);
}
return new Weekday(wday);
}).toString();
break;
case "DTSTART":
dtstart = buildDtstart(value, options.tzid);
break;
case "UNTIL":
outValue = dateutil_default.timeToUntilString(value, !options.tzid);
break;
default:
if (isArray(value)) {
var strValues = [];
for (var j = 0; j < value.length; j++) {
strValues[j] = String(value[j]);
}
outValue = strValues.toString();
} else {
outValue = String(value);
}
}
if (outValue) {
rrule.push([key, outValue]);
}
}
var rules = rrule.map(function(_a) {
var key2 = _a[0], value2 = _a[1];
return key2 + "=" + value2.toString();
}).join(";");
var ruleString = "";
if (rules !== "") {
ruleString = "RRULE:" + rules;
}
return [dtstart, ruleString].filter(function(x) {
return !!x;
}).join("\n");
}
function buildDtstart(dtstart, tzid) {
if (!dtstart) {
return "";
}
return "DTSTART" + new DateWithZone(new Date(dtstart), tzid).toString();
}
// node_modules/rrule/dist/esm/src/cache.js
var Cache = function() {
function Cache3() {
this.all = false;
this.before = [];
this.after = [];
this.between = [];
}
Cache3.prototype._cacheAdd = function(what, value, args) {
if (value) {
value = value instanceof Date ? dateutil_default.clone(value) : dateutil_default.cloneDates(value);
}
if (what === "all") {
this.all = value;
} else {
args._value = value;
this[what].push(args);
}
};
Cache3.prototype._cacheGet = function(what, args) {
var cached = false;
var argsKeys = args ? Object.keys(args) : [];
var findCacheDiff = function(item2) {
for (var i2 = 0; i2 < argsKeys.length; i2++) {
var key = argsKeys[i2];
if (String(args[key]) !== String(item2[key])) {
return true;
}
}
return false;
};
var cachedObject = this[what];
if (what === "all") {
cached = this.all;
} else if (isArray(cachedObject)) {
for (var i = 0; i < cachedObject.length; i++) {
var item = cachedObject[i];
if (argsKeys.length && findCacheDiff(item))
continue;
cached = item._value;
break;
}
}
if (!cached && this.all) {
var iterResult = new iterresult_default(what, args);
for (var i = 0; i < this.all.length; i++) {
if (!iterResult.accept(this.all[i]))
break;
}
cached = iterResult.getValue();
this._cacheAdd(what, cached, args);
}
return isArray(cached) ? dateutil_default.cloneDates(cached) : cached instanceof Date ? dateutil_default.clone(cached) : cached;
};
return Cache3;
}();
// node_modules/rrule/dist/esm/src/masks.js
var M365MASK = __spreadArrays(repeat(1, 31), repeat(2, 28), repeat(3, 31), repeat(4, 30), repeat(5, 31), repeat(6, 30), repeat(7, 31), repeat(8, 31), repeat(9, 30), repeat(10, 31), repeat(11, 30), repeat(12, 31), repeat(1, 7));
var M366MASK = __spreadArrays(repeat(1, 31), repeat(2, 29), repeat(3, 31), repeat(4, 30), repeat(5, 31), repeat(6, 30), repeat(7, 31), repeat(8, 31), repeat(9, 30), repeat(10, 31), repeat(11, 30), repeat(12, 31), repeat(1, 7));
var M28 = range(1, 29);
var M29 = range(1, 30);
var M30 = range(1, 31);
var M31 = range(1, 32);
var MDAY366MASK = __spreadArrays(M31, M29, M31, M30, M31, M30, M31, M31, M30, M31, M30, M31, M31.slice(0, 7));
var MDAY365MASK = __spreadArrays(M31, M28, M31, M30, M31, M30, M31, M31, M30, M31, M30, M31, M31.slice(0, 7));
var NM28 = range(-28, 0);
var NM29 = range(-29, 0);
var NM30 = range(-30, 0);
var NM31 = range(-31, 0);
var NMDAY366MASK = __spreadArrays(NM31, NM29, NM31, NM30, NM31, NM30, NM31, NM31, NM30, NM31, NM30, NM31, NM31.slice(0, 7));
var NMDAY365MASK = __spreadArrays(NM31, NM28, NM31, NM30, NM31, NM30, NM31, NM31, NM30, NM31, NM30, NM31, NM31.slice(0, 7));
var M366RANGE = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366];
var M365RANGE = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365];
var WDAYMASK = function() {
var wdaymask = [];
for (var i = 0; i < 55; i++)
wdaymask = wdaymask.concat(range(7));
return wdaymask;
}();
// node_modules/rrule/dist/esm/src/iterinfo/yearinfo.js
function rebuildYear(year, options) {
var firstyday = new Date(Date.UTC(year, 0, 1));
var yearlen = dateutil_default.isLeapYear(year) ? 366 : 365;
var nextyearlen = dateutil_default.isLeapYear(year + 1) ? 366 : 365;
var yearordinal = dateutil_default.toOrdinal(firstyday);
var yearweekday = dateutil_default.getWeekday(firstyday);
var result = __assign(__assign({
yearlen,
nextyearlen,
yearordinal,
yearweekday
}, baseYearMasks(year)), { wnomask: null });
if (empty(options.byweekno)) {
return result;
}
result.wnomask = repeat(0, yearlen + 7);
var firstwkst;
var wyearlen;
var no1wkst = firstwkst = pymod(7 - yearweekday + options.wkst, 7);
if (no1wkst >= 4) {
no1wkst = 0;
wyearlen = result.yearlen + pymod(yearweekday - options.wkst, 7);
} else {
wyearlen = yearlen - no1wkst;
}
var div = Math.floor(wyearlen / 7);
var mod = pymod(wyearlen, 7);
var numweeks = Math.floor(div + mod / 4);
for (var j = 0; j < options.byweekno.length; j++) {
var n = options.byweekno[j];
if (n < 0) {
n += numweeks + 1;
}
if (!(n > 0 && n <= numweeks)) {
continue;
}
var i = void 0;
if (n > 1) {
i = no1wkst + (n - 1) * 7;
if (no1wkst !== firstwkst) {
i -= 7 - firstwkst;
}
} else {
i = no1wkst;
}
for (var k = 0; k < 7; k++) {
result.wnomask[i] = 1;
i++;
if (result.wdaymask[i] === options.wkst)
break;
}
}
if (includes(options.byweekno, 1)) {
var i = no1wkst + numweeks * 7;
if (no1wkst !== firstwkst)
i -= 7 - firstwkst;
if (i < yearlen) {
for (var j = 0; j < 7; j++) {
result.wnomask[i] = 1;
i += 1;
if (result.wdaymask[i] === options.wkst)
break;
}
}
}
if (no1wkst) {
var lnumweeks = void 0;
if (!includes(options.byweekno, -1)) {
var lyearweekday = dateutil_default.getWeekday(new Date(Date.UTC(year - 1, 0, 1)));
var lno1wkst = pymod(7 - lyearweekday.valueOf() + options.wkst, 7);
var lyearlen = dateutil_default.isLeapYear(year - 1) ? 366 : 365;
var weekst = void 0;
if (lno1wkst >= 4) {
lno1wkst = 0;
weekst = lyearlen + pymod(lyearweekday - options.wkst, 7);
} else {
weekst = yearlen - no1wkst;
}
lnumweeks = Math.floor(52 + pymod(weekst, 7) / 4);
} else {
lnumweeks = -1;
}
if (includes(options.byweekno, lnumweeks)) {
for (var i = 0; i < no1wkst; i++)
result.wnomask[i] = 1;
}
}
return result;
}
function baseYearMasks(year) {
var yearlen = dateutil_default.isLeapYear(year) ? 366 : 365;
var firstyday = new Date(Date.UTC(year, 0, 1));
var wday = dateutil_default.getWeekday(firstyday);
if (yearlen === 365) {
return {
mmask: M365MASK,
mdaymask: MDAY365MASK,
nmdaymask: NMDAY365MASK,
wdaymask: WDAYMASK.slice(wday),
mrange: M365RANGE
};
}
return {
mmask: M366MASK,
mdaymask: MDAY366MASK,
nmdaymask: NMDAY366MASK,
wdaymask: WDAYMASK.slice(wday),
mrange: M366RANGE
};
}
// node_modules/rrule/dist/esm/src/iterinfo/monthinfo.js
function rebuildMonth(year, month, yearlen, mrange, wdaymask, options) {
var result = {
lastyear: year,
lastmonth: month,
nwdaymask: []
};
var ranges = [];
if (options.freq === rrule_default.YEARLY) {
if (empty(options.bymonth)) {
ranges = [[0, yearlen]];
} else {
for (var j = 0; j < options.bymonth.length; j++) {
month = options.bymonth[j];
ranges.push(mrange.slice(month - 1, month + 1));
}
}
} else if (options.freq === rrule_default.MONTHLY) {
ranges = [mrange.slice(month - 1, month + 1)];
}
if (empty(ranges)) {
return result;
}
result.nwdaymask = repeat(0, yearlen);
for (var j = 0; j < ranges.length; j++) {
var rang = ranges[j];
var first = rang[0];
var last = rang[1] - 1;
for (var k = 0; k < options.bynweekday.length; k++) {
var i = void 0;
var _a = options.bynweekday[k], wday = _a[0], n = _a[1];
if (n < 0) {
i = last + (n + 1) * 7;
i -= pymod(wdaymask[i] - wday, 7);
} else {
i = first + (n - 1) * 7;
i += pymod(7 - wdaymask[i] + wday, 7);
}
if (first <= i && i <= last)
result.nwdaymask[i] = 1;
}
}
return result;
}
// node_modules/rrule/dist/esm/src/iterinfo/easter.js
function easter(y, offset) {
if (offset === void 0) {
offset = 0;
}
var a = y % 19;
var b = Math.floor(y / 100);
var c = y % 100;
var d = Math.floor(b / 4);
var e = b % 4;
var f = Math.floor((b + 8) / 25);
var g = Math.floor((b - f + 1) / 3);
var h = Math.floor(19 * a + b - d - g + 15) % 30;
var i = Math.floor(c / 4);
var k = c % 4;
var l = Math.floor(32 + 2 * e + 2 * i - h - k) % 7;
var m = Math.floor((a + 11 * h + 22 * l) / 451);
var month = Math.floor((h + l - 7 * m + 114) / 31);
var day = (h + l - 7 * m + 114) % 31 + 1;
var date = Date.UTC(y, month - 1, day + offset);
var yearStart = Date.UTC(y, 0, 1);
return [Math.ceil((date - yearStart) / (1e3 * 60 * 60 * 24))];
}
// node_modules/rrule/dist/esm/src/iterinfo/index.js
var Iterinfo = function() {
function Iterinfo2(options) {
this.options = options;
}
Iterinfo2.prototype.rebuild = function(year, month) {
var options = this.options;
if (year !== this.lastyear) {
this.yearinfo = rebuildYear(year, options);
}
if (notEmpty(options.bynweekday) && (month !== this.lastmonth || year !== this.lastyear)) {
var _a = this.yearinfo, yearlen = _a.yearlen, mrange = _a.mrange, wdaymask = _a.wdaymask;
this.monthinfo = rebuildMonth(year, month, yearlen, mrange, wdaymask, options);
}
if (isPresent(options.byeaster)) {
this.eastermask = easter(year, options.byeaster);
}
};
Object.defineProperty(Iterinfo2.prototype, "lastyear", {
get: function() {
return this.monthinfo ? this.monthinfo.lastyear : null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "lastmonth", {
get: function() {
return this.monthinfo ? this.monthinfo.lastmonth : null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "yearlen", {
get: function() {
return this.yearinfo.yearlen;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "yearordinal", {
get: function() {
return this.yearinfo.yearordinal;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "mrange", {
get: function() {
return this.yearinfo.mrange;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "wdaymask", {
get: function() {
return this.yearinfo.wdaymask;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "mmask", {
get: function() {
return this.yearinfo.mmask;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "wnomask", {
get: function() {
return this.yearinfo.wnomask;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "nwdaymask", {
get: function() {
return this.monthinfo ? this.monthinfo.nwdaymask : [];
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "nextyearlen", {
get: function() {
return this.yearinfo.nextyearlen;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "mdaymask", {
get: function() {
return this.yearinfo.mdaymask;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Iterinfo2.prototype, "nmdaymask", {
get: function() {
return this.yearinfo.nmdaymask;
},
enumerable: true,
configurable: true
});
Iterinfo2.prototype.ydayset = function() {
return [range(this.yearlen), 0, this.yearlen];
};
Iterinfo2.prototype.mdayset = function(_, month, __) {
var start = this.mrange[month - 1];
var end = this.mrange[month];
var set = repeat(null, this.yearlen);
for (var i = start; i < end; i++)
set[i] = i;
return [set, start, end];
};
Iterinfo2.prototype.wdayset = function(year, month, day) {
var set = repeat(null, this.yearlen + 7);
var i = dateutil_default.toOrdinal(new Date(Date.UTC(year, month - 1, day))) - this.yearordinal;
var start = i;
for (var j = 0; j < 7; j++) {
set[i] = i;
++i;
if (this.wdaymask[i] === this.options.wkst)
break;
}
return [set, start, i];
};
Iterinfo2.prototype.ddayset = function(year, month, day) {
var set = repeat(null, this.yearlen);
var i = dateutil_default.toOrdinal(new Date(Date.UTC(year, month - 1, day))) - this.yearordinal;
set[i] = i;
return [set, i, i + 1];
};
Iterinfo2.prototype.htimeset = function(hour, _, second, millisecond) {
var _this = this;
var set = [];
this.options.byminute.forEach(function(minute) {
set = set.concat(_this.mtimeset(hour, minute, second, millisecond));
});
dateutil_default.sort(set);
return set;
};
Iterinfo2.prototype.mtimeset = function(hour, minute, _, millisecond) {
var set = this.options.bysecond.map(function(second) {
return new Time(hour, minute, second, millisecond);
});
dateutil_default.sort(set);
return set;
};
Iterinfo2.prototype.stimeset = function(hour, minute, second, millisecond) {
return [new Time(hour, minute, second, millisecond)];
};
Iterinfo2.prototype.getdayset = function(freq) {
switch (freq) {
case Frequency.YEARLY:
return this.ydayset.bind(this);
case Frequency.MONTHLY:
return this.mdayset.bind(this);
case Frequency.WEEKLY:
return this.wdayset.bind(this);
case Frequency.DAILY:
return this.ddayset.bind(this);
default:
return this.ddayset.bind(this);
}
};
Iterinfo2.prototype.gettimeset = function(freq) {
switch (freq) {
case Frequency.HOURLY:
return this.htimeset.bind(this);
case Frequency.MINUTELY:
return this.mtimeset.bind(this);
case Frequency.SECONDLY:
return this.stimeset.bind(this);
}
};
return Iterinfo2;
}();
var iterinfo_default = Iterinfo;
// node_modules/rrule/dist/esm/src/iter/poslist.js
function buildPoslist(bysetpos, timeset, start, end, ii, dayset) {
var poslist = [];
for (var j = 0; j < bysetpos.length; j++) {
var daypos = void 0;
var timepos = void 0;
var pos = bysetpos[j];
if (pos < 0) {
daypos = Math.floor(pos / timeset.length);
timepos = pymod(pos, timeset.length);
} else {
daypos = Math.floor((pos - 1) / timeset.length);
timepos = pymod(pos - 1, timeset.length);
}
var tmp = [];
for (var k = start; k < end; k++) {
var val = dayset[k];
if (!isPresent(val))
continue;
tmp.push(val);
}
var i = void 0;
if (daypos < 0) {
i = tmp.slice(daypos)[0];
} else {
i = tmp[daypos];
}
var time = timeset[timepos];
var date = dateutil_default.fromOrdinal(ii.yearordinal + i);
var res = dateutil_default.combine(date, time);
if (!includes(poslist, res))
poslist.push(res);
}
dateutil_default.sort(poslist);
return poslist;
}
// node_modules/rrule/dist/esm/src/iter/index.js
function iter(iterResult, options) {
var dtstart = options.dtstart, freq = options.freq, interval = options.interval, until = options.until, bysetpos = options.bysetpos;
var count = options.count;
if (count === 0 || interval === 0) {
return emitResult(iterResult);
}
var counterDate = DateTime.fromDate(dtstart);
var ii = new iterinfo_default(options);
ii.rebuild(counterDate.year, counterDate.month);
var timeset = makeTimeset(ii, counterDate, options);
while (true) {
var _a = ii.getdayset(freq)(counterDate.year, counterDate.month, counterDate.day), dayset = _a[0], start = _a[1], end = _a[2];
var filtered = removeFilteredDays(dayset, start, end, ii, options);
if (notEmpty(bysetpos)) {
var poslist = buildPoslist(bysetpos, timeset, start, end, ii, dayset);
for (var j = 0; j < poslist.length; j++) {
var res = poslist[j];
if (until && res > until) {
return emitResult(iterResult);
}
if (res >= dtstart) {
var rezonedDate = rezoneIfNeeded(res, options);
if (!iterResult.accept(rezonedDate)) {
return emitResult(iterResult);
}
if (count) {
--count;
if (!count) {
return emitResult(iterResult);
}
}
}
}
} else {
for (var j = start; j < end; j++) {
var currentDay = dayset[j];
if (!isPresent(currentDay)) {
continue;
}
var date = dateutil_default.fromOrdinal(ii.yearordinal + currentDay);
for (var k = 0; k < timeset.length; k++) {
var time = timeset[k];
var res = dateutil_default.combine(date, time);
if (until && res > until) {
return emitResult(iterResult);
}
if (res >= dtstart) {
var rezonedDate = rezoneIfNeeded(res, options);
if (!iterResult.accept(rezonedDate)) {
return emitResult(iterResult);
}
if (count) {
--count;
if (!count) {
return emitResult(iterResult);
}
}
}
}
}
}
if (options.interval === 0) {
return emitResult(iterResult);
}
counterDate.add(options, filtered);
if (counterDate.year > dateutil_default.MAXYEAR) {
return emitResult(iterResult);
}
if (!freqIsDailyOrGreater(freq)) {
timeset = ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, 0);
}
ii.rebuild(counterDate.year, counterDate.month);
}
}
function isFiltered(ii, currentDay, options) {
var bymonth = options.bymonth, byweekno = options.byweekno, byweekday = options.byweekday, byeaster = options.byeaster, bymonthday = options.bymonthday, bynmonthday = options.bynmonthday, byyearday = options.byyearday;
return notEmpty(bymonth) && !includes(bymonth, ii.mmask[currentDay]) || notEmpty(byweekno) && !ii.wnomask[currentDay] || notEmpty(byweekday) && !includes(byweekday, ii.wdaymask[currentDay]) || notEmpty(ii.nwdaymask) && !ii.nwdaymask[currentDay] || byeaster !== null && !includes(ii.eastermask, currentDay) || (notEmpty(bymonthday) || notEmpty(bynmonthday)) && !includes(bymonthday, ii.mdaymask[currentDay]) && !includes(bynmonthday, ii.nmdaymask[currentDay]) || notEmpty(byyearday) && (currentDay < ii.yearlen && !includes(byyearday, currentDay + 1) && !includes(byyearday, -ii.yearlen + currentDay) || currentDay >= ii.yearlen && !includes(byyearday, currentDay + 1 - ii.yearlen) && !includes(byyearday, -ii.nextyearlen + currentDay - ii.yearlen));
}
function rezoneIfNeeded(date, options) {
return new DateWithZone(date, options.tzid).rezonedDate();
}
function emitResult(iterResult) {
return iterResult.getValue();
}
function removeFilteredDays(dayset, start, end, ii, options) {
var filtered = false;
for (var dayCounter = start; dayCounter < end; dayCounter++) {
var currentDay = dayset[dayCounter];
filtered = isFiltered(ii, currentDay, options);
if (filtered)
dayset[currentDay] = null;
}
return filtered;
}
function makeTimeset(ii, counterDate, options) {
var freq = options.freq, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;
if (freqIsDailyOrGreater(freq)) {
return buildTimeset(options);
}
if (freq >= rrule_default.HOURLY && notEmpty(byhour) && !includes(byhour, counterDate.hour) || freq >= rrule_default.MINUTELY && notEmpty(byminute) && !includes(byminute, counterDate.minute) || freq >= rrule_default.SECONDLY && notEmpty(bysecond) && !includes(bysecond, counterDate.second)) {
return [];
}
return ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, counterDate.millisecond);
}
// node_modules/rrule/dist/esm/src/rrule.js
var Days = {
MO: new Weekday(0),
TU: new Weekday(1),
WE: new Weekday(2),
TH: new Weekday(3),
FR: new Weekday(4),
SA: new Weekday(5),
SU: new Weekday(6)
};
var DEFAULT_OPTIONS = {
freq: Frequency.YEARLY,
dtstart: null,
interval: 1,
wkst: Days.MO,
count: null,
until: null,
tzid: null,
bysetpos: null,
bymonth: null,
bymonthday: null,
bynmonthday: null,
byyearday: null,
byweekno: null,
byweekday: null,
bynweekday: null,
byhour: null,
byminute: null,
bysecond: null,
byeaster: null
};
var defaultKeys = Object.keys(DEFAULT_OPTIONS);
var RRule = function() {
function RRule2(options, noCache) {
if (options === void 0) {
options = {};
}
if (noCache === void 0) {
noCache = false;
}
this._cache = noCache ? null : new Cache();
this.origOptions = initializeOptions(options);
var parsedOptions = parseOptions(options).parsedOptions;
this.options = parsedOptions;
}
RRule2.parseText = function(text2, language) {
return parseText(text2, language);
};
RRule2.fromText = function(text2, language) {
return fromText(text2, language);
};
RRule2.fromString = function(str) {
return new RRule2(RRule2.parseString(str) || void 0);
};
RRule2.prototype._iter = function(iterResult) {
return iter(iterResult, this.options);
};
RRule2.prototype._cacheGet = function(what, args) {
if (!this._cache)
return false;
return this._cache._cacheGet(what, args);
};
RRule2.prototype._cacheAdd = function(what, value, args) {
if (!this._cache)
return;
return this._cache._cacheAdd(what, value, args);
};
RRule2.prototype.all = function(iterator) {
if (iterator) {
return this._iter(new callbackiterresult_default("all", {}, iterator));
}
var result = this._cacheGet("all");
if (result === false) {
result = this._iter(new iterresult_default("all", {}));
this._cacheAdd("all", result);
}
return result;
};
RRule2.prototype.between = function(after, before, inc, iterator) {
if (inc === void 0) {
inc = false;
}
if (!dateutil_default.isValidDate(after) || !dateutil_default.isValidDate(before))
throw new Error("Invalid date passed in to RRule.between");
var args = {
before,
after,
inc
};
if (iterator) {
return this._iter(new callbackiterresult_default("between", args, iterator));
}
var result = this._cacheGet("between", args);
if (result === false) {
result = this._iter(new iterresult_default("between", args));
this._cacheAdd("between", result, args);
}
return result;
};
RRule2.prototype.before = function(dt, inc) {
if (inc === void 0) {
inc = false;
}
if (!dateutil_default.isValidDate(dt))
throw new Error("Invalid date passed in to RRule.before");
var args = { dt, inc };
var result = this._cacheGet("before", args);
if (result === false) {
result = this._iter(new iterresult_default("before", args));
this._cacheAdd("before", result, args);
}
return result;
};
RRule2.prototype.after = function(dt, inc) {
if (inc === void 0) {
inc = false;
}
if (!dateutil_default.isValidDate(dt))
throw new Error("Invalid date passed in to RRule.after");
var args = { dt, inc };
var result = this._cacheGet("after", args);
if (result === false) {
result = this._iter(new iterresult_default("after", args));
this._cacheAdd("after", result, args);
}
return result;
};
RRule2.prototype.count = function() {
return this.all().length;
};
RRule2.prototype.toString = function() {
return optionsToString(this.origOptions);
};
RRule2.prototype.toText = function(gettext, language, dateFormatter) {
return toText(this, gettext, language, dateFormatter);
};
RRule2.prototype.isFullyConvertibleToText = function() {
return isFullyConvertible(this);
};
RRule2.prototype.clone = function() {
return new RRule2(this.origOptions);
};
RRule2.FREQUENCIES = [
"YEARLY",
"MONTHLY",
"WEEKLY",
"DAILY",
"HOURLY",
"MINUTELY",
"SECONDLY"
];
RRule2.YEARLY = Frequency.YEARLY;
RRule2.MONTHLY = Frequency.MONTHLY;
RRule2.WEEKLY = Frequency.WEEKLY;
RRule2.DAILY = Frequency.DAILY;
RRule2.HOURLY = Frequency.HOURLY;
RRule2.MINUTELY = Frequency.MINUTELY;
RRule2.SECONDLY = Frequency.SECONDLY;
RRule2.MO = Days.MO;
RRule2.TU = Days.TU;
RRule2.WE = Days.WE;
RRule2.TH = Days.TH;
RRule2.FR = Days.FR;
RRule2.SA = Days.SA;
RRule2.SU = Days.SU;
RRule2.parseString = parseString;
RRule2.optionsToString = optionsToString;
return RRule2;
}();
var rrule_default = RRule;
// node_modules/rrule/dist/esm/src/iterset.js
function iterSet(iterResult, _rrule, _exrule, _rdate, _exdate, tzid) {
var _exdateHash = {};
var _accept = iterResult.accept;
function evalExdate(after, before) {
_exrule.forEach(function(rrule) {
rrule.between(after, before, true).forEach(function(date) {
_exdateHash[Number(date)] = true;
});
});
}
_exdate.forEach(function(date) {
var zonedDate2 = new DateWithZone(date, tzid).rezonedDate();
_exdateHash[Number(zonedDate2)] = true;
});
iterResult.accept = function(date) {
var dt = Number(date);
if (isNaN(dt))
return _accept.call(this, date);
if (!_exdateHash[dt]) {
evalExdate(new Date(dt - 1), new Date(dt + 1));
if (!_exdateHash[dt]) {
_exdateHash[dt] = true;
return _accept.call(this, date);
}
}
return true;
};
if (iterResult.method === "between") {
evalExdate(iterResult.args.after, iterResult.args.before);
iterResult.accept = function(date) {
var dt = Number(date);
if (!_exdateHash[dt]) {
_exdateHash[dt] = true;
return _accept.call(this, date);
}
return true;
};
}
for (var i = 0; i < _rdate.length; i++) {
var zonedDate = new DateWithZone(_rdate[i], tzid).rezonedDate();
if (!iterResult.accept(new Date(zonedDate.getTime())))
break;
}
_rrule.forEach(function(rrule) {
iter(iterResult, rrule.options);
});
var res = iterResult._result;
dateutil_default.sort(res);
switch (iterResult.method) {
case "all":
case "between":
return res;
case "before":
return res.length && res[res.length - 1] || null;
case "after":
default:
return res.length && res[0] || null;
}
}
// node_modules/rrule/dist/esm/src/rrulestr.js
var DEFAULT_OPTIONS2 = {
dtstart: null,
cache: false,
unfold: false,
forceset: false,
compatible: false,
tzid: null
};
function parseInput(s, options) {
var rrulevals = [];
var rdatevals = [];
var exrulevals = [];
var exdatevals = [];
var _a = parseDtstart(s), dtstart = _a.dtstart, tzid = _a.tzid;
var lines = splitIntoLines(s, options.unfold);
lines.forEach(function(line) {
if (!line)
return;
var _a2 = breakDownLine(line), name = _a2.name, parms = _a2.parms, value = _a2.value;
switch (name.toUpperCase()) {
case "RRULE":
if (parms.length) {
throw new Error("unsupported RRULE parm: " + parms.join(","));
}
rrulevals.push(parseString(line));
break;
case "RDATE":
var _b = /RDATE(?:;TZID=([^:=]+))?/i.exec(line), _ = _b[0], rdateTzid = _b[1];
if (rdateTzid && !tzid) {
tzid = rdateTzid;
}
rdatevals = rdatevals.concat(parseRDate(value, parms));
break;
case "EXRULE":
if (parms.length) {
throw new Error("unsupported EXRULE parm: " + parms.join(","));
}
exrulevals.push(parseString(value));
break;
case "EXDATE":
exdatevals = exdatevals.concat(parseRDate(value, parms));
break;
case "DTSTART":
break;
default:
throw new Error("unsupported property: " + name);
}
});
return {
dtstart,
tzid,
rrulevals,
rdatevals,
exrulevals,
exdatevals
};
}
function buildRule(s, options) {
var _a = parseInput(s, options), rrulevals = _a.rrulevals, rdatevals = _a.rdatevals, exrulevals = _a.exrulevals, exdatevals = _a.exdatevals, dtstart = _a.dtstart, tzid = _a.tzid;
var noCache = options.cache === false;
if (options.compatible) {
options.forceset = true;
options.unfold = true;
}
if (options.forceset || rrulevals.length > 1 || rdatevals.length || exrulevals.length || exdatevals.length) {
var rset_1 = new rruleset_default(noCache);
rset_1.dtstart(dtstart);
rset_1.tzid(tzid || void 0);
rrulevals.forEach(function(val2) {
rset_1.rrule(new rrule_default(groomRruleOptions(val2, dtstart, tzid), noCache));
});
rdatevals.forEach(function(date) {
rset_1.rdate(date);
});
exrulevals.forEach(function(val2) {
rset_1.exrule(new rrule_default(groomRruleOptions(val2, dtstart, tzid), noCache));
});
exdatevals.forEach(function(date) {
rset_1.exdate(date);
});
if (options.compatible && options.dtstart)
rset_1.rdate(dtstart);
return rset_1;
}
var val = rrulevals[0] || {};
return new rrule_default(groomRruleOptions(val, val.dtstart || options.dtstart || dtstart, val.tzid || options.tzid || tzid), noCache);
}
function rrulestr(s, options) {
if (options === void 0) {
options = {};
}
return buildRule(s, initializeOptions2(options));
}
function groomRruleOptions(val, dtstart, tzid) {
return __assign(__assign({}, val), {
dtstart,
tzid
});
}
function initializeOptions2(options) {
var invalid = [];
var keys = Object.keys(options);
var defaultKeys2 = Object.keys(DEFAULT_OPTIONS2);
keys.forEach(function(key) {
if (!includes(defaultKeys2, key))
invalid.push(key);
});
if (invalid.length) {
throw new Error("Invalid options: " + invalid.join(", "));
}
return __assign(__assign({}, DEFAULT_OPTIONS2), options);
}
function extractName(line) {
if (line.indexOf(":") === -1) {
return {
name: "RRULE",
value: line
};
}
var _a = split(line, ":", 1), name = _a[0], value = _a[1];
return {
name,
value
};
}
function breakDownLine(line) {
var _a = extractName(line), name = _a.name, value = _a.value;
var parms = name.split(";");
if (!parms)
throw new Error("empty property name");
return {
name: parms[0].toUpperCase(),
parms: parms.slice(1),
value
};
}
function splitIntoLines(s, unfold) {
if (unfold === void 0) {
unfold = false;
}
s = s && s.trim();
if (!s)
throw new Error("Invalid empty string");
if (!unfold) {
return s.split(/\s/);
}
var lines = s.split("\n");
var i = 0;
while (i < lines.length) {
var line = lines[i] = lines[i].replace(/\s+$/g, "");
if (!line) {
lines.splice(i, 1);
} else if (i > 0 && line[0] === " ") {
lines[i - 1] += line.slice(1);
lines.splice(i, 1);
} else {
i += 1;
}
}
return lines;
}
function validateDateParm(parms) {
parms.forEach(function(parm) {
if (!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(parm)) {
throw new Error("unsupported RDATE/EXDATE parm: " + parm);
}
});
}
function parseRDate(rdateval, parms) {
validateDateParm(parms);
return rdateval.split(",").map(function(datestr) {
return dateutil_default.untilStringToDate(datestr);
});
}
// node_modules/rrule/dist/esm/src/rruleset.js
function createGetterSetter(fieldName) {
var _this = this;
return function(field) {
if (field !== void 0) {
_this["_" + fieldName] = field;
}
if (_this["_" + fieldName] !== void 0) {
return _this["_" + fieldName];
}
for (var i = 0; i < _this._rrule.length; i++) {
var field_1 = _this._rrule[i].origOptions[fieldName];
if (field_1) {
return field_1;
}
}
};
}
var RRuleSet = function(_super) {
__extends(RRuleSet2, _super);
function RRuleSet2(noCache) {
if (noCache === void 0) {
noCache = false;
}
var _this = _super.call(this, {}, noCache) || this;
_this.dtstart = createGetterSetter.apply(_this, ["dtstart"]);
_this.tzid = createGetterSetter.apply(_this, ["tzid"]);
_this._rrule = [];
_this._rdate = [];
_this._exrule = [];
_this._exdate = [];
return _this;
}
RRuleSet2.prototype._iter = function(iterResult) {
return iterSet(iterResult, this._rrule, this._exrule, this._rdate, this._exdate, this.tzid());
};
RRuleSet2.prototype.rrule = function(rrule) {
_addRule(rrule, this._rrule);
};
RRuleSet2.prototype.exrule = function(rrule) {
_addRule(rrule, this._exrule);
};
RRuleSet2.prototype.rdate = function(date) {
_addDate(date, this._rdate);
};
RRuleSet2.prototype.exdate = function(date) {
_addDate(date, this._exdate);
};
RRuleSet2.prototype.rrules = function() {
return this._rrule.map(function(e) {
return rrulestr(e.toString());
});
};
RRuleSet2.prototype.exrules = function() {
return this._exrule.map(function(e) {
return rrulestr(e.toString());
});
};
RRuleSet2.prototype.rdates = function() {
return this._rdate.map(function(e) {
return new Date(e.getTime());
});
};
RRuleSet2.prototype.exdates = function() {
return this._exdate.map(function(e) {
return new Date(e.getTime());
});
};
RRuleSet2.prototype.valueOf = function() {
var result = [];
if (!this._rrule.length && this._dtstart) {
result = result.concat(optionsToString({ dtstart: this._dtstart }));
}
this._rrule.forEach(function(rrule) {
result = result.concat(rrule.toString().split("\n"));
});
this._exrule.forEach(function(exrule) {
result = result.concat(exrule.toString().split("\n").map(function(line) {
return line.replace(/^RRULE:/, "EXRULE:");
}).filter(function(line) {
return !/^DTSTART/.test(line);
}));
});
if (this._rdate.length) {
result.push(rdatesToString("RDATE", this._rdate, this.tzid()));
}
if (this._exdate.length) {
result.push(rdatesToString("EXDATE", this._exdate, this.tzid()));
}
return result;
};
RRuleSet2.prototype.toString = function() {
return this.valueOf().join("\n");
};
RRuleSet2.prototype.clone = function() {
var rrs = new RRuleSet2(!!this._cache);
this._rrule.forEach(function(rule) {
return rrs.rrule(rule.clone());
});
this._exrule.forEach(function(rule) {
return rrs.exrule(rule.clone());
});
this._rdate.forEach(function(date) {
return rrs.rdate(new Date(date.getTime()));
});
this._exdate.forEach(function(date) {
return rrs.exdate(new Date(date.getTime()));
});
return rrs;
};
return RRuleSet2;
}(rrule_default);
var rruleset_default = RRuleSet;
function _addRule(rrule, collection) {
if (!(rrule instanceof rrule_default)) {
throw new TypeError(String(rrule) + " is not RRule instance");
}
if (!includes(collection.map(String), String(rrule))) {
collection.push(rrule);
}
}
function _addDate(date, collection) {
if (!(date instanceof Date)) {
throw new TypeError(String(date) + " is not Date instance");
}
if (!includes(collection.map(Number), Number(date))) {
collection.push(date);
dateutil_default.sort(collection);
}
}
function rdatesToString(param, rdates, tzid) {
var isUTC = !tzid || tzid.toUpperCase() === "UTC";
var header = isUTC ? param + ":" : param + ";TZID=" + tzid + ":";
var dateString = rdates.map(function(rdate) {
return dateutil_default.timeToUntilString(rdate.valueOf(), isUTC);
}).join(",");
return "" + header + dateString;
}
// node_modules/rrule/dist/esm/src/index.js
var src_default = rrule_default;
// src/Recurrence.ts
var Recurrence = class {
constructor({
rrule,
baseOnToday,
referenceDate,
startDate,
scheduledDate,
dueDate
}) {
this.rrule = rrule;
this.baseOnToday = baseOnToday;
this.referenceDate = referenceDate;
this.startDate = startDate;
this.scheduledDate = scheduledDate;
this.dueDate = dueDate;
}
static fromText({
recurrenceRuleText,
startDate,
scheduledDate,
dueDate
}) {
try {
const match = recurrenceRuleText.match(/^([a-zA-Z0-9, !]+?)( when done)?$/i);
if (match == null) {
return null;
}
const isolatedRuleText = match[1].trim();
const baseOnToday = match[2] !== void 0;
const options = rrule_default.parseText(isolatedRuleText);
if (options !== null) {
let referenceDate = null;
if (dueDate) {
referenceDate = window.moment(dueDate);
} else if (scheduledDate) {
referenceDate = window.moment(scheduledDate);
} else if (startDate) {
referenceDate = window.moment(startDate);
}
if (!baseOnToday && referenceDate !== null) {
options.dtstart = window.moment(referenceDate).startOf("day").utc(true).toDate();
} else {
options.dtstart = window.moment().startOf("day").utc(true).toDate();
}
const rrule = new rrule_default(options);
return new Recurrence({
rrule,
baseOnToday,
referenceDate,
startDate,
scheduledDate,
dueDate
});
}
} catch (error) {
}
return null;
}
toText() {
let text2 = this.rrule.toText();
if (this.baseOnToday) {
text2 += " when done";
}
return text2;
}
next() {
var _a;
let next;
if (this.baseOnToday) {
const today = window.moment();
const ruleBasedOnToday = new rrule_default(__spreadProps(__spreadValues({}, this.rrule.origOptions), {
dtstart: today.startOf("day").utc(true).toDate()
}));
next = ruleBasedOnToday.after(today.endOf("day").utc(true).toDate());
} else {
const after = window.moment((_a = this.referenceDate) != null ? _a : void 0).endOf("day").utc(true);
next = this.rrule.after(after.toDate());
}
if (next !== null) {
const localTimeZone = window.moment.utc(next).local(true);
const nextOccurrence = localTimeZone.startOf("day");
let startDate = null;
let scheduledDate = null;
let dueDate = null;
if (this.referenceDate) {
if (this.startDate) {
const originalDifference = window.moment.duration(this.startDate.diff(this.referenceDate));
startDate = window.moment(nextOccurrence);
startDate.add(Math.round(originalDifference.asDays()), "days");
}
if (this.scheduledDate) {
const originalDifference = window.moment.duration(this.scheduledDate.diff(this.referenceDate));
scheduledDate = window.moment(nextOccurrence);
scheduledDate.add(Math.round(originalDifference.asDays()), "days");
}
if (this.dueDate) {
const originalDifference = window.moment.duration(this.dueDate.diff(this.referenceDate));
dueDate = window.moment(nextOccurrence);
dueDate.add(Math.round(originalDifference.asDays()), "days");
}
}
return {
startDate,
scheduledDate,
dueDate
};
}
return null;
}
};
// src/Urgency.ts
var _Urgency = class {
static calculate(task) {
let urgency = 0;
if (task.dueDate !== null) {
const daysOverdue = window.moment().diff(task.dueDate) / _Urgency.milliSecondsPerDay;
let dueMultiplier;
if (daysOverdue >= 7) {
dueMultiplier = 1;
} else if (daysOverdue >= -14) {
dueMultiplier = (daysOverdue + 14) * 0.8 / 21 + 0.2;
} else {
dueMultiplier = 0.2;
}
urgency += dueMultiplier * _Urgency.dueCoefficient;
}
if (task.scheduledDate !== null) {
if (window.moment().isSameOrAfter(task.scheduledDate)) {
urgency += 1 * _Urgency.scheduledCoefficient;
}
}
if (task.startDate !== null) {
if (window.moment().isBefore(task.startDate)) {
urgency += 1 * _Urgency.startedCoefficient;
}
}
switch (task.priority) {
case "1":
urgency += 1 * _Urgency.priorityCoefficient;
break;
case "2":
urgency += 0.65 * _Urgency.priorityCoefficient;
break;
case "3":
urgency += 0.325 * _Urgency.priorityCoefficient;
break;
}
return urgency;
}
};
var Urgency = _Urgency;
Urgency.dueCoefficient = 12;
Urgency.scheduledCoefficient = 5;
Urgency.startedCoefficient = -3;
Urgency.priorityCoefficient = 6;
Urgency.milliSecondsPerDay = 1e3 * 60 * 60 * 24;
// src/Task.ts
var Status;
(function(Status2) {
Status2["Todo"] = "Todo";
Status2["Done"] = "Done";
})(Status || (Status = {}));
var Priority;
(function(Priority2) {
Priority2["High"] = "1";
Priority2["Medium"] = "2";
Priority2["None"] = "3";
Priority2["Low"] = "4";
})(Priority || (Priority = {}));
var _Task = class {
constructor({
status,
description,
path,
indentation,
sectionStart,
sectionIndex,
originalStatusCharacter,
precedingHeader,
priority,
startDate,
scheduledDate,
dueDate,
doneDate,
recurrence,
blockLink,
tags
}) {
this._urgency = null;
this.status = status;
this.description = description;
this.path = path;
this.indentation = indentation;
this.sectionStart = sectionStart;
this.sectionIndex = sectionIndex;
this.originalStatusCharacter = originalStatusCharacter;
this.precedingHeader = precedingHeader;
this.tags = tags;
this.priority = priority;
this.startDate = startDate;
this.scheduledDate = scheduledDate;
this.dueDate = dueDate;
this.doneDate = doneDate;
this.recurrence = recurrence;
this.blockLink = blockLink;
}
static fromLine({
line,
path,
sectionStart,
sectionIndex,
precedingHeader
}) {
const regexMatch = line.match(_Task.taskRegex);
if (regexMatch === null) {
return null;
}
const body = regexMatch[3].trim();
const { globalFilter } = getSettings();
if (!body.includes(globalFilter)) {
return null;
}
let description = body;
const indentation = regexMatch[1];
const statusString = regexMatch[2].toLowerCase();
let status;
switch (statusString) {
case " ":
status = Status.Todo;
break;
default:
status = Status.Done;
}
const blockLinkMatch = description.match(this.blockLinkRegex);
const blockLink = blockLinkMatch !== null ? blockLinkMatch[0] : "";
if (blockLink !== "") {
description = description.replace(this.blockLinkRegex, "").trim();
}
let matched;
let priority = Priority.None;
let startDate = null;
let scheduledDate = null;
let dueDate = null;
let doneDate = null;
let recurrence = null;
let tags = [];
const maxRuns = 7;
let runs = 0;
do {
matched = false;
const priorityMatch = description.match(_Task.priorityRegex);
if (priorityMatch !== null) {
switch (priorityMatch[1]) {
case "\u{1F53D}":
priority = Priority.Low;
break;
case "\u{1F53C}":
priority = Priority.Medium;
break;
case "\u23EB":
priority = Priority.High;
break;
}
description = description.replace(_Task.priorityRegex, "").trim();
matched = true;
}
const doneDateMatch = description.match(_Task.doneDateRegex);
if (doneDateMatch !== null) {
doneDate = window.moment(doneDateMatch[1], _Task.dateFormat);
description = description.replace(_Task.doneDateRegex, "").trim();
matched = true;
}
const dueDateMatch = description.match(_Task.dueDateRegex);
if (dueDateMatch !== null) {
dueDate = window.moment(dueDateMatch[1], _Task.dateFormat);
description = description.replace(_Task.dueDateRegex, "").trim();
matched = true;
}
const scheduledDateMatch = description.match(_Task.scheduledDateRegex);
if (scheduledDateMatch !== null) {
scheduledDate = window.moment(scheduledDateMatch[1], _Task.dateFormat);
description = description.replace(_Task.scheduledDateRegex, "").trim();
matched = true;
}
const startDateMatch = description.match(_Task.startDateRegex);
if (startDateMatch !== null) {
startDate = window.moment(startDateMatch[1], _Task.dateFormat);
description = description.replace(_Task.startDateRegex, "").trim();
matched = true;
}
const recurrenceMatch = description.match(_Task.recurrenceRegex);
if (recurrenceMatch !== null) {
recurrence = Recurrence.fromText({
recurrenceRuleText: recurrenceMatch[1].trim(),
startDate,
scheduledDate,
dueDate
});
description = description.replace(_Task.recurrenceRegex, "").trim();
matched = true;
}
runs++;
} while (matched && runs <= maxRuns);
const hashTagMatch = description.match(this.hashTags);
if (hashTagMatch !== null) {
tags = hashTagMatch.filter((tag) => tag !== globalFilter).map((tag) => tag.trim());
}
const task = new _Task({
status,
description,
path,
indentation,
sectionStart,
sectionIndex,
originalStatusCharacter: statusString,
precedingHeader,
priority,
startDate,
scheduledDate,
dueDate,
doneDate,
recurrence,
blockLink,
tags
});
return task;
}
toLi(_0) {
return __async(this, arguments, function* ({
parentUlElement,
listIndex,
layoutOptions,
isFilenameUnique
}) {
const li = parentUlElement.createEl("li");
li.addClasses(["task-list-item", "plugin-tasks-list-item"]);
let taskAsString = this.toString(layoutOptions);
const { globalFilter, removeGlobalFilter } = getSettings();
if (removeGlobalFilter) {
taskAsString = taskAsString.replace(globalFilter, "").trim();
}
const textSpan = li.createSpan();
textSpan.addClass("tasks-list-text");
yield import_obsidian2.MarkdownRenderer.renderMarkdown(taskAsString, textSpan, this.path, null);
const blockQuote = textSpan.querySelector("blockquote");
const directParentOfPTag = blockQuote != null ? blockQuote : textSpan;
const pElement = directParentOfPTag.querySelector("p");
if (pElement !== null) {
while (pElement.firstChild) {
directParentOfPTag.insertBefore(pElement.firstChild, pElement);
}
pElement.remove();
}
textSpan.findAll("p").forEach((pElement2) => {
if (!pElement2.hasChildNodes()) {
pElement2.remove();
}
});
textSpan.findAll(".footnotes").forEach((footnoteElement) => {
footnoteElement.remove();
});
const checkbox = li.createEl("input");
checkbox.addClass("task-list-item-checkbox");
checkbox.type = "checkbox";
if (this.status !== Status.Todo) {
checkbox.checked = true;
li.addClass("is-checked");
}
checkbox.onClickEvent((event) => {
event.preventDefault();
event.stopPropagation();
checkbox.disabled = true;
const toggledTasks = this.toggle();
replaceTaskWithTasks({
originalTask: this,
newTasks: toggledTasks
});
});
li.prepend(checkbox);
li.setAttr("data-task", this.originalStatusCharacter.trim());
li.setAttr("data-line", listIndex);
checkbox.setAttr("data-line", listIndex);
if (layoutOptions == null ? void 0 : layoutOptions.shortMode) {
this.addTooltip({ element: textSpan, isFilenameUnique });
}
return li;
});
}
toString(layoutOptions) {
var _a;
layoutOptions = layoutOptions != null ? layoutOptions : new LayoutOptions();
let taskString = this.description;
if (!layoutOptions.hidePriority) {
let priority = "";
if (this.priority === Priority.High) {
priority = " \u23EB";
} else if (this.priority === Priority.Medium) {
priority = " \u{1F53C}";
} else if (this.priority === Priority.Low) {
priority = " \u{1F53D}";
}
taskString += priority;
}
if (!layoutOptions.hideRecurrenceRule && this.recurrence) {
const recurrenceRule = layoutOptions.shortMode ? " \u{1F501}" : ` \u{1F501} ${this.recurrence.toText()}`;
taskString += recurrenceRule;
}
if (!layoutOptions.hideStartDate && this.startDate) {
const startDate = layoutOptions.shortMode ? " \u{1F6EB}" : ` \u{1F6EB} ${this.startDate.format(_Task.dateFormat)}`;
taskString += startDate;
}
if (!layoutOptions.hideScheduledDate && this.scheduledDate) {
const scheduledDate = layoutOptions.shortMode ? " \u23F3" : ` \u23F3 ${this.scheduledDate.format(_Task.dateFormat)}`;
taskString += scheduledDate;
}
if (!layoutOptions.hideDueDate && this.dueDate) {
const dueDate = layoutOptions.shortMode ? " \u{1F4C5}" : ` \u{1F4C5} ${this.dueDate.format(_Task.dateFormat)}`;
taskString += dueDate;
}
if (!layoutOptions.hideDoneDate && this.doneDate) {
const doneDate = layoutOptions.shortMode ? " \u2705" : ` \u2705 ${this.doneDate.format(_Task.dateFormat)}`;
taskString += doneDate;
}
const blockLink = (_a = this.blockLink) != null ? _a : "";
taskString += blockLink;
return taskString;
}
toFileLineString() {
return `${this.indentation}- [${this.originalStatusCharacter}] ${this.toString()}`;
}
toggle() {
const newStatus = this.status === Status.Todo ? Status.Done : Status.Todo;
let newDoneDate = null;
let nextOccurrence = null;
if (newStatus !== Status.Todo) {
const { setDoneDate } = getSettings();
if (setDoneDate) {
newDoneDate = window.moment();
}
if (this.recurrence !== null) {
nextOccurrence = this.recurrence.next();
}
}
const toggledTask = new _Task(__spreadProps(__spreadValues({}, this), {
status: newStatus,
doneDate: newDoneDate,
originalStatusCharacter: newStatus === Status.Done ? "x" : " "
}));
const newTasks = [];
if (nextOccurrence !== null) {
const nextTask = new _Task(__spreadProps(__spreadValues(__spreadValues({}, this), nextOccurrence), {
blockLink: ""
}));
newTasks.push(nextTask);
}
newTasks.push(toggledTask);
return newTasks;
}
get urgency() {
if (this._urgency === null) {
this._urgency = Urgency.calculate(this);
}
return this._urgency;
}
get filename() {
const fileNameMatch = this.path.match(/([^/]+)\.md$/);
if (fileNameMatch !== null) {
return fileNameMatch[1];
} else {
return null;
}
}
getLinkText({
isFilenameUnique
}) {
let linkText;
if (isFilenameUnique) {
linkText = this.filename;
} else {
linkText = "/" + this.path;
}
if (linkText === null) {
return null;
}
if (this.precedingHeader !== null && this.precedingHeader !== linkText) {
linkText = linkText + " > " + this.precedingHeader;
}
return linkText;
}
addTooltip({
element: element2,
isFilenameUnique
}) {
element2.addEventListener("mouseenter", () => {
const tooltip = element2.createDiv();
tooltip.addClasses(["tooltip", "mod-right"]);
if (this.recurrence) {
const recurrenceDiv = tooltip.createDiv();
recurrenceDiv.setText(`\u{1F501} ${this.recurrence.toText()}`);
}
if (this.startDate) {
const startDateDiv = tooltip.createDiv();
startDateDiv.setText(_Task.toTooltipDate({
signifier: "\u{1F6EB}",
date: this.startDate
}));
}
if (this.scheduledDate) {
const scheduledDateDiv = tooltip.createDiv();
scheduledDateDiv.setText(_Task.toTooltipDate({
signifier: "\u23F3",
date: this.scheduledDate
}));
}
if (this.dueDate) {
const dueDateDiv = tooltip.createDiv();
dueDateDiv.setText(_Task.toTooltipDate({
signifier: "\u{1F4C5}",
date: this.dueDate
}));
}
if (this.doneDate) {
const doneDateDiv = tooltip.createDiv();
doneDateDiv.setText(_Task.toTooltipDate({
signifier: "\u2705",
date: this.doneDate
}));
}
const linkText = this.getLinkText({ isFilenameUnique });
if (linkText) {
const backlinkDiv = tooltip.createDiv();
backlinkDiv.setText(`\u{1F517} ${linkText}`);
}
element2.addEventListener("mouseleave", () => {
tooltip.remove();
});
});
}
static toTooltipDate({
signifier,
date
}) {
return `${signifier} ${date.format(_Task.dateFormat)} (${date.from(window.moment().startOf("day"))})`;
}
};
var Task = _Task;
Task.dateFormat = "YYYY-MM-DD";
Task.taskRegex = /^([\s\t]*)[-*] +\[(.)\] *(.*)/u;
Task.blockLinkRegex = / \^[a-zA-Z0-9-]+$/u;
Task.priorityRegex = /([⏫🔼🔽])$/u;
Task.startDateRegex = /🛫 ?(\d{4}-\d{2}-\d{2})$/u;
Task.scheduledDateRegex = /[⏳⌛] ?(\d{4}-\d{2}-\d{2})$/u;
Task.dueDateRegex = /[📅📆🗓] ?(\d{4}-\d{2}-\d{2})$/u;
Task.doneDateRegex = /✅ ?(\d{4}-\d{2}-\d{2})$/u;
Task.recurrenceRegex = /🔁 ?([a-zA-Z0-9, !]+)$/iu;
Task.hashTags = /(^|\s)#[^ !@#$%^&*(),.?":{}|<>]*/g;
// src/Cache.ts
var State;
(function(State2) {
State2["Cold"] = "Cold";
State2["Initializing"] = "Initializing";
State2["Warm"] = "Warm";
})(State || (State = {}));
var Cache2 = class {
constructor({
metadataCache: metadataCache2,
vault: vault2,
events
}) {
this.metadataCache = metadataCache2;
this.metadataCacheEventReferences = [];
this.vault = vault2;
this.vaultEventReferences = [];
this.events = events;
this.eventsEventReferences = [];
this.tasksMutex = new Mutex();
this.state = State.Cold;
this.tasks = [];
this.loadedAfterFirstResolve = false;
this.subscribeToCache();
this.subscribeToVault();
this.subscribeToEvents();
this.loadVault();
}
unload() {
for (const eventReference of this.metadataCacheEventReferences) {
this.metadataCache.offref(eventReference);
}
for (const eventReference of this.vaultEventReferences) {
this.vault.offref(eventReference);
}
for (const eventReference of this.eventsEventReferences) {
this.events.off(eventReference);
}
}
getTasks() {
return this.tasks;
}
getState() {
return this.state;
}
notifySubscribers() {
this.events.triggerCacheUpdate({
tasks: this.tasks,
state: this.state
});
}
subscribeToCache() {
const resolvedEventeReference = this.metadataCache.on("resolved", () => __async(this, null, function* () {
if (!this.loadedAfterFirstResolve) {
this.loadedAfterFirstResolve = true;
this.loadVault();
}
}));
this.metadataCacheEventReferences.push(resolvedEventeReference);
const changedEventReference = this.metadataCache.on("changed", (file) => {
this.tasksMutex.runExclusive(() => {
this.indexFile(file);
});
});
this.metadataCacheEventReferences.push(changedEventReference);
}
subscribeToVault() {
const createdEventReference = this.vault.on("create", (file) => {
if (!(file instanceof import_obsidian3.TFile)) {
return;
}
this.tasksMutex.runExclusive(() => {
this.indexFile(file);
});
});
this.vaultEventReferences.push(createdEventReference);
const deletedEventReference = this.vault.on("delete", (file) => {
if (!(file instanceof import_obsidian3.TFile)) {
return;
}
this.tasksMutex.runExclusive(() => {
this.tasks = this.tasks.filter((task) => {
return task.path !== file.path;
});
this.notifySubscribers();
});
});
this.vaultEventReferences.push(deletedEventReference);
const renamedEventReference = this.vault.on("rename", (file, oldPath) => {
if (!(file instanceof import_obsidian3.TFile)) {
return;
}
this.tasksMutex.runExclusive(() => {
this.tasks = this.tasks.map((task) => {
if (task.path === oldPath) {
return new Task(__spreadProps(__spreadValues({}, task), { path: file.path }));
} else {
return task;
}
});
this.notifySubscribers();
});
});
this.vaultEventReferences.push(renamedEventReference);
}
subscribeToEvents() {
const requestReference = this.events.onRequestCacheUpdate((handler) => {
handler({ tasks: this.tasks, state: this.state });
});
this.eventsEventReferences.push(requestReference);
}
loadVault() {
return this.tasksMutex.runExclusive(() => __async(this, null, function* () {
this.state = State.Initializing;
yield Promise.all(this.vault.getMarkdownFiles().map((file) => {
return this.indexFile(file);
}));
this.state = State.Warm;
this.notifySubscribers();
}));
}
indexFile(file) {
return __async(this, null, function* () {
const fileCache = this.metadataCache.getFileCache(file);
if (fileCache === null || fileCache === void 0) {
return;
}
let listItems = fileCache.listItems;
if (listItems === void 0) {
listItems = [];
}
const fileContent = yield this.vault.cachedRead(file);
const fileLines = fileContent.split("\n");
this.tasks = this.tasks.filter((task) => {
return task.path !== file.path;
});
let currentSection = null;
let sectionIndex = 0;
for (const listItem of listItems) {
if (listItem.task !== void 0) {
if (currentSection === null || currentSection.position.end.line < listItem.position.start.line) {
currentSection = this.getSection({
lineNumberTask: listItem.position.start.line,
sections: fileCache.sections
});
sectionIndex = 0;
}
if (currentSection === null) {
continue;
}
const line = fileLines[listItem.position.start.line];
const task = Task.fromLine({
line,
path: file.path,
sectionStart: currentSection.position.start.line,
sectionIndex,
precedingHeader: this.getPrecedingHeader({
lineNumberTask: listItem.position.start.line,
sections: fileCache.sections,
fileLines
})
});
if (task !== null) {
sectionIndex++;
this.tasks.push(task);
}
}
}
this.notifySubscribers();
});
}
getSection({
lineNumberTask,
sections
}) {
if (sections === void 0) {
return null;
}
for (const section of sections) {
if (section.type === "list" && section.position.start.line <= lineNumberTask && section.position.end.line >= lineNumberTask) {
return section;
}
}
return null;
}
getPrecedingHeader({
lineNumberTask,
sections,
fileLines
}) {
if (sections === void 0) {
return null;
}
let precedingHeaderSection;
for (const section of sections) {
if (section.type === "heading") {
if (section.position.start.line > lineNumberTask) {
break;
}
precedingHeaderSection = section;
}
}
if (precedingHeaderSection === void 0) {
return null;
}
const lineNumberPrecedingHeader = precedingHeaderSection.position.start.line;
const linePrecedingHeader = fileLines[lineNumberPrecedingHeader];
const headerRegex = /^#+ +(.*)/u;
const headerMatch = linePrecedingHeader.match(headerRegex);
if (headerMatch === null) {
return null;
} else {
return headerMatch[1];
}
}
};
// src/Commands/CreateOrEdit.ts
var import_obsidian5 = __toModule(require("obsidian"));
// src/TaskModal.ts
var import_obsidian4 = __toModule(require("obsidian"));
// node_modules/svelte/internal/index.mjs
function noop() {
}
function run(fn) {
return fn();
}
function blank_object() {
return Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === "function";
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || (a && typeof a === "object" || typeof a === "function");
}
function is_empty(obj) {
return Object.keys(obj).length === 0;
}
var tasks = new Set();
var is_hydrating = false;
function start_hydrating() {
is_hydrating = true;
}
function end_hydrating() {
is_hydrating = false;
}
function append(target, node) {
target.appendChild(node);
}
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
function detach(node) {
node.parentNode.removeChild(node);
}
function element(name) {
return document.createElement(name);
}
function text(data) {
return document.createTextNode(data);
}
function space() {
return text(" ");
}
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
function prevent_default(fn) {
return function(event) {
event.preventDefault();
return fn.call(this, event);
};
}
function attr(node, attribute, value) {
if (value == null)
node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value)
node.setAttribute(attribute, value);
}
function children(element2) {
return Array.from(element2.childNodes);
}
function set_data(text2, data) {
data = "" + data;
if (text2.wholeText !== data)
text2.data = data;
}
function set_input_value(input, value) {
input.value = value == null ? "" : value;
}
function select_option(select, value) {
for (let i = 0; i < select.options.length; i += 1) {
const option = select.options[i];
if (option.__value === value) {
option.selected = true;
return;
}
}
select.selectedIndex = -1;
}
function select_value(select) {
const selected_option = select.querySelector(":checked") || select.options[0];
return selected_option && selected_option.__value;
}
var HtmlTag = class {
constructor() {
this.e = this.n = null;
}
c(html) {
this.h(html);
}
m(html, target, anchor = null) {
if (!this.e) {
this.e = element(target.nodeName);
this.t = target;
this.c(html);
}
this.i(anchor);
}
h(html) {
this.e.innerHTML = html;
this.n = Array.from(this.e.childNodes);
}
i(anchor) {
for (let i = 0; i < this.n.length; i += 1) {
insert(this.t, this.n[i], anchor);
}
}
p(html) {
this.d();
this.h(html);
this.i(this.a);
}
d() {
this.n.forEach(detach);
}
};
var active_docs = new Set();
var current_component;
function set_current_component(component) {
current_component = component;
}
function get_current_component() {
if (!current_component)
throw new Error("Function called outside component initialization");
return current_component;
}
function onMount(fn) {
get_current_component().$$.on_mount.push(fn);
}
var dirty_components = [];
var binding_callbacks = [];
var render_callbacks = [];
var flush_callbacks = [];
var resolved_promise = Promise.resolve();
var update_scheduled = false;
function schedule_update() {
if (!update_scheduled) {
update_scheduled = true;
resolved_promise.then(flush);
}
}
function add_render_callback(fn) {
render_callbacks.push(fn);
}
var flushing = false;
var seen_callbacks = new Set();
function flush() {
if (flushing)
return;
flushing = true;
do {
for (let i = 0; i < dirty_components.length; i += 1) {
const component = dirty_components[i];
set_current_component(component);
update(component.$$);
}
set_current_component(null);
dirty_components.length = 0;
while (binding_callbacks.length)
binding_callbacks.pop()();
for (let i = 0; i < render_callbacks.length; i += 1) {
const callback = render_callbacks[i];
if (!seen_callbacks.has(callback)) {
seen_callbacks.add(callback);
callback();
}
}
render_callbacks.length = 0;
} while (dirty_components.length);
while (flush_callbacks.length) {
flush_callbacks.pop()();
}
update_scheduled = false;
flushing = false;
seen_callbacks.clear();
}
function update($$) {
if ($$.fragment !== null) {
$$.update();
run_all($$.before_update);
const dirty = $$.dirty;
$$.dirty = [-1];
$$.fragment && $$.fragment.p($$.ctx, dirty);
$$.after_update.forEach(add_render_callback);
}
}
var outroing = new Set();
function transition_in(block, local) {
if (block && block.i) {
outroing.delete(block);
block.i(local);
}
}
var globals = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : global;
var boolean_attributes = new Set([
"allowfullscreen",
"allowpaymentrequest",
"async",
"autofocus",
"autoplay",
"checked",
"controls",
"default",
"defer",
"disabled",
"formnovalidate",
"hidden",
"ismap",
"loop",
"multiple",
"muted",
"nomodule",
"novalidate",
"open",
"playsinline",
"readonly",
"required",
"reversed",
"selected"
]);
function mount_component(component, target, anchor, customElement) {
const { fragment, on_mount, on_destroy, after_update } = component.$$;
fragment && fragment.m(target, anchor);
if (!customElement) {
add_render_callback(() => {
const new_on_destroy = on_mount.map(run).filter(is_function);
if (on_destroy) {
on_destroy.push(...new_on_destroy);
} else {
run_all(new_on_destroy);
}
component.$$.on_mount = [];
});
}
after_update.forEach(add_render_callback);
}
function destroy_component(component, detaching) {
const $$ = component.$$;
if ($$.fragment !== null) {
run_all($$.on_destroy);
$$.fragment && $$.fragment.d(detaching);
$$.on_destroy = $$.fragment = null;
$$.ctx = [];
}
}
function make_dirty(component, i) {
if (component.$$.dirty[0] === -1) {
dirty_components.push(component);
schedule_update();
component.$$.dirty.fill(0);
}
component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
}
function init(component, options, instance2, create_fragment2, not_equal, props, append_styles, dirty = [-1]) {
const parent_component = current_component;
set_current_component(component);
const $$ = component.$$ = {
fragment: null,
ctx: null,
props,
update: noop,
not_equal,
bound: blank_object(),
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
callbacks: blank_object(),
dirty,
skip_bound: false,
root: options.target || parent_component.$$.root
};
append_styles && append_styles($$.root);
let ready = false;
$$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => {
const value = rest.length ? rest[0] : ret;
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
if (!$$.skip_bound && $$.bound[i])
$$.bound[i](value);
if (ready)
make_dirty(component, i);
}
return ret;
}) : [];
$$.update();
ready = true;
run_all($$.before_update);
$$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false;
if (options.target) {
if (options.hydrate) {
start_hydrating();
const nodes = children(options.target);
$$.fragment && $$.fragment.l(nodes);
nodes.forEach(detach);
} else {
$$.fragment && $$.fragment.c();
}
if (options.intro)
transition_in(component.$$.fragment);
mount_component(component, options.target, options.anchor, options.customElement);
end_hydrating();
flush();
}
set_current_component(parent_component);
}
var SvelteElement;
if (typeof HTMLElement === "function") {
SvelteElement = class extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open" });
}
connectedCallback() {
const { on_mount } = this.$$;
this.$$.on_disconnect = on_mount.map(run).filter(is_function);
for (const key in this.$$.slotted) {
this.appendChild(this.$$.slotted[key]);
}
}
attributeChangedCallback(attr2, _oldValue, newValue) {
this[attr2] = newValue;
}
disconnectedCallback() {
run_all(this.$$.on_disconnect);
}
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
$on(type, callback) {
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
callbacks.push(callback);
return () => {
const index = callbacks.indexOf(callback);
if (index !== -1)
callbacks.splice(index, 1);
};
}
$set($$props) {
if (this.$$set && !is_empty($$props)) {
this.$$.skip_bound = true;
this.$$set($$props);
this.$$.skip_bound = false;
}
}
};
}
var SvelteComponent = class {
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
$on(type, callback) {
const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
callbacks.push(callback);
return () => {
const index = callbacks.indexOf(callback);
if (index !== -1)
callbacks.splice(index, 1);
};
}
$set($$props) {
if (this.$$set && !is_empty($$props)) {
this.$$.skip_bound = true;
this.$$set($$props);
this.$$.skip_bound = false;
}
}
};
// src/ui/EditTask.svelte
var import_chrono_node = __toModule(require_dist());
function create_fragment(ctx) {
let div12;
let form;
let div0;
let label0;
let t1;
let input0;
let t2;
let hr0;
let t3;
let div1;
let label1;
let t5;
let select;
let option0;
let option1;
let option2;
let option3;
let t10;
let hr1;
let t11;
let div2;
let label2;
let t13;
let input1;
let t14;
let code0;
let t15;
let html_tag;
let t16;
let hr2;
let t17;
let div6;
let div3;
let label3;
let t19;
let input2;
let t20;
let code1;
let t21;
let html_tag_1;
let t22;
let div4;
let label4;
let t24;
let input3;
let t25;
let code2;
let t26;
let html_tag_2;
let t27;
let div5;
let label5;
let t29;
let input4;
let t30;
let code3;
let t31;
let html_tag_3;
let t32;
let hr3;
let t33;
let div9;
let div7;
let t34;
let input5;
let input5_checked_value;
let t35;
let code4;
let t36_value = ctx[0].status + "";
let t36;
let t37;
let div8;
let t38;
let code5;
let t39;
let hr4;
let t40;
let div10;
let t41;
let div11;
let mounted;
let dispose;
return {
c() {
div12 = element("div");
form = element("form");
div0 = element("div");
label0 = element("label");
label0.textContent = "Description";
t1 = space();
input0 = element("input");
t2 = space();
hr0 = element("hr");
t3 = space();
div1 = element("div");
label1 = element("label");
label1.textContent = "Priority";
t5 = space();
select = element("select");
option0 = element("option");
option0.textContent = "None";
option1 = element("option");
option1.textContent = "\u23EB High";
option2 = element("option");
option2.textContent = "\u{1F53C} Medium";
option3 = element("option");
option3.textContent = "\u{1F53D} Low";
t10 = space();
hr1 = element("hr");
t11 = space();
div2 = element("div");
label2 = element("label");
label2.textContent = "Recurrence";
t13 = space();
input1 = element("input");
t14 = space();
code0 = element("code");
t15 = text("\u{1F501} ");
html_tag = new HtmlTag();
t16 = space();
hr2 = element("hr");
t17 = space();
div6 = element("div");
div3 = element("div");
label3 = element("label");
label3.textContent = "Due";
t19 = space();
input2 = element("input");
t20 = space();
code1 = element("code");
t21 = text("\u{1F4C5} ");
html_tag_1 = new HtmlTag();
t22 = space();
div4 = element("div");
label4 = element("label");
label4.textContent = "Scheduled";
t24 = space();
input3 = element("input");
t25 = space();
code2 = element("code");
t26 = text("\u23F3 ");
html_tag_2 = new HtmlTag();
t27 = space();
div5 = element("div");
label5 = element("label");
label5.textContent = "Start";
t29 = space();
input4 = element("input");
t30 = space();
code3 = element("code");
t31 = text("\u{1F6EB} ");
html_tag_3 = new HtmlTag();
t32 = space();
hr3 = element("hr");
t33 = space();
div9 = element("div");
div7 = element("div");
t34 = text("Status:\n ");
input5 = element("input");
t35 = space();
code4 = element("code");
t36 = text(t36_value);
t37 = space();
div8 = element("div");
t38 = text("Done on:\n ");
code5 = element("code");
t39 = space();
hr4 = element("hr");
t40 = space();
div10 = element("div");
t41 = space();
div11 = element("div");
div11.innerHTML = `<button type="submit" class="mod-cta">Apply</button>`;
attr(label0, "for", "description");
attr(input0, "id", "description");
attr(input0, "type", "text");
attr(input0, "class", "tasks-modal-description");
attr(input0, "placeholder", "Take out the trash");
attr(div0, "class", "tasks-modal-section");
attr(label1, "for", "priority");
option0.__value = "none";
option0.value = option0.__value;
option1.__value = "high";
option1.value = option1.__value;
option2.__value = "medium";
option2.value = option2.__value;
option3.__value = "low";
option3.value = option3.__value;
attr(select, "id", "priority");
attr(select, "class", "dropdown");
if (ctx[0].priority === void 0)
add_render_callback(() => ctx[14].call(select));
attr(div1, "class", "tasks-modal-section");
attr(label2, "for", "recurrence");
attr(input1, "id", "description");
attr(input1, "type", "text");
attr(input1, "placeholder", "Try 'every 2 weeks on Thursday'.");
html_tag.a = null;
attr(div2, "class", "tasks-modal-section");
attr(label3, "for", "due");
attr(input2, "id", "due");
attr(input2, "type", "text");
attr(input2, "placeholder", "Try 'Monday' or 'tomorrow'.");
html_tag_1.a = null;
attr(div3, "class", "tasks-modal-date");
attr(label4, "for", "scheduled");
attr(input3, "id", "scheduled");
attr(input3, "type", "text");
attr(input3, "placeholder", "Try 'Monday' or 'tomorrow'.");
html_tag_2.a = null;
attr(div4, "class", "tasks-modal-date");
attr(label5, "for", "start");
attr(input4, "id", "start");
attr(input4, "type", "text");
attr(input4, "placeholder", "Try 'Monday' or 'tomorrow'.");
html_tag_3.a = null;
attr(div5, "class", "tasks-modal-date");
attr(div6, "class", "tasks-modal-section");
attr(input5, "type", "checkbox");
attr(input5, "class", "task-list-item-checkbox tasks-modal-checkbox");
input5.checked = input5_checked_value = ctx[0].status === Status.Done;
input5.disabled = true;
attr(div9, "class", "tasks-modal-section");
attr(div10, "class", "tasks-modal-section");
attr(div11, "class", "tasks-modal-section");
attr(div12, "class", "tasks-modal");
},
m(target, anchor) {
insert(target, div12, anchor);
append(div12, form);
append(form, div0);
append(div0, label0);
append(div0, t1);
append(div0, input0);
set_input_value(input0, ctx[0].description);
ctx[13](input0);
append(form, t2);
append(form, hr0);
append(form, t3);
append(form, div1);
append(div1, label1);
append(div1, t5);
append(div1, select);
append(select, option0);
append(select, option1);
append(select, option2);
append(select, option3);
select_option(select, ctx[0].priority);
append(form, t10);
append(form, hr1);
append(form, t11);
append(form, div2);
append(div2, label2);
append(div2, t13);
append(div2, input1);
set_input_value(input1, ctx[0].recurrenceRule);
append(div2, t14);
append(div2, code0);
append(code0, t15);
html_tag.m(ctx[5], code0);
append(form, t16);
append(form, hr2);
append(form, t17);
append(form, div6);
append(div6, div3);
append(div3, label3);
append(div3, t19);
append(div3, input2);
set_input_value(input2, ctx[0].dueDate);
append(div3, t20);
append(div3, code1);
append(code1, t21);
html_tag_1.m(ctx[4], code1);
append(div6, t22);
append(div6, div4);
append(div4, label4);
append(div4, t24);
append(div4, input3);
set_input_value(input3, ctx[0].scheduledDate);
append(div4, t25);
append(div4, code2);
append(code2, t26);
html_tag_2.m(ctx[3], code2);
append(div6, t27);
append(div6, div5);
append(div5, label5);
append(div5, t29);
append(div5, input4);
set_input_value(input4, ctx[0].startDate);
append(div5, t30);
append(div5, code3);
append(code3, t31);
html_tag_3.m(ctx[2], code3);
append(form, t32);
append(form, hr3);
append(form, t33);
append(form, div9);
append(div9, div7);
append(div7, t34);
append(div7, input5);
append(div7, t35);
append(div7, code4);
append(code4, t36);
append(div9, t37);
append(div9, div8);
append(div8, t38);
append(div8, code5);
code5.innerHTML = ctx[6];
append(form, t39);
append(form, hr4);
append(form, t40);
append(form, div10);
append(form, t41);
append(form, div11);
if (!mounted) {
dispose = [
listen(input0, "input", ctx[12]),
listen(select, "change", ctx[14]),
listen(input1, "input", ctx[15]),
listen(input2, "input", ctx[16]),
listen(input3, "input", ctx[17]),
listen(input4, "input", ctx[18]),
listen(form, "submit", prevent_default(ctx[7]))
];
mounted = true;
}
},
p(ctx2, [dirty]) {
if (dirty & 1 && input0.value !== ctx2[0].description) {
set_input_value(input0, ctx2[0].description);
}
if (dirty & 1) {
select_option(select, ctx2[0].priority);
}
if (dirty & 1 && input1.value !== ctx2[0].recurrenceRule) {
set_input_value(input1, ctx2[0].recurrenceRule);
}
if (dirty & 32)
html_tag.p(ctx2[5]);
if (dirty & 1 && input2.value !== ctx2[0].dueDate) {
set_input_value(input2, ctx2[0].dueDate);
}
if (dirty & 16)
html_tag_1.p(ctx2[4]);
if (dirty & 1 && input3.value !== ctx2[0].scheduledDate) {
set_input_value(input3, ctx2[0].scheduledDate);
}
if (dirty & 8)
html_tag_2.p(ctx2[3]);
if (dirty & 1 && input4.value !== ctx2[0].startDate) {
set_input_value(input4, ctx2[0].startDate);
}
if (dirty & 4)
html_tag_3.p(ctx2[2]);
if (dirty & 1 && input5_checked_value !== (input5_checked_value = ctx2[0].status === Status.Done)) {
input5.checked = input5_checked_value;
}
if (dirty & 1 && t36_value !== (t36_value = ctx2[0].status + ""))
set_data(t36, t36_value);
if (dirty & 64)
code5.innerHTML = ctx2[6];
;
},
i: noop,
o: noop,
d(detaching) {
if (detaching)
detach(div12);
ctx[13](null);
mounted = false;
run_all(dispose);
}
};
}
function instance($$self, $$props, $$invalidate) {
var _a, _b;
let { task } = $$props;
let { onSubmit } = $$props;
let descriptionInput;
let editableTask = {
description: "",
status: Status.Todo,
priority: "none",
recurrenceRule: "",
startDate: "",
scheduledDate: "",
dueDate: "",
doneDate: ""
};
let parsedStartDate = "";
let parsedScheduledDate = "";
let parsedDueDate = "";
let parsedRecurrence = "";
let parsedDone = "";
onMount(() => {
const { globalFilter } = getSettings();
const description = task.description.replace(globalFilter, "").replace(" ", " ").trim();
let priority = "none";
if (task.priority === Priority.Low) {
priority = "low";
} else if (task.priority === Priority.Medium) {
priority = "medium";
} else if (task.priority === Priority.High) {
priority = "high";
}
$$invalidate(0, editableTask = {
description,
status: task.status,
priority,
recurrenceRule: task.recurrence ? task.recurrence.toText() : "",
startDate: task.startDate ? task.startDate.format("YYYY-MM-DD") : "",
scheduledDate: task.scheduledDate ? task.scheduledDate.format("YYYY-MM-DD") : "",
dueDate: task.dueDate ? task.dueDate.format("YYYY-MM-DD") : "",
doneDate: task.doneDate ? task.doneDate.format("YYYY-MM-DD") : ""
});
setTimeout(() => {
descriptionInput.focus();
}, 10);
});
const _onSubmit = () => {
const { globalFilter } = getSettings();
let description = editableTask.description.trim();
if (!description.includes(globalFilter)) {
description = globalFilter + " " + description;
}
let startDate = null;
const parsedStartDate2 = import_chrono_node.default.parseDate(editableTask.startDate, new Date(), { forwardDate: true });
if (parsedStartDate2 !== null) {
startDate = window.moment(parsedStartDate2);
}
let scheduledDate = null;
const parsedScheduledDate2 = import_chrono_node.default.parseDate(editableTask.scheduledDate, new Date(), { forwardDate: true });
if (parsedScheduledDate2 !== null) {
scheduledDate = window.moment(parsedScheduledDate2);
}
let dueDate = null;
const parsedDueDate2 = import_chrono_node.default.parseDate(editableTask.dueDate, new Date(), { forwardDate: true });
if (parsedDueDate2 !== null) {
dueDate = window.moment(parsedDueDate2);
}
let recurrence = null;
if (editableTask.recurrenceRule) {
recurrence = Recurrence.fromText({
recurrenceRuleText: editableTask.recurrenceRule,
startDate,
scheduledDate,
dueDate
});
}
let parsedPriority;
switch (editableTask.priority) {
case "low":
parsedPriority = Priority.Low;
break;
case "medium":
parsedPriority = Priority.Medium;
break;
case "high":
parsedPriority = Priority.High;
break;
default:
parsedPriority = Priority.None;
}
const updatedTask = new Task(Object.assign(Object.assign({}, task), {
description,
status: editableTask.status,
priority: parsedPriority,
recurrence,
startDate,
scheduledDate,
dueDate,
doneDate: window.moment(editableTask.doneDate, "YYYY-MM-DD").isValid() ? window.moment(editableTask.doneDate, "YYYY-MM-DD") : null
}));
onSubmit([updatedTask]);
};
function input0_input_handler() {
editableTask.description = this.value;
$$invalidate(0, editableTask);
}
function input0_binding($$value) {
binding_callbacks[$$value ? "unshift" : "push"](() => {
descriptionInput = $$value;
$$invalidate(1, descriptionInput);
});
}
function select_change_handler() {
editableTask.priority = select_value(this);
$$invalidate(0, editableTask);
}
function input1_input_handler() {
editableTask.recurrenceRule = this.value;
$$invalidate(0, editableTask);
}
function input2_input_handler() {
editableTask.dueDate = this.value;
$$invalidate(0, editableTask);
}
function input3_input_handler() {
editableTask.scheduledDate = this.value;
$$invalidate(0, editableTask);
}
function input4_input_handler() {
editableTask.startDate = this.value;
$$invalidate(0, editableTask);
}
$$self.$$set = ($$props2) => {
if ("task" in $$props2)
$$invalidate(8, task = $$props2.task);
if ("onSubmit" in $$props2)
$$invalidate(9, onSubmit = $$props2.onSubmit);
};
$$self.$$.update = () => {
if ($$self.$$.dirty & 1) {
$: {
if (!editableTask.startDate) {
$$invalidate(2, parsedStartDate = "<i>no start date</>");
} else {
const parsed = import_chrono_node.default.parseDate(editableTask.startDate, new Date(), { forwardDate: true });
if (parsed !== null) {
$$invalidate(2, parsedStartDate = window.moment(parsed).format("YYYY-MM-DD"));
} else {
$$invalidate(2, parsedStartDate = "<i>invalid start date</i>");
}
}
}
}
if ($$self.$$.dirty & 1) {
$: {
if (!editableTask.scheduledDate) {
$$invalidate(3, parsedScheduledDate = "<i>no scheduled date</>");
} else {
const parsed = import_chrono_node.default.parseDate(editableTask.scheduledDate, new Date(), { forwardDate: true });
if (parsed !== null) {
$$invalidate(3, parsedScheduledDate = window.moment(parsed).format("YYYY-MM-DD"));
} else {
$$invalidate(3, parsedScheduledDate = "<i>invalid scheduled date</i>");
}
}
}
}
if ($$self.$$.dirty & 1) {
$: {
if (!editableTask.dueDate) {
$$invalidate(4, parsedDueDate = "<i>no due date</>");
} else {
const parsed = import_chrono_node.default.parseDate(editableTask.dueDate, new Date(), { forwardDate: true });
if (parsed !== null) {
$$invalidate(4, parsedDueDate = window.moment(parsed).format("YYYY-MM-DD"));
} else {
$$invalidate(4, parsedDueDate = "<i>invalid due date</i>");
}
}
}
}
if ($$self.$$.dirty & 3073) {
$: {
if (!editableTask.recurrenceRule) {
$$invalidate(5, parsedRecurrence = "<i>not recurring</>");
} else {
$$invalidate(5, parsedRecurrence = $$invalidate(11, _b = $$invalidate(10, _a = Recurrence.fromText({
recurrenceRuleText: editableTask.recurrenceRule,
startDate: null,
scheduledDate: null,
dueDate: null
})) === null || _a === void 0 ? void 0 : _a.toText()) !== null && _b !== void 0 ? _b : "<i>invalid recurrence rule</i>");
}
}
}
if ($$self.$$.dirty & 1) {
$: {
if (!editableTask.doneDate) {
$$invalidate(6, parsedDone = "<i>no done date</i>");
} else {
const parsed = import_chrono_node.default.parseDate(editableTask.doneDate);
if (parsed !== null) {
$$invalidate(6, parsedDone = window.moment(parsed).format("YYYY-MM-DD"));
} else {
$$invalidate(6, parsedDone = "<i>invalid done date</i>");
}
}
}
}
};
return [
editableTask,
descriptionInput,
parsedStartDate,
parsedScheduledDate,
parsedDueDate,
parsedRecurrence,
parsedDone,
_onSubmit,
task,
onSubmit,
_a,
_b,
input0_input_handler,
input0_binding,
select_change_handler,
input1_input_handler,
input2_input_handler,
input3_input_handler,
input4_input_handler
];
}
var EditTask = class extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, { task: 8, onSubmit: 9 });
}
};
var EditTask_default = EditTask;
// src/TaskModal.ts
var TaskModal = class extends import_obsidian4.Modal {
constructor({
app,
task,
onSubmit
}) {
super(app);
this.task = task;
this.onSubmit = (updatedTasks) => {
onSubmit(updatedTasks);
this.close();
};
}
onOpen() {
this.titleEl.setText("Create or edit Task");
const { contentEl } = this;
new EditTask_default({
target: contentEl,
props: { task: this.task, onSubmit: this.onSubmit }
});
}
onClose() {
const { contentEl } = this;
contentEl.empty();
}
};
// src/Commands/CreateOrEdit.ts
var createOrEdit = (checking, editor, view, app) => {
var _a;
if (checking) {
return view instanceof import_obsidian5.MarkdownView;
}
if (!(view instanceof import_obsidian5.MarkdownView)) {
return;
}
const path = (_a = view.file) == null ? void 0 : _a.path;
if (path === void 0) {
return;
}
const cursorPosition = editor.getCursor();
const lineNumber = cursorPosition.line;
const line = editor.getLine(lineNumber);
const task = taskFromLine({ line, path });
const onSubmit = (updatedTasks) => {
const serialized = updatedTasks.map((task2) => task2.toFileLineString()).join("\n");
editor.setLine(lineNumber, serialized);
};
const taskModal = new TaskModal({
app,
task,
onSubmit
});
taskModal.open();
};
var taskFromLine = ({ line, path }) => {
var _a;
const task = Task.fromLine({
line,
path,
sectionStart: 0,
sectionIndex: 0,
precedingHeader: null
});
if (task !== null) {
return task;
}
const nonTaskRegex = /^([\s\t]*)[-*]? *(\[(.)\])? *(.*)/u;
const nonTaskMatch = line.match(nonTaskRegex);
if (nonTaskMatch === null) {
console.error("Tasks: Cannot create task on line:", line);
return new Task({
status: Status.Todo,
description: "",
path,
indentation: "",
originalStatusCharacter: " ",
priority: Priority.None,
startDate: null,
scheduledDate: null,
dueDate: null,
doneDate: null,
recurrence: null,
sectionStart: 0,
sectionIndex: 0,
precedingHeader: null,
blockLink: "",
tags: []
});
}
const indentation = nonTaskMatch[1];
const statusString = (_a = nonTaskMatch[3]) != null ? _a : " ";
const status = statusString === " " ? Status.Todo : Status.Done;
let description = nonTaskMatch[4];
const blockLinkMatch = line.match(Task.blockLinkRegex);
const blockLink = blockLinkMatch !== null ? blockLinkMatch[0] : "";
if (blockLink !== "") {
description = description.replace(Task.blockLinkRegex, "");
}
return new Task({
status,
description,
path,
indentation,
originalStatusCharacter: statusString,
blockLink,
priority: Priority.None,
startDate: null,
scheduledDate: null,
dueDate: null,
doneDate: null,
recurrence: null,
sectionStart: 0,
sectionIndex: 0,
precedingHeader: null,
tags: []
});
};
// src/Commands/ToggleDone.ts
var import_obsidian6 = __toModule(require("obsidian"));
var toggleDone = (checking, editor, view) => {
var _a;
if (checking) {
if (!(view instanceof import_obsidian6.MarkdownView)) {
return false;
}
return true;
}
if (!(view instanceof import_obsidian6.MarkdownView)) {
return;
}
const path = (_a = view.file) == null ? void 0 : _a.path;
if (path === void 0) {
return;
}
const cursorPosition = editor.getCursor();
const lineNumber = cursorPosition.line;
const line = editor.getLine(lineNumber);
const toggledLine = toggleLine({ line, path });
editor.setLine(lineNumber, toggledLine);
if (/[^ [\]*-]/.test(toggledLine)) {
editor.setCursor({
line: cursorPosition.line,
ch: cursorPosition.ch + toggledLine.length - line.length
});
}
};
var toggleLine = ({ line, path }) => {
let toggledLine = line;
const task = Task.fromLine({
line,
path,
sectionStart: 0,
sectionIndex: 0,
precedingHeader: null
});
if (task !== null) {
toggledLine = toggleTask({ task });
} else {
const regexMatch = line.match(Task.taskRegex);
if (regexMatch !== null) {
toggledLine = toggleChecklistItem({ regexMatch });
} else {
const listItemRegex = /^([\s\t]*)([-*])/;
if (listItemRegex.test(line)) {
toggledLine = line.replace(listItemRegex, "$1$2 [ ]");
} else {
toggledLine = line.replace(/^([\s\t]*)/, "$1- ");
}
}
}
return toggledLine;
};
var toggleTask = ({ task }) => {
const toggledTasks = task.toggle();
const serialized = toggledTasks.map((task2) => task2.toFileLineString()).join("\n");
return serialized;
};
var toggleChecklistItem = ({
regexMatch
}) => {
const indentation = regexMatch[1];
const statusString = regexMatch[2].toLowerCase();
const body = regexMatch[3];
const toggledStatusString = statusString === " " ? "x" : " ";
const toggledLine = `${indentation}- [${toggledStatusString}] ${body}`;
return toggledLine;
};
// src/Commands/index.ts
var Commands = class {
get app() {
return this.plugin.app;
}
constructor({ plugin }) {
this.plugin = plugin;
plugin.addCommand({
id: "edit-task",
name: "Create or edit task",
icon: "pencil",
editorCheckCallback: (checking, editor, view) => {
return createOrEdit(checking, editor, view, this.app);
}
});
plugin.addCommand({
id: "toggle-done",
name: "Toggle task done",
icon: "check-in-circle",
editorCheckCallback: toggleDone
});
}
};
// src/Events.ts
var Event;
(function(Event2) {
Event2["CacheUpdate"] = "obsidian-tasks-plugin:cache-update";
Event2["RequestCacheUpdate"] = "obsidian-tasks-plugin:request-cache-update";
})(Event || (Event = {}));
var Events = class {
constructor({ obsidianEents }) {
this.obsidianEvents = obsidianEents;
}
onCacheUpdate(handler) {
return this.obsidianEvents.on(Event.CacheUpdate, handler);
}
triggerCacheUpdate(cacheData) {
this.obsidianEvents.trigger(Event.CacheUpdate, cacheData);
}
onRequestCacheUpdate(handler) {
return this.obsidianEvents.on(Event.RequestCacheUpdate, handler);
}
triggerRequestCacheUpdate(fn) {
this.obsidianEvents.trigger(Event.RequestCacheUpdate, fn);
}
off(eventRef) {
this.obsidianEvents.offref(eventRef);
}
};
// src/InlineRenderer.ts
var InlineRenderer = class {
constructor({ plugin }) {
this.markdownPostProcessor = this._markdownPostProcessor.bind(this);
plugin.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this));
}
_markdownPostProcessor(element2, context) {
return __async(this, null, function* () {
var _a;
const { globalFilter } = getSettings();
const renderedElements = element2.findAll(".task-list-item").filter((taskItem) => {
var _a2;
const linesText = (_a2 = taskItem.textContent) == null ? void 0 : _a2.split("\n");
if (linesText === void 0) {
return false;
}
let firstLineText = null;
for (let i = 0; i < linesText.length; i = i + 1) {
if (linesText[i] !== "") {
firstLineText = linesText[i];
break;
}
}
if (firstLineText === null) {
return false;
}
return firstLineText.includes(globalFilter);
});
if (renderedElements.length === 0) {
return;
}
const path = context.sourcePath;
const section = context.getSectionInfo(element2);
if (section === null) {
return;
}
const fileLines = section.text.split("\n");
let sectionIndex = 0;
const fileTasks = [];
for (let lineNumber = section.lineStart; lineNumber <= section.lineEnd; lineNumber++) {
const line = fileLines[lineNumber];
if (line === void 0) {
continue;
}
const task = Task.fromLine({
line,
path,
sectionStart: section.lineStart,
sectionIndex,
precedingHeader: null
});
if (task !== null) {
fileTasks.push(task);
sectionIndex++;
}
}
for (let sectionIndex2 = 0; sectionIndex2 < renderedElements.length; sectionIndex2++) {
const task = fileTasks[sectionIndex2];
const renderedElement = renderedElements[sectionIndex2];
if (task === void 0 || renderedElement === void 0) {
continue;
}
const dataLine = (_a = renderedElement.getAttr("data-line")) != null ? _a : "0";
const listIndex = Number.parseInt(dataLine, 10);
const taskElement = yield task.toLi({
parentUlElement: element2,
listIndex
});
const renderedChildren = renderedElement.childNodes;
for (let i = 0; i < renderedChildren.length; i = i + 1) {
const renderedChild = renderedChildren[i];
if (renderedChild.nodeName.toLowerCase() === "div") {
taskElement.prepend(renderedChild);
} else if (renderedChild.nodeName.toLowerCase() === "ul") {
taskElement.append(renderedChild);
}
}
const originalFootnotes = renderedElement.querySelectorAll("[data-footnote-id]");
const newFootnotes = taskElement.querySelectorAll("[data-footnote-id]");
if (originalFootnotes.length === newFootnotes.length) {
for (let i = 0; i < originalFootnotes.length; i++) {
newFootnotes[i].replaceWith(originalFootnotes[i]);
}
}
renderedElement.replaceWith(taskElement);
}
});
}
};
// src/LivePreviewExtension.ts
var import_view = __toModule(require("@codemirror/view"));
var newLivePreviewExtension = () => {
return import_view.ViewPlugin.fromClass(LivePreviewExtension);
};
var LivePreviewExtension = class {
constructor(view) {
this.view = view;
this.handleClickEvent = this.handleClickEvent.bind(this);
this.view.dom.addEventListener("click", this.handleClickEvent);
}
destroy() {
this.view.dom.removeEventListener("click", this.handleClickEvent);
}
handleClickEvent(event) {
const { target } = event;
if (!target || !(target instanceof HTMLInputElement) || target.type !== "checkbox") {
return false;
}
const { state } = this.view;
const position = this.view.posAtDOM(target);
const line = state.doc.lineAt(position);
const task = Task.fromLine({
line: line.text,
path: "",
sectionStart: 0,
sectionIndex: 0,
precedingHeader: null
});
if (task === null) {
return false;
}
event.preventDefault();
const toggled = task.toggle();
const toggledString = toggled.map((task2) => task2.toFileLineString()).join(state.lineBreak);
const transaction = state.update({
changes: {
from: line.from,
to: line.to,
insert: toggledString
}
});
this.view.dispatch(transaction);
const desiredCheckedStatus = target.checked;
setTimeout(() => {
target.checked = desiredCheckedStatus;
}, 1);
return true;
}
};
// src/QueryRenderer.ts
var import_obsidian7 = __toModule(require("obsidian"));
// src/Query.ts
var chrono2 = __toModule(require_dist());
// src/Query/GroupHeading.ts
var GroupHeading = class {
constructor(nestingLevel, name) {
this.nestingLevel = nestingLevel;
this.name = name;
}
};
// src/Query/GroupHeadings.ts
var GroupHeadings = class {
constructor(groupedTasks) {
this.lastHeadingAtLevel = new Array();
const firstGroup = groupedTasks.keys().next().value;
const groupCount = firstGroup.length;
for (let i = 0; i < groupCount; i++) {
this.lastHeadingAtLevel.push("");
}
}
getHeadingsForTaskGroup(groupNames) {
const headingsForGroup = new Array();
for (let level = 0; level < groupNames.length; level++) {
const group = groupNames[level];
if (group != this.lastHeadingAtLevel[level]) {
headingsForGroup.push(new GroupHeading(level, group));
for (let j = level; j < groupNames.length; j++) {
this.lastHeadingAtLevel[j] = "";
}
this.lastHeadingAtLevel[level] = group;
}
}
return headingsForGroup;
}
};
// src/Query/IntermediateTaskGroups.ts
var IntermediateTaskGroupsStorage = class extends Map {
};
var IntermediateTaskGroups = class {
constructor(grouping, tasks2) {
this.groups = new IntermediateTaskGroupsStorage();
if (grouping.length === 0 || tasks2.length === 0) {
this.groups.set([], tasks2);
} else {
const groupers = Group.getGroupersForAllQueryGroupings(grouping);
for (const task of tasks2) {
const groupNames = Group.getGroupNamesForTask(groupers, task);
this.addTask(groupNames, task);
}
this.groups = this.getSortedGroups();
}
}
addTask(groupNames, task) {
const groupForNames = this.getOrCreateGroupForGroupNames(groupNames);
groupForNames == null ? void 0 : groupForNames.push(task);
}
getOrCreateGroupForGroupNames(newGroupNames) {
for (const [groupNames, taskGroup2] of this.groups) {
if (JSON.stringify(groupNames) === JSON.stringify(newGroupNames)) {
return taskGroup2;
}
}
const taskGroup = [];
this.groups.set(newGroupNames, taskGroup);
return taskGroup;
}
getSortedGroups() {
return new IntermediateTaskGroupsStorage([...this.groups.entries()].sort());
}
};
// src/Query/TaskGroup.ts
var TaskGroup = class {
constructor(groups, groupHeadings, tasks2) {
this.groups = groups;
this.groupHeadings = groupHeadings;
this.tasks = tasks2;
}
tasksAsStringOfLines() {
let output = "";
for (const task of this.tasks) {
output += task.toFileLineString() + "\n";
}
return output;
}
toString() {
let output = "\n";
output += `Group names: [${this.groups}]
`;
for (const heading of this.groupHeadings) {
const headingPrefix = "#".repeat(4 + heading.nestingLevel);
output += `${headingPrefix} ${heading.name}
`;
}
output += this.tasksAsStringOfLines();
return output;
}
};
// src/Query/TaskGroups.ts
var TaskGroups = class {
constructor(groups, tasks2) {
this._groups = new Array();
const initialGroups = new IntermediateTaskGroups(groups, tasks2);
this.addTasks(initialGroups);
}
get groups() {
return this._groups;
}
totalTasksCount() {
let totalTasksCount = 0;
for (const group of this.groups) {
totalTasksCount += group.tasks.length;
}
return totalTasksCount;
}
toString() {
let output = "";
for (const taskGroup of this.groups) {
output += taskGroup.toString();
output += "\n---\n";
}
const totalTasksCount = this.totalTasksCount();
output += `
${totalTasksCount} tasks
`;
return output;
}
addTasks(initialGroups) {
const grouper = new GroupHeadings(initialGroups.groups);
for (const [groups, tasks2] of initialGroups.groups) {
const groupHeadings = grouper.getHeadingsForTaskGroup(groups);
const taskGroup = new TaskGroup(groups, groupHeadings, tasks2);
this.add(taskGroup);
}
}
add(taskGroup) {
this._groups.push(taskGroup);
}
};
// src/Query/Group.ts
var _Group = class {
static by(grouping, tasks2) {
return new TaskGroups(grouping, tasks2);
}
static getGroupersForAllQueryGroupings(grouping) {
const groupers = [];
for (const { property } of grouping) {
const comparator = _Group.groupers[property];
groupers.push(comparator);
}
return groupers;
}
static getGroupNamesForTask(groupers, task) {
const groupNames = [];
for (const grouper of groupers) {
const groupName = grouper(task);
groupNames.push(groupName);
}
return groupNames;
}
static getGroupNameForTask(property, task) {
const grouper = _Group.groupers[property];
return grouper(task);
}
static groupByPath(task) {
return task.path.replace(".md", "");
}
static groupByFolder(task) {
const path = task.path;
const fileNameWithExtension = task.filename + ".md";
const folder = path.substring(0, path.lastIndexOf(fileNameWithExtension));
if (folder === "") {
return "/";
}
return folder;
}
static groupByFileName(task) {
const filename = task.filename;
if (filename === null) {
return "Unknown Location";
}
return filename;
}
static groupByBacklink(task) {
const linkText = task.getLinkText({ isFilenameUnique: true });
if (linkText === null) {
return "Unknown Location";
}
return linkText;
}
static groupByStatus(task) {
return task.status;
}
static groupByHeading(task) {
if (task.precedingHeader === null || task.precedingHeader.length === 0) {
return "(No heading)";
}
return task.precedingHeader;
}
};
var Group = _Group;
Group.groupers = {
backlink: _Group.groupByBacklink,
filename: _Group.groupByFileName,
folder: _Group.groupByFolder,
heading: _Group.groupByHeading,
path: _Group.groupByPath,
status: _Group.groupByStatus
};
// src/Sort.ts
var _Sort = class {
static by(query, tasks2) {
const defaultComparators = [
_Sort.compareByUrgency,
_Sort.compareByStatus,
_Sort.compareByDueDate,
_Sort.compareByPriority,
_Sort.compareByPath
];
const userComparators = [];
for (const { property, reverse, propertyInstance } of query.sorting) {
const comparator = _Sort.comparators[property];
userComparators.push(reverse ? _Sort.makeReversedComparator(comparator) : comparator);
if (property === "tag") {
_Sort.tagPropertyInstance = propertyInstance;
}
}
return tasks2.sort(_Sort.makeCompositeComparator([
...userComparators,
...defaultComparators
]));
}
static makeReversedComparator(comparator) {
return (a, b) => comparator(a, b) * -1;
}
static makeCompositeComparator(comparators) {
return (a, b) => {
for (const comparator of comparators) {
const result = comparator(a, b);
if (result !== 0) {
return result;
}
}
return 0;
};
}
static compareByUrgency(a, b) {
return b.urgency - a.urgency;
}
static compareByStatus(a, b) {
if (a.status < b.status) {
return 1;
} else if (a.status > b.status) {
return -1;
} else {
return 0;
}
}
static compareByPriority(a, b) {
return a.priority.localeCompare(b.priority);
}
static compareByStartDate(a, b) {
return _Sort.compareByDate(a.startDate, b.startDate);
}
static compareByScheduledDate(a, b) {
return _Sort.compareByDate(a.scheduledDate, b.scheduledDate);
}
static compareByDueDate(a, b) {
return _Sort.compareByDate(a.dueDate, b.dueDate);
}
static compareByDoneDate(a, b) {
return _Sort.compareByDate(a.doneDate, b.doneDate);
}
static compareByTag(a, b) {
if (a.tags.length === 0 && b.tags.length === 0) {
return 0;
} else if (a.tags.length === 0) {
return 1;
} else if (b.tags.length === 0) {
return -1;
}
const tagInstanceToSortBy = _Sort.tagPropertyInstance - 1;
if (a.tags.length < _Sort.tagPropertyInstance && b.tags.length >= _Sort.tagPropertyInstance) {
return 1;
} else if (b.tags.length < _Sort.tagPropertyInstance && a.tags.length >= _Sort.tagPropertyInstance) {
return -1;
} else if (a.tags.length < _Sort.tagPropertyInstance && b.tags.length < _Sort.tagPropertyInstance) {
return 0;
}
if (a.tags[tagInstanceToSortBy] < b.tags[tagInstanceToSortBy]) {
return -1;
} else if (a.tags[tagInstanceToSortBy] > b.tags[tagInstanceToSortBy]) {
return 1;
} else {
return 0;
}
}
static compareByDate(a, b) {
if (a !== null && b === null) {
return -1;
} else if (a === null && b !== null) {
return 1;
} else if (a !== null && b !== null) {
if (a.isAfter(b)) {
return 1;
} else if (a.isBefore(b)) {
return -1;
} else {
return 0;
}
} else {
return 0;
}
}
static compareByPath(a, b) {
if (a.path < b.path) {
return -1;
} else if (a.path > b.path) {
return 1;
} else {
return 0;
}
}
static compareByDescription(a, b) {
return _Sort.cleanDescription(a.description).localeCompare(_Sort.cleanDescription(b.description));
}
static cleanDescription(description) {
const globalFilter = getSettings().globalFilter;
description = description.replace(globalFilter, "").trim();
const startsWithLinkRegex = /^\[\[?([^\]]*)\]/;
const linkRegexMatch = description.match(startsWithLinkRegex);
if (linkRegexMatch !== null) {
const innerLinkText = linkRegexMatch[1];
description = innerLinkText.substring(innerLinkText.indexOf("|") + 1) + description.replace(startsWithLinkRegex, "");
}
const startsWithItalicOrBoldRegex = /^\*\*?([^*]*)\*/;
const italicBoldRegexMatch = description.match(startsWithItalicOrBoldRegex);
if (italicBoldRegexMatch !== null) {
const innerItalicBoldText = italicBoldRegexMatch[1];
description = innerItalicBoldText + description.replace(startsWithLinkRegex, "");
}
const startsWithHighlightRegex = /^==?([^=]*)==/;
const highlightRegexMatch = description.match(startsWithHighlightRegex);
if (highlightRegexMatch !== null) {
const innerHighlightsText = highlightRegexMatch[1];
description = innerHighlightsText + description.replace(startsWithHighlightRegex, "");
}
return description;
}
};
var Sort = _Sort;
Sort.tagPropertyInstance = 1;
Sort.comparators = {
urgency: _Sort.compareByUrgency,
description: _Sort.compareByDescription,
priority: _Sort.compareByPriority,
start: _Sort.compareByStartDate,
scheduled: _Sort.compareByScheduledDate,
due: _Sort.compareByDueDate,
done: _Sort.compareByDoneDate,
path: _Sort.compareByPath,
status: _Sort.compareByStatus,
tag: _Sort.compareByTag
};
// src/Query.ts
var Query = class {
constructor({ source }) {
this._limit = void 0;
this._layoutOptions = new LayoutOptions();
this._filters = [];
this._error = void 0;
this._sorting = [];
this._grouping = [];
this.priorityRegexp = /^priority (is )?(above|below)? ?(low|none|medium|high)/;
this.happensRegexp = /^happens (before|after|on)? ?(.*)/;
this.noStartString = "no start date";
this.hasStartString = "has start date";
this.startRegexp = /^starts (before|after|on)? ?(.*)/;
this.noScheduledString = "no scheduled date";
this.hasScheduledString = "has scheduled date";
this.scheduledRegexp = /^scheduled (before|after|on)? ?(.*)/;
this.noDueString = "no due date";
this.hasDueString = "has due date";
this.dueRegexp = /^due (before|after|on)? ?(.*)/;
this.doneString = "done";
this.notDoneString = "not done";
this.doneRegexp = /^done (before|after|on)? ?(.*)/;
this.pathRegexp = /^path (includes|does not include) (.*)/;
this.descriptionRegexp = /^description (includes|does not include) (.*)/;
this.tagRegexp = /^(tag|tags) (includes|does not include|include|do not include) (.*)/;
this.sortByRegexp = /^sort by (urgency|status|priority|start|scheduled|due|done|path|description|tag)( reverse)?[\s]*(\d+)?/;
this.groupByRegexp = /^group by (backlink|filename|folder|heading|path|status)/;
this.headingRegexp = /^heading (includes|does not include) (.*)/;
this.hideOptionsRegexp = /^hide (task count|backlink|priority|start date|scheduled date|done date|due date|recurrence rule|edit button)/;
this.shortModeRegexp = /^short/;
this.recurringString = "is recurring";
this.notRecurringString = "is not recurring";
this.limitRegexp = /^limit (to )?(\d+)( tasks?)?/;
this.excludeSubItemsString = "exclude sub-items";
this.commentRegexp = /^#.*/;
source.split("\n").map((line) => line.trim()).forEach((line) => {
switch (true) {
case line === "":
break;
case line === this.doneString:
this._filters.push((task) => task.status === Status.Done);
break;
case line === this.notDoneString:
this._filters.push((task) => task.status !== Status.Done);
break;
case line === this.recurringString:
this._filters.push((task) => task.recurrence !== null);
break;
case line === this.notRecurringString:
this._filters.push((task) => task.recurrence === null);
break;
case line === this.excludeSubItemsString:
this._filters.push((task) => task.indentation === "");
break;
case line === this.noStartString:
this._filters.push((task) => task.startDate === null);
break;
case line === this.noScheduledString:
this._filters.push((task) => task.scheduledDate === null);
break;
case line === this.noDueString:
this._filters.push((task) => task.dueDate === null);
break;
case line === this.hasStartString:
this._filters.push((task) => task.startDate !== null);
break;
case line === this.hasScheduledString:
this._filters.push((task) => task.scheduledDate !== null);
break;
case line === this.hasDueString:
this._filters.push((task) => task.dueDate !== null);
break;
case this.shortModeRegexp.test(line):
this._layoutOptions.shortMode = true;
break;
case this.priorityRegexp.test(line):
this.parsePriorityFilter({ line });
break;
case this.happensRegexp.test(line):
this.parseHappensFilter({ line });
break;
case this.startRegexp.test(line):
this.parseStartFilter({ line });
break;
case this.scheduledRegexp.test(line):
this.parseScheduledFilter({ line });
break;
case this.dueRegexp.test(line):
this.parseDueFilter({ line });
break;
case this.doneRegexp.test(line):
this.parseDoneFilter({ line });
break;
case this.pathRegexp.test(line):
this.parsePathFilter({ line });
break;
case this.descriptionRegexp.test(line):
this.parseDescriptionFilter({ line });
break;
case this.tagRegexp.test(line):
this.parseTagFilter({ line });
break;
case this.headingRegexp.test(line):
this.parseHeadingFilter({ line });
break;
case this.limitRegexp.test(line):
this.parseLimit({ line });
break;
case this.sortByRegexp.test(line):
this.parseSortBy({ line });
break;
case this.groupByRegexp.test(line):
this.parseGroupBy({ line });
break;
case this.hideOptionsRegexp.test(line):
this.parseHideOptions({ line });
break;
case this.commentRegexp.test(line):
break;
default:
this._error = `do not understand query: ${line}`;
}
});
}
get limit() {
return this._limit;
}
get layoutOptions() {
return this._layoutOptions;
}
get filters() {
return this._filters;
}
get sorting() {
return this._sorting;
}
get grouping() {
return this._grouping;
}
get error() {
return this._error;
}
applyQueryToTasks(tasks2) {
this.filters.forEach((filter) => {
tasks2 = tasks2.filter(filter);
});
const tasksSortedLimited = Sort.by(this, tasks2).slice(0, this.limit);
return Group.by(this.grouping, tasksSortedLimited);
}
parseHideOptions({ line }) {
const hideOptionsMatch = line.match(this.hideOptionsRegexp);
if (hideOptionsMatch !== null) {
const option = hideOptionsMatch[1].trim().toLowerCase();
switch (option) {
case "task count":
this._layoutOptions.hideTaskCount = true;
break;
case "backlink":
this._layoutOptions.hideBacklinks = true;
break;
case "priority":
this._layoutOptions.hidePriority = true;
break;
case "start date":
this._layoutOptions.hideStartDate = true;
break;
case "scheduled date":
this._layoutOptions.hideScheduledDate = true;
break;
case "due date":
this._layoutOptions.hideDueDate = true;
break;
case "done date":
this._layoutOptions.hideDoneDate = true;
break;
case "recurrence rule":
this._layoutOptions.hideRecurrenceRule = true;
break;
case "edit button":
this._layoutOptions.hideEditButton = true;
break;
default:
this._error = "do not understand hide option";
}
}
}
parsePriorityFilter({ line }) {
const priorityMatch = line.match(this.priorityRegexp);
if (priorityMatch !== null) {
const filterPriorityString = priorityMatch[3];
let filterPriority = null;
switch (filterPriorityString) {
case "low":
filterPriority = Priority.Low;
break;
case "none":
filterPriority = Priority.None;
break;
case "medium":
filterPriority = Priority.Medium;
break;
case "high":
filterPriority = Priority.High;
break;
}
if (filterPriority === null) {
this._error = "do not understand priority";
return;
}
let filter;
if (priorityMatch[2] === "above") {
filter = (task) => task.priority ? task.priority.localeCompare(filterPriority) < 0 : false;
} else if (priorityMatch[2] === "below") {
filter = (task) => task.priority ? task.priority.localeCompare(filterPriority) > 0 : false;
} else {
filter = (task) => task.priority ? task.priority === filterPriority : false;
}
this._filters.push(filter);
} else {
this._error = "do not understand query filter (priority date)";
}
}
parseHappensFilter({ line }) {
const happensMatch = line.match(this.happensRegexp);
if (happensMatch !== null) {
const filterDate = Query.parseDate(happensMatch[2]);
if (!filterDate.isValid()) {
this._error = "do not understand happens date";
return;
}
let filter;
if (happensMatch[1] === "before") {
filter = (task) => {
return Array.of(task.startDate, task.scheduledDate, task.dueDate).some((date) => date && date.isBefore(filterDate));
};
} else if (happensMatch[1] === "after") {
filter = (task) => {
return Array.of(task.startDate, task.scheduledDate, task.dueDate).some((date) => date && date.isAfter(filterDate));
};
} else {
filter = (task) => {
return Array.of(task.startDate, task.scheduledDate, task.dueDate).some((date) => date && date.isSame(filterDate));
};
}
this._filters.push(filter);
} else {
this._error = "do not understand query filter (happens date)";
}
}
parseStartFilter({ line }) {
const startMatch = line.match(this.startRegexp);
if (startMatch !== null) {
const filterDate = Query.parseDate(startMatch[2]);
if (!filterDate.isValid()) {
this._error = "do not understand start date";
return;
}
let filter;
if (startMatch[1] === "before") {
filter = (task) => task.startDate ? task.startDate.isBefore(filterDate) : true;
} else if (startMatch[1] === "after") {
filter = (task) => task.startDate ? task.startDate.isAfter(filterDate) : true;
} else {
filter = (task) => task.startDate ? task.startDate.isSame(filterDate) : true;
}
this._filters.push(filter);
} else {
this._error = "do not understand query filter (start date)";
}
}
parseScheduledFilter({ line }) {
const scheduledMatch = line.match(this.scheduledRegexp);
if (scheduledMatch !== null) {
const filterDate = Query.parseDate(scheduledMatch[2]);
if (!filterDate.isValid()) {
this._error = "do not understand scheduled date";
}
let filter;
if (scheduledMatch[1] === "before") {
filter = (task) => task.scheduledDate ? task.scheduledDate.isBefore(filterDate) : false;
} else if (scheduledMatch[1] === "after") {
filter = (task) => task.scheduledDate ? task.scheduledDate.isAfter(filterDate) : false;
} else {
filter = (task) => task.scheduledDate ? task.scheduledDate.isSame(filterDate) : false;
}
this._filters.push(filter);
} else {
this._error = "do not understand query filter (scheduled date)";
}
}
parseDueFilter({ line }) {
const dueMatch = line.match(this.dueRegexp);
if (dueMatch !== null) {
const filterDate = Query.parseDate(dueMatch[2]);
if (!filterDate.isValid()) {
this._error = "do not understand due date";
return;
}
let filter;
if (dueMatch[1] === "before") {
filter = (task) => task.dueDate ? task.dueDate.isBefore(filterDate) : false;
} else if (dueMatch[1] === "after") {
filter = (task) => task.dueDate ? task.dueDate.isAfter(filterDate) : false;
} else {
filter = (task) => task.dueDate ? task.dueDate.isSame(filterDate) : false;
}
this._filters.push(filter);
} else {
this._error = "do not understand query filter (due date)";
}
}
parseDoneFilter({ line }) {
const doneMatch = line.match(this.doneRegexp);
if (doneMatch !== null) {
const filterDate = Query.parseDate(doneMatch[2]);
if (!filterDate.isValid()) {
this._error = "do not understand done date";
return;
}
let filter;
if (doneMatch[1] === "before") {
filter = (task) => task.doneDate ? task.doneDate.isBefore(filterDate) : false;
} else if (doneMatch[1] === "after") {
filter = (task) => task.doneDate ? task.doneDate.isAfter(filterDate) : false;
} else {
filter = (task) => task.doneDate ? task.doneDate.isSame(filterDate) : false;
}
this._filters.push(filter);
}
}
parsePathFilter({ line }) {
const pathMatch = line.match(this.pathRegexp);
if (pathMatch !== null) {
const filterMethod = pathMatch[1];
if (filterMethod === "includes") {
this._filters.push((task) => Query.stringIncludesCaseInsensitive(task.path, pathMatch[2]));
} else if (pathMatch[1] === "does not include") {
this._filters.push((task) => !Query.stringIncludesCaseInsensitive(task.path, pathMatch[2]));
} else {
this._error = "do not understand query filter (path)";
}
} else {
this._error = "do not understand query filter (path)";
}
}
parseTagFilter({ line }) {
const tagMatch = line.match(this.tagRegexp);
if (tagMatch !== null) {
const filterMethod = tagMatch[2];
const search = tagMatch[3].replace(/^#/, "");
if (filterMethod === "include" || filterMethod === "includes") {
this._filters.push((task) => task.tags.find((tag) => tag.toLowerCase().includes(search.toLowerCase())) !== void 0);
} else if (tagMatch[2] === "do not include" || tagMatch[2] === "does not include") {
this._filters.push((task) => task.tags.find((tag) => tag.toLowerCase().includes(search.toLowerCase())) == void 0);
} else {
this._error = "do not understand query filter (tag/tags)";
}
} else {
this._error = "do not understand query filter (tag/tags)";
}
}
parseDescriptionFilter({ line }) {
const descriptionMatch = line.match(this.descriptionRegexp);
if (descriptionMatch !== null) {
const filterMethod = descriptionMatch[1];
const globalFilter = getSettings().globalFilter;
if (filterMethod === "includes") {
this._filters.push((task) => Query.stringIncludesCaseInsensitive(task.description.replace(globalFilter, "").trim(), descriptionMatch[2]));
} else if (descriptionMatch[1] === "does not include") {
this._filters.push((task) => !Query.stringIncludesCaseInsensitive(task.description.replace(globalFilter, "").trim(), descriptionMatch[2]));
} else {
this._error = "do not understand query filter (description)";
}
} else {
this._error = "do not understand query filter (description)";
}
}
parseHeadingFilter({ line }) {
const headingMatch = line.match(this.headingRegexp);
if (headingMatch !== null) {
const filterMethod = headingMatch[1].toLowerCase();
if (filterMethod === "includes") {
this._filters.push((task) => task.precedingHeader !== null && Query.stringIncludesCaseInsensitive(task.precedingHeader, headingMatch[2]));
} else if (headingMatch[1] === "does not include") {
this._filters.push((task) => task.precedingHeader === null || !Query.stringIncludesCaseInsensitive(task.precedingHeader, headingMatch[2]));
} else {
this._error = "do not understand query filter (heading)";
}
} else {
this._error = "do not understand query filter (heading)";
}
}
parseLimit({ line }) {
const limitMatch = line.match(this.limitRegexp);
if (limitMatch !== null) {
this._limit = Number.parseInt(limitMatch[2], 10);
} else {
this._error = "do not understand query limit";
}
}
parseSortBy({ line }) {
const fieldMatch = line.match(this.sortByRegexp);
if (fieldMatch !== null) {
this._sorting.push({
property: fieldMatch[1],
reverse: !!fieldMatch[2],
propertyInstance: isNaN(+fieldMatch[3]) ? 1 : +fieldMatch[3]
});
} else {
this._error = "do not understand query sorting";
}
}
parseGroupBy({ line }) {
const fieldMatch = line.match(this.groupByRegexp);
if (fieldMatch !== null) {
this._grouping.push({
property: fieldMatch[1]
});
} else {
this._error = "do not understand query grouping";
}
}
static parseDate(input) {
return window.moment(chrono2.parseDate(input)).startOf("day");
}
static stringIncludesCaseInsensitive(haystack, needle) {
return haystack.toLocaleLowerCase().includes(needle.toLocaleLowerCase());
}
};
// src/QueryRenderer.ts
var QueryRenderer = class {
constructor({ plugin, events }) {
this.addQueryRenderChild = this._addQueryRenderChild.bind(this);
this.app = plugin.app;
this.events = events;
plugin.registerMarkdownCodeBlockProcessor("tasks", this._addQueryRenderChild.bind(this));
}
_addQueryRenderChild(source, element2, context) {
return __async(this, null, function* () {
context.addChild(new QueryRenderChild({
app: this.app,
events: this.events,
container: element2,
source
}));
});
}
};
var QueryRenderChild = class extends import_obsidian7.MarkdownRenderChild {
constructor({
app,
events,
container,
source
}) {
super(container);
this.app = app;
this.events = events;
this.source = source;
this.query = new Query({ source });
}
onload() {
this.events.triggerRequestCacheUpdate(this.render.bind(this));
this.renderEventRef = this.events.onCacheUpdate(this.render.bind(this));
this.reloadQueryAtMidnight();
}
onunload() {
if (this.renderEventRef !== void 0) {
this.events.off(this.renderEventRef);
}
if (this.queryReloadTimeout !== void 0) {
clearTimeout(this.queryReloadTimeout);
}
}
reloadQueryAtMidnight() {
const midnight = new Date();
midnight.setHours(24, 0, 0, 0);
const now = new Date();
const millisecondsToMidnight = midnight.getTime() - now.getTime();
this.queryReloadTimeout = setTimeout(() => {
this.query = new Query({ source: this.source });
this.events.triggerRequestCacheUpdate(this.render.bind(this));
this.reloadQueryAtMidnight();
}, millisecondsToMidnight + 1e3);
}
render(_0) {
return __async(this, arguments, function* ({ tasks: tasks2, state }) {
var _a;
const content = this.containerEl.createEl("div");
if (state === State.Warm && this.query.error === void 0) {
const tasksSortedLimitedGrouped = this.query.applyQueryToTasks(tasks2);
for (const group of tasksSortedLimitedGrouped.groups) {
QueryRenderChild.addGroupHeadings(content, group.groupHeadings);
const { taskList } = yield this.createTasksList({
tasks: group.tasks,
content
});
content.appendChild(taskList);
}
const totalTasksCount = tasksSortedLimitedGrouped.totalTasksCount();
this.addTaskCount(content, totalTasksCount);
} else if (this.query.error !== void 0) {
content.setText(`Tasks query: ${this.query.error}`);
} else {
content.setText("Loading Tasks ...");
}
(_a = this.containerEl.firstChild) == null ? void 0 : _a.replaceWith(content);
});
}
createTasksList(_0) {
return __async(this, arguments, function* ({
tasks: tasks2,
content
}) {
const tasksCount = tasks2.length;
const taskList = content.createEl("ul");
taskList.addClasses([
"contains-task-list",
"plugin-tasks-query-result"
]);
for (let i = 0; i < tasksCount; i++) {
const task = tasks2[i];
const isFilenameUnique = this.isFilenameUnique({ task });
const listItem = yield task.toLi({
parentUlElement: taskList,
listIndex: i,
layoutOptions: this.query.layoutOptions,
isFilenameUnique
});
const footnotes = listItem.querySelectorAll("[data-footnote-id]");
footnotes.forEach((footnote) => footnote.remove());
const postInfo = listItem.createSpan();
const shortMode = this.query.layoutOptions.shortMode;
if (!this.query.layoutOptions.hideBacklinks) {
this.addBacklinks(postInfo, task, shortMode, isFilenameUnique);
}
if (!this.query.layoutOptions.hideEditButton) {
this.addEditButton(postInfo, task);
}
taskList.appendChild(listItem);
}
return { taskList, tasksCount };
});
}
addEditButton(postInfo, task) {
const editTaskPencil = postInfo.createEl("a", {
cls: "tasks-edit"
});
editTaskPencil.onClickEvent((event) => {
event.preventDefault();
const onSubmit = (updatedTasks) => {
replaceTaskWithTasks({
originalTask: task,
newTasks: updatedTasks
});
};
const taskModal = new TaskModal({
app: this.app,
task,
onSubmit
});
taskModal.open();
});
}
static addGroupHeadings(content, groupHeadings) {
for (const heading of groupHeadings) {
QueryRenderChild.addGroupHeading(content, heading);
}
}
static addGroupHeading(content, group) {
let header;
if (group.nestingLevel === 0) {
header = content.createEl("h4", {
cls: "tasks-group-heading"
});
} else if (group.nestingLevel === 1) {
header = content.createEl("h5", {
cls: "tasks-group-heading"
});
} else {
header = content.createEl("h6", {
cls: "tasks-group-heading"
});
}
header.appendText(group.name);
}
addBacklinks(postInfo, task, shortMode, isFilenameUnique) {
var _a;
postInfo.addClass("tasks-backlink");
if (!shortMode) {
postInfo.append(" (");
}
const link = postInfo.createEl("a");
link.href = task.path;
link.setAttribute("data-href", task.path);
link.rel = "noopener";
link.target = "_blank";
link.addClass("internal-link");
if (shortMode) {
link.addClass("internal-link-short-mode");
}
if (task.precedingHeader !== null) {
link.href = link.href + "#" + task.precedingHeader;
link.setAttribute("data-href", link.getAttribute("data-href") + "#" + task.precedingHeader);
}
let linkText;
if (shortMode) {
linkText = " \u{1F517}";
} else {
linkText = (_a = task.getLinkText({ isFilenameUnique })) != null ? _a : "";
}
link.setText(linkText);
if (!shortMode) {
postInfo.append(")");
}
}
addTaskCount(content, tasksCount) {
if (!this.query.layoutOptions.hideTaskCount) {
content.createDiv({
text: `${tasksCount} task${tasksCount !== 1 ? "s" : ""}`,
cls: "tasks-count"
});
}
}
isFilenameUnique({ task }) {
const filenameMatch = task.path.match(/([^/]*)\..+$/i);
if (filenameMatch === null) {
return void 0;
}
const filename = filenameMatch[1];
const allFilesWithSameName = this.app.vault.getMarkdownFiles().filter((file) => {
if (file.basename === filename) {
return true;
}
});
return allFilesWithSameName.length < 2;
}
};
// src/SettingsTab.ts
var import_obsidian8 = __toModule(require("obsidian"));
var SettingsTab = class extends import_obsidian8.PluginSettingTab {
constructor({ plugin }) {
super(plugin.app, plugin);
this.plugin = plugin;
}
display() {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Tasks Settings" });
containerEl.createEl("p", {
cls: "tasks-setting-important",
text: "Changing any settings requires a restart of obsidian."
});
new import_obsidian8.Setting(containerEl).setName("Global task filter").setDesc("The global filter will be applied to all checklist items.").addText((text2) => {
const settings2 = getSettings();
text2.setPlaceholder("#task").setValue(settings2.globalFilter).onChange((value) => __async(this, null, function* () {
updateSettings({ globalFilter: value });
yield this.plugin.saveSettings();
}));
});
containerEl.createEl("div", {
cls: "setting-item-description",
text: 'The global filter will be applied to all checklist items to filter out "non-task" checklist items.\nA checklist item must include the specified string in its description in order to be considered a task.\nFor example, if you set the global filter to `#task`, the Tasks plugin will only handle checklist items tagged with `#task`.\nOther checklist items will remain normal checklist items and not appear in queries or get a done date set.\nLeave empty if you want all checklist items from your vault to be tasks managed by this plugin.'
});
new import_obsidian8.Setting(containerEl).setName("Remove global filter from description").setDesc("Enabling this removes the string that you set as global filter from the task description when displaying a task.").addToggle((toggle) => {
const settings2 = getSettings();
toggle.setValue(settings2.removeGlobalFilter).onChange((value) => __async(this, null, function* () {
updateSettings({ removeGlobalFilter: value });
yield this.plugin.saveSettings();
}));
});
new import_obsidian8.Setting(containerEl).setName("Set done date on every completed task").setDesc("Enabling this will add a timestamp \u2705 YYYY-MM-DD at the end when a task is toggled to done").addToggle((toogle) => {
const settings2 = getSettings();
toogle.setValue(settings2.setDoneDate).onChange((value) => __async(this, null, function* () {
updateSettings({ setDoneDate: value });
yield this.plugin.saveSettings();
}));
});
}
};
// src/main.ts
var TasksPlugin = class extends import_obsidian9.Plugin {
onload() {
return __async(this, null, function* () {
console.log('loading plugin "tasks"');
yield this.loadSettings();
this.addSettingTab(new SettingsTab({ plugin: this }));
initializeFile({
metadataCache: this.app.metadataCache,
vault: this.app.vault
});
const events = new Events({ obsidianEents: this.app.workspace });
this.cache = new Cache2({
metadataCache: this.app.metadataCache,
vault: this.app.vault,
events
});
this.inlineRenderer = new InlineRenderer({ plugin: this });
this.queryRenderer = new QueryRenderer({ plugin: this, events });
this.registerEditorExtension(newLivePreviewExtension());
new Commands({ plugin: this });
});
}
onunload() {
var _a;
console.log('unloading plugin "tasks"');
(_a = this.cache) == null ? void 0 : _a.unload();
}
loadSettings() {
return __async(this, null, function* () {
const newSettings = yield this.loadData();
updateSettings(newSettings);
});
}
saveSettings() {
return __async(this, null, function* () {
yield this.saveData(getSettings());
});
}
};
/*!
* rrule.js - Library for working with recurrence rules for calendar dates.
* https://github.com/jakubroztocil/rrule
*
* Copyright 2010, Jakub Roztocil and Lars Schoning
* Licenced under the BSD licence.
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
* Based on:
* python-dateutil - Extensions to the standard Python datetime module.
* Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
* Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
*/
/*!
* rrule.js - Library for working with recurrence rules for calendar dates.
* https://github.com/jakubroztocil/rrule
*
* Copyright 2010, Jakub Roztocil and Lars Schoning
* Licenced under the BSD licence.
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */