rrule.min.js 48 KB

1234567891011121314151617181920212223242526
  1. !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("luxon")):"function"==typeof define&&define.amd?define(["luxon"],e):"object"==typeof exports?exports.rrule=e(require("luxon")):t.rrule=e(t.luxon)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){"use strict";n.d(e,"f",function(){return r}),n.d(e,"e",function(){return i}),n.d(e,"d",function(){return o}),n.d(e,"j",function(){return a}),n.d(e,"k",function(){return s}),n.d(e,"m",function(){return u}),n.d(e,"h",function(){return c}),n.d(e,"l",function(){return h}),n.d(e,"i",function(){return d}),n.d(e,"a",function(){return y}),n.d(e,"b",function(){return l}),n.d(e,"g",function(){return f}),n.d(e,"c",function(){return b});var r=function(t){return null!==t&&void 0!==t},i=function(t){return"number"==typeof t},o=Array.isArray,a=function(t,e){void 0===e&&(e=t),1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r<e;r++)n.push(r);return n},s=function(t,e){var n=0,r=[];if(o(t))for(;n<e;n++)r[n]=[].concat(t);else for(;n<e;n++)r[n]=t;return r},u=function(t){return o(t)?t:[t]};function c(t,e,n){void 0===n&&(n=" ");var r=String(t);return e>>=0,r.length>e?String(r):((e-=r.length)>n.length&&(n+=s(n,e/n.length)),n.slice(0,e)+String(r))}var h=function(t,e,n){var r=t.split(e);return n?r.slice(0,n).concat([r.slice(n).join(e)]):r},d=function(t,e){var n=t%e;return n*e<0?n+e:n},y=function(t,e){return{div:Math.floor(t/e),mod:d(t,e)}},l=function(t){return!r(t)||0===t.length},f=function(t){return!l(t)},b=function(t,e){return f(t)&&-1!==t.indexOf(e)}},function(t,e,n){"use strict";n.r(e);var r,i=n(0),o=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t.MONTH_DAYS=[31,28,31,30,31,30,31,31,30,31,30,31],t.ONE_DAY=864e5,t.MAXYEAR=9999,t.ORDINAL_BASE=new Date(Date.UTC(1970,0,1)),t.PY_WEEKDAYS=[6,0,1,2,3,4,5],t.getYearDay=function(e){var n=new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());return Math.ceil((n.valueOf()-new Date(e.getUTCFullYear(),0,1).valueOf())/t.ONE_DAY)+1},t.isLeapYear=function(t){return t%4==0&&t%100!=0||t%400==0},t.isDate=function(t){return t instanceof Date},t.isValidDate=function(e){return t.isDate(e)&&!isNaN(e.getTime())},t.tzOffset=function(t){return 60*t.getTimezoneOffset()*1e3},t.daysBetween=function(e,n){var r=e.getTime()-t.tzOffset(e)-(n.getTime()-t.tzOffset(n));return Math.round(r/t.ONE_DAY)},t.toOrdinal=function(e){return t.daysBetween(e,t.ORDINAL_BASE)},t.fromOrdinal=function(e){return new Date(t.ORDINAL_BASE.getTime()+e*t.ONE_DAY)},t.getMonthDays=function(e){var n=e.getUTCMonth();return 1===n&&t.isLeapYear(e.getUTCFullYear())?29:t.MONTH_DAYS[n]},t.getWeekday=function(e){return t.PY_WEEKDAYS[e.getUTCDay()]},t.monthRange=function(e,n){var r=new Date(Date.UTC(e,n,1));return[t.getWeekday(r),t.getMonthDays(r)]},t.combine=function(t,e){return e=e||t,new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))},t.clone=function(t){return new Date(t.getTime())},t.cloneDates=function(e){for(var n=[],r=0;r<e.length;r++)n.push(t.clone(e[r]));return n},t.sort=function(t){t.sort(function(t,e){return t.getTime()-e.getTime()})},t.timeToUntilString=function(t,e){void 0===e&&(e=!0);var n=new Date(t);return[Object(i.h)(n.getUTCFullYear().toString(),4,"0"),Object(i.h)(n.getUTCMonth()+1,2,"0"),Object(i.h)(n.getUTCDate(),2,"0"),"T",Object(i.h)(n.getUTCHours(),2,"0"),Object(i.h)(n.getUTCMinutes(),2,"0"),Object(i.h)(n.getUTCSeconds(),2,"0"),e?"Z":""].join("")},t.untilStringToDate=function(t){var e=/^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/.exec(t);if(!e)throw new Error("Invalid UNTIL value: "+t);return new Date(Date.UTC(parseInt(e[1],10),parseInt(e[2],10)-1,parseInt(e[3],10),parseInt(e[5],10)||0,parseInt(e[6],10)||0,parseInt(e[7],10)||0))};var e=function(){function t(t,e,n,r){this.hour=t,this.minute=e,this.second=n,this.millisecond=r||0}return t.prototype.getHours=function(){return this.hour},t.prototype.getMinutes=function(){return this.minute},t.prototype.getSeconds=function(){return this.second},t.prototype.getMilliseconds=function(){return this.millisecond},t.prototype.getTime=function(){return 1e3*(60*this.hour*60+60*this.minute+this.second)+this.millisecond},t}();t.Time=e;var n=function(e){function n(t,n,r,i,o,a,s){var u=e.call(this,i,o,a,s)||this;return u.year=t,u.month=n,u.day=r,u}return o(n,e),n.fromDate=function(t){return new this(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.valueOf()%1e3)},n.prototype.getWeekday=function(){return t.getWeekday(new Date(this.getTime()))},n.prototype.getTime=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond)).getTime()},n.prototype.getDay=function(){return this.day},n.prototype.getMonth=function(){return this.month},n.prototype.getYear=function(){return this.year},n.prototype.addYears=function(t){this.year+=t},n.prototype.addMonths=function(t){if(this.month+=t,this.month>12){var e=Math.floor(this.month/12),n=Object(i.i)(this.month,12);this.month=n,this.year+=e,0===this.month&&(this.month=12,--this.year)}},n.prototype.addWeekly=function(t,e){e>this.getWeekday()?this.day+=-(this.getWeekday()+1+(6-e))+7*t:this.day+=-(this.getWeekday()-e)+7*t,this.fixDay()},n.prototype.addDaily=function(t){this.day+=t,this.fixDay()},n.prototype.addHours=function(t,e,n){for(e&&(this.hour+=Math.floor((23-this.hour)/t)*t);;){this.hour+=t;var r=Object(i.a)(this.hour,24),o=r.div,a=r.mod;if(o&&(this.hour=a,this.addDaily(o)),Object(i.b)(n)||Object(i.c)(n,this.hour))break}},n.prototype.addMinutes=function(t,e,n,r){for(e&&(this.minute+=Math.floor((1439-(60*this.hour+this.minute))/t)*t);;){this.minute+=t;var o=Object(i.a)(this.minute,60),a=o.div,s=o.mod;if(a&&(this.minute=s,this.addHours(a,!1,n)),(Object(i.b)(n)||Object(i.c)(n,this.hour))&&(Object(i.b)(r)||Object(i.c)(r,this.minute)))break}},n.prototype.addSeconds=function(t,e,n,r,o){for(e&&(this.second+=Math.floor((86399-(3600*this.hour+60*this.minute+this.second))/t)*t);;){this.second+=t;var a=Object(i.a)(this.second,60),s=a.div,u=a.mod;if(s&&(this.second=u,this.addMinutes(s,!1,n,r)),(Object(i.b)(n)||Object(i.c)(n,this.hour))&&(Object(i.b)(r)||Object(i.c)(r,this.minute))&&(Object(i.b)(o)||Object(i.c)(o,this.second)))break}},n.prototype.fixDay=function(){if(!(this.day<=28)){var e=t.monthRange(this.year,this.month-1)[1];if(!(this.day<=e))for(;this.day>e;){if(this.day-=e,++this.month,13===this.month&&(this.month=1,++this.year,this.year>t.MAXYEAR))return;e=t.monthRange(this.year,this.month-1)[1]}}},n}(e);t.DateTime=n}(r||(r={}));var a,s=r,u=function(){function t(t,e){this.minDate=null,this.maxDate=null,this._result=[],this.total=0,this.method=t,this.args=e,"between"===t?(this.maxDate=e.inc?e.before:new Date(e.before.getTime()-1),this.minDate=e.inc?e.after:new Date(e.after.getTime()+1)):"before"===t?this.maxDate=e.inc?e.dt:new Date(e.dt.getTime()-1):"after"===t&&(this.minDate=e.inc?e.dt:new Date(e.dt.getTime()+1))}return t.prototype.accept=function(t){++this.total;var e=this.minDate&&t<this.minDate,n=this.maxDate&&t>this.maxDate;if("between"===this.method){if(e)return!0;if(n)return!1}else if("before"===this.method){if(n)return!1}else if("after"===this.method)return!!e||(this.add(t),!1);return this.add(t)},t.prototype.add=function(t){return this._result.push(t),!0},t.prototype.getValue=function(){var t=this._result;switch(this.method){case"all":case"between":return t;case"before":case"after":return t.length?t[t.length-1]:null}},t.prototype.clone=function(){return new t(this.method,this.args)},t}(),c=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),h=function(t){function e(e,n,r){var i=t.call(this,e,n)||this;return i.iterator=r,i}return c(e,t),e.prototype.add=function(t){return!!this.iterator(t,this._result.length)&&(this._result.push(t),!0)},e}(u);function d(t){return t<a.HOURLY}!function(t){t[t.YEARLY=0]="YEARLY",t[t.MONTHLY=1]="MONTHLY",t[t.WEEKLY=2]="WEEKLY",t[t.DAILY=3]="DAILY",t[t.HOURLY=4]="HOURLY",t[t.MINUTELY=5]="MINUTELY",t[t.SECONDLY=6]="SECONDLY"}(a||(a={}));var y=["MO","TU","WE","TH","FR","SA","SU"],l=function(){function t(t,e){if(0===e)throw new Error("Can't create weekday with n == 0");this.weekday=t,this.n=e}return t.prototype.nth=function(e){return this.n===e?this:new t(this.weekday,e)},t.prototype.equals=function(t){return this.weekday===t.weekday&&this.n===t.n},t.prototype.toString=function(){var t=y[this.weekday];return this.n&&(t=(this.n>0?"+":"")+String(this.n)+t),t},t.prototype.getJsWeekday=function(){return 6===this.weekday?0:this.weekday+1},t}();function f(t){var e=[],n={};if(Object.keys(t).forEach(function(r){var o=t[r];n[r]=o,Object(i.c)(tt,r)||e.push(r),s.isDate(o)&&!s.isValidDate(o)&&e.push(r)}),e.length)throw new Error("Invalid options: "+e.join(", "));return n}var b=function(){return(b=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function p(t){var e=t.split("\n").map(w).filter(function(t){return null!==t});return b({},e[0],e[1])}function m(t){var e={},n=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(t);if(!n)return e;n[0];var r=n[1],i=n[2];return r&&(e.tzid=r),e.dtstart=s.untilStringToDate(i),e}function w(t){if(!(t=t.replace(/^\s+|\s+$/,"")).length)return null;var e=/^([A-Z]+?)[:;]/.exec(t.toUpperCase());if(!e)return v(t);e[0];var n=e[1];switch(n.toUpperCase()){case"RRULE":case"EXRULE":return v(t);case"DTSTART":return m(t);default:throw new Error("Unsupported RFC prop "+n+" in "+t)}}function v(t){var e=m(t.replace(/^RRULE:/i,""));return t.replace(/^(?:RRULE|EXRULE):/i,"").split(";").forEach(function(n){var r=n.split("="),i=r[0],o=r[1];switch(i.toUpperCase()){case"FREQ":e.freq=a[o.toUpperCase()];break;case"WKST":e.wkst=Q[o.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var u=function(t){if(-1!==t.indexOf(",")){var e=t.split(",");return e.map(O)}return O(t)}(o),c=i.toLowerCase();e[c]=u;break;case"BYWEEKDAY":case"BYDAY":e.byweekday=function(t){return t.split(",").map(function(t){if(2===t.length)return Q[t];var e=t.match(/^([+-]?\d)([A-Z]{2})$/),n=Number(e[1]),r=e[2],i=Q[r].weekday;return new l(i,n)})}(o);break;case"DTSTART":case"TZID":var h=m(t);e.tzid=h.tzid,e.dtstart=h.dtstart;break;case"UNTIL":e.until=s.untilStringToDate(o);break;case"BYEASTER":e.byeaster=Number(o);break;default:throw new Error("Unknown RRULE property '"+i+"'")}}),e}function O(t){return/^[+-]?\d+$/.test(t)?Number(t):t}var k=n(2),g=function(){function t(t,e){this.date=t,this.tzid=e}return Object.defineProperty(t.prototype,"isUTC",{get:function(){return!this.tzid||"UTC"===this.tzid.toUpperCase()},enumerable:!0,configurable:!0}),t.prototype.toString=function(){var t=s.timeToUntilString(this.date.getTime(),this.isUTC);return this.isUTC?":"+t:";TZID="+this.tzid+":"+t},t.prototype.getTime=function(){return this.date.getTime()},t.prototype.rezonedDate=function(){if(this.isUTC)return this.date;try{return k.DateTime.fromJSDate(this.date).setZone(this.tzid,{keepLocalTime:!0}).toJSDate()}catch(t){return t instanceof TypeError&&console.error("Using TZID without Luxon available is unsupported. Returned times are in UTC, not the requested time zone"),this.date}},t}();function E(t){for(var e=[],n="",r=Object.keys(t),o=Object.keys($),a=0;a<r.length;a++)if("tzid"!==r[a]&&Object(i.c)(o,r[a])){var u=r[a].toUpperCase(),c=t[r[a]],h="";if(Object(i.f)(c)&&(!Object(i.d)(c)||c.length)){switch(u){case"FREQ":h=et.FREQUENCIES[t.freq];break;case"WKST":h=Object(i.e)(c)?new l(c).toString():c.toString();break;case"BYWEEKDAY":u="BYDAY",h=Object(i.m)(c).map(function(t){return t instanceof l?t:Object(i.d)(t)?new l(t[0],t[1]):new l(t)}).toString();break;case"DTSTART":n=j(c,t.tzid);break;case"UNTIL":h=s.timeToUntilString(c,!t.tzid);break;default:if(Object(i.d)(c)){for(var d=[],y=0;y<c.length;y++)d[y]=String(c[y]);h=d.toString()}else h=String(c)}h&&e.push([u,h])}}var f=e.map(function(t){return t[0]+"="+t[1].toString()}).join(";"),b="";return""!==f&&(b="RRULE:"+f),[n,b].filter(function(t){return!!t}).join("\n")}function j(t,e){return t?"DTSTART"+new g(new Date(t),e).toString():""}var T=function(){function t(){this.all=!1,this.before=[],this.after=[],this.between=[]}return t.prototype._cacheAdd=function(t,e,n){e&&(e=e instanceof Date?s.clone(e):s.cloneDates(e)),"all"===t?this.all=e:(n._value=e,this[t].push(n))},t.prototype._cacheGet=function(t,e){var n=!1,r=e?Object.keys(e):[],o=function(t){for(var n=0;n<r.length;n++){var i=r[n];if(String(e[i])!==String(t[i]))return!0}return!1},a=this[t];if("all"===t)n=this.all;else if(Object(i.d)(a))for(var c=0;c<a.length;c++){var h=a[c];if(!r.length||!o(h)){n=h._value;break}}if(!n&&this.all){var d=new u(t,e);for(c=0;c<this.all.length&&d.accept(this.all[c]);c++);n=d.getValue(),this._cacheAdd(t,n,e)}return Object(i.d)(n)?s.cloneDates(n):n instanceof Date?s.clone(n):n},t}(),D=Object(i.k)(1,31).concat(Object(i.k)(2,28),Object(i.k)(3,31),Object(i.k)(4,30),Object(i.k)(5,31),Object(i.k)(6,30),Object(i.k)(7,31),Object(i.k)(8,31),Object(i.k)(9,30),Object(i.k)(10,31),Object(i.k)(11,30),Object(i.k)(12,31),Object(i.k)(1,7)),x=Object(i.k)(1,31).concat(Object(i.k)(2,29),Object(i.k)(3,31),Object(i.k)(4,30),Object(i.k)(5,31),Object(i.k)(6,30),Object(i.k)(7,31),Object(i.k)(8,31),Object(i.k)(9,30),Object(i.k)(10,31),Object(i.k)(11,30),Object(i.k)(12,31),Object(i.k)(1,7)),Y=Object(i.j)(1,29),S=Object(i.j)(1,30),U=Object(i.j)(1,31),L=Object(i.j)(1,32),_=L.concat(S,L,U,L,U,L,L,U,L,U,L,L.slice(0,7)),M=L.concat(Y,L,U,L,U,L,L,U,L,U,L,L.slice(0,7)),R=Object(i.j)(-28,0),A=Object(i.j)(-29,0),N=Object(i.j)(-30,0),C=Object(i.j)(-31,0),I=C.concat(A,C,N,C,N,C,C,N,C,N,C,C.slice(0,7)),W=C.concat(R,C,N,C,N,C,C,N,C,N,C,C.slice(0,7)),H=[0,31,60,91,121,152,182,213,244,274,305,335,366],q=[0,31,59,90,120,151,181,212,243,273,304,334,365],z=function(){for(var t=[],e=0;e<55;e++)t=t.concat(Object(i.j)(7));return t}(),F=function(){function t(t){this.options=t,this.yearlen=365,this.nextyearlen=365,this.mmask=null,this.mrange=null,this.mdaymask=null,this.nmdaymask=null,this.wdaymask=null,this.wnomask=null,this.nwdaymask=null,this.eastermask=null}return t.prototype.rebuild=function(t,e){var n=this.options;t!==this.lastyear&&this.rebuildYear(t),!Object(i.g)(n.bynweekday)||e===this.lastmonth&&t===this.lastyear||this.rebuildMonth(t,e),Object(i.f)(n.byeaster)&&(this.eastermask=function(t,e){void 0===e&&(e=0);var n=t%19,r=Math.floor(t/100),i=t%100,o=Math.floor(r/4),a=r%4,s=Math.floor((r+8)/25),u=Math.floor((r-s+1)/3),c=Math.floor(19*n+r-o-u+15)%30,h=Math.floor(i/4),d=i%4,y=Math.floor(32+2*a+2*h-c-d)%7,l=Math.floor((n+11*c+22*y)/451),f=Math.floor((c+y-7*l+114)/31),b=(c+y-7*l+114)%31+1,p=Date.UTC(t,f-1,b+e),m=Date.UTC(t,0,1);return[Math.ceil((p-m)/864e5)]}(t,n.byeaster))},t.prototype.rebuildYear=function(t){var e=this.options;this.yearlen=s.isLeapYear(t)?366:365,this.nextyearlen=s.isLeapYear(t+1)?366:365;var n=new Date(Date.UTC(t,0,1));this.yearordinal=s.toOrdinal(n),this.yearweekday=s.getWeekday(n);var r=s.getWeekday(n);if(365===this.yearlen?(this.mmask=D,this.mdaymask=M,this.nmdaymask=W,this.wdaymask=z.slice(r),this.mrange=q):(this.mmask=x,this.mdaymask=_,this.nmdaymask=I,this.wdaymask=z.slice(r),this.mrange=H),Object(i.b)(e.byweekno))this.wnomask=null;else{var o,a;this.wnomask=Object(i.k)(0,this.yearlen+7);var u=o=Object(i.i)(7-this.yearweekday+e.wkst,7);u>=4?(u=0,a=this.yearlen+Object(i.i)(this.yearweekday-e.wkst,7)):a=this.yearlen-u;for(var c=Math.floor(a/7),h=Object(i.i)(a,7),d=Math.floor(c+h/4),y=0;y<e.byweekno.length;y++){var l=e.byweekno[y];if(l<0&&(l+=d+1),l>0&&l<=d){var f=void 0;l>1?(f=u+7*(l-1),u!==o&&(f-=7-o)):f=u;for(var b=0;b<7&&(this.wnomask[f]=1,f++,this.wdaymask[f]!==e.wkst);b++);}}if(Object(i.c)(e.byweekno,1)){f=u+7*d;if(u!==o&&(f-=7-o),f<this.yearlen)for(y=0;y<7&&(this.wnomask[f]=1,f+=1,this.wdaymask[f]!==e.wkst);y++);}if(u){var p=void 0;if(Object(i.c)(e.byweekno,-1))p=-1;else{var m=s.getWeekday(new Date(Date.UTC(t-1,0,1))),w=Object(i.i)(7-m.valueOf()+e.wkst,7),v=s.isLeapYear(t-1)?366:365,O=void 0;w>=4?(w=0,O=v+Object(i.i)(m-e.wkst,7)):O=this.yearlen-u,p=Math.floor(52+Object(i.i)(O,7)/4)}if(Object(i.c)(e.byweekno,p))for(f=0;f<u;f++)this.wnomask[f]=1}}},t.prototype.rebuildMonth=function(t,e){var n=this.options;this.lastyear=t,this.lastmonth=e;var r=[];if(n.freq===et.YEARLY)if(Object(i.b)(n.bymonth))r=[[0,this.yearlen]];else for(var o=0;o<n.bymonth.length;o++)e=n.bymonth[o],r.push(this.mrange.slice(e-1,e+1));else n.freq===et.MONTHLY&&(r=[this.mrange.slice(e-1,e+1)]);if(!Object(i.b)(r)){this.nwdaymask=Object(i.k)(0,this.yearlen);for(o=0;o<r.length;o++)for(var a=r[o],s=a[0],u=a[1]-1,c=0;c<n.bynweekday.length;c++){var h=void 0,d=n.bynweekday[c],y=d[0],l=d[1];l<0?(h=u+7*(l+1),h-=Object(i.i)(this.wdaymask[h]-y,7)):(h=s+7*(l-1),h+=Object(i.i)(7-this.wdaymask[h]+y,7)),s<=h&&h<=u&&(this.nwdaymask[h]=1)}}},t.prototype.ydayset=function(){return[Object(i.j)(this.yearlen),0,this.yearlen]},t.prototype.mdayset=function(t,e,n){for(var r=this.mrange[e-1],o=this.mrange[e],a=Object(i.k)(null,this.yearlen),s=r;s<o;s++)a[s]=s;return[a,r,o]},t.prototype.wdayset=function(t,e,n){for(var r=Object(i.k)(null,this.yearlen+7),o=s.toOrdinal(new Date(Date.UTC(t,e-1,n)))-this.yearordinal,a=o,u=0;u<7&&(r[o]=o,++o,this.wdaymask[o]!==this.options.wkst);u++);return[r,a,o]},t.prototype.ddayset=function(t,e,n){var r=Object(i.k)(null,this.yearlen),o=s.toOrdinal(new Date(Date.UTC(t,e-1,n)))-this.yearordinal;return r[o]=o,[r,o,o+1]},t.prototype.htimeset=function(t,e,n,r){var i=this,o=[];return this.options.byminute.forEach(function(e){o=o.concat(i.mtimeset(t,e,n,r))}),s.sort(o),o},t.prototype.mtimeset=function(t,e,n,r){var i=this.options.bysecond.map(function(n){return new s.Time(t,e,n,r)});return s.sort(i),i},t.prototype.stimeset=function(t,e,n,r){return[new s.Time(t,e,n,r)]},t.prototype.getdayset=function(t){switch(t){case a.YEARLY:return this.ydayset.bind(this);case a.MONTHLY:return this.mdayset.bind(this);case a.WEEKLY:return this.wdayset.bind(this);case a.DAILY:default:return this.ddayset.bind(this)}},t.prototype.gettimeset=function(t){switch(t){case a.HOURLY:return this.htimeset.bind(this);case a.MINUTELY:return this.mtimeset.bind(this);case a.SECONDLY:return this.stimeset.bind(this)}},t}();function P(t,e){var n=e.dtstart,r=e.freq,o=e.until,a=e.bysetpos,u=s.DateTime.fromDate(n),c=new F(e);c.rebuild(u.year,u.month);for(var h=function(t,e,n){var r=n.freq,o=n.byhour,a=n.byminute,u=n.bysecond;if(d(r))return function(t){var e=t.dtstart.getTime()%1e3;if(!d(t.freq))return[];var n=[];return t.byhour.forEach(function(r){t.byminute.forEach(function(i){t.bysecond.forEach(function(t){n.push(new s.Time(r,i,t,e))})})}),n}(n);if(r>=et.HOURLY&&Object(i.g)(o)&&!Object(i.c)(o,e.hour)||r>=et.MINUTELY&&Object(i.g)(a)&&!Object(i.c)(a,e.minute)||r>=et.SECONDLY&&Object(i.g)(u)&&!Object(i.c)(u,e.second))return[];return t.gettimeset(r)(e.hour,e.minute,e.second,e.millisecond)}(c,u,e),y=e.count;;){var l=c.getdayset(r)(u.year,u.month,u.day),f=l[0],b=l[1],p=l[2],m=V(f,b,p,c,e);if(Object(i.g)(a))for(var w=G(a,h,b,p,c,f),v=0;v<w.length;v++){var O=w[v];if(o&&O>o)return Z(t);if(O>=n){var k=B(O,e);if(!t.accept(k))return Z(t);if(y&&!--y)return Z(t)}}else for(v=b;v<p;v++){var g=f[v];if(Object(i.f)(g))for(var E=s.fromOrdinal(c.yearordinal+g),j=0;j<h.length;j++){var T=h[j];O=s.combine(E,T);if(o&&O>o)return Z(t);if(O>=n){k=B(O,e);if(!t.accept(k))return Z(t);if(y&&!--y)return Z(t)}}}if(0===e.interval)return Z(t);if(X(e,c,m,u),u.year>s.MAXYEAR)return Z(t);d(r)||(h=c.gettimeset(r)(u.hour,u.minute,u.second,0)),c.rebuild(u.year,u.month)}}function K(t,e,n){var r=n.bymonth,o=n.byweekno,a=n.byweekday,s=n.byeaster,u=n.bymonthday,c=n.bynmonthday,h=n.byyearday;return Object(i.g)(r)&&!Object(i.c)(r,t.mmask[e])||Object(i.g)(o)&&!t.wnomask[e]||Object(i.g)(a)&&!Object(i.c)(a,t.wdaymask[e])||Object(i.g)(t.nwdaymask)&&!t.nwdaymask[e]||null!==s&&!Object(i.c)(t.eastermask,e)||(Object(i.g)(u)||Object(i.g)(c))&&!Object(i.c)(u,t.mdaymask[e])&&!Object(i.c)(c,t.nmdaymask[e])||Object(i.g)(h)&&(e<t.yearlen&&!Object(i.c)(h,e+1)&&!Object(i.c)(h,-t.yearlen+e)||e>=t.yearlen&&!Object(i.c)(h,e+1-t.yearlen)&&!Object(i.c)(h,-t.nextyearlen+e-t.yearlen))}function B(t,e){return new g(t,e.tzid).rezonedDate()}function Z(t){return t.getValue()}function V(t,e,n,r,i){for(var o=!1,a=e;a<n;a++){var s=t[a];(o=K(r,s,i))&&(t[s]=null)}return o}function X(t,e,n,r){var i=t.freq,o=t.interval,s=t.wkst,u=t.byhour,c=t.byminute,h=t.bysecond;switch(i){case a.YEARLY:return r.addYears(o);case a.MONTHLY:return r.addMonths(o);case a.WEEKLY:return r.addWeekly(o,s);case a.DAILY:return r.addDaily(o);case a.HOURLY:return r.addHours(o,n,u);case a.MINUTELY:return r.addMinutes(o,n,u,c);case a.SECONDLY:return r.addSeconds(o,n,u,c,h)}}function G(t,e,n,r,o,a){for(var u=[],c=0;c<t.length;c++){var h=void 0,d=void 0,y=t[c];y<0?(h=Math.floor(y/e.length),d=Object(i.i)(y,e.length)):(h=Math.floor((y-1)/e.length),d=Object(i.i)(y-1,e.length));for(var l=[],f=n;f<r;f++){var b=a[f];Object(i.f)(b)&&l.push(b)}var p=void 0;p=h<0?l.slice(h)[0]:l[h];var m=e[d],w=s.fromOrdinal(o.yearordinal+p),v=s.combine(w,m);Object(i.c)(u,v)||u.push(v)}return s.sort(u),u}var J=function(){return J._nlp||(J._nlp=n(3)),J._nlp},Q={MO:new l(0),TU:new l(1),WE:new l(2),TH:new l(3),FR:new l(4),SA:new l(5),SU:new l(6)},$={freq:a.YEARLY,dtstart:null,interval:1,wkst:Q.MO,count:null,until:null,tzid:null,bysetpos:null,bymonth:null,bymonthday:null,bynmonthday:null,byyearday:null,byweekno:null,byweekday:null,bynweekday:null,byhour:null,byminute:null,bysecond:null,byeaster:null},tt=Object.keys($),et=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=!1),this._cache=e?null:new T,this.origOptions=f(t);var n=function(t){var e=f(t),n=Object.keys(t);if(tt.forEach(function(t){Object(i.c)(n,t)&&Object(i.f)(e[t])||(e[t]=$[t])}),Object(i.f)(e.byeaster)&&(e.freq=et.YEARLY),!Object(i.f)(e.freq)||!et.FREQUENCIES[e.freq])throw new Error("Invalid frequency: "+e.freq+" "+t.freq);if(e.dtstart||(e.dtstart=new Date((new Date).setMilliseconds(0))),Object(i.f)(e.wkst)?Object(i.e)(e.wkst)||(e.wkst=e.wkst.weekday):e.wkst=et.MO.weekday,Object(i.f)(e.bysetpos)){Object(i.e)(e.bysetpos)&&(e.bysetpos=[e.bysetpos]);for(var r=0;r<e.bysetpos.length;r++)if(0===(u=e.bysetpos[r])||!(u>=-366&&u<=366))throw new Error("bysetpos must be between 1 and 366, or between -366 and -1")}if(!(Boolean(e.byweekno)||Object(i.g)(e.byweekno)||Object(i.g)(e.byyearday)||Boolean(e.bymonthday)||Object(i.g)(e.bymonthday)||Object(i.f)(e.byweekday)||Object(i.f)(e.byeaster)))switch(e.freq){case et.YEARLY:e.bymonth||(e.bymonth=e.dtstart.getUTCMonth()+1),e.bymonthday=e.dtstart.getUTCDate();break;case et.MONTHLY:e.bymonthday=e.dtstart.getUTCDate();break;case et.WEEKLY:e.byweekday=[s.getWeekday(e.dtstart)]}if(Object(i.f)(e.bymonth)&&!Object(i.d)(e.bymonth)&&(e.bymonth=[e.bymonth]),Object(i.f)(e.byyearday)&&!Object(i.d)(e.byyearday)&&Object(i.e)(e.byyearday)&&(e.byyearday=[e.byyearday]),Object(i.f)(e.bymonthday))if(Object(i.d)(e.bymonthday)){var o=[],a=[];for(r=0;r<e.bymonthday.length;r++){var u;(u=e.bymonthday[r])>0?o.push(u):u<0&&a.push(u)}e.bymonthday=o,e.bynmonthday=a}else e.bymonthday<0?(e.bynmonthday=[e.bymonthday],e.bymonthday=[]):(e.bynmonthday=[],e.bymonthday=[e.bymonthday]);else e.bymonthday=[],e.bynmonthday=[];if(Object(i.f)(e.byweekno)&&!Object(i.d)(e.byweekno)&&(e.byweekno=[e.byweekno]),Object(i.f)(e.byweekday))if(Object(i.e)(e.byweekday))e.byweekday=[e.byweekday],e.bynweekday=null;else if(e.byweekday instanceof l)!e.byweekday.n||e.freq>et.MONTHLY?(e.byweekday=[e.byweekday.weekday],e.bynweekday=null):(e.bynweekday=[[e.byweekday.weekday,e.byweekday.n]],e.byweekday=null);else{var c=[],h=[];for(r=0;r<e.byweekday.length;r++){var d=e.byweekday[r];if(Object(i.e)(d))c.push(d);else{var y=d;!y.n||e.freq>et.MONTHLY?c.push(y.weekday):h.push([y.weekday,y.n])}}e.byweekday=Object(i.g)(c)?c:null,e.bynweekday=Object(i.g)(h)?h:null}else e.bynweekday=null;return Object(i.f)(e.byhour)?Object(i.e)(e.byhour)&&(e.byhour=[e.byhour]):e.byhour=e.freq<et.HOURLY?[e.dtstart.getUTCHours()]:null,Object(i.f)(e.byminute)?Object(i.e)(e.byminute)&&(e.byminute=[e.byminute]):e.byminute=e.freq<et.MINUTELY?[e.dtstart.getUTCMinutes()]:null,Object(i.f)(e.bysecond)?Object(i.e)(e.bysecond)&&(e.bysecond=[e.bysecond]):e.bysecond=e.freq<et.SECONDLY?[e.dtstart.getUTCSeconds()]:null,{parsedOptions:e}}(t).parsedOptions;this.options=n}return t.parseText=function(t,e){return J().parseText(t,e)},t.fromText=function(t,e){return J().fromText(t,e)},t.fromString=function(e){return new t(t.parseString(e)||void 0)},t.prototype._iter=function(t){return P(t,this.options)},t.prototype._cacheGet=function(t,e){return!!this._cache&&this._cache._cacheGet(t,e)},t.prototype._cacheAdd=function(t,e,n){if(this._cache)return this._cache._cacheAdd(t,e,n)},t.prototype.all=function(t){if(t)return this._iter(new h("all",{},t));var e=this._cacheGet("all");return!1===e&&(e=this._iter(new u("all",{})),this._cacheAdd("all",e)),e},t.prototype.between=function(t,e,n,r){if(void 0===n&&(n=!1),!s.isValidDate(t)||!s.isValidDate(e))throw new Error("Invalid date passed in to RRule.between");var i={before:e,after:t,inc:n};if(r)return this._iter(new h("between",i,r));var o=this._cacheGet("between",i);return!1===o&&(o=this._iter(new u("between",i)),this._cacheAdd("between",o,i)),o},t.prototype.before=function(t,e){if(void 0===e&&(e=!1),!s.isValidDate(t))throw new Error("Invalid date passed in to RRule.before");var n={dt:t,inc:e},r=this._cacheGet("before",n);return!1===r&&(r=this._iter(new u("before",n)),this._cacheAdd("before",r,n)),r},t.prototype.after=function(t,e){if(void 0===e&&(e=!1),!s.isValidDate(t))throw new Error("Invalid date passed in to RRule.after");var n={dt:t,inc:e},r=this._cacheGet("after",n);return!1===r&&(r=this._iter(new u("after",n)),this._cacheAdd("after",r,n)),r},t.prototype.count=function(){return this.all().length},t.prototype.toString=function(){return E(this.origOptions)},t.prototype.toText=function(t,e){return J().toText(this,t,e)},t.prototype.isFullyConvertibleToText=function(){return J().isFullyConvertible(this)},t.prototype.clone=function(){return new t(this.origOptions)},t.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],t.YEARLY=a.YEARLY,t.MONTHLY=a.MONTHLY,t.WEEKLY=a.WEEKLY,t.DAILY=a.DAILY,t.HOURLY=a.HOURLY,t.MINUTELY=a.MINUTELY,t.SECONDLY=a.SECONDLY,t.MO=Q.MO,t.TU=Q.TU,t.WE=Q.WE,t.TH=Q.TH,t.FR=Q.FR,t.SA=Q.SA,t.SU=Q.SU,t.parseString=p,t.optionsToString=E,t}();var nt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),rt=function(t){function e(e){void 0===e&&(e=!1);var n=t.call(this,{},e)||this;return n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return nt(e,t),e.prototype.tzid=function(t){if(void 0!==t&&(this._tzid=t),void 0!==this._tzid)return this._tzid;for(var e=0;e<this._rrule.length;e++){var n=this._rrule[e].origOptions.tzid;if(n)return n}},e.prototype._iter=function(t){return function(t,e,n,r,i,o){var a={},u=t.accept;function c(t,e){n.forEach(function(n){n.between(t,e,!0).forEach(function(t){a[Number(t)]=!0})})}i.forEach(function(t){var e=new g(t,o).rezonedDate();a[Number(e)]=!0}),t.accept=function(t){var e=Number(t);return!(!a[e]&&(c(new Date(e-1),new Date(e+1)),!a[e]))||(a[e]=!0,u.call(this,t))},"between"===t.method&&(c(t.args.after,t.args.before),t.accept=function(t){var e=Number(t);return!!a[e]||(a[e]=!0,u.call(this,t))});for(var h=0;h<r.length;h++){var d=new g(r[h],o).rezonedDate();if(!t.accept(new Date(d.getTime())))break}e.forEach(function(e){P(t,e.options)});var y=t._result;switch(s.sort(y),t.method){case"all":case"between":return y;case"before":return y.length&&y[y.length-1]||null;case"after":return y.length&&y[0]||null}}(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},e.prototype.rrule=function(t){it(t,this._rrule)},e.prototype.exrule=function(t){it(t,this._exrule)},e.prototype.rdate=function(t){ot(t,this._rdate)},e.prototype.exdate=function(t){ot(t,this._exdate)},e.prototype.valueOf=function(){var t=[];return this._rrule.forEach(function(e){t=t.concat(e.toString().split("\n"))}),this._exrule.forEach(function(e){t=t.concat(e.toString().split("\n").map(function(t){return t.replace(/^RRULE:/,"EXRULE:")}).filter(function(t){return!/^DTSTART/.test(t)}))}),this._rdate.length&&t.push(at("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(at("EXDATE",this._exdate,this.tzid())),t},e.prototype.toString=function(){return this.valueOf().join("\n")},e.prototype.clone=function(){var t=new e(!!this._cache);return this._rrule.forEach(function(e){return t.rrule(e.clone())}),this._exrule.forEach(function(e){return t.exrule(e.clone())}),this._rdate.forEach(function(e){return t.rdate(new Date(e.getTime()))}),this._exdate.forEach(function(e){return t.exdate(new Date(e.getTime()))}),t},e}(et);function it(t,e){if(!(t instanceof et))throw new TypeError(String(t)+" is not RRule instance");Object(i.c)(e.map(String),String(t))||e.push(t)}function ot(t,e){if(!(t instanceof Date))throw new TypeError(String(t)+" is not Date instance");Object(i.c)(e.map(Number),Number(t))||(e.push(t),s.sort(e))}function at(t,e,n){var r=!n||"UTC"===n.toUpperCase();return""+(r?t+":":t+";TZID="+n+":")+e.map(function(t){return s.timeToUntilString(t.valueOf(),r)}).join(",")}var st=function(){return(st=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},ut={dtstart:null,cache:!1,unfold:!1,forceset:!1,compatible:!1,tzid:null};function ct(t,e){var n=[],r=[],o=[],a=[],s=m(t),u=s.dtstart,c=s.tzid;return function(t,e){void 0===e&&(e=!1);if(!(t=t&&t.trim()))throw new Error("Invalid empty string");if(!e)return t.split(/\s/);var n=t.split("\n"),r=0;for(;r<n.length;){var i=n[r]=n[r].replace(/\s+$/g,"");i?r>0&&" "===i[0]?(n[r-1]+=i.slice(1),n.splice(r,1)):r+=1:n.splice(r,1)}return n}(t,e.unfold).forEach(function(t){if(t){var e=function(t){var e=function(t){if(-1===t.indexOf(":"))return{name:"RRULE",value:t};var e=Object(i.l)(t,":",1),n=e[0],r=e[1];return{name:n,value:r}}(t),n=e.name,r=e.value,o=n.split(";");if(!o)throw new Error("empty property name");return{name:o[0].toUpperCase(),parms:o.slice(1),value:r}}(t),s=e.name,u=e.parms,h=e.value;switch(s.toUpperCase()){case"RRULE":if(u.length)throw new Error("unsupported RRULE parm: "+u.join(","));n.push(p(t));break;case"RDATE":var d=/RDATE(?:;TZID=([^:=]+))?/i.exec(t),y=(d[0],d[1]);y&&!c&&(c=y),r=r.concat(yt(h,u));break;case"EXRULE":if(u.length)throw new Error("unsupported EXRULE parm: "+u.join(","));o.push(p(h));break;case"EXDATE":a=a.concat(yt(h,u));break;case"DTSTART":break;default:throw new Error("unsupported property: "+s)}}}),{dtstart:u,tzid:c,rrulevals:n,rdatevals:r,exrulevals:o,exdatevals:a}}function ht(t,e){return void 0===e&&(e={}),function(t,e){var n=ct(t,e),r=n.rrulevals,i=n.rdatevals,o=n.exrulevals,a=n.exdatevals,s=n.dtstart,u=n.tzid,c=!1===e.cache;if(e.compatible&&(e.forceset=!0,e.unfold=!0),e.forceset||r.length>1||i.length||o.length||a.length){var h=new rt(c);return h.tzid(u||void 0),r.forEach(function(t){h.rrule(new et(dt(t,s,u),c))}),i.forEach(function(t){h.rdate(t)}),o.forEach(function(t){h.exrule(new et(dt(t,s,u),c))}),a.forEach(function(t){h.exdate(t)}),e.compatible&&e.dtstart&&h.rdate(s),h}var d=r[0];return new et(dt(d,d.dtstart||e.dtstart||s,d.tzid||e.tzid||u),c)}(t,function(t){var e=[],n=Object.keys(t),r=Object.keys(ut);if(n.forEach(function(t){Object(i.c)(r,t)||e.push(t)}),e.length)throw new Error("Invalid options: "+e.join(", "));var o=st({},t);return r.forEach(function(t){Object(i.c)(n,t)||(o[t]=ut[t])}),o}(e))}function dt(t,e,n){return st({},t,{dtstart:e,tzid:n})}function yt(t,e){return function(t){t.forEach(function(t){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(t))throw new Error("unsupported RDATE/EXDATE parm: "+t)})}(e),t.split(",").map(function(t){return s.untilStringToDate(t)})}n.d(e,"Frequency",function(){return a}),n.d(e,"Weekday",function(){return l}),n.d(e,"RRule",function(){return et}),n.d(e,"RRuleSet",function(){return rt}),n.d(e,"rrulestr",function(){return ht});
  2. /*!
  3. * rrule.js - Library for working with recurrence rules for calendar dates.
  4. * https://github.com/jakubroztocil/rrule
  5. *
  6. * Copyright 2010, Jakub Roztocil and Lars Schoning
  7. * Licenced under the BSD licence.
  8. * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
  9. *
  10. * Based on:
  11. * python-dateutil - Extensions to the standard Python datetime module.
  12. * Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
  13. * Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
  14. * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
  15. *
  16. */e.default=et},function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r={dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],tokens:{SKIP:/^[ \r\n\t]+|^\.$/,number:/^[1-9][0-9]*/,numberAsText:/^(one|two|three)/i,every:/^every/i,"day(s)":/^days?/i,"weekday(s)":/^weekdays?/i,"week(s)":/^weeks?/i,"hour(s)":/^hours?/i,"minute(s)":/^minutes?/i,"month(s)":/^months?/i,"year(s)":/^years?/i,on:/^(on|in)/i,at:/^(at)/i,the:/^the/i,first:/^first/i,second:/^second/i,third:/^third/i,nth:/^([1-9][0-9]*)(\.|th|nd|rd|st)/i,last:/^last/i,for:/^for/i,"time(s)":/^times?/i,until:/^(un)?til/i,monday:/^mo(n(day)?)?/i,tuesday:/^tu(e(s(day)?)?)?/i,wednesday:/^we(d(n(esday)?)?)?/i,thursday:/^th(u(r(sday)?)?)?/i,friday:/^fr(i(day)?)?/i,saturday:/^sa(t(urday)?)?/i,sunday:/^su(n(day)?)?/i,january:/^jan(uary)?/i,february:/^feb(ruary)?/i,march:/^mar(ch)?/i,april:/^apr(il)?/i,may:/^may/i,june:/^june?/i,july:/^july?/i,august:/^aug(ust)?/i,september:/^sep(t(ember)?)?/i,october:/^oct(ober)?/i,november:/^nov(ember)?/i,december:/^dec(ember)?/i,comma:/^(,\s*|(and|or)\s*)+/i}},i=n(1),o=n(0),a=function(t,e){return-1!==t.indexOf(e)},s=function(t){return t.toString()},u=function(){function t(t,e,n){if(void 0===e&&(e=s),void 0===n&&(n=r),this.text=[],this.language=n||r,this.gettext=e,this.rrule=t,this.options=t.options,this.origOptions=t.origOptions,this.origOptions.bymonthday){var i=[].concat(this.options.bymonthday),a=[].concat(this.options.bynmonthday);i.sort(function(t,e){return t-e}),a.sort(function(t,e){return e-t}),this.bymonthday=i.concat(a),this.bymonthday.length||(this.bymonthday=null)}if(Object(o.f)(this.origOptions.byweekday)){var u=Object(o.d)(this.origOptions.byweekday)?this.origOptions.byweekday:[this.origOptions.byweekday],c=String(u);this.byweekday={allWeeks:u.filter(function(t){return!t.n}),someWeeks:u.filter(function(t){return Boolean(t.n)}),isWeekdays:-1!==c.indexOf("MO")&&-1!==c.indexOf("TU")&&-1!==c.indexOf("WE")&&-1!==c.indexOf("TH")&&-1!==c.indexOf("FR")&&-1===c.indexOf("SA")&&-1===c.indexOf("SU"),isEveryDay:-1!==c.indexOf("MO")&&-1!==c.indexOf("TU")&&-1!==c.indexOf("WE")&&-1!==c.indexOf("TH")&&-1!==c.indexOf("FR")&&-1!==c.indexOf("SA")&&-1!==c.indexOf("SU")};var h=function(t,e){return t.weekday-e.weekday};this.byweekday.allWeeks.sort(h),this.byweekday.someWeeks.sort(h),this.byweekday.allWeeks.length||(this.byweekday.allWeeks=null),this.byweekday.someWeeks.length||(this.byweekday.someWeeks=null)}else this.byweekday=null}return t.isFullyConvertible=function(e){if(!(e.options.freq in t.IMPLEMENTED))return!1;if(e.origOptions.until&&e.origOptions.count)return!1;for(var n in e.origOptions){if(a(["dtstart","wkst","freq"],n))return!0;if(!a(t.IMPLEMENTED[e.options.freq],n))return!1}return!0},t.prototype.isFullyConvertible=function(){return t.isFullyConvertible(this.rrule)},t.prototype.toString=function(){var e=this.gettext;if(!(this.options.freq in t.IMPLEMENTED))return e("RRule error: Unable to fully convert this rrule to text");if(this.text=[e("every")],this[i.default.FREQUENCIES[this.options.freq]](),this.options.until){this.add(e("until"));var n=this.options.until;this.add(this.language.monthNames[n.getUTCMonth()]).add(n.getUTCDate()+",").add(n.getUTCFullYear().toString())}else this.options.count&&this.add(e("for")).add(this.options.count.toString()).add(this.plural(this.options.count)?e("times"):e("time"));return this.isFullyConvertible()||this.add(e("(~ approximate)")),this.text.join("")},t.prototype.HOURLY=function(){var t=this.gettext;1!==this.options.interval&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?t("hours"):t("hour"))},t.prototype.MINUTELY=function(){var t=this.gettext;1!==this.options.interval&&this.add(this.options.interval.toString()),this.add((this.plural(this.options.interval),t("minutes")))},t.prototype.DAILY=function(){var t=this.gettext;1!==this.options.interval&&this.add(this.options.interval.toString()),this.byweekday&&this.byweekday.isWeekdays?this.add(this.plural(this.options.interval)?t("weekdays"):t("weekday")):this.add(this.plural(this.options.interval)?t("days"):t("day")),this.origOptions.bymonth&&(this.add(t("in")),this._bymonth()),this.bymonthday?this._bymonthday():this.byweekday?this._byweekday():this.origOptions.byhour&&this._byhour()},t.prototype.WEEKLY=function(){var t=this.gettext;1!==this.options.interval&&this.add(this.options.interval.toString()).add(this.plural(this.options.interval)?t("weeks"):t("week")),this.byweekday&&this.byweekday.isWeekdays?1===this.options.interval?this.add(this.plural(this.options.interval)?t("weekdays"):t("weekday")):this.add(t("on")).add(t("weekdays")):this.byweekday&&this.byweekday.isEveryDay?this.add(this.plural(this.options.interval)?t("days"):t("day")):(1===this.options.interval&&this.add(t("week")),this.origOptions.bymonth&&(this.add(t("in")),this._bymonth()),this.bymonthday?this._bymonthday():this.byweekday&&this._byweekday())},t.prototype.MONTHLY=function(){var t=this.gettext;this.origOptions.bymonth?(1!==this.options.interval&&(this.add(this.options.interval.toString()).add(t("months")),this.plural(this.options.interval)&&this.add(t("in"))),this._bymonth()):(1!==this.options.interval&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?t("months"):t("month"))),this.bymonthday?this._bymonthday():this.byweekday&&this.byweekday.isWeekdays?this.add(t("on")).add(t("weekdays")):this.byweekday&&this._byweekday()},t.prototype.YEARLY=function(){var t=this.gettext;this.origOptions.bymonth?(1!==this.options.interval&&(this.add(this.options.interval.toString()),this.add(t("years"))),this._bymonth()):(1!==this.options.interval&&this.add(this.options.interval.toString()),this.add(this.plural(this.options.interval)?t("years"):t("year"))),this.bymonthday?this._bymonthday():this.byweekday&&this._byweekday(),this.options.byyearday&&this.add(t("on the")).add(this.list(this.options.byyearday,this.nth,t("and"))).add(t("day")),this.options.byweekno&&this.add(t("in")).add(this.plural(this.options.byweekno.length)?t("weeks"):t("week")).add(this.list(this.options.byweekno,void 0,t("and")))},t.prototype._bymonthday=function(){var t=this.gettext;this.byweekday&&this.byweekday.allWeeks?this.add(t("on")).add(this.list(this.byweekday.allWeeks,this.weekdaytext,t("or"))).add(t("the")).add(this.list(this.bymonthday,this.nth,t("or"))):this.add(t("on the")).add(this.list(this.bymonthday,this.nth,t("and")))},t.prototype._byweekday=function(){var t=this.gettext;this.byweekday.allWeeks&&!this.byweekday.isWeekdays&&this.add(t("on")).add(this.list(this.byweekday.allWeeks,this.weekdaytext)),this.byweekday.someWeeks&&(this.byweekday.allWeeks&&this.add(t("and")),this.add(t("on the")).add(this.list(this.byweekday.someWeeks,this.weekdaytext,t("and"))))},t.prototype._byhour=function(){var t=this.gettext;this.add(t("at")).add(this.list(this.origOptions.byhour,void 0,t("and")))},t.prototype._bymonth=function(){this.add(this.list(this.options.bymonth,this.monthtext,this.gettext("and")))},t.prototype.nth=function(t){var e,n;t=parseInt(t.toString(),10);var r=this.gettext;if(-1===t)return r("last");switch(n=Math.abs(t)){case 1:case 21:case 31:e=n+r("st");break;case 2:case 22:e=n+r("nd");break;case 3:case 23:e=n+r("rd");break;default:e=n+r("th")}return t<0?e+" "+r("last"):e},t.prototype.monthtext=function(t){return this.language.monthNames[t-1]},t.prototype.weekdaytext=function(t){var e=Object(o.e)(t)?(t+1)%7:t.getJsWeekday();return(t.n?this.nth(t.n)+" ":"")+this.language.dayNames[e]},t.prototype.plural=function(t){return t%100!=1},t.prototype.add=function(t){return this.text.push(" "),this.text.push(t),this},t.prototype.list=function(t,e,n,r){void 0===r&&(r=","),Object(o.d)(t)||(t=[t]);e=e||function(t){return t.toString()};var i=this,a=function(t){return e&&e.call(i,t)};return n?function(t,e,n){for(var r="",i=0;i<t.length;i++)0!==i&&(i===t.length-1?r+=" "+n+" ":r+=e+" "),r+=t[i];return r}(t.map(a),r,n):t.map(a).join(r+" ")},t}(),c=function(){function t(t){this.done=!0,this.rules=t}return t.prototype.start=function(t){return this.text=t,this.done=!1,this.nextSymbol()},t.prototype.isDone=function(){return this.done&&null===this.symbol},t.prototype.nextSymbol=function(){var t,e;this.symbol=null,this.value=null;do{if(this.done)return!1;for(var n in t=null,this.rules){var r=this.rules[n].exec(this.text);r&&(null===t||r[0].length>t[0].length)&&(t=r,e=n)}if(null!=t&&(this.text=this.text.substr(t[0].length),""===this.text&&(this.done=!0)),null==t)return this.done=!0,this.symbol=null,void(this.value=null)}while("SKIP"===e);return this.symbol=e,this.value=t,!0},t.prototype.accept=function(t){if(this.symbol===t){if(this.value){var e=this.value;return this.nextSymbol(),e}return this.nextSymbol(),!0}return!1},t.prototype.acceptNumber=function(){return this.accept("number")},t.prototype.expect=function(t){if(this.accept(t))return!0;throw new Error("expected "+t+" but found "+this.symbol)},t}();function h(t,e){void 0===e&&(e=r);var n={},o=new c(e.tokens);return o.start(t)?(function(){o.expect("every");var t=o.acceptNumber();t&&(n.interval=parseInt(t[0],10));if(o.isDone())throw new Error("Unexpected end");switch(o.symbol){case"day(s)":n.freq=i.default.DAILY,o.nextSymbol()&&(!function(){if(!o.accept("at"))return;do{var t=o.acceptNumber();if(!t)throw new Error("Unexpected symbol "+o.symbol+", expected hour");for(n.byhour=[parseInt(t[0],10)];o.accept("comma");){if(!(t=o.acceptNumber()))throw new Error("Unexpected symbol "+o.symbol+"; expected hour");n.byhour.push(parseInt(t[0],10))}}while(o.accept("comma")||o.accept("at"))}(),d());break;case"weekday(s)":n.freq=i.default.WEEKLY,n.byweekday=[i.default.MO,i.default.TU,i.default.WE,i.default.TH,i.default.FR],o.nextSymbol(),d();break;case"week(s)":n.freq=i.default.WEEKLY,o.nextSymbol()&&(a(),d());break;case"hour(s)":n.freq=i.default.HOURLY,o.nextSymbol()&&(a(),d());break;case"minute(s)":n.freq=i.default.MINUTELY,o.nextSymbol()&&(a(),d());break;case"month(s)":n.freq=i.default.MONTHLY,o.nextSymbol()&&(a(),d());break;case"year(s)":n.freq=i.default.YEARLY,o.nextSymbol()&&(a(),d());break;case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":n.freq=i.default.WEEKLY;var e=o.symbol.substr(0,2).toUpperCase();if(n.byweekday=[i.default[e]],!o.nextSymbol())return;for(;o.accept("comma");){if(o.isDone())throw new Error("Unexpected end");var r=u();if(!r)throw new Error("Unexpected symbol "+o.symbol+", expected weekday");n.byweekday.push(i.default[r]),o.nextSymbol()}!function(){o.accept("on"),o.accept("the");var t=h();if(!t)return;n.bymonthday=[t],o.nextSymbol();for(;o.accept("comma");){if(!(t=h()))throw new Error("Unexpected symbol "+o.symbol+"; expected monthday");n.bymonthday.push(t),o.nextSymbol()}}(),d();break;case"january":case"february":case"march":case"april":case"may":case"june":case"july":case"august":case"september":case"october":case"november":case"december":if(n.freq=i.default.YEARLY,n.bymonth=[s()],!o.nextSymbol())return;for(;o.accept("comma");){if(o.isDone())throw new Error("Unexpected end");var c=s();if(!c)throw new Error("Unexpected symbol "+o.symbol+", expected month");n.bymonth.push(c),o.nextSymbol()}a(),d();break;default:throw new Error("Unknown symbol")}}(),n):null;function a(){var t=o.accept("on"),e=o.accept("the");if(t||e)do{var r=h(),a=u(),c=s();if(r)a?(o.nextSymbol(),n.byweekday||(n.byweekday=[]),n.byweekday.push(i.default[a].nth(r))):(n.bymonthday||(n.bymonthday=[]),n.bymonthday.push(r),o.accept("day(s)"));else if(a)o.nextSymbol(),n.byweekday||(n.byweekday=[]),n.byweekday.push(i.default[a]);else if("weekday(s)"===o.symbol)o.nextSymbol(),n.byweekday||(n.byweekday=[i.default.MO,i.default.TU,i.default.WE,i.default.TH,i.default.FR]);else if("week(s)"===o.symbol){o.nextSymbol();var d=o.acceptNumber();if(!d)throw new Error("Unexpected symbol "+o.symbol+", expected week number");for(n.byweekno=[parseInt(d[0],10)];o.accept("comma");){if(!(d=o.acceptNumber()))throw new Error("Unexpected symbol "+o.symbol+"; expected monthday");n.byweekno.push(parseInt(d[0],10))}}else{if(!c)return;o.nextSymbol(),n.bymonth||(n.bymonth=[]),n.bymonth.push(c)}}while(o.accept("comma")||o.accept("the")||o.accept("on"))}function s(){switch(o.symbol){case"january":return 1;case"february":return 2;case"march":return 3;case"april":return 4;case"may":return 5;case"june":return 6;case"july":return 7;case"august":return 8;case"september":return 9;case"october":return 10;case"november":return 11;case"december":return 12;default:return!1}}function u(){switch(o.symbol){case"monday":case"tuesday":case"wednesday":case"thursday":case"friday":case"saturday":case"sunday":return o.symbol.substr(0,2).toUpperCase();default:return!1}}function h(){switch(o.symbol){case"last":return o.nextSymbol(),-1;case"first":return o.nextSymbol(),1;case"second":return o.nextSymbol(),o.accept("last")?-2:2;case"third":return o.nextSymbol(),o.accept("last")?-3:3;case"nth":var t=parseInt(o.value[1],10);if(t<-366||t>366)throw new Error("Nth out of range: "+t);return o.nextSymbol(),o.accept("last")?-t:t;default:return!1}}function d(){if("until"===o.symbol){var t=Date.parse(o.text);if(!t)throw new Error("Cannot parse until date:"+o.text);n.until=new Date(t)}else o.accept("for")&&(n.count=parseInt(o.value[0],10),o.expect("number"))}}n.d(e,"fromText",function(){return d}),n.d(e,"isFullyConvertible",function(){return f}),n.d(e,"toText",function(){return l}),n.d(e,"parseText",function(){return h});
  17. /*!
  18. * rrule.js - Library for working with recurrence rules for calendar dates.
  19. * https://github.com/jakubroztocil/rrule
  20. *
  21. * Copyright 2010, Jakub Roztocil and Lars Schoning
  22. * Licenced under the BSD licence.
  23. * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
  24. *
  25. */
  26. var d=function(t,e){return void 0===e&&(e=r),new i.default(h(t,e)||void 0)},y=["count","until","interval","byweekday","bymonthday","bymonth"];u.IMPLEMENTED=[],u.IMPLEMENTED[i.default.HOURLY]=y,u.IMPLEMENTED[i.default.MINUTELY]=y,u.IMPLEMENTED[i.default.DAILY]=["byhour"].concat(y),u.IMPLEMENTED[i.default.WEEKLY]=y,u.IMPLEMENTED[i.default.MONTHLY]=y,u.IMPLEMENTED[i.default.YEARLY]=["byweekno","byyearday"].concat(y);var l=function(t,e,n){return new u(t,e,n).toString()},f=u.isFullyConvertible}])});