/// <reference lib="esnext.temporal" />
import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-BBVLF7lx.cjs";
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";

//#region src/federation/router.d.ts
/**
* Options for the {@link Router}.
* @since 0.12.0
* @deprecated Import `RouterOptions` from `@fedify/uri-template` instead.
*/
interface RouterOptions$1 extends RouterOptions {}
/**
* The result of {@link Router.route} method.
* @since 1.3.0
* @deprecated Import `RouterRouteResult` from `@fedify/uri-template` instead.
*/
interface RouterRouteResult$1 extends RouterRouteResult<Record<never, never>> {}
/**
* URL router and constructor based on URI Template
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
*
* @deprecated Import `Router` from `@fedify/uri-template` instead.  This class
*             remains only for compatibility with older Fedify code.  The
*             `@fedify/uri-template` router is the replacement implementation
*             and should be used directly in new code.
*/
declare class Router {
  #private;
  /**
  * Create a new {@link Router}.
  * @param options Options for the router.
  * @deprecated Use `new Router(options)` from `@fedify/uri-template`
  *             instead.
  */
  constructor(options?: RouterOptions);
  /**
  * Whether to ignore trailing slashes when matching paths.
  * @deprecated Use `Router` from `@fedify/uri-template` instead.  This
  *             accessor forwards to the underlying `@fedify/uri-template`
  *             router so that post-construction mutation keeps working as
  *             in older Fedify code.
  */
  get trailingSlashInsensitive(): boolean;
  set trailingSlashInsensitive(value: boolean);
  /**
  * Clones this router.
  * @deprecated Use `Router` from `@fedify/uri-template` instead.
  */
  clone(): Router;
  /**
  * Checks if a path name exists in the router.
  * @param name The name of the path.
  * @returns `true` if the path name exists, otherwise `false`.
  * @deprecated Use `Router` from `@fedify/uri-template` instead.
  */
  has(name: string): boolean;
  /**
  * Adds a new path rule to the router.
  * @param template The path pattern.
  * @param name The name of the path.
  * @returns The names of the variables in the path pattern.
  * @deprecated Use `Router` from `@fedify/uri-template` instead.  In this
  *             compatibility class, `add()` both registers the route and
  *             returns the variables in the path pattern.  In
  *             `@fedify/uri-template`, these two responsibilities are split:
  *             `router.add(template, name)` registers the route and returns
  *             `void`, while the pure static method
  *             `Router.variables(template)` returns the variable names.  To
  *             migrate, call `Router.variables(template)` when variables are
  *             needed, then call `router.add(template, name)` to register the
  *             route.
  */
  add(template: string, name: string): Set<string>;
  /**
  * Resolves a path name and values from a URL, if any match.
  * @param url The URL to resolve.
  * @returns The name of the path and its values, if any match.  Otherwise,
  *          `null`.
  * @deprecated Use `Router` from `@fedify/uri-template` instead.  Unlike the
  *             stricter `@fedify/uri-template` router, this compatibility
  *             method keeps the old Fedify 2.x contract of returning `null`
  *             (rather than throwing) for inputs that are not router paths.
  */
  route(url: string): RouterRouteResult$1 | null;
  /**
  * Constructs a URL/path from a path name and values.
  * @param name The name of the path.
  * @param values The values to expand the path with.
  * @returns The URL/path, if the name exists.  Otherwise, `null`.
  * @deprecated Use `Router` from `@fedify/uri-template` instead.
  */
  build(name: string, values: Record<string, string>): string | null;
}
/**
* An error thrown by the {@link Router}.
* @deprecated Import `RouterError` from `@fedify/uri-template` instead.
*/
declare class RouterError$1 extends RouterError {
  /**
  * Treats every `RouterError` from `@fedify/uri-template` as an instance of
  * this deprecated class.
  *
  * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
  */
  static override [Symbol.hasInstance](instance: unknown): boolean;
  /**
  * Create a new {@link RouterError}.
  * @param message The error message.
  * @deprecated Import `RouterError` from `@fedify/uri-template` instead.
  */
  constructor(message: string);
}
//#endregion
//#region src/federation/webfinger.d.ts
/**
* Parameters for {@link handleWebFinger}.
*/
interface WebFingerHandlerParameters<TContextData> {
  /**
  * The request context.
  */
  context: RequestContext<TContextData>;
  /**
  * The canonical hostname of the server, if it's explicitly configured.
  * @since 1.5.0
  */
  host?: string;
  /**
  * The callback for dispatching the actor.
  */
  actorDispatcher?: ActorDispatcher<TContextData>;
  /**
  * The callback for mapping a WebFinger username to the corresponding actor's
  * internal identifier, or `null` if the username is not found.
  * @since 0.15.0
  */
  actorHandleMapper?: ActorHandleMapper<TContextData>;
  /**
  * The callback for mapping a WebFinger query to the corresponding actor's
  * internal identifier or username, or `null` if the query is not found.
  * @since 1.4.0
  */
  actorAliasMapper?: ActorAliasMapper<TContextData>;
  /**
  * The callback for dispatching the Links of webFinger.
  */
  webFingerLinksDispatcher?: WebFingerLinksDispatcher<TContextData>;
  /**
  * The function to call when the actor is not found.
  */
  onNotFound(request: Request): Response | Promise<Response>;
  /**
  * The OpenTelemetry tracer.
  * @since 1.3.0
  */
  tracer?: Tracer;
  /**
  * The span for the request.
  * @since 1.3.0
  */
  span?: Span;
  /**
  * The OpenTelemetry meter provider used to record the `webfinger.handle`
  * counter and `webfinger.handle.duration` histogram.  When omitted, no
  * WebFinger-specific measurements are emitted (the request still
  * contributes to `fedify.http.server.request.*` because that metric is
  * recorded one layer up in `Federation.fetch`).
  * @since 2.3.0
  */
  meterProvider?: MeterProvider;
}
/**
* Handles a WebFinger request.  You would not typically call this function
* directly, but instead use {@link Federation.fetch} method.
* @param request The WebFinger request to handle.
* @param parameters The parameters for handling the request.
* @returns The response to the request.
*/
declare function handleWebFinger<TContextData>(request: Request, options: WebFingerHandlerParameters<TContextData>): Promise<Response>;
//#endregion
export { RouterOptions$1 as a, RouterError$1 as i, handleWebFinger as n, RouterRouteResult$1 as o, Router as r, WebFingerHandlerParameters as t };