MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / Je

Function Je

codebase/dhtmlxscheduler.js:40–40  ·  view source on GitHub ↗
(e,i,t)

Source from the content-addressed store, hash-verified

38`).map(ya).filter(function(t){return t!==null});return te(te({},i[0]),i[1])}function Te(e){var i={},t=/DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(e);if(!t)return i;var n=t[1],s=t[2];return n&&(i.tzid=n),i.dtstart=Re(s),i}function ya(e){if(!(e=e.replace(/^\s+|\s+$/,"")).length)return null;var i=/^([A-Z]+?)[:;]/.exec(e.toUpperCase());if(!i)return gt(e);var t=i[1];switch(t.toUpperCase()){case"RRULE":case"EXRULE":return gt(e);case"DTSTART":return Te(e);default:throw new Error("Unsupported RFC prop ".concat(t," in ").concat(e))}}function gt(e){var i=Te(e.replace(/^RRULE:/i,""));return e.replace(/^(?:RRULE|EXRULE):/i,"").split(";").forEach(function(t){var n=t.split("="),s=n[0],a=n[1];switch(s.toUpperCase()){case"FREQ":i.freq=V[a.toUpperCase()];break;case"WKST":i.wkst=re[a.toUpperCase()];break;case"COUNT":case"INTERVAL":case"BYSETPOS":case"BYMONTH":case"BYMONTHDAY":case"BYYEARDAY":case"BYWEEKNO":case"BYHOUR":case"BYMINUTE":case"BYSECOND":var o=function(d){return d.indexOf(",")!==-1?d.split(",").map(mt):mt(d)}(a),_=s.toLowerCase();i[_]=o;break;case"BYWEEKDAY":case"BYDAY":i.byweekday=function(d){var l=d.split(",");return l.map(function(h){if(h.length===2)return re[h];var p=h.match(/^([+-]?\d{1,2})([A-Z]{2})$/);if(!p||p.length<3)throw new SyntaxError("Invalid weekday string: ".concat(h));var v=Number(p[1]),g=p[2],c=re[g].weekday;return new Z(c,v)})}(a);break;case"DTSTART":case"TZID":var r=Te(e);i.tzid=r.tzid,i.dtstart=r.dtstart;break;case"UNTIL":i.until=Re(a);break;case"BYEASTER":i.byeaster=Number(a);break;default:throw new Error("Unknown RRULE property '"+s+"'")}}),i}function mt(e){return/^[+-]?\d+$/.test(e)?Number(e):e}var Ae=function(){function e(i,t){if(isNaN(i.getTime()))throw new RangeError("Invalid date passed to DateWithZone");this.date=i,this.tzid=t}return Object.defineProperty(e.prototype,"isUTC",{get:function(){return!this.tzid||this.tzid.toUpperCase()==="UTC"},enumerable:!1,configurable:!0}),e.prototype.toString=function(){var i=Ie(this.date.getTime(),this.isUTC);return this.isUTC?":".concat(i):";TZID=".concat(this.tzid,":").concat(i)},e.prototype.getTime=function(){return this.date.getTime()},e.prototype.rezonedDate=function(){return this.isUTC?this.date:(i=this.date,t=this.tzid,n=Intl.DateTimeFormat().resolvedOptions().timeZone,s=new Date(ct(i,n)),a=new Date(ct(i,t??"UTC")).getTime()-s.getTime(),new Date(i.getTime()-a));var i,t,n,s,a},e}();function Fe(e){for(var i=[],t="",n=Object.keys(e),s=Object.keys(Be),a=0;a<n.length;a++)if(n[a]!=="tzid"&&F(s,n[a])){var o=n[a].toUpperCase(),_=e[n[a]],r="";if(J(_)&&(!ee(_)||_.length)){switch(o){case"FREQ":r=z.FREQUENCIES[e.freq];break;case"WKST":r=ie(_)?new Z(_).toString():_.toString();break;case"BYWEEKDAY":o="BYDAY",r=da(_).map(function(v){return v instanceof Z?v:ee(v)?new Z(v[0],v[1]):new Z(v)}).toString();break;case"DTSTART":t=ba(_,e.tzid);break;case"UNTIL":r=Ie(_,!e.tzid);break;default:if(ee(_)){for(var d=[],l=0;l<_.length;l++)d[l]=String(_[l]);r=d.toString()}else r=String(_)}r&&i.push([o,r])}}var h=i.map(function(v){var g=v[0],c=v[1];return"".concat(g,"=").concat(c.toString())}).join(";"),p="";return h!==""&&(p="RRULE:".concat(h)),[t,p].filter(function(v){return!!v}).join(`
39`)}function ba(e,i){return e?"DTSTART"+new Ae(new Date(e),i).toString():""}function xa(e,i){return Array.isArray(e)?!!Array.isArray(i)&&e.length===i.length&&e.every(function(t,n){return t.getTime()===i[n].getTime()}):e instanceof Date?i instanceof Date&&e.getTime()===i.getTime():e===i}var wa=function(){function e(){this.all=!1,this.before=[],this.after=[],this.between=[]}return e.prototype._cacheAdd=function(i,t,n){t&&(t=t instanceof Date?je(t):lt(t)),i==="all"?this.all=t:(n._value=t,this[i].push(n))},e.prototype._cacheGet=function(i,t){var n=!1,s=t?Object.keys(t):[],a=function(l){for(var h=0;h<s.length;h++){var p=s[h];if(!xa(t[p],l[p]))return!0}return!1},o=this[i];if(i==="all")n=this.all;else if(ee(o))for(var _=0;_<o.length;_++){var r=o[_];if(!s.length||!a(r)){n=r._value;break}}if(!n&&this.all){var d=new xe(i,t);for(_=0;_<this.all.length&&d.accept(this.all[_]);_++);n=d.getValue(),this._cacheAdd(i,n,t)}return ee(n)?lt(n):n instanceof Date?je(n):n},e}(),ka=q(q(q(q(q(q(q(q(q(q(q(q(q([],Y(1,31),!0),Y(2,28),!0),Y(3,31),!0),Y(4,30),!0),Y(5,31),!0),Y(6,30),!0),Y(7,31),!0),Y(8,31),!0),Y(9,30),!0),Y(10,31),!0),Y(11,30),!0),Y(12,31),!0),Y(1,7),!0),Ea=q(q(q(q(q(q(q(q(q(q(q(q(q([],Y(1,31),!0),Y(2,29),!0),Y(3,31),!0),Y(4,30),!0),Y(5,31),!0),Y(6,30),!0),Y(7,31),!0),Y(8,31),!0),Y(9,30),!0),Y(10,31),!0),Y(11,30),!0),Y(12,31),!0),Y(1,7),!0),Da=oe(1,29),Sa=oe(1,30),ue=oe(1,31),G=oe(1,32),Ma=q(q(q(q(q(q(q(q(q(q(q(q(q([],G,!0),Sa,!0),G,!0),ue,!0),G,!0),ue,!0),G,!0),G,!0),ue,!0),G,!0),ue,!0),G,!0),G.slice(0,7),!0),Na=q(q(q(q(q(q(q(q(q(q(q(q(q([],G,!0),Da,!0),G,!0),ue,!0),G,!0),ue,!0),G,!0),G,!0),ue,!0),G,!0),ue,!0),G,!0),G.slice(0,7),!0),Ta=oe(-28,0),Aa=oe(-29,0),fe=oe(-30,0),X=oe(-31,0),Ca=q(q(q(q(q(q(q(q(q(q(q(q(q([],X,!0),Aa,!0),X,!0),fe,!0),X,!0),fe,!0),X,!0),X,!0),fe,!0),X,!0),fe,!0),X,!0),X.slice(0,7),!0),Oa=q(q(q(q(q(q(q(q(q(q(q(q(q([],X,!0),Ta,!0),X,!0),fe,!0),X,!0),fe,!0),X,!0),X,!0),fe,!0),X,!0),fe,!0),X,!0),X.slice(0,7),!0),La=[0,31,60,91,121,152,182,213,244,274,305,335,366],$a=[0,31,59,90,120,151,181,212,243,273,304,334,365],vt=function(){for(var e=[],i=0;i<55;i++)e=e.concat(oe(7));return e}();function Ha(e,i){var t,n,s=ge(e,1,1),a=ke(e)?366:365,o=ke(e+1)?366:365,_=qe(s),r=be(s),d=te(te({yearlen:a,nextyearlen:o,yearordinal:_,yearweekday:r},function(N){var m=ke(N)?366:365,x=ge(N,1,1),b=be(x);return m===365?{mmask:ka,mdaymask:Na,nmdaymask:Oa,wdaymask:vt.slice(b),mrange:$a}:{mmask:Ea,mdaymask:Ma,nmdaymask:Ca,wdaymask:vt.slice(b),mrange:La}}(e)),{wnomask:null});if(se(i.byweekno))return d;d.wnomask=Y(0,a+7);var l=t=ae(7-r+i.wkst,7);l>=4?(l=0,n=d.yearlen+ae(r-i.wkst,7)):n=a-l;for(var h=Math.floor(n/7),p=ae(n,7),v=Math.floor(h+p/4),g=0;g<i.byweekno.length;g++){var c=i.byweekno[g];if(c<0&&(c+=v+1),c>0&&c<=v){var u=void 0;c>1?(u=l+7*(c-1),l!==t&&(u-=7-t)):u=l;for(var f=0;f<7&&(d.wnomask[u]=1,u++,d.wdaymask[u]!==i.wkst);f++);}}if(F(i.byweekno,1)&&(u=l+7*v,l!==t&&(u-=7-t),u<a))for(g=0;g<7&&(d.wnomask[u]=1,u+=1,d.wdaymask[u]!==i.wkst);g++);if(l){var y=void 0;if(F(i.byweekno,-1))y=-1;else{var w=be(ge(e-1,1,1)),D=ae(7-w.valueOf()+i.wkst,7),M=ke(e-1)?366:365,k=void 0;D>=4?(D=0,k=M+ae(w-i.wkst,7)):k=a-l,y=Math.floor(52+ae(k,7)/4)}if(F(i.byweekno,y))for(u=0;u<l;u++)d.wnomask[u]=1}return d}var za=function(){function e(i){this.options=i}return e.prototype.rebuild=function(i,t){var n=this.options;if(i!==this.lastyear&&(this.yearinfo=Ha(i,n)),K(n.bynweekday)&&(t!==this.lastmonth||i!==this.lastyear)){var s=this.yearinfo,a=s.yearlen,o=s.mrange,_=s.wdaymask;this.monthinfo=function(r,d,l,h,p,v){var g={lastyear:r,lastmonth:d,nwdaymask:[]},c=[];if(v.freq===z.YEARLY)if(se(v.bymonth))c=[[0,l]];else for(var u=0;u<v.bymonth.length;u++)d=v.bymonth[u],c.push(h.slice(d-1,d+1));else v.freq===z.MONTHLY&&(c=[h.slice(d-1,d+1)]);if(se(c))return g;for(g.nwdaymask=Y(0,l),u=0;u<c.length;u++)for(var f=c[u],y=f[0],w=f[1]-1,D=0;D<v.bynweekday.length;D++){var M=void 0,k=v.bynweekday[D],N=k[0],m=k[1];m<0?(M=w+7*(m+1),M-=ae(p[M]-N,7)):(M=y+7*(m-1),M+=ae(7-p[M]+N,7)),y<=M&&M<=w&&(g.nwdaymask[M]=1)}return g}(i,t,a,o,_,n)}J(n.byeaster)&&(this.eastermask=function(r,d){d===void 0&&(d=0);var l=r%19,h=Math.floor(r/100),p=r%100,v=Math.floor(h/4),g=h%4,c=Math.floor((h+8)/25),u=Math.floor((h-c+1)/3),f=Math.floor(19*l+h-v-u+15)%30,y=Math.floor(p/4),w=p%4,D=Math.floor(32+2*g+2*y-f-w)%7,M=Math.floor((l+11*f+22*D)/451),k=Math.floor((f+D-7*M+114)/31),N=(f+D-7*M+114)%31+1,m=Date.UTC(r,k-1,N+d),x=Date.UTC(r,0,1);return[Math.ceil((m-x)/864e5)]}(i,n.byeaster))},Object.defineProperty(e.prototype,"lastyear",{get:function(){return this.monthinfo?this.monthinfo.lastyear:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastmonth",{get:function(){return this.monthinfo?this.monthinfo.lastmonth:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"yearlen",{get:function(){return this.yearinfo.yearlen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"yearordinal",{get:function(){return this.yearinfo.yearordinal},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mrange",{get:function(){return this.yearinfo.mrange},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wdaymask",{get:function(){return this.yearinfo.wdaymask},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mmask",{get:function(){return this.yearinfo.mmask},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wnomask",{get:function(){return this.yearinfo.wnomask},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nwdaymask",{get:function(){return this.monthinfo?this.monthinfo.nwdaymask:[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextyearlen",{get:function(){return this.yearinfo.nextyearlen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mdaymask",{get:function(){return this.yearinfo.mdaymask},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nmdaymask",{get:function(){return this.yearinfo.nmdaymask},enumerable:!1,configurable:!0}),e.prototype.ydayset=function(){return[oe(this.yearlen),0,this.yearlen]},e.prototype.mdayset=function(i,t){for(var n=this.mrange[t-1],s=this.mrange[t],a=Y(null,this.yearlen),o=n;o<s;o++)a[o]=o;return[a,n,s]},e.prototype.wdayset=function(i,t,n){for(var s=Y(null,this.yearlen+7),a=qe(ge(i,t,n))-this.yearordinal,o=a,_=0;_<7&&(s[a]=a,++a,this.wdaymask[a]!==this.options.wkst);_++);return[s,o,a]},e.prototype.ddayset=function(i,t,n){var s=Y(null,this.yearlen),a=qe(ge(i,t,n))-this.yearordinal;return s[a]=a,[s,a,a+1]},e.prototype.htimeset=function(i,t,n,s){var a=this,o=[];return this.options.byminute.forEach(function(_){o=o.concat(a.mtimeset(i,_,n,s))}),De(o),o},e.prototype.mtimeset=function(i,t,n,s){var a=this.options.bysecond.map(function(o){return new Ne(i,t,o,s)});return De(a),a},e.prototype.stimeset=function(i,t,n,s){return[new Ne(i,t,n,s)]},e.prototype.getdayset=function(i){switch(i){case V.YEARLY:return this.ydayset.bind(this);case V.MONTHLY:return this.mdayset.bind(this);case V.WEEKLY:return this.wdayset.bind(this);case V.DAILY:default:return this.ddayset.bind(this)}},e.prototype.gettimeset=function(i){switch(i){case V.HOURLY:return this.htimeset.bind(this);case V.MINUTELY:return this.mtimeset.bind(this);case V.SECONDLY:return this.stimeset.bind(this)}},e}();function qa(e,i,t,n,s,a){for(var o=[],_=0;_<e.length;_++){var r=void 0,d=void 0,l=e[_];l<0?(r=Math.floor(l/i.length),d=ae(l,i.length)):(r=Math.floor((l-1)/i.length),d=ae(l-1,i.length));for(var h=[],p=t;p<n;p++){var v=a[p];J(v)&&h.push(v)}var g=void 0;g=r<0?h.slice(r)[0]:h[r];var c=i[d],u=st(s.yearordinal+g),f=_t(u,c);F(o,f)||o.push(f)}return De(o),o}function yt(e,i){var t=i.dtstart,n=i.freq,s=i.interval,a=i.until,o=i.bysetpos,_=i.count;if(_===0||s===0)return _e(e);var r=ma.fromDate(t),d=new za(i);d.rebuild(r.year,r.month);for(var l=function(m,x,b){var E=b.freq,S=b.byhour,T=b.byminute,A=b.bysecond;return Ye(E)?function(C){var $=C.dtstart.getTime()%1e3;if(!Ye(C.freq))return[];var H=[];return C.byhour.forEach(function(O){C.byminute.forEach(function(R){C.bysecond.forEach(function(P){H.push(new Ne(O,R,P,$))})})}),H}(b):E>=z.HOURLY&&K(S)&&!F(S,x.hour)||E>=z.MINUTELY&&K(T)&&!F(T,x.minute)||E>=z.SECONDLY&&K(A)&&!F(A,x.second)?[]:m.gettimeset(E)(x.hour,x.minute,x.second,x.millisecond)}(d,r,i);;){var h=d.getdayset(n)(r.year,r.month,r.day),p=h[0],v=h[1],g=h[2],c=Ia(p,v,g,d,i);if(K(o))for(var u=qa(o,l,v,g,d,p),f=0;f<u.length;f++){var y=u[f];if(a&&y>a)return _e(e);if(y>=t){var w=bt(y,i);if(!e.accept(w)||_&&!--_)return _e(e)}}else for(f=v;f<g;f++){var D=p[f];if(J(D))for(var M=st(d.yearordinal+D),k=0;k<l.length;k++){var N=l[k];if(y=_t(M,N),a&&y>a||y>=t&&(w=bt(y,i),!e.accept(w)||_&&!--_))return _e(e)}}if(i.interval===0||(r.add(i,c),r.year>9999))return _e(e);Ye(n)||(l=d.gettimeset(n)(r.hour,r.minute,r.second,0)),d.rebuild(r.year,r.month)}}function ja(e,i,t){var n=t.bymonth,s=t.byweekno,a=t.byweekday,o=t.byeaster,_=t.bymonthday,r=t.bynmonthday,d=t.byyearday;return K(n)&&!F(n,e.mmask[i])||K(s)&&!e.wnomask[i]||K(a)&&!F(a,e.wdaymask[i])||K(e.nwdaymask)&&!e.nwdaymask[i]||o!==null&&!F(e.eastermask,i)||(K(_)||K(r))&&!F(_,e.mdaymask[i])&&!F(r,e.nmdaymask[i])||K(d)&&(i<e.yearlen&&!F(d,i+1)&&!F(d,-e.yearlen+i)||i>=e.yearlen&&!F(d,i+1-e.yearlen)&&!F(d,-e.nextyearlen+i-e.yearlen))}function bt(e,i){return new Ae(e,i.tzid).rezonedDate()}function _e(e){return e.getValue()}function Ia(e,i,t,n,s){for(var a=!1,o=i;o<t;o++){var _=e[o];(a=ja(n,_,s))&&(e[_]=null)}return a}var re={MO:new Z(0),TU:new Z(1),WE:new Z(2),TH:new Z(3),FR:new Z(4),SA:new Z(5),SU:new Z(6)},Be={freq:V.YEARLY,dtstart:null,interval:1,wkst:re.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},Ra=Object.keys(Be),z=function(){function e(i,t){i===void 0&&(i={}),t===void 0&&(t=!1),this._cache=t?null:new wa,this.origOptions=pt(i);var n=va(i).parsedOptions;this.options=n}return e.parseText=function(i,t){return ft(i,t)},e.fromText=function(i,t){return pa(i,t)},e.fromString=function(i){return new e(e.parseString(i)||void 0)},e.prototype._iter=function(i){return yt(i,this.options)},e.prototype._cacheGet=function(i,t){return!!this._cache&&this._cache._cacheGet(i,t)},e.prototype._cacheAdd=function(i,t,n){if(this._cache)return this._cache._cacheAdd(i,t,n)},e.prototype.all=function(i){if(i)return this._iter(new ht("all",{},i));var t=this._cacheGet("all");return t===!1&&(t=this._iter(new xe("all",{})),this._cacheAdd("all",t)),t},e.prototype.between=function(i,t,n,s){if(n===void 0&&(n=!1),!Ee(i)||!Ee(t))throw new Error("Invalid date passed in to RRule.between");var a={before:t,after:i,inc:n};if(s)return this._iter(new ht("between",a,s));var o=this._cacheGet("between",a);return o===!1&&(o=this._iter(new xe("between",a)),this._cacheAdd("between",o,a)),o},e.prototype.before=function(i,t){if(t===void 0&&(t=!1),!Ee(i))throw new Error("Invalid date passed in to RRule.before");var n={dt:i,inc:t},s=this._cacheGet("before",n);return s===!1&&(s=this._iter(new xe("before",n)),this._cacheAdd("before",s,n)),s},e.prototype.after=function(i,t){if(t===void 0&&(t=!1),!Ee(i))throw new Error("Invalid date passed in to RRule.after");var n={dt:i,inc:t},s=this._cacheGet("after",n);return s===!1&&(s=this._iter(new xe("after",n)),this._cacheAdd("after",s,n)),s},e.prototype.count=function(){return this.all().length},e.prototype.toString=function(){return Fe(this.origOptions)},e.prototype.toText=function(i,t,n){return function(s,a,o,_){return new de(s,a,o,_).toString()}(this,i,t,n)},e.prototype.isFullyConvertibleToText=function(){return ga(this)},e.prototype.clone=function(){return new e(this.origOptions)},e.FREQUENCIES=["YEARLY","MONTHLY","WEEKLY","DAILY","HOURLY","MINUTELY","SECONDLY"],e.YEARLY=V.YEARLY,e.MONTHLY=V.MONTHLY,e.WEEKLY=V.WEEKLY,e.DAILY=V.DAILY,e.HOURLY=V.HOURLY,e.MINUTELY=V.MINUTELY,e.SECONDLY=V.SECONDLY,e.MO=re.MO,e.TU=re.TU,e.WE=re.WE,e.TH=re.TH,e.FR=re.FR,e.SA=re.SA,e.SU=re.SU,e.parseString=Ve,e.optionsToString=Fe,e}(),xt={dtstart:null,cache:!1,unfold:!1,forceset:!1,compatible:!1,tzid:null};function Pa(e,i){var t=[],n=[],s=[],a=[],o=Te(e),_=o.dtstart,r=o.tzid,d=function(l,h){if(h===void 0&&(h=!1),l=l&&l.trim(),!l)throw new Error("Invalid empty string");if(!h)return l.split(/\s/);for(var p=l.split(`
40`),v=0;v<p.length;){var g=p[v]=p[v].replace(/\s+$/g,"");g?v>0&&g[0]===" "?(p[v-1]+=g.slice(1),p.splice(v,1)):v+=1:p.splice(v,1)}return p}(e,i.unfold);return d.forEach(function(l){var h;if(l){var p=function(f){var y=function(k){if(k.indexOf(":")===-1)return{name:"RRULE",value:k};var N=(b=k,E=":",S=1,T=b.split(E),S?T.slice(0,S).concat([T.slice(S).join(E)]):T),m=N[0],x=N[1],b,E,S,T;return{name:m,value:x}}(f),w=y.name,D=y.value,M=w.split(";");if(!M)throw new Error("empty property name");return{name:M[0].toUpperCase(),parms:M.slice(1),value:D}}(l),v=p.name,g=p.parms,c=p.value;switch(v.toUpperCase()){case"RRULE":if(g.length)throw new Error("unsupported RRULE parm: ".concat(g.join(",")));t.push(Ve(l));break;case"RDATE":var u=((h=/RDATE(?:;TZID=([^:=]+))?/i.exec(l))!==null&&h!==void 0?h:[])[1];u&&!r&&(r=u),n=n.concat(wt(c,g));break;case"EXRULE":if(g.length)throw new Error("unsupported EXRULE parm: ".concat(g.join(",")));s.push(Ve(c));break;case"EXDATE":a=a.concat(wt(c,g));break;case"DTSTART":break;default:throw new Error("unsupported property: "+v)}}}),{dtstart:_,tzid:r,rrulevals:t,rdatevals:n,exrulevals:s,exdatevals:a}}function me(e,i){return i===void 0&&(i={}),function(t,n){var s=Pa(t,n),a=s.rrulevals,o=s.rdatevals,_=s.exrulevals,r=s.exdatevals,d=s.dtstart,l=s.tzid,h=n.cache===!1;if(n.compatible&&(n.forceset=!0,n.unfold=!0),n.forceset||a.length>1||o.length||_.length||r.length){var p=new Ua(h);return p.dtstart(d),p.tzid(l||void 0),a.forEach(function(g){p.rrule(new z(Je(g,d,l),h))}),o.forEach(function(g){p.rdate(g)}),_.forEach(function(g){p.exrule(new z(Je(g,d,l),h))}),r.forEach(function(g){p.exdate(g)}),n.compatible&&n.dtstart&&p.rdate(d),p}var v=a[0]||{};return new z(Je(v,v.dtstart||n.dtstart||d,v.tzid||n.tzid||l),h)}(e,function(t){var n=[],s=Object.keys(t),a=Object.keys(xt);if(s.forEach(function(o){F(a,o)||n.push(o)}),n.length)throw new Error("Invalid options: "+n.join(", "));return te(te({},xt),t)}(i))}function Je(e,i,t){return te(te({},e),{dtstart:i,tzid:t})}function wt(e,i){return function(t){t.forEach(function(n){if(!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(n))throw new Error("unsupported RDATE/EXDATE parm: "+n)})}(i),e.split(",").map(function(t){return Re(t)})}function kt(e){var i=this;return function(t){if(t!==void 0&&(i["_".concat(e)]=t),i["_".concat(e)]!==void 0)return i["_".concat(e)];for(var n=0;n<i._rrule.length;n++){var s=i._rrule[n].origOptions[e];if(s)return s}}}var Ua=function(e){function i(t){t===void 0&&(t=!1);var n=e.call(this,{},t)||this;return n.dtstart=kt.apply(n,["dtstart"]),n.tzid=kt.apply(n,["tzid"]),n._rrule=[],n._rdate=[],n._exrule=[],n._exdate=[],n}return Ue(i,e),i.prototype._iter=function(t){return function(n,s,a,o,_,r){var d={},l=n.accept;function h(c,u){a.forEach(function(f){f.between(c,u,!0).forEach(function(y){d[Number(y)]=!0})})}_.forEach(function(c){var u=new Ae(c,r).rezonedDate();d[Number(u)]=!0}),n.accept=function(c){var u=Number(c);return isNaN(u)?l.call(this,c):!(!d[u]&&(h(new Date(u-1),new Date(u+1)),!d[u]))||(d[u]=!0,l.call(this,c))},n.method==="between"&&(h(n.args.after,n.args.before),n.accept=function(c){var u=Number(c);return!!d[u]||(d[u]=!0,l.call(this,c))});for(var p=0;p<o.length;p++){var v=new Ae(o[p],r).rezonedDate();if(!n.accept(new Date(v.getTime())))break}s.forEach(function(c){yt(n,c.options)});var g=n._result;switch(De(g),n.method){case"all":case"between":return g;case"before":return g.length&&g[g.length-1]||null;default:return g.length&&g[0]||null}}(t,this._rrule,this._exrule,this._rdate,this._exdate,this.tzid())},i.prototype.rrule=function(t){Et(t,this._rrule)},i.prototype.exrule=function(t){Et(t,this._exrule)},i.prototype.rdate=function(t){Dt(t,this._rdate)},i.prototype.exdate=function(t){Dt(t,this._exdate)},i.prototype.rrules=function(){return this._rrule.map(function(t){return me(t.toString())})},i.prototype.exrules=function(){return this._exrule.map(function(t){return me(t.toString())})},i.prototype.rdates=function(){return this._rdate.map(function(t){return new Date(t.getTime())})},i.prototype.exdates=function(){return this._exdate.map(function(t){return new Date(t.getTime())})},i.prototype.valueOf=function(){var t=[];return!this._rrule.length&&this._dtstart&&(t=t.concat(Fe({dtstart:this._dtstart}))),this._rrule.forEach(function(n){t=t.concat(n.toString().split(`
41`))}),this._exrule.forEach(function(n){t=t.concat(n.toString().split(`
42`).map(function(s){return s.replace(/^RRULE:/,"EXRULE:")}).filter(function(s){return!/^DTSTART/.test(s)}))}),this._rdate.length&&t.push(St("RDATE",this._rdate,this.tzid())),this._exdate.length&&t.push(St("EXDATE",this._exdate,this.tzid())),t},i.prototype.toString=function(){return this.valueOf().join(`
43`)},i.prototype.clone=function(){var t=new i(!!this._cache);return this._rrule.forEach(function(n){return t.rrule(n.clone())}),this._exrule.forEach(function(n){return t.exrule(n.clone())}),this._rdate.forEach(function(n){return t.rdate(new Date(n.getTime()))}),this._exdate.forEach(function(n){return t.exdate(new Date(n.getTime()))}),t},i}(z);function Et(e,i){if(!(e instanceof z))throw new TypeError(String(e)+" is not RRule instance");F(i.map(String),String(e))||i.push(e)}function Dt(e,i){if(!(e instanceof Date))throw new TypeError(String(e)+" is not Date instance");F(i.map(Number),Number(e))||(i.push(e),De(i))}function St(e,i,t){var n=!t||t.toUpperCase()==="UTC",s=n?"".concat(e,":"):"".concat(e,";TZID=").concat(t,":"),a=i.map(function(o){return Ie(o.valueOf(),n)}).join(",");return"".concat(s).concat(a)}class Ya{constructor(i){this._scheduler=i}getNode(){const i=this._scheduler;return this._tooltipNode||(this._tooltipNode=document.createElement("div"),this._tooltipNode.className="dhtmlXTooltip scheduler_tooltip tooltip",i._waiAria.tooltipAttr(this._tooltipNode)),i.config.rtl?this._tooltipNode.classList.add("dhtmlXTooltip_rtl"):this._tooltipNode.classList.remove("dhtmlXTooltip_rtl"),this._tooltipNode}setViewport(i){return this._root=i,this}show(i,t){const n=this._scheduler,s=n.$domHelpers,a=document.body,o=this.getNode();if(s.isChildOf(o,a)||(this.hide(),a.appendChild(o)),this._isLikeMouseEvent(i)){const _=this._calculateTooltipPosition(i);t=_.top,i=_.left}return o.style.top=t+"px",o.style.left=i+"px",n._waiAria.tooltipVisibleAttr(o),this}hide(){const i=this._scheduler,t=this.getNode();return t&&t.parentNode&&t.parentNode.removeChild(t),i._waiAria.tooltipHiddenAttr(t),this}setContent(i){return this.getNode().innerHTML=i,this}_isLikeMouseEvent(i){return!(!i||typeof i!="object")&&"clientX"in i&&"clientY"in i}_getViewPort(){return this._root||document.body}_calculateTooltipPosition(i){const t=this._scheduler,n=t.$domHelpers,s=this._getViewPortSize(),a=this.getNode(),o={top:0,left:0,width:a.offsetWidth,height:a.offsetHeight,bottom:0,right:0},_=t.config.tooltip_offset_x,r=t.config.tooltip_offset_y,d=document.body,l=n.getRelativeEventPosition(i,d),h=n.getNodePosition(d);l.y+=h.y,o.top=l.y,o.left=l.x,o.top+=r,o.left+=_,o.bottom=o.top+o.height,o.right=o.left+o.width;const p=window.scrollY+d.scrollTop;return o.top<s.top-p?(o.top=s.top,o.bottom=o.top+o.height):o.bottom>s.bottom&&(o.bottom=s.bottom,o.top=o.bottom-o.height),o.left<s.left?(o.left=s.left,o.right=s.left+o.width):o.right>s.right&&(o.right=s.right,o.left=o.right-o.width),l.x>=o.left&&l.x<=o.right&&(o.left=l.x-o.width-_,o.right=o.left+o.width),l.y>=o.top&&l.y<=o.bottom&&(o.top=l.y-o.height-r,o.bottom=o.top+o.height),o.left<0&&(o.left=0),o.right<0&&(o.right=0),o}_getViewPortSize(){const i=this._scheduler,t=i.$domHelpers,n=this._getViewPort();let s,a=n,o=window.scrollY+document.body.scrollTop,_=window.scrollX+document.body.scrollLeft;return n===i.$event_data?(a=i.$event,o=0,_=0,s=t.getNodePosition(i.$event)):s=t.getNodePosition(a),{left:s.x+_,top:s.y+o,width:s.width,height:s.height,bottom:s.y+s.height+o,right:s.x+s.width+_}}}class Va{constructor(i){this._listeners={},this.tooltip=new Ya(i),this._scheduler=i,this._domEvents=i._createDomEventScope(),this._initDelayedFunctions()}destructor(){this.tooltip.hide(),this._domEvents.detachAll()}hideTooltip(){this.delayHide()}attach(i){let t=document.body;const n=this._scheduler,s=n.$domHelpers;i.global||(t=n.$root);let a=null;const o=_=>{const r=s.getTargetNode(_),d=s.closest(r,i.selector);if(s.isChildOf(r,this.tooltip.getNode()))return;const l=()=>{a=d,i.onmouseenter(_,d)};n._mobile&&n.config.touch_tooltip&&(d?l():i.onmouseleave(_,d)),a?d&&d===a?i.onmousemove(_,d):(i.onmouseleave(_,a),a=null,d&&d!==a&&l()):d&&l()};this.detach(i.selector),this._domEvents.attach(t,"mousemove",o),this._listeners[i.selector]={node:t,handler:o}}detach(i){const t=this._listeners[i];t&&this._domEvents.detach(t.node,"mousemove",t.handler)}tooltipFor(i){const t=n=>{let s=n;return document.createEventObject&&!document.createEvent&&(s=document.createEventObject(n)),s};this._initDelayedFunctions(),this.attach({selector:i.selector,global:i.global,onmouseenter:(n,s)=>{const a=i.html(n,s);a&&this.delayShow(t(n),a)},onmousemove:(n,s)=>{const a=i.html(n,s);a?this.delayShow(t(n),a):(this.delayShow.$cancelTimeout(),this.delayHide())},onmouseleave:()=>{this.delayShow.$cancelTimeout(),this.delayHide()}})}_initDelayedFunctions(){const i=this._scheduler;this.delayShow&&this.delayShow.$cancelTimeout(),this.delayHide&&this.delayHide.$cancelTimeout(),this.tooltip.hide(),this.delayShow=ne.delay((t,n)=>{i.callEvent("onBeforeTooltip",[t])===!1?this.tooltip.hide():(this.tooltip.setContent(n),this.tooltip.show(t))},i.config.tooltip_timeout||1),this.delayHide=ne.delay(()=>{this.delayShow.$cancelTimeout(),this.tooltip.hide()},i.config.tooltip_hide_timeout||1)}}const Fa={active_links:function(e){e.config.active_link_view="day",e._active_link_click=function(i){var t=i.target.getAttribute("data-link-date"),n=e.date.str_to_date(e.config.api_date,!1,!0);if(t)return e.setCurrentView(n(t),e.config.active_link_view),i&&i.preventDefault&&i.preventDefault(),!1},e.attachEvent("onTemplatesReady",function(){var i=function(n,s){s=s||n+"_scale_date",e.templates["_active_links_old_"+s]||(e.templates["_active_links_old_"+s]=e.templates[s]);var a=e.templates["_active_links_old_"+s],o=e.date.date_to_str(e.config.api_date);e.templates[s]=function(_){return"<a data-link-date='"+o(_)+"' href='#'>"+a(_)+"</a>"}};if(i("week"),i("","month_day"),this.matrix)for(var t in this.matrix)i(t);this._detachDomEvent(this._obj,"click",e._active_link_click),e.event(this._obj,"click",e._active_link_click)})},agenda_legacy:function(e){e.date.add_agenda_legacy=function(i){return e.date.add(i,1,"year")},e.templates.agenda_legacy_time=function(i,t,n){return n._timed?this.day_date(n.start_date,n.end_date,n)+" "+this.event_date(i):e.templates.day_date(i)+" &ndash; "+e.templates.day_date(t)},e.templates.agenda_legacy_text=function(i,t,n){return n.text},e.templates.agenda_legacy_date=function(){return""},e.date.agenda_legacy_start=function(){return e.date.date_part(e._currentDate())},e.attachEvent("onTemplatesReady",function(){var i=e.dblclick_dhx_cal_data;e.dblclick_dhx_cal_data=function(){if(this._mode=="agenda_legacy")!this.config.readonly&&this.config.dblclick_create&&this.addEventNow();else if(i)return i.apply(this,arguments)};var t=e.render_data;e.render_data=function(a){if(this._mode!="agenda_legacy")return t.apply(this,arguments);s()};var n=e.render_view_data;function s(){var a=e.get_visible_events();a.sort(function(f,y){return f.start_date>y.start_date?1:-1});for(var o,_="<div class='dhx_agenda_area' "+e._waiAria.agendaDataAttrString()+">",r=0;r<a.length;r++){var d=a[r],l=d.color?"--dhx-scheduler-event-background:"+d.color+";":"",h=d.textColor?"--dhx-scheduler-event-color:"+d.textColor+";":"",p=e.templates.event_class(d.start_date,d.end_date,d);o=e._waiAria.agendaEventAttrString(d);var v=e._waiAria.agendaDetailsBtnString();_+="<div "+o+" class='dhx_agenda_line"+(p?" "+p:"")+"' event_id='"+d.id+"' "+e.config.event_attribute+"='"+d.id+"' style='"+h+l+(d._text_style||"")+"'><div class='dhx_agenda_event_time'>"+(e.config.rtl?e.templates.agenda_time(d.end_date,d.start_date,d):e.templates.agenda_time(d.start_date,d.end_date,d))+"</div>",_+=`<div ${v} class='dhx_event_icon icon_details'><svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">

Callers 1

meFunction · 0.85

Calls 1

teFunction · 0.70

Tested by

no test coverage detected