PageSourceSearch

https://calsouth.com/wp-content/plugins/stachethemes_event_calendar/assets/js/front/stec.min.js?ver=3.3.1

js calsouth.com collected 2026-10-02 17:04:11 UTC 124,629 bytes, 1 lines download raw bytes

1!function($){"use strict";function StachethemesEventCalendar(){const __=(new window.StecHelper).lang;var main=this,moment=window.moment,instance="",$instance="",glob={options:{date:{day:1,month:1,year:2021},set day(value){this.date.day=parseInt(value,10),$instance.find(".stec-event-submission-form").trigger("stec-day-change",this.date)},set month(value){this.date.month=parseInt(value,10)},set year(value){this.date.year=parseInt(value,10)},get day(){return this.date.day},get month(){return this.date.month},get year(){return this.date.year},monthLabelsShort:[__("jan"),__("feb"),__("mar"),__("apr"),__("may"),__("jun"),__("jul"),__("aug"),__("sep"),__("oct"),__("nov"),__("dec")],monthLabels:[__("january"),__("february"),__("march"),__("april"),__("may"),__("june"),__("july"),__("august"),__("september"),__("october"),__("november"),__("december")],dayLabels:[__("sunday"),__("monday"),__("tuesday"),__("wednesday"),__("thursday"),__("friday"),__("saturday")],dayLabelsShort:[__("sun"),__("mon"),__("tue"),__("wed"),__("thu"),__("fri"),__("sat")],myLocation:""},template:{eventCreateForm:"",event:"",gridevent:"",boxgridevent:"",eventInner:"",tooltip:"",preloader:"",share:"",emailEvent:""},temp:[],blockAction:!1,ajax:null,timeout:[]},helper,calData,DB,reminder,rsvp,booking,shop,preloader_add=function(){$("#stec-init-preloader-"+glob.options.id).show()},preloader_count=function(number){$("#stec-init-preloader-"+glob.options.id).find(".stec-init-preloader-count").text(number)},preloader_destroy=function(){$("#stec-init-preloader-"+glob.options.id).remove()},eventsHandler={init:function(){this.bindControls()},bindControls:function(){var parent=this;$(document).on(helper.clickHandle(),$instance.$events.path+" a",(function(e){return e.stopPropagation(),!0})),$(document).on(helper.clickHandle(),$instance.$events.path+".stec-layout-event-preview-right-event-toggle:not('.stec-layout-event-create-form-preview-right-event-toggle')",(function(e){var $event;e.preventDefault(),e.stopPropagation(),$event=$(this).parents(".stec-layout-event"),parent.eventToggle($event)})),$(document).on(helper.clickHandle(),$instance.$events.path+".stec-layout-event:not('.stec-event-create-form, .stec-layout-event-awaiting-approval')",(function(e){var $event;e.preventDefault(),$event=$(this),parent.eventToggle($event)})),$(document).on(helper.clickHandle(),$instance.$events.path+".stec-layout-event-inner",(function(e){e.stopPropagation()})),$(document).on(helper.clickHandle(),$instance.$events.path+".stec-layout-event-inner-top-tabs li",(function(e){e.preventDefault(),parent.activateTab($(this))})),$(document).on(helper.clickHandle(),"#stec-layout-event-inner-"+glob.options.id+" .stec-layout-event-inner-top-tabs li",(function(e){e.preventDefault(),parent.activateTab($(this))})),$(document).on(helper.clickHandle(),"#stec-layout-event-inner-"+glob.options.id+" .stec-layout-event-inner-close",(function(e){e.preventDefault(),$(this).parents(".stec-layout-event-inner-out-wrapper").remove(),$("body").removeClass("stec-modal-opened stec-no-scroll")})),$(document).on(helper.clickHandle(),"#stec-layout-event-inner-"+glob.options.id,(function(e){e.stopPropagation()})),$(document).on(helper.clickHandle(),"#stec-layout-event-inner-out-wrapper-"+glob.options.id,(function(e){e.preventDefault(),$(this).remove(),$("body").removeClass("stec-modal-opened stec-no-scroll"),$instance.trigger("onEventToggleClose")}))},setEventTabs:function($event){var event=calData.getEventById($event.attr("data-id")),tabs=0,hasCustomTabs=$event.find(".stec-layout-event-inner-top-tabs-content > div").length>8;0===parseInt(event.comments,10)?$event.find('.stec-layout-event-inner-top-tabs [data-tab="stec-layout-event-inner-comments"]').remove():tabs++,event.location.full_address?tabs++:$event.find('.stec-layout-event-inner-top-tabs [data-tab="stec-layout-event-inner-location"]').remove(),event.location.coordinates&&glob.options.general_settings.weather_api_key?tabs++:$event.find('.stec-layout-event-inner-top-tabs [data-tab="stec-layout-event-inner-forecast"]').remove(),event.schedule.length<=0?$event.find('.stec-layout-event-inner-top-tabs [data-tab="stec-layout-event-inner-schedule"]').remove():tabs++,event.guests.length<=0?$event.find('.stec-layout-event-inner-top-tabs [data-tab="stec-layout-event-inner-guests"]').remove():tabs++,event.attendance.length<=0?$event.find('.stec-layout-event-inner-top-tabs [data-tab="stec-layout-event-inner-attendance"]').remove():tabs++,event.products.length<=0?$event.find('.stec-layout-event-inner-top-tabs [data-tab="stec-layout-event-inner-shop"]').remove():tabs++,tabs<1&&!1===hasCustomTabs&&$event.find(".stec-layout-event-inner-top-tabs").hide()},eventToggle:function($event){var event,dateTime,repeatOffset,id,external,$siblings,$modal,$container,target="_blank";switch(glob.options.general_settings.event_open_target&&(target=glob.options.general_settings.event_open_target),glob.options.general_settings.open_event_in){case"single":return window.open($event.data("permalink"),target),!1;case"external":if(id=$event.attr("data-id"),external=(event=calData.getEventById(id)).link.url)return window.open(external,target),!1;break;case"modal":$event.find(".stec-layout-event-inner").length<=0&&$(glob.template.eventInner).addClass("stec-modal").appendTo($event),this.setEventTabs($event),event=calData.getEventById($event.attr("data-id")),repeatOffset=$event.attr("data-repeat-time-offset"),dateTime=helper.beautifyTimespan(moment.tz(event.start_date,event.timezone).add(repeatOffset,"seconds"),moment.tz(event.end_date,event.timezone).add(repeatOffset,"seconds"),event.all_day),$modal=$event.find(".stec-modal"),$('<p class="stec-layout-event-inner-intro-datetime stec-style-title2">'+dateTime+"</p>").insertAfter($modal.find(".stec-layout-event-inner-intro-title").parent()),$modal.appendTo("body"),$modal.attr("id","stec-layout-event-inner-"+glob.options.id),$modal.data("event-id",$event.attr("data-id")),$modal.data("repeat-time-offset",$event.attr("data-repeat-time-offset")),$modal.wrap('<div id="stec-layout-event-inner-out-wrapper-'+glob.options.id+'" class="stec-layout-event-inner-out-wrapper stec-modal"></div>'),$('<i class="stec-layout-event-inner-close fa fa-times"></i>').appendTo($modal),$modal.find(".stec-layout-event-inner-top-tabs").children("li.active").length<=0&&$modal.find(".stec-layout-event-inner-top-tabs").children("li").first().trigger(helper.clickHandle()),$(window).trigger("stec-trigger-resize"),$("body").addClass("stec-modal-opened stec-no-scroll"),$modal.show(),helper.focus($modal),$instance.trigger("onEventToggleOpen",{$instance:$instance,$container:$modal,event:event,glob:glob,helper:helper,repeatOffset:$event.attr("data-repeat-time-offset")});break;default:$event.hasClass("active")?($event.removeClass("active").find(".stec-layout-event-preview-right-event-toggle").removeClass("active"),$instance.trigger("onEventToggleClose")):($event.find(".stec-layout-event-inner").length<=0&&$(glob.template.eventInner).appendTo($event),$event.addClass("active").find(".stec-layout-event-preview-right-event-toggle").addClass("active"),($siblings=$instance.$events.find(".stec-layout-event").not($event)).removeClass("active").find(".stec-layout-event-preview-right-event-toggle").removeClass("active"),this.setEventTabs($event),$event.find(".stec-layout-event-inner-top-tabs").children("li.active").length<=0&&$event.find(".stec-layout-event-inner-top-tabs").children("li").first().trigger(helper.clickHandle()),event=calData.getEventById($event.attr("data-id")),($container=$event.find(".stec-layout-event-inner")).data("event-id",$event.attr("data-id")),$container.data("repeat-time-offset",$event.attr("data-repeat-time-offset")),$instance.trigger("onEventToggleOpen",{$instance:$instance,$container:$container,event:event,glob:glob,helper:helper,repeatOffset:$event.attr("data-repeat-time-offset")}),helper.focus($event))}},activateTab:function($tab){var tabClass;$tab.hasClass("active")||($tab.addClass("active").siblings().removeClass("active"),$tab.parents(".stec-layout-event-inner").find(".stec-layout-event-inner-top-tabs-content").children(".active").removeClass("active"),tabClass="."+$tab.attr("data-tab"),$tab.parents(".stec-layout-event-inner").find(tabClass).addClass("active"),$(document).trigger("stec-tab-click-"+glob.options.id))},eventHolder:{getEventHolder:function(){var $eventHolder="";switch(glob.options.view){case"agenda":$eventHolder=$instance.$agenda.find(".stec-event-holder");break;case"month":$eventHolder=$instance.$month.find(".stec-event-holder");break;case"week":$eventHolder=$instance.$week.find(".stec-event-holder");break;case"day":$eventHolder=$instance.$day.find(".stec-event-holder");break;case"map":$eventHolder=$instance.$map.find(".stec-event-holder")}return $eventHolder},removeEvents:function(){$(document).unbind("stec-tab-click-"+glob.options.id),$(window).unbind("resize.stec-unbind-window-resize-on-event-close-"+glob.options.id),$instance.$events.not(".stec-layout-agenda-events-all").children().remove()},displayEvents:function(eventsArray){var d=helper.newDate(glob.options.year,glob.options.month,glob.options.day),events=eventsArray||calData.getEvents(d,!1);if(events.length<=0)return!1;switch($(events).each((function(){var event=this,extraClass=[],date,gmtUtcOffset,timezoneOffsetLabel,icon=[],d1,eventState;switch((helper.getEventState(this)>0||"EventCancelled"===event.event_status||"0"===glob.options.general_settings.reminder)&&extraClass.push("stec-layout-event-no-reminder"),date=helper.beautifyTimespan(event.start_date,1!==parseInt(event.hide_end,10)&&event.end_date,event.all_day),0===(gmtUtcOffset=(gmtUtcOffset=parseInt(event.timezone_utc_offset,10)/3600)>0?"+"+gmtUtcOffset:gmtUtcOffset)&&(gmtUtcOffset=""),timezoneOffsetLabel=0===parseInt(glob.options.general_settings.date_label_gmtutc,10)?"":"UTC/GMT "+gmtUtcOffset,parseInt(this.featured,10)){case 1:extraClass.push("stec-event-featured");break;case 2:extraClass.push("stec-event-featured stec-event-featured-bg")}switch("EventCancelled"===event.event_status&&extraClass.push("stec-event-cancelled"),"icon"!==event.icon_type||event.icon&&"fa"!==event.icon||extraClass.push("stec-no-icon"),event.edit_link||extraClass.push("stec-no-edit"),(event.description_short&&"1"===glob.options.general_settings.preview_desc||event.location.full_address&&"1"===glob.options.general_settings.preview_location)&&extraClass.push("stec-layout-event-preview-size-big"),event.icon_type){case"image":event.icon_images.length>0?(icon.push('<div class="stec-layout-event-preview-left-icon-images">'),$.each(event.icon_images_meta,(function(i){icon.push('<div class="stec-layout-event-preview-left-icon-image '+(0===i?"active":"")+'" style="background-image: url('+this.src+')"></div>')})),icon.push("</div>")):icon.push('<i class="'+event.icon+'"></i>');break;case"date":d1=moment(event.start_date),icon.push('<span class="stec-layout-event-preview-left-icon-date"><span class="stec-layout-event-preview-left-icon-date-number">'+d1.format("D")+'</span><span class="stec-layout-event-preview-left-icon-date-month">'+__(d1.format("MMM").toLowerCase())+"</span></span>");break;default:icon.push('<i class="'+event.icon+'"></i>')}$(glob.template.event).addClass(extraClass.join(" ")).attr("data-id",event.i
1d).attr("data-repeat-time-offset",event.repeat_time_offset?event.repeat_time_offset:0).data("permalink",helper.getPermalink(event.permalink,event.repeat_time_offset)).html((function(index,html){var $html=$(html),eventStatusHtml=[];switch(event.location.full_address&&"1"===glob.options.general_settings.preview_location||$html.find(".stec-layout-event-preview-left-text-location").remove(),event.description_short&&"1"===glob.options.general_settings.preview_desc||$html.find(".stec-layout-event-preview-left-text-desc").remove(),glob.temp.EventPreviewHtml=$html.get(0).outerHTML,$instance.trigger("stecBeforeReturnEventPreviewHtml",{$instance:$instance,event:event,temp:glob.temp}),event.event_status){case"EventCancelled":eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="cancelled">'+__("Cancelled")+"</span></p>");break;case"EventMovedOnline":eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="moved-online">'+__("Moved Online")+"</span></p>");break;case"EventPostponed":eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="postponed">'+__("Postponed")+"</span></p>");break;case"EventRescheduled":eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="rescheduled">'+__("Rescheduled")+"</span></p>");break;default:eventStatusHtml=[]}return 0===event.approved&&eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="unapproved">'+__("Awaiting Approval")+"</span></p>"),glob.temp.EventPreviewHtml.replace("stec_replace_event_status",eventStatusHtml.join("")).replace("stec_replace_summary",event.title).replace("stec_replace_location",(function(){return"virtual"===event.location.type?__("Online Event"):event.location.title?[event.location.title,event.location.full_address].join(", "):event.location.full_address})).replace("stec_replace_desc_short",event.description_short).replace("stec_replace_date",date+" "+timezoneOffsetLabel).replace('stec_replace_event_background=""',' style="background:'+event.color+'" ').replace("stec_replace_icon",icon.join("")).replace(/#stec_replace_edit_link/g,event.edit_link)})).appendTo($instance.$events.not(".stec-layout-agenda-events-all"))})),glob.options.general_settings.open_event_in){case"single":case"external":case"modal":$instance.$events.not(".stec-layout-agenda-events-all").find(".stec-layout-event-preview-right-event-toggle").remove()}return!0},close:function(){$instance.$events.not(".stec-layout-agenda-events-all").find(".active").removeClass("active"),this.getEventHolder().hide(),"month"===glob.options.view&&$instance.$month.find(".stec-layout-month-weekrow").last().addClass("stec-layout-month-weekrow-last"),"week"===glob.options.view&&$instance.$week.find(".stec-layout-week-weekrow").addClass("stec-layout-week-weekrow-last"),helper.extendBind("stachethemes_ec_extend","onEventHolderClose"),this.removeEvents()},open:function(){var result;this.close(),result=this.displayEvents(),"day"===glob.options.view&&(!1===result?$instance.$day.find(".stec-layout-day-noevents").show():$instance.$day.find(".stec-layout-day-noevents").hide()),!1===result&&0===parseInt(glob.options.general_settings.show_create_event_form,10)||("month"===glob.options.view&&($instance.$month.find(".stec-layout-month-eventholder").is(":last-child")?$instance.$month.find(".stec-layout-month-weekrow-last").removeClass("stec-layout-month-weekrow-last"):$instance.$month.find("tr").last().addClass("stec-layout-month-weekrow-last"),helper.focus($instance.$month.find(".stec-layout-month-daycell.active"))),"week"===glob.options.view&&$instance.$week.find(".stec-layout-week-weekrow-last").removeClass("stec-layout-week-weekrow-last"),helper.extendBind("stachethemes_ec_extend","onEventHolderOpen"),helper.animate.eventHolder.open(this.getEventHolder()))},openEvents:function(eventsArray,callback,instant){var result;this.close(),result=this.displayEvents(eventsArray),"day"===glob.options.view&&(!1===result?$instance.$day.find(".stec-layout-day-noevents").show():$instance.$day.find(".stec-layout-day-noevents").hide()),!1===result&&0===parseInt(glob.options.general_settings.show_create_event_form,10)||("month"===glob.options.view&&($instance.$month.find(".stec-layout-month-eventholder").is(":last-child")?$instance.$month.find(".stec-layout-month-weekrow-last").removeClass("stec-layout-month-weekrow-last"):$instance.$month.find("tr").last().addClass("stec-layout-month-weekrow-last"),helper.focus($instance.$month.find(".stec-layout-month-daycell.active"))),"week"===glob.options.view&&$instance.$week.find(".stec-layout-week-weekrow-last").removeClass("stec-layout-week-weekrow-last"),helper.extendBind("stachethemes_ec_extend","onEventHolderOpen"),helper.animate.eventHolder.open(this.getEventHolder(),callback,instant))}}}
1,top={dropDownScrollSpeed:1e3,init:function(){this.bindControls(),this.bindMobile(),2===parseInt(glob.options.general_settings.show_calfilter,10)&&this.setStaticFilterMenu(),$instance.$top.find(".stec-top-menu").children().length<=0&&$instance.$top.find(".stec-top-menu").remove()},setStaticFilterMenu:function(){var $filterIcon=$instance.$top.find(".stec-top-menu-filter"),$filterMenu=$instance.$top.find(".stec-top-menu-filter-dropdown");$filterIcon.remove(),$filterMenu.addClass("active static")},bindMobile:function(){helper.isMobile()&&($(document).on(helper.clickHandle(),(function(){$instance.$top.find(".mobile-hover").removeClass("mobile-hover")})),$instance.$top.find(".stec-top-dropmenu-layouts").children("li").on(helper.clickHandle(),(function(e){e.preventDefault(),e.stopPropagation(),$(this).toggleClass("mobile-hover"),$instance.find(".stec-top-menu-filter").removeClass("active"),$instance.find(".stec-top-menu-filter-dropdown:not(.static)").removeClass("active"),$instance.find(".stec-top-menu-filter-dropdown").children(".stec-style-flexbox").children().removeClass("active"),$instance.find(".stec-top-menu-filter-dropdown > div > div").find("> div > i:last-child").removeClass("fa-chevron-down").addClass("fa-chevron-right")})),$instance.$top.find(".stec-top-menu-date").children("li").on(helper.clickHandle(),(function(e){var html=[],theMonth,i,d,maxMonthDays,j,weekNumber,theWeek,format,label,y;if(e.preventDefault(),$(this).toggleClass("mobile-hover"),$(this).hasClass("mobile-hover")){if(e.stopPropagation(),$(this).hasClass("stec-top-menu-date-day")){for($(this).prop("hovering",!0),$(this).find(".stec-top-menu-date-dropdown ul").remove(),d=glob.options.day,html.push("<ul>"),maxMonthDays=(theMonth=helper.getMonthInfo()).monthLength,j=0;j<3;j++)d=d-1<1?maxMonthDays:d-1;for(i=0;i<5;i++)d=d+1>maxMonthDays?1:d+1,html.push('<li><p data-day="'+d+'">'+d+"</p></li>");html.push("</ul>"),$(this).find(".stec-top-menu-date-control-up").after(html.join("")),top.dateDropdownSetActive()}if($(this).hasClass("stec-top-menu-date-week")){switch($(this).find(".stec-top-menu-date-dropdown ul").remove(),(weekNumber=helper.newDate(glob.options.year,glob.options.month,glob.options.day)).setDate(weekNumber.getDate()-21),format="",glob.options.general_settings.date_format){case"dd.mm.yyyy":format="sday. smonth - eday. emonth. eyear";break;case"dd-mm-yy":format="sday smonth - eday emonth eyear";break;case"mm-dd-yy":format="smonth sday - emonth eday eyear";break;case"yy-mm-dd":default:format="smonth sday - eyear emonth eday"}for(html.push("<ul>"),i=0;i<5;i++)weekNumber.setDate(weekNumber.getDate()+7),theWeek=helper.getWeekInfo(weekNumber),label=helper.getWeekLabel(format,theWeek),html.push('<li><p data-week="'+theWeek.week+'" data-date="'+theWeek.start.year+"-"+theWeek.start.month+"-"+theWeek.start.day+'">'+label+"</p></li>");html.push("</ul>"),$(this).find(".stec-top-menu-date-control-up").after(html.join("")),top.dateDropdownSetActive()}if($(this).hasClass("stec-top-menu-date-month")){for($(this).find(".stec-top-menu-date-dropdown ul").remove(),theMonth=glob.options.month,i=0;i<3;i++)theMonth=theMonth-1<0?11:theMonth-1;for(html.push("<ul>"),i=0;i<5;i++)theMonth=theMonth+1>11?0:theMonth+1,html.push('<li><p data-month="'+theMonth+'">'+glob.options.monthLabels[theMonth]+"</p></li>");html.push("</ul>"),$(this).find(".stec-top-menu-date-control-up").after(html.join("")),top.dateDropdownSetActive()}if($(this).hasClass("stec-top-menu-date-year")){for($(this).find(".stec-top-menu-date-dropdown ul").remove(),y=glob.options.year,html.push("<ul>"),y-=3,i=0;i<5;i++)y++,html.push('<li><p data-year="'+y+'">'+y+"</p></li>");html.push("</ul>"),$(this).find(".stec-top-menu-date-control-up").after(html.join("")),top.dateDropdownSetActive()}}})),$instance.$top.find(".stec-top-menu-date-control-up, .stec-top-menu-date-control-down").on(helper.clickHandle(),(function(e){e.stopPropagation()})))},bindControls:function(){var parent=this;$(document).on(helper.clickHandle(),(function(){$instance.find(".stec-top-menu-filter").removeClass("active"),$instance.find(".stec-top-menu-filter-dropdown:not(.static)").removeClass("active"),$instance.find(".stec-top-menu-search").removeClass("active")})),$instance.$top.find("[data-view]").on(helper.clickHandle(),(function(){glob.options.view=$(this).attr("data-view"),main.refreshState("layout")})),$instance.$top.find(".stec-top-menu-date-year").length>0&&$instance.$top.find(".stec-top-menu-date-year").get(0).addEventListener("wheel",(function(e){e.preventDefault(),e.wheelDelta>0||e.detail<0?parent.dateYearScrollUp():parent.dateYearScrollDown()}),{passive:!1}),$instance.$top.find(".stec-top-menu-date-month").length>0&&$instance.$top.find(".stec-top-menu-date-month").get(0).addEventListener("wheel",(function(e){e.preventDefault(),e.wheelDelta>0||e.detail<0?parent.dateMonthScrollUp():parent.dateMonthScrollDown()}),{passive:!1}),$instance.$top.find(".stec-top-menu-date-week").length>0&&$instance.$top.find(".stec-top-menu-date-week").get(0).addEventListener("wheel",(function(e){e.preventDefault(),e.wheelDelta>0||e.detail<0?parent.dateWeekScrollUp():parent.dateWeekScrollDown()}),{passive:!1}),$instance.$top.find(".stec-top-menu-date-day").length>0&&$instance.$top.find(".stec-top-menu-date-day").get(0).addEventListener("wheel",(function(e){e.preventDefault(),e.wheelDelta>0||e.detail<0?parent.dateDayScrollUp():parent.dateDayScrollDown()}),{passive:!1}),$instance.$top.find(".stec-top-menu-date-year, .stec-top-menu-date-month, .stec-top-menu-date-week, .stec-top-menu-date-day").on("mouseleave",(function(){$(this).prop("hovering",null)})),$instance.$top.find(".stec-top-menu-date-day").on("mouseenter",(function(){var html=[],dayNumber,theMonth,maxD,i,j;if(!$(this).prop("hovering")){for($(this).prop("hovering",!0),$(this).find(".stec-top-menu-date-dropdown ul").remove(),dayNumber=glob.options.day,html.push("<ul>"),maxD=(theMonth=helper.getMonthInfo()).monthLength,j=0;j<3;j++)dayNumber=dayNumber-1<1?maxD:dayNumber-1;for(i=0;i<5;i++)dayNumber=dayNumber+1>maxD?1:dayNumber+1,html.push('<li><p data-day="'+dayNumber+'">'+dayNumber+"</p></li>");html.push("</ul>"),$(this).find(".stec-top-menu-date-control-up").after(html.join("")),top.dateDropdownSetActive()}})),$instance.$top.find(".stec-top-menu-date-week").on("mouseenter",(function(){var format,weekNumber,i,html=[],theWeek,label;if(!$(this).prop("hovering")){$(this).prop("hovering",!0),$(this).find(".stec-top-menu-date-dropdown ul").remove(),weekNumber=helper.newDate(glob.options.year,glob.options.month,glob.options.day);for(let x=0;x<3&&!(weekNumber.getFullYear()<=0);x++)weekNumber.setDate(weekNumber.getDate()-7);switch(format="",glob.options.general_settings.date_format){case"dd.mm.yyyy":format="sday. smonth - eday. emonth. eyear";break;case"dd-mm-yy":format="sday smonth - eday emonth eyear";break;case"mm-dd-yy":format="smonth sday - emonth eday eyear";break;case"yy-mm-dd":default:format="smonth sday - eyear emonth eday"}for(html.push("<ul>"),i=0;i<5;i++)weekNumber.setDate(weekNumber.getDate()+7),theWeek=helper.getWeekInfo(weekNumber),label=helper.getWeekLabel(format,theWeek),html.push('<li><p data-week="'+theWeek.week+'" data-date="'+theWeek.start.year+"-"+theWeek.start.month+"-"+theWeek.start.day+'">'+label+"</p></li>");html.push("</ul>"),$(this).find(".stec-top-menu-date-control-up").after(html.join("")),top.dateDropdownSetActive()}})),$instance.$top.find(".stec-top-menu-date-month").on("mouseenter",(function(){var html=[],monthNumber,i;if(!$(this).prop("hovering")){for($(this).prop("hovering",!0),$(this).find(".stec-top-menu-date-dropdown ul").remove(),monthNumber=glob.options.month,i=0;i<3;i++)monthNumber=monthNumber-1<0?11:monthNumber-1;for(html.push("<ul>"),i=0;i<5;i++)monthNumber=monthNumber+1>11?0:monthNumber+1,html.push('<li><p data-month="'+monthNumber+'">'+glob.options.monthLabels[monthNumber]+"</p></li>");html.push("</ul>"),$(this).find(".stec-top-menu-date-control-up").after(html.join("")),top.dateDropdownSetActive()}})),$instance.$top.find(".stec-top-menu-date-year").on("mouseenter",(function(){var html=[],y,i;if(!$(this).prop("hovering")){$(this).prop("hovering",!0),$(this).find(".stec-top-menu-date-dropdown ul").remove(),y=glob.options.year,html.push("<ul>");for(let x=0;x<3&&!(y<=0);x++)y--;for(i=0;i<5;i++)y++,html.push('<li><p data-year="'+y+'">'+y+"</p></li>");html.push("</ul>"),$(this).find(".stec-top-menu-date-control-up").after(html.join("")),top.dateDropdownSetActive()}})),$instance.$top.find(".stec-top-menu-date-week .stec-top-menu-date-control-up").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.dateWeekScrollUp()})),$instance.$top.find(".stec-top-menu-date-week .stec-top-menu-date-control-down").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.dateWeekScrollDown()})),$instance.$top.find(".stec-top-menu-date-year .stec-top-menu-date-control-up").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.dateYearScrollUp()})),$instance.$top.find(".stec-top-menu-date-year .stec-top-menu-date-control-down").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.dateYearScrollDown()})),$instance.$top.find(".stec-top-menu-date-month .stec-top-menu-date-control-up").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.dateMonthScrollUp()})),$instance.$top.find(".stec-top-menu-date-month .stec-top-menu-date-control-down").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.dateMonthScrollDown()})),$instance.$top.find(".stec-top-menu-date-day .stec-top-menu-date-control-up").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.dateDayScrollUp()})),$instance.$top.find(".stec-top-menu-date-day .stec-top-menu-date-control-down").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.dateDayScrollDown()})),$(document).on(helper.clickHandle(),$instance.$top.path+".stec-top-menu-date-month ul li",(function(e){var month,theMonth;e.preventDefault(),month=$(this).find("[data-month]").attr("data-month"),glob.options.month=parseInt(month,10),theMonth=helper.getMonthInfo(),glob.options.day>theMonth.monthLength&&(glob.options.day=parseInt(theMonth.monthLength,10)),main.refreshState("layout")})),$(document).on(helper.clickHandle(),$instance.$top.path+".stec-top-menu-date-year ul li",(function(e){var year;e.preventDefault(),year=$(this).find("[data-year]").attr("data-year"),glob.options.year=parseInt(year,10),main.refreshState("layout")})),$(document).on(helper.clickHandle(),$instance.$top.path+".stec-top-menu-date-week ul li",(function(e){var d;e.preventDefault(),d=helper.getDateFromData($(this).find("[data-date]").attr("data-date")),glob.options.year=d.getFullYear(),glob.options.month=d.getMonth(),glob.options.day=d.getDate(),main.refreshState("layout")})),$(document).on(helper.clickHandle(),$instance.$top.path+".stec-top-menu-date-day ul li",(function(e){e.preventDefault(),glob.options.day=parseInt($(this).find("[data-day]").attr("data-day"),10),main.refreshState("layout")})),$instance.$top.find("[data-action='previous']").on(helper.clickHandle(),(function(e){var theMonth,theWeek,next;switch(e.preventDefault(),glob.options.view){case"boxgrid":case"grid":case"agenda":glob.options.month=glob.options.month-1,glob.options.month<0&&(glob.options.month=11,glob.options.year=glob.options.year-1),glob.options.day=1,glob.options.year<=0&&(glob.options.day=1,glob.options.month=0,glob.options.year=1),main.refreshState("layout");break;case"map":case"month":glob.options.month=glob.options.month-1,glob.options.month<0&&(glob.options.month=11,glob.options.year=glob.options.year-1),glob.options.year<=0&&(glob.options.day=1,glob.options.month=0,glob.options.year=1),main.refreshState("layout");break;case"week":theWeek=helper.getWeekInfo(),next=helper.newDate(theWeek.start.year,theWeek.start.month,theWeek.start.day-7),glob.options.year=next.getFullYear(),glob.options.month=next.getMonth(),glob.options.day=next.getDate(),glob.options.year<=0&&(glob.options.day=1,glob.options.month=0,glob.options.year=1),main.refreshState("layout");break;case"day":glob.options.day-1<1?glob.options.month-1<0?(glob.options.year=glob.options.year-1,glob.options.month=11,theMonth=helper.getMonthInfo(),glob.options.day=theMonth.monthLength):(glob.options.month=glob.options.month-1,theMonth=helper.getMonthInfo(),glob.options.day=theMonth.monthLength):glob.options.day=glob.options.day-1,glob.options.year<=0&&(glob.options.day=1,glob.options.month=0,glob.options.year=1),main.refreshState("layout")}})),$instance.$top.find("[data-action='next']").on(helper.clickHandle(),(function(e){var theWeek,next,theMonth;switch(e.preventDefault(),glob.options.view){case"boxgrid":case"grid":case"agenda":glob.options.month=glob.options.month+1,glob.options.month>11&&(glob.options.month=0,glob.options.year=glob.options.year+1),glob.options.day=1,main.refreshState("layout");break;case"map":case"month":glob.options.month=glob.options.month+1,glob.options.month>11&&(glob.options.month=0,glob.options.year=glob.options.year+1),main.refreshState("layout");break;case"week":theWeek=helper.getWeekInfo(),next=helper.newDate(theWeek.start.year,theWeek.start.month,theWeek.start.day+7),glob.options.year=next.getFullYear(),glob.options.month=next.getMonth(),glob.options.day=next.getDate(),main.refreshState("layout");break;case"day":theMonth=helper.getMonthInfo(),glob.options.day+1>theMonth.monthLength?glob.options.month+1>11?(glob.options.year=glob.options.year+1,glob.options.month=0,glob.options.day=1):(glob.options.month=glob.options.month+1,glob.options.day=1):glob.options.day=glob.options.day+1,main.refreshState("layout")}})),$instance.$top.find("[data-action='today']").on(helper.clickHandle(),(function(e){var today;e.preventDefault(),today=new Date,glob.options.year=today.getFullYear(),glob.options.month=today.getMonth(),glob.options.day=today.getDate(),main.refreshState("layout")}))},set:function(){var events=[],rad,theWeek,label,format;switch(events.length>0?($instance.$top.find(".stec-top-menu-count").text(events.length),$instance.$top.find(".stec-top-menu-count").show()):$instance.$top.find(".stec-top-menu-count").hide(),$instance.$top.find("[data-view]").removeClass("active"),$instance.$top.find("[data-view='"+glob.options.view+"']").addClass("active"),$instance.$top.find(".stec-top-menu-date-month").hide(),$instance.$top.find(".stec-top-menu-date-year").hide(),$instance.$top.find(".stec-top-menu-date-week").hide(),$instance.$top.find(".stec-top-menu-date-day").hide(),glob.options.view){case"boxgrid":case"grid":case"agenda":switch(rad=$instance.$top.find(".stec-top-menu-date-year").css("border-top-right-radius"),$instance.$top.find(".stec-top-menu-date-month, .stec-top-menu-date-month .stec-top-menu-date-dropdown").css({borderTopLeftRadius:rad,borderBottomLeftRadius:rad}),$instance.$top.find(".stec-top-menu-date-month").show(),$instance.$top.find(".stec-top-menu-date-year").show(),$instance.$top.find(".stec-top-menu-date-month > [data-month]").attr("data-month",glob.options.month).text(glob.options.monthLabels[glob.options.month]),$instance.$top.find(".stec-top-menu-date-day").show(),$instance.$top.find(".stec-top-menu-date-day > [data-day]").attr("data-month",glob.options.day).text(glob.options.day),$instance.find(".stec-top-menu-date-year > [data-year]").attr("data-year",glob.options.year).text(glob.options.year),glob.options.general_settings.date_format){case"dd.mm.yyyy":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.day+". "+glob.options.monthLabels[glob.options.month]+" "+glob.options.year);break;case"dd-mm-yy":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.day+" "+glob.options.monthLabels[glob.options.month]+" "+glob.options.year);break;case"mm-dd-yy":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.monthLabels[glob.options.month]+" "+glob.options.day+" "+glob.options.year);break;case"yy-mm-dd":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.year+" "+glob.options.monthLabels[glob.options.month]+" "+glob.options.day)}break;case"map":case"month":switch(rad=$instance.$top.find(".stec-top-menu-date-year").css("border-top-right-radius"),$instance.$top.find(".stec-top-menu-date-month, .stec-top-menu-date-month .stec-top-menu-date-dropdown").css({borderTopLeftRadius:rad,borderBottomLeftRadius:rad}),$instance.$top.find(".stec-top-menu-date-month").show(),$ins
1tance.$top.find(".stec-top-menu-date-year").show(),$instance.$top.find(".stec-top-menu-date-month > [data-month]").attr("data-month",glob.options.month).text(glob.options.monthLabels[glob.options.month]),$instance.find(".stec-top-menu-date-year > [data-year]").attr("data-year",glob.options.year).text(glob.options.year),glob.options.general_settings.date_format){case"dd.mm.yyyy":case"dd-mm-yy":case"mm-dd-yy":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.monthLabels[glob.options.month]+" "+glob.options.year);break;case"yy-mm-dd":default:$instance.$top.find(".stec-top-menu-date-small").text(glob.options.year+" "+glob.options.monthLabels[glob.options.month])}break;case"week":if((theWeek=helper.getWeekInfo()).start.year===theWeek.end.year)if(theWeek.start.month===theWeek.end.month)switch(glob.options.general_settings.date_format){case"dd.mm.yyyy":format="sday. - eday. emonth. eyear";break;case"dd-mm-yy":format="sday - eday emonth eyear";break;case"mm-dd-yy":format="sday - emonth eday eyear";break;case"yy-mm-dd":default:format="sday - eyear emonth eday"}else switch(glob.options.general_settings.date_format){case"dd.mm.yyyy":format="sday. smonth. - eday. emonth. eyear";break;case"dd-mm-yy":format="sday smonth - eday emonth eyear";break;case"mm-dd-yy":format="smonth sday - emonth eday eyear";break;case"yy-mm-dd":default:format="smonth sday - eyear emonth eday"}else switch(glob.options.general_settings.date_format){case"dd.mm.yyyy":format="sday. smonth. syear - eday. emonth. eyear";break;case"dd-mm-yy":format="sday smonth syear - eday emonth eyear";break;case"mm-dd-yy":format="smonth sday syear - emonth eday eyear";break;case"yy-mm-dd":default:format="syear smonth sday - eyear emonth eday"}label=format,label=helper.getWeekLabel(label,theWeek),$instance.$top.find(".stec-top-menu-date-week").show(),$instance.$top.find(".stec-top-menu-date-week > [data-week]").attr("data-week",theWeek.week).text(label),$instance.$top.find(".stec-top-menu-date-small").text(label);break;case"day":switch($instance.$top.find(".stec-top-menu-date-month").css({borderRadius:0}).find(".stec-top-menu-date-dropdown").css({borderTopLeftRadius:0}),$instance.$top.find(".stec-top-menu-date-day").show(),$instance.$top.find(".stec-top-menu-date-month").show(),$instance.$top.find(".stec-top-menu-date-year").show(),$instance.$top.find(".stec-top-menu-date-day > [data-day]").attr("data-day",glob.options.day).text(glob.options.day),$instance.$top.find(".stec-top-menu-date-month > [data-month]").attr("data-month",glob.options.month).text(glob.options.monthLabels[glob.options.month]),$instance.$top.find(".stec-top-menu-date-year > [data-year]").attr("data-year",glob.options.year).text(glob.options.year),glob.options.general_settings.date_format){case"dd.mm.yyyy":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.day+". "+glob.options.monthLabels[glob.options.month]+" "+glob.options.year);break;case"dd-mm-yy":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.day+" "+glob.options.monthLabels[glob.options.month]+" "+glob.options.year);break;case"mm-dd-yy":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.monthLabels[glob.options.month]+" "+glob.options.day+" "+glob.options.year);break;case"yy-mm-dd":$instance.$top.find(".stec-top-menu-date-small").text(glob.options.year+" "+glob.options.monthLabels[glob.options.month]+" "+glob.options.day)}}this.dateDropdownSetActive()},dateDropdownSetActive:function(){var theWeek,weekDate;$instance.$top.find(".stec-top-menu-date-dropdown .active").removeClass("active"),$instance.$top.find(".stec-top-menu-date-dropdown").find('[data-day="'+glob.options.day+'"]').parent().addClass("active"),$instance.$top.find(".stec-top-menu-date-dropdown").find('[data-month="'+glob.options.month+'"]').parent().addClass("active"),$instance.$top.find(".stec-top-menu-date-dropdown").find('[data-year="'+glob.options.year+'"]').parent().addClass("active"),weekDate=(theWeek=helper.getWeekInfo()).start.year+"-"+theWeek.start.month+"-"+theWeek.start.day,$instance.$top.find(".stec-top-menu-date-dropdown").find('[data-date="'+weekDate+'"]').parent().addClass("active")},dateMonthScrollDown:function(){var parent=this,monthNumber,html=[],i;for($instance.$top.find(".stec-top-menu-date-month").find("ul").stop(!0,!0),monthNumber=$instance.$top.find(".stec-top-menu-date-month").find("ul").first().find("li").last().find("[data-month]").attr("data-month"),monthNumber=parseInt(monthNumber,10),i=0;i<=5;i++)monthNumber=monthNumber+1>11?0:monthNumber+1,html.push('<li><p data-month="'+monthNumber+'">'+glob.options.monthLabels[monthNumber]+"</p></li>");$instance.$top.find(".stec-top-menu-date-month ul li").last().after(html.join("")),$instance.$top.find(".stec-top-menu-date-month").find("ul").css({top:45}).stop(!0,!0).animate({top:-180},{duration:this.dropDownScrollSpeed,easing:"easeOutExpo",complete:function(){$(this).css("top",45).find("li").slice(0,5).remove()}}),this.dateDropdownSetActive()},dateMonthScrollUp:function(){var parent=this,monthNumber=$instance.$top.find(".stec-top-menu-date-month").find("ul").first().find("li").first().find("[data-month]").attr("data-month"),html,mArr=[],i;for(i=0;i<=4;i++)monthNumber=monthNumber-1<0?11:monthNumber-1,mArr[i]='<li><p data-month="'+monthNumber+'">'+glob.options.monthLabels[monthNumber]+"</p></li>";html=mArr.reverse().join(""),$instance.$top.find(".stec-top-menu-date-month ul li").first().before(html),$instance.$top.find(".stec-top-menu-date-month").find("ul").css({top:-180}).stop().animate({top:45},{duration:this.dropDownScrollSpeed,easing:"easeOutExpo",complete:function(){$(this).css("top",45).find("li").slice(6).remove()}}),this.dateDropdownSetActive()},dateYearScrollDown:function(){var parent=this,yearNumber,i,html=[];for($instance.$top.find(".stec-top-menu-date-year").find("ul").stop(!0,!0),yearNumber=$instance.$top.find(".stec-top-menu-date-year").find("ul").first().find("li").last().find("[data-year]").attr("data-year"),yearNumber=parseInt(yearNumber,10),i=0;i<=5;i++)yearNumber+=1,html.push('<li><p data-year="'+yearNumber+'">'+yearNumber+"</p></li>");$instance.$top.find(".stec-top-menu-date-year ul li").last().after(html.join("")),$instance.$top.find(".stec-top-menu-date-year").find("ul").css({top:45}).stop(!0,!0).animate({top:-180},{duration:this.dropDownScrollSpeed,easing:"easeOutExpo",complete:function(){$(this).css("top",45).find("li").slice(0,5).remove()}}),this.dateDropdownSetActive()},dateYearScrollUp:function(){var parent=this,yearNumber=parseInt($instance.$top.find(".stec-top-menu-date-year").find("ul").find("li").find("[data-year]").attr("data-year"),10),html,mArr=[],i;for(i=0;i<=4&&!((yearNumber-=1)<=0);i++)mArr[i]='<li><p data-year="'+yearNumber+'">'+yearNumber+"</p></li>";html=mArr.reverse().join(""),$instance.$top.find(".stec-top-menu-date-year ul li").first().before(html),$instance.$top.find(".stec-top-menu-date-year").find("ul").css({top:-180}).stop().animate({top:45},{duration:this.dropDownScrollSpeed,easing:"easeOutExpo",complete:function(){$(this).css("top",45).find("li").slice(6).remove()}}),this.dateDropdownSetActive()},dateWeekScrollDown:function(){var parent=this,lastWeek,html=[],format,theWeek,label,weekNumber,i,date;switch($instance.$top.find(".stec-top-menu-date-week").find("ul").stop(!0,!0),lastWeek=$instance.$top.find(".stec-top-menu-date-week").find("ul").last().find("li").last().find("[data-date]").attr("data-date"),glob.options.general_settings.date_format){case"dd.mm.yyyy":format="sday. smonth - eday. emonth. eyear";break;case"dd-mm-yy":format="sday smonth - eday emonth eyear";break;case"mm-dd-yy":format="smonth sday - emonth eday eyear";break;case"yy-mm-dd":default:format="smonth sday - eyear emonth eday"}for(weekNumber=helper.getDateFromData(lastWeek),i=1;i<=6;i++)weekNumber.setDate(weekNumber.getDate()+7),theWeek=helper.getWeekInfo(weekNumber),label=helper.getWeekLabel(format,theWeek),date=theWeek.start.year+"-"+theWeek.start.month+"-"+theWeek.start.day,html.push('<li><p data-week="'+theWeek.week+'" data-date="'+date+'">'+label+"</p></li>");$instance.$top.find(".stec-top-menu-date-week ul li").last().after(html.join("")),$instance.$top.find(".stec-top-menu-date-week").find("ul").css({top:45}).stop(!0,!0).animate({top:-180},{duration:this.dropDownScrollSpeed,easing:"easeOutExpo",complete:function(){$(this).css("top",45).find("li").slice(0,5).remove()}}),this.dateDropdownSetActive()},dateWeekScrollUp:function(){var parent=this,firstWeek=$instance.$top.find(".stec-top-menu-date-week").find("ul").first().find("li").first().find("[data-date]").attr("data-date"),html,theWeek,label,weekNumber,mArr=[],format,i=0,date;switch(glob.options.general_settings.date_format){case"dd.mm.yyyy":format="sday. smonth - eday. emonth. eyear";break;case"dd-mm-yy":format="sday smonth - eday emonth eyear";break;case"mm-dd-yy":format="smonth sday - emonth eday eyear";break;case"yy-mm-dd":default:format="smonth sday - eyear emonth eday"}for(weekNumber=helper.getDateFromData(firstWeek),i=1;i<=5&&(weekNumber.setDate(weekNumber.getDate()-7),!((theWeek=helper.getWeekInfo(weekNumber)).start.year<=0));i++)label=helper.getWeekLabel(format,theWeek),date=theWeek.start.year+"-"+theWeek.start.month+"-"+theWeek.start.day,mArr[i]='<li><p data-week="'+theWeek.week+'" data-date="'+date+'">'+label+"</p></li>";html=mArr.reverse().join(""),$instance.$top.find(".stec-top-menu-date-week ul li").first().before(html),$instance.$top.find(".stec-top-menu-date-week").find("ul").css({top:-180}).stop().animate({top:45},{duration:this.dropDownScrollSpeed,easing:"easeOutExpo",complete:function(){$(this).css("top",45).find("li").slice(6).remove()}}),this.dateDropdownSetActive()},dateDayScrollDown:function(){var parent=this,dayNumber,theMonth,maxD,html=[],i;for($instance.$top.find(".stec-top-menu-date-day").find("ul").stop(!0,!0),dayNumber=$instance.$top.find(".stec-top-menu-date-day").find("ul").first().find("li").last().find("[data-day]").attr("data-day"),dayNumber=parseInt(dayNumber,10),maxD=(theMonth=helper.getMonthInfo()).monthLength,i=0;i<=5;i++)dayNumber=dayNumber+1>maxD?1:dayNumber+1,html.push('<li><p data-day="'+dayNumber+'">'+dayNumber+"</p></li>");$instance.$top.find(".stec-top-menu-date-day ul li").last().after(html.join("")),$instance.$top.find(".stec-top-menu-date-day").find("ul").css({top:45}).stop(!0,!0).animate({top:-180},{duration:this.dropDownScrollSpeed,easing:"easeOutExpo",complete:function(){$(this).css("top",45).find("li").slice(0,5).remove()}}),this.dateDropdownSetActive()},dateDayScrollUp:function(){var parent=this,dayNumber=$instance.$top.find(".stec-top-menu-date-day").find("ul").first().find("li").first().find("[data-day]").attr("data-day"),theMonth,maxMonthDays=helper.getMonthInfo().monthLength,html,mArr=[],i;for(i=0;i<=4;i++)dayNumber=dayNumber-1<1?maxMonthDays:dayNumber-1,mArr[i]='<li><p data-day="'+dayNumber+'">'+dayNumber+"</p></li>";html=mArr.reverse().join(""),$instance.$top.find(".stec-top-menu-date-day ul li").first().before(html),$instance.$top.find(".stec-top-menu-date-day").find("ul").css({top:-180}).stop().animate({top:45},{duration:this.dropDownScrollSpeed,easing:"easeOutExpo",complete:function(){$(this).css("top",45).find("li").slice(6).remove()}}),this.dateDropdownSetActive()}},eventsLoader_show=function(){clearTimeout(glob.timeout.eventsLoading),glob.timeout.eventsLoading=setTimeout((function(){$instance.addClass("events-loading"),$instance.trigger("onEventsLoaderShow")}),500)},eventsLoader_hide=function(){clearTimeout(glob.timeout.eventsLoading),$instance.removeClass("events-loading"),$instance.trigger("onEventsLoaderHide")}
1,layout={init:function(){this.initViews(),this.bindControls()},initViews:function(){"string"==typeof glob.options.general_settings.views&&(glob.options.general_settings.views=glob.options.general_settings.views.split(",")),-1!==$.inArray("agenda",glob.options.general_settings.views)?this.agenda.bindControls():($instance.$agenda.remove(),$instance.$top.find('[data-view="agenda"]').remove()),-1!==$.inArray("month",glob.options.general_settings.views)?this.month.bindControls():($instance.$month.remove(),$instance.$top.find('[data-view="month"]').remove()),-1!==$.inArray("week",glob.options.general_settings.views)?this.week.bindControls():($instance.$week.remove(),$instance.$top.find('[data-view="week"]').remove()),-1!==$.inArray("day",glob.options.general_settings.views)?this.day.bindControls():($instance.$day.remove(),$instance.$top.find('[data-view="day"]').remove()),-1!==$.inArray("grid",glob.options.general_settings.views)?this.grid.bindControls():($instance.$grid.remove(),$instance.$top.find('[data-view="grid"]').remove()),-1!==$.inArray("boxgrid",glob.options.general_settings.views)?this.boxgrid.bindControls():($instance.$boxgrid.remove(),$instance.$top.find('[data-view="boxgrid"]').remove()),-1!==$.inArray("map",glob.options.general_settings.views)?(this.map.bindControls(),this.map.sidebar.bindControl
1s()):($instance.$map.remove(),$instance.$top.find('[data-view="map"]').remove()),-1===$.inArray(glob.options.view,glob.options.general_settings.views)&&(glob.options.view=glob.options.general_settings.views[0])},set:function(){switch($instance.$agenda.hide(),$instance.$month.hide(),$instance.$week.hide(),$instance.$day.hide(),$instance.$grid.hide(),$instance.$boxgrid.hide(),$instance.$map.hide(),main.refreshState("top"),glob.options.view){case"agenda":this.agenda.set();break;case"month":this.month.set();break;case"week":this.week.set();break;case"day":this.day.set();break;case"grid":this.grid.set();break;case"boxgrid":this.boxgrid.set();break;case"map":this.map.set()}helper.extendBind("stachethemes_ec_extend","onLayoutSet")},agenda:{cache:{getNfutureEvents:!1},bindControls:function(){var parent=this;helper.onResizeEnd((function(){$instance.$agenda.is(":visible")&&parent.set(!0)}),50),$instance.$agenda.find(".stec-layout-agenda-events-all-load-more").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.fillAgendaAllList()})),$(document).on(helper.clickHandle(),$instance.$agenda.path+" .stec-layout-agenda-daycell",(function(e){var date;if(e.preventDefault(),$(this).hasClass("active"))return eventsHandler.eventHolder.close(),void $(this).removeClass("active");date=helper.getDateFromData($(this).attr("data-date")),glob.options.day=date.getDate(),glob.options.month=date.getMonth(),glob.options.year=date.getFullYear(),main.refreshState("top"),parent.setActiveCell()})),$(document).on(helper.instaClickHandle(),$instance.$agenda.path+" .stec-layout-agenda-daycell",(function(e){var date,curr;e.preventDefault(),date=helper.getDateFromData($(this).attr("data-date")),curr=helper.newDate(glob.options.year,glob.options.month,glob.options.day),date.getTime()!==curr.getTime()&&(glob.options.day=date.getDate(),glob.options.month=date.getMonth(),glob.options.year=date.getFullYear(),main.refreshState("top"))})),$instance.$agenda.find(".stec-layout-agenda-list").draggable({axis:"x",start:function(event,ui){$instance.$agenda.find(".stec-layout-agenda-list").stop(),this.previousPosition=ui.position,this.time=(new Date).getTime()},stop:function(event,ui){var time=(new Date).getTime()-this.time,moved=Math.abs(ui.position.left-this.previousPosition.left);parent.dragFill($(this),ui.position.left),parent.inertia($(this),this.previousPosition.left>ui.position.left?1:-1,time,moved)},drag:function(event,ui){parent.dragFill($(this),ui.position.left)}})},set:function(resizeOnly){var DIM,cells;0!==parseInt(glob.options.general_settings.agenda_cal_display,10)?(DIM=this.getSlideDimensions(!0),$instance.$agenda.find(".stec-layout-agenda-list").stop().css({left:0,width:DIM.width}),cells=this.getCells(!1,!0,1,!0),$instance.$agenda.find(".stec-layout-agenda-list-b").empty().css("left",-1*$instance.$agenda.find(".stec-layout-agenda-list-a").width()),this.fillHTML($instance.$agenda.find(".stec-layout-agenda-list-a"),cells)):$instance.$agenda.find(".stec-layout-agenda-list-wrap").remove(),!0!==resizeOnly&&(eventsHandler.eventHolder.close(),this.clearAgendaAllList(),this.fillAgendaAllList()),$instance.$agenda.show()},setActiveCell:function(){var eventsData,events=[],activeCell=glob.options.year+"-"+glob.options.month+"-"+glob.options.day,$activeCell=$instance.$agenda.find(".stec-layout-agenda-daycell[data-date='"+activeCell+"']");$instance.$agenda.find(".stec-layout-agenda-daycell").removeClass("active"),$activeCell.addClass("active"),(eventsData=$activeCell.find(".stec-layout-agenda-daycell-events").data("events"))&&$(eventsData).each((function(){var event;(event=calData.getEventById(this.id,this.offset))&&events.push(event)})),eventsHandler.eventHolder.openEvents(events)},getSlideDimensions:function(refresh){var windowWidth,innerMaxCells,cellWidth,maxCells,width,DIM;return!0!==refresh&&this.getSlideDimensions.cache?this.getSlideDimensions.cache:(windowWidth=$(window).width()<2e3?2e3:$(window).width(),innerMaxCells=Math.floor($instance.width()/80),cellWidth=Math.floor($instance.width()/innerMaxCells),DIM={width:width=(maxCells=Math.round(windowWidth/cellWidth))*cellWidth,maxCells:maxCells,cellWidth:cellWidth}
1,this.getSlideDimensions.cache=DIM,DIM)},getCells:function(date,centerOnDate,direction,borderMonthCell){var DIM,dayNumber,theMonth,yearNumber,j,cellArray,count,i;if(date||(date=helper.newDate(glob.options.year,glob.options.month,glob.options.day)),DIM=this.getSlideDimensions(),dayNumber=date.getDate(),theMonth=helper.getMonthInfo(date.getMonth()),yearNumber=date.getFullYear(),!0===centerOnDate)for(j=0;j<Math.round(DIM.maxCells/(DIM.width/$instance.width()*2));j++)(dayNumber-=1)<=0&&((theMonth=theMonth.month-1)<0&&(theMonth=11,yearNumber-=1),dayNumber=(theMonth=helper.getMonthInfo(theMonth,yearNumber)).monthLength);if(cellArray=[],count=0,1===direction){for(i=0;i<DIM.maxCells;i++)(dayNumber+=1)>theMonth.monthLength&&((theMonth=theMonth.month+1)>11&&(yearNumber+=1,theMonth=0),theMonth=helper.getMonthInfo(theMonth,yearNumber),dayNumber=1,0===count&&!0!==borderMonthCell||(cellArray[count]={dataDate:!1,dayNum:!1,day:!1,year:yearNumber,month:theMonth.month,monthStartCell:!0,hasEvents:!1},count++)),date=helper.newDate(yearNumber,theMonth.month,dayNumber),cellArray[count]={dataDate:yearNumber+"-"+theMonth.month+"-"+dayNumber,dayNum:date.getDay(),day:dayNumber,year:yearNumber,month:theMonth.month,monthStartCell:!1,hasEvents:!1},count++;cellArray=cellArray.slice(0,DIM.maxCells)}else{for(i=0;i<DIM.maxCells;i++)(dayNumber-=1)<=0&&(0===count&&!0!==borderMonthCell||(cellArray[count]={dataDate:!1,dayNum:!1,day:!1,year:yearNumber,month:theMonth.month,monthStartCell:!0,hasEvents:!1},count++),(theMonth=theMonth.month-1)<0&&(yearNumber-=1,theMonth=11),dayNumber=(theMonth=helper.getMonthInfo(theMonth,yearNumber)).monthLength),date=helper.newDate(yearNumber,theMonth.month,dayNumber),cellArray[count]={dataDate:yearNumber+"-"+theMonth.month+"-"+dayNumber,dayNum:date.getDay(),day:dayNumber,year:yearNumber,month:theMonth.month,monthStartCell:!1,hasEvents:!1},count++;(cellArray=cellArray.slice(0,DIM.maxCells)).reverse()}return cellArray},fillHTML:function($el,cells){var parent=this,DIM=this.getSlideDimensions(),today,date,html=[];$el.empty(),$(cells).each((function(){var cell=this;!0===this.monthStartCell?(html.push('<li style="width: '+DIM.cellWidth+'px" class="stec-layout-agenda-monthstart" data-year="'+this.year+'" data-month="'+this.month+'" >'),html.push('<div class="stec-layout-agenda-monthstart-wrap">'),html.push('<p class="stec-layout-agenda-monthstart-year">'+this.year+"</p>"),html.push('<p class="stec-layout-agenda-monthstart-month">'+glob.options.monthLabelsShort[this.month]+"</p>"),html.push("</div>"),html.push("</li>")):(html.push('<li style="width: '+DIM.cellWidth+'px" class="stec-layout-agenda-daycell" data-date="'+this.dataDate+'">'),html.push('<div class="stec-layout-agenda-daycell-wrap">'),html.push('<p class="stec-layout-agenda-daycell-label">'+glob.options.dayLabelsShort[this.dayNum]+"</p>"),html.push('<p class="stec-layout-agenda-daycell-num">'+this.day+"</p>"),html.push('<div class="stec-layout-agenda-daycell-events">'),html.push("</div>"),html.push("</div>"),html.push("</li>"))})),$el[0].innerHTML+=html.join(""),date=(today=new Date).getFullYear()+"-"+today.getMonth()+"-"+today.getDate(),$instance.$agenda.find(".stec-layout-agenda-daycell[data-date='"+date+"']").addClass("stec-layout-agenda-daycell-today"),this.fillEvents()},fillEvents:function(){var $a,$b,start,end,startDate,endDate;$a=$instance.$agenda.find(".stec-layout-agenda-list-a"),($b=$instance.$agenda.find(".stec-layout-agenda-list-b")).children().length<=0?(start=$a.children(".stec-layout-agenda-daycell").first().attr("data-date"),end=$a.children(".stec-layout-agenda-daycell").last().attr("data-date")):$a[0].offsetLeft>$b[0].offsetLeft?(start=$b.children(".stec-layout-agenda-daycell").first().attr("data-date"),end=$a.children(".stec-layout-agenda-daycell").last().attr("data-date")):(end=$b.children(".stec-layout-agenda-daycell").last().attr("data-date"),start=$a.children(".stec-layout-agenda-daycell").first().attr("data-date")),$instance.$agenda.children(".stec-layout-agenda-list-wrap").find(".stec-layout-agenda-daycell-events").empty(),startDate=helper.getDateFromData(start),endDate=helper.getDateFromData(end),eventsLoader_show(),calData.getEventsThread(startDate,endD
1ate,!0,"agenda").then((function(events){eventsLoader_hide(),events.length<=0||($instance.$agenda.find(".stec-layout-agenda-daycell").find(".stec-layout-agenda-daycell-events").data("events",null),$(events).each((function(){var startDate=moment.tz(this.start_date,this.timezone),endDate=moment.tz(this.end_date,this.timezone),days=0,day,stamp,dataDate,extraClass=[],html,eventState=helper.getEventState(this),$eventCont,dataEvents;for(days=Math.abs(startDate.startOf("day").diff(endDate.startOf("day"),"days")),day=0;day<=days;day++)stamp=moment(this.start_date).add(day,"days").unix(),dataDate=helper.getDataFromDate(new Date(1e3*stamp)),($eventCont=$instance.$agenda.find('.stec-layout-agenda-daycell[data-date="'+dataDate+'"]').find(".stec-layout-agenda-daycell-events")).children(".stec-layout-agenda-daycell-event").length>2||(eventState>0&&extraClass.push("stec-layout-agenda-daycell-event-expired"),extraClass.push("stec-layout-agenda-daycell-event"),$(html="<div></div>").attr({"data-id":this.id,"data-repeat-time-offset":this.repeat_time_offset,style:"background-color: "+this.color,class:extraClass.join(" ")}).appendTo($instance.$agenda.children(".stec-layout-agenda-list-wrap").find('.stec-layout-agenda-daycell[data-date="'+dataDate+'"]').find(".stec-layout-agenda-daycell-events"))),(dataEvents=$eventCont.data("events"))||(dataEvents=[]),dataEvents.push({id:this.id,offset:this.repeat_time_offset}),$eventCont.data("events",dataEvents)})),helper.extendBind("stachethemes_ec_extend","afterFillEvents"))}))},dragFill:function($el,pos){var rebuild=!1,d1,d2,borderMonthCell,cells,$el2=$el.parent().children(".stec-layout-agenda-list").not($el);$el2.css("left",pos+(pos<0?1:-1)*$el.width()),$el2[0].offsetLeft>$el[0].offsetLeft?(rebuild=!1,d1=helper.getDateFromData($el.children(".stec-layout-agenda-daycell").last().attr("data-date")),(d2=$el2.children(".stec-layout-agenda-daycell").first().attr("data-date"))?((d2=helper.getDateFromData(d2)).setDate(d2.getDate()-1),d1.getTime()!==d2.getTime()&&(rebuild=!0)):rebuild=!0,!0===rebuild&&(borderMonthCell=!0,$el.children("li").last().hasClass("stec-layout-agenda-monthstart")&&(borderMonthCell=!1),d1.setDate(d1.getDate()),cells=this.getCells(d1,!1,1,borderMonthCell),this.fillHTML($el2,cells))):(rebuild=!1,d1=helper.getDateFromData($el.children(".stec-layout-agenda-daycell").first().attr("data-date")),(d2=$el2.children(".stec-layout-agenda-daycell").last().attr("data-date"))?((d2=helper.getDateFromData(d2)).setDate(d2.getDate()+1),d1.getTime()!==d2.getTime()&&(rebuild=!0)):rebuild=!0,!0===rebuild&&(borderMonthCell=!0,$el.children("li").first().hasClass("stec-layout-agenda-monthstart")&&(borderMonthCell=!1),cells=this.getCells(d1,!1,-1,borderMonthCell),this.fillHTML($el2,cells)))},inertia:function($el,dir,time,moved){var parent=this,x=0;switch(x=(x=moved/time*100)>$el.width()?$el.width()/4:x,$instance.$agenda.find(".stec-layout-agenda-list").stop(),dir){case 1:$el.animate({left:$el.position().left-x},{easing:"easeOutExpo",duration:1e3,step:function(a,b){parent.dragFill($el,b.now)}});break;case-1:$el.animate({left:$el.position().left+x},{easing:"easeOutExpo",duration:1e3,step:function(a,b){parent.dragFill($el,b.now)}})}},clearAgendaAllList:function(){this.cache.getNfutureEvents=!1,$instance.$agenda.find(".stec-layout-agenda-events-all ul").remove(),$instance.$agenda.find(".stec-layout-agenda-events-all-datetext").remove()},getNfutureEvents:function(){var parent=this;return new Promise((function(resolve){var x,y,returnData={events:[],loadMore:!1};if(parent.cache.getNfutureEvents)return x=parent.getNfutureEvents.i++*parent.getNfutureEvents.n,y=x+parent.getNfutureEvents.n,returnData.events=parent.cache.getNfutureEvents.slice(x,y),returnData.loadMore=parent.cache.getNfutureEvents.slice(y,y+1).length>0,resolve(returnData);parent.getNfutureEvents.n=parseInt(glob.options.general_settings.agenda_get_n,10),calData.getFutureEventsThread(!0,"getNfutureEvents").then((function(events){return 1===parseInt(glob.options.general_settings.reverse_agenda_list,10)?parent.cache.getNfutureEvents=$(events).get().reverse():parent.cache.getNfutureEvents=events,parent.getNfutureEvents.i=0,x=parent.getNfutureEvents.i++*parent.getNfutureEvents.n,y=x+parent.getNfutureEvents.n,returnData.events=parent.cache.getNfutureEvents.slice(
1x,y),returnData.loadMore=parent.cache.getNfutureEvents.slice(y,y+1).length>0,resolve(returnData)}))}))},fillAgendaAllList:function(){var lastLabel,d1;0!==parseInt(glob.options.general_settings.agenda_list_display,10)&&($instance.$agenda.find(".stec-layout-agenda-events-all-control").hide(),this.getNfutureEvents().then((function(data){var events=data.events,loadMore=data.loadMore;if(!events||events.length<=0)$instance.$agenda.find(".stec-layout-agenda-events-all-list").children().length<=0&&$instance.$agenda.find(".stec-layout-agenda-noevents").show();else{switch(!0===loadMore&&$instance.$agenda.find(".stec-layout-agenda-events-all-control").show(),(lastLabel=$instance.$agenda.find(".stec-layout-agenda-events-all-datetext").last()).month=lastLabel.attr("data-month"),lastLabel.year=lastLabel.attr("data-year"),$(events).each((function(i){var event=this,extraClass=[],icon=[],eventState=helper.getEventState(this),d=helper.dbDateTimeToDate(this.start_date);switch((eventState>0||"EventCancelled"===event.event_status||"0"===glob.options.general_settings.reminder)&&extraClass.push("stec-layout-event-no-reminder"),parseInt(lastLabel.month,10)===d.getMonth()&&parseInt(lastLabel.year,10)===d.getFullYear()||(lastLabel.month=d.getMonth(),lastLabel.year=d.getFullYear(),$('<p data-year="'+d.getFullYear()+'" data-month="'+d.getMonth()+'" class="stec-layout-agenda-events-all-datetext">'+glob.options.monthLabels[d.getMonth()]+" "+d.getFullYear()+"</p>").insertBefore($instance.$agenda.find(".stec-layout-agenda-events-all-control")),$('<ul class="stec-layout-agenda-events-all-list"></ul>').insertAfter($instance.$agenda.find(".stec-layout-agenda-events-all-datetext").last())),parseInt(this.featured,10)){case 1:extraClass.push("stec-event-featured");break;case 2:extraClass.push("stec-event-featured stec-event-featured-bg")}switch("EventCancelled"===event.event_status&&extraClass.push("stec-event-cancelled"),"icon"!==event.icon_type||event.icon&&"fa"!==event.icon||extraClass.push("stec-no-icon"),event.edit_link||extraClass.push("stec-no-edit"),(event.description_short&&"1"===glob.options.general_settings.preview_desc||event.location.full_address&&"1"===glob.options.general_settings.preview_location)&&extraClass.push("stec-layout-event-preview-size-big"),event.icon_type){case"image":event.icon_images.length>0?(icon.push('<div class="stec-layout-event-preview-left-icon-images">'),$.each(event.icon_images_meta,(function(i){icon.push('<div class="stec-layout-event-preview-left-icon-image '+(0===i?"active":"")+'" style="background-image: url('+this.src+')"></div>')})),icon.push("</div>")):icon.push('<i class="'+event.icon+'"></i>');break;case"date":d1=moment(event.start_date),icon.push('<span class="stec-layout-event-preview-left-icon-date"><span class="stec-layout-event-preview-left-icon-date-number">'+d1.format("D")+'</span><span class="stec-layout-event-preview-left-icon-date-month">'+__(d1.format("MMM").toLowerCase())+"</span></span>");break;default:icon.push('<i class="'+event.icon+'"></i>')}$(glob.template.event).addClass(extraClass.join(" ")).attr("data-id",event.id).attr("data-repeat-time-offset",event.repeat_time_offset?event.repeat_time_offset:0).data("permalink",helper.getPermalink(event.permalink,event.repeat_time_offset)).html((function(index,html){var $html=$(html),date=helper.beautifyTimespan(event.start_date,1!==parseInt(event.hide_end,10)&&event.end_date,event.all_day),gmtUtcOffset=parseInt(event.timezone_utc_offset,10)/3600,timezoneOffsetLabel,eventStatusHtml=[];switch(0===(gmtUtcOffset=gmtUtcOffset>0?"+"+gmtUtcOffset:gmtUtcOffset)&&(gmtUtcOffset=""),timezoneOffsetLabel=(0===parseInt(glob.options.general_settings.date_label_gmtutc,10)?"":"UTC/GMT "+gmtUtcOffset).trim(),event.location.full_address&&"1"===glob.options.general_settings.preview_location||$html.find(".stec-layout-event-preview-left-text-location").remove(),event.description_short&&"1"===glob.options.general_settings.preview_desc||$html.find(".stec-layout-event-preview-left-text-desc").remove(),glob.temp.EventPreviewHtml=$html.get(0).outerHTML,$instance.trigger("stecBeforeReturnEventPreviewHtml",{$instance:$instance,event:event,temp:glob.temp}),event.event_status){case"EventCancelled":eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="cancelled">'+__("Cancelled")+"</span></p>");break;case"EventMovedOnline":eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="moved-online">'+__("Moved Online")+"</span></p>");break;case"EventPostponed":eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="postponed">'+__("Postponed")+"</span></p>");break;case"EventRescheduled":eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="rescheduled">'+__("Rescheduled")+"</span></p>");break;default:eventStatusHtml=[]}return 0===event.approved&&eventStatusHtml.push('<p class="stec-layout-event-preview-left-text-event-status"><span class="unapproved">'+__("Awaiting Approval")+"</span></p>"),glob.temp.EventPreviewHtml.replace("stec_replace_event_status",eventStatusHtml.join("")).replace("stec_replace_summary",event.title).replace("stec_replace_date",date+" "+timezoneOffsetLabel).replace("stec_replace_location",(function(){return"virtual"===event.location.type?__("Online Event"):event.location.title?[event.location.title,event.location.full_address].join(", "):event.location.full_address})).replace("stec_replace_desc_short",event.description_short).replace('stec_replace_event_background=""','
1style="background:'+event.color+'"').replace("stec_replace_icon",icon.join("")).replace(/#stec_replace_edit_link/g,event.edit_link)})).appendTo($instance.find(".stec-layout-agenda-events-all-list").last())})),glob.options.general_settings.open_event_in){case"single":case"external":case"modal":$instance.find(".stec-layout-agenda-events-all").find(".stec-layout-event-preview-right-event-toggle").remove()}$instance.$agenda.find(".stec-layout-agenda-noevents").hide(),helper.animate.agenda.fillList($instance.$agenda)}})))}},month:{bindControls:function(){var parent=this;$instance.$month.find(".stec-layout-month-daycell").on(helper.clickHandle(),(function(e){var date;if(e.preventDefault(),$(this).hasClass("active"))return eventsHandler.eventHolder.close(),void $(this).removeClass("active");date=helper.getDateFromData($(this).attr("data-date")),glob.options.year=date.getFullYear(),glob.options.month=date.getMonth(),glob.options.day=date.getDate(),parent.setActiveCell()}))},set:function(){$instance.$month.show(),this.setDayLabels(),this.fillGridDays(),this.fillEvents()},setDayLabels:function(){var offset=0,a;switch(glob.options.general_settings.first_day_of_the_week){case"mon":offset=1;break;case"sat":offset=6;break;case"sun":offset=0}a=offset,$instance.$month.find(".stec-layout-month-daylabel td").each((function(i){var label=helper.capitalizeFirstLetter(glob.options.dayLabels[a]),labelShort=helper.capitalizeFirstLetter(glob.options.dayLabelsShort[a]);$(this).find("p").eq(0).text(label),$(this).find("p").eq(1).text(labelShort),$(this).find("p").eq(2).text(labelShort.charAt(0)),a=a+1>=glob.options.dayLabels.length?0:a+1}))},setActiveCell:function(){var events=[],eventsData,activeCell=glob.options.year+"-"+glob.options.month+"-"+glob.options.day,$activeCell=$instance.$month.find(".stec-layout-month-daycell[data-date='"+activeCell+"']");$instance.$month.find(".stec-layout-month-daycell").removeClass("active"),$activeCell.addClass("active"),$instance.$month.find(".stec-layout-month-eventholder").insertAfter($instance.$month.find(".stec-layout-month-daycell.active").parents("tr")),(eventsData=$activeCell.find(".stec-layout-month-daycell-events").data("events"))&&$(eventsData).each((function(){var event;(event=calData.getEventById(this.id,this.offset))&&events.push(event)})),eventsHandler.eventHolder.openEvents(events)},resetGridCells:function(){$instance.$month.find(".stec-layout-month-daylabel td").removeClass("stec-layout-month-daylabel-today"),$instance.$month.find(".stec-layout-month-daycell").removeAttr("data-date").removeClass("stec-layout-month-daycell-today stec-layout-month-daycell-inactive active"),$instance.$month.find(".stec-layout-month-daycell").removeClass("active"),$instance.$month.find(".stec-layout-month-daycell-events").empty(),eventsHandler.eventHolder.close()},fillGridDays:function(){var parent=this,i,realDayNumber,offset,activeMonthInfo,prevMonthInfo,nextMonthInfo,today,date;for(this.resetGridCells(),activeMonthInfo=helper.getMonthInfo(),i=0;i<activeMonthInfo.monthLength;i++)realDayNumber=i+1,$instance.$month.find(".stec-layout-month-daycell").eq(activeMonthInfo.dayOffset+i).attr("data-date",activeMonthInfo.year+"-"+activeMonthInfo.month+"-"+realDayNumber).find(".stec-layout-month-daycell-num").text(realDayNumber);for(prevMonthInfo=helper.getMonthInfo(activeMonthInfo.month-1<0?11:activeMonthInfo.month-1,activeMonthInfo.month-1<0?activeMonthInfo.year-1:activeMonthInfo.year),i=activeMonthInfo.dayOffset;i>0;i--)realDayNumber=prevMonthInfo.monthLength-activeMonthInfo.dayOffset+i,$instance.$month.find(".stec-layout-month-daycell").eq(i-1).addClass("stec-layout-month-daycell-inactive").attr("data-date",prevMonthInfo.year+"-"+prevMonthInfo.month+"-"+realDayNumber).find(".stec-layout-month-daycell-num").text(realDayNumber);for(nextMonthInfo=helper.getMonthInfo(activeMonthInfo.month+1>11?0:activeMonthInfo.month+1,activeMonthInfo.month+1>11?activeMonthInfo.year+1:activeMonthInfo.year),i=0;i<42-(activeMonthInfo.monthLength+activeMonthInfo.dayOffset);i++)offset=activeMonthInfo.monthLength+activeMonthInfo.dayOffset+i,realDayNumber=i+1,$instance.$month.find(".stec-layout-month-daycell").eq(offset).addClass("stec-layout-month-daycell-inactive").attr("data-date",nextMonthInfo.year+"-"+nextMonthInfo.month+"-"+realDayNumber).find(".stec-layout-month-daycell-num").text(realDayNumber);date=(today=new Date).getFullYear()+"-"+today.getMonth()+"-"+today.getDate(),$instance.$month.find(".stec-layout-month-daycell[data-date='"+date+"']").addClass("stec-layout-month-daycell-today"),$instance.$month.find(".stec-layout-month-daycell-today").length>0&&(offset=$instance.$month.find(".stec-layout-month-weekrow").find(".stec-layout-month-daycell[data-date='"+date+"']").index(),$instance.$month.find(".stec-layout-month-daylabel td").eq(offset).addClass("stec-layout-month-daylabel-today"))},fillEvents:function(){var parent=this,from=helper.getDateFromData($instance.$month.find(".stec-layout-month-daycell").first().attr("data-date")),to=helper.getDateFromData($instance.$month.find(".stec-layout-month-daycell").last().attr("data-date"));$instance.$month.find(".stec-layout-month-daycell").find(".stec-layout-month-daycell-events").data("events",null),eventsLoader_show(),calData.getEventsThread(from,to,!0,"base").then((function(events){eventsLoader_hide(),$(events).each((function(){var hiddenEvents=[],startDate="",endDate="",days=0,day,dataDate,$eventCont,html=[],text,num,newText,extraClass,backgroundColorStyle,brightness,pos,repeatTimeOff
1set,posId,eventState,dataEvents;for(startDate=moment.tz(this.start_date,this.timezone),endDate=moment.tz(this.end_date,this.timezone),eventState=helper.getEventState(this),days=Math.abs(startDate.startOf("day").diff(endDate.startOf("day"),"days")),day=0;day<=days;day++){if(extraClass=[],dataDate=helper.getDataFromDate(moment(this.start_date).add(day,"days").toDate()),($eventCont=$instance.$month.find('.stec-layout-month-daycell[data-date="'+dataDate+'"]').find(".stec-layout-month-daycell-events")).find(".stec-layout-month-daycell-event").length>2||hiddenEvents.indexOf(this.id)>-1)$eventCont.find(".stec-layout-month-daycell-eventmore").length>0?(text=$eventCont.find(".stec-layout-month-daycell-eventmore-count").text(),newText="+"+(num=parseInt(text.match(/[0-9]+/),10)+1)+" "+__("morePlural"),$eventCont.find(".stec-layout-month-daycell-eventmore-count").text(newText)):((html=[]).push('<li class="stec-layout-month-daycell-eventmore">'),html.push('   <p class="stec-layout-month-daycell-eventmore-count">+1 '+__("moreSingular")+"</p>"),html.push('   <p class="stec-layout-month-daycell-eventmore-count-dot"></p>'),html.push('   <p class="stec-layout-month-daycell-eventmore-count-dot"></p>'),html.push('   <p class="stec-layout-month-daycell-eventmore-count-dot"></p>'),html.push("</li>"),$(html.join("")).appendTo($eventCont)),repeatTimeOffset=this.repeat_time_offset?this.repeat_time_offset:0,hiddenEvents.push(this.id);else{switch(backgroundColorStyle="background-color:"+this.color,0===day&&extraClass.push("stec-layout-month-daycell-event-start"),day===days&&extraClass.push("stec-layout-month-daycell-event-end"),parseInt(this.featured,10)){case 1:extraClass.push("stec-event-featured");break;case 2:extraClass.push("stec-event-featured stec-event-featured-bg")}pos=parent.getEventPosition(this,$eventCont),(brightness=helper.getColorBrightness(this.color))>170&&extraClass.push("stec-layout-month-daycell-event-bright"),eventState>0&&extraClass.push("stec-layout-month-daycell-event-expired"),repeatTimeOffset=this.repeat_time_offset?this.repeat_time_offset:0,posId=this.id+"-"+repeatTimeOffset,(html=[]).push("<li>"),0!==day&&0===parseInt(glob.options.general_settings.show_event_title_all_cells,10)||html.push('<p class="stec-layout-month-daycell-event-name">'+this.title+"</p>"),html.push("</li>"),extraClass.push("stec-layout-month-daycell-event"),"EventCancelled"===this.event_status&&extraClass.push("stec-event-cancelled"),$(html.join("")).attr({class:extraClass.join(" "),style:backgroundColorStyle,"data-pos":pos,"data-pos-id":posId,"data-repeat-time-offset":repeatTimeOffset,"data-id":this.id}).appendTo($eventCont)}(dataEvents=$eventCont.data("events"))||(dataEvents=[]),dataEvents.push({id:this.id,offset:repeatTimeOffset}),$eventCont.data("events",dataEvents)}})),helper.extendBind("stachethemes_ec_extend","afterFillEvents")}))},getEventPosition:function(event,$eventCont){var position=0,positions=[1,2,3],repeatTimeOffset=event.repeat_time_offset?event.repeat_time_offset:0,posId=event.id+"-"+repeatTimeOffset,$first=$instance.$month.find('.stec-layout-month-daycell-event[data-pos-id="'+posId+'"]').first();return $first.length>0?position=$first.attr("data-pos"):($eventCont.find(".stec-layout-month-daycell-event").each((function(){var i=positions.indexOf(parseInt($(this).attr("data-pos"),10));i>-1&&positions.splice(i,1)})),position=positions[0]),position}}
1,week:{bindControls:function(){var parent=this,date;$instance.$week.find(".stec-layout-week-daycell").on(helper.clickHandle(),(function(e){if(e.preventDefault(),$(this).hasClass("active"))return eventsHandler.eventHolder.close(),void $(this).removeClass("active");date=helper.getDateFromData($(this).attr("data-date")),glob.options.year=date.getFullYear(),glob.options.month=date.getMonth(),glob.options.day=date.getDate(),parent.setActiveCell()})),helper.onResizeEnd((function(){parent.calcHeight()}))},set:function(){$instance.$week.show(),this.setDayLabels(),this.fillGridDays(),this.fillEvents()},setDayLabels:function(){var offset=0,a;switch(glob.options.general_settings.first_day_of_the_week){case"mon":offset=1;break;case"sat":offset=6;break;case"sun":offset=0}a=offset,$instance.$week.find(".stec-layout-week-daylabel td").each((function(i){var label=helper.capitalizeFirstLetter(glob.options.dayLabels[a]),labelShort=helper.capitalizeFirstLetter(glob.options.dayLabelsShort[a]);$(this).find("p").eq(0).text(label),$(this).find("p").eq(1).text(labelShort),$(this).find("p").eq(2).text(labelShort.charAt(0)),a=a+1>=glob.options.dayLabels.length?0:a+1}))},setActiveCell:function(){var activeCell=glob.options.year+"-"+glob.options.month+"-"+glob.options.day,$activeCell=$instance.$week.find(".stec-layout-week-daycell[data-date='"+activeCell+"']"),eventsData=[],events=[];$instance.$week.find(".stec-layout-week-daycell").removeClass("active"),$activeCell.addClass("active"),(eventsData=$activeCell.find(".stec-layout-week-daycell-events").data("events"))&&$(eventsData).each((function(){var event;(event=calData.getEventById(this.id,this.offset))&&events.push(event)})),eventsHandler.eventHolder.openEvents(events)},resetGridCells:function(){$instance.$week.find(".stec-layout-week-daylabel td").removeClass("stec-layout-week-daylabel-today"),$instance.$week.find(".stec-layout-week-daycell").removeAttr("data-date").removeClass("stec-layout-week-daycell-today stec-layout-week-daycell-inactive active"),$instance.$week.find(".stec-layout-week-daycell").removeClass("active"),$instance.$week.find(".stec-layout-week-daycell-events").empty(),eventsHandler.eventHolder.close()},fillGridDays:function(){var parent=this,theWeek=helper.getWeekInfo(),cellDate=helper.newDate(theWeek.start.year,theWeek.start.month,theWeek.start.day),today,date,offset;this.resetGridCells(),$instance.$week.find(".stec-layout-week-daycell").each((function(i){let next=moment(cellDate).add(i,"days").toDate();$(this).attr("data-date",next.getFullYear()+"-"+next.getMonth()+"-"+next.getDate()).find(".stec-layout-week-daycell-num").text(next.getDate())})),date=(today=new Date).getFullYear()+"-"+today.getMonth()+"-"+today.getDate(),$instance.$week.find(".stec-layout-week-daycell[data-date='"+date+"']").addClass("stec-layout-week-daycell-today"),$instance.$week.find(".stec-layout-week-daycell-today").length>0&&(offset=$instance.$week.find(".stec-layout-week-weekrow").find(".stec-layout-week-daycell[data-date='"+date+"']").index(),$instance.$week.find(".stec-layout-week-daylabel td").eq(offset).addClass("stec-layout-week-daylabel-today"))},calcHeight:function(){var minHeight=$instance.hasClass("stec-media-small")?50:160,minULheight=$instance.hasClass("stec-media-small")?20:113,margin=$instance.hasClass("stec-media-small")?6:29,a=$instance.hasClass("stec-media-small")?40:70;$instance.$week.find(".stec-layout-week-daycell").css("height",minHeight),$instance.$week.find(".stec-layout-week-daycell-events").css("height",minULheight),$instance.$week.find(".stec-layout-week-daycell-events").children().each((function(){var pos=parseInt($(this).attr("data-pos"),10);$(this).css({top:margin*pos}),minHeight=Math.max(minHeight,a+margin*pos),minULheight=minHeight-30})),$instance.$week.find(".stec-layout-week-daycell").css("height",minHeight),$instance.$week.find(".stec-layout-week-daycell-events").css("height",minULheight)},fillEvents:function(){var parent=this,hiddenEvents,from=helper.getDateFromData($instance.$week.find(".stec-layout-week-daycell").first().attr("data-date")),to=helper.getDateFromData($instance.$week.find(".stec-layout-week-daycell").last().attr("data-date"));$instance.$week.find(".stec-layout-week-daycell").find(".stec-layout-week-daycell-events").data("events",null),eventsLoader_show(),calData.getEventsThread(from,to,!0,"base").then((function(events){eventsLoader_hide(),events&&($(events).each((function(){var startDate=moment.tz(this.start_date,this.timezone),endDate=moment.tz(this.end_date,this.timezone),days=0,day,dataDate,$eventCont,html,extraClass,backgroundColorStyle,posId,repeatTimeOff
1set,pos,brightness,eventState=helper.getEventState(this),dataEvents=[];for(hiddenEvents=[],days=Math.abs(startDate.startOf("day").diff(endDate.startOf("day"),"days")),day=0;day<=days;day++){switch(extraClass=[],dataDate=helper.getDataFromDate(moment(this.start_date).add(day,"days").toDate()),$eventCont=$instance.$week.find('.stec-layout-week-daycell[data-date="'+dataDate+'"]').find(".stec-layout-week-daycell-events"),backgroundColorStyle="background-color:"+this.color,0===day&&extraClass.push("stec-layout-week-daycell-event-start"),day===days&&extraClass.push("stec-layout-week-daycell-event-end"),parseInt(this.featured,10)){case 1:extraClass.push("stec-event-featured");break;case 2:extraClass.push("stec-event-featured stec-event-featured-bg")}repeatTimeOffset=this.repeat_time_offset?this.repeat_time_offset:0,posId=this.id+"-"+repeatTimeOffset,pos=parent.getEventPosition(this,$eventCont),(brightness=helper.getColorBrightness(this.color))>170&&extraClass.push("stec-layout-week-daycell-event-bright"),eventState>0&&extraClass.push("stec-layout-week-daycell-event-expired"),extraClass.push("stec-layout-week-daycell-event"),(html=[]).push("<li>"),0!==day&&0===parseInt(glob.options.general_settings.show_event_title_all_cells,10)||html.push('<p class="stec-layout-week-daycell-event-name">'+this.title+"</p>"),html.push("</li>"),"EventCancelled"===this.event_status&&extraClass.push("stec-event-cancelled"),$(html.join("")).attr({class:extraClass.join(" "),style:backgroundColorStyle,"data-pos":pos,"data-pos-id":posId,"data-repeat-time-offset":repeatTimeOffset,"data-id":this.id}).appendTo($eventCont),(dataEvents=$eventCont.data("events"))||(dataEvents=[]),dataEvents.push({id:this.id,offset:repeatTimeOffset}),$eventCont.data("events",dataEvents)}})),parent.calcHeight(),helper.extendBind("stachethemes_ec_extend","afterFillEvents"))}))},getEventPosition:function(event,$eventCont){var positions=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],position=0,repeatTimeOffset=event.repeat_time_offset?event.repeat_time_offset:0,posId=event.id+"-"+repeatTimeOffset,$first=$instance.$week.find('.stec-layout-week-daycell-event[data-pos-id="'+posId+'"]').first();return $first.length>0?position=$first.attr("data-pos"):($eventCont.find(".stec-layout-week-daycell-event").each((function(){var i=positions.indexOf(parseInt($(this).attr("data-pos"),10));i>-1&&positions.splice(i,1)})),position=positions[0]),position}}
1,day:{bindControls:function(){},set:function(){var from=helper.newDate(glob.options.year,glob.options.month,glob.options.day),to=from;eventsHandler.eventHolder.close(),$instance.$day.show(),calData.getEventsThread(from,to,!0,"base").then((function(events){eventsHandler.eventHolder.openEvents(events),helper.extendBind("stachethemes_ec_extend","afterFillEvents")}))}},grid:{cache:{getNfutureEvents:!1},columns:0,options:{offset:0,perClick:4,blockMinWidth:270,defaultColumns:4,gutter:10},bindControls:function(){var parent=this;this.options.defaultColumns=parseInt(glob.options.general_settings.grid_columns,10),this.options.gutter=parseInt(glob.options.general_settings.grid_gutter,10),this.options.perClick=parseInt(glob.options.general_settings.grid_per_click,10),this.options.gutter||$instance.$grid.find(".stec-layout-grid-events-all-load-more").css({marginTop:10}),$instance.$grid.find(".stec-layout-grid-events-all-load-more").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.fill()})),"modal"===glob.options.general_settings.open_event_in&&$instance.$grid.on(helper.clickHandle(),".stec-layout-grid-event .stec-layout-grid-event-title, .stec-layout-grid-event .stec-layout-grid-event-image",(function(e){e.preventDefault(),eventsHandler.eventToggle($(this).parents(".stec-layout-grid-event").first())})),helper.onResizeEnd((function(){parent.resizeEvents()}),50),$instance.on("onEventsLoaderShow",(function(){"grid"===glob.options.view&&(layout.grid.placeholders.remove(),layout.grid.placeholders.add())})),$instance.on("onEventsLoaderHide",(function(){"grid"===glob.options.view&&layout.grid.placeholders.remove()}))},set:function(){$instance.$grid.show(),this.clear(),this.fill()},clear:function(){this.cache.getNfutureEvents=!1,$instance.$grid.find(".stec-layout-grid-events").children(".stec-layout-grid-event").remove(),$instance.$grid.find(".stec-layout-grid-noevents").hide()},getNfutureEvents:function(){var parent=this;return new Promise((function(resolve){var x,y,returnData={events:[],loadMore:!1};if(parent.cache.getNfutureEvents)return x=parent.getNfutureEvents.i++*parent.getNfutureEvents.n,y=x+parent.getNfutureEvents.n,returnData.events=parent.cache.getNfutureEvents.slice(x,y),returnData.loadMore=parent.cache.getNfutureEvents.slice(y,y+1).length>0,resolve(returnData);parent.getNfutureEvents.n=parent.options.perClick,calData.getFutureEventsThread(!0,"getFutureEventsThread").then((function(events){return 1===parseInt(glob.options.general_settings.reverse_agenda_list,10)?parent.cache.getNfutureEvents=$(events).get().reverse():parent.cache.getNfutureEvents=events,parent.getNfutureEvents.i=0,x=parent.getNfutureEvents.i++*parent.getNfutureEvents.n,y=x+parent.getNfutureEvents.n,returnData.events=parent.cache.getNfutureEvents.slice(x,y),returnData.loadMore=parent.cache.getNfutureEvents.slice(y,y+1).length>0,resolve(returnData)}))}))},placeholders:{html:function(){var html=[];return html.push('<div class="stec-layout-grid-event-placeholder">'),html.push('<span class="noanim"></span>'),html.push("<span></span>"),html.push("<div><span></span><span></span></div>"),html.push("<div><span></span><span></span></div>"),html.push("</div>"),html.join("")},add:function(){var i,placeholders=[];for(placeholders.push('<div class="stec-layout-grid-event-placeholders-wrap">'),layout.grid.calcColumns(),i=0;i<layout.grid.columns;i++)placeholders.push(this.html());placeholders.push("</div>"),$(placeholders.join("")).appendTo($instance.$grid.find(".stec-layout-grid-events"))},remove:function(){$instance.$grid.find(".stec-layout-grid-events").children(".stec-layout-grid-event-placeholders-wrap").remove()}},fill:function(){var parent=this;eventsLoader_show(),this.getNfutureEvents().then((function(data){var events=data.events,loadMore=data.loadMore;if(eventsLoader_hide(),!events||events.length<=0)return $instance.$grid.find(".stec-layout-grid-events-all-control").hide(),void($instance.$grid.find(".stec-layout-grid-events").children().length<=0&&($instance.$grid.find(".stec-layout-grid-noevents").show(),$instance.$grid.find(".stec-layout-grid-events").height(0)));!1===loadMore?$instance.$grid.find(".stec-layout-grid-events-all-control").hide():$instance.$grid.find(".stec-layout-grid-events-all-control").show(),$(events).each((function(){var event=this,invitedUser=!1,tagsHtml=[],extraClass=[],eventState=helper.getEventState(this);switch((eventState>0||"EventCancelled"===event.event_status||"0"===glob.options.general_settings.reminder)&&extraClass.push("stec-layout-event-no-reminder"),parseInt(this.featured,10)){case 1:extraClass.push("stec-event-featured");break;case 2:extraClass.push("stec-event-featured stec-event-featured-bg")}switch("icon"!==event.icon_type||event.icon&&"fa"!==event.icon||extraClass.push("stec-no-icon"),event.edit_link||extraClass.push("stec-no-edit"),event.images_meta.length>0&&extraClass.push("stec-has-image"),event.products.length>0&&extraClass.push("stec-has-products"),event.location.full_address&&extraClass.push("stec-has-location"),event.organizers.length>0&&extraClass.push("stec-has-organizers"),event.event_status){case"EventCancelled":tagsHtml.push('<span class="cancelled">'+__("Cancelled")+"</span>");break;case"EventMovedOnline":tagsHtml.push('<span class="moved-online">'+__("Moved Online")+"</span>");break;case"EventPostponed":tagsHtml.push('<span class="postponed">'+__("Postponed")+"</span>");break;case"EventRescheduled":tagsHtml.push('<span class="rescheduled">'+__("Rescheduled")+"</span>")}0===event.approved&&tagsHtml.push('<span class="unapproved">'+__("Awaiting Approval")+"</span>"),event.featured>0&&tagsHtml.push('<span class="stec-featured-tag">'+__("featured")+"</span>"),$.each(event.category,(function(){tagsHtml.push('<span style="background-color:'+this.color+'">'+this.title+"</span>")})),tagsHtml.length>0&&extraClass.push("stec-has-tags"),isNaN(glob.options.userid)||$(event.attendance).each((function(){if(this.userid===glob.options.userid)return invitedUser=!0,!1})),invitedUser?extraClass.push("stec-user-invited"):1===parseInt(event.rsvp,10)&&extraClass.push("stec-can-rsvp"),-1!==$.inArray(["EventCancelled","EventPostponed"],event.event_status)&&(2===eventState?extraClass.push("stec-expired"):1===eventState&&extraClass.push("stec-in-progress")),"EventCancelled"===event.event_status&&extraClass.push("stec-event-cancelled"),$(glob.template.gridevent).addClass(extraClass.join(" ")).attr({"data-id":event.id,"data-repeat-time-offset":event.repeat_time_offset?event.repeat_time_offset:0}).html((function(index,html){var date=helper.beautifyTimespan(event.start_date,1!==parseInt(event.hide_end,10)&&event.end_date,event.all_day),gmtUtcOffset=parseInt(event.timezone_utc_offset,10)/3600,timezoneOffsetLabel,organizerString="",productsString="",icon=[],d1,permalink;switch(0===(gmtUtcOffset=gmtUtcOffset>0?"+"+gmtUtcOffset:gmtUtcOffset)&&(gmtUtcOffset=""),timezoneOffsetLabel=0===parseInt(glob.options.general_settings.date_label_gmtutc,10)?"":"UTC/GMT "+gmtUtcOffset,event.organizers.length>0&&(organizerString=event.organizers[0].name,event.organizers.length>1&&(organizerString+=" +"+(event.organizers.length-1)+" "+(event.organizers.length-1>
11?__("morePlural"):__("moreSingular")))),event.products.length>0&&(productsString=event.products[0].title,event.products.length>1&&(productsString+=" +"+(event.products.length-1)+" "+(event.products.length-1>1?__("morePlural"):__("moreSingular")))),event.icon_type){case"image":event.icon_images.length>0?(icon.push('<div class="stec-layout-event-preview-left-icon-images">'),$.each(event.icon_images_meta,(function(i){icon.push('<div class="stec-layout-event-preview-left-icon-image '+(0===i?"active":"")+'" style="background-image: url('+this.src+')"></div>')})),icon.push("</div>")):icon.push('<i class="'+event.icon+'"></i>');break;case"date":d1=moment(event.start_date),icon.push('<span class="stec-layout-event-preview-left-icon-date"><span class="stec-layout-event-preview-left-icon-date-number">'+d1.format("D")+'</span><span class="stec-layout-event-preview-left-icon-date-month">'+__(d1.format("MMM").toLowerCase())+"</span></span>");break;default:icon.push('<i class="'+event.icon+'"></i>')}return permalink=helper.getPermalink(event.permalink,event.repeat_time_offset),"external"===glob.options.general_settings.open_event_in&&event.link&&(permalink=event.link.url),html.replace(/#stec_replace_permalink/g,permalink).replace(/stec_replace_atarget/g,glob.options.general_settings.event_open_target).replace("stec_replace_tags",tagsHtml.join("")).replace("stec_replace_summary",event.title).replace("stec_replace_date",date+" "+timezoneOffsetLabel).replace("stec_replace_image",'style="background-image:url('+(event.images_meta.length>0?event.images_meta[0].src:"")+')"').replace('stec_replace_event_background=""','style="background:'+event.color+'"').replace("stec_replace_organizer_image",'style="background-image: url('+(event.organizers.length>0&&event.organizers[0].photo_src?event.organizers[0].photo_src:"")+')"').replace("stec_replace_organizer_name",organizerString).replace("stec_replace_product_name",productsString).replace("stec_replace_icon",icon.join("")).replace("stec_replace_location",(function(){return"virtual"===event.location.type?__("Online Event"):event.location.title?event.location.title:event.location.full_address})).replace("stec_replace_short_desc",event.description_short).replace(/#stec_replace_edit_link/g,event.edit_link)})).appendTo($instance.$grid.find(".stec-layout-grid-events"))})),parent.resizeEvents(),helper.extendBind("stachethemes_ec_extend","afterFillEvents")}))},calcColumns:function(){var parent=this;for(this.columns=this.options.defaultColumns;($instance.$grid.find(".stec-layout-grid-events").width()-(this.columns-1)*this.options.gutter)/this.columns<this.options.blockMinWidth&&(this.columns--,1!==this.columns););},resizeEvents:function(){var parent;$instance.$grid.is(":visible")&&((parent=this).calcColumns(),$instance.$grid.find(".stec-layout-grid-event").css({width:function(){var val=($instance.$grid.find(".stec-layout-grid-events").outerWidth()-(parent.columns-1)*parent.options.gutter)/parent.columns;return Math.floor(val)}}),this.positionEvents())},positionEvents:function(){var parent=this,maxHeight=0,currentRow=0,currentColumn=0,$prev;$instance.$grid.find(".stec-layout-grid-event").each((function(i){var x=0,y=0,currentHeight;i>0&&i%parent.columns==0&&(currentRow++,currentColumn=0),currentColumn>0&&(x=($prev=$(this).prev()).outerWidth()+$prev.position().left+parent.options.gutter),currentRow>0&&(y=($prev=$instance.$grid.find(".stec-layout-grid-event").eq(i-parent.columns)).outerHeight()+$prev.position().top+parent.options.gutter),$(this).css({top:y,left:x}),currentHeight=y+$(this).outerHeight()+parent.options.gutter,maxHeight=Math.max(currentHeight,maxHeight),currentColumn++})),$instance.$grid.find(".stec-layout-grid-events").height(maxHeight)}},boxgrid:{cache:{getNfutureEvents:!1},columns:0,options:{offset:0,perClick:4,blockMinWidth:270,defaultColumns:4,gutter:0},placeholders:{html:function(){var html=[];return html.push('<div class="stec-layout-boxgrid-event-placeholder">'),html.push("<span></span>"),html.push("<span></span>"),html.push("<span></span>"),html.push("<span></span>"),html.push("<div><span></span><span></span></div>"),html.push("<div><span></span><span></span></div>"),html.push("</div>"),html.join("")},add:function(){var i,placeholders=[];for(placeholders.push('<div class="stec-layout-boxgrid-event-placeholders-wrap">'),layout.boxgrid.calcColumns(),i=0;i<layout.boxgrid.columns;i++)placeholders.push(this.html());placeholders.push("</div>"),$(placeholders.join("")).appendTo($instance.$boxgrid.find(".stec-layout-boxgrid-events"))},remove:function(){$instance.$boxgrid.find(".stec-layout-boxgrid-events").children(".stec-layout-boxgrid-event-placeholders-wrap").remove()}}
1,bindControls:function(){var parent=this;this.options.defaultColumns=parseInt(glob.options.general_settings.boxgrid_columns,10),this.options.perClick=parseInt(glob.options.general_settings.boxgrid_per_click,10),this.options.gutter=parseInt(glob.options.general_settings.boxgrid_gutter,10),this.options.gutter||$instance.$boxgrid.find(".stec-layout-boxgrid-events-all-load-more").css({marginTop:10}),$instance.$boxgrid.find(".stec-layout-boxgrid-events-all-load-more").on(helper.clickHandle(),(function(e){e.preventDefault(),parent.fill()})),"modal"===glob.options.general_settings.open_event_in&&$instance.$boxgrid.on(helper.clickHandle(),".stec-layout-boxgrid-event",(function(e){e.preventDefault(),eventsHandler.eventToggle($(this))})),helper.onResizeEnd((function(){parent.resizeEvents()}),50),$instance.on("onEventsLoaderShow",(function(){"boxgrid"===glob.options.view&&(layout.boxgrid.placeholders.remove(),layout.boxgrid.placeholders.add())})),$instance.on("onEventsLoaderHide",(function(){"boxgrid"===glob.options.view&&layout.boxgrid.placeholders.remove()}))},set:function(){$instance.$boxgrid.show(),this.clear(),this.fill()},clear:function(){this.cache.getNfutureEvents=!1,$instance.$boxgrid.find(".stec-layout-boxgrid-events").empty(),$instance.$boxgrid.find(".stec-layout-boxgrid-noevents").hide()},getNfutureEvents:function(){var parent=this;return new Promise((function(resolve){var x,y,returnData={events:[],loadMore:!1};if(parent.cache.getNfutureEvents)return x=parent.getNfutureEvents.i++*parent.getNfutureEvents.n,y=x+parent.getNfutureEvents.n,returnData.events=parent.cache.getNfutureEvents.slice(x,y),returnData.loadMore=parent.cache.getNfutureEvents.slice(y,y+1).length>0,resolve(returnData);parent.getNfutureEvents.n=parent.options.perClick,calData.getFutureEventsThread(!0,"getFutureEventsThread").then((function(events){return 1===parseInt(glob.options.general_settings.reverse_agenda_list,10)?parent.cache.getNfutureEvents=$(events).get().reverse():parent.cache.getNfutureEvents=events,parent.getNfutureEvents.i=0,x=parent.getNfutureEvents.i++*parent.getNfutureEvents.n,y=x+parent.getNfutureEvents.n,returnData.events=parent.cache.getNfutureEvents.slice(x,y),returnData.loadMore=parent.cache.getNfutureEvents.slice(y,y+1).length>0,resolve(returnData)}))}))},fill:function(){var parent=this;eventsLoader_show(),this.getNfutureEvents().then((function(data){var events=data.events,loadMore=data.loadMore;if(eventsLoader_hide(),!events||events.length<=0)return $instance.$boxgrid.find(".stec-layout-boxgrid-events-all-control").hide(),void($instance.$boxgrid.find(".stec-layout-boxgrid-events").children().length<=0&&$instance.$boxgrid.find(".stec-layout-boxgrid-noevents").show());!1===loadMore?$instance.$boxgrid.find(".stec-layout-boxgrid-events-all-control").hide():$instance.$boxgrid.find(".stec-layout-boxgrid-events-all-control").show(),$(events).each((function(){var event=this,extraClass=[],tagsHtml=[],invitedUser=!1,startDate,endDate,eventState=helper.getEventState(this);switch((eventState>0||"EventCancelled"===event.event_status||"0"===glob.options.general_settings.reminder)&&extraClass.push("stec-layout-event-no-reminder"),parseInt(this.featured,10)){case 1:extraClass.push("stec-event-featured");break;case 2:extraClass.push("stec-event-featured stec-event-featured-bg")}switch(("icon"!==event.icon_type||event.icon&&"fa"!==event.icon)&&"date"!==event.icon_type||extraClass.push("stec-no-icon"),event.images_meta.length>0&&extraClass.push("stec-has-image"),event.event_status){case"EventCancelled":tagsHtml.push('<span class="cancelled">'+__("Cancelled")+"</span>");break;case"EventMovedOnline":tagsHtml.push('<span class="moved-online">'+__("Moved Online")+"</span>");break;case"EventPostponed":tagsHtml.push('<span class="postponed">'+__("Postponed")+"</span>");break;case"EventRescheduled":tagsHtml.push('<span class="rescheduled">'+__("Rescheduled")+"</span>")}0===event.approved&&tagsHtml.push('<span class="unapproved">'+__("Awaiting Approval")+"</span>"),event.featured>0&&tagsHtml.push('<span class="stec-featured-tag">'+__("featured")+"</span>"),$.each(event.category,(function(){tagsHtml.push('<span style="background-color:'+this.color+'">'+this.title+"</span>")})),tagsHtml.length>0&&extraClass.push("stec-has-tags"),isNaN(glob.options.userid)||$(event.attendance).each((function(){if(this.userid===glob.options.userid)return invitedUser=!0,!1})),invitedUser&&extraClass.push("stec-user-invited"),2===eventState?extraClass.push("stec-expired"):1===eventState&&extraClass.push("stec-in-progress"),"EventCancelled"===event.event_status&&extraClass.push("stec-event-cancelled"),$(glob.template.boxgridevent).addClass(extraClass.join(" ")).attr({"data-id":event.id,"data-repeat-time-offset":event.repeat_time_offset?event.repeat_time_offset:0}).html((function(index,html){var timezoneOffsetLabel,dateBigStart,dateBigEnd,dateBig,productsString="",icon=[],images="",permalink,d1,date=helper.beautifyTimespan(event.start_date,1!==parseInt(event.hide_end,10)&&event.end_date,event.all_day),gmtUtcOffset=parseInt(event.timezone_utc_offset,10)/3600;switch(0===(gmtUtcOffset=gmtUtcOffset>0?"+"+gmtUtcOffset:gmtUtcOffset)&&(gmtUtcOffset=""),timezoneOffsetLabel=0===parseInt(glob.options.general_settings.date_label_gmtutc,10)?"":"UTC/GMT "+gmtUtcOffset,dateBig=(dateBigStart="<span>"+moment(event.start_date).format("D")+"</span> "+__(moment(event.start_date).format("MMM").toLowerCase()))+" "+(dateBigStart!==(dateBigEnd="<span>"+moment(event.end_date).format("D")+"</span> "+__(moment(event.end_date).format("MMM").toLowerCase()))?" - "+dateBigEnd:""),event.products.length>0&&(productsString=event.products[0].title,event.products.length>1&&(productsString+=" +"+(event.products.length-1)+" "+(event.products.length-1>
11?__("morePlural"):__("moreSingular")))),event.icon_type){case"image":event.icon_images.length>0?(icon.push('<div class="stec-layout-event-preview-left-icon-images">'),$.each(event.icon_images_meta,(function(i){icon.push('<div class="stec-layout-event-preview-left-icon-image '+(0===i?"active":"")+'" style="background-image: url('+this.src+')"></div>')})),icon.push("</div>")):icon.push('<i class="'+event.icon+'"></i>');break;case"date":d1=moment(event.start_date),icon.push('<span class="stec-layout-event-preview-left-icon-date"><span class="stec-layout-event-preview-left-icon-date-number">'+d1.format("D")+'</span><span class="stec-layout-event-preview-left-icon-date-month">'+__(d1.format("MMM").toLowerCase())+"</span></span>");break;default:icon.push('<i class="'+event.icon+'"></i>')}return event.images.length>0&&$.each(event.images_meta,(function(i){images+='<div class="stec-layout-boxgrid-image '+(0===i?"active":"")+'" style="background-image: url('+this.src+')"></div>'})),permalink=helper.getPermalink(event.permalink,event.repeat_time_offset),"external"===glob.options.general_settings.open_event_in&&event.link&&(permalink=event.link.url),html.replace(/#stec_replace_permalink/g,permalink).replace(/stec_replace_atarget/g,glob.options.general_settings.event_open_target).replace("stec_replace_tags",tagsHtml.join("")).replace("stec_replace_summary",event.title).replace("stec_replace_date_big",dateBig).replace("stec_replace_date",date+" "+timezoneOffsetLabel).replace("stec_replace_image",images).replace('stec_replace_event_background=""','style="background:'+event.color+'"').replace("stec_replace_icon",icon.join("")).replace("stec_replace_short_desc",event.description_short)})).appendTo($instance.$boxgrid.find(".stec-layout-boxgrid-events"))})),helper.extendBind("stachethemes_ec_extend","afterFillEvents"),parent.resizeEvents()}))},resizeEvents:function(){var parent,$boxGridEvents,hasGutter;$instance.$boxgrid.is(":visible")&&(parent=this,$boxGridEvents=$instance.$boxgrid.find(".stec-layout-boxgrid-event"),hasGutter=!!parent.options.gutter,parent.calcColumns(),hasGutter&&$boxGridEvents.css({marginRight:0,marginBottom:parent.options.gutter}),$boxGridEvents.css({width:function(){var boxGridWidth,val=(Math.floor(helper.getElementWidth($instance.$boxgrid.find(".stec-layout-boxgrid-events")))-(parent.columns-1)*parent.options.gutter)/parent.columns;return Math.floor(val)}}),hasGutter&&$boxGridEvents.filter(":not(:nth-child("+parent.columns+"n))").css({marginRight:parent.options.gutter}))},calcColumns:function(){var parent=this,boxGridWidth=Math.floor(helper.getElementWidth($instance.$boxgrid.find(".stec-layout-boxgrid-events")));for(this.columns=this.options.defaultColumns;(boxGridWidth-(this.columns-1)*this.options.gutter)/this.columns<this.options.blockMinWidth&&(this.columns--,1!==this.columns););}}
1,map:{bindControls:function(){},set:function(){switch($instance.$map.show(),!1===layout.map.sidebar.hasSidebar()&&$instance.$map.find(".stec-layout-map-container").width("100%"),glob.options.general_settings.map_type){case"gmap":this.gmap.set();break;case"osm":this.osm.set()}this.sidebar.set()},getRanges:function(){var ranges=[],from,to;function calendarRanges(){let d,m,y,sd,from,to;return d=glob.options.day,m=glob.options.month,y=glob.options.year,sd=moment(),sd.set("year",y),sd.set("month",m),sd.set("date",d),sd.set("hour",0),sd.set("minute",0),sd.set("second",0),from=sd.startOf("month").toDate(),to=sd.endOf("month").toDate(),[from,to]}return glob.options.map_date_start&&glob.options.map_date_end?(from=moment(glob.options.map_date_start),to=moment(glob.options.map_date_end),!1===from.isValid()||!1===to.isValid()?ranges=calendarRanges():(ranges=[from.toDate(),to.toDate()],$instance.$top.find(".stec-top-menu-date-month").hide(),$instance.$top.find(".stec-top-menu-date-year").hide(),$instance.$top.find("[data-action='previous']").hide(),$instance.$top.find("[data-action='next']").hide())):ranges=calendarRanges(),ranges},getEventsWithPhysicalLocations:function(events){var filtered=[];return $.each(events,(function(){this.location.id&&"virtual"!==this.location.type&&filtered.push(this)})),filtered},getMarkerHtml:function(event){var html=[],date=helper.beautifyTimespan(event.start_date,event.end_date,event.all_day);return html.push('<div style="box-sizing: border-box; max-width:270px; padding:10px;">'),html.push("<h3>"+event.title+"</h3>"),html.push('<p style="margin-top:5px;">'+date+"</p>"),event.location.full_address&&html.push('<p style="margin-top:5px;">'+event.location.full_address+"</p>"),html.push('<p style="margin-top:5px;">'+event.description_short+"</p>"),!1===layout.map.sidebar.hasSidebar()&&html.push('<a class="stec-style-button" target="'+(glob.options.general_settings.event_open_target?glob.options.general_settings.event_open_target:"_blank")+'" href="'+helper.getPermalink(event.permalink,event.repeat_time_offset)+'" style="margin-top:10px; display: block;">'+__("View Event")+"</a>"),html.push("</div>"),html.join("")},gmap:{zoom:8,gmap:null,geocoder:null,container:null,location:[0,0],markers:[],activeInfoWindow:null,canvasImage:function(width,height,color,bg,lineWidth){var context,x,y,w,h,r,canvas=document.createElement("canvas");return canvas.width=width,canvas.height=height,(context=canvas.getContext("2d")).beginPath(),context.beginPath(),x=0,y=0,w=width,h=height,r=4,context.moveTo(4,0),context.lineTo(0+w-4,0),context.quadraticCurveTo(0+w,0,0+w,4),context.lineTo(0+w,0+h-4),context.quadraticCurveTo(0+w,0+h,0+w-4,0+h),context.lineTo(4,0+h),context.quadraticCurveTo(0,0+h,0,0+h-4),context.lineTo(0,4),context.quadraticCurveTo(0,0,4,0),context.fill(),context.fillStyle=color,context.fill(),context.lineWidth=lineWidth,context.strokeStyle=bg,context.stroke(),canvas.toDataURL()},set:function(){var parent=this;null===this.gmap?(this.zoom=glob.options.map_zoom?parseInt(glob.options.map_zoom,10):this.zoom,this.container=$instance.$map.find(".stec-layout-map-container").get(0),this.gmap=new window.google.maps.Map(this.container,{zoom:this.zoom,mapTypeControlOptions:{mapTypeIds:[]}}),glob.options.gmap_theme&&"standard"!==glob.options.gmap_theme&&(this.gmap.mapTypes.set("Custom_Style",helper.getMapStyles(glob.options.gmap_theme)),this.gmap.setMapTypeId("Custom_Style")),this.geocoder=new window.google.maps.Geocoder,glob.options.map_focus?this.focusLocation(glob.options.map_focus):this.focusLocation(null,this.location)):this.refresh(!0),this.drawActiveMarkers()},clearMarkers:function(){var i;for(i=0;i<this.markers.length;i++)this.markers[i].setMap(null)},drawActiveMarkers:function(){var parent=this,ranges=layout.map.getRanges();this.clearMarkers(),calData.getNearestDateEventsThread(ranges[0],ranges[1],!0,"drawActiveMarkers").then((function(events){var physicalEvents=layout.map.getEventsWithPhysicalLocations(events),focused=!1;if(physicalEvents.length<=0)return layout.map.sidebar.noEventsDisplay(),void helper.extendBind("stachethemes_ec_extend","afterFillEvents");$.each(physicalEvents,(function(){let event=this,locationString;
1!1===focused&&(glob.options.map_focus||(event.location.coordinates?(parent.location=event.location.coordinates.split(","),parent.focusLocation(null,parent.location)):parent.focusLocation(event.location.full_address)),focused=!0),locationString=event.location.full_address,event.location.coordinates?parent.addMarker(event):parent.getCoordinates(locationString,(function(coords){!1!==coords&&(event.location.coordinates=coords.toString().replace(/\(|\)/gi,""),parent.addMarker(event))}))})),layout.map.sidebar.listEvents(physicalEvents),helper.extendBind("stachethemes_ec_extend","afterFillEvents")}))},addMarker:function(event){var parent=this,marker,infoWindow,coords=event.location.coordinates.split(",").map((function(x){return Number(x)})),latlng={lat:coords[0],lng:coords[1]};glob.temp.stecMapMarkerIcon=parent.canvasImage(50,50,event.color,"white",4),glob.temp.stecMapPopupHtml=layout.map.getMarkerHtml(event),$instance.trigger("stecMapMarkerIcon",{$instance:$instance,event:event,temp:glob.temp}),marker=new window.google.maps.Marker({position:latlng,map:parent.gmap,icon:glob.temp.stecMapMarkerIcon,title:event.title,zIndex:1e3,stec:{event:event}}),infoWindow=new window.google.maps.InfoWindow({content:glob.temp.stecMapPopupHtml}),marker.addListener("click",(function(){parent.activeInfoWindow&&parent.activeInfoWindow.close(),infoWindow.open(parent.gmap.gmap,marker),layout.map.sidebar.hasSidebar()&&layout.map.sidebar.focusEvent(this.stec.event),parent.activeInfoWindow=infoWindow})),window.google.maps.event.addListener(infoWindow,"closeclick",(function(){layout.map.sidebar.clearFocus(),layout.map.sidebar.isSmallScreen()&&layout.map.sidebar.scroller.doScroll()})),parent.markers.push(marker)},getCoordinates:function(location,callback){var parent=this;parent.geocoder.geocode({address:location},(function(results,status){var coords=!1;if(status===window.google.maps.GeocoderStatus.OK)coords=results[0].geometry.location,"function"==typeof callback&&callback(coords);else{if("OVER_QUERY_LIMIT"===status)return void setTimeout((function(){parent.getCoordinates(location,callback)}),3e3);console.log("Geocoder error: "+status),"function"==typeof callback&&callback(!1)}}))},focusLocation:function(location,coordinates){var parent=this;if(!location&&coordinates)return parent.gmap.setCenter(new window.google.maps.LatLng(coordinates[0],coordinates[1])),void parent.refresh();location||(location=parent.location),parent.geocoder.geocode({address:location},(function(results,status){status===window.google.maps.GeocoderStatus.OK?parent.gmap.setCenter(results[0].geometry.location):console.log("Geocoder error: "+status)})),parent.refresh()},refresh:function(focusLocation){var parent=this;setTimeout((function(){window.google.maps.event.trigger(parent.container,"resize"),glob.options.map_focus||!0!==focusLocation||parent.focusLocation(null,parent.location)}),10)}},osm:{zoom:8,omap:null,container:null,location:[0,0],markers:[],markersLayer:null,infoWindow:null,set:function(){var parent=this;null===parent.omap&&(parent.zoom=glob.options.map_zoom?parseInt(glob.options.map_zoom,10):parent.zoom,parent.container=$instance.$map.find(".stec-layout-map-container").get(0),parent.omap=helper.osm(parent.container),glob.options.map_focus?null===glob.options.map_focus.match(/[aA-zZ]+/)?(parent.location=glob.options.map_focus.split(","),parent.omap.setView(parent.location,parent.zoom),glob.options.map_focus=null):helper.promiseGetAddressCoordinates(glob.options.map_focus).then((function(coords){parent.location=coords.split(","),parent.omap.setView(parent.location,parent.zoom),glob.options.map_focus=null})).catch((function(){parent.omap.setView(parent.location,parent.zoom)})):parent.omap.setView(parent.location,parent.zoom)),parent.drawActiveMarkers()},clearMarkers:function(){this.markersLayer&&(this.omap.removeLayer(this.markersLayer),this.markersLayer=null,this.markers=[])},drawActiveMarkers:function(){var parent=this,ranges=layout.map.getRanges(),loopIndex=0;parent.clearMarkers(),calData.getNearestDateEventsThread(ranges[0],ranges[1],!0,"drawActiveMarkers").then((function(events){var eventsToDraw=[],physicalEvents=layout.map.getEventsWithPhysicalLocations(events),phEventsLength=physicalEvents.length;if(phEventsLength<=0)return layout.map.sidebar.noEventsDisplay(),void helper.extendBind("stachethemes_ec_extend","afterFillEvents");$.each(physicalEvents,(function(){let event=this;helper.promiseCoordinates(event).then((function(coords){event.location.coordinates=coords,parent.addMarker(event),eventsToDraw.push(event)})).finally((function(){++loopIndex===phEventsLength&&(glob.options.map_focu
1s||(parent.location=eventsToDraw[0].location.coordinates.split(","),parent.omap.setView(parent.location,parent.zoom)),parent.markersLayer=window.L.layerGroup(parent.markers),parent.omap.addLayer(parent.markersLayer),helper.extendBind("stachethemes_ec_extend","afterFillEvents"))}))})),layout.map.sidebar.listEvents(physicalEvents)}))},addMarker:function(event){var parent=this,d1,iconHtml=[],coords=event.location.coordinates.split(",").map((function(x){return Number(x)})),marker;switch(event.icon_type){case"image":event.icon_images.length>0?iconHtml.push("<div style='background-image: url("+event.icon_images_meta[0].thumb+")'></div>"):iconHtml.push("<div style='background-color:"+event.color+"'><i class='"+event.icon+"'></i></div>");break;case"date":d1=moment(event.start_date),iconHtml.push("<div style='background-color:"+event.color+"'><span class='icon-date'>"+d1.format("D")+"</span> <span class='icon-month'>"+__(d1.format("MMM").toLowerCase())+"</span></div>");break;default:iconHtml.push("<div style='background-color:"+event.color+"'><i class='"+event.icon+"'></i></div>")}glob.temp.stecMapMarkerIcon=new window.L.divIcon({className:"stec-omap-marker-pin",html:iconHtml.join(""),iconSize:[54,54],iconAnchor:[22,22]}),glob.temp.stecMapPopupHtml=layout.map.getMarkerHtml(event),$instance.trigger("stecMapMarkerIcon",{$instance:$instance,event:event,temp:glob.temp}),$instance.trigger("stecMapPopup",{$instance:$instance,event:event,temp:glob.temp}),(marker=window.L.marker(coords,{icon:glob.temp.stecMapMarkerIcon,riseOnHover:!0})).bindPopup(glob.temp.stecMapPopupHtml),marker.on("click",(function(){layout.map.sidebar.hasSidebar()&&layout.map.sidebar.focusEvent(event)})),marker.getPopup().on("remove",(function(){layout.map.sidebar.hasSidebar()&&(layout.map.sidebar.clearFocus(),layout.map.sidebar.isSmallScreen()&&layout.map.sidebar.scroller.doScroll())})),this.markers.push(marker)}},sidebar:{isSidebarEnabled:null,maxHeight:600,hasSidebar:function(){return null===this.isSidebarEnabled&&(this.isSidebarEnabled=!(glob.options.map_list&&0===parseInt(glob.options.map_list,10))),this.isSidebarEnabled},set:function(){!1!==this.hasSidebar()?($instance.$map.removeClass("sidebar-fullwidth"),eventsHandler.eventHolder.close(),this.clearFocus(),$instance.$map.find(".stec-layout-map-sidebar .stec-scrollable").css("max-height",this.maxHeight)):$instance.$map.find(".stec-layout-map-sidebar").hide()},isSmallScreen:function(){return helper.isMobile()||$instance.hasClass("stec-media-small")||$instance.hasClass("stec-media-med")},scroller:{doScroll:function(){var scr;return $instance.$map.find(".stec-scrollable").data("stec-scroll")?(scr=$instance.$map.find(".stec-scrollable").data("stec-scroll")).reset():((scr=new window.StecScroll).create($instance.$map.find(".stec-scrollable")),$instance.$map.find(".stec-scrollable").data("stec-scroll",scr)),scr},removeScroller:function(){var scr=$instance.$map.find(".stec-scrollable").data("stec-scroll");scr&&(scr.destroy(),$instance.$map.find(".stec-scrollable").data("stec-scroll",null))},scrollTo:function(y){var scr=$instance.$map.find(".stec-scrollable").data("stec-scroll");scr&&scr.outer&&scr.scrollTo(y)}},clearFocus:function(){var $eventsContainer=$instance.$map.find(".stec-layout-events"),$event=$eventsContainer.find(".stec-layout-event");$eventsContainer.removeClass("container-focused"),$event.removeClass("event-focused")},focusLocation:function(coordinatesArray){if("1"!==glob.options.map_list_nofocus)switch(glob.options.general_settings.map_type){case"gmap":layout.map.gmap.gmap.panTo(new window.google.maps.LatLng(coordinatesArray[0],coordinatesArray[1]));break;case"osm":layout.map.osm.omap.setView(coordinatesArray,layout.map.osm.zoom)}},focusEvent:function(event){var id=event.id,offset=event.repeat_time_offset?event.repeat_time_offset:0,$eventsContainer=$instance.$map.find(".stec-layout-events"),$event=$eventsContainer.find('.stec-layout-event[data-id="'+id+'"][data-repeat-time-offset="'+offset+'"]');helper.isMobile()||(this.scroller.scrollTo(-1*$event.position().top),this.clearFocus()),$eventsContainer.addClass("container-focused"),$event.addClass("event-focused"),this.isSmallScreen()&&this.scroller.removeScroller()},noEventsDisplay:function(){this.scroller.removeScroller(),$instance.$map.find(".stec-layout-map-noevents").show()},listEvents:function(events){events?($instance.$map.find(".stec-layout-map-noevents").hide(),eventsHandler.eventHolder.openEvents(events,(function(){layout.map.sidebar.scroller.doScroll()}),!0)):this.noEventsDisplay()}
1,bindControls:function(){helper.onResizeEnd((function(){$instance.$map.is(":visible")&&(layout.map.sidebar.scroller.doScroll(),layout.map.sidebar.scroller.scrollTo(0))}),50),$instance.on("onEventToggleOpen",(function(e,data){"self"===glob.options.general_settings.open_event_in&&(!1===data.$container.parent().hasClass("event-focused")&&layout.map.sidebar.clearFocus(),$instance.$map.addClass("sidebar-fullwidth"),layout.map.sidebar.scroller.removeScroller(),$instance.$map.find(".stec-layout-map-sidebar .stec-scrollable").css("max-height","none"))})),$instance.on("onEventToggleClose",(function(){"self"===glob.options.general_settings.open_event_in&&($instance.$map.removeClass("sidebar-fullwidth"),$instance.$map.find(".stec-layout-map-sidebar .stec-scrollable").css("max-height",layout.map.sidebar.maxHeight),layout.map.sidebar.scroller.doScroll())})),$instance.$map.find(".stec-layout-events").on("mouseenter",".stec-layout-event",(function(){var id,event;$instance.$map.find(".stec-layout-events").hasClass("container-focused")||(id=$(this).data("id"),(event=calData.getEventById(id)).location&&event.location.coordinates&&layout.map.sidebar.focusLocation(event.location.coordinates.split(",")))}))}}},bindControls:function(){setInterval((function(){$instance.find(".stec-layout-event-preview-left-icon-images").filter(":visible").each((function(){var currentImage,nextImage;$(this).children().length<=1||(currentImage=$(this).children().filter(".active"),0===(nextImage=currentImage.next()).length&&(nextImage=$(this).children().first()),nextImage.addClass("transition"),setTimeout((function(){currentImage.removeClass("active"),nextImage.removeClass("transition").addClass("active")}),1e3))}))}),6e3),setInterval((function(){$instance.$boxgrid.find(".stec-layout-boxgrid-images").filter(":visible").each((function(){var currentImage,nextImage;$(this).children().length<=1||(currentImage=$(this).children().filter(".active"),0===(nextImage=currentImage.next()).length&&(nextImage=$(this).children().first()),nextImage.addClass("transition"),setTimeout((function(){currentImage.removeClass("active"),nextImage.removeClass("transition").addClass("active")}),1e3))}))}),6e3)}};this.refreshState=function(type){switch(type){case"layout":layout.set();break;case"top":top.set();break;default:layout.set()}},this.prepareEvents=function(callback){var promiseAddToEventsPool;window.stecJsonEvents&&window.stecJsonEvents[glob.options.id]?(promiseAddToEventsPool=new window.Promise((function(resolve,reject){calData.addToEventsPool(window.stecJsonEvents[glob.options.id]),setTimeout((function(){resolve()}))}))).then((function(){"function"==typeof callback&&callback()})):(preloader_add(),calData.queryEvents(callback,(function step(){preloader_count(calData.eventsPool.length)})))},this.init=function(options){var now=new Date,monthNumber,theWeek,theMonth,theToday,match;if(DB=new window.StecDB,helper=new window.StecHelper,calData=new window.StecCalData,$.extend(glob.options,options),instance="#"+glob.options.id,$instance=$(instance),helper.set("glob",glob).set("calData",calData).set("$instance",$instance).set("instance",instance).set("layout",layout).set("eventsHandler",eventsHandler),calData.set("helper",helper).set("glob",glob).set("DB",DB),"0"!==glob.options.general_settings.reminder&&((reminder=new window.StecReminder("reminder-popup-id-"+glob.options.id)).set("$instance",$instance).set("instance",instance).set("helper",helper).set("calData",calData).set("displayPrivacyAgreement",glob.options.general_settings.display_privacy_agreement).set("privacyAgreemntContent",glob.options.general_settings.privacy_agreement_content).set("glob",glob),reminder.controller()),(rsvp=new window.StecRsvpToEvent("rsvp-popup-id-"+glob.options.id)).set("$instance",$instance).set("helper",helper).set("calData",calData).set("layout",layout).set("displayPrivacyAgreement",glob.options.general_settings.display_privacy_agreement).set("privacyAgreemntContent",glob.options.general_settings.privacy_agreement_content).set("glob",glob),rsvp.controller(),glob.rsvp=rsvp,window.StecBooking&&((booking=new window.StecBooking("booking-popup-id-"+glob.options.id)).set("$instance",$instance).set("helper",helper).set("glob",glob),booking.controller()),window.StecShop&&((shop=new window.StecShop).set("$instance",$instance).set("helper",helper).set("glob",glob),shop.c
1ontroller()),$instance.length<=0)console.log("Stachethemes Event Calendar - License is not activated");else{if(helper.isMobile()&&$instance.addClass("stec-mobile"),$instance.$top=$instance.children(".stec-top"),$instance.$agenda=$instance.children(".stec-layout").find(".stec-layout-agenda"),$instance.$month=$instance.children(".stec-layout").find(".stec-layout-month"),$instance.$week=$instance.children(".stec-layout").find(".stec-layout-week"),$instance.$day=$instance.children(".stec-layout").find(".stec-layout-day"),$instance.$grid=$instance.children(".stec-layout").find(".stec-layout-grid"),$instance.$boxgrid=$instance.children(".stec-layout").find(".stec-layout-boxgrid"),$instance.$map=$instance.children(".stec-layout").find(".stec-layout-map"),$instance.$events=$instance.children(".stec-layout").find(".stec-layout-events"),$instance.$top.path=instance+" .stec-top ",$instance.$agenda.path=instance+" .stec-layout .stec-layout-agenda ",$instance.$month.path=instance+" .stec-layout .stec-layout-month ",$instance.$week.path=instance+" .stec-layout .stec-layout-week ",$instance.$day.path=instance+" .stec-layout .stec-layout-day ",$instance.$events.path=instance+" .stec-layout-events ",glob.template.eventCreateForm=$("#stec-event-create-form-template").html(),glob.template.event=$("#stec-event-template").html(),glob.template.gridevent=$("#stec-grid-event-template").html(),glob.template.boxgridevent=$("#stec-boxgrid-event-template").html(),glob.template.eventInner=$("#stec-event-inner-template").html(),glob.template.tooltip=$("#stec-tooltip-template").html(),glob.template.preloader=$("#stec-preloader-template").html(),glob.template.share=$("#stec-share-template").html(),glob.template.emailEvent=$("#stec-email-event-template").html(),glob.options.view=glob.options.general_settings.view,void 0!==glob.options.start_date)switch(glob.options.start_date){case"prev_week":now=moment().subtract(1,"week").startOf("week").toDate();break;case"prev_month":now=moment().subtract(1,"month").startOf("month").toDate();break;case"this_week":now=moment().startOf("week").toDate();break;case"next_week":now=moment().add(1,"week").startOf("week").toDate();break;case"next_month":now=moment().add(1,"month").startOf("month").toDate();break;case"this_month":now=moment().startOf("month").toDate();break;default:if(null!==(match=glob.options.start_date.match(/(\+|\-)(\d)M/)))switch(match[1]){case"+":now=moment().add(parseInt(match[2],10),"month").startOf("month").toDate();break;case"-":now=moment().subtract(parseInt(match[2],10),"month").startOf("month").toDate()}else now=new Date(glob.options.start_date)}if(glob.options.min_date)switch(glob.options.min_date){case"this_week":monthNumber=(theWeek=helper.getWeekInfo(moment().toDate())).start.month+1,monthNumber=parseInt(("0"+monthNumber).slice(-2),10),glob.options.min_date=theWeek.start.year+"-"+monthNumber+"-"+theWeek.start.day;break;case"prev_week":monthNumber=(theWeek=helper.getWeekInfo(moment().subtract(1,"week").toDate())).start.month+1,monthNumber=parseInt(("0"+monthNumber).slice(-2),10),glob.options.min_date=theWeek.start.year+"-"+monthNumber+"-"+theWeek.start.day;break;case"next_week":monthNumber=(theWeek=helper.getWeekInfo(moment().add(1,"week").toDate())).start.month+1,monthNumber=parseInt(("0"+monthNumber).slice(-2),10),glob.options.min_date=theWeek.start.year+"-"+monthNumber+"-"+theWeek.start.day;break;case"prev_month":theMonth=moment().subtract(1,"month").startOf("month"),glob.options.min_date=theMonth.format("YYYY-MM-DD");break;case"next_month":theMonth=moment().add(1,"month").startOf("month"),glob.options.min_date=theMonth.format("YYYY-MM-DD");break;case"this_month":theMonth=moment().startOf("month"),glob.options.min_date=theMonth.format("YYYY-MM-DD");break;case"today":theToday=moment().startOf("day"),glob.options.min_date=theToday.format("YYYY-MM-DD");break;default:if(null!==(match=glob.options.min_date.match(/(\+|\-)(\d)M/)))switch(match[1]){case"+":glob.options.min_date=moment().add(parseInt(match[2],10),"month").startOf("month").format("YYYY-MM-DD");break;case"-":glob.options.min_date=moment().subtract(parseInt(match[2],10),"month").startOf("month").format("YYYY-MM-DD")}}if(glob.options.max_date)switch(glob.options.max_date){case"this_week":monthNumber=(theWeek=helper.getWeekInfo(moment().toDate())).start.month+1,monthNumber=parseInt(("0"+monthNumber).slice(-2),10),glob.options.max_date=theWeek.end.year+"-"+monthNumber+"-"+theWeek.end.day;break;case"prev_week":monthNumber=(theWeek=helper.getWeekInfo(moment().subtract(1,"week").toDate())).end.month+1,monthNumber=parseInt(("0"+monthNumber).slice(-2),10),glob.options.max_date=theWeek.end.year+"-"+monthNumber+"-"+theWeek.end.day;break;case"next_week":monthNumber=(theWeek=helper.getWeekInfo(moment().add(1,"week").toDate())).end.month+1,monthNumber=parseInt(("0"+monthNumber).slice(-2),10),glob.options.max_date=theWeek.end.year+"-"+monthNumber+"-"+theWeek.end.day;break;case"prev_month":theMonth=moment().subtract(1,"month").endOf("month"),glob.options.max_date=theMonth.format("YYYY-MM-DD");break;case"next_month":theMonth=moment().add(1,"month").endOf("month"),glob.options.max_date=theMonth.format("YYYY-MM-DD");break;case"this_month":theMonth=moment().endOf("month"),glob.options.max_date=theMonth.format("YYYY-MM-DD");break;case"today":theToday=moment().endOf("day"),glob.options.max_date=theToday.format("YYYY-MM-DD");break;default:if(null!==(match=glob.options.max_date.match(/(\+|\-)(\d)M/)))switch(match[1]){case"+":glob.options.max_date=moment().add(parseInt(match[2],10),"month").endOf("month").format("YYYY-MM-DD");break;case"-":glob.options.max_date=moment().subtract(parseInt(match[2],10),"month").endOf("month").format("YYYY-MM-DD")}}glob.options.day=now.getDate(),glob.options.month=now.getMonth(),glob.options.year=now.getFullYear(),void 0!==window.StecAnimate&&helper.set("animate",new window.StecAnimate($instance)),top.init(),layout.init(),eventsHandler.init(),this.prepareEvents((function(){preloader_destroy(),$instance.show(),main.refreshState("layout")})),helper.extendBind("stachethemes_ec_extend")}},moment.locale("en")}$((function(){"function"==typeof $.fn.datepicker.noConflict&&($.fn.bootstrapDP=$.fn.datepicker.noConflict()),$(document).on("click",".stec-fi
1xed-message a",(function(e){e.preventDefault(),$(this).parents(".stec-fixed-message").remove()})),void 0!==window.stecInstance&&$(window.stecInstance).each((function(){var stec,thisInstance=this;this.init_on_trigger?$(document).on(this.init_on_trigger,(function(){$(document).trigger("stecInitOnTrigger",thisInstance),(stec=new StachethemesEventCalendar).init(thisInstance)})):(stec=new StachethemesEventCalendar).init(thisInstance)}))})),window.StachethemesEventCalendar=StachethemesEventCalendar}(window.jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.