import { r as registerInstance, d as createEvent, h, a as Host } from './index-55463a54.js';
import { e as defaultIconPack, i as useLanguage } from './ui-store-76bb0e8e.js';
import { S as SyncWithStore } from './index-dafb4b7f.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 = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        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"]
    }; }
};
__decorate([
    SyncWithStore()
], RtkAiToggle.prototype, "states", void 0);
__decorate([
    SyncWithStore()
], RtkAiToggle.prototype, "meeting", void 0);
__decorate([
    SyncWithStore()
], RtkAiToggle.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkAiToggle.prototype, "t", void 0);
RtkAiToggle.style = RtkAiToggleStyle0;

export { RtkAiToggle as rtk_ai_toggle };
