/* Minification failed. Returning unminified contents.
(1,1): run-time error CSS1019: Unexpected token, found '$'
(1,2): run-time error CSS1019: Unexpected token, found '('
(1,11): run-time error CSS1031: Expected selector, found ')'
(1,11): run-time error CSS1025: Expected comma or open brace, found ')'
(3,2): run-time error CSS1019: Unexpected token, found ')'
(4,1): run-time error CSS1019: Unexpected token, found '$'
(4,2): run-time error CSS1019: Unexpected token, found '('
(4,11): run-time error CSS1031: Expected selector, found ')'
(4,11): run-time error CSS1025: Expected comma or open brace, found ')'
(25,2): run-time error CSS1019: Unexpected token, found ')'
(27,10): run-time error CSS1031: Expected selector, found 'onRegisterSubmit('
(27,10): run-time error CSS1025: Expected comma or open brace, found 'onRegisterSubmit('
(32,10): run-time error CSS1031: Expected selector, found 'initPicker('
(32,10): run-time error CSS1025: Expected comma or open brace, found 'initPicker('
(45,10): run-time error CSS1031: Expected selector, found 'onQuizDialogClosed('
(45,10): run-time error CSS1025: Expected comma or open brace, found 'onQuizDialogClosed('
(59,1): run-time error CSS1019: Unexpected token, found '$'
(59,2): run-time error CSS1019: Unexpected token, found '('
(59,11): run-time error CSS1031: Expected selector, found ')'
(59,11): run-time error CSS1025: Expected comma or open brace, found ')'
(68,2): run-time error CSS1019: Unexpected token, found ')'
 */
$(document).ready(function () {
    gsap.to('.g-up', { opacity: 1, y: 0, duration: 0.55, stagger: 0.06, ease: 'power2.out', delay: 0.1 });
});
$(document).ready(function () {
    initPicker('scalePick', 'scale-opt', 'scaleValue', 'scale', 'scaleErr');
    initPicker('phasePick', 'phase-opt', 'phaseValue', 'phase', 'phaseErr');

    gsap.to('.g-up', { opacity: 1, y: 0, duration: 0.5, stagger: 0.045, ease: 'power2.out', delay: 0.1 });

    $(document).on("click", ".take-test-btn", function (e) {
        e.preventDefault();
        e.stopPropagation();

        openQuiz(0, $(this).attr("question-group-id"), 0, 'A');
    });

    $(".field-input").each(function (index, element) {
        var $input = $(this);
        $input.on("keypress", function (e) {
            if (e.which === 13) {
                onRegisterSubmit();
            }
        });
    })
});

function onRegisterSubmit() {
    gtag('event', 'sign_up', { method: 'Email' });
    $("#register-form").submit();
}

function initPicker(pickId, optClass, hiddenId, dataKey, errId) {
    $('#' + pickId).on('click', '.' + optClass, function () {
        var $this = $(this);

        $('#' + pickId + ' .' + optClass).removeClass('sel');

        $this.addClass('sel');

        $('#' + hiddenId).val($this.data(dataKey));
        $('#' + errId).removeClass('show');
    });
}

function onQuizDialogClosed() {
    var title = $(".srb-title").text();

    if (quizState.title.indexOf("Skala") != -1) {
        if (title != "") {
            $('[scale-name="' + title + '"]').click();
        }
    }
    else if (quizState.title.indexOf("Fase") != -1) {
        if (title != "") {
            $('[phase-name="' + title + '"]').click();
        }
    }
}
$(document).ready(function () {
    $(document).on('click', '#eye-icon', function () {
        let passwordInput = $(this).siblings('input[name]');

        let type = passwordInput.attr('type') === 'password' ? 'text' : 'password';
        passwordInput.attr('type', type); 

        $(this).toggleClass('fa-eye fa-eye-slash');
    });
});
