"use strict";
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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UISvgIcon = void 0;
var aurelia_framework_1 = require("aurelia-framework");
var svg_icons_json_1 = __importDefault(require("./svg-icons.json"));
var UISvgIcon = exports.UISvgIcon = (function () {
    function UISvgIcon() {
        this.icon = "";
        this.class = "";
        this.viewBox = "0 0 24 24";
        this.iconPath = "";
    }
    Object.defineProperty(UISvgIcon.prototype, "safeIconPath", {
        get: function () {
            if (this.iconPath == null || this.iconPath.length == 0)
                return "";
            if (!this.iconPath.startsWith('<g>')) {
                return "<path d=\"".concat(this.iconPath, "\"></path>");
            }
            return this.iconPath;
        },
        enumerable: false,
        configurable: true
    });
    UISvgIcon.prototype.bind = function () {
        this.iconChanged();
    };
    UISvgIcon.prototype.iconChanged = function () {
        this.iconPath = svg_icons_json_1.default[this.icon];
        if (!this.iconPath) {
            this.iconPath = svg_icons_json_1.default.unknown;
        }
    };
    __decorate([
        (0, aurelia_framework_1.bindable)(),
        __metadata("design:type", String)
    ], UISvgIcon.prototype, "icon", void 0);
    __decorate([
        (0, aurelia_framework_1.bindable)(),
        __metadata("design:type", String)
    ], UISvgIcon.prototype, "class", void 0);
    __decorate([
        (0, aurelia_framework_1.bindable)(),
        __metadata("design:type", Object)
    ], UISvgIcon.prototype, "viewBox", void 0);
    __decorate([
        (0, aurelia_framework_1.computedFrom)("iconPath"),
        __metadata("design:type", Object),
        __metadata("design:paramtypes", [])
    ], UISvgIcon.prototype, "safeIconPath", null);
    UISvgIcon = __decorate([
        (0, aurelia_framework_1.containerless)(),
        (0, aurelia_framework_1.customElement)("ui-svg-icon"),
        (0, aurelia_framework_1.inlineView)("<template><svg ref=\"vmElement\" slot=\"svg-icon\" class=\"ui-icon ui-svg-icon ${class}\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"24\" height=\"24\" viewBox=\"${viewBox}\" innerhtml.bind=\"safeIconPath\"></svg></template>")
    ], UISvgIcon);
    return UISvgIcon;
}());

//# sourceMappingURL=ui-svg-icon.js.map
