import{Bb as v,Lh as b,Mb as S,Na as g,Nb as R,Sa as h,Yh as w,aa as r,ha as c,ia as p,nb as d,ob as f,rd as C,tb as m,ug as a,vd as y}from"./chunk-K5TQVRW4.js";import{i as u,j as l}from"./chunk-RYEVWIKN.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:3ab8a6a12ff574644ebf46057f36e5643b4288edb94e57af377eaee98d8b77d4*/
//# sourceMappingURL=chunk-O23QGZEA.js.map
