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 { h } from "@stencil/core";
import { defaultIconPack } from "../../exports";
import { sanitizeLink } from "../../utils/string";
import { SyncWithStore } from "../../utils/sync-with-store";
import { downloadFile, getExtension, getFileSize } from "../../utils/file";
/**
 * A component which renders a file message.
 */
export class RtkFileMessageView {
    constructor() {
        /** Icon pack */
        this.iconPack = defaultIconPack;
    }
    render() {
        return (h("div", { key: '10de68cdb7ebb9bc5579f1d26ac20b00909f5236', class: "file" }, h("rtk-button", { key: 'ba255f55de300a1d9cbc4ccf3fb5ec3f93670d50', variant: "secondary", kind: "icon", onClick: () => downloadFile(sanitizeLink(this.url), { name: this.name, fallbackName: 'file' }), part: "button" }, h("rtk-icon", { key: '2ff668ad0b4b48f0cb05acc9f62727bf4cb9bbd5', icon: this.iconPack.download })), h("div", { key: '4b77a03fc4896994430c1bf814767622e5c21cf4', class: "file-data" }, h("div", { key: 'df4dfdf5d2cffb47cc635c8bc410e5bd3f478570', class: "name" }, this.name), h("div", { key: '6bafabd74cc4d6fe0585874542f183519c6e1000', class: "file-data-split" }, h("div", { key: '5ba6f3fcc10a2d8e580e584597c946c650e6d58c', class: "ext" }, getExtension(this.name)), h("span", { key: '682887e1f3ebaf33c48704f7443bb1de3c3c5201', class: "divider" }), h("div", { key: 'fc2c82f17558a794a2192c9e4a23d9888a176b6e', class: "size" }, getFileSize(this.size))))));
    }
    static get is() { return "rtk-file-message-view"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["rtk-file-message-view.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["rtk-file-message-view.css"]
        };
    }
    static get properties() {
        return {
            "name": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Name of the file"
                },
                "getter": false,
                "setter": false,
                "attribute": "name",
                "reflect": false
            },
            "size": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Size of the file"
                },
                "getter": false,
                "setter": false,
                "attribute": "size",
                "reflect": false
            },
            "url": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Url of the file"
                },
                "getter": false,
                "setter": false,
                "attribute": "url",
                "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": "../../exports",
                            "id": "src/exports.ts::IconPack"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon pack"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "defaultIconPack"
            }
        };
    }
}
__decorate([
    SyncWithStore()
], RtkFileMessageView.prototype, "iconPack", void 0);
