'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-75aef097.js');
const config = require('./config-3bb95f39.js');
const locale = require('./locale-ff30a5f3.js');
const helpers = require('./helpers-bb6622f5.js');
const common = require('./common-82ec668f.js');
const formValidation = require('./form-validation-54acc775.js');
const array = require('./array-b1e04a85.js');

const newEnvironmentCss = "button.button-secondary{border-color:var(--color-border-neutral-default)}:host{display:grid;block-size:100%;grid-template-rows:max-content 1fr max-content}.section{display:contents}.basic,.advanced{padding-block-start:16px;block-size:100%;overflow:auto}.advanced{padding-block-end:12px}.basic{display:grid;grid-template:\"runtime-environment runtime-environment\" max-content \"back-end front-end\" 1fr;grid-template-columns:1fr 1fr}.basic__runtime-environment{grid-area:runtime-environment;display:flex;flex-direction:column;align-items:center;gap:var(--spacing-gap-m)}.basic__runtime-environment.one-runtime-only{align-items:center;flex-direction:row;justify-content:center}.dialog-header__back-end,.dialog-header__front-end{padding-block-start:16px}.basic__back-end{grid-area:back-end}.basic__front-end{grid-area:front-end}.basic__back-end,.basic__front-end{display:grid;grid-template-rows:max-content 1fr;grid-auto-rows:max-content;overflow:auto}.main__back-end{border-inline-end:var(--section-common-border)}.main__back-end,.main__front-end{grid-auto-rows:max-content;padding-block:12px;overflow:auto}.text-align-center{text-align:center}.tab::part(page){scrollbar-width:thin}.checkbox{inline-size:max-content}";

