!function(t){"use strict";var n="drop_print_live_postage",e=/\(estimated\)\s*$/i,i=/no shipping options are available/i;function r(){var n=t("#shipping-option, .wc-block-components-shipping-rates-control").first();if(n.length)return n;var e=t("ul.woocommerce-shipping-methods").first();if(e.length){var i=e.closest("tr.shipping, .woocommerce-shipping-totals");return i.length?i:e}return t()}function o(t){return t.find('input[type="radio"]').filter(function(){return-1!==((this.value||"")+(this.id||"")).indexOf(n)})}function a(n){var e=t(n).closest("label");if(!e.length)return"";var i=e.find(".wc-block-components-radio-control__label").first();return(i.length?i.text():e.text())||""}function c(t){return o(t).filter(function(){return this.checked}).get(0)}function s(n){var r=t(".wc-block-components-checkout-place-order-button, #place_order").first();if(r.length){var s,d,p=!!window.dropPrintHasItems&&0===o(n).length,u=p||function(t){var n=c(t);return!!n&&e.test(a(n))}(n);if(r.prop("disabled",u),r.attr("aria-disabled",u?"true":"false"),r.toggleClass("drop-print-tier-place-order-waiting",u),u){var l=p&&function(t){return t.find(".wc-block-components-shipping-rates-control__no-results-notice").length>0||i.test(t.text())}(n),f=l?"Shipping unavailable":"Updating shipping rate…";r.attr("data-dp-blocked-text",(s=f,"string"==typeof(d=window["dropPrintPlaceOrderBlockedText"])&&""!==d?d:s))}else r.removeAttr("data-dp-blocked-text")}}function d(t,n){t&&t.length&&t.toggleClass("drop-print-tier-loading",!!n)}var p=!1;var u=!1;function l(){var n=r();n.length&&(s(n),function(t){if(!p){var n=c(t);if(n&&(p=!0,e.test(a(n)))){var i=window.wp&&window.wp.data;if(i&&i.dispatch){var r=i.dispatch("wc/store/cart");if(r&&"function"==typeof r.selectShippingRate){var o=0,s=/^radio-control-(\d+)-/.exec(n.id||"");s&&(o=parseInt(s[1],10)),d(t,!0),window.setTimeout(function(){d(t,!1)},12e3),r.selectShippingRate(n.value,o)}}}}}(n),function(){if(!u&&window.dropPrintHasItems){var n=window.dropPrintWarmTiers;n&&n.url&&(u=!0,t.post(n.url,{action:"drop_print_warm_shipping_tiers",nonce:n.nonce}).done(function(t){if(t&&t.success&&t.data&&t.data.warmed){var n=window.wp&&window.wp.data;if(n&&n.dispatch){var e=n.dispatch("wc/store/cart");e&&"function"==typeof e.invalidateResolutionForStoreSelector&&e.invalidateResolutionForStoreSelector("getCartData")}}}))}}())}function f(){var t=r();t.length&&window.MutationObserver&&(f.current&&f.current.disconnect(),f.current=new MutationObserver(function(){d(t,!1),l()}),f.current.observe(t.get(0),{childList:!0,subtree:!0,characterData:!0}))}t(document.body).on("click",'input[type="radio"]',function(){var e=t(this);if(-1!==((e.val()||"")+(e.attr("id")||"")).indexOf(n)){var i=r();d(i,!0),window.setTimeout(function(){d(i,!1)},12e3)}}),t(document.body).on("updated_checkout",function(){d(r(),!1),l()}),t(function(){l(),f(),window.setTimeout(l,800),window.setTimeout(function(){l(),f()},2e3)})}(jQuery);