import{d as F}from"./chunk-E2GGCCQI.js";import{$b as p,Ja as _,Rb as c,Tb as C,Ua as D,Vb as E,Wa as g,Xa as f,cc as v,kb as y,ob as R,pb as P}from"./chunk-V6BPA3D7.js";var d=class{attach(t){return this._attachedHost=t,t.attach(this)}detach(){let t=this._attachedHost;t!=null&&(this._attachedHost=null,t.detach())}get isAttached(){return this._attachedHost!=null}setAttachedHost(t){this._attachedHost=t}},m=class extends d{constructor(t,e,o,n,a){super(),this.component=t,this.viewContainerRef=e,this.injector=o,this.componentFactoryResolver=n,this.projectableNodes=a}},l=class extends d{constructor(t,e,o,n){super(),this.templateRef=t,this.viewContainerRef=e,this.context=o,this.injector=n}get origin(){return this.templateRef.elementRef}attach(t,e=this.context){return this.context=e,super.attach(t)}detach(){return this.context=void 0,super.detach()}},w=class extends d{constructor(t){super(),this.element=t instanceof R?t.nativeElement:t}},u=class{constructor(){this._isDisposed=!1,this.attachDomPortal=null}hasAttached(){return!!this._attachedPortal}attach(t){if(t instanceof m)return this._attachedPortal=t,this.attachComponentPortal(t);if(t instanceof l)return this._attachedPortal=t,this.attachTemplatePortal(t);if(this.attachDomPortal&&t instanceof w)return this._attachedPortal=t,this.attachDomPortal(t)}detach(){this._attachedPortal&&(this._attachedPortal.setAttachedHost(null),this._attachedPortal=null),this._invokeDisposeFn()}dispose(){this.hasAttached()&&this.detach(),this._invokeDisposeFn(),this._isDisposed=!0}setDisposeFn(t){this._disposeFn=t}_invokeDisposeFn(){this._disposeFn&&(this._disposeFn(),this._disposeFn=null)}};var M=class extends u{constructor(t,e,o,n,a){super(),this.outletElement=t,this._componentFactoryResolver=e,this._appRef=o,this._defaultInjector=n,this.attachDomPortal=i=>{this._document;let s=i.element;s.parentNode;let h=this._document.createComment("dom-portal");s.parentNode.insertBefore(h,s),this.outletElement.appendChild(s),this._attachedPortal=i,super.setDisposeFn(()=>{h.parentNode&&h.parentNode.replaceChild(s,h)})},this._document=a}attachComponentPortal(t){let o=(t.componentFactoryResolver||this._componentFactoryResolver).resolveComponentFactory(t.component),n;return t.viewContainerRef?(n=t.viewContainerRef.createComponent(o,t.viewContainerRef.length,t.injector||t.viewContainerRef.injector,t.projectableNodes||void 0),this.setDisposeFn(()=>n.destroy())):(n=o.create(t.injector||this._defaultInjector||y.NULL),this._appRef.attachView(n.hostView),this.setDisposeFn(()=>{this._appRef.viewCount>0&&this._appRef.detachView(n.hostView),n.destroy()})),this.outletElement.appendChild(this._getComponentRootNode(n)),this._attachedPortal=t,n}attachTemplatePortal(t){let e=t.viewContainerRef,o=e.createEmbeddedView(t.templateRef,t.context,{injector:t.injector});return o.rootNodes.forEach(n=>this.outletElement.appendChild(n)),o.detectChanges(),this.setDisposeFn(()=>{let n=e.indexOf(o);n!==-1&&e.remove(n)}),this._attachedPortal=t,o}dispose(){super.dispose(),this.outletElement.remove()}_getComponentRootNode(t){return t.hostView.rootNodes[0]}};var b=(()=>{class r extends l{constructor(e,o){super(e,o)}static{this.\u0275fac=function(o){return new(o||r)(c(C),c(p))}}static{this.\u0275dir=f({type:r,selectors:[["","cdkPortal",""]],exportAs:["cdkPortal"],standalone:!0,features:[v]})}}return r})();var U=(()=>{class r extends u{constructor(e,o,n){super(),this._componentFactoryResolver=e,this._viewContainerRef=o,this._isInitialized=!1,this.attached=new P,this.attachDomPortal=a=>{this._document;let i=a.element;i.parentNode;let s=this._document.createComment("dom-portal");a.setAttachedHost(this),i.parentNode.insertBefore(s,i),this._getRootNode().appendChild(i),this._attachedPortal=a,super.setDisposeFn(()=>{s.parentNode&&s.parentNode.replaceChild(i,s)})},this._document=n}get portal(){return this._attachedPortal}set portal(e){this.hasAttached()&&!e&&!this._isInitialized||(this.hasAttached()&&super.detach(),e&&super.attach(e),this._attachedPortal=e||null)}get attachedRef(){return this._attachedRef}ngOnInit(){this._isInitialized=!0}ngOnDestroy(){super.dispose(),this._attachedRef=this._attachedPortal=null}attachComponentPortal(e){e.setAttachedHost(this);let o=e.viewContainerRef!=null?e.viewContainerRef:this._viewContainerRef,a=(e.componentFactoryResolver||this._componentFactoryResolver).resolveComponentFactory(e.component),i=o.createComponent(a,o.length,e.injector||o.injector,e.projectableNodes||void 0);return o!==this._viewContainerRef&&this._getRootNode().appendChild(i.hostView.rootNodes[0]),super.setDisposeFn(()=>i.destroy()),this._attachedPortal=e,this._attachedRef=i,this.attached.emit(i),i}attachTemplatePortal(e){e.setAttachedHost(this);let o=this._viewContainerRef.createEmbeddedView(e.templateRef,e.context,{injector:e.injector});return super.setDisposeFn(()=>this._viewContainerRef.clear()),this._attachedPortal=e,this._attachedRef=o,this.attached.emit(o),o}_getRootNode(){let e=this._viewContainerRef.element.nativeElement;return e.nodeType===e.ELEMENT_NODE?e:e.parentNode}static{this.\u0275fac=function(o){return new(o||r)(c(E),c(p),c(F))}}static{this.\u0275dir=f({type:r,selectors:[["","cdkPortalOutlet",""]],inputs:{portal:[D.None,"cdkPortalOutlet","portal"]},outputs:{attached:"attached"},exportAs:["cdkPortalOutlet"],standalone:!0,features:[v]})}}return r})();var z=(()=>{class r{static{this.\u0275fac=function(o){return new(o||r)}}static{this.\u0275mod=g({type:r})}static{this.\u0275inj=_({})}}return r})();export{m as a,l as b,u as c,M as d,b as e,U as f,z as g};