var __decorate = (this && this.__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;
};
import Hls from "hls.js";
import { h, Host, } from "@stencil/core";
import { defaultIconPack } from "../../exports";
import { useLanguage } from "../../lib/lang";
import { showLivestream, PlayerState, getLivestreamViewerAllowedQualityLevels, } from "../../utils/livestream";
import { SyncWithStore } from "../../utils/sync-with-store";
import { formatSecondsToHHMMSS } from "../../utils/time";
export class RtkLivestreamPlayer {
    constructor() {
        this.statsIntervalTimer = null;
        /** Language */
        this.t = useLanguage();
        /** Icon pack */
        this.iconPack = defaultIconPack;
        this.isSupported = true;
        this.playerState = PlayerState.IDLE;
        this.livestreamState = 'IDLE';
        this.livestreamId = null;
        this.audioPlaybackError = false;
        this.qualityLevels = [];
        this.selectedQuality = -1; // -1 for auto
        this.currentTime = 0;
        this.duration = 0;
        this.hideControls = true;
        this.isDragging = false;
        this.seekPosition = 0;
        this.isSeeking = false;
        this.hideControlsTimeout = null;
        this.seekingTimeout = null;
        this.livestreamUpdateListener = (state) => {
            this.playbackUrl = this.meeting.livestream.playbackUrl;
            this.livestreamState = state;
        };
        this.updateProgress = () => {
            // During seeking, avoid updating currentTime to prevent fluctuations
            if (!this.isSeeking) {
                this.currentTime = this.videoRef.currentTime;
            }
        };
        this.updateHlsStatsPeriodically = () => {
            var _a, _b, _c;
            // Use HLS seekable ranges to get actual duration instead of currentTime + latency
            // This prevents duration from fluctuating when seeking
            if (((_a = this.videoRef) === null || _a === void 0 ? void 0 : _a.seekable) && this.videoRef.seekable.length > 0) {
                this.duration = this.videoRef.seekable.end(this.videoRef.seekable.length - 1);
            }
            else {
                // Fallback to currentTime + latency if seekable ranges aren't available
                this.duration = (((_b = this.videoRef) === null || _b === void 0 ? void 0 : _b.currentTime) || 0) + (((_c = this.hls) === null || _c === void 0 ? void 0 : _c.latency) || 0);
            }
        };
        this.fastForwardToLatest = () => {
            var _a;
            // Use seekable range for more accurate live edge positioning
            if (((_a = this.videoRef) === null || _a === void 0 ? void 0 : _a.seekable) && this.videoRef.seekable.length > 0) {
                this.videoRef.currentTime = this.videoRef.seekable.end(this.videoRef.seekable.length - 1) - 1;
            }
            else {
                this.videoRef.currentTime = this.duration - 1; // Fallback
            }
        };
        this.togglePlay = () => {
            if (this.videoRef.paused) {
                this.videoRef.play();
                this.playerState = PlayerState.PLAYING;
            }
            else {
                this.videoRef.pause();
                this.playerState = PlayerState.IDLE;
            }
        };
        this.changeQuality = (level) => {
            this.selectedQuality = level;
            if (this.hls) {
                this.hls.currentLevel = level;
            }
        };
        this.cleanupPlayer = () => {
            var _a;
            this.playerState = PlayerState.IDLE;
            if (this.videoRef) {
                (_a = this.hls) === null || _a === void 0 ? void 0 : _a.destroy();
                this.hls = null;
            }
        };
        this.onMouseMovePlayer = () => {
            this.hideControls = false;
            clearTimeout(this.hideControlsTimeout);
            this.hideControlsTimeout = setTimeout(() => {
                this.hideControls = true;
            }, 5000);
        };
        this.seekToPosition = (position) => {
            if (!this.videoRef)
                return;
            // Clamp position to valid range
            const clampedPosition = Math.max(0, Math.min(position, this.duration));
            // Set seeking state to prevent currentTime fluctuations
            this.isSeeking = true;
            // Update currentTime immediately for UI feedback
            this.currentTime = clampedPosition;
            try {
                this.videoRef.currentTime = clampedPosition;
                // Clear any existing timeout
                if (this.seekingTimeout) {
                    clearTimeout(this.seekingTimeout);
                }
                // Reset seeking state after a short delay to allow video to stabilize
                this.seekingTimeout = setTimeout(() => {
                    this.isSeeking = false;
                    // Update currentTime one final time to ensure accuracy
                    this.currentTime = this.videoRef.currentTime;
                }, 200);
            }
            catch (error) {
                this.isSeeking = false;
                this.meeting.__internals__.logger.warn('rtk-livestream-player:: Seek failed', { error });
            }
        };
        this.onSeekbarMouseDown = (event) => {
            event.preventDefault();
            this.isDragging = true;
            this.updateSeekPosition(event);
            document.addEventListener('mousemove', this.onSeekbarMouseMove);
            document.addEventListener('mouseup', this.onSeekbarMouseUp);
        };
        this.onSeekbarMouseMove = (event) => {
            if (!this.isDragging)
                return;
            this.updateSeekPosition(event);
        };
        this.onSeekbarMouseUp = (event) => {
            if (!this.isDragging)
                return;
            this.isDragging = false;
            this.updateSeekPosition(event);
            this.seekToPosition(this.seekPosition);
            document.removeEventListener('mousemove', this.onSeekbarMouseMove);
            document.removeEventListener('mouseup', this.onSeekbarMouseUp);
        };
        this.onSeekbarClick = (event) => {
            if (this.isDragging)
                return;
            this.updateSeekPosition(event);
            this.seekToPosition(this.seekPosition);
        };
        this.updateSeekPosition = (event) => {
            const seekbar = event.currentTarget;
            const rect = seekbar.getBoundingClientRect();
            const clickX = event.clientX - rect.left;
            const progress = Math.max(0, Math.min(1, clickX / rect.width));
            // Map progress to duration
            this.seekPosition = progress * this.duration;
        };
        this.getSeekbarProgress = () => {
            if (this.isDragging) {
                return this.duration > 0 ? this.seekPosition / this.duration : 0;
            }
            return this.duration > 0 ? this.currentTime / this.duration : 0;
        };
        this.getLoadingState = () => {
            let loadingMessage = '';
            let isLoading = false;
            let showIcon = false;
            switch (this.livestreamState) {
                case 'IDLE':
                    loadingMessage = this.t('livestream.idle');
                    isLoading = true;
                    showIcon = false;
                    break;
                case 'STARTING':
                    loadingMessage = this.t('livestream.starting');
                    isLoading = true;
                    showIcon = true;
                    break;
                case 'STOPPING':
                    loadingMessage = this.t('livestream.stopping');
                    isLoading = true;
                    showIcon = true;
                    break;
                case 'LIVESTREAMING':
                    if (this.playerState !== PlayerState.PLAYING && this.playerState !== PlayerState.PAUSED) {
                        loadingMessage = this.t('livestream.starting');
                        showIcon = true;
                        isLoading = true;
                    }
                    break;
                default:
                    isLoading = false;
                    loadingMessage = this.t('');
                    showIcon = true;
                    break;
            }
            return { isLoading, loadingMessage, showIcon };
        };
        this.getErrorState = () => {
            var _a, _b;
            let isError = false;
            let errorMessage = '';
            if (this.livestreamState !== 'LIVESTREAMING') {
                isError = false;
                errorMessage = this.t('');
                return { isError, errorMessage };
            }
            if (!this.isSupported) {
                isError = true;
                errorMessage = this.t('livestream.error.not_supported');
            }
            if (!this.playbackUrl) {
                isError = true;
                errorMessage = this.t('livestream.error.not_found');
            }
            if (this.playerError) {
                isError = true;
                errorMessage = this.t((_b = (_a = this.playerError) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : 'livestream.error.unknown');
            }
            return { isError, errorMessage };
        };
        this.initialiseAndPlayStream = async () => {
            try {
                this.meeting.__internals__.logger.info(`rtk-livestream-player:: About to initialise HLS. VideoRef? ${!!this
                    .videoRef} playbackUrl: ${this.playbackUrl}`);
                if (Hls.isSupported()) {
                    this.meeting.__internals__.logger.info(`rtk-livestream-player:: Initialising HLS. HLS is Supported`);
                    this.hls = new Hls({
                        lowLatencyMode: false,
                    });
                    window.rtk_hls = this.hls;
                    this.meeting.__internals__.logger.info(`rtk-livestream-player:: Loading source`);
                    this.hls.loadSource(this.playbackUrl + '?dvrEnabled=true');
                    this.meeting.__internals__.logger.info(`rtk-livestream-player:: Attaching video element to HLS`);
                    this.hls.attachMedia(this.videoRef);
                    this.meeting.__internals__.logger.info(`rtk-livestream-player:: Waiting async for HLS manifest parsing`);
                    this.hls.on(Hls.Events.ERROR, (_event, data) => {
                        if (data.fatal) {
                            this.meeting.__internals__.logger.error(`rtk-livestream-player:: fatal error: ${data.details}`, {
                                error: data.error,
                            });
                            if (this.playbackUrl && this.livestreamState === 'LIVESTREAMING') {
                                /*
                                  NOTE(ravindra-cloudflare): Maybe manifest is not ready,
                                  maybe levels are not available yet.
                                  Keep on retrying every 5 seconds till either livestream is stopped or error is resolved.
                                */
                                setTimeout(() => {
                                    if (this.playbackUrl && this.livestreamState === 'LIVESTREAMING') {
                                        this.meeting.__internals__.logger.info('rtk-livestream-player:: Retrying playbackUrl');
                                        this.hls.loadSource(this.playbackUrl + '?dvrEnabled=true');
                                    }
                                }, 5000);
                                return;
                            }
                        }
                        else {
                            this.meeting.__internals__.logger.warn(`rtk-livestream-player:: non-fatal error: ${data.details}`, {
                                error: data.error,
                            });
                        }
                    });
                    this.hls.on(Hls.Events.MEDIA_ATTACHED, () => {
                        this.meeting.__internals__.logger.info('rtk-livestream-player:: media attached');
                    });
                    this.hls.on(Hls.Events.MEDIA_DETACHED, () => {
                        this.meeting.__internals__.logger.info('rtk-livestream-player:: media detached');
                    });
                    this.hls.on(Hls.Events.DESTROYING, () => {
                        this.meeting.__internals__.logger.info('rtk-livestream-player:: hls is getting destroyed');
                    });
                    // Listen for manifest parsed to populate quality levels
                    this.hls.on(Hls.Events.MANIFEST_PARSED, async (_, data) => {
                        this.meeting.__internals__.logger.info(`rtk-livestream-player:: HLS manifest parsed`);
                        const { levels: levelsToUse, autoLevelChangeAllowed } = getLivestreamViewerAllowedQualityLevels({
                            meeting: this.meeting,
                            hlsLevels: data.levels,
                        });
                        this.qualityLevels = levelsToUse.map((level, index) => ({
                            level: index,
                            resolution: level.height ? `${level.height}p` : 'auto',
                        }));
                        if (autoLevelChangeAllowed) {
                            this.qualityLevels = [{ level: -1, resolution: 'Auto' }, ...this.qualityLevels];
                        }
                        // Set a reasonable starting quality
                        this.hls.currentLevel = this.qualityLevels[0].level;
                        try {
                            this.meeting.__internals__.logger.info('rtk-livestream-player:: About to start video.');
                            await this.videoRef.play(); // Starts playing the video after it is ready
                            this.meeting.__internals__.logger.info('rtk-livestream-player:: Video has started playing.');
                            this.playerState = PlayerState.PLAYING;
                        }
                        catch (error) {
                            this.audioPlaybackError = true;
                            this.meeting.__internals__.logger.error(`rtk-livestream-player:: Video couldn't start. Trying with user gesture again.`, {
                                error,
                            });
                        }
                    });
                    // Setup listeners to show current time and total duration
                    this.videoRef.addEventListener('timeupdate', this.updateProgress);
                    this.statsIntervalTimer = setInterval(this.updateHlsStatsPeriodically, 1000);
                }
                else {
                    this.isSupported = false;
                }
            }
            catch (error) {
                this.meeting.__internals__.logger.error(`rtk-livestream-player:: HLS couldn't initialise.`, {
                    error,
                });
                // Retry with user gesture
            }
        };
    }
    async updateLivestreamId() {
        const url = this.meeting.livestream.playbackUrl;
        if (!url || this.livestreamState !== 'LIVESTREAMING') {
            // If there was a player, clean that up, cleanup all stencil states
            this.playbackUrl = null;
            this.livestreamId = null;
            this.cleanupPlayer();
            return;
        }
        const parts = url.split('/');
        const manifestIndex = parts.findIndex((part) => part === 'manifest');
        const streamId = parts[manifestIndex - 1];
        this.livestreamId = streamId;
        await this.conditionallyStartLivestreamViewer();
    }
    async conditionallyStartLivestreamViewer() {
        if (this.videoRef && this.playbackUrl && !this.hls) {
            await this.initialiseAndPlayStream();
        }
    }
    async connectedCallback() {
        this.meetingChanged(this.meeting);
    }
    disconnectedCallback() {
        this.meeting.livestream.removeListener('livestreamUpdate', this.livestreamUpdateListener);
        this.videoRef.removeEventListener('timeupdate', this.updateProgress);
        clearInterval(this.statsIntervalTimer);
        if (this.seekingTimeout) {
            clearTimeout(this.seekingTimeout);
        }
        this.videoRef = null;
        if (this.hls) {
            this.hls.destroy();
        }
        window.rtk_hls = null;
    }
    meetingChanged(meeting) {
        if (!meeting)
            return;
        this.playbackUrl = this.meeting.livestream.playbackUrl;
        this.livestreamState = this.meeting.livestream.state;
        this.meeting.livestream.on('livestreamUpdate', this.livestreamUpdateListener);
    }
    render() {
        if (!showLivestream(this.meeting))
            return;
        const { isError, errorMessage } = this.getErrorState();
        const { isLoading, loadingMessage, showIcon } = this.getLoadingState();
        return (h(Host, null, h("div", { class: "player-container h-full max-h-full min-h-full w-full min-w-full max-w-full" }, h("div", { ref: async (el) => {
                this.videoContainerRef = el;
            }, class: "video-container relative flex h-full w-full flex-col items-center justify-center" }, h("video", { onMouseMove: this.onMouseMovePlayer, ref: async (el) => {
                this.videoRef = el;
                await this.conditionallyStartLivestreamViewer();
            }, id: "livestream-video", class: "livestream-video", controls: false, onPlay: () => {
                if (this.playerState === PlayerState.PAUSED) {
                    this.playerState = PlayerState.PLAYING;
                }
            }, onPause: () => (this.playerState = PlayerState.PAUSED) }), this.playerState !== PlayerState.IDLE && !this.hideControls && (
        // <!-- Control Bar -->
        h("div", { class: "control-bar" }, h("div", { class: "control-groups" }, h("rtk-icon", { id: "playPause", onClick: this.togglePlay, size: "lg", class: "control-btn", icon: this.playerState === PlayerState.PLAYING
                ? this.iconPack.pause
                : this.iconPack.play }), h("rtk-icon", { size: "lg", class: "control-btn", icon: this.iconPack.fastForward, onClick: this.fastForwardToLatest }), h("span", { class: "timings" }, formatSecondsToHHMMSS(this.currentTime), " /", ' ', formatSecondsToHHMMSS(this.duration))), h("div", { class: "seekbar-container" }, h("div", { class: "seekbar", onMouseDown: this.onSeekbarMouseDown, onClick: this.onSeekbarClick }, h("div", { class: "seekbar-track" }, h("div", { class: "seekbar-progress", style: { width: `${this.getSeekbarProgress() * 100}%` } }), h("div", { class: "seekbar-handle", style: { left: `${this.getSeekbarProgress() * 100}%` } })))), h("div", { class: "control-groups" }, h("select", { class: "level-select", onChange: (e) => this.changeQuality(parseInt(e.target.value)) }, this.qualityLevels.map((level) => (h("option", { value: level.level, selected: this.selectedQuality === level.level }, level.resolution)))), h("rtk-fullscreen-toggle", { id: "fullscreen", class: "control-btn fullscreen-btn", targetElement: this.videoContainerRef, size: "sm", iconPack: this.iconPack, t: this.t, ref: (fullScreenToggle) => {
                var _a;
                // Create a <style> element
                const style = document.createElement('style');
                // Add CSS rules
                style.textContent = `
                        rtk-controlbar-button {
                          display: contents;
                          background-color: var(--bg-brand-500);
                          color: var(--text-text-on-brand);
                        }
                      `;
                // Append the <style> to the Shadow DOM
                (_a = fullScreenToggle === null || fullScreenToggle === void 0 ? void 0 : fullScreenToggle.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(style);
            } }))))), this.audioPlaybackError && (h("div", { class: "unmute-popup" }, h("h3", null, this.t('audio_playback.title')), h("p", null, this.t('audio_playback.description')), h("rtk-button", { kind: "wide", onClick: () => {
                this.audioPlaybackError = false;
                if (this.videoRef) {
                    this.videoRef.muted = false;
                    this.videoRef.play();
                    this.playerState = PlayerState.PLAYING;
                }
            }, title: this.t('audio_playback') }, this.t('audio_playback')))), isError && (h("div", { class: "loader" }, h("rtk-icon", { icon: this.iconPack.warning }), h("p", null, errorMessage))), !isError && isLoading && (h("div", { class: "loader" }, showIcon && (h("rtk-spinner", { id: "icon", part: "spinner", iconPack: this.iconPack, size: "md" })), h("p", null, loadingMessage))))));
    }
    static get is() { return "rtk-livestream-player"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["rtk-livestream-player.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["rtk-livestream-player.css"]
        };
    }
    static get properties() {
        return {
            "meeting": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "Meeting",
                    "resolved": "Client",
                    "references": {
                        "Meeting": {
                            "location": "import",
                            "path": "../../types/rtk-client",
                            "id": "src/types/rtk-client.ts::Meeting"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Meeting object"
                },
                "getter": false,
                "setter": false
            },
            "size": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "Size",
                    "resolved": "\"lg\" | \"md\" | \"sm\" | \"xl\"",
                    "references": {
                        "Size": {
                            "location": "import",
                            "path": "../../exports",
                            "id": "src/exports.ts::Size"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Size"
                },
                "getter": false,
                "setter": false,
                "attribute": "size",
                "reflect": true
            },
            "t": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "RtkI18n",
                    "resolved": "(key: \"pin\" | \"unpin\" | \"kick\" | \"ended\" | \"disconnected\" | \"failed\" | \"type\" | \"end\" | \"joined\" | \"pinned\" | \"join\" | \"participants\" | \"logo\" | \"audio\" | \"search\" | \"video\" | \"image\" | \"chat\" | \"polls\" | \"leave\" | \"close\" | \"plugins\" | \"screenshare\" | \"(you)\" | (string & {}) | \"about_call\" | \"screen\" | \"camera\" | \"dismiss\" | \"page\" | \"more\" | \"page.prev\" | \"page.next\" | \"layout\" | \"layout.auto\" | \"settings\" | \"file\" | \"connection\" | \"leave_confirmation\" | \"cancel\" | \"yes\" | \"you\" | \"everyone\" | \"to\" | \"mute\" | \"accept\" | \"pip_on\" | \"pip_off\" | \"viewers\" | \"create\" | \"ask\" | \"activate\" | \"requests\" | \"mic_off\" | \"disable_mic\" | \"mic_on\" | \"enable_mic\" | \"test\" | \"minimize\" | \"maximize\" | \"mute_all\" | \"mute_all.description\" | \"mute_all.header\" | \"mute_all.allow_unmute\" | \"video_off\" | \"disable_video\" | \"video_on\" | \"enable_video\" | \"offline\" | \"offline.description\" | \"failed.description\" | \"disconnected.description\" | \"participants.errors.empty_results\" | \"participants.empty_list\" | \"participants.no_pending_requests\" | \"participants.turn_off_video\" | \"polls.by\" | \"polls.question\" | \"polls.question.placeholder\" | \"polls.answers\" | \"polls.option\" | \"polls.option.placeholder\" | \"polls.results.anon\" | \"polls.results.hide\" | \"polls.create\" | \"polls.cancel\" | \"polls.empty\" | \"polls.errors.question_required\" | \"polls.errors.empty_option\" | \"screenshare.min_preview\" | \"screenshare.max_preview\" | \"screenshare.shared\" | \"screenshare.start\" | \"screenshare.stop\" | \"screenshare.error.unknown\" | \"screenshare.error.max_count\" | \"plugins.empty\" | \"perm_denied\" | \"perm_denied.audio\" | \"perm_denied.video\" | \"perm_denied.screenshare\" | \"perm_denied.audio.chrome.message\" | \"perm_denied.video.chrome.message\" | \"perm_denied.screenshare.chrome.message\" | \"perm_denied.audio.safari.message\" | \"perm_denied.video.safari.message\" | \"perm_denied.screenshare.safari.message\" | \"perm_denied.audio.edge.message\" | \"perm_denied.video.edge.message\" | \"perm_denied.screenshare.edge.message\" | \"perm_denied.audio.microsoft edge.message\" | \"perm_denied.video.microsoft edge.message\" | \"perm_denied.screenshare.microsoft edge.message\" | \"perm_denied.audio.firefox.message\" | \"perm_denied.video.firefox.message\" | \"perm_denied.screenshare.firefox.message\" | \"perm_denied.audio.others.message\" | \"perm_denied.video.others.message\" | \"perm_denied.screenshare.others.message\" | \"perm_sys_denied\" | \"perm_sys_denied.audio\" | \"perm_sys_denied.video\" | \"perm_sys_denied.screenshare\" | \"perm_sys_denied.audio.macos.message\" | \"perm_sys_denied.video.macos.message\" | \"perm_sys_denied.screenshare.macos.message\" | \"perm_sys_denied.audio.ios.message\" | \"perm_sys_denied.video.ios.message\" | \"perm_sys_denied.screenshare.ios.message\" | \"perm_sys_denied.audio.windows.message\" | \"perm_sys_denied.video.windows.message\" | \"perm_sys_denied.screenshare.windows.message\" | \"perm_sys_denied.audio.android.message\" | \"perm_sys_denied.video.android.message\" | \"perm_sys_denied.screenshare.android.message\" | \"perm_sys_denied.audio.others.message\" | \"perm_sys_denied.video.others.message\" | \"perm_sys_denied.screenshare.others.message\" | \"perm_could_not_start\" | \"perm_could_not_start.audio\" | \"perm_could_not_start.video\" | \"perm_could_not_start.screenshare\" | \"perm_could_not_start.audio.message\" | \"perm_could_not_start.video.message\" | \"perm_could_not_start.screenshare.message\" | \"full_screen\" | \"full_screen.exit\" | \"waitlist.header_title\" | \"waitlist.body_text\" | \"waitlist.deny_request\" | \"waitlist.accept_request\" | \"waitlist.accept_all\" | \"stage_request.header_title\" | \"stage_request.deny_request\" | \"stage_request.accept_request\" | \"stage_request.accept_all\" | \"stage_request.deny_all\" | \"stage_request.approval_pending\" | \"stage_request.denied\" | \"stage_request.request\" | \"stage_request.requested\" | \"stage_request.cancel_request\" | \"stage_request.leave_stage\" | \"stage_request.request_tip\" | \"stage_request.leave_tip\" | \"stage_request.pending_tip\" | \"stage_request.denied_tip\" | \"stage.empty_host\" | \"stage.empty_host_summary\" | \"stage.empty_viewer\" | \"stage.remove_from_stage\" | \"stage.invited_notification\" | \"stage.add_to_stage\" | \"stage.join_title\" | \"stage.join_summary\" | \"stage.join_cancel\" | \"stage.join_confirm\" | \"setup_screen.join_in_as\" | \"setup_screen.your_name\" | \"stage.reconnecting\" | \"recording.label\" | \"recording.indicator\" | \"recording.started\" | \"recording.stopped\" | \"recording.paused\" | \"recording.error.start\" | \"recording.error.stop\" | \"recording.error.resume\" | \"recording.start\" | \"recording.stop\" | \"recording.resume\" | \"recording.starting\" | \"recording.stopping\" | \"recording.loading\" | \"recording.idle\" | \"audio_playback\" | \"audio_playback.title\" | \"audio_playback.description\" | \"breakout_rooms\" | \"breakout_rooms.room_config_header\" | \"breakout_rooms.join_breakout_header\" | \"breakout_rooms.empty\" | \"breakout_rooms.delete\" | \"breakout_rooms.switch\" | \"breakout_rooms.main_room\" | \"breakout_rooms.shuffle_participants\" | \"breakout_rooms.deselect\" | \"breakout_rooms.selected\" | \"breakout_rooms.num_of_rooms\" | \"breakout_rooms.approx\" | \"breakout_rooms.participants_per_room\" | \"breakout_rooms.division_text\" | \"breakout_rooms.start_breakout\" | \"breakout_rooms.close_breakout\" | \"breakout_rooms.update_breakout\" | \"breakout_rooms.discard_changes\" | \"breakout_rooms.room\" | \"breakout_rooms.rooms\" | \"breakout_rooms.room_name\" | \"breakout_rooms.edit_room_name\" | \"breakout_rooms.save_room_name\" | \"breakout_rooms.add_room\" | \"breakout_rooms.add_room_brief\" | \"breakout_rooms.select_all\" | \"breakout_rooms.unassign_all\" | \"breakout_rooms.assign\" | \"breakout_rooms.assign_participants\" | \"breakout_rooms.none_assigned\" | \"breakout_rooms.drag_drop_participants\" | \"breakout_rooms.click_drop_participants\" | \"breakout_rooms.status.assign_multiple\" | \"breakout_rooms.status.select_room\" | \"breakout_rooms.ephemeral_status.participants_assigned\" | \"breakout_rooms.ephemeral_status.participants_assigned_randomly\" | \"breakout_rooms.ephemeral_status.changes_discarded\" | \"breakout_rooms.confirm_modal.start_breakout.header\" | \"breakout_rooms.confirm_modal.start_breakout.content\" | \"breakout_rooms.confirm_modal.start_breakout.cancelText\" | \"breakout_rooms.confirm_modal.start_breakout.ctaText\" | \"breakout_rooms.confirm_modal.close_breakout.header\" | \"breakout_rooms.confirm_modal.close_breakout.content\" | \"breakout_rooms.confirm_modal.close_breakout.ctaText\" | \"breakout_rooms.move_reason.started_msg\" | \"breakout_rooms.move_reason.started_desc\" | \"breakout_rooms.move_reason.closed_msg\" | \"breakout_rooms.move_reason.closed_desc\" | \"breakout_rooms.move_reason.switch_room\" | \"breakout_rooms.move_reason.switch_main_room\" | \"breakout_rooms.all_assigned\" | \"breakout_rooms.empty_main_room\" | \"breakout_rooms.leave_confirmation\" | \"breakout_rooms.leave_confirmation.main_room_btn\" | \"ai\" | \"ai.meeting_ai\" | \"ai.home\" | \"ai.transcriptions\" | \"ai.personal\" | \"ai.caption_view\" | \"ai.chat.tooltip\" | \"ai.chat.summarize\" | \"ai.chat.agenda\" | \"ai.transcriptions.search_placeholder\" | \"ai.transcriptions.no_transcripts_found\" | \"ai.transcriptions.no_transcripts_yet\" | \"search.could_not_find\" | \"search.empty\" | \"end.all\" | \"ended.rejected\" | \"ended.left\" | \"ended.kicked\" | \"ended.disconnected\" | \"ended.network\" | \"ended.unauthorized\" | \"network\" | \"network.reconnecting\" | \"network.delay_extended\" | \"network.disconnected\" | \"network.leaving\" | \"network.restored\" | \"network.delay\" | \"network.lost\" | \"network.lost_extended\" | \"network.troubleshoot\" | \"join.network_error\" | \"join.media_error\" | \"join.media_firewall_error\" | \"join.default_error\" | \"join.error_code\" | \"livestream\" | \"livestream.indicator\" | \"livestream.skip\" | \"livestream.idle\" | \"livestream.starting\" | \"livestream.stopping\" | \"livestream.waiting_on_manual_ingestion\" | \"livestream.error.not_supported\" | \"livestream.error.not_found\" | \"livestream.error.unknown\" | \"livestream.error.sync\" | \"livestream.error.start\" | \"livestream.error.stop\" | \"livestream.go_live\" | \"livestream.end_live\" | \"livestream.error\" | \"cta.help\" | \"cta.continue\" | \"cta.reload\" | \"cta.confirmation\" | \"cta.system_settings\" | \"remote_access.empty\" | \"remote_access.requests\" | \"remote_access.allow\" | \"remote_access.grant\" | \"remote_access.indicator\" | \"chat.new\" | \"chat.max_limit_warning\" | \"chat.rate_limit_error\" | \"chat.member_name\" | \"chat.add_members\" | \"chat.delete_msg\" | \"chat.edit_msg\" | \"chat.send_msg\" | \"chat.send_attachment\" | \"chat.send_img\" | \"chat.send_file\" | \"chat.send_emoji\" | \"chat.update_msg\" | \"chat.img.loading\" | \"chat.error.img_not_found\" | \"chat.error.empty_results\" | \"chat.img.shared_by\" | \"chat.reply\" | \"chat.message_placeholder\" | \"chat.click_to_send\" | \"chat.search_msgs\" | \"chat.search_conversations\" | \"chat.start_conversation\" | \"chat.empty_search\" | \"chat.empty_chat\" | \"chat.cancel_upload\" | \"chat.view_chats\" | \"chat.everyone\" | \"chat.pinned_msgs\" | \"chat.toggle_pinned_msgs\" | \"date.today\" | \"date.yesterday\" | \"date.sunday\" | \"date.monday\" | \"date.tuesday\" | \"date.wednesday\" | \"date.thursday\" | \"date.friday\" | \"date.saturday\" | \"list.empty\" | \"grid.listening\" | \"transcript.off\" | \"transcript.on\" | \"settings.notification_sound\" | \"settings.microphone_input\" | \"settings.speaker_output\" | \"settings.mirror_video\" | \"settings.camera_off\" | \"dialog.close\" | \"notifications.joined\" | \"notifications.left\" | \"notifications.requesting_to_join_meeting\" | \"notifications.requested_to_join_stage\" | \"notifications.joined_stage\" | \"notifications.request_to_join_accepted\" | \"notifications.request_to_join_rejected\" | \"notifications.accept\" | \"notifications.new_poll_created_by\" | \"notifications.connected_to\" | \"notifications.plugin_switched_to\" | \"notifications.remote_control_requested\" | \"notifications.remote_control_request_sent\" | \"notifications.remote_control_request_accepted\" | \"notifications.remote_control_granted\" | \"notifications.remote_control_terminated\" | \"debugger.troubleshooting.label\" | \"debugger.quality.good\" | \"debugger.quality.average\" | \"debugger.quality.poor\" | \"debugger.stats.bitrate.label\" | \"debugger.stats.bitrate.description\" | \"debugger.stats.packet_loss.label\" | \"debugger.stats.packet_loss.description\" | \"debugger.stats.jitter.label\" | \"debugger.stats.jitter.description\" | \"debugger.stats.cpu_limitations.label\" | \"debugger.stats.cpu_limitations.description\" | \"debugger.stats.bandwidth_limitations.label\" | \"debugger.stats.bandwidth_limitations.description\" | \"debugger.audio.label\" | \"debugger.audio.troubleshooting.label\" | \"debugger.audio.messages.generating_report\" | \"debugger.audio.messages.enable_media\" | \"debugger.audio.sections.network_media\" | \"debugger.video.label\" | \"debugger.video.troubleshooting.label\" | \"debugger.video.messages.generating_report\" | \"debugger.video.messages.enable_media\" | \"debugger.video.sections.network_media\" | \"debugger.screenshare.label\" | \"debugger.screenshare.troubleshooting.label\" | \"debugger.screenshare.sections.network_media\" | \"debugger.screenshare.messages.generating_report\" | \"debugger.screenshare.messages.enable_media\" | \"debugger.system.label\" | \"debugger.system.troubleshooting.label\" | \"debugger.system.sections.battery\" | \"debugger.system.battery.level.label\" | \"debugger.system.battery.level.description\" | \"debugger.system.battery.charging.label\" | \"debugger.system.battery.charging.description\" | \"debugger.system.battery.charging.is_charging\" | \"debugger.system.battery.charging.is_not_charging\") => string",
                    "references": {
                        "RtkI18n": {
                            "location": "import",
                            "path": "../../exports",
                            "id": "src/exports.ts::RtkI18n"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Language"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "useLanguage()"
            },
            "iconPack": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "IconPack",
                    "resolved": "{ people: string; people_checked: string; chat: string; poll: string; participants: string; rocket: string; call_end: string; share: string; mic_on: string; mic_off: string; video_on: string; video_off: string; share_screen_start: string; share_screen_stop: string; share_screen_person: string; clock: string; dismiss: string; send: string; search: string; more_vertical: string; chevron_down: string; chevron_up: string; chevron_left: string; chevron_right: string; settings: string; wifi: string; speaker: string; speaker_off: string; download: string; full_screen_maximize: string; full_screen_minimize: string; copy: string; attach: string; image: string; emoji_multiple: string; image_off: string; disconnected: string; wand: string; recording: string; subtract: string; stop_recording: string; warning: string; pin: string; pin_off: string; spinner: string; breakout_rooms: string; add: string; shuffle: string; edit: string; delete: string; back: string; save: string; web: string; checkmark: string; spotlight: string; join_stage: string; leave_stage: string; pip_off: string; pip_on: string; signal_1: string; signal_2: string; signal_3: string; signal_4: string; signal_5: string; start_livestream: string; stop_livestream: string; viewers: string; debug: string; info: string; devices: string; horizontal_dots: string; ai_sparkle: string; meeting_ai: string; captionsOn: string; captionsOff: string; play: string; pause: string; fastForward: string; minimize: string; maximize: string; }",
                    "references": {
                        "IconPack": {
                            "location": "import",
                            "path": "../../exports",
                            "id": "src/exports.ts::IconPack"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon pack"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "defaultIconPack"
            }
        };
    }
    static get states() {
        return {
            "playbackUrl": {},
            "isSupported": {},
            "playerState": {},
            "livestreamState": {},
            "playerError": {},
            "livestreamId": {},
            "audioPlaybackError": {},
            "qualityLevels": {},
            "selectedQuality": {},
            "currentTime": {},
            "duration": {},
            "hideControls": {},
            "isDragging": {},
            "seekPosition": {},
            "isSeeking": {}
        };
    }
    static get events() {
        return [{
                "method": "apiError",
                "name": "rtkApiError",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emit API error events"
                },
                "complexType": {
                    "original": "{\n    trace: string;\n    message: string;\n  }",
                    "resolved": "{ trace: string; message: string; }",
                    "references": {}
                }
            }];
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "livestreamState",
                "methodName": "updateLivestreamId"
            }, {
                "propName": "meeting",
                "methodName": "meetingChanged"
            }];
    }
}
__decorate([
    SyncWithStore()
], RtkLivestreamPlayer.prototype, "meeting", void 0);
__decorate([
    SyncWithStore()
], RtkLivestreamPlayer.prototype, "t", void 0);
__decorate([
    SyncWithStore()
], RtkLivestreamPlayer.prototype, "iconPack", void 0);
