(()=>{var t,n;window.shiptastic=window.shiptastic||{},window.shiptastic.returns=window.shiptastic.returns||{},t=jQuery,(n=window.shiptastic).returns={params:{},init:function(){var i=n.returns;i.params=wc_shiptastic_returns_params,t(document).on("change","#add_return_shipment input.return-item-checkbox, #add_return_shipment input.qty",i.onChangeReturnForm)},onChangeReturnForm:function(){var i=n.returns,e=t(this).parents("form"),s=e.find(".wc-shiptastic-error-wrapper"),a=e.find(".button[type=submit]"),r=e.serialize();return s.find(".notice").remove(),e.addClass("loading"),e.find(":input:not(.disabled):not([type=hidden])").prop("disabled",!0),a.prop("disabled",!0).addClass("loading"),e.find(".return-shipment-costs").hide(),t.ajax({type:"POST",url:i.params.wc_ajax_url.toString().replace("%%endpoint%%","woocommerce_stc_calculate_return_costs"),data:r,dataType:"json"}).done((function(t){e.removeClass("loading"),e.find(":input:not(.disabled):not([type=hidden])").prop("disabled",!1),a.prop("disabled",!1).removeClass("loading"),e.find(".return-shipment-costs").html(t.cost_i18n).show()})).fail((function(n){e.removeClass("loading"),e.find(":input:not(.disabled):not([type=hidden])").prop("disabled",!1),a.prop("disabled",!1).removeClass("loading");try{var i=JSON.parse(n.responseText)}catch(t){i={}}t.each(i.data,(function(t,n){s.append('<p class="woocommerce-error notice">'+n.message+"</p>")})),s[0].scrollIntoView({behavior:"smooth",block:"start"})})),!1}},t(document).ready((function(){n.returns.init()})),((window.wcShiptastic=window.wcShiptastic||{}).static=window.wcShiptastic.static||{}).returns={}})();