(()=>{"use strict";var e,a={726(){const e=window.wc.wcBlocksRegistry,a=window.wc.wcSettings,t=window.wp.htmlEntities,s=window.wp.i18n,n=window.wp.element,o=window.ReactJSXRuntime;window.wc.blocksComponents,["woo_bkash","woo_rocket","woo_nagad","woo_upay"].forEach(r=>{const c=(0,a.getPaymentMethodData)(r);if(window.wcBlockBDPGDebug&&console.log(`BDPG: Registering ${r}`,c),!c)return;const i=e=>((e,a)=>{const{eventRegistration:t,emitResponse:r}=e,{onPaymentSetup:c}=t,[i,l]=(0,n.useState)(""),[d,g]=(0,n.useState)(""),p=a.usd_conversion_enabled&&"USD"===a.store_currency&&a.converted_amount?{original:a.original_amount,converted:a.converted_amount,rate:a.usd_rate}:null;return(0,n.useEffect)(()=>{const e=c(async()=>i?i&&!/^[0-9]+$/.test(i)?{type:r.responseTypes.ERROR,message:(0,s.__)("Please enter a valid account number (numbers only).","bangladeshi-payment-gateways"),messageContext:r.noticeContexts.PAYMENTS}:d?{type:r.responseTypes.SUCCESS,meta:{paymentMethodData:{[`${a.gateway}_acc_no`]:i,[`${a.gateway}_trans_id`]:d}}}:{type:r.responseTypes.ERROR,message:(0,s.__)("Please enter your transaction ID.","bangladeshi-payment-gateways"),messageContext:r.noticeContexts.PAYMENTS}:{type:r.responseTypes.ERROR,message:(0,s.__)("Please enter your account number.","bangladeshi-payment-gateways"),messageContext:r.noticeContexts.PAYMENTS});return()=>e()},[c,i,d,a.gateway]),(0,o.jsxs)("div",{className:"bdpg-payment-method",children:[a.description&&(0,o.jsx)("p",{dangerouslySetInnerHTML:{__html:a.description}}),a.gateway_charge_details&&(0,o.jsx)("p",{dangerouslySetInnerHTML:{__html:a.gateway_charge_details}}),(0,o.jsx)("div",{className:"bdpg-total-amount",children:(0,o.jsxs)("p",{children:[(0,o.jsxs)("strong",{children:[(0,s.__)("You need to send us","bangladeshi-payment-gateways")," "]}),a.formatted_total]})}),p&&a.show_conversion_details&&(0,o.jsx)("div",{className:"bdpg-conversion-info",children:(0,o.jsxs)("small",{children:[(0,s.__)("Converted from ","bangladeshi-payment-gateways"),p.original,(0,s.__)(" at 1 USD = ","bangladeshi-payment-gateways"),p.rate," BDT"]})}),a.accounts&&a.accounts.length>0&&(0,o.jsxs)("div",{className:"bdpg-available-accounts",children:[a.accounts.map((e,a)=>(0,o.jsxs)("div",{className:"bdpg-s__acc",children:[e.qr_code&&(0,o.jsx)("div",{className:"bdpg-acc__qr-code",children:(0,o.jsx)("img",{src:e.qr_code,alt:"QR Code"})}),(0,o.jsxs)("div",{className:"bdpg-acc_d",children:[(0,o.jsxs)("p",{children:[(0,o.jsxs)("strong",{children:[(0,s.__)("Account Type:","bangladeshi-payment-gateways")," "]}),e.type]}),(0,o.jsxs)("p",{children:[(0,o.jsxs)("strong",{children:[(0,s.__)("Account Number:","bangladeshi-payment-gateways")," "]}),e.number]})]})]},a)),(0,o.jsxs)("div",{className:"bdpg-user__acc",children:[(0,o.jsxs)("div",{className:"bdpg-user__field",children:[(0,o.jsx)("label",{htmlFor:`${a.gateway}_acc_no`,children:(0,o.jsx)("strong",{children:(0,s.__)(`Your ${a.gateway} Account Number`,"bangladeshi-payment-gateways")})}),(0,o.jsx)("input",{type:"text",id:`${a.gateway}_acc_no`,className:"wc-block-components-text-input",value:i,onChange:e=>l(e.target.value),placeholder:"01XXXXXXXXX"})]}),(0,o.jsxs)("div",{className:"bdpg-user__field",children:[(0,o.jsx)("label",{htmlFor:`${a.gateway}_trans_id`,children:(0,o.jsx)("strong",{children:(0,s.__)(`Your ${a.gateway} Transaction ID`,"bangladeshi-payment-gateways")})}),(0,o.jsx)("input",{type:"text",id:`${a.gateway}_trans_id`,className:"wc-block-components-text-input",value:d,onChange:e=>g(e.target.value),placeholder:"2M7A5"})]})]})]})]})})(e,c),l=e=>((e,a)=>{const{PaymentMethodLabel:s}=e.components;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s,{text:(0,t.decodeEntities)(a.title||a.gateway)}),a.icon&&(0,o.jsx)("span",{className:"bdpg-gateway-icon",children:(0,o.jsx)("img",{src:a.icon,alt:a.title||a.gateway})})]})})(e,c);(0,e.registerPaymentMethod)({name:r,label:(0,o.jsx)(l,{}),content:(0,o.jsx)(i,{}),edit:(0,o.jsx)(i,{}),canMakePayment:()=>!0,ariaLabel:(0,t.decodeEntities)(c.title||r),supports:{features:c.supports||["products"]}})})}},t={};function s(e){var n=t[e];if(void 0!==n)return n.exports;var o=t[e]={exports:{}};return a[e](o,o.exports,s),o.exports}s.m=a,e=[],s.O=(a,t,n,o)=>{if(!t){var r=1/0;for(d=0;d=o)&&Object.keys(s.O).every(e=>s.O[e](t[i]))?t.splice(i--,1):(c=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[t,n,o]},s.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={849:0,474:0};s.O.j=a=>0===e[a];var a=(a,t)=>{var n,o,[r,c,i]=t,l=0;if(r.some(a=>0!==e[a])){for(n in c)s.o(c,n)&&(s.m[n]=c[n]);if(i)var d=i(s)}for(a&&a(t);ls(726));n=s.O(n)})();