(function(){var thisForm=false,formID=0,event=false,frmstripe,running=100,elements,isStripeLink=false,linkAuthenticationElementIsComplete=false,stripeLinkElementIsComplete=false,triggerCustomEvent;triggerCustomEvent=function(el,eventName,data){frmFrontForm.triggerCustomEvent(el,eventName,data)};function validateForm(e){thisForm=this;formID=jQuery(thisForm).find('input[name="form_id"]').val();if(shouldProcessForm()){e.preventDefault();event=e;processForm();return}frmFrontForm.submitFormManual(e,thisForm);
return false}function shouldProcessForm(){var ccField;if(formID!=frm_stripe_vars.form_id)return false;if(!currentActionTypeShouldBeProcessed())return false;ccField=jQuery(thisForm).find(".frm-card-element");if(ccField.length&&!ccField.is(":hidden"))return true;return false}function currentActionTypeShouldBeProcessed(){var action=jQuery(thisForm).find('input[name="frm_action"]').val();if("object"!==typeof window.frmProForm||"function"!==typeof window.frmProForm.currentActionTypeShouldBeProcessed)return"create"===
action;return window.frmProForm.currentActionTypeShouldBeProcessed(action,{thisForm:thisForm})}function processForm(){var $form,meta;$form=jQuery(thisForm);$form.addClass("frm_js_validate");if(!validateFormSubmit($form))return;frmFrontForm.showSubmitLoading($form);meta=addName($form);if("object"===typeof window.frmProForm&&"function"===typeof window.frmProForm.addAddressMeta)window.frmProForm.addAddressMeta($form,meta);if(!isStripeLink)return;stripeLinkSubmit($form.get(0),meta)}function stripeLinkSubmit(object,
meta){object.classList.add("frm_trigger_event_on_submit","frm_ajax_submit");object.addEventListener("frmSubmitEvent",confirmPayment);running=0;submitForm();function confirmPayment(event){var params,confirmFunction;if(!checkEventDataForError(event))return;var params,confirmFunction;window.onpageshow=function(event){if(event.persisted||window.performance&&window.performance.getEntriesByType("navigation")[0].type==="back_forward")window.location.reload()};params={elements:elements,confirmParams:{return_url:getReturnUrl()}};
if("object"===typeof window.frmProForm&&"function"===typeof frmProForm.beforeConfirmPayment)params=frmProForm.beforeConfirmPayment(params,meta);confirmFunction=isRecurring()?"confirmSetup":"confirmPayment";frmstripe[confirmFunction](params).then(handleConfirmPromise)}function getReturnUrl(){var url=new URL(frm_stripe_vars.ajax);url.searchParams.append("action","frmstrplinkreturn");return url.toString()}function handleConfirmPromise(result){if(result.error)handleConfirmPaymentError(result.error)}function handleConfirmPaymentError(error){var fieldset,
cardErrors;running--;enableSubmit();fieldset=jQuery(object).find(".frm_form_field");fieldset.removeClass("frm_doing_ajax");object.classList.remove("frm_loading_form");if("card_error"===error.type||"invalid_request_error"===error.type||"form_submit_error"===error.type){cardErrors=object.querySelector(".frm-card-errors");if(cardErrors)cardErrors.textContent=error.message}}function checkEventDataForError(event){var element,error;if(!event.frmData||!event.frmData.content.length||-1===event.frmData.content.indexOf('
0)return;frmFrontForm.submitFormManual(event,thisForm)}function enableSubmit(){if(running>0)return;thisForm.classList.add("frm_loading_form");frmFrontForm.removeSubmitLoading(jQuery(thisForm),"enable",0);triggerCustomEvent(document,"frmStripeLiteEnableSubmit",{form:thisForm})}function getPriceFields(){var priceFields=[];function checkStripeSettingForPriceFields(setting){if(-1!==setting.fields)each(setting.fields,
addFieldDataToPriceFieldsArray)}function addFieldDataToPriceFieldsArray(field){if(isNaN(field))priceFields.push("field_"+field);else priceFields.push(field)}each(getStripeSettings(),checkStripeSettingForPriceFields);return priceFields}function getStripeSettings(){var stripeSettings=[];each(frm_stripe_vars.settings,function(setting){if(-1!==setting.gateways.indexOf("stripe"))stripeSettings.push(setting)});return stripeSettings}function priceChanged(_,field,fieldId){var i,data,price=getPriceFields(),
run=price.indexOf(fieldId)>-1||price.indexOf(field.id)>-1;if(!run)for(i=0;i
3&&xmlHttp.status==200){response=xmlHttp.responseText;if(response!=="")try{response=JSON.parse(response)}catch(error){response=""}success(response)}};xmlHttp.setRequestHeader("X-Requested-With","XMLHttpRequest");xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlHttp.send(params);return xmlHttp}function loadElements(){if(document.getElementsByClassName("frm-card-element").length)maybeLoadStripeLink()}
function maybeLoadStripeLink(){var stripeLinkForm,formId,intentField;stripeLinkForm=document.querySelector("form.frm_stripe_link_form");if(!stripeLinkForm)return false;formId=parseInt(stripeLinkForm.querySelector('input[name="form_id"]').value);intentField=stripeLinkForm.querySelector('input[name="frmintent'+formId+'[]"]');if(!intentField)return false;disableSubmit(stripeLinkForm);loadStripeLinkElements(intentField.value);triggerCustomEvent(document,"frmStripeLiteLoad",{form:stripeLinkForm});return true}
function disableSubmit(form){jQuery(form).find('input[type="submit"],input[type="button"],button[type="submit"]').not(".frm_prev_page").attr("disabled","disabled");triggerCustomEvent(document,"frmStripeLiteDisableSubmit",{form:form})}function loadStripeLinkElements(clientSecret){var cardElement,appearance;cardElement=document.querySelector(".frm-card-element");if(!cardElement)return;appearance={theme:"stripe",variables:{fontSizeBase:frm_stripe_vars.baseFontSize,colorText:maybeAdjustColorForStripe(frm_stripe_vars.appearanceRules[".Input"].color),
colorBackground:maybeAdjustColorForStripe(frm_stripe_vars.appearanceRules[".Input"].backgroundColor),fontSmooth:"auto"},rules:frm_stripe_vars.appearanceRules};elements=frmstripe.elements({clientSecret:clientSecret,appearance:appearance});isStripeLink=true;insertAuthenticationElement(cardElement);insertPaymentElement(cardElement);triggerCustomEvent(document,"frmStripeLiteLoadElements",{cardElement:cardElement})}function maybeAdjustColorForStripe(color){var rgba,hex;if(0!==color.indexOf("rgba"))return color;
rgba=color.replace(/^rgba?\(|\s+|\)$/g,"").split(",");hex="#"+((1<<24)+(parseInt(rgba[0],10)<<16)+(parseInt(rgba[1],10)<<8)+parseInt(rgba[2],10)).toString(16).slice(1);return hex}function insertAuthenticationElement(cardElement){var addAboveCardElement,emailField,authenticationMountTarget,emailInput,cardFieldContainer,defaultEmailValue,authenticationElement;addAboveCardElement=true;emailField=checkForEmailField();authenticationMountTarget=createMountTarget("frm-link-authentication-element");if(false!==
emailField)if("hidden"===emailField.getAttribute("type"))emailInput=emailField;else{addAboveCardElement=false;emailInput=emailField.querySelector("input");replaceEmailField(emailField,emailInput,authenticationMountTarget)}if(addAboveCardElement){cardFieldContainer=cardElement.closest(".frm_form_field");cardFieldContainer.parentNode.insertBefore(authenticationMountTarget,cardFieldContainer);triggerCustomEvent(document,"frmStripeLiteAddAuthElementAboveCardElement",{cardElement:cardElement,cardFieldContainer:cardFieldContainer,
authenticationMountTarget:authenticationMountTarget})}defaultEmailValue=false!==emailField?getSettingFieldValue(emailField):"";authenticationElement=elements.create("linkAuthentication",{defaultValues:{email:defaultEmailValue}});authenticationElement.mount(".frm-link-authentication-element");authenticationElement.on("change",getAuthenticationChangeHandler(cardElement,emailInput))}function getAuthenticationChangeHandler(cardElement,emailInput){function syncEmailInput(emailValue){if("string"===typeof emailValue&&
emailValue.length)emailInput.value=emailValue}return function(event){var form;linkAuthenticationElementIsComplete=event.complete;if(linkAuthenticationElementIsComplete&&"undefined"!==typeof emailInput)syncEmailInput(event.value.email);form=cardElement.closest("form");if("object"===typeof window.frmChatForm&&"function"===typeof frmChatForm.maybeHandleAuthenticationChange&&frmChatForm.maybeHandleAuthenticationChange(form,event.complete))return;if(readyToSubmitStripeLink(form)){thisForm=form;running=
0;enableSubmit()}else disableSubmit(form)}}function replaceEmailField(emailField,emailInput,authenticationMountTarget){var emailLabel;emailField.insertBefore(authenticationMountTarget,emailInput);emailInput.type="hidden";emailLabel=emailField.querySelector(".frm_primary_label");if(emailLabel)emailLabel.style.display="none"}function insertPaymentElement(cardElement){var paymentElement;cardElement.parentNode.insertBefore(createMountTarget("frm-payment-element"),cardElement);paymentElement=elements.create("payment",
{defaultValues:{billingDetails:{name:getFullNameValueDefault(),phone:""}}});paymentElement.mount(".frm-payment-element");paymentElement.on("change",handlePaymentElementChange);function handlePaymentElementChange(event){stripeLinkElementIsComplete=event.complete;toggleButtonsOnPaymentElementChange(cardElement);triggerCustomEvent(document,"frmStripeLitePaymentElementChange",{complete:event.complete})}}function toggleButtonsOnPaymentElementChange(cardElement){var form=cardElement.closest(".frm-show-form");
if("object"===typeof window.frmChatForm&&"function"===typeof frmChatForm.maybeHandlePaymentChange&&frmChatForm.maybeHandlePaymentChange(form,stripeLinkElementIsComplete))return;if(readyToSubmitStripeLink(form)){thisForm=form;running=0;enableSubmit()}else disableSubmit(form)}function readyToSubmitStripeLink(form){if(!linkAuthenticationElementIsComplete||!stripeLinkElementIsComplete)return false;if("object"!==typeof window.frmProForm||"function"!==typeof window.frmProForm.submitButtonIsConditionallyDisabled)return true;
return!window.frmProForm.submitButtonIsConditionallyDisabled(form)}function getFullNameValueDefault(){var nameValues,firstNameField,lastNameField;nameValues=[];firstNameField=checkForStripeSettingField("first_name");if(false!==firstNameField)nameValues.push(getSettingFieldValue(firstNameField));lastNameField=checkForStripeSettingField("last_name");if(false!==lastNameField)nameValues.push(getSettingFieldValue(lastNameField));return nameValues.join(" ")}function getSettingFieldValue(field){var value;
if("hidden"===field.getAttribute("type"))value=field.value;else value=field.querySelector("input").value;return value}function checkForEmailField(){return checkForStripeSettingField("email")}function checkForStripeSettingField(settingKey){var settingField=false;each(getStripeSettings(),checkStripeSettingForField);function checkStripeSettingForField(currentSetting){var currentSettingValue,settingIsWrappedAsShortcode,currentFieldId,fieldMatchByKey,fieldContainer,hiddenInput;if("string"!==typeof currentSetting[settingKey]||
!currentSetting[settingKey].length)return;currentSettingValue=currentSetting[settingKey];settingIsWrappedAsShortcode="["===currentSettingValue[0]&&"]"===currentSettingValue[currentSettingValue.length-1];if(settingIsWrappedAsShortcode){currentFieldId=currentSettingValue.substr(1,currentSettingValue.length-2);if(isNaN(currentFieldId))fieldMatchByKey=fieldContainer=document.getElementById("field_"+currentFieldId)}else currentFieldId=currentSettingValue;if(fieldMatchByKey)fieldContainer=fieldMatchByKey.closest(".frm_form_field");
else fieldContainer=document.getElementById("frm_field_"+currentFieldId+"_container");if(!fieldContainer){hiddenInput=document.querySelector('input[name="item_meta['+currentFieldId+']"]');if(!hiddenInput)if("first_name"===settingKey)hiddenInput=document.querySelector('input[name="item_meta['+currentFieldId+'][first]"]');else if("last_name"===settingKey)hiddenInput=document.querySelector('input[name="item_meta['+currentFieldId+'][last]"]');if(hiddenInput){settingField=hiddenInput;return false}return}settingField=
fieldContainer;return false}return settingField}function createMountTarget(className){var newElement=document.createElement("div");newElement.className=className+" frm_form_field form-field";return newElement}function each(items,callback){var index,length;length=items.length;for(index=0;index