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