"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureIcon = exports.SPRITESHEET_VIEWBOX = exports.SYSTEM_SPRITESHEET_ID = void 0;
const namespaceURI_1 = require("./component/namespaceURI");
exports.SYSTEM_SPRITESHEET_ID = '__SYSTEM__SPRITESHEET__';
exports.SPRITESHEET_VIEWBOX = '0 0 24 24';
const ensureIcon = (system, id) => {
    const { api: { document: { createElementNS }, }, cache: { spriteSheetMap }, foreground: { sprite }, icons, } = system;
    if (spriteSheetMap[id]) {
        return;
    }
    let d = icons[id];
    if (!d) {
        return;
    }
    const symbol_el = createElementNS(namespaceURI_1.namespaceURI, 'symbol');
    symbol_el.id = id;
    symbol_el.setAttribute('viewBox', exports.SPRITESHEET_VIEWBOX);
    const path_el = createElementNS(namespaceURI_1.namespaceURI, 'path');
    path_el.setAttribute('d', d);
    symbol_el.appendChild(path_el);
    sprite.appendChild(symbol_el);
    spriteSheetMap[id] = true;
};
exports.ensureIcon = ensureIcon;
//# sourceMappingURL=ensureIcon.js.map