"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const namespaceURI_1 = require("../../../../../client/component/namespaceURI");
const element_1 = require("../../../../../client/element");
const style_1 = require("../../../../../client/style");
class SVGForeignObject extends element_1.Element {
    constructor($props, $system) {
        super($props, $system);
        const { className, style = {}, x = 0, y = 0, width = 100, height = 100, } = this.$props;
        const foreign_el = this.$system.api.document.createElementNS(namespaceURI_1.namespaceURI, 'foreignObject');
        if (className !== undefined) {
            foreign_el.classList.value = className;
        }
        foreign_el.setAttribute('x', `${x}`);
        foreign_el.setAttribute('y', `${y}`);
        foreign_el.setAttribute('width', `${width}`);
        foreign_el.setAttribute('height', `${height}`);
        (0, style_1.applyStyle)(foreign_el, style);
        this._foreign_el = foreign_el;
        this.$element = foreign_el;
    }
    onPropChanged(prop, current) {
        if (prop === 'style') {
            (0, style_1.applyStyle)(this._foreign_el, current);
        }
        else if (prop === 'x') {
            this._foreign_el.setAttribute('x', `${current}`);
        }
        else if (prop === 'y') {
            this._foreign_el.setAttribute('y', `${current}`);
        }
        else if (prop === 'width') {
            this._foreign_el.setAttribute('width', `${current}`);
        }
        else if (prop === 'height') {
            this._foreign_el.setAttribute('height', `${current}`);
        }
    }
}
exports.default = SVGForeignObject;
//# sourceMappingURL=Component.js.map