(function($){
$.fn.serializeArrayAll=function(){
var rCRLF=/\r?\n/g;
return this.map(function(){
return this.elements ? $.makeArray(this.elements):this;
}).map(function(i, elem){
var val=$(this).val();
if(val==null){
return val==null;
}else if(this.type==='checkbox'){
if(this.checked){
return {name: this.name, value: this.checked ? this.value:''};}}else if(this.type==='radio'){
if(this.checked){
return {name: this.name, value: this.checked ? this.value:''};}}else{
return $.isArray(val) ? $.map(val, function(val, i){
return {name: elem.name, value: val.replace(rCRLF, '\r\n')};}):{name: elem.name, value: val.replace(rCRLF, '\r\n')};}}).get();
};
$(document).on('wooaa_adding_to_cart', function(e, $btn){
$btn.removeClass('added').addClass('loading');
});
$(document).
on('wooaa_added_to_cart', function(e, fragments, cart_hash, $btn){
$btn.removeClass('loading').addClass('added');
});
$(document).
on('click',
'.single_add_to_cart_button:not(' + wooaa_vars.ignore_btn_class + ')',
function(e){
var wooaa=false;
var $btn=$(this);
var $form=$btn.closest('.wpc_cart').length ? $btn.closest('.wpc_cart'):$btn.closest('form.cart');
if(wooaa_vars.product_types!==undefined){
var product_types=wooaa_vars.product_types.split(',');
if(product_types.includes('all')){
wooaa=true;
}else{
product_types.forEach(function(item){
if($btn.is('.product-type-' + item +
' .single_add_to_cart_button')){
wooaa=true;
}});
}}
if(wooaa){
e.preventDefault();
var data={};
var form_data=$form.find('input:not([name="product_id"]), select, button, textarea').
serializeArrayAll()||0;
$.each(form_data, function(i, item){
if(item.name==='add-to-cart'){
item.name='product_id';
item.value=$form.find('input[name=variation_id]').val() ||
$form.find('[name=variation_id]').val() ||
$form.find('input.variation_id').val() ||
$form.find('.variation_id').val() ||
$form.find('input[name=add-to-cart]').val() ||
$form.find('[name=add-to-cart]').val()||$btn.val();
}});
$(document.body).
trigger('wooaa_adding_to_cart', [$btn, form_data]);
$(document.body).trigger('adding_to_cart', [$btn, form_data]);
$.each(form_data, function(i, item){
if(item.name!==''){
data[item.name]=item.value;
}});
if($btn.is('.product-type-variable .single_add_to_cart_button')){
var attrs={};
$form.find('[name^="attribute_"]').each(function(){
var attribute=$(this).attr('name');
attrs[attribute]=$(this).val();
});
data.variation=attrs;
}
if((wooaa_vars.ignore_form_data!=undefined) &&
(wooaa_vars.ignore_form_data!='')){
var ignore_form_data=wooaa_vars.ignore_form_data.split(',');
ignore_form_data.forEach(function(item){
delete data[item];
});
}
data.action='wooaa_add_to_cart';
data.nonce=wooaa_vars.nonce;
$.post(wooaa_vars.wc_ajax_url.toString().
replace('%%endpoint%%', 'wooaa_add_to_cart'), data,
function(response){
if(!response){
return;
}
if(response.error&&response.product_url){
window.location=response.product_url;
return;
}
if(wooaa_vars.cart_redirect_after_add==='yes'){
window.location=wooaa_vars.cart_url;
return;
}
$(document.body).
trigger('added_to_cart', [
response.fragments, response.cart_hash, $btn]);
$(document.body).
trigger('wooaa_added_to_cart', [
response.fragments, response.cart_hash, $btn]);
});
return false;
}});
})(jQuery);
(()=>{function e(){const e=document.querySelectorAll(".header--row.hide-on-mobile.is_sticky"),o=document.querySelectorAll(".header--row.hide-on-desktop.is_sticky");(e.length>0||o.length>0)&&(!function(e=!1,t=!1){let o=document.querySelector(".sticky-header-placeholder");const s=document.querySelector(".hfg_header"),r=document.querySelector(".neve-transparent-header");null===o&&null===r&&(o=document.createElement("div"),o.classList.add("sticky-header-placeholder"),s.parentNode.insertBefore(o,s.nextSibling)),!e&&o&&o.classList.add("hide-on-mobile","hide-on-tablet"),!t&&o&&o.classList.add("hide-on-desktop"),e&&s.classList.add("has-sticky-rows--mobile"),t&&s.classList.add("has-sticky-rows--desktop"),null!==o&&(o.style.height=s.offsetHeight+"px")}(o.length>0,e.length>0),t(document.querySelector(".hfg_header"),document.querySelector("header.header"),document.querySelector(".sticky-header-placeholder")))}function t(e,t,s){new IntersectionObserver((t=>{if(!0===t[0].isIntersecting)return e.classList.remove("is-stuck"),o(e,s,!1),!1;e.classList.add("is-stuck"),o(e,s)}),{rootMargin:"20px 0px 25px 0px"}).observe(t)}function o(e,t,o=!0){const s=e.querySelectorAll(".header--row");let r=0;const c=!e.classList.contains("has-sticky-rows--desktop"),i=!e.classList.contains("has-sticky-rows--mobile");s.forEach((e=>{const t=e.querySelector(".header--row-inner").offsetHeight,s="desktop"===e.dataset.showOn;if(!(c&&s||i&&!s))return o?e.classList.contains("is_sticky")?(e.style.height=`${t}px`,void(r+=e.classList.contains("is_sticky_on_scroll")?0:t)):void(e.style.height=0):void(e.classList.contains("is_sticky_on_scroll")?e.style.height=0:(r+=t,e.style.height=`${t}px`));e.style.height=`${t}px`})),t&&(t.style.height=`${r}px`)}function s(){document.querySelectorAll(".footer--row.is_sticky").length>0&&(!function(){let e=document.querySelector(".sticky-footer-placeholder");const t=document.querySelector(".hfg_footer");null===e&&(e=document.createElement("div"),e.classList.add("sticky-footer-placeholder"),t.parentNode.insertBefore(e,t.nextSibling)),t.classList.add("has-sticky-rows"),e.style.height=t.offsetHeight+"px"}(),t(document.querySelector(".hfg_footer"),document.querySelector("footer")))}let r;window.addEventListener("load",(function(){e(),s()})),window.addEventListener("selective-refresh-content-rendered",(function(t){if("hfg_header_layout_partial"===t.detail){const t=document.querySelector(".sticky-header-placeholder"),o=document.querySelector(".hfg_header");t&&t.remove(),o.classList.remove("has-sticky-rows--mobile","has-sticky-rows--desktop"),e()}if("hfg_footer_layout_partial"===t.detail){const e=document.querySelector(".hfg_footer"),t=document.querySelector(".sticky-footer-placeholder");t&&t.remove(),e.classList.remove("has-sticky-rows"),s()}})),window.addEventListener("resize",(function(){clearTimeout(r),r=setTimeout((function(){e(),s()}),500)}))})();