import { NextRequest } from 'next/server';

type MicrofrontendsMiddlewareHandler = (request: NextRequest) => Promise<Response | undefined>;
interface MicrofrontendsMiddleware {
    src: string | RegExp;
    fn: MicrofrontendsMiddlewareHandler;
}

/**
 * Returns an array of middleware functions that will handle routing to the
 * right micro-frontends for the provided configuration.
 *
 * @param config - The micro-frontends configuration object.
 * @param flagValues - An object that maps flag names to functions that return the flag value.
 */
declare function getMicrofrontendsMiddleware({ request, flagValues, }: {
    request: NextRequest;
    flagValues?: Record<string, () => Promise<boolean>>;
}): MicrofrontendsMiddleware[];
/**
 * Executes the middlewares returned by `getMicrofrontendsMiddleware` and
 * returns a `Response` if any of the micro-frontends middlewares match or
 * `undefined` if none match. If a `Response` object is returned, the calling
 * code should return that Response from the Next.js middleware in order to
 * stop execution of the middleware and perform the rewrite.
 */
declare function runMicrofrontendsMiddleware({ request, flagValues, }: {
    request: NextRequest;
    flagValues?: Record<string, () => Promise<boolean>>;
}): Promise<Response | undefined>;

export { MicrofrontendsMiddleware, MicrofrontendsMiddlewareHandler, getMicrofrontendsMiddleware, runMicrofrontendsMiddleware };
