import { p as proxyCustomElement, H, h } from './p-ae373651.js';
import { e as defaultIconPack } from './p-5b3a7f00.js';
import './p-a83ccdbd.js';
import { a as sanitizeLink } from './p-efabd2ce.js';
import { S as SyncWithStore } from './p-070aa695.js';
import { g as getExtension, a as getFileSize, d as downloadFile } from './p-47314bc7.js';
import { d as defineCustomElement$2 } from './p-85587a5c.js';
import { d as defineCustomElement$1 } from './p-3e0452c4.js';

const rtkFileMessageViewCss = ":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)}.file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);min-width:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);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));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.file .file-data{margin-left:var(--rtk-space-1, 4px);flex:1 1 0%}.file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}";
const RtkFileMessageViewStyle0 = rtkFileMessageViewCss;

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 RtkFileMessageView = /*@__PURE__*/ proxyCustomElement(class RtkFileMessageView extends H {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        /** 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 style() { return RtkFileMessageViewStyle0; }
}, [1, "rtk-file-message-view", {
        "name": [1],
        "size": [2],
        "url": [1],
        "iconPack": [16]
    }]);
__decorate([
    SyncWithStore()
], RtkFileMessageView.prototype, "iconPack", void 0);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["rtk-file-message-view", "rtk-button", "rtk-icon"];
    components.forEach(tagName => { switch (tagName) {
        case "rtk-file-message-view":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, RtkFileMessageView);
            }
            break;
        case "rtk-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
        case "rtk-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}
defineCustomElement();

export { RtkFileMessageView as R, defineCustomElement as d };
