!function(e,t){"use strict";ElementsKit_Helper.registerWidget("elementskit-event-calendar.default",(function(t){const n=t.find(".ekit-calendar-wrapper"),o=n.data("id"),r=t.find(`#calendar-${o}`).get(0),a=n.data("calendar-settings"),i=a?.toolbarTogether,l=window.ekit_config?.widgets?.eventCalendar?.headerIcons;if(!r||!a)return;const d=()=>{if(!0===a.showEventPopup){const n=t.find(".ekit-popup-wrapper").map((function(){return e(this).data("popup-id")})).get();return function(t){t.jsEvent.preventDefault();const o=t.event._def.publicId;if(n.includes(o)){const t=`#${o}`;e(t).addClass("open"),e(".popup-close").on("click",(function(){e(t).removeClass("open")}))}if(t.event.url)return!1}}return function(e){e.jsEvent.preventDefault();const t=e?.event?.url;"string"==typeof t&&""!==t.trim()&&"null"!==t&&"undefined"!==t&&window.open(t,"_blank","noopener,noreferrer")}};"google_calendar"!==a.calendarType||a.googleCalendarApiKey?"the_events_calendar"!==a.calendarType||a.theEventsCalendar?(()=>{const t=[!a.hideYear&&"multiMonthYear",!a.hideMonth&&"dayGridMonth",!a.hideWeek&&"timeGridWeek",!a.hideDay&&"timeGridDay",!a.hideList&&"listWeek"].filter(Boolean).join(","),n=a.headerLeftToolbar&&"prev,next,today",o=[!("right"!==i||!a.headerLeftToolbar)&&"prev,next,today",t].filter(Boolean).join(" "),s={locale:a.languageCode,initialView:a.initialView,firstDay:a.firstDay,allDay:a.allDay,selectable:!1,editable:!1,navLinks:!1,weekNumbers:!1,dayMaxEvents:!0,events:a.eventData,buttonIcons:{prev:"chevron-left",next:"chevron-right",prevYear:"chevrons-left",nextYear:"chevrons-right"},eventTimeFormat:{hour:"numeric",minute:"2-digit",meridiem:"short"},headerToolbar:!!a.headerToolbar&&{left:"right"!==i&&n,center:"title",right:!!a.headerRightToolbar&&("right"===i?o:t)},eventClick:d()};"google_calendar"===a.calendarType&&(s.googleCalendarApiKey=a.googleCalendarApiKey);if(new FullCalendar.Calendar(r,s).render(),l){[{selector:".fc-multiMonthYear-button",icon:l.year},{selector:".fc-dayGridMonth-button",icon:l.month},{selector:".fc-timeGridWeek-button",icon:l.week},{selector:".fc-timeGridDay-button",icon:l.day},{selector:".fc-listWeek-button",icon:l.list}].forEach((({selector:t,icon:n})=>{if(!n)return;const o=e(r).find(t);o.length&&o.prepend(n)}))}const c=e(r).find(".fc-header-toolbar"),u="right"==i?"ekit-custom-toolbar-yes":"ekit-custom-toolbar-no";c.removeClass("ekit-custom-toolbar-yes ekit-custom-toolbar-no").addClass(u)})():n.append('<div class="elemenetskit-alert-info">\n\t\t\t\t\t\tPlease install and activate <strong>The Events Calendar</strong> plugin.\n\t\t\t\t\t</div>'):n.append('<div class="elemenetskit-alert-info">\n\t\t\t\t\t\t\tPlease provide a valid <strong>Google API Key</strong> and <strong>Calendar ID</strong>.\n\t\t\t\t\t\t</div>')}))}(jQuery,window.elementorFrontend);