@dam-agents/cli 0.2.3-rc2 → 0.2.4-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +3854 -41
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -1898,8 +1898,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1898
1898
|
* @param {boolean} [combine] - if `true` or omitted, an optional value can be specified directly after the flag.
|
|
1899
1899
|
* @return {Command} `this` command for chaining
|
|
1900
1900
|
*/
|
|
1901
|
-
combineFlagAndOptionalValue(
|
|
1902
|
-
this._combineFlagAndOptionalValue = !!
|
|
1901
|
+
combineFlagAndOptionalValue(combine2 = true) {
|
|
1902
|
+
this._combineFlagAndOptionalValue = !!combine2;
|
|
1903
1903
|
return this;
|
|
1904
1904
|
}
|
|
1905
1905
|
/**
|
|
@@ -2048,18 +2048,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2048
2048
|
*
|
|
2049
2049
|
* @private
|
|
2050
2050
|
*/
|
|
2051
|
-
_prepareUserArgs(argv,
|
|
2051
|
+
_prepareUserArgs(argv, parseOptions2) {
|
|
2052
2052
|
if (argv !== void 0 && !Array.isArray(argv)) {
|
|
2053
2053
|
throw new Error("first parameter to parse must be array or undefined");
|
|
2054
2054
|
}
|
|
2055
|
-
|
|
2056
|
-
if (argv === void 0 &&
|
|
2055
|
+
parseOptions2 = parseOptions2 || {};
|
|
2056
|
+
if (argv === void 0 && parseOptions2.from === void 0) {
|
|
2057
2057
|
if (process10.versions?.electron) {
|
|
2058
|
-
|
|
2058
|
+
parseOptions2.from = "electron";
|
|
2059
2059
|
}
|
|
2060
2060
|
const execArgv = process10.execArgv ?? [];
|
|
2061
2061
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
|
|
2062
|
-
|
|
2062
|
+
parseOptions2.from = "eval";
|
|
2063
2063
|
}
|
|
2064
2064
|
}
|
|
2065
2065
|
if (argv === void 0) {
|
|
@@ -2067,7 +2067,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2067
2067
|
}
|
|
2068
2068
|
this.rawArgs = argv.slice();
|
|
2069
2069
|
let userArgs;
|
|
2070
|
-
switch (
|
|
2070
|
+
switch (parseOptions2.from) {
|
|
2071
2071
|
case void 0:
|
|
2072
2072
|
case "node":
|
|
2073
2073
|
this._scriptPath = argv[1];
|
|
@@ -2089,7 +2089,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2089
2089
|
break;
|
|
2090
2090
|
default:
|
|
2091
2091
|
throw new Error(
|
|
2092
|
-
`unexpected parse option { from: '${
|
|
2092
|
+
`unexpected parse option { from: '${parseOptions2.from}' }`
|
|
2093
2093
|
);
|
|
2094
2094
|
}
|
|
2095
2095
|
if (!this._name && this._scriptPath)
|
|
@@ -2119,9 +2119,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2119
2119
|
* @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron'
|
|
2120
2120
|
* @return {Command} `this` command for chaining
|
|
2121
2121
|
*/
|
|
2122
|
-
parse(argv,
|
|
2122
|
+
parse(argv, parseOptions2) {
|
|
2123
2123
|
this._prepareForParse();
|
|
2124
|
-
const userArgs = this._prepareUserArgs(argv,
|
|
2124
|
+
const userArgs = this._prepareUserArgs(argv, parseOptions2);
|
|
2125
2125
|
this._parseCommand([], userArgs);
|
|
2126
2126
|
return this;
|
|
2127
2127
|
}
|
|
@@ -2145,9 +2145,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2145
2145
|
* @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron'
|
|
2146
2146
|
* @return {Promise}
|
|
2147
2147
|
*/
|
|
2148
|
-
async parseAsync(argv,
|
|
2148
|
+
async parseAsync(argv, parseOptions2) {
|
|
2149
2149
|
this._prepareForParse();
|
|
2150
|
-
const userArgs = this._prepareUserArgs(argv,
|
|
2150
|
+
const userArgs = this._prepareUserArgs(argv, parseOptions2);
|
|
2151
2151
|
await this._parseCommand([], userArgs);
|
|
2152
2152
|
return this;
|
|
2153
2153
|
}
|
|
@@ -7341,7 +7341,7 @@ var require_b4a = __commonJS({
|
|
|
7341
7341
|
function from(value, encodingOrOffset, length) {
|
|
7342
7342
|
return Buffer.from(value, encodingOrOffset, length);
|
|
7343
7343
|
}
|
|
7344
|
-
function
|
|
7344
|
+
function includes2(buffer, value, byteOffset, encoding) {
|
|
7345
7345
|
return toBuffer(buffer).includes(value, byteOffset, encoding);
|
|
7346
7346
|
}
|
|
7347
7347
|
function indexOf(buffer, value, byfeOffset, encoding) {
|
|
@@ -7430,7 +7430,7 @@ var require_b4a = __commonJS({
|
|
|
7430
7430
|
equals,
|
|
7431
7431
|
fill,
|
|
7432
7432
|
from,
|
|
7433
|
-
includes,
|
|
7433
|
+
includes: includes2,
|
|
7434
7434
|
indexOf,
|
|
7435
7435
|
lastIndexOf,
|
|
7436
7436
|
swap16,
|
|
@@ -10896,9 +10896,9 @@ function wrapFetchWithTermsGate(host, baseFetch) {
|
|
|
10896
10896
|
return (async (input, init) => {
|
|
10897
10897
|
const response = await inner(input, init);
|
|
10898
10898
|
if (response.status === 412) {
|
|
10899
|
-
const
|
|
10899
|
+
const clone3 = response.clone();
|
|
10900
10900
|
try {
|
|
10901
|
-
const body = await
|
|
10901
|
+
const body = await clone3.json();
|
|
10902
10902
|
if (body.error === "terms_stale") {
|
|
10903
10903
|
throw new TermsStaleAtTransportError(host);
|
|
10904
10904
|
}
|
|
@@ -13809,15 +13809,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
13809
13809
|
}
|
|
13810
13810
|
}
|
|
13811
13811
|
const input = payload.value;
|
|
13812
|
-
const
|
|
13813
|
-
const
|
|
13814
|
-
if (
|
|
13812
|
+
const isDate2 = input instanceof Date;
|
|
13813
|
+
const isValidDate2 = isDate2 && !Number.isNaN(input.getTime());
|
|
13814
|
+
if (isValidDate2)
|
|
13815
13815
|
return payload;
|
|
13816
13816
|
payload.issues.push({
|
|
13817
13817
|
expected: "date",
|
|
13818
13818
|
code: "invalid_type",
|
|
13819
13819
|
input,
|
|
13820
|
-
...
|
|
13820
|
+
...isDate2 ? { received: "Invalid Date" } : {},
|
|
13821
13821
|
inst
|
|
13822
13822
|
});
|
|
13823
13823
|
return payload;
|
|
@@ -13863,14 +13863,14 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
13863
13863
|
};
|
|
13864
13864
|
});
|
|
13865
13865
|
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
13866
|
-
const
|
|
13866
|
+
const isPresent2 = key in input;
|
|
13867
13867
|
if (result.issues.length) {
|
|
13868
|
-
if (isOptionalIn && isOptionalOut && !
|
|
13868
|
+
if (isOptionalIn && isOptionalOut && !isPresent2) {
|
|
13869
13869
|
return;
|
|
13870
13870
|
}
|
|
13871
13871
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
13872
13872
|
}
|
|
13873
|
-
if (!
|
|
13873
|
+
if (!isPresent2 && !isOptionalIn) {
|
|
13874
13874
|
if (!result.issues.length) {
|
|
13875
13875
|
final.issues.push({
|
|
13876
13876
|
code: "invalid_type",
|
|
@@ -13882,7 +13882,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
13882
13882
|
return;
|
|
13883
13883
|
}
|
|
13884
13884
|
if (result.value === void 0) {
|
|
13885
|
-
if (
|
|
13885
|
+
if (isPresent2) {
|
|
13886
13886
|
final.value[key] = void 0;
|
|
13887
13887
|
}
|
|
13888
13888
|
} else {
|
|
@@ -14503,9 +14503,9 @@ function handleTupleResult(result, final, index) {
|
|
|
14503
14503
|
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
14504
14504
|
for (let i = 0; i < items.length; i++) {
|
|
14505
14505
|
const r = itemResults[i];
|
|
14506
|
-
const
|
|
14506
|
+
const isPresent2 = i < input.length;
|
|
14507
14507
|
if (r.issues.length) {
|
|
14508
|
-
if (!
|
|
14508
|
+
if (!isPresent2 && i >= optoutStart) {
|
|
14509
14509
|
final.value.length = i;
|
|
14510
14510
|
break;
|
|
14511
14511
|
}
|
|
@@ -21920,12 +21920,12 @@ function _uppercase(params) {
|
|
|
21920
21920
|
});
|
|
21921
21921
|
}
|
|
21922
21922
|
// @__NO_SIDE_EFFECTS__
|
|
21923
|
-
function _includes(
|
|
21923
|
+
function _includes(includes2, params) {
|
|
21924
21924
|
return new $ZodCheckIncludes({
|
|
21925
21925
|
check: "string_format",
|
|
21926
21926
|
format: "includes",
|
|
21927
21927
|
...normalizeParams(params),
|
|
21928
|
-
includes
|
|
21928
|
+
includes: includes2
|
|
21929
21929
|
});
|
|
21930
21930
|
}
|
|
21931
21931
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -25475,10 +25475,13 @@ var skillSourceSeedSchema = external_exports.object({
|
|
|
25475
25475
|
name: external_exports.string(),
|
|
25476
25476
|
gitUrl: external_exports.string()
|
|
25477
25477
|
});
|
|
25478
|
+
var templateCategorySchema = external_exports.enum(["harness", "preconfigured"]).default("harness");
|
|
25478
25479
|
var templateSpecSchema = external_exports.object({
|
|
25479
25480
|
version: external_exports.string(),
|
|
25480
25481
|
image: external_exports.string(),
|
|
25481
25482
|
description: external_exports.string().optional(),
|
|
25483
|
+
category: templateCategorySchema,
|
|
25484
|
+
experimental: external_exports.boolean().optional(),
|
|
25482
25485
|
mounts: external_exports.array(mountSchema).optional(),
|
|
25483
25486
|
init: external_exports.string().optional(),
|
|
25484
25487
|
env: external_exports.array(envVarConfigMapSchema).optional(),
|
|
@@ -25670,6 +25673,3049 @@ var scheduleStatusSchema = external_exports.object({
|
|
|
25670
25673
|
lastResult: external_exports.string().optional()
|
|
25671
25674
|
});
|
|
25672
25675
|
|
|
25676
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/index.js
|
|
25677
|
+
var esm_exports = {};
|
|
25678
|
+
__export(esm_exports, {
|
|
25679
|
+
ALL_WEEKDAYS: () => ALL_WEEKDAYS,
|
|
25680
|
+
Frequency: () => Frequency,
|
|
25681
|
+
RRule: () => RRule,
|
|
25682
|
+
RRuleSet: () => RRuleSet,
|
|
25683
|
+
Weekday: () => Weekday,
|
|
25684
|
+
datetime: () => datetime3,
|
|
25685
|
+
rrulestr: () => rrulestr
|
|
25686
|
+
});
|
|
25687
|
+
|
|
25688
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/weekday.js
|
|
25689
|
+
var ALL_WEEKDAYS = [
|
|
25690
|
+
"MO",
|
|
25691
|
+
"TU",
|
|
25692
|
+
"WE",
|
|
25693
|
+
"TH",
|
|
25694
|
+
"FR",
|
|
25695
|
+
"SA",
|
|
25696
|
+
"SU"
|
|
25697
|
+
];
|
|
25698
|
+
var Weekday = (
|
|
25699
|
+
/** @class */
|
|
25700
|
+
(function() {
|
|
25701
|
+
function Weekday2(weekday, n) {
|
|
25702
|
+
if (n === 0)
|
|
25703
|
+
throw new Error("Can't create weekday with n == 0");
|
|
25704
|
+
this.weekday = weekday;
|
|
25705
|
+
this.n = n;
|
|
25706
|
+
}
|
|
25707
|
+
Weekday2.fromStr = function(str) {
|
|
25708
|
+
return new Weekday2(ALL_WEEKDAYS.indexOf(str));
|
|
25709
|
+
};
|
|
25710
|
+
Weekday2.prototype.nth = function(n) {
|
|
25711
|
+
return this.n === n ? this : new Weekday2(this.weekday, n);
|
|
25712
|
+
};
|
|
25713
|
+
Weekday2.prototype.equals = function(other) {
|
|
25714
|
+
return this.weekday === other.weekday && this.n === other.n;
|
|
25715
|
+
};
|
|
25716
|
+
Weekday2.prototype.toString = function() {
|
|
25717
|
+
var s = ALL_WEEKDAYS[this.weekday];
|
|
25718
|
+
if (this.n)
|
|
25719
|
+
s = (this.n > 0 ? "+" : "") + String(this.n) + s;
|
|
25720
|
+
return s;
|
|
25721
|
+
};
|
|
25722
|
+
Weekday2.prototype.getJsWeekday = function() {
|
|
25723
|
+
return this.weekday === 6 ? 0 : this.weekday + 1;
|
|
25724
|
+
};
|
|
25725
|
+
return Weekday2;
|
|
25726
|
+
})()
|
|
25727
|
+
);
|
|
25728
|
+
|
|
25729
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/helpers.js
|
|
25730
|
+
var isPresent = function(value) {
|
|
25731
|
+
return value !== null && value !== void 0;
|
|
25732
|
+
};
|
|
25733
|
+
var isNumber = function(value) {
|
|
25734
|
+
return typeof value === "number";
|
|
25735
|
+
};
|
|
25736
|
+
var isWeekdayStr = function(value) {
|
|
25737
|
+
return typeof value === "string" && ALL_WEEKDAYS.includes(value);
|
|
25738
|
+
};
|
|
25739
|
+
var isArray = Array.isArray;
|
|
25740
|
+
var range = function(start, end) {
|
|
25741
|
+
if (end === void 0) {
|
|
25742
|
+
end = start;
|
|
25743
|
+
}
|
|
25744
|
+
if (arguments.length === 1) {
|
|
25745
|
+
end = start;
|
|
25746
|
+
start = 0;
|
|
25747
|
+
}
|
|
25748
|
+
var rang = [];
|
|
25749
|
+
for (var i = start; i < end; i++)
|
|
25750
|
+
rang.push(i);
|
|
25751
|
+
return rang;
|
|
25752
|
+
};
|
|
25753
|
+
var repeat = function(value, times) {
|
|
25754
|
+
var i = 0;
|
|
25755
|
+
var array2 = [];
|
|
25756
|
+
if (isArray(value)) {
|
|
25757
|
+
for (; i < times; i++)
|
|
25758
|
+
array2[i] = [].concat(value);
|
|
25759
|
+
} else {
|
|
25760
|
+
for (; i < times; i++)
|
|
25761
|
+
array2[i] = value;
|
|
25762
|
+
}
|
|
25763
|
+
return array2;
|
|
25764
|
+
};
|
|
25765
|
+
var toArray = function(item) {
|
|
25766
|
+
if (isArray(item)) {
|
|
25767
|
+
return item;
|
|
25768
|
+
}
|
|
25769
|
+
return [item];
|
|
25770
|
+
};
|
|
25771
|
+
function padStart(item, targetLength, padString) {
|
|
25772
|
+
if (padString === void 0) {
|
|
25773
|
+
padString = " ";
|
|
25774
|
+
}
|
|
25775
|
+
var str = String(item);
|
|
25776
|
+
targetLength = targetLength >> 0;
|
|
25777
|
+
if (str.length > targetLength) {
|
|
25778
|
+
return String(str);
|
|
25779
|
+
}
|
|
25780
|
+
targetLength = targetLength - str.length;
|
|
25781
|
+
if (targetLength > padString.length) {
|
|
25782
|
+
padString += repeat(padString, targetLength / padString.length);
|
|
25783
|
+
}
|
|
25784
|
+
return padString.slice(0, targetLength) + String(str);
|
|
25785
|
+
}
|
|
25786
|
+
var split = function(str, sep, num) {
|
|
25787
|
+
var splits = str.split(sep);
|
|
25788
|
+
return num ? splits.slice(0, num).concat([splits.slice(num).join(sep)]) : splits;
|
|
25789
|
+
};
|
|
25790
|
+
var pymod = function(a, b2) {
|
|
25791
|
+
var r = a % b2;
|
|
25792
|
+
return r * b2 < 0 ? r + b2 : r;
|
|
25793
|
+
};
|
|
25794
|
+
var divmod = function(a, b2) {
|
|
25795
|
+
return { div: Math.floor(a / b2), mod: pymod(a, b2) };
|
|
25796
|
+
};
|
|
25797
|
+
var empty = function(obj) {
|
|
25798
|
+
return !isPresent(obj) || obj.length === 0;
|
|
25799
|
+
};
|
|
25800
|
+
var notEmpty = function(obj) {
|
|
25801
|
+
return !empty(obj);
|
|
25802
|
+
};
|
|
25803
|
+
var includes = function(arr, val) {
|
|
25804
|
+
return notEmpty(arr) && arr.indexOf(val) !== -1;
|
|
25805
|
+
};
|
|
25806
|
+
|
|
25807
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/dateutil.js
|
|
25808
|
+
var datetime3 = function(y, m, d2, h2, i, s) {
|
|
25809
|
+
if (h2 === void 0) {
|
|
25810
|
+
h2 = 0;
|
|
25811
|
+
}
|
|
25812
|
+
if (i === void 0) {
|
|
25813
|
+
i = 0;
|
|
25814
|
+
}
|
|
25815
|
+
if (s === void 0) {
|
|
25816
|
+
s = 0;
|
|
25817
|
+
}
|
|
25818
|
+
return new Date(Date.UTC(y, m - 1, d2, h2, i, s));
|
|
25819
|
+
};
|
|
25820
|
+
var MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
25821
|
+
var ONE_DAY = 1e3 * 60 * 60 * 24;
|
|
25822
|
+
var MAXYEAR = 9999;
|
|
25823
|
+
var ORDINAL_BASE = datetime3(1970, 1, 1);
|
|
25824
|
+
var PY_WEEKDAYS = [6, 0, 1, 2, 3, 4, 5];
|
|
25825
|
+
var isLeapYear = function(year) {
|
|
25826
|
+
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
25827
|
+
};
|
|
25828
|
+
var isDate = function(value) {
|
|
25829
|
+
return value instanceof Date;
|
|
25830
|
+
};
|
|
25831
|
+
var isValidDate = function(value) {
|
|
25832
|
+
return isDate(value) && !isNaN(value.getTime());
|
|
25833
|
+
};
|
|
25834
|
+
var daysBetween = function(date1, date22) {
|
|
25835
|
+
var date1ms = date1.getTime();
|
|
25836
|
+
var date2ms = date22.getTime();
|
|
25837
|
+
var differencems = date1ms - date2ms;
|
|
25838
|
+
return Math.round(differencems / ONE_DAY);
|
|
25839
|
+
};
|
|
25840
|
+
var toOrdinal = function(date5) {
|
|
25841
|
+
return daysBetween(date5, ORDINAL_BASE);
|
|
25842
|
+
};
|
|
25843
|
+
var fromOrdinal = function(ordinal) {
|
|
25844
|
+
return new Date(ORDINAL_BASE.getTime() + ordinal * ONE_DAY);
|
|
25845
|
+
};
|
|
25846
|
+
var getMonthDays = function(date5) {
|
|
25847
|
+
var month = date5.getUTCMonth();
|
|
25848
|
+
return month === 1 && isLeapYear(date5.getUTCFullYear()) ? 29 : MONTH_DAYS[month];
|
|
25849
|
+
};
|
|
25850
|
+
var getWeekday = function(date5) {
|
|
25851
|
+
return PY_WEEKDAYS[date5.getUTCDay()];
|
|
25852
|
+
};
|
|
25853
|
+
var monthRange = function(year, month) {
|
|
25854
|
+
var date5 = datetime3(year, month + 1, 1);
|
|
25855
|
+
return [getWeekday(date5), getMonthDays(date5)];
|
|
25856
|
+
};
|
|
25857
|
+
var combine = function(date5, time3) {
|
|
25858
|
+
time3 = time3 || date5;
|
|
25859
|
+
return new Date(Date.UTC(date5.getUTCFullYear(), date5.getUTCMonth(), date5.getUTCDate(), time3.getHours(), time3.getMinutes(), time3.getSeconds(), time3.getMilliseconds()));
|
|
25860
|
+
};
|
|
25861
|
+
var clone2 = function(date5) {
|
|
25862
|
+
var dolly = new Date(date5.getTime());
|
|
25863
|
+
return dolly;
|
|
25864
|
+
};
|
|
25865
|
+
var cloneDates = function(dates) {
|
|
25866
|
+
var clones = [];
|
|
25867
|
+
for (var i = 0; i < dates.length; i++) {
|
|
25868
|
+
clones.push(clone2(dates[i]));
|
|
25869
|
+
}
|
|
25870
|
+
return clones;
|
|
25871
|
+
};
|
|
25872
|
+
var sort = function(dates) {
|
|
25873
|
+
dates.sort(function(a, b2) {
|
|
25874
|
+
return a.getTime() - b2.getTime();
|
|
25875
|
+
});
|
|
25876
|
+
};
|
|
25877
|
+
var timeToUntilString = function(time3, utc) {
|
|
25878
|
+
if (utc === void 0) {
|
|
25879
|
+
utc = true;
|
|
25880
|
+
}
|
|
25881
|
+
var date5 = new Date(time3);
|
|
25882
|
+
return [
|
|
25883
|
+
padStart(date5.getUTCFullYear().toString(), 4, "0"),
|
|
25884
|
+
padStart(date5.getUTCMonth() + 1, 2, "0"),
|
|
25885
|
+
padStart(date5.getUTCDate(), 2, "0"),
|
|
25886
|
+
"T",
|
|
25887
|
+
padStart(date5.getUTCHours(), 2, "0"),
|
|
25888
|
+
padStart(date5.getUTCMinutes(), 2, "0"),
|
|
25889
|
+
padStart(date5.getUTCSeconds(), 2, "0"),
|
|
25890
|
+
utc ? "Z" : ""
|
|
25891
|
+
].join("");
|
|
25892
|
+
};
|
|
25893
|
+
var untilStringToDate = function(until) {
|
|
25894
|
+
var re = /^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/;
|
|
25895
|
+
var bits = re.exec(until);
|
|
25896
|
+
if (!bits)
|
|
25897
|
+
throw new Error("Invalid UNTIL value: ".concat(until));
|
|
25898
|
+
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));
|
|
25899
|
+
};
|
|
25900
|
+
var dateTZtoISO8601 = function(date5, timeZone) {
|
|
25901
|
+
var dateStr = date5.toLocaleString("sv-SE", { timeZone });
|
|
25902
|
+
return dateStr.replace(" ", "T") + "Z";
|
|
25903
|
+
};
|
|
25904
|
+
var dateInTimeZone = function(date5, timeZone) {
|
|
25905
|
+
var localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
25906
|
+
var dateInLocalTZ = new Date(dateTZtoISO8601(date5, localTimeZone));
|
|
25907
|
+
var dateInTargetTZ = new Date(dateTZtoISO8601(date5, timeZone !== null && timeZone !== void 0 ? timeZone : "UTC"));
|
|
25908
|
+
var tzOffset = dateInTargetTZ.getTime() - dateInLocalTZ.getTime();
|
|
25909
|
+
return new Date(date5.getTime() - tzOffset);
|
|
25910
|
+
};
|
|
25911
|
+
|
|
25912
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/iterresult.js
|
|
25913
|
+
var IterResult = (
|
|
25914
|
+
/** @class */
|
|
25915
|
+
(function() {
|
|
25916
|
+
function IterResult2(method, args) {
|
|
25917
|
+
this.minDate = null;
|
|
25918
|
+
this.maxDate = null;
|
|
25919
|
+
this._result = [];
|
|
25920
|
+
this.total = 0;
|
|
25921
|
+
this.method = method;
|
|
25922
|
+
this.args = args;
|
|
25923
|
+
if (method === "between") {
|
|
25924
|
+
this.maxDate = args.inc ? args.before : new Date(args.before.getTime() - 1);
|
|
25925
|
+
this.minDate = args.inc ? args.after : new Date(args.after.getTime() + 1);
|
|
25926
|
+
} else if (method === "before") {
|
|
25927
|
+
this.maxDate = args.inc ? args.dt : new Date(args.dt.getTime() - 1);
|
|
25928
|
+
} else if (method === "after") {
|
|
25929
|
+
this.minDate = args.inc ? args.dt : new Date(args.dt.getTime() + 1);
|
|
25930
|
+
}
|
|
25931
|
+
}
|
|
25932
|
+
IterResult2.prototype.accept = function(date5) {
|
|
25933
|
+
++this.total;
|
|
25934
|
+
var tooEarly = this.minDate && date5 < this.minDate;
|
|
25935
|
+
var tooLate = this.maxDate && date5 > this.maxDate;
|
|
25936
|
+
if (this.method === "between") {
|
|
25937
|
+
if (tooEarly)
|
|
25938
|
+
return true;
|
|
25939
|
+
if (tooLate)
|
|
25940
|
+
return false;
|
|
25941
|
+
} else if (this.method === "before") {
|
|
25942
|
+
if (tooLate)
|
|
25943
|
+
return false;
|
|
25944
|
+
} else if (this.method === "after") {
|
|
25945
|
+
if (tooEarly)
|
|
25946
|
+
return true;
|
|
25947
|
+
this.add(date5);
|
|
25948
|
+
return false;
|
|
25949
|
+
}
|
|
25950
|
+
return this.add(date5);
|
|
25951
|
+
};
|
|
25952
|
+
IterResult2.prototype.add = function(date5) {
|
|
25953
|
+
this._result.push(date5);
|
|
25954
|
+
return true;
|
|
25955
|
+
};
|
|
25956
|
+
IterResult2.prototype.getValue = function() {
|
|
25957
|
+
var res = this._result;
|
|
25958
|
+
switch (this.method) {
|
|
25959
|
+
case "all":
|
|
25960
|
+
case "between":
|
|
25961
|
+
return res;
|
|
25962
|
+
case "before":
|
|
25963
|
+
case "after":
|
|
25964
|
+
default:
|
|
25965
|
+
return res.length ? res[res.length - 1] : null;
|
|
25966
|
+
}
|
|
25967
|
+
};
|
|
25968
|
+
IterResult2.prototype.clone = function() {
|
|
25969
|
+
return new IterResult2(this.method, this.args);
|
|
25970
|
+
};
|
|
25971
|
+
return IterResult2;
|
|
25972
|
+
})()
|
|
25973
|
+
);
|
|
25974
|
+
var iterresult_default = IterResult;
|
|
25975
|
+
|
|
25976
|
+
// ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
25977
|
+
var extendStatics = function(d2, b2) {
|
|
25978
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
|
|
25979
|
+
d3.__proto__ = b3;
|
|
25980
|
+
} || function(d3, b3) {
|
|
25981
|
+
for (var p2 in b3) if (Object.prototype.hasOwnProperty.call(b3, p2)) d3[p2] = b3[p2];
|
|
25982
|
+
};
|
|
25983
|
+
return extendStatics(d2, b2);
|
|
25984
|
+
};
|
|
25985
|
+
function __extends(d2, b2) {
|
|
25986
|
+
if (typeof b2 !== "function" && b2 !== null)
|
|
25987
|
+
throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
|
|
25988
|
+
extendStatics(d2, b2);
|
|
25989
|
+
function __() {
|
|
25990
|
+
this.constructor = d2;
|
|
25991
|
+
}
|
|
25992
|
+
d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
|
|
25993
|
+
}
|
|
25994
|
+
var __assign = function() {
|
|
25995
|
+
__assign = Object.assign || function __assign2(t) {
|
|
25996
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
25997
|
+
s = arguments[i];
|
|
25998
|
+
for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2)) t[p2] = s[p2];
|
|
25999
|
+
}
|
|
26000
|
+
return t;
|
|
26001
|
+
};
|
|
26002
|
+
return __assign.apply(this, arguments);
|
|
26003
|
+
};
|
|
26004
|
+
function __spreadArray(to, from, pack) {
|
|
26005
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26006
|
+
if (ar || !(i in from)) {
|
|
26007
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
26008
|
+
ar[i] = from[i];
|
|
26009
|
+
}
|
|
26010
|
+
}
|
|
26011
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26012
|
+
}
|
|
26013
|
+
|
|
26014
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/callbackiterresult.js
|
|
26015
|
+
var CallbackIterResult = (
|
|
26016
|
+
/** @class */
|
|
26017
|
+
(function(_super) {
|
|
26018
|
+
__extends(CallbackIterResult2, _super);
|
|
26019
|
+
function CallbackIterResult2(method, args, iterator) {
|
|
26020
|
+
var _this = _super.call(this, method, args) || this;
|
|
26021
|
+
_this.iterator = iterator;
|
|
26022
|
+
return _this;
|
|
26023
|
+
}
|
|
26024
|
+
CallbackIterResult2.prototype.add = function(date5) {
|
|
26025
|
+
if (this.iterator(date5, this._result.length)) {
|
|
26026
|
+
this._result.push(date5);
|
|
26027
|
+
return true;
|
|
26028
|
+
}
|
|
26029
|
+
return false;
|
|
26030
|
+
};
|
|
26031
|
+
return CallbackIterResult2;
|
|
26032
|
+
})(iterresult_default)
|
|
26033
|
+
);
|
|
26034
|
+
var callbackiterresult_default = CallbackIterResult;
|
|
26035
|
+
|
|
26036
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/nlp/i18n.js
|
|
26037
|
+
var ENGLISH = {
|
|
26038
|
+
dayNames: [
|
|
26039
|
+
"Sunday",
|
|
26040
|
+
"Monday",
|
|
26041
|
+
"Tuesday",
|
|
26042
|
+
"Wednesday",
|
|
26043
|
+
"Thursday",
|
|
26044
|
+
"Friday",
|
|
26045
|
+
"Saturday"
|
|
26046
|
+
],
|
|
26047
|
+
monthNames: [
|
|
26048
|
+
"January",
|
|
26049
|
+
"February",
|
|
26050
|
+
"March",
|
|
26051
|
+
"April",
|
|
26052
|
+
"May",
|
|
26053
|
+
"June",
|
|
26054
|
+
"July",
|
|
26055
|
+
"August",
|
|
26056
|
+
"September",
|
|
26057
|
+
"October",
|
|
26058
|
+
"November",
|
|
26059
|
+
"December"
|
|
26060
|
+
],
|
|
26061
|
+
tokens: {
|
|
26062
|
+
SKIP: /^[ \r\n\t]+|^\.$/,
|
|
26063
|
+
number: /^[1-9][0-9]*/,
|
|
26064
|
+
numberAsText: /^(one|two|three)/i,
|
|
26065
|
+
every: /^every/i,
|
|
26066
|
+
"day(s)": /^days?/i,
|
|
26067
|
+
"weekday(s)": /^weekdays?/i,
|
|
26068
|
+
"week(s)": /^weeks?/i,
|
|
26069
|
+
"hour(s)": /^hours?/i,
|
|
26070
|
+
"minute(s)": /^minutes?/i,
|
|
26071
|
+
"month(s)": /^months?/i,
|
|
26072
|
+
"year(s)": /^years?/i,
|
|
26073
|
+
on: /^(on|in)/i,
|
|
26074
|
+
at: /^(at)/i,
|
|
26075
|
+
the: /^the/i,
|
|
26076
|
+
first: /^first/i,
|
|
26077
|
+
second: /^second/i,
|
|
26078
|
+
third: /^third/i,
|
|
26079
|
+
nth: /^([1-9][0-9]*)(\.|th|nd|rd|st)/i,
|
|
26080
|
+
last: /^last/i,
|
|
26081
|
+
for: /^for/i,
|
|
26082
|
+
"time(s)": /^times?/i,
|
|
26083
|
+
until: /^(un)?til/i,
|
|
26084
|
+
monday: /^mo(n(day)?)?/i,
|
|
26085
|
+
tuesday: /^tu(e(s(day)?)?)?/i,
|
|
26086
|
+
wednesday: /^we(d(n(esday)?)?)?/i,
|
|
26087
|
+
thursday: /^th(u(r(sday)?)?)?/i,
|
|
26088
|
+
friday: /^fr(i(day)?)?/i,
|
|
26089
|
+
saturday: /^sa(t(urday)?)?/i,
|
|
26090
|
+
sunday: /^su(n(day)?)?/i,
|
|
26091
|
+
january: /^jan(uary)?/i,
|
|
26092
|
+
february: /^feb(ruary)?/i,
|
|
26093
|
+
march: /^mar(ch)?/i,
|
|
26094
|
+
april: /^apr(il)?/i,
|
|
26095
|
+
may: /^may/i,
|
|
26096
|
+
june: /^june?/i,
|
|
26097
|
+
july: /^july?/i,
|
|
26098
|
+
august: /^aug(ust)?/i,
|
|
26099
|
+
september: /^sep(t(ember)?)?/i,
|
|
26100
|
+
october: /^oct(ober)?/i,
|
|
26101
|
+
november: /^nov(ember)?/i,
|
|
26102
|
+
december: /^dec(ember)?/i,
|
|
26103
|
+
comma: /^(,\s*|(and|or)\s*)+/i
|
|
26104
|
+
}
|
|
26105
|
+
};
|
|
26106
|
+
var i18n_default = ENGLISH;
|
|
26107
|
+
|
|
26108
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/nlp/totext.js
|
|
26109
|
+
var contains = function(arr, val) {
|
|
26110
|
+
return arr.indexOf(val) !== -1;
|
|
26111
|
+
};
|
|
26112
|
+
var defaultGetText = function(id) {
|
|
26113
|
+
return id.toString();
|
|
26114
|
+
};
|
|
26115
|
+
var defaultDateFormatter = function(year, month, day) {
|
|
26116
|
+
return "".concat(month, " ").concat(day, ", ").concat(year);
|
|
26117
|
+
};
|
|
26118
|
+
var ToText = (
|
|
26119
|
+
/** @class */
|
|
26120
|
+
(function() {
|
|
26121
|
+
function ToText2(rrule, gettext, language, dateFormatter) {
|
|
26122
|
+
if (gettext === void 0) {
|
|
26123
|
+
gettext = defaultGetText;
|
|
26124
|
+
}
|
|
26125
|
+
if (language === void 0) {
|
|
26126
|
+
language = i18n_default;
|
|
26127
|
+
}
|
|
26128
|
+
if (dateFormatter === void 0) {
|
|
26129
|
+
dateFormatter = defaultDateFormatter;
|
|
26130
|
+
}
|
|
26131
|
+
this.text = [];
|
|
26132
|
+
this.language = language || i18n_default;
|
|
26133
|
+
this.gettext = gettext;
|
|
26134
|
+
this.dateFormatter = dateFormatter;
|
|
26135
|
+
this.rrule = rrule;
|
|
26136
|
+
this.options = rrule.options;
|
|
26137
|
+
this.origOptions = rrule.origOptions;
|
|
26138
|
+
if (this.origOptions.bymonthday) {
|
|
26139
|
+
var bymonthday = [].concat(this.options.bymonthday);
|
|
26140
|
+
var bynmonthday = [].concat(this.options.bynmonthday);
|
|
26141
|
+
bymonthday.sort(function(a, b2) {
|
|
26142
|
+
return a - b2;
|
|
26143
|
+
});
|
|
26144
|
+
bynmonthday.sort(function(a, b2) {
|
|
26145
|
+
return b2 - a;
|
|
26146
|
+
});
|
|
26147
|
+
this.bymonthday = bymonthday.concat(bynmonthday);
|
|
26148
|
+
if (!this.bymonthday.length)
|
|
26149
|
+
this.bymonthday = null;
|
|
26150
|
+
}
|
|
26151
|
+
if (isPresent(this.origOptions.byweekday)) {
|
|
26152
|
+
var byweekday = !isArray(this.origOptions.byweekday) ? [this.origOptions.byweekday] : this.origOptions.byweekday;
|
|
26153
|
+
var days = String(byweekday);
|
|
26154
|
+
this.byweekday = {
|
|
26155
|
+
allWeeks: byweekday.filter(function(weekday) {
|
|
26156
|
+
return !weekday.n;
|
|
26157
|
+
}),
|
|
26158
|
+
someWeeks: byweekday.filter(function(weekday) {
|
|
26159
|
+
return Boolean(weekday.n);
|
|
26160
|
+
}),
|
|
26161
|
+
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,
|
|
26162
|
+
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
|
|
26163
|
+
};
|
|
26164
|
+
var sortWeekDays = function(a, b2) {
|
|
26165
|
+
return a.weekday - b2.weekday;
|
|
26166
|
+
};
|
|
26167
|
+
this.byweekday.allWeeks.sort(sortWeekDays);
|
|
26168
|
+
this.byweekday.someWeeks.sort(sortWeekDays);
|
|
26169
|
+
if (!this.byweekday.allWeeks.length)
|
|
26170
|
+
this.byweekday.allWeeks = null;
|
|
26171
|
+
if (!this.byweekday.someWeeks.length)
|
|
26172
|
+
this.byweekday.someWeeks = null;
|
|
26173
|
+
} else {
|
|
26174
|
+
this.byweekday = null;
|
|
26175
|
+
}
|
|
26176
|
+
}
|
|
26177
|
+
ToText2.isFullyConvertible = function(rrule) {
|
|
26178
|
+
var canConvert = true;
|
|
26179
|
+
if (!(rrule.options.freq in ToText2.IMPLEMENTED))
|
|
26180
|
+
return false;
|
|
26181
|
+
if (rrule.origOptions.until && rrule.origOptions.count)
|
|
26182
|
+
return false;
|
|
26183
|
+
for (var key in rrule.origOptions) {
|
|
26184
|
+
if (contains(["dtstart", "tzid", "wkst", "freq"], key))
|
|
26185
|
+
return true;
|
|
26186
|
+
if (!contains(ToText2.IMPLEMENTED[rrule.options.freq], key))
|
|
26187
|
+
return false;
|
|
26188
|
+
}
|
|
26189
|
+
return canConvert;
|
|
26190
|
+
};
|
|
26191
|
+
ToText2.prototype.isFullyConvertible = function() {
|
|
26192
|
+
return ToText2.isFullyConvertible(this.rrule);
|
|
26193
|
+
};
|
|
26194
|
+
ToText2.prototype.toString = function() {
|
|
26195
|
+
var gettext = this.gettext;
|
|
26196
|
+
if (!(this.options.freq in ToText2.IMPLEMENTED)) {
|
|
26197
|
+
return gettext("RRule error: Unable to fully convert this rrule to text");
|
|
26198
|
+
}
|
|
26199
|
+
this.text = [gettext("every")];
|
|
26200
|
+
this[RRule.FREQUENCIES[this.options.freq]]();
|
|
26201
|
+
if (this.options.until) {
|
|
26202
|
+
this.add(gettext("until"));
|
|
26203
|
+
var until = this.options.until;
|
|
26204
|
+
this.add(this.dateFormatter(until.getUTCFullYear(), this.language.monthNames[until.getUTCMonth()], until.getUTCDate()));
|
|
26205
|
+
} else if (this.options.count) {
|
|
26206
|
+
this.add(gettext("for")).add(this.options.count.toString()).add(this.plural(this.options.count) ? gettext("times") : gettext("time"));
|
|
26207
|
+
}
|
|
26208
|
+
if (!this.isFullyConvertible())
|
|
26209
|
+
this.add(gettext("(~ approximate)"));
|
|
26210
|
+
return this.text.join("");
|
|
26211
|
+
};
|
|
26212
|
+
ToText2.prototype.HOURLY = function() {
|
|
26213
|
+
var gettext = this.gettext;
|
|
26214
|
+
if (this.options.interval !== 1)
|
|
26215
|
+
this.add(this.options.interval.toString());
|
|
26216
|
+
this.add(this.plural(this.options.interval) ? gettext("hours") : gettext("hour"));
|
|
26217
|
+
};
|
|
26218
|
+
ToText2.prototype.MINUTELY = function() {
|
|
26219
|
+
var gettext = this.gettext;
|
|
26220
|
+
if (this.options.interval !== 1)
|
|
26221
|
+
this.add(this.options.interval.toString());
|
|
26222
|
+
this.add(this.plural(this.options.interval) ? gettext("minutes") : gettext("minute"));
|
|
26223
|
+
};
|
|
26224
|
+
ToText2.prototype.DAILY = function() {
|
|
26225
|
+
var gettext = this.gettext;
|
|
26226
|
+
if (this.options.interval !== 1)
|
|
26227
|
+
this.add(this.options.interval.toString());
|
|
26228
|
+
if (this.byweekday && this.byweekday.isWeekdays) {
|
|
26229
|
+
this.add(this.plural(this.options.interval) ? gettext("weekdays") : gettext("weekday"));
|
|
26230
|
+
} else {
|
|
26231
|
+
this.add(this.plural(this.options.interval) ? gettext("days") : gettext("day"));
|
|
26232
|
+
}
|
|
26233
|
+
if (this.origOptions.bymonth) {
|
|
26234
|
+
this.add(gettext("in"));
|
|
26235
|
+
this._bymonth();
|
|
26236
|
+
}
|
|
26237
|
+
if (this.bymonthday) {
|
|
26238
|
+
this._bymonthday();
|
|
26239
|
+
} else if (this.byweekday) {
|
|
26240
|
+
this._byweekday();
|
|
26241
|
+
} else if (this.origOptions.byhour) {
|
|
26242
|
+
this._byhour();
|
|
26243
|
+
}
|
|
26244
|
+
};
|
|
26245
|
+
ToText2.prototype.WEEKLY = function() {
|
|
26246
|
+
var gettext = this.gettext;
|
|
26247
|
+
if (this.options.interval !== 1) {
|
|
26248
|
+
this.add(this.options.interval.toString()).add(this.plural(this.options.interval) ? gettext("weeks") : gettext("week"));
|
|
26249
|
+
}
|
|
26250
|
+
if (this.byweekday && this.byweekday.isWeekdays) {
|
|
26251
|
+
if (this.options.interval === 1) {
|
|
26252
|
+
this.add(this.plural(this.options.interval) ? gettext("weekdays") : gettext("weekday"));
|
|
26253
|
+
} else {
|
|
26254
|
+
this.add(gettext("on")).add(gettext("weekdays"));
|
|
26255
|
+
}
|
|
26256
|
+
} else if (this.byweekday && this.byweekday.isEveryDay) {
|
|
26257
|
+
this.add(this.plural(this.options.interval) ? gettext("days") : gettext("day"));
|
|
26258
|
+
} else {
|
|
26259
|
+
if (this.options.interval === 1)
|
|
26260
|
+
this.add(gettext("week"));
|
|
26261
|
+
if (this.origOptions.bymonth) {
|
|
26262
|
+
this.add(gettext("in"));
|
|
26263
|
+
this._bymonth();
|
|
26264
|
+
}
|
|
26265
|
+
if (this.bymonthday) {
|
|
26266
|
+
this._bymonthday();
|
|
26267
|
+
} else if (this.byweekday) {
|
|
26268
|
+
this._byweekday();
|
|
26269
|
+
}
|
|
26270
|
+
if (this.origOptions.byhour) {
|
|
26271
|
+
this._byhour();
|
|
26272
|
+
}
|
|
26273
|
+
}
|
|
26274
|
+
};
|
|
26275
|
+
ToText2.prototype.MONTHLY = function() {
|
|
26276
|
+
var gettext = this.gettext;
|
|
26277
|
+
if (this.origOptions.bymonth) {
|
|
26278
|
+
if (this.options.interval !== 1) {
|
|
26279
|
+
this.add(this.options.interval.toString()).add(gettext("months"));
|
|
26280
|
+
if (this.plural(this.options.interval))
|
|
26281
|
+
this.add(gettext("in"));
|
|
26282
|
+
} else {
|
|
26283
|
+
}
|
|
26284
|
+
this._bymonth();
|
|
26285
|
+
} else {
|
|
26286
|
+
if (this.options.interval !== 1) {
|
|
26287
|
+
this.add(this.options.interval.toString());
|
|
26288
|
+
}
|
|
26289
|
+
this.add(this.plural(this.options.interval) ? gettext("months") : gettext("month"));
|
|
26290
|
+
}
|
|
26291
|
+
if (this.bymonthday) {
|
|
26292
|
+
this._bymonthday();
|
|
26293
|
+
} else if (this.byweekday && this.byweekday.isWeekdays) {
|
|
26294
|
+
this.add(gettext("on")).add(gettext("weekdays"));
|
|
26295
|
+
} else if (this.byweekday) {
|
|
26296
|
+
this._byweekday();
|
|
26297
|
+
}
|
|
26298
|
+
};
|
|
26299
|
+
ToText2.prototype.YEARLY = function() {
|
|
26300
|
+
var gettext = this.gettext;
|
|
26301
|
+
if (this.origOptions.bymonth) {
|
|
26302
|
+
if (this.options.interval !== 1) {
|
|
26303
|
+
this.add(this.options.interval.toString());
|
|
26304
|
+
this.add(gettext("years"));
|
|
26305
|
+
} else {
|
|
26306
|
+
}
|
|
26307
|
+
this._bymonth();
|
|
26308
|
+
} else {
|
|
26309
|
+
if (this.options.interval !== 1) {
|
|
26310
|
+
this.add(this.options.interval.toString());
|
|
26311
|
+
}
|
|
26312
|
+
this.add(this.plural(this.options.interval) ? gettext("years") : gettext("year"));
|
|
26313
|
+
}
|
|
26314
|
+
if (this.bymonthday) {
|
|
26315
|
+
this._bymonthday();
|
|
26316
|
+
} else if (this.byweekday) {
|
|
26317
|
+
this._byweekday();
|
|
26318
|
+
}
|
|
26319
|
+
if (this.options.byyearday) {
|
|
26320
|
+
this.add(gettext("on the")).add(this.list(this.options.byyearday, this.nth, gettext("and"))).add(gettext("day"));
|
|
26321
|
+
}
|
|
26322
|
+
if (this.options.byweekno) {
|
|
26323
|
+
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")));
|
|
26324
|
+
}
|
|
26325
|
+
};
|
|
26326
|
+
ToText2.prototype._bymonthday = function() {
|
|
26327
|
+
var gettext = this.gettext;
|
|
26328
|
+
if (this.byweekday && this.byweekday.allWeeks) {
|
|
26329
|
+
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")));
|
|
26330
|
+
} else {
|
|
26331
|
+
this.add(gettext("on the")).add(this.list(this.bymonthday, this.nth, gettext("and")));
|
|
26332
|
+
}
|
|
26333
|
+
};
|
|
26334
|
+
ToText2.prototype._byweekday = function() {
|
|
26335
|
+
var gettext = this.gettext;
|
|
26336
|
+
if (this.byweekday.allWeeks && !this.byweekday.isWeekdays) {
|
|
26337
|
+
this.add(gettext("on")).add(this.list(this.byweekday.allWeeks, this.weekdaytext));
|
|
26338
|
+
}
|
|
26339
|
+
if (this.byweekday.someWeeks) {
|
|
26340
|
+
if (this.byweekday.allWeeks)
|
|
26341
|
+
this.add(gettext("and"));
|
|
26342
|
+
this.add(gettext("on the")).add(this.list(this.byweekday.someWeeks, this.weekdaytext, gettext("and")));
|
|
26343
|
+
}
|
|
26344
|
+
};
|
|
26345
|
+
ToText2.prototype._byhour = function() {
|
|
26346
|
+
var gettext = this.gettext;
|
|
26347
|
+
this.add(gettext("at")).add(this.list(this.origOptions.byhour, void 0, gettext("and")));
|
|
26348
|
+
};
|
|
26349
|
+
ToText2.prototype._bymonth = function() {
|
|
26350
|
+
this.add(this.list(this.options.bymonth, this.monthtext, this.gettext("and")));
|
|
26351
|
+
};
|
|
26352
|
+
ToText2.prototype.nth = function(n) {
|
|
26353
|
+
n = parseInt(n.toString(), 10);
|
|
26354
|
+
var nth;
|
|
26355
|
+
var gettext = this.gettext;
|
|
26356
|
+
if (n === -1)
|
|
26357
|
+
return gettext("last");
|
|
26358
|
+
var npos = Math.abs(n);
|
|
26359
|
+
switch (npos) {
|
|
26360
|
+
case 1:
|
|
26361
|
+
case 21:
|
|
26362
|
+
case 31:
|
|
26363
|
+
nth = npos + gettext("st");
|
|
26364
|
+
break;
|
|
26365
|
+
case 2:
|
|
26366
|
+
case 22:
|
|
26367
|
+
nth = npos + gettext("nd");
|
|
26368
|
+
break;
|
|
26369
|
+
case 3:
|
|
26370
|
+
case 23:
|
|
26371
|
+
nth = npos + gettext("rd");
|
|
26372
|
+
break;
|
|
26373
|
+
default:
|
|
26374
|
+
nth = npos + gettext("th");
|
|
26375
|
+
}
|
|
26376
|
+
return n < 0 ? nth + " " + gettext("last") : nth;
|
|
26377
|
+
};
|
|
26378
|
+
ToText2.prototype.monthtext = function(m) {
|
|
26379
|
+
return this.language.monthNames[m - 1];
|
|
26380
|
+
};
|
|
26381
|
+
ToText2.prototype.weekdaytext = function(wday) {
|
|
26382
|
+
var weekday = isNumber(wday) ? (wday + 1) % 7 : wday.getJsWeekday();
|
|
26383
|
+
return (wday.n ? this.nth(wday.n) + " " : "") + this.language.dayNames[weekday];
|
|
26384
|
+
};
|
|
26385
|
+
ToText2.prototype.plural = function(n) {
|
|
26386
|
+
return n % 100 !== 1;
|
|
26387
|
+
};
|
|
26388
|
+
ToText2.prototype.add = function(s) {
|
|
26389
|
+
this.text.push(" ");
|
|
26390
|
+
this.text.push(s);
|
|
26391
|
+
return this;
|
|
26392
|
+
};
|
|
26393
|
+
ToText2.prototype.list = function(arr, callback, finalDelim, delim) {
|
|
26394
|
+
var _this = this;
|
|
26395
|
+
if (delim === void 0) {
|
|
26396
|
+
delim = ",";
|
|
26397
|
+
}
|
|
26398
|
+
if (!isArray(arr)) {
|
|
26399
|
+
arr = [arr];
|
|
26400
|
+
}
|
|
26401
|
+
var delimJoin = function(array2, delimiter, finalDelimiter) {
|
|
26402
|
+
var list = "";
|
|
26403
|
+
for (var i = 0; i < array2.length; i++) {
|
|
26404
|
+
if (i !== 0) {
|
|
26405
|
+
if (i === array2.length - 1) {
|
|
26406
|
+
list += " " + finalDelimiter + " ";
|
|
26407
|
+
} else {
|
|
26408
|
+
list += delimiter + " ";
|
|
26409
|
+
}
|
|
26410
|
+
}
|
|
26411
|
+
list += array2[i];
|
|
26412
|
+
}
|
|
26413
|
+
return list;
|
|
26414
|
+
};
|
|
26415
|
+
callback = callback || function(o) {
|
|
26416
|
+
return o.toString();
|
|
26417
|
+
};
|
|
26418
|
+
var realCallback = function(arg) {
|
|
26419
|
+
return callback && callback.call(_this, arg);
|
|
26420
|
+
};
|
|
26421
|
+
if (finalDelim) {
|
|
26422
|
+
return delimJoin(arr.map(realCallback), delim, finalDelim);
|
|
26423
|
+
} else {
|
|
26424
|
+
return arr.map(realCallback).join(delim + " ");
|
|
26425
|
+
}
|
|
26426
|
+
};
|
|
26427
|
+
return ToText2;
|
|
26428
|
+
})()
|
|
26429
|
+
);
|
|
26430
|
+
var totext_default = ToText;
|
|
26431
|
+
|
|
26432
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/nlp/parsetext.js
|
|
26433
|
+
var Parser = (
|
|
26434
|
+
/** @class */
|
|
26435
|
+
(function() {
|
|
26436
|
+
function Parser2(rules) {
|
|
26437
|
+
this.done = true;
|
|
26438
|
+
this.rules = rules;
|
|
26439
|
+
}
|
|
26440
|
+
Parser2.prototype.start = function(text) {
|
|
26441
|
+
this.text = text;
|
|
26442
|
+
this.done = false;
|
|
26443
|
+
return this.nextSymbol();
|
|
26444
|
+
};
|
|
26445
|
+
Parser2.prototype.isDone = function() {
|
|
26446
|
+
return this.done && this.symbol === null;
|
|
26447
|
+
};
|
|
26448
|
+
Parser2.prototype.nextSymbol = function() {
|
|
26449
|
+
var best;
|
|
26450
|
+
var bestSymbol;
|
|
26451
|
+
this.symbol = null;
|
|
26452
|
+
this.value = null;
|
|
26453
|
+
do {
|
|
26454
|
+
if (this.done)
|
|
26455
|
+
return false;
|
|
26456
|
+
var rule = void 0;
|
|
26457
|
+
best = null;
|
|
26458
|
+
for (var name_1 in this.rules) {
|
|
26459
|
+
rule = this.rules[name_1];
|
|
26460
|
+
var match = rule.exec(this.text);
|
|
26461
|
+
if (match) {
|
|
26462
|
+
if (best === null || match[0].length > best[0].length) {
|
|
26463
|
+
best = match;
|
|
26464
|
+
bestSymbol = name_1;
|
|
26465
|
+
}
|
|
26466
|
+
}
|
|
26467
|
+
}
|
|
26468
|
+
if (best != null) {
|
|
26469
|
+
this.text = this.text.substr(best[0].length);
|
|
26470
|
+
if (this.text === "")
|
|
26471
|
+
this.done = true;
|
|
26472
|
+
}
|
|
26473
|
+
if (best == null) {
|
|
26474
|
+
this.done = true;
|
|
26475
|
+
this.symbol = null;
|
|
26476
|
+
this.value = null;
|
|
26477
|
+
return;
|
|
26478
|
+
}
|
|
26479
|
+
} while (bestSymbol === "SKIP");
|
|
26480
|
+
this.symbol = bestSymbol;
|
|
26481
|
+
this.value = best;
|
|
26482
|
+
return true;
|
|
26483
|
+
};
|
|
26484
|
+
Parser2.prototype.accept = function(name) {
|
|
26485
|
+
if (this.symbol === name) {
|
|
26486
|
+
if (this.value) {
|
|
26487
|
+
var v2 = this.value;
|
|
26488
|
+
this.nextSymbol();
|
|
26489
|
+
return v2;
|
|
26490
|
+
}
|
|
26491
|
+
this.nextSymbol();
|
|
26492
|
+
return true;
|
|
26493
|
+
}
|
|
26494
|
+
return false;
|
|
26495
|
+
};
|
|
26496
|
+
Parser2.prototype.acceptNumber = function() {
|
|
26497
|
+
return this.accept("number");
|
|
26498
|
+
};
|
|
26499
|
+
Parser2.prototype.expect = function(name) {
|
|
26500
|
+
if (this.accept(name))
|
|
26501
|
+
return true;
|
|
26502
|
+
throw new Error("expected " + name + " but found " + this.symbol);
|
|
26503
|
+
};
|
|
26504
|
+
return Parser2;
|
|
26505
|
+
})()
|
|
26506
|
+
);
|
|
26507
|
+
function parseText(text, language) {
|
|
26508
|
+
if (language === void 0) {
|
|
26509
|
+
language = i18n_default;
|
|
26510
|
+
}
|
|
26511
|
+
var options = {};
|
|
26512
|
+
var ttr = new Parser(language.tokens);
|
|
26513
|
+
if (!ttr.start(text))
|
|
26514
|
+
return null;
|
|
26515
|
+
S2();
|
|
26516
|
+
return options;
|
|
26517
|
+
function S2() {
|
|
26518
|
+
ttr.expect("every");
|
|
26519
|
+
var n = ttr.acceptNumber();
|
|
26520
|
+
if (n)
|
|
26521
|
+
options.interval = parseInt(n[0], 10);
|
|
26522
|
+
if (ttr.isDone())
|
|
26523
|
+
throw new Error("Unexpected end");
|
|
26524
|
+
switch (ttr.symbol) {
|
|
26525
|
+
case "day(s)":
|
|
26526
|
+
options.freq = RRule.DAILY;
|
|
26527
|
+
if (ttr.nextSymbol()) {
|
|
26528
|
+
AT();
|
|
26529
|
+
F2();
|
|
26530
|
+
}
|
|
26531
|
+
break;
|
|
26532
|
+
// FIXME Note: every 2 weekdays != every two weeks on weekdays.
|
|
26533
|
+
// DAILY on weekdays is not a valid rule
|
|
26534
|
+
case "weekday(s)":
|
|
26535
|
+
options.freq = RRule.WEEKLY;
|
|
26536
|
+
options.byweekday = [RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR];
|
|
26537
|
+
ttr.nextSymbol();
|
|
26538
|
+
AT();
|
|
26539
|
+
F2();
|
|
26540
|
+
break;
|
|
26541
|
+
case "week(s)":
|
|
26542
|
+
options.freq = RRule.WEEKLY;
|
|
26543
|
+
if (ttr.nextSymbol()) {
|
|
26544
|
+
ON();
|
|
26545
|
+
AT();
|
|
26546
|
+
F2();
|
|
26547
|
+
}
|
|
26548
|
+
break;
|
|
26549
|
+
case "hour(s)":
|
|
26550
|
+
options.freq = RRule.HOURLY;
|
|
26551
|
+
if (ttr.nextSymbol()) {
|
|
26552
|
+
ON();
|
|
26553
|
+
F2();
|
|
26554
|
+
}
|
|
26555
|
+
break;
|
|
26556
|
+
case "minute(s)":
|
|
26557
|
+
options.freq = RRule.MINUTELY;
|
|
26558
|
+
if (ttr.nextSymbol()) {
|
|
26559
|
+
ON();
|
|
26560
|
+
F2();
|
|
26561
|
+
}
|
|
26562
|
+
break;
|
|
26563
|
+
case "month(s)":
|
|
26564
|
+
options.freq = RRule.MONTHLY;
|
|
26565
|
+
if (ttr.nextSymbol()) {
|
|
26566
|
+
ON();
|
|
26567
|
+
F2();
|
|
26568
|
+
}
|
|
26569
|
+
break;
|
|
26570
|
+
case "year(s)":
|
|
26571
|
+
options.freq = RRule.YEARLY;
|
|
26572
|
+
if (ttr.nextSymbol()) {
|
|
26573
|
+
ON();
|
|
26574
|
+
F2();
|
|
26575
|
+
}
|
|
26576
|
+
break;
|
|
26577
|
+
case "monday":
|
|
26578
|
+
case "tuesday":
|
|
26579
|
+
case "wednesday":
|
|
26580
|
+
case "thursday":
|
|
26581
|
+
case "friday":
|
|
26582
|
+
case "saturday":
|
|
26583
|
+
case "sunday":
|
|
26584
|
+
options.freq = RRule.WEEKLY;
|
|
26585
|
+
var key = ttr.symbol.substr(0, 2).toUpperCase();
|
|
26586
|
+
options.byweekday = [RRule[key]];
|
|
26587
|
+
if (!ttr.nextSymbol())
|
|
26588
|
+
return;
|
|
26589
|
+
while (ttr.accept("comma")) {
|
|
26590
|
+
if (ttr.isDone())
|
|
26591
|
+
throw new Error("Unexpected end");
|
|
26592
|
+
var wkd = decodeWKD();
|
|
26593
|
+
if (!wkd) {
|
|
26594
|
+
throw new Error("Unexpected symbol " + ttr.symbol + ", expected weekday");
|
|
26595
|
+
}
|
|
26596
|
+
options.byweekday.push(RRule[wkd]);
|
|
26597
|
+
ttr.nextSymbol();
|
|
26598
|
+
}
|
|
26599
|
+
AT();
|
|
26600
|
+
MDAYs();
|
|
26601
|
+
F2();
|
|
26602
|
+
break;
|
|
26603
|
+
case "january":
|
|
26604
|
+
case "february":
|
|
26605
|
+
case "march":
|
|
26606
|
+
case "april":
|
|
26607
|
+
case "may":
|
|
26608
|
+
case "june":
|
|
26609
|
+
case "july":
|
|
26610
|
+
case "august":
|
|
26611
|
+
case "september":
|
|
26612
|
+
case "october":
|
|
26613
|
+
case "november":
|
|
26614
|
+
case "december":
|
|
26615
|
+
options.freq = RRule.YEARLY;
|
|
26616
|
+
options.bymonth = [decodeM()];
|
|
26617
|
+
if (!ttr.nextSymbol())
|
|
26618
|
+
return;
|
|
26619
|
+
while (ttr.accept("comma")) {
|
|
26620
|
+
if (ttr.isDone())
|
|
26621
|
+
throw new Error("Unexpected end");
|
|
26622
|
+
var m = decodeM();
|
|
26623
|
+
if (!m) {
|
|
26624
|
+
throw new Error("Unexpected symbol " + ttr.symbol + ", expected month");
|
|
26625
|
+
}
|
|
26626
|
+
options.bymonth.push(m);
|
|
26627
|
+
ttr.nextSymbol();
|
|
26628
|
+
}
|
|
26629
|
+
ON();
|
|
26630
|
+
F2();
|
|
26631
|
+
break;
|
|
26632
|
+
default:
|
|
26633
|
+
throw new Error("Unknown symbol");
|
|
26634
|
+
}
|
|
26635
|
+
}
|
|
26636
|
+
function ON() {
|
|
26637
|
+
var on = ttr.accept("on");
|
|
26638
|
+
var the = ttr.accept("the");
|
|
26639
|
+
if (!(on || the))
|
|
26640
|
+
return;
|
|
26641
|
+
do {
|
|
26642
|
+
var nth = decodeNTH();
|
|
26643
|
+
var wkd = decodeWKD();
|
|
26644
|
+
var m = decodeM();
|
|
26645
|
+
if (nth) {
|
|
26646
|
+
if (wkd) {
|
|
26647
|
+
ttr.nextSymbol();
|
|
26648
|
+
if (!options.byweekday)
|
|
26649
|
+
options.byweekday = [];
|
|
26650
|
+
options.byweekday.push(RRule[wkd].nth(nth));
|
|
26651
|
+
} else {
|
|
26652
|
+
if (!options.bymonthday)
|
|
26653
|
+
options.bymonthday = [];
|
|
26654
|
+
options.bymonthday.push(nth);
|
|
26655
|
+
ttr.accept("day(s)");
|
|
26656
|
+
}
|
|
26657
|
+
} else if (wkd) {
|
|
26658
|
+
ttr.nextSymbol();
|
|
26659
|
+
if (!options.byweekday)
|
|
26660
|
+
options.byweekday = [];
|
|
26661
|
+
options.byweekday.push(RRule[wkd]);
|
|
26662
|
+
} else if (ttr.symbol === "weekday(s)") {
|
|
26663
|
+
ttr.nextSymbol();
|
|
26664
|
+
if (!options.byweekday) {
|
|
26665
|
+
options.byweekday = [RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR];
|
|
26666
|
+
}
|
|
26667
|
+
} else if (ttr.symbol === "week(s)") {
|
|
26668
|
+
ttr.nextSymbol();
|
|
26669
|
+
var n = ttr.acceptNumber();
|
|
26670
|
+
if (!n) {
|
|
26671
|
+
throw new Error("Unexpected symbol " + ttr.symbol + ", expected week number");
|
|
26672
|
+
}
|
|
26673
|
+
options.byweekno = [parseInt(n[0], 10)];
|
|
26674
|
+
while (ttr.accept("comma")) {
|
|
26675
|
+
n = ttr.acceptNumber();
|
|
26676
|
+
if (!n) {
|
|
26677
|
+
throw new Error("Unexpected symbol " + ttr.symbol + "; expected monthday");
|
|
26678
|
+
}
|
|
26679
|
+
options.byweekno.push(parseInt(n[0], 10));
|
|
26680
|
+
}
|
|
26681
|
+
} else if (m) {
|
|
26682
|
+
ttr.nextSymbol();
|
|
26683
|
+
if (!options.bymonth)
|
|
26684
|
+
options.bymonth = [];
|
|
26685
|
+
options.bymonth.push(m);
|
|
26686
|
+
} else {
|
|
26687
|
+
return;
|
|
26688
|
+
}
|
|
26689
|
+
} while (ttr.accept("comma") || ttr.accept("the") || ttr.accept("on"));
|
|
26690
|
+
}
|
|
26691
|
+
function AT() {
|
|
26692
|
+
var at3 = ttr.accept("at");
|
|
26693
|
+
if (!at3)
|
|
26694
|
+
return;
|
|
26695
|
+
do {
|
|
26696
|
+
var n = ttr.acceptNumber();
|
|
26697
|
+
if (!n) {
|
|
26698
|
+
throw new Error("Unexpected symbol " + ttr.symbol + ", expected hour");
|
|
26699
|
+
}
|
|
26700
|
+
options.byhour = [parseInt(n[0], 10)];
|
|
26701
|
+
while (ttr.accept("comma")) {
|
|
26702
|
+
n = ttr.acceptNumber();
|
|
26703
|
+
if (!n) {
|
|
26704
|
+
throw new Error("Unexpected symbol " + ttr.symbol + "; expected hour");
|
|
26705
|
+
}
|
|
26706
|
+
options.byhour.push(parseInt(n[0], 10));
|
|
26707
|
+
}
|
|
26708
|
+
} while (ttr.accept("comma") || ttr.accept("at"));
|
|
26709
|
+
}
|
|
26710
|
+
function decodeM() {
|
|
26711
|
+
switch (ttr.symbol) {
|
|
26712
|
+
case "january":
|
|
26713
|
+
return 1;
|
|
26714
|
+
case "february":
|
|
26715
|
+
return 2;
|
|
26716
|
+
case "march":
|
|
26717
|
+
return 3;
|
|
26718
|
+
case "april":
|
|
26719
|
+
return 4;
|
|
26720
|
+
case "may":
|
|
26721
|
+
return 5;
|
|
26722
|
+
case "june":
|
|
26723
|
+
return 6;
|
|
26724
|
+
case "july":
|
|
26725
|
+
return 7;
|
|
26726
|
+
case "august":
|
|
26727
|
+
return 8;
|
|
26728
|
+
case "september":
|
|
26729
|
+
return 9;
|
|
26730
|
+
case "october":
|
|
26731
|
+
return 10;
|
|
26732
|
+
case "november":
|
|
26733
|
+
return 11;
|
|
26734
|
+
case "december":
|
|
26735
|
+
return 12;
|
|
26736
|
+
default:
|
|
26737
|
+
return false;
|
|
26738
|
+
}
|
|
26739
|
+
}
|
|
26740
|
+
function decodeWKD() {
|
|
26741
|
+
switch (ttr.symbol) {
|
|
26742
|
+
case "monday":
|
|
26743
|
+
case "tuesday":
|
|
26744
|
+
case "wednesday":
|
|
26745
|
+
case "thursday":
|
|
26746
|
+
case "friday":
|
|
26747
|
+
case "saturday":
|
|
26748
|
+
case "sunday":
|
|
26749
|
+
return ttr.symbol.substr(0, 2).toUpperCase();
|
|
26750
|
+
default:
|
|
26751
|
+
return false;
|
|
26752
|
+
}
|
|
26753
|
+
}
|
|
26754
|
+
function decodeNTH() {
|
|
26755
|
+
switch (ttr.symbol) {
|
|
26756
|
+
case "last":
|
|
26757
|
+
ttr.nextSymbol();
|
|
26758
|
+
return -1;
|
|
26759
|
+
case "first":
|
|
26760
|
+
ttr.nextSymbol();
|
|
26761
|
+
return 1;
|
|
26762
|
+
case "second":
|
|
26763
|
+
ttr.nextSymbol();
|
|
26764
|
+
return ttr.accept("last") ? -2 : 2;
|
|
26765
|
+
case "third":
|
|
26766
|
+
ttr.nextSymbol();
|
|
26767
|
+
return ttr.accept("last") ? -3 : 3;
|
|
26768
|
+
case "nth":
|
|
26769
|
+
var v2 = parseInt(ttr.value[1], 10);
|
|
26770
|
+
if (v2 < -366 || v2 > 366)
|
|
26771
|
+
throw new Error("Nth out of range: " + v2);
|
|
26772
|
+
ttr.nextSymbol();
|
|
26773
|
+
return ttr.accept("last") ? -v2 : v2;
|
|
26774
|
+
default:
|
|
26775
|
+
return false;
|
|
26776
|
+
}
|
|
26777
|
+
}
|
|
26778
|
+
function MDAYs() {
|
|
26779
|
+
ttr.accept("on");
|
|
26780
|
+
ttr.accept("the");
|
|
26781
|
+
var nth = decodeNTH();
|
|
26782
|
+
if (!nth)
|
|
26783
|
+
return;
|
|
26784
|
+
options.bymonthday = [nth];
|
|
26785
|
+
ttr.nextSymbol();
|
|
26786
|
+
while (ttr.accept("comma")) {
|
|
26787
|
+
nth = decodeNTH();
|
|
26788
|
+
if (!nth) {
|
|
26789
|
+
throw new Error("Unexpected symbol " + ttr.symbol + "; expected monthday");
|
|
26790
|
+
}
|
|
26791
|
+
options.bymonthday.push(nth);
|
|
26792
|
+
ttr.nextSymbol();
|
|
26793
|
+
}
|
|
26794
|
+
}
|
|
26795
|
+
function F2() {
|
|
26796
|
+
if (ttr.symbol === "until") {
|
|
26797
|
+
var date5 = Date.parse(ttr.text);
|
|
26798
|
+
if (!date5)
|
|
26799
|
+
throw new Error("Cannot parse until date:" + ttr.text);
|
|
26800
|
+
options.until = new Date(date5);
|
|
26801
|
+
} else if (ttr.accept("for")) {
|
|
26802
|
+
options.count = parseInt(ttr.value[0], 10);
|
|
26803
|
+
ttr.expect("number");
|
|
26804
|
+
}
|
|
26805
|
+
}
|
|
26806
|
+
}
|
|
26807
|
+
|
|
26808
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/types.js
|
|
26809
|
+
var Frequency;
|
|
26810
|
+
(function(Frequency3) {
|
|
26811
|
+
Frequency3[Frequency3["YEARLY"] = 0] = "YEARLY";
|
|
26812
|
+
Frequency3[Frequency3["MONTHLY"] = 1] = "MONTHLY";
|
|
26813
|
+
Frequency3[Frequency3["WEEKLY"] = 2] = "WEEKLY";
|
|
26814
|
+
Frequency3[Frequency3["DAILY"] = 3] = "DAILY";
|
|
26815
|
+
Frequency3[Frequency3["HOURLY"] = 4] = "HOURLY";
|
|
26816
|
+
Frequency3[Frequency3["MINUTELY"] = 5] = "MINUTELY";
|
|
26817
|
+
Frequency3[Frequency3["SECONDLY"] = 6] = "SECONDLY";
|
|
26818
|
+
})(Frequency || (Frequency = {}));
|
|
26819
|
+
function freqIsDailyOrGreater(freq) {
|
|
26820
|
+
return freq < Frequency.HOURLY;
|
|
26821
|
+
}
|
|
26822
|
+
|
|
26823
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/nlp/index.js
|
|
26824
|
+
var fromText = function(text, language) {
|
|
26825
|
+
if (language === void 0) {
|
|
26826
|
+
language = i18n_default;
|
|
26827
|
+
}
|
|
26828
|
+
return new RRule(parseText(text, language) || void 0);
|
|
26829
|
+
};
|
|
26830
|
+
var common = [
|
|
26831
|
+
"count",
|
|
26832
|
+
"until",
|
|
26833
|
+
"interval",
|
|
26834
|
+
"byweekday",
|
|
26835
|
+
"bymonthday",
|
|
26836
|
+
"bymonth"
|
|
26837
|
+
];
|
|
26838
|
+
totext_default.IMPLEMENTED = [];
|
|
26839
|
+
totext_default.IMPLEMENTED[Frequency.HOURLY] = common;
|
|
26840
|
+
totext_default.IMPLEMENTED[Frequency.MINUTELY] = common;
|
|
26841
|
+
totext_default.IMPLEMENTED[Frequency.DAILY] = ["byhour"].concat(common);
|
|
26842
|
+
totext_default.IMPLEMENTED[Frequency.WEEKLY] = common;
|
|
26843
|
+
totext_default.IMPLEMENTED[Frequency.MONTHLY] = common;
|
|
26844
|
+
totext_default.IMPLEMENTED[Frequency.YEARLY] = ["byweekno", "byyearday"].concat(common);
|
|
26845
|
+
var toText = function(rrule, gettext, language, dateFormatter) {
|
|
26846
|
+
return new totext_default(rrule, gettext, language, dateFormatter).toString();
|
|
26847
|
+
};
|
|
26848
|
+
var isFullyConvertible = totext_default.isFullyConvertible;
|
|
26849
|
+
|
|
26850
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/datetime.js
|
|
26851
|
+
var Time = (
|
|
26852
|
+
/** @class */
|
|
26853
|
+
(function() {
|
|
26854
|
+
function Time2(hour, minute, second, millisecond) {
|
|
26855
|
+
this.hour = hour;
|
|
26856
|
+
this.minute = minute;
|
|
26857
|
+
this.second = second;
|
|
26858
|
+
this.millisecond = millisecond || 0;
|
|
26859
|
+
}
|
|
26860
|
+
Time2.prototype.getHours = function() {
|
|
26861
|
+
return this.hour;
|
|
26862
|
+
};
|
|
26863
|
+
Time2.prototype.getMinutes = function() {
|
|
26864
|
+
return this.minute;
|
|
26865
|
+
};
|
|
26866
|
+
Time2.prototype.getSeconds = function() {
|
|
26867
|
+
return this.second;
|
|
26868
|
+
};
|
|
26869
|
+
Time2.prototype.getMilliseconds = function() {
|
|
26870
|
+
return this.millisecond;
|
|
26871
|
+
};
|
|
26872
|
+
Time2.prototype.getTime = function() {
|
|
26873
|
+
return (this.hour * 60 * 60 + this.minute * 60 + this.second) * 1e3 + this.millisecond;
|
|
26874
|
+
};
|
|
26875
|
+
return Time2;
|
|
26876
|
+
})()
|
|
26877
|
+
);
|
|
26878
|
+
var DateTime = (
|
|
26879
|
+
/** @class */
|
|
26880
|
+
(function(_super) {
|
|
26881
|
+
__extends(DateTime2, _super);
|
|
26882
|
+
function DateTime2(year, month, day, hour, minute, second, millisecond) {
|
|
26883
|
+
var _this = _super.call(this, hour, minute, second, millisecond) || this;
|
|
26884
|
+
_this.year = year;
|
|
26885
|
+
_this.month = month;
|
|
26886
|
+
_this.day = day;
|
|
26887
|
+
return _this;
|
|
26888
|
+
}
|
|
26889
|
+
DateTime2.fromDate = function(date5) {
|
|
26890
|
+
return new this(date5.getUTCFullYear(), date5.getUTCMonth() + 1, date5.getUTCDate(), date5.getUTCHours(), date5.getUTCMinutes(), date5.getUTCSeconds(), date5.valueOf() % 1e3);
|
|
26891
|
+
};
|
|
26892
|
+
DateTime2.prototype.getWeekday = function() {
|
|
26893
|
+
return getWeekday(new Date(this.getTime()));
|
|
26894
|
+
};
|
|
26895
|
+
DateTime2.prototype.getTime = function() {
|
|
26896
|
+
return new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)).getTime();
|
|
26897
|
+
};
|
|
26898
|
+
DateTime2.prototype.getDay = function() {
|
|
26899
|
+
return this.day;
|
|
26900
|
+
};
|
|
26901
|
+
DateTime2.prototype.getMonth = function() {
|
|
26902
|
+
return this.month;
|
|
26903
|
+
};
|
|
26904
|
+
DateTime2.prototype.getYear = function() {
|
|
26905
|
+
return this.year;
|
|
26906
|
+
};
|
|
26907
|
+
DateTime2.prototype.addYears = function(years) {
|
|
26908
|
+
this.year += years;
|
|
26909
|
+
};
|
|
26910
|
+
DateTime2.prototype.addMonths = function(months) {
|
|
26911
|
+
this.month += months;
|
|
26912
|
+
if (this.month > 12) {
|
|
26913
|
+
var yearDiv = Math.floor(this.month / 12);
|
|
26914
|
+
var monthMod = pymod(this.month, 12);
|
|
26915
|
+
this.month = monthMod;
|
|
26916
|
+
this.year += yearDiv;
|
|
26917
|
+
if (this.month === 0) {
|
|
26918
|
+
this.month = 12;
|
|
26919
|
+
--this.year;
|
|
26920
|
+
}
|
|
26921
|
+
}
|
|
26922
|
+
};
|
|
26923
|
+
DateTime2.prototype.addWeekly = function(days, wkst) {
|
|
26924
|
+
if (wkst > this.getWeekday()) {
|
|
26925
|
+
this.day += -(this.getWeekday() + 1 + (6 - wkst)) + days * 7;
|
|
26926
|
+
} else {
|
|
26927
|
+
this.day += -(this.getWeekday() - wkst) + days * 7;
|
|
26928
|
+
}
|
|
26929
|
+
this.fixDay();
|
|
26930
|
+
};
|
|
26931
|
+
DateTime2.prototype.addDaily = function(days) {
|
|
26932
|
+
this.day += days;
|
|
26933
|
+
this.fixDay();
|
|
26934
|
+
};
|
|
26935
|
+
DateTime2.prototype.addHours = function(hours, filtered, byhour) {
|
|
26936
|
+
if (filtered) {
|
|
26937
|
+
this.hour += Math.floor((23 - this.hour) / hours) * hours;
|
|
26938
|
+
}
|
|
26939
|
+
for (; ; ) {
|
|
26940
|
+
this.hour += hours;
|
|
26941
|
+
var _a3 = divmod(this.hour, 24), dayDiv = _a3.div, hourMod = _a3.mod;
|
|
26942
|
+
if (dayDiv) {
|
|
26943
|
+
this.hour = hourMod;
|
|
26944
|
+
this.addDaily(dayDiv);
|
|
26945
|
+
}
|
|
26946
|
+
if (empty(byhour) || includes(byhour, this.hour))
|
|
26947
|
+
break;
|
|
26948
|
+
}
|
|
26949
|
+
};
|
|
26950
|
+
DateTime2.prototype.addMinutes = function(minutes, filtered, byhour, byminute) {
|
|
26951
|
+
if (filtered) {
|
|
26952
|
+
this.minute += Math.floor((1439 - (this.hour * 60 + this.minute)) / minutes) * minutes;
|
|
26953
|
+
}
|
|
26954
|
+
for (; ; ) {
|
|
26955
|
+
this.minute += minutes;
|
|
26956
|
+
var _a3 = divmod(this.minute, 60), hourDiv = _a3.div, minuteMod = _a3.mod;
|
|
26957
|
+
if (hourDiv) {
|
|
26958
|
+
this.minute = minuteMod;
|
|
26959
|
+
this.addHours(hourDiv, false, byhour);
|
|
26960
|
+
}
|
|
26961
|
+
if ((empty(byhour) || includes(byhour, this.hour)) && (empty(byminute) || includes(byminute, this.minute))) {
|
|
26962
|
+
break;
|
|
26963
|
+
}
|
|
26964
|
+
}
|
|
26965
|
+
};
|
|
26966
|
+
DateTime2.prototype.addSeconds = function(seconds, filtered, byhour, byminute, bysecond) {
|
|
26967
|
+
if (filtered) {
|
|
26968
|
+
this.second += Math.floor((86399 - (this.hour * 3600 + this.minute * 60 + this.second)) / seconds) * seconds;
|
|
26969
|
+
}
|
|
26970
|
+
for (; ; ) {
|
|
26971
|
+
this.second += seconds;
|
|
26972
|
+
var _a3 = divmod(this.second, 60), minuteDiv = _a3.div, secondMod = _a3.mod;
|
|
26973
|
+
if (minuteDiv) {
|
|
26974
|
+
this.second = secondMod;
|
|
26975
|
+
this.addMinutes(minuteDiv, false, byhour, byminute);
|
|
26976
|
+
}
|
|
26977
|
+
if ((empty(byhour) || includes(byhour, this.hour)) && (empty(byminute) || includes(byminute, this.minute)) && (empty(bysecond) || includes(bysecond, this.second))) {
|
|
26978
|
+
break;
|
|
26979
|
+
}
|
|
26980
|
+
}
|
|
26981
|
+
};
|
|
26982
|
+
DateTime2.prototype.fixDay = function() {
|
|
26983
|
+
if (this.day <= 28) {
|
|
26984
|
+
return;
|
|
26985
|
+
}
|
|
26986
|
+
var daysinmonth = monthRange(this.year, this.month - 1)[1];
|
|
26987
|
+
if (this.day <= daysinmonth) {
|
|
26988
|
+
return;
|
|
26989
|
+
}
|
|
26990
|
+
while (this.day > daysinmonth) {
|
|
26991
|
+
this.day -= daysinmonth;
|
|
26992
|
+
++this.month;
|
|
26993
|
+
if (this.month === 13) {
|
|
26994
|
+
this.month = 1;
|
|
26995
|
+
++this.year;
|
|
26996
|
+
if (this.year > MAXYEAR) {
|
|
26997
|
+
return;
|
|
26998
|
+
}
|
|
26999
|
+
}
|
|
27000
|
+
daysinmonth = monthRange(this.year, this.month - 1)[1];
|
|
27001
|
+
}
|
|
27002
|
+
};
|
|
27003
|
+
DateTime2.prototype.add = function(options, filtered) {
|
|
27004
|
+
var freq = options.freq, interval = options.interval, wkst = options.wkst, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;
|
|
27005
|
+
switch (freq) {
|
|
27006
|
+
case Frequency.YEARLY:
|
|
27007
|
+
return this.addYears(interval);
|
|
27008
|
+
case Frequency.MONTHLY:
|
|
27009
|
+
return this.addMonths(interval);
|
|
27010
|
+
case Frequency.WEEKLY:
|
|
27011
|
+
return this.addWeekly(interval, wkst);
|
|
27012
|
+
case Frequency.DAILY:
|
|
27013
|
+
return this.addDaily(interval);
|
|
27014
|
+
case Frequency.HOURLY:
|
|
27015
|
+
return this.addHours(interval, filtered, byhour);
|
|
27016
|
+
case Frequency.MINUTELY:
|
|
27017
|
+
return this.addMinutes(interval, filtered, byhour, byminute);
|
|
27018
|
+
case Frequency.SECONDLY:
|
|
27019
|
+
return this.addSeconds(interval, filtered, byhour, byminute, bysecond);
|
|
27020
|
+
}
|
|
27021
|
+
};
|
|
27022
|
+
return DateTime2;
|
|
27023
|
+
})(Time)
|
|
27024
|
+
);
|
|
27025
|
+
|
|
27026
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/parseoptions.js
|
|
27027
|
+
function initializeOptions(options) {
|
|
27028
|
+
var invalid = [];
|
|
27029
|
+
var keys = Object.keys(options);
|
|
27030
|
+
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
27031
|
+
var key = keys_1[_i];
|
|
27032
|
+
if (!includes(defaultKeys, key))
|
|
27033
|
+
invalid.push(key);
|
|
27034
|
+
if (isDate(options[key]) && !isValidDate(options[key])) {
|
|
27035
|
+
invalid.push(key);
|
|
27036
|
+
}
|
|
27037
|
+
}
|
|
27038
|
+
if (invalid.length) {
|
|
27039
|
+
throw new Error("Invalid options: " + invalid.join(", "));
|
|
27040
|
+
}
|
|
27041
|
+
return __assign({}, options);
|
|
27042
|
+
}
|
|
27043
|
+
function parseOptions(options) {
|
|
27044
|
+
var opts = __assign(__assign({}, DEFAULT_OPTIONS), initializeOptions(options));
|
|
27045
|
+
if (isPresent(opts.byeaster))
|
|
27046
|
+
opts.freq = RRule.YEARLY;
|
|
27047
|
+
if (!(isPresent(opts.freq) && RRule.FREQUENCIES[opts.freq])) {
|
|
27048
|
+
throw new Error("Invalid frequency: ".concat(opts.freq, " ").concat(options.freq));
|
|
27049
|
+
}
|
|
27050
|
+
if (!opts.dtstart)
|
|
27051
|
+
opts.dtstart = new Date((/* @__PURE__ */ new Date()).setMilliseconds(0));
|
|
27052
|
+
if (!isPresent(opts.wkst)) {
|
|
27053
|
+
opts.wkst = RRule.MO.weekday;
|
|
27054
|
+
} else if (isNumber(opts.wkst)) {
|
|
27055
|
+
} else {
|
|
27056
|
+
opts.wkst = opts.wkst.weekday;
|
|
27057
|
+
}
|
|
27058
|
+
if (isPresent(opts.bysetpos)) {
|
|
27059
|
+
if (isNumber(opts.bysetpos))
|
|
27060
|
+
opts.bysetpos = [opts.bysetpos];
|
|
27061
|
+
for (var i = 0; i < opts.bysetpos.length; i++) {
|
|
27062
|
+
var v2 = opts.bysetpos[i];
|
|
27063
|
+
if (v2 === 0 || !(v2 >= -366 && v2 <= 366)) {
|
|
27064
|
+
throw new Error("bysetpos must be between 1 and 366, or between -366 and -1");
|
|
27065
|
+
}
|
|
27066
|
+
}
|
|
27067
|
+
}
|
|
27068
|
+
if (!(Boolean(opts.byweekno) || notEmpty(opts.byweekno) || notEmpty(opts.byyearday) || Boolean(opts.bymonthday) || notEmpty(opts.bymonthday) || isPresent(opts.byweekday) || isPresent(opts.byeaster))) {
|
|
27069
|
+
switch (opts.freq) {
|
|
27070
|
+
case RRule.YEARLY:
|
|
27071
|
+
if (!opts.bymonth)
|
|
27072
|
+
opts.bymonth = opts.dtstart.getUTCMonth() + 1;
|
|
27073
|
+
opts.bymonthday = opts.dtstart.getUTCDate();
|
|
27074
|
+
break;
|
|
27075
|
+
case RRule.MONTHLY:
|
|
27076
|
+
opts.bymonthday = opts.dtstart.getUTCDate();
|
|
27077
|
+
break;
|
|
27078
|
+
case RRule.WEEKLY:
|
|
27079
|
+
opts.byweekday = [getWeekday(opts.dtstart)];
|
|
27080
|
+
break;
|
|
27081
|
+
}
|
|
27082
|
+
}
|
|
27083
|
+
if (isPresent(opts.bymonth) && !isArray(opts.bymonth)) {
|
|
27084
|
+
opts.bymonth = [opts.bymonth];
|
|
27085
|
+
}
|
|
27086
|
+
if (isPresent(opts.byyearday) && !isArray(opts.byyearday) && isNumber(opts.byyearday)) {
|
|
27087
|
+
opts.byyearday = [opts.byyearday];
|
|
27088
|
+
}
|
|
27089
|
+
if (!isPresent(opts.bymonthday)) {
|
|
27090
|
+
opts.bymonthday = [];
|
|
27091
|
+
opts.bynmonthday = [];
|
|
27092
|
+
} else if (isArray(opts.bymonthday)) {
|
|
27093
|
+
var bymonthday = [];
|
|
27094
|
+
var bynmonthday = [];
|
|
27095
|
+
for (var i = 0; i < opts.bymonthday.length; i++) {
|
|
27096
|
+
var v2 = opts.bymonthday[i];
|
|
27097
|
+
if (v2 > 0) {
|
|
27098
|
+
bymonthday.push(v2);
|
|
27099
|
+
} else if (v2 < 0) {
|
|
27100
|
+
bynmonthday.push(v2);
|
|
27101
|
+
}
|
|
27102
|
+
}
|
|
27103
|
+
opts.bymonthday = bymonthday;
|
|
27104
|
+
opts.bynmonthday = bynmonthday;
|
|
27105
|
+
} else if (opts.bymonthday < 0) {
|
|
27106
|
+
opts.bynmonthday = [opts.bymonthday];
|
|
27107
|
+
opts.bymonthday = [];
|
|
27108
|
+
} else {
|
|
27109
|
+
opts.bynmonthday = [];
|
|
27110
|
+
opts.bymonthday = [opts.bymonthday];
|
|
27111
|
+
}
|
|
27112
|
+
if (isPresent(opts.byweekno) && !isArray(opts.byweekno)) {
|
|
27113
|
+
opts.byweekno = [opts.byweekno];
|
|
27114
|
+
}
|
|
27115
|
+
if (!isPresent(opts.byweekday)) {
|
|
27116
|
+
opts.bynweekday = null;
|
|
27117
|
+
} else if (isNumber(opts.byweekday)) {
|
|
27118
|
+
opts.byweekday = [opts.byweekday];
|
|
27119
|
+
opts.bynweekday = null;
|
|
27120
|
+
} else if (isWeekdayStr(opts.byweekday)) {
|
|
27121
|
+
opts.byweekday = [Weekday.fromStr(opts.byweekday).weekday];
|
|
27122
|
+
opts.bynweekday = null;
|
|
27123
|
+
} else if (opts.byweekday instanceof Weekday) {
|
|
27124
|
+
if (!opts.byweekday.n || opts.freq > RRule.MONTHLY) {
|
|
27125
|
+
opts.byweekday = [opts.byweekday.weekday];
|
|
27126
|
+
opts.bynweekday = null;
|
|
27127
|
+
} else {
|
|
27128
|
+
opts.bynweekday = [[opts.byweekday.weekday, opts.byweekday.n]];
|
|
27129
|
+
opts.byweekday = null;
|
|
27130
|
+
}
|
|
27131
|
+
} else {
|
|
27132
|
+
var byweekday = [];
|
|
27133
|
+
var bynweekday = [];
|
|
27134
|
+
for (var i = 0; i < opts.byweekday.length; i++) {
|
|
27135
|
+
var wday = opts.byweekday[i];
|
|
27136
|
+
if (isNumber(wday)) {
|
|
27137
|
+
byweekday.push(wday);
|
|
27138
|
+
continue;
|
|
27139
|
+
} else if (isWeekdayStr(wday)) {
|
|
27140
|
+
byweekday.push(Weekday.fromStr(wday).weekday);
|
|
27141
|
+
continue;
|
|
27142
|
+
}
|
|
27143
|
+
if (!wday.n || opts.freq > RRule.MONTHLY) {
|
|
27144
|
+
byweekday.push(wday.weekday);
|
|
27145
|
+
} else {
|
|
27146
|
+
bynweekday.push([wday.weekday, wday.n]);
|
|
27147
|
+
}
|
|
27148
|
+
}
|
|
27149
|
+
opts.byweekday = notEmpty(byweekday) ? byweekday : null;
|
|
27150
|
+
opts.bynweekday = notEmpty(bynweekday) ? bynweekday : null;
|
|
27151
|
+
}
|
|
27152
|
+
if (!isPresent(opts.byhour)) {
|
|
27153
|
+
opts.byhour = opts.freq < RRule.HOURLY ? [opts.dtstart.getUTCHours()] : null;
|
|
27154
|
+
} else if (isNumber(opts.byhour)) {
|
|
27155
|
+
opts.byhour = [opts.byhour];
|
|
27156
|
+
}
|
|
27157
|
+
if (!isPresent(opts.byminute)) {
|
|
27158
|
+
opts.byminute = opts.freq < RRule.MINUTELY ? [opts.dtstart.getUTCMinutes()] : null;
|
|
27159
|
+
} else if (isNumber(opts.byminute)) {
|
|
27160
|
+
opts.byminute = [opts.byminute];
|
|
27161
|
+
}
|
|
27162
|
+
if (!isPresent(opts.bysecond)) {
|
|
27163
|
+
opts.bysecond = opts.freq < RRule.SECONDLY ? [opts.dtstart.getUTCSeconds()] : null;
|
|
27164
|
+
} else if (isNumber(opts.bysecond)) {
|
|
27165
|
+
opts.bysecond = [opts.bysecond];
|
|
27166
|
+
}
|
|
27167
|
+
return { parsedOptions: opts };
|
|
27168
|
+
}
|
|
27169
|
+
function buildTimeset(opts) {
|
|
27170
|
+
var millisecondModulo = opts.dtstart.getTime() % 1e3;
|
|
27171
|
+
if (!freqIsDailyOrGreater(opts.freq)) {
|
|
27172
|
+
return [];
|
|
27173
|
+
}
|
|
27174
|
+
var timeset = [];
|
|
27175
|
+
opts.byhour.forEach(function(hour) {
|
|
27176
|
+
opts.byminute.forEach(function(minute) {
|
|
27177
|
+
opts.bysecond.forEach(function(second) {
|
|
27178
|
+
timeset.push(new Time(hour, minute, second, millisecondModulo));
|
|
27179
|
+
});
|
|
27180
|
+
});
|
|
27181
|
+
});
|
|
27182
|
+
return timeset;
|
|
27183
|
+
}
|
|
27184
|
+
|
|
27185
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/parsestring.js
|
|
27186
|
+
function parseString(rfcString) {
|
|
27187
|
+
var options = rfcString.split("\n").map(parseLine).filter(function(x) {
|
|
27188
|
+
return x !== null;
|
|
27189
|
+
});
|
|
27190
|
+
return __assign(__assign({}, options[0]), options[1]);
|
|
27191
|
+
}
|
|
27192
|
+
function parseDtstart(line) {
|
|
27193
|
+
var options = {};
|
|
27194
|
+
var dtstartWithZone = /DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(line);
|
|
27195
|
+
if (!dtstartWithZone) {
|
|
27196
|
+
return options;
|
|
27197
|
+
}
|
|
27198
|
+
var tzid = dtstartWithZone[1], dtstart = dtstartWithZone[2];
|
|
27199
|
+
if (tzid) {
|
|
27200
|
+
options.tzid = tzid;
|
|
27201
|
+
}
|
|
27202
|
+
options.dtstart = untilStringToDate(dtstart);
|
|
27203
|
+
return options;
|
|
27204
|
+
}
|
|
27205
|
+
function parseLine(rfcString) {
|
|
27206
|
+
rfcString = rfcString.replace(/^\s+|\s+$/, "");
|
|
27207
|
+
if (!rfcString.length)
|
|
27208
|
+
return null;
|
|
27209
|
+
var header = /^([A-Z]+?)[:;]/.exec(rfcString.toUpperCase());
|
|
27210
|
+
if (!header) {
|
|
27211
|
+
return parseRrule(rfcString);
|
|
27212
|
+
}
|
|
27213
|
+
var key = header[1];
|
|
27214
|
+
switch (key.toUpperCase()) {
|
|
27215
|
+
case "RRULE":
|
|
27216
|
+
case "EXRULE":
|
|
27217
|
+
return parseRrule(rfcString);
|
|
27218
|
+
case "DTSTART":
|
|
27219
|
+
return parseDtstart(rfcString);
|
|
27220
|
+
default:
|
|
27221
|
+
throw new Error("Unsupported RFC prop ".concat(key, " in ").concat(rfcString));
|
|
27222
|
+
}
|
|
27223
|
+
}
|
|
27224
|
+
function parseRrule(line) {
|
|
27225
|
+
var strippedLine = line.replace(/^RRULE:/i, "");
|
|
27226
|
+
var options = parseDtstart(strippedLine);
|
|
27227
|
+
var attrs = line.replace(/^(?:RRULE|EXRULE):/i, "").split(";");
|
|
27228
|
+
attrs.forEach(function(attr) {
|
|
27229
|
+
var _a3 = attr.split("="), key = _a3[0], value = _a3[1];
|
|
27230
|
+
switch (key.toUpperCase()) {
|
|
27231
|
+
case "FREQ":
|
|
27232
|
+
options.freq = Frequency[value.toUpperCase()];
|
|
27233
|
+
break;
|
|
27234
|
+
case "WKST":
|
|
27235
|
+
options.wkst = Days[value.toUpperCase()];
|
|
27236
|
+
break;
|
|
27237
|
+
case "COUNT":
|
|
27238
|
+
case "INTERVAL":
|
|
27239
|
+
case "BYSETPOS":
|
|
27240
|
+
case "BYMONTH":
|
|
27241
|
+
case "BYMONTHDAY":
|
|
27242
|
+
case "BYYEARDAY":
|
|
27243
|
+
case "BYWEEKNO":
|
|
27244
|
+
case "BYHOUR":
|
|
27245
|
+
case "BYMINUTE":
|
|
27246
|
+
case "BYSECOND":
|
|
27247
|
+
var num = parseNumber(value);
|
|
27248
|
+
var optionKey = key.toLowerCase();
|
|
27249
|
+
options[optionKey] = num;
|
|
27250
|
+
break;
|
|
27251
|
+
case "BYWEEKDAY":
|
|
27252
|
+
case "BYDAY":
|
|
27253
|
+
options.byweekday = parseWeekday(value);
|
|
27254
|
+
break;
|
|
27255
|
+
case "DTSTART":
|
|
27256
|
+
case "TZID":
|
|
27257
|
+
var dtstart = parseDtstart(line);
|
|
27258
|
+
options.tzid = dtstart.tzid;
|
|
27259
|
+
options.dtstart = dtstart.dtstart;
|
|
27260
|
+
break;
|
|
27261
|
+
case "UNTIL":
|
|
27262
|
+
options.until = untilStringToDate(value);
|
|
27263
|
+
break;
|
|
27264
|
+
case "BYEASTER":
|
|
27265
|
+
options.byeaster = Number(value);
|
|
27266
|
+
break;
|
|
27267
|
+
default:
|
|
27268
|
+
throw new Error("Unknown RRULE property '" + key + "'");
|
|
27269
|
+
}
|
|
27270
|
+
});
|
|
27271
|
+
return options;
|
|
27272
|
+
}
|
|
27273
|
+
function parseNumber(value) {
|
|
27274
|
+
if (value.indexOf(",") !== -1) {
|
|
27275
|
+
var values = value.split(",");
|
|
27276
|
+
return values.map(parseIndividualNumber);
|
|
27277
|
+
}
|
|
27278
|
+
return parseIndividualNumber(value);
|
|
27279
|
+
}
|
|
27280
|
+
function parseIndividualNumber(value) {
|
|
27281
|
+
if (/^[+-]?\d+$/.test(value)) {
|
|
27282
|
+
return Number(value);
|
|
27283
|
+
}
|
|
27284
|
+
return value;
|
|
27285
|
+
}
|
|
27286
|
+
function parseWeekday(value) {
|
|
27287
|
+
var days = value.split(",");
|
|
27288
|
+
return days.map(function(day) {
|
|
27289
|
+
if (day.length === 2) {
|
|
27290
|
+
return Days[day];
|
|
27291
|
+
}
|
|
27292
|
+
var parts = day.match(/^([+-]?\d{1,2})([A-Z]{2})$/);
|
|
27293
|
+
if (!parts || parts.length < 3) {
|
|
27294
|
+
throw new SyntaxError("Invalid weekday string: ".concat(day));
|
|
27295
|
+
}
|
|
27296
|
+
var n = Number(parts[1]);
|
|
27297
|
+
var wdaypart = parts[2];
|
|
27298
|
+
var wday = Days[wdaypart].weekday;
|
|
27299
|
+
return new Weekday(wday, n);
|
|
27300
|
+
});
|
|
27301
|
+
}
|
|
27302
|
+
|
|
27303
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/datewithzone.js
|
|
27304
|
+
var DateWithZone = (
|
|
27305
|
+
/** @class */
|
|
27306
|
+
(function() {
|
|
27307
|
+
function DateWithZone2(date5, tzid) {
|
|
27308
|
+
if (isNaN(date5.getTime())) {
|
|
27309
|
+
throw new RangeError("Invalid date passed to DateWithZone");
|
|
27310
|
+
}
|
|
27311
|
+
this.date = date5;
|
|
27312
|
+
this.tzid = tzid;
|
|
27313
|
+
}
|
|
27314
|
+
Object.defineProperty(DateWithZone2.prototype, "isUTC", {
|
|
27315
|
+
get: function() {
|
|
27316
|
+
return !this.tzid || this.tzid.toUpperCase() === "UTC";
|
|
27317
|
+
},
|
|
27318
|
+
enumerable: false,
|
|
27319
|
+
configurable: true
|
|
27320
|
+
});
|
|
27321
|
+
DateWithZone2.prototype.toString = function() {
|
|
27322
|
+
var datestr = timeToUntilString(this.date.getTime(), this.isUTC);
|
|
27323
|
+
if (!this.isUTC) {
|
|
27324
|
+
return ";TZID=".concat(this.tzid, ":").concat(datestr);
|
|
27325
|
+
}
|
|
27326
|
+
return ":".concat(datestr);
|
|
27327
|
+
};
|
|
27328
|
+
DateWithZone2.prototype.getTime = function() {
|
|
27329
|
+
return this.date.getTime();
|
|
27330
|
+
};
|
|
27331
|
+
DateWithZone2.prototype.rezonedDate = function() {
|
|
27332
|
+
if (this.isUTC) {
|
|
27333
|
+
return this.date;
|
|
27334
|
+
}
|
|
27335
|
+
return dateInTimeZone(this.date, this.tzid);
|
|
27336
|
+
};
|
|
27337
|
+
return DateWithZone2;
|
|
27338
|
+
})()
|
|
27339
|
+
);
|
|
27340
|
+
|
|
27341
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/optionstostring.js
|
|
27342
|
+
function optionsToString(options) {
|
|
27343
|
+
var rrule = [];
|
|
27344
|
+
var dtstart = "";
|
|
27345
|
+
var keys = Object.keys(options);
|
|
27346
|
+
var defaultKeys2 = Object.keys(DEFAULT_OPTIONS);
|
|
27347
|
+
for (var i = 0; i < keys.length; i++) {
|
|
27348
|
+
if (keys[i] === "tzid")
|
|
27349
|
+
continue;
|
|
27350
|
+
if (!includes(defaultKeys2, keys[i]))
|
|
27351
|
+
continue;
|
|
27352
|
+
var key = keys[i].toUpperCase();
|
|
27353
|
+
var value = options[keys[i]];
|
|
27354
|
+
var outValue = "";
|
|
27355
|
+
if (!isPresent(value) || isArray(value) && !value.length)
|
|
27356
|
+
continue;
|
|
27357
|
+
switch (key) {
|
|
27358
|
+
case "FREQ":
|
|
27359
|
+
outValue = RRule.FREQUENCIES[options.freq];
|
|
27360
|
+
break;
|
|
27361
|
+
case "WKST":
|
|
27362
|
+
if (isNumber(value)) {
|
|
27363
|
+
outValue = new Weekday(value).toString();
|
|
27364
|
+
} else {
|
|
27365
|
+
outValue = value.toString();
|
|
27366
|
+
}
|
|
27367
|
+
break;
|
|
27368
|
+
case "BYWEEKDAY":
|
|
27369
|
+
key = "BYDAY";
|
|
27370
|
+
outValue = toArray(value).map(function(wday) {
|
|
27371
|
+
if (wday instanceof Weekday) {
|
|
27372
|
+
return wday;
|
|
27373
|
+
}
|
|
27374
|
+
if (isArray(wday)) {
|
|
27375
|
+
return new Weekday(wday[0], wday[1]);
|
|
27376
|
+
}
|
|
27377
|
+
return new Weekday(wday);
|
|
27378
|
+
}).toString();
|
|
27379
|
+
break;
|
|
27380
|
+
case "DTSTART":
|
|
27381
|
+
dtstart = buildDtstart(value, options.tzid);
|
|
27382
|
+
break;
|
|
27383
|
+
case "UNTIL":
|
|
27384
|
+
outValue = timeToUntilString(value, !options.tzid);
|
|
27385
|
+
break;
|
|
27386
|
+
default:
|
|
27387
|
+
if (isArray(value)) {
|
|
27388
|
+
var strValues = [];
|
|
27389
|
+
for (var j3 = 0; j3 < value.length; j3++) {
|
|
27390
|
+
strValues[j3] = String(value[j3]);
|
|
27391
|
+
}
|
|
27392
|
+
outValue = strValues.toString();
|
|
27393
|
+
} else {
|
|
27394
|
+
outValue = String(value);
|
|
27395
|
+
}
|
|
27396
|
+
}
|
|
27397
|
+
if (outValue) {
|
|
27398
|
+
rrule.push([key, outValue]);
|
|
27399
|
+
}
|
|
27400
|
+
}
|
|
27401
|
+
var rules = rrule.map(function(_a3) {
|
|
27402
|
+
var key2 = _a3[0], value2 = _a3[1];
|
|
27403
|
+
return "".concat(key2, "=").concat(value2.toString());
|
|
27404
|
+
}).join(";");
|
|
27405
|
+
var ruleString = "";
|
|
27406
|
+
if (rules !== "") {
|
|
27407
|
+
ruleString = "RRULE:".concat(rules);
|
|
27408
|
+
}
|
|
27409
|
+
return [dtstart, ruleString].filter(function(x) {
|
|
27410
|
+
return !!x;
|
|
27411
|
+
}).join("\n");
|
|
27412
|
+
}
|
|
27413
|
+
function buildDtstart(dtstart, tzid) {
|
|
27414
|
+
if (!dtstart) {
|
|
27415
|
+
return "";
|
|
27416
|
+
}
|
|
27417
|
+
return "DTSTART" + new DateWithZone(new Date(dtstart), tzid).toString();
|
|
27418
|
+
}
|
|
27419
|
+
|
|
27420
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/cache.js
|
|
27421
|
+
function argsMatch(left, right) {
|
|
27422
|
+
if (Array.isArray(left)) {
|
|
27423
|
+
if (!Array.isArray(right))
|
|
27424
|
+
return false;
|
|
27425
|
+
if (left.length !== right.length)
|
|
27426
|
+
return false;
|
|
27427
|
+
return left.every(function(date5, i) {
|
|
27428
|
+
return date5.getTime() === right[i].getTime();
|
|
27429
|
+
});
|
|
27430
|
+
}
|
|
27431
|
+
if (left instanceof Date) {
|
|
27432
|
+
return right instanceof Date && left.getTime() === right.getTime();
|
|
27433
|
+
}
|
|
27434
|
+
return left === right;
|
|
27435
|
+
}
|
|
27436
|
+
var Cache = (
|
|
27437
|
+
/** @class */
|
|
27438
|
+
(function() {
|
|
27439
|
+
function Cache2() {
|
|
27440
|
+
this.all = false;
|
|
27441
|
+
this.before = [];
|
|
27442
|
+
this.after = [];
|
|
27443
|
+
this.between = [];
|
|
27444
|
+
}
|
|
27445
|
+
Cache2.prototype._cacheAdd = function(what, value, args) {
|
|
27446
|
+
if (value) {
|
|
27447
|
+
value = value instanceof Date ? clone2(value) : cloneDates(value);
|
|
27448
|
+
}
|
|
27449
|
+
if (what === "all") {
|
|
27450
|
+
this.all = value;
|
|
27451
|
+
} else {
|
|
27452
|
+
args._value = value;
|
|
27453
|
+
this[what].push(args);
|
|
27454
|
+
}
|
|
27455
|
+
};
|
|
27456
|
+
Cache2.prototype._cacheGet = function(what, args) {
|
|
27457
|
+
var cached2 = false;
|
|
27458
|
+
var argsKeys = args ? Object.keys(args) : [];
|
|
27459
|
+
var findCacheDiff = function(item2) {
|
|
27460
|
+
for (var i2 = 0; i2 < argsKeys.length; i2++) {
|
|
27461
|
+
var key = argsKeys[i2];
|
|
27462
|
+
if (!argsMatch(args[key], item2[key])) {
|
|
27463
|
+
return true;
|
|
27464
|
+
}
|
|
27465
|
+
}
|
|
27466
|
+
return false;
|
|
27467
|
+
};
|
|
27468
|
+
var cachedObject = this[what];
|
|
27469
|
+
if (what === "all") {
|
|
27470
|
+
cached2 = this.all;
|
|
27471
|
+
} else if (isArray(cachedObject)) {
|
|
27472
|
+
for (var i = 0; i < cachedObject.length; i++) {
|
|
27473
|
+
var item = cachedObject[i];
|
|
27474
|
+
if (argsKeys.length && findCacheDiff(item))
|
|
27475
|
+
continue;
|
|
27476
|
+
cached2 = item._value;
|
|
27477
|
+
break;
|
|
27478
|
+
}
|
|
27479
|
+
}
|
|
27480
|
+
if (!cached2 && this.all) {
|
|
27481
|
+
var iterResult = new iterresult_default(what, args);
|
|
27482
|
+
for (var i = 0; i < this.all.length; i++) {
|
|
27483
|
+
if (!iterResult.accept(this.all[i]))
|
|
27484
|
+
break;
|
|
27485
|
+
}
|
|
27486
|
+
cached2 = iterResult.getValue();
|
|
27487
|
+
this._cacheAdd(what, cached2, args);
|
|
27488
|
+
}
|
|
27489
|
+
return isArray(cached2) ? cloneDates(cached2) : cached2 instanceof Date ? clone2(cached2) : cached2;
|
|
27490
|
+
};
|
|
27491
|
+
return Cache2;
|
|
27492
|
+
})()
|
|
27493
|
+
);
|
|
27494
|
+
|
|
27495
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/masks.js
|
|
27496
|
+
var M365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], repeat(1, 31), true), repeat(2, 28), true), repeat(3, 31), true), repeat(4, 30), true), repeat(5, 31), true), repeat(6, 30), true), repeat(7, 31), true), repeat(8, 31), true), repeat(9, 30), true), repeat(10, 31), true), repeat(11, 30), true), repeat(12, 31), true), repeat(1, 7), true);
|
|
27497
|
+
var M366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], repeat(1, 31), true), repeat(2, 29), true), repeat(3, 31), true), repeat(4, 30), true), repeat(5, 31), true), repeat(6, 30), true), repeat(7, 31), true), repeat(8, 31), true), repeat(9, 30), true), repeat(10, 31), true), repeat(11, 30), true), repeat(12, 31), true), repeat(1, 7), true);
|
|
27498
|
+
var M28 = range(1, 29);
|
|
27499
|
+
var M29 = range(1, 30);
|
|
27500
|
+
var M30 = range(1, 31);
|
|
27501
|
+
var M31 = range(1, 32);
|
|
27502
|
+
var MDAY366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], M31, true), M29, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31.slice(0, 7), true);
|
|
27503
|
+
var MDAY365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], M31, true), M28, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31.slice(0, 7), true);
|
|
27504
|
+
var NM28 = range(-28, 0);
|
|
27505
|
+
var NM29 = range(-29, 0);
|
|
27506
|
+
var NM30 = range(-30, 0);
|
|
27507
|
+
var NM31 = range(-31, 0);
|
|
27508
|
+
var NMDAY366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], NM31, true), NM29, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31.slice(0, 7), true);
|
|
27509
|
+
var NMDAY365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], NM31, true), NM28, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31.slice(0, 7), true);
|
|
27510
|
+
var M366RANGE = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366];
|
|
27511
|
+
var M365RANGE = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365];
|
|
27512
|
+
var WDAYMASK = (function() {
|
|
27513
|
+
var wdaymask = [];
|
|
27514
|
+
for (var i = 0; i < 55; i++)
|
|
27515
|
+
wdaymask = wdaymask.concat(range(7));
|
|
27516
|
+
return wdaymask;
|
|
27517
|
+
})();
|
|
27518
|
+
|
|
27519
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/iterinfo/yearinfo.js
|
|
27520
|
+
function rebuildYear(year, options) {
|
|
27521
|
+
var firstyday = datetime3(year, 1, 1);
|
|
27522
|
+
var yearlen = isLeapYear(year) ? 366 : 365;
|
|
27523
|
+
var nextyearlen = isLeapYear(year + 1) ? 366 : 365;
|
|
27524
|
+
var yearordinal = toOrdinal(firstyday);
|
|
27525
|
+
var yearweekday = getWeekday(firstyday);
|
|
27526
|
+
var result = __assign(__assign({ yearlen, nextyearlen, yearordinal, yearweekday }, baseYearMasks(year)), { wnomask: null });
|
|
27527
|
+
if (empty(options.byweekno)) {
|
|
27528
|
+
return result;
|
|
27529
|
+
}
|
|
27530
|
+
result.wnomask = repeat(0, yearlen + 7);
|
|
27531
|
+
var firstwkst;
|
|
27532
|
+
var wyearlen;
|
|
27533
|
+
var no1wkst = firstwkst = pymod(7 - yearweekday + options.wkst, 7);
|
|
27534
|
+
if (no1wkst >= 4) {
|
|
27535
|
+
no1wkst = 0;
|
|
27536
|
+
wyearlen = result.yearlen + pymod(yearweekday - options.wkst, 7);
|
|
27537
|
+
} else {
|
|
27538
|
+
wyearlen = yearlen - no1wkst;
|
|
27539
|
+
}
|
|
27540
|
+
var div = Math.floor(wyearlen / 7);
|
|
27541
|
+
var mod = pymod(wyearlen, 7);
|
|
27542
|
+
var numweeks = Math.floor(div + mod / 4);
|
|
27543
|
+
for (var j3 = 0; j3 < options.byweekno.length; j3++) {
|
|
27544
|
+
var n = options.byweekno[j3];
|
|
27545
|
+
if (n < 0) {
|
|
27546
|
+
n += numweeks + 1;
|
|
27547
|
+
}
|
|
27548
|
+
if (!(n > 0 && n <= numweeks)) {
|
|
27549
|
+
continue;
|
|
27550
|
+
}
|
|
27551
|
+
var i = void 0;
|
|
27552
|
+
if (n > 1) {
|
|
27553
|
+
i = no1wkst + (n - 1) * 7;
|
|
27554
|
+
if (no1wkst !== firstwkst) {
|
|
27555
|
+
i -= 7 - firstwkst;
|
|
27556
|
+
}
|
|
27557
|
+
} else {
|
|
27558
|
+
i = no1wkst;
|
|
27559
|
+
}
|
|
27560
|
+
for (var k2 = 0; k2 < 7; k2++) {
|
|
27561
|
+
result.wnomask[i] = 1;
|
|
27562
|
+
i++;
|
|
27563
|
+
if (result.wdaymask[i] === options.wkst)
|
|
27564
|
+
break;
|
|
27565
|
+
}
|
|
27566
|
+
}
|
|
27567
|
+
if (includes(options.byweekno, 1)) {
|
|
27568
|
+
var i = no1wkst + numweeks * 7;
|
|
27569
|
+
if (no1wkst !== firstwkst)
|
|
27570
|
+
i -= 7 - firstwkst;
|
|
27571
|
+
if (i < yearlen) {
|
|
27572
|
+
for (var j3 = 0; j3 < 7; j3++) {
|
|
27573
|
+
result.wnomask[i] = 1;
|
|
27574
|
+
i += 1;
|
|
27575
|
+
if (result.wdaymask[i] === options.wkst)
|
|
27576
|
+
break;
|
|
27577
|
+
}
|
|
27578
|
+
}
|
|
27579
|
+
}
|
|
27580
|
+
if (no1wkst) {
|
|
27581
|
+
var lnumweeks = void 0;
|
|
27582
|
+
if (!includes(options.byweekno, -1)) {
|
|
27583
|
+
var lyearweekday = getWeekday(datetime3(year - 1, 1, 1));
|
|
27584
|
+
var lno1wkst = pymod(7 - lyearweekday.valueOf() + options.wkst, 7);
|
|
27585
|
+
var lyearlen = isLeapYear(year - 1) ? 366 : 365;
|
|
27586
|
+
var weekst = void 0;
|
|
27587
|
+
if (lno1wkst >= 4) {
|
|
27588
|
+
lno1wkst = 0;
|
|
27589
|
+
weekst = lyearlen + pymod(lyearweekday - options.wkst, 7);
|
|
27590
|
+
} else {
|
|
27591
|
+
weekst = yearlen - no1wkst;
|
|
27592
|
+
}
|
|
27593
|
+
lnumweeks = Math.floor(52 + pymod(weekst, 7) / 4);
|
|
27594
|
+
} else {
|
|
27595
|
+
lnumweeks = -1;
|
|
27596
|
+
}
|
|
27597
|
+
if (includes(options.byweekno, lnumweeks)) {
|
|
27598
|
+
for (var i = 0; i < no1wkst; i++)
|
|
27599
|
+
result.wnomask[i] = 1;
|
|
27600
|
+
}
|
|
27601
|
+
}
|
|
27602
|
+
return result;
|
|
27603
|
+
}
|
|
27604
|
+
function baseYearMasks(year) {
|
|
27605
|
+
var yearlen = isLeapYear(year) ? 366 : 365;
|
|
27606
|
+
var firstyday = datetime3(year, 1, 1);
|
|
27607
|
+
var wday = getWeekday(firstyday);
|
|
27608
|
+
if (yearlen === 365) {
|
|
27609
|
+
return {
|
|
27610
|
+
mmask: M365MASK,
|
|
27611
|
+
mdaymask: MDAY365MASK,
|
|
27612
|
+
nmdaymask: NMDAY365MASK,
|
|
27613
|
+
wdaymask: WDAYMASK.slice(wday),
|
|
27614
|
+
mrange: M365RANGE
|
|
27615
|
+
};
|
|
27616
|
+
}
|
|
27617
|
+
return {
|
|
27618
|
+
mmask: M366MASK,
|
|
27619
|
+
mdaymask: MDAY366MASK,
|
|
27620
|
+
nmdaymask: NMDAY366MASK,
|
|
27621
|
+
wdaymask: WDAYMASK.slice(wday),
|
|
27622
|
+
mrange: M366RANGE
|
|
27623
|
+
};
|
|
27624
|
+
}
|
|
27625
|
+
|
|
27626
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/iterinfo/monthinfo.js
|
|
27627
|
+
function rebuildMonth(year, month, yearlen, mrange, wdaymask, options) {
|
|
27628
|
+
var result = {
|
|
27629
|
+
lastyear: year,
|
|
27630
|
+
lastmonth: month,
|
|
27631
|
+
nwdaymask: []
|
|
27632
|
+
};
|
|
27633
|
+
var ranges = [];
|
|
27634
|
+
if (options.freq === RRule.YEARLY) {
|
|
27635
|
+
if (empty(options.bymonth)) {
|
|
27636
|
+
ranges = [[0, yearlen]];
|
|
27637
|
+
} else {
|
|
27638
|
+
for (var j3 = 0; j3 < options.bymonth.length; j3++) {
|
|
27639
|
+
month = options.bymonth[j3];
|
|
27640
|
+
ranges.push(mrange.slice(month - 1, month + 1));
|
|
27641
|
+
}
|
|
27642
|
+
}
|
|
27643
|
+
} else if (options.freq === RRule.MONTHLY) {
|
|
27644
|
+
ranges = [mrange.slice(month - 1, month + 1)];
|
|
27645
|
+
}
|
|
27646
|
+
if (empty(ranges)) {
|
|
27647
|
+
return result;
|
|
27648
|
+
}
|
|
27649
|
+
result.nwdaymask = repeat(0, yearlen);
|
|
27650
|
+
for (var j3 = 0; j3 < ranges.length; j3++) {
|
|
27651
|
+
var rang = ranges[j3];
|
|
27652
|
+
var first = rang[0];
|
|
27653
|
+
var last = rang[1] - 1;
|
|
27654
|
+
for (var k2 = 0; k2 < options.bynweekday.length; k2++) {
|
|
27655
|
+
var i = void 0;
|
|
27656
|
+
var _a3 = options.bynweekday[k2], wday = _a3[0], n = _a3[1];
|
|
27657
|
+
if (n < 0) {
|
|
27658
|
+
i = last + (n + 1) * 7;
|
|
27659
|
+
i -= pymod(wdaymask[i] - wday, 7);
|
|
27660
|
+
} else {
|
|
27661
|
+
i = first + (n - 1) * 7;
|
|
27662
|
+
i += pymod(7 - wdaymask[i] + wday, 7);
|
|
27663
|
+
}
|
|
27664
|
+
if (first <= i && i <= last)
|
|
27665
|
+
result.nwdaymask[i] = 1;
|
|
27666
|
+
}
|
|
27667
|
+
}
|
|
27668
|
+
return result;
|
|
27669
|
+
}
|
|
27670
|
+
|
|
27671
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/iterinfo/easter.js
|
|
27672
|
+
function easter(y, offset) {
|
|
27673
|
+
if (offset === void 0) {
|
|
27674
|
+
offset = 0;
|
|
27675
|
+
}
|
|
27676
|
+
var a = y % 19;
|
|
27677
|
+
var b2 = Math.floor(y / 100);
|
|
27678
|
+
var c2 = y % 100;
|
|
27679
|
+
var d2 = Math.floor(b2 / 4);
|
|
27680
|
+
var e2 = b2 % 4;
|
|
27681
|
+
var f = Math.floor((b2 + 8) / 25);
|
|
27682
|
+
var g = Math.floor((b2 - f + 1) / 3);
|
|
27683
|
+
var h2 = Math.floor(19 * a + b2 - d2 - g + 15) % 30;
|
|
27684
|
+
var i = Math.floor(c2 / 4);
|
|
27685
|
+
var k2 = c2 % 4;
|
|
27686
|
+
var l = Math.floor(32 + 2 * e2 + 2 * i - h2 - k2) % 7;
|
|
27687
|
+
var m = Math.floor((a + 11 * h2 + 22 * l) / 451);
|
|
27688
|
+
var month = Math.floor((h2 + l - 7 * m + 114) / 31);
|
|
27689
|
+
var day = (h2 + l - 7 * m + 114) % 31 + 1;
|
|
27690
|
+
var date5 = Date.UTC(y, month - 1, day + offset);
|
|
27691
|
+
var yearStart = Date.UTC(y, 0, 1);
|
|
27692
|
+
return [Math.ceil((date5 - yearStart) / (1e3 * 60 * 60 * 24))];
|
|
27693
|
+
}
|
|
27694
|
+
|
|
27695
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/iterinfo/index.js
|
|
27696
|
+
var Iterinfo = (
|
|
27697
|
+
/** @class */
|
|
27698
|
+
(function() {
|
|
27699
|
+
function Iterinfo2(options) {
|
|
27700
|
+
this.options = options;
|
|
27701
|
+
}
|
|
27702
|
+
Iterinfo2.prototype.rebuild = function(year, month) {
|
|
27703
|
+
var options = this.options;
|
|
27704
|
+
if (year !== this.lastyear) {
|
|
27705
|
+
this.yearinfo = rebuildYear(year, options);
|
|
27706
|
+
}
|
|
27707
|
+
if (notEmpty(options.bynweekday) && (month !== this.lastmonth || year !== this.lastyear)) {
|
|
27708
|
+
var _a3 = this.yearinfo, yearlen = _a3.yearlen, mrange = _a3.mrange, wdaymask = _a3.wdaymask;
|
|
27709
|
+
this.monthinfo = rebuildMonth(year, month, yearlen, mrange, wdaymask, options);
|
|
27710
|
+
}
|
|
27711
|
+
if (isPresent(options.byeaster)) {
|
|
27712
|
+
this.eastermask = easter(year, options.byeaster);
|
|
27713
|
+
}
|
|
27714
|
+
};
|
|
27715
|
+
Object.defineProperty(Iterinfo2.prototype, "lastyear", {
|
|
27716
|
+
get: function() {
|
|
27717
|
+
return this.monthinfo ? this.monthinfo.lastyear : null;
|
|
27718
|
+
},
|
|
27719
|
+
enumerable: false,
|
|
27720
|
+
configurable: true
|
|
27721
|
+
});
|
|
27722
|
+
Object.defineProperty(Iterinfo2.prototype, "lastmonth", {
|
|
27723
|
+
get: function() {
|
|
27724
|
+
return this.monthinfo ? this.monthinfo.lastmonth : null;
|
|
27725
|
+
},
|
|
27726
|
+
enumerable: false,
|
|
27727
|
+
configurable: true
|
|
27728
|
+
});
|
|
27729
|
+
Object.defineProperty(Iterinfo2.prototype, "yearlen", {
|
|
27730
|
+
get: function() {
|
|
27731
|
+
return this.yearinfo.yearlen;
|
|
27732
|
+
},
|
|
27733
|
+
enumerable: false,
|
|
27734
|
+
configurable: true
|
|
27735
|
+
});
|
|
27736
|
+
Object.defineProperty(Iterinfo2.prototype, "yearordinal", {
|
|
27737
|
+
get: function() {
|
|
27738
|
+
return this.yearinfo.yearordinal;
|
|
27739
|
+
},
|
|
27740
|
+
enumerable: false,
|
|
27741
|
+
configurable: true
|
|
27742
|
+
});
|
|
27743
|
+
Object.defineProperty(Iterinfo2.prototype, "mrange", {
|
|
27744
|
+
get: function() {
|
|
27745
|
+
return this.yearinfo.mrange;
|
|
27746
|
+
},
|
|
27747
|
+
enumerable: false,
|
|
27748
|
+
configurable: true
|
|
27749
|
+
});
|
|
27750
|
+
Object.defineProperty(Iterinfo2.prototype, "wdaymask", {
|
|
27751
|
+
get: function() {
|
|
27752
|
+
return this.yearinfo.wdaymask;
|
|
27753
|
+
},
|
|
27754
|
+
enumerable: false,
|
|
27755
|
+
configurable: true
|
|
27756
|
+
});
|
|
27757
|
+
Object.defineProperty(Iterinfo2.prototype, "mmask", {
|
|
27758
|
+
get: function() {
|
|
27759
|
+
return this.yearinfo.mmask;
|
|
27760
|
+
},
|
|
27761
|
+
enumerable: false,
|
|
27762
|
+
configurable: true
|
|
27763
|
+
});
|
|
27764
|
+
Object.defineProperty(Iterinfo2.prototype, "wnomask", {
|
|
27765
|
+
get: function() {
|
|
27766
|
+
return this.yearinfo.wnomask;
|
|
27767
|
+
},
|
|
27768
|
+
enumerable: false,
|
|
27769
|
+
configurable: true
|
|
27770
|
+
});
|
|
27771
|
+
Object.defineProperty(Iterinfo2.prototype, "nwdaymask", {
|
|
27772
|
+
get: function() {
|
|
27773
|
+
return this.monthinfo ? this.monthinfo.nwdaymask : [];
|
|
27774
|
+
},
|
|
27775
|
+
enumerable: false,
|
|
27776
|
+
configurable: true
|
|
27777
|
+
});
|
|
27778
|
+
Object.defineProperty(Iterinfo2.prototype, "nextyearlen", {
|
|
27779
|
+
get: function() {
|
|
27780
|
+
return this.yearinfo.nextyearlen;
|
|
27781
|
+
},
|
|
27782
|
+
enumerable: false,
|
|
27783
|
+
configurable: true
|
|
27784
|
+
});
|
|
27785
|
+
Object.defineProperty(Iterinfo2.prototype, "mdaymask", {
|
|
27786
|
+
get: function() {
|
|
27787
|
+
return this.yearinfo.mdaymask;
|
|
27788
|
+
},
|
|
27789
|
+
enumerable: false,
|
|
27790
|
+
configurable: true
|
|
27791
|
+
});
|
|
27792
|
+
Object.defineProperty(Iterinfo2.prototype, "nmdaymask", {
|
|
27793
|
+
get: function() {
|
|
27794
|
+
return this.yearinfo.nmdaymask;
|
|
27795
|
+
},
|
|
27796
|
+
enumerable: false,
|
|
27797
|
+
configurable: true
|
|
27798
|
+
});
|
|
27799
|
+
Iterinfo2.prototype.ydayset = function() {
|
|
27800
|
+
return [range(this.yearlen), 0, this.yearlen];
|
|
27801
|
+
};
|
|
27802
|
+
Iterinfo2.prototype.mdayset = function(_, month) {
|
|
27803
|
+
var start = this.mrange[month - 1];
|
|
27804
|
+
var end = this.mrange[month];
|
|
27805
|
+
var set2 = repeat(null, this.yearlen);
|
|
27806
|
+
for (var i = start; i < end; i++)
|
|
27807
|
+
set2[i] = i;
|
|
27808
|
+
return [set2, start, end];
|
|
27809
|
+
};
|
|
27810
|
+
Iterinfo2.prototype.wdayset = function(year, month, day) {
|
|
27811
|
+
var set2 = repeat(null, this.yearlen + 7);
|
|
27812
|
+
var i = toOrdinal(datetime3(year, month, day)) - this.yearordinal;
|
|
27813
|
+
var start = i;
|
|
27814
|
+
for (var j3 = 0; j3 < 7; j3++) {
|
|
27815
|
+
set2[i] = i;
|
|
27816
|
+
++i;
|
|
27817
|
+
if (this.wdaymask[i] === this.options.wkst)
|
|
27818
|
+
break;
|
|
27819
|
+
}
|
|
27820
|
+
return [set2, start, i];
|
|
27821
|
+
};
|
|
27822
|
+
Iterinfo2.prototype.ddayset = function(year, month, day) {
|
|
27823
|
+
var set2 = repeat(null, this.yearlen);
|
|
27824
|
+
var i = toOrdinal(datetime3(year, month, day)) - this.yearordinal;
|
|
27825
|
+
set2[i] = i;
|
|
27826
|
+
return [set2, i, i + 1];
|
|
27827
|
+
};
|
|
27828
|
+
Iterinfo2.prototype.htimeset = function(hour, _, second, millisecond) {
|
|
27829
|
+
var _this = this;
|
|
27830
|
+
var set2 = [];
|
|
27831
|
+
this.options.byminute.forEach(function(minute) {
|
|
27832
|
+
set2 = set2.concat(_this.mtimeset(hour, minute, second, millisecond));
|
|
27833
|
+
});
|
|
27834
|
+
sort(set2);
|
|
27835
|
+
return set2;
|
|
27836
|
+
};
|
|
27837
|
+
Iterinfo2.prototype.mtimeset = function(hour, minute, _, millisecond) {
|
|
27838
|
+
var set2 = this.options.bysecond.map(function(second) {
|
|
27839
|
+
return new Time(hour, minute, second, millisecond);
|
|
27840
|
+
});
|
|
27841
|
+
sort(set2);
|
|
27842
|
+
return set2;
|
|
27843
|
+
};
|
|
27844
|
+
Iterinfo2.prototype.stimeset = function(hour, minute, second, millisecond) {
|
|
27845
|
+
return [new Time(hour, minute, second, millisecond)];
|
|
27846
|
+
};
|
|
27847
|
+
Iterinfo2.prototype.getdayset = function(freq) {
|
|
27848
|
+
switch (freq) {
|
|
27849
|
+
case Frequency.YEARLY:
|
|
27850
|
+
return this.ydayset.bind(this);
|
|
27851
|
+
case Frequency.MONTHLY:
|
|
27852
|
+
return this.mdayset.bind(this);
|
|
27853
|
+
case Frequency.WEEKLY:
|
|
27854
|
+
return this.wdayset.bind(this);
|
|
27855
|
+
case Frequency.DAILY:
|
|
27856
|
+
return this.ddayset.bind(this);
|
|
27857
|
+
default:
|
|
27858
|
+
return this.ddayset.bind(this);
|
|
27859
|
+
}
|
|
27860
|
+
};
|
|
27861
|
+
Iterinfo2.prototype.gettimeset = function(freq) {
|
|
27862
|
+
switch (freq) {
|
|
27863
|
+
case Frequency.HOURLY:
|
|
27864
|
+
return this.htimeset.bind(this);
|
|
27865
|
+
case Frequency.MINUTELY:
|
|
27866
|
+
return this.mtimeset.bind(this);
|
|
27867
|
+
case Frequency.SECONDLY:
|
|
27868
|
+
return this.stimeset.bind(this);
|
|
27869
|
+
}
|
|
27870
|
+
};
|
|
27871
|
+
return Iterinfo2;
|
|
27872
|
+
})()
|
|
27873
|
+
);
|
|
27874
|
+
var iterinfo_default = Iterinfo;
|
|
27875
|
+
|
|
27876
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/iter/poslist.js
|
|
27877
|
+
function buildPoslist(bysetpos, timeset, start, end, ii, dayset) {
|
|
27878
|
+
var poslist = [];
|
|
27879
|
+
for (var j3 = 0; j3 < bysetpos.length; j3++) {
|
|
27880
|
+
var daypos = void 0;
|
|
27881
|
+
var timepos = void 0;
|
|
27882
|
+
var pos = bysetpos[j3];
|
|
27883
|
+
if (pos < 0) {
|
|
27884
|
+
daypos = Math.floor(pos / timeset.length);
|
|
27885
|
+
timepos = pymod(pos, timeset.length);
|
|
27886
|
+
} else {
|
|
27887
|
+
daypos = Math.floor((pos - 1) / timeset.length);
|
|
27888
|
+
timepos = pymod(pos - 1, timeset.length);
|
|
27889
|
+
}
|
|
27890
|
+
var tmp = [];
|
|
27891
|
+
for (var k2 = start; k2 < end; k2++) {
|
|
27892
|
+
var val = dayset[k2];
|
|
27893
|
+
if (!isPresent(val))
|
|
27894
|
+
continue;
|
|
27895
|
+
tmp.push(val);
|
|
27896
|
+
}
|
|
27897
|
+
var i = void 0;
|
|
27898
|
+
if (daypos < 0) {
|
|
27899
|
+
i = tmp.slice(daypos)[0];
|
|
27900
|
+
} else {
|
|
27901
|
+
i = tmp[daypos];
|
|
27902
|
+
}
|
|
27903
|
+
var time3 = timeset[timepos];
|
|
27904
|
+
var date5 = fromOrdinal(ii.yearordinal + i);
|
|
27905
|
+
var res = combine(date5, time3);
|
|
27906
|
+
if (!includes(poslist, res))
|
|
27907
|
+
poslist.push(res);
|
|
27908
|
+
}
|
|
27909
|
+
sort(poslist);
|
|
27910
|
+
return poslist;
|
|
27911
|
+
}
|
|
27912
|
+
|
|
27913
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/iter/index.js
|
|
27914
|
+
function iter(iterResult, options) {
|
|
27915
|
+
var dtstart = options.dtstart, freq = options.freq, interval = options.interval, until = options.until, bysetpos = options.bysetpos;
|
|
27916
|
+
var count = options.count;
|
|
27917
|
+
if (count === 0 || interval === 0) {
|
|
27918
|
+
return emitResult(iterResult);
|
|
27919
|
+
}
|
|
27920
|
+
var counterDate = DateTime.fromDate(dtstart);
|
|
27921
|
+
var ii = new iterinfo_default(options);
|
|
27922
|
+
ii.rebuild(counterDate.year, counterDate.month);
|
|
27923
|
+
var timeset = makeTimeset(ii, counterDate, options);
|
|
27924
|
+
for (; ; ) {
|
|
27925
|
+
var _a3 = ii.getdayset(freq)(counterDate.year, counterDate.month, counterDate.day), dayset = _a3[0], start = _a3[1], end = _a3[2];
|
|
27926
|
+
var filtered = removeFilteredDays(dayset, start, end, ii, options);
|
|
27927
|
+
if (notEmpty(bysetpos)) {
|
|
27928
|
+
var poslist = buildPoslist(bysetpos, timeset, start, end, ii, dayset);
|
|
27929
|
+
for (var j3 = 0; j3 < poslist.length; j3++) {
|
|
27930
|
+
var res = poslist[j3];
|
|
27931
|
+
if (until && res > until) {
|
|
27932
|
+
return emitResult(iterResult);
|
|
27933
|
+
}
|
|
27934
|
+
if (res >= dtstart) {
|
|
27935
|
+
var rezonedDate = rezoneIfNeeded(res, options);
|
|
27936
|
+
if (!iterResult.accept(rezonedDate)) {
|
|
27937
|
+
return emitResult(iterResult);
|
|
27938
|
+
}
|
|
27939
|
+
if (count) {
|
|
27940
|
+
--count;
|
|
27941
|
+
if (!count) {
|
|
27942
|
+
return emitResult(iterResult);
|
|
27943
|
+
}
|
|
27944
|
+
}
|
|
27945
|
+
}
|
|
27946
|
+
}
|
|
27947
|
+
} else {
|
|
27948
|
+
for (var j3 = start; j3 < end; j3++) {
|
|
27949
|
+
var currentDay = dayset[j3];
|
|
27950
|
+
if (!isPresent(currentDay)) {
|
|
27951
|
+
continue;
|
|
27952
|
+
}
|
|
27953
|
+
var date5 = fromOrdinal(ii.yearordinal + currentDay);
|
|
27954
|
+
for (var k2 = 0; k2 < timeset.length; k2++) {
|
|
27955
|
+
var time3 = timeset[k2];
|
|
27956
|
+
var res = combine(date5, time3);
|
|
27957
|
+
if (until && res > until) {
|
|
27958
|
+
return emitResult(iterResult);
|
|
27959
|
+
}
|
|
27960
|
+
if (res >= dtstart) {
|
|
27961
|
+
var rezonedDate = rezoneIfNeeded(res, options);
|
|
27962
|
+
if (!iterResult.accept(rezonedDate)) {
|
|
27963
|
+
return emitResult(iterResult);
|
|
27964
|
+
}
|
|
27965
|
+
if (count) {
|
|
27966
|
+
--count;
|
|
27967
|
+
if (!count) {
|
|
27968
|
+
return emitResult(iterResult);
|
|
27969
|
+
}
|
|
27970
|
+
}
|
|
27971
|
+
}
|
|
27972
|
+
}
|
|
27973
|
+
}
|
|
27974
|
+
}
|
|
27975
|
+
if (options.interval === 0) {
|
|
27976
|
+
return emitResult(iterResult);
|
|
27977
|
+
}
|
|
27978
|
+
counterDate.add(options, filtered);
|
|
27979
|
+
if (counterDate.year > MAXYEAR) {
|
|
27980
|
+
return emitResult(iterResult);
|
|
27981
|
+
}
|
|
27982
|
+
if (!freqIsDailyOrGreater(freq)) {
|
|
27983
|
+
timeset = ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, 0);
|
|
27984
|
+
}
|
|
27985
|
+
ii.rebuild(counterDate.year, counterDate.month);
|
|
27986
|
+
}
|
|
27987
|
+
}
|
|
27988
|
+
function isFiltered(ii, currentDay, options) {
|
|
27989
|
+
var bymonth = options.bymonth, byweekno = options.byweekno, byweekday = options.byweekday, byeaster = options.byeaster, bymonthday = options.bymonthday, bynmonthday = options.bynmonthday, byyearday = options.byyearday;
|
|
27990
|
+
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));
|
|
27991
|
+
}
|
|
27992
|
+
function rezoneIfNeeded(date5, options) {
|
|
27993
|
+
return new DateWithZone(date5, options.tzid).rezonedDate();
|
|
27994
|
+
}
|
|
27995
|
+
function emitResult(iterResult) {
|
|
27996
|
+
return iterResult.getValue();
|
|
27997
|
+
}
|
|
27998
|
+
function removeFilteredDays(dayset, start, end, ii, options) {
|
|
27999
|
+
var filtered = false;
|
|
28000
|
+
for (var dayCounter = start; dayCounter < end; dayCounter++) {
|
|
28001
|
+
var currentDay = dayset[dayCounter];
|
|
28002
|
+
filtered = isFiltered(ii, currentDay, options);
|
|
28003
|
+
if (filtered)
|
|
28004
|
+
dayset[currentDay] = null;
|
|
28005
|
+
}
|
|
28006
|
+
return filtered;
|
|
28007
|
+
}
|
|
28008
|
+
function makeTimeset(ii, counterDate, options) {
|
|
28009
|
+
var freq = options.freq, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;
|
|
28010
|
+
if (freqIsDailyOrGreater(freq)) {
|
|
28011
|
+
return buildTimeset(options);
|
|
28012
|
+
}
|
|
28013
|
+
if (freq >= RRule.HOURLY && notEmpty(byhour) && !includes(byhour, counterDate.hour) || freq >= RRule.MINUTELY && notEmpty(byminute) && !includes(byminute, counterDate.minute) || freq >= RRule.SECONDLY && notEmpty(bysecond) && !includes(bysecond, counterDate.second)) {
|
|
28014
|
+
return [];
|
|
28015
|
+
}
|
|
28016
|
+
return ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, counterDate.millisecond);
|
|
28017
|
+
}
|
|
28018
|
+
|
|
28019
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/rrule.js
|
|
28020
|
+
var Days = {
|
|
28021
|
+
MO: new Weekday(0),
|
|
28022
|
+
TU: new Weekday(1),
|
|
28023
|
+
WE: new Weekday(2),
|
|
28024
|
+
TH: new Weekday(3),
|
|
28025
|
+
FR: new Weekday(4),
|
|
28026
|
+
SA: new Weekday(5),
|
|
28027
|
+
SU: new Weekday(6)
|
|
28028
|
+
};
|
|
28029
|
+
var DEFAULT_OPTIONS = {
|
|
28030
|
+
freq: Frequency.YEARLY,
|
|
28031
|
+
dtstart: null,
|
|
28032
|
+
interval: 1,
|
|
28033
|
+
wkst: Days.MO,
|
|
28034
|
+
count: null,
|
|
28035
|
+
until: null,
|
|
28036
|
+
tzid: null,
|
|
28037
|
+
bysetpos: null,
|
|
28038
|
+
bymonth: null,
|
|
28039
|
+
bymonthday: null,
|
|
28040
|
+
bynmonthday: null,
|
|
28041
|
+
byyearday: null,
|
|
28042
|
+
byweekno: null,
|
|
28043
|
+
byweekday: null,
|
|
28044
|
+
bynweekday: null,
|
|
28045
|
+
byhour: null,
|
|
28046
|
+
byminute: null,
|
|
28047
|
+
bysecond: null,
|
|
28048
|
+
byeaster: null
|
|
28049
|
+
};
|
|
28050
|
+
var defaultKeys = Object.keys(DEFAULT_OPTIONS);
|
|
28051
|
+
var RRule = (
|
|
28052
|
+
/** @class */
|
|
28053
|
+
(function() {
|
|
28054
|
+
function RRule3(options, noCache) {
|
|
28055
|
+
if (options === void 0) {
|
|
28056
|
+
options = {};
|
|
28057
|
+
}
|
|
28058
|
+
if (noCache === void 0) {
|
|
28059
|
+
noCache = false;
|
|
28060
|
+
}
|
|
28061
|
+
this._cache = noCache ? null : new Cache();
|
|
28062
|
+
this.origOptions = initializeOptions(options);
|
|
28063
|
+
var parsedOptions = parseOptions(options).parsedOptions;
|
|
28064
|
+
this.options = parsedOptions;
|
|
28065
|
+
}
|
|
28066
|
+
RRule3.parseText = function(text, language) {
|
|
28067
|
+
return parseText(text, language);
|
|
28068
|
+
};
|
|
28069
|
+
RRule3.fromText = function(text, language) {
|
|
28070
|
+
return fromText(text, language);
|
|
28071
|
+
};
|
|
28072
|
+
RRule3.fromString = function(str) {
|
|
28073
|
+
return new RRule3(RRule3.parseString(str) || void 0);
|
|
28074
|
+
};
|
|
28075
|
+
RRule3.prototype._iter = function(iterResult) {
|
|
28076
|
+
return iter(iterResult, this.options);
|
|
28077
|
+
};
|
|
28078
|
+
RRule3.prototype._cacheGet = function(what, args) {
|
|
28079
|
+
if (!this._cache)
|
|
28080
|
+
return false;
|
|
28081
|
+
return this._cache._cacheGet(what, args);
|
|
28082
|
+
};
|
|
28083
|
+
RRule3.prototype._cacheAdd = function(what, value, args) {
|
|
28084
|
+
if (!this._cache)
|
|
28085
|
+
return;
|
|
28086
|
+
return this._cache._cacheAdd(what, value, args);
|
|
28087
|
+
};
|
|
28088
|
+
RRule3.prototype.all = function(iterator) {
|
|
28089
|
+
if (iterator) {
|
|
28090
|
+
return this._iter(new callbackiterresult_default("all", {}, iterator));
|
|
28091
|
+
}
|
|
28092
|
+
var result = this._cacheGet("all");
|
|
28093
|
+
if (result === false) {
|
|
28094
|
+
result = this._iter(new iterresult_default("all", {}));
|
|
28095
|
+
this._cacheAdd("all", result);
|
|
28096
|
+
}
|
|
28097
|
+
return result;
|
|
28098
|
+
};
|
|
28099
|
+
RRule3.prototype.between = function(after, before, inc, iterator) {
|
|
28100
|
+
if (inc === void 0) {
|
|
28101
|
+
inc = false;
|
|
28102
|
+
}
|
|
28103
|
+
if (!isValidDate(after) || !isValidDate(before)) {
|
|
28104
|
+
throw new Error("Invalid date passed in to RRule.between");
|
|
28105
|
+
}
|
|
28106
|
+
var args = {
|
|
28107
|
+
before,
|
|
28108
|
+
after,
|
|
28109
|
+
inc
|
|
28110
|
+
};
|
|
28111
|
+
if (iterator) {
|
|
28112
|
+
return this._iter(new callbackiterresult_default("between", args, iterator));
|
|
28113
|
+
}
|
|
28114
|
+
var result = this._cacheGet("between", args);
|
|
28115
|
+
if (result === false) {
|
|
28116
|
+
result = this._iter(new iterresult_default("between", args));
|
|
28117
|
+
this._cacheAdd("between", result, args);
|
|
28118
|
+
}
|
|
28119
|
+
return result;
|
|
28120
|
+
};
|
|
28121
|
+
RRule3.prototype.before = function(dt2, inc) {
|
|
28122
|
+
if (inc === void 0) {
|
|
28123
|
+
inc = false;
|
|
28124
|
+
}
|
|
28125
|
+
if (!isValidDate(dt2)) {
|
|
28126
|
+
throw new Error("Invalid date passed in to RRule.before");
|
|
28127
|
+
}
|
|
28128
|
+
var args = { dt: dt2, inc };
|
|
28129
|
+
var result = this._cacheGet("before", args);
|
|
28130
|
+
if (result === false) {
|
|
28131
|
+
result = this._iter(new iterresult_default("before", args));
|
|
28132
|
+
this._cacheAdd("before", result, args);
|
|
28133
|
+
}
|
|
28134
|
+
return result;
|
|
28135
|
+
};
|
|
28136
|
+
RRule3.prototype.after = function(dt2, inc) {
|
|
28137
|
+
if (inc === void 0) {
|
|
28138
|
+
inc = false;
|
|
28139
|
+
}
|
|
28140
|
+
if (!isValidDate(dt2)) {
|
|
28141
|
+
throw new Error("Invalid date passed in to RRule.after");
|
|
28142
|
+
}
|
|
28143
|
+
var args = { dt: dt2, inc };
|
|
28144
|
+
var result = this._cacheGet("after", args);
|
|
28145
|
+
if (result === false) {
|
|
28146
|
+
result = this._iter(new iterresult_default("after", args));
|
|
28147
|
+
this._cacheAdd("after", result, args);
|
|
28148
|
+
}
|
|
28149
|
+
return result;
|
|
28150
|
+
};
|
|
28151
|
+
RRule3.prototype.count = function() {
|
|
28152
|
+
return this.all().length;
|
|
28153
|
+
};
|
|
28154
|
+
RRule3.prototype.toString = function() {
|
|
28155
|
+
return optionsToString(this.origOptions);
|
|
28156
|
+
};
|
|
28157
|
+
RRule3.prototype.toText = function(gettext, language, dateFormatter) {
|
|
28158
|
+
return toText(this, gettext, language, dateFormatter);
|
|
28159
|
+
};
|
|
28160
|
+
RRule3.prototype.isFullyConvertibleToText = function() {
|
|
28161
|
+
return isFullyConvertible(this);
|
|
28162
|
+
};
|
|
28163
|
+
RRule3.prototype.clone = function() {
|
|
28164
|
+
return new RRule3(this.origOptions);
|
|
28165
|
+
};
|
|
28166
|
+
RRule3.FREQUENCIES = [
|
|
28167
|
+
"YEARLY",
|
|
28168
|
+
"MONTHLY",
|
|
28169
|
+
"WEEKLY",
|
|
28170
|
+
"DAILY",
|
|
28171
|
+
"HOURLY",
|
|
28172
|
+
"MINUTELY",
|
|
28173
|
+
"SECONDLY"
|
|
28174
|
+
];
|
|
28175
|
+
RRule3.YEARLY = Frequency.YEARLY;
|
|
28176
|
+
RRule3.MONTHLY = Frequency.MONTHLY;
|
|
28177
|
+
RRule3.WEEKLY = Frequency.WEEKLY;
|
|
28178
|
+
RRule3.DAILY = Frequency.DAILY;
|
|
28179
|
+
RRule3.HOURLY = Frequency.HOURLY;
|
|
28180
|
+
RRule3.MINUTELY = Frequency.MINUTELY;
|
|
28181
|
+
RRule3.SECONDLY = Frequency.SECONDLY;
|
|
28182
|
+
RRule3.MO = Days.MO;
|
|
28183
|
+
RRule3.TU = Days.TU;
|
|
28184
|
+
RRule3.WE = Days.WE;
|
|
28185
|
+
RRule3.TH = Days.TH;
|
|
28186
|
+
RRule3.FR = Days.FR;
|
|
28187
|
+
RRule3.SA = Days.SA;
|
|
28188
|
+
RRule3.SU = Days.SU;
|
|
28189
|
+
RRule3.parseString = parseString;
|
|
28190
|
+
RRule3.optionsToString = optionsToString;
|
|
28191
|
+
return RRule3;
|
|
28192
|
+
})()
|
|
28193
|
+
);
|
|
28194
|
+
|
|
28195
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/iterset.js
|
|
28196
|
+
function iterSet(iterResult, _rrule, _exrule, _rdate, _exdate, tzid) {
|
|
28197
|
+
var _exdateHash = {};
|
|
28198
|
+
var _accept = iterResult.accept;
|
|
28199
|
+
function evalExdate(after, before) {
|
|
28200
|
+
_exrule.forEach(function(rrule) {
|
|
28201
|
+
rrule.between(after, before, true).forEach(function(date5) {
|
|
28202
|
+
_exdateHash[Number(date5)] = true;
|
|
28203
|
+
});
|
|
28204
|
+
});
|
|
28205
|
+
}
|
|
28206
|
+
_exdate.forEach(function(date5) {
|
|
28207
|
+
var zonedDate2 = new DateWithZone(date5, tzid).rezonedDate();
|
|
28208
|
+
_exdateHash[Number(zonedDate2)] = true;
|
|
28209
|
+
});
|
|
28210
|
+
iterResult.accept = function(date5) {
|
|
28211
|
+
var dt2 = Number(date5);
|
|
28212
|
+
if (isNaN(dt2))
|
|
28213
|
+
return _accept.call(this, date5);
|
|
28214
|
+
if (!_exdateHash[dt2]) {
|
|
28215
|
+
evalExdate(new Date(dt2 - 1), new Date(dt2 + 1));
|
|
28216
|
+
if (!_exdateHash[dt2]) {
|
|
28217
|
+
_exdateHash[dt2] = true;
|
|
28218
|
+
return _accept.call(this, date5);
|
|
28219
|
+
}
|
|
28220
|
+
}
|
|
28221
|
+
return true;
|
|
28222
|
+
};
|
|
28223
|
+
if (iterResult.method === "between") {
|
|
28224
|
+
evalExdate(iterResult.args.after, iterResult.args.before);
|
|
28225
|
+
iterResult.accept = function(date5) {
|
|
28226
|
+
var dt2 = Number(date5);
|
|
28227
|
+
if (!_exdateHash[dt2]) {
|
|
28228
|
+
_exdateHash[dt2] = true;
|
|
28229
|
+
return _accept.call(this, date5);
|
|
28230
|
+
}
|
|
28231
|
+
return true;
|
|
28232
|
+
};
|
|
28233
|
+
}
|
|
28234
|
+
for (var i = 0; i < _rdate.length; i++) {
|
|
28235
|
+
var zonedDate = new DateWithZone(_rdate[i], tzid).rezonedDate();
|
|
28236
|
+
if (!iterResult.accept(new Date(zonedDate.getTime())))
|
|
28237
|
+
break;
|
|
28238
|
+
}
|
|
28239
|
+
_rrule.forEach(function(rrule) {
|
|
28240
|
+
iter(iterResult, rrule.options);
|
|
28241
|
+
});
|
|
28242
|
+
var res = iterResult._result;
|
|
28243
|
+
sort(res);
|
|
28244
|
+
switch (iterResult.method) {
|
|
28245
|
+
case "all":
|
|
28246
|
+
case "between":
|
|
28247
|
+
return res;
|
|
28248
|
+
case "before":
|
|
28249
|
+
return res.length && res[res.length - 1] || null;
|
|
28250
|
+
case "after":
|
|
28251
|
+
default:
|
|
28252
|
+
return res.length && res[0] || null;
|
|
28253
|
+
}
|
|
28254
|
+
}
|
|
28255
|
+
|
|
28256
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/rrulestr.js
|
|
28257
|
+
var DEFAULT_OPTIONS2 = {
|
|
28258
|
+
dtstart: null,
|
|
28259
|
+
cache: false,
|
|
28260
|
+
unfold: false,
|
|
28261
|
+
forceset: false,
|
|
28262
|
+
compatible: false,
|
|
28263
|
+
tzid: null
|
|
28264
|
+
};
|
|
28265
|
+
function parseInput(s, options) {
|
|
28266
|
+
var rrulevals = [];
|
|
28267
|
+
var rdatevals = [];
|
|
28268
|
+
var exrulevals = [];
|
|
28269
|
+
var exdatevals = [];
|
|
28270
|
+
var parsedDtstart = parseDtstart(s);
|
|
28271
|
+
var dtstart = parsedDtstart.dtstart;
|
|
28272
|
+
var tzid = parsedDtstart.tzid;
|
|
28273
|
+
var lines = splitIntoLines(s, options.unfold);
|
|
28274
|
+
lines.forEach(function(line) {
|
|
28275
|
+
var _a3;
|
|
28276
|
+
if (!line)
|
|
28277
|
+
return;
|
|
28278
|
+
var _b = breakDownLine(line), name = _b.name, parms = _b.parms, value = _b.value;
|
|
28279
|
+
switch (name.toUpperCase()) {
|
|
28280
|
+
case "RRULE":
|
|
28281
|
+
if (parms.length) {
|
|
28282
|
+
throw new Error("unsupported RRULE parm: ".concat(parms.join(",")));
|
|
28283
|
+
}
|
|
28284
|
+
rrulevals.push(parseString(line));
|
|
28285
|
+
break;
|
|
28286
|
+
case "RDATE":
|
|
28287
|
+
var _c = (_a3 = /RDATE(?:;TZID=([^:=]+))?/i.exec(line)) !== null && _a3 !== void 0 ? _a3 : [], rdateTzid = _c[1];
|
|
28288
|
+
if (rdateTzid && !tzid) {
|
|
28289
|
+
tzid = rdateTzid;
|
|
28290
|
+
}
|
|
28291
|
+
rdatevals = rdatevals.concat(parseRDate(value, parms));
|
|
28292
|
+
break;
|
|
28293
|
+
case "EXRULE":
|
|
28294
|
+
if (parms.length) {
|
|
28295
|
+
throw new Error("unsupported EXRULE parm: ".concat(parms.join(",")));
|
|
28296
|
+
}
|
|
28297
|
+
exrulevals.push(parseString(value));
|
|
28298
|
+
break;
|
|
28299
|
+
case "EXDATE":
|
|
28300
|
+
exdatevals = exdatevals.concat(parseRDate(value, parms));
|
|
28301
|
+
break;
|
|
28302
|
+
case "DTSTART":
|
|
28303
|
+
break;
|
|
28304
|
+
default:
|
|
28305
|
+
throw new Error("unsupported property: " + name);
|
|
28306
|
+
}
|
|
28307
|
+
});
|
|
28308
|
+
return {
|
|
28309
|
+
dtstart,
|
|
28310
|
+
tzid,
|
|
28311
|
+
rrulevals,
|
|
28312
|
+
rdatevals,
|
|
28313
|
+
exrulevals,
|
|
28314
|
+
exdatevals
|
|
28315
|
+
};
|
|
28316
|
+
}
|
|
28317
|
+
function buildRule(s, options) {
|
|
28318
|
+
var _a3 = parseInput(s, options), rrulevals = _a3.rrulevals, rdatevals = _a3.rdatevals, exrulevals = _a3.exrulevals, exdatevals = _a3.exdatevals, dtstart = _a3.dtstart, tzid = _a3.tzid;
|
|
28319
|
+
var noCache = options.cache === false;
|
|
28320
|
+
if (options.compatible) {
|
|
28321
|
+
options.forceset = true;
|
|
28322
|
+
options.unfold = true;
|
|
28323
|
+
}
|
|
28324
|
+
if (options.forceset || rrulevals.length > 1 || rdatevals.length || exrulevals.length || exdatevals.length) {
|
|
28325
|
+
var rset_1 = new RRuleSet(noCache);
|
|
28326
|
+
rset_1.dtstart(dtstart);
|
|
28327
|
+
rset_1.tzid(tzid || void 0);
|
|
28328
|
+
rrulevals.forEach(function(val2) {
|
|
28329
|
+
rset_1.rrule(new RRule(groomRruleOptions(val2, dtstart, tzid), noCache));
|
|
28330
|
+
});
|
|
28331
|
+
rdatevals.forEach(function(date5) {
|
|
28332
|
+
rset_1.rdate(date5);
|
|
28333
|
+
});
|
|
28334
|
+
exrulevals.forEach(function(val2) {
|
|
28335
|
+
rset_1.exrule(new RRule(groomRruleOptions(val2, dtstart, tzid), noCache));
|
|
28336
|
+
});
|
|
28337
|
+
exdatevals.forEach(function(date5) {
|
|
28338
|
+
rset_1.exdate(date5);
|
|
28339
|
+
});
|
|
28340
|
+
if (options.compatible && options.dtstart)
|
|
28341
|
+
rset_1.rdate(dtstart);
|
|
28342
|
+
return rset_1;
|
|
28343
|
+
}
|
|
28344
|
+
var val = rrulevals[0] || {};
|
|
28345
|
+
return new RRule(groomRruleOptions(val, val.dtstart || options.dtstart || dtstart, val.tzid || options.tzid || tzid), noCache);
|
|
28346
|
+
}
|
|
28347
|
+
function rrulestr(s, options) {
|
|
28348
|
+
if (options === void 0) {
|
|
28349
|
+
options = {};
|
|
28350
|
+
}
|
|
28351
|
+
return buildRule(s, initializeOptions2(options));
|
|
28352
|
+
}
|
|
28353
|
+
function groomRruleOptions(val, dtstart, tzid) {
|
|
28354
|
+
return __assign(__assign({}, val), { dtstart, tzid });
|
|
28355
|
+
}
|
|
28356
|
+
function initializeOptions2(options) {
|
|
28357
|
+
var invalid = [];
|
|
28358
|
+
var keys = Object.keys(options);
|
|
28359
|
+
var defaultKeys2 = Object.keys(DEFAULT_OPTIONS2);
|
|
28360
|
+
keys.forEach(function(key) {
|
|
28361
|
+
if (!includes(defaultKeys2, key))
|
|
28362
|
+
invalid.push(key);
|
|
28363
|
+
});
|
|
28364
|
+
if (invalid.length) {
|
|
28365
|
+
throw new Error("Invalid options: " + invalid.join(", "));
|
|
28366
|
+
}
|
|
28367
|
+
return __assign(__assign({}, DEFAULT_OPTIONS2), options);
|
|
28368
|
+
}
|
|
28369
|
+
function extractName(line) {
|
|
28370
|
+
if (line.indexOf(":") === -1) {
|
|
28371
|
+
return {
|
|
28372
|
+
name: "RRULE",
|
|
28373
|
+
value: line
|
|
28374
|
+
};
|
|
28375
|
+
}
|
|
28376
|
+
var _a3 = split(line, ":", 1), name = _a3[0], value = _a3[1];
|
|
28377
|
+
return {
|
|
28378
|
+
name,
|
|
28379
|
+
value
|
|
28380
|
+
};
|
|
28381
|
+
}
|
|
28382
|
+
function breakDownLine(line) {
|
|
28383
|
+
var _a3 = extractName(line), name = _a3.name, value = _a3.value;
|
|
28384
|
+
var parms = name.split(";");
|
|
28385
|
+
if (!parms)
|
|
28386
|
+
throw new Error("empty property name");
|
|
28387
|
+
return {
|
|
28388
|
+
name: parms[0].toUpperCase(),
|
|
28389
|
+
parms: parms.slice(1),
|
|
28390
|
+
value
|
|
28391
|
+
};
|
|
28392
|
+
}
|
|
28393
|
+
function splitIntoLines(s, unfold) {
|
|
28394
|
+
if (unfold === void 0) {
|
|
28395
|
+
unfold = false;
|
|
28396
|
+
}
|
|
28397
|
+
s = s && s.trim();
|
|
28398
|
+
if (!s)
|
|
28399
|
+
throw new Error("Invalid empty string");
|
|
28400
|
+
if (!unfold) {
|
|
28401
|
+
return s.split(/\s/);
|
|
28402
|
+
}
|
|
28403
|
+
var lines = s.split("\n");
|
|
28404
|
+
var i = 0;
|
|
28405
|
+
while (i < lines.length) {
|
|
28406
|
+
var line = lines[i] = lines[i].replace(/\s+$/g, "");
|
|
28407
|
+
if (!line) {
|
|
28408
|
+
lines.splice(i, 1);
|
|
28409
|
+
} else if (i > 0 && line[0] === " ") {
|
|
28410
|
+
lines[i - 1] += line.slice(1);
|
|
28411
|
+
lines.splice(i, 1);
|
|
28412
|
+
} else {
|
|
28413
|
+
i += 1;
|
|
28414
|
+
}
|
|
28415
|
+
}
|
|
28416
|
+
return lines;
|
|
28417
|
+
}
|
|
28418
|
+
function validateDateParm(parms) {
|
|
28419
|
+
parms.forEach(function(parm) {
|
|
28420
|
+
if (!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(parm)) {
|
|
28421
|
+
throw new Error("unsupported RDATE/EXDATE parm: " + parm);
|
|
28422
|
+
}
|
|
28423
|
+
});
|
|
28424
|
+
}
|
|
28425
|
+
function parseRDate(rdateval, parms) {
|
|
28426
|
+
validateDateParm(parms);
|
|
28427
|
+
return rdateval.split(",").map(function(datestr) {
|
|
28428
|
+
return untilStringToDate(datestr);
|
|
28429
|
+
});
|
|
28430
|
+
}
|
|
28431
|
+
|
|
28432
|
+
// ../../node_modules/.pnpm/rrule@2.8.1/node_modules/rrule/dist/esm/rruleset.js
|
|
28433
|
+
function createGetterSetter(fieldName) {
|
|
28434
|
+
var _this = this;
|
|
28435
|
+
return function(field) {
|
|
28436
|
+
if (field !== void 0) {
|
|
28437
|
+
_this["_".concat(fieldName)] = field;
|
|
28438
|
+
}
|
|
28439
|
+
if (_this["_".concat(fieldName)] !== void 0) {
|
|
28440
|
+
return _this["_".concat(fieldName)];
|
|
28441
|
+
}
|
|
28442
|
+
for (var i = 0; i < _this._rrule.length; i++) {
|
|
28443
|
+
var field_1 = _this._rrule[i].origOptions[fieldName];
|
|
28444
|
+
if (field_1) {
|
|
28445
|
+
return field_1;
|
|
28446
|
+
}
|
|
28447
|
+
}
|
|
28448
|
+
};
|
|
28449
|
+
}
|
|
28450
|
+
var RRuleSet = (
|
|
28451
|
+
/** @class */
|
|
28452
|
+
(function(_super) {
|
|
28453
|
+
__extends(RRuleSet2, _super);
|
|
28454
|
+
function RRuleSet2(noCache) {
|
|
28455
|
+
if (noCache === void 0) {
|
|
28456
|
+
noCache = false;
|
|
28457
|
+
}
|
|
28458
|
+
var _this = _super.call(this, {}, noCache) || this;
|
|
28459
|
+
_this.dtstart = createGetterSetter.apply(_this, ["dtstart"]);
|
|
28460
|
+
_this.tzid = createGetterSetter.apply(_this, ["tzid"]);
|
|
28461
|
+
_this._rrule = [];
|
|
28462
|
+
_this._rdate = [];
|
|
28463
|
+
_this._exrule = [];
|
|
28464
|
+
_this._exdate = [];
|
|
28465
|
+
return _this;
|
|
28466
|
+
}
|
|
28467
|
+
RRuleSet2.prototype._iter = function(iterResult) {
|
|
28468
|
+
return iterSet(iterResult, this._rrule, this._exrule, this._rdate, this._exdate, this.tzid());
|
|
28469
|
+
};
|
|
28470
|
+
RRuleSet2.prototype.rrule = function(rrule) {
|
|
28471
|
+
_addRule(rrule, this._rrule);
|
|
28472
|
+
};
|
|
28473
|
+
RRuleSet2.prototype.exrule = function(rrule) {
|
|
28474
|
+
_addRule(rrule, this._exrule);
|
|
28475
|
+
};
|
|
28476
|
+
RRuleSet2.prototype.rdate = function(date5) {
|
|
28477
|
+
_addDate(date5, this._rdate);
|
|
28478
|
+
};
|
|
28479
|
+
RRuleSet2.prototype.exdate = function(date5) {
|
|
28480
|
+
_addDate(date5, this._exdate);
|
|
28481
|
+
};
|
|
28482
|
+
RRuleSet2.prototype.rrules = function() {
|
|
28483
|
+
return this._rrule.map(function(e2) {
|
|
28484
|
+
return rrulestr(e2.toString());
|
|
28485
|
+
});
|
|
28486
|
+
};
|
|
28487
|
+
RRuleSet2.prototype.exrules = function() {
|
|
28488
|
+
return this._exrule.map(function(e2) {
|
|
28489
|
+
return rrulestr(e2.toString());
|
|
28490
|
+
});
|
|
28491
|
+
};
|
|
28492
|
+
RRuleSet2.prototype.rdates = function() {
|
|
28493
|
+
return this._rdate.map(function(e2) {
|
|
28494
|
+
return new Date(e2.getTime());
|
|
28495
|
+
});
|
|
28496
|
+
};
|
|
28497
|
+
RRuleSet2.prototype.exdates = function() {
|
|
28498
|
+
return this._exdate.map(function(e2) {
|
|
28499
|
+
return new Date(e2.getTime());
|
|
28500
|
+
});
|
|
28501
|
+
};
|
|
28502
|
+
RRuleSet2.prototype.valueOf = function() {
|
|
28503
|
+
var result = [];
|
|
28504
|
+
if (!this._rrule.length && this._dtstart) {
|
|
28505
|
+
result = result.concat(optionsToString({ dtstart: this._dtstart }));
|
|
28506
|
+
}
|
|
28507
|
+
this._rrule.forEach(function(rrule) {
|
|
28508
|
+
result = result.concat(rrule.toString().split("\n"));
|
|
28509
|
+
});
|
|
28510
|
+
this._exrule.forEach(function(exrule) {
|
|
28511
|
+
result = result.concat(exrule.toString().split("\n").map(function(line) {
|
|
28512
|
+
return line.replace(/^RRULE:/, "EXRULE:");
|
|
28513
|
+
}).filter(function(line) {
|
|
28514
|
+
return !/^DTSTART/.test(line);
|
|
28515
|
+
}));
|
|
28516
|
+
});
|
|
28517
|
+
if (this._rdate.length) {
|
|
28518
|
+
result.push(rdatesToString("RDATE", this._rdate, this.tzid()));
|
|
28519
|
+
}
|
|
28520
|
+
if (this._exdate.length) {
|
|
28521
|
+
result.push(rdatesToString("EXDATE", this._exdate, this.tzid()));
|
|
28522
|
+
}
|
|
28523
|
+
return result;
|
|
28524
|
+
};
|
|
28525
|
+
RRuleSet2.prototype.toString = function() {
|
|
28526
|
+
return this.valueOf().join("\n");
|
|
28527
|
+
};
|
|
28528
|
+
RRuleSet2.prototype.clone = function() {
|
|
28529
|
+
var rrs = new RRuleSet2(!!this._cache);
|
|
28530
|
+
this._rrule.forEach(function(rule) {
|
|
28531
|
+
return rrs.rrule(rule.clone());
|
|
28532
|
+
});
|
|
28533
|
+
this._exrule.forEach(function(rule) {
|
|
28534
|
+
return rrs.exrule(rule.clone());
|
|
28535
|
+
});
|
|
28536
|
+
this._rdate.forEach(function(date5) {
|
|
28537
|
+
return rrs.rdate(new Date(date5.getTime()));
|
|
28538
|
+
});
|
|
28539
|
+
this._exdate.forEach(function(date5) {
|
|
28540
|
+
return rrs.exdate(new Date(date5.getTime()));
|
|
28541
|
+
});
|
|
28542
|
+
return rrs;
|
|
28543
|
+
};
|
|
28544
|
+
return RRuleSet2;
|
|
28545
|
+
})(RRule)
|
|
28546
|
+
);
|
|
28547
|
+
function _addRule(rrule, collection) {
|
|
28548
|
+
if (!(rrule instanceof RRule)) {
|
|
28549
|
+
throw new TypeError(String(rrule) + " is not RRule instance");
|
|
28550
|
+
}
|
|
28551
|
+
if (!includes(collection.map(String), String(rrule))) {
|
|
28552
|
+
collection.push(rrule);
|
|
28553
|
+
}
|
|
28554
|
+
}
|
|
28555
|
+
function _addDate(date5, collection) {
|
|
28556
|
+
if (!(date5 instanceof Date)) {
|
|
28557
|
+
throw new TypeError(String(date5) + " is not Date instance");
|
|
28558
|
+
}
|
|
28559
|
+
if (!includes(collection.map(Number), Number(date5))) {
|
|
28560
|
+
collection.push(date5);
|
|
28561
|
+
sort(collection);
|
|
28562
|
+
}
|
|
28563
|
+
}
|
|
28564
|
+
function rdatesToString(param, rdates, tzid) {
|
|
28565
|
+
var isUTC = !tzid || tzid.toUpperCase() === "UTC";
|
|
28566
|
+
var header = isUTC ? "".concat(param, ":") : "".concat(param, ";TZID=").concat(tzid, ":");
|
|
28567
|
+
var dateString = rdates.map(function(rdate) {
|
|
28568
|
+
return timeToUntilString(rdate.valueOf(), isUTC);
|
|
28569
|
+
}).join(",");
|
|
28570
|
+
return "".concat(header).concat(dateString);
|
|
28571
|
+
}
|
|
28572
|
+
|
|
28573
|
+
// ../api-server-api/src/modules/schedules/rrule.ts
|
|
28574
|
+
var rrulePkg = Reflect.get(esm_exports, "default") ?? esm_exports;
|
|
28575
|
+
var { Frequency: Frequency2, RRule: RRule2 } = rrulePkg;
|
|
28576
|
+
var ALL_DAYS = [1, 2, 3, 4, 5, 6, 7];
|
|
28577
|
+
var ISO_TO_RRULE_WEEKDAY = {
|
|
28578
|
+
1: RRule2.MO,
|
|
28579
|
+
2: RRule2.TU,
|
|
28580
|
+
3: RRule2.WE,
|
|
28581
|
+
4: RRule2.TH,
|
|
28582
|
+
5: RRule2.FR,
|
|
28583
|
+
6: RRule2.SA,
|
|
28584
|
+
7: RRule2.SU
|
|
28585
|
+
};
|
|
28586
|
+
function buildRRule(preset) {
|
|
28587
|
+
if (preset.kind === "custom") {
|
|
28588
|
+
return stripRRulePrefix(preset.rrule.trim());
|
|
28589
|
+
}
|
|
28590
|
+
const opts = toOptions(preset);
|
|
28591
|
+
return stripRRulePrefix(new RRule2(opts).toString());
|
|
28592
|
+
}
|
|
28593
|
+
function toOptions(preset) {
|
|
28594
|
+
const byweekday = daysFilterToByWeekday(preset.days);
|
|
28595
|
+
switch (preset.kind) {
|
|
28596
|
+
case "minutely":
|
|
28597
|
+
return {
|
|
28598
|
+
freq: Frequency2.MINUTELY,
|
|
28599
|
+
interval: preset.interval,
|
|
28600
|
+
...byweekday
|
|
28601
|
+
};
|
|
28602
|
+
case "hourly":
|
|
28603
|
+
return {
|
|
28604
|
+
freq: Frequency2.HOURLY,
|
|
28605
|
+
interval: preset.interval,
|
|
28606
|
+
...byweekday
|
|
28607
|
+
};
|
|
28608
|
+
case "daily":
|
|
28609
|
+
return {
|
|
28610
|
+
freq: Frequency2.DAILY,
|
|
28611
|
+
byhour: [preset.hour],
|
|
28612
|
+
byminute: [preset.minute],
|
|
28613
|
+
bysecond: [0],
|
|
28614
|
+
...byweekday
|
|
28615
|
+
};
|
|
28616
|
+
}
|
|
28617
|
+
}
|
|
28618
|
+
function daysFilterToByWeekday(days) {
|
|
28619
|
+
if (days.length === 0 || days.length === ALL_DAYS.length) return {};
|
|
28620
|
+
const mapped = days.map((d2) => ISO_TO_RRULE_WEEKDAY[d2]).filter(Boolean);
|
|
28621
|
+
return mapped.length > 0 ? { byweekday: mapped } : {};
|
|
28622
|
+
}
|
|
28623
|
+
function stripRRulePrefix(s) {
|
|
28624
|
+
return s.replace(/^RRULE:/, "");
|
|
28625
|
+
}
|
|
28626
|
+
function rruleToText(rruleBody) {
|
|
28627
|
+
try {
|
|
28628
|
+
const rule = RRule2.fromString(rruleBody);
|
|
28629
|
+
return rule.toText();
|
|
28630
|
+
} catch {
|
|
28631
|
+
return rruleBody;
|
|
28632
|
+
}
|
|
28633
|
+
}
|
|
28634
|
+
function detectPreset(rruleBody) {
|
|
28635
|
+
try {
|
|
28636
|
+
const options = RRule2.parseString(rruleBody);
|
|
28637
|
+
const days = byweekdayToIso(options.byweekday) ?? [...ALL_DAYS];
|
|
28638
|
+
const interval = typeof options.interval === "number" ? options.interval : 1;
|
|
28639
|
+
const hours = toNumArray(options.byhour);
|
|
28640
|
+
const minutes = toNumArray(options.byminute);
|
|
28641
|
+
if (options.freq === Frequency2.MINUTELY && hours.length === 0 && minutes.length === 0) {
|
|
28642
|
+
return { kind: "minutely", interval, days };
|
|
28643
|
+
}
|
|
28644
|
+
if (options.freq === Frequency2.HOURLY && hours.length === 0 && minutes.length === 0) {
|
|
28645
|
+
return { kind: "hourly", interval, days };
|
|
28646
|
+
}
|
|
28647
|
+
if ((options.freq === Frequency2.DAILY || options.freq === Frequency2.WEEKLY) && hours.length === 1 && minutes.length === 1) {
|
|
28648
|
+
return { kind: "daily", hour: hours[0], minute: minutes[0], days };
|
|
28649
|
+
}
|
|
28650
|
+
} catch {
|
|
28651
|
+
}
|
|
28652
|
+
return { kind: "custom", rrule: rruleBody };
|
|
28653
|
+
}
|
|
28654
|
+
function toNumArray(v2) {
|
|
28655
|
+
if (v2 == null) return [];
|
|
28656
|
+
if (Array.isArray(v2))
|
|
28657
|
+
return v2.filter((x) => typeof x === "number");
|
|
28658
|
+
return typeof v2 === "number" ? [v2] : [];
|
|
28659
|
+
}
|
|
28660
|
+
function byweekdayToIso(byweekday) {
|
|
28661
|
+
if (!Array.isArray(byweekday) || byweekday.length === 0) return null;
|
|
28662
|
+
const mapped = [];
|
|
28663
|
+
for (const bw of byweekday) {
|
|
28664
|
+
const n = typeof bw === "number" ? bw : bw.weekday;
|
|
28665
|
+
if (typeof n !== "number") continue;
|
|
28666
|
+
mapped.push(n + 1);
|
|
28667
|
+
}
|
|
28668
|
+
mapped.sort((a, b2) => a - b2);
|
|
28669
|
+
return mapped.length > 0 ? mapped : null;
|
|
28670
|
+
}
|
|
28671
|
+
function detectTimezone() {
|
|
28672
|
+
try {
|
|
28673
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
28674
|
+
} catch {
|
|
28675
|
+
return "UTC";
|
|
28676
|
+
}
|
|
28677
|
+
}
|
|
28678
|
+
function isInQuietHours(date5, windows) {
|
|
28679
|
+
if (windows.length === 0) return false;
|
|
28680
|
+
const m = date5.getUTCHours() * 60 + date5.getUTCMinutes();
|
|
28681
|
+
for (const w3 of windows) {
|
|
28682
|
+
if (!w3.enabled) continue;
|
|
28683
|
+
const start = parseHHMM(w3.startTime);
|
|
28684
|
+
const end = parseHHMM(w3.endTime);
|
|
28685
|
+
if (start == null || end == null || start === end) continue;
|
|
28686
|
+
const hit = start < end ? m >= start && m < end : m >= start || m < end;
|
|
28687
|
+
if (hit) return true;
|
|
28688
|
+
}
|
|
28689
|
+
return false;
|
|
28690
|
+
}
|
|
28691
|
+
function hasVisibleOccurrence(rruleBody, windows) {
|
|
28692
|
+
const enabled = windows.filter((w3) => w3.enabled);
|
|
28693
|
+
if (enabled.length === 0) return true;
|
|
28694
|
+
try {
|
|
28695
|
+
const rule = RRule2.fromString(rruleBody);
|
|
28696
|
+
let visible = false;
|
|
28697
|
+
rule.all((date5, i) => {
|
|
28698
|
+
if (i >= 1440) return false;
|
|
28699
|
+
if (!isInQuietHours(date5, enabled)) {
|
|
28700
|
+
visible = true;
|
|
28701
|
+
return false;
|
|
28702
|
+
}
|
|
28703
|
+
return true;
|
|
28704
|
+
});
|
|
28705
|
+
return visible;
|
|
28706
|
+
} catch {
|
|
28707
|
+
return true;
|
|
28708
|
+
}
|
|
28709
|
+
}
|
|
28710
|
+
function parseHHMM(s) {
|
|
28711
|
+
const match = /^(\d{2}):(\d{2})$/.exec(s);
|
|
28712
|
+
if (!match) return null;
|
|
28713
|
+
const h2 = Number(match[1]);
|
|
28714
|
+
const mi = Number(match[2]);
|
|
28715
|
+
if (h2 < 0 || h2 > 23 || mi < 0 || mi > 59) return null;
|
|
28716
|
+
return h2 * 60 + mi;
|
|
28717
|
+
}
|
|
28718
|
+
|
|
25673
28719
|
// ../api-server-api/src/modules/secrets/schemas.ts
|
|
25674
28720
|
var presetSecretTypeSchema = external_exports.enum([
|
|
25675
28721
|
"anthropic",
|
|
@@ -26847,6 +29893,7 @@ var EXIT_AGENT_NOT_RESOLVED = 5;
|
|
|
26847
29893
|
var EXIT_RULE_NOT_FOUND = 6;
|
|
26848
29894
|
var EXIT_AGENT_NOT_REACHABLE = 7;
|
|
26849
29895
|
var EXIT_APPROVAL_NOT_ACTIONABLE = 8;
|
|
29896
|
+
var EXIT_SCHEDULE_NOT_FOUND = 9;
|
|
26850
29897
|
var EXIT_SIGINT = 130;
|
|
26851
29898
|
|
|
26852
29899
|
// src/modules/agent/commands/errors.ts
|
|
@@ -30177,7 +33224,7 @@ var ESC_MAP = {
|
|
|
30177
33224
|
'"': '"',
|
|
30178
33225
|
"\\": "\\"
|
|
30179
33226
|
};
|
|
30180
|
-
function
|
|
33227
|
+
function parseString2(str, ptr = 0, endPtr = str.length) {
|
|
30181
33228
|
let isLiteral = str[ptr] === "'";
|
|
30182
33229
|
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
30183
33230
|
if (isMultiline) {
|
|
@@ -30337,7 +33384,7 @@ function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
|
30337
33384
|
let endPtr;
|
|
30338
33385
|
if (c2 === '"' || c2 === "'") {
|
|
30339
33386
|
endPtr = getStringEnd(str, ptr);
|
|
30340
|
-
let parsed =
|
|
33387
|
+
let parsed = parseString2(str, ptr, endPtr);
|
|
30341
33388
|
if (end) {
|
|
30342
33389
|
endPtr = skipVoid(str, endPtr);
|
|
30343
33390
|
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
@@ -30421,7 +33468,7 @@ function parseKey(str, ptr, end = "=") {
|
|
|
30421
33468
|
});
|
|
30422
33469
|
}
|
|
30423
33470
|
}
|
|
30424
|
-
parsed.push(
|
|
33471
|
+
parsed.push(parseString2(str, ptr, eos));
|
|
30425
33472
|
} else {
|
|
30426
33473
|
dot = str.indexOf(".", ptr);
|
|
30427
33474
|
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
@@ -34843,7 +37890,7 @@ function createProcessEnvReader() {
|
|
|
34843
37890
|
|
|
34844
37891
|
// src/modules/cli/infrastructure/package-version.ts
|
|
34845
37892
|
function readPackageVersion() {
|
|
34846
|
-
return true ? "0.2.
|
|
37893
|
+
return true ? "0.2.4-rc1" : DEV_VERSION;
|
|
34847
37894
|
}
|
|
34848
37895
|
|
|
34849
37896
|
// src/modules/cli/infrastructure/version-probe.ts
|
|
@@ -35303,7 +38350,7 @@ async function collectInputs(template, opts, json2) {
|
|
|
35303
38350
|
return { values, presetsApplied };
|
|
35304
38351
|
}
|
|
35305
38352
|
function buildPayload(template, name, values) {
|
|
35306
|
-
const
|
|
38353
|
+
const common2 = { templateId: template.id, name };
|
|
35307
38354
|
const v2 = (k2) => {
|
|
35308
38355
|
const s = values[k2]?.trim();
|
|
35309
38356
|
return s && s.length > 0 ? s : void 0;
|
|
@@ -35311,7 +38358,7 @@ function buildPayload(template, name, values) {
|
|
|
35311
38358
|
switch (template.authKind) {
|
|
35312
38359
|
case "oauth":
|
|
35313
38360
|
return {
|
|
35314
|
-
...
|
|
38361
|
+
...common2,
|
|
35315
38362
|
authKind: "oauth",
|
|
35316
38363
|
...v2("url") ? { url: v2("url") } : {},
|
|
35317
38364
|
...v2("host") ? { host: v2("host") } : {},
|
|
@@ -35329,7 +38376,7 @@ function buildPayload(template, name, values) {
|
|
|
35329
38376
|
if (ov) configInputs[input.name] = ov;
|
|
35330
38377
|
}
|
|
35331
38378
|
return {
|
|
35332
|
-
...
|
|
38379
|
+
...common2,
|
|
35333
38380
|
authKind: "header",
|
|
35334
38381
|
...v2("host") ? { host: v2("host") } : {},
|
|
35335
38382
|
...v2("headerName") ? { headerName: v2("headerName") } : {},
|
|
@@ -35341,7 +38388,7 @@ function buildPayload(template, name, values) {
|
|
|
35341
38388
|
}
|
|
35342
38389
|
case "none":
|
|
35343
38390
|
return {
|
|
35344
|
-
...
|
|
38391
|
+
...common2,
|
|
35345
38392
|
authKind: "none",
|
|
35346
38393
|
...v2("url") ? { url: v2("url") } : {}
|
|
35347
38394
|
};
|
|
@@ -37090,6 +40137,765 @@ function composeImportModule(opts) {
|
|
|
37090
40137
|
};
|
|
37091
40138
|
}
|
|
37092
40139
|
|
|
40140
|
+
// src/modules/schedule/domain/recurrence-flags.ts
|
|
40141
|
+
var WEEKDAY_TO_ISO = {
|
|
40142
|
+
MO: 1,
|
|
40143
|
+
TU: 2,
|
|
40144
|
+
WE: 3,
|
|
40145
|
+
TH: 4,
|
|
40146
|
+
FR: 5,
|
|
40147
|
+
SA: 6,
|
|
40148
|
+
SU: 7
|
|
40149
|
+
};
|
|
40150
|
+
var ISO_TO_WEEKDAY = {
|
|
40151
|
+
1: "MO",
|
|
40152
|
+
2: "TU",
|
|
40153
|
+
3: "WE",
|
|
40154
|
+
4: "TH",
|
|
40155
|
+
5: "FR",
|
|
40156
|
+
6: "SA",
|
|
40157
|
+
7: "SU"
|
|
40158
|
+
};
|
|
40159
|
+
function formatWeekdays(days) {
|
|
40160
|
+
return days.map((d2) => ISO_TO_WEEKDAY[d2]).filter((t) => t !== void 0).join(",");
|
|
40161
|
+
}
|
|
40162
|
+
function parseWeekdays(s) {
|
|
40163
|
+
const tokens = s.split(",").map((t) => t.trim().toUpperCase()).filter((t) => t.length > 0);
|
|
40164
|
+
if (tokens.length === 0) {
|
|
40165
|
+
throw new Error("--weekdays needs at least one of MO,TU,WE,TH,FR,SA,SU");
|
|
40166
|
+
}
|
|
40167
|
+
const days = [];
|
|
40168
|
+
for (const tok of tokens) {
|
|
40169
|
+
const iso = WEEKDAY_TO_ISO[tok];
|
|
40170
|
+
if (iso === void 0) {
|
|
40171
|
+
throw new Error(`unknown weekday "${tok}" \u2014 use MO,TU,WE,TH,FR,SA,SU`);
|
|
40172
|
+
}
|
|
40173
|
+
if (!days.includes(iso)) days.push(iso);
|
|
40174
|
+
}
|
|
40175
|
+
days.sort((a, b2) => a - b2);
|
|
40176
|
+
return days;
|
|
40177
|
+
}
|
|
40178
|
+
function parseEvery(s) {
|
|
40179
|
+
const m = /^(\d+)(m|h)$/.exec(s.trim());
|
|
40180
|
+
if (!m) {
|
|
40181
|
+
throw new Error(`--every must be <N>m or <N>h (e.g. 30m, 2h), got "${s}"`);
|
|
40182
|
+
}
|
|
40183
|
+
const interval = Number(m[1]);
|
|
40184
|
+
if (interval < 1) {
|
|
40185
|
+
throw new Error(`--every interval must be a positive integer, got "${s}"`);
|
|
40186
|
+
}
|
|
40187
|
+
return { kind: m[2] === "m" ? "minutely" : "hourly", interval };
|
|
40188
|
+
}
|
|
40189
|
+
function parseDaily(s) {
|
|
40190
|
+
const m = /^(\d{2}):(\d{2})$/.exec(s.trim());
|
|
40191
|
+
if (!m) throw new Error(`--daily must be HH:MM (24h), got "${s}"`);
|
|
40192
|
+
const hour = Number(m[1]);
|
|
40193
|
+
const minute = Number(m[2]);
|
|
40194
|
+
if (hour > 23 || minute > 59) {
|
|
40195
|
+
throw new Error(`--daily must be a valid 24h time 00:00\u201323:59, got "${s}"`);
|
|
40196
|
+
}
|
|
40197
|
+
return { hour, minute };
|
|
40198
|
+
}
|
|
40199
|
+
function buildPresetFromFlags(opts) {
|
|
40200
|
+
const chosen = [opts.daily, opts.every, opts.rrule].filter(
|
|
40201
|
+
(v2) => v2 !== void 0
|
|
40202
|
+
);
|
|
40203
|
+
if (chosen.length === 0) {
|
|
40204
|
+
throw new Error(
|
|
40205
|
+
"a recurrence is required \u2014 pass exactly one of --daily, --every, or --rrule"
|
|
40206
|
+
);
|
|
40207
|
+
}
|
|
40208
|
+
if (chosen.length > 1) {
|
|
40209
|
+
throw new Error(
|
|
40210
|
+
"--daily, --every, and --rrule are mutually exclusive \u2014 pass exactly one"
|
|
40211
|
+
);
|
|
40212
|
+
}
|
|
40213
|
+
if (opts.rrule !== void 0) {
|
|
40214
|
+
if (opts.weekdays !== void 0) {
|
|
40215
|
+
throw new Error(
|
|
40216
|
+
"--weekdays cannot combine with --rrule (the raw RRULE body carries its own BYDAY)"
|
|
40217
|
+
);
|
|
40218
|
+
}
|
|
40219
|
+
return { kind: "custom", rrule: opts.rrule };
|
|
40220
|
+
}
|
|
40221
|
+
const days = opts.weekdays !== void 0 ? parseWeekdays(opts.weekdays) : [...ALL_DAYS];
|
|
40222
|
+
if (opts.every !== void 0) {
|
|
40223
|
+
const { kind, interval } = parseEvery(opts.every);
|
|
40224
|
+
return { kind, interval, days };
|
|
40225
|
+
}
|
|
40226
|
+
const { hour, minute } = parseDaily(opts.daily);
|
|
40227
|
+
return { kind: "daily", hour, minute, days };
|
|
40228
|
+
}
|
|
40229
|
+
function parseQuietWindow(s) {
|
|
40230
|
+
const parts = s.split("-");
|
|
40231
|
+
if (parts.length !== 2) {
|
|
40232
|
+
throw new Error(
|
|
40233
|
+
`--quiet-window must be HH:MM-HH:MM (e.g. 22:00-06:00), got "${s}"`
|
|
40234
|
+
);
|
|
40235
|
+
}
|
|
40236
|
+
const parsed = quietWindowSchema.safeParse({
|
|
40237
|
+
startTime: parts[0]?.trim(),
|
|
40238
|
+
endTime: parts[1]?.trim(),
|
|
40239
|
+
enabled: true
|
|
40240
|
+
});
|
|
40241
|
+
if (!parsed.success) {
|
|
40242
|
+
const msg = parsed.error.issues[0]?.message ?? "invalid quiet window";
|
|
40243
|
+
throw new Error(`--quiet-window "${s}": ${msg}`);
|
|
40244
|
+
}
|
|
40245
|
+
return parsed.data;
|
|
40246
|
+
}
|
|
40247
|
+
|
|
40248
|
+
// src/modules/schedule/commands/create.ts
|
|
40249
|
+
function buildCreateCommand3(deps) {
|
|
40250
|
+
return new Command("create").description("Create an RRULE schedule on an Agent").argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").requiredOption("--name <name>", "schedule name").requiredOption("--task <task>", "task prompt to run each tick").option("--daily <HH:MM>", "run daily at HH:MM (24h)").option("--every <interval>", "run every N minutes (Nm) or hours (Nh)").option(
|
|
40251
|
+
"--rrule <body>",
|
|
40252
|
+
"raw RFC 5545 RRULE body (mutually exclusive with --daily/--every/--weekdays)"
|
|
40253
|
+
).option(
|
|
40254
|
+
"--weekdays <days>",
|
|
40255
|
+
"limit --daily/--every to these days, e.g. MO,WE,FR"
|
|
40256
|
+
).option("--timezone <tz>", "IANA timezone (default: host zone)").option(
|
|
40257
|
+
"--quiet-window <HH:MM-HH:MM>",
|
|
40258
|
+
"suppress fires inside this daily window (repeatable)",
|
|
40259
|
+
(v2, acc) => [...acc, v2],
|
|
40260
|
+
[]
|
|
40261
|
+
).addOption(
|
|
40262
|
+
new Option(
|
|
40263
|
+
"--session-mode <mode>",
|
|
40264
|
+
"session strategy each tick (default: fresh)"
|
|
40265
|
+
).choices(["fresh", "continuous"])
|
|
40266
|
+
).option(
|
|
40267
|
+
"--server <url>",
|
|
40268
|
+
"override the configured server URL for this call"
|
|
40269
|
+
).option("--json", "emit the created schedule as JSON").addHelpText(
|
|
40270
|
+
"after",
|
|
40271
|
+
"\nExamples:\n dam schedule create my-agent --name nightly --task 'Check dashboards' --daily 22:00\n dam schedule create my-agent --name standup --task 'Summarize' --every 30m --weekdays MO,WE,FR --quiet-window 22:00-06:00\n dam schedule create my-agent --name custom --task 'Run' --rrule 'FREQ=WEEKLY;BYDAY=MO;BYHOUR=7;BYMINUTE=0'\n"
|
|
40272
|
+
).action(async (ref, opts) => {
|
|
40273
|
+
const host = await resolveActiveHost(deps, {
|
|
40274
|
+
flag: opts.server ? { server: opts.server } : void 0,
|
|
40275
|
+
exitCodes: {
|
|
40276
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
40277
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
40278
|
+
}
|
|
40279
|
+
});
|
|
40280
|
+
const resolver = createAgentResolver({
|
|
40281
|
+
agentService: deps.createAgentService(host)
|
|
40282
|
+
});
|
|
40283
|
+
const resolved = await resolver.resolve(ref);
|
|
40284
|
+
if (!resolved.ok) {
|
|
40285
|
+
printResolveError(resolved.error, host);
|
|
40286
|
+
process.exit(exitCodeForResolveError(resolved.error));
|
|
40287
|
+
}
|
|
40288
|
+
let rrule;
|
|
40289
|
+
let quietHours;
|
|
40290
|
+
try {
|
|
40291
|
+
rrule = buildRRule(
|
|
40292
|
+
buildPresetFromFlags({
|
|
40293
|
+
daily: opts.daily,
|
|
40294
|
+
every: opts.every,
|
|
40295
|
+
rrule: opts.rrule,
|
|
40296
|
+
weekdays: opts.weekdays
|
|
40297
|
+
})
|
|
40298
|
+
);
|
|
40299
|
+
quietHours = opts.quietWindow.map(parseQuietWindow);
|
|
40300
|
+
} catch (e2) {
|
|
40301
|
+
process.stderr.write(`error: ${e2.message}
|
|
40302
|
+
`);
|
|
40303
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40304
|
+
}
|
|
40305
|
+
const timezone = opts.timezone ?? detectTimezone();
|
|
40306
|
+
if (!hasVisibleOccurrence(rrule, quietHours)) {
|
|
40307
|
+
process.stderr.write(
|
|
40308
|
+
"error: quiet hours cover every scheduled occurrence \u2014 this schedule would never fire\n"
|
|
40309
|
+
);
|
|
40310
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40311
|
+
}
|
|
40312
|
+
const result = await deps.createScheduleService(host).createRRule({
|
|
40313
|
+
name: opts.name,
|
|
40314
|
+
agentId: resolved.value.id,
|
|
40315
|
+
rrule,
|
|
40316
|
+
timezone,
|
|
40317
|
+
quietHours,
|
|
40318
|
+
task: opts.task,
|
|
40319
|
+
...opts.sessionMode ? { sessionMode: opts.sessionMode } : {}
|
|
40320
|
+
});
|
|
40321
|
+
if (!result.ok) {
|
|
40322
|
+
if (result.error.kind === "invalid-input") {
|
|
40323
|
+
process.stderr.write(`error: ${result.error.message}
|
|
40324
|
+
`);
|
|
40325
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40326
|
+
}
|
|
40327
|
+
printServiceError(result.error, host);
|
|
40328
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40329
|
+
}
|
|
40330
|
+
if (opts.json) {
|
|
40331
|
+
process.stdout.write(`${JSON.stringify(result.value)}
|
|
40332
|
+
`);
|
|
40333
|
+
} else {
|
|
40334
|
+
process.stdout.write(
|
|
40335
|
+
`\u2713 Created schedule ${result.value.id} (${result.value.name}) on ${ref}.
|
|
40336
|
+
`
|
|
40337
|
+
);
|
|
40338
|
+
}
|
|
40339
|
+
process.exit(EXIT_SUCCESS);
|
|
40340
|
+
});
|
|
40341
|
+
}
|
|
40342
|
+
|
|
40343
|
+
// src/modules/schedule/commands/delete.ts
|
|
40344
|
+
function buildDeleteCommand2(deps) {
|
|
40345
|
+
return new Command("delete").description("Delete a schedule. Idempotent \u2014 unknown ids exit 0.").argument("<schedule-id>", "Schedule id (from `dam schedule list`)").option(
|
|
40346
|
+
"--server <url>",
|
|
40347
|
+
"override the configured server URL for this call"
|
|
40348
|
+
).option("-y, --yes", "skip the confirmation prompt").option("--json", "emit { deleted, id } as JSON").addHelpText(
|
|
40349
|
+
"after",
|
|
40350
|
+
"\nExamples:\n dam schedule delete sched-abc123\n dam schedule delete sched-abc123 --yes\n"
|
|
40351
|
+
).action(
|
|
40352
|
+
async (id, opts) => {
|
|
40353
|
+
const host = await resolveActiveHost(deps, {
|
|
40354
|
+
flag: opts.server ? { server: opts.server } : void 0,
|
|
40355
|
+
exitCodes: {
|
|
40356
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
40357
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
40358
|
+
}
|
|
40359
|
+
});
|
|
40360
|
+
if (!opts.yes) {
|
|
40361
|
+
if (!process.stdin.isTTY) {
|
|
40362
|
+
process.stderr.write(
|
|
40363
|
+
"error: refusing to delete without --yes on non-interactive stdin\n"
|
|
40364
|
+
);
|
|
40365
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40366
|
+
}
|
|
40367
|
+
if (!await confirm(`Delete schedule ${id}?`)) exitCancelled(opts);
|
|
40368
|
+
}
|
|
40369
|
+
const result = await deps.createScheduleService(host).delete(id);
|
|
40370
|
+
if (!result.ok) {
|
|
40371
|
+
printServiceError(result.error, host);
|
|
40372
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40373
|
+
}
|
|
40374
|
+
if (opts.json) {
|
|
40375
|
+
process.stdout.write(`${JSON.stringify({ deleted: true, id })}
|
|
40376
|
+
`);
|
|
40377
|
+
} else {
|
|
40378
|
+
process.stdout.write(`\u2713 Deleted schedule ${id}.
|
|
40379
|
+
`);
|
|
40380
|
+
}
|
|
40381
|
+
process.exit(EXIT_SUCCESS);
|
|
40382
|
+
}
|
|
40383
|
+
);
|
|
40384
|
+
}
|
|
40385
|
+
|
|
40386
|
+
// src/modules/schedule/commands/toggle-command.ts
|
|
40387
|
+
function buildToggleCommand(deps, enable) {
|
|
40388
|
+
const verb = enable ? "enable" : "disable";
|
|
40389
|
+
return new Command(verb).description(
|
|
40390
|
+
`${enable ? "Enable" : "Disable"} a schedule (idempotent \u2014 a no-op if already ${verb}d)`
|
|
40391
|
+
).argument("<schedule-id>", "Schedule id (from `dam schedule list`)").option(
|
|
40392
|
+
"--server <url>",
|
|
40393
|
+
"override the configured server URL for this call"
|
|
40394
|
+
).option("--json", "emit the resulting schedule as JSON").addHelpText("after", `
|
|
40395
|
+
Examples:
|
|
40396
|
+
dam schedule ${verb} sched-abc123
|
|
40397
|
+
`).action(async (id, opts) => {
|
|
40398
|
+
const host = await resolveActiveHost(deps, {
|
|
40399
|
+
flag: opts.server ? { server: opts.server } : void 0,
|
|
40400
|
+
exitCodes: {
|
|
40401
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
40402
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
40403
|
+
}
|
|
40404
|
+
});
|
|
40405
|
+
const svc = deps.createScheduleService(host);
|
|
40406
|
+
const current = await svc.get(id);
|
|
40407
|
+
if (!current.ok) {
|
|
40408
|
+
if (current.error.kind === "schedule-not-found") {
|
|
40409
|
+
process.stderr.write(`error: schedule not found: ${id}
|
|
40410
|
+
`);
|
|
40411
|
+
process.exit(EXIT_SCHEDULE_NOT_FOUND);
|
|
40412
|
+
}
|
|
40413
|
+
printServiceError(current.error, host);
|
|
40414
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40415
|
+
}
|
|
40416
|
+
if (current.value.enabled === enable) {
|
|
40417
|
+
if (opts.json) {
|
|
40418
|
+
process.stdout.write(`${JSON.stringify(current.value)}
|
|
40419
|
+
`);
|
|
40420
|
+
} else {
|
|
40421
|
+
process.stdout.write(`Schedule ${id} is already ${verb}d.
|
|
40422
|
+
`);
|
|
40423
|
+
}
|
|
40424
|
+
process.exit(EXIT_SUCCESS);
|
|
40425
|
+
}
|
|
40426
|
+
const result = await svc.toggle(id);
|
|
40427
|
+
if (!result.ok) {
|
|
40428
|
+
if (result.error.kind === "schedule-not-found") {
|
|
40429
|
+
process.stderr.write(`error: schedule not found: ${id}
|
|
40430
|
+
`);
|
|
40431
|
+
process.exit(EXIT_SCHEDULE_NOT_FOUND);
|
|
40432
|
+
}
|
|
40433
|
+
printServiceError(result.error, host);
|
|
40434
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40435
|
+
}
|
|
40436
|
+
if (opts.json) {
|
|
40437
|
+
process.stdout.write(`${JSON.stringify(result.value)}
|
|
40438
|
+
`);
|
|
40439
|
+
} else {
|
|
40440
|
+
process.stdout.write(`\u2713 ${enable ? "Enabled" : "Disabled"} ${id}.
|
|
40441
|
+
`);
|
|
40442
|
+
}
|
|
40443
|
+
process.exit(EXIT_SUCCESS);
|
|
40444
|
+
});
|
|
40445
|
+
}
|
|
40446
|
+
|
|
40447
|
+
// src/modules/schedule/commands/disable.ts
|
|
40448
|
+
function buildDisableCommand(deps) {
|
|
40449
|
+
return buildToggleCommand(deps, false);
|
|
40450
|
+
}
|
|
40451
|
+
|
|
40452
|
+
// src/modules/schedule/commands/enable.ts
|
|
40453
|
+
function buildEnableCommand(deps) {
|
|
40454
|
+
return buildToggleCommand(deps, true);
|
|
40455
|
+
}
|
|
40456
|
+
|
|
40457
|
+
// src/modules/schedule/commands/get.ts
|
|
40458
|
+
function renderSchedule(view) {
|
|
40459
|
+
const lines = [];
|
|
40460
|
+
lines.push(`ID: ${view.id}`);
|
|
40461
|
+
lines.push(
|
|
40462
|
+
`Name: ${view.createdBy === "agent" ? `${view.name} (agent)` : view.name}`
|
|
40463
|
+
);
|
|
40464
|
+
if (view.rrule !== null) {
|
|
40465
|
+
lines.push(`Recurrence: ${rruleToText(view.rrule)}`);
|
|
40466
|
+
lines.push(`RRULE: ${view.rrule}`);
|
|
40467
|
+
lines.push(`Timezone: ${view.timezone ?? "\u2014"}`);
|
|
40468
|
+
if (view.quietHours.length > 0) {
|
|
40469
|
+
const windows = view.quietHours.map(
|
|
40470
|
+
(q2) => `${q2.startTime}-${q2.endTime}${q2.enabled ? "" : " (disabled)"}`
|
|
40471
|
+
).join(", ");
|
|
40472
|
+
lines.push(`Quiet hours: ${windows}`);
|
|
40473
|
+
}
|
|
40474
|
+
} else {
|
|
40475
|
+
lines.push(`Cron: ${view.cron ?? ""}`);
|
|
40476
|
+
}
|
|
40477
|
+
lines.push(`Session: ${view.sessionMode ?? "fresh"}`);
|
|
40478
|
+
lines.push(`Enabled: ${view.enabled}`);
|
|
40479
|
+
lines.push(`Created by: ${view.createdBy}`);
|
|
40480
|
+
if (view.status?.lastRun) lines.push(`Last run: ${view.status.lastRun}`);
|
|
40481
|
+
if (view.status?.nextRun) lines.push(`Next run: ${view.status.nextRun}`);
|
|
40482
|
+
if (view.status?.lastResult) {
|
|
40483
|
+
lines.push(`Last result: ${view.status.lastResult}`);
|
|
40484
|
+
}
|
|
40485
|
+
return `${lines.join("\n")}
|
|
40486
|
+
`;
|
|
40487
|
+
}
|
|
40488
|
+
function buildGetCommand2(deps) {
|
|
40489
|
+
return new Command("get").description("Show one schedule, expanded").argument("<schedule-id>", "Schedule id (from `dam schedule list`)").option(
|
|
40490
|
+
"--server <url>",
|
|
40491
|
+
"override the configured server URL for this call"
|
|
40492
|
+
).option("--json", "emit the raw schedule as JSON").addHelpText(
|
|
40493
|
+
"after",
|
|
40494
|
+
"\nExamples:\n dam schedule get sched-abc123\n dam schedule get sched-abc123 --json\n"
|
|
40495
|
+
).action(async (id, opts) => {
|
|
40496
|
+
const host = await resolveActiveHost(deps, {
|
|
40497
|
+
flag: opts.server ? { server: opts.server } : void 0,
|
|
40498
|
+
exitCodes: {
|
|
40499
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
40500
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
40501
|
+
}
|
|
40502
|
+
});
|
|
40503
|
+
const result = await deps.createScheduleService(host).get(id);
|
|
40504
|
+
if (!result.ok) {
|
|
40505
|
+
if (result.error.kind === "schedule-not-found") {
|
|
40506
|
+
process.stderr.write(`error: schedule not found: ${id}
|
|
40507
|
+
`);
|
|
40508
|
+
process.exit(EXIT_SCHEDULE_NOT_FOUND);
|
|
40509
|
+
}
|
|
40510
|
+
printServiceError(result.error, host);
|
|
40511
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40512
|
+
}
|
|
40513
|
+
if (opts.json) {
|
|
40514
|
+
process.stdout.write(`${JSON.stringify(result.value)}
|
|
40515
|
+
`);
|
|
40516
|
+
} else {
|
|
40517
|
+
process.stdout.write(renderSchedule(result.value));
|
|
40518
|
+
}
|
|
40519
|
+
process.exit(EXIT_SUCCESS);
|
|
40520
|
+
});
|
|
40521
|
+
}
|
|
40522
|
+
|
|
40523
|
+
// src/modules/schedule/commands/list.ts
|
|
40524
|
+
function recurrenceText(view) {
|
|
40525
|
+
return view.rrule !== null ? rruleToText(view.rrule) : view.cron ?? "";
|
|
40526
|
+
}
|
|
40527
|
+
function buildListCommand5(deps) {
|
|
40528
|
+
return new Command("list").description("List the schedules attached to an Agent").argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").option(
|
|
40529
|
+
"--server <url>",
|
|
40530
|
+
"override the configured server URL for this call"
|
|
40531
|
+
).option("--json", "emit raw JSON instead of the default table").addHelpText(
|
|
40532
|
+
"after",
|
|
40533
|
+
"\nExamples:\n dam schedule list my-agent\n dam schedule list agent-abc123 --json\n"
|
|
40534
|
+
).action(async (ref, opts) => {
|
|
40535
|
+
const host = await resolveActiveHost(deps, {
|
|
40536
|
+
flag: opts.server ? { server: opts.server } : void 0,
|
|
40537
|
+
exitCodes: {
|
|
40538
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
40539
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
40540
|
+
}
|
|
40541
|
+
});
|
|
40542
|
+
const resolver = createAgentResolver({
|
|
40543
|
+
agentService: deps.createAgentService(host)
|
|
40544
|
+
});
|
|
40545
|
+
const resolved = await resolver.resolve(ref);
|
|
40546
|
+
if (!resolved.ok) {
|
|
40547
|
+
printResolveError(resolved.error, host);
|
|
40548
|
+
process.exit(exitCodeForResolveError(resolved.error));
|
|
40549
|
+
}
|
|
40550
|
+
const result = await deps.createScheduleService(host).list(resolved.value.id);
|
|
40551
|
+
if (!result.ok) {
|
|
40552
|
+
printServiceError(result.error, host);
|
|
40553
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40554
|
+
}
|
|
40555
|
+
if (opts.json) {
|
|
40556
|
+
process.stdout.write(`${JSON.stringify(result.value)}
|
|
40557
|
+
`);
|
|
40558
|
+
process.exit(EXIT_SUCCESS);
|
|
40559
|
+
}
|
|
40560
|
+
if (result.value.length === 0) {
|
|
40561
|
+
process.stderr.write(
|
|
40562
|
+
`No schedules. Add one with \`dam schedule create ${ref} --name <n> --task <t> --daily HH:MM\`.
|
|
40563
|
+
`
|
|
40564
|
+
);
|
|
40565
|
+
process.exit(EXIT_SUCCESS);
|
|
40566
|
+
}
|
|
40567
|
+
process.stdout.write(
|
|
40568
|
+
renderTable([
|
|
40569
|
+
[
|
|
40570
|
+
"ID",
|
|
40571
|
+
"NAME",
|
|
40572
|
+
"RECURRENCE",
|
|
40573
|
+
"TZ",
|
|
40574
|
+
"ENABLED",
|
|
40575
|
+
"NEXT-RUN",
|
|
40576
|
+
"LAST-RESULT"
|
|
40577
|
+
],
|
|
40578
|
+
...result.value.map((v2) => [
|
|
40579
|
+
v2.id,
|
|
40580
|
+
v2.createdBy === "agent" ? `${v2.name} (agent)` : v2.name,
|
|
40581
|
+
recurrenceText(v2),
|
|
40582
|
+
v2.timezone ?? "\u2014",
|
|
40583
|
+
String(v2.enabled),
|
|
40584
|
+
v2.status?.nextRun ?? "\u2014",
|
|
40585
|
+
v2.status?.lastResult ?? "\u2014"
|
|
40586
|
+
])
|
|
40587
|
+
])
|
|
40588
|
+
);
|
|
40589
|
+
process.exit(EXIT_SUCCESS);
|
|
40590
|
+
});
|
|
40591
|
+
}
|
|
40592
|
+
|
|
40593
|
+
// src/modules/schedule/commands/reset-session.ts
|
|
40594
|
+
function buildResetSessionCommand(deps) {
|
|
40595
|
+
return new Command("reset-session").description(
|
|
40596
|
+
"Clear a continuous schedule's accumulated session so the next tick starts fresh"
|
|
40597
|
+
).argument("<schedule-id>", "Schedule id (from `dam schedule list`)").option(
|
|
40598
|
+
"--server <url>",
|
|
40599
|
+
"override the configured server URL for this call"
|
|
40600
|
+
).option("--json", "emit { reset, id, sessionMode } as JSON").addHelpText(
|
|
40601
|
+
"after",
|
|
40602
|
+
"\nExamples:\n dam schedule reset-session sched-abc123\n"
|
|
40603
|
+
).action(async (id, opts) => {
|
|
40604
|
+
const host = await resolveActiveHost(deps, {
|
|
40605
|
+
flag: opts.server ? { server: opts.server } : void 0,
|
|
40606
|
+
exitCodes: {
|
|
40607
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
40608
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
40609
|
+
}
|
|
40610
|
+
});
|
|
40611
|
+
const svc = deps.createScheduleService(host);
|
|
40612
|
+
const current = await svc.get(id);
|
|
40613
|
+
if (!current.ok) {
|
|
40614
|
+
if (current.error.kind === "schedule-not-found") {
|
|
40615
|
+
process.stderr.write(`error: schedule not found: ${id}
|
|
40616
|
+
`);
|
|
40617
|
+
process.exit(EXIT_SCHEDULE_NOT_FOUND);
|
|
40618
|
+
}
|
|
40619
|
+
printServiceError(current.error, host);
|
|
40620
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40621
|
+
}
|
|
40622
|
+
const sessionMode = current.value.sessionMode ?? "fresh";
|
|
40623
|
+
if (sessionMode !== "continuous") {
|
|
40624
|
+
if (opts.json) {
|
|
40625
|
+
process.stdout.write(
|
|
40626
|
+
`${JSON.stringify({ reset: false, id, sessionMode })}
|
|
40627
|
+
`
|
|
40628
|
+
);
|
|
40629
|
+
} else {
|
|
40630
|
+
process.stdout.write(
|
|
40631
|
+
`Nothing to reset \u2014 "${current.value.name}" is a fresh-session schedule.
|
|
40632
|
+
`
|
|
40633
|
+
);
|
|
40634
|
+
}
|
|
40635
|
+
process.exit(EXIT_SUCCESS);
|
|
40636
|
+
}
|
|
40637
|
+
const result = await svc.resetSession(id);
|
|
40638
|
+
if (!result.ok) {
|
|
40639
|
+
printServiceError(result.error, host);
|
|
40640
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40641
|
+
}
|
|
40642
|
+
if (opts.json) {
|
|
40643
|
+
process.stdout.write(
|
|
40644
|
+
`${JSON.stringify({ reset: true, id, sessionMode })}
|
|
40645
|
+
`
|
|
40646
|
+
);
|
|
40647
|
+
} else {
|
|
40648
|
+
process.stdout.write(
|
|
40649
|
+
`\u2713 Reset session for "${current.value.name}". The next tick starts fresh.
|
|
40650
|
+
`
|
|
40651
|
+
);
|
|
40652
|
+
}
|
|
40653
|
+
process.exit(EXIT_SUCCESS);
|
|
40654
|
+
});
|
|
40655
|
+
}
|
|
40656
|
+
|
|
40657
|
+
// src/modules/schedule/commands/update.ts
|
|
40658
|
+
function buildUpdateCommand2(deps) {
|
|
40659
|
+
return new Command("update").description(
|
|
40660
|
+
"Update an RRULE schedule (read-merge-write). Partial \u2014 pass only the fields to change. Legacy cron schedules are read-only."
|
|
40661
|
+
).argument("<schedule-id>", "Schedule id (from `dam schedule list`)").option("--name <name>", "new schedule name").option("--task <task>", "new task prompt").option("--daily <HH:MM>", "rebuild recurrence: daily at HH:MM").option("--every <interval>", "rebuild recurrence: every Nm/Nh").option("--rrule <body>", "rebuild recurrence: raw RFC 5545 RRULE body").option(
|
|
40662
|
+
"--weekdays <days>",
|
|
40663
|
+
"BYDAY filter for --daily/--every, e.g. MO,WE,FR"
|
|
40664
|
+
).option("--timezone <tz>", "new IANA timezone").option(
|
|
40665
|
+
"--quiet-window <HH:MM-HH:MM>",
|
|
40666
|
+
"replace ALL quiet windows with these (repeatable)",
|
|
40667
|
+
(v2, acc) => [...acc, v2],
|
|
40668
|
+
[]
|
|
40669
|
+
).addOption(
|
|
40670
|
+
new Option("--session-mode <mode>", "session strategy each tick").choices(
|
|
40671
|
+
["fresh", "continuous"]
|
|
40672
|
+
)
|
|
40673
|
+
).option(
|
|
40674
|
+
"--server <url>",
|
|
40675
|
+
"override the configured server URL for this call"
|
|
40676
|
+
).option("--json", "emit the updated schedule as JSON").addHelpText(
|
|
40677
|
+
"after",
|
|
40678
|
+
"\nExamples:\n dam schedule update sched-abc123 --name nightly\n dam schedule update sched-abc123 --every 30m --weekdays MO,WE,FR\n dam schedule update sched-abc123 --quiet-window 22:00-06:00\n"
|
|
40679
|
+
).action(async (id, opts) => {
|
|
40680
|
+
const recurrenceGiven = opts.daily !== void 0 || opts.every !== void 0 || opts.rrule !== void 0;
|
|
40681
|
+
const quietGiven = opts.quietWindow.length > 0;
|
|
40682
|
+
const anyFlag = opts.name !== void 0 || opts.task !== void 0 || opts.timezone !== void 0 || opts.sessionMode !== void 0 || opts.weekdays !== void 0 || recurrenceGiven || quietGiven;
|
|
40683
|
+
if (!anyFlag) {
|
|
40684
|
+
process.stderr.write(
|
|
40685
|
+
"error: nothing to update \u2014 pass at least one of --name, --task, --daily/--every/--rrule, --weekdays, --timezone, --quiet-window, --session-mode\n"
|
|
40686
|
+
);
|
|
40687
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40688
|
+
}
|
|
40689
|
+
if (opts.weekdays !== void 0 && !recurrenceGiven) {
|
|
40690
|
+
process.stderr.write(
|
|
40691
|
+
"error: --weekdays only applies when rebuilding the recurrence; pass it with --daily or --every\n"
|
|
40692
|
+
);
|
|
40693
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40694
|
+
}
|
|
40695
|
+
const host = await resolveActiveHost(deps, {
|
|
40696
|
+
flag: opts.server ? { server: opts.server } : void 0,
|
|
40697
|
+
exitCodes: {
|
|
40698
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
40699
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
40700
|
+
}
|
|
40701
|
+
});
|
|
40702
|
+
const svc = deps.createScheduleService(host);
|
|
40703
|
+
const current = await svc.get(id);
|
|
40704
|
+
if (!current.ok) {
|
|
40705
|
+
if (current.error.kind === "schedule-not-found") {
|
|
40706
|
+
process.stderr.write(`error: schedule not found: ${id}
|
|
40707
|
+
`);
|
|
40708
|
+
process.exit(EXIT_SCHEDULE_NOT_FOUND);
|
|
40709
|
+
}
|
|
40710
|
+
printServiceError(current.error, host);
|
|
40711
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40712
|
+
}
|
|
40713
|
+
const view = current.value;
|
|
40714
|
+
if (view.rrule === null) {
|
|
40715
|
+
process.stderr.write(
|
|
40716
|
+
"error: this is a legacy cron schedule; recreate it as an RRULE to edit\n"
|
|
40717
|
+
);
|
|
40718
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40719
|
+
}
|
|
40720
|
+
let rrule = view.rrule;
|
|
40721
|
+
if (recurrenceGiven) {
|
|
40722
|
+
try {
|
|
40723
|
+
rrule = buildRRule(
|
|
40724
|
+
buildPresetFromFlags({
|
|
40725
|
+
daily: opts.daily,
|
|
40726
|
+
every: opts.every,
|
|
40727
|
+
rrule: opts.rrule,
|
|
40728
|
+
weekdays: opts.weekdays
|
|
40729
|
+
})
|
|
40730
|
+
);
|
|
40731
|
+
} catch (e2) {
|
|
40732
|
+
process.stderr.write(`error: ${e2.message}
|
|
40733
|
+
`);
|
|
40734
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40735
|
+
}
|
|
40736
|
+
if (opts.weekdays === void 0 && opts.rrule === void 0) {
|
|
40737
|
+
const old = detectPreset(view.rrule);
|
|
40738
|
+
if (old.kind !== "custom" && old.days.length < ALL_DAYS.length) {
|
|
40739
|
+
process.stderr.write(
|
|
40740
|
+
`note: weekday filter (${formatWeekdays(old.days)}) cleared by the new recurrence; re-pass --weekdays to keep it
|
|
40741
|
+
`
|
|
40742
|
+
);
|
|
40743
|
+
}
|
|
40744
|
+
}
|
|
40745
|
+
}
|
|
40746
|
+
let quietHours = view.quietHours;
|
|
40747
|
+
if (quietGiven) {
|
|
40748
|
+
try {
|
|
40749
|
+
quietHours = opts.quietWindow.map(parseQuietWindow);
|
|
40750
|
+
} catch (e2) {
|
|
40751
|
+
process.stderr.write(`error: ${e2.message}
|
|
40752
|
+
`);
|
|
40753
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40754
|
+
}
|
|
40755
|
+
}
|
|
40756
|
+
if (!hasVisibleOccurrence(rrule, quietHours)) {
|
|
40757
|
+
process.stderr.write(
|
|
40758
|
+
"error: quiet hours cover every scheduled occurrence \u2014 this schedule would never fire\n"
|
|
40759
|
+
);
|
|
40760
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40761
|
+
}
|
|
40762
|
+
const sessionMode = opts.sessionMode ?? view.sessionMode;
|
|
40763
|
+
const result = await svc.updateRRule({
|
|
40764
|
+
id,
|
|
40765
|
+
name: opts.name ?? view.name,
|
|
40766
|
+
rrule,
|
|
40767
|
+
timezone: opts.timezone ?? view.timezone ?? detectTimezone(),
|
|
40768
|
+
quietHours,
|
|
40769
|
+
task: opts.task ?? view.task ?? "",
|
|
40770
|
+
...sessionMode ? { sessionMode } : {}
|
|
40771
|
+
});
|
|
40772
|
+
if (!result.ok) {
|
|
40773
|
+
if (result.error.kind === "schedule-not-found") {
|
|
40774
|
+
process.stderr.write(`error: schedule not found: ${id}
|
|
40775
|
+
`);
|
|
40776
|
+
process.exit(EXIT_SCHEDULE_NOT_FOUND);
|
|
40777
|
+
}
|
|
40778
|
+
if (result.error.kind === "invalid-input") {
|
|
40779
|
+
process.stderr.write(`error: ${result.error.message}
|
|
40780
|
+
`);
|
|
40781
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
40782
|
+
}
|
|
40783
|
+
printServiceError(result.error, host);
|
|
40784
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
40785
|
+
}
|
|
40786
|
+
if (opts.json) {
|
|
40787
|
+
process.stdout.write(`${JSON.stringify(result.value)}
|
|
40788
|
+
`);
|
|
40789
|
+
} else {
|
|
40790
|
+
process.stdout.write(
|
|
40791
|
+
`\u2713 Updated schedule ${result.value.id} (${result.value.name}).
|
|
40792
|
+
`
|
|
40793
|
+
);
|
|
40794
|
+
}
|
|
40795
|
+
process.exit(EXIT_SUCCESS);
|
|
40796
|
+
});
|
|
40797
|
+
}
|
|
40798
|
+
|
|
40799
|
+
// src/modules/schedule/services/schedule-service.ts
|
|
40800
|
+
function codeOf(e2) {
|
|
40801
|
+
return e2?.data?.code;
|
|
40802
|
+
}
|
|
40803
|
+
function messageOf(e2) {
|
|
40804
|
+
return e2 instanceof Error ? e2.message : "invalid schedule input";
|
|
40805
|
+
}
|
|
40806
|
+
function createScheduleService(deps) {
|
|
40807
|
+
return {
|
|
40808
|
+
async list(agentId) {
|
|
40809
|
+
return trpcCall(
|
|
40810
|
+
() => deps.trpc.schedules.list.query({ agentId })
|
|
40811
|
+
);
|
|
40812
|
+
},
|
|
40813
|
+
async get(id) {
|
|
40814
|
+
try {
|
|
40815
|
+
return ok2(await deps.trpc.schedules.get.query({ id }));
|
|
40816
|
+
} catch (e2) {
|
|
40817
|
+
if (codeOf(e2) === "NOT_FOUND") {
|
|
40818
|
+
return err2({ kind: "schedule-not-found", id });
|
|
40819
|
+
}
|
|
40820
|
+
return classifyTrpcError(e2);
|
|
40821
|
+
}
|
|
40822
|
+
},
|
|
40823
|
+
async createRRule(input) {
|
|
40824
|
+
try {
|
|
40825
|
+
return ok2(await deps.trpc.schedules.createRRule.mutate(input));
|
|
40826
|
+
} catch (e2) {
|
|
40827
|
+
if (codeOf(e2) === "BAD_REQUEST") {
|
|
40828
|
+
return err2({ kind: "invalid-input", message: messageOf(e2) });
|
|
40829
|
+
}
|
|
40830
|
+
return classifyTrpcError(e2);
|
|
40831
|
+
}
|
|
40832
|
+
},
|
|
40833
|
+
async updateRRule(input) {
|
|
40834
|
+
try {
|
|
40835
|
+
return ok2(await deps.trpc.schedules.updateRRule.mutate(input));
|
|
40836
|
+
} catch (e2) {
|
|
40837
|
+
const code = codeOf(e2);
|
|
40838
|
+
if (code === "NOT_FOUND") {
|
|
40839
|
+
return err2({ kind: "schedule-not-found", id: input.id });
|
|
40840
|
+
}
|
|
40841
|
+
if (code === "BAD_REQUEST") {
|
|
40842
|
+
return err2({ kind: "invalid-input", message: messageOf(e2) });
|
|
40843
|
+
}
|
|
40844
|
+
return classifyTrpcError(e2);
|
|
40845
|
+
}
|
|
40846
|
+
},
|
|
40847
|
+
async toggle(id) {
|
|
40848
|
+
try {
|
|
40849
|
+
return ok2(await deps.trpc.schedules.toggle.mutate({ id }));
|
|
40850
|
+
} catch (e2) {
|
|
40851
|
+
if (codeOf(e2) === "NOT_FOUND") {
|
|
40852
|
+
return err2({ kind: "schedule-not-found", id });
|
|
40853
|
+
}
|
|
40854
|
+
return classifyTrpcError(e2);
|
|
40855
|
+
}
|
|
40856
|
+
},
|
|
40857
|
+
async delete(id) {
|
|
40858
|
+
return trpcCall(async () => {
|
|
40859
|
+
await deps.trpc.schedules.delete.mutate({ id });
|
|
40860
|
+
});
|
|
40861
|
+
},
|
|
40862
|
+
async resetSession(id) {
|
|
40863
|
+
return trpcCall(async () => {
|
|
40864
|
+
await deps.trpc.schedules.resetSession.mutate({ id });
|
|
40865
|
+
});
|
|
40866
|
+
}
|
|
40867
|
+
};
|
|
40868
|
+
}
|
|
40869
|
+
|
|
40870
|
+
// src/modules/schedule/compose.ts
|
|
40871
|
+
function composeScheduleModule(opts) {
|
|
40872
|
+
const buildTrpc = (host) => createTrpcClient({ host, tokenProvider: opts.tokenProvider });
|
|
40873
|
+
const createService = (host) => createScheduleService({ trpc: buildTrpc(host) });
|
|
40874
|
+
const agentScoped = {
|
|
40875
|
+
compatService: opts.compatService,
|
|
40876
|
+
configService: opts.configService,
|
|
40877
|
+
createAgentService: opts.createAgentService,
|
|
40878
|
+
createScheduleService: createService
|
|
40879
|
+
};
|
|
40880
|
+
const idScoped = {
|
|
40881
|
+
compatService: opts.compatService,
|
|
40882
|
+
configService: opts.configService,
|
|
40883
|
+
createScheduleService: createService
|
|
40884
|
+
};
|
|
40885
|
+
const parent = new Command("schedule").description(
|
|
40886
|
+
"Manage time-triggered tasks (schedules) attached to an Agent"
|
|
40887
|
+
);
|
|
40888
|
+
parent.addCommand(buildListCommand5(agentScoped));
|
|
40889
|
+
parent.addCommand(buildGetCommand2(idScoped));
|
|
40890
|
+
parent.addCommand(buildCreateCommand3(agentScoped));
|
|
40891
|
+
parent.addCommand(buildUpdateCommand2(idScoped));
|
|
40892
|
+
parent.addCommand(buildEnableCommand(idScoped));
|
|
40893
|
+
parent.addCommand(buildDisableCommand(idScoped));
|
|
40894
|
+
parent.addCommand(buildDeleteCommand2(idScoped));
|
|
40895
|
+
parent.addCommand(buildResetSessionCommand(idScoped));
|
|
40896
|
+
return { commands: [parent], exports: { createService } };
|
|
40897
|
+
}
|
|
40898
|
+
|
|
37093
40899
|
// src/modules/skill/domain/source-ref.ts
|
|
37094
40900
|
function resolveSourceRef(sources, ref) {
|
|
37095
40901
|
if (ref.includes("://")) {
|
|
@@ -37361,7 +41167,7 @@ function buildInstallCommand(deps) {
|
|
|
37361
41167
|
// src/modules/skill/commands/list.ts
|
|
37362
41168
|
var INSTALLED_HEADER = ["SOURCE", "NAME", "VERSION"];
|
|
37363
41169
|
var STANDALONE_HEADER = ["NAME", "PUBLISHED"];
|
|
37364
|
-
function
|
|
41170
|
+
function buildListCommand6(deps) {
|
|
37365
41171
|
return new Command("list").description("List the skills on an Agent \u2014 installed and standalone").argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").option(
|
|
37366
41172
|
"--server <url>",
|
|
37367
41173
|
"override the configured server URL for this call"
|
|
@@ -38119,7 +41925,7 @@ function composeSkillModule(opts) {
|
|
|
38119
41925
|
sourceGroup.addCommand(buildSourceRefreshCommand(shared));
|
|
38120
41926
|
parent.addCommand(sourceGroup);
|
|
38121
41927
|
parent.addCommand(buildCatalogCommand(shared));
|
|
38122
|
-
parent.addCommand(
|
|
41928
|
+
parent.addCommand(buildListCommand6(shared));
|
|
38123
41929
|
parent.addCommand(buildInstallCommand(shared));
|
|
38124
41930
|
parent.addCommand(buildUninstallCommand(shared));
|
|
38125
41931
|
parent.addCommand(buildPublishCommand(shared));
|
|
@@ -38684,7 +42490,7 @@ function composeSshModule(opts) {
|
|
|
38684
42490
|
|
|
38685
42491
|
// src/modules/template/commands/list.ts
|
|
38686
42492
|
var DESCRIPTION_MAX = 60;
|
|
38687
|
-
function
|
|
42493
|
+
function buildListCommand7(deps) {
|
|
38688
42494
|
return new Command("list").description("List agent templates available on the active host").option(
|
|
38689
42495
|
"--server <url>",
|
|
38690
42496
|
"override the configured server URL for this call"
|
|
@@ -38769,7 +42575,7 @@ function composeTemplateModule(opts) {
|
|
|
38769
42575
|
"Discover agent templates on the active host"
|
|
38770
42576
|
);
|
|
38771
42577
|
parent.addCommand(
|
|
38772
|
-
|
|
42578
|
+
buildListCommand7({
|
|
38773
42579
|
compatService: opts.compatService,
|
|
38774
42580
|
configService: opts.configService,
|
|
38775
42581
|
createTemplateService: createService
|
|
@@ -38843,6 +42649,12 @@ function compose(opts = {}) {
|
|
|
38843
42649
|
createAgentService: agent.exports.createService,
|
|
38844
42650
|
browserOpener: createBrowserOpener()
|
|
38845
42651
|
});
|
|
42652
|
+
const schedule = composeScheduleModule({
|
|
42653
|
+
tokenProvider: auth.exports.tokenProvider,
|
|
42654
|
+
configService: cli.services.configService,
|
|
42655
|
+
compatService: cli.services.compatService,
|
|
42656
|
+
createAgentService: agent.exports.createService
|
|
42657
|
+
});
|
|
38846
42658
|
const skill = composeSkillModule({
|
|
38847
42659
|
tokenProvider: auth.exports.tokenProvider,
|
|
38848
42660
|
configService: cli.services.configService,
|
|
@@ -38868,6 +42680,7 @@ function compose(opts = {}) {
|
|
|
38868
42680
|
for (const command of egress.commands) program3.addCommand(command);
|
|
38869
42681
|
for (const command of approval.commands) program3.addCommand(command);
|
|
38870
42682
|
for (const command of connection2.commands) program3.addCommand(command);
|
|
42683
|
+
for (const command of schedule.commands) program3.addCommand(command);
|
|
38871
42684
|
for (const command of skill.commands) program3.addCommand(command);
|
|
38872
42685
|
for (const command of ssh.commands) program3.addCommand(command);
|
|
38873
42686
|
return program3;
|