import{Ab as v,Dh as b,Lb as S,Ma as g,Mb as R,Qh as w,Ra as h,aa as r,ga as c,ha as p,kd as C,mb as d,mg as a,nb as f,od as y,sb as m}from"./chunk-IDYB4NXF.js";import{i as u,j as l}from"./chunk-AI7IVZV2.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:1cf7c077143c4c267fdafbe5508f191afcef21bad6aba22a3a8dc180e1003753*/
//# sourceMappingURL=chunk-SMRGZLN2.js.map
