"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var applyLayout_1 = require("./applyLayout");
var createTagNode_1 = require("./createTagNode");
var createTextNode_1 = require("./createTextNode");
var isTextNode_1 = require("./isTextNode");
var getFlexId_1 = require("./getFlexId");
function replaceElement(domElement, virtualElement, parentDomNode, parentVirtualElement, component) {
    var flexId = getFlexId_1.default(virtualElement);
    component.subcacheClear(flexId);
    var newElement = isTextNode_1.default(virtualElement)
        ? createTextNode_1.default(domElement, virtualElement)
        : createTagNode_1.default(domElement, virtualElement, parentVirtualElement, component);
    applyLayout_1.default(newElement, virtualElement, parentDomNode, parentVirtualElement, component, null);
    parentDomNode.replaceChild(newElement, domElement);
    component._addElementToHashTable(newElement, virtualElement);
    return newElement;
}
exports.default = replaceElement;
//# sourceMappingURL=replaceElement.js.map