@real-router/core 0.35.2 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,165 @@
1
+ import { DefaultDependencies, Router as Router$1, Route, Options, Params, State, PluginFactory, Unsubscribe, SubscribeFn, NavigationOptions } from '@real-router/types';
2
+
3
+ /**
4
+ * Router class with integrated namespace architecture.
5
+ *
6
+ * All functionality is provided by namespace classes:
7
+ * - OptionsNamespace: getOptions (immutable)
8
+ * - DependenciesStore: get/set/remove dependencies
9
+ * - EventEmitter: subscribe
10
+ * - StateNamespace: state storage (getState, setState, getPreviousState)
11
+ * - RoutesNamespace: route tree operations
12
+ * - RouteLifecycleNamespace: canActivate/canDeactivate guards
13
+ * - PluginsNamespace: plugin lifecycle
14
+ * - NavigationNamespace: navigate
15
+ * - RouterLifecycleNamespace: start, stop, isStarted
16
+ *
17
+ * @internal This class implementation is internal. Use createRouter() instead.
18
+ */
19
+ declare class Router<Dependencies extends DefaultDependencies = DefaultDependencies> implements Router$1<Dependencies> {
20
+ #private;
21
+ [key: string]: unknown;
22
+ /**
23
+ * @param routes - Route definitions
24
+ * @param options - Router options
25
+ * @param dependencies - DI dependencies
26
+ */
27
+ constructor(routes?: Route<Dependencies>[], options?: Partial<Options>, dependencies?: Dependencies);
28
+ isActiveRoute(name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean): boolean;
29
+ buildPath(route: string, params?: Params): string;
30
+ getState<P extends Params = Params, MP extends Params = Params>(): State<P, MP> | undefined;
31
+ getPreviousState(): State | undefined;
32
+ areStatesEqual(state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean): boolean;
33
+ shouldUpdateNode(nodeName: string): (toState: State, fromState?: State) => boolean;
34
+ isActive(): boolean;
35
+ start(startPath: string): Promise<State>;
36
+ stop(): this;
37
+ dispose(): void;
38
+ canNavigateTo(name: string, params?: Params): boolean;
39
+ usePlugin(...plugins: PluginFactory<Dependencies>[]): Unsubscribe;
40
+ subscribe(listener: SubscribeFn): Unsubscribe;
41
+ navigate(routeName: string, routeParams?: Params, options?: NavigationOptions): Promise<State>;
42
+ navigateToDefault(options?: NavigationOptions): Promise<State>;
43
+ navigateToNotFound(path?: string): State;
44
+ }
45
+
46
+ /**
47
+ * Path Matcher Type Definitions.
48
+ *
49
+ * Core types for path matching and parameter extraction.
50
+ *
51
+ * @module path-matcher/types
52
+ */
53
+ /**
54
+ * Constraint pattern for a URL parameter.
55
+ */
56
+ interface ConstraintPattern {
57
+ /**
58
+ * Compiled RegExp for validating the parameter value.
59
+ *
60
+ * @example /^(\d+)$/ for constraint "<\\d+>"
61
+ */
62
+ readonly pattern: RegExp;
63
+ /**
64
+ * Raw constraint string from the route pattern.
65
+ *
66
+ * @example "<\\d+>"
67
+ */
68
+ readonly constraint: string;
69
+ }
70
+ /**
71
+ * Parameter metadata extracted from a route path pattern.
72
+ */
73
+ interface ParamMeta {
74
+ /**
75
+ * URL parameter names extracted from the path pattern.
76
+ *
77
+ * @example [":id", ":postId"] from "/users/:id/posts/:postId"
78
+ */
79
+ readonly urlParams: readonly string[];
80
+ /**
81
+ * Query parameter names extracted from the path pattern.
82
+ *
83
+ * @example ["q", "page"] from "/search?q&page"
84
+ */
85
+ readonly queryParams: readonly string[];
86
+ /**
87
+ * Splat parameter names extracted from the path pattern.
88
+ *
89
+ * @example ["path"] from "/files/*path"
90
+ */
91
+ readonly spatParams: readonly string[];
92
+ /**
93
+ * Map of parameter names to their type (url or query).
94
+ *
95
+ * @example { id: "url", q: "query" }
96
+ */
97
+ readonly paramTypeMap: Readonly<Record<string, "url" | "query">>;
98
+ /**
99
+ * Map of parameter names to their constraint patterns.
100
+ *
101
+ * Only includes parameters with explicit constraints (e.g., `:id<\\d+>`).
102
+ * Parameters without constraints are not included in this map.
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * buildParamMeta("/users/:id<\\d+>").constraintPatterns.get("id")
107
+ * // → { pattern: /^(\d+)$/, constraint: "<\\d+>" }
108
+ *
109
+ * buildParamMeta("/users/:id").constraintPatterns.size
110
+ * // → 0 (no constraints)
111
+ * ```
112
+ */
113
+ readonly constraintPatterns: ReadonlyMap<string, ConstraintPattern>;
114
+ /**
115
+ * Path pattern without query string, pre-computed for buildPath.
116
+ *
117
+ * @example "/users/:id" from "/users/:id?q&page"
118
+ */
119
+ readonly pathPattern: string;
120
+ }
121
+
122
+ /**
123
+ * Immutable route tree node.
124
+ *
125
+ * This is the core data structure of the new route-tree architecture.
126
+ * It contains only data (no methods) and is created by the builder.
127
+ *
128
+ * All caches are pre-computed at build time:
129
+ * - nonAbsoluteChildren: filtered children without absolute paths
130
+ * - absoluteDescendants: all descendants with absolute paths (recursive)
131
+ * - parentSegments: array from root to parent
132
+ * - fullName: pre-computed "users.profile" instead of runtime join
133
+ */
134
+ interface RouteTree {
135
+ /** Route segment name (e.g., "users" in "users.profile") */
136
+ readonly name: string;
137
+ /** Route path pattern (e.g., "/users/:id") */
138
+ readonly path: string;
139
+ /** Whether this route uses absolute path matching (path starts with "~") */
140
+ readonly absolute: boolean;
141
+ /** Child route nodes (Map for O(1) lookup by name) */
142
+ readonly children: ReadonlyMap<string, RouteTree>;
143
+ /** Parameter metadata extracted from path pattern (replaces parser dependency) */
144
+ readonly paramMeta: ParamMeta;
145
+ /** Parent node (null for root) */
146
+ readonly parent: RouteTree | null;
147
+ /** Children without absolute paths (for regular matching) */
148
+ readonly nonAbsoluteChildren: readonly RouteTree[];
149
+ /** Pre-computed full name (e.g., "users.profile") */
150
+ readonly fullName: string;
151
+ /**
152
+ * Pre-computed static path for routes without parameters.
153
+ * Used by buildPath fast path to avoid inject() overhead.
154
+ * Only set when route has no URL params, query params, or splat params.
155
+ */
156
+ readonly staticPath: string | null;
157
+ /**
158
+ * Pre-computed parameter type map for this segment.
159
+ * Cached to avoid recomputing on every navigation.
160
+ * Maps param name → "url" | "query".
161
+ */
162
+ readonly paramTypeMap: Readonly<Record<string, "url" | "query">>;
163
+ }
164
+
165
+ export { Router as R, type RouteTree as a };
@@ -1,5 +1,7 @@
1
- import { Params, RouteTreeState, DefaultDependencies, Router as Router$1, Route, Options, State, PluginFactory, Unsubscribe, SubscribeFn, NavigationOptions, ErrorCodeKeys, ErrorCodeValues, ErrorCodeToValueMap, EventToNameMap, Navigator, PluginApi as PluginApi$1, RoutesApi, DependenciesApi, LifecycleApi } from '@real-router/types';
2
- export { Config, DefaultDependencies, DependenciesApi, GuardFn, GuardFnFactory, LifecycleApi, Listener, NavigationOptions, Navigator, Options, Params, Plugin, PluginFactory, Route, RouteConfigUpdate, RoutesApi, SimpleState, State, StateMeta, SubscribeFn, SubscribeState, Subscription, Unsubscribe } from '@real-router/types';
1
+ import { Params, RouteTreeState, ErrorCodeKeys, ErrorCodeValues, ErrorCodeToValueMap, EventToNameMap, State, DefaultDependencies, Route, Options, Router as Router$1, Navigator } from '@real-router/types';
2
+ export { Config, DefaultDependencies, GuardFn, GuardFnFactory, Listener, NavigationOptions, Navigator, Options, Params, Plugin, PluginFactory, Route, RouteConfigUpdate, SimpleState, State, StateMeta, SubscribeFn, SubscribeState, Subscription, Unsubscribe } from '@real-router/types';
3
+ import { R as Router } from './index.d-DDimDpYc.mjs';
4
+ export { a as RouteTree } from './index.d-DDimDpYc.mjs';
3
5
 
4
6
  /**
5
7
  * Core-internal types + re-exports from @real-router/types.
@@ -21,49 +23,6 @@ interface BuildStateResultWithSegments<P extends Params = Params> {
21
23
  readonly segments: readonly unknown[];
22
24
  }
23
25
 
24
- /**
25
- * Router class with integrated namespace architecture.
26
- *
27
- * All functionality is provided by namespace classes:
28
- * - OptionsNamespace: getOptions (immutable)
29
- * - DependenciesStore: get/set/remove dependencies
30
- * - EventEmitter: subscribe
31
- * - StateNamespace: state storage (getState, setState, getPreviousState)
32
- * - RoutesNamespace: route tree operations
33
- * - RouteLifecycleNamespace: canActivate/canDeactivate guards
34
- * - PluginsNamespace: plugin lifecycle
35
- * - NavigationNamespace: navigate
36
- * - RouterLifecycleNamespace: start, stop, isStarted
37
- *
38
- * @internal This class implementation is internal. Use createRouter() instead.
39
- */
40
- declare class Router<Dependencies extends DefaultDependencies = DefaultDependencies> implements Router$1<Dependencies> {
41
- #private;
42
- [key: string]: unknown;
43
- /**
44
- * @param routes - Route definitions
45
- * @param options - Router options
46
- * @param dependencies - DI dependencies
47
- */
48
- constructor(routes?: Route<Dependencies>[], options?: Partial<Options>, dependencies?: Dependencies);
49
- isActiveRoute(name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean): boolean;
50
- buildPath(route: string, params?: Params): string;
51
- getState<P extends Params = Params, MP extends Params = Params>(): State<P, MP> | undefined;
52
- getPreviousState(): State | undefined;
53
- areStatesEqual(state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean): boolean;
54
- shouldUpdateNode(nodeName: string): (toState: State, fromState?: State) => boolean;
55
- isActive(): boolean;
56
- start(startPath: string): Promise<State>;
57
- stop(): this;
58
- dispose(): void;
59
- canNavigateTo(name: string, params?: Params): boolean;
60
- usePlugin(...plugins: PluginFactory<Dependencies>[]): Unsubscribe;
61
- subscribe(listener: SubscribeFn): Unsubscribe;
62
- navigate(routeName: string, routeParams?: Params, options?: NavigationOptions): Promise<State>;
63
- navigateToDefault(options?: NavigationOptions): Promise<State>;
64
- navigateToNotFound(path?: string): State;
65
- }
66
-
67
26
  type ConstantsKeys = "UNKNOWN_ROUTE";
68
27
  type Constants = Record<ConstantsKeys, string>;
69
28
  type ErrorCodes = Record<ErrorCodeKeys, ErrorCodeValues>;
@@ -292,137 +251,4 @@ declare const createRouter: <Dependencies extends DefaultDependencies = DefaultD
292
251
 
293
252
  declare const getNavigator: <Dependencies extends DefaultDependencies = DefaultDependencies>(router: Router$1<Dependencies>) => Navigator;
294
253
 
