"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cloneUnitClass = exports.cloneUnit = void 0;
const fromUnitBundle_1 = require("./fromUnitBundle");
function cloneUnit(unit) {
    const { __system } = unit;
    const NewBundle = cloneUnitClass(unit);
    const newUnit = new NewBundle(__system);
    return newUnit;
}
exports.cloneUnit = cloneUnit;
function cloneUnitClass(unit) {
    const { __system } = unit;
    const specs = __system.specs;
    const bundle = unit.getUnitBundleSpec();
    // console.log(JSON.stringify(bundle, null, 2))
    const NewBundle = (0, fromUnitBundle_1.fromUnitBundle)(bundle, specs, __system.classes);
    return NewBundle;
}
exports.cloneUnitClass = cloneUnitClass;
//# sourceMappingURL=cloneUnit.js.map