"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_ICON_VIEWBOX = void 0;
const namespaceURI_1 = require("../../../../client/component/namespaceURI");
const icons_1 = require("../../../../client/icons");
const svg_1 = require("../../../../client/svg");
exports.DEFAULT_ICON_VIEWBOX = '0 0 24 24';
class Icon extends svg_1.SVGElement_ {
    constructor($props, $system) {
        super($props, $system, $system.api.document.createElementNS(namespaceURI_1.namespaceURI, 'svg'), $system.style['icon'], {
            viewBox: exports.DEFAULT_ICON_VIEWBOX,
        }, {
            icon: (icon = '') => {
                const d = icons_1.icons[icon] ?? '';
                path_el.setAttribute('d', d);
            },
            title: (title = '') => {
                title_el.innerHTML = title;
            },
        });
        const { className, icon, title = '' } = $props;
        if (className) {
            this.$element.classList.add(className);
        }
        const title_el = this.$system.api.document.createElementNS(namespaceURI_1.namespaceURI, 'title');
        title_el.innerHTML = title;
        this.$element.appendChild(title_el);
        const path_el = this.$system.api.document.createElementNS(namespaceURI_1.namespaceURI, 'path');
        const d = icons_1.icons[icon] ?? '';
        path_el.setAttribute('d', d);
        this.$element.appendChild(path_el);
    }
}
exports.default = Icon;
//# sourceMappingURL=Component.js.map