/*! This file is auto-generated */ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):jQuery&&!jQuery.fn.hoverIntent&&e(jQuery)}(function(f){"use strict";function u(e){return"function"==typeof e}var i,r,v={interval:100,sensitivity:6,timeout:0},s=0,a=function(e){i=e.pageX,r=e.pageY},p=function(e,t,n,o){if(Math.sqrt((n.pX-i)*(n.pX-i)+(n.pY-r)*(n.pY-r)) ul.mega-sub-menu > li.mega-menu-item-has-children," + "li.mega-menu-flyout li.mega-menu-item-has-children", $menu); var collapse_children_parents = $("li.mega-menu-megamenu li.mega-menu-item-has-children.mega-collapse-children > a.mega-menu-link", $menu); plugin.addAnimatingClass = function(element) { if (plugin.settings.effect === "disabled") { return; } $(".mega-animating").removeClass("mega-animating"); var timeout = plugin.settings.effect_speed + parseInt(plugin.settings.hover_intent_timeout, 10); element.addClass("mega-animating"); setTimeout(function() { element.removeClass("mega-animating"); }, timeout ); }; plugin.hideAllPanels = function() { $(".mega-toggle-on > a.mega-menu-link", $menu).each(function() { plugin.hidePanel($(this), false); }); }; plugin.expandMobileSubMenus = function() { if (plugin.settings.mobile_direction !== 'vertical') { return; } $(".mega-menu-item-has-children.mega-expand-on-mobile > a.mega-menu-link", $menu).each(function() { plugin.showPanel($(this), true); }); if ( plugin.settings.mobile_state == 'expand_all' ) { $(".mega-menu-item-has-children:not(.mega-toggle-on) > a.mega-menu-link", $menu).each(function() { plugin.showPanel($(this), true); }); } if ( plugin.settings.mobile_state == 'expand_active' ) { const activeItemSelectors = [ "li.mega-current-menu-ancestor.mega-menu-item-has-children > a.mega-menu-link", "li.mega-current-menu-item.mega-menu-item-has-children > a.mega-menu-link", "li.mega-current-menu-parent.mega-menu-item-has-children > a.mega-menu-link", "li.mega-current_page_ancestor.mega-menu-item-has-children > a.mega-menu-link", "li.mega-current_page_item.mega-menu-item-has-children > a.mega-menu-link" ]; $menu.find(activeItemSelectors.join(', ')).each(function() { plugin.showPanel($(this), true); }); } } plugin.hideSiblingPanels = function(anchor, immediate) { anchor.parent().parent().find(".mega-toggle-on").children("a.mega-menu-link").each(function() { // all open children of open siblings plugin.hidePanel($(this), immediate); }); }; plugin.isDesktopView = function() { var width = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0); return width > plugin.settings.breakpoint; }; plugin.isMobileView = function() { return !plugin.isDesktopView(); }; plugin.showPanel = function(anchor, immediate) { if ( $.isNumeric(anchor) ) { anchor = $("li.mega-menu-item-" + anchor, $menu).find("a.mega-menu-link").first(); } else if ( anchor.is("li.mega-menu-item") ) { anchor = anchor.find("a.mega-menu-link").first(); } anchor.parent().triggerHandler("before_open_panel"); anchor.parent().find("[aria-expanded]").first().attr("aria-expanded", "true"); $(".mega-animating").removeClass("mega-animating"); if (plugin.isMobileView() && anchor.parent().hasClass("mega-hide-sub-menu-on-mobile")) { return; } if (plugin.isDesktopView() && ( $menu.hasClass("mega-menu-horizontal") || $menu.hasClass("mega-menu-vertical") ) && !anchor.parent().hasClass("mega-collapse-children")) { plugin.hideSiblingPanels(anchor, true); } if ((plugin.isMobileView() && $wrap.hasClass("mega-keyboard-navigation")) || plugin.settings.vertical_behaviour === "accordion") { plugin.hideSiblingPanels(anchor, false); } plugin.calculateDynamicSubmenuWidths(anchor); // apply jQuery transition (only if the effect is set to "slide", other transitions are CSS based) if ( plugin.shouldUseSlideAnimation(anchor, immediate) ) { var speed = plugin.isMobileView() ? plugin.settings.effect_speed_mobile : plugin.settings.effect_speed; anchor.siblings(".mega-sub-menu").css("display", "none").animate({"height":"show", "paddingTop":"show", "paddingBottom":"show", "minHeight":"show"}, speed, function() { $(this).css("display", ""); }); } anchor.parent().addClass("mega-toggle-on").triggerHandler("open_panel"); }; plugin.shouldUseSlideAnimation = function(anchor, immediate) { if (immediate == true) { return false; } if (anchor.parent().hasClass("mega-collapse-children")) { return true; } if (plugin.isDesktopView() && plugin.settings.effect === "slide") { return true; } if (plugin.isMobileView()) { if (plugin.settings.effect_mobile === "slide") { return true; } if (plugin.settings.effect_mobile === "slide_left" || plugin.settings.effect_mobile === "slide_right") { return plugin.settings.mobile_direction !== "horizontal"; } } return false; }; plugin.hidePanel = function(anchor, immediate) { if ( $.isNumeric(anchor) ) { anchor = $("li.mega-menu-item-" + anchor, $menu).find("a.mega-menu-link").first(); } else if ( anchor.is("li.mega-menu-item") ) { anchor = anchor.find("a.mega-menu-link").first(); } anchor.parent().triggerHandler("before_close_panel"); anchor.parent().find("[aria-expanded]").first().attr("aria-expanded", "false"); if ( plugin.shouldUseSlideAnimation(anchor) ) { var speed = plugin.isMobileView() ? plugin.settings.effect_speed_mobile : plugin.settings.effect_speed; anchor.siblings(".mega-sub-menu").animate({"height":"hide", "paddingTop":"hide", "paddingBottom":"hide", "minHeight":"hide"}, speed, function() { anchor.siblings(".mega-sub-menu").css("display", ""); anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel"); }); return; } if (immediate) { anchor.siblings(".mega-sub-menu").css("display", "none").delay(plugin.settings.effect_speed).queue(function(){ $(this).css("display", "").dequeue(); }); } // pause video widget videos anchor.siblings(".mega-sub-menu").find(".widget_media_video video").each(function() { this.player.pause(); }); anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel"); plugin.addAnimatingClass(anchor.parent()); }; plugin.calculateDynamicSubmenuWidths = function(anchor) { // apply dynamic width and sub menu position (only to top level mega menus) if (anchor.parent().hasClass("mega-menu-megamenu") && anchor.parent().parent().hasClass("max-mega-menu") && plugin.settings.panel_width ) { if (plugin.isDesktopView()) { var submenu_offset = $menu.offset(); var target_offset = $(plugin.settings.panel_width).offset(); if ( plugin.settings.panel_width == '100vw' ) { target_offset = $('body').offset(); anchor.siblings(".mega-sub-menu").css({ left: (target_offset.left - submenu_offset.left) + "px" }); } else if ( $(plugin.settings.panel_width).length > 0 ) { anchor.siblings(".mega-sub-menu").css({ width: $(plugin.settings.panel_width).outerWidth(), left: (target_offset.left - submenu_offset.left) + "px" }); } } else { anchor.siblings(".mega-sub-menu").css({ width: "", left: "" }); } } // apply inner width to sub menu by adding padding to the left and right of the mega menu if (anchor.parent().hasClass("mega-menu-megamenu") && anchor.parent().parent().hasClass("max-mega-menu") && plugin.settings.panel_inner_width && $(plugin.settings.panel_inner_width).length > 0) { var target_width = 0; if ($(plugin.settings.panel_inner_width).length) { // jQuery selector target_width = parseInt($(plugin.settings.panel_inner_width).width(), 10); } else { // we"re using a pixel width target_width = parseInt(plugin.settings.panel_inner_width, 10); } anchor.siblings(".mega-sub-menu").css({ "paddingLeft": "", "paddingRight": "" }); var submenu_width = parseInt(anchor.siblings(".mega-sub-menu").innerWidth(), 10); if (plugin.isDesktopView() && target_width > 0 && target_width < submenu_width) { anchor.siblings(".mega-sub-menu").css({ "paddingLeft": (submenu_width - target_width) / 2 + "px", "paddingRight": (submenu_width - target_width) / 2 + "px" }); } } }; plugin.bindClickEvents = function() { if ( $wrap.data('has-click-events') === true ) { return; } $wrap.data('has-click-events', true); var dragging = false; $(document).on({ "touchmove": function(e) { dragging = true; }, "touchstart": function(e) { dragging = false; } }); $(document).on("click touchend", function(e) { // hide menu when clicked away from if (!dragging && plugin.settings.document_click === "collapse" && ! $(e.target).closest(".mega-menu-wrap").length ) { plugin.hideAllPanels(); plugin.hideMobileMenu(); } dragging = false; }); var clickable_parents = $("> a.mega-menu-link", items_with_submenus).add(collapse_children_parents); clickable_parents.on("touchend.megamenu", function(e) { if (plugin.settings.event === "hover_intent") { plugin.unbindHoverIntentEvents(); } if (plugin.settings.event === "hover") { plugin.unbindHoverEvents(); } }); clickable_parents.on("click.megamenu", function(e) { if ( $(e.target).hasClass('mega-indicator') ) { return; } if (plugin.isDesktopView() && $(this).parent().hasClass("mega-toggle-on") && $(this).closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed") ) { if (plugin.settings.second_click === "go") { return; } else { e.preventDefault(); return; } } if (dragging) { return; } if (plugin.isMobileView() && $(this).parent().hasClass("mega-hide-sub-menu-on-mobile")) { return; // allow all clicks on parent items when sub menu is hidden on mobile } if ((plugin.settings.second_click === "go" || $(this).parent().hasClass("mega-click-click-go")) && $(this).attr("href") !== undefined) { // check for second click if (!$(this).parent().hasClass("mega-toggle-on")) { e.preventDefault(); plugin.showPanel($(this)); } } else { e.preventDefault(); if ($(this).parent().hasClass("mega-toggle-on")) { plugin.hidePanel($(this), false); } else { plugin.showPanel($(this)); } } }); if ( plugin.settings.second_click === "disabled" ) { clickable_parents.off("click.megamenu"); } $(".mega-close-after-click:not(.mega-menu-item-has-children) > a.mega-menu-link", $menu).on("click", function() { plugin.hideAllPanels(); plugin.hideMobileMenu(); }); $("button.mega-close", $wrap).on("click", function(e) { plugin.hideMobileMenu(); }); }; plugin.bindHoverEvents = function() { items_with_submenus.on({ "mouseenter.megamenu" : function() { plugin.unbindClickEvents(); if (! $(this).hasClass("mega-toggle-on")) { plugin.showPanel($(this).children("a.mega-menu-link")); } }, "mouseleave.megamenu" : function() { if ($(this).hasClass("mega-toggle-on") && ! $(this).hasClass("mega-disable-collapse") && ! $(this).parent().parent().hasClass("mega-menu-tabbed")) { plugin.hidePanel($(this).children("a.mega-menu-link"), false); } } }); }; plugin.bindHoverIntentEvents = function() { items_with_submenus.hoverIntent({ over: function () { plugin.unbindClickEvents(); if (! $(this).hasClass("mega-toggle-on")) { plugin.showPanel($(this).children("a.mega-menu-link")); } }, out: function () { if ($(this).hasClass("mega-toggle-on") && ! $(this).hasClass("mega-disable-collapse") && ! $(this).parent().parent().hasClass("mega-menu-tabbed")) { plugin.hidePanel($(this).children("a.mega-menu-link"), false); } }, timeout: plugin.settings.hover_intent_timeout, interval: plugin.settings.hover_intent_interval }); }; plugin.bindKeyboardEvents = function() { var tab_key = 9; var escape_key = 27; var enter_key = 13; var left_arrow_key = 37; var up_arrow_key = 38; var right_arrow_key = 39; var down_arrow_key = 40; var space_key = 32; var isMobileOffCanvasHorizontal = function() { return plugin.isMobileView() && ( plugin.settings.effect_mobile === 'slide_right' || plugin.settings.effect_mobile === '' ) && plugin.settings.mobile_direction === 'horizontal'; } var shouldTrapFocusInCurrentSubMenu = function() { return isMobileOffCanvasHorizontal() && ( keyCode === up_arrow_key || keyCode === down_arrow_key || keyCode === tab_key ); } $wrap.on("keyup.megamenu", ".max-mega-menu, .mega-menu-toggle", function(e) { var keyCode = e.keyCode || e.which; var active_link = $(e.target); if (keyCode === tab_key) { $wrap.addClass("mega-keyboard-navigation"); plugin.bindClickEvents(); // Windows Narrator ignores the Enter keypress, so ensure click events are available when pressing tab } }); $wrap.on("keydown.megamenu", "a.mega-menu-link, .mega-indicator, .mega-menu-toggle-block, .mega-menu-toggle-animated-block button", function(e) { if ( ! $wrap.hasClass("mega-keyboard-navigation") ) { return; } var keyCode = e.keyCode || e.which; var active_link = $(e.target); if ( keyCode === space_key && active_link.is(".mega-menu-link") ) { e.preventDefault(); // pressing space on a parent item will always toggle the sub menu if ( active_link.parent().is(items_with_submenus) ) { if ( active_link.parent().hasClass("mega-toggle-on") && ! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed") ) { plugin.hidePanel(active_link); } else { plugin.showPanel(active_link); } } } if ( keyCode === space_key && active_link.is("mega-indicator") ) { e.preventDefault(); if ( active_link.parent().parent().hasClass("mega-toggle-on") && ! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed") ) { plugin.hidePanel(active_link.parent()); } else { plugin.showPanel(active_link.parent()); } } if ( keyCode === escape_key ) { var submenu_open = $(".mega-toggle-on", $menu).length !== 0; if ( submenu_open ) { var focused_menu_item = $menu.find(":focus"); if ( focused_menu_item.closest('.mega-menu-flyout.mega-toggle-on').length !== 0 ) { var nearest_parent_of_focused_item_li = focused_menu_item.closest('.mega-toggle-on'); var nearest_parent_of_focused_item_a = $("> a.mega-menu-link", nearest_parent_of_focused_item_li); plugin.hidePanel(nearest_parent_of_focused_item_a); nearest_parent_of_focused_item_a.focus(); } if ( focused_menu_item.closest('.mega-menu-megamenu.mega-toggle-on').length !== 0 ) { var nearest_parent_of_focused_item_li = focused_menu_item.closest('.mega-menu-megamenu.mega-toggle-on'); var nearest_parent_of_focused_item_a = $("> a.mega-menu-link", nearest_parent_of_focused_item_li); plugin.hidePanel(nearest_parent_of_focused_item_a); nearest_parent_of_focused_item_a.focus(); } } if ( plugin.isMobileView() && ! submenu_open ) { plugin.hideMobileMenu(); $(".mega-menu-toggle-block, button.mega-toggle-animated", $toggle_bar).first().focus(); } } if ( keyCode === space_key || keyCode === enter_key ) { if ( active_link.is(".mega-menu-toggle-block, .mega-menu-toggle-animated-block button") ) { e.preventDefault(); if ( $toggle_bar.hasClass("mega-menu-open") ) { plugin.hideMobileMenu(); } else { plugin.showMobileMenu(); } } } if ( keyCode === enter_key ) { // ignored by windows narrator // pressing enter on an arrow will toggle the sub menu if ( active_link.is(".mega-indicator") ) { if ( active_link.closest("li.mega-menu-item").hasClass("mega-toggle-on") && ! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed") ) { plugin.hidePanel(active_link.parent()); } else { plugin.showPanel(active_link.parent()); } return; } // pressing enter on a parent link if ( active_link.parent().is(items_with_submenus) ) { // when clicking on the parent of a hidden submenu, follow the link if ( plugin.isMobileView() && active_link.parent().is(".mega-hide-sub-menu-on-mobile") ) { return; } // pressing enter on a parent item without a link will toggle the sub menu if ( active_link.is("[href]") === false ) { if ( active_link.parent().hasClass("mega-toggle-on") && ! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed") ) { plugin.hidePanel(active_link); } else { plugin.showPanel(active_link); } return; } // pressing enter on a parent item will first open the sub menu, then follow the link if ( active_link.parent().hasClass("mega-toggle-on") && ! active_link.closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed") ) { return; } else { e.preventDefault(); plugin.showPanel(active_link); } } } if ( shouldTrapFocusInCurrentSubMenu() ) { var focused_item = $(":focus", $menu); // if the menu doesn't have focus, focus the first menu item if ( focused_item.length === 0) { e.preventDefault(); $("> li.mega-menu-item:visible", $menu).find("> a.mega-menu-link, .mega-search span[role=button]").first().focus(); return; } // try to find the next item at the same level var next_item_to_focus = focused_item.parent().nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first(); // can't find another item in the same level, attempt to skip back to the top if ( next_item_to_focus.length === 0 && focused_item.closest(".mega-menu-megamenu").length !== 0 ) { // are we inside a megamenu? find the 'back' button and focus on that var all_li_parents = focused_item.parentsUntil(".mega-menu-megamenu"); if ( focused_item.is(all_li_parents.find("a.mega-menu-link").last()) ) { next_item_to_focus = all_li_parents.find(".mega-back-button:visible > a.mega-menu-link").first(); } } // skip back to the top of non-megamenu menus if ( next_item_to_focus.length === 0 ) { next_item_to_focus = focused_item.parent().prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first(); } if ( next_item_to_focus.length !== 0 ) { e.preventDefault(); next_item_to_focus.focus(); } } var shouldGoToNextTopLevelItem = function() { return ( ( keyCode === right_arrow_key && plugin.isDesktopView() ) || ( keyCode === down_arrow_key && plugin.isMobileView() ) ) && $menu.hasClass("mega-menu-horizontal"); } var shouldGoToPreviousTopLevelItem = function() { return ( ( keyCode === left_arrow_key && plugin.isDesktopView() ) || ( keyCode === up_arrow_key && plugin.isMobileView() ) ) && $menu.hasClass("mega-menu-horizontal"); } if ( shouldGoToNextTopLevelItem() ) { e.preventDefault(); var next_top_level_item = $("> .mega-toggle-on", $menu).nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first(); if (next_top_level_item.length === 0) { next_top_level_item = $(":focus", $menu).parent().nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first(); } if (next_top_level_item.length === 0) { next_top_level_item = $(":focus", $menu).parent().parent().parent().nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").first(); } plugin.hideAllPanels(); next_top_level_item.focus(); } if ( shouldGoToPreviousTopLevelItem() ) { e.preventDefault(); var prev_top_level_item = $("> .mega-toggle-on", $menu).prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").last(); if (prev_top_level_item.length === 0) { prev_top_level_item = $(":focus", $menu).parent().prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").last(); } if (prev_top_level_item.length === 0) { prev_top_level_item = $(":focus", $menu).parent().parent().parent().prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search span[role=button]").last(); } plugin.hideAllPanels(); prev_top_level_item.focus(); } }); $wrap.on("focusout.megamenu", function(e) { if ( $wrap.hasClass("mega-keyboard-navigation") ) { setTimeout(function() { var menu_has_focus = $wrap.find(":focus").length > 0; if (! menu_has_focus) { $wrap.removeClass("mega-keyboard-navigation"); plugin.hideAllPanels(); plugin.hideMobileMenu(); } }, 10); } }); }; plugin.unbindAllEvents = function() { $("ul.mega-sub-menu, li.mega-menu-item, li.mega-menu-row, li.mega-menu-column, a.mega-menu-link, .mega-indicator", $menu).off().unbind(); }; plugin.unbindClickEvents = function() { if ( $wrap.hasClass('mega-keyboard-navigation') ) { return; } // collapsable parents always have a click event $("> a.mega-menu-link", items_with_submenus).not(collapse_children_parents).off("click.megamenu touchend.megamenu"); $wrap.data('has-click-events', false); }; plugin.unbindHoverEvents = function() { items_with_submenus.off("mouseenter.megamenu mouseleave.megamenu"); }; plugin.unbindHoverIntentEvents = function() { items_with_submenus.off("mouseenter mouseleave").removeProp("hoverIntent_t").removeProp("hoverIntent_s"); // hoverintent does not allow namespaced events }; plugin.unbindKeyboardEvents = function() { $wrap.off("keyup.megamenu keydown.megamenu focusout.megamenu"); }; plugin.unbindMegaMenuEvents = function() { if (plugin.settings.event === "hover_intent") { plugin.unbindHoverIntentEvents(); } if (plugin.settings.event === "hover") { plugin.unbindHoverEvents(); } plugin.unbindClickEvents(); plugin.unbindKeyboardEvents(); }; plugin.bindMegaMenuEvents = function() { plugin.unbindMegaMenuEvents(); if (plugin.isDesktopView() && plugin.settings.event === "hover_intent") { plugin.bindHoverIntentEvents(); } if (plugin.isDesktopView() && plugin.settings.event === "hover") { plugin.bindHoverEvents(); } plugin.bindClickEvents(); // always bind click events for touch screen devices plugin.bindKeyboardEvents(); }; plugin.checkWidth = function() { if ( plugin.isMobileView() && $menu.data("view") === "desktop" ) { plugin.switchToMobile(); } if ( plugin.isDesktopView() && $menu.data("view") === "mobile" ) { plugin.switchToDesktop(); } plugin.calculateDynamicSubmenuWidths($("> li.mega-menu-megamenu > a.mega-menu-link", $menu)); }; plugin.reverseRightAlignedItems = function() { if ( ! $("body").hasClass("rtl") && $menu.hasClass("mega-menu-horizontal") && $menu.css("display") !== 'flex' ) { $menu.append($menu.children("li.mega-item-align-right").get().reverse()); } }; plugin.addClearClassesToMobileItems = function() { $(".mega-menu-row", $menu).each(function() { $("> .mega-sub-menu > .mega-menu-column:not(.mega-hide-on-mobile)", $(this)).filter(":even").addClass("mega-menu-clear"); // :even is 0 based }); }; plugin.initDesktop = function() { $menu.data("view", "desktop"); plugin.bindMegaMenuEvents(); plugin.initIndicators(); }; plugin.initMobile = function() { plugin.switchToMobile(); }; plugin.switchToDesktop = function() { $menu.data("view", "desktop"); plugin.bindMegaMenuEvents(); plugin.reverseRightAlignedItems(); plugin.hideAllPanels(); plugin.hideMobileMenu(true); }; plugin.switchToMobile = function() { $menu.data("view", "mobile"); plugin.bindMegaMenuEvents(); plugin.initIndicators(); plugin.reverseRightAlignedItems(); plugin.addClearClassesToMobileItems(); plugin.hideAllPanels(); plugin.expandMobileSubMenus(); }; plugin.initToggleBar = function() { $toggle_bar.on("click", function(e) { if ( $(e.target).is(".mega-menu-toggle, .mega-menu-toggle-custom-block *, .mega-menu-toggle-block, .mega-menu-toggle-animated-block, .mega-menu-toggle-animated-block *, .mega-toggle-blocks-left, .mega-toggle-blocks-center, .mega-toggle-blocks-right, .mega-toggle-label, .mega-toggle-label span") ) { e.preventDefault(); if ($(this).hasClass("mega-menu-open")) { plugin.hideMobileMenu(); } else { plugin.showMobileMenu(); } } }); }; plugin.initIndicators = function() { $menu.off('click.megamenu', '.mega-indicator'); $menu.on('click.megamenu', '.mega-indicator', function(e) { e.preventDefault(); e.stopPropagation(); if ( $(this).closest(".mega-menu-item").hasClass("mega-toggle-on") ) { if ( ! $(this).closest("ul.mega-sub-menu").parent().hasClass("mega-menu-tabbed") || plugin.isMobileView() ) { plugin.hidePanel($(this).parent(), false); } } else { plugin.showPanel($(this).parent(), false); } }); }; plugin.hideMobileMenu = function(force) { force = force || false; if ( ! $toggle_bar.is(":visible") && ! force ) { return; } html_body_class_timeout = setTimeout(function() { $("body").removeClass($menu.attr("id") + "-mobile-open"); $("html").removeClass($menu.attr("id") + "-off-canvas-open"); }, plugin.settings.effect_speed_mobile); $(".mega-toggle-label, .mega-toggle-animated", $toggle_bar).attr("aria-expanded", "false"); if (plugin.settings.effect_mobile === "slide" && ! force ) { $menu.animate({"height":"hide"}, plugin.settings.effect_speed_mobile, function() { $menu.css({ width: "", left: "", display: "" }); $toggle_bar.removeClass("mega-menu-open"); }); } else { $menu.css({ width: "", left: "", display: "" }); $toggle_bar.removeClass("mega-menu-open"); } $menu.triggerHandler("mmm:hideMobileMenu"); }; plugin.showMobileMenu = function() { if ( ! $toggle_bar.is(":visible")) { return; } clearTimeout(html_body_class_timeout); $("body").addClass($menu.attr("id") + "-mobile-open"); plugin.expandMobileSubMenus(); if ( plugin.settings.effect_mobile === "slide_left" || plugin.settings.effect_mobile === "slide_right" ) { $("html").addClass($menu.attr("id") + "-off-canvas-open"); } $(".mega-toggle-label, .mega-toggle-animated", $toggle_bar).attr("aria-expanded", "true"); if (plugin.settings.effect_mobile === "slide") { $menu.animate({"height":"show"}, plugin.settings.effect_speed_mobile, function() { $(this).css("display", ""); }); } $toggle_bar.addClass("mega-menu-open"); plugin.toggleBarForceWidth(); $menu.triggerHandler("mmm:showMobileMenu"); }; plugin.toggleBarForceWidth = function() { if ($(plugin.settings.mobile_force_width).length && ( plugin.settings.effect_mobile === "slide" || plugin.settings.effect_mobile === "disabled" ) ) { var submenu_offset = $toggle_bar.offset(); var target_offset = $(plugin.settings.mobile_force_width).offset(); $menu.css({ width: $(plugin.settings.mobile_force_width).outerWidth(), left: (target_offset.left - submenu_offset.left) + "px" }); } }; plugin.doConsoleChecks = function() { if (plugin.settings.mobile_force_width != "false" && ! $(plugin.settings.mobile_force_width).length && ( plugin.settings.effect_mobile === "slide" || plugin.settings.effect_mobile === "disabled" ) ) { console.warn('Max Mega Menu #' + $wrap.attr('id') + ': Mobile Force Width element (' + plugin.settings.mobile_force_width + ') not found'); } const cssWidthRegex = /^((\d+(\.\d+)?(px|%|em|rem|vw|vh|ch|ex|cm|mm|in|pt|pc))|auto)$/i; if (plugin.settings.panel_width !== undefined && ! cssWidthRegex.test(plugin.settings.panel_width) && ! $(plugin.settings.panel_width).length ) { console.warn('Max Mega Menu #' + $wrap.attr('id') + ': Panel Width (Outer) element (' + plugin.settings.panel_width + ') not found'); } if (plugin.settings.panel_inner_width !== undefined && ! cssWidthRegex.test(plugin.settings.panel_inner_width) && ! $(plugin.settings.panel_inner_width).length ) { console.warn('Max Mega Menu #' + $wrap.attr('id') + ': Panel Width (Inner) element (' + plugin.settings.panel_inner_width + ') not found'); } } plugin.init = function() { $menu.triggerHandler("before_mega_menu_init"); plugin.settings = $.extend({}, defaults, options); if (window.console) { plugin.doConsoleChecks(); } $menu.removeClass("mega-no-js"); plugin.initToggleBar(); if (plugin.settings.unbind_events === "true") { plugin.unbindAllEvents(); } $(window).on("load", function() { plugin.calculateDynamicSubmenuWidths($("> li.mega-menu-megamenu > a.mega-menu-link", $menu)); }); if ( plugin.isDesktopView() ) { plugin.initDesktop(); } else { plugin.initMobile(); } $(window).on("resize", function() { plugin.checkWidth(); }); $menu.triggerHandler("after_mega_menu_init"); }; plugin.init(); }; $.fn.maxmegamenu = function(options) { return this.each(function() { if (undefined === $(this).data("maxmegamenu")) { var plugin = new $.maxmegamenu(this, options); $(this).data("maxmegamenu", plugin); } }); }; $(function() { $(".max-mega-menu").maxmegamenu(); }); }( jQuery ));; !function(){"use strict";var e,t={noop:function(){},texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"’").replace(/'/g,"’")).replace(/"/g,"”").replace(/"/g,"”").replace(/"/g,"”").replace(/[\u201D]/g,"”")).replace(/([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g,'$1="$2"')).trim()},applyReplacements:function(e,t){if(e)return t?e.replace(/{(\d+)}/g,function(e,r){return void 0!==t[r]?t[r]:e}):e},getBackgroundImage:function(e){var t=document.createElement("canvas"),r=t.getContext&&t.getContext("2d");if(e){r.filter="blur(20px) ",r.drawImage(e,0,0);var o=t.toDataURL("image/png");return t=null,o}}},r=function(){function e(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t,r,o){if(!e)return o();e.style.removeProperty("display"),e.style.opacity=t,e.style.pointerEvents="none";var a=function(i,n){var l=(performance.now()-i)/n;l<1?(e.style.opacity=t+(r-t)*l,requestAnimationFrame(()=>a(i,n))):(e.style.opacity=r,e.style.removeProperty("pointer-events"),o())};requestAnimationFrame(function(){requestAnimationFrame(function(){a(performance.now(),200)})})}return{closest:function(t,r){if(t.closest)return t.closest(r);var o=t;do{if(e(o,r))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null},matches:e,hide:function(e){e&&(e.style.display="none")},show:function(e){e&&(e.style.display="block")},fadeIn:function(e,o){r(e,0,1,o=o||t.noop)},fadeOut:function(e,o){o=o||t.noop,r(e,1,0,function(){e&&(e.style.display="none"),o()})},scrollToElement:function(e,t,r){if(!e||!t)return r?r():void 0;var o=t.querySelector(".jp-carousel-info-extra");o&&(o.style.minHeight=window.innerHeight-64+"px");var a=!0,i=Date.now(),n=t.scrollTop,l=Math.max(0,e.offsetTop-Math.max(0,window.innerHeight-function(e){var t=e.querySelector(".jp-carousel-info-footer"),r=e.querySelector(".jp-carousel-info-extra"),o=e.querySelector(".jp-carousel-info-content-wrapper");if(t&&r&&o){var a=window.getComputedStyle(r),i=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return i=isNaN(i)?0:i,o.offsetHeight+t.offsetHeight+i}return 0}(t)))-t.scrollTop;function s(){a=!1}l=Math.min(l,t.scrollHeight-window.innerHeight),t.addEventListener("wheel",s),function e(){var c,u=Date.now(),d=(c=(u-i)/300)<.5?2*c*c:1-Math.pow(-2*c+2,2)/2,p=(d=d>1?1:d)*l;if(t.scrollTop=n+p,u<=i+300&&a)return requestAnimationFrame(e);r&&r(),o&&(o.style.minHeight=""),a=!1,t.removeEventListener("wheel",s)}()},getJSONAttribute:function(e,t){if(e&&e.hasAttribute(t))try{return JSON.parse(e.getAttribute(t))}catch{return}},convertToPlainText:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},stripHTML:function(e){return e.replace(/<[^>]*>?/gm,"")},emitEvent:function(e,t,r){var o;try{o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r||null})}catch{(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,r||null)}e.dispatchEvent(o)},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}}}();function o(){var o,a,i,n,l="",s=!1,c="div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery",u=".gallery-item, .tiled-gallery-item, .blocks-gallery-item, .tiled-gallery__item",d=u+", .wp-block-image",p={},m="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,g="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function h(t){if(!s)switch(t.which){case 38:t.preventDefault(),p.overlay.scrollTop-=100;break;case 40:t.preventDefault(),p.overlay.scrollTop+=100;break;case 39:t.preventDefault(),e.slideNext();break;case 37:case 8:t.preventDefault(),e.slidePrev();break;case 27:t.preventDefault(),k()}}function f(){s=!0}function v(){s=!1}function y(e){e.role="button",e.tabIndex=0,e.ariaLabel=jetpackCarouselStrings.image_label}function w(){p.overlay||(p.overlay=document.querySelector(".jp-carousel-overlay"),p.container=p.overlay.querySelector(".jp-carousel-wrap"),p.gallery=p.container.querySelector(".jp-carousel"),p.info=p.overlay.querySelector(".jp-carousel-info"),p.caption=p.info.querySelector(".jp-carousel-caption"),p.commentField=p.overlay.querySelector("#jp-carousel-comment-form-comment-field"),p.emailField=p.overlay.querySelector("#jp-carousel-comment-form-email-field"),p.authorField=p.overlay.querySelector("#jp-carousel-comment-form-author-field"),p.urlField=p.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[p.commentField,p.emailField,p.authorField,p.urlField].forEach(function(e){e&&(e.addEventListener("focus",f),e.addEventListener("blur",v))}),p.overlay.addEventListener("click",function(e){var t,o,a=e.target,i=!!r.closest(a,".jp-carousel-close-hint"),n=!!window.matchMedia("(max-device-width: 760px)").matches;a===p.overlay?n||k():i?k():a.classList.contains("jp-carousel-image-download")?m("download_original_click"):a.classList.contains("jp-carousel-comment-login")?(t=p.currentSlide,o=t?t.attrs.attachmentId:"0",window.location.href=jetpackCarouselStrings.login_url+"%23jp-carousel-"+o):r.closest(a,"#jp-carousel-comment-form-container")?function(e){var t=e.target,o=r.getJSONAttribute(p.container,"data-carousel-extra")||{},a=p.currentSlide.attrs.attachmentId,i=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),n=document.querySelector("#jp-carousel-comment-form-spinner"),l=document.querySelector("#jp-carousel-comment-form-button-submit"),s=document.querySelector("#jp-carousel-comment-form");if(p.commentField&&p.commentField.getAttribute("id")===t.getAttribute("id"))f(),r.show(i);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(n),s.classList.add("jp-carousel-is-disabled");var c={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:p.commentField.value};if(!c.comment.length)return void j(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(c.email=p.emailField.value,c.author=p.authorField.value,c.url=p.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!c.email.length||!c.email.match("@"))return void j(jetpackCarouselStrings.no_comment_email,!1);if(!c.author.length)return void j(jetpackCarouselStrings.no_comment_author,!1)}var u=new XMLHttpRequest;u.open("POST",jetpackCarouselStrings.ajaxurl,!0),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),u.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch{return void j(jetpackCarouselStrings.comment_post_error,!1)}"approved"===e.comment_status?j(jetpackCarouselStrings.comment_approved,!0):"unapproved"===e.comment_status?j(jetpackCarouselStrings.comment_unapproved,!0):j(jetpackCarouselStrings.comment_post_error,!1),I(),_(a),l.value=jetpackCarouselStrings.post_comment,r.hide(n),s.classList.remove("jp-carousel-is-disabled")}else j(jetpackCarouselStrings.comment_post_error,!1)};var d=[];for(var m in c)if(m){var g=encodeURIComponent(m)+"="+encodeURIComponent(c[m]);d.push(g.replace(/%20/g,"+"))}var h=d.join("&");u.send(h)}}(e):(r.closest(a,".jp-carousel-photo-icons-container")||a.classList.contains("jp-carousel-photo-title"))&&function(e){e.preventDefault();var t=e.target,o=p.info.querySelector(".jp-carousel-info-extra"),a=p.info.querySelector(".jp-carousel-image-meta"),i=p.info.querySelector(".jp-carousel-comments-wrapper"),n=p.info.querySelector(".jp-carousel-icon-info"),l=p.info.querySelector(".jp-carousel-icon-comments");function s(){l&&l.classList.remove("jp-carousel-selected"),n.classList.toggle("jp-carousel-selected"),i&&i.classList.remove("jp-carousel-show"),a&&(a.classList.toggle("jp-carousel-show"),a.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}function c(){n&&n.classList.remove("jp-carousel-selected"),l.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),i&&(i.classList.toggle("jp-carousel-show"),i.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}(r.closest(t,".jp-carousel-icon-info")||t.classList.contains("jp-carousel-photo-title"))&&(a&&a.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,s):(s(),r.scrollToElement(p.info,p.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(i&&i.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,c):(c(),r.scrollToElement(p.info,p.overlay)))}(e)}),window.addEventListener("keydown",h),p.overlay.addEventListener("jp_carousel.afterOpen",function(){v(),p.slides.length<=1||(p.slides.length<=5?r.show(p.info.querySelector(".jp-swiper-pagination")):r.show(p.info.querySelector(".jp-carousel-pagination")))}),p.overlay.addEventListener("jp_carousel.beforeClose",function(){f(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(p.info.querySelector(".jp-swiper-pagination")),r.hide(p.info.querySelector(".jp-carousel-pagination"))}),p.overlay.addEventListener("jp_carousel.afterClose",function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",l="",p.isOpen=!1}),p.overlay.addEventListener("touchstart",function(e){e.touches.length>1&&e.preventDefault()}))}function j(e,t){var o=p.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML=''+e+"",r.hide(p.overlay.querySelector("#jp-carousel-comment-form-spinner")),p.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function b(){var e=document.querySelectorAll("a img[data-attachment-id]");Array.prototype.forEach.call(e,function(e){var t=e.parentElement,o=t.parentElement;if(!o.classList.contains("gallery-icon")&&!r.closest(o,u)&&t.hasAttribute("href")){var a=!1;t.getAttribute("href").split("?")[0]===e.getAttribute("data-orig-file").split("?")[0]&&1===Number(jetpackCarouselStrings.single_image_gallery_media_file)&&(a=!0),t.getAttribute("href")===e.getAttribute("data-permalink")&&(a=!0),a&&(y(e),t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}})}function S(t,r){p.isOpen?(L(r),e.slideTo(r+1)):F(t,{startIndex:r})}function L(e){(!e||e<0||e>p.slides.length)&&(e=0),p.currentSlide=p.slides[e];var o,a,i=p.currentSlide,n=i.attrs.attachmentId;H(p.slides[e]),function(e){var t=[],r=p.slides.length;if(r>1){var o=e>0?e-1:r-1;t.push(o);var a=e
"+jetpackCarouselStrings[o]+"
"+a+""}}t.innerHTML=r,t.style.removeProperty("display")}(p.slides[e].attrs.imageMeta),function(e){if(!e)return!1;var r,o=[e.attrs.origWidth,e.attrs.origHeight],a=document.createElement("a");a.href=e.attrs.src.replace(/\?.+$/,""),r=null!==a.hostname.match(/^i[\d]{1}\.wp\.com$/i)?a.href:e.attrs.origFile.replace(/\?.+$/,"");var i=p.info.querySelector(".jp-carousel-download-text"),n=p.info.querySelector(".jp-carousel-image-download");i.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),n.setAttribute("href",r),n.style.removeProperty("display")}(i),1===Number(jetpackCarouselStrings.display_comments)&&(o=p.slides[e].attrs.commentsOpened,a=p.info.querySelector("#jp-carousel-comment-form-container"),1===parseInt(o,10)?r.fadeIn(a):r.fadeOut(a),_(n),r.hide(p.info.querySelector("#jp-carousel-comment-post-results")));var s=p.info.querySelector(".jp-carousel-pagination");if(s&&p.slides.length>5){var c=e+1;s.innerHTML=""+c+" / "+p.slides.length+""}jetpackCarouselStrings.stats&&p.isOpen&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(n)+"&rand="+Math.random()),p.isOpen&&g(n),l="#jp-carousel-"+n,window.location.hash=l}function k(){document.body.style.overflow=a,document.documentElement.style.overflow=i,I(),f(),r.emitEvent(p.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,n||0),p.isOpen=!1,e.destroy(),p.slides=[],p.currentSlide=void 0,p.gallery.innerHTML="",r.fadeOut(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterClose")})}function x(e){if("object"!=typeof e&&(e={}),void 0===e.origFile)return"";if(void 0===e.origWidth||void 0===e.maxWidth)return e.origFile;if(void 0===e.mediumFile||void 0===e.largeFile)return e.origFile;var t=document.createElement("a");t.href=e.largeFile;var r=/^i[0-2]\.wp\.com$/i.test(t.hostname),o=q(e.largeFile,e.origWidth,r),a=parseInt(o[0],10),i=parseInt(o[1],10);if(e.origMaxWidth=e.maxWidth,e.origMaxHeight=e.maxHeight,void 0!==window.devicePixelRatio&&window.devicePixelRatio>1&&(e.maxWidth=e.maxWidth*window.devicePixelRatio,e.maxHeight=e.maxHeight*window.devicePixelRatio),a>=e.maxWidth||i>=e.maxHeight)return e.largeFile;var n=q(e.mediumFile,e.origWidth,r),l=parseInt(n[0],10),s=parseInt(n[1],10);if(l>=e.maxWidth||s>=e.maxHeight)return e.mediumFile;if(r){if(-1===e.largeFile.lastIndexOf("?"))return e.largeFile;var c=function(e){var t;try{t=new URL(e)}catch(t){return e}var r=["quality","ssl","filter","brightness","contrast","colorize","smooth"],o=Array.from(t.searchParams.entries());return t.search="",o.forEach(([e,o])=>{r.includes(e)&&t.searchParams.append(e,o)}),t}(e.largeFile);return(e.origWidth>e.maxWidth||e.origHeight>e.maxHeight)&&(e.origMaxWidth=2*e.maxWidth,e.origMaxHeight=2*e.maxHeight,c.searchParams.set("fit",e.origMaxWidth+","+e.origMaxHeight)),c.toString()}return e.origFile}function q(e,t,r){var o,a=r?e.replace(/.*=([\d]+%2C[\d]+).*$/,"$1"):e.replace(/.*-([\d]+x[\d]+)\..+$/,"$1");return"9999"===(o=a!==e?r?a.split("%2C"):a.split("x"):[t,0])[0]&&(o[0]="0"),"9999"===o[1]&&(o[1]="0"),o}function A(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}function E(e){return!e.match(" ")&&e.match("_")?"":e}function _(e,t){var a=void 0===t,i=p.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");if(i.classList.remove("jp-carousel-show"),clearInterval(o),e){(!t||t<1)&&(t=0);var n=p.info.querySelector(".jp-carousel-comments"),l=p.info.querySelector("#jp-carousel-comments-loading");r.show(l),a&&(r.hide(n),n.innerHTML="");var s=new XMLHttpRequest,c=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;s.open("GET",c),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var u=function(){r.fadeIn(n),r.fadeOut(l)};s.onload=function(){if(p.currentSlide&&p.currentSlide.attrs.attachmentId===e){var c,d=s.status>=200&&s.status<300;try{c=JSON.parse(s.responseText)}catch{}if(!d||!c||!Array.isArray(c))return u();a&&(n.innerHTML="");for(var m=0;m'+g.gravatar_markup+'
'+g.author_markup+'
'+g.date_gmt+"
"+g.content+"
",n.appendChild(h),clearInterval(o),o=setInterval(function(){p.container.scrollTop+150>window.innerHeight&&(_(e,t+10),clearInterval(o))},300)}c.length>0&&(r.show(n),i.innerText=c.length,i.classList.add("jp-carousel-show")),r.hide(l)}},s.onerror=u,s.send()}}function H(e){var t=e.el,r=e.attrs,o=t.querySelector("img");if(!o.hasAttribute("data-loaded")){var a=!!r.previewImage,i=r.thumbSize;!a||i&&t.offsetWidth>i.width?o.src=r.src:o.src=r.previewImage,o.setAttribute("itemprop","image"),o.setAttribute("data-loaded",1)}}function T(t){var r=t.el;e&&e.slides&&(r=e.slides[e.activeIndex]);var o=t.attrs.originalElement;o.complete&&0!==o.naturalHeight?C(t,r,o):o.onload=function(){C(t,r,o)}}function C(e,r,o){var a=t.getBackgroundImage(o);e.backgroundImage=a,r.style.backgroundImage="url("+a+")",r.style.backgroundSize="cover"}function I(){p.commentField&&(p.commentField.value="")}function M(e,o){p.slides=[];var a={width:window.innerWidth,height:window.innerHeight-64};0!==o&&null!==e[o].getAttribute("data-gallery-src")&&((new Image).src=e[o].getAttribute("data-gallery-src"));var i=!!r.closest(e[0],".tiled-gallery.type-rectangular");Array.prototype.forEach.call(e,function(e,o){var n=r.closest(e,"a"),l=e.getAttribute("data-orig-file")||e.getAttribute("src-orig"),s=e.getAttribute("data-attachment-id")||e.getAttribute("data-id")||"0",c=document.querySelector('img[data-attachment-id="'+s+'"] + figcaption');c=c?c.innerHTML:e.getAttribute("data-image-caption");var u={originalElement:e,attachmentId:s,commentsOpened:e.getAttribute("data-comments-opened")||"0",imageMeta:r.getJSONAttribute(e,"data-image-meta")||{},title:e.getAttribute("data-image-title")||"",desc:e.getAttribute("data-image-description")||"",mediumFile:e.getAttribute("data-medium-file")||"",largeFile:e.getAttribute("data-large-file")||"",origFile:l||"",thumbSize:{width:e.naturalWidth,height:e.naturalHeight},caption:c||"",permalink:n&&n.getAttribute("href"),src:l||e.getAttribute("src")||""},d=r.closest(e,".tiled-gallery-item"),m=d&&d.querySelector(".tiled-gallery-caption"),g=m&&m.innerHTML;g&&(u.caption=g);var h=function(e){var t=e.getAttribute("data-orig-size")||"";if(t){var r=t.split(",");return{width:parseInt(r[0],10),height:parseInt(r[1],10)}}return{width:e.getAttribute("data-original-width")||e.getAttribute("width")||void 0,height:e.getAttribute("data-original-height")||e.getAttribute("height")||void 0}}(e);if(u.origWidth=h.width||u.thumbSize.width,u.origHeight=h.height||u.thumbSize.height,"undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.generateImgSrc?u.src=wpcom.carousel.generateImgSrc(e,a):u.src=x({origFile:u.src,origWidth:u.origWidth,origHeight:u.origHeight,maxWidth:a.width,maxHeight:a.height,mediumFile:u.mediumFile,largeFile:u.largeFile}),e.setAttribute("data-gallery-src",u.src),"0"!==u.attachmentId){u.title=t.texturize(u.title),u.desc=t.texturize(u.desc),u.caption=t.texturize(u.caption);var f=new Image,v=document.createElement("div");v.classList.add("swiper-slide"),v.setAttribute("itemprop","associatedMedia"),v.setAttribute("itemscope",""),v.setAttribute("itemtype","https://schema.org/ImageObject");var y=document.createElement("div");y.classList.add("swiper-zoom-container"),p.gallery.appendChild(v),v.appendChild(y),y.appendChild(f),v.setAttribute("data-attachment-id",u.attachmentId),v.setAttribute("data-permalink",u.permalink),v.setAttribute("data-orig-file",u.origFile),i&&(u.previewImage=u.src);var w={el:v,attrs:u,index:o};p.slides.push(w)}})}function F(e,t){if(!window.JetpackSwiper){var o=document.querySelector("#jp-carousel-loading-overlay");r.show(o);var a=document.createElement("script");return a.id="jetpack-carousel-swiper-js",a.src=window.jetpackSwiperLibraryPath.url,a.async=!0,a.onload=function(){r.hide(o),O(e,t)},a.onerror=function(){r.hide(o)},void document.head.appendChild(a)}O(e,t)}function O(t,o){var l,s={imgSelector:".gallery-item [data-attachment-id], .tiled-gallery-item [data-attachment-id], img[data-attachment-id], img[data-id]",startIndex:0},c=r.getJSONAttribute(t,"data-carousel-extra");if(!c)return;const u=t.querySelectorAll(s.imgSelector);if(u.length&&(w(),!p.isOpen)){for(var d in p.isOpen=!0,a=getComputedStyle(document.body).overflow,document.body.style.overflow="hidden",i=getComputedStyle(document.documentElement).overflow,document.documentElement.style.overflow="hidden",n=window.scrollY||window.pageYOffset||0,p.container.setAttribute("data-carousel-extra",JSON.stringify(c)),m(["open","view_image"]),o||{})s[d]=o[d];-1===s.startIndex&&(s.startIndex=0),r.emitEvent(p.overlay,"jp_carousel.beforeOpen"),p.gallery.innerHTML="",p.overlay.style.opacity=1,p.overlay.style.display="block",M(u,s.startIndex),(e=new window.JetpackSwiper(".jp-carousel-swiper-container",{centeredSlides:!0,zoom:!0,loop:p.slides.length>1,enabled:p.slides.length>1,pagination:{el:".jp-swiper-pagination",clickable:!0},navigation:{nextEl:".jp-swiper-button-next",prevEl:".jp-swiper-button-prev"},initialSlide:s.startIndex,on:{init:function(){L(s.startIndex)}},preventClicks:!1,preventClicksPropagation:!1,preventInteractionOnTransition:!r.isTouch(),threshold:5})).on("slideChange",function(e){p.isOpen&&(L(e.realIndex),p.overlay.classList.remove("jp-carousel-hide-controls"))}),e.on("zoomChange",function(e,t){t>1&&p.overlay.classList.add("jp-carousel-hide-controls"),1===t&&p.overlay.classList.remove("jp-carousel-hide-controls")}),e.on("doubleTap",function(e){if(clearTimeout(l),1===e.zoom.scale)var t=setTimeout(function(){p.overlay.classList.remove("jp-carousel-hide-controls"),clearTimeout(t)},150)}),e.on("tap",function(){e.zoom.scale>1&&(l=setTimeout(function(){p.overlay.classList.toggle("jp-carousel-hide-controls")},150))}),r.fadeIn(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterOpen")})}}function W(e){if("click"!==e.type){if("keydown"===e.type){const t=document.activeElement.parentElement,r=t&&t.classList.contains("tiled-gallery__item");" "!==e.key&&"Enter"!==e.key||!r||R(e)}}else R(e)}function N(e){var t=e.parentElement,o=t.parentElement,a=null;return o&&o.classList.contains("wp-block-image")?a=t.getAttribute("href"):t&&t.classList.contains("wp-block-image")&&t.querySelector(":scope > a")&&(a=t.querySelector(":scope > a").getAttribute("href")),!(a&&a.split("?")[0]!==e.getAttribute("data-orig-file").split("?")[0]&&a!==e.getAttribute("data-permalink")||t.classList.contains("gallery-caption")||r.matches(t,"figcaption"))}function R(e){if(window.CSS&&window.CSS.supports&&window.CSS.supports("display","grid")){var t,o=e.target,a=r.closest(o,c);if(a){if(!(t=a)||!t.getAttribute("data-carousel-extra"))return;if(!N(o))return;document.documentElement.style.height="auto",e.preventDefault(),e.stopPropagation();var i=r.closest(o,d),n=Array.prototype.indexOf.call(a.querySelectorAll(d),i);F(a,{startIndex:n})}}}document.body.addEventListener("click",W),document.body.addEventListener("keydown",W),document.querySelectorAll(u+"img").forEach(function(e){N(e)&&y(e)}),1===Number(jetpackCarouselStrings.single_image_gallery)&&(b(),document.body.addEventListener("is.post-load",function(){b()})),window.addEventListener("hashchange",function(){var e=/jp-carousel-(\d+)/;if(window.location.hash&&e.test(window.location.hash)){if(window.location.hash!==l||!p.isOpen)if(window.location.hash&&p.gallery&&!p.isOpen&&history.back)history.back();else{l=window.location.hash;for(var t=window.location.hash.match(e),r=parseInt(t[1],10),o=document.querySelectorAll(c),a=0;a