import{Af as a,Ah as R,Fc as f,Gd as v,Ib as d,Kd as S,Na as c,Nh as C,Rb as m,Sb as h,ba as r,qb as p,rb as g}from"./chunk-NY4TI4KT.js";import{i as u,j as l}from"./chunk-IQVXR75E.js";var y=["root"],E=(()=>{let i=class i{metaService=r(R);route=r(v);router=r(S);pluginService=r(C);root=f("root");urlSub;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 o=t.closest("a");if(!o)return;let s=o.getAttribute("href")||"";!o.target&&s.startsWith("/")&&(e.preventDefault(),e.stopPropagation(),this.router.navigateByUrl(s))}loadRoute(){return l(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(o=>o.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(i,"\u0275fac",function(t){return new(t||i)}),u(i,"\u0275cmp",c({type:i,selectors:[["ng-component"]],viewQuery:function(t,o){t&1&&m(o.root,y,5),t&2&&h()},decls:2,vars:0,consts:[["root",""],[3,"click"]],template:function(t,o){t&1&&(p(0,"div",1,0),d("click",function(b){return o.onRootClick(b)}),g())},encapsulation:2}));let n=i;return n})();export{E as a};
/**i18n:347eeb695970c32bc275618edc2e751c67145d9fc3012e70543c114a99b9e016*/
//# sourceMappingURL=chunk-NTXXZ4RS.js.map
