cronli5 0.1.5 → 0.1.6

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 CHANGED
@@ -6,6 +6,34 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.6]
10
+
11
+ ### Fixed
12
+
13
+ - **Chinese no longer drops the minute** when an uneven minute step meets an uneven
14
+ hour step: `*/25 */5` read "凌晨0点、5点、…、20点" — silently losing minutes :25 and
15
+ :50 (a wrong schedule) — and now reads "从0点起每5小时,至20点,每小时0、25、50分".
16
+ - **A bounded hour step composed with a second no longer doubles the seconds
17
+ clause**: `30 */25 9-17/2` read "at 30 seconds past the minute, at 30 seconds past
18
+ the minute, …"; the clause is now emitted once (en/es/de/fi; zh's clock-time
19
+ variant likewise).
20
+ - **A sub-minute second under a minute list starting at 0 no longer repeats the
21
+ hour**: `* */25 9,17` read "9 a.m., 9 a.m., 9 a.m." (en/es) — fixed.
22
+
23
+ ### Changed
24
+
25
+ - **Far fewer enumerations: steps, ranges, and stepped hours now read as cadences
26
+ and spans throughout composed forms.** Extending 0.1.5's bounded-step cadence into
27
+ every context — a minute step under an hour range/list ("alle 2 Minuten von Minute
28
+ 3 bis 59 jeder Stunde, von 9 bis 17 Uhr"), an hour range or step under a fixed time
29
+ ("at 30 seconds past the hour, every hour from 9 a.m. through 5 p.m."), and
30
+ **offset/uneven hour steps** ("从1点起每2小时"; "every 5 hours from midnight through
31
+ 8 p.m."; "cada 5 horas de las 00:00 a las 20:00") — instead of listing every fire.
32
+ Irregular sets and runs of up to six clock times still read as explicit times. All
33
+ languages.
34
+ - **Chinese renders an hour range inside a list as a span**: `9-20,22` →
35
+ "9点至20点和22点" rather than thirteen enumerated hours.
36
+
9
37
  ## [0.1.5]
10
38
 
11
39
  ### Changed
package/cronli5.min.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";(()=>{var Xn={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6},_n={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:_n,top:12},weekday:{aliases:{"?":"*",L:"6"},cyclic:!0,max:7,min:0,numbers:Xn,top:6},year:{max:9999,min:1970}},k=["second","minute","hour","date","month","weekday","year"],V={"@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,e){return(""+n).indexOf(e)!==-1}function j(n){return Array.from(new Set(n))}function E(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 f(n,e){return E(n)?+n:e[n.toUpperCase()]}function gn(n){return k.forEach(function(t){ne(n[t],y[t],t)}),n}function ne(n,e,t){typeof n!="string"&&typeof n!="number"&&dn(n,t);let r=""+n;r!=="*"&&(t==="date"&&T(r)||t==="weekday"&&F(r,e)||r.split(",").forEach(function(o){ee(o,e)||dn(o,t)}))}function T(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 F(n,e){if(/L$/.test(n))return v(n.slice(0,-1),e);let t=n.split("#");return t.length===2?v(t[0],e)&&/^[1-5]$/.test(t[1]):!1}function ee(n,e){return a(n,"/")?te(n,e):a(n,"-")?hn(n,e):v(n,e)}function te(n,e){let t=n.split("/");return t.length!==2||!E(t[1])||+t[1]<1?!1:t[0]==="*"||v(t[0],e)||hn(t[0],e,!0)}function hn(n,e,t){let r=n.split("-");return r.length!==2||!v(r[0],e)||!v(r[1],e)?!1:e.cyclic&&!t?!0:f(r[0],e.numbers)<=f(r[1],e.numbers)}function v(n,e){return n==="*"?!1:E(n)?+n>=e.min&&+n<=e.max:e.numbers?n.toUpperCase()in e.numbers:!1}function dn(n,e){throw new Error('`cronli5` was passed an invalid field value "'+n+'" for the '+e+" field.")}var re={hour:24,minute:60,second:60};function yn(n){k.forEach(function(t){let r=y[t].aliases,i=r&&r[""+n[t]];i&&(n[t]=i)})}function bn(n){return k.forEach(function(t){let r=""+n[t];if(t==="date"&&T(r)||t==="weekday"&&F(r,y[t])){n[t]=r;return}n[t]=ie(r,t,y[t])}),n}function ie(n,e,t){let r=""+n;if(r==="*")return r;let i=re[e],o=r.split(",").map(function(s){return oe(Sn(le(ce(me(ae(se(s,t),t),t),t),t,i),t),t)}).join(",").split(",");return o.indexOf("*")!==-1?"*":j(o).sort(function(s,c){return pn(s,t)-pn(c,t)}).join(",")}function oe(n,e){if(!e.numbers)return n;let t=n.split("/"),r=t[0].split("-").map(function(o){return ue(o,e)}).join("-");return t.length===2?r+"/"+t[1]:r}function ue(n,e){if(n==="*")return n;let t=f(n,e.numbers);return""+(t>e.top?e.min:t)}function se(n,e){let t=n.split("/");if(!e.cyclic||t.length!==2||+t[1]!=1)return n;let r=t[0];return a(r,"-")?r:r==="*"||f(r,e.numbers)===e.min?"*":r+"-"+e.top}function ae(n,e){let t=n.split("/");if(!e.cyclic||typeof e.top!="number"||t.length!==2||a(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 le(n,e,t){let r=n.split("/");if(typeof t!="number"||r.length!==2||a(r[0],"-"))return n;let i=+r[1],o=r[0]==="*"?e.min:f(r[0]);if(t%i===0&&o<i)return n;let u=[];for(let s=o;s<=e.top;s+=i)u.push(s);return u.join(",")}function ce(n,e){let t=n.split("/");return t.length!==2||!a(t[0],"-")?n:Sn(t[0],e)==="*"?"*/"+t[1]:n}function Sn(n,e){if(typeof e.top!="number"||a(n,"/")||!a(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 o=e.top,u={};for(let s=r;s<=i;s+=1)u[s>o?e.min:s]=!0;for(let s=e.min;s<=o;s+=1)if(!u[s])return n;return"*"}function me(n,e){let t=n.split("/")[0];if(!a(t,"-"))return n;let r=t.split("-");return f(r[0],e.numbers)!==f(r[1],e.numbers)?n:r[0]}function pn(n,e){let t=n.split("/")[0].split("-")[0];return t==="*"?e.min:f(t,e.numbers)}function On(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 kn(n,e);if(typeof n=="object")return fe(n);if(typeof n=="string")return de(n,e);throw new Error("`cronli5` was passed an unexpected type.")}function kn(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 fe(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:N(n.second,"0"),minute:N(n.minute,r),hour:N(n.hour,i),date:N(n.date,"*"),month:N(n.month,"*"),weekday:N(n.weekday,"*"),year:N(n.year,"*")}}function N(n,e){return typeof n>"u"?e:n}function de(n,e){let t=ge(n).split(/\s+/);return kn(t,e)}function ge(n){let e=n.trim();if(e.charAt(0)!=="@")return n;let t=e.toLowerCase();if(Object.hasOwn(V,t))return V[t];throw new Error("`cronli5` does not recognize the macro `"+e+"`.")}function Nn(n){return n!=="*"&&!a(n,",")&&!a(n,"-")&&!a(n,"/")}function J(n){return a(n,"-")&&!a(n,",")&&!a(n,"/")}function he(n){return a(n,"/")&&!a(n,",")}function Y(n){return n!=="*"&&!a(n,"-")&&!a(n,"/")}function B(n){return n!=="*"&&!J(n)&&!he(n)}function M(n,e,t){let r=[],i=n;for(;i<=t;)r.push(i),i+=e;return r}function zn(n,e,t,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]==="*"?e:f(i[0],r);return M(u,o,t)}function K(n,e,t){let r=[];return n.split(",").forEach(function(o){if(a(o,"/"))r.push(...zn(o,e,t));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,t)),r.push(...M(e,1,+u[1])))}else r.push(+o)}),j(r)}function pe(n){return Y(n)?n.split(",").map(Number):[0]}function ye(n){if(n==="*")return[0,59];if(J(n)){let e=n.split("-");if(+e[0]<=+e[1])return[+e[0],+e[1]]}return null}function be(n){return n==="*"?59:Math.max(...K(n,0,59))}function Se(n){if(Nn(n)&&n!=="0")return+n}function Oe(n,e){return n==="*"?"wildcard":e==="date"&&T(n)||e==="weekday"&&F(n,y.weekday)?"quartz":a(n,",")?"list":a(n,"/")?"step":a(n,"-")?"range":"single"}function ke(n,e,t){return e==="wildcard"||e==="quartz"?null:n.split(",").map(function(i){if(a(i,"/")){let o=i.split("/");return{fires:zn(i,t.min,t.top,t.numbers),interval:+o[1],kind:"step",startToken:o[0]}}return a(i,"-")?{bounds:i.split("-"),kind:"range"}:{kind:"single",value:i}})}function Pn(n){let e={},t={};k.forEach(function(u){e[u]=Oe(n[u],u),t[u]=ke(n[u],e[u],y[u])});let i={analyses:{clockSecond:Se(n.second),lastMinuteFire:be(n.minute),minuteSpan:ye(n.minute),segments:t},pattern:n,shapes:e};return{...i,plan:Ne(i)}}function Ne(n){let{analyses:e,pattern:t,shapes:r}=n;if(t.second!=="0"){let i=ze(t,r,e);if(i)return i}return vn(t,r,e)||Rn(t,r,e)}function ze(n,e,t){let r=Pe(n,e);return r||(n.hour==="*"&&e.minute==="single"&&n.second!=="*"?{kind:"secondsWithinMinute",singleSecond:e.second==="single"}:e.second==="single"&&Y(n.minute)&&B(n.hour)?null:{kind:"composeSeconds",rest:vn(n,e,t,!0)||Rn(n,e,t,!0)})}function Pe(n,e){return n.minute!=="*"||n.hour!=="*"?null:n.second==="*"?{kind:"everySecond"}:e.second==="single"?{kind:"secondPastMinute"}:{kind:"standaloneSeconds"}}function vn(n,e,t,r=!1){if(e.minute==="step")return{hours:Re(n,e,t),kind:"minuteFrequency"};if(e.hour==="single"&&t.minuteSpan)return{hour:+n.hour,kind:"minuteSpanInHour",span:t.minuteSpan};let i=Ce(n,e);if(i)return i;let o=ve(n,e);if(o)return o;if(n.hour==="*")return we(n,e,r)}function G(n){let[e,t]=n.split("/"),r=e==="*"?0:+e;return e.indexOf("-")===-1&&24%+t===0&&r<+t}function ve(n,e){return e.hour!=="step"?null:n.minute==="*"?G(n.hour)?{form:"wildcard",kind:"minuteSpanAcrossHourStep"}:{form:"wildcard",kind:"minutesAcrossHours",times:I(n.hour)}:e.minute==="range"?{form:"range",kind:"minuteSpanAcrossHourStep"}:e.minute==="list"&&G(n.hour)?{form:"list",kind:"minuteSpanAcrossHourStep"}:null}function Re(n,e,t){if(e.hour==="list")return{kind:"during",times:I(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"?G(n.hour)?{kind:"step"}:{kind:"during",times:I(n.hour)}:{kind:"none"}}function Ce(n,e){return B(n.hour)?n.minute==="*"?{form:"wildcard",kind:"minutesAcrossHours",times:I(n.hour)}:e.minute==="range"||e.minute==="list"&&a(n.minute,"-")&&!a(n.minute,"/")?{form:e.minute==="range"?"range":"list",kind:"minutesAcrossHours",times:I(n.hour)}:null:null}function we(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 Rn(n,e,t,r=!1){let i=r&&n.minute==="0";return e.hour==="range"&&!i?xe(n,e,t):e.hour==="step"&&n.minute==="0"&&!r?{kind:"hourStep"}:n.hour==="*"&&!i?{kind:"everyHour"}:Te(n,t,i)}function xe(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 Te(n,e,t=!1){let r=K(n.hour,0,23),i=pe(n.minute);if(!t&&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(P){o.push({hour:s,minute:P,second:e.clockSecond})})}),{kind:"clockTimes",times:o}}function I(n){let e=K(n,0,23);return e.length<=x?{fires:e,kind:"fires"}:{kind:"segments"}}function Cn(n,e){let t=On(n,e);return yn(t),gn(t),bn(t)}function Z(n){return n=""+n,n.length<2?"0"+n:n}function wn(n,e,t){return t.short?n:e[n]||n}function X(n,{sep:e,pad:t,lean:r}){let i=t?Z(n.hour):""+n.hour;return r&&!n.minute&&!n.second?i:i+e+Z(n.minute)+(n.second?e+Z(n.second):"")}var _={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 xn(n){return typeof n=="object"&&n!==null?{..._.us,...n}:_[n==="uk"?"gb":n]||_.us}var Fe=["zero","one","two","three","four","five","six","seven","eight","nine","ten"],nn=["th","st","nd","rd"],Me=[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"]],Ie={SUN:S[0],MON:S[1],TUE:S[2],WED:S[3],THU:S[4],FRI:S[5],SAT:S[6]},He=[null,"first","second","third","fourth","fifth"];function Le(n){return n=n||{},{ampm:typeof n.ampm=="boolean"?n.ampm:!0,lenient:!!n.lenient,seconds:!!n.seconds,short:!!n.short,style:xn(n.dialect),years:!!n.years}}function We(n,e){return bt(Fn(n,n.plan,e),n,e)}function Fn(n,e,t){let r=ut[e.kind];return r(n,e,t)}function je(n,e,t){return"every second"+l(n,t)}function Ee(n,e,t){return R(n,t)+l(n,t)}function Ae(n,e,t){let r=n.pattern.second;return d(r,t)+" "+b(r,"second")+" past the minute, every minute"+l(n,t)}function De(n,e,t){let r=n.pattern.minute,i=d(r,t),o=b(r,"minute");if(e.singleSecond){let u=n.pattern.second;return i+" "+o+" and "+d(u,t)+" "+b(u,"second")+" past the hour, every hour"+l(n,t)}return R(n,t)+", "+i+" "+o+" past the hour, every hour"+l(n,t)}function Ue(n,e,t){return(e.rest.kind==="clockTimes"||e.rest.kind==="compactClockTimes")&&n.shapes.minute==="single"?an(n,+n.pattern.minute,t):null}function Qe(n,e,t){let r=Ue(n,e,t);return r!==null?r:e.rest.kind==="clockTimes"&&(n.shapes.second==="wildcard"||n.shapes.second==="step")?+e.rest.times[0].minute==0?R(n,t)+" for one minute at "+qe(n,e.rest,t):R(n,t)+" of "+Ve(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"+l(n,t):R(n,t)+", "+Fn(n,e.rest,t)}function qe(n,e,t){let r=e.times.map(function(u){return m({hour:u.hour,minute:0},t)}),i=D(n,cn,t);return h(r,t)+(i&&", "+i)}function Ve(n,e,t){let r=e.times.map(function(u){return m({hour:u.hour,minute:u.minute,second:u.second,explicit:!0},t)}),i=D(n,cn,t);return h(r,t)+(i&&", "+i)}function R(n,e){return H(n,"minute",e)}function H(n,e,t){let r=n.pattern.second,i=n.shapes.second;if(r==="*")return"every second";if(i==="step")return jn(n.analyses.segments.second[0],"second",e,t);if(i==="range"){let o=r.split("-"),u=W(o,t);return"every second from "+u(o[0])+p(t)+u(o[1])+" past the "+e}return i==="single"?"at "+d(r,t)+" "+b(r,"second")+" past the "+e:C(n.analyses.segments.second,"second",e,t)??O(w(n.analyses.segments.second,t),"second",e,t)}function $e(n,e,t){return"every minute"+l(n,t)}function Je(n,e,t){let r=n.pattern.minute;return d(r,t)+" "+b(r,"minute")+" past the hour, every hour"+l(n,t)}function Ye(n,e,t){return A(n.pattern.minute,t)+l(n,t)}function Be(n,e,t){return(C(n.analyses.segments.minute,"minute","hour",t)??O(w(n.analyses.segments.minute,t),"minute","hour",t))+l(n,t)}function Ge(n,e,t){let r=jn(n.analyses.segments.minute[0],"minute","hour",t);return e.hours.kind==="during"?r+=" during the "+tn(n,e.hours.times,!1,t)+" hours":e.hours.kind==="window"?r+=" "+Hn(e.hours,t):e.hours.kind==="step"&&(r+=" "+sn(n.analyses.segments.hour[0],t)),r+l(n,t)}function Ke(n,e,t){return n.pattern.minute==="*"?"every minute of the "+m({hour:e.hour,minute:0},t)+" hour"+l(n,t):"every minute from "+m({hour:e.hour,minute:e.span[0]},t)+p(t)+m({hour:e.hour,minute:e.span[1]},t)+l(n,t)}function Ze(n,e,t){if(e.form==="wildcard")return"every minute during the "+tn(n,e.times,!1,t)+" hours"+l(n,t);let r=tn(n,e.times,!0,t);return(e.form==="range"?A(n.pattern.minute,t):C(n.analyses.segments.minute,"minute","hour",t)??O(w(n.analyses.segments.minute,t),"minute","hour",t))+", at "+r+l(n,t)}var Mn={2:"other",3:"third",4:"fourth",6:"sixth",8:"eighth",12:"twelfth"};function sn(n,e){let t="during every "+Mn[n.interval]+" hour",r=n.startToken==="*"?0:+n.startToken;return r===0?t:t+" starting at "+m({hour:r,minute:0},e)}function Xe(n,e,t){let r=n.analyses.segments.hour[0];return e.form==="wildcard"?"every minute "+sn(r,t)+l(n,t):(e.form==="list"?C(n.analyses.segments.minute,"minute","hour",t)??O(w(n.analyses.segments.minute,t),"minute","hour",t):A(n.pattern.minute,t))+", "+En(r,t)+l(n,t)}function A(n,e){let t=n.split("-"),r=W(t,e);return"every minute from "+r(t[0])+p(e)+r(t[1])+" past the hour"}function _e(n,e,t){return"every hour"+l(n,t)}function nt(n,e,t){let r=Hn(tt(e),t);return e.minuteForm==="wildcard"?"every minute "+r+l(n,t):e.minuteForm==="range"?A(n.pattern.minute,t)+", "+r+l(n,t):In(n,t)+" "+r+l(n,t)}function In(n,e){return n.pattern.minute==="0"?"every hour":C(n.analyses.segments.minute,"minute","hour",e)??O(w(n.analyses.segments.minute,e),"minute","hour",e)}function et(n,e,t){return En(n.analyses.segments.hour[0],t)+l(n,t)}function tt(n){return{from:n.from,last:n.boundMinute??0,to:n.to}}function Hn(n,e){return"from "+m({hour:n.from,minute:0},e)+p(e)+m({hour:n.to,minute:n.last},e)}function rt(n,e,t){if(n.shapes.minute==="single"){let o=an(n,+n.pattern.minute,t);if(o!==null)return o}let r=ln(e.times),i=e.times.map(function(u){return m({hour:u.hour,minute:u.minute,second:u.second,plain:r},t)});return Dn(n,t)+"at "+h(i,t)}function it(n,e,t){if(e.fold){let i=an(n,+e.minute,t);if(i!==null)return i;if(n.analyses.segments.hour.some(function(c){return c.kind==="range"})&&!n.analyses.clockSecond)return ot(n,e,t)+l(n,t);let u={minute:e.minute,second:n.analyses.clockSecond};return Dn(n,t)+"at "+rn(n,u,!0,t)}let r=(C(n.analyses.segments.minute,"minute","hour",t)??O(w(n.analyses.segments.minute,t),"minute","hour",t))+", at "+rn(n,{minute:0,second:null},!0,t)+l(n,t);return n.analyses.clockSecond?R(n,t)+", "+r:r}function ot(n,e,t){let r=e.minute,i=[],o=[];n.analyses.segments.hour.forEach(function(c){c.kind==="range"?i.push("from "+m({hour:c.bounds[0],minute:0},t)+p(t)+m({hour:c.bounds[1],minute:r},t)):c.kind==="step"?o.push(...c.fires):o.push(+c.value)});let u=In(n,t)+" "+h(i,t);return o.length&&(u+=" and at "+h(o.map(function(c){return m({hour:c,minute:r},t)}),t)),u}var ut={clockTimes:rt,compactClockTimes:it,composeSeconds:Qe,everyHour:_e,everyMinute:$e,everySecond:je,hourRange:nt,hourStep:et,minuteFrequency:Ge,minuteSpanAcrossHourStep:Xe,minuteSpanInHour:Ke,minutesAcrossHours:Ze,multipleMinutes:Be,rangeOfMinutes:Ye,secondPastMinute:Ae,secondsWithinMinute:De,singleMinute:Je,standaloneSeconds:Ee};function Ln(n,e){let{interval:t,start:r,last:i,cycle:o,unit:u,anchor:s}=n,c="every "+d(t,e)+" "+u+"s",P=o%t===0;if(r===0&&P)return c;if(r<t&&P)return c+" from "+d(r,e)+" "+b(r,u)+" past the "+s;let g=W([r,i],e);return c+" from "+g(r)+p(e)+g(i)+" "+b(i,u)+" past the "+s}function Wn(n){let e=[];for(let t of n){if(t.kind!=="single")return null;e.push(+t.value)}return e}function C(n,e,t,r){let i=Wn(n),o=i&&$(i);return o?Ln({...o,cycle:60,unit:e,anchor:t},r):null}function jn(n,e,t,r){if(n.startToken.indexOf("-")!==-1)return O(Tn(n.fires,r),e,t,r);let i=n.startToken==="*"?0:+n.startToken;return i!==0&&n.fires.length<=3?O(Tn(n.fires,r),e,t,r):Ln({interval:n.interval,start:i,last:n.fires[n.fires.length-1],cycle:60,unit:e,anchor:t},r)}function En(n,e){if(n.startToken.indexOf("-")!==-1)return"at "+en(n.fires,e);let t=n.startToken==="*"?0:+n.startToken,r=n.interval;return t===0?"every "+d(r,e)+" hours":n.fires.length<=3?"at "+en(n.fires,e):"every "+d(r,e)+" hours from "+m({hour:t,minute:0},e)}function st(n,e){let{start:t,interval:r,last:i}=n,o="every "+d(r,e)+" hours",u=24%r===0;return t===0&&u?o:t<r&&u?o+" from "+m({hour:t,minute:0},e):o+" from "+m({hour:t,minute:0},e)+p(e)+m({hour:i,minute:0},e)}function at(n){let e=n.analyses.segments.hour;if(e.length===1&&e[0].kind==="step"){let i=e[0],o=i.startToken==="*"?0:+i.startToken.split("-")[0];return{interval:i.interval,last:i.fires[i.fires.length-1],start:o}}let t=Wn(e);return t&&$(t)||null}function An(n){return n.pattern.second==="*"||n.shapes.second==="step"}function lt(n,e,t){if(e===0)return An(n)?H(n,"minute",t)+" for one minute":H(n,"hour",t);let r=d(e,t)+" "+b(e,"minute")+" past the hour";return n.pattern.second==="0"?r:H(n,"minute",t)+", "+r}function an(n,e,t){let r=at(n);if(!r)return null;let i=(r.last-r.start)/r.interval+1;if(n.pattern.second==="0"&&i<=x)return null;let o=e===0&&An(n)&&ct(n);return o?H(n,"minute",t)+" for one minute "+sn(o,t)+l(n,t):lt(n,e,t)+", "+st(r,t)+l(n,t)}function ct(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 Mn)?null:t}function W(n,e){let t=n.some(function(i){return+i>10});return function(i){return t?""+i:d(i,e)}}function Tn(n,e){return n.map(W(n,e))}function w(n,e){let t=n.flatMap(function(o){return o.kind==="range"?o.bounds:o.kind==="step"?o.fires:[o.value]}),r=W(t,e);return n.flatMap(function(o){return o.kind==="range"?[r(o.bounds[0])+p(e)+r(o.bounds[1])]:o.kind==="step"?o.fires.map(r):[r(o.value)]})}function O(n,e,t,r){return"at "+h(n,r)+" "+e+"s past the "+t}function mt(n,e,t){return(+n==0||+n==12)&&+e==0&&!(typeof t=="number"&&t>0)}function ln(n){let e=n.filter(function(r){return mt(r.hour,r.minute,r.second)});return e.length>0&&e.length<n.length}function en(n,e){let t=ln(n.map(function(o){return{hour:o,minute:0}})),r=n.map(function(o){return m({hour:o,minute:0,plain:t},e)});return h(r,e)}function tn(n,e,t,r){return e.kind==="fires"?en(e.fires,r):rn(n,{minute:0,second:null},t,r)}function ft(n){return n.kind==="range"?n.bounds:n.kind==="step"?n.fires:[n.value]}function rn(n,e,t,r){let{minute:i,second:o}=e,u=n.analyses.segments.hour,s=ln(u.flatMap(function(g){return ft(g).map(function(q){return{hour:+q,minute:i,second:o}})})),c=[];return u.forEach(function(g){g.kind==="step"?c.push(...g.fires.map(function(q){return m({hour:q,minute:i,second:o,plain:s},r)})):g.kind==="range"?c.push(m({hour:g.bounds[0],minute:i,second:o,plain:s},r)+p(r)+m({hour:g.bounds[1],minute:i,second:o,plain:s},r)):c.push(m({hour:g.value,minute:i,second:o,plain:s},r))}),h(dt(c,u,t),r)}function dt(n,e,t){let r=e.some(function(o){return o.kind==="range"});return!t||!r?n:n.map(function(o,u){return u===0?o:"at "+o})}function h(n,e){if(n.length<=1)return n.join("");if(n.length===2)return n[0]+" and "+n[1];let t=e.style.serialComma?", and ":" and ";return n.slice(0,-1).join(", ")+t+n[n.length-1]}var gt={all:"",month:"in ",stepDate:"on ",weekday:"on "},cn={all:"every day",month:"every day in ",stepDate:"",weekday:"every "};function l(n,e){let t=D(n,gt,e);return t&&" "+t}function Dn(n,e){return D(n,cn,e)+" "}function D(n,e,t){let r=n.pattern;return r.date!=="*"&&r.weekday!=="*"?pt(n,t):r.date!=="*"?ht(n,e,t):r.weekday!=="*"?(qn(r.weekday,t)||e.weekday+Yn(n,t))+z(n,t):r.month!=="*"?e.month+U(n,t):e.all}function ht(n,e,t){let r=n.pattern,i=Qn(r.date,t);return i?i+z(n,t):mn(r.date)?e.stepDate+$n(r.date)+z(n,t):r.month!=="*"&&!Un(n)?"on the "+on(n,t)+z(n,t):r.month!=="*"?"on "+Vn(n,t):"on the "+on(n,t)}function Un(n){return!Jn(n.pattern.month)&&n.analyses.segments.month.every(function(t){return t.kind!=="range"})}function pt(n,e){let t=n.pattern,r=qn(t.weekday,e)||"on "+Yn(n,e),i=Qn(t.date,e);return i?i+z(n,e)+" or "+r:mn(t.date)?$n(t.date)+z(n,e)+" or "+r:t.month!=="*"&&Un(n)?"on "+Vn(n,e)+" or "+r+" in "+U(n,e):"on the "+on(n,e)+" or "+r+z(n,e)}function Qn(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 d(+t[1],e)+" "+b(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 "+L(r[1]||r[2])}function qn(n,e){let t=n.split("#");if(t.length===2)return"on the "+He[+t[1]]+" "+un(t[0],e)+" of the month";if(/L$/.test(n))return"on the last "+un(n.slice(0,-1),e)+" of the month"}function Vn(n,e){let t=U(n,e),r=Q(n.analyses.segments.date,e.style.ordinals?L:yt,e);return e.style.dayFirst?r+" "+t:t+" "+r}function yt(n){return""+n}function z(n,e){return n.pattern.month==="*"?"":" in "+U(n,e)}function $n(n){let e=n.split("/"),t=+e[1],r=e[0],o=(t===2?"every other":"every "+L(t))+" day of the month";return r!=="*"&&r!=="1"&&(o+=" from the "+L(r)),o}function on(n,e){return Q(n.analyses.segments.date,L,e)}function U(n,e){let t=Jn(n.pattern.month);return t||Q(n.analyses.segments.month,function(i){return Nt(i,e)},e)}function Jn(n){if(!mn(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 Yn(n,e){return Q(n.analyses.segments.weekday,function(r){return un(r,e)},e)}function Q(n,e,t){let r=[];return n.forEach(function(o){o.kind==="step"?r.push(...o.fires.map(e)):o.kind==="range"?r.push(o.bounds.map(e).join(p(t))):r.push(e(o.value))}),h(r,t)}function mn(n){return n.indexOf("/")!==-1&&n.indexOf("-")===-1&&n.indexOf(",")===-1}function bt(n,e,t){let r=e.pattern.year;if(r==="*")return n;if(r.indexOf("/")!==-1)return n+" "+Ot(r,t);let i=St(r,t);if(r.indexOf("-")===-1&&r.indexOf(",")===-1&&e.pattern.date!=="*"&&n.indexOf(" at ")!==-1){let o=t.style.dayFirst?" ":", ";return n.replace(" at ",o+i+" at ")}return n+" in "+i}function St(n,e){return n.indexOf(",")!==-1?h(n.split(","),e):n}function Ot(n,e){let t=n.split("/"),r=+t[1],i=t[0];if(r<=1)return"every year";let o="every "+d(r,e)+" years";return i!=="*"&&i!=="0"&&(o+=" from "+i),o}function m(n,e){let{hour:t,minute:r,plain:i,explicit:o}=n,u=typeof n.second=="number"&&n.second>0?n.second:0;return e.ampm?kt({hour:t,minute:r,second:u,plain:i,explicit:o},e):X({hour:t,minute:r,second:u},{pad:!0,sep:e.style.sep})}function kt(n,e){let{hour:t,minute:r,second:i,plain:o,explicit:u}=n,s=e.style;if(!o&&!u&&+r==0&&!i){if(+t==0)return s.midnight;if(+t==12)return s.midday}return X({hour:t%12||12,minute:r,second:i},{lean:!u,sep:s.sep})+(s.closeUp?"":" ")+(t<12?s.am:s.pm)}function d(n,e){return wn(n,Fe,e)}function b(n,e){return+n==1?e:e+"s"}function p(n){return n.short?"-":n.style.through}function L(n){let e=Math.abs(n),t=nn[e];return t||(e=(e%100-20)%10,t=nn[e]||nn[0]),n+t}function Nt(n,e){let t=Me[+n];return t&&t[e.short?1:0]}function un(n,e){let t=n===7||n==="7"?0:n,r=S[t]||Ie[t];return r&&r[e.short?1:0]}var zt={describe:We,fallback:"an unrecognizable cron pattern",options:Le,reboot:"at system startup",sentence:n=>"Runs "+n+(n.endsWith(".")?"":".")},Bn=zt;/**
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&&gt(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;/**
2
2
  * @license MIT, Copyright (c) 2026 Andrew Brož
3
- */function Pt(n,e){let t=e&&e.lang||Bn,r=t.options(e);if(!r.lenient)return Gn(Kn(n,t,r),t,e);try{return Gn(Kn(n,t,r),t,e)}catch{return t.fallback}}function Gn(n,e,t){return t&&t.sentence?e.sentence(n):n}function Kn(n,e,t){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return e.reboot;let r=Pn(Cn(n,t)),i=e.strategy?e.strategy(r,r.plan):r.plan;return e.describe({...r,plan:i},t)}var fn=Pt;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:fn});var ar=fn;})();
3
+ */function Ft(n,t){let e=t&&t.lang||ne,r=e.options(t);if(!r.lenient)return ee(te(n,e,r),e,t);try{return ee(te(n,e,r),e,t)}catch{return e.fallback}}function ee(n,t,e){return e&&e.sentence?t.sentence(n):n}function te(n,t,e){if(typeof n=="string"&&n.trim().toLowerCase()==="@reboot")return t.reboot;let r=wn(Fn(n,e)),i=t.strategy?t.strategy(r,r.plan):r.plan;return t.describe({...r,plan:i},e)}var hn=Ft;typeof globalThis<"u"&&Object.assign(globalThis,{cronli5:hn});var hr=hn;})();
package/dist/cronli5.cjs CHANGED
@@ -972,7 +972,17 @@ function renderSecondsWithinMinute(ir, plan, opts) {
972
972
  }
973
973
  function composeHourCadence(ir, plan, opts) {
974
974
  const clockRest = plan.rest.kind === "clockTimes" || plan.rest.kind === "compactClockTimes";
975
- return clockRest && ir.shapes.minute === "single" ? hourCadence(ir, +ir.pattern.minute, opts) : null;
975
+ if (!clockRest || ir.shapes.minute !== "single") {
976
+ return null;
977
+ }
978
+ const minute = +ir.pattern.minute;
979
+ return hourCadence(ir, minute, opts) ?? hourRangeCadence(ir, minute, opts);
980
+ }
981
+ function clockTimesConfinement(ir, rest, opts) {
982
+ if (+rest.times[0].minute === 0 && ir.shapes.minute === "single") {
983
+ return secondsLeadClause(ir, opts) + " for one minute at " + durationHours(ir, rest, opts);
984
+ }
985
+ return secondsLeadClause(ir, opts) + " of " + clockTimesOf(ir, rest, opts);
976
986
  }
977
987
  function renderComposeSeconds(ir, plan, opts) {
978
988
  const cadence = composeHourCadence(ir, plan, opts);
@@ -980,16 +990,14 @@ function renderComposeSeconds(ir, plan, opts) {
980
990
  return cadence;
981
991
  }
982
992
  if (plan.rest.kind === "clockTimes" && (ir.shapes.second === "wildcard" || ir.shapes.second === "step")) {
983
- const minute = plan.rest.times[0].minute;
984
- if (+minute === 0) {
985
- return secondsLeadClause(ir, opts) + " for one minute at " + durationHours(ir, plan.rest, opts);
986
- }
987
- return secondsLeadClause(ir, opts) + " of " + clockTimesOf(ir, plan.rest, opts);
993
+ return clockTimesConfinement(ir, plan.rest, opts);
988
994
  }
989
995
  if (ir.shapes.second === "wildcard" && plan.rest.kind === "minuteFrequency" && plan.rest.hours.kind === "none" && ir.pattern.minute === "*/2") {
990
996
  return "every second of every other minute" + trailingQualifier(ir, opts);
991
997
  }
992
- return secondsLeadClause(ir, opts) + ", " + render(ir, plan.rest, opts);
998
+ const restOwnsLead = plan.rest.kind === "compactClockTimes" && ir.analyses.clockSecond;
999
+ const lead = restOwnsLead ? "" : secondsLeadClause(ir, opts) + ", ";
1000
+ return lead + render(ir, plan.rest, opts);
993
1001
  }
994
1002
  function durationHours(ir, plan, opts) {
995
1003
  const hours = plan.times.map(function clock(time) {
@@ -1072,7 +1080,8 @@ function renderMinuteFrequency(ir, plan, opts) {
1072
1080
  opts
1073
1081
  );
1074
1082
  if (plan.hours.kind === "during") {
1075
- phrase += " during the " + hourTimesFromPlan(ir, plan.hours.times, false, opts) + " hours";
1083
+ const cadence = unevenHourCadence(ir, opts);
1084
+ phrase += cadence ? ", " + cadence : " during the " + hourTimesFromPlan(ir, plan.hours.times, false, opts) + " hours";
1076
1085
  } else if (plan.hours.kind === "window") {
1077
1086
  phrase += " " + hourWindow(plan.hours, opts);
1078
1087
  } else if (plan.hours.kind === "step") {
@@ -1087,10 +1096,13 @@ function renderMinuteSpanInHour(ir, plan, opts) {
1087
1096
  return "every minute from " + getTime({ hour: plan.hour, minute: plan.span[0] }, opts) + through(opts) + getTime({ hour: plan.hour, minute: plan.span[1] }, opts) + trailingQualifier(ir, opts);
1088
1097
  }
1089
1098
  function renderMinutesAcrossHours(ir, plan, opts) {
1099
+ const cadence = unevenHourCadence(ir, opts);
1090
1100
  if (plan.form === "wildcard") {
1101
+ if (cadence !== null) {
1102
+ return "every minute, " + cadence + trailingQualifier(ir, opts);
1103
+ }
1091
1104
  return "every minute during the " + hourTimesFromPlan(ir, plan.times, false, opts) + " hours" + trailingQualifier(ir, opts);
1092
1105
  }
1093
- const times = hourTimesFromPlan(ir, plan.times, true, opts);
1094
1106
  const lead = plan.form === "range" ? minuteRangeLead(ir.pattern.minute, opts) : (
1095
1107
  // The 'list' form is a minute list, which has segments; an offset/uneven
1096
1108
  // step enumerated to that list reads as a stride.
@@ -1101,6 +1113,10 @@ function renderMinutesAcrossHours(ir, plan, opts) {
1101
1113
  opts
1102
1114
  )
1103
1115
  );
1116
+ if (cadence !== null) {
1117
+ return lead + ", " + cadence + trailingQualifier(ir, opts);
1118
+ }
1119
+ const times = hourTimesFromPlan(ir, plan.times, true, opts);
1104
1120
  return lead + ", at " + times + trailingQualifier(ir, opts);
1105
1121
  }
1106
1122
  var stepOrdinals = {
@@ -1127,7 +1143,8 @@ function renderMinuteSpanAcrossHourStep(ir, plan, opts) {
1127
1143
  "hour",
1128
1144
  opts
1129
1145
  ) : minuteRangeLead(ir.pattern.minute, opts);
1130
- return lead + ", " + stepHours(segment, opts) + trailingQualifier(ir, opts);
1146
+ const cadence = unevenHourCadence(ir, opts);
1147
+ return lead + ", " + (cadence ?? stepHours(segment, opts)) + trailingQualifier(ir, opts);
1131
1148
  }
1132
1149
  function minuteRangeLead(minuteField, opts) {
1133
1150
  const bounds = minuteField.split("-");
@@ -1164,6 +1181,10 @@ function rangeMinuteLead(ir, opts) {
1164
1181
  );
1165
1182
  }
1166
1183
  function renderHourStep(ir, plan, opts) {
1184
+ const cadence = unevenHourCadence(ir, opts);
1185
+ if (cadence !== null) {
1186
+ return cadence + trailingQualifier(ir, opts);
1187
+ }
1167
1188
  return stepHours(ir.analyses.segments.hour[0], opts) + trailingQualifier(ir, opts);
1168
1189
  }
1169
1190
  function boundedWindow(plan) {
@@ -1174,7 +1195,8 @@ function hourWindow(window, opts) {
1174
1195
  }
1175
1196
  function renderClockTimes(ir, plan, opts) {
1176
1197
  if (ir.shapes.minute === "single") {
1177
- const cadence = hourCadence(ir, +ir.pattern.minute, opts);
1198
+ const minute = +ir.pattern.minute;
1199
+ const cadence = hourCadence(ir, minute, opts) ?? hourRangeCadence(ir, minute, opts);
1178
1200
  if (cadence !== null) {
1179
1201
  return cadence;
1180
1202
  }
@@ -1192,9 +1214,9 @@ function renderClockTimes(ir, plan, opts) {
1192
1214
  }
1193
1215
  function renderCompactClockTimes(ir, plan, opts) {
1194
1216
  if (plan.fold) {
1195
- const cadence = hourCadence(ir, +plan.minute, opts);
1196
- if (cadence !== null) {
1197
- return cadence;
1217
+ const cadence2 = hourCadence(ir, +plan.minute, opts) ?? hourRangeCadence(ir, +plan.minute, opts);
1218
+ if (cadence2 !== null) {
1219
+ return cadence2;
1198
1220
  }
1199
1221
  const hasRange = ir.analyses.segments.hour.some(function range(segment) {
1200
1222
  return segment.kind === "range";
@@ -1205,16 +1227,18 @@ function renderCompactClockTimes(ir, plan, opts) {
1205
1227
  const fold = { minute: plan.minute, second: ir.analyses.clockSecond };
1206
1228
  return interpretDayQualifier(ir, opts) + "at " + hourSegmentTimes(ir, fold, true, opts);
1207
1229
  }
1208
- const phrase = (
1230
+ const minuteLead = (
1209
1231
  // The non-fold branch is a minute list, which has segments. An
1210
1232
  // offset/uneven step enumerated to that list reads as a stride.
1211
- (strideFromSegments(ir.analyses.segments.minute, "minute", "hour", opts) ?? listPastThe(
1233
+ strideFromSegments(ir.analyses.segments.minute, "minute", "hour", opts) ?? listPastThe(
1212
1234
  segmentWords(ir.analyses.segments.minute, opts),
1213
1235
  "minute",
1214
1236
  "hour",
1215
1237
  opts
1216
- )) + ", at " + hourSegmentTimes(ir, { minute: 0, second: null }, true, opts) + trailingQualifier(ir, opts)
1238
+ )
1217
1239
  );
1240
+ const cadence = unevenHourCadence(ir, opts);
1241
+ const phrase = cadence ? minuteLead + ", " + cadence + trailingQualifier(ir, opts) : minuteLead + ", at " + hourSegmentTimes(ir, { minute: 0, second: null }, true, opts) + trailingQualifier(ir, opts);
1218
1242
  return ir.analyses.clockSecond ? secondsLeadClause(ir, opts) + ", " + phrase : phrase;
1219
1243
  }
1220
1244
  function foldedHourWindows(ir, plan, opts) {
@@ -1332,16 +1356,46 @@ function hourStrideCadence(stride, opts) {
1332
1356
  }
1333
1357
  return cadence + " from " + getTime({ hour: start, minute: 0 }, opts) + through(opts) + getTime({ hour: last, minute: 0 }, opts);
1334
1358
  }
1359
+ function offsetCleanStride(stride) {
1360
+ return stride.start < stride.interval && 24 % stride.interval === 0;
1361
+ }
1362
+ function unevenHourCadence(ir, opts) {
1363
+ const stride = hourStride(ir);
1364
+ if (!stride || offsetCleanStride(stride)) {
1365
+ return null;
1366
+ }
1367
+ return hourStrideCadence(stride, opts);
1368
+ }
1369
+ function hourListStride(values) {
1370
+ if (values.length < 2) {
1371
+ return null;
1372
+ }
1373
+ const interval = values[1] - values[0];
1374
+ if (interval < 2) {
1375
+ return null;
1376
+ }
1377
+ for (let i = 2; i < values.length; i += 1) {
1378
+ if (values[i] - values[i - 1] !== interval) {
1379
+ return null;
1380
+ }
1381
+ }
1382
+ if (values[0] !== 0 && values.length < 5) {
1383
+ return null;
1384
+ }
1385
+ return { interval, last: values[values.length - 1], start: values[0] };
1386
+ }
1335
1387
  function hourStride(ir) {
1336
1388
  const segments = ir.analyses.segments.hour;
1337
1389
  if (segments.length === 1 && segments[0].kind === "step") {
1338
1390
  const segment = segments[0];
1391
+ if (segment.fires.length < 2) {
1392
+ return null;
1393
+ }
1339
1394
  const start = segment.startToken === "*" ? 0 : +segment.startToken.split("-")[0];
1340
1395
  return { interval: segment.interval, last: segment.fires[segment.fires.length - 1], start };
1341
1396
  }
1342
1397
  const values = singleValues(segments);
1343
- const step = values && arithmeticStep(values);
1344
- return step || null;
1398
+ return values && hourListStride(values);
1345
1399
  }
1346
1400
  function subMinuteSecond(ir) {
1347
1401
  return ir.pattern.second === "*" || ir.shapes.second === "step";
@@ -1365,13 +1419,16 @@ function hourCadence(ir, minute, opts) {
1365
1419
  return null;
1366
1420
  }
1367
1421
  const fires = (stride.last - stride.start) / stride.interval + 1;
1368
- if (ir.pattern.second === "0" && fires <= maxClockTimes) {
1422
+ if (ir.pattern.second === "0" && fires <= maxClockTimes && offsetCleanStride(stride)) {
1369
1423
  return null;
1370
1424
  }
1371
1425
  const confinement = minute === 0 && subMinuteSecond(ir) && cleanStrideSegment(ir);
1372
1426
  if (confinement) {
1373
1427
  return secondsClause(ir, "minute", opts) + " for one minute " + everyNthHour(confinement, opts) + trailingQualifier(ir, opts);
1374
1428
  }
1429
+ if (minute === 0 && ir.pattern.second === "0") {
1430
+ return hourStrideCadence(stride, opts) + trailingQualifier(ir, opts);
1431
+ }
1375
1432
  return hourCadenceLead(ir, minute, opts) + ", " + hourStrideCadence(stride, opts) + trailingQualifier(ir, opts);
1376
1433
  }
1377
1434
  function cleanStrideSegment(ir) {
@@ -1382,6 +1439,46 @@ function cleanStrideSegment(ir) {
1382
1439
  }
1383
1440
  return segment;
1384
1441
  }
1442
+ function hasHourWindow(ir) {
1443
+ return ir.analyses.segments.hour.some(function range(segment) {
1444
+ return segment.kind === "range";
1445
+ });
1446
+ }
1447
+ function hourRangeWindowTail(ir, opts) {
1448
+ const windows = [];
1449
+ const singles = [];
1450
+ ir.analyses.segments.hour.forEach(function classify(segment) {
1451
+ if (segment.kind === "range") {
1452
+ windows.push("from " + getTime(
1453
+ { hour: +segment.bounds[0], minute: 0 },
1454
+ opts
1455
+ ) + through(opts) + getTime({ hour: +segment.bounds[1], minute: 0 }, opts));
1456
+ } else if (segment.kind === "step") {
1457
+ singles.push(...segment.fires);
1458
+ } else {
1459
+ singles.push(+segment.value);
1460
+ }
1461
+ });
1462
+ let phrase = "every hour " + joinList(windows, opts);
1463
+ if (singles.length) {
1464
+ phrase += " and at " + joinList(singles.map(function time(hour) {
1465
+ return getTime({ hour, minute: 0 }, opts);
1466
+ }), opts);
1467
+ }
1468
+ return phrase;
1469
+ }
1470
+ function hourRangeCadence(ir, minute, opts) {
1471
+ if (minute !== 0 || !hasHourWindow(ir)) {
1472
+ return null;
1473
+ }
1474
+ if (ir.pattern.second === "0") {
1475
+ return null;
1476
+ }
1477
+ if (subMinuteSecond(ir)) {
1478
+ return secondsClause(ir, "minute", opts) + " for one minute during the " + hourSegmentTimes(ir, { minute: 0, second: null }, false, opts) + " hours" + trailingQualifier(ir, opts);
1479
+ }
1480
+ return hourCadenceLead(ir, minute, opts) + ", " + hourRangeWindowTail(ir, opts) + trailingQualifier(ir, opts);
1481
+ }
1385
1482
  function seriesNumber(values, opts) {
1386
1483
  const anyBig = values.some(function big(v) {
1387
1484
  return +v > 10;