(function(m,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(m=typeof globalThis<"u"?globalThis:m||self,c(m.CronCore={},m.Vue))})(this,function(m,c){"use strict";var ze=Object.defineProperty;var Be=(m,c,O)=>c in m?ze(m,c,{enumerable:!0,configurable:!0,writable:!0,value:O}):m[c]=O;var y=(m,c,O)=>(Be(m,typeof c!="symbol"?c+"":c,O),O);var O=(i=>(i.Empty="empty",i.Value="value",i.Range="range",i.EveryX="everyX",i.Combined="combined",i.NoSpecific="noSpecific",i))(O||{}),$=(i=>(i.Prefix="prefix",i.Suffix="suffix",i.Text="text",i))($||{});class _{constructor(e){y(this,"field");y(this,"itemMap");this.field=e,this.itemMap=this.field.items.reduce((t,r)=>(t[r.value]=r,t),{})}get id(){return this.field.id}get items(){return this.field.items}get onChange(){return this.field.onChange}get segmentFactories(){return this.field.segmentFactories}get min(){return this.items[0].value}get max(){return this.items[this.items.length-1].value}getItem(e){return this.itemMap[e]}}function he(i,e,t=1){const r=[];for(let n=i;n<=e;n+=t)r.push(n);return r}class ve{constructor(e,t,r=1){y(this,"start");y(this,"end");y(this,"step");return this.start=e,this.end=t,this.step=r,new Proxy(this,{get:function(n,a){const s=typeof a=="string"?parseInt(a):a;return typeof s=="number"&&s>=0&&s<=n.length?n.start+n.step*s:Reflect.get(n,a)}})}get length(){return(this.end-this.start)/this.step+1}[Symbol.iterator](){let e=-1;return{next:()=>({value:this[++e],done:this[e+1]===void 0})}}}function I(i,e,t=n=>n+"",r=n=>n+""){const n=[];for(const a of new ve(i,e))n.push({text:t(a),alt:r(a),value:a});return n}function ee(i,e="crontab"){const t=(n,a=!1)=>new Date(2021,n-1,1).toLocaleDateString(i,{month:a?"short":"long"}),r=(n,a=!1)=>new Date(2021,0,3+n).toLocaleDateString(i,{weekday:a?"short":"long"});return{secondItems:I(0,59,n=>z(n,2)),minuteItems:I(0,59,n=>z(n,2)),hourItems:I(0,23,n=>z(n,2)),dayItems:I(1,31),monthItems:I(1,12,t,n=>t(n,!0)),dayOfWeekItems:e==="quartz"?I(1,7,n=>r(n-1),n=>r(n-1,!0)):I(0,6,r,n=>r(n,!0))}}function z(i,e){const t=i+"";return t.length0&&Q(i,e),i}function te(i,...e){if(e.length===0)return i;for(const t of e[0])if(t in i){const r=te(i[t],...e.slice(1));if(r!==void 0)return r}}function ge(i){for(let e=1;en.value))?new X(t):null}}const N=class N{constructor(e,t,r){y(this,"field");y(this,"type",O.Range);y(this,"start");y(this,"end");this.field=e,this.start=t,this.end=r}toCron(){return`${this.start}-${this.end}`}toArray(){const e=this.start,t=this.end;return he(e,t)}get items(){return{start:this.field.itemMap[this.start],end:this.field.itemMap[this.end]}}static fromString(e,t){if(!N.re.test(e))return null;const{min:r,max:n}=t,a=e.split("-"),s=parseInt(a[0]),l=parseInt(a[1]);return s>l||sn?null:new N(t,s,l)}};y(N,"re",/^\d+-\d+$/);let V=N;const ne=(i,e,t)=>{const r=[];for(let n=e;n<=t;n+=i)r.push(n);return r},L=class L{constructor(e,t,r,n){y(this,"field");y(this,"type",O.EveryX);y(this,"every");y(this,"start");y(this,"end");this.field=e,this.every=t,this.start=r??e.min,this.end=n??e.max}toCron(){return this.start==this.field.min&&this.end==this.field.max?`*/${this.every}`:`${this.start}-${this.end}/${this.every}`}toArray(){return ne(this.every,this.start,this.end)}get items(){return{every:this.field.itemMap[this.every],start:this.field.itemMap[this.start],end:this.field.itemMap[this.end]}}static fromString(e,t){if(!L.re.test(e))return null;const[r,n]=e.split("/"),a=parseInt(n);if(a>t.items.length)return null;const s=e.split("-").map(x=>parseInt(x)),l=r=="*"?t.min:s[0],o=r=="*"?t.max:s[1];return ne(a,l,o).length==0?null:new L(t,a,l,o)}static fromArray(e,t){const{min:r,max:n}=t;if(e.length<3)return null;const a=e[1]-e[0];if(a<=1||e[0]!=r)return null;const s=e[e.length-1];if(n-s>=a)return null;for(let l=2;l=r&&a<=n?new P(t,a):null}static fromArray(e,t){const{min:r,max:n}=t;if(e.length!=1)return null;const a=e[0];return an?null:a}}const U=class U{constructor(e,t=[]){y(this,"field");y(this,"segments");this.field=e,this.segments=t}get type(){return this.segments.length==1?this.segments[0].type:O.Range}addSegment(e){this.segments.push(e)}toCron(){return this.segments.map(e=>e.toCron()).join(",")}toArray(){const e=new Set;for(const t of this.segments)t.toArray().forEach(r=>e.add(r));return Array.from(e)}get items(){return we()}static fromString(e,t){const r=t.segmentFactories??U.segmentFactories;let n=[];for(const a of e.split(",")){if(a==="*"){n=[new X(t)];break}let s=null;for(const l of r)if(s=l(a,t),s!==null)break;if(s===null)return null;n.push(s)}return new U(t,n)}static fromArray(e,t){const{min:r,max:n}=t,a=e[0],s=e[e.length-1];if(an)return null;const l=[];let o=0;for(let x=0;x1)&&(x===o?l.push(new P(t,e[o])):l.push(new V(t,e[o],e[x])),o=x+1);return new U(t,l)}};y(U,"segmentFactories",[X.fromString,j.fromString,V.fromString,P.fromString]);let F=U;function ie(i,e){return F.fromString(i,e)}function Se(i,e){for(const t of[X.fromArray,j.fromArray,F.fromArray]){const r=t(i,e);if(r!=null)return r}return null}/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js */var ke=Object.prototype.toString,E=Array.isArray||function(e){return ke.call(e)==="[object Array]"};function K(i){return typeof i=="function"}function Ce(i){return E(i)?"array":typeof i}function Y(i){return i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function ae(i,e){return i!=null&&typeof i=="object"&&e in i}function Oe(i,e){return i!=null&&typeof i!="object"&&i.hasOwnProperty&&i.hasOwnProperty(e)}var be=RegExp.prototype.test;function qe(i,e){return be.call(i,e)}var We=/\S/;function Ae(i){return!qe(We,i)}var Xe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Me(i){return String(i).replace(/[&<>"'`=\/]/g,function(t){return Xe[t]})}var $e=/\s*/,Ie=/\s+/,se=/\s*=/,Te=/\s*\}/,Ve=/#|\^|\/|>|\{|&|=|!/;function je(i,e){if(!i)return[];var t=!1,r=[],n=[],a=[],s=!1,l=!1,o="",x=0;function h(){if(s&&!l)for(;a.length;)delete n[a.pop()];else a=[];s=!1,l=!1}var p,w,M;function A(W){if(typeof W=="string"&&(W=W.split(Ie,2)),!E(W)||W.length!==2)throw new Error("Invalid tags: "+W);p=new RegExp(Y(W[0])+"\\s*"),w=new RegExp("\\s*"+Y(W[1])),M=new RegExp("\\s*"+Y("}"+W[1]))}A(e||b.tags);for(var u=new D(i),v,f,g,q,T,d;!u.eos();){if(v=u.pos,g=u.scanUntil(p),g)for(var S=0,C=g.length;S"?T=[f,g,v,u.pos,o,x,t]:T=[f,g,v,u.pos],x++,n.push(T),f==="#"||f==="^")r.push(T);else if(f==="/"){if(d=r.pop(),!d)throw new Error('Unopened section "'+g+'" at '+v);if(d[1]!==g)throw new Error('Unclosed section "'+d[1]+'" at '+v)}else f==="name"||f==="{"||f==="&"?l=!0:f==="="&&A(g)}if(h(),d=r.pop(),d)throw new Error('Unclosed section "'+d[1]+'" at '+u.pos);return Ee(Pe(n))}function Pe(i){for(var e=[],t,r,n=0,a=i.length;n0?r[r.length-1][4]:e;break;default:t.push(n)}return e}function D(i){this.string=i,this.tail=i,this.pos=0}D.prototype.eos=function(){return this.tail===""},D.prototype.scan=function(e){var t=this.tail.match(e);if(!t||t.index!==0)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r},D.prototype.scanUntil=function(e){var t=this.tail.search(e),r;switch(t){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,t),this.tail=this.tail.substring(t)}return this.pos+=r.length,r};function R(i,e){this.view=i,this.cache={".":this.view},this.parent=e}R.prototype.push=function(e){return new R(e,this)},R.prototype.lookup=function(e){var t=this.cache,r;if(t.hasOwnProperty(e))r=t[e];else{for(var n=this,a,s,l,o=!1;n;){if(e.indexOf(".")>0)for(a=n.view,s=e.split("."),l=0;a!=null&&l"?x=this.renderPartial(l,t,r,a):o==="&"?x=this.unescapedValue(l,t):o==="name"?x=this.escapedValue(l,t,a):o==="text"&&(x=this.rawValue(l)),x!==void 0&&(s+=x);return s},k.prototype.renderSection=function(e,t,r,n,a){var s=this,l="",o=t.lookup(e[1]);function x(w){return s.render(w,t,r,a)}if(o){if(E(o))for(var h=0,p=o.length;h0||!r)&&(a[s]=n+a[s]);return a.join(` `)},k.prototype.renderPartial=function(e,t,r,n){if(r){var a=this.getConfigTags(n),s=K(r)?r(e[1]):r[e[1]];if(s!=null){var l=e[6],o=e[5],x=e[4],h=s;o==0&&x&&(h=this.indentPartial(s,x,l));var p=this.parse(h,a);return this.renderTokens(p,t,r,h,n)}}},k.prototype.unescapedValue=function(e,t){var r=t.lookup(e[1]);if(r!=null)return r},k.prototype.escapedValue=function(e,t,r){var n=this.getConfigEscape(r)||b.escape,a=t.lookup(e[1]);if(a!=null)return typeof a=="number"&&n===b.escape?String(a):n(a)},k.prototype.rawValue=function(e){return e[1]},k.prototype.getConfigTags=function(e){return E(e)?e:e&&typeof e=="object"?e.tags:void 0},k.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!E(e))return e.escape};var b={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(i){H.templateCache=i},get templateCache(){return H.templateCache}},H=new k;b.clearCache=function(){return H.clearCache()},b.parse=function(e,t){return H.parse(e,t)},b.render=function(e,t,r,n){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Ce(e)+'" was given as the first argument for mustache#render(template, view, partials)');return H.render(e,t,r,n)},b.escape=Me,b.Scanner=D,b.Context=R,b.Writer=k;const le={"*":{prefix:"每",suffix:"",text:"未知","*":{empty:{text:"每 {{field.id}}"},value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"每 {{every.value}}"}},month:{"*":{prefix:"的"},empty:{text:"每月"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"的"},empty:{text:"每日"},value:{text:"{{value.alt}}号"},range:{text:"{{start.alt}}号-{{end.alt}}号"}},dayOfWeek:{"*":{prefix:"的"},empty:{text:"一周的每一天"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},hour:{"*":{prefix:"的"},empty:{text:"每小时"}},minute:{"*":{prefix:":"},empty:{text:"每分钟"}},second:{"*":{prefix:":"},empty:{text:"每秒"}}},minute:{text:"分"},hour:{text:"小时",minute:{"*":{prefix:":",suffix:"分钟"},empty:{text:"每"}}},day:{text:"天"},week:{text:"周",dayOfWeek:{"*":{prefix:"的"},empty:{text:"每天"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}}},month:{text:"月",dayOfWeek:{"*":{prefix:"和"}},day:{"*":{prefix:"的"}}},year:{text:"年",dayOfWeek:{"*":{prefix:"和"}}},"q-second":{text:"秒"},"q-minute":{text:"分钟",second:{"*":{prefix:":",suffix:"秒"},empty:{text:"每"}}},"q-hour":{text:"小时",minute:{"*":{prefix:":"}}}},G={empty:{},en:{"*":{prefix:"Every",suffix:"",text:"Unknown","*":{empty:{text:"every {{field.id}}"},value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"every {{every.value}}"}},month:{"*":{prefix:"in"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"on"},noSpecific:{text:"no specific day"}},dayOfWeek:{"*":{prefix:"on"},empty:{text:"every day of the week"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{text:"no specific day of the week"}},hour:{"*":{prefix:"at"}},minute:{"*":{prefix:":"}},second:{"*":{prefix:":"}}},minute:{text:"Minute"},hour:{text:"Hour",minute:{"*":{prefix:"at",suffix:"minute(s)"},empty:{text:"every"}}},day:{text:"Day"},week:{text:"Week"},month:{text:"Month",dayOfWeek:{"*":{prefix:"and"}}},year:{text:"Year",dayOfWeek:{"*":{prefix:"and"}}},"q-second":{text:"Second"},"q-minute":{text:"Minute",second:{"*":{prefix:"at",suffix:"second(s)"},empty:{text:"every"}}},"q-hour":{text:"Hour",minute:{"*":{prefix:"at"}}}},de:{"*":{prefix:"Jede",suffix:"",text:"Unknown","*":{value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"alle {{every.value}}"}},month:{"*":{prefix:"im"},empty:{prefix:"in",text:"jedem Monat"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"den"},empty:{prefix:"an",text:"jedem Tag"},everyX:{prefix:"",text:"alle {{every.value}} Tage"},noSpecific:{prefix:"an",text:"keinem bestimmten Tag"}},dayOfWeek:{"*":{prefix:"am"},empty:{prefix:"an",text:"jedem Wochentag"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{prefix:"und",text:"keinem bestimmten Wochentag"}},hour:{"*":{prefix:"um"},empty:{prefix:"zu",text:"jeder Stunde"},everyX:{prefix:"",text:"alle {{every.value}} Stunden"}},minute:{"*":{prefix:":"},empty:{text:"jede Minute"},everyX:{prefix:"",text:"alle {{every.value}} Minuten"}},second:{"*":{prefix:":"},empty:{text:"jede Sekunde"},everyX:{prefix:"",text:"alle {{every.value}} Sekunden"}}},minute:{text:"Minute"},hour:{text:"Stunde",minute:{"*":{prefix:"zu",suffix:"Minute(n)"},empty:{text:"jeder"}}},day:{prefix:"Jeden",text:"Tag"},week:{text:"Woche"},month:{prefix:"Jedes",text:"Monat"},year:{prefix:"Jedes",text:"Jahr"},"q-second":{text:"Sekunde"},"q-minute":{text:"Minute",second:{"*":{prefix:"und"}}},"q-hour":{text:"Stunde",minute:{"*":{prefix:"und"}},second:{"*":{prefix:"und"}}}},pt:{"*":{prefix:"Todo(a)",suffix:"",text:"Desconhecido","*":{empty:{text:"todo {{field.id}}"},value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"todo {{every.value}}"}},month:{"*":{prefix:"de"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},empty:{text:"todo mês"}},day:{"*":{prefix:"no(s) dia(s)"},empty:{text:"todos"}},dayOfWeek:{"*":{prefix:"de"},empty:{text:"todos dias da semana"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},hour:{"*":{prefix:"às"},empty:{text:"cada hora"}},minute:{"*":{prefix:":"},empty:{text:"cada minuto"}}},minute:{text:"Minuto"},hour:{text:"Hora",minute:{"*":{prefix:"e",suffix:"minuto(s)"},empty:{text:"cada"}}},day:{text:"Dia"},week:{text:"Semana"},month:{text:"Mês",dayOfWeek:{"*":{prefix:"e de"}}},year:{text:"Ano",dayOfWeek:{"*":{prefix:"e de"}}}},es:{"*":{prefix:"todos los",suffix:"",text:"Desconocido","*":{empty:{text:"todos los {{ field.id }}"},value:{text:"{{ value.text }}"},range:{text:"{{ start.text }}-{{ end.text }}"},everyX:{text:"todos/as {{ every.value }}"}},month:{"*":{prefix:"en"},empty:{text:"todos los meses"},value:{text:"{{ value.alt }}"},range:{text:"{{ start.alt }}-{{ end.alt }}"}},day:{"*":{prefix:"en"},empty:{text:"todos los días"},value:{text:"los días {{ value.alt }}"}},dayOfWeek:{"*":{prefix:"de"},empty:{text:"todos los días de la semana"},value:{text:"los {{ value.alt }}"},range:{text:"{{ start.alt }}-{{ end.alt }}"}},hour:{"*":{prefix:"a"},empty:{text:"todas las horas"},value:{text:"las {{ value.text }}"}},minute:{"*":{prefix:":"},empty:{text:"todos los minutos"}}},minute:{prefix:"todos los",text:"minutos"},hour:{prefix:"todas las",text:"horas",minute:{"*":{prefix:"a los",suffix:"minutos"},empty:{text:"todos",prefix:"a",suffix:"los minutos"}}},day:{text:"Días"},week:{text:"Semanas"},month:{text:"Meses",dayOfWeek:{"*":{prefix:"y"}}},year:{text:"años",dayOfWeek:{"*":{prefix:"y"}}}},da:{"*":{prefix:"Hver",suffix:"",text:"Ukendt","*":{value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"hver {{every.value}}"}},month:{"*":{prefix:"i"},empty:{text:"hver måned"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"og"},empty:{text:"hver dag i måneden"},value:{text:"{{value.alt}}."},range:{text:"{{start.alt}}.-{{end.alt}}."},noSpecific:{text:"ingen specifik dag"}},dayOfWeek:{"*":{prefix:"på"},empty:{text:"hver dag i ugen"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{text:"ingen specifik dag i ugen"}},hour:{"*":{prefix:"klokken"},empty:{text:"hver time"}},minute:{"*":{prefix:":"},empty:{text:"hvert minut"}},second:{"*":{prefix:":"},empty:{text:"hvert sekund"}}},second:{prefix:"Hvert"},minute:{prefix:"Hvert",text:"Minut"},hour:{text:"Time",minute:{"*":{prefix:"ved",suffix:"minutter"},empty:{text:"alle"}}},day:{text:"Dag"},week:{text:"Uge"},month:{text:"Måned",dayOfWeek:{"*":{prefix:"og"}}},year:{prefix:"Hvert",text:"År",dayOfWeek:{"*":{prefix:"og"}}},"q-second":{text:"Sekund"},"q-minute":{text:"Minut",second:{"*":{suffix:"sekund(er)"},empty:{text:"hvert"}}},"q-hour":{text:"Time",minute:{"*":{prefix:"på"}}}},zh:le,"zh-cn":le,he:{"*":{prefix:"בכל",suffix:"",text:"לא ידוע","*":{value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"כל {{every.value}}"}},month:{"*":{prefix:"ב"},empty:{text:"כל חודש"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"ב"},empty:{text:"כל יום"},value:{text:"יום {{value.alt}} לחודש"},noSpecific:{text:"ללא יום מוגדר"}},dayOfWeek:{"*":{prefix:"ב"},empty:{text:"כל יום מימות השבוע"},value:{text:"ימי {{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{text:"ללא יום בשבוע מוגדר"}},hour:{"*":{prefix:"ב"},empty:{text:"כל שעה"},value:{text:"שעה {{value.text}}"}},minute:{"*":{prefix:":"},empty:{text:"כל דקה"}},second:{"*":{prefix:":"},empty:{text:"כל שניה"}}},minute:{text:"דקה"},hour:{text:"שעה",minute:{"*":{prefix:"ב",suffix:"דקות"},empty:{text:"כל"}}},day:{text:"יום"},week:{text:"שבוע"},month:{text:"חודש",dayOfWeek:{"*":{prefix:"ו"}}},year:{text:"שנה",dayOfWeek:{"*":{prefix:"ו"}}},"q-second":{text:"שניה"},"q-minute":{text:"דקה",second:{"*":{prefix:"ב",suffix:"שניות"},empty:{text:"כל"}}},"q-hour":{text:"שעה",minute:{"*":{prefix:"ב"}}}},ru:{"*":{prefix:"Каждый",suffix:"",text:"Неизвестно","*":{value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"каждый {{every.value}}"}},month:{"*":{prefix:"в"},empty:{prefix:"в",text:"каждом месяце"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"в"},empty:{prefix:"в",text:"каждый день"},everyX:{prefix:"",text:"каждые {{every.value}} дня"},noSpecific:{prefix:"в",text:"нет определенного дня"}},dayOfWeek:{"*":{prefix:"по"},empty:{prefix:"по",text:"каждому дню недели"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{prefix:"и",text:"нет определенного дня недели"}},hour:{"*":{prefix:"в"},empty:{prefix:"в",text:"каждый час"},everyX:{prefix:"",text:"каждые {{every.value}} часа"}},minute:{"*":{prefix:":"},empty:{text:"каждую минуту"},everyX:{prefix:"",text:"каждые {{every.value}} минуты"}},second:{"*":{prefix:":"},empty:{text:"каждую секунду"},everyX:{prefix:"",text:"каждые {{every.value}} секунды"}}},minute:{text:"Минута"},hour:{text:"Час",minute:{"*":{prefix:"в",suffix:"минут(а/ы)"},empty:{text:"каждый"}}},day:{prefix:"Каждый",text:"День"},week:{text:"Неделя"},month:{prefix:"Каждый",text:"Месяц"},year:{prefix:"Каждый",text:"Год"},"q-second":{text:"Секунда"},"q-minute":{text:"Минута",second:{"*":{prefix:"и"}}},"q-hour":{text:"Час",minute:{"*":{prefix:"и"}},second:{"*":{prefix:"и"}}}},fr:{"*":{prefix:"Toutes",suffix:"",text:"Inconnu","*":{value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"tous les {{every.value}}"}},month:{"*":{prefix:"en"},empty:{prefix:"en",text:"tous les mois"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"le"},empty:{prefix:"à",text:"tous les jours"},everyX:{prefix:"",text:"tous les {{every.value}} jours"},noSpecific:{prefix:"à",text:"aucun jour particulier"}},dayOfWeek:{"*":{prefix:"le"},empty:{prefix:"à",text:"tous les jours de la semaine"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{prefix:"et",text:"aucun jour de la semaine particulier"}},hour:{"*":{prefix:"à"},empty:{prefix:"à",text:"toutes les heures"},everyX:{prefix:"",text:"toutes les {{every.value}} heures"}},minute:{"*":{prefix:":"},empty:{text:"toutes les minutes"},everyX:{prefix:"",text:"toutes les {{every.value}} minutes"}},second:{"*":{prefix:":"},empty:{text:"toutes les secondes"},everyX:{prefix:"",text:"toutes les {{every.value}} secondes"}}},minute:{text:"Minute"},hour:{text:"Heure",minute:{"*":{prefix:"à",suffix:"minute(s)"},empty:{text:"toutes"}}},day:{prefix:"Tous",text:"Jour"},week:{text:"Semaine"},month:{prefix:"Tous",text:"Mois"},year:{prefix:"Tous",text:"Année"},"q-second":{text:"Seconde"},"q-minute":{text:"Minute",second:{"*":{prefix:"et"}}},"q-hour":{text:"Heure",minute:{"*":{prefix:"et"}},second:{"*":{prefix:"et"}}}},hi:{"*":{prefix:"हर",suffix:"",text:"अज्ञात","*":{value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"{{every.value}} हर"}},month:{"*":{prefix:"में"},empty:{prefix:"के",text:"हर महीने"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"के"},empty:{prefix:"पर",text:"हर दिन"},everyX:{prefix:"",text:"{{every.value}} दिन हर"},noSpecific:{prefix:"पर",text:"कोई विशेष दिन नहीं"}},dayOfWeek:{"*":{prefix:"पर"},empty:{prefix:"पर",text:"हर सप्ताह"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{prefix:"और",text:"कोई विशेष सप्ताह नहीं"}},hour:{"*":{prefix:"को"},empty:{prefix:"पर",text:"हर घंटे"},everyX:{prefix:"",text:"{{every.value}} घंटे हर"}},minute:{"*":{prefix:":"},empty:{text:"हर मिनट"},everyX:{prefix:"",text:"{{every.value}} मिनट हर"}},second:{"*":{prefix:":"},empty:{text:"हर सेकंड"},everyX:{prefix:"",text:"{{every.value}} सेकंड हर"}}},minute:{text:"मिनट"},hour:{text:"घंटा",minute:{"*":{prefix:"पर",suffix:"मिनट"},empty:{text:"हर"}}},day:{prefix:"हर",text:"दिन"},week:{text:"सप्ताह"},month:{prefix:"हर",text:"महीना"},year:{prefix:"हर",text:"साल"},"q-second":{text:"सेकंड"},"q-minute":{text:"मिनट",second:{"*":{prefix:"और"}}},"q-hour":{text:"घंटा",minute:{"*":{prefix:"और"}},second:{"*":{prefix:"और"}}}},ja:{"*":{prefix:"毎",suffix:"",text:"不明","*":{value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"{{every.value}}ごとに"}},month:{"*":{prefix:"に"},empty:{prefix:"の",text:"毎月"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"の"},empty:{prefix:"に",text:"毎日"},everyX:{prefix:"",text:"{{every.value}}日ごとに"},noSpecific:{prefix:"に",text:"特定の日はなし"}},dayOfWeek:{"*":{prefix:"の"},empty:{prefix:"に",text:"毎週"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{prefix:"と",text:"特定の曜日はなし"}},hour:{"*":{prefix:"の"},empty:{prefix:"に",text:"毎時"},everyX:{prefix:"",text:"{{every.value}}時間ごとに"}},minute:{"*":{prefix:":"},empty:{text:"毎分"},everyX:{prefix:"",text:"{{every.value}}分ごとに"}},second:{"*":{prefix:":"},empty:{text:"毎秒"},everyX:{prefix:"",text:"{{every.value}}秒ごとに"}}},minute:{text:"分"},hour:{text:"時",minute:{"*":{prefix:"に",suffix:"分"},empty:{text:"毎"}}},day:{prefix:"毎",text:"日"},week:{text:"週"},month:{prefix:"毎",text:"月"},year:{prefix:"毎",text:"年"},"q-second":{text:"秒"},"q-minute":{text:"分",second:{"*":{prefix:"と"}}},"q-hour":{text:"時",minute:{"*":{prefix:"と"}},second:{"*":{prefix:"と"}}}},ko:{"*":{prefix:"매",suffix:"",text:"알 수 없음","*":{value:{text:"{{value.text}}"},range:{text:"{{start.text}}-{{end.text}}"},everyX:{text:"{{every.value}}마다"}},month:{"*":{prefix:"에"},empty:{prefix:"의",text:"매월"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"}},day:{"*":{prefix:"의"},empty:{prefix:"에",text:"매일"},everyX:{prefix:"",text:"{{every.value}}일마다"},noSpecific:{prefix:"에",text:"특정한 날 없음"}},dayOfWeek:{"*":{prefix:"의"},empty:{prefix:"에",text:"매주"},value:{text:"{{value.alt}}"},range:{text:"{{start.alt}}-{{end.alt}}"},noSpecific:{prefix:"과",text:"특정한 요일 없음"}},hour:{"*":{prefix:"의"},empty:{prefix:"에",text:"매시"},everyX:{prefix:"",text:"{{every.value}}시간마다"}},minute:{"*":{prefix:":"},empty:{text:"매분"},everyX:{prefix:"",text:"{{every.value}}분마다"}},second:{"*":{prefix:":"},empty:{text:"매초"},everyX:{prefix:"",text:"{{every.value}}초마다"}}},minute:{text:"분"},hour:{text:"시",minute:{"*":{prefix:"에",suffix:"분"},empty:{text:"매"}}},day:{prefix:"매",text:"일"},week:{text:"주"},month:{prefix:"매",text:"월"},year:{prefix:"매",text:"년"},"q-second":{text:"초"},"q-minute":{text:"분",second:{"*":{prefix:"와"}}},"q-hour":{text:"시",minute:{"*":{prefix:"와"}},second:{"*":{prefix:"와"}}}}};class oe{constructor(e){y(this,"dict");this.dict=e}getLocaleStr(...e){const t=e.map(r=>[r,"*"]);return te(this.dict,...t)||""}render(e,t,r,n,a){const s=this.getLocaleStr(e,t,r,n);return b.render(s,a||{})}}function ue(i,e){const[t]=i.split("-"),r=G[i.toLowerCase()]||G[t.toLowerCase()]||G.en,n=Q(r,e||{});return new oe(n)}function Re(i){const{period:e,field:t,initialCron:r="*",locale:n}=i,a=c.ref(r),s=c.ref(""),l=c.ref([]),o=c.ref(""),x=c.ref(""),h=c.ref(""),p=u=>{const v=u instanceof F?u.segments:[u];o.value=v.map(f=>n.render(e.value.id,t.id,f.type,$.Text,{field:t,...f.items})).join(","),x.value=n.getLocaleStr(e.value.id,t.id,u.type,$.Prefix),h.value=n.getLocaleStr(e.value.id,t.id,u.type,$.Suffix)},w=u=>{const v=ie(u,t);v!=null?(l.value=v.toArray(),p(v)):s.value=`${u} is not a valid cron segment (${t.id})`},M=u=>{if(a.value=="?"&&u.length==0)return;const v=Se(u,t);v!=null?(a.value=v.toCron(),p(v)):s.value=`failed to convert ${u} to cron (${t.id})`};w(r);const A=u=>{const v=Array.from(u).sort((f,g)=>f>g?1:-1);l.value=v};return c.watch(a,u=>{w(u)}),c.watch(l,u=>{M(u)}),c.watch(e,()=>{const u=ie(a.value,t);u!=null&&p(u)}),{id:t.id,items:t.items,cron:a,selected:l,error:s,select:A,text:o,prefix:x,suffix:h}}function fe(i,e="*"){return new Array(i).fill(e).join(" ")}function Le(i){return i!==void 0}class Ue{constructor(){y(this,"locale","en");y(this,"format","crontab")}initialValue(e,t="*"){return fe(e,t)}fields(e,t){const r=e=="quartz"||e=="spring",n=ee(t,e),a=s=>(l,{segmentMap:o})=>{if(l.cron.value=="?")return;const x=o.get(s);x&&(x.cron.value="?")};return[...r?[{id:"second",items:n.secondItems}]:[],{id:"minute",items:n.minuteItems},{id:"hour",items:n.hourItems},{id:"day",items:n.dayItems,onChange:r?a("dayOfWeek"):void 0,segmentFactories:r?[X.fromString,J.fromString,j.fromString,V.fromString,P.fromString]:void 0},{id:"month",items:n.monthItems},{id:"dayOfWeek",items:n.dayOfWeekItems,onChange:r?a("day"):void 0,segmentFactories:r?[X.fromString,J.fromString,j.fromString,V.fromString,P.fromString]:void 0}]}periods(e){const t=e=="quartz"||e=="spring",r=t?[{id:"q-second",value:[]}]:[],n=t?["second"]:[],a=t?"q-":"";return[...r,{id:a+"minute",value:[...n]},{id:a+"hour",value:["minute",...n]},{id:"day",value:["hour","minute",...n]},{id:"week",value:["dayOfWeek","hour","minute",...n]},{id:"month",value:["day","dayOfWeek","hour","minute",...n]},{id:"year",value:["month","day","dayOfWeek","hour","minute",...n]}]}}function Fe(i,e,t){const r=e.split(" ");if(r.length!==t.length)return;const n=t.filter((a,s)=>!["*","?"].includes(r[s])).map(a=>a.id);return i.find(a=>{const s=new Set(a.value);return n.every(l=>s.has(l))})}function ce(i){const e=new Ue,t=i.locale??e.locale,r=i.format??e.format,{customLocale:n,fields:a=e.fields(r,t)}=i,s=i.initialValue??e.initialValue(a.length),l=ue(t,n),o=(i.periods??e.periods(r)).map(d=>({...d,text:d.text??l.getLocaleStr(d.id,$.Text)})),x=(i.initialPeriod?o.find(d=>d.id==i.initialPeriod):void 0)??Fe([...o].reverse(),s,a)??o[o.length-1],h=c.ref(s),p=c.ref(""),w=c.ref(x),M=c.ref(""),A=c.ref(""),u=a.map(d=>Re({field:new _(d),locale:l,period:w})),v=new Map(u.map(d=>[d.id,d])),f=c.computed(()=>w.value.value.map(d=>{const S=v.get(d);if(Le(S))return S;throw Error("${fieldId} not found")})),g=d=>{if(!d){h.value=fe(a.length);return}const S=d.split(" ");if(S.length!==a.length){p.value="invalid pattern";return}for(let C=0;C{h.value=u.map(d=>w.value.value.includes(d.id)||d.cron.value=="?"?d.cron.value:"*").join(" ")},T=()=>{M.value=l.getLocaleStr(w.value.id,$.Prefix),A.value=l.getLocaleStr(w.value.id,$.Suffix)};return T(),c.watch(h,g),c.watch(w,()=>{q(),T()}),u.forEach((d,S)=>{c.watch(d.cron,()=>{var C,W;(W=(C=a[S]).onChange)==null||W.call(C,d,{segmentMap:v}),q()}),c.watch(d.error,C=>{p.value=C})}),{cron:h,error:p,segments:u,selected:f,period:{select:d=>{const S=o.map(C=>C.id).indexOf(d);S!=-1&&(w.value=o[S])},selected:w,items:o,prefix:M,suffix:A}}}function xe(i,{emit:e}){const t={...i,initialValue:i.modelValue,initialPeriod:i.period},r=ce(t);return c.watch(()=>i.modelValue,n=>{n&&(r.cron.value=n)}),c.watch(()=>i.period,n=>{n&&r.period.select(n)}),c.watch(r.cron,n=>{e("update:model-value",n)}),c.watch(r.period.selected,n=>{e("update:period",n.id)}),c.watch(r.error,n=>{e("error",n)}),r}const pe=()=>({modelValue:{type:String},period:{type:String},format:{type:String},locale:{type:String},fields:{type:Array},periods:{type:Array},customLocale:{type:Object},cols:{type:Object,default:()=>({second:5,minute:5,hour:4,day:4})},disabled:{type:Boolean,default:!1}}),de=c.defineComponent({name:"VueCronCore",props:pe(),emits:["update:model-value","update:period","error"],setup(i,e){const{error:t,selected:r,period:n}=xe(i,e);return()=>{var s,l;const a={error:t,fields:r.value.map(o=>({id:o.id,items:o.items,cron:o.cron.value,selectedStr:o.text.value,events:{"update:model-value":o.select},attrs:{modelValue:o.selected.value},prefix:o.prefix.value,suffix:o.suffix.value})),period:{attrs:{modelValue:n.selected.value.id},events:{"update:model-value":n.select},items:n.items,prefix:n.prefix.value,suffix:n.suffix.value}};return(l=(s=e.slots).default)==null?void 0:l.call(s,a)}}});function De(i){const{items:e}=i,t=new Set,r=c.ref(0),n=()=>{r.value=r.value+1},a=p=>{e.indexOf(p)!=-1&&(t.add(p),n())},s=p=>t.has(p),l=p=>{t.delete(p)&&n()};return{values:t,add:a,toggle:p=>{s(p)?l(p):a(p)},remove:l,clear:()=>{t.clear(),n()},updated:r,equals:p=>{if(p.length!=t.size)return!1;for(const w of p)if(!t.has(w))return!1;return!0}}}function me(){return{modelValue:{type:[String,Number,Array]},selection:{type:String},clearable:{type:Boolean,default:!1},items:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},cols:{type:Number,default:1},itemText:{type:[String,Function],default:"text"},itemValue:{type:[String,Function],default:"value"},disabled:{type:Boolean,default:!1}}}function Z(i){const{items:e,cols:t=1,multiple:r=!1,itemText:n="text",itemValue:a="value"}=i,s=De(i),l=r?c.ref([]):c.ref(null),o=c.ref(""),x=f=>{r?s.toggle(f):(s.clear(),s.add(f))},h=f=>{if(f===null)return!1;const g=p(f);return Array.isArray(l.value)?l.value.includes(g):l.value===g},p=f=>typeof a=="function"?a(f):f[a],w=f=>typeof n=="function"?n(f):f[n],M=new Map(e.map(f=>[p(f),f])),A=f=>{s.equals(f)||(s.clear(),f.forEach(g=>x(g)))},u=f=>{f=Array.isArray(f)?f:[f];const g=f.map(q=>M.get(q)).filter(q=>!!q);A(g)};c.watch(s.updated,()=>{const f=Array.from(s.values);l.value=r?f.map(p):p(f[0]),o.value=f.map(w).join(",")});const v=c.computed(()=>r?!Array.isArray(l.value)||l.value.length==0:!!l.value);return{...s,select:x,selected:l,selectedStr:o,itemRows:re(e,t),setItems:A,setValues:u,isEmpty:v,has:h}}function He(i,e,{emit:t}){const r=Z(i);return c.watch(r.selected,()=>{t("update:model-value",r.selected.value)}),c.watch(e,n=>{n&&r.setValues(n)},{immediate:!0}),r}const Ne=c.defineComponent({name:"RenderlessSelect",props:{...me(),modelValue:{type:[String,Number,Array]},selection:{type:String},clearable:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(i,{emit:e,slots:t}){const r=Z(i);return c.watch(r.selected,()=>{e("update:modelValue",r.selected.value)}),c.watch(()=>i.modelValue,n=>{n&&r.setValues(n)},{immediate:!0}),()=>{var a;const n={selectedStr:i.selection||r.selectedStr.value,modelValue:i.modelValue,items:i.items,select:r.select,isSelected:r.has,clearable:i.clearable&&!r.isEmpty.value,clear:r.clear,cols:i.cols,rows:r.itemRows.length,itemRows:r.itemRows,multiple:i.multiple,itemText:i.itemText,itemValue:i.itemValue};return(a=t.default)==null?void 0:a.call(t,n)}}}),ye={install:i=>{i.component("CronCore",de)}};m.CronCore=de,m.CronCorePlugin=ye,m.CronType=O,m.FieldWrapper=_,m.Locale=oe,m.RenderlessSelect=Ne,m.TextPosition=$,m.cronCoreProps=pe,m.default=ye,m.defaultItems=ee,m.genItems=I,m.getLocale=ue,m.pad=z,m.selectProps=me,m.setupCron=xe,m.setupSelect=He,m.splitArray=re,m.useCron=ce,m.useSelect=Z,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); //# sourceMappingURL=core.umd.cjs.map