(function(t,o){"use strict";t=t||{},o(document).ready((function(){"undefined"!=typeof yith_woocompare&&(o("body").on("click",".wishlist_table a.compare.added",(function(e){e.preventDefault(),o("body").trigger("yith_woocompare_open_popup",{response:t.add_query_arg("action",yith_woocompare.actions?yith_woocompare.actions.view:yith_woocompare.actionview)+"&iframe=true"})})),o(document).off("click","a.compare:not(.added)").off("click",".product a.compare:not(.added)").on("click",".product a.compare:not(.added), .wishlist_table a.compare:not(.added)",(function(e){e.preventDefault(),void 0!==t.comparePopup&&t.comparePopup.initialize(o(this));var a=o(this),i={action:yith_woocompare.actions?yith_woocompare.actions.add:yith_woocompare.actionadd,id:a.data("product_id"),context:"frontend",security:yith_woocompare.nonces?yith_woocompare.nonces.add:yith_woocompare.add_nonce},c=o(".yith-woocompare-widget ul.products-list");a.addClass("added"),o.ajax({type:"post",url:yith_woocompare.ajaxurl.toString().replace("%%endpoint%%",yith_woocompare.actions?yith_woocompare.actions.add:yith_woocompare.actionadd),data:i,dataType:"json",success:function(t){o(".yith-woocompare-open .compare-count").each((function(){this.innerHTML=parseInt(this.innerHTML)+1}));var e="";a.data("added_icon")&&(e+='');var i=yith_woocompare.added_label;a.attr("data-bs-original-title",i),"hide"==a.data("hide_title")&&(i=""),a.attr("href",t.table_url).html(a.data("icon_pos")?i+e:e+i),c.html(t.widget_table),"undefined"==typeof yith_woocompare||"yes"!=yith_woocompare.auto_open&&"1"!=yith_woocompare.auto_open||a.trigger("click"),t.added&&o(document).trigger("yith_woocompare_product_added",{productId:a.data("product_id"),$initiator:a})}}).fail((function(){a.removeClass("added")}))})))})),js_porto_vars.compare_popup&&o.extend(t,{comparePopup:{isCart:!0,popupContainer:null,$el:null,initialize:function(t){return this.$el=t,0==o(".after-loading-success-message.style-3").length?(o("body").append('
'),this.isCart=!1,this.popupContainer=o(".after-loading-success-message.style-3")):(this.popupContainer=o(".after-loading-success-message.style-3"),this.popupContainer.eq(0).stop().show()),this.popupContainer.data("inited")||(this.popupContainer.on("click",".compare-close",(function(){var t=o(this).closest(".success-message-container");t.removeClass("active"),setTimeout((function(){t.slideUp(300,(function(){t.remove()}))}),350)})),this.popupContainer.data("inited",!0)),this.build(),this},build:function(){var t=this;if(js_porto_vars.compare_popup&&(!yith_woocompare||yith_woocompare&&("no"==yith_woocompare.auto_open||""==yith_woocompare.auto_open))){t=this;var e=o(".wishlist_table").length>0,a=e?t.$el.closest("tr"):t.$el.closest(".product"),i="string"==typeof js_porto_vars.compare_popup_title?js_porto_vars.compare_popup_title:"",c=e?a.find(".product-thumbnail a:first-child").attr("href"):a.find(".product-image>a:first-child").length>0?a.find(".product-image>a:first-child").attr("href"):"#",r=e?a.find(".product-thumbnail img").attr("src"):a.find(".product-inner .product-image img").length>0?a.find(".product-inner .product-image img").attr("src"):a.find(".product-images .owl-item.active .img-thumbnail img").attr("src"),n=e?a.find(".product-price").html():a.find(".price").html(),d=e?a.find(".product-name a").text():1==a.find(".woocommerce-loop-product__title").length?a.find(".woocommerce-loop-product__title").text():a.find(".product_title").text();if(!r&&a.find(".product-image img").length){r=a.find(".product-image img").attr("src");var p=a.find(".product-images img");a.find(".product-image").closest(".product-nav")&&p.length&&(r=p.attr("src"),p.attr("data-oi")&&(r=p.attr("data-oi")))}!d&&a.find(".product-image").length&&(d=a.find(".product-image").data("title"));var s=o('

'+i+'

'+(n||"")+'
'+d+'
');t.popupContainer.prepend(s),setTimeout((function(){s.addClass("active")}),150),setTimeout((function(){s.find(".compare-close").trigger("click")}),4e3)}return t}}})}).apply(this,[window.theme,jQuery]),function(t){var o="";t("#yith-woocompare.woocommerce").length&&(t(document).on("click",".remove a",(function(){o=t(this).data("product_id")})),t(window).on("yith_woocompare_product_removed",(function(){var e=t('.porto-tb-compare[data-product_id="'+o+'"]',window.parent.document);e.html(''+("hide"==e.data("hide_title")?"":yith_woocompare.button_text)),t('.compare[data-product_id="'+o+'"]',window.parent.document).attr("data-bs-original-title",yith_woocompare.button_text),t(".yith-woocompare-open .compare-count",window.parent.document).each((function(){this.innerHTML=Math.max(0,parseInt(this.innerHTML)-1)}))}))),t(document).on("click","#yith-woocompare-table_wrapper .remove a",(function(){o=t(this).data("product_id")})),t(window).on("yith_woocompare_product_removed",(function(){o&&(t('.porto-tb-compare[data-product_id="'+o+'"]').each((function(){$each_btn=t(this),$each_btn.html(''+("hide"==$each_btn.data("hide_title")?"":yith_woocompare.button_text))})),t('.compare[data-product_id="'+o+'"]').attr("data-bs-original-title",yith_woocompare.button_text),t(".yith-woocompare-open .compare-count").each((function(){this.innerHTML=Math.max(0,parseInt(this.innerHTML)-1)})),t('.single-product .widget-compare [data-product_id="'+o+'"], .single-product .product-summary-wrap [data-product_id="'+o+'"]').each((function(){$each_btn=t(this),$each_btn.html("hide"==$each_btn.data("hide_title")?"":yith_woocompare.button_text)})))}))}(window.jQuery);