295
- /**
296
- * Path Matcher Type Definitions.
297
- *
298
- * Core types for path matching and parameter extraction.
299
- *
300
- * @module path-matcher/types
301
- */
302
- /**
303
- * Constraint pattern for a URL parameter.
304
- */
305
- interface ConstraintPattern {
306
- /**
307
- * Compiled RegExp for validating the parameter value.
308
- *
309
- * @example /^(\d+)$/ for constraint "<\\d+>"
310
- */
311
- readonly pattern: RegExp;
312
- /**
313
- * Raw constraint string from the route pattern.
314
- *
315
- * @example "<\\d+>"
316
- */
317
- readonly constraint: string;
318
- }
319
- /**
320
- * Parameter metadata extracted from a route path pattern.
321
- */
322
- interface ParamMeta {
323
- /**
324
- * URL parameter names extracted from the path pattern.
325
- *
326
- * @example [":id", ":postId"] from "/users/:id/posts/:postId"
327
- */
328
- readonly urlParams: readonly string[];
329
- /**
330
- * Query parameter names extracted from the path pattern.
331
- *
332
- * @example ["q", "page"] from "/search?q&page"
333
- */
334
- readonly queryParams: readonly string[];
335
- /**
336
- * Splat parameter names extracted from the path pattern.
337
- *
338
- * @example ["path"] from "/files/*path"
339
- */
340
- readonly spatParams: readonly string[];
341
- /**
342
- * Map of parameter names to their type (url or query).
343
- *
344
- * @example { id: "url", q: "query" }
345
- */
346
- readonly paramTypeMap: Readonly<Record<string, "url" | "query">>;
347
- /**
348
- * Map of parameter names to their constraint patterns.
349
- *
350
- * Only includes parameters with explicit constraints (e.g., `:id<\\d+>`).
351
- * Parameters without constraints are not included in this map.
352
- *
353
- * @example
354
- * ```typescript
355
- * buildParamMeta("/users/:id<\\d+>").constraintPatterns.get("id")
356
- * // → { pattern: /^(\d+)$/, constraint: "<\\d+>" }
357
- *
358
- * buildParamMeta("/users/:id").constraintPatterns.size
359
- * // → 0 (no constraints)
360
- * ```
361
- */
362
- readonly constraintPatterns: ReadonlyMap<string, ConstraintPattern>;
363
- /**
364
- * Path pattern without query string, pre-computed for buildPath.
365
- *
366
- * @example "/users/:id" from "/users/:id?q&page"
367
- */
368
- readonly pathPattern: string;
369
- }
370
-
371
- /**
372
- * Immutable route tree node.
373
- *
374
- * This is the core data structure of the new route-tree architecture.
375
- * It contains only data (no methods) and is created by the builder.
376
- *
377
- * All caches are pre-computed at build time:
378
- * - nonAbsoluteChildren: filtered children without absolute paths
379
- * - absoluteDescendants: all descendants with absolute paths (recursive)
380
- * - parentSegments: array from root to parent
381
- * - fullName: pre-computed "users.profile" instead of runtime join
382
- */
383
- interface RouteTree {
384
- /** Route segment name (e.g., "users" in "users.profile") */
385
- readonly name: string;
386
- /** Route path pattern (e.g., "/users/:id") */
387
- readonly path: string;
388
- /** Whether this route uses absolute path matching (path starts with "~") */
389
- readonly absolute: boolean;
390
- /** Child route nodes (Map for O(1) lookup by name) */
391
- readonly children: ReadonlyMap<string, RouteTree>;
392
- /** Parameter metadata extracted from path pattern (replaces parser dependency) */
393
- readonly paramMeta: ParamMeta;
394
- /** Parent node (null for root) */
395
- readonly parent: RouteTree | null;
396
- /** Children without absolute paths (for regular matching) */
397
- readonly nonAbsoluteChildren: readonly RouteTree[];
398
- /** Pre-computed full name (e.g., "users.profile") */
399
- readonly fullName: string;
400
- /**
401
- * Pre-computed static path for routes without parameters.
402
- * Used by buildPath fast path to avoid inject() overhead.
403
- * Only set when route has no URL params, query params, or splat params.
404
- */
405
- readonly staticPath: string | null;
406
- /**
407
- * Pre-computed parameter type map for this segment.
408
- * Cached to avoid recomputing on every navigation.
409
- * Maps param name → "url" | "query".
410
- */
411
- readonly paramTypeMap: Readonly<Record<string, "url" | "query">>;
412
- }
413
-
414
- interface PluginApi extends Omit<PluginApi$1, "getTree"> {
415
- getTree: () => RouteTree;
416
- }
417
-
418
- declare function getPluginApi<Dependencies extends DefaultDependencies = DefaultDependencies>(router: Router$1<Dependencies>): PluginApi;
419
-
420
- declare function getRoutesApi<Dependencies extends DefaultDependencies = DefaultDependencies>(router: Router$1<Dependencies>): RoutesApi<Dependencies>;
421
-
422
- declare function getDependenciesApi<Dependencies extends DefaultDependencies = DefaultDependencies>(router: Router$1<Dependencies>): DependenciesApi<Dependencies>;
423
-
424
- declare function getLifecycleApi<Dependencies extends DefaultDependencies = DefaultDependencies>(router: Router$1<Dependencies>): LifecycleApi<Dependencies>;
425
-
426
- declare function cloneRouter<Dependencies extends DefaultDependencies = DefaultDependencies>(router: Router$1<Dependencies>, dependencies?: Dependencies): Router<Dependencies>;
427
-
428
- export { type BuildStateResultWithSegments, type Constants, type ErrorCodes, type PluginApi, type RouteTree, Router, RouterError, UNKNOWN_ROUTE, cloneRouter, constants, createRouter, errorCodes, events, getDependenciesApi, getLifecycleApi, getNavigator, getPluginApi, getRoutesApi };
254
+ export { type BuildStateResultWithSegments, type Constants, type ErrorCodes, Router, RouterError, UNKNOWN_ROUTE, constants, createRouter, errorCodes, events, getNavigator };
@@ -1 +1 @@
1
- import{logger as e}from"@real-router/logger";import{FSM as t}from"@real-router/fsm";var r={maxListeners:0,warnListeners:0,maxEventDepth:0},n=class extends Error{},o=class{#e=new Map;#t=null;#r=r;#n;#o;constructor(e){e?.limits&&(this.#r=e.limits),this.#n=e?.onListenerError??null,this.#o=e?.onListenerWarn??null}static validateCallback(e,t){if("function"!=typeof e)throw new TypeError(`Expected callback to be a function for event ${t}`)}setLimits(e){this.#r=e}on(e,t){const r=this.#i(e);if(r.has(t))throw new Error(`Duplicate listener for "${e}"`);const{maxListeners:n,warnListeners:o}=this.#r;if(0!==o&&r.size===o&&this.#o?.(e,o),0!==n&&r.size>=n)throw new Error(`Listener limit (${n}) reached for "${e}"`);return r.add(t),()=>{this.off(e,t)}}off(e,t){this.#e.get(e)?.delete(t)}emit(e,...t){const r=this.#e.get(e);r&&0!==r.size&&(0!==this.#r.maxEventDepth?this.#a(r,e,t):this.#s(r,e,t))}clearAll(){this.#e.clear(),this.#t=null}listenerCount(e){return this.#e.get(e)?.size??0}#s(e,t,r){const n=[...e];for(const e of n)try{this.#c(e,r)}catch(e){this.#n?.(t,e)}}#c(e,t){switch(t.length){case 0:e();break;case 1:e(t[0]);break;case 2:e(t[0],t[1]);break;case 3:e(t[0],t[1],t[2]);break;default:Function.prototype.apply.call(e,void 0,t)}}#a(e,t,r){this.#t??=new Map;const o=this.#t,i=o.get(t)??0;if(i>=this.#r.maxEventDepth)throw new n(`Maximum recursion depth (${this.#r.maxEventDepth}) exceeded for event: ${t}`);try{o.set(t,i+1);const a=[...e];for(const e of a)try{this.#c(e,r)}catch(e){if(e instanceof n)throw e;this.#n?.(t,e)}}finally{o.set(t,o.get(t)-1)}}#i(e){const t=this.#e.get(e);if(t)return t;const r=new Set;return this.#e.set(e,r),r}},i=["replace","reload","force","forceDeactivate","redirected"],a=/\S/,s=/^[A-Z_a-z][\w-]*(?:\.[A-Z_a-z][\w-]*)*$/;function c(e,t){return new TypeError(`[router.${e}] ${t}`)}function u(e,t=new WeakSet){if(null==e)return!0;const r=typeof e;if("string"===r||"boolean"===r)return!0;if("number"===r)return Number.isFinite(e);if("function"===r||"symbol"===r)return!1;if(Array.isArray(e))return!t.has(e)&&(t.add(e),e.every(e=>u(e,t)));if("object"===r){if(t.has(e))return!1;t.add(e);const r=Object.getPrototypeOf(e);return(null===r||r===Object.prototype)&&Object.values(e).every(e=>u(e,t))}return!1}function d(e){if(null==e)return!0;const t=typeof e;return"string"===t||"boolean"===t||"number"===t&&Number.isFinite(e)}function l(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);if(null!==t&&t!==Object.prototype)return!1;let r=!1;for(const t in e){if(!Object.hasOwn(e,t))continue;const n=e[t];if(!d(n)){const e=typeof n;if("function"===e||"symbol"===e)return!1;r=!0;break}}return!r||u(e)}function f(e){return"string"==typeof e}function h(e){return"boolean"==typeof e}function p(e,t){return e in t}function m(e,t){if("string"!=typeof e)throw c(t,"Route name must be a string, got "+typeof e);if(""!==e){if(!a.test(e))throw c(t,"Route name cannot contain only whitespace");if(e.length>1e4)throw c(t,"Route name exceeds maximum length of 10000 characters. This is a technical safety limit.");if(!e.startsWith("@@")&&!s.test(e))throw c(t,`Invalid route name "${e}". Each segment must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens. Segments are separated by dots (e.g., "users.profile").`)}}function g(e){return null===e?"null":Array.isArray(e)?`array[${e.length}]`:"object"==typeof e?"constructor"in e&&"Object"!==e.constructor.name?e.constructor.name:"object":typeof e}function v(e,t){if(!function(e){return"object"==typeof e&&null!==e&&function(e){return function(e){return"string"==typeof e&&(""===e||!(e.length>1e4)&&(!!e.startsWith("@@")||s.test(e)))}(e.name)&&"string"==typeof e.path&&l(e.params)}(e)}(e))throw new TypeError(`[${t}] Invalid state structure: ${g(e)}. Expected State object with name, params, and path properties.`)}var w=Object.freeze({ROUTER_NOT_STARTED:"NOT_STARTED",NO_START_PATH_OR_STATE:"NO_START_PATH_OR_STATE",ROUTER_ALREADY_STARTED:"ALREADY_STARTED",ROUTE_NOT_FOUND:"ROUTE_NOT_FOUND",SAME_STATES:"SAME_STATES",CANNOT_DEACTIVATE:"CANNOT_DEACTIVATE",CANNOT_ACTIVATE:"CANNOT_ACTIVATE",TRANSITION_ERR:"TRANSITION_ERR",TRANSITION_CANCELLED:"CANCELLED",ROUTER_DISPOSED:"DISPOSED",PLUGIN_CONFLICT:"PLUGIN_CONFLICT"}),y="@@router/UNKNOWN_ROUTE",b={UNKNOWN_ROUTE:y},S="onStart",T="onStop",E="onTransitionStart",O="onTransitionCancel",P="onTransitionSuccess",A="onTransitionError",R={ROUTER_START:"$start",ROUTER_STOP:"$stop",TRANSITION_START:"$$start",TRANSITION_CANCEL:"$$cancel",TRANSITION_SUCCESS:"$$success",TRANSITION_ERROR:"$$error"},$=new Set([R.ROUTER_START,R.TRANSITION_START,R.TRANSITION_SUCCESS,R.TRANSITION_ERROR,R.TRANSITION_CANCEL,R.ROUTER_STOP]),N={maxDependencies:100,maxPlugins:50,maxListeners:1e4,warnListeners:1e3,maxEventDepth:5,maxLifecycleHandlers:200},D={maxDependencies:{min:0,max:1e4},maxPlugins:{min:0,max:1e3},maxListeners:{min:0,max:1e5},warnListeners:{min:0,max:1e5},maxEventDepth:{min:0,max:100},maxLifecycleHandlers:{min:0,max:1e4}},C="IDLE",j="STARTING",F="READY",x="TRANSITIONING",I="DISPOSED",L="START",M="STARTED",_="NAVIGATE",k="COMPLETE",U="FAIL",B="CANCEL",G="STOP",V="DISPOSE",z={initial:C,context:null,transitions:{[C]:{[L]:j,[V]:I},[j]:{[M]:F,[U]:C},[F]:{[_]:x,[U]:F,[G]:C},[x]:{[_]:x,[k]:F,[B]:F,[U]:F},[I]:{}}},W=new WeakSet;function q(e){if(null!==e&&"object"==typeof e&&!Object.isFrozen(e))if(Object.freeze(e),Array.isArray(e))for(const t of e)q(t);else for(const t in e)q(e[t])}function Q(e){return e?(W.has(e)||(q(e),W.add(e)),e):e}function H(e){return{warn:Math.floor(.2*e),error:Math.floor(.5*e)}}var K=new WeakMap;function J(e){const t=K.get(e);if(!t)throw new TypeError("[real-router] Invalid router instance — not found in internals registry");return t}function Y(e,t,r){return(...n)=>{const o=r.get(e);return o&&0!==o.length?function(e,t,r){let n=t;for(const t of e){const e=n;n=(...r)=>t(e,...r)}return n(...r)}(o,t,n):t(...n)}}var Z={defaultRoute:"",defaultParams:{},trailingSlash:"preserve",queryParamsMode:"loose",queryParams:{arrayFormat:"none",booleanFormat:"none",nullFormat:"default"},urlParamsEncoding:"default",allowNotFound:!0,rewritePathOnMatch:!0,noValidate:!1},X={trailingSlash:["strict","never","always","preserve"],queryParamsMode:["default","strict","loose"],urlParamsEncoding:["default","uri","uriComponent","none"]},ee={arrayFormat:["none","brackets","index","comma"],booleanFormat:["none","string","empty-true"],nullFormat:["default","hidden"]};function te(e){Object.freeze(e);for(const t of Object.keys(e)){const r=e[t];r&&"object"==typeof r&&r.constructor===Object&&te(r)}return e}function re(e,t){return"function"==typeof e?e(t):e}function ne(e,t,r){if("function"==typeof t&&("defaultRoute"===e||"defaultParams"===e))return;const n=Z[e];if(n&&"object"==typeof n)return function(e,t,r){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[router.${r}] Invalid type for "${t}": expected plain object, got ${g(e)}`);for(const n in e)if(Object.getOwnPropertyDescriptor(e,n)?.get)throw new TypeError(`[router.${r}] Getters not allowed in "${t}": "${n}"`)}(t,e,r),void("queryParams"===e&&function(e,t){for(const r in e){if(!p(r,ee)){const e=Object.keys(ee).map(e=>`"${e}"`).join(", ");throw new TypeError(`[router.${t}] Unknown queryParams key: "${r}". Valid keys: ${e}`)}const n=e[r],o=ee[r];if(!o.includes(n)){const e=o.map(e=>`"${e}"`).join(", ");throw new TypeError(`[router.${t}] Invalid value for queryParams.${r}: expected one of ${e}, got "${String(n)}"`)}}}(t,r));if(typeof t!=typeof n)throw new TypeError(`[router.${r}] Invalid type for "${e}": expected ${typeof n}, got ${typeof t}`);e in X&&function(e,t,r){const n=X[e];if(!n.includes(t)){const o=n.map(e=>`"${e}"`).join(", ");throw new TypeError(`[router.${r}] Invalid value for "${e}": expected one of ${o}, got "${String(t)}"`)}}(e,t,r)}function oe(e,t,r){if("limits"===e)return void 0!==t&&function(e,t){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[router.${t}]: invalid limits: expected plain object, got ${typeof e}`);for(const[r,n]of Object.entries(e)){if(!Object.hasOwn(D,r))throw new TypeError(`[router.${t}]: unknown limit: "${r}"`);void 0!==n&&ie(r,n,t)}}(t,r),!0;throw new TypeError(`[router.${r}] Unknown option: "${e}"`)}function ie(e,t,r){if("number"!=typeof t||!Number.isInteger(t))throw new TypeError(`[router.${r}]: limit "${e}" must be an integer, got ${String(t)}`);const n=D[e];if(t<n.min||t>n.max)throw new RangeError(`[router.${r}]: limit "${e}" must be between ${n.min} and ${n.max}, got ${t}`)}var ae=class{#u;constructor(e={}){this.#u=te({...Z,...e})}static validateOptions(e,t){!function(e,t){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[router.${t}] Invalid options: expected plain object, got ${g(e)}`);for(const[r,n]of Object.entries(e))p(r,Z)?void 0!==n&&ne(r,n,t):oe(r,n,t)}(e,t)}get(){return this.#u}};function se(e,t){return e===t||!(!Array.isArray(e)||!Array.isArray(t))&&e.length===t.length&&e.every((e,r)=>se(e,t[r]))}var ce=class{#d=0;#l=void 0;#f=void 0;#h;#p=new Map;static validateAreStatesEqualArgs(e,t,r){if(null!=e&&v(e,"areStatesEqual"),null!=t&&v(t,"areStatesEqual"),void 0!==r&&"boolean"!=typeof r)throw new TypeError(`[router.areStatesEqual] Invalid ignoreQueryParams: ${g(r)}. Expected boolean.`)}get(){return this.#l}set(e){this.#f=this.#l,this.#l=e?Q(e):void 0}getPrevious(){return this.#f}reset(){this.#l=void 0,this.#f=void 0,this.#p.clear(),this.#d=0}setDependencies(e){this.#h=e}makeState(e,t,r,n,o){const i=n?{...n,id:o??++this.#d,params:n.params}:void 0,a=this.#h.getDefaultParams();let s;return s=Object.hasOwn(a,e)?{...a[e],...t}:t?{...t}:{},Q({name:e,params:s,path:r??this.#h.buildPath(e,t),meta:i})}areStatesEqual(e,t,r=!0){if(!e||!t)return!!e==!!t;if(e.name!==t.name)return!1;if(r){const r=e.meta?.params??t.meta?.params;return(r?function(e){const t=[];for(const r in e){const n=e[r];for(const e in n)"url"===n[e]&&t.push(e)}return t}(r):this.#m(e.name)).every(r=>se(e.params[r],t.params[r]))}const n=Object.keys(e.params),o=Object.keys(t.params);return n.length===o.length&&n.every(r=>r in t.params&&se(e.params[r],t.params[r]))}#m(e){const t=this.#p.get(e);if(void 0!==t)return t;const r=this.#h.getUrlParams(e);return this.#p.set(e,r),r}},ue={[S]:R.ROUTER_START,[T]:R.ROUTER_STOP,[P]:R.TRANSITION_SUCCESS,[E]:R.TRANSITION_START,[A]:R.TRANSITION_ERROR,[O]:R.TRANSITION_CANCEL},de=Object.keys(ue).filter(e=>p(e,ue)),le="router.usePlugin",fe=class t{#g=new Set;#v=new Set;#h;#w=N;static validateUsePluginArgs(e){!function(e){for(const[t,r]of e.entries())if("function"!=typeof r)throw new TypeError(`[router.usePlugin] Expected plugin factory function at index ${t}, got ${g(r)}`)}(e)}static validatePlugin(e){!function(e){if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`[router.usePlugin] Plugin factory must return an object, got ${g(e)}`);if("function"==typeof e.then)throw new TypeError("[router.usePlugin] Async plugin factories are not supported. Factory returned a Promise instead of a plugin object.");for(const t in e)if("teardown"!==t&&!p(t,ue))throw new TypeError(`[router.usePlugin] Unknown property '${t}'. Plugin must only contain event handlers and optional teardown.`)}(e)}static validatePluginLimit(e,t,r){!function(e,t,r=N.maxPlugins){if(0!==r&&e+t>r)throw new Error(`[router.usePlugin] Plugin limit exceeded (${r}). Current: ${e}, Attempting to add: ${t}. This indicates an architectural problem. Consider consolidating plugins.`)}(e,t,r)}static validateNoDuplicatePlugins(e,t){for(const r of e)if(t(r))throw new Error("[router.usePlugin] Plugin factory already registered. To re-register, first unsubscribe the existing plugin.")}setDependencies(e){this.#h=e}setLimits(e){this.#w=e}count(){return this.#g.size}use(...t){if(this.#y(t.length),1===t.length){const r=t[0],n=this.#b(r);this.#g.add(r);let o=!1;const i=()=>{if(!o){o=!0,this.#g.delete(r),this.#v.delete(i);try{n()}catch(t){e.error(le,"Error during cleanup:",t)}}};return this.#v.add(i),i}const r=this.#S(t),n=[];try{for(const e of r){const t=this.#b(e);n.push({factory:e,cleanup:t})}}catch(t){for(const{cleanup:t}of n)try{t()}catch(t){e.error(le,"Cleanup error:",t)}throw t}for(const{factory:e}of n)this.#g.add(e);let o=!1;const i=()=>{if(!o){o=!0,this.#v.delete(i);for(const{factory:e}of n)this.#g.delete(e);for(const{cleanup:t}of n)try{t()}catch(t){e.error(le,"Error during cleanup:",t)}}};return this.#v.add(i),i}getAll(){return[...this.#g]}has(e){return this.#g.has(e)}disposeAll(){for(const e of this.#v)e();this.#g.clear(),this.#v.clear()}#y(t){const r=this.#w.maxPlugins;if(0===r)return;const n=t+this.#g.size,{warn:o,error:i}=H(r);n>=i?e.error(le,`${n} plugins registered! This is excessive and will impact performance. Hard limit at ${r}.`):n>=o&&e.warn(le,`${n} plugins registered. Consider if all are necessary.`)}#S(t){const r=new Set;for(const n of t)r.has(n)?e.warn(le,"Duplicate factory in batch, will be registered once"):r.add(n);return r}#b(r){const n=this.#h.compileFactory(r);t.validatePlugin(n),Object.freeze(n);const o=[];for(const t of de)t in n&&("function"==typeof n[t]?(o.push(this.#h.addEventListener(ue[t],n[t])),"onStart"===t&&this.#h.canNavigate()&&e.warn(le,"Router already started, onStart will not be called")):e.warn(le,`Property '${t}' is not a function, skipping`));return()=>{for(const e of o)e();"function"==typeof n.teardown&&n.teardown()}}};function he(e,t){if(!h(e)&&"function"!=typeof e)throw new TypeError(`[router.${t}] Handler must be a boolean or factory function, got ${g(e)}`)}function pe(e,t,r){if(e)throw new Error(`[router.${r}] Cannot modify route "${t}" during its own registration`)}function me(e,t,r=N.maxLifecycleHandlers){if(0!==r&&e>=r)throw new Error(`[router.${t}] Lifecycle handler limit exceeded (${r}). This indicates too many routes with individual handlers. Consider using plugins for cross-cutting concerns.`)}var ge=class{#T=new Map;#E=new Map;#O=new Map;#P=new Map;#A=new Set;#R=new Set;#$=new Set;#h;#w=N;setDependencies(e){this.#h=e}setLimits(e){this.#w=e}addCanActivate(e,t,r,n=!1){n?this.#R.add(e):this.#R.delete(e),r||pe(this.#A.has(e),e,"addActivateGuard");const o=this.#E.has(e);o||r||me(this.#E.size+1,"addActivateGuard",this.#w.maxLifecycleHandlers),this.#N("activate",e,t,this.#E,this.#P,"canActivate",o)}addCanDeactivate(e,t,r,n=!1){n?this.#$.add(e):this.#$.delete(e),r||pe(this.#A.has(e),e,"addDeactivateGuard");const o=this.#T.has(e);o||r||me(this.#T.size+1,"addDeactivateGuard",this.#w.maxLifecycleHandlers),this.#N("deactivate",e,t,this.#T,this.#O,"canDeactivate",o)}clearCanActivate(e){this.#E.delete(e),this.#P.delete(e),this.#R.delete(e)}clearCanDeactivate(e){this.#T.delete(e),this.#O.delete(e),this.#$.delete(e)}clearAll(){this.#E.clear(),this.#P.clear(),this.#T.clear(),this.#O.clear(),this.#R.clear(),this.#$.clear()}clearDefinitionGuards(){for(const e of this.#R)this.#E.delete(e),this.#P.delete(e);for(const e of this.#$)this.#T.delete(e),this.#O.delete(e);this.#R.clear(),this.#$.clear()}getFactories(){const e={},t={};for(const[t,r]of this.#T)e[t]=r;for(const[e,r]of this.#E)t[e]=r;return[e,t]}getFunctions(){return[this.#O,this.#P]}canNavigateTo(e,t,r,n){for(const t of e)if(!this.#D(this.#O,t,r,n,"canNavigateTo"))return!1;for(const e of t)if(!this.#D(this.#P,e,r,n,"canNavigateTo"))return!1;return!0}#N(t,r,n,o,i,a,s){s?e.warn(`router.${a}`,`Overwriting existing ${t} handler for route "${r}"`):this.#y(o.size+1,a);const c=h(n)?function(e){const t=()=>e;return()=>t}(n):n;o.set(r,c),this.#A.add(r);try{const e=this.#h.compileFactory(c);if("function"!=typeof e)throw new TypeError(`[router.${a}] Factory must return a function, got ${g(e)}`);i.set(r,e)}catch(e){throw o.delete(r),e}finally{this.#A.delete(r)}}#D(t,r,n,o,i){const a=t.get(r);if(!a)return!0;try{const t=a(n,o);return"boolean"==typeof t?t:(e.warn(`router.${i}`,`Guard for "${r}" returned a Promise. Sync check cannot resolve async guards — returning false.`),!1)}catch{return!1}}#y(t,r){const n=this.#w.maxLifecycleHandlers;if(0===n)return;const{warn:o,error:i}=H(n);t>=i?e.error(`router.${r}`,`${t} lifecycle handlers registered! This is excessive. Hard limit at ${n}.`):t>=o&&e.warn(`router.${r}`,`${t} lifecycle handlers registered. Consider consolidating logic.`)}},ve=new Set;function we(){return{decoders:Object.create(null),encoders:Object.create(null),defaultParams:Object.create(null),forwardMap:Object.create(null),forwardFnMap:Object.create(null)}}function ye(e){const t={name:e.name,path:e.path};return e.children&&(t.children=e.children.map(e=>ye(e))),t}function be(e,t,r=""){for(let n=0;n<e.length;n++){const o=e[n],i=r?`${r}.${o.name}`:o.name;if(i===t)return e.splice(n,1),!0;if(o.children&&t.startsWith(`${i}.`)&&be(o.children,t,i))return!0}return!1}function Se(e,t){for(const r of Object.keys(e))t(r)&&delete e[r]}function Te(e){return`(${e.replaceAll(/(^<|>$)/g,"")})`}var Ee=/([:*])([^/?<]+)(<[^>]+>)?(\?)?/g,Oe=/([:*][^/?<]+(?:<[^>]+>)?)\?(?=\/|$)/g,Pe=/\?(.+)$/,Ae=/[^\w!$'()*+,.:;|~-]/gu,Re=/[^\w!$'()*+,.:;|~-]/u,$e={default:e=>Re.test(e)?e.replaceAll(Ae,e=>encodeURIComponent(e)):e,uri:encodeURI,uriComponent:encodeURIComponent,none:e=>e},Ne={default:decodeURIComponent,uri:decodeURI,uriComponent:decodeURIComponent,none:e=>e};function De(){return{staticChildren:Object.create(null),paramChild:void 0,splatChild:void 0,route:void 0,slashChildRoute:void 0}}function Ce(e){return e.length>1&&e.endsWith("/")?e.slice(0,-1):e}function je(e){const t={};if(0===e.length)return t;const r=e.split("&");for(const e of r){const r=e.indexOf("=");-1===r?t[e]="":t[e.slice(0,r)]=e.slice(r+1)}return t}function Fe(e){const t=[];for(const r of Object.keys(e)){const n=e[r],o=encodeURIComponent(r);t.push(""===n?o:`${o}=${encodeURIComponent(String(n))}`)}return t.join("&")}function xe(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ie(e){let t=0;for(;t<e.length;)if("%"===e[t]){if(t+2>=e.length)return!1;const r=e.codePointAt(t+1)??0,n=e.codePointAt(t+2)??0;if(!xe(r)||!xe(n))return!1;t+=3}else t++;return!0}var Le=/<[^>]*>/g;function Me(e,t,r,n,o){const i=""===t.fullName;i||n.push(t);const a=t.absolute,s=t.paramMeta.pathPattern,c=a&&s.startsWith("~")?s.slice(1):s,u=(a?c:s).replaceAll(Le,""),d=a?u:(f=u,""===(l=r)?f:""===f?l:l+f);var l,f;let h=o;i||(h=function(e,t,r,n,o,i){const a=(g=n,Ce(r)===Ce(g)),s=Object.freeze([...o]),c=function(e){const t={};for(const r of e)t[r.fullName]=r.paramTypeMap;return Object.freeze(t)}(s),u=Ce(r),d=function(e,t){const r=[];e.length>0&&r.push(...e);for(const e of t)e.paramMeta.queryParams.length>0&&r.push(...e.paramMeta.queryParams);return r}(e.rootQueryParams,o),l=function(e){const t=new Map;for(const r of e)for(const[e,n]of r.paramMeta.constraintPatterns)t.set(e,n);return t}(o),f=a?Ce(n):u,{buildStaticParts:h,buildParamSlots:p}=function(e,t,r){const n=new Set,o=new Set;for(const e of t){for(const t of e.paramMeta.urlParams)n.add(t);for(const t of e.paramMeta.spatParams)o.add(t)}if(0===n.size)return{buildStaticParts:[e],buildParamSlots:[]};const i=[],a=[],s=/[:*]([\w]+)(?:<[^>]*>)?(\?)?/gu;let c,u=0;for(;null!==(c=s.exec(e));){const t=c[1],n="?"===c[2];i.push(e.slice(u,c.index));const s=o.has(t);a.push({paramName:t,isOptional:n,encoder:s?e=>{const t=$e[r],n=e.split("/");let o=t(n[0]);for(let e=1;e<n.length;e++)o+=`/${t(n[e])}`;return o}:$e[r]}),u=c.index+c[0].length}return i.push(e.slice(u)),{buildStaticParts:i,buildParamSlots:a}}(f,a?o.slice(0,-1):o,e.options.urlParamsEncoding),m={name:t.fullName,parent:i,depth:o.length-1,matchSegments:s,meta:c,declaredQueryParams:d,declaredQueryParamsSet:new Set(d),hasTrailingSlash:r.length>1&&r.endsWith("/"),constraintPatterns:l,hasConstraints:l.size>0,buildStaticParts:h,buildParamSlots:p,buildParamNamesSet:new Set(p.map(e=>e.paramName))};var g;return e.routesByName.set(t.fullName,m),e.segmentsByName.set(t.fullName,s),e.metaByName.set(t.fullName,c),a?function(e,t,r){var n,o;n=t,(function(e,t,r){const n=Ce(r);if("/"===n||""===n)return t;let o=t,i=1;const a=n.length;for(;i<=a;){const t=n.indexOf("/",i),r=-1===t?a:t;if(r<=i)break;o=ke(e,o,n.slice(i,r)),i=r+1}return o}(o=e,o.root,r)).slashChildRoute=n;const i=Ce(r),a=e.options.caseSensitive?i:i.toLowerCase();e.staticCache.has(a)&&e.staticCache.set(a,t)}(e,m,n):function(e,t,r,n,o){if(function(e,t,r){const n=Ce(r);"/"!==n?_e(e,e.root,n,1,t):e.root.route=t}(e,t,r),0===o.paramMeta.urlParams.length){const r=e.options.caseSensitive?n:n.toLowerCase();e.staticCache.set(r,t)}}(e,m,r,u,t),m}(e,t,d,a?"":r,n,o));for(const r of t.children.values())Me(e,r,d,n,h);i||n.pop()}function _e(e,t,r,n,o){const i=r.length;for(;n<=i;){const a=r.indexOf("/",n),s=-1===a?i:a,c=r.slice(n,s);if(c.endsWith("?")){const n=c.slice(1).replaceAll(Le,"").replace(/\?$/,"");return t.paramChild??={node:De(),name:n},_e(e,t.paramChild.node,r,s+1,o),void(s>=i?t.route??=o:_e(e,t,r,s+1,o))}t=ke(e,t,c),n=s+1}t.route=o}function ke(e,t,r){if(r.startsWith("*")){const e=r.slice(1);return t.splatChild??={node:De(),name:e},t.splatChild.node}if(r.startsWith(":")){const e=r.slice(1).replaceAll(Le,"").replace(/\?$/,"");return t.paramChild??={node:De(),name:e},t.paramChild.node}const n=e.options.caseSensitive?r:r.toLowerCase();return n in t.staticChildren||(t.staticChildren[n]=De()),t.staticChildren[n]}var Ue=/[\u0080-\uFFFF]/,Be=class{get options(){return this.#e}#e;#t=De();#o=new Map;#i=new Map;#r=new Map;#a=new Map;#n="";#C=[];constructor(e){this.#e={caseSensitive:e?.caseSensitive??!0,strictTrailingSlash:e?.strictTrailingSlash??!1,strictQueryParams:e?.strictQueryParams??!1,urlParamsEncoding:e?.urlParamsEncoding??"default",parseQueryString:e?.parseQueryString??je,buildQueryString:e?.buildQueryString??Fe}}registerTree(e){this.#C=e.paramMeta.queryParams,Me({root:this.#t,options:this.#e,routesByName:this.#o,segmentsByName:this.#i,metaByName:this.#r,staticCache:this.#a,rootQueryParams:this.#C},e,"",[],null)}match(e){const t=this.#s(e);if(!t)return;const[r,n,o]=t,i=this.#e.caseSensitive?n:n.toLowerCase(),a=this.#a.get(i);if(a){if(this.#e.strictTrailingSlash&&!this.#c(r,a))return;return this.#j(a,{},o)}const s={},c=this.#F(n,s);return!c||this.#e.strictTrailingSlash&&!this.#c(r,c)||c.hasConstraints&&!this.#x(s,c)||!this.#I(s)?void 0:this.#j(c,s,o)}buildPath(e,t,r){const n=this.#o.get(e);if(!n)throw new Error(`[SegmentMatcher.buildPath] '${e}' is not defined`);n.hasConstraints&&t&&this.#L(n,e,t);const o=this.#M(n,t),i=this.#_(o,r?.trailingSlash),a=this.#k(n,t,r?.queryParamsMode);return i+(a?`?${a}`:"")}getSegmentsByName(e){return this.#i.get(e)}getMetaByName(e){return this.#r.get(e)}hasRoute(e){return this.#o.has(e)}setRootPath(e){this.#n=e}#L(e,t,r){for(const[n,o]of e.constraintPatterns){const e=r[n];if(null!=e){const r="object"==typeof e?JSON.stringify(e):String(e);if(!o.pattern.test(r))throw new Error(`[SegmentMatcher.buildPath] '${t}' — param '${n}' value '${r}' does not match constraint '${o.constraint}'`)}}}#M(e,t){const r=e.buildStaticParts,n=e.buildParamSlots;if(0===n.length)return this.#n+r[0];let o=this.#n+r[0];for(const[e,i]of n.entries()){const n=t?.[i.paramName];if(null==n){if(!i.isOptional)throw new Error(`[SegmentMatcher.buildPath] Missing required param '${i.paramName}'`);o.length>1&&o.endsWith("/")&&(o=o.slice(0,-1)),o+=r[e+1];continue}const a="object"==typeof n?JSON.stringify(n):String(n);o+=i.encoder(a)+r[e+1]}return o}#_(e,t){return"always"!==t||e.endsWith("/")?"never"===t&&"/"!==e&&e.endsWith("/")?e.slice(0,-1):e:`${e}/`}#k(e,t,r){if(!t)return"";const n={};let o=!1;for(const r of e.declaredQueryParams)r in t&&(n[r]=t[r],o=!0);if("loose"===r)for(const r in t)!Object.hasOwn(t,r)||e.declaredQueryParamsSet.has(r)||e.buildParamNamesSet.has(r)||(n[r]=t[r],o=!0);return o?this.#e.buildQueryString(n):""}#s(e){if(""===e&&(e="/"),!e.startsWith("/"))return;const t=e.indexOf("#");if(-1!==t&&(e=e.slice(0,t)),Ue.test(e))return;if(this.#n.length>0){if(!e.startsWith(this.#n))return;e=e.slice(this.#n.length)||"/"}const r=e.indexOf("?"),n=-1===r?e:e.slice(0,r),o=-1===r?void 0:e.slice(r+1);return n.includes("//")?void 0:[n,Ce(n),o]}#j(e,t,r){if(void 0!==r){const n=this.#e.parseQueryString(r);if(this.#e.strictQueryParams){const t=e.declaredQueryParamsSet;for(const e of Object.keys(n))if(!t.has(e))return}for(const e of Object.keys(n))t[e]=n[e]}return{segments:e.matchSegments,params:t,meta:e.meta}}#c(e,t){return(e.length>1&&e.endsWith("/"))===t.hasTrailingSlash}#F(e,t){return 1===e.length?this.#t.slashChildRoute??this.#t.route:this.#U(this.#t,e,1,t)}#U(e,t,r,n){let o=e;const i=t.length;for(;r<=i;){const e=t.indexOf("/",r),a=-1===e?i:e,s=t.slice(r,a),c=this.#e.caseSensitive?s:s.toLowerCase();let u;if(c in o.staticChildren)u=o.staticChildren[c];else{if(!o.paramChild){if(o.splatChild){const e={},i=this.#U(o.splatChild.node,t,r,e);return i?(Object.assign(n,e),i):(n[o.splatChild.name]=t.slice(r),o.splatChild.node.route)}return}u=o.paramChild.node,n[o.paramChild.name]=s}o=u,r=a+1}return o.slashChildRoute??o.route}#I(e){const t=this.#e.urlParamsEncoding;if("none"===t)return!0;const r=Ne[t];for(const t in e){const n=e[t];if(n.includes("%")){if(!Ie(n))return!1;e[t]=r(n)}}return!0}#x(e,t){for(const[r,n]of t.constraintPatterns)if(!n.pattern.test(e[r]))return!1;return!0}},Ge=e=>{const t=e.indexOf("%"),r=e.indexOf("+");if(-1===t&&-1===r)return e;const n=-1===r?e:e.split("+").join(" ");return-1===t?n:decodeURIComponent(n)},Ve=e=>{const t=typeof e;if("string"!==t&&"number"!==t&&"boolean"!==t)throw new TypeError(`[search-params] Array element must be a string, number, or boolean — received ${"object"===t&&null===e?"null":t}`);return encodeURIComponent(e)},ze={none:{encodeArray:(e,t)=>t.map(t=>`${e}=${Ve(t)}`).join("&")},brackets:{encodeArray:(e,t)=>t.map(t=>`${e}[]=${Ve(t)}`).join("&")},index:{encodeArray:(e,t)=>t.map((t,r)=>`${e}[${r}]=${Ve(t)}`).join("&")},comma:{encodeArray:(e,t)=>`${e}=${t.map(e=>Ve(e)).join(",")}`}},We={none:{encode:(e,t)=>`${e}=${t}`,decodeUndefined:()=>null,decodeRaw:()=>null,decodeValue:e=>e},string:{encode:(e,t)=>`${e}=${t}`,decodeUndefined:()=>null,decodeRaw:e=>"true"===e||"false"!==e&&null,decodeValue:e=>e},"empty-true":{encode:(e,t)=>t?e:`${e}=false`,decodeUndefined:()=>!0,decodeRaw:()=>null,decodeValue:e=>e}},qe={default:{encode:e=>e},hidden:{encode:()=>""}},Qe=(e,t,r)=>({boolean:We[t],null:qe[r],array:ze[e]}),He={arrayFormat:"none",booleanFormat:"none",nullFormat:"default",strategies:{boolean:We.none,null:qe.default,array:ze.none}},Ke=e=>{if(!e||void 0===e.arrayFormat&&void 0===e.booleanFormat&&void 0===e.nullFormat)return He;const t=e.arrayFormat??"none",r=e.booleanFormat??"none",n=e.nullFormat??"default";return{arrayFormat:t,booleanFormat:r,nullFormat:n,strategies:Qe(t,r,n)}},Je=e=>encodeURIComponent(e),Ye=(e,t,r)=>{const n=Je(e);switch(typeof t){case"string":case"number":default:return`${n}=${Je(t)}`;case"boolean":return r.strategies.boolean.encode(n,t);case"object":return null===t?r.strategies.null.encode(n):Array.isArray(t)?r.strategies.array.encodeArray(n,t):`${n}=${Je(t)}`}};function Ze(e,t,r,n,o){const i=e.indexOf("=",t),a=-1!==i&&i<r,s=e.slice(t,a?i:r),{name:c,hasBrackets:u}=function(e){const t=e.indexOf("[");return-1===t?{name:e,hasBrackets:!1}:{name:e.slice(0,t),hasBrackets:!0}}(s);var d,l,f,h,p;!function(e,t,r,n){const o=e[t];void 0===o?e[t]=n?[r]:r:Array.isArray(o)?o.push(r):e[t]=[o,r]}(n,Ge(c),(d=e,l=i,f=r,h=a,p=o,p?((e,t)=>{if(void 0===e)return t.boolean.decodeUndefined();const r=t.boolean.decodeRaw(e);if(null!==r)return r;const n=Ge(e);return t.boolean.decodeValue(n)})(h?d.slice(l+1,f):void 0,p):h?Ge(d.slice(l+1,f)):null),u)}function Xe(e,t){const r=e.path,n=r.startsWith("~"),o=n?r.slice(1):r,i={name:e.name,path:o,absolute:n,children:[],parent:t,nonAbsoluteChildren:[],fullName:""};if(e.children)for(const t of e.children){const e=Xe(t,i);i.children.push(e)}return i}function et(e,t){return e.endsWith("/")&&t.startsWith("/")?e+t.slice(1):e+t}function tt(e){const t=new Map;for(const r of e)t.set(r.name,r);return t}function rt(e,t,r){const n=function(e){const t=[],r=[],n=[],o={},i=new Map,a=e.replaceAll(Oe,"$1"),s=Pe.exec(a);if(null!==s){const t=s[1].split("&");for(const e of t){const t=e.trim();t.length>0&&(r.push(t),o[t]="query")}e=e.slice(0,s.index)}let c;for(;null!==(c=Ee.exec(e));){const e=c[2],r=c[3];if("*"===c[1])n.push(e),t.push(e),o[e]="url";else if(t.push(e),o[e]="url",r){const t=`^${Te(r)}$`;i.set(e,{pattern:new RegExp(t),constraint:r})}}return{urlParams:t,queryParams:r,spatParams:n,paramTypeMap:o,constraintPatterns:i,pathPattern:e}}(e.path),o=function(e){const t={};for(const r of e.urlParams)t[r]="url";for(const r of e.queryParams)t[r]="query";return t}(n),i={name:e.name,path:e.path,absolute:e.absolute,parent:t,children:void 0,paramMeta:n,nonAbsoluteChildren:void 0,fullName:"",staticPath:null,paramTypeMap:o};var a;i.fullName=(a=i,a.parent?.name?`${a.parent.fullName}.${a.name}`:a.name);const{childrenMap:s,nonAbsoluteChildren:c}=function(e,t,r){const n=[],o=[];for(const i of e){const e=rt(i,t,r);n.push(e),e.absolute||o.push(e)}return{childrenMap:tt(n),nonAbsoluteChildren:o}}(e.children,i,r);return i.children=s,i.nonAbsoluteChildren=c,i.staticPath=function(e){if(!e.path)return null;const{urlParams:t,queryParams:r,spatParams:n}=e.paramMeta;if(t.length>0||r.length>0||n.length>0)return null;const o=[];let i=e.parent;for(;i?.path;)o.unshift(i),i=i.parent;let a="";for(const e of o){const{urlParams:t,queryParams:r,spatParams:n}=e.paramMeta;if(t.length>0||r.length>0||n.length>0)return null;a=e.absolute?e.path:et(a,e.path)}return e.absolute?e.path:et(a,e.path)}(i),r&&(Object.freeze(c),Object.freeze(o),Object.freeze(i.children),Object.freeze(i)),i}function nt(e,t,r,n){return function(e,t){const r=[];return{add(e){return r.push(e),this},addMany(e){return r.push(...e),this},build:n=>function(e,t=!0){return rt(e,null,t)}(function(e,t,r){const n=Xe({name:e,path:t},null);for(const e of r){const t=Xe(e,n);n.children.push(t)}return n}(e,t,r),!n?.skipFreeze)}}(e,t).addMany(r).build(n)}function ot(e){const t={name:e.name,path:e.absolute?`~${e.path}`:e.path};return e.children.size>0&&(t.children=[...e.children.values()].map(e=>ot(e))),t}function it(e){const t=e?.queryParams;return new Be({...void 0===e?.caseSensitive?void 0:{caseSensitive:e.caseSensitive},...void 0===e?.strictTrailingSlash?void 0:{strictTrailingSlash:e.strictTrailingSlash},...void 0===e?.strictQueryParams?void 0:{strictQueryParams:e.strictQueryParams},...void 0===e?.urlParamsEncoding?void 0:{urlParamsEncoding:e.urlParamsEncoding},parseQueryString:e=>((e,t)=>{const r=(e=>{const t=e.indexOf("?");return-1===t?e:e.slice(t+1)})(e);if(""===r||"?"===r)return{};if(!t)return function(e){const t={};return function(e,t){let r=0;const n=e.length;for(;r<n;){let o=e.indexOf("&",r);-1===o&&(o=n),Ze(e,r,o,t),r=o+1}}(e,t),t}(r);const n=Ke(t),o={};let i=0;const a=r.length;for(;i<a;){let e=r.indexOf("&",i);-1===e&&(e=a),Ze(r,i,e,o,n.strategies),i=e+1}return o})(e,t),buildQueryString:e=>((e,t)=>{const r=Object.keys(e);if(0===r.length)return"";const n=Ke(t),o=[];for(const t of r){const r=e[t];if(void 0===r)continue;const i=Ye(t,r,n);i&&o.push(i)}return o.join("&")})(e,t)})}function at(e,t){return new TypeError(`[router.${e}] ${t}`)}var st=/^[A-Z_a-z][\w-]*$/,ct=/\S/;function ut(e){return null===e?"null":"object"==typeof e?"constructor"in e&&"Object"!==e.constructor.name?e.constructor.name:"object":typeof e}function dt(e,t){if(!t.includes("."))return e.children.get(t);let r=e;for(const e of t.split("."))if(r=r.children.get(e),!r)return;return r}function lt(e,t,r,n="",o,i){!function(e,t){if(!e||"object"!=typeof e)throw new TypeError(`[router.${t}] Route must be an object, got ${ut(e)}`);const r=Object.getPrototypeOf(e);if(r!==Object.prototype&&null!==r)throw new TypeError(`[router.${t}] Route must be a plain object, got ${ut(e)}`);if(function(e){for(const t of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,t);if(r&&(r.get||r.set))return!0}return!1}(e))throw new TypeError(`[router.${t}] Route must not have getters or setters`)}(e,t);const a=e;!function(e,t){if("string"!=typeof e.name)throw new TypeError(`[router.${t}] Route name must be a string, got ${ut(e.name)}`);const r=e.name;if(""===r)throw new TypeError(`[router.${t}] Route name cannot be empty`);if(!ct.test(r))throw new TypeError(`[router.${t}] Route name cannot contain only whitespace`);if(r.length>1e4)throw new TypeError(`[router.${t}] Route name exceeds maximum length of 10000 characters`);if(!r.startsWith("@@")){if(r.includes("."))throw new TypeError(`[router.${t}] Route name "${r}" cannot contain dots. Use children array or { parent } option in addRoute() instead.`);if(!st.test(r))throw new TypeError(`[router.${t}] Invalid route name "${r}". Name must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens.`)}}(a,t),function(e,t,r,n){if("string"!=typeof e){let t;throw t=null===e?"null":Array.isArray(e)?"array":typeof e,at(r,`Route path must be a string, got ${t}`)}if(""===e)return;if(/\s/.test(e))throw at(r,`Invalid path for route "${t}": whitespace not allowed in "${e}"`);if(!/^([/?~]|[^/]+$)/.test(e))throw at(r,`Route "${t}" has invalid path format: "${e}". Path should start with '/', '~', '?' or be a relative segment.`);if(e.includes("//"))throw at(r,`Invalid path for route "${t}": double slashes not allowed in "${e}"`);const o=n&&Object.values(n.paramTypeMap).includes("url");if(e.startsWith("~")&&o)throw at(r,`Absolute path "${e}" cannot be used under parent route with URL parameters`)}(a.path,a.name,t,r),function(e,t){if(void 0!==e.encodeParams&&"function"!=typeof e.encodeParams)throw new TypeError(`[router.${t}] Route "${String(e.name)}" encodeParams must be a function`)}(a,t),function(e,t){if(void 0!==e.decodeParams&&"function"!=typeof e.decodeParams)throw new TypeError(`[router.${t}] Route "${String(e.name)}" decodeParams must be a function`)}(a,t);const s=a.name,c=n?`${n}.${s}`:s;r&&c&&function(e,t,r){if(dt(e,t))throw new Error(`[router.${r}] Route "${t}" already exists`)}(r,c,t),o&&function(e,t,r){if(e.has(t))throw new Error(`[router.${r}] Duplicate route "${t}" in batch`);e.add(t)}(o,c,t);const u=a.path,d=n;if(r&&function(e,t,r,n){const o=""===t?e:dt(e,t);if(o)for(const e of o.children.values())if(e.path===r)throw new Error(`[router.${n}] Path "${r}" is already defined`)}(r,d,u,t),i&&function(e,t,r,n){const o=e.get(t);if(o?.has(r))throw new Error(`[router.${n}] Path "${r}" is already defined`);o?o.add(r):e.set(t,new Set([r]))}(i,d,u,t),void 0!==a.children){if(!Array.isArray(a.children))throw new TypeError(`[router.${t}] Route "${s}" children must be an array, got ${ut(a.children)}`);for(const e of a.children)lt(e,t,r,c,o,i)}}function ft(e,t){if(void 0!==e.canActivate&&"function"!=typeof e.canActivate)throw new TypeError(`[router.addRoute] canActivate must be a function for route "${t}", got ${g(e.canActivate)}`);if(void 0!==e.canDeactivate&&"function"!=typeof e.canDeactivate)throw new TypeError(`[router.addRoute] canDeactivate must be a function for route "${t}", got ${g(e.canDeactivate)}`);if(void 0!==e.defaultParams){const r=e.defaultParams;if(null===r||"object"!=typeof r||Array.isArray(r))throw new TypeError(`[router.addRoute] defaultParams must be an object for route "${t}", got ${g(e.defaultParams)}`)}if("AsyncFunction"===e.decodeParams?.constructor.name)throw new TypeError(`[router.addRoute] decodeParams cannot be async for route "${t}". Async functions break matchPath/buildPath.`);if("AsyncFunction"===e.encodeParams?.constructor.name)throw new TypeError(`[router.addRoute] encodeParams cannot be async for route "${t}". Async functions break matchPath/buildPath.`);if(function(e,t){if(void 0!==e&&"function"==typeof e){const r="AsyncFunction"===e.constructor.name,n=e.toString().includes("__awaiter");if(r||n)throw new TypeError(`[router.addRoute] forwardTo callback cannot be async for route "${t}". Async functions break matchPath/buildPath.`)}}(e.forwardTo,t),e.children)for(const r of e.children)ft(r,`${t}.${r.name}`)}function ht(e){const t=new Set,r=/[*:]([A-Z_a-z]\w*)/g;let n;for(;null!==(n=r.exec(e));)t.add(n[1]);return t}function pt(e){const t=new Set;for(const r of e)for(const e of ht(r))t.add(e);return t}function mt(e,t,r="",n=[]){for(const o of e){const e=r?`${r}.${o.name}`:o.name,i=[...n,o.path];if(e===t)return i;if(o.children&&t.startsWith(`${e}.`))return mt(o.children,t,e,i)}throw new Error(`[internal] collectPathsToRoute: route "${t}" not found`)}function gt(e,t=""){const r=new Set;for(const n of e){const e=t?`${t}.${n.name}`:n.name;if(r.add(e),n.children)for(const t of gt(n.children,e))r.add(t)}return r}function vt(e,t=""){const r=new Map;for(const n of e){const e=t?`${t}.${n.name}`:n.name;if(n.forwardTo&&"string"==typeof n.forwardTo&&r.set(e,n.forwardTo),n.children)for(const[t,o]of vt(n.children,e))r.set(t,o)}return r}function wt(e,t,r,n){return t?function(e){const t=new Set;for(const r of e){for(const e of r.paramMeta.urlParams)t.add(e);for(const e of r.paramMeta.spatParams)t.add(e)}return t}(function(e,t){const r=[],n=t.includes(".")?t.split("."):[t];""!==e.path&&r.push(e);let o=e;for(const e of n){const t=o.children.get(e);if(!t)return null;r.push(t),o=t}return r}(r,e)):pt(mt(n,e))}function yt(e,t,r,n,o){const i=function(e,t){const r=t.split(".");let n=e;for(const e of r)if(n=n.children.get(e),!n)return!1;return!0}(o,t),a=n.has(t);if(!i&&!a)throw new Error(`[router.addRoute] forwardTo target "${t}" does not exist for route "${e}"`);const s=pt(mt(r,e)),c=[...wt(t,i,o,r)].filter(e=>!s.has(e));if(c.length>0)throw new Error(`[router.addRoute] forwardTo target "${t}" requires params [${c.join(", ")}] that are not available in source route "${e}"`)}function bt(e,t,r=100){const n=new Set,o=[e];let i=e;for(;t[i];){const e=t[i];if(n.has(e)){const t=o.indexOf(e),r=[...o.slice(t),e];throw new Error(`Circular forwardTo: ${r.join(" → ")}`)}if(n.add(i),o.push(e),i=e,o.length>r)throw new Error(`forwardTo chain exceeds maximum depth (${r}): ${o.join(" → ")}`)}return i}function St(e,t,r){const n=gt(e),o=vt(e),i={...t};for(const[e,t]of o)i[e]=t;for(const[t,i]of o)yt(t,i,e,n,r);for(const e of Object.keys(i))bt(e,i)}function Tt(e,t){if(e.startsWith("@@"))throw new Error(`[router.${t}] Route name "${e}" uses the reserved "@@" prefix. Routes with this prefix are internal and cannot be modified through the public API.`)}function Et(e,t){for(const r of e)r&&"object"==typeof r&&"string"==typeof r.name&&(Tt(r.name,t),r.children&&Et(r.children,t))}function Ot(e){for(const t of e){if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`[router.addRoute] Route must be an object, got ${g(t)}`);ft(t,t.name)}}function Pt(e,t,r){if(!f(e))throw new TypeError(`[router.${r}] Invalid routeName: ${g(e)}. Expected string.`);if(!l(t))throw new TypeError(`[router.${r}] Invalid routeParams: ${g(t)}. Expected plain object.`)}function At(e,t){if("AsyncFunction"===e.constructor.name||e.toString().includes("__awaiter"))throw new TypeError(`[real-router] updateRoute: ${t} cannot be an async function`)}function Rt(e,t){if(null!=e){if("function"!=typeof e)throw new TypeError(`[real-router] updateRoute: ${t} must be a function or null, got ${typeof e}`);At(e,t)}}function $t(e,t,r,n){if(n&&t){let e=t;for(const t of n.split("."))if(e=e.children.get(t),!e)throw new Error(`[router.addRoute] Parent route "${n}" does not exist`)}const o=new Set,i=new Map;for(const r of e)lt(r,"addRoute",t,n??"",o,i);t&&r&&St(e,r,t)}function Nt(t){return!t||(e.error("router.clearRoutes","Cannot clear routes while navigation is in progress. Wait for navigation to complete."),!1)}function Dt(e,t,r,n,o){if(!r(e))throw new ReferenceError(`[real-router] updateRoute: route "${e}" does not exist`);if(null!=t&&"string"==typeof t){if(!r(t))throw new Error(`[real-router] updateRoute: forwardTo target "${t}" does not exist`);(function(e,t,r){const n=r.getSegmentsByName(e),o=r.getSegmentsByName(t),i=function(e){const t=new Set;for(const r of e)for(const e of r.paramMeta.urlParams)t.add(e);return t}(n),a=[];for(const e of o)for(const t of e.paramMeta.urlParams)a.push(t);const s=a.filter(e=>!i.has(e));if(s.length>0)throw new Error(`[real-router] forwardTo target "${t}" requires params [${s.join(", ")}] that are not available in source route "${e}"`)})(e,t,n),function(e,t,r){bt(e,{...r.forwardMap,[e]:t})}(e,t,o)}}function Ct(e,t,r){const n=nt("",t,e),o=it(r);return o.registerTree(n),{tree:n,matcher:o}}function jt(e,t){const r=Ct(e.definitions,e.rootPath,e.matcherOptions);e.tree=r.tree,e.matcher=r.matcher,e.resolvedForwardMap=Lt(e.config,t)}function Ft(e){const t=Ct(e.definitions,e.rootPath,e.matcherOptions);e.tree=t.tree,e.matcher=t.matcher}function xt(e){It(e),Ft(e)}function It(e){e.definitions.length=0,Object.assign(e.config,we()),e.resolvedForwardMap=Object.create(null),e.routeCustomFields=Object.create(null)}function Lt(e,t){return t?_t(e):Mt(e)}function Mt(e){const t=Object.create(null);for(const r of Object.keys(e.forwardMap))t[r]=bt(r,e.forwardMap);return t}function _t(e){const t=Object.create(null);for(const r of Object.keys(e.forwardMap)){let n=r;for(;e.forwardMap[n];)n=e.forwardMap[n];t[r]=n}return t}function kt(t,r,n,o,i,a,s){const c=new Set(["name","path","children","canActivate","canDeactivate","forwardTo","encodeParams","decodeParams","defaultParams"]),u=Object.fromEntries(Object.entries(t).filter(([e])=>!c.has(e)));Object.keys(u).length>0&&(o[r]=u),t.canActivate&&(s?s.addActivateGuard(r,t.canActivate):i.set(r,t.canActivate)),t.canDeactivate&&(s?s.addDeactivateGuard(r,t.canDeactivate):a.set(r,t.canDeactivate)),t.forwardTo&&function(t,r,n){if(t.canActivate&&e.warn("real-router",`Route "${r}" has both forwardTo and canActivate. canActivate will be ignored because forwardTo creates a redirect (industry standard). Move canActivate to the target route "${"string"==typeof t.forwardTo?t.forwardTo:"[dynamic]"}".`),t.canDeactivate&&e.warn("real-router",`Route "${r}" has both forwardTo and canDeactivate. canDeactivate will be ignored because forwardTo creates a redirect (industry standard). Move canDeactivate to the target route "${"string"==typeof t.forwardTo?t.forwardTo:"[dynamic]"}".`),"function"==typeof t.forwardTo){const e="AsyncFunction"===t.forwardTo.constructor.name,n=t.forwardTo.toString().includes("__awaiter");if(e||n)throw new TypeError(`forwardTo callback cannot be async for route "${r}". Async functions break matchPath/buildPath.`)}"string"==typeof t.forwardTo?n.forwardMap[r]=t.forwardTo:n.forwardFnMap[r]=t.forwardTo}(t,r,n),t.decodeParams&&(n.decoders[r]=e=>t.decodeParams?.(e)??e),t.encodeParams&&(n.encoders[r]=e=>t.encodeParams?.(e)??e),t.defaultParams&&(n.defaultParams[r]=t.defaultParams)}function Ut(e,t,r,n,o,i,a=""){for(const s of e){const e=a?`${a}.${s.name}`:s.name;kt(s,e,t,r,n,o,i),s.children&&Ut(s.children,t,r,n,o,i,e)}}var Bt,Gt,Vt=".";function zt(e){const t=[];for(let r=e.length-1;r>=0;r--)t.push(e[r]);return t}function Wt(e){const t=typeof e;return"string"===t||"number"===t||"boolean"===t}function qt(e,t,r){const n=t.meta?.params[e];if(!n||"object"!=typeof n)return!0;for(const e of Object.keys(n)){const n=t.params[e],o=r.params[e];if(Wt(n)&&Wt(o)&&String(n)!==String(o))return!1}return!0}function Qt(e){if(!e)return[""];const t=e.indexOf(Vt);if(-1===t)return[e];const r=e.indexOf(Vt,t+1);if(-1===r)return[e.slice(0,t),e];const n=e.indexOf(Vt,r+1);return-1===n?[e.slice(0,t),e.slice(0,r),e]:-1===e.indexOf(Vt,n+1)?[e.slice(0,t),e.slice(0,r),e.slice(0,n),e]:function(e){const t=e.split(Vt),r=t.length,n=[t[0]];let o=t[0].length;for(let i=1;i<r-1;i++)o+=1+t[i].length,n.push(e.slice(0,o));return n.push(e),n}(e)}var Ht=null;function Kt(e,t){if(!t)return{intersection:"",toActivate:Qt(e.name),toDeactivate:[]};if(void 0===e.meta?.params&&void 0===t.meta?.params)return{intersection:"",toActivate:Qt(e.name),toDeactivate:zt(Qt(t.name))};const r=Qt(e.name),n=Qt(t.name),o=function(e,t,r,n,o){for(let i=0;i<o;i++){const o=r[i];if(o!==n[i])return i;if(!qt(o,e,t))return i}return o}(e,t,r,n,Math.min(n.length,r.length)),i=[];for(let e=n.length-1;e>=o;e--)i.push(n[e]);const a=r.slice(o);return{intersection:o>0?n[o-1]:"",toDeactivate:i,toActivate:a}}function Jt(e,t,r){if(r?.reload)return Kt(e,t);if(null!==Ht&&e===Bt&&t===Gt)return Ht;const n=Kt(e,t);return Bt=e,Gt=t,Ht=n,n}function Yt(e,t){var r;return{name:t??(r=e.segments,r.at(-1)?.fullName??""),params:e.params,meta:e.meta}}var Zt=class{#B;get#h(){return this.#B.depsStore}constructor(e=[],t=!1,r){this.#B=function(e,t,r){const n=[],o=we(),i=Object.create(null),a=new Map,s=new Map;for(const t of e)n.push(ye(t));const{tree:c,matcher:u}=Ct(n,"",r);return Ut(e,o,i,a,s,void 0,""),{definitions:n,config:o,tree:c,matcher:u,resolvedForwardMap:t?_t(o):Mt(o),routeCustomFields:i,rootPath:"",matcherOptions:r,depsStore:void 0,lifecycleNamespace:void 0,pendingCanActivate:a,pendingCanDeactivate:s,treeOperations:{commitTreeChanges:jt,resetStore:xt,nodeToDefinition:ot,validateRoutes:$t}}}(e,t,r)}static shouldUpdateNode(e){return(t,r)=>{if(!t||"object"!=typeof t||!("name"in t))throw new TypeError("[router.shouldUpdateNode] toState must be valid State object");if(t.transition?.reload)return!0;if(""===e&&!r)return!0;const{intersection:n,toActivate:o,toDeactivate:i}=Jt(t,r);return e===n||!!o.includes(e)||i.includes(e)}}setDependencies(e){this.#B.depsStore=e;for(const[t,r]of this.#B.pendingCanActivate)e.addActivateGuard(t,r);this.#B.pendingCanActivate.clear();for(const[t,r]of this.#B.pendingCanDeactivate)e.addDeactivateGuard(t,r);this.#B.pendingCanDeactivate.clear()}setLifecycleNamespace(e){this.#B.lifecycleNamespace=e}setRootPath(e){this.#B.rootPath=e,Ft(this.#B)}hasRoute(e){return this.#B.matcher.hasRoute(e)}clearRoutes(){xt(this.#B)}buildPath(e,t,r){if(e===b.UNKNOWN_ROUTE)return f(t?.path)?t.path:"";const n=Object.hasOwn(this.#B.config.defaultParams,e)?{...this.#B.config.defaultParams[e],...t}:t??{},o="function"==typeof this.#B.config.encoders[e]?this.#B.config.encoders[e]({...n}):n,i=r?.trailingSlash;return this.#B.matcher.buildPath(e,o,{trailingSlash:"never"===i||"always"===i?i:void 0,queryParamsMode:r?.queryParamsMode})}matchPath(e,t){const r=t,n=this.#B.matcher.match(e);if(!n)return;const o=Yt(n),{name:i,params:a,meta:s}=o,c="function"==typeof this.#B.config.decoders[i]?this.#B.config.decoders[i](a):a,{name:u,params:d}=this.#h.forwardState(i,c);let l=e;if(r.rewritePathOnMatch){const e="function"==typeof this.#B.config.encoders[u]?this.#B.config.encoders[u]({...d}):d,t=r.trailingSlash;l=this.#B.matcher.buildPath(u,e,{trailingSlash:"never"===t||"always"===t?t:void 0,queryParamsMode:r.queryParamsMode})}return this.#h.makeState(u,d,l,{params:s})}forwardState(e,t){if(Object.hasOwn(this.#B.config.forwardFnMap,e)){const r=this.#G(e,t),n=this.#B.config.forwardFnMap[e],o=this.#V(e,n,t);return{name:o,params:this.#G(o,r)}}const r=this.#B.resolvedForwardMap[e]??e;if(r!==e&&Object.hasOwn(this.#B.config.forwardFnMap,r)){const n=this.#G(e,t),o=this.#B.config.forwardFnMap[r],i=this.#V(r,o,t);return{name:i,params:this.#G(i,n)}}if(r!==e){const n=this.#G(e,t);return{name:r,params:this.#G(r,n)}}return{name:e,params:this.#G(e,t)}}buildStateResolved(e,t){const r=this.#B.matcher.getSegmentsByName(e);if(r)return Yt({segments:r,params:t,meta:this.#B.matcher.getMetaByName(e)},e)}buildStateWithSegmentsResolved(e,t){const r=this.#B.matcher.getSegmentsByName(e);if(r)return{state:Yt({segments:r,params:t,meta:this.#B.matcher.getMetaByName(e)},e),segments:r}}isActiveRoute(e,t={},r=!1,n=!0){ve.has(e)||(m(e,"isActiveRoute"),ve.add(e));const o=this.#h.getState();if(!o)return!1;const i=o.name;if(i!==e&&!i.startsWith(`${e}.`)&&!e.startsWith(`${i}.`))return!1;const a=this.#B.config.defaultParams[e];if(r||i===e){const r=a?{...a,...t}:t;return this.#h.areStatesEqual({name:e,params:r,path:""},o,n)}const s=o.params;return!!function(e,t){for(const r in e)if(e[r]!==t[r])return!1;return!0}(t,s)&&(!a||function(e,t,r){for(const n in e)if(!(n in r)&&e[n]!==t[n])return!1;return!0}(a,s,t))}getUrlParams(e){const t=this.#B.matcher.getSegmentsByName(e);return t?function(e){const t=[];for(const r of e)for(const e of r.paramMeta.urlParams)t.push(e);return t}(t):[]}getStore(){return this.#B}#G(e,t){return Object.hasOwn(this.#B.config.defaultParams,e)?{...this.#B.config.defaultParams[e],...t}:t}#V(e,t,r){const n=new Set([e]);let o=t(this.#h.getDependency,r),i=0;if("string"!=typeof o)throw new TypeError("forwardTo callback must return a string, got "+typeof o);for(;i<100;){if(void 0===this.#B.matcher.getSegmentsByName(o))throw new Error(`Route "${o}" does not exist`);if(n.has(o)){const e=[...n,o].join(" → ");throw new Error(`Circular forwardTo detected: ${e}`)}if(n.add(o),Object.hasOwn(this.#B.config.forwardFnMap,o)){o=(0,this.#B.config.forwardFnMap[o])(this.#h.getDependency,r),i++;continue}const e=this.#B.config.forwardMap[o];if(void 0===e)return o;o=e,i++}throw new Error("forwardTo exceeds maximum depth of 100")}},Xt=new Set(Object.values(w)),er=new Set(["code","segment","path","redirect"]),tr=new Set(["setCode","setErrorInstance","setAdditionalFields","hasField","getField","toJSON"]),rr=class extends Error{segment;path;redirect;code;constructor(e,{message:t,segment:r,path:n,redirect:o,...i}={}){super(t??e),this.code=e,this.segment=r,this.path=n,this.redirect=o?function(e){if(!e)return e;if(null===(t=e)||"object"!=typeof t||"string"!=typeof t.name||"string"!=typeof t.path||"object"!=typeof t.params||null===t.params)throw new TypeError("[deepFreezeState] Expected valid State object, got: "+typeof e);var t;const r=structuredClone(e),n=new WeakSet;return function e(t){if(null===t||"object"!=typeof t)return;if(n.has(t))return;n.add(t),Object.freeze(t);const r=Array.isArray(t)?t:Object.values(t);for(const t of r)e(t)}(r),r}(o):void 0;for(const[e,t]of Object.entries(i)){if(er.has(e))throw new TypeError(`[RouterError] Cannot set reserved property "${e}"`);tr.has(e)||(this[e]=t)}}setCode(e){this.code=e,Xt.has(this.message)&&(this.message=e)}setErrorInstance(e){if(!e)throw new TypeError("[RouterError.setErrorInstance] err parameter is required and must be an Error instance");this.message=e.message,this.cause=e.cause,this.stack=e.stack??""}setAdditionalFields(e){for(const[t,r]of Object.entries(e)){if(er.has(t))throw new TypeError(`[RouterError.setAdditionalFields] Cannot set reserved property "${t}"`);tr.has(t)||(this[t]=r)}}hasField(e){return e in this}getField(e){return this[e]}toJSON(){const e={code:this.code,message:this.message};void 0!==this.segment&&(e.segment=this.segment),void 0!==this.path&&(e.path=this.path),void 0!==this.redirect&&(e.redirect=this.redirect);const t=new Set(["code","message","segment","path","redirect","stack"]);for(const r in this)Object.hasOwn(this,r)&&!t.has(r)&&(e[r]=this[r]);return e}};function nr(e,t,r){if(e instanceof rr)throw e.setCode(t),e;throw new rr(t,function(e,t){const r={segment:t};if(e instanceof Error)return{...r,message:e.message,stack:e.stack,..."cause"in e&&void 0!==e.cause&&{cause:e.cause}};if(e&&"object"==typeof e){const t={};for(const[r,n]of Object.entries(e))or.has(r)||(t[r]=n);return{...r,...t}}return r}(e,r))}var or=new Set(["code","segment","path","redirect"]);async function ir(e,t,r,n,o,i,a){const s=n.filter(t=>e.has(t));if(0===s.length)return;let c;for(const n of s){if(i())throw new rr(w.TRANSITION_CANCELLED);const s=e.get(n);try{c=await s(t,r,a)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new rr(w.TRANSITION_CANCELLED,{reason:a.reason});nr(e,o,n)}if(!c)throw new rr(o,{segment:n})}}var ar=[b.UNKNOWN_ROUTE];Object.freeze(ar);var sr={replace:!0};Object.freeze(sr);var cr=class{#h;#z=null;static validateNavigateArgs(e){!function(e){if("string"!=typeof e)throw new TypeError(`[router.navigate] Invalid route name: expected string, got ${g(e)}`)}(e)}static validateNavigateToDefaultArgs(e){!function(e){if(void 0!==e&&("object"!=typeof e||null===e))throw new TypeError(`[router.navigateToDefault] Invalid options: ${g(e)}. Expected NavigationOptions object.`)}(e)}static validateNavigationOptions(e,t){!function(e,t){if(!function(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=e;for(const e of i){const r=t[e];if(void 0!==r&&"boolean"!=typeof r)return!1}const r=t.signal;return!(void 0!==r&&!(r instanceof AbortSignal))}(e))throw new TypeError(`[router.${t}] Invalid options: ${g(e)}. Expected NavigationOptions object.`)}(e,t)}setDependencies(e){this.#h=e}async navigate(e,t,r){if(!this.#h.canNavigate())throw new rr(w.ROUTER_NOT_STARTED);const n=this.#h,o=n.buildStateWithSegments(e,t);if(!o){const e=new rr(w.ROUTE_NOT_FOUND);throw n.emitTransitionError(void 0,n.getState(),e),e}const{state:i}=o,a=n.makeState(i.name,i.params,n.buildPath(i.name,i.params),{params:i.meta}),s=n.getState();if(r=function(e,t){return t?.name!==b.UNKNOWN_ROUTE||e.replace?e:{...e,replace:!0}}(r,s),s&&!r.reload&&!r.force&&n.areStatesEqual(s,a,!1)){const e=new rr(w.SAME_STATES);throw n.emitTransitionError(a,s,e),e}this.#W();const c=new AbortController;if(this.#z=c,r.signal){if(r.signal.aborted)throw this.#z=null,new rr(w.TRANSITION_CANCELLED,{reason:r.signal.reason});r.signal.addEventListener("abort",()=>{c.abort(r.signal?.reason)},{once:!0,signal:c.signal})}n.startTransition(a,s);try{const{state:e,meta:t}=await async function(e,t,r,n,o){const[i,a]=e.getLifecycleFunctions(),s=t.name===b.UNKNOWN_ROUTE,c=()=>o.aborted||!e.isActive(),{toDeactivate:u,toActivate:d,intersection:l}=Jt(t,r,void 0===n.reload?void 0:{reload:n.reload}),f=!s&&d.length>0;if(r&&!n.forceDeactivate&&u.length>0&&await ir(i,t,r,u,w.CANNOT_DEACTIVATE,c,o),c())throw new rr(w.TRANSITION_CANCELLED);if(f&&await ir(a,t,r,d,w.CANNOT_ACTIVATE,c,o),c())throw new rr(w.TRANSITION_CANCELLED);if(r)for(const t of u)!d.includes(t)&&i.has(t)&&e.clearCanDeactivate(t);return{state:t,meta:{phase:"activating",segments:{deactivated:u,activated:d,intersection:l}}}}(n,a,s,r,c.signal);if(e.name===b.UNKNOWN_ROUTE||n.hasRoute(e.name)){const o=function(e,t,r,n){const o={phase:t.phase,...void 0!==r?.name&&{from:r.name},reason:"success",segments:t.segments,...void 0!==n.reload&&{reload:n.reload},...void 0!==n.redirected&&{redirected:n.redirected}};return Object.freeze(o.segments.deactivated),Object.freeze(o.segments.activated),Object.freeze(o.segments),Object.freeze(o),{...e,transition:o}}(e,t,s,r);n.setState(o);const i=void 0===r.signal?r:function({signal:e,...t}){return t}(r);return n.sendTransitionDone(o,s,i),o}{const t=new rr(w.ROUTE_NOT_FOUND,{routeName:e.name});throw n.sendTransitionFail(e,s,t),t}}catch(e){throw function(e,t,r,n){t.code!==w.TRANSITION_CANCELLED&&t.code!==w.ROUTE_NOT_FOUND&&e.sendTransitionFail(r,n,t)}(n,e,a,s),e}finally{c.abort(),this.#z===c&&(this.#z=null)}}async navigateToDefault(e){const t=this.#h;if(!t.getOptions().defaultRoute)throw new rr(w.ROUTE_NOT_FOUND,{routeName:"defaultRoute not configured"});const{route:r,params:n}=t.resolveDefault();if(!r)throw new rr(w.ROUTE_NOT_FOUND,{routeName:"defaultRoute resolved to empty"});return this.navigate(r,n,e)}navigateToNotFound(e){this.#W();const t=this.#h.getState(),r=t?Qt(t.name).toReversed():[];Object.freeze(r);const n={deactivated:r,activated:ar,intersection:""};Object.freeze(n);const o={phase:"activating",...t&&{from:t.name},reason:"success",segments:n};Object.freeze(o);const i={name:b.UNKNOWN_ROUTE,params:{},path:e,transition:o};return Object.freeze(i),this.#h.setState(i),this.#h.emitTransitionSuccess(i,t,sr),i}abortCurrentNavigation(){this.#z?.abort(new rr(w.TRANSITION_CANCELLED)),this.#z=null}#W(){this.#h.isTransitioning()&&(e.warn("router.navigate","Concurrent navigation detected on shared router instance. For SSR, use cloneRouter() to create isolated instance per request."),this.#z?.abort(new rr(w.TRANSITION_CANCELLED)),this.#h.cancelNavigation())}},ur={replace:!0};Object.freeze(ur);var dr=class{#h;static validateStartArgs(e){if(1!==e.length||"string"!=typeof e[0])throw new Error("[router.start] Expected exactly 1 string argument (startPath).")}setDependencies(e){this.#h=e}async start(e){const t=this.#h,r=t.getOptions(),n=t.matchPath(e);if(!n&&!r.allowNotFound){const r=new rr(w.ROUTE_NOT_FOUND,{path:e});throw t.emitTransitionError(void 0,void 0,r),r}return t.completeStart(),n?t.navigate(n.name,n.params,ur):t.navigateToNotFound(e)}stop(){this.#h.clearState()}},lr=class{#q;#Q;#H;constructor(e){this.#q=e.routerFSM,this.#Q=e.emitter,this.#H=void 0,this.#K()}static validateSubscribeListener(e){if("function"!=typeof e)throw new TypeError("[router.subscribe] Expected a function. For Observable pattern use @real-router/rx package")}emitRouterStart(){this.#Q.emit(R.ROUTER_START)}emitRouterStop(){this.#Q.emit(R.ROUTER_STOP)}emitTransitionStart(e,t){this.#Q.emit(R.TRANSITION_START,e,t)}emitTransitionSuccess(e,t,r){this.#Q.emit(R.TRANSITION_SUCCESS,e,t,r)}emitTransitionError(e,t,r){this.#Q.emit(R.TRANSITION_ERROR,e,t,r)}emitTransitionCancel(e,t){this.#Q.emit(R.TRANSITION_CANCEL,e,t)}sendStart(){this.#q.send(L)}sendStop(){this.#q.send(G)}sendDispose(){this.#q.send(V)}sendStarted(){this.#q.send(M)}sendNavigate(e,t){this.#H=e,this.#q.send(_,{toState:e,fromState:t})}sendComplete(e,t,r={}){this.#q.send(k,{state:e,fromState:t,opts:r}),this.#H=void 0}sendFail(e,t,r){this.#q.send(U,{toState:e,fromState:t,error:r}),this.#H=void 0}sendFailSafe(e,t,r){this.isReady()?this.sendFail(e,t,r):this.emitTransitionError(e,t,r)}sendCancel(e,t){this.#q.send(B,{toState:e,fromState:t}),this.#H=void 0}canBeginTransition(){return this.#q.canSend(_)}canStart(){return this.#q.canSend(L)}canCancel(){return this.#q.canSend(B)}isActive(){const e=this.#q.getState();return e!==C&&e!==I}isDisposed(){return this.#q.getState()===I}isTransitioning(){return this.#q.getState()===x}isReady(){return this.#q.getState()===F}getCurrentToState(){return this.#H}addEventListener(e,t){return this.#Q.on(e,t)}subscribe(e){return this.#Q.on(R.TRANSITION_SUCCESS,(t,r)=>{e({route:t,previousRoute:r})})}clearAll(){this.#Q.clearAll()}setLimits(e){this.#Q.setLimits(e)}sendCancelIfTransitioning(e){this.canCancel()&&this.sendCancel(this.#H,e)}#K(){const e=this.#q;e.on(j,M,()=>{this.emitRouterStart()}),e.on(F,G,()=>{this.emitRouterStop()}),e.on(F,_,e=>{this.emitTransitionStart(e.toState,e.fromState)}),e.on(x,k,e=>{this.emitTransitionSuccess(e.state,e.fromState,e.opts)}),e.on(x,B,e=>{this.emitTransitionCancel(e.toState,e.fromState)}),e.on(j,U,e=>{this.emitTransitionError(e.toState,e.fromState,e.error)}),e.on(F,U,e=>{this.emitTransitionError(e.toState,e.fromState,e.error)}),e.on(x,U,e=>{this.emitTransitionError(e.toState,e.fromState,e.error)})}};function fr(e,t){if("string"!=typeof e)throw new TypeError(`[router.${t}]: dependency name must be a string, got ${typeof e}`)}function hr(e,t){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[router.${t}] Invalid argument: expected plain object, received ${g(e)}`);for(const r in e)if(Object.getOwnPropertyDescriptor(e,r)?.get)throw new TypeError(`[router.${t}] Getters not allowed: "${r}"`)}var pr=new rr(w.ROUTER_ALREADY_STARTED),mr=new Set(["all","warn-error","error-only"]);var gr=class{router;options;limits;dependenciesStore;state;routes;routeLifecycle;plugins;navigation;lifecycle;eventBus;constructor(e){this.router=e.router,this.options=e.options,this.limits=e.limits,this.dependenciesStore=e.dependenciesStore,this.state=e.state,this.routes=e.routes,this.routeLifecycle=e.routeLifecycle,this.plugins=e.plugins,this.navigation=e.navigation,this.lifecycle=e.lifecycle,this.eventBus=e.eventBus}wireLimits(){this.dependenciesStore.limits=this.limits,this.plugins.setLimits(this.limits),this.eventBus.setLimits({maxListeners:this.limits.maxListeners,warnListeners:this.limits.warnListeners,maxEventDepth:this.limits.maxEventDepth}),this.routeLifecycle.setLimits(this.limits)}wireRouteLifecycleDeps(){const e={compileFactory:this.createCompileFactory()};this.routeLifecycle.setDependencies(e)}wireRoutesDeps(){this.routes.setDependencies({addActivateGuard:(e,t)=>{this.routeLifecycle.addCanActivate(e,t,!0,!0)},addDeactivateGuard:(e,t)=>{this.routeLifecycle.addCanDeactivate(e,t,!0,!0)},makeState:(e,t,r,n)=>this.state.makeState(e,t,r,n),getState:()=>this.state.get(),areStatesEqual:(e,t,r)=>this.state.areStatesEqual(e,t,r),getDependency:e=>this.dependenciesStore.dependencies[e],forwardState:(e,t)=>{const r=J(this.router);return r.noValidate||Pt(e,t,"forwardState"),r.forwardState(e,t)}}),this.routes.setLifecycleNamespace(this.routeLifecycle)}wirePluginsDeps(){const e={addEventListener:(e,t)=>this.eventBus.addEventListener(e,t),canNavigate:()=>this.eventBus.canBeginTransition(),compileFactory:this.createCompileFactory()};this.plugins.setDependencies(e)}wireNavigationDeps(){this.navigation.setDependencies({getOptions:()=>this.options.get(),hasRoute:e=>this.routes.hasRoute(e),getState:()=>this.state.get(),setState:e=>{this.state.set(e)},buildStateWithSegments:(e,t)=>{const r=J(this.router);r.noValidate||Pt(e,t,"navigate");const{name:n,params:o}=r.forwardState(e,t);return this.routes.buildStateWithSegmentsResolved(n,o)},makeState:(e,t,r,n)=>this.state.makeState(e,t,r,n),buildPath:(e,t)=>J(this.router).buildPath(e,t),areStatesEqual:(e,t,r)=>this.state.areStatesEqual(e,t,r),resolveDefault:()=>{const e=this.options.get();return{route:re(e.defaultRoute,e=>this.dependenciesStore.dependencies[e]),params:re(e.defaultParams,e=>this.dependenciesStore.dependencies[e])}},startTransition:(e,t)=>{this.eventBus.sendNavigate(e,t)},cancelNavigation:()=>{this.eventBus.sendCancel(this.eventBus.getCurrentToState(),this.state.get())},sendTransitionDone:(e,t,r)=>{this.eventBus.sendComplete(e,t,r)},sendTransitionFail:(e,t,r)=>{this.eventBus.sendFail(e,t,r)},emitTransitionError:(e,t,r)=>{this.eventBus.sendFailSafe(e,t,r)},emitTransitionSuccess:(e,t,r)=>{this.eventBus.emitTransitionSuccess(e,t,r)},canNavigate:()=>this.eventBus.canBeginTransition(),getLifecycleFunctions:()=>this.routeLifecycle.getFunctions(),isActive:()=>this.router.isActive(),isTransitioning:()=>this.eventBus.isTransitioning(),clearCanDeactivate:e=>{this.routeLifecycle.clearCanDeactivate(e)}})}wireLifecycleDeps(){this.lifecycle.setDependencies({getOptions:()=>this.options.get(),navigate:(e,t,r)=>this.navigation.navigate(e,t,r),navigateToNotFound:e=>this.navigation.navigateToNotFound(e),clearState:()=>{this.state.set(void 0)},matchPath:e=>this.routes.matchPath(e,this.options.get()),completeStart:()=>{this.eventBus.sendStarted()},emitTransitionError:(e,t,r)=>{this.eventBus.sendFail(e,t,r)}})}wireStateDeps(){this.state.setDependencies({getDefaultParams:()=>this.routes.getStore().config.defaultParams,buildPath:(e,t)=>J(this.router).buildPath(e,t),getUrlParams:e=>this.routes.getUrlParams(e)})}createCompileFactory(){const{router:e,dependenciesStore:t}=this;return r=>r(e,e=>t.dependencies[e])}},vr=class r{#u;#w;#J;#Y;#Z;#X;#g;#ee;#te;#re;#ne;constructor(r=[],n={},i={}){n.logger&&function(e){if("object"!=typeof e||null===e)throw new TypeError("Logger config must be an object");const t=e;for(const e of Object.keys(t))if("level"!==e&&"callback"!==e)throw new TypeError(`Unknown logger config property: "${e}"`);if("level"in t&&void 0!==t.level&&("string"!=typeof(r=t.level)||!mr.has(r)))throw new TypeError(`Invalid logger level: ${function(e){return"string"==typeof e?`"${e}"`:"object"==typeof e?JSON.stringify(e):String(e)}(t.level)}. Expected: "all" | "warn-error" | "error-only"`);var r;if("callback"in t&&void 0!==t.callback&&"function"!=typeof t.callback)throw new TypeError("Logger callback must be a function, got "+typeof t.callback);return!0}(n.logger)&&(e.configure(n.logger),delete n.logger),ae.validateOptions(n,"constructor");const a=n.noValidate??!1;a||hr(i,"constructor"),!a&&r.length>0&&(Ot(r),$t(r)),this.#u=new ae(n),this.#w=function(e={}){return{...N,...e}}(n.limits),this.#J=function(e={}){const t=Object.create(null);for(const r in e)void 0!==e[r]&&(t[r]=e[r]);return{dependencies:t,limits:N}}(i),this.#Y=new ce,this.#Z=new Zt(r,a,function(e){return{strictTrailingSlash:"strict"===e.trailingSlash,strictQueryParams:"strict"===e.queryParamsMode,urlParamsEncoding:e.urlParamsEncoding,queryParams:e.queryParams}}(this.#u.get())),this.#X=new ge,this.#g=new fe,this.#ee=new cr,this.#te=new dr,this.#ne=a;const s=new t(z),c=new o({onListenerError:(t,r)=>{e.error("Router",`Error in listener for ${t}:`,r)},onListenerWarn:(t,r)=>{e.warn("router.addEventListener",`Event "${t}" has ${r} listeners — possible memory leak`)}});var u;this.#re=new lr({routerFSM:s,emitter:c}),(u=new gr({router:this,options:this.#u,limits:this.#w,dependenciesStore:this.#J,state:this.#Y,routes:this.#Z,routeLifecycle:this.#X,plugins:this.#g,navigation:this.#ee,lifecycle:this.#te,eventBus:this.#re})).wireLimits(),u.wireRouteLifecycleDeps(),u.wireRoutesDeps(),u.wirePluginsDeps(),u.wireNavigationDeps(),u.wireLifecycleDeps(),u.wireStateDeps();const d=new Map;var l;l={makeState:(e,t,r,n,o)=>this.#Y.makeState(e,t,r,n,o),forwardState:Y("forwardState",(e,t)=>this.#Z.forwardState(e,t),d),buildStateResolved:(e,t)=>this.#Z.buildStateResolved(e,t),matchPath:(e,t)=>this.#Z.matchPath(e,t),getOptions:()=>this.#u.get(),addEventListener:(e,t)=>this.#re.addEventListener(e,t),buildPath:Y("buildPath",(e,t)=>this.#Z.buildPath(e,t??{},this.#u.get()),d),start:Y("start",e=>(a||dr.validateStartArgs([e]),this.#te.start(e)),d),interceptors:d,setRootPath:e=>{this.#Z.setRootPath(e)},getRootPath:()=>this.#Z.getStore().rootPath,getTree:()=>this.#Z.getStore().tree,isDisposed:()=>this.#re.isDisposed(),noValidate:a,dependenciesGetStore:()=>this.#J,cloneOptions:()=>({...this.#u.get()}),cloneDependencies:()=>({...this.#J.dependencies}),getLifecycleFactories:()=>this.#X.getFactories(),getPluginFactories:()=>this.#g.getAll(),routeGetStore:()=>this.#Z.getStore(),getStateName:()=>this.#Y.get()?.name,isTransitioning:()=>this.#re.isTransitioning(),clearState:()=>{this.#Y.set(void 0)},setState:e=>{this.#Y.set(e)},routerExtensions:[]},K.set(this,l),this.isActiveRoute=this.isActiveRoute.bind(this),this.buildPath=this.buildPath.bind(this),this.getState=this.getState.bind(this),this.getPreviousState=this.getPreviousState.bind(this),this.areStatesEqual=this.areStatesEqual.bind(this),this.shouldUpdateNode=this.shouldUpdateNode.bind(this),this.isActive=this.isActive.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.dispose=this.dispose.bind(this),this.canNavigateTo=this.canNavigateTo.bind(this),this.usePlugin=this.usePlugin.bind(this),this.navigate=this.navigate.bind(this),this.navigateToDefault=this.navigateToDefault.bind(this),this.navigateToNotFound=this.navigateToNotFound.bind(this),this.subscribe=this.subscribe.bind(this)}isActiveRoute(t,r,n,o){return this.#ne||function(e,t,r,n){if(!f(e))throw new TypeError("Route name must be a string");if(void 0!==t&&!l(t))throw new TypeError("[router.isActiveRoute] Invalid params structure");if(void 0!==r&&"boolean"!=typeof r)throw new TypeError("[router.isActiveRoute] strictEquality must be a boolean, got "+typeof r);if(void 0!==n&&"boolean"!=typeof n)throw new TypeError("[router.isActiveRoute] ignoreQueryParams must be a boolean, got "+typeof n)}(t,r,n,o),""===t?(e.warn("real-router",'isActiveRoute("") called with empty string. Root node is not considered a parent of any route.'),!1):this.#Z.isActiveRoute(t,r,n,o)}buildPath(e,t){return this.#ne||function(e){if(!f(e)||""===e)throw new TypeError("[real-router] buildPath: route must be a non-empty string, got "+("string"==typeof e?'""':typeof e))}(e),J(this).buildPath(e,t)}getState(){return this.#Y.get()}getPreviousState(){return this.#Y.getPrevious()}areStatesEqual(e,t,r=!0){return this.#ne||ce.validateAreStatesEqualArgs(e,t,r),this.#Y.areStatesEqual(e,t,r)}shouldUpdateNode(e){return this.#ne||function(e){if(!f(e))throw new TypeError("[router.shouldUpdateNode] nodeName must be a string, got "+typeof e)}(e),Zt.shouldUpdateNode(e)}isActive(){return this.#re.isActive()}start(e){if(!this.#re.canStart())return Promise.reject(pr);this.#re.sendStart();const t=J(this).start(e).catch(e=>{throw this.#re.isReady()&&(this.#te.stop(),this.#re.sendStop()),e});return r.#oe(t),t}stop(){return this.#ee.abortCurrentNavigation(),this.#re.sendCancelIfTransitioning(this.#Y.get()),this.#re.isReady()||this.#re.isTransitioning()?(this.#te.stop(),this.#re.sendStop(),this):this}dispose(){if(this.#re.isDisposed())return;this.#ee.abortCurrentNavigation(),this.#re.sendCancelIfTransitioning(this.#Y.get()),(this.#re.isReady()||this.#re.isTransitioning())&&(this.#te.stop(),this.#re.sendStop()),this.#re.sendDispose(),this.#re.clearAll(),this.#g.disposeAll();const e=J(this);for(const t of e.routerExtensions)for(const e of t.keys)delete this[e];e.routerExtensions.length=0,this.#Z.clearRoutes(),this.#X.clearAll(),this.#Y.reset(),this.#J.dependencies=Object.create(null),this.#ie()}canNavigateTo(e,t){if(this.#ne||m(e,"canNavigateTo"),!this.#Z.hasRoute(e))return!1;const r=J(this),{name:n,params:o}=r.forwardState(e,t??{}),i=this.#Y.makeState(n,o),a=this.#Y.get(),{toDeactivate:s,toActivate:c}=Jt(i,a);return this.#X.canNavigateTo(s,c,i,a)}usePlugin(...e){return this.#ne||(fe.validateUsePluginArgs(e),fe.validatePluginLimit(this.#g.count(),e.length,this.#w.maxPlugins),fe.validateNoDuplicatePlugins(e,this.#g.has.bind(this.#g))),this.#g.use(...e)}subscribe(e){return this.#ne||lr.validateSubscribeListener(e),this.#re.subscribe(e)}navigate(e,t,n){this.#ne||cr.validateNavigateArgs(e);const o=n??{};this.#ne||cr.validateNavigationOptions(o,"navigate");const i=this.#ee.navigate(e,t??{},o);return r.#oe(i),i}navigateToDefault(e){this.#ne||cr.validateNavigateToDefaultArgs(e);const t=e??{};this.#ne||cr.validateNavigationOptions(t,"navigateToDefault");const n=this.#ee.navigateToDefault(t);return r.#oe(n),n}navigateToNotFound(e){if(!this.#re.isActive())throw new rr(w.ROUTER_NOT_STARTED);const t=e??this.#Y.get().path;return this.#ee.navigateToNotFound(t)}static#ae=t=>{t instanceof rr&&(t.code===w.SAME_STATES||t.code===w.TRANSITION_CANCELLED||t.code===w.ROUTER_NOT_STARTED||t.code===w.ROUTE_NOT_FOUND)||e.error("router.navigate","Unexpected navigation error",t)};static#oe(e){e.catch(r.#ae)}#ie(){this.navigate=wr,this.navigateToDefault=wr,this.navigateToNotFound=wr,this.start=wr,this.stop=wr,this.usePlugin=wr,this.subscribe=wr,this.canNavigateTo=wr}};function wr(){throw new rr(w.ROUTER_DISPOSED)}var yr=(e=[],t={},r={})=>new vr(e,t,r),br=new WeakMap,Sr=e=>{let t=br.get(e);return t||(t=Object.freeze({navigate:e.navigate,getState:e.getState,isActiveRoute:e.isActiveRoute,canNavigateTo:e.canNavigateTo,subscribe:e.subscribe}),br.set(e,t)),t};function Tr(e){if(e())throw new rr(w.ROUTER_DISPOSED)}function Er(e){const t=J(e);return{makeState:(e,r,n,o,i)=>(t.noValidate||function(e,t,r,n){if(!f(e))throw new TypeError(`[router.makeState] Invalid name: ${g(e)}. Expected string.`);if(void 0!==t&&!l(t))throw new TypeError(`[router.makeState] Invalid params: ${g(t)}. Expected plain object.`);if(void 0!==r&&!f(r))throw new TypeError(`[router.makeState] Invalid path: ${g(r)}. Expected string.`);if(void 0!==n&&"number"!=typeof n)throw new TypeError(`[router.makeState] Invalid forceId: ${g(n)}. Expected number.`)}(e,r,n,i),t.makeState(e,r,n,o,i)),buildState:(e,r)=>{t.noValidate||Pt(e,r,"buildState");const{name:n,params:o}=t.forwardState(e,r);return t.buildStateResolved(n,o)},forwardState:(e,r)=>(t.noValidate||Pt(e,r,"forwardState"),t.forwardState(e,r)),matchPath:e=>(t.noValidate||function(e){if(!f(e))throw new TypeError("[real-router] matchPath: path must be a string, got "+typeof e)}(e),t.matchPath(e,t.getOptions())),setRootPath:e=>{Tr(t.isDisposed),t.noValidate||function(e){if("string"!=typeof e)throw new TypeError(`[router.setRootPath] rootPath must be a string, got ${g(e)}`)}(e),t.setRootPath(e)},getRootPath:t.getRootPath,addEventListener:(e,r)=>(Tr(t.isDisposed),t.noValidate||function(e,t){if(function(e){if(!$.has(e))throw new Error(`Invalid event name: ${String(e)}`)}(e),"function"!=typeof t)throw new TypeError(`Expected callback to be a function for event ${e}`)}(e,r),t.addEventListener(e,r)),buildNavigationState:(e,r={})=>{t.noValidate||Pt(e,r,"buildNavigationState");const{name:n,params:o}=t.forwardState(e,r),i=t.buildStateResolved(n,o);if(i)return t.makeState(i.name,i.params,t.buildPath(i.name,i.params),{params:i.meta})},getOptions:t.getOptions,getTree:t.getTree,addInterceptor:(e,r)=>{Tr(t.isDisposed);let n=t.interceptors.get(e);return n||(n=[],t.interceptors.set(e,n)),n.push(r),()=>{const e=n.indexOf(r);-1!==e&&n.splice(e,1)}},extendRouter:r=>{Tr(t.isDisposed);const n=Object.keys(r);for(const t of n)if(t in e)throw new rr(w.PLUGIN_CONFLICT,{message:`Cannot extend router: property "${t}" already exists`});for(const t of n)e[t]=r[t];const o={keys:n};t.routerExtensions.push(o);let i=!1;return()=>{if(i)return;i=!0;for(const t of o.keys)delete e[t];const r=t.routerExtensions.indexOf(o);-1!==r&&t.routerExtensions.splice(r,1)}}}}function Or(e,t,r=""){for(const n of e){const e=r?`${r}.${n.name}`:n.name;if(e===t)return n;if(n.children&&t.startsWith(`${e}.`))return Or(n.children,t,e)}}function Pr(e,t,r,n){const o={name:e.name,path:e.path},i=r.forwardFnMap[t],a=r.forwardMap[t];void 0!==i?o.forwardTo=i:void 0!==a&&(o.forwardTo=a),t in r.defaultParams&&(o.defaultParams=r.defaultParams[t]),t in r.decoders&&(o.decodeParams=r.decoders[t]),t in r.encoders&&(o.encodeParams=r.encoders[t]);const[s,c]=n;return t in c&&(o.canActivate=c[t]),t in s&&(o.canDeactivate=s[t]),e.children&&(o.children=e.children.map(e=>Pr(e,`${t}.${e.name}`,r,n))),o}function Ar(e,t,r,n){if(n){const t=Or(e.definitions,n);t.children??=[];for(const e of r)t.children.push(ye(e))}else for(const t of r)e.definitions.push(ye(t));Ut(r,e.config,e.routeCustomFields,e.pendingCanActivate,e.pendingCanDeactivate,e.depsStore,n??""),e.treeOperations.commitTreeChanges(e,t)}function Rr(e,t,r){return!!be(e.definitions,r)&&(function(e,t,r,n){const o=t=>t===e||t.startsWith(`${e}.`);Se(t.decoders,o),Se(t.encoders,o),Se(t.defaultParams,o),Se(t.forwardMap,o),Se(t.forwardFnMap,o),Se(r,o),Se(t.forwardMap,e=>o(t.forwardMap[e]));const[i,a]=n.getFactories();for(const e of Object.keys(a))o(e)&&n.clearCanActivate(e);for(const e of Object.keys(i))o(e)&&n.clearCanDeactivate(e)}(r,e.config,e.routeCustomFields,e.lifecycleNamespace),e.treeOperations.commitTreeChanges(e,t),!0)}function $r(e,t){const r=e.matcher.getSegmentsByName(t);if(!r)return;const n=r.at(-1),o=e.treeOperations.nodeToDefinition(n),i=e.lifecycleNamespace.getFactories();return Pr(o,t,e.config,i)}function Nr(t){const r=J(t),n=r.routeGetStore(),o=r.noValidate;return{add:(e,t)=>{Tr(r.isDisposed);const i=Array.isArray(e)?e:[e],a=t?.parent;r.noValidate||(void 0!==a&&function(e){if("string"!=typeof e||""===e)throw new TypeError(`[router.addRoute] parent option must be a non-empty string, got ${g(e)}`);m(e,"addRoute")}(a),Et(i,"addRoute"),Ot(i),n.treeOperations.validateRoutes(i,n.tree,n.config.forwardMap,a)),Ar(n,o,i,a)},remove:t=>{Tr(r.isDisposed),r.noValidate||(function(e){m(e,"removeRoute")}(t),Tt(t,"removeRoute"));const i=function(t,r,n){if(r){const n=r===t,o=r.startsWith(`${t}.`);if(n||o)return e.warn("router.removeRoute",`Cannot remove route "${t}" — it is currently active${n?"":` (current: "${r}")`}. Navigate away first.`),!1}return n&&e.warn("router.removeRoute",`Route "${t}" removed while navigation is in progress. This may cause unexpected behavior.`),!0}(t,r.getStateName(),r.isTransitioning());i&&(Rr(n,o,t)||e.warn("router.removeRoute",`Route "${t}" not found. No changes made.`))},update:(t,i)=>{Tr(r.isDisposed),r.noValidate||(function(e,t){if(m(e,"updateRoute"),""===e)throw new ReferenceError("[router.updateRoute] Invalid name: empty string. Cannot update root node.");if(null===t)throw new TypeError("[real-router] updateRoute: updates must be an object, got null");if("object"!=typeof t||Array.isArray(t))throw new TypeError(`[real-router] updateRoute: updates must be an object, got ${g(t)}`)}(t,i),Tt(t,"updateRoute"));const{forwardTo:a,defaultParams:s,decodeParams:c,encodeParams:u,canActivate:d,canDeactivate:l}=i;r.noValidate||function(e,t,r,n){if(null!=e){if("string"!=typeof e&&"function"!=typeof e)throw new TypeError(`[real-router] updateRoute: forwardTo must be a string, function, or null, got ${g(e)}`);"function"==typeof e&&At(e,"forwardTo callback")}if(null!=t&&("object"!=typeof t||Array.isArray(t)))throw new TypeError(`[real-router] updateRoute: defaultParams must be an object or null, got ${g(t)}`);Rt(r,"decodeParams"),Rt(n,"encodeParams")}(a,s,c,u),r.isTransitioning()&&e.error("router.updateRoute",`Updating route "${t}" while navigation is in progress. This may cause unexpected behavior.`),r.noValidate||Dt(t,a,e=>n.matcher.hasRoute(e),n.matcher,n.config),function(e,t,r,n){if(void 0!==n.forwardTo&&(e.resolvedForwardMap=function(e,t,r,n,o){return null===t?(delete r.forwardMap[e],delete r.forwardFnMap[e]):"string"==typeof t?(delete r.forwardFnMap[e],r.forwardMap[e]=t):(delete r.forwardMap[e],r.forwardFnMap[e]=t),o(r,n)}(r,n.forwardTo,e.config,t,Lt)),void 0!==n.defaultParams&&(null===n.defaultParams?delete e.config.defaultParams[r]:e.config.defaultParams[r]=n.defaultParams),void 0!==n.decodeParams)if(null===n.decodeParams)delete e.config.decoders[r];else{const t=n.decodeParams;e.config.decoders[r]=e=>t(e)??e}if(void 0!==n.encodeParams)if(null===n.encodeParams)delete e.config.encoders[r];else{const t=n.encodeParams;e.config.encoders[r]=e=>t(e)??e}}(n,o,t,{forwardTo:a,defaultParams:s,decodeParams:c,encodeParams:u}),void 0!==d&&(null===d?n.lifecycleNamespace.clearCanActivate(t):n.lifecycleNamespace.addCanActivate(t,d,o,!0)),void 0!==l&&(null===l?n.lifecycleNamespace.clearCanDeactivate(t):n.lifecycleNamespace.addCanDeactivate(t,l,o,!0))},clear:()=>{Tr(r.isDisposed),Nt(r.isTransitioning())&&(n.treeOperations.resetStore(n),n.lifecycleNamespace.clearAll(),r.clearState())},has:e=>(r.noValidate||m(e,"hasRoute"),n.matcher.hasRoute(e)),get:e=>(r.noValidate||m(e,"getRoute"),$r(n,e)),getConfig:e=>function(e,t){if(e.matcher.hasRoute(t))return e.routeCustomFields[t]}(n,e),replace:e=>{Tr(r.isDisposed);const i=Array.isArray(e)?e:[e];if(!Nt(r.isTransitioning()))return;r.noValidate||(Et(i,"replaceRoutes"),Ot(i),n.treeOperations.validateRoutes(i));const a=t.getState()?.path;!function(e,t,r,n,o){It(e),e.lifecycleNamespace.clearDefinitionGuards();for(const t of r)e.definitions.push(ye(t));if(Ut(r,e.config,e.routeCustomFields,e.pendingCanActivate,e.pendingCanDeactivate,e.depsStore,""),e.treeOperations.commitTreeChanges(e,t),void 0!==o){const e=n.matchPath(o,n.getOptions());e?n.setState(e):n.clearState()}}(n,o,i,r,a)}}}function Dr(t){const r=J(t);return{get:e=>{r.noValidate||fr(e,"getDependency");const t=r.dependenciesGetStore().dependencies[e];return r.noValidate||function(e,t){if(void 0===e)throw new ReferenceError(`[router.getDependency]: dependency "${t}" not found`)}(t,e),t},getAll:()=>({...r.dependenciesGetStore().dependencies}),set:(t,n)=>{Tr(r.isDisposed),r.noValidate||function(e){if("string"!=typeof e)throw new TypeError("[router.setDependency]: dependency name must be a string, got "+typeof e)}(t),function(t,r,n){if(void 0===n)return!1;if(Object.hasOwn(t.dependencies,r)){const o=t.dependencies[r],i=o!==n,a=Number.isNaN(o)&&Number.isNaN(n);i&&!a&&e.warn("router.setDependency","Router dependency already exists and is being overwritten:",r)}else!function(t,r){const n=t.limits.maxDependencies;if(0===n)return;const o=Object.keys(t.dependencies).length,{warn:i,error:a}=H(n);if(o===i)e.warn(`router.${r}`,`${i} dependencies registered. Consider if all are necessary.`);else if(o===a)e.error(`router.${r}`,`${a} dependencies registered! This indicates architectural problems. Hard limit at ${n}.`);else if(o>=n)throw new Error(`[router.${r}] Dependency limit exceeded (${n}). Current: ${o}. This is likely a bug in your code. If you genuinely need more dependencies, your architecture needs refactoring.`)}(t,"setDependency");t.dependencies[r]=n}(r.dependenciesGetStore(),t,n)},setAll:t=>{Tr(r.isDisposed);const n=r.dependenciesGetStore();r.noValidate||(hr(t,"setDependencies"),function(e,t,r,n=N.maxDependencies){if(0===n)return;const o=e+t;if(o>=n)throw new Error(`[router.${"setDependencies"}] Dependency limit exceeded (${n}). Current: ${o}. This is likely a bug in your code.`)}(Object.keys(n.dependencies).length,Object.keys(t).length,0,n.limits.maxDependencies)),function(t,r){const n=[];for(const e in r)void 0!==r[e]&&(Object.hasOwn(t.dependencies,e)&&n.push(e),t.dependencies[e]=r[e]);n.length>0&&e.warn("router.setDependencies","Overwritten:",n.join(", "))}(n,t)},remove:t=>{Tr(r.isDisposed),r.noValidate||fr(t,"removeDependency");const n=r.dependenciesGetStore();Object.hasOwn(n.dependencies,t)||e.warn("router.removeDependency",`Attempted to remove non-existent dependency: "${g(t)}"`),delete n.dependencies[t]},reset:()=>{Tr(r.isDisposed),r.dependenciesGetStore().dependencies=Object.create(null)},has:e=>(r.noValidate||fr(e,"hasDependency"),Object.hasOwn(r.dependenciesGetStore().dependencies,e))}}function Cr(e){const t=J(e),r=t.routeGetStore().lifecycleNamespace;return{addActivateGuard(e,n){Tr(t.isDisposed),t.noValidate||(m(e,"addActivateGuard"),he(n,"addActivateGuard")),r.addCanActivate(e,n,t.noValidate)},addDeactivateGuard(e,n){Tr(t.isDisposed),t.noValidate||(m(e,"addDeactivateGuard"),he(n,"addDeactivateGuard")),r.addCanDeactivate(e,n,t.noValidate)},removeActivateGuard(e){Tr(t.isDisposed),t.noValidate||m(e,"removeActivateGuard"),r.clearCanActivate(e)},removeDeactivateGuard(e){Tr(t.isDisposed),t.noValidate||m(e,"removeDeactivateGuard"),r.clearCanDeactivate(e)}}}function jr(e,t){const r=J(e);if(r.isDisposed())throw new rr(w.ROUTER_DISPOSED);r.noValidate||function(e){if(void 0!==e){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[cloneRouter] Invalid dependencies: expected plain object or undefined, received ${g(e)}`);for(const t in e)if(Object.getOwnPropertyDescriptor(e,t)?.get)throw new TypeError(`[cloneRouter] Getters not allowed in dependencies: "${t}"`)}}(t);const n=r.routeGetStore(),o=[...n.tree.children.values()].map(e=>ot(e)),i=n.config,a=n.resolvedForwardMap,s=n.routeCustomFields,c=r.cloneOptions(),u=r.cloneDependencies(),[d,l]=r.getLifecycleFactories(),f=r.getPluginFactories(),h={...u,...t},p=new vr(o,c,h),m=Cr(p);for(const[e,t]of Object.entries(d))m.addDeactivateGuard(e,t);for(const[e,t]of Object.entries(l))m.addActivateGuard(e,t);f.length>0&&p.usePlugin(...f);const v=J(p).routeGetStore();return Object.assign(v.config.decoders,i.decoders),Object.assign(v.config.encoders,i.encoders),Object.assign(v.config.defaultParams,i.defaultParams),Object.assign(v.config.forwardMap,i.forwardMap),Object.assign(v.config.forwardFnMap,i.forwardFnMap),Object.assign(v.resolvedForwardMap,a),Object.assign(v.routeCustomFields,s),p}export{vr as Router,rr as RouterError,y as UNKNOWN_ROUTE,jr as cloneRouter,b as constants,yr as createRouter,w as errorCodes,R as events,Dr as getDependenciesApi,Cr as getLifecycleApi,Sr as getNavigator,Er as getPluginApi,Nr as getRoutesApi};//# sourceMappingURL=index.mjs.map
1
+ import{Router as e}from"./chunk-HZ7RFKT5.mjs";export{Router,RouterError,UNKNOWN_ROUTE,constants,errorCodes,events}from"./chunk-HZ7RFKT5.mjs";var t=(t=[],r={},a={})=>new e(t,r,a),r=new WeakMap,a=e=>{let t=r.get(e);return t||(t=Object.freeze({navigate:e.navigate,getState:e.getState,isActiveRoute:e.isActiveRoute,canNavigateTo:e.canNavigateTo,subscribe:e.subscribe}),r.set(e,t)),t};export{t as createRouter,a as getNavigator};//# sourceMappingURL=index.mjs.map