(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ngx-bootstrap/modal'), require('@wm/core'), require('@wm/components/base'), require('@angular/router'), require('@wavemaker/focus-trap'), require('@angular/common')) :
    typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'ngx-bootstrap/modal', '@wm/core', '@wm/components/base', '@angular/router', '@wavemaker/focus-trap', '@angular/common'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.dialogs = {}), global.ng.core, global.modal, global.wm.core, global.wm.components.base, global.ng.router, global.focusTrap, global.ng.common));
})(this, (function (exports, i0, i1, core, i2, router, focusTrap, i1$1) { 'use strict';

    function _interopNamespaceDefault(e) {
        var n = Object.create(null);
        if (e) {
            Object.keys(e).forEach(function (k) {
                if (k !== 'default') {
                    var d = Object.getOwnPropertyDescriptor(e, k);
                    Object.defineProperty(n, k, d.get ? d : {
                        enumerable: true,
                        get: function () { return e[k]; }
                    });
                }
            });
        }
        n.default = e;
        return Object.freeze(n);
    }

    var i0__namespace = /*#__PURE__*/_interopNamespaceDefault(i0);
    var i1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1);
    var i2__namespace = /*#__PURE__*/_interopNamespaceDefault(i2);
    var i1$1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1$1);

    const DEFAULT_CLS$1 = 'app-dialog-body modal-body';
    class DialogBodyDirective {
        constructor(elRef, dialogRef, bsModal, renderer) {
            this.dialogRef = dialogRef;
            this.renderer = renderer;
            core.addClass(elRef.nativeElement, DEFAULT_CLS$1);
            const subscription = bsModal.onShown.subscribe(() => {
                const dialogRoot = $(elRef.nativeElement).closest('.app-dialog')[0];
                let dialogRootContainer = $('body.wm-app')[0];
                // To identify the microfrontend, if body tag doesn't have wm-app class then app loading as micro-frontend
                if (!dialogRootContainer) {
                    const dialogBackrop = $('body > .modal-backdrop')[0];
                    const parentContainer = $('body > modal-container')[0];
                    dialogRootContainer = $('.wm-app')[0];
                    if (dialogRootContainer && parentContainer) {
                        if (dialogBackrop) {
                            this.renderer.appendChild(dialogRootContainer, dialogBackrop);
                        }
                        this.renderer.appendChild(dialogRootContainer, parentContainer);
                    }
                }
                const width = this.dialogRef.width;
                const height = this.dialogRef.height;
                if (height) {
                    setTimeout(e => {
                        core.setCSS($(elRef.nativeElement)[0], 'height', height);
                    });
                }
                if (dialogRoot) {
                    if (width) {
                        core.setCSS(dialogRoot, 'width', width);
                    }
                    core.setAttr(dialogRoot, 'tabindex', this.dialogRef.tabindex);
                    core.setAttr(dialogRoot, 'name', this.dialogRef.name);
                }
                subscription.unsubscribe();
            });
        }
        static { this.ɵfac = function DialogBodyDirective_Factory(t) { return new (t || DialogBodyDirective)(i0__namespace.ɵɵdirectiveInject(i0__namespace.ElementRef), i0__namespace.ɵɵdirectiveInject(i2.DialogRef), i0__namespace.ɵɵdirectiveInject(i1__namespace.BsModalService), i0__namespace.ɵɵdirectiveInject(i0__namespace.Renderer2)); }; }
        static { this.ɵdir = /*@__PURE__*/ i0__namespace.ɵɵdefineDirective({ type: DialogBodyDirective, selectors: [["div", "wmDialogBody", ""]], hostVars: 2, hostBindings: function DialogBodyDirective_HostBindings(rf, ctx) { if (rf & 2) {
                i0__namespace.ɵɵstyleProp("height", ctx.height);
            } } }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(DialogBodyDirective, [{
            type: i0.Directive,
            args: [{
                    selector: 'div[wmDialogBody]',
                }]
        }], () => [{ type: i0__namespace.ElementRef }, { type: undefined, decorators: [{
                    type: i0.Inject,
                    args: [i2.DialogRef]
                }] }, { type: i1__namespace.BsModalService }, { type: i0__namespace.Renderer2 }], { height: [{
                type: i0.HostBinding,
                args: ['style.height']
            }] }); })();

    const registerProps = () => {
        i2.register('wm-dialogfooter', new Map([
            ['class', i2.PROP_STRING],
            ['name', i2.PROP_STRING],
            ['show', { value: true, ...i2.PROP_BOOLEAN }]
        ]));
    };

    const WIDGET_INFO = {
        widgetType: 'wm-dialogfooter',
        hostClass: 'app-dialog-footer modal-footer'
    };
    class DialogFooterDirective extends i2.BaseComponent {
        static { this.initializeProps = registerProps(); }
        constructor(inj, explicitContext) {
            super(inj, WIDGET_INFO, explicitContext);
        }
        static { this.ɵfac = function DialogFooterDirective_Factory(t) { return new (t || DialogFooterDirective)(i0__namespace.ɵɵdirectiveInject(i0__namespace.Injector), i0__namespace.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
        static { this.ɵdir = /*@__PURE__*/ i0__namespace.ɵɵdefineDirective({ type: DialogFooterDirective, selectors: [["div", "wmDialogFooter", ""]], features: [i0__namespace.ɵɵProvidersFeature([
                    i2.provideAsWidgetRef(DialogFooterDirective)
                ]), i0__namespace.ɵɵInheritDefinitionFeature] }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(DialogFooterDirective, [{
            type: i0.Directive,
            args: [{
                    selector: 'div[wmDialogFooter]',
                    providers: [
                        i2.provideAsWidgetRef(DialogFooterDirective)
                    ]
                }]
        }], () => [{ type: i0__namespace.Injector }, { type: undefined, decorators: [{
                    type: i0.Inject,
                    args: ['EXPLICIT_CONTEXT']
                }, {
                    type: i0.Optional
                }] }], null); })();
    const focusTrapObj = {
        activeElement: null
    };
    const invokeOpenedCallback = (ref) => {
        if (ref) {
            setTimeout(() => {
                const root = core.findRootContainer(ref.$element);
                // if page styles have to be applied to dialog then dialog has to be child of page element.
                if (root) {
                    $('body > modal-container > div').wrap('<' + root + '/>');
                }
                ref.invokeEventCallback('opened', { $event: { type: 'opened' } });
                // focusTrapObj will create focus trap for the respective dialog according to the titleId assigned to them which is unique.
                const container = $('[aria-labelledby= ' + ref.titleId + ']')[0];
                const keyboardFocusableElements = [container.querySelectorAll('a, button, input, textarea, select, details, iframe, embed, object, summary dialog, audio[controls], video[controls], [contenteditable], [tabindex]:not([tabindex="-1"])')].filter(el => {
                    return (!el[0].hasAttribute('disabled') && !el[0].hasAttribute('hidden'));
                })[0];
                $(keyboardFocusableElements[0]).focus();
                focusTrapObj[ref.titleId] = focusTrap.createFocusTrap(container, {
                    onActivate: () => container.classList.add('is-active'),
                    onDeactivate: () => container.classList.remove('is-active'),
                    allowOutsideClick: true,
                    setReturnFocus: focusTrapObj.activeElement,
                });
                focusTrapObj[ref.titleId].activate();
                const openedDialogs = ref.dialogService.getOpenedDialogs();
                if (openedDialogs.length > 1) {
                    let zIndex = Number($("[aria-labelledby= " + openedDialogs[openedDialogs.length - 2].titleId + "]").css('z-index'));
                    $('[aria-labelledby= ' + ref.dialogService.getLastOpenedDialog().titleId + ']').css('z-index', zIndex + 2);
                    $('bs-modal-backdrop').css('z-index', zIndex + 1);
                }
            });
        }
    };
    const invokeClosedCallback = (ref) => {
        if (ref) {
            ref.invokeEventCallback('close');
            ref.dialogRef = undefined;
            const openedDialogs = ref.dialogService.getOpenedDialogs();
            if (openedDialogs.length >= 1) {
                let zIndex = Number($("[aria-labelledby= " + openedDialogs[openedDialogs.length - 1].titleId + "]").css('z-index'));
                $('bs-modal-backdrop').css('z-index', zIndex - 1);
            }
        }
    };
    class BaseDialog extends i2.BaseComponent {
        constructor(inj, config, modalOptions, explicitContext) {
            super(inj, config, explicitContext);
            this.modalOptions = modalOptions;
            this.titleId = 'wmdialog-' + core.generateGUId();
            this.dialogService = inj.get(core.AbstractDialogService);
            this.bsModal = inj.get(i1.BsModalService);
            const router$1 = inj.get(router.Router);
            const subscriptions = [
                this.bsModal.onShown.subscribe(({ id }) => {
                    const ref = this.dialogService.getLastOpenedDialog();
                    if (ref === this && !this.dialogId) {
                        // Always get the reference of last pushed dialog in the array for calling onOpen callback
                        invokeOpenedCallback(ref);
                        this.dialogId = id;
                    }
                }),
                this.bsModal.onShow.subscribe(() => {
                    focusTrapObj.activeElement = document.activeElement;
                }),
                this.bsModal.onHidden.subscribe((closeReason) => {
                    let ref = this.dialogService.getDialogRefFromClosedDialogs();
                    if (this.dialogId && closeReason?.id === this.dialogId) {
                        ref = this;
                    }
                    else if (closeReason === 'esc' || closeReason === 'backdrop-click') {
                        ref = this.dialogService.getLastOpenedDialog();
                    }
                    if (ref === this) {
                        this.dialogId = null;
                        // remove the dialog reference from opened dialogs and closed dialogs
                        this.dialogService.removeFromOpenedDialogs(ref);
                        this.dialogService.removeFromClosedDialogs(ref);
                        invokeClosedCallback(ref);
                        if (ref.closeCallBackFn) {
                            ref.closeCallBackFn();
                        }
                    }
                }),
                this.bsModal.onHide.subscribe(() => {
                    //  Will de-activate focus trap for the respective dialog when they are closed.
                    const ref = this.dialogService.getDialogRefFromClosedDialogs();
                    if (ref && focusTrapObj[ref.titleId] !== undefined) {
                        focusTrapObj[ref.titleId].deactivate();
                    }
                }),
                router$1.events.subscribe(e => {
                    if (e instanceof router.NavigationEnd) {
                        this.close();
                    }
                })
            ];
            this.registerDestroyListener(() => {
                this.dialogService.removeFromOpenedDialogs(this);
                this.dialogService.removeFromClosedDialogs(this);
                subscriptions.forEach(s => s.unsubscribe());
            });
        }
        /**
         * Opens the dialog
         * Subscribe to the onShown event emitter of bsModal and trigger on-opened event callback
         */
        open(initState) {
            // remove the popovers in the page to avoid the overlap with dialog
            // closePopover(this.$element); Commenting this line because it is causing regression(if we have dialog inside popover as partail content, then the dialog close is not working because on closing the popover the partial get destroyed.)
            // do not open the dialog again if it is already opened
            const duplicateDialogCheck = (openedDialog) => {
                return openedDialog === this;
            };
            if (this.dialogService.getOpenedDialogs().some(duplicateDialogCheck)) {
                return;
            }
            this.dialogService.addToOpenedDialogs(this);
            // extend the context with the initState
            Object.assign(this.context, initState);
            this.modalOptions.ariaLabelledBy = this.titleId;
            this.dialogRef = this.bsModal.show(this.getTemplateRef(), this.modalOptions);
            // Fix for [WMS-23948]: Focus moving out of active Dialog widget
            if (this.dialogService.getOpenedDialogs().length === 1 && (core.isMobile() || core.isMobileApp())) {
                const parentSelector = $('body > app-root')[0];
                parentSelector.setAttribute('aria-hidden', 'true');
            }
            $('.cdk-focus-trap-anchor').removeAttr('aria-hidden');
        }
        /**
         * closes the dialog
         * invokes the on-close event callback
         */
        close() {
            // remove the popovers in the page to avoid the overlap with dialog
            // closePopover(this.$element); Commenting this line because it is causing regression(if we have dialog inside popover as partail content, then the dialog close is not working because on closing the popover the partial get destroyed.)
            if (this.dialogRef) {
                this.dialogService.addToClosedDialogs(this);
                this.dialogRef.hide();
            }
        }
        /**
         * Register the dialog with the dialog service for programmatic access
         */
        register(scope) {
            // add scope along with name in the dialogRefsCollection Map while registering dialog
            // So that 2 dialogs having same name on different pages won't be overridden.
            this.dialogService.register(this.name, this, scope);
        }
        /**
         * De Register the dialog with the dialog service after dialog destruction
         */
        deRegister(scope) {
            this.dialogService.deRegister(this.name, scope);
        }
        onPropertyChange(key, nv, ov) {
            // ignore the class attribute.
            // Prevent the framework from setting the class on the host element.
            if (key === 'class' || key === 'name' || key === 'tabindex') {
                return;
            }
            else if (key === 'animation') {
                this.modalOptions.class = this.modalOptions.class.replace(' animated ' + ov, '');
                if (nv) {
                    this.modalOptions.class = this.modalOptions.class + ' animated ' + nv;
                }
            }
            super.onPropertyChange(key, nv, ov);
        }
        ngOnDestroy() {
            this.close();
            this.deRegister(this.viewParent);
            super.ngOnDestroy();
        }
        static { this.ɵfac = function BaseDialog_Factory(t) { return new (t || BaseDialog)(i0__namespace.ɵɵinject(i0__namespace.Injector), i0__namespace.ɵɵinject(i2.WidgetConfig), i0__namespace.ɵɵinject(i1__namespace.ModalOptions), i0__namespace.ɵɵinject('EXPLICIT_CONTEXT', 8)); }; }
        static { this.ɵprov = /*@__PURE__*/ i0__namespace.ɵɵdefineInjectable({ token: BaseDialog, factory: BaseDialog.ɵfac }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(BaseDialog, [{
            type: i0.Injectable
        }], () => [{ type: i0__namespace.Injector }, { type: undefined, decorators: [{
                    type: i0.Inject,
                    args: [i2.WidgetConfig]
                }] }, { type: i1__namespace.ModalOptions }, { type: undefined, decorators: [{
                    type: i0.Inject,
                    args: ['EXPLICIT_CONTEXT']
                }, {
                    type: i0.Optional
                }] }], null); })();

    const _c0 = ["wmDialogHeader", ""];
    const _c1 = (a0, a1, a2) => ({ width: a0, height: a1, margin: a2 });
    function DialogHeaderComponent_button_0_Template(rf, ctx) { if (rf & 1) {
        const _r1 = i0__namespace.ɵɵgetCurrentView();
        i0__namespace.ɵɵelementStart(0, "button", 5);
        i0__namespace.ɵɵlistener("click", function DialogHeaderComponent_button_0_Template_button_click_0_listener() { i0__namespace.ɵɵrestoreView(_r1); const ctx_r1 = i0__namespace.ɵɵnextContext(); return i0__namespace.ɵɵresetView(ctx_r1.closeDialog()); });
        i0__namespace.ɵɵelementStart(1, "span", 6);
        i0__namespace.ɵɵtext(2, "\u00D7");
        i0__namespace.ɵɵelementEnd()();
    } if (rf & 2) {
        const ctx_r1 = i0__namespace.ɵɵnextContext();
        i0__namespace.ɵɵattribute("aria-label", "Close " + (ctx_r1.title ? ctx_r1.title : "") + " dialog");
    } }
    function DialogHeaderComponent_ng_container_2_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogHeaderComponent_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainerStart(0);
        i0__namespace.ɵɵelementStart(1, "h1", 7);
        i0__namespace.ɵɵtemplate(2, DialogHeaderComponent_ng_container_2_ng_container_2_Template, 1, 0, "ng-container", 8);
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵelementContainerEnd();
    } if (rf & 2) {
        i0__namespace.ɵɵnextContext();
        const headerTemplate_r3 = i0__namespace.ɵɵreference(10);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
    } }
    function DialogHeaderComponent_ng_container_3_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogHeaderComponent_ng_container_3_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainerStart(0);
        i0__namespace.ɵɵelementStart(1, "h2", 7);
        i0__namespace.ɵɵtemplate(2, DialogHeaderComponent_ng_container_3_ng_container_2_Template, 1, 0, "ng-container", 8);
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵelementContainerEnd();
    } if (rf & 2) {
        i0__namespace.ɵɵnextContext();
        const headerTemplate_r3 = i0__namespace.ɵɵreference(10);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
    } }
    function DialogHeaderComponent_ng_container_4_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogHeaderComponent_ng_container_4_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainerStart(0);
        i0__namespace.ɵɵelementStart(1, "h3", 7);
        i0__namespace.ɵɵtemplate(2, DialogHeaderComponent_ng_container_4_ng_container_2_Template, 1, 0, "ng-container", 8);
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵelementContainerEnd();
    } if (rf & 2) {
        i0__namespace.ɵɵnextContext();
        const headerTemplate_r3 = i0__namespace.ɵɵreference(10);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
    } }
    function DialogHeaderComponent_ng_container_5_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogHeaderComponent_ng_container_5_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainerStart(0);
        i0__namespace.ɵɵelementStart(1, "h4", 7);
        i0__namespace.ɵɵtemplate(2, DialogHeaderComponent_ng_container_5_ng_container_2_Template, 1, 0, "ng-container", 8);
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵelementContainerEnd();
    } if (rf & 2) {
        i0__namespace.ɵɵnextContext();
        const headerTemplate_r3 = i0__namespace.ɵɵreference(10);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
    } }
    function DialogHeaderComponent_ng_container_6_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogHeaderComponent_ng_container_6_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainerStart(0);
        i0__namespace.ɵɵelementStart(1, "h5", 7);
        i0__namespace.ɵɵtemplate(2, DialogHeaderComponent_ng_container_6_ng_container_2_Template, 1, 0, "ng-container", 8);
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵelementContainerEnd();
    } if (rf & 2) {
        i0__namespace.ɵɵnextContext();
        const headerTemplate_r3 = i0__namespace.ɵɵreference(10);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
    } }
    function DialogHeaderComponent_ng_container_7_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogHeaderComponent_ng_container_7_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainerStart(0);
        i0__namespace.ɵɵelementStart(1, "h6", 7);
        i0__namespace.ɵɵtemplate(2, DialogHeaderComponent_ng_container_7_ng_container_2_Template, 1, 0, "ng-container", 8);
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵelementContainerEnd();
    } if (rf & 2) {
        i0__namespace.ɵɵnextContext();
        const headerTemplate_r3 = i0__namespace.ɵɵreference(10);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
    } }
    function DialogHeaderComponent_ng_container_8_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogHeaderComponent_ng_container_8_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainerStart(0);
        i0__namespace.ɵɵelementStart(1, "h4", 7);
        i0__namespace.ɵɵtemplate(2, DialogHeaderComponent_ng_container_8_ng_container_2_Template, 1, 0, "ng-container", 8);
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵelementContainerEnd();
    } if (rf & 2) {
        i0__namespace.ɵɵnextContext();
        const headerTemplate_r3 = i0__namespace.ɵɵreference(10);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
    } }
    function DialogHeaderComponent_ng_template_9_i_0_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelement(0, "i", 13);
    } if (rf & 2) {
        const ctx_r1 = i0__namespace.ɵɵnextContext(2);
        i0__namespace.ɵɵproperty("ngClass", ctx_r1.iconclass)("ngStyle", i0__namespace.ɵɵpureFunction3(2, _c1, ctx_r1.iconwidth, ctx_r1.iconheight, ctx_r1.iconmargin));
    } }
    function DialogHeaderComponent_ng_template_9_img_1_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelement(0, "img", 14);
        i0__namespace.ɵɵpipe(1, "image");
    } if (rf & 2) {
        const ctx_r1 = i0__namespace.ɵɵnextContext(2);
        i0__namespace.ɵɵproperty("src", i0__namespace.ɵɵpipeBind1(1, 2, ctx_r1.iconurl), i0__namespace.ɵɵsanitizeUrl)("ngStyle", i0__namespace.ɵɵpureFunction3(4, _c1, ctx_r1.iconwidth, ctx_r1.iconheight, ctx_r1.iconmargin));
    } }
    function DialogHeaderComponent_ng_template_9_span_3_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelement(0, "span", 15);
    } if (rf & 2) {
        const ctx_r1 = i0__namespace.ɵɵnextContext(2);
        i0__namespace.ɵɵproperty("title", ctx_r1.subheading)("textContent", ctx_r1.subheading);
    } }
    function DialogHeaderComponent_ng_template_9_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵtemplate(0, DialogHeaderComponent_ng_template_9_i_0_Template, 1, 6, "i", 9)(1, DialogHeaderComponent_ng_template_9_img_1_Template, 2, 8, "img", 10);
        i0__namespace.ɵɵelement(2, "span", 11);
        i0__namespace.ɵɵtemplate(3, DialogHeaderComponent_ng_template_9_span_3_Template, 1, 2, "span", 12);
    } if (rf & 2) {
        const ctx_r1 = i0__namespace.ɵɵnextContext();
        i0__namespace.ɵɵproperty("ngIf", ctx_r1.iconclass && !ctx_r1.iconurl);
        i0__namespace.ɵɵadvance();
        i0__namespace.ɵɵproperty("ngIf", ctx_r1.iconurl);
        i0__namespace.ɵɵadvance();
        i0__namespace.ɵɵproperty("textContent", ctx_r1.heading)("id", ctx_r1.titleid);
        i0__namespace.ɵɵadvance();
        i0__namespace.ɵɵproperty("ngIf", ctx_r1.subheading);
    } }
    const DEFAULT_CLS = 'app-dialog-header modal-header';
    const DEFAULT_ICON_DIMENSIONS = '21px';
    class DialogHeaderComponent {
        get isClosable() {
            return core.toBoolean(this.closable);
        }
        constructor(elRef, dialogRef) {
            this.dialogRef = dialogRef;
            this.iconwidth = DEFAULT_ICON_DIMENSIONS;
            this.iconheight = DEFAULT_ICON_DIMENSIONS;
            this.closable = true;
            this.headinglevel = 'h4';
            core.addClass(elRef.nativeElement, DEFAULT_CLS);
        }
        closeDialog() {
            this.dialogRef.close();
        }
        static { this.ɵfac = function DialogHeaderComponent_Factory(t) { return new (t || DialogHeaderComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.ElementRef), i0__namespace.ɵɵdirectiveInject(i2.DialogRef)); }; }
        static { this.ɵcmp = /*@__PURE__*/ i0__namespace.ɵɵdefineComponent({ type: DialogHeaderComponent, selectors: [["div", "wmDialogHeader", ""]], inputs: { iconwidth: "iconwidth", iconheight: "iconheight", iconmargin: "iconmargin", iconclass: "iconclass", iconurl: "iconurl", closable: "closable", heading: "heading", headinglevel: "headinglevel", subheading: "subheading", titleid: "titleid", title: "title" }, attrs: _c0, decls: 11, vars: 8, consts: [["headerTemplate", ""], ["class", "app-dialog-close close", "title", "Close", 3, "click", 4, "ngIf"], [3, "ngSwitch"], [4, "ngSwitchCase"], [4, "ngSwitchDefault"], ["title", "Close", 1, "app-dialog-close", "close", 3, "click"], ["aria-hidden", "true"], [1, "app-dialog-title", "modal-title"], [4, "ngTemplateOutlet"], [3, "ngClass", "ngStyle", 4, "ngIf"], ["data-identifier", "img", 3, "src", "ngStyle", 4, "ngIf"], [1, "dialog-heading", 3, "textContent", "id"], ["class", "dialog-sub-heading", 3, "title", "textContent", 4, "ngIf"], [3, "ngClass", "ngStyle"], ["data-identifier", "img", 3, "src", "ngStyle"], [1, "dialog-sub-heading", 3, "title", "textContent"]], template: function DialogHeaderComponent_Template(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵtemplate(0, DialogHeaderComponent_button_0_Template, 3, 1, "button", 1);
                i0__namespace.ɵɵelementContainerStart(1, 2);
                i0__namespace.ɵɵtemplate(2, DialogHeaderComponent_ng_container_2_Template, 3, 1, "ng-container", 3)(3, DialogHeaderComponent_ng_container_3_Template, 3, 1, "ng-container", 3)(4, DialogHeaderComponent_ng_container_4_Template, 3, 1, "ng-container", 3)(5, DialogHeaderComponent_ng_container_5_Template, 3, 1, "ng-container", 3)(6, DialogHeaderComponent_ng_container_6_Template, 3, 1, "ng-container", 3)(7, DialogHeaderComponent_ng_container_7_Template, 3, 1, "ng-container", 3)(8, DialogHeaderComponent_ng_container_8_Template, 3, 1, "ng-container", 4);
                i0__namespace.ɵɵelementContainerEnd();
                i0__namespace.ɵɵtemplate(9, DialogHeaderComponent_ng_template_9_Template, 4, 5, "ng-template", null, 0, i0__namespace.ɵɵtemplateRefExtractor);
            } if (rf & 2) {
                i0__namespace.ɵɵproperty("ngIf", ctx.isClosable);
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngSwitch", ctx.headinglevel);
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngSwitchCase", "h1");
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngSwitchCase", "h2");
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngSwitchCase", "h3");
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngSwitchCase", "h4");
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngSwitchCase", "h5");
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngSwitchCase", "h6");
            } }, dependencies: [i1$1__namespace.NgClass, i1$1__namespace.NgIf, i1$1__namespace.NgTemplateOutlet, i1$1__namespace.NgStyle, i1$1__namespace.NgSwitch, i1$1__namespace.NgSwitchCase, i1$1__namespace.NgSwitchDefault, i2__namespace.TextContentDirective, i2__namespace.ImagePipe], encapsulation: 2 }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(DialogHeaderComponent, [{
            type: i0.Component,
            args: [{ selector: 'div[wmDialogHeader]', template: "<button (click)=\"closeDialog();\" *ngIf=\"isClosable\"\n        [attr.aria-label]=\"'Close ' + (title ? title : '') + ' dialog'\" class=\"app-dialog-close close\" title=\"Close\">\n    <span aria-hidden=\"true\">&times;</span>\n</button>\n\n<ng-container [ngSwitch]=\"headinglevel\">\n    <ng-container *ngSwitchCase=\"'h1'\">\n        <h1 class=\"app-dialog-title modal-title\">\n            <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n        </h1>\n    </ng-container>\n    <ng-container *ngSwitchCase=\"'h2'\">\n        <h2 class=\"app-dialog-title modal-title\">\n            <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n        </h2>\n    </ng-container>\n    <ng-container *ngSwitchCase=\"'h3'\">\n        <h3 class=\"app-dialog-title modal-title\">\n            <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n        </h3>\n    </ng-container>\n    <ng-container *ngSwitchCase=\"'h4'\">\n        <h4 class=\"app-dialog-title modal-title\">\n            <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n        </h4>\n    </ng-container>\n    <ng-container *ngSwitchCase=\"'h5'\">\n        <h5 class=\"app-dialog-title modal-title\">\n            <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n        </h5>\n    </ng-container>\n    <ng-container *ngSwitchCase=\"'h6'\">\n        <h6 class=\"app-dialog-title modal-title\">\n            <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n        </h6>\n    </ng-container>\n    <ng-container *ngSwitchDefault>\n        <h4 class=\"app-dialog-title modal-title\">\n            <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n        </h4>\n    </ng-container>\n</ng-container>\n\n<ng-template #headerTemplate>\n    <i [ngClass]=\"iconclass\" [ngStyle]=\"{width: iconwidth, height: iconheight, margin: iconmargin}\" *ngIf=\"iconclass && !iconurl\"></i>\n    <img data-identifier=\"img\" [src]=\"iconurl | image\" *ngIf=\"iconurl\" [ngStyle]=\"{width: iconwidth, height: iconheight, margin: iconmargin}\"/>\n    <span class=\"dialog-heading\" [textContent]=\"heading\" [id]=\"titleid\"></span>\n    <span class=\"dialog-sub-heading\" *ngIf=\"subheading\" [title]=\"subheading\" [textContent]=\"subheading\"></span>\n</ng-template>\n" }]
        }], () => [{ type: i0__namespace.ElementRef }, { type: BaseDialog, decorators: [{
                    type: i0.Inject,
                    args: [i2.DialogRef]
                }] }], { iconwidth: [{
                type: i0.Input
            }], iconheight: [{
                type: i0.Input
            }], iconmargin: [{
                type: i0.Input
            }], iconclass: [{
                type: i0.Input
            }], iconurl: [{
                type: i0.Input
            }], closable: [{
                type: i0.Input
            }], heading: [{
                type: i0.Input
            }], headinglevel: [{
                type: i0.Input
            }], subheading: [{
                type: i0.Input
            }], titleid: [{
                type: i0.Input
            }], title: [{
                type: i0.Input
            }] }); })();
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassDebugInfo(DialogHeaderComponent, { className: "DialogHeaderComponent", filePath: "dialog-header/dialog-header.component.ts", lineNumber: 15 }); })();

    const components = [
        DialogBodyDirective,
        DialogFooterDirective,
        DialogHeaderComponent
    ];
    class DialogModule {
        static { this.ɵfac = function DialogModule_Factory(t) { return new (t || DialogModule)(); }; }
        static { this.ɵmod = /*@__PURE__*/ i0__namespace.ɵɵdefineNgModule({ type: DialogModule }); }
        static { this.ɵinj = /*@__PURE__*/ i0__namespace.ɵɵdefineInjector({ imports: [i1$1.CommonModule,
                i1.ModalModule,
                i2.WmComponentsModule] }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(DialogModule, [{
            type: i0.NgModule,
            args: [{
                    imports: [
                        i1$1.CommonModule,
                        i1.ModalModule,
                        i2.WmComponentsModule
                    ],
                    declarations: [...components],
                    exports: [...components]
                }]
        }], null, null); })();
    (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0__namespace.ɵɵsetNgModuleScope(DialogModule, { declarations: [DialogBodyDirective,
            DialogFooterDirective,
            DialogHeaderComponent], imports: [i1$1.CommonModule,
            i1.ModalModule,
            i2.WmComponentsModule], exports: [DialogBodyDirective,
            DialogFooterDirective,
            DialogHeaderComponent] }); })();

    exports.BaseDialog = BaseDialog;
    exports.DialogBodyDirective = DialogBodyDirective;
    exports.DialogFooterDirective = DialogFooterDirective;
    exports.DialogHeaderComponent = DialogHeaderComponent;
    exports.DialogModule = DialogModule;

}));
