cronli5 0.1.6 → 0.2.0
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/CHANGELOG.md +86 -0
- package/README.md +6 -6
- package/cronli5.min.js +2 -2
- package/dist/cronli5.cjs +401 -81
- package/dist/cronli5.js +401 -81
- package/dist/lang/de.cjs +63 -17
- package/dist/lang/de.js +63 -17
- package/dist/lang/en.cjs +401 -81
- package/dist/lang/en.js +401 -81
- package/dist/lang/es.cjs +68 -5
- package/dist/lang/es.js +68 -5
- package/dist/lang/fi.cjs +21 -1
- package/dist/lang/fi.js +21 -1
- package/dist/lang/zh.cjs +38 -7
- package/dist/lang/zh.js +38 -7
- package/package.json +1 -1
- package/src/core/ir.ts +5 -0
- package/src/core/util.ts +52 -1
- package/src/lang/de/index.ts +95 -25
- package/src/lang/en/dialects.ts +6 -2
- package/src/lang/en/index.ts +781 -117
- package/src/lang/es/index.ts +85 -9
- package/src/lang/fi/index.ts +6 -2
- package/src/lang/zh/index.ts +44 -18
- package/types/core/ir.d.ts +1 -0
- package/types/core/util.d.ts +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,92 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.2.0]
|
|
10
|
+
|
|
11
|
+
A major naturalness pass for English, validated by blind native-speaker
|
|
12
|
+
(math-inclined) panels: mean idiom rose 3.60 → 4.15 and clarity 3.75 → 4.20 on
|
|
13
|
+
full-space random samples, with zero correctness regressions. The full
|
|
14
|
+
panel-validated naturalness specification (`test/lang/en/core-set.js` +
|
|
15
|
+
`known-issues.js`, 165 cases) is now un-skipped and runs in CI as the contract
|
|
16
|
+
for the prose. Changes are to the English default dialect; other languages are
|
|
17
|
+
unchanged, and round-trip + the metamorphic invariant guard every rewrite.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **OR-day now reads as a union condition-frame.** When both day-of-month and
|
|
22
|
+
day-of-week are restricted, cron fires on the *union* of days. The old "on the
|
|
23
|
+
1st or on Friday" read as alternatives (and "and" would read as intersection);
|
|
24
|
+
it now reads "[in MONTH] [at TIME] whenever the day is the 1st or a Friday" — a
|
|
25
|
+
predicate over the day that reads as a union for naive, logical, and technical
|
|
26
|
+
readers. (~70% of expressions.)
|
|
27
|
+
- **Hour ranges read as an until-window:** "from 9 a.m. until 6 p.m." (was
|
|
28
|
+
"through 5 p.m."); hour *steps* keep "through K" (the endpoint is a real fire).
|
|
29
|
+
- **Coarser fields confine under a finer cadence:** "every second during minute
|
|
30
|
+
:00 of every hour", "every second of the midnight hour", "every two minutes
|
|
31
|
+
from midnight until 1 a.m."; a redundant unrestricted finer field drops.
|
|
32
|
+
- **Trailing weekdays pluralize** ("on Mondays"); weekday ranges keep "on Monday
|
|
33
|
+
through Friday". Weekday lists order Monday-first.
|
|
34
|
+
- **"of the month" drops under an explicit month** ("on the last Friday in
|
|
35
|
+
January"); a month range keeps "of each month from January through March".
|
|
36
|
+
- Minute lists numeralize ("4, 6, and 9 minutes past the hour"); a seconds range
|
|
37
|
+
digitizes its bounds ("from 0 through 10 past the minute"); a contiguous hour
|
|
38
|
+
run with an outlier reads "from 9 a.m. until 9 p.m. plus 10 p.m."; a year range
|
|
39
|
+
reads "2030 through 2035" and a stepped year "every second, every other year";
|
|
40
|
+
the gb day-first multi-month fold no longer garden-paths the day.
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- The English naturalness specification (`core-set.js` + `known-issues.js`, 165
|
|
45
|
+
cases) is un-skipped and runs in CI as the prose contract.
|
|
46
|
+
|
|
47
|
+
### Known limitations
|
|
48
|
+
|
|
49
|
+
- Genuinely dense crons (three stacked sub-hour cadences) remain inherently
|
|
50
|
+
verbose (~3/5 naturalness); a structural rewrite was scoped and deferred.
|
|
51
|
+
|
|
52
|
+
## [0.1.7]
|
|
53
|
+
|
|
54
|
+
A correctness and clarity pass driven by blind, math-inclined native-speaker
|
|
55
|
+
review panels over four rounds of randomly sampled patterns (one reviewer per
|
|
56
|
+
language per round), plus a new conciseness CI gate. Each fix was written
|
|
57
|
+
test-first and validated by round-trip, fuzz, and the metamorphic invariant.
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
|
|
61
|
+
- The conciseness sweep is wired into `npm run verify` as a gate: it exits
|
|
62
|
+
non-zero on any over-budget description and runs alongside lint, types, tests,
|
|
63
|
+
the metamorphic invariant, docs, and build. It is zero over-budget across all
|
|
64
|
+
five languages, guarding against verbosity regressions.
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
|
|
68
|
+
- **en:** a month (or year) restriction on an "or"-day cron — both day-of-month
|
|
69
|
+
and day-of-week set, e.g. `15W 6-8 MON#2` — scoped only the day-of-month
|
|
70
|
+
branch, falsely implying the weekday branch fires every month; it now scopes
|
|
71
|
+
the whole or.
|
|
72
|
+
- **en/es/de:** an hour range under a fixed minute (`5 9-17`) folded the minute
|
|
73
|
+
into the window end only ("through 5:05 p.m." with a bare :00 start), a false
|
|
74
|
+
continuous span; now the bare hour window plus the minute clause.
|
|
75
|
+
- **es:** a fixed hour under a step or range minute (`3/2 0`) read "a las
|
|
76
|
+
00:00", asserting a minute-:00 fire that never happens; now the hour context
|
|
77
|
+
("a medianoche" / "al mediodía" / "de la hora de las HH").
|
|
78
|
+
- **de:** a standalone offset-clean hour step (`0 0 1/2`) enumerated its hours
|
|
79
|
+
instead of the cadence ("alle 2 Stunden ab 1 Uhr"); and a "jeder
|
|
80
|
+
Minute/Stunde" suffix was emitted even when that field is fixed
|
|
81
|
+
(`30 30 9-17/2`), contradicting it — now dropped unless the field is a
|
|
82
|
+
wildcard.
|
|
83
|
+
- **zh:** an offset hour stride at minute 0 under a sub-minute second enumerated
|
|
84
|
+
instead of its cadence; a month range ran into the day-of-month
|
|
85
|
+
(`6月至8月1日` → `6月至8月,1日`); and a single-hour minute-step with a `15W`
|
|
86
|
+
day dropped the month entirely (`*/25 12 15W 12`) — all fixed.
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
|
|
90
|
+
- Weekday lists now order Monday-first (Sunday last): `SAT,SUN` reads "Saturday
|
|
91
|
+
and Sunday" (and the equivalent in each language). Display order only — the IR
|
|
92
|
+
stays canonical (Sunday = 0), so ranges, single days, and the metamorphic
|
|
93
|
+
invariant are unaffected.
|
|
94
|
+
|
|
9
95
|
## [0.1.6]
|
|
10
96
|
|
|
11
97
|
### Fixed
|
package/README.md
CHANGED
|
@@ -247,16 +247,16 @@ cronli5('0 12 * 6,12 *'); // 'every day in June and December at noon'
|
|
|
247
247
|
|
|
248
248
|
// Ranges (wrap-around ranges describe overnight and weekend windows)
|
|
249
249
|
cronli5('0-29 * * * *'); // 'every minute from 0 through 29 past the hour'
|
|
250
|
-
cronli5('0 9-17 * * *'); // 'every hour from 9 a.m.
|
|
250
|
+
cronli5('0 9-17 * * *'); // 'every hour from 9 a.m. until 6 p.m.'
|
|
251
251
|
cronli5('0 0 1-15 * *'); // 'on the 1st through 15th at midnight'
|
|
252
|
-
cronli5('0 22-2 * * *'); // 'every hour from 10 p.m.
|
|
252
|
+
cronli5('0 22-2 * * *'); // 'every hour from 10 p.m. until 3 a.m.'
|
|
253
253
|
cronli5('0 0 * * FRI-MON'); // 'every Friday through Monday at midnight'
|
|
254
254
|
|
|
255
255
|
// Compound patterns
|
|
256
256
|
cronli5('0,30 9 * * *'); // 'every day at 9 a.m. and 9:30 a.m.'
|
|
257
|
-
cronli5('*/15 9-17 * * *'); // 'every 15 minutes from 9 a.m.
|
|
257
|
+
cronli5('*/15 9-17 * * *'); // 'every 15 minutes from 9 a.m. until 6 p.m.'
|
|
258
258
|
cronli5('30 9-17 * * *');
|
|
259
|
-
// 'at 30 minutes past the hour from 9 a.m.
|
|
259
|
+
// 'at 30 minutes past the hour from 9 a.m. until 6 p.m.'
|
|
260
260
|
cronli5('0 12 1 1 *'); // 'on January 1 at noon'
|
|
261
261
|
cronli5('0 * 13 * *'); // 'every hour on the 13th'
|
|
262
262
|
|
|
@@ -279,8 +279,8 @@ pattern — `5,10 30 9 * * MON` — in every language:
|
|
|
279
279
|
<!-- BEGIN GENERATED: cronstrue-head-to-head -->
|
|
280
280
|
| Language | cronli5 | cRonstrue 3.14.0 |
|
|
281
281
|
| --- | --- | --- |
|
|
282
|
-
| English | at
|
|
283
|
-
| German | in den Sekunden 5 und 10
|
|
282
|
+
| English | at 5 and 10 seconds past the minute, every Monday at 9:30 a.m. | At 5 and 10 seconds past the minute, at 30 minutes past the hour, at 09:00 AM, only on Monday |
|
|
283
|
+
| German | in den Sekunden 5 und 10, um 9:30 Uhr montags | Bei Sekunde 5 und 10, bei Minute 30, um 09:00, nur jeden Montag |
|
|
284
284
|
| Spanish | los lunes, en los segundos 5 y 10 de las 09:30 | A los 5 y 10 segundos del minuto, a los 30 minutos de la hora, a las 09:00, sólo el lunes |
|
|
285
285
|
| Finnish | 5 ja 10 sekunnin kohdalla, maanantaisin klo 9.30 | 5 ja 10 sekunnnin jälkeen, 30 minuuttia yli, klo 09:00, vain maanantai |
|
|
286
286
|
<!-- END GENERATED: cronstrue-head-to-head -->
|
package/cronli5.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";(()=>{var ie={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},oe={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12},y={second:{cyclic:!0,max:59,min:0,top:59},minute:{cyclic:!0,max:59,min:0,top:59},hour:{cyclic:!0,max:23,min:0,top:23},date:{aliases:{"?":"*"},cyclic:!0,max:31,min:1,top:31},month:{cyclic:!0,max:12,min:1,numbers:oe,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:ie,top:6},year:{max:9999,min:1970}},N=["second","minute","hour","date","month","weekday","year"],J={"@annually":"0 0 1 1 *","@yearly":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *"},x=6;function a(n,t){return(""+n).indexOf(t)!==-1}function j(n){return Array.from(new Set(n))}function A(n){return/^\d+$/.test(n)}function pn(n){if(n.length<5)return null;let t=n[1]-n[0];if(t<2)return null;for(let e=2;e<n.length;e+=1)if(n[e]-n[e-1]!==t)return null;return{start:n[0],interval:t,last:n[n.length-1]}}function f(n,t){return A(n)?+n:t[n.toUpperCase()]}function bn(n){return N.forEach(function(e){ue(n[e],y[e],e)}),n}function ue(n,t,e){typeof n!="string"&&typeof n!="number"&&yn(n,e);let r=""+n;r!=="*"&&(e==="date"&&F(r)||e==="weekday"&&I(r,t)||r.split(",").forEach(function(o){se(o,t)||yn(o,e)}))}function F(n){if(n==="L"||n==="LW"||n==="WL")return!0;let t=/^L-(\d{1,2})$/.exec(n);if(t)return+t[1]>=1&&+t[1]<=30;let e=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(e){let r=+(e[1]||e[2]);return r>=1&&r<=31}return!1}function I(n,t){if(/L$/.test(n))return P(n.slice(0,-1),t);let e=n.split("#");return e.length===2?P(e[0],t)&&/^[1-5]$/.test(e[1]):!1}function se(n,t){return a(n,"/")?ae(n,t):a(n,"-")?Sn(n,t):P(n,t)}function ae(n,t){let e=n.split("/");return e.length!==2||!A(e[1])||+e[1]<1?!1:e[0]==="*"||P(e[0],t)||Sn(e[0],t,!0)}function Sn(n,t,e){let r=n.split("-");return r.length!==2||!P(r[0],t)||!P(r[1],t)?!1:t.cyclic&&!e?!0:f(r[0],t.numbers)<=f(r[1],t.numbers)}function P(n,t){return n==="*"?!1:A(n)?+n>=t.min&&+n<=t.max:t.numbers?n.toUpperCase()in t.numbers:!1}function yn(n,t){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+t+" field.")}var le={hour:24,minute:60,second:60};function kn(n){N.forEach(function(e){let r=y[e].aliases,i=r&&r[""+n[e]];i&&(n[e]=i)})}function Nn(n){return N.forEach(function(e){let r=""+n[e];if(e==="date"&&F(r)||e==="weekday"&&I(r,y[e])){n[e]=r;return}n[e]=ce(r,e,y[e])}),n}function ce(n,t,e){let r=""+n;if(r==="*")return r;let i=le[t],o=r.split(",").map(function(s){return me(zn(he(pe(ye(ge(de(s,e),e),e),e),e,i),e),e)}).join(",").split(",");return o.indexOf("*")!==-1?"*":j(o).sort(function(s,m){return On(s,e)-On(m,e)}).join(",")}function me(n,t){if(!t.numbers)return n;let e=n.split("/"),r=e[0].split("-").map(function(o){return fe(o,t)}).join("-");return e.length===2?r+"/"+e[1]:r}function fe(n,t){if(n==="*")return n;let e=f(n,t.numbers);return""+(e>t.top?t.min:e)}function de(n,t){let e=n.split("/");if(!t.cyclic||e.length!==2||+e[1]!=1)return n;let r=e[0];return a(r,"-")?r:r==="*"||f(r,t.numbers)===t.min?"*":r+"-"+t.top}function ge(n,t){let e=n.split("/");if(!t.cyclic||typeof t.top!="number"||e.length!==2||a(e[0],"-"))return n;let r=e[0];return(r==="*"?t.min:f(r,t.numbers))+ +e[1]<=t.top?n:r==="*"?""+t.min:r}function he(n,t,e){let r=n.split("/");if(typeof e!="number"||r.length!==2||a(r[0],"-"))return n;let i=+r[1],o=r[0]==="*"?t.min:f(r[0]);if(e%i===0&&o<i)return n;let u=[];for(let s=o;s<=t.top;s+=i)u.push(s);return u.join(",")}function pe(n,t){let e=n.split("/");return e.length!==2||!a(e[0],"-")?n:zn(e[0],t)==="*"?"*/"+e[1]:n}function zn(n,t){if(typeof t.top!="number"||a(n,"/")||!a(n,"-"))return n;let e=n.split("-"),r=f(e[0],t.numbers),i=f(e[1],t.numbers);if(r>i)return n;let o=t.top,u={};for(let s=r;s<=i;s+=1)u[s>o?t.min:s]=!0;for(let s=t.min;s<=o;s+=1)if(!u[s])return n;return"*"}function ye(n,t){let e=n.split("/")[0];if(!a(e,"-"))return n;let r=e.split("-");return f(r[0],t.numbers)!==f(r[1],t.numbers)?n:r[0]}function On(n,t){let e=n.split("/")[0].split("-")[0];return e==="*"?t.min:f(e,t.numbers)}function Rn(n,t){let e=n instanceof Array;if(n===null||typeof n>"u"||n===""||e&&n.length===0)throw new Error("`cronli5` expects a non-empty cron pattern as the first argument.");if(e)return Pn(n,t);if(typeof n=="object")return be(n);if(typeof n=="string")return Se(n,t);throw new Error("`cronli5` was passed an unexpected type.")}function Pn(n,t){if(n.length>7)throw new Error("`cronli5` was passed a cron pattern with more than seven fields.");return!t.seconds&&n.length<(t.years?7:6)&&n.unshift("0"),{second:n[0]||"0",minute:n[1]||"*",hour:n[2]||"*",date:n[3]||"*",month:n[4]||"*",weekday:n[5]||"*",year:n[6]||"*"}}function be(n){if(!n.second&&!n.minute&&!n.hour)throw new Error("`cronli5` expects that any object being interpreted as a cron pattern have at least one of the following properties: `second`, `minute`, or `hour`");let t=typeof n.second<"u",e=typeof n.minute<"u",r=t?"*":"0",i=t||e?"*":"0";return{second:z(n.second,"0"),minute:z(n.minute,r),hour:z(n.hour,i),date:z(n.date,"*"),month:z(n.month,"*"),weekday:z(n.weekday,"*"),year:z(n.year,"*")}}function z(n,t){return typeof n>"u"?t:n}function Se(n,t){let e=Oe(n).split(/\s+/);return Pn(e,t)}function Oe(n){let t=n.trim();if(t.charAt(0)!=="@")return n;let e=t.toLowerCase();if(Object.hasOwn(J,e))return J[e];throw new Error("`cronli5` does not recognize the macro `"+t+"`.")}function Cn(n){return n!=="*"&&!a(n,",")&&!a(n,"-")&&!a(n,"/")}function Y(n){return a(n,"-")&&!a(n,",")&&!a(n,"/")}function ke(n){return a(n,"/")&&!a(n,",")}function B(n){return n!=="*"&&!a(n,"-")&&!a(n,"/")}function G(n){return n!=="*"&&!Y(n)&&!ke(n)}function M(n,t,e){let r=[],i=n;for(;i<=e;)r.push(i),i+=t;return r}function vn(n,t,e,r){let i=n.split("/"),o=+i[1];if(a(i[0],"-")){let s=i[0].split("-");return M(f(s[0],r),o,f(s[1],r))}let u=i[0]==="*"?t:f(i[0],r);return M(u,o,e)}function Z(n,t,e){let r=[];return n.split(",").forEach(function(o){if(a(o,"/"))r.push(...vn(o,t,e));else if(a(o,"-")){let u=o.split("-");+u[0]<=+u[1]?r.push(...M(+u[0],1,+u[1])):(r.push(...M(+u[0],1,e)),r.push(...M(t,1,+u[1])))}else r.push(+o)}),j(r)}function Ne(n){return B(n)?n.split(",").map(Number):[0]}function ze(n){if(n==="*")return[0,59];if(Y(n)){let t=n.split("-");if(+t[0]<=+t[1])return[+t[0],+t[1]]}return null}function Re(n){return n==="*"?59:Math.max(...Z(n,0,59))}function Pe(n){if(Cn(n)&&n!=="0")return+n}function Ce(n,t){return n==="*"?"wildcard":t==="date"&&F(n)||t==="weekday"&&I(n,y.weekday)?"quartz":a(n,",")?"list":a(n,"/")?"step":a(n,"-")?"range":"single"}function ve(n,t,e){return t==="wildcard"||t==="quartz"?null:n.split(",").map(function(i){if(a(i,"/")){let o=i.split("/");return{fires:vn(i,e.min,e.top,e.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return a(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function wn(n){let t={},e={};N.forEach(function(u){t[u]=Ce(n[u],u),e[u]=ve(n[u],t[u],y[u])});let i={analyses:{clockSecond:Pe(n.second),lastMinuteFire:Re(n.minute),minuteSpan:ze(n.minute),segments:e},pattern:n,shapes:t};return{...i,plan:we(i)}}function we(n){let{analyses:t,pattern:e,shapes:r}=n;if(e.second!=="0"){let i=Te(e,r,t);if(i)return i}return Tn(e,r,t)||xn(e,r,t)}function Te(n,t,e){let r=xe(n,t);return r||(n.hour==="*"&&t.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:t.second==="single"}:t.second==="single"&&B(n.minute)&&G(n.hour)?null:{kind:"composeSeconds",rest:Tn(n,t,e,!0)||xn(n,t,e,!0)})}function xe(n,t){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:t.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function Tn(n,t,e,r=!1){if(t.minute==="step")return{hours:Ie(n,t,e),kind:"minuteFrequency"};if(t.hour==="single"&&e.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:e.minuteSpan};let i=Me(n,t);if(i)return i;let o=Fe(n,t);if(o)return o;if(n.hour==="*")return He(n,t,r)}function K(n){let[t,e]=n.split("/"),r=t==="*"?0:+t;return t.indexOf("-")===-1&&24%+e===0&&r<+e}function Fe(n,t){return t.hour!=="step"?null:n.minute==="*"?K(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:H(n.hour)}:t.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:t.minute==="list"&&K(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function Ie(n,t,e){if(t.hour==="list")return{kind:"during",times:H(n.hour)};if(t.hour==="range"){let r=n.hour.split("-");return{from:+r[0],kind:"window",last:e.lastMinuteFire,to:+r[1]}}return t.hour==="single"?{from:+n.hour,kind:"window",last:e.lastMinuteFire,to:+n.hour}:t.hour==="step"?K(n.hour)?{kind:"step"}:{kind:"during",times:H(n.hour)}:{kind:"none"}}function Me(n,t){return G(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:H(n.hour)}:t.minute==="range"||t.minute==="list"&&a(n.minute,"-")&&!a(n.minute,"/")?{form:t.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:H(n.hour)}:null:null}function He(n,t,e){if(t.minute==="range")return{kind:"rangeOfMinutes"};if(t.minute==="list")return{kind:"multipleMinutes"};if(n.minute==="*")return{kind:"everyMinute"};if(n.minute!=="0"||e)return{kind:"singleMinute"}}function xn(n,t,e,r=!1){let i=r&&n.minute==="0";return t.hour==="range"&&!i?Le(n,t,e):t.hour==="step"&&n.minute==="0"&&!r?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:We(n,e,i)}function Le(n,t,e){let r=n.hour.split("-"),i="lead";return n.minute==="*"?i="wildcard":t.minute==="range"&&(i="range"),{boundMinute:t.minute==="range"||t.minute==="list"?null:e.lastMinuteFire,from:+r[0],kind:"hourRange",last:e.lastMinuteFire,minuteForm:i,to:+r[1]}}function We(n,t,e=!1){let r=Z(n.hour,0,23),i=Ne(n.minute);if(!e&&r.length*i.length>x)return{fold:i.length===1,kind:"compactClockTimes",minute:i[0]};let o=[];return r.forEach(function(s){i.forEach(function(k){o.push({hour:s,minute:k,second:t.clockSecond})})}),{kind:"clockTimes",times:o}}function H(n){let t=Z(n,0,23);return t.length<=x?{fires:t,kind:"fires"}:{kind:"segments"}}function Fn(n,t){let e=Rn(n,t);return kn(e),bn(e),Nn(e)}function X(n){return n=""+n,n.length<2?"0"+n:n}function In(n,t,e){return e.short?n:t[n]||n}function _(n,{sep:t,pad:e,lean:r}){let i=e?X(n.hour):""+n.hour;return r&&!n.minute&&!n.second?i:i+t+X(n.minute)+(n.second?t+X(n.second):"")}var nn={gb:{am:"am",closeUp:!0,dayFirst:!0,midday:"midday",midnight:"midnight",ordinals:!1,pm:"pm",sep:".",serialComma:!1,through:" to "},us:{am:"a.m.",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!1,pm:"p.m.",sep:":",serialComma:!0,through:" through "},house:{am:"AM",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!0,pm:"PM",sep:":",serialComma:!0,through:" - "}};function Mn(n){return typeof n=="object"&&n!==null?{...nn.us,...n}:nn[n==="uk"?"gb":n]||nn.us}var Ee=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],en=["th","st","nd","rd"],je=[null,["January","Jan"],["February","Feb"],["March","Mar"],["April","Apr"],["May","May"],["June","Jun"],["July","Jul"],["August","Aug"],["September","Sep"],["October","Oct"],["November","Nov"],["December","Dec"]],S=[["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"],["Saturday","Sat"]],Ae={SUN:S[0],MON:S[1],TUE:S[2],WED:S[3],THU:S[4],FRI:S[5],SAT:S[6]},De=[null,"first","second","third","fourth","fifth"];function Ue(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,seconds:!!n.seconds,short:!!n.short,style:Mn(n.dialect),years:!!n.years}}function Qe(n,t){return Pt(Ln(n,n.plan,t),n,t)}function Ln(n,t,e){let r=dt[t.kind];return r(n,t,e)}function qe(n,t,e){return"every second"+l(n,e)}function Ve(n,t,e){return v(n,e)+l(n,e)}function $e(n,t,e){let r=n.pattern.second;return d(r,e)+" "+b(r,"second")+" past the minute, every minute"+l(n,e)}function Je(n,t,e){let r=n.pattern.minute,i=d(r,e),o=b(r,"minute");if(t.singleSecond){let u=n.pattern.second;return i+" "+o+" and "+d(u,e)+" "+b(u,"second")+" past the hour, every hour"+l(n,e)}return v(n,e)+", "+i+" "+o+" past the hour, every hour"+l(n,e)}function Ye(n,t,e){if(!(t.rest.kind==="clockTimes"||t.rest.kind==="compactClockTimes")||n.shapes.minute!=="single")return null;let i=+n.pattern.minute;return cn(n,i,e)??mn(n,i,e)}function Be(n,t,e){return+t.times[0].minute==0&&n.shapes.minute==="single"?v(n,e)+" for one minute at "+Ke(n,t,e):v(n,e)+" of "+Ze(n,t,e)}function Ge(n,t,e){let r=Ye(n,t,e);return r!==null?r:t.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?Be(n,t.rest,e):n.shapes.second==="wildcard"&&t.rest.kind==="minuteFrequency"&&t.rest.hours.kind==="none"&&n.pattern.minute==="*/2"?"every second of every other minute"+l(n,e):(t.rest.kind==="compactClockTimes"&&n.analyses.clockSecond?"":v(n,e)+", ")+Ln(n,t.rest,e)}function Ke(n,t,e){let r=t.times.map(function(u){return c({hour:u.hour,minute:0},e)}),i=Q(n,dn,e);return h(r,e)+(i&&", "+i)}function Ze(n,t,e){let r=t.times.map(function(u){return c({hour:u.hour,minute:u.minute,second:u.second,explicit:!0},e)}),i=Q(n,dn,e);return h(r,e)+(i&&", "+i)}function v(n,t){return C(n,"minute",t)}function C(n,t,e){let r=n.pattern.second,i=n.shapes.second;if(r==="*")return"every second";if(i==="step")return Un(n.analyses.segments.second[0],"second",t,e);if(i==="range"){let o=r.split("-"),u=E(o,e);return"every second from "+u(o[0])+p(e)+u(o[1])+" past the "+t}return i==="single"?"at "+d(r,e)+" "+b(r,"second")+" past the "+t:w(n.analyses.segments.second,"second",t,e)??O(T(n.analyses.segments.second,e),"second",t,e)}function Xe(n,t,e){return"every minute"+l(n,e)}function _e(n,t,e){let r=n.pattern.minute;return d(r,e)+" "+b(r,"minute")+" past the hour, every hour"+l(n,e)}function nt(n,t,e){return U(n.pattern.minute,e)+l(n,e)}function et(n,t,e){return(w(n.analyses.segments.minute,"minute","hour",e)??O(T(n.analyses.segments.minute,e),"minute","hour",e))+l(n,e)}function tt(n,t,e){let r=Un(n.analyses.segments.minute[0],"minute","hour",e);if(t.hours.kind==="during"){let i=W(n,e);r+=i?", "+i:" during the "+on(n,t.hours.times,!1,e)+" hours"}else t.hours.kind==="window"?r+=" "+jn(t.hours,e):t.hours.kind==="step"&&(r+=" "+an(n.analyses.segments.hour[0],e));return r+l(n,e)}function rt(n,t,e){return n.pattern.minute==="*"?"every minute of the "+c({hour:t.hour,minute:0},e)+" hour"+l(n,e):"every minute from "+c({hour:t.hour,minute:t.span[0]},e)+p(e)+c({hour:t.hour,minute:t.span[1]},e)+l(n,e)}function it(n,t,e){let r=W(n,e);if(t.form==="wildcard")return r!==null?"every minute, "+r+l(n,e):"every minute during the "+on(n,t.times,!1,e)+" hours"+l(n,e);let i=t.form==="range"?U(n.pattern.minute,e):w(n.analyses.segments.minute,"minute","hour",e)??O(T(n.analyses.segments.minute,e),"minute","hour",e);if(r!==null)return i+", "+r+l(n,e);let o=on(n,t.times,!0,e);return i+", at "+o+l(n,e)}var Wn={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function an(n,t){let e="during every "+Wn[n.interval]+" hour",r=n.startToken==="*"?0:+n.startToken;return r===0?e:e+" starting at "+c({hour:r,minute:0},t)}function ot(n,t,e){let r=n.analyses.segments.hour[0];if(t.form==="wildcard")return"every minute "+an(r,e)+l(n,e);let i=t.form==="list"?w(n.analyses.segments.minute,"minute","hour",e)??O(T(n.analyses.segments.minute,e),"minute","hour",e):U(n.pattern.minute,e),o=W(n,e);return i+", "+(o??Qn(r,e))+l(n,e)}function U(n,t){let e=n.split("-"),r=E(e,t);return"every minute from "+r(e[0])+p(t)+r(e[1])+" past the hour"}function ut(n,t,e){return"every hour"+l(n,e)}function st(n,t,e){let r=jn(lt(t),e);return t.minuteForm==="wildcard"?"every minute "+r+l(n,e):t.minuteForm==="range"?U(n.pattern.minute,e)+", "+r+l(n,e):En(n,e)+" "+r+l(n,e)}function En(n,t){return n.pattern.minute==="0"?"every hour":w(n.analyses.segments.minute,"minute","hour",t)??O(T(n.analyses.segments.minute,t),"minute","hour",t)}function at(n,t,e){let r=W(n,e);return r!==null?r+l(n,e):Qn(n.analyses.segments.hour[0],e)+l(n,e)}function lt(n){return{from:n.from,last:n.boundMinute??0,to:n.to}}function jn(n,t){return"from "+c({hour:n.from,minute:0},t)+p(t)+c({hour:n.to,minute:n.last},t)}function ct(n,t,e){if(n.shapes.minute==="single"){let o=+n.pattern.minute,u=cn(n,o,e)??mn(n,o,e);if(u!==null)return u}let r=fn(t.times),i=t.times.map(function(u){return c({hour:u.hour,minute:u.minute,second:u.second,plain:r},e)});return Jn(n,e)+"at "+h(i,e)}function mt(n,t,e){if(t.fold){let u=cn(n,+t.minute,e)??mn(n,+t.minute,e);if(u!==null)return u;if(n.analyses.segments.hour.some(function(g){return g.kind==="range"})&&!n.analyses.clockSecond)return ft(n,t,e)+l(n,e);let m={minute:t.minute,second:n.analyses.clockSecond};return Jn(n,e)+"at "+D(n,m,!0,e)}let r=w(n.analyses.segments.minute,"minute","hour",e)??O(T(n.analyses.segments.minute,e),"minute","hour",e),i=W(n,e),o=i?r+", "+i+l(n,e):r+", at "+D(n,{minute:0,second:null},!0,e)+l(n,e);return n.analyses.clockSecond?v(n,e)+", "+o:o}function ft(n,t,e){let r=t.minute,i=[],o=[];n.analyses.segments.hour.forEach(function(m){m.kind==="range"?i.push("from "+c({hour:m.bounds[0],minute:0},e)+p(e)+c({hour:m.bounds[1],minute:r},e)):m.kind==="step"?o.push(...m.fires):o.push(+m.value)});let u=En(n,e)+" "+h(i,e);return o.length&&(u+=" and at "+h(o.map(function(m){return c({hour:m,minute:r},e)}),e)),u}var dt={clockTimes:ct,compactClockTimes:mt,composeSeconds:Ge,everyHour:ut,everyMinute:Xe,everySecond:qe,hourRange:st,hourStep:at,minuteFrequency:tt,minuteSpanAcrossHourStep:ot,minuteSpanInHour:rt,minutesAcrossHours:it,multipleMinutes:et,rangeOfMinutes:nt,secondPastMinute:$e,secondsWithinMinute:Je,singleMinute:_e,standaloneSeconds:Ve};function An(n,t){let{interval:e,start:r,last:i,cycle:o,unit:u,anchor:s}=n,m="every "+d(e,t)+" "+u+"s",k=o%e===0;if(r===0&&k)return m;if(r<e&&k)return m+" from "+d(r,t)+" "+b(r,u)+" past the "+s;let g=E([r,i],t);return m+" from "+g(r)+p(t)+g(i)+" "+b(i,u)+" past the "+s}function Dn(n){let t=[];for(let e of n){if(e.kind!=="single")return null;t.push(+e.value)}return t}function w(n,t,e,r){let i=Dn(n),o=i&&pn(i);return o?An({...o,cycle:60,unit:t,anchor:e},r):null}function Un(n,t,e,r){if(n.startToken.indexOf("-")!==-1)return O(Hn(n.fires,r),t,e,r);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?O(Hn(n.fires,r),t,e,r):An({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:t,anchor:e},r)}function Qn(n,t){if(n.startToken.indexOf("-")!==-1)return"at "+rn(n.fires,t);let e=n.startToken==="*"?0:+n.startToken,r=n.interval;return e===0?"every "+d(r,t)+" hours":n.fires.length<=3?"at "+rn(n.fires,t):"every "+d(r,t)+" hours from "+c({hour:e,minute:0},t)}function tn(n,t){let{start:e,interval:r,last:i}=n,o="every "+d(r,t)+" hours",u=24%r===0;return e===0&&u?o:e<r&&u?o+" from "+c({hour:e,minute:0},t):o+" from "+c({hour:e,minute:0},t)+p(t)+c({hour:i,minute:0},t)}function qn(n){return n.start<n.interval&&24%n.interval===0}function W(n,t){let e=Vn(n);return!e||qn(e)?null:tn(e,t)}function gt(n){if(n.length<2)return null;let t=n[1]-n[0];if(t<2)return null;for(let e=2;e<n.length;e+=1)if(n[e]-n[e-1]!==t)return null;return n[0]!==0&&n.length<5?null:{interval:t,last:n[n.length-1],start:n[0]}}function Vn(n){let t=n.analyses.segments.hour;if(t.length===1&&t[0].kind==="step"){let r=t[0];if(r.fires.length<2)return null;let i=r.startToken==="*"?0:+r.startToken.split("-")[0];return{interval:r.interval,last:r.fires[r.fires.length-1],start:i}}let e=Dn(t);return e&>(e)}function ln(n){return n.pattern.second==="*"||n.shapes.second==="step"}function $n(n,t,e){if(t===0)return ln(n)?C(n,"minute",e)+" for one minute":C(n,"hour",e);let r=d(t,e)+" "+b(t,"minute")+" past the hour";return n.pattern.second==="0"?r:C(n,"minute",e)+", "+r}function cn(n,t,e){let r=Vn(n);if(!r)return null;let i=(r.last-r.start)/r.interval+1;if(n.pattern.second==="0"&&i<=x&&qn(r))return null;let o=t===0&&ln(n)&&ht(n);return o?C(n,"minute",e)+" for one minute "+an(o,e)+l(n,e):t===0&&n.pattern.second==="0"?tn(r,e)+l(n,e):$n(n,t,e)+", "+tn(r,e)+l(n,e)}function ht(n){let t=n.analyses.segments.hour,e=t.length===1&&t[0];return!e||e.kind!=="step"||e.startToken.indexOf("-")!==-1||!(e.interval in Wn)?null:e}function pt(n){return n.analyses.segments.hour.some(function(e){return e.kind==="range"})}function yt(n,t){let e=[],r=[];n.analyses.segments.hour.forEach(function(u){u.kind==="range"?e.push("from "+c({hour:+u.bounds[0],minute:0},t)+p(t)+c({hour:+u.bounds[1],minute:0},t)):u.kind==="step"?r.push(...u.fires):r.push(+u.value)});let i="every hour "+h(e,t);return r.length&&(i+=" and at "+h(r.map(function(u){return c({hour:u,minute:0},t)}),t)),i}function mn(n,t,e){return t!==0||!pt(n)||n.pattern.second==="0"?null:ln(n)?C(n,"minute",e)+" for one minute during the "+D(n,{minute:0,second:null},!1,e)+" hours"+l(n,e):$n(n,t,e)+", "+yt(n,e)+l(n,e)}function E(n,t){let e=n.some(function(i){return+i>10});return function(i){return e?""+i:d(i,t)}}function Hn(n,t){return n.map(E(n,t))}function T(n,t){let e=n.flatMap(function(o){return o.kind==="range"?o.bounds:o.kind==="step"?o.fires:[o.value]}),r=E(e,t);return n.flatMap(function(o){return o.kind==="range"?[r(o.bounds[0])+p(t)+r(o.bounds[1])]:o.kind==="step"?o.fires.map(r):[r(o.value)]})}function O(n,t,e,r){return"at "+h(n,r)+" "+t+"s past the "+e}function bt(n,t,e){return(+n==0||+n==12)&&+t==0&&!(typeof e=="number"&&e>0)}function fn(n){let t=n.filter(function(r){return bt(r.hour,r.minute,r.second)});return t.length>0&&t.length<n.length}function rn(n,t){let e=fn(n.map(function(o){return{hour:o,minute:0}})),r=n.map(function(o){return c({hour:o,minute:0,plain:e},t)});return h(r,t)}function on(n,t,e,r){return t.kind==="fires"?rn(t.fires,r):D(n,{minute:0,second:null},e,r)}function St(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function D(n,t,e,r){let{minute:i,second:o}=t,u=n.analyses.segments.hour,s=fn(u.flatMap(function(g){return St(g).map(function($){return{hour:+$,minute:i,second:o}})})),m=[];return u.forEach(function(g){g.kind==="step"?m.push(...g.fires.map(function($){return c({hour:$,minute:i,second:o,plain:s},r)})):g.kind==="range"?m.push(c({hour:g.bounds[0],minute:i,second:o,plain:s},r)+p(r)+c({hour:g.bounds[1],minute:i,second:o,plain:s},r)):m.push(c({hour:g.value,minute:i,second:o,plain:s},r))}),h(Ot(m,u,e),r)}function Ot(n,t,e){let r=t.some(function(o){return o.kind==="range"});return!e||!r?n:n.map(function(o,u){return u===0?o:"at "+o})}function h(n,t){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+" and "+n[1];let e=t.style.serialComma?", and ":" and ";return n.slice(0,-1).join(", ")+e+n[n.length-1]}var kt={all:"",month:"in ",stepDate:"on ",weekday:"on "},dn={all:"every day",month:"every day in ",stepDate:"",weekday:"every "};function l(n,t){let e=Q(n,kt,t);return e&&" "+e}function Jn(n,t){return Q(n,dn,t)+" "}function Q(n,t,e){let r=n.pattern;return r.date!=="*"&&r.weekday!=="*"?zt(n,e):r.date!=="*"?Nt(n,t,e):r.weekday!=="*"?(Gn(r.weekday,e)||t.weekday+_n(n,e))+R(n,e):r.month!=="*"?t.month+q(n,e):t.all}function Nt(n,t,e){let r=n.pattern,i=Bn(r.date,e);return i?i+R(n,e):gn(r.date)?t.stepDate+Zn(r.date)+R(n,e):r.month!=="*"&&!Yn(n)?"on the "+un(n,e)+R(n,e):r.month!=="*"?"on "+Kn(n,e):"on the "+un(n,e)}function Yn(n){return!Xn(n.pattern.month)&&n.analyses.segments.month.every(function(e){return e.kind!=="range"})}function zt(n,t){let e=n.pattern,r=Gn(e.weekday,t)||"on "+_n(n,t),i=Bn(e.date,t);return i?i+R(n,t)+" or "+r:gn(e.date)?Zn(e.date)+R(n,t)+" or "+r:e.month!=="*"&&Yn(n)?"on "+Kn(n,t)+" or "+r+" in "+q(n,t):"on the "+un(n,t)+" or "+r+R(n,t)}function Bn(n,t){if(n==="L")return"on the last day of the month";if(n==="LW"||n==="WL")return"on the last weekday of the month";let e=/^L-(\d{1,2})$/.exec(n);if(e)return d(+e[1],t)+" "+b(e[1],"day")+" before the last day of the month";let r=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(r)return"on the weekday nearest the "+L(r[1]||r[2])}function Gn(n,t){let e=n.split("#");if(e.length===2)return"on the "+De[+e[1]]+" "+sn(e[0],t)+" of the month";if(/L$/.test(n))return"on the last "+sn(n.slice(0,-1),t)+" of the month"}function Kn(n,t){let e=q(n,t),r=V(n.analyses.segments.date,t.style.ordinals?L:Rt,t);return t.style.dayFirst?r+" "+e:e+" "+r}function Rt(n){return""+n}function R(n,t){return n.pattern.month==="*"?"":" in "+q(n,t)}function Zn(n){let t=n.split("/"),e=+t[1],r=t[0],o=(e===2?"every other":"every "+L(e))+" day of the month";return r!=="*"&&r!=="1"&&(o+=" from the "+L(r)),o}function un(n,t){return V(n.analyses.segments.date,L,t)}function q(n,t){let e=Xn(n.pattern.month);return e||V(n.analyses.segments.month,function(i){return Tt(i,t)},t)}function Xn(n){if(!gn(n))return null;let[t,e]=n.split("/");return+e!=2?null:t==="*"||t==="1"?"every odd-numbered month":t==="2"?"every even-numbered month":null}function _n(n,t){return V(n.analyses.segments.weekday,function(r){return sn(r,t)},t)}function V(n,t,e){let r=[];return n.forEach(function(o){o.kind==="step"?r.push(...o.fires.map(t)):o.kind==="range"?r.push(o.bounds.map(t).join(p(e))):r.push(t(o.value))}),h(r,e)}function gn(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function Pt(n,t,e){let r=t.pattern.year;if(r==="*")return n;if(r.indexOf("/")!==-1)return n+" "+vt(r,e);let i=Ct(r,e);if(r.indexOf("-")===-1&&r.indexOf(",")===-1&&t.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let o=e.style.dayFirst?" ":", ";return n.replace(" at ",o+i+" at ")}return n+" in "+i}function Ct(n,t){return n.indexOf(",")!==-1?h(n.split(","),t):n}function vt(n,t){let e=n.split("/"),r=+e[1],i=e[0];if(r<=1)return"every year";let o="every "+d(r,t)+" years";return i!=="*"&&i!=="0"&&(o+=" from "+i),o}function c(n,t){let{hour:e,minute:r,plain:i,explicit:o}=n,u=typeof n.second=="number"&&n.second>0?n.second:0;return t.ampm?wt({hour:e,minute:r,second:u,plain:i,explicit:o},t):_({hour:e,minute:r,second:u},{pad:!0,sep:t.style.sep})}function wt(n,t){let{hour:e,minute:r,second:i,plain:o,explicit:u}=n,s=t.style;if(!o&&!u&&+r==0&&!i){if(+e==0)return s.midnight;if(+e==12)return s.midday}return _({hour:e%12||12,minute:r,second:i},{lean:!u,sep:s.sep})+(s.closeUp?"":" ")+(e<12?s.am:s.pm)}function d(n,t){return In(n,Ee,t)}function b(n,t){return+n==1?t:t+"s"}function p(n){return n.short?"-":n.style.through}function L(n){let t=Math.abs(n),e=en[t];return e||(t=(t%100-20)%10,e=en[t]||en[0]),n+e}function Tt(n,t){let e=je[+n];return e&&e[t.short?1:0]}function sn(n,t){let e=n===7||n==="7"?0:n,r=S[e]||Ae[e];return r&&r[t.short?1:0]}var xt={describe:Qe,fallback:"an unrecognizable cron pattern",options:Ue,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},ne=xt;/**
|
|
1
|
+
"use strict";(()=>{var pe={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},ye={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12},S={second:{cyclic:!0,max:59,min:0,top:59},minute:{cyclic:!0,max:59,min:0,top:59},hour:{cyclic:!0,max:23,min:0,top:23},date:{aliases:{"?":"*"},cyclic:!0,max:31,min:1,top:31},month:{cyclic:!0,max:12,min:1,numbers:ye,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:pe,top:6},year:{max:9999,min:1970}},v=["second","minute","hour","date","month","weekday","year"],X={"@annually":"0 0 1 1 *","@yearly":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *"},W=6;function l(n,e){return(""+n).indexOf(e)!==-1}function Q(n){return Array.from(new Set(n))}function V(n){return/^\d+$/.test(n)}function _(n){if(n.length<5)return null;let e=n[1]-n[0];if(e<2)return null;for(let t=2;t<n.length;t+=1)if(n[t]-n[t-1]!==e)return null;return{start:n[0],interval:e,last:n[n.length-1]}}function Rn(n){return n===0?7:n}function wn(n){let e=n.flatMap(function(i){return i.kind==="step"?i.fires.map(function(o){return{kind:"single",value:""+o}}):[i]});function t(r){return r.kind==="range"?Rn(+r.bounds[0]):Rn(+r.value)}return e.map(function(i,u){return[i,u]}).sort(function(i,u){return t(i[0])-t(u[0])||i[1]-u[1]}).map(function(i){return i[0]})}function f(n,e){return V(n)?+n:e[n.toUpperCase()]}function Pn(n){return v.forEach(function(t){be(n[t],S[t],t)}),n}function be(n,e,t){typeof n!="string"&&typeof n!="number"&&vn(n,t);let r=""+n;r!=="*"&&(t==="date"&&H(r)||t==="weekday"&&L(r,e)||r.split(",").forEach(function(u){Se(u,e)||vn(u,t)}))}function H(n){if(n==="L"||n==="LW"||n==="WL")return!0;let e=/^L-(\d{1,2})$/.exec(n);if(e)return+e[1]>=1&&+e[1]<=30;let t=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(t){let r=+(t[1]||t[2]);return r>=1&&r<=31}return!1}function L(n,e){if(/L$/.test(n))return T(n.slice(0,-1),e);let t=n.split("#");return t.length===2?T(t[0],e)&&/^[1-5]$/.test(t[1]):!1}function Se(n,e){return l(n,"/")?ke(n,e):l(n,"-")?Cn(n,e):T(n,e)}function ke(n,e){let t=n.split("/");return t.length!==2||!V(t[1])||+t[1]<1?!1:t[0]==="*"||T(t[0],e)||Cn(t[0],e,!0)}function Cn(n,e,t){let r=n.split("-");return r.length!==2||!T(r[0],e)||!T(r[1],e)?!1:e.cyclic&&!t?!0:f(r[0],e.numbers)<=f(r[1],e.numbers)}function T(n,e){return n==="*"?!1:V(n)?+n>=e.min&&+n<=e.max:e.numbers?n.toUpperCase()in e.numbers:!1}function vn(n,e){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+e+" field.")}var Oe={hour:24,minute:60,second:60};function xn(n){v.forEach(function(t){let r=S[t].aliases,i=r&&r[""+n[t]];i&&(n[t]=i)})}function Tn(n){return v.forEach(function(t){let r=""+n[t];if(t==="date"&&H(r)||t==="weekday"&&L(r,S[t])){n[t]=r;return}n[t]=Ne(r,t,S[t])}),n}function Ne(n,e,t){let r=""+n;if(r==="*")return r;let i=Oe[e],u=r.split(",").map(function(s){return ze(Fn(Pe(Ce(Ie(ve(we(s,t),t),t),t),t,i),t),t)}).join(",").split(",");return u.indexOf("*")!==-1?"*":Q(u).sort(function(s,m){return In(s,t)-In(m,t)}).join(",")}function ze(n,e){if(!e.numbers)return n;let t=n.split("/"),r=t[0].split("-").map(function(u){return Re(u,e)}).join("-");return t.length===2?r+"/"+t[1]:r}function Re(n,e){if(n==="*")return n;let t=f(n,e.numbers);return""+(t>e.top?e.min:t)}function we(n,e){let t=n.split("/");if(!e.cyclic||t.length!==2||+t[1]!=1)return n;let r=t[0];return l(r,"-")?r:r==="*"||f(r,e.numbers)===e.min?"*":r+"-"+e.top}function ve(n,e){let t=n.split("/");if(!e.cyclic||typeof e.top!="number"||t.length!==2||l(t[0],"-"))return n;let r=t[0];return(r==="*"?e.min:f(r,e.numbers))+ +t[1]<=e.top?n:r==="*"?""+e.min:r}function Pe(n,e,t){let r=n.split("/");if(typeof t!="number"||r.length!==2||l(r[0],"-"))return n;let i=+r[1],u=r[0]==="*"?e.min:f(r[0]);if(t%i===0&&u<i)return n;let o=[];for(let s=u;s<=e.top;s+=i)o.push(s);return o.join(",")}function Ce(n,e){let t=n.split("/");return t.length!==2||!l(t[0],"-")?n:Fn(t[0],e)==="*"?"*/"+t[1]:n}function Fn(n,e){if(typeof e.top!="number"||l(n,"/")||!l(n,"-"))return n;let t=n.split("-"),r=f(t[0],e.numbers),i=f(t[1],e.numbers);if(r>i)return n;let u=e.top,o={};for(let s=r;s<=i;s+=1)o[s>u?e.min:s]=!0;for(let s=e.min;s<=u;s+=1)if(!o[s])return n;return"*"}function Ie(n,e){let t=n.split("/")[0];if(!l(t,"-"))return n;let r=t.split("-");return f(r[0],e.numbers)!==f(r[1],e.numbers)?n:r[0]}function In(n,e){let t=n.split("/")[0].split("-")[0];return t==="*"?e.min:f(t,e.numbers)}function Mn(n,e){let t=n instanceof Array;if(n===null||typeof n>"u"||n===""||t&&n.length===0)throw new Error("`cronli5` expects a non-empty cron pattern as the first argument.");if(t)return Wn(n,e);if(typeof n=="object")return xe(n);if(typeof n=="string")return Te(n,e);throw new Error("`cronli5` was passed an unexpected type.")}function Wn(n,e){if(n.length>7)throw new Error("`cronli5` was passed a cron pattern with more than seven fields.");return!e.seconds&&n.length<(e.years?7:6)&&n.unshift("0"),{second:n[0]||"0",minute:n[1]||"*",hour:n[2]||"*",date:n[3]||"*",month:n[4]||"*",weekday:n[5]||"*",year:n[6]||"*"}}function xe(n){if(!n.second&&!n.minute&&!n.hour)throw new Error("`cronli5` expects that any object being interpreted as a cron pattern have at least one of the following properties: `second`, `minute`, or `hour`");let e=typeof n.second<"u",t=typeof n.minute<"u",r=e?"*":"0",i=e||t?"*":"0";return{second:P(n.second,"0"),minute:P(n.minute,r),hour:P(n.hour,i),date:P(n.date,"*"),month:P(n.month,"*"),weekday:P(n.weekday,"*"),year:P(n.year,"*")}}function P(n,e){return typeof n>"u"?e:n}function Te(n,e){let t=Fe(n).split(/\s+/);return Wn(t,e)}function Fe(n){let e=n.trim();if(e.charAt(0)!=="@")return n;let t=e.toLowerCase();if(Object.hasOwn(X,t))return X[t];throw new Error("`cronli5` does not recognize the macro `"+e+"`.")}function Hn(n){return n!=="*"&&!l(n,",")&&!l(n,"-")&&!l(n,"/")}function nn(n){return l(n,"-")&&!l(n,",")&&!l(n,"/")}function Me(n){return l(n,"/")&&!l(n,",")}function en(n){return n!=="*"&&!l(n,"-")&&!l(n,"/")}function tn(n){return n!=="*"&&!nn(n)&&!Me(n)}function E(n,e,t){let r=[],i=n;for(;i<=t;)r.push(i),i+=e;return r}function Ln(n,e,t,r){let i=n.split("/"),u=+i[1];if(l(i[0],"-")){let s=i[0].split("-");return E(f(s[0],r),u,f(s[1],r))}let o=i[0]==="*"?e:f(i[0],r);return E(o,u,t)}function un(n,e,t){let r=[];return n.split(",").forEach(function(u){if(l(u,"/"))r.push(...Ln(u,e,t));else if(l(u,"-")){let o=u.split("-");+o[0]<=+o[1]?r.push(...E(+o[0],1,+o[1])):(r.push(...E(+o[0],1,t)),r.push(...E(e,1,+o[1])))}else r.push(+u)}),Q(r)}function We(n){return en(n)?n.split(",").map(Number):[0]}function He(n){if(n==="*")return[0,59];if(nn(n)){let e=n.split("-");if(+e[0]<=+e[1])return[+e[0],+e[1]]}return null}function Le(n){return n==="*"?59:Math.max(...un(n,0,59))}function Ee(n){if(Hn(n)&&n!=="0")return+n}function De(n,e){return n==="*"?"wildcard":e==="date"&&H(n)||e==="weekday"&&L(n,S.weekday)?"quartz":l(n,",")?"list":l(n,"/")?"step":l(n,"-")?"range":"single"}function je(n,e,t){return e==="wildcard"||e==="quartz"?null:n.split(",").map(function(i){if(l(i,"/")){let u=i.split("/");return{fires:Ln(i,t.min,t.top,t.numbers),interval:+u[1],kind:"step",startToken:u[0]}}return l(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function En(n){let e={},t={};v.forEach(function(o){e[o]=De(n[o],o),t[o]=je(n[o],e[o],S[o])});let i={analyses:{clockSecond:Ee(n.second),lastMinuteFire:Le(n.minute),minuteSpan:He(n.minute),segments:t},pattern:n,shapes:e};return{...i,plan:Ae(i)}}function Ae(n){let{analyses:e,pattern:t,shapes:r}=n;if(t.second!=="0"){let i=Ue(t,r,e);if(i)return i}return Dn(t,r,e)||jn(t,r,e)}function Ue(n,e,t){let r=qe(n,e);return r||(n.hour==="*"&&e.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:e.second==="single"}:e.second==="single"&&en(n.minute)&&tn(n.hour)?null:{kind:"composeSeconds",rest:Dn(n,e,t,!0)||jn(n,e,t,!0)})}function qe(n,e){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:e.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function Dn(n,e,t,r=!1){if(e.minute==="step")return{hours:Ve(n,e,t),kind:"minuteFrequency"};if(e.hour==="single"&&t.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:t.minuteSpan};let i=$e(n,e);if(i)return i;let u=Qe(n,e);if(u)return u;if(n.hour==="*")return Je(n,e,r)}function rn(n){let[e,t]=n.split("/"),r=e==="*"?0:+e;return e.indexOf("-")===-1&&24%+t===0&&r<+t}function Qe(n,e){return e.hour!=="step"?null:n.minute==="*"?rn(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:D(n.hour)}:e.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:e.minute==="list"&&rn(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function Ve(n,e,t){if(e.hour==="list")return{kind:"during",times:D(n.hour)};if(e.hour==="range"){let r=n.hour.split("-");return{from:+r[0],kind:"window",last:t.lastMinuteFire,to:+r[1]}}return e.hour==="single"?{from:+n.hour,kind:"window",last:t.lastMinuteFire,to:+n.hour}:e.hour==="step"?rn(n.hour)?{kind:"step"}:{kind:"during",times:D(n.hour)}:{kind:"none"}}function $e(n,e){return tn(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:D(n.hour)}:e.minute==="range"||e.minute==="list"&&l(n.minute,"-")&&!l(n.minute,"/")?{form:e.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:D(n.hour)}:null:null}function Je(n,e,t){if(e.minute==="range")return{kind:"rangeOfMinutes"};if(e.minute==="list")return{kind:"multipleMinutes"};if(n.minute==="*")return{kind:"everyMinute"};if(n.minute!=="0"||t)return{kind:"singleMinute"}}function jn(n,e,t,r=!1){let i=r&&n.minute==="0";return e.hour==="range"&&!i?Ke(n,e,t):e.hour==="step"&&n.minute==="0"&&!r?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:Ye(n,t,i)}function Ke(n,e,t){let r=n.hour.split("-"),i="lead";return n.minute==="*"?i="wildcard":e.minute==="range"&&(i="range"),{boundMinute:e.minute==="range"||e.minute==="list"?null:t.lastMinuteFire,from:+r[0],kind:"hourRange",last:t.lastMinuteFire,minuteForm:i,to:+r[1]}}function Ye(n,e,t=!1){let r=un(n.hour,0,23),i=We(n.minute);if(!t&&r.length*i.length>W)return{fold:i.length===1,kind:"compactClockTimes",minute:i[0]};let u=[];return r.forEach(function(s){i.forEach(function(d){u.push({hour:s,minute:d,second:e.clockSecond})})}),{kind:"clockTimes",times:u}}function D(n){let e=un(n,0,23);return e.length<=W?{fires:e,kind:"fires"}:{kind:"segments"}}function An(n,e){let t=Mn(n,e);return xn(t),Pn(t),Tn(t)}function N(n){return n=""+n,n.length<2?"0"+n:n}function Un(n,e,t){return t.short?n:e[n]||n}function on(n,{sep:e,pad:t,lean:r}){let i=t?N(n.hour):""+n.hour;return r&&!n.minute&&!n.second?i:i+e+N(n.minute)+(n.second?e+N(n.second):"")}var sn={gb:{am:"am",closeUp:!0,dayFirst:!0,midday:"midday",midnight:"midnight",ordinals:!1,pm:"pm",sep:".",serialComma:!1,through:" to "},us:{am:"a.m.",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!1,pm:"p.m.",sep:":",serialComma:!0,through:" through ",untilWindow:!0},house:{am:"AM",closeUp:!1,dayFirst:!1,midday:"noon",midnight:"midnight",ordinals:!0,pm:"PM",sep:":",serialComma:!0,through:" - "}};function qn(n){return typeof n=="object"&&n!==null?{...sn.us,untilWindow:!1,...n}:sn[n==="uk"?"gb":n]||sn.us}var Ge=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],an=["th","st","nd","rd"],Ze=[null,["January","Jan"],["February","Feb"],["March","Mar"],["April","Apr"],["May","May"],["June","Jun"],["July","Jul"],["August","Aug"],["September","Sep"],["October","Oct"],["November","Nov"],["December","Dec"]],z=[["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"],["Saturday","Sat"]],Be={SUN:z[0],MON:z[1],TUE:z[2],WED:z[3],THU:z[4],FRI:z[5],SAT:z[6]},Xe=[null,"first","second","third","fourth","fifth"];function _e(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,seconds:!!n.seconds,short:!!n.short,style:qn(n.dialect),years:!!n.years}}function nt(n,e){let t=Ft(n,e)??Vn(n,n.plan,e),r=Y(n,e)?$t(n,e):"";return nr(r+t,n,e)}function Vn(n,e,t){let r=Mt[e.kind];return r(n,e,t)}function et(n,e,t){return"every second"+a(n,t)}function tt(n,e,t){return F(n,t)+a(n,t)}function rt(n,e,t){let r=n.pattern.second;return g(r,t)+" "+O(r,"second")+" past the minute, every minute"+a(n,t)}function it(n,e,t){let r=n.pattern.minute,i=g(r,t),u=O(r,"minute");if(e.singleSecond){let o=n.pattern.second;return i+" "+u+" and "+g(o,t)+" "+O(o,"second")+" past the hour, every hour"+a(n,t)}return F(n,t)+", "+i+" "+u+" past the hour, every hour"+a(n,t)}function ut(n,e,t){if(!(e.rest.kind==="clockTimes"||e.rest.kind==="compactClockTimes")||n.shapes.minute!=="single")return null;let i=+n.pattern.minute;return yn(n,i,t)??bn(n,i,t)}function ot(n,e,t){return+e.times[0].minute==0&&n.shapes.minute==="single"?F(n,t)+" for one minute at "+at(n,e,t):F(n,t)+" of "+lt(n,e,t)}function st(n,e,t){let r=ut(n,e,t);return r!==null?r:e.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?ot(n,e.rest,t):n.shapes.second==="wildcard"&&e.rest.kind==="minuteFrequency"&&e.rest.hours.kind==="none"&&n.pattern.minute==="*/2"?"every second of every other minute"+a(n,t):(e.rest.kind==="compactClockTimes"&&n.analyses.clockSecond?"":F(n,t)+", ")+Vn(n,e.rest,t)}function at(n,e,t){let r=e.times.map(function(o){return c({hour:o.hour,minute:0},t)}),i=K(n,On,t);return y(r,t)+(i&&", "+i)}function lt(n,e,t){let r=e.times.map(function(o){return c({hour:o.hour,minute:o.minute,second:o.second,explicit:!0},t)}),i=K(n,On,t);return y(r,t)+(i&&", "+i)}function F(n,e){return C(n,"minute",e)}function C(n,e,t){let r=n.pattern.second,i=n.shapes.second;if(r==="*")return"every second";if(i==="step")return hn(n.analyses.segments.second[0],"second",e,t);if(i==="range"){let u=r.split("-"),o=Sn();return"every second from "+o(u[0])+p(t)+o(u[1])+" past the "+e}return i==="single"?"at "+g(r,t)+" "+O(r,"second")+" past the "+e:M(n.analyses.segments.second,"second",e,t)??w(x(n.analyses.segments.second,t),"second",e,t)}function ct(n,e,t){return"every minute"+a(n,t)}function mt(n,e,t){let r=n.pattern.minute;return g(r,t)+" "+O(r,"minute")+" past the hour, every hour"+a(n,t)}function ft(n,e,t){return $(n.pattern.minute,t)+a(n,t)}function dt(n,e,t){return(M(n.analyses.segments.minute,"minute","hour",t)??w(x(n.analyses.segments.minute,t),"minute","hour",t))+a(n,t)}function gt(n,e,t){let r=hn(n.analyses.segments.minute[0],"minute","hour",t);if(e.hours.kind==="during"){let i=U(n,t);r+=i?", "+i:" during the "+j(n,e.hours.times,!1,t)+" hours"}else e.hours.kind==="window"?r+=" "+Kn(e.hours,t):e.hours.kind==="step"&&(r+=" "+dn(n.analyses.segments.hour[0],t));return r+a(n,t)}function ht(n,e,t){return n.pattern.minute==="*"?"every minute of the "+c({hour:e.hour,minute:0},t)+" hour"+a(n,t):"every minute from "+c({hour:e.hour,minute:e.span[0]},t)+p(t)+c({hour:e.hour,minute:e.span[1]},t)+a(n,t)}function pt(n,e,t){let r=U(n,t);if(e.form==="wildcard")return r!==null?"every minute, "+r+a(n,t):"every minute during the "+j(n,e.times,!1,t)+" hours"+a(n,t);if(e.form==="range"){let o=$(n.pattern.minute,t);return r!==null?o+", "+r+a(n,t):jt(e.times)?o+", at "+j(n,e.times,!0,t)+a(n,t):o+" during the "+j(n,e.times,!1,t)+" hours"+a(n,t)}let i=M(n.analyses.segments.minute,"minute","hour",t)??w(x(n.analyses.segments.minute,t),"minute","hour",t);if(r!==null)return i+", "+r+a(n,t);let u=j(n,e.times,!0,t);return i+", at "+u+a(n,t)}var $n={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function dn(n,e){let t="during every "+$n[n.interval]+" hour",r=n.startToken==="*"?0:+n.startToken;return r===0?t:t+" starting at "+c({hour:r,minute:0},e)}function yt(n,e,t){let r=n.analyses.segments.hour[0];if(e.form==="wildcard")return"every minute "+dn(r,t)+a(n,t);let i=e.form==="list"?M(n.analyses.segments.minute,"minute","hour",t)??w(x(n.analyses.segments.minute,t),"minute","hour",t):$(n.pattern.minute,t),u=U(n,t);return i+", "+(u??Xn(r,t))+a(n,t)}function $(n,e){let t=n.split("-"),r=Sn();return"every minute from "+r(t[0])+p(e)+r(t[1])+" past the hour"}function bt(n,e,t){return"every hour"+a(n,t)}function St(n,e,t){let r=Kn(Ot(e),t);return e.minuteForm==="wildcard"?"every minute "+r+a(n,t):e.minuteForm==="range"?$(n.pattern.minute,t)+", "+r+a(n,t):Jn(n,t)+" "+r+a(n,t)}function Jn(n,e){return n.pattern.minute==="0"?"every hour":M(n.analyses.segments.minute,"minute","hour",e)??w(x(n.analyses.segments.minute,e),"minute","hour",e)}function kt(n,e,t){let r=U(n,t);return r!==null?r+a(n,t):Xn(n.analyses.segments.hour[0],t)+a(n,t)}function Ot(n){let e=n.minuteForm==="wildcard"?n.boundMinute??0:0;return{from:n.from,last:e,to:n.to}}function J(n,e,t,r){let i="from "+c({hour:n,minute:0},r);return r.style.untilWindow&&!r.short&&n!==e?i+" until "+c({hour:(e+1)%24,minute:0},r):i+p(r)+c({hour:e,minute:t},r)}function Kn(n,e){return J(n.from,n.to,n.last,e)}function Nt(n,e,t){if(n.shapes.minute==="single"){let u=+n.pattern.minute,o=yn(n,u,t)??bn(n,u,t);if(o!==null)return o}let r=kn(e.times),i=e.times.map(function(o){return c({hour:o.hour,minute:o.minute,second:o.second,plain:r},t)});return ie(n,t)+"at "+y(i,t)+Yn(n,t)}function Yn(n,e){return Y(n,e)?oe(n,e):""}function zt(n,e,t){if(e.fold){let o=yn(n,+e.minute,t)??bn(n,+e.minute,t);if(o!==null)return o;if(n.analyses.segments.hour.some(function(h){return h.kind==="range"})&&!n.analyses.clockSecond)return Rt(n,e,t)+a(n,t);let m={minute:e.minute,second:n.analyses.clockSecond};return ie(n,t)+"at "+A(n,m,!0,t)+Yn(n,t)}let r=M(n.analyses.segments.minute,"minute","hour",t)??w(x(n.analyses.segments.minute,t),"minute","hour",t),i=U(n,t),u=i?r+", "+i+a(n,t):r+", at "+A(n,{minute:0,second:null},!0,t)+a(n,t);return n.analyses.clockSecond?F(n,t)+", "+u:u}function Rt(n,e,t){let r=e.minute,i=[],u=Gn(n),o=u.hours.map(function(d){return c({hour:d,minute:r},t)});return n.analyses.segments.hour.forEach(function(d){d.kind==="range"&&i.push(J(+d.bounds[0],+d.bounds[1],r,t))}),Jn(n,t)+" "+y(i,t)+Zn(o,u.pureStrays,t)}function Gn(n){let e=[],t=!0;return n.analyses.segments.hour.forEach(function(i){i.kind==="step"?(e.push(...i.fires),t=!1):i.kind!=="range"&&e.push(+i.value)}),{hours:e,pureStrays:t}}function Zn(n,e,t){return n.length?(e&&t.style.untilWindow&&!t.short?" plus ":" and at ")+y(n,t):""}function I(n){return n==="*"||n.startsWith("*/")&&n.indexOf("-")===-1}function wt(n,e){let{second:t,minute:r}=n.pattern;return I(t)?{secondLead:!0,text:C(n,"minute",e)}:t==="0"&&I(r)?{secondLead:!1,text:r==="*"?"every minute":hn(n.analyses.segments.minute[0],"minute","hour",e)}:null}function vt(n,e){let t=n.pattern.minute;if(t==="*")return"";if(I(t))return" of every other minute";let r=n.analyses.segments.minute;if(n.shapes.minute==="single")return" during minute :"+N(t);if(n.shapes.minute==="range"){let u=t.split("-");return" during minutes :"+N(u[0])+p(e)+":"+N(u[1])}let i=x(r,e).map(function(o){return":"+N(o)});return" during minutes "+y(i,e)}function Pt(n,e){let t=n.pattern.hour;if(t==="*")return n.pattern.minute!=="*"&&!I(n.pattern.minute)?" of every hour":"";if(I(t))return t==="*/2"?" of every other hour":"";if(n.shapes.hour==="single"){let r=+t;return n.shapes.minute==="step"?" from "+c({hour:r,minute:0},e)+" until "+c({hour:(r+1)%24,minute:0},e):n.pattern.minute!=="*"&&!I(n.pattern.minute)?" at "+c({hour:r,minute:0},e):" of the "+c({hour:r,minute:0},e)+" hour"}if(n.shapes.hour==="range"){let r=t.split("-");return" "+J(+r[0],+r[1],0,e)}return" during the "+A(n,{minute:0,second:null},!1,e)+" hours"}function Ct(n){return n.shapes.hour==="range"}function It(n){if(n.shapes.hour!=="step")return!0;let e=n.analyses.segments.hour[0];return n.pattern.hour==="*/2"||e.startToken.indexOf("-")!==-1}function xt(n){if(n.shapes.minute!=="list")return!1;let e=gn(n.analyses.segments.minute);return e!==null&&_(e)!==null}function Tt(n,e){let{minute:t,hour:r}=n.pattern,i=I(t)&&t!=="*";return It(n)?e.secondLead?i?t==="*/2"&&!Ct(n):!(xt(n)||n.shapes.minute==="list"&&n.shapes.hour==="list"):r==="*/2"?!0:n.shapes.hour==="single"&&t==="*/2":!1}function Ft(n,e){if(!e.style.untilWindow||e.short||n.pattern.minute==="*"&&n.pattern.hour==="*")return null;let t=wt(n,e);if(!t||!Tt(n,t))return null;let r=t.secondLead?vt(n,e):"";return t.text+r+Pt(n,e)+a(n,e)}var Mt={clockTimes:Nt,compactClockTimes:zt,composeSeconds:st,everyHour:bt,everyMinute:ct,everySecond:et,hourRange:St,hourStep:kt,minuteFrequency:gt,minuteSpanAcrossHourStep:yt,minuteSpanInHour:ht,minutesAcrossHours:pt,multipleMinutes:dt,rangeOfMinutes:ft,secondPastMinute:rt,secondsWithinMinute:it,singleMinute:mt,standaloneSeconds:tt};function Bn(n,e){let{interval:t,start:r,last:i,cycle:u,unit:o,anchor:s}=n,m="every "+g(t,e)+" "+o+"s",d=u%t===0;if(r===0&&d)return m;if(r<t&&d)return m+" from "+g(r,e)+" "+O(r,o)+" past the "+s;let h=Sn();return m+" from "+h(r)+p(e)+h(i)+" "+O(i,o)+" past the "+s}function gn(n){let e=[];for(let t of n){if(t.kind!=="single")return null;e.push(+t.value)}return e}function M(n,e,t,r){let i=gn(n),u=i&&_(i);return u?Bn({...u,cycle:60,unit:e,anchor:t},r):null}function hn(n,e,t,r){if(n.startToken.indexOf("-")!==-1)return w(Qn(n.fires,r),e,t,r);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?w(Qn(n.fires,r),e,t,r):Bn({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:e,anchor:t},r)}function Xn(n,e){if(n.startToken.indexOf("-")!==-1)return"at "+cn(n.fires,e);let t=n.startToken==="*"?0:+n.startToken,r=n.interval;return t===0?"every "+g(r,e)+" hours":n.fires.length<=3?"at "+cn(n.fires,e):"every "+g(r,e)+" hours from "+c({hour:t,minute:0},e)}function ln(n,e){let{start:t,interval:r,last:i}=n,u="every "+g(r,e)+" hours",o=24%r===0;return t===0&&o?u:t<r&&o?u+" from "+c({hour:t,minute:0},e):u+" from "+c({hour:t,minute:0},e)+p(e)+c({hour:i,minute:0},e)}function _n(n){return n.start<n.interval&&24%n.interval===0}function U(n,e){let t=ne(n);return!t||_n(t)?null:ln(t,e)}function Wt(n){if(n.length<2)return null;let e=n[1]-n[0];if(e<2)return null;for(let t=2;t<n.length;t+=1)if(n[t]-n[t-1]!==e)return null;return n[0]!==0&&n.length<5?null:{interval:e,last:n[n.length-1],start:n[0]}}function ne(n){let e=n.analyses.segments.hour;if(e.length===1&&e[0].kind==="step"){let r=e[0];if(r.fires.length<2)return null;let i=r.startToken==="*"?0:+r.startToken.split("-")[0];return{interval:r.interval,last:r.fires[r.fires.length-1],start:i}}let t=gn(e);return t&&Wt(t)}function pn(n){return n.pattern.second==="*"||n.shapes.second==="step"}function ee(n,e,t){if(e===0)return pn(n)?C(n,"minute",t)+" for one minute":C(n,"hour",t);let r=g(e,t)+" "+O(e,"minute")+" past the hour";return n.pattern.second==="0"?r:C(n,"minute",t)+", "+r}function yn(n,e,t){let r=ne(n);if(!r)return null;let i=(r.last-r.start)/r.interval+1;if(n.pattern.second==="0"&&i<=W&&_n(r))return null;let u=e===0&&pn(n)&&Ht(n);return u?C(n,"minute",t)+" for one minute "+dn(u,t)+a(n,t):e===0&&n.pattern.second==="0"?ln(r,t)+a(n,t):ee(n,e,t)+", "+ln(r,t)+a(n,t)}function Ht(n){let e=n.analyses.segments.hour,t=e.length===1&&e[0];return!t||t.kind!=="step"||t.startToken.indexOf("-")!==-1||!(t.interval in $n)?null:t}function Lt(n){return n.analyses.segments.hour.some(function(t){return t.kind==="range"})}function Et(n,e){let t=[],r=Gn(n);n.analyses.segments.hour.forEach(function(s){s.kind==="range"&&t.push(J(+s.bounds[0],+s.bounds[1],0,e))});let i="every hour "+y(t,e),u=r.hours.map(function(s){return c({hour:s,minute:0},e)});return i+Zn(u,r.pureStrays,e)}function bn(n,e,t){return e!==0||!Lt(n)||n.pattern.second==="0"?null:pn(n)?C(n,"minute",t)+" for one minute during the "+A(n,{minute:0,second:null},!1,t)+" hours"+a(n,t):ee(n,e,t)+", "+Et(n,t)+a(n,t)}function Sn(){return function(e){return""+e}}function te(n,e){return n>1?function(r){return""+r}:function(r){return g(r,e)}}function Qn(n,e){return n.map(te(n.length,e))}function x(n,e){let t=n.reduce(function(u,o){return o.kind==="range"?u+1:u+(o.kind==="step"?o.fires.length:1)},0),r=te(t,e);return n.flatMap(function(u){return u.kind==="range"?[r(u.bounds[0])+p(e)+r(u.bounds[1])]:u.kind==="step"?u.fires.map(r):[r(u.value)]})}function w(n,e,t,r){return"at "+y(n,r)+" "+e+"s past the "+t}function Dt(n,e,t){return(+n==0||+n==12)&&+e==0&&!(typeof t=="number"&&t>0)}function kn(n){let e=n.filter(function(r){return Dt(r.hour,r.minute,r.second)});return e.length>0&&e.length<n.length}function cn(n,e){let t=kn(n.map(function(u){return{hour:u,minute:0}})),r=n.map(function(u){return c({hour:u,minute:0,plain:t},e)});return y(r,e)}function jt(n){return n.kind==="fires"&&n.fires.length===1}function j(n,e,t,r){return e.kind==="fires"?cn(e.fires,r):A(n,{minute:0,second:null},t,r)}function At(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function A(n,e,t,r){let{minute:i,second:u}=e,o=n.analyses.segments.hour,s=kn(o.flatMap(function(h){return At(h).map(function(B){return{hour:+B,minute:i,second:u}})})),m=[];return o.forEach(function(h){h.kind==="step"?m.push(...h.fires.map(function(B){return c({hour:B,minute:i,second:u,plain:s},r)})):h.kind==="range"?m.push(c({hour:h.bounds[0],minute:i,second:u,plain:s},r)+p(r)+c({hour:h.bounds[1],minute:i,second:u,plain:s},r)):m.push(c({hour:h.value,minute:i,second:u,plain:s},r))}),y(Ut(m,o,t),r)}function Ut(n,e,t){let r=e.some(function(u){return u.kind==="range"});return!t||!r?n:n.map(function(u,o){return o===0?u:"at "+u})}function re(n,e,t){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+e+n[1];let r=t.style.serialComma?","+e:e;return n.slice(0,-1).join(", ")+r+n[n.length-1]}function y(n,e){return re(n," and ",e)}function qt(n,e){return re(n," or ",e)}var Qt={all:"",month:"in ",recurringWeekday:!0,stepDate:"on ",weekday:"on "},On={all:"every day",month:"every day in ",recurringWeekday:!1,stepDate:"",weekday:"every "};function a(n,e){if(Y(n,e))return oe(n,e);let t=K(n,Qt,e);return t&&" "+t}function ie(n,e){return Y(n,e)?"":K(n,On,e)+" "}function K(n,e,t){let r=n.pattern;if(r.date!=="*"&&r.weekday!=="*")return Gt(n,t);if(r.date!=="*")return Vt(n,e,t);if(r.weekday!=="*"){let i=Nn(r.weekday,t);return i?mn(i,n,t):e.weekday+me(n,e.recurringWeekday,t)+ae(n,t)}return r.month!=="*"?e.month+k(n,t):e.all}function Vt(n,e,t){let r=n.pattern,i=G(r.date,t);return i?mn(i,n,t):q(r.date)?mn(e.stepDate+le(r.date),n,t):r.month!=="*"&&!ue(n)?"on the "+fn(n,t)+ae(n,t):r.month!=="*"?"on "+se(n,t):"on the "+fn(n,t)}function ue(n){return!ce(n.pattern.month)&&n.analyses.segments.month.every(function(t){return t.kind!=="range"})}function Y(n,e){return n.pattern.date!=="*"&&n.pattern.weekday!=="*"&&!!e.style.untilWindow&&!e.short}function oe(n,e){let t=[...Jt(n,e),...Kt(n,e)];return" whenever the day is "+qt(t,e)}function $t(n,e){return n.pattern.month==="*"?"":"in "+k(n,e)+" "}function Jt(n,e){let t=n.pattern.date,r=G(t,e);if(r)return[r.replace(/^on /,"")];let i=Yt(t);if(i)return[i];let u=[];return n.analyses.segments.date.forEach(function(s){s.kind==="range"?u.push("from the "+b(s.bounds[0])+p(e)+"the "+b(s.bounds[1])):s.kind==="step"?s.fires.forEach(function(d){u.push("the "+b(d))}):u.push("the "+b(s.value))}),u}function Kt(n,e){let t=n.pattern.weekday,r=Nn(t,e);if(r)return[r.replace(/^on /,"")];let i=[];return n.analyses.segments.weekday.forEach(function(o){o.kind==="range"&&o.bounds[0]==="1"&&o.bounds[1]==="5"?i.push("a weekday"):o.kind==="range"?i.push("a "+R(o.bounds[0],e)+p(e)+"a "+R(o.bounds[1],e)):o.kind==="step"?o.fires.forEach(function(m){i.push("a "+R(m,e))}):i.push("a "+R(o.value,e))}),i}function Yt(n){if(!q(n))return null;let[e,t]=n.split("/");return+t!=2?null:e==="*"||e==="1"?"an odd-numbered day":e==="2"?"an even-numbered day":null}function Gt(n,e){let t=n.pattern,r=Nn(t.weekday,e)||"on "+me(n,!1,e);return t.month!=="*"&&ue(n)&&!G(t.date,e)&&!q(t.date)?"on "+se(n,e)+" or "+r+" in "+k(n,e):Zt(n,e)+" or "+r+Bt(n,e)}function Zt(n,e){let t=n.pattern,r=G(t.date,e);return r||(q(t.date)?le(t.date):"on the "+fn(n,e))}function Bt(n,e){return n.pattern.month==="*"?"":", in "+k(n,e)}function G(n,e){if(n==="L")return"on the last day of the month";if(n==="LW"||n==="WL")return"on the last weekday of the month";let t=/^L-(\d{1,2})$/.exec(n);if(t)return g(+t[1],e)+" "+O(t[1],"day")+" before the last day of the month";let r=/^(\d{1,2})W$|^W(\d{1,2})$/.exec(n);if(r)return"on the weekday nearest the "+b(r[1]||r[2])}function Nn(n,e){let t=n.split("#");if(t.length===2)return"on the "+Xe[+t[1]]+" "+R(t[0],e)+" of the month";if(/L$/.test(n))return"on the last "+R(n.slice(0,-1),e)+" of the month"}function se(n,e){let t=k(n,e),r=Z(n.analyses.segments.date,e.style.ordinals?b:Xt,e);return e.style.dayFirst&&n.shapes.date==="single"&&n.shapes.month!=="single"?"the "+b(n.pattern.date)+" of "+t:e.style.dayFirst?r+" "+t:t+" "+r}function Xt(n){return""+n}function ae(n,e){return n.pattern.month==="*"?"":" in "+k(n,e)}function mn(n,e,t){if(e.pattern.month==="*")return n;let r=n.indexOf(" of the month")!==-1;return r&&e.shapes.month==="range"?n.replace(" of the month"," of each month")+" from "+k(e,t):r&&(e.shapes.month==="single"||e.shapes.month==="step")?n.replace(" of the month","")+" in "+k(e,t):n+" in "+k(e,t)}function le(n){let e=n.split("/"),t=+e[1],r=e[0],u=(t===2?"every other":"every "+b(t))+" day of the month";return r!=="*"&&r!=="1"&&(u+=" from the "+b(r)),u}function fn(n,e){return Z(n.analyses.segments.date,b,e)}function k(n,e){let t=ce(n.pattern.month);return t||Z(n.analyses.segments.month,function(i){return ir(i,e)},e)}function ce(n){if(!q(n))return null;let[e,t]=n.split("/");return+t!=2?null:e==="*"||e==="1"?"every odd-numbered month":e==="2"?"every even-numbered month":null}function me(n,e,t){let r=wn(n.analyses.segments.weekday),i=r.some(function(s){return s.kind==="range"});return Z(r,e&&!i?function(s){return _t(s,t)}:function(s){return R(s,t)},t)}function _t(n,e){let t=R(n,e);return e.short?t:t+"s"}function Z(n,e,t){let r=[];return n.forEach(function(u){u.kind==="step"?r.push(...u.fires.map(e)):u.kind==="range"?r.push(u.bounds.map(e).join(p(t))):r.push(e(u.value))}),y(r,t)}function q(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function nr(n,e,t){let r=e.pattern.year;if(r==="*")return n;if(r.indexOf("/")!==-1)return n+", "+tr(r,t);let i=er(r,t);if(r.indexOf("-")===-1&&r.indexOf(",")===-1&&e.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let u=t.style.dayFirst?" ":", ";return n.replace(" at ",u+i+" at ")}return n+" in "+i}function er(n,e){return n.indexOf(",")!==-1?y(n.split(","),e):n.indexOf("-")!==-1?n.split("-").join(p(e)):n}function tr(n,e){let t=n.split("/"),r=+t[1],i=t[0];if(r<=1)return"every year";let u=r===2?"every other year":"every "+g(r,e)+" years";return i!=="*"&&i!=="0"&&(u+=" from "+i),u}function c(n,e){let{hour:t,minute:r,plain:i,explicit:u}=n,o=typeof n.second=="number"&&n.second>0?n.second:0;return e.ampm?rr({hour:t,minute:r,second:o,plain:i,explicit:u},e):on({hour:t,minute:r,second:o},{pad:!0,sep:e.style.sep})}function rr(n,e){let{hour:t,minute:r,second:i,plain:u,explicit:o}=n,s=e.style;if(!u&&!o&&+r==0&&!i){if(+t==0)return s.midnight;if(+t==12)return s.midday}return on({hour:t%12||12,minute:r,second:i},{lean:!o,sep:s.sep})+(s.closeUp?"":" ")+(t<12?s.am:s.pm)}function g(n,e){return Un(n,Ge,e)}function O(n,e){return+n==1?e:e+"s"}function p(n){return n.short?"-":n.style.through}function b(n){let e=Math.abs(n),t=an[e];return t||(e=(e%100-20)%10,t=an[e]||an[0]),n+t}function ir(n,e){let t=Ze[+n];return t&&t[e.short?1:0]}function R(n,e){let t=n===7||n==="7"?0:n,r=z[t]||Be[t];return r&&r[e.short?1:0]}var ur={describe:nt,fallback:"an unrecognizable cron pattern",options:_e,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},fe=ur;/**
|
|
2
2
|
* @license MIT, Copyright (c) 2026 Andrew Brož
|
|
3
|
-
*/function
|
|
3
|
+
*/function or(n,e){let t=e&&e.lang||fe,r=t.options(e);if(!r.lenient)return de(ge(n,t,r),t,e);try{return de(ge(n,t,r),t,e)}catch{return t.fallback}}function de(n,e,t){return t&&t.sentence?e.sentence(n):n}function ge(n,e,t){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return e.reboot;let r=En(An(n,t)),i=e.strategy?e.strategy(r,r.plan):r.plan;return e.describe({...r,plan:i},t)}var zn=or;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:zn});var Vr=zn;})();
|