<commit_before>/**
 * YDS Editor (modification of Highcharts Editor's normal editor)
 * @param parent                Parent DOM element to put Editor in
 * @param attributes            Attributes of the Editor
 * @param createLibraryList     Function to call for creating the Library list tab content
 * @param createViewSelector    Function to call for creating the view/axes selection tab content
 * @returns {*}
 * @constructor
 */
highed.YDSEditor = function (parent, attributes, createLibraryList, createViewSelector) {
    var events = highed.events(),

        properties = highed.merge({
            defaultChartOptions: {},
            on: {},
            plugins: {},
            features: 'welcome import export templates customize',
            includeSVGInHTMLEmbedding: true,
            importer: {},
            exporter: {},
            availableSettings: false,
            useContextMenu: true,
            useHeader: true
        }, attributes),

        container = highed.dom.cr('div', 'highed-container'),
        expandContainer = highed.dom.cr('div', 'highed-expand-container'),

        wizbody = highed.dom.cr('div'),

        mainToolbar = highed.Toolbar(container, {
            additionalCSS: ['highed-header']
        }),

        splitter = highed.HSplitter(container, {
            leftWidth: 60,
            rightClasses: 'highed-chart-preview-bar',
            allowResize: false,
            leftMax: 800
        }),

        wizbar = highed.WizardBar(container, splitter.left),

        welcomeStep = wizbar.addStep({title: highed.getLocalizedStr('stepStart')}),

        dataImpStep = wizbar.addStep({title: highed.getLocalizedStr('stepImport')}),
        dataImp = highed.DataImporter(dataImpStep.body, properties.importer),

        dataTableStep = wizbar.addStep({title: highed.getLocalizedStr('stepData')}),
        dataTable = highed.DataTable(dataTableStep.body),

        libraryListStep = wizbar.addStep({title: "Library"}),
        libraryListSelector = createLibraryList(libraryListStep.body),

        viewTypeStep = wizbar.addStep({title: "Axes"}),
        viewTypeSelector = createViewSelector(viewTypeStep.body),

        templateStep = wizbar.addStep({title: highed.getLocalizedStr('stepTemplates')}),
        chartTemplateSelector = highed.ChartTemplateSelector(templateStep.body),

        chartContainer = highed.dom.cr('div', 'highed-box-size highed-chart-container'),
        chartPreview = highed.ChartPreview(chartContainer, {
            defaultChartOptions: properties.defaultChartOptions,
            expandTo: expandContainer
        }),

        customizerStep = wizbar.addStep({title: highed.getLocalizedStr('stepCustomize'), id: 'customize'}),
        chartCustomizer = highed.ChartCustomizer(customizerStep.body, {
            availableSettings: properties.availableSettings
        }),

        dataExpStep = wizbar.addStep({title: highed.getLocalizedStr('stepExport'), id: 'export'}),
        dataExp = highed.Exporter(dataExpStep.body, properties.exporter),

        doneBtn = highed.dom.cr('div', 'highed-ok-button', highed.getLocalizedStr('doneCaption')),
        doneStep = wizbar.addStep({title: highed.getLocalizedStr('stepDone')}),

        chartIcon = highed.dom.cr('div', 'highed-chart-container-icon'),

        cmenu = highed.DefaultContextMenu(chartPreview)
        ;

    cmenu.on('NewChart', function () {
        dataImpStep.activate();
    });

    properties.features = highed.arrToObj(properties.features.split(' '));

    ////////////////////////////////////////////////////////////////////////

    function updateToolbarIcon() {
        if (highed.onPhone()) {
            highed.dom.style(chartIcon, {
                'background-image': 'url("data:image/svg+xml;utf8,' +
                encodeURIComponent(chartPreview.export.svg()) +
                '")'
            });
        }
    }

    //Hide features that are disabled
    function applyFeatures() {
        var things = properties.features;

        if (!things.export) {
            dataExpStep.hide();
        }

        if (!things.import) {
            dataImpStep.hide();
        }

        if (!things.templates) {
            templateStep.hide();
        }

        if (!things.customize) {
            customizerStep.hide();
        }

        if (!things.welcome) {
            welcomeStep.hide();
        }

        if (!things.done) {
            doneStep.hide();
        }

        if (!things.data) {
            dataTableStep.hide();
        }

        wizbar.selectFirst();
    }<commit_msg>Make YDSEditor hide library & view steps when not enabled<commit_after>/**
 * YDS Editor (modification of Highcharts Editor's normal editor)
 * @param parent                Parent DOM element to put Editor in
 * @param attributes            Attributes of the Editor
 * @param createLibraryList     Function to call for creating the Library list tab content
 * @param createViewSelector    Function to call for creating the view/axes selection tab content
 * @returns {*}
 * @constructor
 */
highed.YDSEditor = function (parent, attributes, createLibraryList, createViewSelector) {
    var events = highed.events(),

        properties = highed.merge({
            defaultChartOptions: {},
            on: {},
            plugins: {},
            features: 'welcome import export templates customize',
            includeSVGInHTMLEmbedding: true,
            importer: {},
            exporter: {},
            availableSettings: false,
            useContextMenu: true,
            useHeader: true
        }, attributes),

        container = highed.dom.cr('div', 'highed-container'),
        expandContainer = highed.dom.cr('div', 'highed-expand-container'),

        wizbody = highed.dom.cr('div'),

        mainToolbar = highed.Toolbar(container, {
            additionalCSS: ['highed-header']
        }),

        splitter = highed.HSplitter(container, {
            leftWidth: 60,
            rightClasses: 'highed-chart-preview-bar',
            allowResize: false,
            leftMax: 800
        }),

        wizbar = highed.WizardBar(container, splitter.left),

        welcomeStep = wizbar.addStep({title: highed.getLocalizedStr('stepStart')}),

        dataImpStep = wizbar.addStep({title: highed.getLocalizedStr('stepImport')}),
        dataImp = highed.DataImporter(dataImpStep.body, properties.importer),

        dataTableStep = wizbar.addStep({title: highed.getLocalizedStr('stepData')}),
        dataTable = highed.DataTable(dataTableStep.body),

        libraryListStep = wizbar.addStep({title: "Library"}),
        libraryListSelector = createLibraryList(libraryListStep.body),

        viewTypeStep = wizbar.addStep({title: "Axes"}),
        viewTypeSelector = createViewSelector(viewTypeStep.body),

        templateStep = wizbar.addStep({title: highed.getLocalizedStr('stepTemplates')}),
        chartTemplateSelector = highed.ChartTemplateSelector(templateStep.body),

        chartContainer = highed.dom.cr('div', 'highed-box-size highed-chart-container'),
        chartPreview = highed.ChartPreview(chartContainer, {
            defaultChartOptions: properties.defaultChartOptions,
            expandTo: expandContainer
        }),

        customizerStep = wizbar.addStep({title: highed.getLocalizedStr('stepCustomize'), id: 'customize'}),
        chartCustomizer = highed.ChartCustomizer(customizerStep.body, {
            availableSettings: properties.availableSettings
        }),

        dataExpStep = wizbar.addStep({title: highed.getLocalizedStr('stepExport'), id: 'export'}),
        dataExp = highed.Exporter(dataExpStep.body, properties.exporter),

        doneBtn = highed.dom.cr('div', 'highed-ok-button', highed.getLocalizedStr('doneCaption')),
        doneStep = wizbar.addStep({title: highed.getLocalizedStr('stepDone')}),

        chartIcon = highed.dom.cr('div', 'highed-chart-container-icon'),

        cmenu = highed.DefaultContextMenu(chartPreview)
        ;

    cmenu.on('NewChart', function () {
        dataImpStep.activate();
    });

    properties.features = highed.arrToObj(properties.features.split(' '));

    ////////////////////////////////////////////////////////////////////////

    function updateToolbarIcon() {
        if (highed.onPhone()) {
            highed.dom.style(chartIcon, {
                'background-image': 'url("data:image/svg+xml;utf8,' +
                encodeURIComponent(chartPreview.export.svg()) +
                '")'
            });
        }
    }

    //Hide features that are disabled
    function applyFeatures() {
        var things = properties.features;

        if (!things.export) {
            dataExpStep.hide();
        }

        if (!things.import) {
            dataImpStep.hide();
        }

        if (!things.library) {
            libraryListStep.hide();
        }

        if (!things.view) {
            viewTypeStep.hide();
        }

        if (!things.templates) {
            templateStep.hide();
        }

        if (!things.customize) {
            customizerStep.hide();
        }

        if (!things.welcome) {
            welcomeStep.hide();
        }

        if (!things.done) {
            doneStep.hide();
        }

        if (!things.data) {
            dataTableStep.hide();
        }

        wizbar.selectFirst();
    }
{'fraction_non_alphanumeric': 0.1339419978517723, 'fraction_numerical': 0.0012889366272824919, 'mean_word_length': 2.2555944055944055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2461041', 'n_tokens_mistral': 2580, 'n_tokens_neox': 2492, 'n_words': 452}