'use strict';

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

const index$1 = require('./index-2e5758b6.js');
const uiStore = require('./ui-store-583d205a.js');
const index = require('./index-3f8e5441.js');

const rtkEndedScreenCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;display:flex;flex-direction:column;align-items:center;justify-content:center}.ctr{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-8, 32px)}rtk-logo.loaded{height:var(--rtk-space-12, 48px)}.rejoin-button{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-6, 24px);padding-bottom:var(--rtk-space-6, 24px);padding-left:var(--rtk-space-16, 64px);padding-right:var(--rtk-space-16, 64px)}.rejoin-icon{margin-right:var(--rtk-space-2, 8px)}p{font-size:16px;border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}p.breakout{font-size:20px;display:flex;flex-direction:column;align-items:center}p.breakout span{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-0, 0px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}span{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}";
const RtkEndedScreenStyle0 = rtkEndedScreenCss;

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 RtkEndedScreen = class {
    constructor(hostRef) {
        index$1.registerInstance(this, hostRef);
        /** Config object */
        this.config = uiStore.createDefaultConfig();
        /** Icon */
        this.icon = uiStore.defaultIconPack;
        /** Language */
        this.t = uiStore.useLanguage();
        /** Icon pack */
        this.iconPack = uiStore.defaultIconPack;
        this.message = '';
    }
    connectedCallback() {
        this.statesChanged(this.states);
    }
    getBreakoutRoomsMessage(states) {
        var _a;
        let message;
        if ((states === null || states === void 0 ? void 0 : states.roomLeftState) === 'connected-meeting') {
            if (((_a = this.states.activeBreakoutRoomsManager) === null || _a === void 0 ? void 0 : _a.destinationMeetingId) ===
                this.meeting.connectedMeetings.parentMeeting.id) {
                message = 'breakout_rooms.move_reason.switch_main_room';
            }
            else {
                message = 'breakout_rooms.move_reason.switch_room';
            }
        }
        return message;
    }
    statesChanged(states) {
        if (states != null) {
            switch (states === null || states === void 0 ? void 0 : states.roomLeftState) {
                case 'left':
                    this.message = 'ended.left';
                    break;
                case 'kicked':
                    this.message = 'ended.kicked';
                    break;
                case 'disconnected':
                    this.message = 'ended.disconnected';
                    break;
                case 'rejected':
                    this.message = 'ended.rejected';
                    break;
                case 'connected-meeting':
                    this.message = this.getBreakoutRoomsMessage(states);
                    break;
                case 'unauthorized':
                    this.message = 'ended.unauthorized';
                    break;
                default:
                    this.message = 'ended';
            }
        }
    }
    renderBreakoutRoomScreen() {
        return (index$1.h(index$1.Host, null, index$1.h("div", { class: "ctr", part: "container" }, index$1.h("rtk-icon", { icon: this.iconPack.breakout_rooms }), index$1.h("p", { part: "message", class: "breakout" }, this.t(this.message)))));
    }
    render() {
        if (!this.meeting)
            return null;
        const states = this.states;
        if (states.roomLeftState === 'connected-meeting') {
            return this.renderBreakoutRoomScreen();
        }
        return (index$1.h(index$1.Host, null, index$1.h("div", { class: "ctr", part: "container" }, index$1.h("rtk-logo", { meeting: this.meeting, config: this.config, part: "logo", t: this.t }), index$1.h("p", { part: "message" }, this.t(this.message)), (states === null || states === void 0 ? void 0 : states.roomLeftState) === 'disconnected' && (index$1.h("span", { part: "description" }, this.t('ended.network'))))));
    }
    static get watchers() { return {
        "states": ["statesChanged"]
    }; }
};
__decorate([
    index.SyncWithStore()
], RtkEndedScreen.prototype, "config", void 0);
__decorate([
    index.SyncWithStore()
], RtkEndedScreen.prototype, "states", void 0);
__decorate([
    index.SyncWithStore()
], RtkEndedScreen.prototype, "t", void 0);
__decorate([
    index.SyncWithStore()
], RtkEndedScreen.prototype, "iconPack", void 0);
__decorate([
    index.SyncWithStore()
], RtkEndedScreen.prototype, "meeting", void 0);
RtkEndedScreen.style = RtkEndedScreenStyle0;

exports.rtk_ended_screen = RtkEndedScreen;
