import { p as proxyCustomElement, H, h, c as Host } from './p-ae373651.js';
import { i as useLanguage, e as defaultIconPack, L as showLivestream } from './p-5b3a7f00.js';
import './p-a83ccdbd.js';
import { S as SyncWithStore } from './p-070aa695.js';
import { d as defineCustomElement$1 } from './p-3e0452c4.js';

const rtkLivestreamIndicatorCss = ":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{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);display:flex}:host([data-hidden]){display:none}:host[size='sm']{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px)}.indicator{display:flex;flex-direction:row;align-items:center;font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);animation:blink 4s linear infinite}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='sm']) .indicator span{display:none}@keyframes blink{0%,10%{opacity:0}11%,100%{opacity:1}}";
const RtkLivestreamIndicatorStyle0 = rtkLivestreamIndicatorCss;

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 RtkLivestreamIndicator = /*@__PURE__*/ proxyCustomElement(class RtkLivestreamIndicator extends H {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        /** Language */
        this.t = useLanguage();
        /** Icon pack */
        this.iconPack = defaultIconPack;
        this.setIsLivestreaming = (state) => {
            this.isLivestreaming = state === 'LIVESTREAMING';
        };
    }
    connectedCallback() {
        this.meetingChanged(this.meeting);
    }
    disconnectedCallback() {
        var _a, _b;
        (_b = (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.livestream) === null || _b === void 0 ? void 0 : _b.removeListener('livestreamUpdate', this.setIsLivestreaming);
    }
    meetingChanged(meeting) {
        var _a, _b;
        if (!meeting)
            return;
        this.setIsLivestreaming((_a = this.meeting.livestream) === null || _a === void 0 ? void 0 : _a.state);
        (_b = this.meeting.livestream) === null || _b === void 0 ? void 0 : _b.on('livestreamUpdate', this.setIsLivestreaming);
    }
    render() {
        if (!showLivestream(this.meeting) || !this.isLivestreaming)
            return h(Host, { "data-hidden": true });
        return (h(Host, null, h("div", { class: "indicator", "aria-label": this.t('livestream.indicator'), part: "indicator" }, h("rtk-icon", { icon: this.iconPack.start_livestream, size: this.size }), h("span", null, this.t('LIVE')))));
    }
    static get watchers() { return {
        "meeting": ["meetingChanged"]
    }; }
    static get style() { return RtkLivestreamIndicatorStyle0; }
}, [1, "rtk-livestream-indicator", {
        "meeting": [16],
        "size": [513],
        "t": [16],
        "iconPack": [16],
        "isLivestreaming": [32]
    }, undefined, {
        "meeting": ["meetingChanged"]
    }]);
__decorate([
    SyncWithStore()
], RtkLivestreamIndicator.prototype, "meeting", void 0);
__decorate([
    SyncWithStore()
], RtkLivestreamIndicator.prototype, "t", void 0);
__decorate([
    SyncWithStore()
], RtkLivestreamIndicator.prototype, "iconPack", void 0);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["rtk-livestream-indicator", "rtk-icon"];
    components.forEach(tagName => { switch (tagName) {
        case "rtk-livestream-indicator":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, RtkLivestreamIndicator);
            }
            break;
        case "rtk-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}
defineCustomElement();

export { RtkLivestreamIndicator as R, defineCustomElement as d };
