!function(){"use strict";var e=window.wp.element,t=window.wp.compose,l=window.wp.hooks,n=window.wp.i18n,a=window.wp.blockEditor,o=window.wp.components;function i({attributes:t,setAttributes:l}){const i=window.stripePaymentElementGatewaySettings,s=t=>(0,e.createInterpolateElement)(t,{a:(0,e.createElement)("a",{href:i.stripeSettingsUrl})}),r=i.defaultAccount,c=t.stripeAccountId,u=!r&&(t.stripeUseGlobalDefault||!t.stripeUseGlobalDefault&&!c),p=s((0,n.__)("All donations are processed through the default account set in the <a>Global settings</a>.","give")),d=(()=>{const t=(0,n.__)("Select an account you would like to use to process donations for this form.","give");return u?(0,e.createElement)(e.Fragment,null,t):s(t+" "+(0,n.__)("You can also add another account in <a>Global settings</a>.","give"))})(),m=[{label:(0,n.__)("Select","give"),value:""},...Object.keys(i.allAccounts).map((e=>({label:i.allAccounts[e].account_name,value:i.allAccounts[e].account_id})))];return(0,e.createElement)(a.InspectorControls,null,(0,e.createElement)(o.PanelBody,{title:(0,n.__)("Stripe Account","give"),className:"givewp-stripe-payment-element__panel",initialOpen:!0},(0,e.createElement)(o.ToggleControl,{label:(0,n.__)("Use global default","give"),checked:t.stripeUseGlobalDefault,onChange:e=>l({stripeUseGlobalDefault:e}),help:p}),!t.stripeUseGlobalDefault&&(0,e.createElement)(o.SelectControl,{label:(0,n.__)("Choose Account","give"),value:t.stripeAccountId,options:m,onChange:e=>l({stripeAccountId:e}),help:d}),u&&(0,e.createElement)(o.Notice,{isDismissible:!1,status:"warning",actions:[{label:(0,n.__)("Connect a Stripe account","give"),url:i.stripeSettingsUrl,variant:"link"}]},(0,e.createElement)("h4",null,(0,n.__)("No default account set","give")),(0,e.createElement)("p",null,(0,n.__)("All donations are processed through the default Stripe account.","give")))))}(0,l.addFilter)("blocks.registerBlockType","givewp/stripe-payment-element",(function(e,t){return"givewp/payment-gateways"===t&&(e.attributes={...e.attributes,stripeUseGlobalDefault:{type:"boolean",default:!0},stripeAccountId:{type:"string",default:""}}),e}));const s=(0,t.createHigherOrderComponent)((t=>l=>((0,e.useEffect)((()=>{l.attributes.hasOwnProperty("stripeUseGlobalDefault")||l.setAttributes({stripeUseGlobalDefault:!0,stripeAccountId:""})}),[]),"givewp/payment-gateways"===l.name?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t,{...l}),(0,e.createElement)(i,{...l})):(0,e.createElement)(t,{...l}))),"withInspectorControl");(0,l.addFilter)("editor.BlockEdit","givewp/stripe-payment-element",s)}();