<commit_before>(function($) {

    $.widget("mapbender.mbBaseSourceSwitcher", {
        options: {
        },
        scalebar: null,
        _create: function() {
            if (!Mapbender.checkTarget("mbBaseSourceSwitcher", this.options.target)) {
                return;
            }
            var self = this;
            Mapbender.elementRegistry.onElementReady(this.options.target, $.proxy(self._setup, self));
        },
        _setup: function() {
            var self = this;
            $('.basesourcesetswitch:not(.basesourcegroup)', this.element).on('click', $.proxy(self._toggleMapset, self));
            $('.basesourcegroup', this.element).on('click', function(e) {
                var bsswtch = $('.basesourcesubswitcher', $(e.currentTarget));
                $('.basesourcesubswitcher', $(self.element)).addClass('hidden');
                if (bsswtch.hasClass('hidden')) {
                    bsswtch.removeClass('hidden');
                } else {
                    bsswtch.addClass('hidden');
                }
            });
            this._hideSources();
            this._showActive();
        },
        _hideSources: function() {
            var me = $(this.element);
            var map = $('#' + this.options.target).data('mapbenderMbMap');
            var model = map.getModel();
            $.each(me.find('.basesourcesetswitch'), function(idx, elm) {
                var sourcesIds = $(elm).attr("data-sourceset").split(",");
                for (var i = 0; i < sourcesIds.length; i++) {
                    if (sourcesIds[i] !== '') {
                        var source = model.getSource({origId: sourcesIds[i]});
                        if (source) {
                            var tochange = {
                                change: {
                                    sourceIdx: {id: source.id},
                                    options: {
                                        configuration: {
                                            options: {visibility: false}
                                        },
                                        type: 'selected'
                                    }
                                }
                            };<commit_msg>fix basesourceswitcher: activate only first position<commit_after>(function($) {

    $.widget("mapbender.mbBaseSourceSwitcher", {
        options: {
        },
        scalebar: null,
        _create: function() {
            if (!Mapbender.checkTarget("mbBaseSourceSwitcher", this.options.target)) {
                return;
            }
            var self = this;
            Mapbender.elementRegistry.onElementReady(this.options.target, $.proxy(self._setup, self));
        },
        _setup: function() {
            var self = this;
            $('.basesourcesetswitch:not(.basesourcegroup)', this.element).on('click', $.proxy(self._toggleMapset, self));
            $('.basesourcegroup', this.element).on('click', function(e) {
                var bsswtch = $('.basesourcesubswitcher', $(e.currentTarget));
                $('.basesourcesubswitcher', $(self.element)).addClass('hidden');
                if (bsswtch.hasClass('hidden')) {
                    bsswtch.removeClass('hidden');
                } else {
                    bsswtch.addClass('hidden');
                }
            });
            this._hideSources();
            this._showActive();
            this.element.find('.basesourcesetswitch:first').click();
        },
        _hideSources: function() {
            var me = $(this.element);
            var map = $('#' + this.options.target).data('mapbenderMbMap');
            var model = map.getModel();
            $.each(me.find('.basesourcesetswitch'), function(idx, elm) {
                $(elm).attr("data-state", "");
                var sourcesIds = $(elm).attr("data-sourceset").split(",");
                for (var i = 0; i < sourcesIds.length; i++) {
                    if (sourcesIds[i] !== '') {
                        var source = model.getSource({origId: sourcesIds[i]});
                        if (source) {
                            var tochange = {
                                change: {
                                    sourceIdx: {id: source.id},
                                    options: {
                                        configuration: {
                                            options: {visibility: false}
                                        },
                                        type: 'selected'
                                    }
                                }
                            };
{'fraction_non_alphanumeric': 0.1323243243243243, 'fraction_numerical': 0.00043243243243243243, 'mean_word_length': 1.181046676096181, 'pattern_counts': {'":': 0, '<': 5, '<?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': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '682952', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1088, 'n_words': 181}