1function f(t){const i=t.querySelector(".checkout_coupon"),r=t.querySelector("#coupon_code"),s=t.querySelector('button[name="apply_coupon"]'),a=()=>{var e=jQuery("#coupon_code");e.length!==0&&e.removeClass("has-error").removeAttr("aria-invalid").removeAttr("aria-describedby").parent().next(".coupon-error-notice").remove()},m=()=>{jQuery("#coupon_code").val("").removeClass("has-error").removeAttr("aria-invalid").removeAttr("aria-describedby").parent().next(".coupon-error-notice").remove()},y=e=>{const c=jQuery(r.parentElement);a();var o=jQuery(jQuery.parseHTML(e)).text().trim();o!==""&&(c.find("#coupon_code").focus().addClass("has-error").attr("aria-invalid","true").attr("aria-describedby","coupon-error-notice"),jQuery("<span>",{class:"coupon-error-notice",id:"coupon-error-notice",role:"alert",text:o}).appendTo(c.parent()))},u=e=>{e.preventDefault(),a();const c=r.value.trim(),o=jQuery(i);o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var l={security:FlyntData.apply_coupon_nonce,coupon_code:c,billing_email:""};return jQuery.ajax({type:"POST",url:FlyntData.wc_ajax_url.toString().replace("%%endpoint%%","apply_coupon"),data:l,success:function(n){if(jQuery(".woocommerce-error, .woocommerce-message, .is-error, .is-success, .checkout-inline-error-message").remove(),o.removeClass("processing").unblock(),n){if(n.indexOf("woocommerce-error")===-1&&n.indexOf("is-error")===-1){m();const d=t.closest("form");d&&jQuery(d).addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),jQuery(".woocommerce-cart-form").length?jQuery(document.body).trigger("wc_update_cart"):jQuery(".woocommerce-checkout").length?jQuery(document.body).trigger("update_checkout"):jQuery(document.body).trigger("wc_fragment_refresh")}else y(n);jQuery(document.body).trigger("applied_coupon_in_checkout",[l.coupon_code])}},dataType:"html"}),!1},p=e=>{e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),u(e)):r.value.trim().length>0&&(a(),i.classList.remove("muted"))};return r.addEventListener("keydown",p),s.addEventListener("click",u),()=>{r.removeEventListener("keyup",p),s.removeEventListener("click",u)}}export{f as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.