import { p as proxyCustomElement, H, e as createEvent, h, c as Host } from './p-ae373651.js';
import { e as defaultIconPack, i as useLanguage } from './p-5b3a7f00.js';
import { S as SyncWithStore } from './p-070aa695.js';
import { d as defineCustomElement$4 } from './p-0031a3c0.js';
import { d as defineCustomElement$3 } from './p-3e0452c4.js';
import { d as defineCustomElement$2 } from './p-e6245534.js';

const rtkAiToggleCss = ":host{display:block}:host([data-hidden]){display:none}";
const RtkAiToggleStyle0 = rtkAiToggleCss;

var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
        r = Reflect.decorate(decorators, target, key, desc);
    else
        for (var i = decorators.length - 1; i >= 0; i--)
            if (d = decorators[i])
                r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
const RtkAiToggle$1 = /*@__PURE__*/ proxyCustomElement(class RtkAiToggle extends H {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        this.stateUpdate = createEvent(this, "rtkStateUpdate", 7);
        /** Variant */
        this.variant = 'button';
        /** Icon pack */
        this.iconPack = defaultIconPack;
        /** Language */
        this.t = useLanguage();
        this.aiActive = false;
        this.toggleAI = () => {
            const states = this.states;
            this.aiActive = !((states === null || states === void 0 ? void 0 : states.activeSidebar) && (states === null || states === void 0 ? void 0 : states.sidebar) === 'ai');
            this.stateUpdate.emit({
                activeSidebar: this.aiActive,
                sidebar: this.aiActive ? 'ai' : undefined,
                activeMoreMenu: false,
            });
        };
    }
    connectedCallback() {
        this.statesChanged(this.states);
    }
    statesChanged(states) {
        if (states != null) {
            this.aiActive = states.activeSidebar === true && states.sidebar === 'ai';
        }
    }
    render() {
        var _a, _b;
        if (!this.meeting)
            return null;
        const text = this.t('ai.meeting_ai');
        if (!((_b = (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.permissions).transcriptionEnabled) {
            return h(Host, { "data-hidden": true });
        }
        return (h(Host, { title: text }, h("rtk-controlbar-button", { part: "controlbar-button", size: this.size, iconPack: this.iconPack, class: { active: this.aiActive }, onClick: this.toggleAI, icon: this.iconPack.meeting_ai, label: text, variant: this.variant, brandIcon: true })));
    }
    static get watchers() { return {
        "states": ["statesChanged"]
    }; }
    static get style() { return RtkAiToggleStyle0; }
}, [1, "rtk-ai-toggle", {
        "variant": [513],
        "states": [16],
        "meeting": [16],
        "size": [513],
        "iconPack": [16],
        "t": [16],
        "aiActive": [32]
    }, undefined, {
        "states": ["statesChanged"]
    }]);
__decorate([
    SyncWithStore()
], RtkAiToggle$1.prototype, "states", void 0);
__decorate([
    SyncWithStore()
], RtkAiToggle$1.prototype, "meeting", void 0);
__decorate([
    SyncWithStore()
], RtkAiToggle$1.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkAiToggle$1.prototype, "t", void 0);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["rtk-ai-toggle", "rtk-controlbar-button", "rtk-icon", "rtk-spinner"];
    components.forEach(tagName => { switch (tagName) {
        case "rtk-ai-toggle":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, RtkAiToggle$1);
            }
            break;
        case "rtk-controlbar-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$4();
            }
            break;
        case "rtk-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "rtk-spinner":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}
defineCustomElement$1();

const RtkAiToggle = RtkAiToggle$1;
const defineCustomElement = defineCustomElement$1;

export { RtkAiToggle, defineCustomElement };
