(()=>{"use strict";const e=window.wp.element,t=window.wc.wcSettings.getSetting("wc_etransctions_data",{}).methods,{useState:n,useRef:a,useEffect:c}=wp.element,{sprintf:o}=wp.i18n,s=t=>{const{method:n}=t,{label:a,icon:c}=n;return(0,e.createElement)("span",{className:"wc-block-payment-method__label",style:{width:"100%"}},a,(0,e.createElement)("img",{src:c,alt:a,className:"wc-block-payment-method__image",style:{float:"right",marginRight:"20px"}}))},i=()=>{let t="DEMO";return"0"===wc_etransactions.account_demo_mode&&(t="production"!==wc_etransactions.account_environment&&"TEST"),t?(0,e.createElement)("div",{className:"wce-description-notice wce-notice-warning wce-notice-padding"},(0,e.createElement)("span",null," ",o(wc_etransactions.i18n.environment,t))):""},l=({props:t,paymentMethodData:n,setpaymentMethodData:a})=>{const{eventRegistration:c,emitResponse:o,method:s}=t,{params:i}=s;return"1"===i.one_click_enabled?(0,e.createElement)("div",{className:"wce-one-click-notice wce-notice-padding"},(0,e.createElement)("label",{for:"wce_one_click"},(0,e.createElement)("input",{type:"checkbox",name:"wce_one_click",id:"wce_one_click",value:"1",onChange:e=>function(e,t,n,a){let c="0";e.target.checked&&(c="1");const{eventRegistration:o,emitResponse:s,method:i}=t,{onPaymentSetup:l}=o;n.wce_one_click=c,a(n),l((async()=>({type:s.responseTypes.SUCCESS,meta:{paymentMethodData:n}})))}(e,t,n,a)}),(0,e.createElement)("span",null,wc_etransactions.i18n.oneClick))):""},m=t=>{const[a,c]=n({});return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(i,null),(0,e.createElement)(l,{props:t,paymentMethodData:a,setpaymentMethodData:c}))};t.forEach((t=>{const n={name:t.name,label:(0,e.createElement)(s,{method:t}),content:(0,e.createElement)(m,{method:t}),edit:(0,e.createElement)(m,{method:t}),canMakePayment:()=>!0,ariaLabel:t.label,supports:{}};window.wc.wcBlocksRegistry.registerPaymentMethod(n)}))})();