/*! Simple Calendar - 3.3.1
 * https://simplecalendar.io
 * Copyright (c) Xtendify Technologies 2024
 * Licensed GPLv2+ */

(()=>{var ft=Object.create;var it=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var dt=Object.getPrototypeOf,ht=Object.prototype.hasOwnProperty;var Q=(a,$)=>()=>($||a(($={exports:{}}).exports,$),$.exports);var mt=(a,$,U,W)=>{if($&&typeof $=="object"||typeof $=="function")for(let S of lt($))!ht.call(a,S)&&S!==U&&it(a,S,{get:()=>$[S],enumerable:!(W=ct($,S))||W.enumerable});return a};var G=(a,$,U)=>(U=a!=null?ft(dt(a)):{},mt($||!a||!a.__esModule?it(U,"default",{value:a,enumerable:!0}):U,a));var at=Q((K,R)=>{(function(a,$){typeof K=="object"&&typeof R<"u"?R.exports=$():typeof define=="function"&&define.amd?define($):(a=typeof globalThis<"u"?globalThis:a||self).dayjs=$()})(K,function(){"use strict";var a=1e3,$=6e4,U=36e5,W="millisecond",S="second",_="minute",M="hour",T="day",v="week",f="month",l="quarter",m="year",c="date",t="Invalid Date",r=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(o){var n=["th","st","nd","rd"],e=o%100;return"["+o+(n[(e-20)%10]||n[e]||n[0])+"]"}},p=function(o,n,e){var s=String(o);return!s||s.length>=n?o:""+Array(n+1-s.length).join(e)+o},x={s:p,z:function(o){var n=-o.utcOffset(),e=Math.abs(n),s=Math.floor(e/60),i=e%60;return(n<=0?"+":"-")+p(s,2,"0")+":"+p(i,2,"0")},m:function o(n,e){if(n.date()<e.date())return-o(e,n);var s=12*(e.year()-n.year())+(e.month()-n.month()),i=n.clone().add(s,f),u=e-i<0,h=n.clone().add(s+(u?-1:1),f);return+(-(s+(e-i)/(u?i-h:h-i))||0)},a:function(o){return o<0?Math.ceil(o)||0:Math.floor(o)},p:function(o){return{M:f,y:m,w:v,d:T,D:c,h:M,m:_,s:S,ms:W,Q:l}[o]||String(o||"").toLowerCase().replace(/s$/,"")},u:function(o){return o===void 0}},d="en",z={};z[d]=y;var H="$isDayjsObject",b=function(o){return o instanceof j||!(!o||!o[H])},C=function o(n,e,s){var i;if(!n)return d;if(typeof n=="string"){var u=n.toLowerCase();z[u]&&(i=u),e&&(z[u]=e,i=u);var h=n.split("-");if(!i&&h.length>1)return o(h[0])}else{var O=n.name;z[O]=n,i=O}return!s&&i&&(d=i),i||!s&&d},D=function(o,n){if(b(o))return o.clone();var e=typeof n=="object"?n:{};return e.date=o,e.args=arguments,new j(e)},g=x;g.l=C,g.i=b,g.w=function(o,n){return D(o,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var j=function(){function o(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[H]=!0}var n=o.prototype;return n.parse=function(e){this.$d=function(s){var i=s.date,u=s.utc;if(i===null)return new Date(NaN);if(g.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var h=i.match(r);if(h){var O=h[2]-1||0,Y=(h[7]||"0").substring(0,3);return u?new Date(Date.UTC(h[1],O,h[3]||1,h[4]||0,h[5]||0,h[6]||0,Y)):new Date(h[1],O,h[3]||1,h[4]||0,h[5]||0,h[6]||0,Y)}}return new Date(i)}(e),this.init()},n.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},n.$utils=function(){return g},n.isValid=function(){return this.$d.toString()!==t},n.isSame=function(e,s){var i=D(e);return this.startOf(s)<=i&&i<=this.endOf(s)},n.isAfter=function(e,s){return D(e)<this.startOf(s)},n.isBefore=function(e,s){return this.endOf(s)<D(e)},n.$g=function(e,s,i){return g.u(e)?this[s]:this.set(i,e)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(e,s){var i=this,u=!!g.u(s)||s,h=g.p(e),O=function(B,N){var Z=g.w(i.$u?Date.UTC(i.$y,N,B):new Date(i.$y,N,B),i);return u?Z:Z.endOf(T)},Y=function(B,N){return g.w(i.toDate()[B].apply(i.toDate("s"),(u?[0,0,0,0]:[23,59,59,999]).slice(N)),i)},k=this.$W,L=this.$M,I=this.$D,J="set"+(this.$u?"UTC":"");switch(h){case m:return u?O(1,0):O(31,11);case f:return u?O(1,L):O(0,L+1);case v:var F=this.$locale().weekStart||0,P=(k<F?k+7:k)-F;return O(u?I-P:I+(6-P),L);case T:case c:return Y(J+"Hours",0);case M:return Y(J+"Minutes",1);case _:return Y(J+"Seconds",2);case S:return Y(J+"Milliseconds",3);default:return this.clone()}},n.endOf=function(e){return this.startOf(e,!1)},n.$set=function(e,s){var i,u=g.p(e),h="set"+(this.$u?"UTC":""),O=(i={},i[T]=h+"Date",i[c]=h+"Date",i[f]=h+"Month",i[m]=h+"FullYear",i[M]=h+"Hours",i[_]=h+"Minutes",i[S]=h+"Seconds",i[W]=h+"Milliseconds",i)[u],Y=u===T?this.$D+(s-this.$W):s;if(u===f||u===m){var k=this.clone().set(c,1);k.$d[O](Y),k.init(),this.$d=k.set(c,Math.min(this.$D,k.daysInMonth())).$d}else O&&this.$d[O](Y);return this.init(),this},n.set=function(e,s){return this.clone().$set(e,s)},n.get=function(e){return this[g.p(e)]()},n.add=function(e,s){var i,u=this;e=Number(e);var h=g.p(s),O=function(L){var I=D(u);return g.w(I.date(I.date()+Math.round(L*e)),u)};if(h===f)return this.set(f,this.$M+e);if(h===m)return this.set(m,this.$y+e);if(h===T)return O(1);if(h===v)return O(7);var Y=(i={},i[_]=$,i[M]=U,i[S]=a,i)[h]||1,k=this.$d.getTime()+e*Y;return g.w(k,this)},n.subtract=function(e,s){return this.add(-1*e,s)},n.format=function(e){var s=this,i=this.$locale();if(!this.isValid())return i.invalidDate||t;var u=e||"YYYY-MM-DDTHH:mm:ssZ",h=g.z(this),O=this.$H,Y=this.$m,k=this.$M,L=i.weekdays,I=i.months,J=i.meridiem,F=function(N,Z,E,V){return N&&(N[Z]||N(s,u))||E[Z].slice(0,V)},P=function(N){return g.s(O%12||12,N,"0")},B=J||function(N,Z,E){var V=N<12?"AM":"PM";return E?V.toLowerCase():V};return u.replace(w,function(N,Z){return Z||function(E){switch(E){case"YY":return String(s.$y).slice(-2);case"YYYY":return g.s(s.$y,4,"0");case"M":return k+1;case"MM":return g.s(k+1,2,"0");case"MMM":return F(i.monthsShort,k,I,3);case"MMMM":return F(I,k);case"D":return s.$D;case"DD":return g.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return F(i.weekdaysMin,s.$W,L,2);case"ddd":return F(i.weekdaysShort,s.$W,L,3);case"dddd":return L[s.$W];case"H":return String(O);case"HH":return g.s(O,2,"0");case"h":return P(1);case"hh":return P(2);case"a":return B(O,Y,!0);case"A":return B(O,Y,!1);case"m":return String(Y);case"mm":return g.s(Y,2,"0");case"s":return String(s.$s);case"ss":return g.s(s.$s,2,"0");case"SSS":return g.s(s.$ms,3,"0");case"Z":return h}return null}(N)||h.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(e,s,i){var u,h=this,O=g.p(s),Y=D(e),k=(Y.utcOffset()-this.utcOffset())*$,L=this-Y,I=function(){return g.m(h,Y)};switch(O){case m:u=I()/12;break;case f:u=I();break;case l:u=I()/3;break;case v:u=(L-k)/6048e5;break;case T:u=(L-k)/864e5;break;case M:u=L/U;break;case _:u=L/$;break;case S:u=L/a;break;default:u=L}return i?u:g.a(u)},n.daysInMonth=function(){return this.endOf(f).$D},n.$locale=function(){return z[this.$L]},n.locale=function(e,s){if(!e)return this.$L;var i=this.clone(),u=C(e,s,!0);return u&&(i.$L=u),i},n.clone=function(){return g.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},o}(),A=j.prototype;return D.prototype=A,[["$ms",W],["$s",S],["$m",_],["$H",M],["$W",T],["$M",f],["$y",m],["$D",c]].forEach(function(o){A[o[1]]=function(n){return this.$g(n,o[0],o[1])}}),D.extend=function(o,n){return o.$i||(o(n,j,D),o.$i=!0),D},D.locale=C,D.isDayjs=b,D.unix=function(o){return D(1e3*o)},D.en=z[d],D.Ls=z,D.p={},D})});var st=Q((X,tt)=>{(function(a,$){typeof X=="object"&&typeof tt<"u"?tt.exports=$():typeof define=="function"&&define.amd?define($):(a=typeof globalThis<"u"?globalThis:a||self).dayjs_plugin_utc=$()})(X,function(){"use strict";var a="minute",$=/[+-]\d\d(?::?\d\d)?/g,U=/([+-]|\d\d)/g;return function(W,S,_){var M=S.prototype;_.utc=function(t){var r={date:t,utc:!0,args:arguments};return new S(r)},M.utc=function(t){var r=_(this.toDate(),{locale:this.$L,utc:!0});return t?r.add(this.utcOffset(),a):r},M.local=function(){return _(this.toDate(),{locale:this.$L,utc:!1})};var T=M.parse;M.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),T.call(this,t)};var v=M.init;M.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else v.call(this)};var f=M.utcOffset;M.utcOffset=function(t,r){var w=this.$utils().u;if(w(t))return this.$u?0:w(this.$offset)?f.call(this):this.$offset;if(typeof t=="string"&&(t=function(d){d===void 0&&(d="");var z=d.match($);if(!z)return null;var H=(""+z[0]).match(U)||["-",0,0],b=H[0],C=60*+H[1]+ +H[2];return C===0?0:b==="+"?C:-C}(t),t===null))return this;var y=Math.abs(t)<=16?60*t:t,p=this;if(r)return p.$offset=y,p.$u=t===0,p;if(t!==0){var x=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(p=this.local().add(y+x,a)).$offset=y,p.$x.$localOffset=x}else p=this.utc();return p};var l=M.format;M.format=function(t){var r=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return l.call(this,r)},M.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},M.isUTC=function(){return!!this.$u},M.toISOString=function(){return this.toDate().toISOString()},M.toString=function(){return this.toDate().toUTCString()};var m=M.toDate;M.toDate=function(t){return t==="s"&&this.$offset?_(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():m.call(this)};var c=M.diff;M.diff=function(t,r,w){if(t&&this.$u===t.$u)return c.call(this,t,r,w);var y=this.local(),p=_(t).local();return c.call(y,p,r,w)}}})});var rt=Q((et,nt)=>{(function(a,$){typeof et=="object"&&typeof nt<"u"?nt.exports=$():typeof define=="function"&&define.amd?define($):(a=typeof globalThis<"u"?globalThis:a||self).dayjs_plugin_timezone=$()})(et,function(){"use strict";var a={year:0,month:1,day:2,hour:3,minute:4,second:5},$={};return function(U,W,S){var _,M=function(l,m,c){c===void 0&&(c={});var t=new Date(l),r=function(w,y){y===void 0&&(y={});var p=y.timeZoneName||"short",x=w+"|"+p,d=$[x];return d||(d=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:w,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:p}),$[x]=d),d}(m,c);return r.formatToParts(t)},T=function(l,m){for(var c=M(l,m),t=[],r=0;r<c.length;r+=1){var w=c[r],y=w.type,p=w.value,x=a[y];x>=0&&(t[x]=parseInt(p,10))}var d=t[3],z=d===24?0:d,H=t[0]+"-"+t[1]+"-"+t[2]+" "+z+":"+t[4]+":"+t[5]+":000",b=+l;return(S.utc(H).valueOf()-(b-=b%1e3))/6e4},v=W.prototype;v.tz=function(l,m){l===void 0&&(l=_);var c=this.utcOffset(),t=this.toDate(),r=t.toLocaleString("en-US",{timeZone:l}),w=Math.round((t-new Date(r))/1e3/60),y=S(r,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(t.getTimezoneOffset()/15)-w,!0);if(m){var p=y.utcOffset();y=y.add(c-p,"minute")}return y.$x.$timezone=l,y},v.offsetName=function(l){var m=this.$x.$timezone||S.tz.guess(),c=M(this.valueOf(),m,{timeZoneName:l}).find(function(t){return t.type.toLowerCase()==="timezonename"});return c&&c.value};var f=v.startOf;v.startOf=function(l,m){if(!this.$x||!this.$x.$timezone)return f.call(this,l,m);var c=S(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return f.call(c,l,m).tz(this.$x.$timezone,!0)},S.tz=function(l,m,c){var t=c&&m,r=c||m||_,w=T(+S(),r);if(typeof l!="string")return S(l).tz(r);var y=function(z,H,b){var C=z-60*H*1e3,D=T(C,b);if(H===D)return[C,H];var g=T(C-=60*(D-H)*1e3,b);return D===g?[C,D]:[z-60*Math.min(D,g)*1e3,Math.max(D,g)]}(S.utc(l,t).valueOf(),w,r),p=y[0],x=y[1],d=S(p).utcOffset(x);return d.$x.$timezone=r,d},S.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},S.tz.setDefault=function(l){_=l}}})});var q=G(at()),ot=G(st()),ut=G(rt());q.default.extend(ot.default);q.default.extend(ut.default);jQuery(function(a){a(".simcal-default-calendar").each(function(T,v){var f=a(v),l=f.data("calendar-id"),m=f.data("offset"),c=f.data("events-first"),t=f.data("calendar-end"),r=f.find(".simcal-calendar-head"),w=r.find(".simcal-nav-button"),y=f.find(".simcal-ajax-loader"),p=r.find(".simcal-current"),x=p.data("calendar-current"),d=p.find("span.simcal-current-month"),z=p.find("span.simcal-current-year"),H=(0,q.default)(x*1e3).tz(f.data("timezone")),b,C;f.hasClass("simcal-default-calendar-grid")?(C="simcal_default_calendar_draw_grid",b=new Date(H.year(),H.month()),$(w,b.getTime()/1e3,c,t)):(C="simcal_default_calendar_draw_list",U(w,f,c,t,!1,x),W(f)),w.on("click",function(){var D=a(this).hasClass("simcal-next")?"next":"prev";if(C=="simcal_default_calendar_draw_grid"){var g=f.find(".simcal-month"),j,A,o;D=="prev"?j=new Date(b.setMonth(b.getMonth()-1,1)):(j=new Date(b.setMonth(b.getMonth()+2,1)),j.setDate(0),j.setHours(23),j.setMinutes(59),j.setSeconds(59)),A=j.getMonth(),o=j.getFullYear(),a.ajax({url:simcal_default_calendar.ajax_url,type:"POST",dataType:"json",cache:!1,data:{action:C,month:A+1,year:o,id:l},beforeSend:function(){y.fadeToggle()},success:function(u){d.text(simcal_default_calendar.months.full[A]),z.text(o),p.attr("data-calendar-current",j.getTime()/1e3+m+1),$(w,j.getTime()/1e3,c,t),y.fadeToggle(),b=j,g.replaceWith(u.data),_(f,n),M()},error:function(u){console.log(u)}})}else{var n=f.find(".simcal-events-list-container"),e=n.data("prev"),s=n.data("next"),i=D=="prev"?e:s;a.ajax({url:simcal_default_calendar.ajax_url,type:"POST",dataType:"json",cache:!1,data:{action:C,ts:i,id:l},beforeSend:function(){y.fadeToggle()},success:function(u){n.replaceWith(u.data),p.attr("data-calendar-current",i),W(f),U(w,f,c,t,D,i),y.fadeToggle(),M()},error:function(u){console.log(u)}})}})});function $(T,v,f,l){T.each(function(m,c){var t=a(c),r=new Date(v*1e3);t.hasClass("simcal-prev")?(r=new Date(r.setMonth(r.getMonth(),1)),r.setDate(0),r.getTime()/1e3<=f?t.attr("disabled","disabled"):t.removeAttr("disabled")):(r=new Date(r.setMonth(r.getMonth()+1,1)),r.setDate(0),r.setHours(23),r.setMinutes(59),r.setSeconds(59),r.getTime()/1e3>=l?t.attr("disabled","disabled"):t.removeAttr("disabled"))})}function U(T,v,f,l,m,c){var t=v.find(".simcal-events-list-container"),r=t.data("prev"),w=t.data("next"),y=t.find("li.simcal-event:last").data("start");T.each(function(p,x){var d=a(x);m?d.hasClass("simcal-prev")?m=="prev"?r<=f&&c<=f&&d.attr("disabled","disabled"):d.removeAttr("disabled"):d.hasClass("simcal-next")&&(m=="next"?(w>=l&&c>=l||y>=l)&&d.attr("disabled","disabled"):d.removeAttr("disabled")):d.hasClass("simcal-prev")?r<=f&&c<=f&&d.attr("disabled","disabled"):d.hasClass("simcal-next")&&(w>=l&&c>=l||y>=l)&&d.attr("disabled","disabled")})}function W(T){var v=a(T).find(".simcal-current"),f=a(T).find(".simcal-events-list-container"),l=f.data("heading-small"),m=f.data("heading-large"),c=a("<h3 />");T.width()<400?c.text(l):c.text(m),v.html(c)}var S=a(".simcal-default-calendar-grid");function _(T){var v=a(T).find("> table"),f=v.find("thead"),l=f.find("th.simcal-week-day"),m=v.find("td.simcal-day > div"),c=v.find("ul.simcal-events"),t=c.find("> li > .simcal-event-title"),r=v.find(".simcal-events-toggle"),w=v.find("span.simcal-events-dots"),y=v.find(".simcal-tooltip-content"),p=v.find(".simcal-event-toggled"),x=v.data("event-bubble-trigger"),d=m.first().width();if(d<60){l.each(function(H,b){a(b).text(a(b).data("screen-small"))}),c.hide(),t.hide(),r!="undefined"&&(r.hide(),p!="undefined"&&p.show()),w.show(),x="click";var z=d-10+"px";m.css("min-height",z),v.find("span.simcal-events-dots:not(:empty)").css("min-height",z)}else d<=240?l.each(function(H,b){a(b).text(a(b).data("screen-medium"))}):l.each(function(H,b){a(b).text(a(b).data("screen-large"))}),c.show(),t.show(),r!="undefined"&&(r.show(),p!="undefined"&&p.hide()),w.hide(),m.css("min-height",d+"px");m.each(function(H,b){var C=a(b).find("span.simcal-events-dots"),D=a(b).find(".simcal-tooltip"),g,j,A;d<60?(y.show(),g=C):(y.hide(),g=D),g.each(function(o,n){a(n).qtip({content:d<60?a(b).find("ul.simcal-events"):a(n).find("> .simcal-tooltip-content"),position:{my:"top center",at:"bottom center",target:a(n),viewport:d<60?a(window):!0,adjust:{method:"shift",scroll:!1}},style:{def:!1,classes:"simcal-default-calendar simcal-event-bubble"},show:{solo:!0,effect:!1,event:x=="hover"?"mouseenter":"click"},hide:{fixed:!0,effect:!1,event:x=="click"?"unfocus":"mouseleave",delay:100},events:{show:function(e,s){A&&A.id&&A.id!=s.id&&A.hide(),A=s}},overwrite:!1})})})}S.each(function(T,v){_(v),a(v).on("change",function(){_(this)})}),window.onresize=function(){S.each(function(T,v){_(v)})};function M(){a(".simcal-events-toggle").each(function(T,v){var f=a(v).prev(".simcal-events"),l=f.find(".simcal-event-toggled"),m=a(v).find("i");a(v).on("click",function(){m.toggleClass("simcal-icon-rotate-180"),l.slideToggle()})})}M()});})();
//# sourceMappingURL=default-calendar.min.js.map
