// source --> https://www.mizikoos.com/wp-content/plugins/restrict-content/core/includes/gateways/stripe/js/stripe.min.js?ver=4.0.0 
var rcpStripe=window.rcpStripe||{};function rcpStripeEnableForm(){jQuery("#rcp_registration_form #rcp_submit").attr("disabled",!1),jQuery("#rcp_ajax_loading").hide(),jQuery("#rcp_registration_form").unblock(),jQuery("#rcp_submit").val(rcp_script_options.register),rcp_processing=!1}function rcpStripeHandleError(e,r){void 0!==r&&void 0!==rcpStripe.errors[r]&&(e=rcpStripe.errors[r]),document.getElementById("rcp_registration_form")||document.getElementById("rcp_update_card_form")?(rcpStripeToggleElementErrors({error:{message:e}}),rcpStripeEnableForm()):document.getElementById("rcp-stripe-confirm-form")&&jQuery("#rcp-stripe-confirmation-loading").empty().append(rcpStripeGenerateNotice(e)).append('<p><a href="'+document.referrer+'">'+rcp_script_options.click_try_again+"</a></p>")}function rcpStripeGenerateNotice(e){var r=document.createElement("span");r.innerText=e;var t=document.createElement("p");t.classList.add("rcp_error"),t.appendChild(r);var o=document.createElement("div");return o.classList.add("rcp_message"),o.classList.add("error"),o.appendChild(t),o}function rcpStripeToggleElementErrors(e){var r=document.getElementById("rcp-card-element-errors");null!==r&&(r.innerHTML="",e.error&&r.appendChild(rcpStripeGenerateNotice(e.error.message)))}function rcpStripeUpdateElementStyles(e,r){void 0===typeof r&&(r=".rcp_card_name");let t=document.querySelector(r);if(null===t)return;if(null!==rcpStripe.elementsConfig&&rcpStripe.elementsConfig.style)return;let o=window.getComputedStyle(t),p=document.createElement("style");p.innerHTML=".StripeElement {background-color:"+o.getPropertyValue("background-color")+";border-top-color:"+o.getPropertyValue("border-top-color")+";border-right-color:"+o.getPropertyValue("border-right-color")+";border-bottom-color:"+o.getPropertyValue("border-bottom-color")+";border-left-color:"+o.getPropertyValue("border-left-color")+";border-top-width:"+o.getPropertyValue("border-top-width")+";border-right-width:"+o.getPropertyValue("border-right-width")+";border-bottom-width:"+o.getPropertyValue("border-bottom-width")+";border-left-width:"+o.getPropertyValue("border-left-width")+";border-top-style:"+o.getPropertyValue("border-top-style")+";border-right-style:"+o.getPropertyValue("border-right-style")+";border-bottom-style:"+o.getPropertyValue("border-bottom-style")+";border-left-style:"+o.getPropertyValue("border-left-style")+";border-top-left-radius:"+o.getPropertyValue("border-top-left-radius")+";border-top-right-radius:"+o.getPropertyValue("border-top-right-radius")+";border-bottom-left-radius:"+o.getPropertyValue("border-bottom-left-radius")+";border-bottom-right-radius:"+o.getPropertyValue("border-bottom-right-radius")+";padding-top:"+o.getPropertyValue("padding-top")+";padding-right:"+o.getPropertyValue("padding-right")+";padding-bottom:"+o.getPropertyValue("padding-bottom")+";padding-left:"+o.getPropertyValue("padding-left")+";}",document.body.appendChild(p),e.update({style:{base:{color:o.getPropertyValue("color"),fontFamily:o.getPropertyValue("font-family"),fontSize:o.getPropertyValue("font-size"),fontWeight:o.getPropertyValue("font-weight"),fontSmoothing:o.getPropertyValue("-webkit-font-smoothing")}}})}rcpStripe.Stripe=Stripe(rcpStripe.keys.publishable),rcpStripe.Elements=rcpStripe.Stripe.elements(),rcpStripe.elements={card:rcpStripe.Elements.create("card",rcpStripe.elementsConfig)};
// source --> https://www.mizikoos.com/wp-content/plugins/restrict-content/core/includes/gateways/stripe/js/register.min.js?ver=4.0.0 
function rcpStripeHandlePaymentFailure(e,t){jQuery.ajax({type:"post",dataType:"json",url:rcp_script_options.ajaxurl,data:{action:"rcp_stripe_handle_initial_payment_failure",payment_id:e,message:t,nonce:rcp_script_options.stripe_payment_nonce},success:function(e){}})}function rcpStripeCloseCheckoutModal(){if(rcp_processing)return;let e=jQuery,t=e(".rcp-modal-wrapper"),r=e(".rcp-modal");t.fadeOut(250),r.hide(),document.getElementById("rcp-card-element")&&rcpStripe.elements.card.unmount("#rcp-card-element")}function rcpStripeHandleIntent(e,t,r){return rcpStripe.Stripe[e](t,r)}jQuery((function(e){var t={hasPaymentMethod:!1,paymentMethodID:!1,init:function(){e("body").on("rcp_gateway_loaded",t.mountElements),e("#rcp_submit").on("click",t.maybeBlockSubmit),e("body").on("rcp_registration_form_processed",t.handlePayment),e("body").on("click",".rcp-stripe-register-submit-button",t.launchModal)},mountElements:function(e,r){document.getElementById("rcp-card-element")&&(rcpStripeUpdateElementStyles(rcpStripe.elements.card,".rcp_card_name"),rcpStripe.elements.card.mount("#rcp-card-element"),rcpStripe.elements.card.addEventListener("change",(function(e){e.complete&&(t.hasPaymentMethod=!0)})),t.setPaymentMethodID(),rcpStripe.elements.card.addEventListener("change",rcpStripeToggleElementErrors))},setPaymentMethodID:function(){let r=e('input[name="rcp_gateway_existing_payment_method"]');r.on("change",(function(r){rcpStripeToggleElementErrors(r);let a=e('input[name="rcp_gateway_existing_payment_method"]:checked').val();e(".rcp-gateway-saved-payment-method, .rcp-gateway-add-payment-method-wrap").removeClass("rcp-gateway-selected-payment-method"),"new"===a?(e(".rcp-gateway-new-card-fields").show(),e(".rcp-gateway-add-payment-method-wrap").addClass("rcp-gateway-selected-payment-method"),t.paymentMethodID=!1):(e(".rcp-gateway-new-card-fields").hide(),e(this).parents(".rcp-gateway-saved-payment-method").addClass("rcp-gateway-selected-payment-method"),t.paymentMethodID=a)})),r.trigger("change")},maybeBlockSubmit:function(e){if("stripe"===rcp_get_gateway().val()&&document.getElementById("rcp-card-element")&&!t.hasPaymentMethod&&!t.paymentMethodID)return e.stopPropagation(),rcpStripeHandleError(rcp_script_options.enter_card_details),!1},handlePayment:function(r,a,n){if("stripe"!==n.gateway.slug)return;if(!(n.total||n.recurring_total&&n.auto_renew))return;if(e(".rcp_gateway_fields").hasClass("rcp_discounted_100"))return;if(!n.gateway.data.stripe_client_secret)return rcpStripeHandleError(rcp_script_options.error_occurred),void rcpStripeHandlePaymentFailure(n.payment_id,rcp_script_options.error_occurred);let c=e(".card-name").val(),p="payment_intent"===n.gateway.data.stripe_intent_type?"confirmCardPayment":"confirmCardSetup",d={payment_method:{card:rcpStripe.elements.card,billing_details:{name:c}}};t.paymentMethodID&&(d={payment_method:t.paymentMethodID}),rcpStripeHandleIntent(p,n.gateway.data.stripe_client_secret,d).then((function(e){e.error?(rcpStripeHandleError(e.error.message,e.error.code),rcpStripeHandlePaymentFailure(n.payment_id,e.error.message)):rcp_submit_registration_form(a,n)}))},launchModal:function(r){r.preventDefault();let a=e(".rcp-modal-wrapper"),n=e(".rcp-modal"),c=e(this).parents(".rcp-stripe-register");if(!document.getElementById("rcp-card-element"))return;a.fadeIn(250),rcpStripe.elements.card.mount("#rcp-card-element");let p=n.find("input.rcp-modal-submit");rcpStripe.elements.card.addEventListener("change",(function(e){e.complete&&(t.hasPaymentMethod=!0)})),rcpStripe.elements.card.addEventListener("change",rcpStripeToggleElementErrors),t.setPaymentMethodID(),c.data("name")&&e(".rcp-modal-membership-name").text(c.data("name")).show(),c.data("description")&&e(".rcp-modal-membership-description").text(c.data("description")).show(),c.data("panel-label")&&p.val(c.data("panel-label")),c.data("level-id")&&n.find("#rcp-stripe-checkout-level-id").val(c.data("level-id")),n.fadeIn(250),a.find(".rcp-modal-close").on("click",(function(){rcpStripeCloseCheckoutModal()})),e(document).on("keydown",(function(e){27===e.keyCode&&rcpStripeCloseCheckoutModal()})),e(document).mouseup((function(e){n.is(e.target)||0!==n.has(e.target).length||rcpStripeCloseCheckoutModal()}))}};t.init()}));