angular.module("c8y.smartRules").directive("smartRuleParamFrequency",["gettext",function(e){e("Hour"),e("Day"),e("Week"),e("Month"),e("Year");return{scope:{rule:"=",param:"="},restrict:"E",template:'<cron-selection template=":::PLUGIN_PATH:::/views/paramInputFrequency.html" config="config" output="cronRule" init="initRule"></cron-selection>',controller:["$scope",function(t){t.config={options:{allowMinute:!1}};var e=t.rule.config;t.initRule=e.minute||"*",t.initRule+=" ".concat(e.hour||"*"),t.initRule+=" ".concat(e.day||"*"),t.initRule+=" ".concat(e.month||"*"),t.initRule+=" ".concat(e.weekday||"*"),"* * * * *"===t.initRule&&(t.initRule="0 0 * * 1"),t.$watch("cronRule",function(e){e&&(e=e.split(/\s+/),t.rule.config.minute=e[0],t.rule.config.hour=e[1],t.rule.config.day=e[2],t.rule.config.month=e[3],t.rule.config.weekday=e[4])})}]}}]).filter("smartRuleParamFrequency",function(){return function(e){return(e||[]).filter(function(e){return"Minute"!==e.label})}}).filter("smartRuleParamFrequencyDayNameToDate",function(){return function(e){return moment().day(e).toDate()}}).filter("smartRuleParamFrequencyMonthNameToDate",function(){return function(e){return moment().month(e-1).toDate()}}).filter("smartRuleParamFrequencyMinuteValueToDate",function(){return function(e){return moment().minute(e).toDate()}});