import{o as F}from"./chunk-C6uGsfWa.js";import{At as Gi,Co as jb,Ja as g,Jn as Nhe,Pa as eo,Wi as _$,ci as Vx,ei as V,hi as Wx,ht as Et,l as $c,s as $a,ti as Vb}from"./chunk-b0nJCs5_.js";var C=[`root`];var S=class s{metaService=g($c);route=g(eo);router=g(Et);pluginService=g(Gi);root=Nhe(`root`);urlSub;ngAfterViewInit(){this.urlSub=this.route.url.subscribe(()=>{this.loadRoute()})}ngOnDestroy(){this.urlSub&&this.urlSub.unsubscribe()}onRootClick(t){let e=t.target;if(!e)return;let i=e.closest(`a`);if(!i)return;let n=i.getAttribute(`href`)||``;!i.target&&n.startsWith(`/`)&&(t.preventDefault(),t.stopPropagation(),this.router.navigateByUrl(n))}loadRoute(){return F(this,null,function*(){if(yield this.pluginService.ensurePluginsAreLoaded(this.route.snapshot.data.pluginScope||`common`),!this.route.snapshot.data.parentRoute){V.error(`Missing "parentRoute" URL data to load plugin route `+this.route.snapshot.url);return}let t=`/`+this.route.snapshot.url.map(i=>i.path).join(`/`),e=this.pluginService.getRegisteredClientRoute(t,this.route.snapshot.data.parentRoute);if(!e)return V.info(`Could not find registered route ${t}`,{routes:this.pluginService.getAllRegisteredClientRoutes()}),this.router.navigate([`/404`],{skipLocationChange:!0});e.title&&this.metaService.setTitle(e.title),e.onMount({rootEl:this.root().nativeElement})})}static ɵfac=function(e){return new(e||s)};static ɵcmp=$a({type:s,selectors:[[`ng-component`]],viewQuery:function(e,i){e&1&&Wx(i.root,C,5),e&2&&_$()},decls:2,vars:0,consts:[[`root`,``],[3,`click`]],template:function(e,i){e&1&&(jb(0,`div`,1,0),Vx(`click`,function(b){return i.onRootClick(b)}),Vb())},encapsulation:2,changeDetection:1})};export{S as t};
//# debugId=e4a69dd6-575c-5d41-b9c2-73149f7af864
//# sourceMappingURL=chunk-Baa1q2FL2.js.map