<commit_before>;(function($, window, document, undefined) {
    "use strict";

    var pluginName = 'register',
        defaults = {
            hiddenCls: 'is--hidden',
            errorCls: 'has--error'
        };

    /**
     * Plugin constructor which merges the default settings with the user settings
     * and parses the `data`-attributes of the incoming `element`.
     *
     * @param {HTMLElement} element - Element which should be used in the plugin
     * @param {Object} userOpts - User settings for the plugin
     * @returns {Void}
     * @constructor
     */
    function Plugin(element, userOpts) {
        var me = this;

        me.$el = $(element);
        me.opts = $.extend({}, defaults, userOpts);

        me._defaults = defaults;
        me._name = pluginName;

        me.init();
    }

    /**
     * Initializes the plugin, sets up event listeners and adds the necessary
     * classes to get the plugin up and running.
     *
     * @returns {Void}
     */
    Plugin.prototype.init = function() {
        var me = this;

        me.$form = me.$el.find('.register--form');
        me.$submitBtn = me.$el.find('.register--submit');

        me.$typeSelection = me.$el.find('.register--customertype select');
        me.$skipAccount = me.$el.find('.register--check input');
        me.$alternativeShipping = me.$el.find('.register--alt-shipping input');

        me.$companyFieldset = me.$el.find('.register--company');
        me.$accountFieldset = me.$el.find('.register--account-information');
        me.$shippingFieldset = me.$el.find('.register--shipping');

        me.$countySelectFields = me.$el.find('.select--country');
        me.$stateSelectContainers = $('.register--state-selection');

        me.$inputs = me.$el.find('.is--required');

        me.checkType();
        me.checkSkipAccount();
        me.checkChangeShipping();

        me.registerEvents();
    };

    Plugin.prototype.registerEvents = function () {
        var me = this;

        me.$typeSelection.on('change.' + pluginName, $.proxy(me.checkType, me));
        me.$skipAccount.on('change.' + pluginName, $.proxy(me.checkSkipAccount, me));
        me.$alternativeShipping.on('change.' + pluginName, $.proxy(me.checkChangeShipping, me));
        me.$countySelectFields.on('change.' + pluginName, $.proxy(me.onCountryChanged, me));
        me.$inputs.on('blur.' + pluginName, $.proxy(me.onValidateInput, me));
        me.$submitBtn.on('click.' + pluginName, $.proxy(me.onSubmitBtn, me));
    };

    Plugin.prototype.checkType = function () {
        var me = this,
            status = (me.$typeSelection.val() === 'private'),
            requiredFields = me.$companyFieldset.find('.is--required'),
            requiredMethod = (!status) ? me.setHtmlRequired : me.removeHtmlRequired,
            classMethod = (!status) ? 'removeClass' : 'addClass';

        requiredMethod(requiredFields);

        me.$companyFieldset[classMethod](me.opts.hiddenCls);
    };

    Plugin.prototype.checkSkipAccount = function () {
        var me = this,
            isChecked = me.$skipAccount.is(':checked'),
            requiredFields = me.$accountFieldset.find('.is--required'),
            requiredMethod = (!isChecked) ? me.setHtmlRequired : me.removeHtmlRequired,
            classMethod = (isChecked) ? 'addClass' : 'removeClass';

        requiredMethod(requiredFields);

        me.$accountFieldset[classMethod](me.opts.hiddenCls);
    };

    Plugin.prototype.checkChangeShipping = function () {
        var me = this,
            isChecked = me.$alternativeShipping.is(':checked'),
            requiredFields = me.$shippingFieldset.find('.is--required'),
            requiredMethod = (isChecked) ? me.setHtmlRequired : me.removeHtmlRequired,
            classMethod = (isChecked) ? 'removeClass' : 'addClass';

        requiredMethod(requiredFields);

        me.$shippingFieldset[classMethod](me.opts.hiddenCls);
    };

    Plugin.prototype.onCountryChanged = function(event) {
        var $select = $(event.currentTarget),
            selectId = $select.attr('id'),
            val = $select.val(),
            parent = $select.parents('.panel--body'),
            areaSelection = parent.find('#' + selectId + '_' + val + '_states'),
            select, plugin;

        parent.find('.register--state-selection').addClass('is--hidden');
        select = areaSelection.find('select');
        plugin = select.data('pluginSelectboxReplacement');

        plugin.$el.addClass('is--hidden');
        plugin.$wrapEl.addClass('is--hidden');
        areaSelection.addClass('is--hidden');
        plugin.setDisabled();

        if (areaSelection.length) {
            // We have a state selection
            select = areaSelection.find('select');
            plugin = select.data('pluginSelectboxReplacement');

            plugin.$el.removeClass('is--hidden');
            plugin.$wrapEl.removeClass('is--hidden');
            areaSelection.removeClass('is--hidden');
            plugin.setEnabled();
        }

        console.log(areaSelection);
    };

    Plugin.prototype.onSubmitBtn = function(event) {
        var me = this,
            input,
            valid = true;

        me.$inputs.each(function() {
            input = $(this);

            if (!input.val()) {
                valid = false;
                me.setFieldAsError(input);
            }<commit_msg>SW-8675 Removed: Debug code<commit_after>;(function($, window, document, undefined) {
    "use strict";

    var pluginName = 'register',
        defaults = {
            hiddenCls: 'is--hidden',
            errorCls: 'has--error'
        };

    /**
     * Plugin constructor which merges the default settings with the user settings
     * and parses the `data`-attributes of the incoming `element`.
     *
     * @param {HTMLElement} element - Element which should be used in the plugin
     * @param {Object} userOpts - User settings for the plugin
     * @returns {Void}
     * @constructor
     */
    function Plugin(element, userOpts) {
        var me = this;

        me.$el = $(element);
        me.opts = $.extend({}, defaults, userOpts);

        me._defaults = defaults;
        me._name = pluginName;

        me.init();
    }

    /**
     * Initializes the plugin, sets up event listeners and adds the necessary
     * classes to get the plugin up and running.
     *
     * @returns {Void}
     */
    Plugin.prototype.init = function() {
        var me = this;

        me.$form = me.$el.find('.register--form');
        me.$submitBtn = me.$el.find('.register--submit');

        me.$typeSelection = me.$el.find('.register--customertype select');
        me.$skipAccount = me.$el.find('.register--check input');
        me.$alternativeShipping = me.$el.find('.register--alt-shipping input');

        me.$companyFieldset = me.$el.find('.register--company');
        me.$accountFieldset = me.$el.find('.register--account-information');
        me.$shippingFieldset = me.$el.find('.register--shipping');

        me.$countySelectFields = me.$el.find('.select--country');
        me.$stateSelectContainers = $('.register--state-selection');

        me.$inputs = me.$el.find('.is--required');

        me.checkType();
        me.checkSkipAccount();
        me.checkChangeShipping();

        me.registerEvents();
    };

    Plugin.prototype.registerEvents = function () {
        var me = this;

        me.$typeSelection.on('change.' + pluginName, $.proxy(me.checkType, me));
        me.$skipAccount.on('change.' + pluginName, $.proxy(me.checkSkipAccount, me));
        me.$alternativeShipping.on('change.' + pluginName, $.proxy(me.checkChangeShipping, me));
        me.$countySelectFields.on('change.' + pluginName, $.proxy(me.onCountryChanged, me));
        me.$inputs.on('blur.' + pluginName, $.proxy(me.onValidateInput, me));
        me.$submitBtn.on('click.' + pluginName, $.proxy(me.onSubmitBtn, me));
    };

    Plugin.prototype.checkType = function () {
        var me = this,
            status = (me.$typeSelection.val() === 'private'),
            requiredFields = me.$companyFieldset.find('.is--required'),
            requiredMethod = (!status) ? me.setHtmlRequired : me.removeHtmlRequired,
            classMethod = (!status) ? 'removeClass' : 'addClass';

        requiredMethod(requiredFields);

        me.$companyFieldset[classMethod](me.opts.hiddenCls);
    };

    Plugin.prototype.checkSkipAccount = function () {
        var me = this,
            isChecked = me.$skipAccount.is(':checked'),
            requiredFields = me.$accountFieldset.find('.is--required'),
            requiredMethod = (!isChecked) ? me.setHtmlRequired : me.removeHtmlRequired,
            classMethod = (isChecked) ? 'addClass' : 'removeClass';

        requiredMethod(requiredFields);

        me.$accountFieldset[classMethod](me.opts.hiddenCls);
    };

    Plugin.prototype.checkChangeShipping = function () {
        var me = this,
            isChecked = me.$alternativeShipping.is(':checked'),
            requiredFields = me.$shippingFieldset.find('.is--required'),
            requiredMethod = (isChecked) ? me.setHtmlRequired : me.removeHtmlRequired,
            classMethod = (isChecked) ? 'removeClass' : 'addClass';

        requiredMethod(requiredFields);

        me.$shippingFieldset[classMethod](me.opts.hiddenCls);
    };

    Plugin.prototype.onCountryChanged = function(event) {
        var $select = $(event.currentTarget),
            selectId = $select.attr('id'),
            val = $select.val(),
            parent = $select.parents('.panel--body'),
            areaSelection = parent.find('#' + selectId + '_' + val + '_states'),
            select, plugin;

        parent.find('.register--state-selection').addClass('is--hidden');
        select = areaSelection.find('select');
        plugin = select.data('pluginSelectboxReplacement');

        plugin.$el.addClass('is--hidden');
        plugin.$wrapEl.addClass('is--hidden');
        areaSelection.addClass('is--hidden');
        plugin.setDisabled();

        if (areaSelection.length) {
            // We have a state selection
            select = areaSelection.find('select');
            plugin = select.data('pluginSelectboxReplacement');

            plugin.$el.removeClass('is--hidden');
            plugin.$wrapEl.removeClass('is--hidden');
            areaSelection.removeClass('is--hidden');
            plugin.setEnabled();
        }
    };

    Plugin.prototype.onSubmitBtn = function(event) {
        var me = this,
            input,
            valid = true;

        me.$inputs.each(function() {
            input = $(this);

            if (!input.val()) {
                valid = false;
                me.setFieldAsError(input);
            }
{'fraction_non_alphanumeric': 0.15146716348393108, 'fraction_numerical': 0.0003726129482999534, 'mean_word_length': 2.3197278911564627, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7593913', 'n_tokens_mistral': 2943, 'n_tokens_neox': 2872, 'n_words': 548}