"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AsyncWrap = void 0;
const AsyncWrap = (unit, // RETURN $
_, wrapper) => {
    const { __ = [] } = unit;
    let $unit = unit;
    for (const ___ of _) {
        const AsyncWrapper = wrapper[___];
        if (!AsyncWrapper) {
            throw new Error('Async Wrapper is not registered');
        }
        if (!__.includes(___)) {
            $unit = Object.assign(Object.assign({}, $unit), AsyncWrapper(unit));
        }
    }
    return $unit;
};
exports.AsyncWrap = AsyncWrap;
//# sourceMappingURL=AsyncWrap.js.map