!function(t){"use strict";function a(a){a.find('*[data-filter="yes"]').each(function(){const a=t(this);t(".tab-option").off("click").on("click",function(){const a=t(this).data("grid-column");var o;localStorage.setItem("usk_grid_data",a),(o=t(this)).closest(".usk-grid-header").find("li").removeClass("usk-tabs-active"),o.parent().addClass("usk-tabs-active"),function(t,a){const o="usk-list-2"!==a?"usk-grid usk-grid-layout":"usk-grid usk-list-layout";t.closest(".usk-grid-header").parent().find(".usk-grid").removeClass().addClass(o+" "+a)}(t(this),a)}),function(a){const o=localStorage.getItem("usk_grid_data");if(o){const e=t("[data-grid-column='"+o+"']");if(e.length){e.parent().addClass("usk-tabs-active");const t="usk-list-2"!==o?"usk-grid usk-grid-layout":"usk-grid usk-list-layout";a.find(".usk-grid").removeClass().addClass(t+" "+o)}}}(a)})}t(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/usk-shiny-grid.default",a),elementorFrontend.hooks.addAction("frontend/element_ready/usk-glossy-grid.default",a),elementorFrontend.hooks.addAction("frontend/element_ready/usk-florence-grid.default",a),t(document.body).off("click.uskVariationAddToCart",".usk-button.product_type_variation.add_to_cart_button"),t(document.body).off("click",".add_to_cart_button"),t(".usk-button.product_type_variation.add_to_cart_button").each(function(){t(this).attr("href","javascript:void(0)"),t(this).attr("data-prevent_redirect","true")}),t(document.body).on("click.uskVariationAddToCart",".usk-button.product_type_variation.add_to_cart_button",function(a){a.preventDefault(),a.stopPropagation(),a.stopImmediatePropagation();const o=t(this);o.attr("href","javascript:void(0)");const e=o.data("product_id"),r=o.data("variation_id");if(!e||!r)return console.log("Missing product ID or variation ID"),!1;const n={product_id:e,variation_id:r,quantity:1};return t.each(o[0].attributes,function(t,a){if(a.name.startsWith("data-attribute_")){const t=a.name.substring(5);n[t]=a.value}}),o.addClass("loading"),t.ajax({type:"POST",url:usk_ajax_config.ajax_url,data:{action:"usk_add_to_cart",nonce:usk_ajax_config.nonce,...n},success:function(a){if(o.removeClass("loading"),a.success){a.fragments&&t.each(a.fragments,function(a,o){t(a).replaceWith(o)}),t(document.body).trigger("wc_fragment_refresh"),t(document.body).trigger("added_to_cart",[a.fragments,a.cart_hash,o]);const e=t('<div class="usk-cart-success-message">Product added to cart! ✓</div>');o.closest(".usk-item").append(e),setTimeout(function(){e.fadeOut(300,function(){t(this).remove()})},2e3)}else console.error("Error adding to cart:",a),alert(a.message||"Error adding product to cart")},error:function(){o.removeClass("loading"),alert("Error occurred while adding to cart. Please try again.")},complete:function(){o.attr("href","javascript:void(0)")}}),!1}),t(document.body).on("wc_fragments_refreshed wc_fragments_loaded added_to_cart",function(){t(".usk-button.product_type_variation.add_to_cart_button").each(function(){t(this).attr("href","javascript:void(0)"),t(this).attr("data-prevent_redirect","true")})})})}(jQuery,window.elementorFrontend);