(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/operators'), require('rxjs'), require('@angular/core'), require('@angular/animations'), require('@bravobit/bb-foundation'), require('@bravobit/bb-foundation/elements'), require('@bravobit/bb-foundation/localize'), require('@angular/common')) :
    typeof define === 'function' && define.amd ? define('@bravobit/bb-foundation/dialog', ['exports', 'rxjs/operators', 'rxjs', '@angular/core', '@angular/animations', '@bravobit/bb-foundation', '@bravobit/bb-foundation/elements', '@bravobit/bb-foundation/localize', '@angular/common'], factory) :
    (global = global || self, factory((global.bravobit = global.bravobit || {}, global.bravobit['bb-foundation'] = global.bravobit['bb-foundation'] || {}, global.bravobit['bb-foundation'].dialog = {}), global.rxjs.operators, global.rxjs, global.ng.core, global.ng.animations, global.bravobit['bb-foundation'], global.bravobit['bb-foundation'].elements, global.bravobit['bb-foundation'].localize, global.ng.common));
}(this, (function (exports, operators, rxjs, core, animations, bbFoundation, elements, localize, common) { 'use strict';

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog.ref.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    /**
     * @template T
     */
    var   /**
     * @template T
     */
    BbDialogRef = /** @class */ (function () {
        function BbDialogRef() {
            // Data.
            this._afterClosed$ = new rxjs.Subject();
            this._overlayClicked$ = new rxjs.Subject();
        }
        Object.defineProperty(BbDialogRef.prototype, "afterClosed", {
            get: /**
             * @return {?}
             */
            function () {
                return this._afterClosed$.pipe(operators.take(1));
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(BbDialogRef.prototype, "overlayClicked", {
            get: /**
             * @return {?}
             */
            function () {
                return this._overlayClicked$.pipe(operators.take(1));
            },
            enumerable: true,
            configurable: true
        });
        /**
         * @return {?}
         */
        BbDialogRef.prototype.onOverlayClicked = /**
         * @return {?}
         */
        function () {
            this._overlayClicked$.next();
        };
        /**
         * @param {?=} result
         * @return {?}
         */
        BbDialogRef.prototype.close = /**
         * @param {?=} result
         * @return {?}
         */
        function (result) {
            this._afterClosed$.next(result);
        };
        return BbDialogRef;
    }());
    if (false) {
        /**
         * @type {?}
         * @private
         */
        BbDialogRef.prototype._afterClosed$;
        /**
         * @type {?}
         * @private
         */
        BbDialogRef.prototype._overlayClicked$;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog.interfaces.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    /**
     * @template T
     */
    var   /**
     * @template T
     */
    BbDialogConfig = /** @class */ (function () {
        function BbDialogConfig() {
        }
        return BbDialogConfig;
    }());
    if (false) {
        /** @type {?} */
        BbDialogConfig.prototype.data;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog-overlay/dialog-overlay.component.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var BbDialogOverlay = /** @class */ (function () {
        function BbDialogOverlay() {
            // Inputs.
            this.animations = true;
            // Outputs.
            this.closeRequested = new core.EventEmitter();
            // State.
            this._state = 'open';
            this._closed$ = new rxjs.Subject();
        }
        Object.defineProperty(BbDialogOverlay.prototype, "state", {
            get: /**
             * @return {?}
             */
            function () {
                return this.animations
                    ? this._state
                    : 'none';
            },
            enumerable: true,
            configurable: true
        });
        /**
         * @return {?}
         */
        BbDialogOverlay.prototype.onOverlayClicked = /**
         * @return {?}
         */
        function () {
            this.closeRequested.emit();
        };
        /**
         * @param {?} event
         * @return {?}
         */
        BbDialogOverlay.prototype.onKeyEvent = /**
         * @param {?} event
         * @return {?}
         */
        function (event) {
            if (event.key === 'Escape') {
                this.closeRequested.emit();
            }
        };
        /**
         * @param {?} event
         * @return {?}
         */
        BbDialogOverlay.prototype.onAnimationDone = /**
         * @param {?} event
         * @return {?}
         */
        function (event) {
            // Check if the dialog is being destroyed.
            if (!['close', 'none'].includes(event.toState)) {
                return;
            }
            this._closed$.next();
            this._closed$.complete();
        };
        /**
         * @return {?}
         */
        BbDialogOverlay.prototype.close = /**
         * @return {?}
         */
        function () {
            this._state = 'close';
            return this._closed$.pipe(operators.take(1)).toPromise();
        };
        BbDialogOverlay.decorators = [
            { type: core.Component, args: [{
                        selector: 'bb-dialog-overlay',
                        template: "<div class=\"bb-dialog-overlay-backdrop\"></div>\r\n\r\n<ng-content select=\"[bb-dialog-modal]\"></ng-content>\r\n",
                        changeDetection: core.ChangeDetectionStrategy.OnPush,
                        encapsulation: core.ViewEncapsulation.None,
                        preserveWhitespaces: false,
                        host: { 'class': 'bb-dialog-overlay', '[@bbDialogAnimation]': 'state' },
                        animations: [
                            animations.trigger('bbDialogAnimation', [
                                animations.transition('* => none', []),
                                animations.transition(':enter, * => open', [
                                    animations.group([
                                        animations.query('.bb-dialog-overlay-backdrop', [
                                            animations.style({ opacity: 0 }),
                                            animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations.style({ opacity: 1 }))
                                        ]),
                                        animations.query('.bb-dialog-modal', [
                                            animations.style({ transform: 'scale(0.95)' }),
                                            animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations.style({ transform: 'scale(1)' }))
                                        ])
                                    ])
                                ]),
                                animations.transition(':leave, * => close', [
                                    animations.group([
                                        animations.query('.bb-dialog-overlay-backdrop', [
                                            animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations.style({ opacity: 0 }))
                                        ]),
                                        animations.query('.bb-dialog-modal', [
                                            animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations.style({ opacity: 0, transform: 'scale(0.95)' }))
                                        ])
                                    ])
                                ])
                            ])
                        ],
                        styles: [".bb-dialog-overlay,.bb-dialog-overlay-backdrop{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:1000;position:fixed;-ms-flex-direction:column;flex-direction:column}.bb-dialog-overlay{padding:20px}.bb-dialog-overlay-backdrop{background-color:rgba(0,0,0,.5)}.bb-dialog-overlay-component{z-index:1001;display:block;position:relative}"]
                    }] }
        ];
        BbDialogOverlay.propDecorators = {
            animations: [{ type: core.Input }],
            closeRequested: [{ type: core.Output }],
            onOverlayClicked: [{ type: core.HostListener, args: ['click',] }],
            onKeyEvent: [{ type: core.HostListener, args: ['window:keyup', ['$event'],] }],
            onAnimationDone: [{ type: core.HostListener, args: ['@bbDialogAnimation.done', ['$event'],] }]
        };
        return BbDialogOverlay;
    }());
    if (false) {
        /** @type {?} */
        BbDialogOverlay.prototype.animations;
        /** @type {?} */
        BbDialogOverlay.prototype.closeRequested;
        /**
         * @type {?}
         * @private
         */
        BbDialogOverlay.prototype._state;
        /**
         * @type {?}
         * @private
         */
        BbDialogOverlay.prototype._closed$;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog-modal/dialog-modal.component.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var BbDialogModal = /** @class */ (function () {
        function BbDialogModal(_patch) {
            this._patch = _patch;
            // Styling.
            this.maxWidth = '420px';
        }
        /**
         * @param {?} event
         * @return {?}
         */
        BbDialogModal.prototype.onOverlayClickedEvent = /**
         * @param {?} event
         * @return {?}
         */
        function (event) {
            event.stopPropagation();
        };
        /**
         * @return {?}
         */
        BbDialogModal.prototype.ngOnInit = /**
         * @return {?}
         */
        function () {
            this._patch.mobileVerticalHeight();
        };
        BbDialogModal.decorators = [
            { type: core.Component, args: [{
                        selector: '[bb-dialog-modal]',
                        template: "<ng-content select=\"[bb-dialog-header]\">\r\n\r\n</ng-content>\r\n\r\n<div class=\"bb-dialog-modal-body\">\r\n    <ng-content></ng-content>\r\n</div>\r\n\r\n<ng-content select=\"[bb-dialog-actions]\">\r\n\r\n</ng-content>\r\n",
                        changeDetection: core.ChangeDetectionStrategy.OnPush,
                        encapsulation: core.ViewEncapsulation.None,
                        preserveWhitespaces: false,
                        host: {
                            'class': 'bb-dialog-modal',
                            'role': 'dialog'
                        },
                        styles: [".bb-dialog-modal{width:100%;margin:auto;z-index:1001;display:-ms-flexbox;display:flex;max-width:420px;border-radius:4px;position:relative;-ms-flex-direction:column;flex-direction:column;background-color:#fff;max-height:calc((var(--vh,1vh) * 100) - 40px)}.bb-dialog-modal-body{padding:20px;color:#738694;font-size:13px;overflow-y:auto;line-height:1.4;background-color:#f1f3f6}"]
                    }] }
        ];
        /** @nocollapse */
        BbDialogModal.ctorParameters = function () { return [
            { type: bbFoundation.Patch }
        ]; };
        BbDialogModal.propDecorators = {
            maxWidth: [{ type: core.HostBinding, args: ['style.max-width',] }, { type: core.Input }],
            onOverlayClickedEvent: [{ type: core.HostListener, args: ['click', ['$event'],] }]
        };
        return BbDialogModal;
    }());
    if (false) {
        /** @type {?} */
        BbDialogModal.prototype.maxWidth;
        /**
         * @type {?}
         * @private
         */
        BbDialogModal.prototype._patch;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog-header/dialog-header.component.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var BbDialogHeader = /** @class */ (function () {
        function BbDialogHeader() {
            // Inputs.
            this.iconName = null;
            this.iconColor = 'black';
            // Outputs.
            this.closeRequested = new core.EventEmitter();
        }
        BbDialogHeader.decorators = [
            { type: core.Component, args: [{
                        selector: '[bb-dialog-header]',
                        template: "<div class=\"bb-dialog-header-row\">\r\n    <div *ngIf=\"iconName as icon\"\r\n         [style.color]=\"iconColor\"\r\n         class=\"bb-dialog-header-icon\">\r\n        <i class=\"material-icons\">{{ icon }}</i>\r\n    </div>\r\n\r\n    <div class=\"bb-dialog-header-content\">\r\n        <ng-content></ng-content>\r\n    </div>\r\n\r\n    <button *ngIf=\"closeRequested?.observers?.length > 0\"\r\n            (click)=\"closeRequested?.emit()\"\r\n            type=\"button\"\r\n            class=\"bb-dialog-header-close\">\r\n    </button>\r\n</div>\r\n\r\n<nav class=\"bb-dialog-header-navigation\">\r\n    <ng-content select=\"[bb-dialog-link]\"></ng-content>\r\n</nav>\r\n",
                        changeDetection: core.ChangeDetectionStrategy.OnPush,
                        encapsulation: core.ViewEncapsulation.None,
                        preserveWhitespaces: false,
                        host: { 'class': 'bb-dialog-header' },
                        styles: [".bb-dialog-header{display:-ms-flexbox;display:flex;min-height:60px;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;background-color:#fff;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:1px solid #d8d8d8}.bb-dialog-header .bb-dialog-header-content,.bb-dialog-header .bb-dialog-header-content h1{max-width:100%;font-size:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.bb-dialog-header-navigation,.bb-dialog-header-row{width:100%;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.bb-dialog-header-row{padding:10px 20px}.bb-dialog-header-navigation{width:100%;padding:0 20px;overflow-x:auto;white-space:nowrap}.bb-dialog-header-navigation:empty{margin:0;height:0;padding:0;visibility:hidden}.bb-dialog-header-content{-ms-flex:1;flex:1}.bb-dialog-header-icon{width:40px;height:40px;display:-ms-flexbox;display:flex;min-width:40px;overflow:hidden;min-height:40px;margin-right:10px;border-radius:50%;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.bb-dialog-header-icon:after{top:0;left:0;right:0;bottom:0;content:\"\";opacity:.14;position:absolute;background-color:currentColor}.bb-dialog-header-close{width:32px;height:32px;border:none;min-width:32px;min-height:32px;overflow:hidden;margin-left:10px;border-radius:4px;position:relative;margin-right:-10px;display:inline-block;background-color:transparent}.bb-dialog-header-close:after,.bb-dialog-header-close:before{top:50%;left:20%;width:60%;height:2px;content:\"\";margin-top:-1px;position:absolute;background-color:#a2a9ba}.bb-dialog-header-close:before{-ms-transform:rotate(45deg);transform:rotate(45deg)}.bb-dialog-header-close:after{-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.bb-dialog-header-close:hover{background-color:rgba(0,0,0,.08)}.bb-dialog-header-close:focus{background-color:rgba(0,0,0,.12)}.bb-dialog-header-close:active{background-color:rgba(0,0,0,.16)}"]
                    }] }
        ];
        BbDialogHeader.propDecorators = {
            iconName: [{ type: core.Input }],
            iconColor: [{ type: core.Input }],
            closeRequested: [{ type: core.Output }]
        };
        return BbDialogHeader;
    }());
    if (false) {
        /** @type {?} */
        BbDialogHeader.prototype.iconName;
        /** @type {?} */
        BbDialogHeader.prototype.iconColor;
        /** @type {?} */
        BbDialogHeader.prototype.closeRequested;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog-link/dialog-link.component.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var BbDialogLink = /** @class */ (function () {
        function BbDialogLink() {
        }
        BbDialogLink.decorators = [
            { type: core.Component, args: [{
                        selector: '[bb-dialog-link]',
                        template: "<ng-content></ng-content>\r\n",
                        changeDetection: core.ChangeDetectionStrategy.OnPush,
                        encapsulation: core.ViewEncapsulation.None,
                        preserveWhitespaces: false,
                        host: { 'class': 'bb-dialog-link' },
                        styles: [".bb-dialog-link{height:30px;display:-ms-flexbox;display:flex;font-size:16px;font-weight:500;white-space:nowrap;-ms-flex-align:center;align-items:center;color:#6b5c5c!important;background-color:transparent;text-decoration:none!important;border-bottom:2px solid transparent}.bb-dialog-link+.bb-dialog-link{margin-left:10px}.bb-dialog-link:hover:not(.disabled){border-bottom:2px solid rgba(117,119,148,.2)}.bb-dialog-link.active,.bb-dialog-link.active:hover{color:#5b53ff!important;border-bottom-color:#5b53ff}.bb-dialog-link.disabled,.bb-dialog-link.disabled:active,.bb-dialog-link.disabled:focus,.bb-dialog-link.disabled:hover{opacity:.4;cursor:default;box-shadow:none}"]
                    }] }
        ];
        return BbDialogLink;
    }());

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog-actions/dialog-actions.component.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var BbDialogActions = /** @class */ (function () {
        function BbDialogActions() {
        }
        BbDialogActions.decorators = [
            { type: core.Component, args: [{
                        selector: '[bb-dialog-actions]',
                        template: "<bb-form-group class=\"end\">\r\n    <ng-content></ng-content>\r\n</bb-form-group>\r\n",
                        changeDetection: core.ChangeDetectionStrategy.OnPush,
                        encapsulation: core.ViewEncapsulation.None,
                        preserveWhitespaces: false,
                        host: { 'class': 'bb-dialog-actions' },
                        styles: [".bb-dialog-actions{padding:20px;display:block;background-color:#fff;border-top:1px solid #d8d8d8;border-bottom-left-radius:4px;border-bottom-right-radius:4px}"]
                    }] }
        ];
        return BbDialogActions;
    }());

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog.insertion.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var BbDialogInsertion = /** @class */ (function () {
        function BbDialogInsertion(viewContainerRef) {
            this.viewContainerRef = viewContainerRef;
        }
        BbDialogInsertion.decorators = [
            { type: core.Directive, args: [{
                        selector: '[bbDialogInsertion]'
                    },] }
        ];
        /** @nocollapse */
        BbDialogInsertion.ctorParameters = function () { return [
            { type: core.ViewContainerRef }
        ]; };
        return BbDialogInsertion;
    }());
    if (false) {
        /** @type {?} */
        BbDialogInsertion.prototype.viewContainerRef;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog-container/dialog-container.component.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var BbDialogContainer = /** @class */ (function () {
        function BbDialogContainer(_changeDetection, _componentFactoryResolver) {
            this._changeDetection = _changeDetection;
            this._componentFactoryResolver = _componentFactoryResolver;
            // Data.
            this.componentRef = null;
            this.childComponentType = null;
            // State.
            this.overlayClicked$ = new rxjs.Subject();
        }
        Object.defineProperty(BbDialogContainer.prototype, "onOverlayClicked", {
            get: /**
             * @return {?}
             */
            function () {
                return this.overlayClicked$.pipe(operators.take(1));
            },
            enumerable: true,
            configurable: true
        });
        /**
         * @return {?}
         */
        BbDialogContainer.prototype.ngAfterViewInit = /**
         * @return {?}
         */
        function () {
            // Load the child component.
            this.loadChildComponent(this.childComponentType);
            // Detect changes to notify change detection.
            this._changeDetection.detectChanges();
        };
        /**
         * @param {?} event
         * @return {?}
         */
        BbDialogContainer.prototype.onAnimationDone = /**
         * @param {?} event
         * @return {?}
         */
        function (event) {
            // Check if the dialog is being destroyed.
            if (event.toState !== 'void') {
                return;
            }
            // Destroy the ref if it exists.
            this.componentRef && this.componentRef.destroy();
        };
        /**
         * @return {?}
         */
        BbDialogContainer.prototype.onOverlayClickedEvent = /**
         * @return {?}
         */
        function () {
            this.overlayClicked$.next();
        };
        /**
         * @private
         * @param {?} componentType
         * @return {?}
         */
        BbDialogContainer.prototype.loadChildComponent = /**
         * @private
         * @param {?} componentType
         * @return {?}
         */
        function (componentType) {
            // Resolve the component.
            /** @type {?} */
            var componentFactory = this._componentFactoryResolver.resolveComponentFactory(componentType);
            // Get the view container ref and clear it.
            /** @type {?} */
            var viewContainerRef = this.insertion.viewContainerRef;
            viewContainerRef.clear();
            // Create an instance of the component.
            this.componentRef = viewContainerRef.createComponent(componentFactory);
        };
        BbDialogContainer.decorators = [
            { type: core.Component, args: [{
                        selector: 'bb-dialog-container',
                        template: "<div class=\"bb-dialog-container-backdrop\">\r\n</div>\r\n\r\n<div class=\"bb-dialog-container-component\">\r\n    <ng-container bbDialogInsertion>\r\n    </ng-container>\r\n</div>\r\n",
                        changeDetection: core.ChangeDetectionStrategy.OnPush,
                        encapsulation: core.ViewEncapsulation.None,
                        host: { 'class': 'bb-dialog-container', '[@bbDialogAnimation]': 'true' },
                        preserveWhitespaces: false,
                        animations: [
                            animations.trigger('bbDialogAnimation', [
                                animations.transition(':enter', [
                                    animations.group([
                                        animations.query('.bb-dialog-container-backdrop', [
                                            animations.style({
                                                opacity: 0
                                            }),
                                            animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations.style({
                                                opacity: 1
                                            }))
                                        ]),
                                        animations.query('.bb-dialog-container-component', [
                                            animations.style({
                                                transform: 'scale(0.95)'
                                            }),
                                            animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations.style({
                                                transform: 'scale(1)'
                                            }))
                                        ])
                                    ])
                                ]),
                                animations.transition(':leave', [
                                    animations.group([
                                        animations.query('.bb-dialog-container-backdrop', [
                                            animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations.style({
                                                opacity: 0
                                            }))
                                        ]),
                                        animations.query('.bb-dialog-container-component', [
                                            animations.animate('150ms cubic-bezier(0, 0, 0.2, 1)', animations.style({
                                                opacity: 0,
                                                transform: 'scale(0.95)'
                                            }))
                                        ])
                                    ])
                                ])
                            ])
                        ],
                        styles: [".bb-dialog-container,.bb-dialog-container-backdrop{top:0;left:0;right:0;bottom:0;z-index:1000;position:fixed}.bb-dialog-container{display:-ms-flexbox;display:flex}.bb-dialog-container-backdrop{background-color:rgba(0,0,0,.5)}.bb-dialog-container-component{width:100%;margin:auto;padding:20px;z-index:1001;display:block}"]
                    }] }
        ];
        /** @nocollapse */
        BbDialogContainer.ctorParameters = function () { return [
            { type: core.ChangeDetectorRef },
            { type: core.ComponentFactoryResolver }
        ]; };
        BbDialogContainer.propDecorators = {
            insertion: [{ type: core.ViewChild, args: [BbDialogInsertion, { static: true },] }],
            onAnimationDone: [{ type: core.HostListener, args: ['@bbDialogAnimation.done', ['$event'],] }],
            onOverlayClickedEvent: [{ type: core.HostListener, args: ['click',] }]
        };
        return BbDialogContainer;
    }());
    if (false) {
        /** @type {?} */
        BbDialogContainer.prototype.insertion;
        /** @type {?} */
        BbDialogContainer.prototype.componentRef;
        /** @type {?} */
        BbDialogContainer.prototype.childComponentType;
        /** @type {?} */
        BbDialogContainer.prototype.overlayClicked$;
        /**
         * @type {?}
         * @private
         */
        BbDialogContainer.prototype._changeDetection;
        /**
         * @type {?}
         * @private
         */
        BbDialogContainer.prototype._componentFactoryResolver;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog-confirm/dialog-confirm.component.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    /** @type {?} */
    var nextUniqueId = 0;
    var BbDialogConfirm = /** @class */ (function () {
        function BbDialogConfirm(config, dialogRef) {
            this.config = config;
            this.dialogRef = dialogRef;
            // Id.
            this.dialogId = "bb-dialog-confirm-" + nextUniqueId++;
        }
        /**
         * @return {?}
         */
        BbDialogConfirm.prototype.ngAfterViewInit = /**
         * @return {?}
         */
        function () {
            // Initial focus the button.
            this.confirmButton.focus();
        };
        /**
         * @param {?} result
         * @return {?}
         */
        BbDialogConfirm.prototype.onClose = /**
         * @param {?} result
         * @return {?}
         */
        function (result) {
            this.dialogRef.close(result);
        };
        BbDialogConfirm.decorators = [
            { type: core.Component, args: [{
                        selector: 'bb-dialog-confirm',
                        template: "<div [attr.aria-labelledby]=\"dialogId\"\r\n     bb-dialog-modal\r\n     bbFocusTrap>\r\n    <header bb-dialog-header>\r\n        <h1 *ngIf=\"config?.data?.title as title\"\r\n            [id]=\"dialogId\">\r\n            {{ title | bbLocalize:{optional: true} }}\r\n        </h1>\r\n    </header>\r\n\r\n    <p>\r\n        {{ config?.data?.description | bbLocalize:{optional: true} }}\r\n    </p>\r\n\r\n    <footer bb-dialog-actions>\r\n        <button *ngIf=\"config?.data?.cancelButtonText as cancelButtonText\"\r\n                (click)=\"onClose(false)\"\r\n                bb-button\r\n                type=\"button\">\r\n            {{ cancelButtonText | bbLocalize:{optional: true} }}\r\n        </button>\r\n        <button #confirm\r\n                *ngIf=\"config?.data?.confirmButtonText as confirmButtonText\"\r\n                (click)=\"onClose(true)\"\r\n                bb-button\r\n                type=\"button\"\r\n                class=\"destructive\">\r\n            {{ confirmButtonText | bbLocalize:{optional: true} }}\r\n        </button>\r\n    </footer>\r\n</div>\r\n",
                        changeDetection: core.ChangeDetectionStrategy.OnPush,
                        encapsulation: core.ViewEncapsulation.None,
                        preserveWhitespaces: false,
                        host: { 'class': 'bb-dialog-confirm' },
                        styles: [".bb-dialog-confirm{display:block}"]
                    }] }
        ];
        /** @nocollapse */
        BbDialogConfirm.ctorParameters = function () { return [
            { type: BbDialogConfig },
            { type: BbDialogRef }
        ]; };
        BbDialogConfirm.propDecorators = {
            confirmButton: [{ type: core.ViewChild, args: ['confirm', { read: elements.BbButton, static: false },] }]
        };
        return BbDialogConfirm;
    }());
    if (false) {
        /** @type {?} */
        BbDialogConfirm.prototype.confirmButton;
        /** @type {?} */
        BbDialogConfirm.prototype.dialogId;
        /** @type {?} */
        BbDialogConfirm.prototype.config;
        /** @type {?} */
        BbDialogConfirm.prototype.dialogRef;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog.injector.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var BbDialogInjector = /** @class */ (function () {
        function BbDialogInjector(_parentInjector, _additionalTokens) {
            this._parentInjector = _parentInjector;
            this._additionalTokens = _additionalTokens;
        }
        /**
         * @param {?} token
         * @param {?=} notFoundValue
         * @return {?}
         */
        BbDialogInjector.prototype.get = /**
         * @param {?} token
         * @param {?=} notFoundValue
         * @return {?}
         */
        function (token, notFoundValue) {
            // First check if the additional token
            // contains the token.
            /** @type {?} */
            var value = this._additionalTokens.get(token);
            // If that value exists return it.
            if (value) {
                return value;
            }
            // Else query the parent injector.
            return this._parentInjector.get(token, notFoundValue);
        };
        return BbDialogInjector;
    }());
    if (false) {
        /**
         * @type {?}
         * @private
         */
        BbDialogInjector.prototype._parentInjector;
        /**
         * @type {?}
         * @private
         */
        BbDialogInjector.prototype._additionalTokens;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog.service.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var Dialog = /** @class */ (function () {
        function Dialog(_injector, _applicationRef, _componentFactoryResolver) {
            this._injector = _injector;
            this._applicationRef = _applicationRef;
            this._componentFactoryResolver = _componentFactoryResolver;
        }
        /**
         * @template T
         * @param {?} componentType
         * @param {?} config
         * @return {?}
         */
        Dialog.prototype.open = /**
         * @template T
         * @param {?} componentType
         * @param {?} config
         * @return {?}
         */
        function (componentType, config) {
            return this.createDialog(componentType, config);
        };
        /**
         * @param {?} title
         * @param {?} description
         * @param {?=} options
         * @return {?}
         */
        Dialog.prototype.confirm = /**
         * @param {?} title
         * @param {?} description
         * @param {?=} options
         * @return {?}
         */
        function (title, description, options) {
            if (options === void 0) { options = {}; }
            return this.open(BbDialogConfirm, {
                data: {
                    title: title,
                    description: description,
                    cancelButtonText: options.cancelButtonText || 'dialog.default_cancel_button',
                    confirmButtonText: options.confirmButtonText || 'dialog.default_confirm_button'
                }
            });
        };
        /**
         * @private
         * @template T
         * @param {?} componentType
         * @param {?} config
         * @return {?}
         */
        Dialog.prototype.createDialog = /**
         * @private
         * @template T
         * @param {?} componentType
         * @param {?} config
         * @return {?}
         */
        function (componentType, config) {
            var _this = this;
            // Create a reference.
            /** @type {?} */
            var dialogRef = new BbDialogRef();
            // Create a map with the config.
            /** @type {?} */
            var map = new WeakMap();
            map.set(BbDialogConfig, config);
            map.set(BbDialogRef, dialogRef);
            // Create a custom injector.
            /** @type {?} */
            var dialogInjector = new BbDialogInjector(this._injector, map);
            // Resolve the dialog component reference.
            /** @type {?} */
            var dialogComponentRef = this._componentFactoryResolver
                .resolveComponentFactory(BbDialogContainer)
                .create(dialogInjector);
            // Attach the host view to the application.
            this._applicationRef.attachView(dialogComponentRef.hostView);
            try {
                // Remove the current focus.
                /** @type {?} */
                var activeElement = (/** @type {?} */ (document.activeElement));
                activeElement.blur();
                // Append the element to the DOM.
                document.body.appendChild(dialogComponentRef.location.nativeElement);
            }
            catch (_a) {
                // Don't do anything, because it must've failed.
            }
            // Set the child component type on the component.
            dialogComponentRef.instance.childComponentType = componentType;
            dialogComponentRef.instance.onOverlayClicked.subscribe((/**
             * @return {?}
             */
            function () { return dialogRef.onOverlayClicked(); }));
            // Listen for close events.
            dialogRef.afterClosed.subscribe((/**
             * @return {?}
             */
            function () { return _this.deleteDialog(dialogComponentRef); }));
            // Return the reference.
            return dialogRef;
        };
        /**
         * @private
         * @param {?} dialogComponentRef
         * @return {?}
         */
        Dialog.prototype.deleteDialog = /**
         * @private
         * @param {?} dialogComponentRef
         * @return {?}
         */
        function (dialogComponentRef) {
            // Only continue if the dialog component ref exists.
            if (!dialogComponentRef) {
                return;
            }
            // Detach the dialog.
            this._applicationRef.detachView(dialogComponentRef.hostView);
            // Destroy the dialog.
            dialogComponentRef.destroy();
            dialogComponentRef = null;
        };
        Dialog.decorators = [
            { type: core.Injectable }
        ];
        /** @nocollapse */
        Dialog.ctorParameters = function () { return [
            { type: core.Injector },
            { type: core.ApplicationRef },
            { type: core.ComponentFactoryResolver }
        ]; };
        return Dialog;
    }());
    if (false) {
        /**
         * @type {?}
         * @private
         */
        Dialog.prototype._injector;
        /**
         * @type {?}
         * @private
         */
        Dialog.prototype._applicationRef;
        /**
         * @type {?}
         * @private
         */
        Dialog.prototype._componentFactoryResolver;
    }

    /**
     * @fileoverview added by tsickle
     * Generated from: lib/dialog.module.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    var DialogModule = /** @class */ (function () {
        function DialogModule() {
        }
        /**
         * @return {?}
         */
        DialogModule.forRoot = /**
         * @return {?}
         */
        function () {
            return {
                ngModule: DialogModule,
                providers: [Dialog]
            };
        };
        DialogModule.decorators = [
            { type: core.NgModule, args: [{
                        imports: [
                            common.CommonModule,
                            localize.LocalizeModule,
                            elements.ElementsModule
                        ],
                        declarations: [
                            BbDialogContainer,
                            BbDialogOverlay,
                            BbDialogModal,
                            BbDialogHeader,
                            BbDialogLink,
                            BbDialogActions,
                            BbDialogConfirm,
                            BbDialogInsertion
                        ],
                        entryComponents: [
                            BbDialogContainer,
                            BbDialogConfirm
                        ],
                        exports: [
                            BbDialogOverlay,
                            BbDialogModal,
                            BbDialogHeader,
                            BbDialogLink,
                            BbDialogActions
                        ]
                    },] }
        ];
        return DialogModule;
    }());

    exports.BbDialogActions = BbDialogActions;
    exports.BbDialogConfig = BbDialogConfig;
    exports.BbDialogHeader = BbDialogHeader;
    exports.BbDialogLink = BbDialogLink;
    exports.BbDialogModal = BbDialogModal;
    exports.BbDialogOverlay = BbDialogOverlay;
    exports.BbDialogRef = BbDialogRef;
    exports.Dialog = Dialog;
    exports.DialogModule = DialogModule;
    exports.ɵa = BbDialogContainer;
    exports.ɵb = BbDialogInsertion;
    exports.ɵc = BbDialogConfirm;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=bravobit-bb-foundation-dialog.umd.js.map
