import { h } from "@stencil/core";
export class Download {
    constructor() {
        this.tokens = 'css';
    }
    render() {
        const fileMap = {
            css: 'css-variables.css',
            scss: 'scss-variables.scss'
        };
        const fileName = `infineon-tokens.${this.tokens}`;
        const sourceFile = fileMap[this.tokens];
        const fileUrl = `https://raw.githubusercontent.com/Infineon/public-assets/main/ifx-tokens/${sourceFile}`;
        return (h("ifx-link", { key: '51887d03944efc6448ef2c71288a16754bebf12f', onClick: (e) => {
                e.preventDefault();
                fetch(fileUrl)
                    .then(res => res.blob())
                    .then(blob => {
                    const link = document.createElement('a');
                    link.href = URL.createObjectURL(blob);
                    link.download = fileName;
                    link.click();
                });
            }, href: fileUrl, download: fileName, class: "download__wrapper", size: "m", variant: "bold" }, h("slot", { key: '8b4c69297dcbf44cf7182e8db89758a4f3a1f981' })));
    }
    static get is() { return "ifx-download"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["./download.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["download.css"]
        };
    }
    static get properties() {
        return {
            "tokens": {
                "type": "string",
                "attribute": "tokens",
                "mutable": false,
                "complexType": {
                    "original": "'css' | 'scss'",
                    "resolved": "\"css\" | \"scss\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'css'"
            }
        };
    }
}
//# sourceMappingURL=download.js.map
