platypush/platypush/backend/http/webapp/dist/static/js/1869.dfb6d223.js

2 lines
49 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[1869],{2458:function(e){(function(t,n){e.exports=n()})(globalThis,(()=>(()=>{"use strict";var e={794:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CronParser=void 0;var i=n(586),r=function(){function e(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!1),this.expression=e,this.dayOfWeekStartIndexZero=t,this.monthStartIndexZero=n}return e.prototype.parse=function(){var e=this.extractParts(this.expression);return this.normalize(e),this.validate(e),e},e.prototype.extractParts=function(e){if(!this.expression)throw new Error("cron expression is empty");for(var t=e.trim().split(/[ ]+/),n=0;n<t.length;n++)if(t[n].includes(",")){var i=t[n].split(",").map((function(e){return e.trim()})).filter((function(e){return""!==e})).map((function(e){return isNaN(Number(e))?e:Number(e)})).filter((function(e){return null!==e&&""!==e}));0===i.length&&i.push("*"),i.sort((function(e,t){return null!==e&&null!==t?e-t:0})),t[n]=i.map((function(e){return null!==e?e.toString():""})).join(",")}if(t.length<5)throw new Error("Expression has only ".concat(t.length," part").concat(1==t.length?"":"s",". At least 5 parts are required."));if(5==t.length)t.unshift(""),t.push("");else if(6==t.length){var r=/\d{4}$/.test(t[5])||"?"==t[4]||"?"==t[2];r?t.unshift(""):t.push("")}else if(t.length>7)throw new Error("Expression has ".concat(t.length," parts; too many!"));return t},e.prototype.normalize=function(e){var t=this;if(e[3]=e[3].replace("?","*"),e[5]=e[5].replace("?","*"),e[2]=e[2].replace("?","*"),0==e[0].indexOf("0/")&&(e[0]=e[0].replace("0/","*/")),0==e[1].indexOf("0/")&&(e[1]=e[1].replace("0/","*/")),0==e[2].indexOf("0/")&&(e[2]=e[2].replace("0/","*/")),0==e[3].indexOf("1/")&&(e[3]=e[3].replace("1/","*/")),0==e[4].indexOf("1/")&&(e[4]=e[4].replace("1/","*/")),0==e[6].indexOf("1/")&&(e[6]=e[6].replace("1/","*/")),e[5]=e[5].replace(/(^\d)|([^#/\s]\d)/g,(function(e){var n=e.replace(/\D/,""),i=n;return t.dayOfWeekStartIndexZero?"7"==n&&(i="0"):i=(parseInt(n)-1).toString(),e.replace(n,i)})),"L"==e[5]&&(e[5]="6"),"?"==e[3]&&(e[3]="*"),e[3].indexOf("W")>-1&&(e[3].indexOf(",")>-1||e[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var i in n)e[5]=e[5].replace(new RegExp(i,"gi"),n[i].toString());e[4]=e[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,(function(e){var n=e.replace(/\D/,""),i=n;return t.monthStartIndexZero&&(i=(parseInt(n)+1).toString()),e.replace(n,i)}));var r={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var a in r)e[4]=e[4].replace(new RegExp(a,"gi"),r[a].toString());"0"==e[0]&&(e[0]=""),/\*|\-|\,|\//.test(e[2])||!/\*|\//.test(e[1])&&!/\*|\//.test(e[0])||(e[2]+="-".concat(e[2]));for(var o=0;o<e.length;o++)if(-1!=e[o].indexOf(",")&&(e[o]=e[o].split(",").filter((function(e){return""!==e})).join(",")||"*"),"*/1"==e[o]&&(e[o]="*"),e[o].indexOf("/")>-1&&!/^\*|\-|\,/.test(e[o])){var s=null;switch(o){case 4:s="12";break;case 5:s="6";break;case 6:s="9999";break;default:s=null;break}if(null!==s){var l=e[o].split("/");e[o]="".concat(l[0],"-").concat(s,"/").concat(l[1])}}},e.prototype.validate=function(e){this.assertNoInvalidCharacters("DOW",e[5]),this.assertNoInvalidCharacters("DOM",e[3]),this.validateRange(e)},e.prototype.validateRange=function(e){i.default.secondRange(e[0]),i.default.minuteRange(e[1]),i.default.hourRange(e[2]),i.default.dayOfMonthRange(e[3]),i.default.monthRange(e[4],this.monthStartIndexZero),i.default.dayOfWeekRange(e[5],this.dayOfWeekStartIndexZero)},e.prototype.assertNoInvalidCharacters=function(e,t){var n=t.match(/[A-KM-VX-Z]+/gi);if(n&&n.length)throw new Error("".concat(e," part contains invalid values: '").concat(n.toString(),"'"))},e}();t.CronParser=r},728:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExpressionDescriptor=void 0;var i=n(910),r=n(794),a=function(){function e(t,n){if(this.expression=t,this.options=n,this.expressionParts=new Array(5),!this.options.locale&&e.defaultLocale&&(this.options.locale=e.defaultLocale),!e.locales[this.options.locale]){var i=Object.keys(e.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(i,"'.")),this.options.locale=i}this.i18n=e.locales[this.options.locale],void 0===n.use24HourTimeFormat&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var i=void 0===n?{}:n,r=i.throwExceptionOnParseError,a=void 0===r||r,o=i.verbose,s=void 0!==o&&o,l=i.dayOfWeekStartIndexZero,u=void 0===l||l,c=i.monthStartIndexZero,p=void 0!==c&&c,d=i.use24HourTimeFormat,h=i.locale,m=void 0===h?null:h,f=i.tzOffset,v=void 0===f?0:f,g={throwExceptionOnParseError:a,verbose:s,dayOfWeekStartIndexZero:u,monthStartIndexZero:p,use24HourTimeFormat:d,locale:m,tzOffset:v},y=new e(t,g);return y.getFullDescription()},e.initialize=function(t,n){void 0===n&&(n="en"),e.specialCharacters=["/","-",",","*"],e.defaultLocale=n,t.load(e.locales)},e.prototype.getFullDescription=function(){var e="";try{var t=new r.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);this.expressionParts=t.parse();var n=this.getTimeOfDayDescription(),i=this.getDayOfMonthDescription(),a=this.getMonthDescription(),o=this.getDayOfWeekDescription(),s=this.getYearDescription();e+=n+i+o+a+s,e=this.transformVerbosity(e,!!this.options.verbose),e=e.charAt(0).toLocaleUpperCase()+e.substr(1)}catch(l){if(this.options.throwExceptionOnParseError)throw"".concat(l);e=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD()}return e},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],r=this.expressionParts[2],a="";if(i.StringUtilities.containsAny(n,e.specialCharacters)||i.StringUtilities.containsAny(r,e.specialCharacters)||i.StringUtilities.containsAny(t,e.specialCharacters))if(t||!(n.indexOf("-")>-1)||n.indexOf(",")>-1||n.indexOf("/")>-1||i.StringUtilities.containsAny(r,e.specialCharacters))if(!t&&r.indexOf(",")>-1&&-1==r.indexOf("-")&&-1==r.indexOf("/")&&!i.StringUtilities.containsAny(n,e.specialCharacters)){var o=r.split(",");a+=this.i18n.at();for(var s=0;s<o.length;s++)a+=" ",a+=this.formatTime(o[s],n,""),s<o.length-2&&(a+=","),s==o.length-2&&(a+=this.i18n.spaceAnd())}else{var l=this.getSecondsDescription(),u=this.getMinutesDescription(),c=this.getHoursDescription();if(a+=l,a&&u&&(a+=", "),a+=u,u===c)return a;a&&c&&(a+=", "),a+=c}else{var p=n.split("-");a+=i.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(r,p[0],""),this.formatTime(r,p[1],""))}else a+=this.i18n.atSpace()+this.formatTime(r,n,t);return a},e.prototype.getSecondsDescription=function(){var e=this,t=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),(function(e){return e}),(function(t){return i.StringUtilities.format(e.i18n.everyX0Seconds(t),t)}),(function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()}),(function(t){return"0"==t?"":parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute(t):e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute(t)}));return t},e.prototype.getMinutesDescription=function(){var e=this,t=this.expressionParts[0],n=this.expressionParts[2],r=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),(function(e){return e}),(function(t){return i.StringUtilities.format(e.i18n.everyX0Minutes(t),t)}),(function(t){return e.i18n.minutesX0ThroughX1PastTheHour()}),(function(i){try{return"0"==i&&-1==n.indexOf("/")&&""==t?e.i18n.everyHour():parseInt(i)<20?e.i18n.atX0MinutesPastTheHour(i):e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour(i)}catch(r){return e.i18n.atX0MinutesPastTheHour(i)}}));return r},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2],n=this.getSegmentDescription(t,this.i18n.everyHour(),(function(t){return e.formatTime(t,"0","")}),(function(t){return i.StringUtilities.format(e.i18n.everyX0Hours(t),t)}),(function(t){return e.i18n.betweenX0AndX1()}),(function(t){return e.i18n.atX0()}));if(n&&t.includes("-")&&"0"!=this.expressionParts[1]){var r=Array.from(n.matchAll(/:00/g));if(r.length>1){var a=r[r.length-1].index;n=n.substring(0,a)+":59"+n.substring(a+3)}}return n},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek(),n=null;return n="*"==this.expressionParts[5]?"":this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),(function(n,i){var r=n;n.indexOf("#")>-1?r=n.substring(0,n.indexOf("#")):n.indexOf("L")>-1&&(r=r.replace("L",""));var a=parseInt(r);if(e.options.tzOffset){var o=e.expressionParts[2],s=parseInt(o)+(e.options.tzOffset?e.options.tzOffset:0);s>=24?a++:s<0&&a--,a>6?a=0:a<0&&(a=6)}var l=e.i18n.daysOfTheWeekInCase?e.i18n.daysOfTheWeekInCase(i)[a]:t[a];if(n.indexOf("#")>-1){var u=null,c=n.substring(n.indexOf("#")+1),p=n.substring(0,n.indexOf("#"));switch(c){case"1":u=e.i18n.first(p);break;case"2":u=e.i18n.second(p);break;case"3":u=e.i18n.third(p);break;case"4":u=e.i18n.fourth(p);break;case"5":u=e.i18n.fifth(p);break}l=u+" "+l}return l}),(function(t){return 1==parseInt(t)?"":i.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(t),t)}),(function(t){var n=t.substring(0,t.indexOf("-")),i="*"!=e.expressionParts[3];return i?e.i18n.commaAndX0ThroughX1(n):e.i18n.commaX0ThroughX1(n)}),(function(t){var n=null;if(t.indexOf("#")>-1){var i=t.substring(t.indexOf("#")+1);n=e.i18n.commaOnThe(i).trim()+e.i18n.spaceX0OfTheMonth()}else if(t.indexOf("L")>-1)n=e.i18n.commaOnTheLastX0OfTheMonth(t.replace("L",""));else{var r="*"!=e.expressionParts[3];n=r?e.i18n.commaAndOnX0():e.i18n.commaOnlyOnX0(t)}return n})),n},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear(),n=this.getSegmentDescription(this.expressionParts[4],"",(function(n,i){return i&&e.i18n.monthsOfTheYearInCase?e.i18n.monthsOfTheYearInCase(i)[parseInt(n)-1]:t[parseInt(n)-1]}),(function(t){return 1==parseInt(t)?"":i.StringUtilities.format(e.i18n.commaEveryX0Months(t),t)}),(function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()}),(function(t){return e.i18n.commaOnlyInMonthX0?e.i18n.commaOnlyInMonthX0():e.i18n.commaOnlyInX0()}));return n},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case"L":t=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var r=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(r){var a=parseInt(r[0].replace("W","")),o=1==a?this.i18n.firstWeekday():i.StringUtilities.format(this.i18n.weekdayNearestDayX0(),a.toString());t=i.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),o);break}var s=n.match(/L-(\d{1,2})/);if(s){var l=s[1];t=i.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(l),l);break}if("*"==n&&"*"!=this.expressionParts[5])return"";t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),(function(t){return"L"==t?e.i18n.lastDay():e.i18n.dayX0?i.StringUtilities.format(e.i18n.dayX0(),t):t}),(function(t){return"1"==t?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days(t)}),(function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth(t)}),(function(t){return e.i18n.commaOnDayX0OfTheMonth(t)}));break}return t},e.prototype.getYearDescription=function(){var e=this,t=this.getSegmentDescription(this.expressionParts[6],"",(function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e}),(function(t){return i.StringUtilities.format(e.i18n.commaEveryX0Years(t),t)}),(function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()}),(function(t){return e.i18n.commaOnlyInYearX0?e.i18n.commaOnlyInYearX0():e.i18n.commaOnlyInX0()}));return t},e.prototype.getSegmentDescription=function(e,t,n,r,a,o){var s=null,l=e.indexOf("/")>-1,u=e.indexOf("-")>-1,c=e.indexOf(",")>-1;if(e)if("*"===e)s=t;else if(l||u||c)if(c){for(var p=e.split(","),d="",h=0;h<p.length;h++)if(h>0&&p.length>2&&(d+=",",h<p.length-1&&(d+=" ")),h>0&&p.length>1&&(h==p.length-1||2==p.length)&&(d+="".concat(this.i18n.spaceAnd()," ")),p[h].indexOf("/")>-1||p[h].indexOf("-")>-1){var m=p[h].indexOf("-")>-1&&-1==p[h].indexOf("/"),f=this.getSegmentDescription(p[h],t,n,r,m?this.i18n.commaX0ThroughX1:a,o);m&&(f=f.replace(", ","")),d+=f}else d+=l?this.getSegmentDescription(p[h],t,n,r,a,o):n(p[h]);s=l?d:i.StringUtilities.format(o(e),d)}else if(l){p=e.split("/");if(s=i.StringUtilities.format(r(p[1]),p[1]),p[0].indexOf("-")>-1){var v=this.generateRangeSegmentDescription(p[0],a,n);0!=v.indexOf(", ")&&(s+=", "),s+=v}else if(-1==p[0].indexOf("*")){var g=i.StringUtilities.format(o(p[0]),n(p[0]));g=g.replace(", ",""),s+=i.StringUtilities.format(this.i18n.commaStartingX0(),g)}}else u&&(s=this.generateRangeSegmentDescription(e,a,n));else s=i.StringUtilities.format(o(e),n(e));else s="";return s},e.prototype.generateRangeSegmentDescription=function(e,t,n){var r="",a=e.split("-"),o=n(a[0],1),s=n(a[1],2),l=t(e);return r+=i.StringUtilities.format(l,o,s),r},e.prototype.formatTime=function(e,t,n){var i=0,r=0;this.options.tzOffset&&(i=this.options.tzOffset>0?Math.floor(this.options.tzOffset):Math.ceil(this.options.tzOffset),r=parseFloat((this.options.tzOffset%1).toFixed(2)),0!=r&&(r*=60));var a=parseInt(e)+i,o=parseInt(t)+r;o>=60?(o-=60,a+=1):o<0&&(o+=60,a-=1),a>=24?a-=24:a<0&&(a=24+a);var s="",l=!1;this.options.use24HourTimeFormat||(l=!(!this.i18n.setPeriodBeforeTime||!this.i18n.setPeriodBeforeTime()),s=l?"".concat(this.getPeriod(a)," "):" ".concat(this.getPeriod(a)),a>12&&(a-=12),0===a&&(a=12));var u="";return n&&(u=":".concat(("00"+n).substring(n.length))),"".concat(l?s:"").concat(("00"+a.toString()).substring(a.toString().length),":").concat(("00"+o.toString()).substring(o.toString().length)).concat(u).concat(l?"":s)},e.prototype.transformVerbosity=function(e,t){return t||(e=e.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),e=e.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),e=e.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),e=e.replace(/\, ?$/,"")),e},e.prototype.getPeriod=function(e){return e>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},e.locales={},e}();t.ExpressionDescriptor=a},336:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.enLocaleLoader=void 0;var i=n(751),r=function(){function e(){}return e.prototype.load=function(e){e["en"]=new i.en},e}();t.enLocaleLoader=r},751:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.en=void 0;var n=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occured when generating the expression description. Check the cron expression syntax."},e.prototype.everyMinute=function(){return"every minute"},e.prototype.everyHour=function(){return"every hour"},e.prototype.atSpace=function(){return"At "},e.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},e.prototype.at=function(){return"At"},e.prototype.spaceAnd=function(){return" and"},e.prototype.everySecond=function(){return"every second"},e.prototype.everyX0Seconds=function(){return"every %s seconds"},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},e.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},e.prototype.everyX0Minutes=function(){return"every %s minutes"},e.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},e.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},e.prototype.everyX0Hours=function(){return"every %s hours"},e.prototype.betweenX0AndX1=function(){return"between %s and %s"},e.prototype.atX0=function(){return"at %s"},e.prototype.commaEveryDay=function(){return", every day"},e.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},e.prototype.commaX0ThroughX1=function(){return", %s through %s"},e.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},e.prototype.first=function(){return"first"},e.prototype.second=function(){return"second"},e.prototype.third=function(){return"third"},e.prototype.fourth=function(){return"fourth"},e.prototype.fifth=function(){return"fifth"},e.prototype.commaOnThe=function(){return", on the "},e.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},e.prototype.lastDay=function(){return"the last day"},e.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},e.prototype.commaOnlyOnX0=function(){return", only on %s"},e.prototype.commaAndOnX0=function(){return", and on %s"},e.prototype.commaEveryX0Months=function(){return", every %s months"},e.prototype.commaOnlyInX0=function(){return", only in %s"},e.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},e.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},e.prototype.firstWeekday=function(){return"first weekday"},e.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},e.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},e.prototype.commaEveryX0Days=function(){return", every %s days"},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},e.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},e.prototype.commaEveryHour=function(){return", every hour"},e.prototype.commaEveryX0Years=function(){return", every %s years"},e.prototype.commaStartingX0=function(){return", starting %s"},e.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},e.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},e}();t.en=n},586:(e,t)=>{function n(e,t){if(!e)throw new Error(t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.secondRange=function(e){for(var t=e.split(","),i=0;i<t.length;i++)if(!isNaN(parseInt(t[i],10))){var r=parseInt(t[i],10);n(r>=0&&r<=59,"seconds part must be >= 0 and <= 59")}},e.minuteRange=function(e){for(var t=e.split(","),i=0;i<t.length;i++)if(!isNaN(parseInt(t[i],10))){var r=parseInt(t[i],10);n(r>=0&&r<=59,"minutes part must be >= 0 and <= 59")}},e.hourRange=function(e){for(var t=e.split(","),i=0;i<t.length;i++)if(!isNaN(parseInt(t[i],10))){var r=parseInt(t[i],10);n(r>=0&&r<=23,"hours part must be >= 0 and <= 23")}},e.dayOfMonthRange=function(e){for(var t=e.split(","),i=0;i<t.length;i++)if(!isNaN(parseInt(t[i],10))){var r=parseInt(t[i],10);n(r>=1&&r<=31,"DOM part must be >= 1 and <= 31")}},e.monthRange=function(e,t){for(var i=e.split(","),r=0;r<i.length;r++)if(!isNaN(parseInt(i[r],10))){var a=parseInt(i[r],10);n(a>=1&&a<=12,t?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},e.dayOfWeekRange=function(e,t){for(var i=e.split(","),r=0;r<i.length;r++)if(!isNaN(parseInt(i[r],10))){var a=parseInt(i[r],10);n(a>=0&&a<=6,t?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},e}();t["default"]=i},910:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StringUtilities=void 0;var n=function(){function e(){}return e.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return e.replace(/%s/g,(function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return t.shift()}))},e.containsAny=function(e,t){return t.some((function(t){return e.indexOf(t)>-1}))},e}();t.StringUtilities=n}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}var i={};return(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.toString=void 0;var t=n(728),r=n(336);t.ExpressionDescriptor.initialize(new r.enLocaleLoader),e["default"]=t.ExpressionDescriptor;var a=t.ExpressionDescriptor.toString;e.toString=a})(),i})()))},2381:function(e,t,n){"use strict";n.d(t,{Z:function(){return M}});var i=n(6252),r=n(3577);const a=e=>((0,i.dD)("data-v-0f0ae058"),e=e(),(0,i.Cn)(),e),o={class:"browser"},s={class:"nav",ref:"nav"},l=["onClick"],u={class:"token"},c={key:0,class:"separator"},p=a((()=>(0,i._)("i",{class:"fa fa-chevron-right"},null,-1))),d=[p],h={class:"items",ref:"items"},m=a((()=>(0,i._)("div",{class:"col-10 left side"},[(0,i._)("i",{class:"icon fa fa-folder"}),(0,i._)("span",{class:"name"},"..")],-1))),f=[m],v=["onClick"],g={class:"col-10"},y={class:"name"},w={key:0,class:"col-2 actions"};function _(e,t,n,a,p,m){const _=(0,i.up)("Loading"),x=(0,i.up)("DropdownItem"),b=(0,i.up)("Dropdown");return(0,i.wg)(),(0,i.iD)("div",o,[p.loading?((0,i.wg)(),(0,i.j4)(_,{key:0})):(0,i.kq)("",!0),(0,i._)("div",s,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(m.pathTokens,((e,t)=>((0,i.wg)(),(0,i.iD)("span",{class:"path",key:t,onClick:e=>p.path=m.pathTokens.slice(0,t+1).join("/").slice(1)},[(0,i._)("span",u,(0,r.zw)(e),1),(t>0||m.pathTokens.length>1)&&t<m.pathTokens.length-1?((0,i.wg)(),(0,i.iD)("span",c,d)):(0,i.kq)("",!0)],8,l)))),128))],512),(0,i._)("div",h,[p.path?.length&&"/"!==p.path||n.hasBack?((0,i.wg)(),(0,i.iD)("div",{key:0,class:"row item",onClick:t[0]||(t[0]=(...e)=>m.onBack&&m.onBack(...e))},f)):(0,i.kq)("",!0),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(m.filteredFiles,((t,n)=>((0,i.wg)(),(0,i.iD)("div",{class:"row item",key:n,onClick:e=>m.onItemSelect(t)},[(0,i._)("div",g,[(0,i._)("i",{class:(0,r.C_)(["icon fa",{"fa-file":"directory"!==t.type,"fa-folder":"directory"===t.type}])},null,2),(0,i._)("span",y,(0,r.zw)(t.name),1)]),m.fileActions.length?((0,i.wg)(),(0,i.iD)("div",w,[(0,i.Wm)(b,null,{default:(0,i.w5)((()=>[m.hasPlay&&"directory"!==t.type?((0,i.wg)(),(0,i.j4)(x,{key:0,"icon-class":"fa fa-play",text:"Play",onClick:n=>e.$emit("play",{type:"file",url:`file://${t.path}`})},null,8,["onClick"])):(0,i.kq)("",!0)])),_:2},1024)])):(0,i.kq)("",!0)],8,v)))),128))],512)])}var x=n(6791),b=n(8637),D=n(1065),k=n(2787),O=n(815),I={name:"Browser",components:{DropdownItem:O.Z,Dropdown:k.Z,Loading:x.Z},mixins:[b.Z,D.Z],emits:["back","path-change","play","input"],props:{hasBack:{type:Boolean,default:!1},initialPath:{type:String},isMedia:{type:Boolean},filter:{type:String,default:""}},data(){return{loading:!1,path:this.initialPath,files:[]}},computed:{filteredFiles(){return this.filter?.length?this.files.filter((e=>(e?.name||"").toLowerCase().indexOf(this.filter.toLowerCase())>=0)):this.files},hasPlay(){return this.isMedia&&this.files.some((e=>this.mediaExtensions.has(e.name.split(".").pop()?.toLowerCase())))},fileActions(){return this.hasPlay?[{iconClass:"fa fa-play",text:"Play",onClick:e=>this.$emit("play",{type:"file",url:`file://${e.path}`})}]:[]},pathTokens(){return this.path?.length?["/",...this.path.split(/(?<!\\)\//).slice(1)]:["/"]}},methods:{async refresh(){this.loading=!0,this.$nextTick((()=>{this.$refs.nav.scrollLeft=99999,this.$refs.items.scrollTop=0}));try{this.files=await this.request("file.list",{path:this.path}),this.$emit("path-change",this.path)}finally{this.loading=!1}},onBack(){this.path?.length&&"/"!==this.path?this.path=[...this.pathTokens].slice(0,-1).join("/").slice(1):this.$emit("back")},onItemSelect(e){"directory"===e.type?this.path=e.path:this.$emit("input",e.path)}},watch:{initialPath(){this.path=this.initialPath},path(){this.refresh()}},mounted(){this.refresh()}},S=n(3744);const T=(0,S.Z)(I,[["render",_],["__scopeId","data-v-0f0ae058"]]);var M=T},1065:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});n(7658);var i=n(8637),r={name:"Utils",mixins:[i.Z],computed:{audioExtensions(){return new Set(["3gp","aa","aac","aax","act","aiff","amr","ape","au","awb","dct","dss","dvf","flac","gsm","iklax","ivs","m4a","m4b","m4p","mmf","mp3","mpc","msv","nmf","nsf","ogg,","opus","ra,","raw","sln","tta","vox","wav","wma","wv","webm","8svx"])},videoExtensions(){return new Set(["webm","mkv","flv","flv","vob","ogv","ogg","drc","gif","gifv","mng","avi","mts","m2ts","mov","qt","wmv","yuv","rm","rmvb","asf","amv","mp4","m4p","m4v","mpg","mp2","mpeg","mpe","mpv","mpg","mpeg","m2v","m4v","svi","3gp","3g2","mxf","roq","nsv","flv","f4v","f4p","f4a","f4b"])},mediaExtensions(){return new Set([...this.videoExtensions,...this.audioExtensions])}},methods:{convertTime(e){e=parseFloat(e);const t={};t.h=""+parseInt(e/3600),t.m=""+parseInt(e/60-60*t.h),t.s=""+parseInt(e-(3600*t.h+60*t.m));for(const i of["m","s"])parseInt(t[i])<10&&(t[i]="0"+t[i]);const n=[];return parseInt(t.h)&&n.push(t.h),n.push(t.m,t.s),n.join(":")},async startStreaming(e,t,n=!1){let i=e,r=null;e instanceof Object?(i=e.url,r=e.subtitles):e={url:i};const a=await this.request(`${t}.start_streaming`,{media:i,subtitles:r,download:n});return{...e,...a}},async stopStreaming(e,t){await this.request(`${t}.stop_streaming`,{media_id:e})}}};const a=r;var o=a},4358:function(e,t,n){"use strict";n.d(t,{Z:function(){return y}});var i=n(6252),r=n(3577),a=n(9963);const o={class:"slider-wrapper"},s=["textContent"],l=["textContent"],u={class:"slider-container"},c=["min","max","step","disabled","value"],p={class:"track-inner",ref:"track"},d={class:"thumb",ref:"thumb"},h=["textContent"];function m(e,t,n,m,f,v){return(0,i.wg)(),(0,i.iD)("label",o,[n.withRange?((0,i.wg)(),(0,i.iD)("span",{key:0,class:(0,r.C_)(["range-labels",{"with-label":n.withLabel}])},[n.withRange?((0,i.wg)(),(0,i.iD)("span",{key:0,class:"label left",textContent:(0,r.zw)(n.range[0])},null,8,s)):(0,i.kq)("",!0),n.withRange?((0,i.wg)(),(0,i.iD)("span",{key:1,class:"label right",textContent:(0,r.zw)(n.range[1])},null,8,l)):(0,i.kq)("",!0)],2)):(0,i.kq)("",!0),(0,i._)("span",u,[(0,i._)("input",{class:(0,r.C_)(["slider",{"with-label":n.withLabel}]),type:"range",min:n.range[0],max:n.range[1],step:n.step,disabled:n.disabled,value:n.value,ref:"range",onInput:t[0]||(t[0]=(0,a.iM)(((...e)=>v.onUpdate&&v.onUpdate(...e)),["stop"])),onChange:t[1]||(t[1]=(0,a.iM)(((...e)=>v.onUpdate&&v.onUpdate(...e)),["stop"]))},null,42,c),(0,i._)("div",{class:(0,r.C_)(["track",{"with-label":n.withLabel}])},[(0,i._)("div",p,null,512)],2),(0,i._)("div",d,null,512),n.withLabel?((0,i.wg)(),(0,i.iD)("span",{key:0,class:"label",textContent:(0,r.zw)(n.value),ref:"label"},null,8,h)):(0,i.kq)("",!0)])])}var f={name:"Slider",emits:["input","change","mouseup","mousedown","touchstart","touchend","keyup","keydown"],props:{value:{type:Number},disabled:{type:Boolean,default:!1},range:{type:Array,default:()=>[0,100]},step:{type:Number,default:1},withLabel:{type:Boolean,default:!1},withRange:{type:Boolean,default:!1}},methods:{onUpdate(e){this.update(e.target.value),this.$emit(e.type,{...e,target:{...e.target,value:this.$refs.range.value}})},update(e){const t=this.$refs.range.clientWidth,n=(e-this.range[0])/(this.range[1]-this.range[0]),i=n*t,r=this.$refs.thumb;r.style.left=i-r.clientWidth/2+"px",this.$refs.thumb.style.transform=`translate(-${n}%, -50%)`,this.$refs.track.style.width=`${i}px`}},mounted(){null!=this.value&&this.update(this.value),this.$watch((()=>this.value),(e=>this.update(e)))}},v=n(3744);const g=(0,v.Z)(f,[["render",m],["__scopeId","data-v-4b38623f"]]);var y=g},7514:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var i=n(6252),r=n(3577),a=n(9963);const o=e=>((0,i.dD)("data-v-eff375b6"),e=e(),(0,i.Cn)(),e),s=["checked","id"],l=o((()=>(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1))),u={class:"label"};function c(e,t,n,o,c,p){return(0,i.wg)(),(0,i.iD)("div",{class:(0,r.C_)(["power-switch",{disabled:n.disabled}]),onClick:t[0]||(t[0]=(0,a.iM)(((...e)=>p.onInput&&p.onInput(...e)),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:n.value,id:n.id},null,8,s),(0,i._)("label",null,[l,(0,i._)("span",u,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var p={name:"ToggleSwitch",emits:["input"],props:{id:{type:String},value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput(e){if(this.disabled)return!1;this.$emit("input",e)}}},d=n(3744);const h=(0,d.Z)(p,[["render",c],["__scopeId","data-v-eff375b6"]]);var m=h},1869:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return _t}});var i=n(6252),r=n(3577),a=n(9963);const o=e=>((0,i.dD)("data-v-530f2c6b"),e=e(),(0,i.Cn)(),e),s={class:"head"},l={class:"row item"},u={class:"col-8"},c={key:0,class:"col-4 buttons"},p=o((()=>(0,i._)("i",{class:"fas fa-undo"},null,-1))),d=[p],h=o((()=>(0,i._)("button",{type:"submit",class:"save-btn",title:"Save"},[(0,i._)("i",{class:"fas fa-save"})],-1))),m={class:"body"},f={class:"row item"},v={class:"name"},g=o((()=>(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-question"}),(0,i.Uk)(" Condition ")],-1))),y=o((()=>(0,i._)("br",null,null,-1))),w=o((()=>(0,i._)("span",{class:"subtext"},[(0,i._)("span",{class:"text"},[(0,i.Uk)(" The condition that must be met for the alarm to trigger. "),(0,i._)("a",{href:"https://crontab.guru",target:"_blank"},"Cron syntax"),(0,i.Uk)(" is supported. ")])],-1))),_={class:"condition-type radio"},x={class:"value"},b=["value"],D={class:"row item"},k=o((()=>(0,i._)("div",{class:"name"},[(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-music"}),(0,i.Uk)(" Media ")]),(0,i._)("br"),(0,i._)("span",{class:"subtext"},[(0,i._)("span",{class:"text"}," Path or URL of the media resource to play when the alarm triggers. ")])],-1))),O={class:"value"},I={class:"row item"},S=o((()=>(0,i._)("div",{class:"name"},[(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-puzzle-piece"}),(0,i.Uk)(" Media Plugin ")]),(0,i._)("br"),(0,i._)("span",{class:"subtext"},[(0,i._)("span",{class:"text"}," The plugin to use to play the media resource. ")])],-1))),T={class:"value"},M={class:"row item"},X=o((()=>(0,i._)("div",{class:"name"},[(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-repeat"}),(0,i.Uk)(" Repeat Media ")]),(0,i._)("br"),(0,i._)("span",{class:"subtext"},[(0,i._)("span",{class:"text"}," Whether to repeat the media resource when it finishes playing if the alarm is still running. ")])],-1))),C={class:"value"},E={class:"row item"},A=o((()=>(0,i._)("div",{class:"name"},[(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-volume-high"}),(0,i.Uk)(" Volume ")]),(0,i._)("br"),(0,i._)("span",{class:"subtext"},[(0,i._)("span",{class:"text"}," The volume to play the media resource at. ")])],-1))),U={class:"value"},P={class:"row item"},F=o((()=>(0,i._)("div",{class:"name"},[(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-bell"}),(0,i.Uk)(" Snooze interval ")]),(0,i._)("br"),(0,i._)("span",{class:"subtext"},[(0,i._)("span",{class:"text"}," How long the alarm should be paused after being triggered and manually snoozed. ")])],-1))),W={class:"value"},$={class:"row item"},L=o((()=>(0,i._)("div",{class:"name"},[(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-xmark"}),(0,i.Uk)(" Dismiss timeout ")]),(0,i._)("br"),(0,i._)("span",{class:"subtext"},[(0,i._)("span",{class:"text"}," How long the alarm should run before being automatically dismissed. ")])],-1))),R={class:"value"},Z={class:"row item"},N=o((()=>(0,i._)("div",{class:"name"},[(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-play"}),(0,i.Uk)(" Actions ")]),(0,i._)("br"),(0,i._)("span",{class:"subtext"},[(0,i._)("span",{class:"text"}," Actions to perform when the alarm triggers. ")])],-1))),V={class:"value"};function H(e,t,n,o,p,H){const z=(0,i.up)("Loading"),B=(0,i.up)("CronEditor"),q=(0,i.up)("TimeInterval"),j=(0,i.up)("FileSelector"),Y=(0,i.up)("ToggleSwitch"),G=(0,i.up)("Slider"),J=(0,i.up)("ProcedureEditor");return(0,i.wg)(),(0,i.iD)("div",{class:(0,r.C_)(["alarm-editor-container",{"with-changes":H.hasChanges}])},[p.loading?((0,i.wg)(),(0,i.j4)(z,{key:0})):(0,i.kq)("",!0),(0,i._)("form",{class:"alarm-editor",onSubmit:t[14]||(t[14]=(0,a.iM)(((...e)=>H.save&&H.save(...e)),["prevent"]))},[(0,i._)("div",s,[(0,i._)("div",l,[(0,i._)("div",u,[(0,i.wy)((0,i._)("input",{type:"text",ref:"nameInput",placeholder:"Alarm name","onUpdate:modelValue":t[0]||(t[0]=e=>p.editForm.name=e)},null,512),[[a.nr,p.editForm.name]])]),H.hasChanges?((0,i.wg)(),(0,i.iD)("div",c,[(0,i._)("button",{type:"button",class:"reset-btn",title:"Reset",onClick:t[1]||(t[1]=e=>p.editForm={...n.value})},d),h])):(0,i.kq)("",!0)])]),(0,i._)("div",m,[(0,i._)("div",f,[(0,i._)("div",v,[g,y,w,(0,i._)("div",_,[(0,i._)("label",{class:(0,r.C_)({selected:"cron"===p.editForm.condition_type})},[(0,i.wy)((0,i._)("input",{type:"radio",value:"cron","onUpdate:modelValue":t[2]||(t[2]=e=>p.editForm.condition_type=e)},null,512),[[a.G2,p.editForm.condition_type]]),(0,i.Uk)("  Periodic ")],2),(0,i.Uk)("   "),(0,i._)("label",{class:(0,r.C_)({selected:"timestamp"===p.editForm.condition_type})},[(0,i.wy)((0,i._)("input",{type:"radio",value:"timestamp","onUpdate:modelValue":t[3]||(t[3]=e=>p.editForm.condition_type=e)},null,512),[[a.G2,p.editForm.condition_type]]),(0,i.Uk)("  Date/Time ")],2),(0,i.Uk)("   "),(0,i._)("label",{class:(0,r.C_)({selected:"interval"===p.editForm.condition_type})},[(0,i.wy)((0,i._)("input",{type:"radio",value:"interval","onUpdate:modelValue":t[4]||(t[4]=e=>p.editForm.condition_type=e)},null,512),[[a.G2,p.editForm.condition_type]]),(0,i.Uk)("  Timer ")],2)])]),(0,i._)("div",x,["cron"===p.editForm.condition_type?((0,i.wg)(),(0,i.j4)(B,{key:0,value:"cron"===n.value.condition_type?p.editForm.when:null,onInput:t[5]||(t[5]=e=>H.onWhenInput(e,"cron"))},null,8,["value"])):"timestamp"===p.editForm.condition_type?((0,i.wg)(),(0,i.iD)("input",{key:1,type:"datetime-local",value:"timestamp"===n.value.condition_type?p.editForm.when:null,onInput:t[6]||(t[6]=e=>H.onWhenInput(e.target.value,"timestamp"))},null,40,b)):"interval"===p.editForm.condition_type?((0,i.wg)(),(0,i.j4)(q,{key:2,value:"interval"===n.value.condition_type?p.editForm.when:null,onInput:t[7]||(t[7]=e=>H.onWhenInput(e,"interval"))},null,8,["value"])):(0,i.kq)("",!0)])]),(0,i._)("div",D,[k,(0,i._)("div",O,[(0,i.Wm)(j,{value:p.editForm.media,onInput:t[8]||(t[8]=e=>p.editForm.media=e)},null,8,["value"])])]),(0,i._)("div",I,[S,(0,i._)("div",T,[(0,i.wy)((0,i._)("input",{type:"text","onUpdate:modelValue":t[9]||(t[9]=e=>p.editForm.media_plugin=e)},null,512),[[a.nr,p.editForm.media_plugin]])])]),(0,i._)("div",M,[(0,i._)("label",null,[X,(0,i._)("div",C,[(0,i.Wm)(Y,{value:p.editForm.media_repeat,onInput:t[10]||(t[10]=e=>p.editForm.media_repeat=e.target.checked)},null,8,["value"])])])]),(0,i._)("div",E,[A,(0,i._)("div",U,[(0,i.Wm)(G,{value:H.audioVolume,range:[0,100],onInput:H.onVolumeChange},null,8,["value","onInput"])])]),(0,i._)("div",P,[F,(0,i._)("div",W,[(0,i.Wm)(q,{value:p.editForm.snooze_interval,onInput:t[11]||(t[11]=e=>p.editForm.snooze_interval=e)},null,8,["value"])])]),(0,i._)("div",$,[L,(0,i._)("div",R,[(0,i.Wm)(q,{value:p.editForm.dismiss_interval,onInput:t[12]||(t[12]=e=>p.editForm.dismiss_interval=e)},null,8,["value"])])]),(0,i._)("div",Z,[N,(0,i._)("div",V,[(0,i.Wm)(J,{value:H.procedure,"with-name":!1,onInput:t[13]||(t[13]=e=>H.onActionsInput(e))},null,8,["value"])])])])],32)],2)}var z=n(6791);const B=e=>((0,i.dD)("data-v-818098dc"),e=e(),(0,i.Cn)(),e),q={class:"procedure-editor"},j={key:0,class:"name-editor-container"},Y={class:"row item"},G=B((()=>(0,i._)("div",{class:"name"},[(0,i._)("label",null,[(0,i._)("i",{class:"icon fas fa-pen-to-square"}),(0,i.Uk)(" Name ")])],-1))),J={class:"value"},K={class:"actions"},Q=["onDragover","onDragenter","onDrop"],ee=B((()=>(0,i._)("div",{class:"drop-target"},null,-1))),te=[ee],ne={key:1,class:"separator"},ie=["onDragover","onDragenter","onDrop"],re=B((()=>(0,i._)("div",{class:"drop-target"},null,-1))),ae=[re],oe={key:3,class:"separator"},se={class:"row item"};function le(e,t,n,o,s,l){const u=(0,i.up)("ActionTile"),c=(0,i.up)("Response");return(0,i.wg)(),(0,i.iD)("div",{class:(0,r.C_)(["procedure-editor-container",{dragging:null!=s.dragItem}])},[(0,i._)("div",q,[(0,i._)("form",{autocomplete:"off",onSubmit:t[6]||(t[6]=(0,a.iM)(((...e)=>l.executeAction&&l.executeAction(...e)),["prevent"]))},[n.withName?((0,i.wg)(),(0,i.iD)("div",j,[(0,i._)("div",Y,[G,(0,i._)("div",J,[(0,i.wy)((0,i._)("input",{type:"text","onUpdate:modelValue":t[0]||(t[0]=e=>s.newValue.name=e)},null,512),[[a.nr,s.newValue.name]])])])])):(0,i.kq)("",!0),(0,i._)("div",K,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(s.newValue.actions,((e,n)=>((0,i.wg)(),(0,i.iD)("div",{class:"row item",key:n},[null!=s.dragItem&&s.dragItem>n?((0,i.wg)(),(0,i.iD)("div",{key:0,class:(0,r.C_)(["drop-target-container",{active:s.dropIndex===n}]),onDragover:(0,a.iM)((e=>s.dropIndex=n),["prevent"]),onDragenter:(0,a.iM)((e=>s.dropIndex=n),["prevent"]),onDragleave:t[1]||(t[1]=(0,a.iM)((e=>s.dropIndex=void 0),["prevent"])),onDragend:t[2]||(t[2]=(0,a.iM)((e=>s.dropIndex=void 0),["prevent"])),onDrop:e=>l.onDrop(n)},te,42,Q)):null!=s.dragItem&&s.dragItem===n?((0,i.wg)(),(0,i.iD)("div",ne)):(0,i.kq)("",!0),(0,i.Wm)(u,{value:e,draggable:"","with-delete":"",onDrag:e=>s.dragItem=n,onDrop:t[3]||(t[3]=e=>s.dragItem=void 0),onInput:e=>l.editAction(e,n),onDelete:e=>l.deleteAction(n)},null,8,["value","onDrag","onInput","onDelete"]),null!=s.dragItem&&s.dragItem<n?((0,i.wg)(),(0,i.iD)("div",{key:2,class:(0,r.C_)(["drop-target-container",{active:s.dropIndex===n}]),onDragover:(0,a.iM)((e=>s.dropIndex=n),["prevent"]),onDragenter:(0,a.iM)((e=>s.dropIndex=n),["prevent"]),onDragleave:t[4]||(t[4]=(0,a.iM)((e=>s.dropIndex=void 0),["prevent"])),onDragend:t[5]||(t[5]=(0,a.iM)((e=>s.dropIndex=void 0),["prevent"])),onDrop:e=>l.onDrop(n)},ae,42,ie)):null!=s.dragItem&&s.dragItem===n?((0,i.wg)(),(0,i.iD)("div",oe)):(0,i.kq)("",!0)])))),128)),(0,i._)("div",se,[(0,i.Wm)(u,{value:s.newAction,onInput:l.addAction},null,8,["value","onInput"])])]),(0,i.Wm)(c,{response:s.response,error:s.error},null,8,["response","error"])],32)])],2)}n(7658);const ue=e=>((0,i.dD)("data-v-0bf520a2"),e=e(),(0,i.Cn)(),e),ce=["draggable"],pe=ue((()=>(0,i._)("i",{class:"icon fas fa-xmark"},null,-1))),de=[pe],he={key:1,class:"action-name"},me={key:2,class:"new-action"},fe=ue((()=>(0,i._)("i",{class:"icon fas fa-plus"},null,-1))),ve={key:3,class:"action-args"},ge={class:"arg-name"},ye={class:"arg-value"},we={class:"action-editor-container"};function _e(e,t,n,o,s,l){const u=(0,i.up)("ActionEditor"),c=(0,i.up)("Modal");return(0,i.wg)(),(0,i.iD)(i.HY,null,[(0,i._)("div",{class:(0,r.C_)(["action-tile",{drag:n.draggable&&s.dragging}]),draggable:n.draggable,onDragstart:t[1]||(t[1]=(...e)=>l.onDragStart&&l.onDragStart(...e)),onDragend:t[2]||(t[2]=(...e)=>l.onDragEnd&&l.onDragEnd(...e)),onClick:t[3]||(t[3]=(...t)=>e.$refs.actionEditor.show&&e.$refs.actionEditor.show(...t))},[n.withDelete?((0,i.wg)(),(0,i.iD)("div",{key:0,class:"action-delete",title:"Remove",onClick:t[0]||(t[0]=(0,a.iM)((t=>e.$emit("delete")),["stop"]))},de)):(0,i.kq)("",!0),l.name?.length?((0,i.wg)(),(0,i.iD)("div",he,(0,r.zw)(l.name),1)):((0,i.wg)(),(0,i.iD)("div",me,[fe,(0,i.Uk)("  Add Action ")])),Object.keys(n.value.args||{})?.length?((0,i.wg)(),(0,i.iD)("div",ve,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(n.value.args,((e,t)=>((0,i.wg)(),(0,i.iD)("div",{class:"arg",key:t},[(0,i._)("div",ge,(0,r.zw)(t),1),(0,i._)("div",ye,(0,r.zw)(e),1)])))),128))])):(0,i.kq)("",!0)],42,ce),(0,i._)("div",we,[(0,i.Wm)(c,{ref:"actionEditor",title:"Edit Action"},{default:(0,i.w5)((()=>[this.$refs.actionEditor?.$data?.isVisible?((0,i.wg)(),(0,i.j4)(u,{key:0,value:n.value,"with-save":"",onInput:l.onInput},null,8,["value","onInput"])):(0,i.kq)("",!0)])),_:1},512)])],64)}var xe=n(1807),be=n(3493),De={emits:["input","delete","drag","drop"],components:{ActionEditor:xe.Z,Modal:be.Z},props:{value:{type:Object,default:()=>({name:void 0,args:{},extraArgs:[],supportsExtraArgs:!0})},withDelete:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1}},data(){return{dragging:!1}},computed:{name(){return this.value.name||this.value.action}},methods:{onDragStart(e){this.dragging=!0,e.dataTransfer.dropEffect="move",e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("application/json",JSON.stringify(this.value)),this.$emit("drag")},onDragEnd(){this.dragging=!1,this.$emit("drop")},onInput(e){this.$emit("input",{...this.value,name:e.action,args:e.args,extraArgs:e.extraArgs,supportsExtraArgs:e.supportsExtraArgs}),this.$refs.actionEditor.close()}}},ke=n(3744);const Oe=(0,ke.Z)(De,[["render",_e],["__scopeId","data-v-0bf520a2"]]);var Ie=Oe,Se=n(803),Te=n(8637),Me={mixins:[Te.Z],emits:["input"],components:{ActionTile:Ie,Response:Se.Z},props:{withName:{type:Boolean,default:!1},value:{type:Object,default:()=>({name:void 0,actions:[]})}},data(){return{loading:!1,running:!1,response:void 0,error:void 0,actions:[],newValue:{...this.value},newAction:{},dragItem:void 0,dropIndex:void 0}},methods:{onResponse(e){this.response=("string"===typeof e?e:JSON.stringify(e,null,2)).trim(),this.error=void 0},onError(e){this.response=void 0,this.error=e},onDone(){this.running=!1},emitInput(){this.$emit("input",this.newValue)},onDrop(e){void 0!==this.dragItem&&(this.newValue.actions.splice(e,0,this.newValue.actions.splice(this.dragItem,1)[0]),this.emitInput())},executeAction(){this.value.actions?.length&&(this.running=!0,this.execute(this.value.actions).then(this.onResponse).catch(this.onError).finally(this.onDone))},editAction(e,t){this.newValue.actions[t]=e,this.emitInput()},addAction(e){this.newValue.actions.push(e),this.emitInput()},deleteAction(e){this.newValue.actions.splice(e,1),this.emitInput()}},watch:{value:{immediate:!0,deep:!0,handler(e){this.newValue={...e}}}}};const Xe=(0,ke.Z)(Me,[["render",le],["__scopeId","data-v-818098dc"]]);var Ce=Xe,Ee=n(4358);const Ae={class:"cron-editor-container"},Ue=["textContent"],Pe={class:"col-s-12 col-m-8"},Fe=["onUpdate:modelValue","onInput","onFocus"],We={class:"cron-description-container"},$e=["textContent"],Le={key:1,class:"cron-description"},Re=["textContent"],Ze={key:0,class:"cron-next-run"},Ne=["textContent"];function Ve(e,t,n,o,s,l){const u=(0,i.up)("CopyButton");return(0,i.wg)(),(0,i.iD)("div",Ae,[(0,i._)("div",{class:(0,r.C_)(["input-grid",{error:null!=s.error}])},[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(s.labels,((e,n)=>((0,i.wg)(),(0,i.iD)("label",{class:(0,r.C_)(["item",{selected:s.selectedItem===n}]),key:n},[(0,i._)("div",{class:"col-s-12 col-m-4",textContent:(0,r.zw)(e)},null,8,Ue),(0,i._)("div",Pe,[(0,i.wy)((0,i._)("input",{type:"text","onUpdate:modelValue":e=>s.cronExpr[n]=e,onKeydown:t[0]||(t[0]=(...e)=>l.validate&&l.validate(...e)),onInput:e=>l.updateCronExpr(n,e.target.value),onFocus:e=>s.selectedItem=n,onBlur:t[1]||(t[1]=e=>s.selectedItem=null)},null,40,Fe),[[a.nr,s.cronExpr[n]]])])],2)))),128))],2),(0,i._)("div",We,[s.error?((0,i.wg)(),(0,i.iD)("div",{key:0,class:"error",textContent:(0,r.zw)(s.error)},null,8,$e)):((0,i.wg)(),(0,i.iD)("div",Le,[(0,i.Wm)(u,{text:l.cronString},null,8,["text"]),(0,i._)("div",{class:"cron-string",textContent:(0,r.zw)(l.cronString)},null,8,Re),s.error?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",Ze,[(0,i.Uk)(" Runs: "),(0,i._)("span",{class:"cron-text",textContent:(0,r.zw)(s.cronDescription)},null,8,Ne)]))]))])])}var He=n(2458),ze=n.n(He),Be=n(2544),qe={emits:["input"],components:{CopyButton:Be.Z},props:{value:{type:String,required:!0}},data(){return{cronExpr:this.value.split(/\s+/),cronDescription:null,error:null,selectedItem:null,cronRegex:new RegExp("^[0-9*/,-]*$"),labels:["Minute","Hour","Day of Month","Month","Day of Week"]}},computed:{cronString(){return this.cronExpr.map((e=>e.trim())).join(" ")}},watch:{cronExpr:{handler(e,t){e.forEach(((e,n)=>{e=e.trim(),e.match(this.cronRegex)?this.cronExpr[n]=e:this.cronExpr[n]=t[n]}))},deep:!0}},methods:{validate(e){const t=e.key;["Enter","Escape","Tab","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Home","End"].includes(t)||e.ctrlKey||e.metaKey||t.match(this.cronRegex)||e.preventDefault()},updateCronDescription(){try{const e=ze().toString(this.cronString);this.error=null,this.cronDescription=e}catch(e){this.error=`Invalid cron expression: ${e}`,this.cronDescription=null}},updateCronExpr(e,t){this.cronExpr[e]=t,this.updateCronDescription(),this.error||this.$emit("input",this.cronString)}},mounted(){this.updateCronDescription()}};const je=(0,ke.Z)(qe,[["render",Ve],["__scopeId","data-v-c55ac602"]]);var Ye=je;const Ge=e=>((0,i.dD)("data-v-3daea642"),e=e(),(0,i.Cn)(),e),Je={class:"file-selector-container"},Ke={class:"input"},Qe=["value","readonly"],et=Ge((()=>(0,i._)("i",{class:"fa fa-folder-open"},null,-1))),tt=[et];function nt(e,t,n,r,a,o){const s=(0,i.up)("Browser"),l=(0,i.up)("Modal");return(0,i.wg)(),(0,i.iD)("div",Je,[(0,i._)("div",Ke,[(0,i._)("input",{type:"text",value:n.value,readonly:n.strict,onInput:t[0]||(t[0]=t=>e.$emit("input",t.target.value))},null,40,Qe),(0,i._)("button",{type:"button",title:"Select a file",onClick:t[1]||(t[1]=t=>e.$refs.fileSelectorModal.show())},tt)]),(0,i.Wm)(l,{title:"Select a file",ref:"fileSelectorModal"},{default:(0,i.w5)((()=>[(0,i.Wm)(s,{initialPath:a.path,onInput:t[2]||(t[2]=e=>o.onValueChange(e)),onPathChange:t[3]||(t[3]=e=>a.path=e)},null,8,["initialPath"])])),_:1},512)])}var it=n(2381),rt={emits:["input"],components:{Browser:it.Z,Modal:be.Z},props:{value:{type:String},strict:{type:Boolean,default:!1}},data(){return{path:"/"}},methods:{onValueChange(e){this.$emit("input",e)},onFileSelect(e){null!=e&&(e.startsWith("/")||e.startsWith("file://"))?this.path=e.split("/").slice(0,-1).join("/"):this.path="/",this.$refs.fileSelectorModal.hide()}},watch:{value(e){this.onFileSelect(e)}},mounted(){this.onFileSelect(this.value)}};const at=(0,ke.Z)(rt,[["render",nt],["__scopeId","data-v-3daea642"]]);var ot=at;const st={class:"time-interval-container"},lt={class:"row"},ut={class:"value-container"},ct=["step"],pt={class:"unit-container"},dt=["value"];function ht(e,t,n,o,s,l){return(0,i.wg)(),(0,i.iD)("div",st,[(0,i._)("div",lt,[(0,i._)("div",ut,[(0,i.wy)((0,i._)("input",{type:"number","onUpdate:modelValue":t[0]||(t[0]=e=>s.duration=e),step:n.step},null,8,ct),[[a.nr,s.duration]])]),(0,i._)("div",pt,[(0,i.wy)((0,i._)("select",{"onUpdate:modelValue":t[1]||(t[1]=e=>s.selectedUnit=e)},[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(s.units,(e=>((0,i.wg)(),(0,i.iD)("option",{key:e.value,value:e.value},(0,r.zw)(e.label),9,dt)))),128))],512),[[a.bM,s.selectedUnit]])])])])}var mt={emits:["input"],props:{value:{type:Number},step:{type:Number,default:1}},data(){return{duration:null,selectedUnit:"second",units:{second:{label:"Seconds",value:"second",multiplier:1},minute:{label:"Minutes",value:"minute",multiplier:60},hour:{label:"Hours",value:"hour",multiplier:3600},day:{label:"Days",value:"day",multiplier:86400}}}},computed:{unit(){return this.units[this.selectedUnit]},multiplier(){return this.unit.multiplier},seconds(){return null==this.duration?null:this.toSeconds(this.duration)}},watch:{seconds(e){null!==e&&(this.duration=this.toUnit(e),this.$emit("input",e))},value(e){this.duration=this.toUnit(e)}},methods:{toSeconds(e){return null==e?null:e*this.multiplier},toUnit(e){return null==e?null:e/this.multiplier}},mounted(){this.duration=this.toUnit(this.value)}};const ft=(0,ke.Z)(mt,[["render",ht],["__scopeId","data-v-d1cb0878"]]);var vt=ft,gt=n(7514),yt={emits:["input"],mixins:[Te.Z],components:{CronEditor:Ye,FileSelector:ot,Loading:z.Z,ProcedureEditor:Ce,Slider:Ee.Z,TimeInterval:vt,ToggleSwitch:gt.Z},props:{value:{type:Object,required:!0},newAlarm:{type:Boolean,default:!1}},data(){return{loading:!1,editForm:{...this.value}}},computed:{procedure(){return{actions:[...this.editForm.actions||[]]}},audioVolume(){return this.editForm.audio_volume??this.defaultVolume},defaultVolume(){return this.$root.config?.alarm?.audio_volume??100},hasChanges(){return Object.keys(this.changes).length>0},changes(){const e={};return(this.value.audio_volume??this.defaultVolume)!==this.audioVolume&&(e.audio_volume=this.audioVolume),JSON.stringify(this.editForm.actions)!==JSON.stringify(this.value.actions)&&(e.actions=this.editForm.actions),["dismiss_interval","media","media_plugin","media_repeat","name","snooze_interval","when"].forEach((t=>{this.editForm[t]!==this.value[t]&&(e[t]=this.editForm[t])})),e}},methods:{actionsToArgs(e){return e?.map((e=>(e.name&&(e.action=e.name,delete e.name),e)))??[]},onWhenInput(e,t){if(null!=e){switch(t){case"timestamp":e=new Date(e).toISOString();break;case"cron":case"interval":break;default:return void console.error("Unknown cron type",t)}this.editForm.when=e,this.editForm.condition_type=t}},onActionsInput(e){this.editForm.actions=e.actions},onVolumeChange(e){this.editForm.audio_volume=parseFloat(e.target.value)},async save(){this.loading=!0;let e={},t=null;this.newAlarm?(t="alarm.add",e={name:this.editForm.name,when:this.editForm.when,media:this.editForm.media,media_plugin:this.editForm.media_plugin,audio_volume:this.editForm.audio_volume,snooze_interval:this.editForm.snooze_interval,dismiss_interval:this.editForm.dismiss_interval,actions:this.actionsToArgs(this.editForm.actions)}):(t="alarm.edit",e={name:this.value.name,...this.changes},this.changes.actions&&(e.actions=this.actionsToArgs(this.changes.actions)),null!=this.changes.name&&(e.name=this.value.name,e.new_name=this.changes.name));try{const n=await this.request(t,e);this.$emit("input",n)}finally{this.loading=!1}}},mounted(){this.$nextTick((()=>{this.$refs.nameInput.focus()}))}};const wt=(0,ke.Z)(yt,[["render",H],["__scopeId","data-v-530f2c6b"]]);var _t=wt}}]);
//# sourceMappingURL=1869.dfb6d223.js.map