!function(l){"use strict";var n=l(document),m=l(window),c=l("body"),i=l(".site-footer .site-footer-bottom"),s=l(".search-screen"),o=window.patiotimeIsRTL,a=(l(".sidemenu"),l(".to-top")),e=l(".patiotime-mega-menu"),r=l("#sticky-site-header"),h=patiotimeParseInt(c.offset().top),d=window.location;function u(){var t=r.length&&r.hasClass("hide");t&&r.css("visibility","hidden").removeClass("hide"),e.each(function(){var t,e=l(this).children(".patiotime-dropdown-menu");e.length&&(e.hasClass("fullwidth")?o?e.css("right",-(window.patiotimeInnerWidth-l(this).offset().left-l(this).outerWidth(!0))):e.css("left",-l(this).offset().left):(t=patiotimeParseInt(e.css("width")),o?t-l(this).offset().left>l(this).outerWidth(!0)&&e.css("right",-patiotimeParseInt(t-l(this).offset().left-l(this).outerWidth(!0))-10):t>window.patiotimeInnerWidth-l(this).offset().left&&e.css("left",patiotimeParseInt(window.patiotimeInnerWidth-l(this).offset().left-t-10))))}),t&&r.css("visibility","").addClass("hide")}function p(t,e){t.length&&e.length&&(1<e.val()?t.removeAttr("disabled"):t.attr("disabled","disabled"))}patiotime=patiotime||{},patiotime.pages=patiotime.pages||{},patiotime.pages.all={init:function(){var i=this;i.fixPrimaryMenu(),i.checkFixedElements(patiotimeParseInt(m.scrollTop())),patiotime.onepagemenus&&(i.checkOnePageMenus(),c.removeClass("patiotime-enable-onepage-menu-check")),n.on("scrolling.patiotime.window resize.patiotime.window",function(t,e){i.checkFixedElements(e.top)})},checkFixedElements:function(t){var e;a.length&&(e=i.length?i.outerHeight()-37:100,150<t&&t<n.height()-patiotimeInnerHeight-e?a.addClass("show"):a.removeClass("show"))},fixPrimaryMenu:function(){var i,t=l("nav > ul > li");t.length&&(t.find(".sub-menu.hide").length&&t.find(".sub-menu.hide").removeClass("hide"),t.filter(".patiotime-mega-menu").length&&(u(),m.on("resize.patiotime.window",function(){u()})),t.filter(".menu-item-has-children").not(".patiotime-mega-menu").length&&(i=patiotimeParseInt(window.patiotimeInnerWidth-10),t.filter(".menu-item-has-children").not(".patiotime-mega-menu").on("mouseover",function(t){var e;l(this).closest(".mobile-menu").length||l(this).hasClass("right")||(e=l(this)).find("ul.sub-menu").each(function(){return o&&l(this).offset().left<patiotimeParseInt(l("#page").offset().left+10)||!o&&patiotimeParseInt(l(this).offset().left+l(this).outerWidth(!0))>i?(e.addClass("right"),!1):void 0})}),m.on("resize.patiotime.window",function(){i=patiotimeParseInt(window.patiotimeInnerWidth-10),t.filter(".menu-item-has-children").removeClass("right")})))},checkOnePageMenus:function(){var t,n,s,o,a,r;1<l(".menu-item.current-menu-item").length&&(t=l(".menu-item"),n={},s=[],o=l(),a=l(),r=window.location.origin+window.location.pathname,t.each(function(){var t=l(this),e=t.children("a").get(0),i=e.origin+e.pathname;r==i&&(e.hash?c.find(e.hash).length&&(i=c.find(e.hash),a=a.add(t),n[e.hash]?n[e.hash]=n[e.hash].add(t):(n[e.hash]=t,s.push({top:Math.max(0,patiotimeParseInt(i.offset().top-window.patiotimeInnerHeight/2)),target:i,hash:e.hash}))):o=o.add(t))}),s.length&&(m.scrollTop(),s.sort((t,e)=>t.top>e.top?-1:1),a.removeClass("current-menu-item"),m.on("resize.patiotime.window",function(){s.forEach(function(t){t.top=Math.max(0,patiotimeParseInt(l(t.target).offset().top-window.patiotimeInnerHeight/2))})}).on("scrolling.patiotime.window onepagemenu.check",function(){var e=l(this).scrollTop(),i=!1;a.removeClass("current-menu-item"),s.forEach(function(t){i||t.top<e&&(n[t.hash].addClass("current-menu-item"),i=!0)}),o.length&&(i?o.removeClass("current-menu-item"):o.addClass("current-menu-item"))}),m.trigger("onepagemenu.check")))}},n.on("patiotime.init",function(){patiotime.pages.all.init()}),document.addEventListener("DOMContentLoaded",function(){var t,e,a,i=l(".comment-content img, .post-entry img");n.trigger("patiotime.init"),l("body.page #primary iframe, body.single #primary iframe").length&&(e=['iframe[data-src*="videopress.com"]','iframe[data-src*="video.wordpress.com"]','iframe[data-src*="player.vimeo.com"]','iframe[data-src*="youtube.com"]','iframe[data-src*="youtube-nocookie.com"]','iframe[data-src*="kickstarter.com"][src*="video.html"]'],(t=l("body.page #primary, body.single #primary")).fitVids({customSelector:'iframe[src*="video.wordpress.com"]'}),t.find(e.join(",")).length&&t.find(e.join(",")).each(function(){var t=l(this),e=patiotimeParseInt(t.attr("width")),i=patiotimeParseInt(t.attr("height"));!l(this).parents(".fluid-width-video-wrapper").length&&e&&i&&t.attr("src",t.data("src")).wrap(l("<div>",{class:"fluid-width-video-wrapper"}).css("padding-top",i/e*100+"%")).removeAttr("height").removeAttr("width")})),m.on("load",function(){var t;window.location.hash&&"#comments"==window.location.hash&&l("#comments").length&&(t=l("#comments").offset().top-h,l("html, body").animate({scrollTop:t},200))}),n.on("beforeopen.popupbox.loftocean",function(t,e){var i=l(".sidemenu");i.length&&i.hasClass("show")&&i.find(".close-button").trigger("click")}).on("click",".to-top.show",function(t){t.preventDefault(),l("html, body").animate({scrollTop:0},Math.min(800,Math.max(300,Math.round(m.scrollTop()/5))))}).on("click",".site-header #menu-toggle, .elementor-widget-pt_menu_toggle .menu-toggle",function(t){t.preventDefault();t=l(".sidemenu");t.length&&(l(this).toggleClass("toggled-on"),l(this).hasClass("toggled-on")?(t.addClass("show"),c.css("overflow","hidden")):(t.removeClass("show"),c.css("overflow","")))}).on("click",".sidemenu.show .close-button",function(t){t.preventDefault(),t.stopPropagation(),l(".menu-toggle").removeClass("toggled-on"),l(".sidemenu").removeClass("show"),c.css("overflow","")}).on("click",".sidemenu",function(t){t=l(t.target);t.hasClass("sidemenu")&&t.hasClass("show")&&l(".sidemenu .close-button").trigger("click")}).on("click",".sidemenu .menu-item a",function(t){var e,i,n;this.hash&&1<this.hash.length&&d.host+d.pathname==this.host+this.pathname&&(n=l(this).closest("nav"),e=l(this),n.length&&(i=n.find(".menu-item"),n=n.find("li").filter(l(this).parent().parents("li")),i.length&&i.removeClass("current-menu-item current-menu-ancestor"),e.parent().addClass("current-menu-item"),n.length&&n.addClass("current-menu-ancestor")),setTimeout(function(){e.closest(".sidemenu").find(".close-button").trigger("click")},550))}).on("mouseover","#masthead .primary-menu .mega-menu .sub-cat-list li",function(){var t;l(this).hasClass("current")||(t=l(this).parents(".sub-cat-list").first().siblings(".sub-cat-posts").first(),l(this).siblings(".current").removeClass("current").end().addClass("current"),t.children(".current").removeClass("current"),t.children("."+l(this).attr("data-id")).addClass("current"))}).on("click",".main-navigation .dropdown-toggle, .secondary-navigation .dropdown-toggle, .pt-menu .dropdown-toggle",function(t){t.preventDefault(),l(this).hasClass("toggled-on")?l(this).parent().find(".toggled-on").removeClass("toggled-on"):(l(this).parent().siblings("li").find(".toggled-on").removeClass("toggled-on"),l(this).addClass("toggled-on"))}).on("click",".site-header .site-header-search, .pt-search-toggle .toggle-button",function(t){t.preventDefault(),s.length&&(s.hasClass("show")||(l(this).data("post-types")&&((t=s.find('input[name="post_type"]').length?s.find('input[name="post_type"]'):l("<input>",{name:"post_type",type:"hidden"}).appendTo(s.find(".search-form"))).val()&&!t.data("default-post-types")&&t.data("default-post-types",t.val()),t.addClass("custom-post-type").val(l(this).data("post-types"))),s.addClass("show"),setTimeout(function(){s.find("form .search-field").focus()},250),c.css("overflow","hidden")))}).on("click",".search-screen.show .close-button",function(t){t.preventDefault(),s.find(".custom-post-type").length&&((t=s.find(".custom-post-type")).data("default-post-types")?t.val(t.data("default-post-types")).removeAttr("class").removeAttr("data-default-post-types"):t.remove()),s.removeClass("show"),c.css("overflow","")}).on("click",".single #primary .post-footer .comments-link a",function(t){t.preventDefault();t=l("#comments");t.length&&(t=t.offset().top-h,l("html, body").animate({scrollTop:t},200))}).on("click",function(t){var e=l("#masthead .menu-item.focused");e.length&&e.removeClass("focused")}).on("keyup",function(t){var e;9===(t.keyCode||t.which)&&(e=l(t.target),t=l("#masthead .menu-item"),e.hasClass("menu-item")||e.parents(".menu-item").length?(e=e.parents(".menu-item").length?e.parents(".menu-item").last():e,t.removeClass("focused"),e.addClass("focused")):t.removeClass("focused"))}).on("click",".quantity.pt-quantity .minus",function(t){t.preventDefault();var e=l(this).siblings(".qty");e.length&&(0<(t=e.val())&&e.val(t-1).trigger("change"),p(l(this),e))}).on("click",".quantity.pt-quantity .plus",function(t){t.preventDefault();var e=l(this).siblings(".qty");e.length&&(t=e.val(),e.val(++t).trigger("change"),l(this).siblings(".minus").removeAttr("disabled"))}),patiotime.woocommerceProductFilterAjaxEnabled&&(a=!1,n.on("click",".widget.woocommerce.widget_product_categories .product-categories a",function(t){t.preventDefault();var s=l(this),o=s.closest(".product-categories").find(".cat-item");return s.attr("href")&&!s.parent().hasClass("current-cat")&&l.get(s.attr("href")).done(function(t,e,i){var n;i&&i.status&&200==i.status&&((n=l(t).find("#primary")).length&&(i=l("#primary"),t=o.filter(s.parent().parents("li.cat-item")),n.hide(),i.html(n.html()),n.show("fast"),o.removeClass("current-cat-parent current-cat"),s.parent().addClass("current-cat"),t.length&&t.addClass("current-cat-parent"),a=s.attr("href")))}),!1}),n.on("change","#primary .woocommerce-ordering .orderby",function(t){!1!==a&&l(this).closest("form.woocommerce-ordering").attr("action",a).submit()})),l(".quantity.pt-quantity .minus").length&&l(".quantity.pt-quantity .minus").each(function(){p(l(this),l(this).siblings(".qty"))}),i.length&&i.each(function(){l(this).parent("a").length&&l(this).parent("a").addClass("image-link")}),l(".post-content-gallery.gallery-justified").patiotimeJustifiedGallery()})}(jQuery);
