"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,a,r){return a&&e(t.prototype,a),r&&e(t,r),t}}();!function(e){new(function(){function t(){var a=this;_classCallCheck(this,t),this.initSlideProduct(),e(".woocommerce-product-gallery").on("wc-product-gallery-after-init",function(){a.singleProductGalleryImages()})}return _createClass(t,[{key:"initSlideProduct",value:function(){var t=e(".single-product.woocommerce-single-style-4 div.product .images");t.length&&t.removeClass(function(e,t){return(t.match(/(^|\s)woocommerce-product-gallery--columns-\S+/g)||[]).join(" ")}).flexslider({selector:".woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image",animation:"slide",controlNav:!0,directionNav:!0,slideshow:!1,smoothHeight:!1,itemMargin:0,touch:!0})}},{key:"singleProductGalleryImages",value:function(){var t=!!e("body").hasClass("rtl"),a=e(".woocommerce-single-style-2 .woocommerce-product-gallery");if(!(a.length<0)){var r=a.data("columns"),c=e(".flex-control-thumbs",a);c.children().length>r&&c.slick({rtl:t,infinite:!1,slidesToShow:r,vertical:!0,verticalSwiping:!0})}}},{key:"productTogerther",value:function(){var t=e(".opal-frequently-bought");if(!(t.length<=0)){var a=t.find(".otf-total-price .woocommerce-Price-amount"),r=t.find(".otf_add_to_cart_button"),c=parseFloat(t.find("#otf-data_price").data("price"));t.data("currency"),t.data("thousand"),t.data("decimal"),t.data("price_decimals"),t.data("currency_pos");t.find("input[type=checkbox]").on("change",function(){var o=e(this).val();e(this).closest("li").toggleClass("uncheck");var n=parseFloat(e(this).closest("li").find(".product-price").data("price"));e(this).closest("li").hasClass("uncheck")?(t.find("#fbt-product-"+o).addClass("un-active"),c-=n):(t.find("#fbt-product-"+o).removeClass("un-active"),c+=n);var i="0";t.find(".product-list li").each(function(){e(this).hasClass("uncheck")||(i+=","+e(this).find("input[type=checkbox]").val())}),r.attr("value",i),a.html(this.formatNumber(c))}),t.on("click",".otf_add_to_cart_button.ajax_add_to_cart",function(){var t=e(this);t.addClass("loading");var a=window.location.href;e.ajax({url:ajaxurl,dataType:"json",method:"post",data:{action:"otf_woocommerce_fbt_add_to_cart",product_ids:t.attr("value")},error:function(){window.location=a},success:function(a){if("undefined"!=typeof wc_add_to_cart_params&&"yes"===wc_add_to_cart_params.cart_redirect_after_add)return void(window.location=wc_add_to_cart_params.cart_url);e(document.body).trigger("updated_wc_div"),e(document.body).on("wc_fragments_refreshed",function(){t.removeClass("loading")})}})})}}},{key:"formatNumber",value:function(e){var t=e;if(parseInt(price_decimals)>0){e=e.toFixed(price_decimals)+"";for(var a=e.split("."),r=a[0],c=a.length>1?decimal+a[1]:"",o=/(\d+)(\d{3})/;o.test(r);)r=r.replace(o,"$1"+thousand+"$2");t=r+c}switch(currency_pos){case"left":return currency+t;case"right":return t+currency;case"left_space":return currency+" "+t;case"right_space":return t+" "+currency}}}]),t}())}(jQuery);