{
  "id": "@typed/router/Matcher#Matcher",
  "canonicalId": "@typed/router#Matcher",
  "symbol": {
    "id": "@typed/router/Matcher#Matcher",
    "packageName": "@typed/router",
    "moduleName": "Matcher",
    "exportName": "Matcher",
    "kind": "interface",
    "signatures": [
      "export interface Matcher<A, E = never, R = never> extends Fx.Fx<A, E | RouteNotFound | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>, Pipeable {\n    readonly cases: ReadonlyArray<MatchAst>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: (params: RefSubject.RefSubject<Route.Type<Rt>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, options: MatchHandlerOptions<Route.Type<Rt>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;\n    match<Rt extends Route.Any, const B>(route: Rt, handler: B): Matcher<A | B, E, R | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: (params: RefSubject.RefSubject<GuardOutput<G>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, guard: G, options: MatchHandlerOptions<GuardOutput<G>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"r\"] | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B>(route: Rt, guard: G, handler: B): Matcher<A | B, E | GuardError<G>, R | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(options: MatchOptions<Rt, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;\n    readonly prefix: <Rt extends Route.Any>(route: Rt) => Matcher<A, E, R>;\n    readonly provide: <Layers extends readonly [\n        AnyLayer,\n        ...AnyLayer[]\n    ]>(...layers: Layers) => Matcher<A, E | LayerError<Layers[number]>, Exclude<R, LayerSuccess<Layers[number]>> | LayerServices<Layers[number]>>;\n    readonly provideService: <Id, S>(tag: Context.Service<Id, S>, service: S) => Matcher<A, E, Exclude<R, Id>>;\n    readonly provideContext: <R2>(services: Context.Context<R2>) => Matcher<A, E, Exclude<R, R2>>;\n    readonly catchCause: <B, E2, R2>(f: CatchHandler<E, B, E2, R2>) => Matcher<A | B, E2, R | R2>;\n    readonly catch: <B, E2, R2>(f: (e: E) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2, R | R2>;\n    readonly catchTag: <const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>>, B, E2, R2>(tag: K, f: (e: ExtractTag<NoInfer<E>, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2 | ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>, R | R2>;\n    readonly redirectTo: (path: string) => Fx.Fx<A, Exclude<E, RouteNotFound> | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>;\n    readonly layout: <B, E2, R2>(layout: Layout<any, A, E, R, B, E2, R2>) => Matcher<B, E | E2, R | R2>;\n    readonly merge: <const Others extends ReadonlyArray<Matcher.Any>>(...others: Others) => Matcher<A | Matcher.MergeSuccess<Others>, E | Matcher.MergeError<Others>, R | Matcher.MergeServices<Others>>;\n}",
      "export declare namespace Matcher {\n    type Any = Matcher<any, any, any> | Matcher<any, never, any> | Matcher<any, any, never> | Matcher<any, never, never>;\n    type Success<T> = [\n        T\n    ] extends [\n        Matcher<infer A, infer _E, infer _R>\n    ] ? A : never;\n    type Error<T> = [\n        T\n    ] extends [\n        Matcher<infer _A, infer E, infer _R>\n    ] ? E : never;\n    type Services<T> = [\n        T\n    ] extends [\n        Matcher<infer _A, infer _E, infer R>\n    ] ? R : never;\n    type MergeSuccess<Matchers extends ReadonlyArray<Matcher.Any>> = Success<Matchers[number]>;\n    type MergeError<Matchers extends ReadonlyArray<Matcher.Any>> = Error<Matchers[number]>;\n    type MergeServices<Matchers extends ReadonlyArray<Matcher.Any>> = Services<Matchers[number]>;\n}"
    ],
    "summary": "Composes ordered route cases into an Fx that follows the current Navigation path.",
    "sections": {
      "Why": "A Matcher is both a declarative route table and `Fx<A, E, R>`. Route, guard, dependency, layout,\nand catch composition therefore stays in Effect's typed success, error, and service channels.",
      "Ownership and lifetime": "Building a Matcher is pure. Running it requires Router and Scope: it subscribes to CurrentPath,\nswitches selected handlers when the route changes, reuses the same handler for parameter-only\nupdates, and finalizes route/layout/layer scopes when selection changes or the consumer interrupts.\nMatching is case-insensitive and ignores trailing slashes. Distinct registered matcher paths use\nstructural precedence (literal, constrained parameter, parameter, then wildcard), not a global\nfirst-declared rule. Registration order matters among compiled entries that\nshare the same matcher path: their schemas and guards fall through in that order.",
      "Property: cases": "The immutable ordered Match AST compiled when this Matcher is run.",
      "Property: cases: Why": "Keeping cases visible preserves registration order for entries that compile to the same matcher\npath. Distinct matcher paths are still selected by structural path-shape precedence.",
      "Property: cases: Ownership and lifetime": "The array is retained by the Matcher value and acquires no runtime resources.",
      "Property: catch": "Handles the first typed failure in this Matcher's cause.",
      "Property: catch: Why": "It provides an ergonomic typed-error boundary while retaining non-failure causes unchanged.",
      "Property: catch: Ownership and lifetime": "The replacement Fx is owned by the selected route Scope; defects and interruption are rethrown.",
      "Property: catchCause": "Handles complete Effect causes from this Matcher with a reactive Cause RefSubject.",
      "Property: catchCause: Why": "Defects, interruption, and typed failures remain distinguishable instead of collapsing to one error value.",
      "Property: catchCause: Ownership and lifetime": "The catch Fx is mounted in the same selected route Scope and is interrupted when the route changes.",
      "Property: catchTag": "Handles selected tagged failures while retaining unmatched failures in the error channel.",
      "Property: catchTag: Why": "Tagged recovery narrows only the handled variants instead of erasing the entire error union.",
      "Property: catchTag: Ownership and lifetime": "The replacement Fx shares the selected route Scope. Unmatched tags rethrow the original cause.",
      "Property: layout": "Wraps the Matcher's selected content in a parameter-aware layout Fx.",
      "Property: layout: Why": "Layouts can compose output around nested content while observing the same reactive parameters.",
      "Property: layout: Ownership and lifetime": "Layouts are acquired inner-to-outer so each newly acquired outer layout receives the already-\nwrapped inner Fx as its content. The rendered nesting is therefore outer(inner(handler)). Stable\nlayout identities receive parameter/content updates without remounting and finalize with the\nselected route Scope.",
      "Method: match": "Appends one route case with an optional guard, dependencies, layout, and local error boundary.",
      "Method: match: Why": "Nine overload families accept direct values, Effect, Stream, Fx, parameter functions, guarded\nvariants, and options without erasing their errors or service requirements. After path lookup,\ncandidates registered under the same matcher path are decoded and guarded in declaration order:\nthe first decoded guard `Some` wins; decode failure, guard `None`, or guard failure falls through.\nDistinct path shapes are prioritized structurally, not solely by this call's position.",
      "Method: match: Ownership and lifetime": "Registration is pure and returns a new Matcher. When run, candidate layers are prepared before\nthe guard; rejected candidates roll them back. The selected handler, layout, and dependencies\nare owned by its route Scope and are interrupted on replacement.",
      "Property: merge": "Merge this matcher with one or more others. Combined matcher matches all routes; each matcher's layouts/provide apply only to its own routes.",
      "Property: merge: Why": "Independent route tables can be assembled without moving their local providers or layouts to a global boundary.",
      "Property: merge: Ownership and lifetime": "Merge is pure and concatenates cases: this Matcher's cases precede each supplied Matcher's cases.\nThat order governs decode/guard fallthrough only when entries share a matcher path; the path\nrouter chooses between distinct shapes according to its own specificity rules.",
      "Property: prefix": "Prefixes every case in this Matcher with another Route.",
      "Property: prefix: Why": "Nested applications can reuse a route table beneath a structural mount path.",
      "Property: prefix: Ownership and lifetime": "Composition is pure. Prefix services and schemas participate when the returned Matcher runs.",
      "Property: provide": "Provides one or more Effect Layers to this Matcher's cases.",
      "Property: provide: Why": "Route-local services remain explicit in the Matcher type instead of leaking into the whole app.",
      "Property: provide: Ownership and lifetime": "Layers are acquired only for candidate evaluation, committed for the selected route, shared via\nEffect's memo map where possible, and finalized when no selected case retains them.",
      "Property: provideContext": "Provides an existing Effect Context to this Matcher's cases.",
      "Property: provideContext: Why": "Multiple already-constructed services can satisfy route requirements without rebuilding Layers.",
      "Property: provideContext: Ownership and lifetime": "The Context is retained by the Matcher; resource lifetime remains owned by whoever constructed it.",
      "Property: provideService": "Provides one concrete Effect service to this Matcher's cases.",
      "Property: provideService: Why": "It is the concise constant-service form of `provideContext`.",
      "Property: provideService: Ownership and lifetime": "The supplied service is retained by the Matcher value; no acquisition or finalizer is added.",
      "Property: redirectTo": "Finishes route configuration with one redirect-and-retry on `RouteNotFound`.\n\nUse this terminal method after adding routes, providers, layouts, and recovery. It returns\nan Fx rather than another Matcher because the redirect wraps the running route selection.\nMatched-handler, decoding, and guard failures retain their error channels and do not redirect.\nConstruction starts no navigation; the consuming Scope owns execution and the single retry."
    },
    "examples": [
      {
        "language": "text",
        "code": "```ts\nimport * as Router from \"@typed/router\"\n\nconst app = Router.match(Router.Parse(\"/\"), \"home\")\n  .match(Router.Parse(\"/users/:id\"), (params) => params)\n```\n\nMatcher dependency and lifetime behavior follows Effect v4 Layer and Scope semantics:\nhttps://effect.website/docs/requirements-management/layers/ and\nhttps://effect.website/docs/resource-management/scope/."
      },
      {
        "language": "ts",
        "code": "import * as Router from \"@typed/router\"\nimport * as Effect from \"effect/Effect\"\n\nconst users = Router.match(Router.Parse(\"/users/:id\"), (params) =>\n  Effect.map(params, ({ id }) => `user:${id}`)\n)"
      },
      {
        "language": "text",
        "code": "Guarded candidate\n```ts\nimport * as Router from \"@typed/router\"\nimport type { Guard } from \"@typed/guard\"\nimport * as Effect from \"effect/Effect\"\n\ntype Params = { readonly id: string }\nconst accepted: Guard<Params, Params> = (params) => Effect.succeedSome(params)\nconst users = Router.match(Router.Parse(\"/users/:id\"), accepted, (params) => params)\n```"
      },
      {
        "language": "ts",
        "code": "import * as Router from \"@typed/router\"\n\nconst application = Router.match(Router.Slash, \"Queue\")\n  .match(Router.Parse(\"/issues/:issueId\"), \"Issue\")\n  .redirectTo(\"/\")"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/router/src/Matcher.ts",
      "line": 399
    },
    "since": "1.0.0",
    "category": "Matcher contracts"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/router/Matcher#Matcher",
    "packageName": "@typed/router",
    "packageVersion": "1.0.0-beta.13",
    "moduleName": "Matcher",
    "consumerSpecifier": "@typed/router/Matcher",
    "exportName": "Matcher",
    "qualifiedName": "Matcher",
    "declarationKey": "declaration:4f211c87664e790f6747204d",
    "family": "interface",
    "signatures": [
      "export interface Matcher<A, E = never, R = never> extends Fx.Fx<A, E | RouteNotFound | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>, Pipeable {\n    readonly cases: ReadonlyArray<MatchAst>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: (params: RefSubject.RefSubject<Route.Type<Rt>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, options: MatchHandlerOptions<Route.Type<Rt>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;\n    match<Rt extends Route.Any, const B>(route: Rt, handler: B): Matcher<A | B, E, R | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: (params: RefSubject.RefSubject<GuardOutput<G>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, guard: G, options: MatchHandlerOptions<GuardOutput<G>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"r\"] | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B>(route: Rt, guard: G, handler: B): Matcher<A | B, E | GuardError<G>, R | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(options: MatchOptions<Rt, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;\n    readonly prefix: <Rt extends Route.Any>(route: Rt) => Matcher<A, E, R>;\n    readonly provide: <Layers extends readonly [\n        AnyLayer,\n        ...AnyLayer[]\n    ]>(...layers: Layers) => Matcher<A, E | LayerError<Layers[number]>, Exclude<R, LayerSuccess<Layers[number]>> | LayerServices<Layers[number]>>;\n    readonly provideService: <Id, S>(tag: Context.Service<Id, S>, service: S) => Matcher<A, E, Exclude<R, Id>>;\n    readonly provideContext: <R2>(services: Context.Context<R2>) => Matcher<A, E, Exclude<R, R2>>;\n    readonly catchCause: <B, E2, R2>(f: CatchHandler<E, B, E2, R2>) => Matcher<A | B, E2, R | R2>;\n    readonly catch: <B, E2, R2>(f: (e: E) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2, R | R2>;\n    readonly catchTag: <const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>>, B, E2, R2>(tag: K, f: (e: ExtractTag<NoInfer<E>, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2 | ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>, R | R2>;\n    readonly redirectTo: (path: string) => Fx.Fx<A, Exclude<E, RouteNotFound> | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>;\n    readonly layout: <B, E2, R2>(layout: Layout<any, A, E, R, B, E2, R2>) => Matcher<B, E | E2, R | R2>;\n    readonly merge: <const Others extends ReadonlyArray<Matcher.Any>>(...others: Others) => Matcher<A | Matcher.MergeSuccess<Others>, E | Matcher.MergeError<Others>, R | Matcher.MergeServices<Others>>;\n}",
      "export declare namespace Matcher {\n    type Any = Matcher<any, any, any> | Matcher<any, never, any> | Matcher<any, any, never> | Matcher<any, never, never>;\n    type Success<T> = [\n        T\n    ] extends [\n        Matcher<infer A, infer _E, infer _R>\n    ] ? A : never;\n    type Error<T> = [\n        T\n    ] extends [\n        Matcher<infer _A, infer E, infer _R>\n    ] ? E : never;\n    type Services<T> = [\n        T\n    ] extends [\n        Matcher<infer _A, infer _E, infer R>\n    ] ? R : never;\n    type MergeSuccess<Matchers extends ReadonlyArray<Matcher.Any>> = Success<Matchers[number]>;\n    type MergeError<Matchers extends ReadonlyArray<Matcher.Any>> = Error<Matchers[number]>;\n    type MergeServices<Matchers extends ReadonlyArray<Matcher.Any>> = Services<Matchers[number]>;\n}"
    ],
    "sourceSpans": [
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 399,
          "column": 1
        },
        "end": {
          "line": 762,
          "column": 2
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 764,
          "column": 1
        },
        "end": {
          "line": 870,
          "column": 2
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 417,
          "column": 3
        },
        "end": {
          "line": 417,
          "column": 43
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 668,
          "column": 3
        },
        "end": {
          "line": 668,
          "column": 92
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 653,
          "column": 3
        },
        "end": {
          "line": 653,
          "column": 97
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 683,
          "column": 3
        },
        "end": {
          "line": 692,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 736,
          "column": 3
        },
        "end": {
          "line": 738,
          "column": 35
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 460,
          "column": 3
        },
        "end": {
          "line": 463,
          "column": 51
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 466,
          "column": 3
        },
        "end": {
          "line": 469,
          "column": 51
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 472,
          "column": 3
        },
        "end": {
          "line": 489,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 492,
          "column": 3
        },
        "end": {
          "line": 492,
          "column": 99
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 495,
          "column": 3
        },
        "end": {
          "line": 505,
          "column": 86
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 508,
          "column": 3
        },
        "end": {
          "line": 518,
          "column": 86
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 521,
          "column": 3
        },
        "end": {
          "line": 542,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 545,
          "column": 3
        },
        "end": {
          "line": 549,
          "column": 76
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 552,
          "column": 3
        },
        "end": {
          "line": 568,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 755,
          "column": 3
        },
        "end": {
          "line": 761,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 583,
          "column": 3
        },
        "end": {
          "line": 583,
          "column": 74
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 599,
          "column": 3
        },
        "end": {
          "line": 605,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 638,
          "column": 3
        },
        "end": {
          "line": 638,
          "column": 97
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 620,
          "column": 3
        },
        "end": {
          "line": 623,
          "column": 38
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 714,
          "column": 3
        },
        "end": {
          "line": 718,
          "column": 5
        }
      }
    ],
    "aliases": [
      "@typed/router#Matcher"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:4f211c87664e790f6747204d",
    "name": "Matcher",
    "family": "interface",
    "facets": [
      {
        "family": "interface",
        "syntaxKind": "InterfaceDeclaration",
        "signatures": [
          "export interface Matcher<A, E = never, R = never> extends Fx.Fx<A, E | RouteNotFound | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>, Pipeable {\n    readonly cases: ReadonlyArray<MatchAst>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: (params: RefSubject.RefSubject<Route.Type<Rt>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, options: MatchHandlerOptions<Route.Type<Rt>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;\n    match<Rt extends Route.Any, const B>(route: Rt, handler: B): Matcher<A | B, E, R | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: (params: RefSubject.RefSubject<GuardOutput<G>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, guard: G, options: MatchHandlerOptions<GuardOutput<G>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"r\"] | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B>(route: Rt, guard: G, handler: B): Matcher<A | B, E | GuardError<G>, R | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(options: MatchOptions<Rt, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;\n    readonly prefix: <Rt extends Route.Any>(route: Rt) => Matcher<A, E, R>;\n    readonly provide: <Layers extends readonly [\n        AnyLayer,\n        ...AnyLayer[]\n    ]>(...layers: Layers) => Matcher<A, E | LayerError<Layers[number]>, Exclude<R, LayerSuccess<Layers[number]>> | LayerServices<Layers[number]>>;\n    readonly provideService: <Id, S>(tag: Context.Service<Id, S>, service: S) => Matcher<A, E, Exclude<R, Id>>;\n    readonly provideContext: <R2>(services: Context.Context<R2>) => Matcher<A, E, Exclude<R, R2>>;\n    readonly catchCause: <B, E2, R2>(f: CatchHandler<E, B, E2, R2>) => Matcher<A | B, E2, R | R2>;\n    readonly catch: <B, E2, R2>(f: (e: E) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2, R | R2>;\n    readonly catchTag: <const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>>, B, E2, R2>(tag: K, f: (e: ExtractTag<NoInfer<E>, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2 | ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>, R | R2>;\n    readonly redirectTo: (path: string) => Fx.Fx<A, Exclude<E, RouteNotFound> | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>;\n    readonly layout: <B, E2, R2>(layout: Layout<any, A, E, R, B, E2, R2>) => Matcher<B, E | E2, R | R2>;\n    readonly merge: <const Others extends ReadonlyArray<Matcher.Any>>(...others: Others) => Matcher<A | Matcher.MergeSuccess<Others>, E | Matcher.MergeError<Others>, R | Matcher.MergeServices<Others>>;\n}"
        ],
        "typeParameters": [
          "A",
          "E = never",
          "R = never"
        ],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 399,
              "column": 1
            },
            "end": {
              "line": 762,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "namespace",
        "syntaxKind": "ModuleDeclaration",
        "signatures": [
          "export declare namespace Matcher {\n    type Any = Matcher<any, any, any> | Matcher<any, never, any> | Matcher<any, any, never> | Matcher<any, never, never>;\n    type Success<T> = [\n        T\n    ] extends [\n        Matcher<infer A, infer _E, infer _R>\n    ] ? A : never;\n    type Error<T> = [\n        T\n    ] extends [\n        Matcher<infer _A, infer E, infer _R>\n    ] ? E : never;\n    type Services<T> = [\n        T\n    ] extends [\n        Matcher<infer _A, infer _E, infer R>\n    ] ? R : never;\n    type MergeSuccess<Matchers extends ReadonlyArray<Matcher.Any>> = Success<Matchers[number]>;\n    type MergeError<Matchers extends ReadonlyArray<Matcher.Any>> = Error<Matchers[number]>;\n    type MergeServices<Matchers extends ReadonlyArray<Matcher.Any>> = Services<Matchers[number]>;\n}"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 764,
              "column": 1
            },
            "end": {
              "line": 870,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly cases: ReadonlyArray<MatchAst>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 417,
              "column": 3
            },
            "end": {
              "line": 417,
              "column": 43
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly catch: <B, E2, R2>(f: (e: E) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2, R | R2>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 668,
              "column": 3
            },
            "end": {
              "line": 668,
              "column": 92
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly catchCause: <B, E2, R2>(f: CatchHandler<E, B, E2, R2>) => Matcher<A | B, E2, R | R2>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 653,
              "column": 3
            },
            "end": {
              "line": 653,
              "column": 97
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly catchTag: <const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>>, B, E2, R2>(tag: K, f: (e: ExtractTag<NoInfer<E>, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2 | ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>, R | R2>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 683,
              "column": 3
            },
            "end": {
              "line": 692,
              "column": 5
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly layout: <B, E2, R2>(layout: Layout<any, A, E, R, B, E2, R2>) => Matcher<B, E | E2, R | R2>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 736,
              "column": 3
            },
            "end": {
              "line": 738,
              "column": 35
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "method",
        "syntaxKind": "MethodSignature",
        "signatures": [
          "match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: (params: RefSubject.RefSubject<Route.Type<Rt>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;",
          "match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;",
          "match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, options: MatchHandlerOptions<Route.Type<Rt>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;",
          "match<Rt extends Route.Any, const B>(route: Rt, handler: B): Matcher<A | B, E, R | Scope.Scope>;",
          "match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: (params: RefSubject.RefSubject<GuardOutput<G>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;",
          "match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;",
          "match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, guard: G, options: MatchHandlerOptions<GuardOutput<G>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"r\"] | Scope.Scope>;",
          "match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B>(route: Rt, guard: G, handler: B): Matcher<A | B, E | GuardError<G>, R | GuardServices<G> | Scope.Scope>;",
          "match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(options: MatchOptions<Rt, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;"
        ],
        "typeParameters": [
          "Rt extends Route.Any",
          "B",
          "E2 = never",
          "R2 = never",
          "D extends ReadonlyArray<AnyDependency> | undefined = undefined",
          "LB = B",
          "LE2 = never",
          "LR2 = never",
          "C extends CatchHandler<any, any, any, any> | undefined = undefined",
          "const B",
          "G extends GuardInput<Route.Type<Rt>, any, any, any>"
        ],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 460,
              "column": 3
            },
            "end": {
              "line": 463,
              "column": 51
            }
          },
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 466,
              "column": 3
            },
            "end": {
              "line": 469,
              "column": 51
            }
          },
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 472,
              "column": 3
            },
            "end": {
              "line": 489,
              "column": 5
            }
          },
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 492,
              "column": 3
            },
            "end": {
              "line": 492,
              "column": 99
            }
          },
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 495,
              "column": 3
            },
            "end": {
              "line": 505,
              "column": 86
            }
          },
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 508,
              "column": 3
            },
            "end": {
              "line": 518,
              "column": 86
            }
          },
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 521,
              "column": 3
            },
            "end": {
              "line": 542,
              "column": 5
            }
          },
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 545,
              "column": 3
            },
            "end": {
              "line": 549,
              "column": 76
            }
          },
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 552,
              "column": 3
            },
            "end": {
              "line": 568,
              "column": 5
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly merge: <const Others extends ReadonlyArray<Matcher.Any>>(...others: Others) => Matcher<A | Matcher.MergeSuccess<Others>, E | Matcher.MergeError<Others>, R | Matcher.MergeServices<Others>>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 755,
              "column": 3
            },
            "end": {
              "line": 761,
              "column": 5
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly prefix: <Rt extends Route.Any>(route: Rt) => Matcher<A, E, R>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 583,
              "column": 3
            },
            "end": {
              "line": 583,
              "column": 74
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly provide: <Layers extends readonly [\n    AnyLayer,\n    ...AnyLayer[]\n]>(...layers: Layers) => Matcher<A, E | LayerError<Layers[number]>, Exclude<R, LayerSuccess<Layers[number]>> | LayerServices<Layers[number]>>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 599,
              "column": 3
            },
            "end": {
              "line": 605,
              "column": 5
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly provideContext: <R2>(services: Context.Context<R2>) => Matcher<A, E, Exclude<R, R2>>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 638,
              "column": 3
            },
            "end": {
              "line": 638,
              "column": 97
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly provideService: <Id, S>(tag: Context.Service<Id, S>, service: S) => Matcher<A, E, Exclude<R, Id>>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 620,
              "column": 3
            },
            "end": {
              "line": 623,
              "column": 38
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      },
      {
        "family": "property",
        "syntaxKind": "PropertySignature",
        "signatures": [
          "readonly redirectTo: (path: string) => Fx.Fx<A, Exclude<E, RouteNotFound> | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/router/src/Matcher.ts",
            "start": {
              "line": 714,
              "column": 3
            },
            "end": {
              "line": 718,
              "column": 5
            }
          }
        ],
        "static": false,
        "readonly": true,
        "optional": false
      }
    ],
    "signatures": [
      "export interface Matcher<A, E = never, R = never> extends Fx.Fx<A, E | RouteNotFound | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>, Pipeable {\n    readonly cases: ReadonlyArray<MatchAst>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: (params: RefSubject.RefSubject<Route.Type<Rt>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never>(route: Rt, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2, R | R2 | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, options: MatchHandlerOptions<Route.Type<Rt>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;\n    match<Rt extends Route.Any, const B>(route: Rt, handler: B): Matcher<A | B, E, R | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: (params: RefSubject.RefSubject<GuardOutput<G>>) => MatchHandlerReturnValue<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never>(route: Rt, guard: G, handler: Fx.Fx<B, E2, R2> | Effect.Effect<B, E2, R2> | Stream.Stream<B, E2, R2>): Matcher<A | B, E | E2 | GuardError<G>, R | R2 | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(route: Rt, guard: G, options: MatchHandlerOptions<GuardOutput<G>, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, GuardError<G>, GuardServices<G>>[\"r\"] | Scope.Scope>;\n    match<Rt extends Route.Any, G extends GuardInput<Route.Type<Rt>, any, any, any>, B>(route: Rt, guard: G, handler: B): Matcher<A | B, E | GuardError<G>, R | GuardServices<G> | Scope.Scope>;\n    match<Rt extends Route.Any, B, E2 = never, R2 = never, D extends ReadonlyArray<AnyDependency> | undefined = undefined, LB = B, LE2 = never, LR2 = never, C extends CatchHandler<any, any, any, any> | undefined = undefined>(options: MatchOptions<Rt, B, E2, R2, D, LB, LE2, LR2, C>): Matcher<A | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"a\"], E | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"e\"], R | ComputeMatchResult<E2, R2, D, LB, LE2, LR2, C, never, never>[\"r\"] | Scope.Scope>;\n    readonly prefix: <Rt extends Route.Any>(route: Rt) => Matcher<A, E, R>;\n    readonly provide: <Layers extends readonly [\n        AnyLayer,\n        ...AnyLayer[]\n    ]>(...layers: Layers) => Matcher<A, E | LayerError<Layers[number]>, Exclude<R, LayerSuccess<Layers[number]>> | LayerServices<Layers[number]>>;\n    readonly provideService: <Id, S>(tag: Context.Service<Id, S>, service: S) => Matcher<A, E, Exclude<R, Id>>;\n    readonly provideContext: <R2>(services: Context.Context<R2>) => Matcher<A, E, Exclude<R, R2>>;\n    readonly catchCause: <B, E2, R2>(f: CatchHandler<E, B, E2, R2>) => Matcher<A | B, E2, R | R2>;\n    readonly catch: <B, E2, R2>(f: (e: E) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2, R | R2>;\n    readonly catchTag: <const K extends Tags<E> | Arr.NonEmptyReadonlyArray<Tags<E>>, B, E2, R2>(tag: K, f: (e: ExtractTag<NoInfer<E>, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>) => Fx.Fx<B, E2, R2>) => Matcher<A | B, E2 | ExcludeTag<E, K extends Arr.NonEmptyReadonlyArray<string> ? K[number] : K>, R | R2>;\n    readonly redirectTo: (path: string) => Fx.Fx<A, Exclude<E, RouteNotFound> | RouteDecodeError | RouteGuardError, R | Router | Scope.Scope>;\n    readonly layout: <B, E2, R2>(layout: Layout<any, A, E, R, B, E2, R2>) => Matcher<B, E | E2, R | R2>;\n    readonly merge: <const Others extends ReadonlyArray<Matcher.Any>>(...others: Others) => Matcher<A | Matcher.MergeSuccess<Others>, E | Matcher.MergeError<Others>, R | Matcher.MergeServices<Others>>;\n}",
      "export declare namespace Matcher {\n    type Any = Matcher<any, any, any> | Matcher<any, never, any> | Matcher<any, any, never> | Matcher<any, never, never>;\n    type Success<T> = [\n        T\n    ] extends [\n        Matcher<infer A, infer _E, infer _R>\n    ] ? A : never;\n    type Error<T> = [\n        T\n    ] extends [\n        Matcher<infer _A, infer E, infer _R>\n    ] ? E : never;\n    type Services<T> = [\n        T\n    ] extends [\n        Matcher<infer _A, infer _E, infer R>\n    ] ? R : never;\n    type MergeSuccess<Matchers extends ReadonlyArray<Matcher.Any>> = Success<Matchers[number]>;\n    type MergeError<Matchers extends ReadonlyArray<Matcher.Any>> = Error<Matchers[number]>;\n    type MergeServices<Matchers extends ReadonlyArray<Matcher.Any>> = Services<Matchers[number]>;\n}"
    ],
    "typeParameters": [
      "A",
      "E = never",
      "R = never",
      "Rt extends Route.Any",
      "B",
      "E2 = never",
      "R2 = never",
      "D extends ReadonlyArray<AnyDependency> | undefined = undefined",
      "LB = B",
      "LE2 = never",
      "LR2 = never",
      "C extends CatchHandler<any, any, any, any> | undefined = undefined",
      "const B",
      "G extends GuardInput<Route.Type<Rt>, any, any, any>"
    ],
    "summary": "Composes ordered route cases into an Fx that follows the current Navigation path.",
    "sections": {
      "Why": "A Matcher is both a declarative route table and `Fx<A, E, R>`. Route, guard, dependency, layout,\nand catch composition therefore stays in Effect's typed success, error, and service channels.",
      "Ownership and lifetime": "Building a Matcher is pure. Running it requires Router and Scope: it subscribes to CurrentPath,\nswitches selected handlers when the route changes, reuses the same handler for parameter-only\nupdates, and finalizes route/layout/layer scopes when selection changes or the consumer interrupts.\nMatching is case-insensitive and ignores trailing slashes. Distinct registered matcher paths use\nstructural precedence (literal, constrained parameter, parameter, then wildcard), not a global\nfirst-declared rule. Registration order matters among compiled entries that\nshare the same matcher path: their schemas and guards fall through in that order.",
      "Property: cases": "The immutable ordered Match AST compiled when this Matcher is run.",
      "Property: cases: Why": "Keeping cases visible preserves registration order for entries that compile to the same matcher\npath. Distinct matcher paths are still selected by structural path-shape precedence.",
      "Property: cases: Ownership and lifetime": "The array is retained by the Matcher value and acquires no runtime resources.",
      "Property: catch": "Handles the first typed failure in this Matcher's cause.",
      "Property: catch: Why": "It provides an ergonomic typed-error boundary while retaining non-failure causes unchanged.",
      "Property: catch: Ownership and lifetime": "The replacement Fx is owned by the selected route Scope; defects and interruption are rethrown.",
      "Property: catchCause": "Handles complete Effect causes from this Matcher with a reactive Cause RefSubject.",
      "Property: catchCause: Why": "Defects, interruption, and typed failures remain distinguishable instead of collapsing to one error value.",
      "Property: catchCause: Ownership and lifetime": "The catch Fx is mounted in the same selected route Scope and is interrupted when the route changes.",
      "Property: catchTag": "Handles selected tagged failures while retaining unmatched failures in the error channel.",
      "Property: catchTag: Why": "Tagged recovery narrows only the handled variants instead of erasing the entire error union.",
      "Property: catchTag: Ownership and lifetime": "The replacement Fx shares the selected route Scope. Unmatched tags rethrow the original cause.",
      "Property: layout": "Wraps the Matcher's selected content in a parameter-aware layout Fx.",
      "Property: layout: Why": "Layouts can compose output around nested content while observing the same reactive parameters.",
      "Property: layout: Ownership and lifetime": "Layouts are acquired inner-to-outer so each newly acquired outer layout receives the already-\nwrapped inner Fx as its content. The rendered nesting is therefore outer(inner(handler)). Stable\nlayout identities receive parameter/content updates without remounting and finalize with the\nselected route Scope.",
      "Method: match": "Appends one route case with an optional guard, dependencies, layout, and local error boundary.",
      "Method: match: Why": "Nine overload families accept direct values, Effect, Stream, Fx, parameter functions, guarded\nvariants, and options without erasing their errors or service requirements. After path lookup,\ncandidates registered under the same matcher path are decoded and guarded in declaration order:\nthe first decoded guard `Some` wins; decode failure, guard `None`, or guard failure falls through.\nDistinct path shapes are prioritized structurally, not solely by this call's position.",
      "Method: match: Ownership and lifetime": "Registration is pure and returns a new Matcher. When run, candidate layers are prepared before\nthe guard; rejected candidates roll them back. The selected handler, layout, and dependencies\nare owned by its route Scope and are interrupted on replacement.",
      "Property: merge": "Merge this matcher with one or more others. Combined matcher matches all routes; each matcher's layouts/provide apply only to its own routes.",
      "Property: merge: Why": "Independent route tables can be assembled without moving their local providers or layouts to a global boundary.",
      "Property: merge: Ownership and lifetime": "Merge is pure and concatenates cases: this Matcher's cases precede each supplied Matcher's cases.\nThat order governs decode/guard fallthrough only when entries share a matcher path; the path\nrouter chooses between distinct shapes according to its own specificity rules.",
      "Property: prefix": "Prefixes every case in this Matcher with another Route.",
      "Property: prefix: Why": "Nested applications can reuse a route table beneath a structural mount path.",
      "Property: prefix: Ownership and lifetime": "Composition is pure. Prefix services and schemas participate when the returned Matcher runs.",
      "Property: provide": "Provides one or more Effect Layers to this Matcher's cases.",
      "Property: provide: Why": "Route-local services remain explicit in the Matcher type instead of leaking into the whole app.",
      "Property: provide: Ownership and lifetime": "Layers are acquired only for candidate evaluation, committed for the selected route, shared via\nEffect's memo map where possible, and finalized when no selected case retains them.",
      "Property: provideContext": "Provides an existing Effect Context to this Matcher's cases.",
      "Property: provideContext: Why": "Multiple already-constructed services can satisfy route requirements without rebuilding Layers.",
      "Property: provideContext: Ownership and lifetime": "The Context is retained by the Matcher; resource lifetime remains owned by whoever constructed it.",
      "Property: provideService": "Provides one concrete Effect service to this Matcher's cases.",
      "Property: provideService: Why": "It is the concise constant-service form of `provideContext`.",
      "Property: provideService: Ownership and lifetime": "The supplied service is retained by the Matcher value; no acquisition or finalizer is added.",
      "Property: redirectTo": "Finishes route configuration with one redirect-and-retry on `RouteNotFound`.\n\nUse this terminal method after adding routes, providers, layouts, and recovery. It returns\nan Fx rather than another Matcher because the redirect wraps the running route selection.\nMatched-handler, decoding, and guard failures retain their error channels and do not redirect.\nConstruction starts no navigation; the consuming Scope owns execution and the single retry."
    },
    "examples": [
      {
        "language": "text",
        "code": "```ts\nimport * as Router from \"@typed/router\"\n\nconst app = Router.match(Router.Parse(\"/\"), \"home\")\n  .match(Router.Parse(\"/users/:id\"), (params) => params)\n```\n\nMatcher dependency and lifetime behavior follows Effect v4 Layer and Scope semantics:\nhttps://effect.website/docs/requirements-management/layers/ and\nhttps://effect.website/docs/resource-management/scope/."
      },
      {
        "language": "ts",
        "code": "import * as Router from \"@typed/router\"\nimport * as Effect from \"effect/Effect\"\n\nconst users = Router.match(Router.Parse(\"/users/:id\"), (params) =>\n  Effect.map(params, ({ id }) => `user:${id}`)\n)"
      },
      {
        "language": "text",
        "code": "Guarded candidate\n```ts\nimport * as Router from \"@typed/router\"\nimport type { Guard } from \"@typed/guard\"\nimport * as Effect from \"effect/Effect\"\n\ntype Params = { readonly id: string }\nconst accepted: Guard<Params, Params> = (params) => Effect.succeedSome(params)\nconst users = Router.match(Router.Parse(\"/users/:id\"), accepted, (params) => params)\n```"
      },
      {
        "language": "ts",
        "code": "import * as Router from \"@typed/router\"\n\nconst application = Router.match(Router.Slash, \"Queue\")\n  .match(Router.Parse(\"/issues/:issueId\"), \"Issue\")\n  .redirectTo(\"/\")"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 399,
          "column": 1
        },
        "end": {
          "line": 762,
          "column": 2
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 764,
          "column": 1
        },
        "end": {
          "line": 870,
          "column": 2
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 417,
          "column": 3
        },
        "end": {
          "line": 417,
          "column": 43
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 668,
          "column": 3
        },
        "end": {
          "line": 668,
          "column": 92
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 653,
          "column": 3
        },
        "end": {
          "line": 653,
          "column": 97
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 683,
          "column": 3
        },
        "end": {
          "line": 692,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 736,
          "column": 3
        },
        "end": {
          "line": 738,
          "column": 35
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 460,
          "column": 3
        },
        "end": {
          "line": 463,
          "column": 51
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 466,
          "column": 3
        },
        "end": {
          "line": 469,
          "column": 51
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 472,
          "column": 3
        },
        "end": {
          "line": 489,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 492,
          "column": 3
        },
        "end": {
          "line": 492,
          "column": 99
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 495,
          "column": 3
        },
        "end": {
          "line": 505,
          "column": 86
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 508,
          "column": 3
        },
        "end": {
          "line": 518,
          "column": 86
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 521,
          "column": 3
        },
        "end": {
          "line": 542,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 545,
          "column": 3
        },
        "end": {
          "line": 549,
          "column": 76
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 552,
          "column": 3
        },
        "end": {
          "line": 568,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 755,
          "column": 3
        },
        "end": {
          "line": 761,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 583,
          "column": 3
        },
        "end": {
          "line": 583,
          "column": 74
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 599,
          "column": 3
        },
        "end": {
          "line": 605,
          "column": 5
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 638,
          "column": 3
        },
        "end": {
          "line": 638,
          "column": 97
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 620,
          "column": 3
        },
        "end": {
          "line": 623,
          "column": 38
        }
      },
      {
        "file": "packages/router/src/Matcher.ts",
        "start": {
          "line": 714,
          "column": 3
        },
        "end": {
          "line": 718,
          "column": 5
        }
      }
    ],
    "since": "1.0.0",
    "category": "Matcher contracts"
  }
}
