import{Db as v,Dg as b,Na as g,Ob as S,Pb as R,Qg as w,Sa as h,ba as r,ha as c,ia as p,ld as C,mf as a,pb as d,pd as y,qb as f,vb as m}from"./chunk-YAKH5Q6V.js";import{i as u,j as l}from"./chunk-DM5LJ7VI.js";var k=["root"],Q=(()=>{let o=class o{metaService=r(b);route=r(C);router=r(y);pluginService=r(w);root=g("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 i=t.closest("a");if(!i)return;let n=i.getAttribute("href")||"";!i.target&&n.startsWith("/")&&(e.preventDefault(),e.stopPropagation(),this.router.navigateByUrl(n))}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(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)}),u(o,"\u0275cmp",h({type:o,selectors:[["ng-component"]],viewQuery:function(t,i){t&1&&S(i.root,k,5),t&2&&R()},decls:2,vars:0,consts:[["root",""],[3,"click"]],template:function(t,i){if(t&1){let n=m();d(0,"div",1,0),v("click",function(P){return c(n),p(i.onRootClick(P))}),f()}},encapsulation:2}));let s=o;return s})();export{Q as a};
/**i18n:197837fef124041a3f31333a5ea4afa44db030645e23ee7031f32704e8696a1d*/
//# sourceMappingURL=chunk-MLT2VTMM.js.map
