import { getAssetPath, proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { g as getIconPath } from './mer-animated-dots.js';
import 'lit';
import 'lit/directives/when.js';
import 'lit/directives/if-defined.js';
import { L as Locale } from './locale.js';

const chatWelcomeCss = ":host{block-size:100%}.welcome-container{--opacity:1;--translate-y:0;opacity:var(--opacity);transform:translateY(var(--translate-y));transition:all var(--transition-duration);display:flex;block-size:100%;grid-template-rows:max-content max-content;flex-direction:column;justify-content:space-between;background-repeat:no-repeat;background-size:cover;background-size:contain}.welcome-container.hidden{--opacity:0;--translate-y:4px}.header{--opacity:0;--translate-y:3px;transition:all var(--transition-duration) var(--transition-delay) cubic-bezier(0.4, 0, 0.2, 1);transform:translateY(var(--translate-y));opacity:var(--opacity);display:flex;flex-direction:column;gap:var(--spacing-gap-xl);align-items:center;padding:16px}.header--visible{--opacity:1;--translate-y:0}.header__circle{inline-size:55px;block-size:55px;background-size:contain;background-repeat:no-repeat;background-position:center center;margin-block-end:calc(8px * -1)}.header__title{display:grid;text-align:center;margin:0;text-align:center;white-space:pre-line;line-height:var(--line-height-regular);font-weight:var(--font-style-semi-bold);font-size:var(--font-size-header-h3)}.header__greeting{line-height:var(--line-height-relaxed);text-align:center;font-weight:var(--font-style-regular)}.suggested-prompts{--opacity:1;opacity:var(--opacity);transition:opacity var(--transition-duration);display:flex;flex-direction:column;gap:var(--spacing-gap-xl);list-style:none;margin:0;padding:16px}.suggested-prompts.hidden{--opacity:0}.suggested-prompts__button{opacity:0;transform:translateX(-3px);animation:fadeInSuggestedPromptButton var(--timing-regular) ease forwards;animation-delay:var(--delay, 0s);padding:var(--spacing-padding-l);border-radius:44px;font-style:oblique;cursor:pointer;display:flex;align-items:center;gap:var(--spacing-gap-m);max-inline-size:300px;background-color:var(--color-component-button-suggestion-accent-default);color:var(--color-text-neutral-default);border:1px solid var(--color-component-button-suggestion-border-default)}.suggested-prompts__button:hover{background-color:var(--color-component-button-suggestion-accent-hover);border-color:var(--color-component-button-suggestion-border-hover);color:var(--color-text-primary-hover)}.suggested-prompts__button:active{background-color:var(--color-component-button-suggestion-accent-pressed);border-color:var(--color-component-button-suggestion-border-pressed);color:var(--color-text-neutral-pressed)}.suggested-prompts__icon{flex-shrink:0}@keyframes fadeInSuggestedPromptButton{from{opacity:0;transform:translateX(-3px)}to{opacity:1;transform:translateX(0)}}";

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 _GxIdeChatWelcome_componentLocale, _GxIdeChatWelcome_animationEntrance, _GxIdeChatWelcome_sendPromptToChat, _GxIdeChatWelcome_animationExit;
const HEADER_ILLUSTRATION = getAssetPath(`./gx-ide-assets/chat-welcome/images/header-illustration.svg`);
const AI_AVATAR = getAssetPath(`./gx-ide-assets/chat-welcome/images/ai-avatar-welcome.svg`);
const HEADER_TRANSITION_DELAY = 100;
const HEADER_TRANSITION_DURATION = 500;
const SUGGESTED_PROMPT_BUTTON_INTERVAL = 200;
const SUGGESTED_PROMPT_BUTTONS_DELAY = 500;
const WELCOME_EXIT_DURATION = 100;
const AI_ICON = getIconPath({
    category: "system",
    name: "assistant",
    colorType: "primary"
});
const ARROW_RIGHT_ICON = getIconPath({
    category: "system",
    name: "arrow-right",
    colorType: "primary"
});
const CSS_BUNDLES = [
    "resets/box-sizing",
    "components/icon",
    "utils/typography"
];
const GxIdeChatWelcome = /*@__PURE__*/ proxyCustomElement(class GxIdeChatWelcome extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        // eslint-disable-next-line @stencil-community/own-props-must-be-private
        _GxIdeChatWelcome_componentLocale.set(this, void 0);
        _GxIdeChatWelcome_animationEntrance.set(this, () => {
            setTimeout(() => {
                this.showHeader = true;
                setTimeout(() => {
                    this.showSuggestedPrompts = true;
                }, SUGGESTED_PROMPT_BUTTONS_DELAY);
            }, HEADER_TRANSITION_DELAY + HEADER_TRANSITION_DURATION);
        });
        _GxIdeChatWelcome_sendPromptToChat.set(this, async (e) => {
            const prompt = e.currentTarget.dataset["prommpt"];
            await __classPrivateFieldGet(this, _GxIdeChatWelcome_animationExit, "f").call(this);
            this.suggestedPrompRequestedCallback(prompt);
        });
        _GxIdeChatWelcome_animationExit.set(this, async () => {
            this.hideWelcome = true;
            await new Promise(resolve => setTimeout(resolve, WELCOME_EXIT_DURATION));
        });
        this.showHeader = false;
        this.showSuggestedPrompts = false;
        this.hideWelcome = false;
        this.welcomeTitle = undefined;
        this.welcomeGreeting = undefined;
        this.suggestedPrompts = undefined;
        this.suggestedPrompRequestedCallback = undefined;
    }
    async componentWillLoad() {
        __classPrivateFieldSet(this, _GxIdeChatWelcome_componentLocale, await Locale.getComponentStrings(this.el), "f");
        // Set defaults
        if (!this.welcomeTitle) {
            this.welcomeTitle = __classPrivateFieldGet(this, _GxIdeChatWelcome_componentLocale, "f").welcomeTitle;
        }
        if (!this.welcomeGreeting) {
            this.welcomeGreeting = __classPrivateFieldGet(this, _GxIdeChatWelcome_componentLocale, "f").welcomeGreeting;
        }
        if (!this.suggestedPrompts) {
            this.suggestedPrompts = __classPrivateFieldGet(this, _GxIdeChatWelcome_componentLocale, "f").suggestedPrompts;
        }
    }
    componentDidRender() {
        if (!this.hideWelcome) {
            __classPrivateFieldGet(this, _GxIdeChatWelcome_animationEntrance, "f").call(this);
        }
    }
    /**
     * It will exit the wellcome screen and remove it from the dom.
     */
    async exitWelcome() {
        __classPrivateFieldGet(this, _GxIdeChatWelcome_animationExit, "f").call(this);
    }
    render() {
        return (h(Host, null, h("ch-theme", { model: CSS_BUNDLES }), h("div", { class: { "welcome-container": true, "hidden": this.hideWelcome }, style: {
                "backgroundImage": `url(${HEADER_ILLUSTRATION})`,
                "--transition-duration": `${WELCOME_EXIT_DURATION}ms`
            } }, h("header", { class: { "header": true, "header--visible": this.showHeader }, style: {
                "--transition-delay": `${HEADER_TRANSITION_DELAY}ms`,
                "--transition-duration": `${HEADER_TRANSITION_DURATION}ms`
            } }, h("span", { class: "header__circle", style: { backgroundImage: `url(${AI_AVATAR})` } }), h("h2", { class: "header__title" }, this.welcomeTitle), h("p", { class: "header__greeting" }, this.welcomeGreeting)), this.suggestedPrompts && this.showSuggestedPrompts && (h("ul", { class: "suggested-prompts" }, this.suggestedPrompts.map((prompt, i) => (h("li", { class: "suggested-prompts__item" }, h("button", { class: {
                "suggested-prompts__button": true
            }, onClick: __classPrivateFieldGet(this, _GxIdeChatWelcome_sendPromptToChat, "f"), style: {
                "--delay": `${SUGGESTED_PROMPT_BUTTON_INTERVAL * i}ms`
            }, "data-prommpt": prompt }, h("ch-image", { src: AI_ICON, class: "icon-m suggested-prompts__icon" }), prompt, h("ch-image", { src: ARROW_RIGHT_ICON, class: "icon-m suggested-prompts__icon" }))))))))));
    }
    static get assetsDirs() { return ["gx-ide-assets/chat-welcome"]; }
    get el() { return this; }
    static get style() { return chatWelcomeCss; }
}, [1, "gx-ide-chat-welcome", {
        "welcomeTitle": [1025, "welcome-title"],
        "welcomeGreeting": [1025, "welcome-greeting"],
        "suggestedPrompts": [1040],
        "suggestedPrompRequestedCallback": [16],
        "showHeader": [32],
        "showSuggestedPrompts": [32],
        "hideWelcome": [32],
        "exitWelcome": [64]
    }]);
_GxIdeChatWelcome_componentLocale = new WeakMap(), _GxIdeChatWelcome_animationEntrance = new WeakMap(), _GxIdeChatWelcome_sendPromptToChat = new WeakMap(), _GxIdeChatWelcome_animationExit = new WeakMap();
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["gx-ide-chat-welcome"];
    components.forEach(tagName => { switch (tagName) {
        case "gx-ide-chat-welcome":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, GxIdeChatWelcome);
            }
            break;
    } });
}

export { GxIdeChatWelcome as G, defineCustomElement as d };

//# sourceMappingURL=chat-welcome.js.map