import{Db as v,Eb as S,Fb as R,Ga as n,La as g,Xe as a,bd as C,ed as y,ia as l,ib as h,ig as b,ja as p,jb as d,ob as f,qg as w,wb as m}from"./chunk-4JM6MIZ5.js";import{i as u,j as c}from"./chunk-QJQRWPYR.js";var _=["root"],V=(()=>{let o=class o{metaService;route;router;pluginService;root;urlSub;constructor(e,t,i,r){this.metaService=e,this.route=t,this.router=i,this.pluginService=r}ngAfterViewInit(){this.urlSub=this.route.url.subscribe(()=>{this.loadRoute()})}ngOnDestroy(){this.urlSub&&this.urlSub.unsubscribe()}onRootClick(e){let t=e.target;if(!t)return;let i=t.closest("a");if(!i)return;let r=i.getAttribute("href")||"";!i.target&&r.startsWith("/")&&(e.preventDefault(),e.stopPropagation(),this.router.navigateByUrl(r))}loadRoute(){return c(this,null,function*(){if(yield this.pluginService.ensurePluginsAreLoaded(this.route.snapshot.data.pluginScope||"common"),!this.route.snapshot.data.parentRoute){a.error('Missing "parentRoute" URL data to load plugin route '+this.route.snapshot.url);return}let e="/"+this.route.snapshot.url.map(i=>i.path).join("/"),t=this.pluginService.getRegisteredClientRoute(e,this.route.snapshot.data.parentRoute);if(!t)return a.info(`Could not find registered route ${e}`,{routes:this.pluginService.getAllRegisteredClientRoutes()}),this.router.navigate(["/404"],{skipLocationChange:!0});t.title&&this.metaService.setTitle(t.title),t.onMount({rootEl:this.root.nativeElement})})}};u(o,"\u0275fac",function(t){return new(t||o)(n(w),n(C),n(y),n(b))}),u(o,"\u0275cmp",g({type:o,selectors:[["ng-component"]],viewQuery:function(t,i){if(t&1&&v(_,5),t&2){let r;S(r=R())&&(i.root=r.first)}},decls:2,vars:0,consts:[["root",""],[3,"click"]],template:function(t,i){if(t&1){let r=f();h(0,"div",1,0),m("click",function(P){return l(r),p(i.onRootClick(P))}),d()}},encapsulation:2}));let s=o;return s})();export{V as a};
/**i18n:68865f44f2a527c44cf5136a17c76a0ff8308c2bae5c7c8d50070a5fb9847c44*/
//# sourceMappingURL=chunk-WCNBSIIG.js.map
