3 lines
93 KiB
Java
3 lines
93 KiB
Java
|
|
import{r as lt}from"./dayjs.min-3azO_lpC-BamC5rSi.js";import{c as gi,n as pi}from"./_commonjsHelpers-B52_cu2H-BG14nIm9.js";var wi=Object.defineProperty,vi=Object.defineProperties,ki=Object.getOwnPropertyDescriptors,re=Object.getOwnPropertySymbols,yr=Object.prototype.hasOwnProperty,gr=Object.prototype.propertyIsEnumerable,Si=Math.pow,ar=(m,f,c)=>f in m?wi(m,f,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[f]=c,M=(m,f)=>{for(var c in f||(f={}))yr.call(f,c)&&ar(m,c,f[c]);if(re)for(var c of re(f))gr.call(f,c)&&ar(m,c,f[c]);return m},it=(m,f)=>vi(m,ki(f)),or=(m,f)=>{var c={};for(var u in m)yr.call(m,u)&&f.indexOf(u)<0&&(c[u]=m[u]);if(m!=null&&re)for(var u of re(m))f.indexOf(u)<0&&gr.call(m,u)&&(c[u]=m[u]);return c},Q={},ur;function Oi(){if(ur)return Q;ur=1,Object.defineProperty(Q,"__esModule",{value:!0});class m extends Error{}class f extends m{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class c extends m{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class u extends m{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class h extends m{}class y extends m{constructor(t){super(`Invalid unit ${t}`)}}class g extends m{}class k extends m{constructor(){super("Zone is an abstract class")}}const d="numeric",p="short",O="long",v={year:d,month:d,day:d},L={year:d,month:p,day:d},N={year:d,month:p,day:d,weekday:p},z={year:d,month:O,day:d},W={year:d,month:O,day:d,weekday:O},F={hour:d,minute:d},V={hour:d,minute:d,second:d},j={hour:d,minute:d,second:d,timeZoneName:p},G={hour:d,minute:d,second:d,timeZoneName:O},E={hour:d,minute:d,hourCycle:"h23"},Z={hour:d,minute:d,second:d,hourCycle:"h23"},H={hour:d,minute:d,second:d,hourCycle:"h23",timeZoneName:p},K={hour:d,minute:d,second:d,hourCycle:"h23",timeZoneName:O},ot={year:d,month:d,day:d,hour:d,minute:d},Le={year:d,month:d,day:d,hour:d,minute:d,second:d},ze={year:d,month:p,day:d,hour:d,minute:d},je={year:d,month:p,day:d,hour:d,minute:d,second:d},wr={year:d,month:p,day:d,weekday:p,hour:d,minute:d},Ae={year:d,month:O,day:d,hour:d,minute:d,timeZoneName:p},Ue={year:d,month:O,day:d,hour:d,minute:d,second:d,timeZoneName:p},qe={year:d,month:O,day:d,weekday:O,hour:d,minute:d,timeZoneName:O},Ye={year:d,month:O,day:d,weekday:O,hour:d,minute:d,second:d,timeZoneName:O};class gt{get type(){throw new k}get name(){throw new k}get ianaName(){return this.name}get isUniversal(){throw new k}offsetName(t,e){throw new k}formatOffset(t,e){throw new k}offset(t){throw new k}equals(t){throw new k}get isValid(){throw new k}}let ie=null;class xt extends gt{static get instance(){return ie===null&&(ie=new xt),ie}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:e,locale:r}){return wn(t,e,r)}formatOffset(t,e){return Vt(this.offset(t),e)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return t.type==="system"}get isValid(){return!0}}const ae=new Map;function vr(n){let t=ae.get(n);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),ae.set(n,t)),t}const kr={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Sr(n,t){const e=n.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(e),[,s,i,a,o,l,w,S]=r;return[a,s,i,o,l,w,S]}function Or(n,t){const e=n.formatToParts(t),r=[];for(let s=0;s<e.length;s++){const{type:i,value:a}=e[s],o=kr[i];i==="era"?r[o]=a:D(o)||(r[o]=parseInt(a,10))}return r}const oe=new Map;class at extends gt{static create(t){let e=oe.get(t);return e===void 0&&oe.set(t,e=new at(t)),e}static resetCache(){oe.clear(),ae.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(e){return!1}}constructor(t){super(),this.zoneName=t,this.valid=at.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:e,locale:r}){return wn(t
|
||
|
|
`),h={variables:{},expressions:[],errors:{}},y=0,g=u.length;y<g;y++){var k=u[y],d=null,p=k.trim();if(p.length>0){if(p.match(/^#/))continue;if(d=p.match(/^(.*)=(.*)$/))h.variables[d[1]]=d[2];else{var O=null;try{O=f._parseEntry("0 "+p),h.expressions.push(O.interval)}catch(v){h.errors[p]=v}}}}return h},f.parseFile=function(c,u){Ei.readFile(c,function(h,y){if(h){u(h);return}return u(null,f.parseString(y.toString()))})},Ze=f,Ze}var Vi=Ii();const Fi=pi(Vi),Ci="__custom__";function pr(m){const f=m?lt(m):null;return!f||!f.isValid()?{second:0,minute:0,hour:0}:{second:f.second(),minute:f.minute(),hour:f.hour()}}function _i(m){const{second:f,minute:c,hour:u}=pr(m);return[{label:"每分钟",value:`${f} 0/1 * * * ?`,type:"minute"},{label:"每小时",value:`${f} ${c} 0/1 * * ?`,type:"hour"},{label:"每天",value:`${f} ${c} ${u} * * ?`,type:"day"},{label:"自定义",value:Ci,type:"custom"}]}function Hi(m,f){const c=_i(m),u=c.find(h=>h.type===f);return u?u.value:c[0].value}function $i(m,f){const c=[];if(!m)return c;const u=f&&f.count&&f.count>0?f.count:10,h=f?mr(f.startTime):void 0,y=f?mr(f.endTime):void 0;if(h&&y&<(h).isAfter(y))return c;const g={currentDate:h?lt(h).subtract(1,"second").toDate():new Date};h&&(g.startDate=h),y&&(g.endDate=y);try{const k=Fi.parseExpression(m,g);for(let d=0;d<u;d++){let p;try{p=k.next()}catch(v){break}const O=typeof p.toDate=="function"?p.toDate():new Date(p);if(y&<(O).isAfter(y))break;c.push(lt(O).format("YYYY-MM-DD HH:mm:ss"))}}catch(k){}return c}function mr(m){if(m==null)return;const f=lt(m);if(f.isValid())return f.toDate()}function Pi(m){var f,c;const u=[],h=m.now?lt(m.now).format("YYYY-MM-DD HH:mm:ss"):lt().format("YYYY-MM-DD HH:mm:ss"),y=(f=m.startTime)!=null?f:h,g=(c=m.endTime)!=null?c:void 0,k=m.previewCount,d=$i(m.cronExp,{count:k,startTime:y,endTime:g});if(d.length>0&&(u.push({key:"start",text:d[0],type:"start"}),d[1]&&u.push({key:"second",text:d[1],type:"normal"}),d[2]&&u.push({key:"third",text:d[2],type:"normal"}),u.push({key:"ellipsis",text:"⋮",type:"ellipsis"})),g){const p=lt(g).format("YYYY-MM-DD HH:mm:ss");u.push({key:"end",text:p,type:"end"})}else u.push({key:"infinite",text:"永不结束",type:"infinite"});if(!u.length){const p=h;u.push({key:"fallback",text:p,type:"start"}),u.push({key:"ellipsis",text:"⋮",type:"ellipsis"}),u.push({key:"infinite",text:"永不结束",type:"infinite"})}return u}function Wi(m){const{second:f,minute:c}=pr(m);return{time:{second:f,minute:c},hour:{mode:"every"},day:{type:"day",day:{mode:"every"}},month:{mode:"every"}}}function Ri(m){var f,c;const u=m!=null?m:Wi(),h=A((f=u.time)==null?void 0:f.second,0,59,0),y=A((c=u.time)==null?void 0:c.minute,0,59,0),g=Zi(u.hour),k=Li(u.month),{dayField:d,weekField:p}=zi(u.day);return`${h} ${y} ${g} ${d} ${k} ${p}`}function Ji(m){const f=m?m.trim().split(/\s+/):[];if(f.length<6)return null;const[c,u,h,y,g,k]=f,d={second:A(Number(c),0,59,0),minute:A(Number(u),0,59,0)},p=ji(h);if(!p)return null;const O=Ai(g);if(!O)return null;const v=Ui(y,k);return v?{time:d,hour:p,day:v,month:O}:null}function A(m,f,c,u){const h=typeof m=="number"&&Number.isFinite(m)?Math.floor(m):NaN;return Number.isNaN(h)?u:h<f?f:h>c?c:h}function Zi(m){var f;if(!m)return"*";const c={mode:(f=m.mode)!=null?f:"every",range:m.range,values:m.values,interval:m.interval};if(c.mode==="range"&&c.range&&c.range.length===2){const[u,h]=c.range;return`${A(u,0,23,0)}-${A(h,0,23,23)}`}if(c.mode==="value"&&Array.isArray(c.values)&&c.values.length>0){const u=Array.from(new Set(c.values.map(h=>A(h,0,23,0))));return u.sort((h,y)=>h-y),u.join(",")}if(c.mode==="interval"&&c.interval){const u=A(c.interval.start,0,23,0),h=A(c.interval.step,1,23,1);return`${u}/${h}`}return c.mode,"*"}function Li(m){var f;if(!m)return"*";const c={mode:(f=m.mode)!=null?f:"every",values:m.values};if(c.mode==="value"&&Array.isArray(c.values)&&c.values.length>0){const u=Array.from(new Set(c.values.map(h=>A(h,1,12,1))));return u.sort((h,y)=>h-y),u.join(",")}return"*"}function zi(m){var f;if(((m==null?void 0:m.type)==="week"?"week":"day")=="week"){const u=(f=m==null?void 0:m.week)==null?void 0:f.va
|