var PronamicPayWooCommerce;(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{registerMethod:()=>p});const n=window.wc.wcBlocksRegistry,o=window.wc.wcSettings,i=window.wp.htmlEntities,r=window.wp.element,s=window.wp.components,d=window.ReactJSXRuntime,a=e=>e.text,c=({description:e,fields:t,eventRegistration:n})=>{const{onPaymentProcessing:o}=n,[i,a]=(0,r.useState)();function c(e){if(void 0===i||!i.hasOwnProperty(e.id)){let t;if(e.hasOwnProperty("options")&&e.options.length>0){let[n]=e.options;t=n.value}a(n=>({...n,[e.id]:t}))}switch(e.type){case"select":return(0,d.jsx)(s.SelectControl,{id:e.id,options:e.options,onChange:t=>a(n=>({...n,[e.id]:t}))});case"date":return(0,d.jsx)(s.TextControl,{id:e.id,name:e.id,type:"date",onChange:t=>a(n=>({...n,[e.id]:t}))})}}function l(e){if(e.error)return(0,d.jsx)("div",{children:e.error})}return(0,r.useEffect)(()=>o(function(){return{type:"success",meta:{paymentMethodData:i}}}),[o,i]),(0,d.jsx)(d.Fragment,{children:(""!==e||t.length>0)&&(0,d.jsxs)("div",{children:[""!==e&&(0,d.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}),t.map(e=>(0,d.jsx)("div",{children:(0,d.jsxs)(s.BaseControl,{id:e.id,label:e.label,children:[c(e),l(e)]})},e.id))]})})},l=e=>{const{PaymentMethodLabel:t}=e.components;return(0,d.jsxs)(d.Fragment,{children:[""!==e.icon&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("img",{src:e.icon})," "]}),""!==e.title&&(0,d.jsx)(t,{text:(0,i.decodeEntities)(e.title)})]})};function p(e){const t=(0,o.getSetting)(e+"_data",!1);if(!1===t)return;const r=t.title||"",s=t.description||"";(0,n.registerPaymentMethod)({name:e,label:(0,d.jsx)(l,{title:r,icon:t.icon}),ariaLabel:(0,i.decodeEntities)(r),content:(0,d.jsx)(c,{description:s,fields:t.fields}),edit:(0,d.jsx)(a,{text:s}),placeOrderButtonLabel:t.orderButtonLabel||"",supports:{features:t?.supports||["products"]},canMakePayment:()=>!0})}PronamicPayWooCommerce=t})();