import * as i0 from '@angular/core';
import { Directive, Inject, HostBinding, Optional, Injectable, Component, Input, NgModule } from '@angular/core';
import * as i1 from 'ngx-bootstrap/modal';
import { BsModalService, ModalModule } from 'ngx-bootstrap/modal';
import { addClass, setCSS, setAttr, findRootContainer, generateGUId, AbstractDialogService, isMobile, isMobileApp, toBoolean } from '@wm/core';
import * as i2 from '@wm/components/base';
import { DialogRef, PROP_STRING, PROP_BOOLEAN, register, BaseComponent, provideAsWidgetRef, WidgetConfig, WmComponentsModule } from '@wm/components/base';
import { Router, NavigationEnd } from '@angular/router';
import { createFocusTrap } from '@wavemaker/focus-trap';
import * as i1$1 from '@angular/common';
import { CommonModule } from '@angular/common';

const DEFAULT_CLS$1 = 'app-dialog-body modal-body';
class DialogBodyDirective {
    constructor(elRef, dialogRef, bsModal, renderer) {
        this.dialogRef = dialogRef;
        this.renderer = renderer;
        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 => {
                    setCSS($(elRef.nativeElement)[0], 'height', height);
                });
            }
            if (dialogRoot) {
                if (width) {
                    setCSS(dialogRoot, 'width', width);
                }
                setAttr(dialogRoot, 'tabindex', this.dialogRef.tabindex);
                setAttr(dialogRoot, 'name', this.dialogRef.name);
            }
            subscription.unsubscribe();
        });
    }
    static { this.ɵfac = function DialogBodyDirective_Factory(t) { return new (t || DialogBodyDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(DialogRef), i0.ɵɵdirectiveInject(i1.BsModalService), i0.ɵɵdirectiveInject(i0.Renderer2)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: DialogBodyDirective, selectors: [["div", "wmDialogBody", ""]], hostVars: 2, hostBindings: function DialogBodyDirective_HostBindings(rf, ctx) { if (rf & 2) {
            i0.ɵɵstyleProp("height", ctx.height);
        } } }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DialogBodyDirective, [{
        type: Directive,
        args: [{
                selector: 'div[wmDialogBody]',
            }]
    }], () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
                type: Inject,
                args: [DialogRef]
            }] }, { type: i1.BsModalService }, { type: i0.Renderer2 }], { height: [{
            type: HostBinding,
            args: ['style.height']
        }] }); })();

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

const WIDGET_INFO = {
    widgetType: 'wm-dialogfooter',
    hostClass: 'app-dialog-footer modal-footer'
};
class DialogFooterDirective extends 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.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: DialogFooterDirective, selectors: [["div", "wmDialogFooter", ""]], features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(DialogFooterDirective)
            ]), i0.ɵɵInheritDefinitionFeature] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DialogFooterDirective, [{
        type: Directive,
        args: [{
                selector: 'div[wmDialogFooter]',
                providers: [
                    provideAsWidgetRef(DialogFooterDirective)
                ]
            }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], null); })();

