!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/animations"),require("@angular/common"),require("primeng/dom"),require("rxjs")):"function"==typeof define&&define.amd?define("primeng/dynamicdialog",["exports","@angular/core","@angular/animations","@angular/common","primeng/dom","rxjs"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).primeng=e.primeng||{},e.primeng.dynamicdialog={}),e.ng.core,e.ng.animations,e.ng.common,e.primeng.dom,e.rxjs)}(this,(function(e,t,n,o,i,a){"use strict";var s=function(e){this.viewContainerRef=e};s.decorators=[{type:t.Directive,args:[{selector:"[pDynamicDialogContent]"}]}],s.ctorParameters=function(){return[{type:t.ViewContainerRef}]};var r=function(){},l=function(){function e(){this._onClose=new a.Subject,this.onClose=this._onClose.asObservable(),this._onDestroy=new a.Subject,this.onDestroy=this._onDestroy.asObservable()}return e.prototype.close=function(e){this._onClose.next(e)},e.prototype.destroy=function(){this._onDestroy.next()},e}(),c=n.animation([n.style({transform:"{{transform}}",opacity:0}),n.animate("{{transition}}",n.style({transform:"none",opacity:1}))]),d=n.animation([n.animate("{{transition}}",n.style({transform:"{{transform}}",opacity:0}))]),p=function(){function e(e,t,n,o,i,a){this.componentFactoryResolver=e,this.cd=t,this.renderer=n,this.config=o,this.dialogRef=i,this.zone=a,this.visible=!0,this.transformOptions="scale(0.7)"}return e.prototype.ngAfterViewInit=function(){this.loadChildComponent(this.childComponentType),this.cd.detectChanges()},e.prototype.loadChildComponent=function(e){var t=this.componentFactoryResolver.resolveComponentFactory(e),n=this.insertionPoint.viewContainerRef;n.clear(),this.componentRef=n.createComponent(t)},e.prototype.moveOnTop=function(){if(!1!==this.config.autoZIndex){var e=(this.config.baseZIndex||0)+ ++i.DomHandler.zindex;this.container.style.zIndex=String(e),this.maskViewChild.nativeElement.style.zIndex=String(e-1)}},e.prototype.onAnimationStart=function(e){switch(e.toState){case"visible":this.container=e.element,this.wrapper=this.container.parentElement,this.moveOnTop(),this.bindGlobalListeners(),!1!==this.config.modal&&this.enableModality(),this.focus();break;case"void":this.onContainerDestroy()}},e.prototype.onAnimationEnd=function(e){"void"===e.toState&&this.dialogRef.destroy()},e.prototype.onContainerDestroy=function(){this.unbindGlobalListeners(),!1!==this.config.modal&&this.disableModality(),this.container=null},e.prototype.close=function(){this.visible=!1,this.cd.markForCheck()},e.prototype.hide=function(){this.dialogRef&&this.dialogRef.close()},e.prototype.enableModality=function(){var e=this;!1!==this.config.closable&&this.config.dismissableMask&&(this.maskClickListener=this.renderer.listen(this.wrapper,"click",(function(t){e.wrapper&&e.wrapper.isSameNode(t.target)&&e.hide()}))),!1!==this.config.modal&&i.DomHandler.addClass(document.body,"p-overflow-hidden")},e.prototype.disableModality=function(){this.wrapper&&(this.config.dismissableMask&&this.unbindMaskClickListener(),!1!==this.config.modal&&i.DomHandler.removeClass(document.body,"p-overflow-hidden"),this.cd.destroyed||this.cd.detectChanges())},e.prototype.onKeydown=function(e){if(9===e.which){e.preventDefault();var t=i.DomHandler.getFocusableElements(this.container);if(t&&t.length>0)if(t[0].ownerDocument.activeElement){var n=t.indexOf(t[0].ownerDocument.activeElement);e.shiftKey?-1==n||0===n?t[t.length-1].focus():t[n-1].focus():-1==n||n===t.length-1?t[0].focus():t[n+1].focus()}else t[0].focus()}},e.prototype.focus=function(){var e=i.DomHandler.findSingle(this.container,"[autofocus]");e&&this.zone.runOutsideAngular((function(){setTimeout((function(){return e.focus()}),5)}))},e.prototype.bindGlobalListeners=function(){this.bindDocumentKeydownListener(),!1!==this.config.closeOnEscape&&!1!==this.config.closable&&this.bindDocumentEscapeListener()},e.prototype.unbindGlobalListeners=function(){this.unbindDocumentKeydownListener(),this.unbindDocumentEscapeListener()},e.prototype.bindDocumentKeydownListener=function(){var e=this;this.zone.runOutsideAngular((function(){e.documentKeydownListener=e.onKeydown.bind(e),window.document.addEventListener("keydown",e.documentKeydownListener)}))},e.prototype.unbindDocumentKeydownListener=function(){this.documentKeydownListener&&(window.document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},e.prototype.bindDocumentEscapeListener=function(){var e=this,t=this.maskViewChild?this.maskViewChild.nativeElement.ownerDocument:"document";this.documentEscapeListener=this.renderer.listen(t,"keydown",(function(t){27==t.which&&parseInt(e.container.style.zIndex)==i.DomHandler.zindex+(e.config.baseZIndex?e.config.baseZIndex:0)&&e.hide()}))},e.prototype.unbindDocumentEscapeListener=function(){this.documentEscapeListener&&(this.documentEscapeListener(),this.documentEscapeListener=null)},e.prototype.unbindMaskClickListener=function(){this.maskClickListener&&(this.maskClickListener(),this.maskClickListener=null)},e.prototype.ngOnDestroy=function(){this.onContainerDestroy(),this.componentRef&&this.componentRef.destroy()},e}();p.decorators=[{type:t.Component,args:[{selector:"p-dynamicDialog",template:'\n