(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.confirmdialog = {}), 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, common, base, i1, i2, 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-confirmdialog', new Map([
            ['animation', base.PROP_STRING],
            ['canceltext', { value: 'CANCEL', ...base.PROP_STRING }],
            ['class', base.PROP_STRING],
            ['closable', { value: true, PROP_BOOLEAN: base.PROP_BOOLEAN }],
            ['iconclass', { value: 'wm-sl-l sl-check', PROP_STRING: base.PROP_STRING }],
            ['iconheight', base.PROP_STRING],
            ['iconmargin', base.PROP_STRING],
            ['iconurl', base.PROP_STRING],
            ['iconwidth', base.PROP_STRING],
            ['message', { value: 'I am confirm box!', ...base.PROP_STRING }],
            ['modal', { value: false, ...base.PROP_BOOLEAN }],
            ['name', base.PROP_STRING],
            ['oktext', { value: 'OK', ...base.PROP_STRING }],
            ['tabindex', { value: 0, ...base.PROP_NUMBER }],
            ['headinglevel', { value: 'h4', ...base.PROP_STRING }],
            ['title', { value: 'Confirm', ...base.PROP_STRING }]
        ]));
    };

    const _c0 = ["dialogTemplate"];
    const _c1 = ["wmConfirmDialog", ""];
    function ConfirmDialogComponent_ng_template_0_Template(rf, ctx) { if (rf & 1) {
        const _r1 = i0__namespace.ɵɵgetCurrentView();
        i0__namespace.ɵɵelement(0, "div", 1);
        i0__namespace.ɵɵelementStart(1, "div", 2)(2, "p");
        i0__namespace.ɵɵtext(3);
        i0__namespace.ɵɵelementEnd()();
        i0__namespace.ɵɵelementStart(4, "div", 3)(5, "button", 4);
        i0__namespace.ɵɵlistener("click", function ConfirmDialogComponent_ng_template_0_Template_button_click_5_listener($event) { i0__namespace.ɵɵrestoreView(_r1); const ctx_r1 = i0__namespace.ɵɵnextContext(); return i0__namespace.ɵɵresetView(ctx_r1.onCancel($event)); });
        i0__namespace.ɵɵelementEnd();
        i0__namespace.ɵɵelementStart(6, "button", 5);
        i0__namespace.ɵɵlistener("click", function ConfirmDialogComponent_ng_template_0_Template_button_click_6_listener($event) { i0__namespace.ɵɵrestoreView(_r1); const ctx_r1 = i0__namespace.ɵɵnextContext(); return i0__namespace.ɵɵresetView(ctx_r1.onOk($event)); });
        i0__namespace.ɵɵelementEnd()();
    } if (rf & 2) {
        const ctx_r1 = i0__namespace.ɵɵnextContext();
        i0__namespace.ɵɵproperty("closable", ctx_r1.closable)("iconclass", ctx_r1.iconclass)("iconurl", ctx_r1.iconurl)("iconwidth", ctx_r1.iconwidth)("iconheight", ctx_r1.iconheight)("iconmargin", ctx_r1.iconmargin)("heading", ctx_r1.title)("headinglevel", ctx_r1.headinglevel)("title", ctx_r1.title)("titleid", ctx_r1.titleId);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵclassMapInterpolate1("app-dialog-message ", ctx_r1.messageclass, "");
        i0__namespace.ɵɵadvance();
        i0__namespace.ɵɵtextInterpolate(ctx_r1.message);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵattribute("aria-label", ctx_r1.canceltext);
        i0__namespace.ɵɵadvance();
        i0__namespace.ɵɵattribute("aria-label", ctx_r1.oktext);
    } }
    const DIALOG_CLS = 'app-dialog modal-dialog app-confirm-dialog';
    const WIDGET_INFO = { widgetType: 'wm-confirmdialog' };
    class ConfirmDialogComponent extends i1.BaseDialog {
        static { this.initializeProps = registerProps(); }
        constructor(inj, dialogClass, modal, closable, explicitContext) {
            if (modal === null || modal === undefined) {
                modal = false;
            }
            // setting the backdrop to 'static' will not close the dialog on backdrop click
            const backdrop = 'static';
            super(inj, WIDGET_INFO, {
                class: `${DIALOG_CLS} ${dialogClass || ''}`,
                backdrop,
                keyboard: !core.toBoolean(modal)
            }, explicitContext);
        }
        onEscape($event) { }
        ;
        getTemplateRef() {
            return this.dialogTemplate;
        }
        /**
         * Click event handler for the ok button
         * invokes on-ok event callback
         * @param {Event} $event
         */
        onOk($event) {
            this.invokeEventCallback('ok', { $event });
        }
        /**
         * Click event handler for the cancel button
         * invokes on-cancel event callback
         * @param {Event} $event
         */
        onCancel($event) {
            this.invokeEventCallback('cancel', { $event });
        }
        ngOnInit() {
            super.ngOnInit();
            this.register(this.viewParent);
        }
        static { this.ɵfac = function ConfirmDialogComponent_Factory(t) { return new (t || ConfirmDialogComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.Injector), i0__namespace.ɵɵinjectAttribute('class'), i0__namespace.ɵɵinjectAttribute('modal'), i0__namespace.ɵɵinjectAttribute('closable'), i0__namespace.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
        static { this.ɵcmp = /*@__PURE__*/ i0__namespace.ɵɵdefineComponent({ type: ConfirmDialogComponent, selectors: [["div", "wmConfirmDialog", ""]], viewQuery: function ConfirmDialogComponent_Query(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵviewQuery(_c0, 7);
            } if (rf & 2) {
                let _t;
                i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.dialogTemplate = _t.first);
            } }, hostBindings: function ConfirmDialogComponent_HostBindings(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵlistener("keydown.esc", function ConfirmDialogComponent_keydown_esc_HostBindingHandler($event) { return ctx.onEscape($event); }, false, i0__namespace.ɵɵresolveWindow);
            } }, features: [i0__namespace.ɵɵProvidersFeature([
                    base.provideAsWidgetRef(ConfirmDialogComponent),
                    base.provideAsDialogRef(ConfirmDialogComponent)
                ]), i0__namespace.ɵɵInheritDefinitionFeature], attrs: _c1, decls: 2, vars: 0, consts: [["dialogTemplate", ""], ["wmDialogHeader", "", 3, "closable", "iconclass", "iconurl", "iconwidth", "iconheight", "iconmargin", "heading", "headinglevel", "title", "titleid"], ["wmDialogBody", ""], ["wmDialogFooter", ""], ["caption.bind", "canceltext", "wmButton", "", 1, "btn-default", "cancel-action", 3, "click"], ["caption.bind", "oktext", "wmButton", "", 1, "btn-primary", "ok-action", 3, "click"]], template: function ConfirmDialogComponent_Template(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵtemplate(0, ConfirmDialogComponent_ng_template_0_Template, 7, 16, "ng-template", null, 0, i0__namespace.ɵɵtemplateRefExtractor);
            } }, dependencies: [i1__namespace.DialogBodyDirective, i1__namespace.DialogFooterDirective, i1__namespace.DialogHeaderComponent, i2__namespace.ButtonComponent], encapsulation: 2 }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(ConfirmDialogComponent, [{
            type: i0.Component,
            args: [{ selector: 'div[wmConfirmDialog]', providers: [
                        base.provideAsWidgetRef(ConfirmDialogComponent),
                        base.provideAsDialogRef(ConfirmDialogComponent)
                    ], 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         [title]=\"title\"\n         [titleid]=\"titleId\"></div>\n    <div wmDialogBody>\n        <p class=\"app-dialog-message {{messageclass}}\">{{ message }}</p>\n    </div>\n    <div wmDialogFooter>\n        <button (click)=\"onCancel($event)\" [attr.aria-label]=\"canceltext\" caption.bind=\"canceltext\" class=\"btn-default cancel-action\"\n                wmButton></button>\n        <button (click)=\"onOk($event)\" [attr.aria-label]=\"oktext\" caption.bind=\"oktext\" class=\"btn-primary ok-action\"\n                wmButton></button>\n    </div>\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: undefined, decorators: [{
                    type: i0.Inject,
                    args: ['EXPLICIT_CONTEXT']
                }, {
                    type: i0.Optional
                }] }], { dialogTemplate: [{
                type: i0.ViewChild,
                args: ['dialogTemplate', { static: true }]
            }], onEscape: [{
                type: i0.HostListener,
                args: ['window:keydown.esc', ['$event']]
            }] }); })();
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassDebugInfo(ConfirmDialogComponent, { className: "ConfirmDialogComponent", filePath: "confirm-dialog.component.ts", lineNumber: 31 }); })();

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

    exports.ConfirmDialogComponent = ConfirmDialogComponent;
    exports.ConfirmDialogModule = ConfirmDialogModule;

}));
