jQuery(function($){var nbt_ajaxcart_load={block:function($el){$el.block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});},unblock:function($el){$el.unblock();}}
var nbt_ajaxcart={init:function(){$(window).load(function(){nbt_ajaxcart.load_cal();});if($('body').hasClass('single-product')&&$('.single-product .js_open_desginer_in_new_page').length==0&&$('.single-product .js_is_edit_mode').length==0){if($('[name="variation_id"]').length||$('[name="add-to-cart"]').length){$(document).on('submit','.single-product form.cart',this.add_to_cart);}}
$(document).on('added_to_cart',this.added_to_cart);$(document).on('click','.nbt-ajax-cart-icon',this.show_ajaxcart_popup);$(document).on('click','.nbt-ajax-cart-popup .remove',this.remove_to_cart);$(document).mouseup(function(e)
{if($(".nbt-ajax-cart").length){var container=$(".nbt-ajax-cart-popup");var icon=$(".nbt-ajax-cart-icon");if(!container.is(e.target)&&container.has(e.target).length===0&&!icon.is(e.target)&&icon.has(e.target).length===0)
{container.hide();container.removeClass('open');container.closest('.nbt-ajax-cart').removeClass('active');}}});$(document).on('click','.button.product_type_simple',this.trigger_add_to_cart);},trigger_add_to_cart:function(event){event.preventDefault();var $this=$(this);$this.block({message:null,overlayCSS:{background:'#fff',opacity:0.5,cursor:'none'}});var product_data=[];product_data.push({name:'action',value:'nbt_add_to_cart'});product_data.push({name:'add-to-cart',value:$this.attr('data-product_id')});product_data.push({name:'quantity',value:1});$.ajax({url:nbt_solutions.ajax_url,data:$.param(product_data),type:'POST',datatype:'json',success:function(response){$this.unblock();if(response.fragments){$(document.body).trigger('added_to_cart',[response.fragments]);if(response.fragments.ajax_completed!=undefined){Cookies.set('ajax_count',response.fragments.ajax_count);nbt_ajaxcart.notification('<div class="text-notice"><a href="'+response.fragments.url+'" class="button wc-forward nbt-ac-carturl">'+nbt_ajaxcart_params.label.view_cart+'</a> <div>'+response.fragments.title+' '+nbt_ajaxcart_params.label.message_success+'</div></div>');}}
if(response.error!=undefined){alert(response.error);}
$(".cart_list").mCustomScrollbar({theme:"dark"});},error:function(){alert('There was an error when processing data, please try again !');nbt_ajaxcart_load.unblock($li);}});},load_cal:function(){if($(".nbt-ajax-cart").length){var $width=$(window).width()-300;$('.nbt-ajax-cart').each(function(){var $wrap=$(this);var position=$wrap.offset();if($width<position.left){$wrap.find(".nbt-ajax-cart-popup").addClass('nbt-ajaxcart-right');$wrap.find(".nbt-ajax-cart-popup").css({right:'-20px'});}else{$wrap.find(".nbt-ajax-cart-popup").addClass('nbt-ajaxcart-left');$wrap.find(".nbt-ajax-cart-popup").css({left:0});}});}},show_ajaxcart_popup:function(){var $el=$(this).closest('.nbt-ajax-cart-icon').next();var $wrap=$(this).closest('.nbt-ajax-cart');if($el.hasClass('open')){$el.hide();$el.removeClass('open');$wrap.removeClass('active');}else{$el.show();$el.addClass('open');$wrap.addClass('active');nbt_ajaxcart.load_cal();$wrap.find(".cart_list").mCustomScrollbar({theme:"dark"});}},add_to_cart:function(event){if(nbt_ajaxcart_params.enable_ajax!='yes'){return;}
event.preventDefault();var product_data=$(this).serializeArray();var btn_submit=$(this).find('button[type="submit"]');if(btn_submit.attr('name')&&btn_submit.attr('name')=='add-to-cart'&&btn_submit.attr('value')){product_data.push({name:'add-to-cart',value:btn_submit.attr('value')});}
product_data.push({name:'action',value:'nbt_add_to_cart'});if(Cookies.get('ajax_count')==undefined){Cookies.set('ajax_count',nbt_ajaxcart_params.ajax_count);}
nbt_ajaxcart_load.block(btn_submit);$.ajax({url:nbt_solutions.ajax_url,data:$.param(product_data),type:'POST',datatype:'json',success:function(response){if(response.fragments){$(document.body).trigger('added_to_cart',[response.fragments,btn_submit]);console.log(response);if(response.fragments.ajax_completed!=undefined){btn_submit.prop('disabled',false);nbt_ajaxcart_load.unblock(btn_submit);Cookies.set('ajax_count',response.fragments.ajax_count);nbt_ajaxcart.notification('<div class="text-notice"><a href="'+response.fragments.url+'" class="button wc-forward nbt-ac-carturl">'+nbt_ajaxcart_params.label.view_cart+'</a> <div>'+response.fragments.title+' '+nbt_ajaxcart_params.label.message_success+'</div></div>');}else{btn_submit.prop('disabled',true);nbt_ajaxcart_load.unblock(btn_submit);alert('You can\'t add to cart this product!');}
$(".cart_list").mCustomScrollbar({theme:"dark"});}else{location.reload();}},error:function(){alert('There was an error when processing data, please try again !');nbt_ajaxcart_load.unblock($li);}});},added_to_cart:function(event,fragments,btn_submit){},remove_to_cart:function(){var $this=$(this).closest('li');var $wrap=$(this).closest('.nbt-ajax-cart');nbt_ajaxcart_load.block($wrap.find('.nbt-ajax-cart-popup'));var product_data=[];product_data.push({name:'action',value:'nbt_remove_cart'});product_data.push({name:'product_id',value:$(this).attr('data-product_id')});product_data.push({name:'variation_id',value:$(this).attr('data-variation_id')});$.ajax({url:nbt_solutions.ajax_url,data:$.param(product_data),type:'POST',datatype:'json',success:function(response){if(response.fragments){$wrap.find('.nbt-ajax-cart-count, .counter-number').text(response.fragments.ajax_count);$wrap.find('div.nbt-ajax-cart-popup').replaceWith(response.fragments.ajax_popup);nbt_ajaxcart.load_cal();$wrap.find(".cart_list").mCustomScrollbar({theme:"dark"});}
nbt_ajaxcart_load.unblock($wrap.find('.nbt-ajax-cart-popup'));},error:function(){alert('There was an error when processing data, please try again !');nbt_ajaxcart_load.unblock();}});return false;},notification:function(content){$('.ajaxcart-notification').remove();$('body').append('<div id="growls" class="ajaxcart-notification default" style="top: '+nbt_ajaxcart_params.top_notification+'px;"><div class="growl growl-notice growl-medium"><div class="growl-message"><div class="growl-close">×</div>'+content+'</div></div>');$('.ajaxcart-notification').hide().show('slow').delay(2000).hide('slow');}}
nbt_ajaxcart.init();});
jQuery(function($){var nbt_ajax_search_load={block:function($el){$el.block({message:null,overlayCSS:{background:'#fff',opacity:0.6}});},unblock:function($el){$el.unblock();}}
var nbt_ajax_search={init:function(){$(document).on('click','.nas-icon-click',this.openSearchPopup);$(document).on('click','.nas-overlay-close',this.closeSearchPopup);$(window).load(function(){var typingTimer;var doneTypingInterval=1000;var $input=$('.nas-field');$input.on('keyup',function(){var $this=$(this).closest('.nas-wrapper'),$val=$(this).val();$this.addClass('nas-searching');$this.removeClass('nas-active');$this.find('.nas-results').empty();if($val.length>2){clearTimeout(typingTimer);typingTimer=setTimeout(doneTyping.bind(null,$this),doneTypingInterval);}else{$this.removeClass('nas-searching');}});$input.on('keydown',function(){clearTimeout(typingTimer);});function doneTyping(el){nbt_ajax_search.searchNow(typingTimer,el);}});$(document).mouseup(function(e)
{if($(".nas-layout-input .nas-active").length){var container=$('.nas-search-form');if(!container.is(e.target)&&container.has(e.target).length===0)
{$('.nas-search-form.nas-active .nas-results').empty();container.removeClass('nas-active');}}});},searchNow:function(typingTimer,el){var data=el.find('.nas-field').val();$.ajax({url:nbt_solutions.ajax_url,data:{action:'nbt_search_now',search:data},type:'POST',datatype:'json',success:function(response){if(response.complete!=undefined){el.find('.nas-results').html(response.result);el.find('.nas-results').mCustomScrollbar({theme:"dark"});}else{}
el.removeClass('nas-searching');el.addClass('nas-active');clearTimeout(typingTimer);},error:function(){clearTimeout(typingTimer);alert('There was an error when processing data, please try again !');}});},openSearchPopup:function(e){e.preventDefault();var $this=$(this).closest('.nas-wrapper');$this.addClass('nas-overlay-active');},closeSearchPopup:function(e){e.preventDefault();var $this=$(this).closest('.nas-wrapper');$this.removeClass('nas-overlay-active nas-active');}}
nbt_ajax_search.init();});
var x=false;jQuery(function($){var nbtcs_frontend={init:function(){$('.variations_form').addClass('swatches-support');$('.variations_form').on('click','.swatch',this.select_attributes);$('.variations_form').on('click','.reset_variations',this.reset_attributes);$(document).ajaxComplete(this.ajax_quick_view);$(document).ajaxStop(function(){x=false;});$('body').on('click','.nbtcs-swatches .swatch-color',function(){var $pt_product_meta=$(this).closest('.pt-product-meta');var $hover_image_img=$pt_product_meta.find('.hover-image img');var $img_show=$pt_product_meta.find('.attachment-woocommerce_thumbnail');for(var i=0;i<$hover_image_img.length;i++){if($($hover_image_img[i]).attr('data-color')===$(this).attr('data-value')){$img_show.attr('src',$($hover_image_img[i]).attr('src'));$img_show.attr('srcset',$($hover_image_img[i]).attr('srcset'));}}})
$(document).ajaxComplete(function(event,xhr,options){if(typeof(options.url)=="string"&&options.url.includes("get_variation")){if(xhr.status==200){nbtcs_frontend.trigger_price_matrix();}}});},ajax_quick_view:function(event,request,settings){if(!x&&typeof(settings.data)=="string"&&settings.data&&settings.data.includes("action=yith_load_product_quick_view")){nbtcs_frontend.init();x=true;}},select_attributes:function(){var selected=[];var $el=$(this);var attr=$el.closest('.nbtcs-swatches');var $select=attr.prev().find('select'),$nbtcs_swatches=$el.closest('.nbtcs-swatches'),attribute_name=$select.data('attribute_name')||$select.attr('name'),value=$el.attr('data-value');$select.trigger('focusin');if(!$select.find('option[value="'+value+'"]').length){$el.siblings('.swatch').removeClass('selected');$select.val('').change();$('.variations_form').trigger('tawcvs_no_matching_variations',[$el]);return;}
clicked=attribute_name;if(selected.indexOf(attribute_name)===-1){selected.push(attribute_name);}
if($el.hasClass('swatch-radio')){$select.val(value);}else{if($el.hasClass('selected')){$select.val('');$el.removeClass('selected');delete selected[selected.indexOf(attribute_name)];}else{$el.addClass('selected').siblings('.selected').removeClass('selected');$select.val(value);}}
var table_variation=$('.variations_form table.variations td.value select'),total_variations=table_variation.length,total_selected=0,new_push=[];table_variation.each(function(index){var attribute_name=$(this).attr('data-attribute_name'),attribute_value=$(this).val(),attribute_name=attribute_name.replace("attribute_","");if((total_variations-1)==index&&$('.pm-select-last').length<=0){$(this).addClass('pm-select-last');}
if(attribute_value){total_selected+=1;new_push.push(md5(attribute_name+attribute_value));}});if(total_variations==total_selected){$select.trigger('change');nbtcs_frontend.trigger_price_matrix();}},trigger_price_matrix:function(){var $this=$(this);if($('.price-matrix-table').length>0){$('.pm-td-price').removeClass('selected');var variation_id='pm-price-'+$('.variation_id').val();$('#'+variation_id).addClass('selected');$('table.un-variations td.value select').each(function(index){var attr_name=$(this).attr('data-attribute_name'),attr_value=$('[data-attribute_name="attribute_'+attr_name+'"]').val();$(this).val(attr_value);});}},select_attributes_radio:function(){var $el=$(this);alert(2);},reset_attributes:function(){$(this).closest('.variations_form').find('.swatch.selected').removeClass('selected');$(this).closest('.variations_form').find('[type="radio"]').prop('checked',false);selected=[];}}
nbtcs_frontend.init();});