import { ExternalRouteRef, RouteRef, SubRouteRef, FrontendFeature as FrontendFeature$1, ExtensionFactoryMiddleware, AppTree } from '@backstage/frontend-plugin-api';
import { ConfigApi, ApiHolder } from '@backstage/core-plugin-api';

/**
 * Extracts a union of the keys in a map whose value extends the given type
 *
 * @ignore
 */
type KeysWithType<Obj extends {
    [key in string]: any;
}, Type> = {
    [key in keyof Obj]: Obj[key] extends Type ? key : never;
}[keyof Obj];
/**
 * Takes a map Map required values and makes all keys matching Keys optional
 *
 * @ignore
 */
type PartialKeys<Map extends {
    [name in string]: any;
}, Keys extends keyof Map> = Partial<Pick<Map, Keys>> & Required<Omit<Map, Keys>>;
/**
 * Creates a map of target routes with matching parameters based on a map of external routes.
 *
 * @ignore
 */
type TargetRouteMap<ExternalRoutes extends {
    [name: string]: ExternalRouteRef;
}> = {
    [name in keyof ExternalRoutes]: ExternalRoutes[name] extends ExternalRouteRef<infer Params> ? RouteRef<Params> | SubRouteRef<Params> | false : never;
};
/**
 * A function that can bind from external routes of a given plugin, to concrete
 * routes of other plugins. See {@link @backstage/frontend-defaults#createApp}.
 *
 * @public
 */
type CreateAppRouteBinder = <TExternalRoutes extends {
    [name: string]: ExternalRouteRef;
}>(externalRoutes: TExternalRoutes, targetRoutes: PartialKeys<TargetRouteMap<TExternalRoutes>, KeysWithType<TExternalRoutes, ExternalRouteRef<any>>>) => void;

/** @public
 * @deprecated Use {@link @backstage/frontend-plugin-api#FrontendFeature} instead.
 */
type FrontendFeature = FrontendFeature$1;

/**
 * Creates an empty app without any default features. This is a low-level API is
 * intended for use in tests or specialized setups. Typically you want to use
 * `createApp` from `@backstage/frontend-defaults` instead.
 *
 * @public
 */
declare function createSpecializedApp(options?: {
    features?: FrontendFeature[];
    config?: ConfigApi;
    bindRoutes?(context: {
        bind: CreateAppRouteBinder;
    }): void;
    apis?: ApiHolder;
    extensionFactoryMiddleware?: ExtensionFactoryMiddleware | ExtensionFactoryMiddleware[];
    flags?: {
        allowUnknownExtensionConfig?: boolean;
    };
}): {
    apis: ApiHolder;
    tree: AppTree;
};

export { type CreateAppRouteBinder, type FrontendFeature, createSpecializedApp };
