import { r as registerInstance, d as createEvent, h, a as Host } from './index-55463a54.js';
import { e as defaultIconPack, i as useLanguage, U as getPreference, V as setPreference } from './ui-store-76bb0e8e.js';
import { S as SyncWithStore } from './index-dafb4b7f.js';

const rtkSettingsAudioCss = ":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{display:flex;width:100%;flex-direction:column}audio{visibility:hidden}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.row{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}rtk-audio-visualizer{flex-shrink:0}rtk-button{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}rtk-button rtk-icon{margin-right:var(--rtk-space-2, 8px)}";
const RtkSettingsAudioStyle0 = rtkSettingsAudioCss;

var __decorate$1 = (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 RtkSettingsAudio = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.stateUpdate = createEvent(this, "rtkStateUpdate", 7);
        /** Icon pack */
        this.iconPack = defaultIconPack;
        /** Language */
        this.t = useLanguage();
    }
    render() {
        var _a, _b;
        if (!this.meeting)
            return null;
        const defaults = {
            meeting: this.meeting,
            states: this.states,
            size: this.size,
            iconPack: this.iconPack,
            t: this.t,
        };
        const states = this.states;
        const initialNotificationSoundsPreference = ((_a = states === null || states === void 0 ? void 0 : states.prefs) === null || _a === void 0 ? void 0 : _a.muteNotificationSounds) === true ||
            getPreference('mute-notification-sounds') === 'true';
        return (h(Host, null, h("rtk-microphone-selector", Object.assign({}, defaults), h("rtk-audio-visualizer", { participant: (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.self, iconPack: this.iconPack, t: this.t, slot: "indicator" })), h("rtk-speaker-selector", Object.assign({}, defaults)), h("div", { class: "group", part: "notification-toggle" }, h("div", { class: "row" }, h("label", { htmlFor: "notification-toggle" }, this.t('settings.notification_sound')), h("rtk-switch", { id: "notification-toggle", checked: !initialNotificationSoundsPreference, onRtkChange: (e) => {
                const { checked } = e.target;
                const muteNotificationSounds = !checked;
                this.stateUpdate.emit({ prefs: { muteNotificationSounds } });
                setPreference('mute-notification-sounds', muteNotificationSounds);
            }, iconPack: this.iconPack, t: this.t })))));
    }
};
__decorate$1([
    SyncWithStore()
], RtkSettingsAudio.prototype, "meeting", void 0);
__decorate$1([
    SyncWithStore()
], RtkSettingsAudio.prototype, "states", void 0);
__decorate$1([
    SyncWithStore()
], RtkSettingsAudio.prototype, "iconPack", void 0);
__decorate$1([
    SyncWithStore()
], RtkSettingsAudio.prototype, "t", void 0);
RtkSettingsAudio.style = RtkSettingsAudioStyle0;

const rtkSettingsVideoCss = ":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)}.rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5)}:host{display:flex;width:100%;flex-direction:column}.rtk-select{width:100%;text-overflow:ellipsis}rtk-participant-tile{margin-left:auto;margin-right:auto;margin-bottom:var(--rtk-space-4, 16px);max-width:100%}#icon{padding-bottom:var(--rtk-space-1, 4px)}.apply-button{height:var(--rtk-space-10, 40px)}label{-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:14px}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.row{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.section{display:flex;flex-direction:column}@media only screen and (max-height: 480px) and (orientation: landscape){:host{flex-direction:row}:host([size='sm']){flex-direction:row}.section[part='tile-preview']{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);max-height:90%;max-width:40%;flex-shrink:1}.section[part='video-settings']{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);flex-grow:1}}";
const RtkSettingsVideoStyle0 = rtkSettingsVideoCss;

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 RtkSettingsVideo = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.stateUpdate = createEvent(this, "rtkStateUpdate", 7);
        /** Icon pack */
        this.iconPack = defaultIconPack;
        /** Language */
        this.t = useLanguage();
        this.onVideoUpdate = (videoState) => {
            this.videoEnabled = videoState.videoEnabled;
        };
    }
    componentDidLoad() {
        this.meetingChanged(this.meeting);
    }
    meetingChanged(meeting) {
        var _a;
        if (!meeting)
            return;
        this.videoEnabled = meeting.self.videoEnabled;
        (_a = meeting.self) === null || _a === void 0 ? void 0 : _a.addListener('videoUpdate', this.onVideoUpdate);
    }
    disconnectedCallback() {
        var _a;
        (_a = this.meeting.self) === null || _a === void 0 ? void 0 : _a.removeListener('videoUpdate', this.onVideoUpdate);
    }
    render() {
        var _a, _b, _c;
        if (!this.meeting)
            return null;
        const defaults = {
            meeting: this.meeting,
            states: this.states,
            size: this.size,
            iconPack: this.iconPack,
            t: this.t,
        };
        const states = this.states;
        const initialMirrorPreference = ((_a = states === null || states === void 0 ? void 0 : states.prefs) === null || _a === void 0 ? void 0 : _a.mirrorVideo) === true || getPreference('mirror-video') === 'true';
        return (h(Host, null, h("div", { class: "section", part: "tile-preview" }, h("div", { class: "group", part: "tile-preview" }, this.videoEnabled === true ? (h("rtk-participant-tile", { meeting: this.meeting, participant: (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.self, iconPack: this.iconPack, t: this.t, states: states, size: this.size, isPreview: true })) : (h("div", { class: "camera-off-helper" }, h("rtk-participant-tile", { meeting: this.meeting, participant: (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.self, size: this.size }, h("div", null, h("rtk-icon", { id: "icon", icon: this.iconPack.video_off, tabIndex: -1, "aria-hidden": true }), h("div", null, this.t('settings.camera_off')))))))), h("rtk-camera-selector", Object.assign({}, defaults)), h("div", { class: "group", part: "mirror-toggle" }, h("div", { class: "row" }, h("label", { htmlFor: "mirror-toggle" }, this.t('settings.mirror_video')), h("rtk-switch", { checked: initialMirrorPreference, iconPack: this.iconPack, t: this.t, onRtkChange: (e) => {
                const { checked } = e.target;
                this.stateUpdate.emit({ prefs: { mirrorVideo: checked } });
                setPreference('mirror-video', checked);
            } })))));
    }
    static get watchers() { return {
        "meeting": ["meetingChanged"]
    }; }
};
__decorate([
    SyncWithStore()
], RtkSettingsVideo.prototype, "meeting", void 0);
__decorate([
    SyncWithStore()
], RtkSettingsVideo.prototype, "states", void 0);
__decorate([
    SyncWithStore()
], RtkSettingsVideo.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkSettingsVideo.prototype, "t", void 0);
RtkSettingsVideo.style = RtkSettingsVideoStyle0;

export { RtkSettingsAudio as rtk_settings_audio, RtkSettingsVideo as rtk_settings_video };
