(()=>{"use strict";(function(){jQuery(document).ready(function(a){let e,t,r,n,o,c,i,u,l;return i=null!=(t=window.sv_wc_payment_gateway_admin_order)?t:{},u=null!=(r=window.woocommerce_admin)?r:{},l=null!=(n=window.woocommerce_admin_meta_boxes)?n:{},e=null!=(o=window.accounting)?o:{},a(".sv-wc-payment-gateway-partial-capture").appendTo("#woocommerce-order-items .inside"),""!==i.has_gift_card&&a("#refund_amount").prop("readonly",!0),a("#woocommerce-order-items").on("click",".wc-square-payment-gateway-capture:not(.disabled)",function(e){return e.preventDefault(),a(this).hasClass("partial-capture")?(a("div.sv-wc-payment-gateway-partial-capture").slideDown(),a("div.wc-order-data-row-toggle").not("div.sv-wc-payment-gateway-partial-capture").slideUp(),a("div.wc-order-totals-items").slideUp()):c()}),a(".sv-wc-payment-gateway-partial-capture").on("change keyup","#capture_amount",function(t){let r;return r=e.unformat(a(this).val(),u.mon_decimal_point),r?a("button.capture-action").removeAttr("disabled"):a("button.capture-action").attr("disabled","disabled"),a("button .capture-amount .amount").text(e.formatMoney(r,{symbol:l.currency_format_symbol,decimal:l.currency_format_decimal_sep,thousand:l.currency_format_thousand_sep,precision:l.currency_format_num_decimals,format:l.currency_format}))}),a(".sv-wc-payment-gateway-partial-capture").on("click",".capture-action",function(e){let t,r;return e.preventDefault(),t=a(".sv-wc-payment-gateway-partial-capture #capture_amount").val(),r=a(".sv-wc-payment-gateway-partial-capture #capture_comment").val(),c(t,r)}),(()=>{const e=a(".square-billing-details-info"),t=a("#_billing_country");t.on("change",function(){""===t.val()?e.show():e.hide()}).trigger("change")})(),c=function(e,t){let r;if(null==e&&(e=""),null==t&&(t=""),confirm(i.capture_ays))return a("#woocommerce-order-items").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),r={action:i.capture_action,nonce:i.capture_nonce,gateway_id:i.gateway_id,order_id:i.order_id,amount:e,comment:t},a.ajax({url:i.ajax_url,data:r}).done(function(a){if(null!=a.data&&null!=a.data.message&&alert(a.data.message),a.success)return location.reload()}).fail(function(){return alert(i.capture_error)}).always(function(){return a("#woocommerce-order-items").unblock()})}})}).call(void 0)})();