cronli5 0.1.6 → 0.1.7
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 +43 -0
- package/README.md +2 -2
- package/cronli5.min.js +2 -2
- package/dist/cronli5.cjs +39 -7
- package/dist/cronli5.js +39 -7
- package/dist/lang/de.cjs +63 -17
- package/dist/lang/de.js +63 -17
- package/dist/lang/en.cjs +39 -7
- package/dist/lang/en.js +39 -7
- 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/util.ts +52 -1
- package/src/lang/de/index.ts +95 -25
- package/src/lang/en/index.ts +47 -16
- 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/util.d.ts +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,49 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.7]
|
|
10
|
+
|
|
11
|
+
A correctness and clarity pass driven by blind, math-inclined native-speaker
|
|
12
|
+
review panels over four rounds of randomly sampled patterns (one reviewer per
|
|
13
|
+
language per round), plus a new conciseness CI gate. Each fix was written
|
|
14
|
+
test-first and validated by round-trip, fuzz, and the metamorphic invariant.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- The conciseness sweep is wired into `npm run verify` as a gate: it exits
|
|
19
|
+
non-zero on any over-budget description and runs alongside lint, types, tests,
|
|
20
|
+
the metamorphic invariant, docs, and build. It is zero over-budget across all
|
|
21
|
+
five languages, guarding against verbosity regressions.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- **en:** a month (or year) restriction on an "or"-day cron — both day-of-month
|
|
26
|
+
and day-of-week set, e.g. `15W 6-8 MON#2` — scoped only the day-of-month
|
|
27
|
+
branch, falsely implying the weekday branch fires every month; it now scopes
|
|
28
|
+
the whole or.
|
|
29
|
+
- **en/es/de:** an hour range under a fixed minute (`5 9-17`) folded the minute
|
|
30
|
+
into the window end only ("through 5:05 p.m." with a bare :00 start), a false
|
|
31
|
+
continuous span; now the bare hour window plus the minute clause.
|
|
32
|
+
- **es:** a fixed hour under a step or range minute (`3/2 0`) read "a las
|
|
33
|
+
00:00", asserting a minute-:00 fire that never happens; now the hour context
|
|
34
|
+
("a medianoche" / "al mediodía" / "de la hora de las HH").
|
|
35
|
+
- **de:** a standalone offset-clean hour step (`0 0 1/2`) enumerated its hours
|
|
36
|
+
instead of the cadence ("alle 2 Stunden ab 1 Uhr"); and a "jeder
|
|
37
|
+
Minute/Stunde" suffix was emitted even when that field is fixed
|
|
38
|
+
(`30 30 9-17/2`), contradicting it — now dropped unless the field is a
|
|
39
|
+
wildcard.
|
|
40
|
+
- **zh:** an offset hour stride at minute 0 under a sub-minute second enumerated
|
|
41
|
+
instead of its cadence; a month range ran into the day-of-month
|
|
42
|
+
(`6月至8月1日` → `6月至8月,1日`); and a single-hour minute-step with a `15W`
|
|
43
|
+
day dropped the month entirely (`*/25 12 15W 12`) — all fixed.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- Weekday lists now order Monday-first (Sunday last): `SAT,SUN` reads "Saturday
|
|
48
|
+
and Sunday" (and the equivalent in each language). Display order only — the IR
|
|
49
|
+
stays canonical (Sunday = 0), so ranges, single days, and the metamorphic
|
|
50
|
+
invariant are unaffected.
|
|
51
|
+
|
|
9
52
|
## [0.1.6]
|
|
10
53
|
|
|
11
54
|
### Fixed
|
package/README.md
CHANGED
|
@@ -256,7 +256,7 @@ cronli5('0 0 * * FRI-MON'); // 'every Friday through Monday at midnight'
|
|
|
256
256
|
cronli5('0,30 9 * * *'); // 'every day at 9 a.m. and 9:30 a.m.'
|
|
257
257
|
cronli5('*/15 9-17 * * *'); // 'every 15 minutes from 9 a.m. through 5:45 p.m.'
|
|
258
258
|
cronli5('30 9-17 * * *');
|
|
259
|
-
// 'at 30 minutes past the hour from 9 a.m. through 5
|
|
259
|
+
// 'at 30 minutes past the hour from 9 a.m. through 5 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
|
|
|
@@ -280,7 +280,7 @@ pattern — `5,10 30 9 * * MON` — in every language:
|
|
|
280
280
|
| Language | cronli5 | cRonstrue 3.14.0 |
|
|
281
281
|
| --- | --- | --- |
|
|
282
282
|
| English | at five and ten 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
|
|
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 ue={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},se={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:se,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:ue,top:6},year:{max:9999,min:1970}},N=["second","minute","hour","date","month","weekday","year"],K={"@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 * * * *"},T=6;function a(n,t){return(""+n).indexOf(t)!==-1}function D(n){return Array.from(new Set(n))}function E(n){return/^\d+$/.test(n)}function bn(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 yn(n){return n===0?7:n}function Sn(n){let t=n.flatMap(function(i){return i.kind==="step"?i.fires.map(function(u){return{kind:"single",value:""+u}}):[i]});function e(r){return r.kind==="range"?yn(+r.bounds[0]):yn(+r.value)}return t.map(function(i,o){return[i,o]}).sort(function(i,o){return e(i[0])-e(o[0])||i[1]-o[1]}).map(function(i){return i[0]})}function f(n,t){return E(n)?+n:t[n.toUpperCase()]}function On(n){return N.forEach(function(e){ae(n[e],y[e],e)}),n}function ae(n,t,e){typeof n!="string"&&typeof n!="number"&&kn(n,e);let r=""+n;r!=="*"&&(e==="date"&&x(r)||e==="weekday"&&F(r,t)||r.split(",").forEach(function(o){le(o,t)||kn(o,e)}))}function x(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 F(n,t){if(/L$/.test(n))return R(n.slice(0,-1),t);let e=n.split("#");return e.length===2?R(e[0],t)&&/^[1-5]$/.test(e[1]):!1}function le(n,t){return a(n,"/")?ce(n,t):a(n,"-")?Nn(n,t):R(n,t)}function ce(n,t){let e=n.split("/");return e.length!==2||!E(e[1])||+e[1]<1?!1:e[0]==="*"||R(e[0],t)||Nn(e[0],t,!0)}function Nn(n,t,e){let r=n.split("-");return r.length!==2||!R(r[0],t)||!R(r[1],t)?!1:t.cyclic&&!e?!0:f(r[0],t.numbers)<=f(r[1],t.numbers)}function R(n,t){return n==="*"?!1:E(n)?+n>=t.min&&+n<=t.max:t.numbers?n.toUpperCase()in t.numbers:!1}function kn(n,t){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+t+" field.")}var me={hour:24,minute:60,second:60};function Rn(n){N.forEach(function(e){let r=y[e].aliases,i=r&&r[""+n[e]];i&&(n[e]=i)})}function Pn(n){return N.forEach(function(e){let r=""+n[e];if(e==="date"&&x(r)||e==="weekday"&&F(r,y[e])){n[e]=r;return}n[e]=fe(r,e,y[e])}),n}function fe(n,t,e){let r=""+n;if(r==="*")return r;let i=me[t],o=r.split(",").map(function(s){return de(vn(ye(be(Se(pe(he(s,e),e),e),e),e,i),e),e)}).join(",").split(",");return o.indexOf("*")!==-1?"*":D(o).sort(function(s,m){return zn(s,e)-zn(m,e)}).join(",")}function de(n,t){if(!t.numbers)return n;let e=n.split("/"),r=e[0].split("-").map(function(o){return ge(o,t)}).join("-");return e.length===2?r+"/"+e[1]:r}function ge(n,t){if(n==="*")return n;let e=f(n,t.numbers);return""+(e>t.top?t.min:e)}function he(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 pe(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 ye(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 be(n,t){let e=n.split("/");return e.length!==2||!a(e[0],"-")?n:vn(e[0],t)==="*"?"*/"+e[1]:n}function vn(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 Se(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 zn(n,t){let e=n.split("/")[0].split("-")[0];return e==="*"?t.min:f(e,t.numbers)}function wn(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 Cn(n,t);if(typeof n=="object")return ke(n);if(typeof n=="string")return Oe(n,t);throw new Error("`cronli5` was passed an unexpected type.")}function Cn(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 ke(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 Oe(n,t){let e=Ne(n).split(/\s+/);return Cn(e,t)}function Ne(n){let t=n.trim();if(t.charAt(0)!=="@")return n;let e=t.toLowerCase();if(Object.hasOwn(K,e))return K[e];throw new Error("`cronli5` does not recognize the macro `"+t+"`.")}function Tn(n){return n!=="*"&&!a(n,",")&&!a(n,"-")&&!a(n,"/")}function Y(n){return a(n,"-")&&!a(n,",")&&!a(n,"/")}function ze(n){return a(n,"/")&&!a(n,",")}function B(n){return n!=="*"&&!a(n,"-")&&!a(n,"/")}function G(n){return n!=="*"&&!Y(n)&&!ze(n)}function I(n,t,e){let r=[],i=n;for(;i<=e;)r.push(i),i+=t;return r}function xn(n,t,e,r){let i=n.split("/"),o=+i[1];if(a(i[0],"-")){let s=i[0].split("-");return I(f(s[0],r),o,f(s[1],r))}let u=i[0]==="*"?t:f(i[0],r);return I(u,o,e)}function X(n,t,e){let r=[];return n.split(",").forEach(function(o){if(a(o,"/"))r.push(...xn(o,t,e));else if(a(o,"-")){let u=o.split("-");+u[0]<=+u[1]?r.push(...I(+u[0],1,+u[1])):(r.push(...I(+u[0],1,e)),r.push(...I(t,1,+u[1])))}else r.push(+o)}),D(r)}function Re(n){return B(n)?n.split(",").map(Number):[0]}function Pe(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 ve(n){return n==="*"?59:Math.max(...X(n,0,59))}function we(n){if(Tn(n)&&n!=="0")return+n}function Ce(n,t){return n==="*"?"wildcard":t==="date"&&x(n)||t==="weekday"&&F(n,y.weekday)?"quartz":a(n,",")?"list":a(n,"/")?"step":a(n,"-")?"range":"single"}function Te(n,t,e){return t==="wildcard"||t==="quartz"?null:n.split(",").map(function(i){if(a(i,"/")){let o=i.split("/");return{fires:xn(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 Fn(n){let t={},e={};N.forEach(function(u){t[u]=Ce(n[u],u),e[u]=Te(n[u],t[u],y[u])});let i={analyses:{clockSecond:we(n.second),lastMinuteFire:ve(n.minute),minuteSpan:Pe(n.minute),segments:e},pattern:n,shapes:t};return{...i,plan:xe(i)}}function xe(n){let{analyses:t,pattern:e,shapes:r}=n;if(e.second!=="0"){let i=Fe(e,r,t);if(i)return i}return In(e,r,t)||Mn(e,r,t)}function Fe(n,t,e){let r=Ie(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:In(n,t,e,!0)||Mn(n,t,e,!0)})}function Ie(n,t){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:t.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function In(n,t,e,r=!1){if(t.minute==="step")return{hours:He(n,t,e),kind:"minuteFrequency"};if(t.hour==="single"&&e.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:e.minuteSpan};let i=We(n,t);if(i)return i;let o=Me(n,t);if(o)return o;if(n.hour==="*")return Le(n,t,r)}function Z(n){let[t,e]=n.split("/"),r=t==="*"?0:+t;return t.indexOf("-")===-1&&24%+e===0&&r<+e}function Me(n,t){return t.hour!=="step"?null:n.minute==="*"?Z(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:M(n.hour)}:t.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:t.minute==="list"&&Z(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function He(n,t,e){if(t.hour==="list")return{kind:"during",times:M(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"?Z(n.hour)?{kind:"step"}:{kind:"during",times:M(n.hour)}:{kind:"none"}}function We(n,t){return G(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:M(n.hour)}:t.minute==="range"||t.minute==="list"&&a(n.minute,"-")&&!a(n.minute,"/")?{form:t.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:M(n.hour)}:null:null}function Le(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 Mn(n,t,e,r=!1){let i=r&&n.minute==="0";return t.hour==="range"&&!i?je(n,t,e):t.hour==="step"&&n.minute==="0"&&!r?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:De(n,e,i)}function je(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 De(n,t,e=!1){let r=X(n.hour,0,23),i=Re(n.minute);if(!e&&r.length*i.length>T)return{fold:i.length===1,kind:"compactClockTimes",minute:i[0]};let o=[];return r.forEach(function(s){i.forEach(function(O){o.push({hour:s,minute:O,second:t.clockSecond})})}),{kind:"clockTimes",times:o}}function M(n){let t=X(n,0,23);return t.length<=T?{fires:t,kind:"fires"}:{kind:"segments"}}function Hn(n,t){let e=wn(n,t);return Rn(e),On(e),Pn(e)}function _(n){return n=""+n,n.length<2?"0"+n:n}function Wn(n,t,e){return e.short?n:t[n]||n}function nn(n,{sep:t,pad:e,lean:r}){let i=e?_(n.hour):""+n.hour;return r&&!n.minute&&!n.second?i:i+t+_(n.minute)+(n.second?t+_(n.second):"")}var en={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 Ln(n){return typeof n=="object"&&n!==null?{...en.us,...n}:en[n==="uk"?"gb":n]||en.us}var Ee=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],tn=["th","st","nd","rd"],Ae=[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"]],Ue={SUN:S[0],MON:S[1],TUE:S[2],WED:S[3],THU:S[4],FRI:S[5],SAT:S[6]},Qe=[null,"first","second","third","fourth","fifth"];function qe(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,seconds:!!n.seconds,short:!!n.short,style:Ln(n.dialect),years:!!n.years}}function Ve(n,t){return Tt(Dn(n,n.plan,t),n,t)}function Dn(n,t,e){let r=ht[t.kind];return r(n,t,e)}function $e(n,t,e){return"every second"+l(n,e)}function Je(n,t,e){return v(n,e)+l(n,e)}function Ke(n,t,e){let r=n.pattern.second;return d(r,e)+" "+b(r,"second")+" past the minute, every minute"+l(n,e)}function Ye(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 Be(n,t,e){if(!(t.rest.kind==="clockTimes"||t.rest.kind==="compactClockTimes")||n.shapes.minute!=="single")return null;let i=+n.pattern.minute;return mn(n,i,e)??fn(n,i,e)}function Ge(n,t,e){return+t.times[0].minute==0&&n.shapes.minute==="single"?v(n,e)+" for one minute at "+Xe(n,t,e):v(n,e)+" of "+_e(n,t,e)}function Ze(n,t,e){let r=Be(n,t,e);return r!==null?r:t.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?Ge(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)+", ")+Dn(n,t.rest,e)}function Xe(n,t,e){let r=t.times.map(function(u){return c({hour:u.hour,minute:0},e)}),i=q(n,gn,e);return h(r,e)+(i&&", "+i)}function _e(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,gn,e);return h(r,e)+(i&&", "+i)}function v(n,t){return P(n,"minute",t)}function P(n,t,e){let r=n.pattern.second,i=n.shapes.second;if(r==="*")return"every second";if(i==="step")return Vn(n.analyses.segments.second[0],"second",t,e);if(i==="range"){let o=r.split("-"),u=L(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)??k(C(n.analyses.segments.second,e),"second",t,e)}function nt(n,t,e){return"every minute"+l(n,e)}function et(n,t,e){let r=n.pattern.minute;return d(r,e)+" "+b(r,"minute")+" past the hour, every hour"+l(n,e)}function tt(n,t,e){return Q(n.pattern.minute,e)+l(n,e)}function rt(n,t,e){return(w(n.analyses.segments.minute,"minute","hour",e)??k(C(n.analyses.segments.minute,e),"minute","hour",e))+l(n,e)}function it(n,t,e){let r=Vn(n.analyses.segments.minute[0],"minute","hour",e);if(t.hours.kind==="during"){let i=W(n,e);r+=i?", "+i:" during the "+un(n,t.hours.times,!1,e)+" hours"}else t.hours.kind==="window"?r+=" "+Un(t.hours,e):t.hours.kind==="step"&&(r+=" "+ln(n.analyses.segments.hour[0],e));return r+l(n,e)}function ot(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 ut(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 "+un(n,t.times,!1,e)+" hours"+l(n,e);let i=t.form==="range"?Q(n.pattern.minute,e):w(n.analyses.segments.minute,"minute","hour",e)??k(C(n.analyses.segments.minute,e),"minute","hour",e);if(r!==null)return i+", "+r+l(n,e);let o=un(n,t.times,!0,e);return i+", at "+o+l(n,e)}var En={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function ln(n,t){let e="during every "+En[n.interval]+" hour",r=n.startToken==="*"?0:+n.startToken;return r===0?e:e+" starting at "+c({hour:r,minute:0},t)}function st(n,t,e){let r=n.analyses.segments.hour[0];if(t.form==="wildcard")return"every minute "+ln(r,e)+l(n,e);let i=t.form==="list"?w(n.analyses.segments.minute,"minute","hour",e)??k(C(n.analyses.segments.minute,e),"minute","hour",e):Q(n.pattern.minute,e),o=W(n,e);return i+", "+(o??$n(r,e))+l(n,e)}function Q(n,t){let e=n.split("-"),r=L(e,t);return"every minute from "+r(e[0])+p(t)+r(e[1])+" past the hour"}function at(n,t,e){return"every hour"+l(n,e)}function lt(n,t,e){let r=Un(mt(t),e);return t.minuteForm==="wildcard"?"every minute "+r+l(n,e):t.minuteForm==="range"?Q(n.pattern.minute,e)+", "+r+l(n,e):An(n,e)+" "+r+l(n,e)}function An(n,t){return n.pattern.minute==="0"?"every hour":w(n.analyses.segments.minute,"minute","hour",t)??k(C(n.analyses.segments.minute,t),"minute","hour",t)}function ct(n,t,e){let r=W(n,e);return r!==null?r+l(n,e):$n(n.analyses.segments.hour[0],e)+l(n,e)}function mt(n){let t=n.minuteForm==="wildcard"?n.boundMinute??0:0;return{from:n.from,last:t,to:n.to}}function Un(n,t){return"from "+c({hour:n.from,minute:0},t)+p(t)+c({hour:n.to,minute:n.last},t)}function ft(n,t,e){if(n.shapes.minute==="single"){let o=+n.pattern.minute,u=mn(n,o,e)??fn(n,o,e);if(u!==null)return u}let r=dn(t.times),i=t.times.map(function(u){return c({hour:u.hour,minute:u.minute,second:u.second,plain:r},e)});return Bn(n,e)+"at "+h(i,e)}function dt(n,t,e){if(t.fold){let u=mn(n,+t.minute,e)??fn(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 gt(n,t,e)+l(n,e);let m={minute:t.minute,second:n.analyses.clockSecond};return Bn(n,e)+"at "+U(n,m,!0,e)}let r=w(n.analyses.segments.minute,"minute","hour",e)??k(C(n.analyses.segments.minute,e),"minute","hour",e),i=W(n,e),o=i?r+", "+i+l(n,e):r+", at "+U(n,{minute:0,second:null},!0,e)+l(n,e);return n.analyses.clockSecond?v(n,e)+", "+o:o}function gt(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=An(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 ht={clockTimes:ft,compactClockTimes:dt,composeSeconds:Ze,everyHour:at,everyMinute:nt,everySecond:$e,hourRange:lt,hourStep:ct,minuteFrequency:it,minuteSpanAcrossHourStep:st,minuteSpanInHour:ot,minutesAcrossHours:ut,multipleMinutes:rt,rangeOfMinutes:tt,secondPastMinute:Ke,secondsWithinMinute:Ye,singleMinute:et,standaloneSeconds:Je};function Qn(n,t){let{interval:e,start:r,last:i,cycle:o,unit:u,anchor:s}=n,m="every "+d(e,t)+" "+u+"s",O=o%e===0;if(r===0&&O)return m;if(r<e&&O)return m+" from "+d(r,t)+" "+b(r,u)+" past the "+s;let g=L([r,i],t);return m+" from "+g(r)+p(t)+g(i)+" "+b(i,u)+" past the "+s}function qn(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=qn(n),o=i&&bn(i);return o?Qn({...o,cycle:60,unit:t,anchor:e},r):null}function Vn(n,t,e,r){if(n.startToken.indexOf("-")!==-1)return k(jn(n.fires,r),t,e,r);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?k(jn(n.fires,r),t,e,r):Qn({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:t,anchor:e},r)}function $n(n,t){if(n.startToken.indexOf("-")!==-1)return"at "+on(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 "+on(n.fires,t):"every "+d(r,t)+" hours from "+c({hour:e,minute:0},t)}function rn(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 Jn(n){return n.start<n.interval&&24%n.interval===0}function W(n,t){let e=Kn(n);return!e||Jn(e)?null:rn(e,t)}function pt(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 Kn(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=qn(t);return e&&pt(e)}function cn(n){return n.pattern.second==="*"||n.shapes.second==="step"}function Yn(n,t,e){if(t===0)return cn(n)?P(n,"minute",e)+" for one minute":P(n,"hour",e);let r=d(t,e)+" "+b(t,"minute")+" past the hour";return n.pattern.second==="0"?r:P(n,"minute",e)+", "+r}function mn(n,t,e){let r=Kn(n);if(!r)return null;let i=(r.last-r.start)/r.interval+1;if(n.pattern.second==="0"&&i<=T&&Jn(r))return null;let o=t===0&&cn(n)&&yt(n);return o?P(n,"minute",e)+" for one minute "+ln(o,e)+l(n,e):t===0&&n.pattern.second==="0"?rn(r,e)+l(n,e):Yn(n,t,e)+", "+rn(r,e)+l(n,e)}function yt(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 En)?null:e}function bt(n){return n.analyses.segments.hour.some(function(e){return e.kind==="range"})}function St(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 fn(n,t,e){return t!==0||!bt(n)||n.pattern.second==="0"?null:cn(n)?P(n,"minute",e)+" for one minute during the "+U(n,{minute:0,second:null},!1,e)+" hours"+l(n,e):Yn(n,t,e)+", "+St(n,e)+l(n,e)}function L(n,t){let e=n.some(function(i){return+i>10});return function(i){return e?""+i:d(i,t)}}function jn(n,t){return n.map(L(n,t))}function C(n,t){let e=n.flatMap(function(o){return o.kind==="range"?o.bounds:o.kind==="step"?o.fires:[o.value]}),r=L(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 k(n,t,e,r){return"at "+h(n,r)+" "+t+"s past the "+e}function kt(n,t,e){return(+n==0||+n==12)&&+t==0&&!(typeof e=="number"&&e>0)}function dn(n){let t=n.filter(function(r){return kt(r.hour,r.minute,r.second)});return t.length>0&&t.length<n.length}function on(n,t){let e=dn(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 un(n,t,e,r){return t.kind==="fires"?on(t.fires,r):U(n,{minute:0,second:null},e,r)}function Ot(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function U(n,t,e,r){let{minute:i,second:o}=t,u=n.analyses.segments.hour,s=dn(u.flatMap(function(g){return Ot(g).map(function(J){return{hour:+J,minute:i,second:o}})})),m=[];return u.forEach(function(g){g.kind==="step"?m.push(...g.fires.map(function(J){return c({hour:J,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(Nt(m,u,e),r)}function Nt(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 zt={all:"",month:"in ",stepDate:"on ",weekday:"on "},gn={all:"every day",month:"every day in ",stepDate:"",weekday:"every "};function l(n,t){let e=q(n,zt,t);return e&&" "+e}function Bn(n,t){return q(n,gn,t)+" "}function q(n,t,e){let r=n.pattern;return r.date!=="*"&&r.weekday!=="*"?Pt(n,e):r.date!=="*"?Rt(n,t,e):r.weekday!=="*"?(Zn(r.weekday,e)||t.weekday+ee(n,e))+A(n,e):r.month!=="*"?t.month+j(n,e):t.all}function Rt(n,t,e){let r=n.pattern,i=hn(r.date,e);return i?i+A(n,e):$(r.date)?t.stepDate+_n(r.date)+A(n,e):r.month!=="*"&&!Gn(n)?"on the "+sn(n,e)+A(n,e):r.month!=="*"?"on "+Xn(n,e):"on the "+sn(n,e)}function Gn(n){return!ne(n.pattern.month)&&n.analyses.segments.month.every(function(e){return e.kind!=="range"})}function Pt(n,t){let e=n.pattern,r=Zn(e.weekday,t)||"on "+ee(n,t);return e.month!=="*"&&Gn(n)&&!hn(e.date,t)&&!$(e.date)?"on "+Xn(n,t)+" or "+r+" in "+j(n,t):vt(n,t)+" or "+r+wt(n,t)}function vt(n,t){let e=n.pattern,r=hn(e.date,t);return r||($(e.date)?_n(e.date):"on the "+sn(n,t))}function wt(n,t){return n.pattern.month==="*"?"":", in "+j(n,t)}function hn(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 "+H(r[1]||r[2])}function Zn(n,t){let e=n.split("#");if(e.length===2)return"on the "+Qe[+e[1]]+" "+an(e[0],t)+" of the month";if(/L$/.test(n))return"on the last "+an(n.slice(0,-1),t)+" of the month"}function Xn(n,t){let e=j(n,t),r=V(n.analyses.segments.date,t.style.ordinals?H:Ct,t);return t.style.dayFirst?r+" "+e:e+" "+r}function Ct(n){return""+n}function A(n,t){return n.pattern.month==="*"?"":" in "+j(n,t)}function _n(n){let t=n.split("/"),e=+t[1],r=t[0],o=(e===2?"every other":"every "+H(e))+" day of the month";return r!=="*"&&r!=="1"&&(o+=" from the "+H(r)),o}function sn(n,t){return V(n.analyses.segments.date,H,t)}function j(n,t){let e=ne(n.pattern.month);return e||V(n.analyses.segments.month,function(i){return Mt(i,t)},t)}function ne(n){if(!$(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 ee(n,t){let e=Sn(n.analyses.segments.weekday);return V(e,function(i){return an(i,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 $(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function Tt(n,t,e){let r=t.pattern.year;if(r==="*")return n;if(r.indexOf("/")!==-1)return n+" "+Ft(r,e);let i=xt(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 xt(n,t){return n.indexOf(",")!==-1?h(n.split(","),t):n}function Ft(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?It({hour:e,minute:r,second:u,plain:i,explicit:o},t):nn({hour:e,minute:r,second:u},{pad:!0,sep:t.style.sep})}function It(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 nn({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 Wn(n,Ee,t)}function b(n,t){return+n==1?t:t+"s"}function p(n){return n.short?"-":n.style.through}function H(n){let t=Math.abs(n),e=tn[t];return e||(t=(t%100-20)%10,e=tn[t]||tn[0]),n+e}function Mt(n,t){let e=Ae[+n];return e&&e[t.short?1:0]}function an(n,t){let e=n===7||n==="7"?0:n,r=S[e]||Ue[e];return r&&r[t.short?1:0]}var Ht={describe:Ve,fallback:"an unrecognizable cron pattern",options:qe,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},te=Ht;/**
|
|
2
2
|
* @license MIT, Copyright (c) 2026 Andrew Brož
|
|
3
|
-
*/function
|
|
3
|
+
*/function Wt(n,t){let e=t&&t.lang||te,r=e.options(t);if(!r.lenient)return re(ie(n,e,r),e,t);try{return re(ie(n,e,r),e,t)}catch{return e.fallback}}function re(n,t,e){return e&&e.sentence?t.sentence(n):n}function ie(n,t,e){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return t.reboot;let r=Fn(Hn(n,e)),i=t.strategy?t.strategy(r,r.plan):r.plan;return t.describe({...r,plan:i},e)}var pn=Wt;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:pn});var Sr=pn;})();
|
package/dist/cronli5.cjs
CHANGED
|
@@ -110,6 +110,26 @@ function arithmeticStep(values) {
|
|
|
110
110
|
}
|
|
111
111
|
return { start: values[0], interval, last: values[values.length - 1] };
|
|
112
112
|
}
|
|
113
|
+
function weekdayDisplayKey(value) {
|
|
114
|
+
return value === 0 ? 7 : value;
|
|
115
|
+
}
|
|
116
|
+
function orderWeekdaysForDisplay(segments) {
|
|
117
|
+
const flattened = segments.flatMap(function flat(segment) {
|
|
118
|
+
return segment.kind === "step" ? segment.fires.map(function single(value) {
|
|
119
|
+
return { kind: "single", value: "" + value };
|
|
120
|
+
}) : [segment];
|
|
121
|
+
});
|
|
122
|
+
function key(segment) {
|
|
123
|
+
return segment.kind === "range" ? weekdayDisplayKey(+segment.bounds[0]) : weekdayDisplayKey(+segment.value);
|
|
124
|
+
}
|
|
125
|
+
return flattened.map(function index(segment, position) {
|
|
126
|
+
return [segment, position];
|
|
127
|
+
}).sort(function byDisplayKey(a, b) {
|
|
128
|
+
return key(a[0]) - key(b[0]) || a[1] - b[1];
|
|
129
|
+
}).map(function unwrap(pair) {
|
|
130
|
+
return pair[0];
|
|
131
|
+
});
|
|
132
|
+
}
|
|
113
133
|
function toFieldNumber(token, numberMap) {
|
|
114
134
|
return isNonNegativeInteger(token) ? +token : numberMap[token.toUpperCase()];
|
|
115
135
|
}
|
|
@@ -1188,7 +1208,8 @@ function renderHourStep(ir, plan, opts) {
|
|
|
1188
1208
|
return stepHours(ir.analyses.segments.hour[0], opts) + trailingQualifier(ir, opts);
|
|
1189
1209
|
}
|
|
1190
1210
|
function boundedWindow(plan) {
|
|
1191
|
-
|
|
1211
|
+
const last = plan.minuteForm === "wildcard" ? plan.boundMinute ?? 0 : 0;
|
|
1212
|
+
return { from: plan.from, last, to: plan.to };
|
|
1192
1213
|
}
|
|
1193
1214
|
function hourWindow(window, opts) {
|
|
1194
1215
|
return "from " + getTime({ hour: window.from, minute: 0 }, opts) + through(opts) + getTime({ hour: window.to, minute: window.last }, opts);
|
|
@@ -1643,17 +1664,27 @@ function monthFoldsIntoDate(ir) {
|
|
|
1643
1664
|
function dateOrWeekday(ir, opts) {
|
|
1644
1665
|
const pattern = ir.pattern;
|
|
1645
1666
|
const weekdayPart = quartzWeekdayPhrase(pattern.weekday, opts) || "on " + weekdayPhrase(ir, opts);
|
|
1667
|
+
if (pattern.month !== "*" && monthFoldsIntoDate(ir) && !quartzDatePhrase(pattern.date, opts) && !isOpenStep(pattern.date)) {
|
|
1668
|
+
return "on " + monthDatePhrase(ir, opts) + " or " + weekdayPart + " in " + monthName(ir, opts);
|
|
1669
|
+
}
|
|
1670
|
+
return datePart(ir, opts) + " or " + weekdayPart + orMonthScope(ir, opts);
|
|
1671
|
+
}
|
|
1672
|
+
function datePart(ir, opts) {
|
|
1673
|
+
const pattern = ir.pattern;
|
|
1646
1674
|
const quartzDate = quartzDatePhrase(pattern.date, opts);
|
|
1647
1675
|
if (quartzDate) {
|
|
1648
|
-
return quartzDate
|
|
1676
|
+
return quartzDate;
|
|
1649
1677
|
}
|
|
1650
1678
|
if (isOpenStep(pattern.date)) {
|
|
1651
|
-
return stepDates(pattern.date)
|
|
1679
|
+
return stepDates(pattern.date);
|
|
1652
1680
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1681
|
+
return "on the " + dateOrdinals(ir, opts);
|
|
1682
|
+
}
|
|
1683
|
+
function orMonthScope(ir, opts) {
|
|
1684
|
+
if (ir.pattern.month === "*") {
|
|
1685
|
+
return "";
|
|
1655
1686
|
}
|
|
1656
|
-
return "
|
|
1687
|
+
return ", in " + monthName(ir, opts);
|
|
1657
1688
|
}
|
|
1658
1689
|
function quartzDatePhrase(dateField, opts) {
|
|
1659
1690
|
if (dateField === "L") {
|
|
@@ -1735,7 +1766,8 @@ function oddEvenMonth(monthField) {
|
|
|
1735
1766
|
return start === "2" ? "every even-numbered month" : null;
|
|
1736
1767
|
}
|
|
1737
1768
|
function weekdayPhrase(ir, opts) {
|
|
1738
|
-
|
|
1769
|
+
const segments = orderWeekdaysForDisplay(ir.analyses.segments.weekday);
|
|
1770
|
+
return renderSegments(segments, function name(value) {
|
|
1739
1771
|
return getWeekday(value, opts);
|
|
1740
1772
|
}, opts);
|
|
1741
1773
|
}
|
package/dist/cronli5.js
CHANGED
|
@@ -84,6 +84,26 @@ function arithmeticStep(values) {
|
|
|
84
84
|
}
|
|
85
85
|
return { start: values[0], interval, last: values[values.length - 1] };
|
|
86
86
|
}
|
|
87
|
+
function weekdayDisplayKey(value) {
|
|
88
|
+
return value === 0 ? 7 : value;
|
|
89
|
+
}
|
|
90
|
+
function orderWeekdaysForDisplay(segments) {
|
|
91
|
+
const flattened = segments.flatMap(function flat(segment) {
|
|
92
|
+
return segment.kind === "step" ? segment.fires.map(function single(value) {
|
|
93
|
+
return { kind: "single", value: "" + value };
|
|
94
|
+
}) : [segment];
|
|
95
|
+
});
|
|
96
|
+
function key(segment) {
|
|
97
|
+
return segment.kind === "range" ? weekdayDisplayKey(+segment.bounds[0]) : weekdayDisplayKey(+segment.value);
|
|
98
|
+
}
|
|
99
|
+
return flattened.map(function index(segment, position) {
|
|
100
|
+
return [segment, position];
|
|
101
|
+
}).sort(function byDisplayKey(a, b) {
|
|
102
|
+
return key(a[0]) - key(b[0]) || a[1] - b[1];
|
|
103
|
+
}).map(function unwrap(pair) {
|
|
104
|
+
return pair[0];
|
|
105
|
+
});
|
|
106
|
+
}
|
|
87
107
|
function toFieldNumber(token, numberMap) {
|
|
88
108
|
return isNonNegativeInteger(token) ? +token : numberMap[token.toUpperCase()];
|
|
89
109
|
}
|
|
@@ -1162,7 +1182,8 @@ function renderHourStep(ir, plan, opts) {
|
|
|
1162
1182
|
return stepHours(ir.analyses.segments.hour[0], opts) + trailingQualifier(ir, opts);
|
|
1163
1183
|
}
|
|
1164
1184
|
function boundedWindow(plan) {
|
|
1165
|
-
|
|
1185
|
+
const last = plan.minuteForm === "wildcard" ? plan.boundMinute ?? 0 : 0;
|
|
1186
|
+
return { from: plan.from, last, to: plan.to };
|
|
1166
1187
|
}
|
|
1167
1188
|
function hourWindow(window, opts) {
|
|
1168
1189
|
return "from " + getTime({ hour: window.from, minute: 0 }, opts) + through(opts) + getTime({ hour: window.to, minute: window.last }, opts);
|
|
@@ -1617,17 +1638,27 @@ function monthFoldsIntoDate(ir) {
|
|
|
1617
1638
|
function dateOrWeekday(ir, opts) {
|
|
1618
1639
|
const pattern = ir.pattern;
|
|
1619
1640
|
const weekdayPart = quartzWeekdayPhrase(pattern.weekday, opts) || "on " + weekdayPhrase(ir, opts);
|
|
1641
|
+
if (pattern.month !== "*" && monthFoldsIntoDate(ir) && !quartzDatePhrase(pattern.date, opts) && !isOpenStep(pattern.date)) {
|
|
1642
|
+
return "on " + monthDatePhrase(ir, opts) + " or " + weekdayPart + " in " + monthName(ir, opts);
|
|
1643
|
+
}
|
|
1644
|
+
return datePart(ir, opts) + " or " + weekdayPart + orMonthScope(ir, opts);
|
|
1645
|
+
}
|
|
1646
|
+
function datePart(ir, opts) {
|
|
1647
|
+
const pattern = ir.pattern;
|
|
1620
1648
|
const quartzDate = quartzDatePhrase(pattern.date, opts);
|
|
1621
1649
|
if (quartzDate) {
|
|
1622
|
-
return quartzDate
|
|
1650
|
+
return quartzDate;
|
|
1623
1651
|
}
|
|
1624
1652
|
if (isOpenStep(pattern.date)) {
|
|
1625
|
-
return stepDates(pattern.date)
|
|
1653
|
+
return stepDates(pattern.date);
|
|
1626
1654
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1655
|
+
return "on the " + dateOrdinals(ir, opts);
|
|
1656
|
+
}
|
|
1657
|
+
function orMonthScope(ir, opts) {
|
|
1658
|
+
if (ir.pattern.month === "*") {
|
|
1659
|
+
return "";
|
|
1629
1660
|
}
|
|
1630
|
-
return "
|
|
1661
|
+
return ", in " + monthName(ir, opts);
|
|
1631
1662
|
}
|
|
1632
1663
|
function quartzDatePhrase(dateField, opts) {
|
|
1633
1664
|
if (dateField === "L") {
|
|
@@ -1709,7 +1740,8 @@ function oddEvenMonth(monthField) {
|
|
|
1709
1740
|
return start === "2" ? "every even-numbered month" : null;
|
|
1710
1741
|
}
|
|
1711
1742
|
function weekdayPhrase(ir, opts) {
|
|
1712
|
-
|
|
1743
|
+
const segments = orderWeekdaysForDisplay(ir.analyses.segments.weekday);
|
|
1744
|
+
return renderSegments(segments, function name(value) {
|
|
1713
1745
|
return getWeekday(value, opts);
|
|
1714
1746
|
}, opts);
|
|
1715
1747
|
}
|
package/dist/lang/de.cjs
CHANGED
|
@@ -62,6 +62,26 @@ function arithmeticStep(values) {
|
|
|
62
62
|
}
|
|
63
63
|
return { start: values[0], interval, last: values[values.length - 1] };
|
|
64
64
|
}
|
|
65
|
+
function weekdayDisplayKey(value) {
|
|
66
|
+
return value === 0 ? 7 : value;
|
|
67
|
+
}
|
|
68
|
+
function orderWeekdaysForDisplay(segments) {
|
|
69
|
+
const flattened = segments.flatMap(function flat(segment) {
|
|
70
|
+
return segment.kind === "step" ? segment.fires.map(function single(value) {
|
|
71
|
+
return { kind: "single", value: "" + value };
|
|
72
|
+
}) : [segment];
|
|
73
|
+
});
|
|
74
|
+
function key(segment) {
|
|
75
|
+
return segment.kind === "range" ? weekdayDisplayKey(+segment.bounds[0]) : weekdayDisplayKey(+segment.value);
|
|
76
|
+
}
|
|
77
|
+
return flattened.map(function index(segment, position) {
|
|
78
|
+
return [segment, position];
|
|
79
|
+
}).sort(function byDisplayKey(a, b) {
|
|
80
|
+
return key(a[0]) - key(b[0]) || a[1] - b[1];
|
|
81
|
+
}).map(function unwrap(pair) {
|
|
82
|
+
return pair[0];
|
|
83
|
+
});
|
|
84
|
+
}
|
|
65
85
|
function toFieldNumber(token, numberMap) {
|
|
66
86
|
return isNonNegativeInteger(token) ? +token : numberMap[token.toUpperCase()];
|
|
67
87
|
}
|
|
@@ -122,6 +142,9 @@ function everyUnit(unit) {
|
|
|
122
142
|
function everyN(interval, unit) {
|
|
123
143
|
return "alle " + interval + " " + unit.plural;
|
|
124
144
|
}
|
|
145
|
+
function withAnchor(clause, anchor) {
|
|
146
|
+
return anchor ? clause + " " + anchor : clause;
|
|
147
|
+
}
|
|
125
148
|
function stepSegment(segments) {
|
|
126
149
|
return segments[0];
|
|
127
150
|
}
|
|
@@ -145,7 +168,10 @@ function stepClause(segment, unit, anchor) {
|
|
|
145
168
|
const start = segment.startToken === "*" ? 0 : +segment.startToken;
|
|
146
169
|
const short = start !== 0 && segment.fires.length <= 3;
|
|
147
170
|
if (segment.startToken.indexOf("-") !== -1 || short) {
|
|
148
|
-
return
|
|
171
|
+
return withAnchor(
|
|
172
|
+
"in den " + unit.plural + " " + joinList(segment.fires.map(String)),
|
|
173
|
+
anchor
|
|
174
|
+
);
|
|
149
175
|
}
|
|
150
176
|
return renderStride({
|
|
151
177
|
interval: segment.interval,
|
|
@@ -206,7 +232,7 @@ function weekdayRange(bounds) {
|
|
|
206
232
|
return weekdayName(bounds[0]) + " bis " + weekdayName(bounds[1]);
|
|
207
233
|
}
|
|
208
234
|
function weekdayQualifier(ir) {
|
|
209
|
-
const segments =
|
|
235
|
+
const segments = orderWeekdaysForDisplay(fieldSegments(ir, "weekday"));
|
|
210
236
|
if (segments.length === 1 && segments[0].kind === "range") {
|
|
211
237
|
return weekdayRange(segments[0].bounds);
|
|
212
238
|
}
|
|
@@ -346,8 +372,11 @@ function countedPhrase(ir, field, singular, plural) {
|
|
|
346
372
|
}
|
|
347
373
|
return "in den " + plural + " " + joinList(fieldValues(ir, field));
|
|
348
374
|
}
|
|
375
|
+
function minuteAnchor(ir) {
|
|
376
|
+
return ir.pattern.minute === "*" ? "jeder Minute" : "";
|
|
377
|
+
}
|
|
349
378
|
function secondsLead(ir) {
|
|
350
|
-
return secondsClause(ir,
|
|
379
|
+
return secondsClause(ir, minuteAnchor(ir));
|
|
351
380
|
}
|
|
352
381
|
function secondsClause(ir, anchor) {
|
|
353
382
|
if (ir.pattern.second === "*") {
|
|
@@ -357,7 +386,7 @@ function secondsClause(ir, anchor) {
|
|
|
357
386
|
if (ir.shapes.second === "step") {
|
|
358
387
|
return stepClause(stepSegment(segments), UNITS.second, anchor);
|
|
359
388
|
}
|
|
360
|
-
return strideFromSegments(segments, UNITS.second, anchor) ?? countedPhrase(ir, "second", "Sekunde", "Sekunden")
|
|
389
|
+
return strideFromSegments(segments, UNITS.second, anchor) ?? withAnchor(countedPhrase(ir, "second", "Sekunde", "Sekunden"), anchor);
|
|
361
390
|
}
|
|
362
391
|
function spanTime(hour, minute, sep) {
|
|
363
392
|
return hour + sep + pad(minute);
|
|
@@ -532,16 +561,22 @@ function renderMinuteFrequency(ir, plan, opts) {
|
|
|
532
561
|
const segment = stepSegment(ir.analyses.segments.minute);
|
|
533
562
|
const sep = opts.style.sep;
|
|
534
563
|
const clean = cleanStep(segment, 60);
|
|
535
|
-
const base = stepClause(segment, UNITS.minute, "jeder Stunde");
|
|
536
564
|
if (plan.hours.kind === "window") {
|
|
565
|
+
const singleHour = plan.hours.from === plan.hours.to;
|
|
566
|
+
const base2 = stepClause(
|
|
567
|
+
segment,
|
|
568
|
+
UNITS.minute,
|
|
569
|
+
singleHour ? "" : "jeder Stunde"
|
|
570
|
+
);
|
|
537
571
|
const window = hourWindow(
|
|
538
572
|
plan.hours.from,
|
|
539
573
|
plan.hours.to,
|
|
540
574
|
plan.hours.last,
|
|
541
575
|
sep
|
|
542
576
|
);
|
|
543
|
-
return clean ?
|
|
577
|
+
return clean ? base2 + " " + window : base2 + ", " + window;
|
|
544
578
|
}
|
|
579
|
+
const base = stepClause(segment, UNITS.minute, "jeder Stunde");
|
|
545
580
|
if (plan.hours.kind === "during") {
|
|
546
581
|
const cadence = unevenHourCadence(ir);
|
|
547
582
|
return cadence ? base + ", " + cadence : base + " " + duringHours(ir, plan.hours.times, sep);
|
|
@@ -557,7 +592,18 @@ function hourStepPhrase(ir) {
|
|
|
557
592
|
return cadence;
|
|
558
593
|
}
|
|
559
594
|
const segment = stepSegment(ir.analyses.segments.hour);
|
|
560
|
-
|
|
595
|
+
if (cleanStep(segment, 24)) {
|
|
596
|
+
return everyN(segment.interval, UNITS.hour);
|
|
597
|
+
}
|
|
598
|
+
const stride = openOffsetCleanStride(ir, segment);
|
|
599
|
+
return stride ? hourStrideCadence(stride) : atHours(segment.fires);
|
|
600
|
+
}
|
|
601
|
+
function openOffsetCleanStride(ir, segment) {
|
|
602
|
+
if (segment.startToken.indexOf("-") !== -1) {
|
|
603
|
+
return null;
|
|
604
|
+
}
|
|
605
|
+
const stride = hourStride(ir);
|
|
606
|
+
return stride && offsetCleanStride(stride) ? stride : null;
|
|
561
607
|
}
|
|
562
608
|
function hourStrideCadence(stride) {
|
|
563
609
|
const { start, interval, last } = stride;
|
|
@@ -621,7 +667,7 @@ function subMinuteSecond(ir) {
|
|
|
621
667
|
function hourCadenceLead(ir, minute) {
|
|
622
668
|
if (minute === 0) {
|
|
623
669
|
if (subMinuteSecond(ir)) {
|
|
624
|
-
return secondsClause(ir,
|
|
670
|
+
return withAnchor(secondsClause(ir, minuteAnchor(ir)), "f\xFCr eine Minute");
|
|
625
671
|
}
|
|
626
672
|
return secondsClause(ir, "jeder Stunde");
|
|
627
673
|
}
|
|
@@ -629,7 +675,7 @@ function hourCadenceLead(ir, minute) {
|
|
|
629
675
|
if (ir.pattern.second === "0") {
|
|
630
676
|
return minutePhrase;
|
|
631
677
|
}
|
|
632
|
-
return secondsClause(ir,
|
|
678
|
+
return secondsClause(ir, minuteAnchor(ir)) + ", " + minutePhrase;
|
|
633
679
|
}
|
|
634
680
|
function hourCadence(ir, minute) {
|
|
635
681
|
const stride = hourStride(ir);
|
|
@@ -643,7 +689,7 @@ function hourCadence(ir, minute) {
|
|
|
643
689
|
const segment = fieldSegments(ir, "hour")[0];
|
|
644
690
|
const confined = minute === 0 && subMinuteSecond(ir) && fieldSegments(ir, "hour").length === 1 && segment.kind === "step" && confinedHourStride(segment);
|
|
645
691
|
if (confined) {
|
|
646
|
-
return secondsClause(ir,
|
|
692
|
+
return withAnchor(secondsClause(ir, minuteAnchor(ir)), "f\xFCr eine Minute") + " " + everyNthHour(segment);
|
|
647
693
|
}
|
|
648
694
|
if (minute === 0 && ir.pattern.second === "0") {
|
|
649
695
|
return hourStrideCadence(stride);
|
|
@@ -673,12 +719,8 @@ function hourRangeWindowTail(ir) {
|
|
|
673
719
|
return joinList(hourSegmentParts(ir, 0, 0, ":"));
|
|
674
720
|
}
|
|
675
721
|
function renderHourRange(ir, plan, opts) {
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
plan.to,
|
|
679
|
-
plan.boundMinute ?? 0,
|
|
680
|
-
opts.style.sep
|
|
681
|
-
);
|
|
722
|
+
const last = plan.minuteForm === "wildcard" ? plan.boundMinute ?? 0 : 0;
|
|
723
|
+
const window = hourWindow(plan.from, plan.to, last, opts.style.sep);
|
|
682
724
|
if (plan.minuteForm === "wildcard") {
|
|
683
725
|
return "jede Minute " + window;
|
|
684
726
|
}
|
|
@@ -754,7 +796,11 @@ function needsDailyFrame(ir) {
|
|
|
754
796
|
if (ir.plan.kind === "clockTimes" || isComposeMinuteZero(ir)) {
|
|
755
797
|
return true;
|
|
756
798
|
}
|
|
757
|
-
|
|
799
|
+
if (ir.plan.kind !== "hourStep") {
|
|
800
|
+
return false;
|
|
801
|
+
}
|
|
802
|
+
const segment = stepSegment(ir.analyses.segments.hour);
|
|
803
|
+
return !cleanStep(segment, 24) && !openOffsetCleanStride(ir, segment);
|
|
758
804
|
}
|
|
759
805
|
function render(ir, plan, opts) {
|
|
760
806
|
return renderers[plan.kind](
|