/**
 * NOTE(ikabra): INFINITE SCROLL IMPLEMENTATION:
 *
 * Uses scrollend listener for 2way scrolling.
 * Empty divs ($topRef, $bottomRef) act as scroll triggers to fetch new messages.
 *
 * UPWARD SCROLLING:
 * - Fetch top anchor (element currently visible to the user near top)
 * - Fetch older messages, push to end of 2D array
 * - When exceeding pagesAllowed, delete pages and scroll back to anchor
 *
 * DOWNWARD SCROLLING:
 * - Fetch bottom anchor (element currently visible to the user near bottom)
 * - Fetch new page, insert at the start
 * - Update timestamps & firstEmptyIndex, then rerender
 * - When exceeding pagesAllowed, delete pages and scroll back to anchor
 *
 * ADDING NEW NODES:
 * - If no pages exist, load old page
 * - If on 1st page, append messages till page size is full and then load new page
 *
 * DELETE NODE:
 * - If deleting the only available node, reset to initial state
 * - If page is empty, delete it
 * - Update timestamp curors
 */
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 { Host, h } from "@stencil/core";
import { defaultIconPack } from "../../lib/icons";
import { useLanguage } from "../../lib/lang";
import { SyncWithStore } from "../../utils/sync-with-store";
import { debounce } from "lodash-es";
export class RtkPaginatedList {
    constructor() {
        // Timestamp pertaining to the oldest stored message
        this.oldestPaginatedTimestamp = 0;
        // Timestamp pertaining to the latest stored message
        this.latestPaginatedTimestamp = null;
        // Timestamp pertaining to the latest message stored in backend
        this.latestMessageTimestamp = null;
        // the length of pages will always be pageSize + 2
        this.pages = [];
        // Controls whether to keep auto-scrolling when a new page load.
        this.shouldScrollToBottom = false;
        // Shows "scroll to bottom" button when new nodes arrive and autoscroll is off.
        this.showNewMessagesCTR = false;
        /** label to show when empty */
        this.emptyListLabel = null;
        /** Icon pack */
        this.iconPack = defaultIconPack;
        /** Language */
        this.t = useLanguage();
        this.rerenderBoolean = false;
        this.showEmptyListLabel = false;
        this.isLoading = false;
        this.isLoadingTop = false;
        this.isLoadingBottom = false;
        // Tells us if we need to scroll to a specific anchor after a rerender
        this.pendingScrollAnchor = null;
        this.isInView = (el) => {
            const rect = el.getBoundingClientRect();
            return rect.top >= 0 && rect.bottom <= window.innerHeight;
        };
    }
    /**
     * Rerender paginated list
     */
    async rerenderList() {
        this.rerenderBoolean = !this.rerenderBoolean;
    }
    /**
     * Adds a new node to the beginning of the paginated list
     * @param {DataNode} node - The data node to add to the beginning of the list
     */
    async onNewNode(node) {
        // if there are no pages, append to the first page
        if (this.pages.length < 1) {
            this.oldestPaginatedTimestamp = node.timeMs;
            this.pages.unshift([node]);
            this.latestPaginatedTimestamp = node.timeMs;
            this.latestMessageTimestamp = node.timeMs;
            this.rerender();
            if (this.autoScroll)
                this.$bottomRef.scrollIntoView({ behavior: 'smooth' });
        }
        else if (this.latestMessageTimestamp === this.latestPaginatedTimestamp) {
            // append messages to the page if page has not reached full capacity
            if (this.pages[0].length < this.pageSize) {
                this.pages[0].unshift(node);
                this.latestPaginatedTimestamp = node.timeMs;
                this.latestMessageTimestamp = node.timeMs;
                this.rerender();
            }
            else {
                // if page is at full capacity, load next page
                this.pages.unshift([node]);
                this.latestPaginatedTimestamp = node.timeMs;
                this.latestMessageTimestamp = node.timeMs;
                // remove pages if out of bounds
                if (this.pages.length > this.pagesAllowed)
                    this.pages.pop();
                // update timestamps
                const lastPage = this.pages[this.pages.length - 1];
                this.oldestPaginatedTimestamp = lastPage[lastPage.length - 1].timeMs;
                this.rerender();
            }
            if (this.autoScroll)
                this.$bottomRef.scrollIntoView({ behavior: 'smooth' });
        }
        else {
            if (this.autoScroll)
                this.scrollToBottom();
        }
        this.pendingScrollAnchor = null;
    }
    /**
     * Deletes a node anywhere from the list
     * @param {string} id - The id of the node to delete
     * */
    async onNodeDelete(id) {
        var _a, _b;
        for (let i = this.pages.length - 1; i >= 0; i--) {
            const index = this.pages[i].findIndex((node) => node.id === id);
            // if message not found, move on
            if (index === -1)
                continue;
            // delete message
            this.pages[i].splice(index, 1);
            // if page is empty, delete it
            if (this.pages[i].length === 0)
                this.pages.splice(i, 1);
            // update timestamps
            const firstPage = this.pages[0];
            const lastPage = this.pages[this.pages.length - 1];
            this.latestPaginatedTimestamp = (_a = firstPage === null || firstPage === void 0 ? void 0 : firstPage[0]) === null || _a === void 0 ? void 0 : _a.timeMs;
            this.oldestPaginatedTimestamp = (_b = lastPage === null || lastPage === void 0 ? void 0 : lastPage[lastPage.length - 1]) === null || _b === void 0 ? void 0 : _b.timeMs;
            // if I have deleted the latest message, update latestMessageTimestamp
            if (index === 0 && i === 0)
                this.latestMessageTimestamp = this.latestPaginatedTimestamp;
            this.rerender();
            break;
        }
    }
    /**
     * Updates a new node anywhere in the list
     * @param {string} id - The id of the node to update
     * @param {DataNode} node - The updated data node
     * */
    async onNodeUpdate(id, node) {
        for (let i = this.pages.length - 1; i >= 0; i--) {
            const index = this.pages[i].findIndex((node) => node.id === id);
            // if message not found, move on
            if (index === -1)
                continue;
            // edit message
            this.pages[i][index] = Object.assign(Object.assign({}, this.pages[i][index]), node);
            this.rerender();
            break;
        }
    }
    /**
     * Resets the paginated list to a given timestamp
     */
    async reset(timestamp = 0) {
        this.oldestPaginatedTimestamp = timestamp;
        this.latestPaginatedTimestamp = null;
        this.pages = [];
        this.shouldScrollToBottom = false;
        this.showNewMessagesCTR = false;
        this.pendingScrollAnchor = null;
        this.isLoading = false;
        this.isLoadingTop = false;
        this.isLoadingBottom = false;
        if (timestamp === 0) {
            // preserve latestMessageTimestamp if reseting to a particular message
            this.latestMessageTimestamp = null;
        }
        this.rerender();
        await this.loadPrevPage();
    }
    connectedCallback() {
        this.rerender = debounce(this.rerender.bind(this), 50, { maxWait: 200 });
    }
    componentDidLoad() {
        // initial load
        this.loadPrevPage();
        if (this.$containerRef) {
            this.$containerRef.onscrollend = async () => {
                // do not do anything if we are scrolling to bottom
                if (this.shouldScrollToBottom)
                    return;
                // handle top and bottom scroll
                if (this.isInView(this.$bottomRef) &&
                    this.latestMessageTimestamp > this.latestPaginatedTimestamp) {
                    await this.loadNextPage();
                }
                else if (this.isInView(this.$topRef)) {
                    this.showNewMessagesCTR = true;
                    await this.loadPrevPage();
                }
            };
        }
    }
    componentDidRender() {
        if (!this.pendingScrollAnchor)
            return;
        const anchor = this.pendingScrollAnchor;
        this.pendingScrollAnchor = null;
        this.restoreScrollToAnchor(anchor);
    }
    async loadPrevPage() {
        if (this.isLoading)
            return;
        const scrollAnchor = this.getScrollAnchor('top');
        // if old timestamp is 0, it means we are at initial state
        if (this.oldestPaginatedTimestamp === 0)
            this.oldestPaginatedTimestamp = new Date().getTime();
        // load data
        this.isLoading = true;
        this.isLoadingTop = true;
        const data = await this.fetchData(this.oldestPaginatedTimestamp - 1, this.pageSize, true);
        this.isLoading = false;
        this.isLoadingTop = false;
        // no more old messages to show, we are at the top of the page
        if (!data.length)
            return;
        // add old data to the end of the array
        this.pages.push(data);
        // clear old pages when we reach the limit
        if (this.pages.length > this.pagesAllowed)
            this.pages.shift();
        // update timestamps
        const lastPage = this.pages[this.pages.length - 1];
        this.oldestPaginatedTimestamp = lastPage[lastPage.length - 1].timeMs;
        this.latestPaginatedTimestamp = this.pages[0][0].timeMs;
        if (!this.latestMessageTimestamp)
            this.latestMessageTimestamp = this.latestPaginatedTimestamp;
        this.rerender();
        // fix scroll position
        if (scrollAnchor)
            this.pendingScrollAnchor = scrollAnchor;
    }
    async loadNextPage() {
        if (this.isLoading)
            return [];
        // Do nothing. New timestamp needs to be assigned by loadPrevPage method
        if (!this.latestPaginatedTimestamp) {
            this.showNewMessagesCTR = false;
            return [];
        }
        this.isLoading = true;
        this.isLoadingBottom = true;
        const scrollAnchor = this.getScrollAnchor('bottom');
        const data = await this.fetchData(this.latestPaginatedTimestamp + 1, this.pageSize, false);
        this.isLoading = false;
        this.isLoadingBottom = false;
        // no more new messages to load
        if (!data.length) {
            this.latestMessageTimestamp = this.latestPaginatedTimestamp;
            this.showNewMessagesCTR = false;
            return [];
        }
        // load new messages and append to the start
        const incoming = [...data].reverse();
        if (this.pages.length === 0)
            this.pages.unshift([]);
        const firstPage = this.pages[0];
        const spaceInFirstPage = this.pageSize - firstPage.length;
        if (spaceInFirstPage > 0) {
            const toFill = incoming.splice(0, spaceInFirstPage);
            firstPage.unshift(...toFill);
        }
        while (incoming.length > 0) {
            this.pages.unshift(incoming.splice(0, this.pageSize));
        }
        // remove pages if out of bounds
        if (this.pages.length > this.pagesAllowed)
            this.pages.pop();
        // update timestamps
        const lastPage = this.pages[this.pages.length - 1];
        this.oldestPaginatedTimestamp = lastPage[lastPage.length - 1].timeMs;
        this.latestPaginatedTimestamp = this.pages[0][0].timeMs;
        this.rerender();
        this.pendingScrollAnchor = scrollAnchor;
        return data;
    }
    // Find the element that is closest to the top/bottom of the container
    getScrollAnchor(edge = 'top') {
        if (!this.$containerRef)
            return null;
        const containerRect = this.$containerRef.getBoundingClientRect();
        const candidates = Array.from(this.$containerRef.querySelectorAll('[id]')).filter((el) => el.id !== 'top-scroll' && el.id !== 'bottom-scroll');
        let best = null;
        for (const el of candidates) {
            const rect = el.getBoundingClientRect();
            const isVisibleInContainer = rect.bottom > containerRect.top && rect.top < containerRect.bottom;
            if (!isVisibleInContainer)
                continue;
            if (edge === 'top') {
                const offsetTop = rect.top - containerRect.top;
                if (best == null || (best.edge === 'top' && offsetTop < best.offsetTop)) {
                    best = { id: el.id, edge: 'top', offsetTop };
                }
            }
            else {
                const offsetBottom = containerRect.bottom - rect.bottom;
                if (best == null || (best.edge === 'bottom' && offsetBottom < best.offsetBottom)) {
                    best = { id: el.id, edge: 'bottom', offsetBottom };
                }
            }
        }
        return best;
    }
    //instant scroll to anchor to make sure we are at the same position after a rerender
    restoreScrollToAnchor(anchor) {
        if (!this.$containerRef)
            return;
        // make element id safe to use inside a CSS selector
        const escapeId = (id) => {
            var _a;
            const cssEscape = (_a = globalThis.CSS) === null || _a === void 0 ? void 0 : _a.escape;
            return typeof cssEscape === 'function'
                ? cssEscape(id)
                : id.replace(/[^a-zA-Z0-9_-]/g, '\\$&');
        };
        const el = this.$containerRef.querySelector(`#${escapeId(anchor.id)}`);
        if (!el)
            return;
        const containerRect = this.$containerRef.getBoundingClientRect();
        const rect = el.getBoundingClientRect();
        if (anchor.edge === 'top') {
            const newOffsetTop = rect.top - containerRect.top;
            this.$containerRef.scrollTop += newOffsetTop - anchor.offsetTop;
        }
        else {
            const newOffsetBottom = containerRect.bottom - rect.bottom;
            this.$containerRef.scrollTop += anchor.offsetBottom - newOffsetBottom;
        }
    }
    // this method is called recursively based on shouldScrollToBottom (see loadNextPage)
    async scrollToBottom() {
        this.shouldScrollToBottom = true;
        while (this.shouldScrollToBottom) {
            const response = await this.loadNextPage();
            this.$bottomRef.scrollIntoView({ behavior: 'smooth' });
            if (response.length === 0)
                this.shouldScrollToBottom = false;
        }
    }
    rerender() {
        this.rerenderBoolean = !this.rerenderBoolean;
    }
    render() {
        var _a;
        /**
         * div.container is flex=column-reversewhich is why div#bottom-scroll comes before div#top-scroll
         */
        return (h(Host, { key: 'bff4fc91b737334c5764e690fbf2adafa1444408' }, h("div", { key: 'f4efa98ef0bd178602ee03718d35fcb833487909', class: "scrollbar container", part: "container", ref: (el) => (this.$containerRef = el) }, h("div", { key: '37403f6462812a6662efa9577ae9ed43d27f63d6', class: { 'show-new-messages-ctr': true, active: this.showNewMessagesCTR } }, h("rtk-button", { key: 'ee7e04e6281370dddb1b1e10b753e96dc602d42a', class: "show-new-messages", kind: "icon", variant: "secondary", part: "show-new-messages", onClick: () => {
                this.scrollToBottom();
            } }, this.shouldScrollToBottom ? (h("rtk-spinner", { size: "sm" })) : (h("rtk-icon", { icon: this.iconPack.chevron_down })))), h("div", { key: '91bcdadd2518313fa06306a172575f5acc786596', class: "smallest-dom-element", id: "bottom-scroll", ref: (el) => (this.$bottomRef = el) }), this.isLoadingBottom && this.pages.length > 0 && h("rtk-spinner", { key: '932af19af69c3ecd5af22dd3051a5eea5cb25e7a', size: "sm" }), this.isLoading && this.pages.length < 1 && h("rtk-spinner", { key: '9fa60fb784a09800a32a3accdc81d940476330d2', size: "lg" }), !this.isLoading && this.pages.flat().length === 0 ? (h("div", { class: "empty-list" }, (_a = this.emptyListLabel) !== null && _a !== void 0 ? _a : this.t('list.empty'))) : (h("div", { class: "page-wrapper" }, this.pages.map((page, pageIndex) => (h("div", { class: "page", "data-page-index": pageIndex }, this.createNodes([...page].reverse())))))), this.isLoadingTop && this.pages.length > 0 && h("rtk-spinner", { key: '73103f58338bdb89be69f9f6dc742e3cdd2c95d8', size: "sm" }), h("div", { key: '9c4c43ffb6442d58040448fe1b2d7332505fc81e', class: "smallest-dom-element", id: "top-scroll", ref: (el) => (this.$topRef = el) }))));
    }
    static get is() { return "rtk-paginated-list"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["rtk-paginated-list.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["rtk-paginated-list.css"]
        };
    }
    static get properties() {
        return {
            "pageSize": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Page Size"
                },
                "getter": false,
                "setter": false,
                "attribute": "page-size",
                "reflect": false
            },
            "pagesAllowed": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Number of pages allowed to be shown"
                },
                "getter": false,
                "setter": false,
                "attribute": "pages-allowed",
                "reflect": false
            },
            "emptyListLabel": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "label to show when empty"
                },
                "getter": false,
                "setter": false,
                "attribute": "empty-list-label",
                "reflect": false,
                "defaultValue": "null"
            },
            "fetchData": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(timestamp: number, size: number, reversed: boolean) => Promise<unknown[]>",
                    "resolved": "(timestamp: number, size: number, reversed: boolean) => Promise<unknown[]>",
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Fetch the data"
                },
                "getter": false,
                "setter": false
            },
            "createNodes": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(data: unknown[]) => VNode[]",
                    "resolved": "(data: unknown[]) => VNode[]",
                    "references": {
                        "VNode": {
                            "location": "import",
                            "path": "@stencil/core",
                            "id": "../../node_modules/@stencil/core/internal/stencil-core/index.d.ts::VNode"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Create nodes"
                },
                "getter": false,
                "setter": false
            },
            "autoScroll": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "auto scroll list to bottom"
                },
                "getter": false,
                "setter": false,
                "attribute": "auto-scroll",
                "reflect": false
            },
            "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": "../../lib/icons",
                            "id": "src/lib/icons/index.ts::IconPack"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon pack"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "defaultIconPack"
            },
            "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": "../../lib/lang",
                            "id": "src/lib/lang/index.ts::RtkI18n"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Language"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "useLanguage()"
            }
        };
    }
    static get states() {
        return {
            "rerenderBoolean": {},
            "showEmptyListLabel": {},
            "isLoading": {},
            "isLoadingTop": {},
            "isLoadingBottom": {}
        };
    }
    static get methods() {
        return {
            "rerenderList": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Rerender paginated list",
                    "tags": []
                }
            },
            "onNewNode": {
                "complexType": {
                    "signature": "(node: DataNode) => Promise<void>",
                    "parameters": [{
                            "name": "node",
                            "type": "DataNode",
                            "docs": "- The data node to add to the beginning of the list"
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "DataNode": {
                            "location": "local",
                            "path": "/home/runner/work/realtimekit-ui/realtimekit-ui/packages/core/src/components/rtk-paginated-list/rtk-paginated-list.tsx",
                            "id": "src/components/rtk-paginated-list/rtk-paginated-list.tsx::DataNode"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Adds a new node to the beginning of the paginated list",
                    "tags": [{
                            "name": "param",
                            "text": "node - The data node to add to the beginning of the list"
                        }]
                }
            },
            "onNodeDelete": {
                "complexType": {
                    "signature": "(id: string) => Promise<void>",
                    "parameters": [{
                            "name": "id",
                            "type": "string",
                            "docs": "- The id of the node to delete"
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Deletes a node anywhere from the list",
                    "tags": [{
                            "name": "param",
                            "text": "id - The id of the node to delete"
                        }]
                }
            },
            "onNodeUpdate": {
                "complexType": {
                    "signature": "(id: string, node: DataNode) => Promise<void>",
                    "parameters": [{
                            "name": "id",
                            "type": "string",
                            "docs": "- The id of the node to update"
                        }, {
                            "name": "node",
                            "type": "DataNode",
                            "docs": "- The updated data node"
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "DataNode": {
                            "location": "local",
                            "path": "/home/runner/work/realtimekit-ui/realtimekit-ui/packages/core/src/components/rtk-paginated-list/rtk-paginated-list.tsx",
                            "id": "src/components/rtk-paginated-list/rtk-paginated-list.tsx::DataNode"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Updates a new node anywhere in the list",
                    "tags": [{
                            "name": "param",
                            "text": "id - The id of the node to update"
                        }, {
                            "name": "param",
                            "text": "node - The updated data node"
                        }]
                }
            },
            "reset": {
                "complexType": {
                    "signature": "(timestamp?: number) => Promise<void>",
                    "parameters": [{
                            "name": "timestamp",
                            "type": "number",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Resets the paginated list to a given timestamp",
                    "tags": []
                }
            }
        };
    }
}
__decorate([
    SyncWithStore()
], RtkPaginatedList.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkPaginatedList.prototype, "t", void 0);
