import{Fc as f,Gd as v,Ib as d,Kd as S,Mh as C,Na as c,Rb as m,Sb as h,ba as r,qb as p,rb as g,zf as a,zh as R}from"./chunk-RKSLYOIW.js";import{i as u,j as l}from"./chunk-QQ7SJNXU.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:5a85df092a135682c90bae008e37ec28160e04e5f445e29af2927333ba91ffa1*/
//# sourceMappingURL=chunk-GU6SHHME.js.map
