website/script/rrule.min.js

40 lines
50 KiB
JavaScript
Raw Normal View History

2023-01-12 12:05:44 +01:00
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.rrule=e():t.rrule=e()}("undefined"!=typeof self?self:this,function(){return r={},i.m=n=[function(t,e,n){"use strict";n.d(e,"f",function(){return i}),n.d(e,"e",function(){return a}),n.d(e,"g",function(){return o}),n.d(e,"d",function(){return s}),n.d(e,"k",function(){return u}),n.d(e,"l",function(){return c}),n.d(e,"n",function(){return h}),n.d(e,"i",function(){return d}),n.d(e,"m",function(){return y}),n.d(e,"j",function(){return l}),n.d(e,"a",function(){return f}),n.d(e,"b",function(){return b}),n.d(e,"h",function(){return p}),n.d(e,"c",function(){return m});var r=n(2),i=function(t){return null!=t},a=function(t){return"number"==typeof t},o=function(t){return 0<=r.a.indexOf(t)},s=Array.isArray,u=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},c=function(t,e){var n=0,r=[];if(s(t))for(;n<e;n++)r[n]=[].concat(t);else for(;n<e;n++)r[n]=t;return r},h=function(t){return s(t)?t:[t]};function d(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+=c(n,e/n.length)),n.slice(0,e)+String(r))}var y=function(t,e,n){var r=t.split(e);return n?r.slice(0,n).concat([r.slice(n).join(e)]):r},l=function(t,e){var n=t%e;return n*e<0?n+e:n},f=function(t,e){return{div:Math.floor(t/e),mod:l(t,e)}},b=function(t){return!i(t)||0===t.length},p=function(t){return!b(t)},m=function(t,e){return p(t)&&-1!==t.indexOf(e)}},function(t,e,n){"use strict";n.r(e);var r,i,x=n(0);(i=r=r||{}).MONTH_DAYS=[31,28,31,30,31,30,31,31,30,31,30,31],i.ONE_DAY=864e5,i.MAXYEAR=9999,i.ORDINAL_BASE=new Date(Date.UTC(1970,0,1)),i.PY_WEEKDAYS=[6,0,1,2,3,4,5],i.getYearDay=function(t){var e=new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate());return Math.ceil((e.valueOf()-new Date(t.getUTCFullYear(),0,1).valueOf())/i.ONE_DAY)+1},i.isLeapYear=function(t){return t%4==0&&t%100!=0||t%400==0},i.isDate=function(t){return t instanceof Date},i.isValidDate=function(t){return i.isDate(t)&&!isNaN(t.getTime())},i.tzOffset=function(t){return 60*t.getTimezoneOffset()*1e3},i.daysBetween=function(t,e){var n=t.getTime()-i.tzOffset(t)-(e.getTime()-i.tzOffset(e));return Math.round(n/i.ONE_DAY)},i.toOrdinal=function(t){return i.daysBetween(t,i.ORDINAL_BASE)},i.fromOrdinal=function(t){return new Date(i.ORDINAL_BASE.getTime()+t*i.ONE_DAY)},i.getMonthDays=function(t){var e=t.getUTCMonth();return 1===e&&i.isLeapYear(t.getUTCFullYear())?29:i.MONTH_DAYS[e]},i.getWeekday=function(t){return i.PY_WEEKDAYS[t.getUTCDay()]},i.monthRange=function(t,e){var n=new Date(Date.UTC(t,e,1));return[i.getWeekday(n),i.getMonthDays(n)]},i.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()))},i.clone=function(t){return new Date(t.getTime())},i.cloneDates=function(t){for(var e=[],n=0;n<t.length;n++)e.push(i.clone(t[n]));return e},i.sort=function(t){t.sort(function(t,e){return t.getTime()-e.getTime()})},i.timeToUntilString=function(t,e){void 0===e&&(e=!0);var n=new Date(t);return[Object(x.i)(n.getUTCFullYear().toString(),4,"0"),Object(x.i)(n.getUTCMonth()+1,2,"0"),Object(x.i)(n.getUTCDate(),2,"0"),"T",Object(x.i)(n.getUTCHours(),2,"0"),Object(x.i)(n.getUTCMinutes(),2,"0"),Object(x.i)(n.getUTCSeconds(),2,"0"),e?"Z":""].join("")},i.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 Y=r;function a(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
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function s(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u,S=function(){return(S=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 h(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var a=arguments[e],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function d(t,e,n){var r=u.call(this,t,e)||this;return r.iterator=n,r}var y,l,f=(s(d,u=c),d.prototype.add=function(t){return!!this.iterator(t,this._result.length)&&(this._result.push(t),!0)},d);function j(t){return t<y.HOURLY}(l=y=y||{})[l.YEARLY=0]="YEARLY",l[l.MONTHLY=1]="MONTHLY",l[l.WEEKLY=2]="WEEKLY",l[l.DAILY=3]="DAILY",l[l.HOURLY=4]="HOURLY",l[l.MINUTELY=5]="MINUTELY",l[l.SECONDLY=6]="SECONDLY";var b=n(2),T=(p.prototype.getHours=function(){return this.hour},p.prototype.getMinutes=function(){return this.minute},p.prototype.getSeconds=function(){return this.second},p.prototype.getMilliseconds=function(){return this.millisecond},p.prototype.getTime=function(){return 1e3*(60*this.hour*60+60*this.minute+this.second)+this.millisecond},p);function p(t,e,n,r){this.hour=t,this.minute=e,this.second=n,this.millisecond=r||0}var m,D=(s(w,m=T),w.fromDate=function(t){return new this(t.getUTCFullYear(),t.getUTCMonth()+1,t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.valueOf()%1e3)},w.prototype.getWeekday=function(){return r.getWeekday(new Date(this.getTime()))},w.prototype.getTime=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond)).getTime()},w.prototype.getDay=function(){return this.day},w.prototype.getMonth=function(){return this.month},w.prototype.getYear=function(){return this.year},w.prototype.addYears=function(t){this.year+=t},w.prototype.addMonths=function(t){if(this.month+=t,12<this.month){var e=Math.floor(this.month/12),n=Object(x.j)(this.month,12);this.month=n,this.year+=e,0===this.month&&(this.month=12,--this.year)}},w.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()},w.prototype.addDaily=function(t){this.day+=t,this.fixDay()},w.prototype.addHours=function(t,e,n){for(e&&(this.hour+=Math.floor((23-this.hour)/t)*t);;){this.hour+=t;var r=Object(x.a)(this.hour,24),i=r.div,a=r.mod;if(i&&(this.hour=a,this.addDaily(i)),Object(x.b)(n)||Object(x.c)(n,this.hour))break}},w.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 i=Object(x.a)(this.minute,60),a=i.div,o=i.mod;if(a&&(this.minute=o,this.addHours(a,!1,n)),(Object(x.b)(n)||Object(x.c)(n,this.hour))&&(Object(x.b)(r)||Object(x.c)(r,this.minute)))break}},w.prototype.addSeconds=function(t,e,n,r,i){for(e&&(this.second+=Math.floor((86399-(3600*this.hour+60*this.minute+this.second))/t)*t);;){this.second+=t;var a=Object(x.a)(this.second,60),o=a.div,s=a.mod;if(o&&(this.second=s,this.addMinutes(o,!1,n,r)),(Object(x.b)(n)||Object(x.c)(n,this.hour))&&(Object(x.b)(r)||Object(x.c)(r,this.minute))&&(Object(x.b)(i)||Object(x.c)(i,this.second)))break}},w.prototype.fixDay=function(){if(!(this.day<=28)){var t=r.monthRange(this.year,this.month-1)[1];if(!(this.day<=t))for(;this.day>t;){if(this.day-=t,++this.month,13===this.month&&(this.month=1,++this.year,this.year>r.MAXYEAR))return;t=r.monthRange(this.year,this.month-1)[1]}}},w.prototype.add=function(t,e){var n=t.freq,r=t.interval,i=t.wkst,a=t.byhour,o=t.byminute,s=t.bysecond;switch(n){case y.YEARLY:return this.addYears(r);case y.MONTHLY:return this.addMonths(r);case y.WEEKLY:return this.addWeekly(r,i);case y.DAILY:return this.addDaily(r);case y.HOURLY:return this.addHours(r,e,a);case y.MINUTELY:return this.addMinutes(r,e,a,o);case y.SECONDLY:return this.addSeconds(r,e,a,o,s)}},w);functio
/*!
* rrule.js - Library for working with recurrence rules for calendar dates.
* https://github.com/jakubroztocil/rrule
*
* Copyright 2010, Jakub Roztocil and Lars Schoning
* Licenced under the BSD licence.
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
* Based on:
* python-dateutil - Extensions to the standard Python datetime module.
* Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
* Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
*/e.default=ft},function(t,e,n){"use strict";n.d(e,"a",function(){return r}),n.d(e,"b",function(){return i});var r=["MO","TU","WE","TH","FR","SA","SU"],i=(a.fromStr=function(t){return new a(r.indexOf(t))},a.prototype.nth=function(t){return this.n===t?this:new a(this.weekday,t)},a.prototype.equals=function(t){return this.weekday===t.weekday&&this.n===t.n},a.prototype.toString=function(){var t=r[this.weekday];return this.n&&(t=(0<this.n?"+":"")+String(this.n)+t),t},a.prototype.getJsWeekday=function(){return 6===this.weekday?0:this.weekday+1},a);function a(t,e){if(0===e)throw new Error("Can't create weekday with n == 0");this.weekday=t,this.n=e}},function(t,e,n){"use strict";n.r(e);function r(t,e){return-1!==t.indexOf(e)}function c(t){return t.toString()}function h(t,e,n){return e+" "+n+", "+t}var d={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}},y=n(1),l=n(0);function i(t,e,n,r){if(void 0===e&&(e=c),void 0===n&&(n=d),void 0===r&&(r=h),this.text=[],this.language=n||d,this.gettext=e,this.dateFormatter=r,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(l.f)(this.origOptions.byweekday)){var o=Object(l.d)(this.origOptions.byweekday)?this.origOptions.byweekday:[this.origOptions.byweekday],s=String(o);this.byweekday={allWeeks:o.filter(function(t){return!t.n}),someWeeks:o.filter(function(t){return Boolean(t.n)}),isWeekdays:-1!==s.indexOf("MO")&&-1!==s.indexOf("TU")&&-1!==s.indexOf("WE")&&-1!==s.indexOf("TH")&&-1!==s.indexOf("FR")&&-1===s.indexOf("SA")&&-1===s.indexOf("SU"),isEveryDay:-1!==s.indexOf("MO")&&-1!==s.indexOf("TU")&&-1!==s.indexOf("WE")&&-1!==s.indexOf("TH")&&-1!==s.indexOf("FR")&&-1!==s.indexOf("SA")&&-1!==s.indexOf("SU")};var u=function(t,e){return t.weekday-e.weekday};this.byweekday.allWeeks.sort(u),this.byweekday.someWeeks.sort(u),this.byweekday.allWeeks.length||(this.byweekday.allWeeks=null),this.byweekday.someWeeks.length||(this.byweekday.someWeeks=null)}else this.byweekday=null}var a=(i.isFullyConvertible=function(t){if(!(t.options.freq in i.IMPLEMENTED))return!1;if(t.origOptions.until&&t.origOptions.count)return!1;for(var e in t.origOptions){if(r(["dtstart","wkst","freq"],e))return!0;if(!r(i.IMPLEMENTED[t.options.freq],e))return!1}return!0},i.prototype.isFullyConvertible=function(){return i.isFullyConvertible(this.rrule)},i.prototype.toString=function(){var t=this.gettext;if(!(this.options.freq in i.IMPLEMENTED))return t("RRule error: Unable to fully convert this rrule to text");if(this.text=[t("every")],this[y.default.FREQUENCIES[this.options.freq]](),this.options.until){this.add(t("until"));var e=this.options.until;this.add(this.dateFormatter(e.getUTCFullYear(),this.language.monthNames[e.getUTCMonth()],e.getUTCDate()))}else this.options.count&&this.add(t("for")).add(t
/*!
* rrule.js - Library for working with recurrence rules for calendar dates.
* https://github.com/jakubroztocil/rrule
*
* Copyright 2010, Jakub Roztocil and Lars Schoning
* Licenced under the BSD licence.
* https://github.com/jakubroztocil/rrule/blob/master/LICENCE
*
*/
var u=function(t,e){return void 0===e&&(e=d),new y.default(s(t,e)||void 0)},b=["count","until","interval","byweekday","bymonthday","bymonth"];a.IMPLEMENTED=[],a.IMPLEMENTED[y.default.HOURLY]=b,a.IMPLEMENTED[y.default.MINUTELY]=b,a.IMPLEMENTED[y.default.DAILY]=["byhour"].concat(b),a.IMPLEMENTED[y.default.WEEKLY]=b,a.IMPLEMENTED[y.default.MONTHLY]=b,a.IMPLEMENTED[y.default.YEARLY]=["byweekno","byyearday"].concat(b);var p=function(t,e,n,r){return new a(t,e,n,r).toString()},m=a.isFullyConvertible}],i.c=r,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1);function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}var n,r});