(()=>{var e={};document.addEventListener("DOMContentLoaded",(function(t){var i=[],a="",r=[],n=[],l=[],s=give_stripe_vars.preferred_locale,d=document.querySelectorAll(".give-form-wrap");function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=Object.keys(t).length;i>0&&t[0].item,Array.prototype.forEach.call(t,(function(t,i){!1===t.isCardMounted&&(t.item.mount(t.selector+e),t.isCardMounted=!0)}))}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];Array.prototype.forEach.call(e,(function(e,t){!0===e.isCardMounted&&(e.item.unmount(),e.isCardMounted=!1)}))}0!==Object.keys(give_stripe_vars.element_font_styles).length&&l.push(give_stripe_vars.element_font_styles),Array.prototype.forEach.call(d,(function(t){var d=t.querySelector(".give-form");if(null!==d){var c=d.getAttribute("data-publishable-key"),u=d.getAttribute("data-account"),p=d.getAttribute("data-id");if(null!==c){e[p]=Stripe(c),0!==u.trim().length&&(e[p]=Stripe(c,{stripeAccount:u}));var g=e[p].elements({locale:s});l.length>0&&(g=e[p].elements({fonts:l,locale:s})),null!==d.querySelector(".give-gateway:checked")&&(a=d.querySelector(".give-gateway:checked").value);var _=d.querySelector(".give-submit");i=function(e,t,i){var r=[],n=give_stripe_vars.element_base_styles,l=give_stripe_vars.element_complete_styles,s=give_stripe_vars.element_empty_styles,d=give_stripe_vars.element_invalid_styles,o=e.querySelector("#give-stripe-sepa-fields-"+i),v={style:{base:n,complete:l,empty:s,invalid:d},classes:{focus:"focus",empty:"empty",invalid:"invalid"},supportedCountries:["SEPA"]};if("stripe_sepa"===a){var c=o.getAttribute("data-hide_icon"),u=o.getAttribute("data-icon_style"),p=o.getAttribute("data-placeholder_country");v.iconStyle=u,v.hideIcon="disabled"!==c,v.placeholderCountry=p}var g=t.create("iban",v);return r.push(g),r}(d,g,p),n=["#give-stripe-sepa-fields-"],r[p]=[],Array.prototype.forEach.call(n,(function(e,t){r[p][t]=[],r[p][t].item=i[t],r[p][t].selector=e,r[p][t].isCardMounted=!1})),jQuery(document).on("give_gateway_loaded",(function(e,t,i){v(r[p]),"stripe_sepa"===d.querySelector(".give-gateway-option-selected .give-gateway").value&&o(p,r[p])})),"stripe_sepa"===a?(_.setAttribute("disabled","disabled"),o(p,r[p]),_.removeAttribute("disabled")):v(i)}}})),jQuery("body").on("submit",".give-form",(function(t){var i=jQuery(this),a=i.find('input[name="give-form-id-prefix"]').val();"stripe_sepa"===i.find("input.give-gateway:checked").val()&&(!function(t,i){var a={billing_details:{name:"",email:""}},r=t.find('input[name="give-form-id"]').val(),n=t.find('input[name="give-form-id-prefix"]').val(),l=t.find('input[name="give_first"]').val(),s=t.find('input[name="give_last"]').val(),d=t.find('input[name="give_email"]').val(),o=t.find("[id^=give-purchase-button]");if(t.find("[id^=give-purchase-button]").attr("disabled","disabled"),a.billing_details.name=l+" "+s,a.billing_details.email=d,give_stripe_vars.checkout_address&&!give_stripe_vars.stripe_card_update){var v=t.find(".card-address").val(),c=t.find(".card-address-2").val(),u=t.find(".card-city").val(),p=t.find(".card_state").val(),g=t.find(".card-zip").val(),_=t.find(".billing-country").val();a.billing_details.address={line1:v||"",line2:c||"",city:u||"",state:p||"",postal_code:g||"",country:_||""}}e[n].createPaymentMethod("sepa_debit",i,a).then((function(e){if(e.error){var i='<div class="give_errors"><p class="give_error">'.concat(e.error.message,"</p></div>");o.attr("disabled",!1),jQuery(".give-loading-animation").fadeOut(),t.find("[id^=give-stripe-payment-errors-"+r+"]").html(i),give_global_vars.complete_purchase?o.val(give_global_vars.complete_purchase):o.val(o.data("before-validation-label"))}else!function(e,t){e.find('input[name="give_stripe_payment_method"]').val(t.id),e.get(0).submit()}(t,e.paymentMethod)}))}(i,r[a][0].item),t.preventDefault())}))}))})();