!function(t){"use strict";function e(t,c){var a=(t=t.find(".minimog-shoppable-image")).data("tag_type"),s=c(".mabel-siwc-img-wrapper",t),t=s.data("sw-icon"),e=s.data("sw-tags"),n=s.data("sw-text"),o=s.data("sw-size"),r='<i class="'+t+'"></i>';c(document.body).on("click",function(t){c(t.target).is(".mb-siwc-tag")||c(t.target).parents(".mb-siwc-tag").length||c(t.target).is(".mb-siwc-popup-inner")||c(t.target).parents(".mb-siwc-popup-inner").length||c(".mb-siwc-tag",this).removeClass("active").next().addClass("mabel-invisible")}),c.each(e,function(t,e){"numeric"===a&&(r=(t+1).toFixed(0));var t=e.thumb?'<img src="'+e.thumb+'" alt="'+e.title+'"/>':"",t='<div class="mb-siwc-popup-inner"><div class="siwc-thumb-wrapper"><a target="_blank" href="'+e.link+'">'+t+'</a></div><div class="siwc-content-wrapper"><h3 class="product-title"><a target="_blank" href="'+e.link+'">'+e.title+'</a></h3><p class="price">'+e.price+'</p><a target="_blank" class="product-link" href="'+e.link+'">'+n+"</a></div></div>",t=(c('<span class="mb-siwc-tag">'+r+"</span>").css({top:e.posY+"%",left:e.posX+"%"}).on("click",function(t){t.preventDefault();var t=c(t.currentTarget),e=s.find(".mb-siwc-tag");t.toggleClass("active"),e.not(t).removeClass("active"),e.not(t).next().addClass("mabel-invisible"),t.next().toggleClass("mabel-invisible")}).appendTo(s),c(t)),i=c('<div class="mb-siwc-popup mabel-invisible">');e.thumb||i.addClass("siwc-no-thumb"),i.append(t).appendTo(s).css({top:e.posY+"%",left:e.posX+"%",marginLeft:-i.width()/2,marginTop:o/2+7}),c(window).on("resize",function(){var t=function(t,e,i,a){null==(a=void 0===a?null:a)&&(a=c(document.body));var s=i.height(),i=i.width(),n=a.height(),a=a.width(),o=i/a*100,r=a*t/100,e=100<e+s/n*100?"top":"bottom";100<t+o&&i<r?e+=" left":t-o<0&&i<a-r&&(e+=" right");return e}(e.posX,e.posY,i,s);if("bottom"!=t)switch(t){case"top":i.css({marginTop:-1*(i.height()+o/2+7)});break;case"top left":i.css({marginTop:-1*(i.height()+o/2),marginLeft:-1*(i.width()+o/2)});break;case"top right":i.css({marginTop:-1*(i.height()+o/2),marginLeft:o/2});break;case"bottom left":i.css({marginTop:o/2,marginLeft:-1*(i.width()+o/2)});break;case"bottom right":i.css({marginTop:o/2,marginLeft:o/2})}i.addClass("mb-siwc-"+t.replace(" ","-"))}).trigger("resize")})}t(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/tm-shoppable-image.default",e)})}(jQuery);