!function(C){"use strict";etTheme.autoinit.XStoreWishlist=etTheme.XStoreWishlist=function(){var h,_,i,u,n,l,d,c,m,e,p,f,g,s;function w(a,o,r){a<o?C(r[a]).hasClass("processing")||(C(r[a]).trigger("click").addClass("processing"),C(document.body).on("added_to_cart",function(t,e,i,s){s.attr("data-product_id")==C(r[a]).attr("data-product_id")&&(s.removeClass("processing in-process"),w(++a,o,r))})):C(r[a-1]).parent().hasClass("keeper-all-products-buttons")&&C(".et_b_header-wishlist").find("li").unblock()}function x(t,e,i){t<e&&(C(i[t]).hasClass("processing")||C(i[t]).trigger("click",{is_multiple:!0,i:t,max:e,buttons:i}).addClass("processing"))}function v(t,e,i){var s;t<e&&(s=m?"in-process":"processing",C(i[t]).hasClass(s)||C(i[t]).trigger("click",{is_multiple:!0,i:t,max:e,buttons:i}).addClass(s))}function b(){var t;return i||(C.ajax({url:xstore_wishlist_params.ajaxurl,dataType:"json",method:"POST",data:{cookie_key:_,action:"xstore_get_user_wishlist"},success:function(t){return i=t.products.products.map(t=>JSON.stringify(t))},error:function(){},complete:function(){}}),(t=etTheme.getCookie(_))?t.split("|"):[])}function y(){var t;return i?i.map(t=>JSON.parse(t).id):(C.ajax({url:xstore_wishlist_params.ajaxurl,dataType:"json",method:"POST",data:{cookie_key:_,action:"xstore_get_user_wishlist"},success:function(t){var e=t.products.products;return i=t.products.products.map(t=>JSON.stringify(t)),e},error:function(){},complete:function(){}}),(t=etTheme.getCookie(_))&&C.isArray(t)?t.split("|").map(t=>JSON.parse(t).id):[])}function T(t,e={}){t=parseInt(t);var i=b(),s=i.map(t=>JSON.parse(t).id).indexOf(t);-1<s&&(i.splice(s,1),etTheme.setCookie(_,i.join("|")),e.table_row&&(e.table_row.css({position:"relative",zoom:1}),e.table_row.find("td:last-child").block({message:null,overlayCSS:{opacity:.6}}).attr("style",null),m?setTimeout(function(){e.table_row.remove()},1500):(e.table_row.find("td:last-child").unblock(),setTimeout(function(){e.table_row.attr("style",null)},500))),C(document).find("."+h+"[data-id="+t+"]").each(function(){e.table_row||C(this).addClass("processing"),g(C(this),JSON.parse(C(this).attr("data-settings")),"remove")}),e.miniwishlist&&!e.liItem.parents(".etheme-elementor-off-canvas").length&&e.liItem.block({message:null,overlayCSS:{opacity:.6}}),xstore_wishlist_params.is_loggedin&&(clearTimeout(u),u=setTimeout(function(){k(i.join("|"))},1500)),e.is_multiple?(e.i++,C(document).trigger("xstore_wishlist/removing_product",[i,t,e.is_multiple,e.i,e.max,e.buttons])):C(document).trigger("xstore_wishlist/removing_product",[i,t]))}function k(t){C.ajax({url:xstore_wishlist_params.ajaxurl,dataType:"json",method:"POST",data:{action:"xstore_update_user_wishlist",cookie_key:_,products:t},success:function(t){},error:function(){},complete:function(){}})}function a(t,e){t.length&&(e?(t.attr("data-o_id")||t.attr("data-o_id",t.data("id")),t.attr("data-id",e)):void 0!==t.attr("data-o_id")&&t.attr("data-id",t.attr("data-o_id")),s(t,parseInt(e)))}function o(t){void 0!==t.attr("data-o_id")&&(t.attr("data-id",t.attr("data-o_id")),s(t,t.attr("data-o_id")))}"undefined"!=typeof Cookies&&(etTheme.xstore_wishlist={},h="xstore-wishlist",_=xstore_wishlist_params.wishlist_id,i=null,l=n=u=0,d=etTheme.et_global.w_width<etTheme.et_global.mob_header_start||etConfig.layoutSettings.is_mobile?C(".mobile-header-wrapper"):C(".header-wrapper"),c=C("body").hasClass("xstore-wishlist-page"),m=C("body").hasClass("xstore-wishlist-owner"),p=e=0,f=`
        <svg viewBox="0 0 24 22" class="xstore-wishlist-animated-heart">
        <path d="M23 6.6C23 12 17.1 17.5 12 21 6.9 17.5 1 12 1 6.6 1 3.5 3.5 1 6.5 1c2.3 0 4.7 1.5 5.5 3.5.8-2 3.2-3.5 5.5-3.5 3 0 5.5 2.5 5.5 5.6z"></path>
        </svg>`,xstore_wishlist_params.ajax_fragments&&(C(document).on("xstore_wishlist_initialized",function(t,e){C(document).trigger("xstore_wishlist_fragment_refresh",[e])}),C(window).on("pageshow",function(t){t.originalEvent.persisted&&(C(".et_b_wishlist-dropdown").empty(),C(document).trigger("xstore_wishlist_fragment_refresh",[b()]))}),C(document).on("xstore_wishlist_force_fragment_refresh",function(){C(".et_b_wishlist-dropdown").empty(),C(document).trigger("xstore_wishlist_fragment_refresh",[b()])})),C(document).on("click","."+h,function(t,e){t.preventDefault();var i=C(this).attr("data-action"),s=C(this).attr("data-id"),a=C(this).data("settings")||{},o=C(this).hasClass(h+"-redirect"),t=e&&!!e.is_multiple,r={},n=(t&&(r={is_multiple:!0,i:e.i,max:e.max,buttons:e.buttons}),C(this).parents("td"));switch((t||n)&&(r.table_row=C(this).parents("tr")),i){case"add":C(this).addClass("processing"),xstore_wishlist_params.animated_hearts&&(clearTimeout(p),C(this).prepend('<span class="xstore-wishlist-animated-hearts et-icon">'+f+f+f+f+f+"</span>")),g(C(this),a,i);var l,[d,c={}]=[s,r];d=parseInt(d),-1===y().indexOf(d)&&((l=b()).push(JSON.stringify({id:d,time:Math.floor((new Date).getTime()/1e3)})),etTheme.setCookie(_,l.join("|"),xstore_wishlist_params.days_cache),c.table_row&&!m&&(c.table_row.css({position:"relative",zoom:1}),c.table_row.find("td:last-child").block({message:null,overlayCSS:{opacity:.6}}).attr("style",null),c.table_row.find("td:last-child").unblock(),setTimeout(function(){c.table_row.attr("style",null)},500)),xstore_wishlist_params.is_loggedin&&(clearTimeout(u),u=setTimeout(function(){k(l.join("|"))},1500)),C(document).find("."+h+"[data-id="+d+"]").each(function(){C(this).addClass("processing"),g(C(this),JSON.parse(C(this).attr("data-settings")))}),c.is_multiple?(c.i++,C(document).trigger("xstore_wishlist/adding_product",[l,d,c.is_multiple,c.i,c.max,c.buttons])):C(document).trigger("xstore_wishlist/adding_product",[l,d])),o&&C(this).addClass(h+"-redirect-ready");break;case"remove":o&&C(this).hasClass(h+"-redirect-ready")?window.location.href=xstore_wishlist_params.wishlist_page_url:(m||n||C(this).addClass("processing"),g(C(this),a,i),T(s,r))}}),g=function(t,e,i="add"){"add"==i?(e.removeText&&(t.find(".button-text").text(e.removeText),t.find(".mt-mes").text(e.removeText)),e.iconRemove&&t.find(".et-icon").addClass(e.iconRemove).removeClass(e.iconAdd),t.attr("data-action","remove"),t.attr("href",t.attr("href").replace("add_to_wishlist","remove_wishlist"))):(e.addText&&(t.find(".button-text").text(e.addText),t.find(".mt-mes").text(e.addText)),e.iconAdd&&t.find(".et-icon").addClass(e.iconAdd).removeClass(e.iconRemove),t.attr("data-action","add"),t.attr("href",t.attr("href").replace("remove_wishlist","add_to_wishlist"))),t.removeClass(h+"-redirect-ready"),"add"!=i?setTimeout(function(){t.removeClass("processing in-process"),xstore_wishlist_params.animated_hearts&&t.addClass("xstore-wishlist-has-animation")},300):xstore_wishlist_params.animated_hearts?(clearTimeout(p),p=setTimeout(function(){"add"==i?t.removeClass("xstore-wishlist-has-animation"):t.addClass("xstore-wishlist-has-animation"),t.find(".xstore-wishlist-animated-hearts").remove(),t.removeClass("processing in-process")},1e3)):setTimeout(function(){t.removeClass("processing in-process")},300)},C(document).on("click",".xstore-miniwishlist-remove",function(t){t.preventDefault(),T(C(this).data("id"),{miniwishlist:!0,liItem:C(this).parents("li")})}),C(".xstore-wishlist-table :checkbox").on("click",function(){var t;"product-bulk-select"==C(this).attr("name")?C(this).closest("table").children("tbody").find(":checkbox").prop("checked",C(this).prop("checked")):(t=C(this).closest("tbody").find(":checkbox").filter(":visible:enabled").not(":checked"),C(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===t.length}))}),C(document).on("click",".xstore-wishlist-form .add-all-products",function(t){t.preventDefault(),confirm(xstore_wishlist_params.confirmQuestion)&&(etConfig.ajaxProductAddedNotify.type="alert",(t=C(this).closest(".xstore-wishlist-form").find("table").children("tbody").find(":checkbox").parents("tr").find(".ajax_add_to_cart")).length<1?alert(xstore_wishlist_params.no_products_available):w(0,t.length,t))}),C(document).on("click",".et_b_header-wishlist .add-all-products",function(t){var e;t.preventDefault(),confirm(xstore_wishlist_params.confirmQuestion)&&(etConfig.ajaxProductAddedNotify.type="alert",(e=(t=C(this).parents(".et_b_header-wishlist")).find(".keeper-all-products-buttons .ajax_add_to_cart")).length?(t.find("li").block({message:null,overlayCSS:{opacity:.6}}),w(0,e.length,e)):e.length<1&&alert(xstore_wishlist_params.no_products_available))}),C(".xstore-wishlist-actions").on("click",function(t){t.preventDefault(),etConfig.ajaxProductAddedNotify.type="alert";var e=C(this).closest(".xstore-wishlist-form").find("table").children("tbody").find(":checkbox:checked").parents("tr");if(e.length<1)alert(xstore_wishlist_params.no_active_checkbox);else if(confirm(xstore_wishlist_params.confirmQuestion))switch(C(this).parent().find("select").val()){case"add":(s=e.find(".ajax_add_to_cart")).length<1?alert(xstore_wishlist_params.no_products_available):w(0,s.length,s);break;case"add_wishlist":(s=e.find("."+h+'[data-action="add"]')).addClass("in-process"),x(0,s.length,s);break;case"remove":var i,s=e.find("."+h+'[data-action="remove"]');m?(i=C(this).closest(".xstore-wishlist-form").find("table").children("tbody").find("tr"),s.length==i.find("."+h).length?(C.each(i,function(){C(this).css({position:"relative",zoom:1}),C(this).find("td:last-child").block({message:null,overlayCSS:{opacity:.6}}).attr("style",null)}),etTheme.setCookie(_,"",0),xstore_wishlist_params.is_loggedin&&k([]),C(document).trigger("xstore_wishlist_fragment_refresh",[[]])):v(0,s.length,s)):(s.addClass("in-process"),v(0,s.length,s))}}),etTheme.xstore_wishlist.force_init_active_wishlist=function(){C.ajax({url:xstore_wishlist_params.ajaxurl,dataType:"json",method:"POST",data:{cookie_key:_,action:"xstore_get_user_wishlist"},success:function(t){i=t.products.products.map(t=>JSON.stringify(t)),C(document).trigger("xstore_wishlist_initialized",[i])},error:function(){},complete:function(){}})},C(document).on("xstore_wishlist/removing_product",function(t,e,i,s,a,o,r){if(s&&a<o)setTimeout(function(){v(a,o,r)},1700);else{if(clearTimeout(l),l=setTimeout(function(){C(document).trigger("xstore_wishlist_fragment_refresh",[e])},700),c&&void 0!==etTheme.quickView&&C(t.target.activeElement).parents(".et-quick-view-wrapper").length){let t=C(document).find(".xstore-wishlist-form ."+h+"[data-id="+i+"]").parents("tr");t.css({position:"relative",zoom:1}),t.find("td:last-child").block({message:null,overlayCSS:{opacity:.6}}).attr("style",null),m?setTimeout(function(){t.remove()},1500):(t.find("td:last-child").unblock(),setTimeout(function(){t.attr("style",null)},500)),etTheme.et_woocommerce.quick_view_opened&&etTheme.closeQuickView()}C(document).trigger("xstore_wishlist/removed_product")}}),C(document).on("xstore_wishlist/adding_product",function(t,s,a,e,i,o,r){if(e&&i<o)setTimeout(function(){x(i,o,r)},1700);else switch(clearTimeout(l),l=setTimeout(function(){C(document).trigger("xstore_wishlist_fragment_refresh",[s])},700),clearTimeout(n),C(document).trigger("xstore_wishlist/added_product"),xstore_wishlist_params.notify_type){case"alert":etTheme.notify(etConfig.successfullyAdded);break;case"alert_advanced":C.ajax({url:xstore_wishlist_params.ajaxurl,data:{product_id:a,action:"xstore_get_wishlist_product_info"},method:"POST",success:function(t){var e=C("<a>",{class:"et-notify-image",href:t.product_link,target:"_self"}).html(t.product_image),t=C("<div>",{class:"et-notify-info"}).html(t.product_title),i=C("<a>",{class:"et-notify-button",href:xstore_wishlist_params.wishlist_page_url}).html(xstore_wishlist_params.view_wishlist);t.append(i[0].outerHTML),etTheme.notify(e[0].outerHTML+t[0].outerHTML,"info",5e3,!0)}});break;case"mini_wishlist":let t=C(d).find(".et_b_header-wishlist.et_element-top-level"),e=C(d).find(".et_b_header-wishlist.et_element-top-level.et-off-canvas .et-mini-content"),i=C(d).find(".et_b_header-wishlist.et_element-top-level.et-off-canvas");i.length&&(etTheme.closeQuickView(),etTheme.showHideElementsOnCanvasActions(!0),etTheme.et_global.deny_link_click=!0,C(".et-mobile-panel-wrapper").addClass("outside")),t.addClass("active"),e.addClass("active"),i.addClass("et-content-shown"),n=setTimeout(function(){t.removeClass("active")},1e3)}}),C(document).on("found_variation","form.variations_form",function(t,e){var i=C(t.target).closest(".product").find(".xstore-wishlist-single");i.length&&(xstore_wishlist_params.is_multilingual?(i.block({message:null,overlayCSS:{opacity:.6}}),C.ajax({url:xstore_wishlist_params.ajaxurl,data:{variation_id:e.variation_id,action:"xstore_get_origin_wishlist_product_variation_id"},method:"POST",success:function(t){a(i,t.variation_id),i.unblock()}})):a(i,e.variation_id))}),C(document).on("reset_data","form.variations_form",function(t){t=C(t.target).closest(".product").find(".xstore-wishlist-single");t.length&&o(t)}),C(document).on("found_variation","div.st-swatch-in-loop",function(t,e){var i=C(t.target).closest(".product").find(".xstore-wishlist");i.length&&(xstore_wishlist_params.is_multilingual?(i.block({message:null,overlayCSS:{opacity:.6}}),C.ajax({url:xstore_wishlist_params.ajaxurl,data:{variation_id:e.variation_id,action:"xstore_get_origin_wishlist_product_variation_id"},method:"POST",success:function(t){a(i,t.variation_id),i.unblock()}})):a(i,e.variation_id))}),C(document).on("reset_data","div.st-swatch-in-loop",function(t){t=C(t.target).closest(".product").find(".xstore-wishlist");t.length&&o(t)}),C(document).on("change",".xstore-wishlist-form .xstore-wishlist-quantity .qty",function(){if(clearTimeout(e),0==C(this).val()){let t=C(this).parents("tr").find("."+h+'[data-action="remove"]');e=setTimeout(function(){t.trigger("click")},1500)}}),s=etTheme.xstore_wishlist.switch_variation_button=function(t,e){-1===y().indexOf(e)?g(t,JSON.parse(t.attr("data-settings")),"remove"):g(t,JSON.parse(t.attr("data-settings")))},etTheme.xstore_wishlist.force_init_active_wishlist(),C(document).on("xstore_wishlist_fragment_refresh",function(t,e){var i;i=e,C.ajax({url:xstore_wishlist_params.ajaxurl,data:{products:i,products_count:i.length,action:"xstore_wishlist_fragments"},method:"POST",success:function(t){t&&t.fragments&&C.each(t.fragments,function(t,e){C(t).replaceWith(e)}),i.length<1?(C(".et_b_header-wishlist").find(".product_list-popup-footer-wrapper").hide(),m&&c&&C.ajax({url:xstore_wishlist_params.ajaxurl,data:{action:"xstore_empty_wishlist_page"},method:"POST",success:function(t){t&&t.page_content&&(C(document).find("form.xstore-wishlist-form").replaceWith(t.page_content),C(document).find(".xstore-wishlist-share").remove())}})):C(".et_b_header-wishlist").find(".product_list-popup-footer-wrapper").attr("style",null),C(document).trigger("xstore_wishlist_fragment_refreshed",[i])}})}))}}(jQuery);