jQuery(document).ready(function(e){"use strict";e(document).on("click","#create-authentication",function(t){t.preventDefault();var n=e(this),s=n.html(),a=e("input[name=auth_id]").val(),c=e("input[name=auth_key]").val();""==a||""==c?cfmsync_toaster("error","Please fill in the required fields."):e.ajax({url:cfmsync.ajaxurl,type:"post",data:{action:"create-authentication",auth_id:a,auth_key:c,_nonce:cfmsync.ajaxnonce},beforeSend:function(){n.prop("disabled",!0),n.html('<i class="fas fa-spinner fa-spin me-2"></i> Authenticating user...')},success:function(e){"success"==e?cfmsync_toaster("success","User authenticated successfully."):cfmsync_toaster("error",e),n.html(s),setTimeout(function(){location.reload(!0)},5e3)}}),t.preventDefault()}),e(document).on("click","#remove-authentication",function(t){t.preventDefault();var n=e(this),s=n.html();e.ajax({url:cfmsync.ajaxurl,type:"post",data:{action:"remove-authentication",_nonce:cfmsync.ajaxnonce},beforeSend:function(){n.prop("disabled",!0),n.siblings("button").prop("disabled",!0),n.html('<i class="fas fa-spinner fa-spin me-2"></i> Processing...')},success:function(t){"success"==t?cfmsync_toaster("success","User credentials credentials, shows, and episodes removed successfully."):cfmsync_toaster("error",t),n.prop("disabled",!1),n.siblings("button").prop("disabled",!1),n.html(s),e("#confirmation-modal").modal("hide"),setTimeout(function(){location.reload(!0)},2e3)}}),t.preventDefault()})});