import{d as p,e as g,k as V,s as _,t as G,u as H,v as a,w as m}from"./chunk-VYUKN3XQ.js";import{c as C,d as L,e as Q,g as T,h as O,k as K}from"./chunk-AWMJHCA7.js";import{Ia as v,Na as F,Od as x,Qa as A,Sa as f,Ta as j,Xa as q,a as y,b,cb as w,qb as D}from"./chunk-XNQ3RS5P.js";var J="@ngrx/router-store/request",yt=p(J,g()),P="@ngrx/router-store/navigation",vt=p(P,g()),U="@ngrx/router-store/cancel",At=p(U,g()),z="@ngrx/router-store/error",Ct=p(z,g()),W="@ngrx/router-store/navigated",Tt=p(W,g());function Ot(e,t){let n=t;switch(n.type){case P:case z:case U:return{state:n.payload.routerState,navigationId:n.payload.event.id};default:return e}}var E=class{serialize(t){return{root:this.serializeRoute(t.root),url:t.url}}serializeRoute(t){let n=t.children.map(r=>this.serializeRoute(r));return{params:t.params,data:t.data,url:t.url,outlet:t.outlet,title:t.title,routeConfig:t.routeConfig?{path:t.routeConfig.path,pathMatch:t.routeConfig.pathMatch,redirectTo:t.routeConfig.redirectTo,outlet:t.routeConfig.outlet,title:typeof t.routeConfig.title=="string"?t.routeConfig.title:void 0}:null,queryParams:t.queryParams,fragment:t.fragment,firstChild:n[0],children:n}}},I=function(e){return e[e.PreActivation=1]="PreActivation",e[e.PostActivation=2]="PostActivation",e}(I||{}),X="router",B=new A("@ngrx/router-store Internal Configuration"),Y=new A("@ngrx/router-store Configuration");function it(e){return y({stateKey:X,serializer:E,navigationActionTiming:I.PreActivation},e)}var N=class{serialize(t){return{root:this.serializeRoute(t.root),url:t.url}}serializeRoute(t){let n=t.children.map(r=>this.serializeRoute(r));return{params:t.params,paramMap:t.paramMap,data:t.data,url:t.url,outlet:t.outlet,title:t.title,routeConfig:t.routeConfig?{component:t.routeConfig.component,path:t.routeConfig.path,pathMatch:t.routeConfig.pathMatch,redirectTo:t.routeConfig.redirectTo,outlet:t.routeConfig.outlet,title:t.routeConfig.title}:null,queryParams:t.queryParams,queryParamMap:t.queryParamMap,fragment:t.fragment,component:t.routeConfig?t.routeConfig.component:void 0,root:void 0,parent:void 0,firstChild:n[0],pathFromRoot:void 0,children:n}}},S=class{},l=function(e){return e[e.NONE=1]="NONE",e[e.ROUTER=2]="ROUTER",e[e.STORE=3]="STORE",e}(l||{}),Z=(()=>{let t=class t{constructor(r,s,o,h,R,u){this.store=r,this.router=s,this.serializer=o,this.errorHandler=h,this.config=R,this.activeRuntimeChecks=u,this.lastEvent=null,this.routerState=null,this.trigger=l.NONE,this.stateKey=this.config.stateKey,!H()&&x()&&(u!=null&&u.strictActionSerializability||u!=null&&u.strictStateSerializability)&&this.serializer instanceof N&&console.warn("@ngrx/router-store: The serializability runtime checks cannot be enabled with the FullRouterStateSerializer. The FullRouterStateSerializer has an unserializable router state and actions that are not serializable. To use the serializability runtime checks either use the MinimalRouterStateSerializer or implement a custom router state serializer."),this.setUpStoreStateListener(),this.setUpRouterEventsListener()}setUpStoreStateListener(){this.store.pipe(G(this.stateKey),v(this.store)).subscribe(([r,s])=>{this.navigateIfNeeded(r,s)})}navigateIfNeeded(r,s){if(!r||!r.state||this.trigger===l.ROUTER||this.lastEvent instanceof C)return;let o=r.state.url;st(this.router.url,o)||(this.storeState=s,this.trigger=l.STORE,this.router.navigateByUrl(o).catch(h=>{this.errorHandler.handleError(h)}))}setUpRouterEventsListener(){let r=this.config.navigationActionTiming===I.PostActivation,s;this.router.events.pipe(v(this.store)).subscribe(([o,h])=>{this.lastEvent=o,o instanceof C?(this.routerState=this.serializer.serialize(this.router.routerState.snapshot),this.trigger!==l.STORE&&(this.storeState=h,this.dispatchRouterRequest(o))):o instanceof O?(s=o,!r&&this.trigger!==l.STORE&&this.dispatchRouterNavigation(o)):o instanceof Q?(this.dispatchRouterCancel(o),this.reset()):o instanceof T?(this.dispatchRouterError(o),this.reset()):o instanceof L&&(this.trigger!==l.STORE&&(r&&this.dispatchRouterNavigation(s),this.dispatchRouterNavigated(o)),this.reset())})}dispatchRouterRequest(r){this.dispatchRouterAction(J,{event:r})}dispatchRouterNavigation(r){let s=this.serializer.serialize(r.state);this.dispatchRouterAction(P,{routerState:s,event:new O(r.id,r.url,r.urlAfterRedirects,s)})}dispatchRouterCancel(r){this.dispatchRouterAction(U,{storeState:this.storeState,event:r})}dispatchRouterError(r){this.dispatchRouterAction(z,{storeState:this.storeState,event:new T(r.id,r.url,"".concat(r))})}dispatchRouterNavigated(r){let s=this.serializer.serialize(this.router.routerState.snapshot);this.dispatchRouterAction(W,{event:r,routerState:s})}dispatchRouterAction(r,s){this.trigger=l.ROUTER;try{this.store.dispatch({type:r,payload:b(y({routerState:this.routerState},s),{event:this.config.routerState===0?s.event:{id:s.event.id,url:s.event.url,urlAfterRedirects:s.event.urlAfterRedirects}})})}finally{this.trigger=l.NONE}}reset(){this.trigger=l.NONE,this.storeState=null,this.routerState=null}};t.\u0275fac=function(s){return new(s||t)(f(_),f(K),f(S),f(D),f(Y),f(V))},t.\u0275prov=F({token:t,factory:t.\u0275fac});let e=t;return e})();function st(e,t){return $(e)===$(t)}function $(e){return(e==null?void 0:e.length)>0&&e[e.length-1]==="/"?e.substring(0,e.length-1):e}function Pt(e={}){return w([{provide:B,useValue:e},{provide:Y,useFactory:it,deps:[B]},{provide:S,useClass:e.serializer?e.serializer:e.routerState===0?N:E},{provide:q,multi:!0,useFactory(){return()=>j(Z)}},Z])}function ot(){return m(X)}function k(e=ot()){let t=a(e,i=>i&&i.state),n=a(t,i=>i&&i.root),r=a(n,i=>{if(!i)return;let c=i;for(;c.firstChild;)c=c.firstChild;return c}),s=a(n,i=>i&&i.fragment),o=a(n,i=>i&&i.queryParams),h=i=>a(o,c=>c&&c[i]),R=a(r,i=>i&&i.params),u=i=>a(R,c=>c&&c[i]),M=a(r,i=>i&&i.data),tt=i=>a(M,c=>c&&c[i]),et=a(t,i=>i&&i.url),rt=a(r,i=>{if(i!=null&&i.routeConfig)return typeof i.routeConfig.title=="string"?i.routeConfig.title:i.title});return{selectCurrentRoute:r,selectFragment:s,selectQueryParams:o,selectQueryParam:h,selectRouteParams:R,selectRouteParam:u,selectRouteData:M,selectRouteDataParam:tt,selectUrl:et,selectTitle:rt}}var at=m("router"),d=k(at),bt=d.selectCurrentRoute,Ft=d.selectQueryParams,jt=d.selectQueryParam,nt=d.selectRouteParams,qt=d.selectRouteParam,wt=d.selectRouteData,ct=d.selectUrl,Dt=a(nt,ct,(e,t)=>({params:e,url:t}));export{P as a,Tt as b,Ot as c,Pt as d,k as e,Ft as f,jt as g,nt as h,qt as i,wt as j,ct as k,Dt as l};