"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.componentClassFromSpecId = void 0;
const evaluate_1 = require("../spec/evaluate");
const componentClassFromSpec_1 = require("./componentClassFromSpec");
const id_1 = require("./id");
const spec_1 = require("./spec");
function componentClassFromSpecId(components, specs, classes, id, inputs = {}, subComponentMap = {}, element = undefined) {
    var _a;
    const spec = (0, spec_1.getSpec)(specs, id);
    if ((0, id_1.isBaseSpec)(spec)) {
        const Class = components[id];
        return _a = class NewClass extends Class {
                constructor($props, $system) {
                    super($props, $system, element);
                    for (const name in inputs) {
                        const input = inputs[name];
                        const { data } = input;
                        const _data = (0, evaluate_1.evaluate)(data, specs, classes);
                        // @ts-ignore
                        this.setProp(name, _data);
                    }
                }
            },
            _a.id = id,
            _a;
    }
    else {
        return (0, componentClassFromSpec_1.componentClassFromSpec)(spec, specs, subComponentMap);
    }
}
exports.componentClassFromSpecId = componentClassFromSpecId;
//# sourceMappingURL=componentClassFromSpecId.js.map