/* @license Copyright (C) Exontrol. All rights reserved. */ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(t="undefined"!=typeof globalThis?globalThis:t||self,n(t.exontrol||{}))}(this,function(t){"use strict";function n(t){return null!=t}function i(t){return null==t}var r=r||window.exontrol,e=Math.max,o=Math.min;r.Mrg(r,function(){function t(t){return r.ToS(t).trim()}function s(t,n){var i,e=r.ToS(t);return(n=r.ToS(n,O))&&(i=n.length-e.length)>0&&(e=n.substr(0,i)+e),e}function u(t){return"MINUTELY"==t?"N":t.charAt(0)}function h(t){return t%W}function c(t){return t-h(t)}function a(t,n,i,r,e,o){return Date.Create(t,n,i,r,e,o)}function f(t,r,e){return n(t)&&(t=a(t)),i(t)?t=r||e:(n(r)&&(r=a(r))&&(t=t.getTime()>r.getTime()?t:r),n(e)&&(e=a(e))&&(t=t.getTime()=I&&(this.m-=I,this.y++)},q.prototype.nW=function(t){var n=this.get();n&&this.set(n.NextWeek(t||this.int))},q.prototype.nD=function(t){var n=this.get();n&&this.set(n.NextDay(t||this.int))},q.prototype.nH=function(t){var n=~~((t=t||this.int)/24);n&&this.nD(n),this.h+=t%24,this.h>=24&&(this.h-=24,this.nD(1))},q.prototype.nN=function(t){var n=~~((t=t||this.int)/60);n&&this.nH(n),this.n+=t%60,this.n>=60&&(this.n-=60,this.nH(1))},q.prototype.nS=function(t){var n=~~((t=t||this.int)/60);n&&this.nN(n),this.s+=t%60,this.s>=60&&(this.s-=60,this.nN(1))};var lt={ignoreUnknownRule:!0};return N.version="3.2",N.type="IRecur",N.count=256,N.toU=function(t){return r.ToS(t).toUpperCase()},N.Parse=function(n,i){r.IsO(n)&&(n=function(n){function i(n){return r.IsD(n)?function(t){var n=s(l(t),C)+s(y(t))+s(d(t));return(v(t)||g(t)||D(t))&&(n+=s(v(t))+s(g(t))+s(D(t))+"Z"),n}(n):t(n)}var e="";if(n)for(var o in n)e+=(e.length?F:"")+o+H+i(n[o]);return e}(n)),n=t(n);var e=w.get(n);return!e&&w.set(n,e=new N(i).parse(n)),e},N.prototype.init=function(){this.mR=null,this.oE=null,this.oT=null,this.r=null},N.prototype.parse=function(o){function s(t){var n,i,r,e=void 0;return t&&(n=t.match(P))&&(i=[~~(r=n[1]).substr(0,4),~~r.substr(4,2),~~r.substr(6,2)],Date.parse(i.join("-"))&&(i[1]--,(r=n[2])&&(r=r.substr(1))&&(i.push(~~r.substr(0,2)),i.push(~~r.substr(2,2)),i.push(~~r.substr(4,2))),e=n[3]||!r?new Date(Date.UTC(i[0],i[1],i[2],i[3]||0,i[4]||0,i[5]||0)):new Date(i[0],i[1],i[2],i[3]||0,i[4]||0,i[5]||0),isNaN(e)&&(e=void 0))),e}function h(n,i){this.oE||(this.oE=n,(i=t(i))&&(this.oE=r.Cpy(this.oE))&&(this.oE.desc=this.oE.desc.replace("...",i)))}function c(t,i,r){var e=this.get(t);return n(e)&&(n(e=i.call(this,e))?this.set(t,e):(this.del(t),r&&h.call(this,r))),!this.oE}function f(){function t(){function t(t,n){var i=[],r=[],e={l:!0};this.r.fR(t,e);for(var o=e.s.copy(),s=e.e.getTime();o.getTime()<=s;o.NextDay())this.vBy(o)&&r.push(o.copy());return r.length&&(n?n.forEach(function(t){var n=function(t,n){if(t<0&&(t=n.length+t+1),--t>=0&&t=s)&&h.push(u))}),h}.call(this,l(t.date),this.r.byM,o,s,u,h,e).forEachU(function(r){return!this.enumT(r,function(r){return!t.out(r)&&n.pushnn(i(r.getTime())),t.idle()&&(!t.count||n.len()=-53&&t<=53),i&&(e=(n=n||new Map).get(r),!~(e=e||[]).indexOf(t)&&e.push(t),!e.z&&(e.z=!t),n.set(r,e))))}),n}(t)},at.invalidByDay)&&c.call(this,rt,function(t){return y(t,-31,31,0)},at.invalidByMonthDay)&&c.call(this,et,function(t){return y(t,-366,366,0)},at.invalidByYearDay)&&c.call(this,ut,function(t){return y(t,-366,366,0)},at.invalidBySetPos)&&c.call(this,st,function(t){return y(t,1,12)},at.invalidByMonth)&&c.call(this,tt,function(t){return y(t,0,23)},at.invalidByHour)&&c.call(this,_,function(t){return y(t,0,59)},at.invalidByMinute)&&c.call(this,X,function(t){return y(t,0,60)},at.invalidBySecond)&&(this.oO.ignoreUnknownRule||!(n=function(){var t;return this.mR&&this.mR.forEach(function(n,i){t||ft.has(i)||(t=i)}),t}.call(this))?(this.r={},function(){var t=this.freq();this.r.fR=this["fR"+u(t)].bind(this)}.call(this),function(){var t,n,i=this.r;i.rgqVBy=[],(t=this.bymonth())&&(i.byM=t,i.rgqVBy.push(this.qVbyM)),(t=this.byweekno())&&(i.byW=t,i.rgqVBy.push(this.qVbyW)),(t=this.bymonthday())&&(i.byMD=t,i.rgqVBy.push(this.qVbyMD)),(t=this.byyearday())&&(i.byYD=t,i.rgqVBy.push(this.qVbyYD)),(t=this.byday())&&(i.byD=t,(n=this.freq())==z?i.rgqVBy.push(this.qVbyDM):n==K?i.byM?i.rgqVBy.push(this.qVbyDM):i.rgqVBy.push(this.qVbyDY):i.rgqVBy.push(this.qVbyD))}.call(this),function(){var t=this.r;x.forEachU(function(n){return t[n]&&(t.c=this["c"+r.getP(n)].bind(this))&&(t.cN=n)},this)}.call(this),function(){var t=this.r;t.rgV=[],t.c&&x.forEach(function(n){t[n]&&t.rgV.push(this["v"+r.getP(n)])},this)}.call(this),t.call(this)):h.call(this,at.unknownRule,n))}else h.call(this,at.missFreq);else h.call(this,at.empty);return this}function y(t,n,e,o){var s;return t&&t.split(",").forEach(function(t){r.IsI(t)&&(t=~~t,(i(o)||t!=o)&&t>=n&&t<=e&&!~(s=s||[]).indexOf(t)&&s.push(t))}),s}if(this.init(),o=t(o)){var p,T={P:o,C:0,W:F};for(this.mR=new Map;~T.C;)R(T),~R(p={P:T.V,C:0,W:H})&&this.set(p.V.trim(),N.toU(T.V.substr(p.C).trim()))}return f.call(this)},N.prototype.valid=function(){return!this.oE},N.prototype.error=function(){return this.oE&&this.oE.desc||""},N.prototype.get=function(t){return this.mR&&this.mR.get(N.toU(t))},N.prototype.has=function(t){return this.mR&&this.mR.has(N.toU(t))},N.prototype.set=function(t,n){this.mR&&this.mR.set(N.toU(t),n)},N.prototype.del=function(t){this.mR&&this.mR.delete(N.toU(t))},N.prototype.freq=function(){return this.get("FREQ")},N.prototype.interval=function(){return~~e(1,this.get(J))},N.prototype.count=function(){return~~e(1,this.get($))},N.prototype.dtstart=function(){return this.get(L)||Date.Now()},N.prototype.until=function(){return this.get(Z)},N.prototype.wkst=function(){return this.has(ht)?this.get(ht):1},N.prototype.bymonth=function(){var t=this.get(st);return t&&new r.Arr(t)},N.prototype.byweekno=function(){var t=this.get(ot);return t&&new r.Arr(t)},N.prototype.bymonthday=function(){var t=this.get(rt);return t&&new r.Arr(t)},N.prototype.byyearday=function(){var t=this.get(et);return t&&new r.Arr(t)},N.prototype.byday=function(){return this.get(nt)},N.prototype.bysetpos=function(){var t=this.get(ut);return t&&new r.Arr(t)},N.prototype.dFR=function(t,n,i){if(t.l){var r=this.r.dS.getTime();n=e(n,r),i=e(i,r)}t.s=new Date(n),t.e=new Date(i)},N.prototype.bytime=function(t){var n=this.get(t);return n&&n.slice()},N.prototype.fRY=function(t,n){var i=l(t),r=h(this.r.dS.getTime());return this.dFR(n,Date.UTC(i,0,1)+r,Date.UTC(i,11,31)+r),i},N.prototype.fRM=function(t,n){var i=l(t),r=y(t)-1,e=h(this.r.dS.getTime());return this.dFR(n,Date.UTC(i,r,1)+e,Date.UTC(i,r,E(i,r))+e),r+1},N.prototype.fRW=function(t,n){var i=this.wkst(),r=T(t,i),e=h(this.r.dS.getTime()),o=c(r.getTime());return this.dFR(n,o+e,o+(S-1)*W+e),M(t,i)},N.prototype.fRD=function(t,n){var i=c(t.getTime())+h(this.r.dS.getTime());return this.dFR(n,i,i),d(t)},N.prototype.fRH=function(t,n){return v(t)},N.prototype.fRN=function(t,n){return g(t)},N.prototype.fRS=function(t,n){return D(t)},N.prototype.qVbyM=function(t){return~this.r.byM.indexOf(y(t))},N.prototype.qVbyW=function(t){var n=this.wkst(),i=this.r.byW,r=M(t,n);return~i.indexOf(r)||~i.indexOf(-(Y(l(t),n)-(r-1)))||1==r&&12==y(t)&&~i.indexOf(-Y(l(t)+1,n))||53==r&&1==y(t)&&~i.indexOf(-(Y(l(t)-1,n)-(r-1)))},N.prototype.qVbyMD=function(t){var n=d(t),i=this.r.byMD;return~i.indexOf(n)||~i.indexOf(-(E(l(t),y(t)-1)-(n-1)))},N.prototype.qVbyYD=function(t){var n=function(t){return t.yDay()}(t)+1,i=this.r.byYD;return~i.indexOf(n)||~i.indexOf(-(B(l(t))-(n-1)))},N.prototype.qVbyWD=function(t){return this.r.byD.get(p(t))},N.prototype.qVbyDM=function(t){var n=this.qVbyWD(t);return n&&(n.z||n.forEachU(function(n){return function(n){function i(n){return l(t)==l(n)&&y(t)==y(n)}var r=t.copy().addD(-n*S);return!i(r)&&i(r.addD((n<0?-1:1)*S))}(n)}))},N.prototype.qVbyDY=function(t){var n=this.qVbyWD(t);return n&&(n.z||n.forEachU(function(n){return function(n){function i(n){return l(t)==l(n)}var r=t.copy().addD(-n*S);return!i(r)&&i(r.addD((n<0?-1:1)*S))}(n)}))},N.prototype.qVbyD=function(t){return this.qVbyWD(t)},N.prototype.qVby=function(t){for(var n=!0,i=this.r.rgqVBy,r=0,e=i.length;n&&r=1&&e<=r&&t.add(a(n,o,e).getTime())})})},N.prototype.cByW=function(t,n){var i=this.wkst();this.cBy(t,n,"byW",function(t,n,r){r.forEach(function(r){var o,s=Y(n,i);if(r<0&&(r=s+r+1),r>=1&&r<=s){for(o=T(a(n,1,1),i).addD(e(0,r-1)*S);M(o,i)!=r;)o.NextDay();for(var u=0;u0;e=o?e-1:e+1;for(var s,u=1;u<=I;u++)s=a(n,u,1),(s=o?m(s,r):T(s.NextMonth().PrevDay(),r)).addD(e*S),l(s)==n&&y(s)==u&&t.add(s.getTime())}else i(t,n,r)}:r==K&&(e=function(t,n,r,e){if(e){var o=e>0,s=a(n,1,1);e=o?e-1:e+1,(s=o?m(s,r):T(s.NextYear().PrevDay(),r)).addD(e*S),l(s)==n&&t.add(s.getTime())}else i(t,n,r)}),this.cBy(t,n,"byD",function(t,n,r){r.forEach(function(r,o){r.forEach(function(r){(r?e:i)(t,n,o,r)})})})},N.prototype.cByM=function(t,n){this.cBy(t,n,"byM",function(t,n,i){i.forEach(function(i){for(var r=1,e=E(n,i-1),o=a(n,i,1);r<=e;r++,o.NextDay())t.add(o.getTime())})})},N.prototype.val=function(t,n,i){var e=new r.Arr,o=t.GetYear();return n.call(this,e,o),i&&(n.call(this,e,o-1),n.call(this,e,o+1)),e.has(c(t.getTime()))},N.prototype.vByYD=function(t){return this.val(t,this.cByYD)},N.prototype.vByMD=function(t){return this.val(t,this.cByMD)},N.prototype.vByW=function(t){return this.val(t,this.cByW,!0)},N.prototype.vByD=function(t){return this.val(t,this.cByD)},N.prototype.vByM=function(t){return this.val(t,this.cByM)},N.prototype.vBy=function(t){for(var n=!0,i=this.r.rgV,r=0,e=i.length;n&&rh?1:t.getTime()=0;o--)if(m=B[o]){if(++m.i