"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.componentClassFromSpecId = componentClassFromSpecId;
const util_1 = require("../spec/util");
const f_1 = __importDefault(require("../system/f/object/Merge/f"));
const object_1 = require("../util/object");
const componentClassFromSpec_1 = require("./componentClassFromSpec");
const id_1 = require("./id");
function componentClassFromSpecId(components, specs, id, memory, subComponentMap = {}, element = undefined) {
    var _a;
    const spec = (0, util_1.getSpec)(specs, id);
    if ((0, id_1.isBaseSpec)(spec)) {
        const Class = components[id];
        const props = (0, object_1.mapObjVK)(memory?.input ?? {}, ({ _register }) => {
            return _register;
        });
        return _a = class NewClass extends Class {
                constructor($props, $system) {
                    super((0, f_1.default)(props, $props), $system, element);
                }
            },
            _a.id = id,
            _a;
    }
    else {
        return (0, componentClassFromSpec_1.componentClassFromSpec)(spec, specs, subComponentMap, memory);
    }
}
//# sourceMappingURL=componentClassFromSpecId.js.map