/* WP PowerSuite Turnstile — unlock submit controls after a successful challenge */

/**
 * The lock is a stylesheet rule using !important, which outranks a normal inline style,
 * so the unlock has to be marked important too or the control stays dead.
 *
 * @param {string} selector Submit control selector.
 */
function wppsTurnstileUnlock(selector) {
	document.querySelectorAll(selector).forEach(function (el) {
		el.style.setProperty('pointer-events', 'auto', 'important');
		el.style.setProperty('opacity', '1', 'important');
	});
}
function turnstileWPCallback() {
	wppsTurnstileUnlock('#wp-submit');
}
function turnstileWppsCommentCallback() {
	wppsTurnstileUnlock('#commentform input#submit, #commentform button[type="submit"]');
}
function turnstileJetpackCallback() {
	wppsTurnstileUnlock('.wp-block-jetpack-contact-form button[type="submit"]');
}
function turnstilePMProCallback() {
	wppsTurnstileUnlock('.pmpro_btn-submit');
}
function turnstileWooLoginCallback() {
	wppsTurnstileUnlock('.woocommerce-form-login__submit');
}
function turnstileWooRegisterCallback() {
	wppsTurnstileUnlock('.woocommerce-form-register__submit');
}
function turnstileWooResetCallback() {
	wppsTurnstileUnlock('.woocommerce-ResetPassword .button');
}
function turnstileWooCheckoutCallback() {
	wppsTurnstileUnlock(
		'#place_order, .wc-block-components-checkout-place-order-button, .wc-block-checkout__actions_row .wc-block-components-button'
	);
}
function turnstileEDDLoginCallback() {
	wppsTurnstileUnlock('#edd_login_submit');
}
function turnstileEDDRegisterCallback() {
	wppsTurnstileUnlock('#edd_register_form .edd-submit');
}
function turnstileEDDCheckoutCallback() {
	wppsTurnstileUnlock('.edd-submit');
}
function turnstileElementorCallback() {
	wppsTurnstileUnlock('.elementor-form button[type="submit"]');
}
function turnstileCF7Callback() {
	wppsTurnstileUnlock('.wpcf7-submit');
}
function turnstileMC4WPCallback() {
	wppsTurnstileUnlock('.mc4wp-form-fields input[type=submit]');
}
function turnstileBPCallback() {
	wppsTurnstileUnlock('#buddypress #signup-form .submit');
}
function turnstileBBPressReplyCallback() {
	wppsTurnstileUnlock('#bbp_reply_submit');
}
function turnstileBBPressCreateCallback() {
	wppsTurnstileUnlock('#bbp_topic_submit');
}
function turnstileWPFCallback() {
	wppsTurnstileUnlock('.wpforms-submit');
}
function turnstileFluentCallback() {
	wppsTurnstileUnlock('.fluentform .ff-btn-submit');
}
function turnstileFormidableCallback() {
	wppsTurnstileUnlock('.frm_forms .frm_button_submit');
}
function turnstileGravityCallback() {
	wppsTurnstileUnlock('.gform_button');
}
function turnstileUMCallback() {
	wppsTurnstileUnlock('#um-submit-btn');
}
function turnstileMEPRCallback() {
	wppsTurnstileUnlock('.mepr-submit');
}
