<commit_before>define([
    'framework/framework',
    'framework/utils',
    'framework/form/base-form-element'
],
    function (App, Utils, BaseFormElement) {
        "use strict";

        var ButtonToggle = function (options) {
            this.initialize(options);
        };

        ButtonToggle.prototype = Utils.extend({}, BaseFormElement.prototype, {

            /**
             * Initialization.
             * @param {object} options - Options to pass
             * @param {Array} options.inputs - The collection of input elements to be made into toggle items
             * @param {Function} [options.onChange] - A callback function that fires when of the toggle elements are selected
             * @param {string} [options.cssPrefix] - A custom css class that will be used as namespace for all css classes applied
             * @param {Function} [options.onSelect] - A callback function that fires when the button toggle element is selected
             * @param {Function} [options.onDeselect] - A callback function that fires when the button toggle element is deselected
             */
            initialize: function (options) {

                this.options = Utils.extend({
                    inputs: [],
                    onChange: null,
                    cssPrefix: 'ui-button-toggle'
                }, options);

                BaseFormElement.prototype.initialize.call(this, options);

                this._container = this.options.container;

                if (!this.options.inputs.length && this._container) {
                    this.options.inputs = this._container.querySelectorAll('input');
                }

                // cache vars
                this.selectedClass = this.options.cssPrefix + '-selected';
                this.disabledClass = this.options.cssPrefix + '-disabled';
                this._input = this.options.el;

                if (!this.options.inputs.length) {
                    console.error('could not build toggle items: no toggle input items were passed');
                } else {
                    this._formElements = this._buildFormElements(this.options.inputs);
                    this._UIElements = this._buildUIElements(this._formElements);
                }

                this.setup();

            },

            /**
             * Sets up html.
             */
            setup: function () {
//                var input = this.getFormElement();
//                Utils.addClass(input, this.options.cssPrefix + '-input');
                this._setupEvents();
            },

            /**
             * Sets up events.
             * @private
             */
            _setupEvents: function () {
                this._triggerAll(function (formElement, UIElement) {
                    Utils.addEventListener(UIElement, 'click', this._onToggleClick.bind(this));
                }.bind(this));
            },

            /**
             * Gets all the current input toggles.
             * @returns {Array|*}
             */
            getFormElements: function () {
                return this._formElements;
            },

            /**
             * Gets all current ui-versions of input toggles.<commit_msg>Making sure default css classes are added for each button toggle element during setup<commit_after>define([
    'framework/framework',
    'framework/utils',
    'framework/form/base-form-element'
],
    function (App, Utils, BaseFormElement) {
        "use strict";

        var ButtonToggle = function (options) {
            this.initialize(options);
        };

        ButtonToggle.prototype = Utils.extend({}, BaseFormElement.prototype, {

            /**
             * Initialization.
             * @param {object} options - Options to pass
             * @param {Array} options.inputs - The collection of input elements to be made into toggle items
             * @param {Function} [options.onChange] - A callback function that fires when of the toggle elements are selected
             * @param {string} [options.cssPrefix] - A custom css class that will be used as namespace for all css classes applied
             * @param {Function} [options.onSelect] - A callback function that fires when the button toggle element is selected
             * @param {Function} [options.onDeselect] - A callback function that fires when the button toggle element is deselected
             */
            initialize: function (options) {

                this.options = Utils.extend({
                    inputs: [],
                    onChange: null,
                    cssPrefix: 'ui-button-toggle'
                }, options);

                BaseFormElement.prototype.initialize.call(this, options);

                this._container = this.options.container;

                if (!this.options.inputs.length && this._container) {
                    this.options.inputs = this._container.querySelectorAll('input');
                }

                // cache vars
                this.selectedClass = this.options.cssPrefix + '-selected';
                this.disabledClass = this.options.cssPrefix + '-disabled';
                this._input = this.options.el;

                if (!this.options.inputs.length) {
                    console.error('could not build toggle items: no toggle input items were passed');
                } else {
                    this._formElements = this._buildFormElements(this.options.inputs);
                    this._UIElements = this._buildUIElements(this._formElements);
                }

                this.setup();

            },

            /**
             * Sets up html.
             */
            setup: function () {
                // add initial class
                this._triggerAll(function (formElement) {
                    Utils.addClass(formElement, this.options.cssPrefix + '-input');
                }.bind(this));
                this._setupEvents();
            },

            /**
             * Sets up events.
             * @private
             */
            _setupEvents: function () {
                this._triggerAll(function (formElement, UIElement) {
                    Utils.addEventListener(UIElement, 'click', this._onToggleClick.bind(this));
                }.bind(this));
            },

            /**
             * Gets all the current input toggles.
             * @returns {Array|*}
             */
            getFormElements: function () {
                return this._formElements;
            },

            /**
             * Gets all current ui-versions of input toggles.
{'fraction_non_alphanumeric': 0.09828606097376005, 'fraction_numerical': 0.0, 'mean_word_length': 1.5043676414736042, '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': '4797988', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1462, 'n_words': 405}