"use strict";!function(n){"undefined"!=typeof wpQuiz?(n(document).on("ready",function(){"undefined"!=typeof Cookies&&(n('.wq-subscribe-locker :input[name="email"]').val(Cookies.get("wp_quiz_subscribe_email")),n('.wq-subscribe-locker :input[name="username"]').val(Cookies.get("wp_quiz_subscribe_username")))}),n(document).on("submit",".wq-subscribe-locker",function(e){e.preventDefault();var i=n(this),s=i.serializeObject(),o=i.find(":submit"),r=i.find(".wq-error");i.addClass("wq-is-processing"),r.html(""),o.prop("disabled",!0),s.quiz_id=i.attr("data-quiz-id"),s.current_url=window.location.href;var u=wpQuiz.helpers.getRequest({url:wpQuiz.restUrl+"wp-quiz/v2/subscribe",method:"POST",data:s});u.done(function(e){console.log(e),"undefined"!=typeof Cookies&&s.username&&s.email&&(Cookies.set("wp_quiz_subscribe_email",s.email,{expires:7}),Cookies.set("wp_quiz_subscribe_username",s.username,{expires:7})),i.remove()}),u.fail(function(e){r.html(e.responseJSON.message),i.removeClass("wq-is-processing"),o.prop("disabled",!1)})})):console.log("WP Quiz script is not loaded")}(jQuery);