// source --> https://easywayhomecare.in/wp-content/plugins/shopengine-pro/modules/quick-checkout/assets/js/script.js?ver=6.9.4 
jQuery((function(t){"use strict";var e=t(".shopengine-single-page-qc-btn"),n=t(".shopengine-quick-checkout-modal"),a=e.siblings(".single_add_to_cart_button"),i=e.siblings('[name="add-to-cart"]'),o=e.parents(".variations_form"),r=t(".shopengine_qc_btn"),c={fadeDuration:250,ifIframe:!0};function s(e){Array.from(e).forEach((e=>{e.addEventListener("click",(function(e){if("undefined"!=typeof window.vacationStatus&&window.vacationStatus)return void e.preventDefault();e.preventDefault();let a=t(this).siblings(".add_to_cart_button").attr("data-product_id");var i="?";window.wc_add_to_cart_params&&wc_add_to_cart_params.cart_url.includes("?")&&(i="&");let o=t(this).data("source-url")+`${i}add-to-cart=`+a+"&nonce="+shopEngineQuickCheckout.rest_nonce+"&shopengine_quick_checkout=modal-content&quantity=1";n.html('<iframe src="'+o+'"></iframe>').modal(c)}))}))}o.on("woocommerce_variation_has_changed",(function(){e.toggleClass("disabled",a.hasClass("disabled"))})).on("hide_variation",(function(){e.toggleClass("disabled",!0)})),(Array.from(r).length>0&&"redirect"!==t(r[0]).attr("data-checkout")&&!t(".shopengine-single-page-qc-btn")||Array.from(r).length>0&&"redirect"!==t(r[0]).attr("data-checkout")&&t(".shopengine-single-page-qc-btn"))&&s(r),"redirect"!==e.attr("data-checkout-single")&&e.on("click",(function(e){e.preventDefault();var o=t(this);if(o.hasClass("disabled"))a.trigger("click");else{var r="?";window.wc_add_to_cart_params&&wc_add_to_cart_params.cart_url.includes("?")&&(r="&");var s=o.parents("form.cart").serialize(),l=i.val(),d=o.data("source-url")+`${r}add-to-cart=`+l+"&nonce="+shopEngineQuickCheckout.rest_nonce+"&"+s;n.html('<iframe src="'+d+'"></iframe>').modal(c)}})),t("body").on("click",".se-close-modal",(function(t){t.preventDefault(),n.modal("hide"),n.html("")})),"redirect"===e.attr("data-checkout-single")&&(t(".variations_form").on("found_variation",(function(e,n){let a=n?.variation_id;a&&t(".shopengine-quick-checkout-button.shopengine-single-page-qc-btn").off("click").on("click",(function(e){if(e.preventDefault(),t(".pre-order-closed-message:visible").length)return void alert("Sorry, this product is unavailable. Please choose a different combination.");let n=t('input[name="quantity"]').val()||1,i=e.currentTarget.href+"&variation_id="+a+"&quantity="+n;t(".variations_form .variations select").each((function(){let e=t(this).attr("name"),n=t(this).val();n&&(i+="&"+encodeURIComponent(e)+"="+encodeURIComponent(n))})),window.location.href=i}))})),t(document).on("click",".shopengine-quick-checkout-button.shopengine-single-page-qc-btn",(function(e){if(t(".single-product").length&&!t(".variations_form").length){e.preventDefault();let n=t('input[name="quantity"]').val()||1,a=t(this).attr("href")+"&quantity="+n;window.location.href=a}})))}));