'+r.messages+""):n.prepend(r),n.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur"),o.scroll_to_notices()}o.init_payment_methods(),r&&"success"===r.result&&t.current_target&&-1!==t.current_target.id.indexOf("shipping_method")&&document.getElementById(t.current_target.id).focus(),e(document.body).trigger("updated_checkout",[r])}}})}},handleUnloadEvent:function(e){return-1===navigator.userAgent.indexOf("MSIE")&&!document.documentMode||(e.preventDefault(),undefined)},attachUnloadEventsOnSubmit:function(){e(window).on("beforeunload",this.handleUnloadEvent)},detachUnloadEventsOnSubmit:function(){e(window).off("beforeunload",this.handleUnloadEvent)},blockOnSubmit:function(e){1!==e.data("blockUI.isBlocked")&&e.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},submitOrder:function(){o.blockOnSubmit(e(this))},submit:function(){o.reset_update_checkout_timer();var t=e(this);return!t.is(".processing")&&(!1!==t.triggerHandler("checkout_place_order",[o])&&!1!==t.triggerHandler("checkout_place_order_"+o.get_payment_method(),[o])&&(t.addClass("processing"),o.blockOnSubmit(t),o.attachUnloadEventsOnSubmit(),e.ajaxSetup({dataFilter:function(e,t){if("json"!==t)return e;if(o.is_valid_json(e))return e;var r=e.match(/{"result.*}/);return null===r?console.log("Unable to fix malformed JSON #1"):o.is_valid_json(r[0])?(console.log("Fixed malformed JSON. Original:"),console.log(e),e=r[0]):console.log("Unable to fix malformed JSON #2"),e}}),e.ajax({type:"POST",url:wc_checkout_params.checkout_url,data:t.serialize(),dataType:"json",success:function(r){o.detachUnloadEventsOnSubmit(),e(".checkout-inline-error-message").remove();try{if("success"!==r.result||!1===t.triggerHandler("checkout_place_order_success",[r,o]))throw"failure"===r.result?"Result failure":"Invalid response";-1===r.redirect.indexOf("https://")||-1===r.redirect.indexOf("http://")?window.location=r.redirect:window.location=decodeURI(r.redirect)}catch(a){if(!0===r.reload)return void window.location.reload();if(!0===r.refresh&&e(document.body).trigger("update_checkout"),r.messages){var i=e(r.messages).removeAttr("role").attr("tabindex","-1"),c=o.wrapMessagesInsideLink(i),n=e('').append(c);o.submit_error(n.prop("outerHTML")),o.show_inline_errors(i)}else o.submit_error(''+wc_checkout_params.i18n_checkout_error+"
")}},error:function(e,t,r){o.detachUnloadEventsOnSubmit();var i=r;"object"==typeof wc_checkout_params&&null!==wc_checkout_params&&wc_checkout_params.hasOwnProperty("i18n_checkout_error")&&"string"==typeof wc_checkout_params.i18n_checkout_error&&""!==wc_checkout_params.i18n_checkout_error.trim()&&(i=wc_checkout_params.i18n_checkout_error),o.submit_error(''+i+"
")}})),!1)},submit_error:function(t){e(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message, .is-error, .is-success").remove(),o.$checkout_form.prepend(''+t+"
"),o.$checkout_form.removeClass("processing").unblock(),o.$checkout_form.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur"),o.scroll_to_notices(),o.$checkout_form.find('.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]').focus(),e(document.body).trigger("checkout_error",[t])},wrapMessagesInsideLink:function(o){return o.find("li[data-id]").each(function(){const o=e(this),t=o.attr("data-id");if(t){const r=e("",{href:"#"+t,html:o.html()});o.empty().append(r)}}),o},show_inline_errors:function(o){o.find("li[data-id]").each(function(){const o=e(this),t=o.attr("data-id"),r=e("#"+t);if(1===r.length){const e=t+"_description",i=o.text().trim(),c=r.closest(".form-row"),n=document.createElement("p");n.id=e,n.className="checkout-inline-error-message",n.textContent=i,c&&n.textContent.length>0&&c.append(n),r.attr("aria-describedby",e),r.attr("aria-invalid","true")}})},scroll_to_notices:function(){var o=e(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");o.length||(o=e("form.checkout")),e.scroll_to_notices(o)}},t={init:function(){e(document.body).on("click","a.showcoupon",this.show_coupon_form),e(document.body).on("click",".woocommerce-remove-coupon",this.remove_coupon),e(document.body).on("keydown",".woocommerce-remove-coupon",this.on_keydown_remove_coupon),e(document.body).on("change input","#coupon_code",this.remove_coupon_error),e("form.checkout_coupon").hide().on("submit",this.submit.bind(this))},show_coupon_form:function(){var o=e(this);return e(".checkout_coupon").slideToggle(400,function(){var t=e(this);t.is(":visible")?(o.attr("aria-expanded","true"),t.find(":input:eq(0)").trigger("focus")):o.attr("aria-expanded","false")}),!1},show_coupon_error:function(o,t){if(0!==t.length){this.remove_coupon_error();var r=e(e.parseHTML(o)).text().trim();""!==r&&(t.find("#coupon_code").focus().addClass("has-error").attr("aria-invalid","true").attr("aria-describedby","coupon-error-notice"),e("",{"class":"coupon-error-notice",id:"coupon-error-notice",role:"alert",text:r}).appendTo(t))}},remove_coupon_error:function(){var o=e("#coupon_code");0!==o.length&&o.removeClass("has-error").removeAttr("aria-invalid").removeAttr("aria-describedby").next(".coupon-error-notice").remove()},clear_coupon_input:function(){e("#coupon_code").val("").removeClass("has-error").removeAttr("aria-invalid").removeAttr("aria-describedby").next(".coupon-error-notice").remove()},submit:function(t){var r=e(t.currentTarget),i=r.find("#coupon_code"),c=this;if(c.remove_coupon_error(),r.is(".processing"))return!1;r.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var n={security:wc_checkout_params.apply_coupon_nonce,coupon_code:r.find('input[name="coupon_code"]').val(),billing_email:o.$checkout_form.find('input[name="billing_email"]').val()};return e.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","apply_coupon"),data:n,success:function(o){e(".woocommerce-error, .woocommerce-message, .is-error, .is-success, .checkout-inline-error-message").remove(),r.removeClass("processing").unblock(),o&&(-1===o.indexOf("woocommerce-error")&&-1===o.indexOf("is-error")?(r.slideUp(400,function(){e("a.showcoupon").attr("aria-expanded","false"),r.before(o)}),c.clear_coupon_input()):c.show_coupon_error(o,i.parent()),e(document.body).trigger("applied_coupon_in_checkout",[n.coupon_code]),e(document.body).trigger("update_checkout",{update_shipping_method:!1}))},dataType:"html"}),!1},remove_coupon:function(o){o.preventDefault();var r=e(this).parents(".woocommerce-checkout-review-order"),i=e(this).data("coupon");r.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var c={security:wc_checkout_params.remove_coupon_nonce,coupon:i};e.ajax({type:"POST",url:wc_checkout_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_coupon"),data:c,success:function(o){e(".woocommerce-error, .woocommerce-message, .is-error, .is-success").remove(),r.removeClass("processing").unblock(),o&&(e("form.woocommerce-checkout").before(o),e(document.body).trigger("removed_coupon_in_checkout",[c.coupon]),e(document.body).trigger("update_checkout",{update_shipping_method:!1}),t.clear_coupon_input(),e("form.checkout_coupon").slideUp(400,function(){e("a.showcoupon").attr("aria-expanded","false")}))},error:function(e){wc_checkout_params.debug_mode&&console.log(e.responseText)},dataType:"html"})},on_keydown_remove_coupon:function(o){" "===o.key&&(o.preventDefault(),e(this).trigger("click"))}},r={init:function(){e(document.body).on("click","a.showlogin",this.show_login_form)},show_login_form:function(){var o=e("form.login, form.woocommerce-form--login");return o.is(":visible")?o.slideToggle({duration:400}):o.slideToggle({duration:400,complete:function(){o.is(":visible")&&e("html, body").animate({scrollTop:o.offset().top-50},300)}}),!1}},i={init:function(){e(document.body).on("click","a.woocommerce-terms-and-conditions-link",this.toggle_terms)},toggle_terms:function(){if(e(".woocommerce-terms-and-conditions").length)return e(".woocommerce-terms-and-conditions").slideToggle(function(){var o=e(".woocommerce-terms-and-conditions-link");e(".woocommerce-terms-and-conditions").is(":visible")?(o.addClass("woocommerce-terms-and-conditions-link--open"),o.removeClass("woocommerce-terms-and-conditions-link--closed")):(o.removeClass("woocommerce-terms-and-conditions-link--open"),o.addClass("woocommerce-terms-and-conditions-link--closed"))}),!1}};o.init(),t.init(),r.init(),i.init()});;
(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{actions:()=>P,addAction:()=>A,addFilter:()=>m,applyFilters:()=>w,applyFiltersAsync:()=>I,createHooks:()=>h,currentAction:()=>x,currentFilter:()=>T,defaultHooks:()=>f,didAction:()=>j,didFilter:()=>z,doAction:()=>g,doActionAsync:()=>k,doingAction:()=>O,doingFilter:()=>S,filters:()=>Z,hasAction:()=>_,hasFilter:()=>v,removeAction:()=>p,removeAllActions:()=>F,removeAllFilters:()=>b,removeFilter:()=>y});const n=function(t){return"string"!=typeof t||""===t?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(t)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)},r=function(t){return"string"!=typeof t||""===t?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(t)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(t)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)},i=function(t,e){return function(i,o,s,c=10){const l=t[e];if(!r(i))return;if(!n(o))return;if("function"!=typeof s)return void console.error("The hook callback must be a function.");if("number"!=typeof c)return void console.error("If specified, the hook priority must be a number.");const a={callback:s,priority:c,namespace:o};if(l[i]){const t=l[i].handlers;let e;for(e=t.length;e>0&&!(c>=t[e-1].priority);e--);e===t.length?t[e]=a:t.splice(e,0,a),l.__current.forEach((t=>{t.name===i&&t.currentIndex>=e&&t.currentIndex++}))}else l[i]={handlers:[a],runs:0};"hookAdded"!==i&&t.doAction("hookAdded",i,o,s,c)}},o=function(t,e,i=!1){return function(o,s){const c=t[e];if(!r(o))return;if(!i&&!n(s))return;if(!c[o])return 0;let l=0;if(i)l=c[o].handlers.length,c[o]={runs:c[o].runs,handlers:[]};else{const t=c[o].handlers;for(let e=t.length-1;e>=0;e--)t[e].namespace===s&&(t.splice(e,1),l++,c.__current.forEach((t=>{t.name===o&&t.currentIndex>=e&&t.currentIndex--})))}return"hookRemoved"!==o&&t.doAction("hookRemoved",o,s),l}},s=function(t,e){return function(n,r){const i=t[e];return void 0!==r?n in i&&i[n].handlers.some((t=>t.namespace===r)):n in i}},c=function(t,e,n,r){return function(i,...o){const s=t[e];s[i]||(s[i]={handlers:[],runs:0}),s[i].runs++;const c=s[i].handlers;if(!c||!c.length)return n?o[0]:void 0;const l={name:i,currentIndex:0};return(r?async function(){try{s.__current.add(l);let t=n?o[0]:void 0;for(;l.currentIndex0:Array.from(r.__current).some((t=>t.name===n))}},u=function(t,e){return function(n){const i=t[e];if(r(n))return i[n]&&i[n].runs?i[n].runs:0}};class d{constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=i(this,"actions"),this.addFilter=i(this,"filters"),this.removeAction=o(this,"actions"),this.removeFilter=o(this,"filters"),this.hasAction=s(this,"actions"),this.hasFilter=s(this,"filters"),this.removeAllActions=o(this,"actions",!0),this.removeAllFilters=o(this,"filters",!0),this.doAction=c(this,"actions",!1,!1),this.doActionAsync=c(this,"actions",!1,!0),this.applyFilters=c(this,"filters",!0,!1),this.applyFiltersAsync=c(this,"filters",!0,!0),this.currentAction=l(this,"actions"),this.currentFilter=l(this,"filters"),this.doingAction=a(this,"actions"),this.doingFilter=a(this,"filters"),this.didAction=u(this,"actions"),this.didFilter=u(this,"filters")}}const h=function(){return new d},f=h(),{addAction:A,addFilter:m,removeAction:p,removeFilter:y,hasAction:_,hasFilter:v,removeAllActions:F,removeAllFilters:b,doAction:g,doActionAsync:k,applyFilters:w,applyFiltersAsync:I,currentAction:x,currentFilter:T,doingAction:O,doingFilter:S,didAction:j,didFilter:z,actions:P,filters:Z}=f;(window.wp=window.wp||{}).hooks=e})();
//# sourceMappingURL=index.min.js.map;