import { __awaiter } from "tslib";
import { FoundationRouter } from '@genesislcap/foundation-ui';
import { logger } from '../utils';
var ResourceType;
(function (ResourceType) {
    ResourceType["LOCAL"] = "LOCAL";
    ResourceType["REMOTE"] = "REMOTE";
})(ResourceType || (ResourceType = {}));
/**
 * TODO: Think about sharing import functions across micro frontends.
 */
function loadZeroFallback() {
    return import(
    /* webpackMode: "lazy" */
    '@genesislcap/foundation-zero');
}
/**
 * Granular
 */
function loadZeroDesignSystem() {
    return __awaiter(this, void 0, void 0, function* () {
        let type = ResourceType.REMOTE;
        try {
            // @ts-ignore
            return yield import('foundationZero/ZeroDesignSystem');
        }
        catch (e) {
            type = ResourceType.LOCAL;
            return yield loadZeroFallback();
        }
        finally {
            logger.debug(`Using '${type}' version of foundationZero/ZeroDesignSystem`);
        }
    });
}
export function loadRemotes(options) {
    return __awaiter(this, void 0, void 0, function* () {
        const { registerZeroDesignSystem } = yield loadZeroDesignSystem();
        return {
            ZeroDesignSystem: registerZeroDesignSystem(),
        };
    });
}
/**
 * Ensure tree shaking doesn't remove these
 * Perhaps we keep these MFs style free, ie. they need to get wrapped to have style applied. Keeping it simple for now.
 */
FoundationRouter;
//# sourceMappingURL=components.js.map