(()=>{"use strict";const e=window.wp.element,t=window?.wc?.wcSettings?.getSetting("acceptblue-ach_data",{}),n=window?.wp?.htmlEntities?.decodeEntities(t.title)||window?.wp?.i18n.__("ACH/Check","acceptblue-ach"),a=function(t){const[n,a]=(0,e.useState)(""),[r,c]=(0,e.useState)(""),[o,u]=(0,e.useState)(!1),[s,l]=(0,e.useState)(""),[i,m]=(0,e.useState)([]),[p,d]=(0,e.useState)([]),{eventRegistration:w,emitResponse:b}=t,{onPaymentSetup:E,onCheckoutValidation:g}=w,h=e=>"string"!=typeof e||0===e.trim().length;return(0,e.useEffect)((()=>{const e=g((async function(){(h(n)||h(r))&&(l("Error. All fields in ACH/Check form is required."),u(!0)),h(n)||h(r)||(l(""),u(!1))}));return()=>e}),[n,r]),(0,e.useEffect)((()=>{const e=E((async function(){return o?{type:b.responseTypes.ERROR,message:s}:{type:b.responseTypes.SUCCESS,meta:{paymentMethodData:{"routing-number":n,"account-number":r}}}}));return()=>e()}),[b.responseTypes.ERROR,b.responseTypes.SUCCESS,E,n,r,o,s]),(0,e.useEffect)((()=>{window.dispatchEvent(new CustomEvent("pgabfw-renderFooterComponentsACH",{detail:{setComponent:e=>m([...i,e])}})),window.dispatchEvent(new CustomEvent("pgabfw-renderHeaderComponentsACH",{detail:{setComponent:e=>d([...p,e])}}))}),[]),(0,e.createElement)("div",{className:"acceptblue-ach-wrap"},p.map((e=>e)),(0,e.createElement)("div",{className:"ab-routing-number-wrap"},(0,e.createElement)("label",{htmlFor:"ab-routing-num"},"Routing Number"),(0,e.createElement)("br",null),(0,e.createElement)("input",{type:"text",name:"routing-number",placeholder:"",onChange:function(e){a(e.target.value)},value:n,id:"ab-routing-num"})),(0,e.createElement)("div",{className:"ab-account-number-wrap"},(0,e.createElement)("label",{htmlFor:"ab-account-num"},"Account Number"),(0,e.createElement)("br",null),(0,e.createElement)("input",{type:"text",name:"account-number",placeholder:"",onChange:function(e){c(e.target.value)},value:r,id:"ab-account-num"})),i.map((e=>e)))},r={name:"acceptblue-ach",label:n,content:(0,e.createElement)(a,null),edit:(0,e.createElement)(a,null),canMakePayment:()=>!0,ariaLabel:n,supports:{features:t.supports}};window.wc.wcBlocksRegistry.registerPaymentMethod(r)})();