import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { c as config } from './config.js';
import { L as Locale } from './locale.js';
import { d as defineCustomElement$2 } from './container.js';

const wfSettingsCss = ":host{display:grid;block-size:100%}.opacity-0{opacity:0}.gxi-hidden{display:none !important}.align-center{display:flex;align-items:center}.align-end{display:flex;align-items:end}.overflow-auto{overflow:auto}:host(.gx-ide-component){height:100% !important;display:flex !important;flex-direction:column !important}.gx-ide-main-wrapper{color:var(--gx-ide-component-text-color);font-weight:var(--font-style-regular);font-size:var(--font-size-body-m);font-family:var(--font-family-body);height:100%;display:flex;flex-direction:column;flex-grow:1;box-sizing:border-box}.buttons-container{display:flex;gap:var(--spacing-gap-m)}.giu-static-pill-icon-and-text,.giu-static-pill{background-color:var(--elevation-background-color, var(--color-accent-surface-elevation-1));padding-inline:var(--spacing-padding-m);color:var(--color-text-neutral-default);font-size:var(--font-size-body-s);line-height:var(--line-height-relaxed);font-weight:var(--font-style-regular);border-radius:4px;min-block-size:25px;display:inline-grid;align-items:center;pointer-events:none;inline-size:max-content}.giu-static-pill-icon-and-text{display:inline-grid;grid-auto-flow:column;grid-auto-columns:max-content;gap:var(--spacing-gap-m)}.tab-full-width-buttons::part(tab-list block-start),.tab-full-width-buttons::part(tab-list block-end){grid-auto-columns:1fr}.tab-full-width-buttons::part(tab block-start){justify-content:center}.tree-view::part(item__header){--icon__system_warning_warning--disabled:var(\n    --icon__system_warning_warning--enabled\n  )}.tabular-grid{--focus-outline-width:1px}:host{display:block}.options{max-inline-size:50%;display:flex;flex-direction:column;gap:var(--spacing-gap-m-large)}.message-item{display:flex;align-items:start;gap:var(--spacing-gap-m)}";

const GxIdeWFSettings = /*@__PURE__*/ proxyCustomElement(class GxIdeWFSettings extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        this.componentDidRenderFirstTime = createEvent(this, "componentDidRenderFirstTime", 7);
        this.renderedFirstTime = false;
        // 7.LISTENERS //
        // 8.PUBLIC METHODS API //
        // 9.LOCAL METHODS //
        this.cancelHandler = () => {
            if (this.cancelCallback) {
                this.cancelCallback();
            }
        };
        this.saveCallbackHandler = () => {
            if (this.saveCallback) {
                const wfConfigData = {
                    installClient: this.installGxFlowEl.checked,
                    futureUpgrades: this.futureUpgradesEl.value
                };
                this.saveCallback(wfConfigData);
            }
        };
        this.displayTitle = false;
        this.configurationType = "installation";
        this.defaultConfiguration = {
            installClient: true,
            futureUpgrades: "automatic"
        };
        this.saveCallback = undefined;
        this.cancelCallback = undefined;
    }
    // 6.COMPONENT LIFECYCLE METHODS //
    async componentWillLoad() {
        this._componentLocale = await Locale.getComponentStrings(this.el);
    }
    componentDidRender() {
        if (!this.renderedFirstTime) {
            this.componentDidRenderFirstTime.emit(this._componentLocale.componentName);
            this.renderedFirstTime = true;
        }
    }
    // 10.RENDER() FUNCTION //
    render() {
        return (h(Host, { class: "gx-ide-component" }, h("div", { class: "gx-ide-main-wrapper" }, h("gx-ide-container", { slimmerFooter: config.gxIdeContainer.slimmerFooter }, h("div", { class: "message-item" }, h("gxg-icon", { type: "gx-server/changes-commit-pending", color: "auto", size: "small" }), h("gxg-text", null, this._componentLocale.description[this.configurationType])), h("div", { class: "options" }, h("gxg-form-checkbox", { label: this._componentLocale.installGxFlow, checked: this.defaultConfiguration.installClient, ref: el => (this.installGxFlowEl = el) }), h("gxg-combo-box", { class: "upgrades-options", label: this._componentLocale.manageUpgrades, disableFilter: true, value: this.defaultConfiguration.futureUpgrades, ref: el => (this.futureUpgradesEl = el) }, h("gxg-combo-box-item", { value: "automatic" }, this._componentLocale.upgradesOptions[0]), h("gxg-combo-box-item", { value: "prompt" }, this._componentLocale.upgradesOptions[1]), h("gxg-combo-box-item", { value: "never" }, this._componentLocale.upgradesOptions[2]))), h("gxg-text", { textAlign: "end", type: "text-regular" }, this._componentLocale.prompt[this.configurationType]), h("gxg-button", { slot: "footer-end", type: "outlined", onClick: this.cancelHandler }, "Cancel"), h("gxg-button", { slot: "footer-end", onClick: this.saveCallbackHandler }, this._componentLocale.footer.confirmButton[this.configurationType])))));
    }
    static get assetsDirs() { return ["gx-ide-assets/wf-settings"]; }
    get el() { return this; }
    static get style() { return wfSettingsCss; }
}, [1, "gx-ide-wf-settings", {
        "displayTitle": [4, "display-title"],
        "configurationType": [1, "configuration-type"],
        "defaultConfiguration": [16],
        "saveCallback": [16],
        "cancelCallback": [16]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["gx-ide-wf-settings", "gx-ide-container"];
    components.forEach(tagName => { switch (tagName) {
        case "gx-ide-wf-settings":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, GxIdeWFSettings);
            }
            break;
        case "gx-ide-container":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}

const GxIdeWfSettings = GxIdeWFSettings;
const defineCustomElement = defineCustomElement$1;

export { GxIdeWfSettings, defineCustomElement };

//# sourceMappingURL=gx-ide-wf-settings.js.map