jQuery(document).ready((e=>{const o=e("form.checkout");let t,r=!1;const a=e(document.body);let c=null;function s(a){const d=o.find("#billing_email").val();let i="";a&&""!==a?(t=o.find("input[type=submit],button,.autopay-blik-code").prop("disabled",!0).hide(),void 0!==d&&(i=`&order_email=${d}`),e.ajax({type:"POST",url:woocommerce_params.wc_ajax_url.replace("%%endpoint%%","wppay_refresh_blik_order_status"),data:`blik_code=${a}&order_id=${c}${i}`,dataType:"json",success(o){o&&("error"===o.type&&(t.prop("disabled",!1).show(),alert(o.msg)),"pending"===o.type&&(function(o){e("#blik_msg_container").html(o)}(o.msg),setTimeout((()=>{s(a)}),1500)),"success"===o.type&&(r=!0,window.location.href=o.redirect))}})):alert("Proszę wprowadzić kod BLIK")}a.on("checkout_error",(o=>{c=parseInt(jQuery("#autopay_blik_orderId").html()),c&&(s(e("input[name=blik_code]").val()),(a.hasClass("woocommerce-checkout")||a.hasClass("woocommerce-cart"))&&e("html, body").stop())}))}));