(()=>{"use strict";var e={20:(e,t,o)=>{var r=o(609),s=Symbol.for("react.element"),n=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function i(e,t,o){var r,i={},p=null,d=null;for(r in void 0!==o&&(p=""+o),void 0!==t.key&&(p=""+t.key),void 0!==t.ref&&(d=t.ref),t)n.call(t,r)&&!c.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:s,type:e,key:p,ref:d,props:i,_owner:a.current}}t.jsx=i,t.jsxs=i},609:e=>{e.exports=window.React},848:(e,t,o)=>{e.exports=o(20)}},t={};const o=window.wp.element,r=window.wc.wcBlocksRegistry,s=window.wc.blocksCheckout,n=window.wp.htmlEntities,a=window.wc.wcSettings,c="mercadopago_blocks_update_cart";var i=function o(r){var s=t[r];if(void 0!==s)return s.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.exports}(848);const p=({text:e,imgSrc:t,id:o})=>(0,i.jsxs)("div",{id:o,className:"row-image-select",children:[(0,i.jsx)("img",{src:t}),(0,i.jsx)("span",{children:e})]});var d;const u="mp_checkout_blocks",l="woo-mercado-pago-credits",m=(0,a.getSetting)("woo-mercado-pago-credits_data",{}),_=(0,n.decodeEntities)(m.title)||"Checkout Credits",w=()=>{const e=(0,n.decodeEntities)(m?.params?.fee_title||""),t=`${_} ${e}`;return(0,i.jsx)(p,{text:t,imgSrc:m.params.icon})},y=e=>((e=>{const{eventRegistration:t,emitResponse:r}=e,{onPaymentSetup:n,onCheckoutSuccess:a,onCheckoutFail:i}=t;(0,o.useEffect)((()=>{((e,t)=>{e({namespace:c,data:{action:"add",gateway:t}})})(s.extensionCartUpdate,l);const e=n((()=>({type:r.responseTypes.SUCCESS,meta:{paymentMethodData:{...window.mpHiddenInputDataFromBlocksCheckout}}})));return()=>(((e,t)=>{e({namespace:c,data:{action:"remove",gateway:t}})})(s.extensionCartUpdate,l),e())}),[n]),(0,o.useEffect)((()=>{const e=a((async e=>{const t=e.processingResponse;return sendMetric("MP_CREDITS_BLOCKS_SUCCESS",t.paymentStatus,u),{type:r.responseTypes.SUCCESS}}));return()=>e()}),[a]),(0,o.useEffect)((()=>{const e=i((e=>{"undefined"!=typeof MPCheckoutErrorDispatcher&&MPCheckoutErrorDispatcher.dispatchEventWhenBlocksCheckoutErrorOccurred(e);const t=e.processingResponse;return sendMetric("MP_CREDITS_BLOCKS_ERROR",t.paymentStatus,u),{type:r.responseTypes.FAIL,messageContext:r.noticeContexts.PAYMENTS}}));return()=>e()}),[i])})(e),(0,i.jsx)("div",{dangerouslySetInnerHTML:{__html:m.params.content}})),S={name:l,label:(0,i.jsx)(w,{}),content:(0,i.jsx)(y,{}),edit:(0,i.jsx)(y,{}),canMakePayment:()=>!0,ariaLabel:_,supports:{features:null!==(d=m?.supports)&&void 0!==d?d:[]}};(0,r.registerPaymentMethod)(S)})();