(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@wm/components/base'), require('@wm/components/dialogs'), require('@wm/components/input'), require('@wm/core')) :
    typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common', '@wm/components/base', '@wm/components/dialogs', '@wm/components/input', '@wm/core'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.dialogs = global.wm.components.dialogs || {}, global.wm.components.dialogs.designdialog = {}), global.ng.core, global.ng.common, global.wm.components.base, global.wm.components.dialogs, global.wm.components.input, global.wm.core));
})(this, (function (exports, i0, i1, base, i2, input, core) { '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);

    const registerProps = () => {
        base.register('wm-dialog', new Map([
            ['animation', base.PROP_STRING],
            ['class', base.PROP_STRING],
            ['closable', { value: true, ...base.PROP_BOOLEAN }],
            ['iconclass', { value: 'wi wi-file-text', PROP_STRING: base.PROP_STRING }],
            ['iconheight', base.PROP_STRING],
            ['iconmargin', base.PROP_STRING],
            ['iconurl', base.PROP_STRING],
            ['iconwidth', base.PROP_STRING],
            ['modal', { value: true, ...base.PROP_BOOLEAN }],
            ['name', base.PROP_STRING],
            ['showheader', { value: true, ...base.PROP_BOOLEAN }],
            ['tabindex', { value: 0, ...base.PROP_NUMBER }],
            ['title', { value: 'Information', ...base.PROP_STRING }],
            ['headinglevel', { value: 'h4', ...base.PROP_STRING }],
            ['eventsource', base.PROP_ANY]
        ]));
    };

    const _c0 = ["dialogBody"];
    const _c1 = ["dialogFooter"];
    const _c2 = ["dialogTemplate"];
    const _c3 = ["wmDialog", ""];
    function DialogComponent_ng_template_0_div_0_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelement(0, "div", 4);
    } if (rf & 2) {
        const ctx_r0 = i0__namespace.ɵɵnextContext(2);
        i0__namespace.ɵɵproperty("closable", ctx_r0.closable)("iconclass", ctx_r0.iconclass)("iconurl", ctx_r0.iconurl)("iconwidth", ctx_r0.iconwidth)("iconheight", ctx_r0.iconheight)("iconmargin", ctx_r0.iconmargin)("heading", ctx_r0.title)("headinglevel", ctx_r0.headinglevel)("title", ctx_r0.title)("titleid", ctx_r0.titleId);
    } }
    function DialogComponent_ng_template_0_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogComponent_ng_template_0_ng_container_3_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementContainer(0);
    } }
    function DialogComponent_ng_template_0_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵtemplate(0, DialogComponent_ng_template_0_div_0_Template, 1, 10, "div", 1);
        i0__namespace.ɵɵelementStart(1, "div", 2);
        i0__namespace.ɵɵtemplate(2, DialogComponent_ng_template_0_ng_container_2_Template, 1, 0, "ng-container", 3);
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵtemplate(3, DialogComponent_ng_template_0_ng_container_3_Template, 1, 0, "ng-container", 3);
    } if (rf & 2) {
        const ctx_r0 = i0__namespace.ɵɵnextContext();
        i0__namespace.ɵɵproperty("ngIf", ctx_r0.showheader);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngTemplateOutlet", ctx_r0.dialogBody);
        i0__namespace.ɵɵadvance();
        i0__namespace.ɵɵproperty("ngTemplateOutlet", ctx_r0.dialogFooter);
    } }
    const DIALOG_CLS = 'app-dialog modal-dialog';
    const WIDGET_INFO = { widgetType: 'wm-dialog' };
    class DialogComponent extends i2.BaseDialog {
        static { this.initializeProps = registerProps(); }
        constructor(inj, dialogClass, modal, closable, contexts, explicitContext) {
            if (modal === null || modal === undefined) {
                modal = true;
            }
            if (closable === null || closable === undefined) {
                closable = true;
            }
            // contexts[0] will refer to the self context provided by this component
            contexts[0].closeDialog = () => this.close();
            // setting the backdrop to 'static' will not close the dialog on backdrop click
            const backdrop = core.toBoolean(modal) ? 'static' : true;
            super(inj, WIDGET_INFO, {
                class: `${DIALOG_CLS} ${dialogClass || ''}`,
                backdrop,
                keyboard: core.toBoolean(closable) ? true : !core.toBoolean(modal)
            }, explicitContext);
            this.isDialogComponent = true;
        }
        getTemplateRef() {
            return this.dialogTemplate;
        }
        ngOnInit() {
            super.ngOnInit();
            this.register(this.viewParent);
        }
        static { this.ɵfac = function DialogComponent_Factory(t) { return new (t || DialogComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.Injector), i0__namespace.ɵɵinjectAttribute('class'), i0__namespace.ɵɵinjectAttribute('modal'), i0__namespace.ɵɵinjectAttribute('closable'), i0__namespace.ɵɵdirectiveInject(base.Context, 2), i0__namespace.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
        static { this.ɵcmp = /*@__PURE__*/ i0__namespace.ɵɵdefineComponent({ type: DialogComponent, selectors: [["div", "wmDialog", ""]], contentQueries: function DialogComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
                i0__namespace.ɵɵcontentQuery(dirIndex, _c0, 5, i0.TemplateRef);
                i0__namespace.ɵɵcontentQuery(dirIndex, _c1, 5, i0.TemplateRef);
            } if (rf & 2) {
                let _t;
                i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.dialogBody = _t.first);
                i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.dialogFooter = _t.first);
            } }, viewQuery: function DialogComponent_Query(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵviewQuery(_c2, 7, i0.TemplateRef);
            } if (rf & 2) {
                let _t;
                i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.dialogTemplate = _t.first);
            } }, features: [i0__namespace.ɵɵProvidersFeature([
                    base.provideAsWidgetRef(DialogComponent),
                    base.provideAsDialogRef(DialogComponent),
                    { provide: base.Context, useFactory: () => { return {}; }, multi: true }
                ]), i0__namespace.ɵɵInheritDefinitionFeature], attrs: _c3, decls: 2, vars: 0, consts: [["dialogTemplate", ""], ["wmDialogHeader", "", 3, "closable", "iconclass", "iconurl", "iconwidth", "iconheight", "iconmargin", "heading", "headinglevel", "title", "titleid", 4, "ngIf"], ["wmDialogBody", ""], [4, "ngTemplateOutlet"], ["wmDialogHeader", "", 3, "closable", "iconclass", "iconurl", "iconwidth", "iconheight", "iconmargin", "heading", "headinglevel", "title", "titleid"]], template: function DialogComponent_Template(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵtemplate(0, DialogComponent_ng_template_0_Template, 4, 3, "ng-template", null, 0, i0__namespace.ɵɵtemplateRefExtractor);
            } }, dependencies: [i1__namespace.NgIf, i1__namespace.NgTemplateOutlet, i2__namespace.DialogBodyDirective, i2__namespace.DialogHeaderComponent], encapsulation: 2 }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(DialogComponent, [{
            type: i0.Component,
            args: [{ selector: 'div[wmDialog]', providers: [
                        base.provideAsWidgetRef(DialogComponent),
                        base.provideAsDialogRef(DialogComponent),
                        { provide: base.Context, useFactory: () => { return {}; }, multi: true }
                    ], template: "<ng-template #dialogTemplate>\n    <div wmDialogHeader [closable]=\"closable\"\n         [iconclass]=\"iconclass\"\n         [iconurl]=\"iconurl\"\n         [iconwidth]=\"iconwidth\"\n         [iconheight]=\"iconheight\"\n         [iconmargin]=\"iconmargin\"\n         [heading]=\"title\"\n         [headinglevel]=\"headinglevel\"\n         *ngIf=\"showheader\"\n         [title]=\"title\"\n         [titleid]=\"titleId\"\n    ></div>\n    <div wmDialogBody>\n        <ng-container *ngTemplateOutlet=\"dialogBody\"></ng-container>\n    </div>\n    <ng-container *ngTemplateOutlet=\"dialogFooter\"></ng-container>\n</ng-template>\n" }]
        }], () => [{ type: i0__namespace.Injector }, { type: undefined, decorators: [{
                    type: i0.Attribute,
                    args: ['class']
                }] }, { type: undefined, decorators: [{
                    type: i0.Attribute,
                    args: ['modal']
                }] }, { type: undefined, decorators: [{
                    type: i0.Attribute,
                    args: ['closable']
                }] }, { type: Array, decorators: [{
                    type: i0.Self
                }, {
                    type: i0.Inject,
                    args: [base.Context]
                }] }, { type: undefined, decorators: [{
                    type: i0.Inject,
                    args: ['EXPLICIT_CONTEXT']
                }, {
                    type: i0.Optional
                }] }], { dialogTemplate: [{
                type: i0.ViewChild,
                args: ['dialogTemplate', { static: true, read: i0.TemplateRef }]
            }], dialogBody: [{
                type: i0.ContentChild,
                args: ['dialogBody', /* TODO: add static flag */ { read: i0.TemplateRef }]
            }], dialogFooter: [{
                type: i0.ContentChild,
                args: ['dialogFooter', /* TODO: add static flag */ { read: i0.TemplateRef }]
            }] }); })();
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassDebugInfo(DialogComponent, { className: "DialogComponent", filePath: "dialog.component.ts", lineNumber: 33 }); })();

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

    exports.DesignDialogModule = DesignDialogModule;
    exports.DialogComponent = DialogComponent;

}));
