import type { Client } from '@sentry/core';
/** The parts of a URL a route depends on. A `URL` satisfies it. */
type RouteUrl = Pick<URL, 'pathname' | 'search' | 'hash'>;
/**
 * Resolves URLs to low-cardinality route names.
 *
 * Framework SDKs register one so that everything the SDK names after a route (span names, the scope's
 * transaction name, metric and span segment attributes) gets the parameterized route instead of the raw
 * URL, without each integration having to reach into the framework's router itself.
 */
export interface RouteProvider {
    /**
     * Resolves a URL path template for a specific URL, e.g. `/users/42` -> `/users/:id`.
     *
     * Must return a path template, never a route identifier. Routers that name routes independently of
     * their path (Vue Router's `route.name`, Ember's `posts.show`) have to return the matched path
     * instead: callers set `url.template` from this, and an identifier is not a template. An SDK that
     * wants to name its span after the identifier still can, on the span itself.
     *
     * Returns `undefined` when the URL matches no known route. Must answer for the URL it is given rather
     * than for wherever the router currently is, so that callers can resolve a URL they captured earlier
     * (a web vital reported after a soft navigation, for example).
     */
    resolveRoute(url: RouteUrl): string | undefined;
    /**
     * Resolves the route the app is currently on.
     *
     * Routers whose location lives in the address bar can delegate to `resolveRoute`, which is what
     * {@link createUrlRouteProvider} does. Routers that keep their own location (memory and hash routers)
     * have to answer from that location instead: for those, `location.href` is the unchanging shell URL
     * and would bucket every route together.
     */
    resolveCurrentRoute(): string | undefined;
}
/**
 * Registers the route provider for a client, replacing any previously registered one. `BrowserClient`
 * calls this with its `routeProvider` option.
 *
 * Prefer the `routeProvider` option where the provider is known at `init`: the pageload span is named
 * while `browserTracingIntegration` sets up, so a provider registered after `init` can only rename it
 * after the fact.
 *
 * A client holds one provider. An app running two routers (a framework migration, or a shell plus an
 * island) registers twice and the last one wins, so the first router's routes stop resolving.
 */
export declare function setRouteProvider(provider: RouteProvider, client?: Client | undefined): void;
/**
 * Returns the route provider registered for a client.
 */
export declare function getRouteProvider(client?: Client | undefined): RouteProvider | undefined;
/**
 * Resolves a URL to a low-cardinality route name, e.g. `/users/42` -> `/users/:id`.
 *
 * Returns `undefined` when no route provider is registered or the URL matches no route. Callers pick
 * their own fallback, because the right one differs: a span name falls back to a low-cardinality
 * constant, the scope's transaction name to the raw path.
 */
export declare function resolveRoute(url: string | URL, client?: Client | undefined): string | undefined;
/**
 * Resolves the route the app is currently on.
 *
 * Returns `undefined` when no route provider is registered or the current location matches no route.
 */
export declare function resolveCurrentRoute(client?: Client | undefined): string | undefined;
/**
 * Builds a {@link RouteProvider} for a router whose location is the browser's, which covers every
 * router except memory and hash routers.
 */
export declare function createUrlRouteProvider(resolveRouteFromUrl: (url: RouteUrl) => string | undefined): RouteProvider;
/**
 * A {@link RouteProvider} that answers from routes it has been told about, rather than by matching.
 */
export interface CachedRouteProvider extends RouteProvider {
    /** Records the route name a router reported for a path. Ignores empty values. */
    record(pathname: string | undefined, routeName: string | null | undefined): void;
}
/**
 * Builds a route provider for a router with no usable matcher, which can only report the route it is
 * on as it gets there (SvelteKit's `page.route.id`, Solid Router's current matches).
 *
 * A URL the app has not visited resolves to `undefined`, which includes the first pageload until the
 * router reports. Backed by an LRU so a long-lived app visiting many URLs can't grow it without end,
 * and so routes that keep being resolved outlive ones passed through once.
 */
export declare function createCachedRouteProvider(maxEntries?: number): CachedRouteProvider;
export {};
//# sourceMappingURL=routing.d.ts.map