const eventsRegistered = false;
const focusTrapObj = {
    activeElement: null
};
const invokeOpenedCallback = (ref) => {
    if (ref) {
        setTimeout(() => {
            const root = 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] = 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 BaseComponent {
    constructor(inj, config, modalOptions, explicitContext) {
        super(inj, config, explicitContext);
        this.modalOptions = modalOptions;
        this.titleId = 'wmdialog-' + generateGUId();
        this.dialogService = inj.get(AbstractDialogService);
        this.bsModal = inj.get(BsModalService);
        const router = inj.get(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.events.subscribe(e => {
                if (e instanceof 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 && (isMobile() || 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.ɵɵinject(i0.Injector), i0.ɵɵinject(WidgetConfig), i0.ɵɵinject(i1.ModalOptions), i0.ɵɵinject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: BaseDialog, factory: BaseDialog.ɵfac }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseDialog, [{
        type: Injectable
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: Inject,
                args: [WidgetConfig]
            }] }, { type: i1.ModalOptions }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: 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.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 5);
    i0.ɵɵlistener("click", function DialogHeaderComponent_button_0_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.closeDialog()); });
    i0.ɵɵelementStart(1, "span", 6);
    i0.ɵɵtext(2, "\u00D7");
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵ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.ɵɵelementContainer(0);
} }
function DialogHeaderComponent_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "h1", 7);
    i0.ɵɵtemplate(2, DialogHeaderComponent_ng_container_2_ng_container_2_Template, 1, 0, "ng-container", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    const headerTemplate_r3 = i0.ɵɵreference(10);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
} }
function DialogHeaderComponent_ng_container_3_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function DialogHeaderComponent_ng_container_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "h2", 7);
    i0.ɵɵtemplate(2, DialogHeaderComponent_ng_container_3_ng_container_2_Template, 1, 0, "ng-container", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    const headerTemplate_r3 = i0.ɵɵreference(10);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
} }
function DialogHeaderComponent_ng_container_4_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function DialogHeaderComponent_ng_container_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "h3", 7);
    i0.ɵɵtemplate(2, DialogHeaderComponent_ng_container_4_ng_container_2_Template, 1, 0, "ng-container", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    const headerTemplate_r3 = i0.ɵɵreference(10);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
} }
function DialogHeaderComponent_ng_container_5_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function DialogHeaderComponent_ng_container_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "h4", 7);
    i0.ɵɵtemplate(2, DialogHeaderComponent_ng_container_5_ng_container_2_Template, 1, 0, "ng-container", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    const headerTemplate_r3 = i0.ɵɵreference(10);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
} }
function DialogHeaderComponent_ng_container_6_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function DialogHeaderComponent_ng_container_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "h5", 7);
    i0.ɵɵtemplate(2, DialogHeaderComponent_ng_container_6_ng_container_2_Template, 1, 0, "ng-container", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    const headerTemplate_r3 = i0.ɵɵreference(10);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
} }
function DialogHeaderComponent_ng_container_7_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function DialogHeaderComponent_ng_container_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "h6", 7);
    i0.ɵɵtemplate(2, DialogHeaderComponent_ng_container_7_ng_container_2_Template, 1, 0, "ng-container", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    const headerTemplate_r3 = i0.ɵɵreference(10);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
} }
function DialogHeaderComponent_ng_container_8_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainer(0);
} }
function DialogHeaderComponent_ng_container_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "h4", 7);
    i0.ɵɵtemplate(2, DialogHeaderComponent_ng_container_8_ng_container_2_Template, 1, 0, "ng-container", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    const headerTemplate_r3 = i0.ɵɵreference(10);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", headerTemplate_r3);
} }
function DialogHeaderComponent_ng_template_9_i_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 13);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngClass", ctx_r1.iconclass)("ngStyle", i0.ɵɵ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.ɵɵelement(0, "img", 14);
    i0.ɵɵpipe(1, "image");
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("src", i0.ɵɵpipeBind1(1, 2, ctx_r1.iconurl), i0.ɵɵsanitizeUrl)("ngStyle", i0.ɵɵ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.ɵɵelement(0, "span", 15);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("title", ctx_r1.subheading)("textContent", ctx_r1.subheading);
} }
function DialogHeaderComponent_ng_template_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵ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.ɵɵelement(2, "span", 11);
    i0.ɵɵtemplate(3, DialogHeaderComponent_ng_template_9_span_3_Template, 1, 2, "span", 12);
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngIf", ctx_r1.iconclass && !ctx_r1.iconurl);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngIf", ctx_r1.iconurl);
    i0.ɵɵadvance();
    i0.ɵɵproperty("textContent", ctx_r1.heading)("id", ctx_r1.titleid);
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngIf", ctx_r1.subheading);
} }
const DEFAULT_CLS = 'app-dialog-header modal-header';
const DEFAULT_ICON_DIMENSIONS = '21px';
class DialogHeaderComponent {
    get isClosable() {
        return 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';
        addClass(elRef.nativeElement, DEFAULT_CLS);
    }
    closeDialog() {
        this.dialogRef.close();
    }
    static { this.ɵfac = function DialogHeaderComponent_Factory(t) { return new (t || DialogHeaderComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(DialogRef)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵ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.ɵɵtemplate(0, DialogHeaderComponent_button_0_Template, 3, 1, "button", 1);
            i0.ɵɵelementContainerStart(1, 2);
            i0.ɵɵ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.ɵɵelementContainerEnd();
            i0.ɵɵtemplate(9, DialogHeaderComponent_ng_template_9_Template, 4, 5, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
        } if (rf & 2) {
            i0.ɵɵproperty("ngIf", ctx.isClosable);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngSwitch", ctx.headinglevel);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngSwitchCase", "h1");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngSwitchCase", "h2");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngSwitchCase", "h3");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngSwitchCase", "h4");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngSwitchCase", "h5");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngSwitchCase", "h6");
        } }, dependencies: [i1$1.NgClass, i1$1.NgIf, i1$1.NgTemplateOutlet, i1$1.NgStyle, i1$1.NgSwitch, i1$1.NgSwitchCase, i1$1.NgSwitchDefault, i2.TextContentDirective, i2.ImagePipe], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DialogHeaderComponent, [{
        type: 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.ElementRef }, { type: BaseDialog, decorators: [{
                type: Inject,
                args: [DialogRef]
            }] }], { iconwidth: [{
            type: Input
        }], iconheight: [{
            type: Input
        }], iconmargin: [{
            type: Input
        }], iconclass: [{
            type: Input
        }], iconurl: [{
            type: Input
        }], closable: [{
            type: Input
        }], heading: [{
            type: Input
        }], headinglevel: [{
            type: Input
        }], subheading: [{
            type: Input
        }], titleid: [{
            type: Input
        }], title: [{
            type: Input
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵ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.ɵɵdefineNgModule({ type: DialogModule }); }
    static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
            ModalModule,
            WmComponentsModule] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(DialogModule, [{
        type: NgModule,
        args: [{
                imports: [
                    CommonModule,
                    ModalModule,
                    WmComponentsModule
                ],
                declarations: [...components],
                exports: [...components]
            }]
    }], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(DialogModule, { declarations: [DialogBodyDirective,
        DialogFooterDirective,
        DialogHeaderComponent], imports: [CommonModule,
        ModalModule,
        WmComponentsModule], exports: [DialogBodyDirective,
        DialogFooterDirective,
        DialogHeaderComponent] }); })();

/**
 * Generated bundle index. Do not edit.
 */

export { BaseDialog, DialogBodyDirective, DialogFooterDirective, DialogHeaderComponent, DialogModule };
//# sourceMappingURL=index.mjs.map
