/*! @azure/msal-browser v3.5.0 2023-11-07 */
'use strict';
import { TeamsAppOperatingContext } from '../operatingcontext/TeamsAppOperatingContext.mjs';
import { StandardOperatingContext } from '../operatingcontext/StandardOperatingContext.mjs';

/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */
async function createV3Controller(config) {
    const standard = new StandardOperatingContext(config);
    await standard.initialize();
    const controller = await import('./StandardController.mjs');
    return await controller.StandardController.createController(standard);
}
async function createController(config) {
    const standard = new StandardOperatingContext(config);
    const teamsApp = new TeamsAppOperatingContext(config);
    const operatingContexts = [standard.initialize(), teamsApp.initialize()];
    await Promise.all(operatingContexts);
    if (teamsApp.isAvailable() &&
        teamsApp.getConfig().auth.supportsNestedAppAuth) {
        const controller = await import('./NestedAppAuthController.mjs');
        return await controller.NestedAppAuthController.createController(teamsApp);
    }
    else if (standard.isAvailable()) {
        const controller = await import('./StandardController.mjs');
        return await controller.StandardController.createController(standard);
    }
    else {
        // Since neither of the actual operating contexts are available keep the UnknownOperatingContextController
        return null;
    }
}

export { createController, createV3Controller };
//# sourceMappingURL=ControllerFactory.mjs.map
