<commit_before>/*! angular-scheduler - v0.0.1 - 2014-03-14 */"use strict";angular.module("underscore",[]).factory("_",[function(){return window._}]),angular.module("AngularScheduler",["underscore"]).constant("AngularScheduler.partials","/lib/").constant("AngularScheduler.useTimezone",!1).constant("AngularScheduler.showUTCField",!1).factory("SchedulerInit",["$log","$filter","$timezones","LoadLookupValues","SetDefaults","CreateObject","_","AngularScheduler.useTimezone","AngularScheduler.showUTCField",function(a,b,c,d,e,f,g,h,i){return function(b){var j=b.scope,k=b.requireFutureStartTime||!1;return j.schedulerShowTimeZone=h,j.schedulerShowUTCStartTime=i,j.setDefaults=function(){h&&(j.current_timezone=c.getLocal(),($.isEmptyObject(j.current_timezone)||!j.current_timezone.name)&&(a.error("Failed to find local timezone. Defaulting to America/New_York."),j.current_timezone={name:"America/New_York"}),j.schedulerTimeZone=g.find(j.timeZones,function(a){return a.name===j.current_timezone.name})),d(j),e(j),j.scheduleTimeChange(),j.scheduleRepeatChange()},j.scheduleTimeChange=function(){if(j.schedulerStartDt)if(h){j.resetStartDate();try{var a=j.schedulerStartDt+"T"+j.schedulerStartHour+":"+j.schedulerStartMinute+":"+j.schedulerStartSecond+".000Z";j.schedulerUTCTime=c.toUTC(a,j.schedulerTimeZone.name).toISOString()}catch(b){j.startDateError("Provide a valid start date and time")}}else j.schedulerUTCTime=j.schedulerStartDt+"T"+j.schedulerStartHour+":"+j.schedulerStartMinute+":"+j.schedulerStartSecond+".000Z";else j.schedulerUTCTime=""},j.scheduleRepeatChange=function(){j.schedulerFrequency&&""!==j.schedulerFrequency.value&&"none"!==j.schedulerFrequency.value?(j.schedulerInterval=1,j.schedulerShowInterval=!0,j.schedulerIntervalLabel=j.schedulerFrequency.intervalLabel):(j.schedulerShowInterval=!1,j.schedulerEnd=j.endOptions[0])},j.showCalendar=function(a){$("#"+a).focus()},j.monthlyRepeatChange=function(){$("#monthDay").spinner("day"!==j.monthlyRepeatOption?"disable":"enable")},j.yearlyRepeatChange=function(){$("#yearlyRepeatDay").spinner("month"!==j.yearlyRepeatOption?"disable":"enable")},j.setWeekday=function(a){var b=j.weekDays.indexOf(a);b>=0?j.weekDays.splice(a,1):j.weekDays.push(a)},j.startDateError=function(a){j.scheduler_form&&(j.scheduler_form.schedulerStartDt&&(j.scheduler_form_schedulerStartDt_error=a,j.scheduler_form.schedulerStartDt.$pristine=!1,j.scheduler_form.schedulerStartDt.$dirty=!0),$("#schedulerStartDt").removeClass("ng-pristine").removeClass("ng-valid").removeClass("ng-valid-custom-error").addClass("ng-dirty").addClass("ng-invalid").addClass("ng-invalid-custom-error"))},j.resetStartDate=function(){j.scheduler_form&&(j.scheduler_form_schedulerStartDt_error="",j.scheduler_form.schedulerStartDt&&(j.scheduler_form.schedulerStartDt.$setValidity("custom-error",!0),j.scheduler_form.schedulerStartDt.$setPristine()))},j.removeZonesReady&&j.removeZonesReady(),j.removeZonesReady=j.$on("zonesReady",function(){j.timeZones=JSON.parse(localStorage.zones),j.setDefaults()}),h?c.getZoneList(j):j.setDefaults(),f(j,k)}}]).factory("CreateObject",["AngularScheduler.useTimezone","$filter","GetRule","Inject","InjectDetail","SetDefaults","$timezones","SetRule",function(a,b,c,d,e,f,g,h){return function(f,i){var j=function(){this.scope=f,this.useTimezone=a,this.requireFutureStartTime=i,this.getOptions=function(){var a={};return a.startDate=this.scope.schedulerUTCTime,a.frequency=this.scope.schedulerFrequency.value,a.interval=this.scope.schedulerInterval,"after"===this.scope.schedulerEnd.value&&(a.occurrenceCount=this.scope.schedulerOccurrenceCount),"on"===this.scope.schedulerEnd.value&&(a.endDate=f.schedulerEndDt+this.scope.schedulerUTCTime.replace(/^\d{4}-\d{2}-\d{2}/,"")),"weekly"===this.scope.schedulerFrequency.value?a.weekDays=this.scope.weekDays:"yearly"===this.scope.schedulerFrequency.value?"month"===this.scope.yearlyRepeatOption?(a.month=this.scope.yearlyMonth.value,a.monthDay=this.scope.yearlyMonthDay):(a.setOccurrence=this.scope.yearlyOccurrence.value,a.weekDays=this.scope.yearlyWeekDay.value,a.month=this.scope.yearlyOtherMonth.value):"monthly"===this.scope.schedulerFrequency.value&&("day"===this.scope.monthlyRepeatOption?a.monthDay=this.scope.monthDay:(a.setOccurrence=this.scope.monthlyOccurrence.value,a.weekDays=this.scope.monthlyWeekDay.value)),a},this.clearErrors=function(){this.scope.scheduler_weekDays_error=!1,this.scope.scheduler_endDt_error=!1,this.scope.resetStartDate(),this.scope.scheduler_endDt_error=!1,this.scope.scheduler_form&&this.scope.scheduler_form.schedulerEndDt&&(this.scope.scheduler_form.schedulerEndDt.$setValidity("custom-error",!0),this.scope.scheduler_form.schedulerEndDt.$setPristine(),this.scope.scheduler_form.$setPristine())},this.setDetails=function(){var a=this.getRRule();a&&(f.rrule_nlp_description=a.toText(),f.dateChoice="utc",f.occurrence_list=[],a.all(function(a,b){return 10>b?(f.occurrence_list.push({utc:a.toUTCString(),local:a.toString()}),!0):!1}),f.rrule_nlp_description=a.toText().replace(/^RRule error.*$/,"Natural language description not available"),f.rrule=a.toString())},this.isValid=function(){var a,c,d,e,h,i,j=!0;if(this.clearErrors(),"weekly"===this.scope.schedulerFrequency.value&&0===f.weekDays.length&&(this.scope.scheduler_weekDays_error=!0,j=!1),this.scope.scheduler_form.schedulerName.$valid||(this.scope.scheduler_form.schedulerName.$dirty=!0,$("#schedulerName").addClass("ng-dirty"),j=!1),"on"===this.scope.schedulerEnd.value&&(/^\d{4}-\d{2}-\d{2}$/.test(this.scope.schedulerEndDt)||(this.scope.scheduler_form.schedulerEndDt.$pristine=!1,this.scope.scheduler_form.schedulerEndDt.$dirty=!0,$("#schedulerEndDt").removeClass("ng-pristine").removeClass("ng-valid").removeClass("ng-valid-custom-error").addClass("ng-dirty").addClass("ng-invalid").addClass("ng-invalid-custom-error"),this.scope.scheduler_endDt_error=!0,j=!1)),this.scope.schedulerUTCTime)try{a=new Date(this.scope.schedulerUTCTime),isNaN(a)?(this.scope.startDateError("Invalid start time"),j=!1):(i=a.getTime(),c=new Date,this.useTimezone?(d=c.getFullYear()+"-"+b("schZeroPad")(c.getMonth()+1,2)+"-"+b("schZeroPad")(c.getDate(),2)+"T"+b("schZeroPad")(c.getHours(),2)+":"+b("schZeroPad")(c.getMinutes(),2)+":"+b("schZeroPad")(c.getSeconds(),2)+".000Z",e=g.toUTC(d,this.scope.schedulerTimeZone.name),h=e.getTime()):h=c.getTime(),this.requireFutureStartTime&&h>=i&&(this.scope.startDateError("Start time must be in the future"),j=!1))}catch(k){this.scope.startDateError("Invalid start time"),j=!1}else this.scope.startDateError("Provide a start time"),j=!1;return f.schedulerIsValid=j,j&&this.setDetails(),j},this.getRRule=function(){var a=this.getOptions();return c(a)},this.getValue=function(){var a=this.getRRule(),b=this.getOptions();return{name:f.schedulerName,rrule:a.toString(),options:b}},this.setRRule=function(a){return this.clear(),h(a,this.scope)},this.setName=function(a){this.scope.schedulerName=a},this.inject=function(a,b){return d({scope:this.scope,target:a,buttons:b})},this.injectDetail=function(a,b){return e({scope:this.scope,target:a,showRRule:b})},this.clear=function(){this.clearErrors(),this.scope.scheduler_form&&this.scope.scheduler_form.schedulerName&&this.scope.scheduler_form.schedulerName.$setPristine(),this.scope.setDefaults()},this.getUserTimezone=function(){return g.getLocal()},this.setRequireFutureStartTime=function(a){this.requireFutureStartTime=a},this.getRequireFutureStartTime=function(){return this.requireFutureStartTime},this.setShowRRule=function(a){f.showRRule=a}};return new j}}]).factory("Inject",["AngularScheduler.partial","$compile","$http","$log",function(a,b,c){return function(d){var e=d.scope,f=d.target,g=d.buttons;e.removeHtmlReady&&e.removeHtmlReady(),e.removeHtmlReady=e.$on("htmlReady",function(a,c){var d=angular.isObject(f)?f:angular.element(document.getElementById(f));d.html(c),b(d)(e),g&&$("#scheduler-buttons").show()}),c({method:"GET",url:a+"angular-scheduler.html"}).success(function(a){e.$emit("htmlReady",a)}).error(function(b,c){throw"Error reading "+a+"angular-scheduler.html. "+c})}}]).factory("InjectDetail",["AngularScheduler.partial","$compile","$http","$log",function(a,b,c){return function(d){var e=d.scope,f=d.target,g=d.showRRule;e.showRRule=g||!1,e.removeHtmlDetailReady&&e.removeHtmlDetailReady(),e.removeHtmlDetailReady=e.$on("htmlDetailReady",function(a,c){var d=angular.isObject(f)?f:angular.element(document.getElementById(f));d.html(c),b(d)(e)}),c({method:"GET",url:a+"angular-scheduler-detail.html"}).success(function(a){e.$emit("htmlDetailReady",a)}).error(function(b,c){throw"Error reading "+a+"angular-scheduler-detail.html. "+c})}}]).factory("GetRule",["$log",function(a){return function(b){var c,d=b.startDate,e=b.frequency,f=b.interval,g=b.occurrenceCount,h=b.endDate,i=b.month,j=b.monthDay,k=b.weekDays,l=b.setOccurrence,m={};if(angular.isDate(d))m.dtstart=d;else try{m.dtstart=new Date(d)}catch(n){a.error("Date conversion failed. Attempted to convert "+d+" to Date. "+n.message)}if(e&&"none"!==e){if(m.freq=RRule[e.toUpperCase()],m.interval=f,k&&"string"==typeof k&&(m.byweekday=RRule[k.toUpperCase()]),k&&angular.isArray(k))for(m.byweekday=[],c=0;c<k.length;c++)m.byweekday.push(RRule[k[c].toUpperCase()]);if(void 0!==l&&null!==l&&(m.bysetpos=l),i&&(m.bymonth=i),j&&(m.bymonthday=j),g)m.count=g;else if(h)if(angular.isDate(h))m.until=h;else try{m.until=new Date(h)}catch(n){a.error("Date conversion failed. Attempted to convert "+h+" to Date. "+n.message)}}else m.freq=RRule.DAILY,m.interval=1,m.count=1;return new RRule(m)}}]).factory("SetRule",["AngularScheduler.useTimezone","_","$log","$timezones","$filter",function(a,b,c,d,e){return function(d,f){function g(a,c){var d=b.find(a,function(a){var b=a.split(/=/)[0].toUpperCase();return b===c});return d?d.split(/=/)[1].toUpperCase():null}function h(a){var c=a.toLowerCase().split(/,/),d=b.find(f.weekdays,function(a){var d=angular.isArray(a.value)?a.value:[a.value],e=b.difference(d,c),f=b.difference(c,d);return 0===e.length&&0===f.length});return d}function i(c,d){var i,j,k,l,o,p,q,r=c.split(/=/)[0].toUpperCase(),s=c.split(/=/)[1];if("NAME"===r&&(f.schedulerName=s),"FREQ"===r&&(j=s.toLowerCase(),f.schedulerFrequency=b.find(f.frequencyOptions,function(a){return a.value===j}),f.schedulerFrequency&&f.schedulerFrequency.name||(m="FREQ not found in list of valid options")),"INTERVAL"===r&&(parseInt(s,10)?(f.schedulerInterval=parseInt(s,10),f.schedulerShowInterval=!0):m="INTERVAL must contain an integer > 0"),"BYDAY"===r)if("WEEKLY"===g(d,"FREQ"))for(i=s.split(/,/),f.weekDays=[],k=0;k<i.length;k++)b.contains(["SU","MO","TU","WE","TH","FR","SA"],i[k])?(f.weekDays.push(i[k].toLowerCase()),f["weekDay"+i[k].toUpperCase()+"Class"]="active"):m="BYDAY contains unrecognized day value(s)";else"MONTHLY"===g(d,"FREQ")?(f.monthlyRepeatOption="other",f.monthlyWeekDay=h(s),f.monthlyWeekDay||(m="BYDAY contains unrecognized day value(s)")):(f.yearlyRepeatOption="other",f.yearlyWeekDay=h(s),f.yearlyWeekDay||(m="BYDAY contains unrecognized day value(s)"));"BYMONTHDAY"===r&&(parseInt(s,10)&&parseInt(s,10)>0&&parseInt(s,10)<32?(f.monthDay=parseInt(s,10),f.monhthlyRepeatOption="day"):m="BYMONTHDAY must contain an integer between 1 and 31"),"DTSTART"===r&&(n=!0,/\d{8}T\d{6}Z/.test(s)&&(s=s.replace(/(\d{4})(\d{2})(\d{2}T)(\d{2})(\d{2})(\d{2}Z)/,function(a,b,c,d,e,f,g){return b+"-"+c+"-"+d+e+":"+f+":"+g})),a?(l=new Date(s),o=e("schZeroPad")(l.getMonth()+1,2),p=e("schZeroPad")(l.getDate(),2),f.schedulerStartDt=l.getFullYear()+"-"+o+"-"+p,f.schedulerStartHour=e("schZeroPad")(l.getHours(),2),f.schedulerStartMinute=e("schZeroPad")(l.getMinutes(),2),f.schedulerStartSecond=e("schZeroPad")(l.getSeconds(),2),f.scheduleTimeChange()):(q=s.replace(/^.*T/,""),f.schedulerStartDt=s.replace(/T.*$/,""),f.schedulerStartHour=q.substr(0,2),f.schedulerStartMinute=q.substr(3,2),f.schedulerStartMinute=q.substr(6,2)),f.scheduleTimeChange()),"BYSETPOS"===r&&("YEARLY"===g(d,"FREQ")?(f.yearlRepeatOption="other",f.yearlyOccurrence=b.find(f.occurrences,function(a){return a.value===parseInt(s,10)}),f.yearlyOccurrence&&f.yearlyOccurrence.name||(m="BYSETPOS was not in the set of 1,2,3,4,-1")):(f.monthlyOccurrence=b.find(f.occurrences,function(a){return a.value===parseInt(s,10)}),f.monthlyOccurrence&&f.monthlyOccurrence.name||(m="BYSETPOS was not in the set of 1,2,3,4,-1"))),"COUNT"===r&&(parseInt(s,10)?(f.schedulerEnd=f.endOptions[1],f.schedulerOccurrenceCount=parseInt(s,10)):m="COUNT must be a valid integer > 0"),"UNTIL"===r&&(/\d{8}T\d{6}Z/.test(s)&&(s=s.replace(/(\d{4})(\d{2})(\d{2}T)(\d{2})(\d{2})(\d{2}Z)/,function(a,b,c,d,e,f,g){return b+"-"+c+"-"+d+e+":"+f+":"+g})),f.schedulerEnd=f.endOptions[2],a?(l=new Date(s),o=e("schZeroPad")(l.getMonth()+1,2),p=e("schZeroPad")(l.getDate(),2),f.schedulerEndDt=l.getFullYear()+"-"+o+"-"+p):f.schedulerEndDt=s.replace(/T.*$/,"")),"BYMONTH"===r&&("YEARLY"===g(d,"FREQ")&&g(d,"BYDAY")?(f.yearlRepeatOption="other",f.yearlyOtherMonth=b.find(f.months,function(a){return a.value===parseInt(s,10)}),f.yearlyOtherMonth&&f.yearlyOtherMonth.name||(m="BYMONTH must be an integer between 1 and 12")):(f.yearlyOption="month",f.yearlyMonth=b.find(f.months,function(a){return a.value===parseInt(s,10)}),f.yearlyMonth&&f.yearlyMonth.name||(m="BYMONTH must be an integer between 1 and 12"))),"BYMONTHDAY"===r&&(parseInt(s,10)?f.yearlyMonthDay=parseInt(s,10):m="BYMONTHDAY must be an integer between 1 and 31")}function j(){"weekly"===f.schedulerFrequency.name&&0===f.weekDays.length&&(m="Frequency is weekly, but BYDAYS value is missing."),n||(m="Warning: start date was not provided")}var k,l,m="",n=!1;if(d)if(k=d.split(/;/),angular.isArray(k)){for(l=0;l<k.length&&(i(k[l],k),!m);l++);m||j()}else m="No rule entered. Provide a valid RRule string.";else m="No rule entered. Provide a valid RRule string.";return m&&c.error(m),m}}]).factory("SetDefaults",["$filter",function(a){return function(b){var c=new Date,d=a("schZeroPad")(c.getMonth()+1,2),e=a("schZeroPad")(c.getDate(),2),f=c.getFullYear()+"-"+d+"-"+e;b.schedulerName="",b.weekDays=[],b.schedulerStartHour="00",b.schedulerStartMinute="00",b.schedulerStartSecond="00",b.schedulerStartDt=f,b.schedulerFrequency=b.frequencyOptions[0],b.schedulerShowEvery=!1,b.schedulerEnd=b.endOptions[0],b.schedulerInterval=1,b.schedulerOccurrenceCount=1,b.monthlyRepeatOption="day",b.monthDay=1,b.monthlyOccurrence=b.occurrences[0],b.monthlyWeekDay=b.weekdays[0],b.yearlyRepeatOption="month",b.yearlyMonth=b.months[0],b.yearlyMonthDay=1,b.yearlyWeekDay=b.weekdays[0],b.yearlyOtherMonth=b.months[0],b.yearlyOccurrence=b.occurrences[0],b.weekDayMOClass="",b.weekDayTUClass="",b.weekDayWEClass="",b.weekDayTHClass="",b.weekDayFRClass="",b.weekDaySAClass="",b.weekDaySUClass="",b.schedulerIsValid=!1,b.rrule_nlp_description="",b.rrule="",b.dateChoice="utc",b.occurrence_list=[]}}]).factory("LoadLookupValues",[function(){return function(a){a.frequencyOptions=[{name:"None (run once)",value:"none",intervalLabel:""},{name:"Minute",value:"minutely",intervalLabel:"minutes"},{name:"Hour",value:"hourly",intervalLabel:"hours"},{name:"Day",value:"daily",intervalLabel:"days"},{name:"Week",value:"weekly",intervalLabel:"weeks"},{name:"Month",value:"monthly",intervalLabel:"months"},{name:"Year",value:"yearly",intervalLabel:"years"}],a.endOptions=[{name:"Never",value:"never"},{name:"After",value:"after"},{name:"On Date",value:"on"}],a.occurrences=[{name:"first",value:1},{name:"second",value:2},{name:"third",value:3},{name:"fourth",value:4},{name:"last",value:-1}],a.weekdays=[{name:"Sunday",value:"su"},{name:"Monday",value:"mo"},{name:"Tueday",value:"tu"},{name:"Wednesday",value:"we"},{name:"Thursday",value:"th"},{name:"Friday",value:"fr"},{name:"Saturday",value:"sa"},{name:"Day",value:["mo","tu","we","th","fr","sa","su"]},{name:"Weekday",value:["mo","tu","we","th","fr"]},{name:"Weekend day",value:["sa","su"]}],a.months=[{name:"January",value:1},{name:"February",value:2},{name:"March",value:3},{name:"April",value:4},{name:"May",value:5},{name:"June",value:6},{name:"July",value:7},{name:"August",value:8},{name:"September",value:9},{name:"October",value:10},{name:"November",value:11},{name:"December",value:12}]}}]).filter("schZeroPad",[function(){return function(a,b){var c=(Math.pow(10,b)+"").replace(/^1/,"")+(a+"").trim();return c.substr(c.length-b)}}]).directive("schTooltip",[function(){return{link:function(a,b,c){var d=c.placement?c.placement:"top";$(b).tooltip({html:!0,placement:d,title:c.afTooltip,trigger:"hover",container:"body"})}}}]).directive("schDatePicker",[function(){return{require:"ngModel",link:function(a,b,c){var d={},e=c.ngModel,f=new Date;d.dateFormat=c.dateFormat||"yy-mm-dd",d.defaultDate=a[e],d.minDate=c.minToday?f:null,d.maxDate=c.maxDate?new Date(c("maxDate")):null,d.changeMonth="false"===c.changeMonth?!1:!0,d.changeYear="false"===c.changeYear?!1:!0,d.beforeShow=function(){setTimeout(function(){$(".ui-datepicker").css("z-index",9999)},100)},$(b).datepicker(d)}}}]).directive("schSpinner",["$filter",function(a){return{require:"ngModel",link:function(b,c,d,e){var f=d.schSpinner,g=d.zeroPad;$(c).spinner({stop:function(){g?(b[d.ngModel]=a("schZeroPad")($(this).val(),g),$(this).val(b[d.ngModel])):b[d.ngModel]=$(this).spinner("value"),d.ngChange&&b.$apply(b[d.ngChange])},spin:function(){b[f].$setDirty(),e.$dirty=!0,e.$pristine=!1,b.$$phase||b.$digest()}})}}}]);<commit_msg>Recompiled js/css, making sure latest miniified files committed.<commit_after>/*! angular-scheduler - v0.0.1 - 2014-03-14 */"use strict";angular.module("underscore",[]).factory("_",[function(){return window._}]),angular.module("AngularScheduler",["underscore"]).constant("AngularScheduler.partials","/lib/").constant("AngularScheduler.useTimezone",!1).constant("AngularScheduler.showUTCField",!1).factory("SchedulerInit",["$log","$filter","$timezones","LoadLookupValues","SetDefaults","CreateObject","_","AngularScheduler.useTimezone","AngularScheduler.showUTCField",function(a,b,c,d,e,f,g,h,i){return function(b){var j=b.scope,k=b.requireFutureStartTime||!1;return j.schedulerShowTimeZone=h,j.schedulerShowUTCStartTime=i,j.setDefaults=function(){h&&(j.current_timezone=c.getLocal(),($.isEmptyObject(j.current_timezone)||!j.current_timezone.name)&&(a.error("Failed to find local timezone. Defaulting to America/New_York."),j.current_timezone={name:"America/New_York"}),j.schedulerTimeZone=g.find(j.timeZones,function(a){return a.name===j.current_timezone.name})),d(j),e(j),j.scheduleTimeChange(),j.scheduleRepeatChange()},j.scheduleTimeChange=function(){if(j.schedulerStartDt)if(h){j.resetStartDate();try{var a=j.schedulerStartDt+"T"+j.schedulerStartHour+":"+j.schedulerStartMinute+":"+j.schedulerStartSecond+".000Z";j.schedulerUTCTime=c.toUTC(a,j.schedulerTimeZone.name).toISOString()}catch(b){j.startDateError("Provide a valid start date and time")}}else j.schedulerUTCTime=j.schedulerStartDt+"T"+j.schedulerStartHour+":"+j.schedulerStartMinute+":"+j.schedulerStartSecond+".000Z";else j.schedulerUTCTime=""},j.scheduleRepeatChange=function(){j.schedulerFrequency&&""!==j.schedulerFrequency.value&&"none"!==j.schedulerFrequency.value?(j.schedulerInterval=1,j.schedulerShowInterval=!0,j.schedulerIntervalLabel=j.schedulerFrequency.intervalLabel):(j.schedulerShowInterval=!1,j.schedulerEnd=j.endOptions[0])},j.showCalendar=function(a){$("#"+a).focus()},j.monthlyRepeatChange=function(){$("#monthDay").spinner("day"!==j.monthlyRepeatOption?"disable":"enable")},j.yearlyRepeatChange=function(){$("#yearlyRepeatDay").spinner("month"!==j.yearlyRepeatOption?"disable":"enable")},j.setWeekday=function(a){var b=j.weekDays.indexOf(a);b>=0?j.weekDays.splice(a,1):j.weekDays.push(a)},j.startDateError=function(a){j.scheduler_form&&(j.scheduler_form.schedulerStartDt&&(j.scheduler_form_schedulerStartDt_error=a,j.scheduler_form.schedulerStartDt.$pristine=!1,j.scheduler_form.schedulerStartDt.$dirty=!0),$("#schedulerStartDt").removeClass("ng-pristine").removeClass("ng-valid").removeClass("ng-valid-custom-error").addClass("ng-dirty").addClass("ng-invalid").addClass("ng-invalid-custom-error"))},j.resetStartDate=function(){j.scheduler_form&&(j.scheduler_form_schedulerStartDt_error="",j.scheduler_form.schedulerStartDt&&(j.scheduler_form.schedulerStartDt.$setValidity("custom-error",!0),j.scheduler_form.schedulerStartDt.$setPristine()))},j.removeZonesReady&&j.removeZonesReady(),j.removeZonesReady=j.$on("zonesReady",function(){j.timeZones=JSON.parse(localStorage.zones),j.setDefaults()}),h?c.getZoneList(j):j.setDefaults(),f(j,k)}}]).factory("CreateObject",["AngularScheduler.useTimezone","$filter","GetRule","Inject","InjectDetail","SetDefaults","$timezones","SetRule",function(a,b,c,d,e,f,g,h){return function(f,i){var j=function(){this.scope=f,this.useTimezone=a,this.requireFutureStartTime=i,this.getOptions=function(){var a={};return a.startDate=this.scope.schedulerUTCTime,a.frequency=this.scope.schedulerFrequency.value,a.interval=this.scope.schedulerInterval,"after"===this.scope.schedulerEnd.value&&(a.occurrenceCount=this.scope.schedulerOccurrenceCount),"on"===this.scope.schedulerEnd.value&&(a.endDate=f.schedulerEndDt+this.scope.schedulerUTCTime.replace(/^\d{4}-\d{2}-\d{2}/,"")),"weekly"===this.scope.schedulerFrequency.value?a.weekDays=this.scope.weekDays:"yearly"===this.scope.schedulerFrequency.value?"month"===this.scope.yearlyRepeatOption?(a.month=this.scope.yearlyMonth.value,a.monthDay=this.scope.yearlyMonthDay):(a.setOccurrence=this.scope.yearlyOccurrence.value,a.weekDays=this.scope.yearlyWeekDay.value,a.month=this.scope.yearlyOtherMonth.value):"monthly"===this.scope.schedulerFrequency.value&&("day"===this.scope.monthlyRepeatOption?a.monthDay=this.scope.monthDay:(a.setOccurrence=this.scope.monthlyOccurrence.value,a.weekDays=this.scope.monthlyWeekDay.value)),a},this.clearErrors=function(){this.scope.scheduler_weekDays_error=!1,this.scope.scheduler_endDt_error=!1,this.scope.resetStartDate(),this.scope.scheduler_endDt_error=!1,this.scope.scheduler_form&&this.scope.scheduler_form.schedulerEndDt&&(this.scope.scheduler_form.schedulerEndDt.$setValidity("custom-error",!0),this.scope.scheduler_form.schedulerEndDt.$setPristine(),this.scope.scheduler_form.$setPristine())},this.setDetails=function(){var a=this.getRRule();a&&(f.rrule_nlp_description=a.toText(),f.dateChoice="utc",f.occurrence_list=[],a.all(function(a,b){return 10>b?(f.occurrence_list.push({utc:a.toUTCString(),local:a.toString()}),!0):!1}),f.rrule_nlp_description=a.toText().replace(/^RRule error.*$/,"Natural language description not available"),f.rrule=a.toString())},this.isValid=function(){var a,c,d,e,h,i,j=!0;if(this.clearErrors(),"weekly"===this.scope.schedulerFrequency.value&&0===f.weekDays.length&&(this.scope.scheduler_weekDays_error=!0,j=!1),this.scope.scheduler_form.schedulerName.$valid||(this.scope.scheduler_form.schedulerName.$dirty=!0,$("#schedulerName").addClass("ng-dirty"),j=!1),"on"===this.scope.schedulerEnd.value&&(/^\d{4}-\d{2}-\d{2}$/.test(this.scope.schedulerEndDt)||(this.scope.scheduler_form.schedulerEndDt.$pristine=!1,this.scope.scheduler_form.schedulerEndDt.$dirty=!0,$("#schedulerEndDt").removeClass("ng-pristine").removeClass("ng-valid").removeClass("ng-valid-custom-error").addClass("ng-dirty").addClass("ng-invalid").addClass("ng-invalid-custom-error"),this.scope.scheduler_endDt_error=!0,j=!1)),this.scope.schedulerUTCTime)try{a=new Date(this.scope.schedulerUTCTime),isNaN(a)?(this.scope.startDateError("Invalid start time"),j=!1):(i=a.getTime(),c=new Date,this.useTimezone?(d=c.getFullYear()+"-"+b("schZeroPad")(c.getMonth()+1,2)+"-"+b("schZeroPad")(c.getDate(),2)+"T"+b("schZeroPad")(c.getHours(),2)+":"+b("schZeroPad")(c.getMinutes(),2)+":"+b("schZeroPad")(c.getSeconds(),2)+".000Z",e=g.toUTC(d,this.scope.schedulerTimeZone.name),h=e.getTime()):h=c.getTime(),this.requireFutureStartTime&&h>=i&&(this.scope.startDateError("Start time must be in the future"),j=!1))}catch(k){this.scope.startDateError("Invalid start time"),j=!1}else this.scope.startDateError("Provide a start time"),j=!1;return f.schedulerIsValid=j,j&&this.setDetails(),j},this.getRRule=function(){var a=this.getOptions();return c(a)},this.getValue=function(){var a=this.getRRule(),b=this.getOptions();return{name:f.schedulerName,rrule:a.toString(),options:b}},this.setRRule=function(a){return this.clear(),h(a,this.scope)},this.setName=function(a){this.scope.schedulerName=a},this.inject=function(a,b){return d({scope:this.scope,target:a,buttons:b})},this.injectDetail=function(a,b){return e({scope:this.scope,target:a,showRRule:b})},this.clear=function(){this.clearErrors(),this.scope.scheduler_form&&this.scope.scheduler_form.schedulerName&&this.scope.scheduler_form.schedulerName.$setPristine(),this.scope.setDefaults()},this.getUserTimezone=function(){return g.getLocal()},this.setRequireFutureStartTime=function(a){this.requireFutureStartTime=a},this.getRequireFutureStartTime=function(){return this.requireFutureStartTime},this.setShowRRule=function(a){f.showRRule=a}};return new j}}]).factory("Inject",["AngularScheduler.partials","$compile","$http","$log",function(a,b,c){return function(d){var e=d.scope,f=d.target,g=d.buttons;e.removeHtmlReady&&e.removeHtmlReady(),e.removeHtmlReady=e.$on("htmlReady",function(a,c){var d=angular.isObject(f)?f:angular.element(document.getElementById(f));d.html(c),b(d)(e),g&&$("#scheduler-buttons").show()}),c({method:"GET",url:a+"angular-scheduler.html"}).success(function(a){e.$emit("htmlReady",a)}).error(function(b,c){throw"Error reading "+a+"angular-scheduler.html. "+c})}}]).factory("InjectDetail",["AngularScheduler.partials","$compile","$http","$log",function(a,b,c){return function(d){var e=d.scope,f=d.target,g=d.showRRule;e.showRRule=g||!1,e.removeHtmlDetailReady&&e.removeHtmlDetailReady(),e.removeHtmlDetailReady=e.$on("htmlDetailReady",function(a,c){var d=angular.isObject(f)?f:angular.element(document.getElementById(f));d.html(c),b(d)(e)}),c({method:"GET",url:a+"angular-scheduler-detail.html"}).success(function(a){e.$emit("htmlDetailReady",a)}).error(function(b,c){throw"Error reading "+a+"angular-scheduler-detail.html. "+c})}}]).factory("GetRule",["$log",function(a){return function(b){var c,d=b.startDate,e=b.frequency,f=b.interval,g=b.occurrenceCount,h=b.endDate,i=b.month,j=b.monthDay,k=b.weekDays,l=b.setOccurrence,m={};if(angular.isDate(d))m.dtstart=d;else try{m.dtstart=new Date(d)}catch(n){a.error("Date conversion failed. Attempted to convert "+d+" to Date. "+n.message)}if(e&&"none"!==e){if(m.freq=RRule[e.toUpperCase()],m.interval=f,k&&"string"==typeof k&&(m.byweekday=RRule[k.toUpperCase()]),k&&angular.isArray(k))for(m.byweekday=[],c=0;c<k.length;c++)m.byweekday.push(RRule[k[c].toUpperCase()]);if(void 0!==l&&null!==l&&(m.bysetpos=l),i&&(m.bymonth=i),j&&(m.bymonthday=j),g)m.count=g;else if(h)if(angular.isDate(h))m.until=h;else try{m.until=new Date(h)}catch(n){a.error("Date conversion failed. Attempted to convert "+h+" to Date. "+n.message)}}else m.freq=RRule.DAILY,m.interval=1,m.count=1;return new RRule(m)}}]).factory("SetRule",["AngularScheduler.useTimezone","_","$log","$timezones","$filter",function(a,b,c,d,e){return function(d,f){function g(a,c){var d=b.find(a,function(a){var b=a.split(/=/)[0].toUpperCase();return b===c});return d?d.split(/=/)[1].toUpperCase():null}function h(a){var c=a.toLowerCase().split(/,/),d=b.find(f.weekdays,function(a){var d=angular.isArray(a.value)?a.value:[a.value],e=b.difference(d,c),f=b.difference(c,d);return 0===e.length&&0===f.length});return d}function i(c,d){var i,j,k,l,o,p,q,r=c.split(/=/)[0].toUpperCase(),s=c.split(/=/)[1];if("NAME"===r&&(f.schedulerName=s),"FREQ"===r&&(j=s.toLowerCase(),f.schedulerFrequency=b.find(f.frequencyOptions,function(a){return a.value===j}),f.schedulerFrequency&&f.schedulerFrequency.name||(m="FREQ not found in list of valid options")),"INTERVAL"===r&&(parseInt(s,10)?(f.schedulerInterval=parseInt(s,10),f.schedulerShowInterval=!0):m="INTERVAL must contain an integer > 0"),"BYDAY"===r)if("WEEKLY"===g(d,"FREQ"))for(i=s.split(/,/),f.weekDays=[],k=0;k<i.length;k++)b.contains(["SU","MO","TU","WE","TH","FR","SA"],i[k])?(f.weekDays.push(i[k].toLowerCase()),f["weekDay"+i[k].toUpperCase()+"Class"]="active"):m="BYDAY contains unrecognized day value(s)";else"MONTHLY"===g(d,"FREQ")?(f.monthlyRepeatOption="other",f.monthlyWeekDay=h(s),f.monthlyWeekDay||(m="BYDAY contains unrecognized day value(s)")):(f.yearlyRepeatOption="other",f.yearlyWeekDay=h(s),f.yearlyWeekDay||(m="BYDAY contains unrecognized day value(s)"));"BYMONTHDAY"===r&&(parseInt(s,10)&&parseInt(s,10)>0&&parseInt(s,10)<32?(f.monthDay=parseInt(s,10),f.monhthlyRepeatOption="day"):m="BYMONTHDAY must contain an integer between 1 and 31"),"DTSTART"===r&&(n=!0,/\d{8}T\d{6}Z/.test(s)&&(s=s.replace(/(\d{4})(\d{2})(\d{2}T)(\d{2})(\d{2})(\d{2}Z)/,function(a,b,c,d,e,f,g){return b+"-"+c+"-"+d+e+":"+f+":"+g})),a?(l=new Date(s),o=e("schZeroPad")(l.getMonth()+1,2),p=e("schZeroPad")(l.getDate(),2),f.schedulerStartDt=l.getFullYear()+"-"+o+"-"+p,f.schedulerStartHour=e("schZeroPad")(l.getHours(),2),f.schedulerStartMinute=e("schZeroPad")(l.getMinutes(),2),f.schedulerStartSecond=e("schZeroPad")(l.getSeconds(),2),f.scheduleTimeChange()):(q=s.replace(/^.*T/,""),f.schedulerStartDt=s.replace(/T.*$/,""),f.schedulerStartHour=q.substr(0,2),f.schedulerStartMinute=q.substr(3,2),f.schedulerStartMinute=q.substr(6,2)),f.scheduleTimeChange()),"BYSETPOS"===r&&("YEARLY"===g(d,"FREQ")?(f.yearlRepeatOption="other",f.yearlyOccurrence=b.find(f.occurrences,function(a){return a.value===parseInt(s,10)}),f.yearlyOccurrence&&f.yearlyOccurrence.name||(m="BYSETPOS was not in the set of 1,2,3,4,-1")):(f.monthlyOccurrence=b.find(f.occurrences,function(a){return a.value===parseInt(s,10)}),f.monthlyOccurrence&&f.monthlyOccurrence.name||(m="BYSETPOS was not in the set of 1,2,3,4,-1"))),"COUNT"===r&&(parseInt(s,10)?(f.schedulerEnd=f.endOptions[1],f.schedulerOccurrenceCount=parseInt(s,10)):m="COUNT must be a valid integer > 0"),"UNTIL"===r&&(/\d{8}T\d{6}Z/.test(s)&&(s=s.replace(/(\d{4})(\d{2})(\d{2}T)(\d{2})(\d{2})(\d{2}Z)/,function(a,b,c,d,e,f,g){return b+"-"+c+"-"+d+e+":"+f+":"+g})),f.schedulerEnd=f.endOptions[2],a?(l=new Date(s),o=e("schZeroPad")(l.getMonth()+1,2),p=e("schZeroPad")(l.getDate(),2),f.schedulerEndDt=l.getFullYear()+"-"+o+"-"+p):f.schedulerEndDt=s.replace(/T.*$/,"")),"BYMONTH"===r&&("YEARLY"===g(d,"FREQ")&&g(d,"BYDAY")?(f.yearlRepeatOption="other",f.yearlyOtherMonth=b.find(f.months,function(a){return a.value===parseInt(s,10)}),f.yearlyOtherMonth&&f.yearlyOtherMonth.name||(m="BYMONTH must be an integer between 1 and 12")):(f.yearlyOption="month",f.yearlyMonth=b.find(f.months,function(a){return a.value===parseInt(s,10)}),f.yearlyMonth&&f.yearlyMonth.name||(m="BYMONTH must be an integer between 1 and 12"))),"BYMONTHDAY"===r&&(parseInt(s,10)?f.yearlyMonthDay=parseInt(s,10):m="BYMONTHDAY must be an integer between 1 and 31")}function j(){"weekly"===f.schedulerFrequency.name&&0===f.weekDays.length&&(m="Frequency is weekly, but BYDAYS value is missing."),n||(m="Warning: start date was not provided")}var k,l,m="",n=!1;if(d)if(k=d.split(/;/),angular.isArray(k)){for(l=0;l<k.length&&(i(k[l],k),!m);l++);m||j()}else m="No rule entered. Provide a valid RRule string.";else m="No rule entered. Provide a valid RRule string.";return m&&c.error(m),m}}]).factory("SetDefaults",["$filter",function(a){return function(b){var c=new Date,d=a("schZeroPad")(c.getMonth()+1,2),e=a("schZeroPad")(c.getDate(),2),f=c.getFullYear()+"-"+d+"-"+e;b.schedulerName="",b.weekDays=[],b.schedulerStartHour="00",b.schedulerStartMinute="00",b.schedulerStartSecond="00",b.schedulerStartDt=f,b.schedulerFrequency=b.frequencyOptions[0],b.schedulerShowEvery=!1,b.schedulerEnd=b.endOptions[0],b.schedulerInterval=1,b.schedulerOccurrenceCount=1,b.monthlyRepeatOption="day",b.monthDay=1,b.monthlyOccurrence=b.occurrences[0],b.monthlyWeekDay=b.weekdays[0],b.yearlyRepeatOption="month",b.yearlyMonth=b.months[0],b.yearlyMonthDay=1,b.yearlyWeekDay=b.weekdays[0],b.yearlyOtherMonth=b.months[0],b.yearlyOccurrence=b.occurrences[0],b.weekDayMOClass="",b.weekDayTUClass="",b.weekDayWEClass="",b.weekDayTHClass="",b.weekDayFRClass="",b.weekDaySAClass="",b.weekDaySUClass="",b.schedulerIsValid=!1,b.rrule_nlp_description="",b.rrule="",b.dateChoice="utc",b.occurrence_list=[]}}]).factory("LoadLookupValues",[function(){return function(a){a.frequencyOptions=[{name:"None (run once)",value:"none",intervalLabel:""},{name:"Minute",value:"minutely",intervalLabel:"minutes"},{name:"Hour",value:"hourly",intervalLabel:"hours"},{name:"Day",value:"daily",intervalLabel:"days"},{name:"Week",value:"weekly",intervalLabel:"weeks"},{name:"Month",value:"monthly",intervalLabel:"months"},{name:"Year",value:"yearly",intervalLabel:"years"}],a.endOptions=[{name:"Never",value:"never"},{name:"After",value:"after"},{name:"On Date",value:"on"}],a.occurrences=[{name:"first",value:1},{name:"second",value:2},{name:"third",value:3},{name:"fourth",value:4},{name:"last",value:-1}],a.weekdays=[{name:"Sunday",value:"su"},{name:"Monday",value:"mo"},{name:"Tueday",value:"tu"},{name:"Wednesday",value:"we"},{name:"Thursday",value:"th"},{name:"Friday",value:"fr"},{name:"Saturday",value:"sa"},{name:"Day",value:["mo","tu","we","th","fr","sa","su"]},{name:"Weekday",value:["mo","tu","we","th","fr"]},{name:"Weekend day",value:["sa","su"]}],a.months=[{name:"January",value:1},{name:"February",value:2},{name:"March",value:3},{name:"April",value:4},{name:"May",value:5},{name:"June",value:6},{name:"July",value:7},{name:"August",value:8},{name:"September",value:9},{name:"October",value:10},{name:"November",value:11},{name:"December",value:12}]}}]).filter("schZeroPad",[function(){return function(a,b){var c=(Math.pow(10,b)+"").replace(/^1/,"")+(a+"").trim();return c.substr(c.length-b)}}]).directive("schTooltip",[function(){return{link:function(a,b,c){var d=c.placement?c.placement:"top";$(b).tooltip({html:!0,placement:d,title:c.afTooltip,trigger:"hover",container:"body"})}}}]).directive("schDatePicker",[function(){return{require:"ngModel",link:function(a,b,c){var d={},e=c.ngModel,f=new Date;d.dateFormat=c.dateFormat||"yy-mm-dd",d.defaultDate=a[e],d.minDate=c.minToday?f:null,d.maxDate=c.maxDate?new Date(c("maxDate")):null,d.changeMonth="false"===c.changeMonth?!1:!0,d.changeYear="false"===c.changeYear?!1:!0,d.beforeShow=function(){setTimeout(function(){$(".ui-datepicker").css("z-index",9999)},100)},$(b).datepicker(d)}}}]).directive("schSpinner",["$filter",function(a){return{require:"ngModel",link:function(b,c,d,e){var f=d.schSpinner,g=d.zeroPad;$(c).spinner({stop:function(){g?(b[d.ngModel]=a("schZeroPad")($(this).val(),g),$(this).val(b[d.ngModel])):b[d.ngModel]=$(this).spinner("value"),d.ngChange&&b.$apply(b[d.ngChange])},spin:function(){b[f].$setDirty(),e.$dirty=!0,e.$pristine=!1,b.$$phase||b.$digest()}})}}}]);
{'fraction_non_alphanumeric': 0.25252932868301964, 'fraction_numerical': 0.01331680742512899, 'mean_word_length': 15.52095238095238, 'pattern_counts': {'":': 24, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4711387', 'n_tokens_mistral': 13578, 'n_tokens_neox': 13308, 'n_words': 514}