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AAC,QAAQ,CAAC,CAAC,CAAC;YAClB,MAAM,CAAC;QACT,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IACI,yBAAU,GAA0B;QAC3C,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oBACxB,QAAQ,EAAE,iBAAiB;oBAC3B,QAAQ,EAAE,gbAYT;iBACF,EAAG,EAAE;KACL,CAAC;IACF,kBAAkB;IACX,6BAAc,GAAmE,cAAM,OAAA;QAC9F,EAAC,IAAI,EAAE,WAAW,GAAG;KACpB,EAF6F,CAE7F,CAAC;IACK,6BAAc,GAA2C;QAChE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAC1B,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACjC,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACtC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;KAC9B,CAAC;IAvEA;QAAC,QAAQ,EAAE;;uDAAA;IAwEb,qBAAC;AAAD,CAAC,AA5ED,IA4EC","sourcesContent":["import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';\nimport { AlertConfig } from './alert.config';\nimport { OnChange } from '../utils/decorators';\n\n\nexport class AlertComponent implements OnInit {\n /** Alert type. Provides one of four bootstrap supported contextual classes: `success`, `info`, `warning` and `danger` */\n public type: string = 'warning';\n /** If set, displays an inline \"Close\" button */\n @OnChange()\n public dismissible: boolean = false;\n /** Number in milliseconds, after which alert will be closed */\n public dismissOnTimeout: number | string;\n\n /** This event fires immediately after close instance method is called, $event is an instance of Alert component. */\n public onClose: EventEmitter<AlertComponent> = new EventEmitter<AlertComponent>();\n /** This event fires when alert closed, $event is an instance of Alert component */\n public onClosed: EventEmitter<AlertComponent> = new EventEmitter<AlertComponent>();\n\n public isClosed: boolean = false;\n public classes: string = '';\n public dismissibleChange: EventEmitter<string> = new EventEmitter();\n\n public constructor(_config: AlertConfig) {\n Object.assign(this, _config);\n this.dismissibleChange.subscribe((dismissible: boolean) => {\n this.classes = this.dismissible ? 'alert-dismissible' : '';\n });\n }\n\n public ngOnInit(): void {\n if (this.dismissOnTimeout) {\n // if dismissOnTimeout used as attr without binding, it will be a string\n setTimeout(() => this.close(),\n parseInt(this.dismissOnTimeout as string, 10));\n }\n }\n\n // todo: animation ` If the .fade and .in classes are present on the element,\n // the alert will fade out before it is removed`\n /**\n * Closes an alert by removing it from the DOM.\n */\n public close(): void {\n if (this.isClosed) {\n return;\n }\n\n this.onClose.emit(this);\n this.isClosed = true;\n this.onClosed.emit(this);\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: Component, args: [{\n selector: 'alert,ngx-alert',\n template: `\n<template [ngIf]=\"!isClosed\">\n <div [class]=\"'alert alert-' + type\" role=\"alert\" [ngClass]=\"classes\">\n <template [ngIf]=\"dismissible\">\n <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"close()\">\n <span aria-hidden=\"true\">&times;</span>\n <span class=\"sr-only\">Close</span>\n </button>\n </template>\n <ng-content></ng-content>\n </div>\n</template>\n `\n}, ] },\n];\n/** @nocollapse */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: AlertConfig, },\n];\nstatic propDecorators: {[key: string]: DecoratorInvocation[]} = {\n'type': [{ type: Input },],\n'dismissible': [{ type: Input },],\n'dismissOnTimeout': [{ type: Input },],\n'onClose': [{ type: Output },],\n'onClosed': [{ type: Output },],\n};\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"]}
\No newline at end of file