"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerPlatform = registerPlatform;
exports.getPlatform = getPlatform;
exports.getPlatformOrThrow = getPlatformOrThrow;
const platforms = new Map();
function registerPlatform(adapter) {
    if (platforms.has(adapter.platformId)) {
        throw new Error(`Platform "${adapter.platformId}" is already registered`);
    }
    platforms.set(adapter.platformId, adapter);
}
function getPlatform(id) {
    return platforms.get(id);
}
function getPlatformOrThrow(id) {
    const platform = platforms.get(id);
    if (!platform) {
        throw new Error(`Platform "${id}" is not registered. ` +
            `Import @mablhq-internal/mobile-runtime at CLI startup to register the mobile platform.`);
    }
    return platform;
}