var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
    if (kind === "m")
        throw new TypeError("Private method is not writable");
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _GxIdeNewEnvironment_advancedTabHasBeenRendered, _GxIdeNewEnvironment_chShortcutsEl, _GxIdeNewEnvironment_envNameModifiedByUser, _GxIdeNewEnvironment_frontEndsCheckedMap, _GxIdeNewEnvironment_selectedDataStoreId, _GxIdeNewEnvironment_selectedLanguageId, _GxIdeNewEnvironment_selectedRuntimeEnvironmentId, _GxIdeNewEnvironment_shortcutsSrc, _GxIdeNewEnvironment_newEnvironmentSectionsModel, _GxIdeNewEnvironment_componentLocale, _GxIdeNewEnvironment_dataStoreEl, _GxIdeNewEnvironment_environmentNameEl, _GxIdeNewEnvironment_languageEl, _GxIdeNewEnvironment_setAsCurrentEnvironmentEl, _GxIdeNewEnvironment_dataStoreValueChangedHandler, _GxIdeNewEnvironment_envNameInputHandler, _GxIdeNewEnvironment_evaluateSelectedRuntimeEnvironmentId, _GxIdeNewEnvironment_evaluateTooltipRender, _GxIdeNewEnvironment_initializeValidatableControlsBasicTab, _GxIdeNewEnvironment_languageValueChangedHandler, _GxIdeNewEnvironment_renderAdvanced, _GxIdeNewEnvironment_renderBasic, _GxIdeNewEnvironment_runtimeEnvironmentChangedHandler, _GxIdeNewEnvironment_createCallbackHandler, _GxIdeNewEnvironment_tabSelectionChangedHandler, _GxIdeNewEnvironment_updateDataSources, _GxIdeNewEnvironment_updateEnvironmentName, _GxIdeNewEnvironment_updateFrontEnds, _GxIdeNewEnvironment_updateLanguages, _GxIdeNewEnvironment_frontEndCheckboxInputHandler, _GxIdeNewEnvironment_updateFrontEndsCheckedMap;
const CSS_BUNDLES = [
    // TODO: review if "utils/form--full" is required.
    "resets/box-sizing",
    "components/tab",
    "components/tooltip",
    "utils/form--full",
    "utils/layout",
    "utils/typography",
    "utils/spacing",
    "chameleon/scrollbar"
];
const MAIN_SECTION_CLASSES = "main";
const BASIC_SECTION_PARENT_CLASSES = "basic";
const BASIC_TAB_SELECTOR = "basic";
const ADVANCED_TAB_SELECTOR = "advanced";
const GxIdeNewEnvironment = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        _GxIdeNewEnvironment_advancedTabHasBeenRendered.set(this, false);
        _GxIdeNewEnvironment_chShortcutsEl.set(this, void 0);
        _GxIdeNewEnvironment_envNameModifiedByUser.set(this, false);
        /**
         * frontEndsState saves the id's of the front ends checkboxes that are checked
         */
        // TODO (Use a set instead of an array to improve performance)
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewEnvironment_frontEndsCheckedMap.set(this, new Map());
        _GxIdeNewEnvironment_selectedDataStoreId.set(this, void 0);
        _GxIdeNewEnvironment_selectedLanguageId.set(this, void 0);
        _GxIdeNewEnvironment_selectedRuntimeEnvironmentId.set(this, void 0);
        _GxIdeNewEnvironment_shortcutsSrc.set(this, index.getAssetPath(`./gx-ide-assets/new-environment/shortcuts.json`));
        _GxIdeNewEnvironment_newEnvironmentSectionsModel.set(this, []);
        /**
         * The component hard-coded strings translations.
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewEnvironment_componentLocale.set(this, void 0);
        // References needed to collect data con "createCallback" button submit*/
        _GxIdeNewEnvironment_dataStoreEl.set(this, void 0);
        _GxIdeNewEnvironment_environmentNameEl.set(this, void 0);
        _GxIdeNewEnvironment_languageEl.set(this, void 0);
        _GxIdeNewEnvironment_setAsCurrentEnvironmentEl.set(this, void 0);
        _GxIdeNewEnvironment_dataStoreValueChangedHandler.set(this, () => {
            /* the data store item id is used for the value (they are equal)*/
            __classPrivateFieldSet(this, _GxIdeNewEnvironment_selectedDataStoreId, __classPrivateFieldGet(this, _GxIdeNewEnvironment_dataStoreEl, "f").value, "f");
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateEnvironmentName, "f").call(this);
        });
        _GxIdeNewEnvironment_envNameInputHandler.set(this, (e) => {
            const newEnvName = e.detail.trim();
            __classPrivateFieldSet(this, _GxIdeNewEnvironment_envNameModifiedByUser, newEnvName !== this.environmentName, "f");
        });
        _GxIdeNewEnvironment_evaluateSelectedRuntimeEnvironmentId.set(this, () => {
            var _a;
            __classPrivateFieldSet(this, _GxIdeNewEnvironment_selectedRuntimeEnvironmentId, (_a = this.runtimes[0]) === null || _a === void 0 ? void 0 : _a.value, "f");
        });
        // TODO: We must avoid performing the get 3 times.
        // It is used on new-environment as well.
        _GxIdeNewEnvironment_evaluateTooltipRender.set(this, (controlReference) => {
            var _a, _b, _c;
            return ((_b = (_a = this.validatableControls) === null || _a === void 0 ? void 0 : _a.get(controlReference === null || controlReference === void 0 ? void 0 : controlReference.id)) === null || _b === void 0 ? void 0 : _b.hasError) &&
                ((_c = this.validatableControls.get(controlReference.id)) === null || _c === void 0 ? void 0 : _c.message) && (index.h("ch-tooltip", { class: "tooltip", actionElement: controlReference, blockAlign: config.config.tooltipSettings.blockAlign, inlineAlign: config.config.tooltipSettings.inlineAlign, delay: config.config.tooltipSettings.delay }, this.validatableControls.get(controlReference.id).message));
        });
        _GxIdeNewEnvironment_initializeValidatableControlsBasicTab.set(this, () => {
            // populate #controlsValidation with the controls that could have errors.
            const validatableControls = [
                __classPrivateFieldGet(this, _GxIdeNewEnvironment_dataStoreEl, "f"),
                __classPrivateFieldGet(this, _GxIdeNewEnvironment_languageEl, "f")
            ];
            validatableControls.forEach(validatableControl => {
                if (validatableControl.id) {
                    this.validatableControls.set(validatableControl.id, {
                        reference: validatableControl,
                        hasError: false,
                        message: undefined
                    });
                }
            });
        });
        _GxIdeNewEnvironment_languageValueChangedHandler.set(this, async (event) => {
            __classPrivateFieldSet(this, _GxIdeNewEnvironment_selectedLanguageId, event.detail, "f");
            await __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateDataSources, "f").call(this);
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateFrontEnds, "f").call(this);
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateEnvironmentName, "f").call(this);
        });
        _GxIdeNewEnvironment_renderAdvanced.set(this, () => {
            return index.h("slot", { name: "property-grid" });
        });
        _GxIdeNewEnvironment_renderBasic.set(this, () => {
            return [
                index.h("div", { class: {
                        "basic__runtime-environment": true,
                        "dialog-header-with-border": true,
                        "one-runtime-only": this.runtimes.length === 1
                    } }, this.runtimes.length > 1
                    ? [
                        index.h("h2", {
                            // Runtime Environment
                            class: "subtitle-regular-xs\t text-align-center"
                        }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").runtime),
                        index.h("ch-radio-group-render", { class: "radio-group", onChange: __classPrivateFieldGet(this, _GxIdeNewEnvironment_runtimeEnvironmentChangedHandler, "f"), model: this.runtimesRadioGroupModel, value: __classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedRuntimeEnvironmentId, "f") })
                    ]
                    : [
                        index.h("h2", { class: "subtitle-regular-xs\t text-align-center" }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").runtime, ":"),
                        index.h("p", null, this.runtimesRadioGroupModel[0].caption)
                    ]),
                index.h("section", { class: "basic__back-end scrollable" }, index.h("h2", {
                    // back end
                    class: "dialog-header dialog-header-with-border dialog-header__back-end subtitle-regular-xs\t text-align-center spacing-body-inline"
                }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").tabBasic.backEnd.backEndLabel), index.h("div", { class: "field-group main__back-end spacing-body-inline scrollable" }, index.h("div", {
                    // #language
                    class: "field field-block"
                }, index.h("label", { class: "label", htmlFor: "language" }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").tabBasic.backEnd.language), index.h("ch-combo-box-render", { id: "language", class: "combo-box", part: "language", value: __classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedLanguageId, "f"), disabled: this.languages.length === 0, model: this.languageComboBoxModel, onInput: __classPrivateFieldGet(this, _GxIdeNewEnvironment_languageValueChangedHandler, "f"), ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewEnvironment_languageEl, el, "f")) }), __classPrivateFieldGet(this, _GxIdeNewEnvironment_evaluateTooltipRender, "f").call(this, __classPrivateFieldGet(this, _GxIdeNewEnvironment_languageEl, "f"))), index.h("div", {
                    // #data stores
                    class: "field field-block"
                }, index.h("label", { class: "label", htmlFor: "data-store" }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").tabBasic.backEnd.dataStores), index.h("ch-combo-box-render", { id: "data-store", class: "combo-box", part: "data-store", value: __classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedDataStoreId, "f"), model: this.dataStoresComboBoxModel, onInput: __classPrivateFieldGet(this, _GxIdeNewEnvironment_dataStoreValueChangedHandler, "f"), ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewEnvironment_dataStoreEl, el, "f")) }), __classPrivateFieldGet(this, _GxIdeNewEnvironment_evaluateTooltipRender, "f").call(this, __classPrivateFieldGet(this, _GxIdeNewEnvironment_dataStoreEl, "f"))))),
                index.h("section", { class: "basic__front-end scrollable" }, index.h("h2", {
                    // front end
                    class: "dialog-header dialog-header-with-border dialog-header__front-end subtitle-regular-xs\t text-align-center spacing-body-inline"
                }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").tabBasic.frontEnd.frontEndLabel), index.h("div", { class: "field-group front-end__checkboxes spacing-body-inline main__front-end scrollable", role: "group", "aria-labelledby": __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").tabBasic.frontEnd.generators }, helpers.renderChCheckboxItems(this.frontEnds, __classPrivateFieldGet(this, _GxIdeNewEnvironment_frontEndCheckboxInputHandler, "f"), __classPrivateFieldGet(this, _GxIdeNewEnvironment_frontEndsCheckedMap, "f").get(__classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedLanguageId, "f")))))
            ];
        });
        _GxIdeNewEnvironment_runtimeEnvironmentChangedHandler.set(this, async (event) => {
            __classPrivateFieldSet(this, _GxIdeNewEnvironment_selectedRuntimeEnvironmentId, event.detail, "f");
            await __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateLanguages, "f").call(this);
            await __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateDataSources, "f").call(this);
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateEnvironmentName, "f").call(this);
        });
        _GxIdeNewEnvironment_createCallbackHandler.set(this, async () => {
            var _a, _b;
            const selectedFrontEndIds = (_a = __classPrivateFieldGet(this, _GxIdeNewEnvironment_frontEndsCheckedMap, "f").get(__classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedLanguageId, "f"))) !== null && _a !== void 0 ? _a : [];
            this.createCallback({
                setAsCurrent: !!((_b = __classPrivateFieldGet(this, _GxIdeNewEnvironment_setAsCurrentEnvironmentEl, "f")) === null || _b === void 0 ? void 0 : _b.value),
                name: __classPrivateFieldGet(this, _GxIdeNewEnvironment_environmentNameEl, "f").value,
                runtime: __classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedRuntimeEnvironmentId, "f"),
                language: __classPrivateFieldGet(this, _GxIdeNewEnvironment_languageEl, "f").value,
                dataStores: __classPrivateFieldGet(this, _GxIdeNewEnvironment_dataStoreEl, "f").value,
                frontEnds: selectedFrontEndIds
            }).then((formSubmitResult) => {
                this.validatableControls = formValidation.validateControls(formSubmitResult, this.validatableControls);
            });
        });
        _GxIdeNewEnvironment_tabSelectionChangedHandler.set(this, (event) => {
            if (event.detail.newSelectedId === ADVANCED_TAB_SELECTOR) {
                this.advancedTabIsVisible = true;
                // Some logic for advanced tab is done on componentDidRender lifecycle,
                // since the reference to the elements is needed.
            }
        });
        _GxIdeNewEnvironment_updateDataSources.set(this, async () => {
            const updatedDataSources = await this.getDataSourcesCallback(__classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedLanguageId, "f"), __classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedRuntimeEnvironmentId, "f"));
            if ((updatedDataSources === null || updatedDataSources === void 0 ? void 0 : updatedDataSources.length) > 0) {
                this.dataStores = updatedDataSources;
            }
        });
        _GxIdeNewEnvironment_updateEnvironmentName.set(this, async () => {
            if (!__classPrivateFieldGet(this, _GxIdeNewEnvironment_envNameModifiedByUser, "f")) {
                this.environmentName = await this.getEnvironmentNameCallback(__classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedLanguageId, "f"), __classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedDataStoreId, "f"), __classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedRuntimeEnvironmentId, "f"));
            }
        });
        _GxIdeNewEnvironment_updateFrontEnds.set(this, async () => {
            const updatedFrontEnds = await this.getFrontEndsCallback(__classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedLanguageId, "f"));
            if ((updatedFrontEnds === null || updatedFrontEnds === void 0 ? void 0 : updatedFrontEnds.length) > 0) {
                this.frontEnds = updatedFrontEnds;
            }
        });
        _GxIdeNewEnvironment_updateLanguages.set(this, async () => {
            const updatedLanguages = await this.getLanguagesCallback(__classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedRuntimeEnvironmentId, "f"));
            if ((updatedLanguages === null || updatedLanguages === void 0 ? void 0 : updatedLanguages.length) > 0) {
                this.languages = updatedLanguages;
            }
        });
        _GxIdeNewEnvironment_frontEndCheckboxInputHandler.set(this, (event) => {
            const checkedValue = event.target.checkedValue;
            const checked = event.detail === checkedValue;
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateFrontEndsCheckedMap, "f").call(this, checkedValue, checked);
        });
        /**
         * This function updates frontEndsCheckedMap, that contains the checked
         * checkboxes for each language front ends.
         */
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeNewEnvironment_updateFrontEndsCheckedMap.set(this, (checkboxId, checked) => {
            let currentState = __classPrivateFieldGet(this, _GxIdeNewEnvironment_frontEndsCheckedMap, "f").get(__classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedLanguageId, "f"));
            if (!currentState) {
                // first time
                currentState = [];
                __classPrivateFieldGet(this, _GxIdeNewEnvironment_frontEndsCheckedMap, "f").set(__classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedLanguageId, "f"), currentState);
            }
            if (checked) {
                // update by adding
                currentState.push(checkboxId);
            }
            else {
                // update by removing
                const checkboxIndex = currentState.findIndex(id => id === checkboxId);
                array.removeIndex(currentState, checkboxIndex);
            }
        });
        this.advancedTabIsVisible = false;
        this.frontEnds = undefined;
        this.validatableControls = new Map();
        this.dataStoresComboBoxModel = [];
        this.languageComboBoxModel = [];
        this.runtimesRadioGroupModel = [];
        this.cancelCallback = undefined;
        this.createCallback = undefined;
        this.dataStores = undefined;
        this.environmentName = undefined;
        this.getDataSourcesCallback = undefined;
        this.getEnvironmentNameCallback = undefined;
        this.getFrontEndsCallback = undefined;
        this.isAdvanced = false;
        this.languages = undefined;
        this.getLanguagesCallback = undefined;
        this.runtimes = undefined;
        this.setAsTarget = true;
    }
    dataStoresChanged(newValue) {
        if (newValue === null || newValue === void 0 ? void 0 : newValue.length) {
            this.dataStoresComboBoxModel = helpers.mapOptionsToComboBoxItemModel(newValue);
            const result = common.setSelectedItem(newValue, __classPrivateFieldGet(this, _GxIdeNewEnvironment_selectedDataStoreId, "f"));
            __classPrivateFieldSet(this, _GxIdeNewEnvironment_selectedDataStoreId, common.getSelectedItem(result), "f");
        }
    }
    languagesChanged(newValue) {
        if (newValue === null || newValue === void 0 ? void 0 : newValue.length) {
            this.languageComboBoxModel = helpers.mapOptionsToComboBoxItemModel(newValue);
            __classPrivateFieldSet(this, _GxIdeNewEnvironment_selectedLanguageId, common.getSelectedItem(newValue), "f");
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateFrontEnds, "f").call(this);
        }
    }
    runtimesChanged(newValue) {
        if (newValue === null || newValue === void 0 ? void 0 : newValue.length) {
            this.runtimesRadioGroupModel = helpers.mapOptionsToComboBoxItemModel(this.runtimes);
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_updateLanguages, "f").call(this);
        }
    }
    connectedCallback() {
        this.dataStoresChanged(this.dataStores);
        this.languagesChanged(this.languages);
        this.runtimesChanged(this.runtimes);
    }
    componentDidLoad() {
        __classPrivateFieldGet(this, _GxIdeNewEnvironment_initializeValidatableControlsBasicTab, "f").call(this);
    }
    componentDidRender() {
        if (this.advancedTabIsVisible && !__classPrivateFieldGet(this, _GxIdeNewEnvironment_advancedTabHasBeenRendered, "f")) {
            // just call this once.
            __classPrivateFieldSet(this, _GxIdeNewEnvironment_advancedTabHasBeenRendered, true, "f");
        }
    }
    async componentWillLoad() {
        __classPrivateFieldSet(this, _GxIdeNewEnvironment_componentLocale, await locale.Locale.getComponentStrings(this.el), "f");
        __classPrivateFieldSet(this, _GxIdeNewEnvironment_newEnvironmentSectionsModel, [
            {
                id: BASIC_TAB_SELECTOR,
                name: __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").tabBasic.tabLabel
            },
            {
                id: ADVANCED_TAB_SELECTOR,
                name: __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").tabAdvanced.tabLabel
            }
        ], "f");
        __classPrivateFieldGet(this, _GxIdeNewEnvironment_evaluateSelectedRuntimeEnvironmentId, "f").call(this);
    }
    /**
     * Suspends or reactivates the shortcuts
     */
    async suspendShortcuts(suspendShortcuts) {
        if (suspendShortcuts) {
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_chShortcutsEl, "f").suspend = true;
        }
        else {
            __classPrivateFieldGet(this, _GxIdeNewEnvironment_chShortcutsEl, "f").suspend = false;
        }
    }
    render() {
        return (index.h(index.Host, { class: "widget scrollable" }, index.h("ch-theme", { model: CSS_BUNDLES }), index.h("ch-shortcuts", { src: __classPrivateFieldGet(this, _GxIdeNewEnvironment_shortcutsSrc, "f"), ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewEnvironment_chShortcutsEl, el, "f")) }), index.h("section", { class: "section" }, index.h("header", { class: {
                "header": true,
                "spacing-body-inline": true,
                "spacing-body-block-start": true,
                "dialog-header": this.isAdvanced,
                "dialog-header-with-border": !this.isAdvanced
            } }, index.h("div", {
            // #environment name
            class: "field field-inline"
        }, index.h("label", { class: "label", htmlFor: "environment-name" }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").name), index.h("ch-edit", {
            // environment name
            autoFocus: true, id: "environment-name", class: "input", part: "environment-name", value: this.environmentName, placeholder: __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").environmentNamePlaceholder,
            // TODO: toolTip={config.tooltip}
            ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewEnvironment_environmentNameEl, el, "f")), onInput: __classPrivateFieldGet(this, _GxIdeNewEnvironment_envNameInputHandler, "f")
        }))), this.isAdvanced ? (index.h("ch-tab-render", {
            // main section
            class: {
                tab: true,
                [MAIN_SECTION_CLASSES]: true
            }, tabListPosition: "block-start", model: __classPrivateFieldGet(this, _GxIdeNewEnvironment_newEnvironmentSectionsModel, "f"), selectedId: BASIC_TAB_SELECTOR, overflow: "auto", contain: "size", onSelectedItemChange: !this.advancedTabIsVisible && __classPrivateFieldGet(this, _GxIdeNewEnvironment_tabSelectionChangedHandler, "f")
        }, index.h("div", { slot: BASIC_TAB_SELECTOR, class: BASIC_SECTION_PARENT_CLASSES, part: "tab-button-basic" }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_renderBasic, "f").call(this)), this.advancedTabIsVisible && (index.h("div", { slot: ADVANCED_TAB_SELECTOR, class: "advanced spacing-body-inline", part: "tab-button-advanced" }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_renderAdvanced, "f").call(this))))) : (index.h("div", {
            // main section
            class: MAIN_SECTION_CLASSES
        }, index.h("div", { class: BASIC_SECTION_PARENT_CLASSES }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_renderBasic, "f").call(this)))), index.h("footer", { class: {
                "dialog-footer": this.isAdvanced,
                "dialog-footer-with-border": !this.isAdvanced,
                "dialog-footer-space-between": true,
                "spacing-body-block-end": true,
                "spacing-body-inline": true
            } }, index.h("ch-checkbox", {
            // #set as current environment
            class: "checkbox", caption: __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").footer.setAsCurrentEnvironment, ref: (el) => (__classPrivateFieldSet(this, _GxIdeNewEnvironment_setAsCurrentEnvironmentEl, el, "f")), checkedValue: "current-environment", value: this.setAsTarget ? "current-environment" : "", part: "set-as-current-environment"
        }), index.h("div", { class: "buttons-spacer" }, index.h("button", {
            // #cancel
            class: "button-secondary", onClick: this.cancelCallback, part: "button button-cancel"
        }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").footer.btnCancel), index.h("button", {
            // #create
            class: "button-primary", onClick: __classPrivateFieldGet(this, _GxIdeNewEnvironment_createCallbackHandler, "f"), part: "button button-create"
        }, __classPrivateFieldGet(this, _GxIdeNewEnvironment_componentLocale, "f").footer.btnCreate))))));
    }
    static get assetsDirs() { return ["gx-ide-assets/new-environment"]; }
    get el() { return index.getElement(this); }
    static get watchers() { return {
        "dataStores": ["dataStoresChanged"],
        "languages": ["languagesChanged"],
        "runtimes": ["runtimesChanged"]
    }; }
};
_GxIdeNewEnvironment_advancedTabHasBeenRendered = new WeakMap(), _GxIdeNewEnvironment_chShortcutsEl = new WeakMap(), _GxIdeNewEnvironment_envNameModifiedByUser = new WeakMap(), _GxIdeNewEnvironment_frontEndsCheckedMap = new WeakMap(), _GxIdeNewEnvironment_selectedDataStoreId = new WeakMap(), _GxIdeNewEnvironment_selectedLanguageId = new WeakMap(), _GxIdeNewEnvironment_selectedRuntimeEnvironmentId = new WeakMap(), _GxIdeNewEnvironment_shortcutsSrc = new WeakMap(), _GxIdeNewEnvironment_newEnvironmentSectionsModel = new WeakMap(), _GxIdeNewEnvironment_componentLocale = new WeakMap(), _GxIdeNewEnvironment_dataStoreEl = new WeakMap(), _GxIdeNewEnvironment_environmentNameEl = new WeakMap(), _GxIdeNewEnvironment_languageEl = new WeakMap(), _GxIdeNewEnvironment_setAsCurrentEnvironmentEl = new WeakMap(), _GxIdeNewEnvironment_dataStoreValueChangedHandler = new WeakMap(), _GxIdeNewEnvironment_envNameInputHandler = new WeakMap(), _GxIdeNewEnvironment_evaluateSelectedRuntimeEnvironmentId = new WeakMap(), _GxIdeNewEnvironment_evaluateTooltipRender = new WeakMap(), _GxIdeNewEnvironment_initializeValidatableControlsBasicTab = new WeakMap(), _GxIdeNewEnvironment_languageValueChangedHandler = new WeakMap(), _GxIdeNewEnvironment_renderAdvanced = new WeakMap(), _GxIdeNewEnvironment_renderBasic = new WeakMap(), _GxIdeNewEnvironment_runtimeEnvironmentChangedHandler = new WeakMap(), _GxIdeNewEnvironment_createCallbackHandler = new WeakMap(), _GxIdeNewEnvironment_tabSelectionChangedHandler = new WeakMap(), _GxIdeNewEnvironment_updateDataSources = new WeakMap(), _GxIdeNewEnvironment_updateEnvironmentName = new WeakMap(), _GxIdeNewEnvironment_updateFrontEnds = new WeakMap(), _GxIdeNewEnvironment_updateLanguages = new WeakMap(), _GxIdeNewEnvironment_frontEndCheckboxInputHandler = new WeakMap(), _GxIdeNewEnvironment_updateFrontEndsCheckedMap = new WeakMap();
GxIdeNewEnvironment.style = newEnvironmentCss;

exports.gx_ide_new_environment = GxIdeNewEnvironment;

//# sourceMappingURL=gx-ide-new-environment.cjs.entry.js.map