!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define("@fluxit/components",["exports","@angular/core","@angular/common","rxjs","@angular/platform-browser"],t):t(((o=o||self).fluxit=o.fluxit||{},o.fluxit.components={}),o.ng.core,o.ng.common,o.rxjs,o.ng.platformBrowser)}(this,(function(o,t,n,e,r){"use strict";
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation. All rights reserved.
    Licensed under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of the
    License at http://www.apache.org/licenses/LICENSE-2.0

    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
    MERCHANTABLITY OR NON-INFRINGEMENT.

    See the Apache Version 2.0 License for specific language governing permissions
    and limitations under the License.
    ***************************************************************************** */var a=function(){return(a=Object.assign||function(o){for(var t,n=1,e=arguments.length;n<e;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(o[r]=t[r]);return o}).apply(this,arguments)};function s(o,t,n,e){var r,a=arguments.length,s=a<3?t:null===e?e=Object.getOwnPropertyDescriptor(t,n):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(o,t,n,e);else for(var i=o.length-1;i>=0;i--)(r=o[i])&&(s=(a<3?r(s):a>3?r(t,n,s):r(t,n))||s);return a>3&&s&&Object.defineProperty(t,n,s),s}var i=function(){function o(){}return o=s([t.Component({selector:"button",template:"<ng-content></ng-content>",styles:[":host.pl-button{display:inline-block;font-weight:400;color:#212529;text-align:center;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:transparent;border:1px solid transparent;padding:.375rem .75rem;font-size:1rem;line-height:1.5;border-radius:.25rem;-webkit-transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){:host.pl-button{-webkit-transition:none;transition:none}}:host.pl-button:hover{color:#212529;text-decoration:none}:host.pl-button.focus,:host.pl-button:focus{outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}:host.pl-button.disabled,:host.pl-button:disabled{cursor:default;opacity:.65}:host.pl-button--primary{color:#fff;background-color:#007bff;box-shadow:none;min-width:86px}:host.pl-button--primary:not(:disabled):not(.disabled):hover{color:#fff;background-color:#006fe6;box-shadow:0 3px 6px rgba(0,0,0,.16)}:host.pl-button--primary.focus,:host.pl-button--primary:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5),0 3px 6px rgba(0,0,0,.16)}:host.pl-button--primary.disabled,:host.pl-button--primary:disabled{color:#6c757d;background:#dee2e6}.show>:host.pl-button--primary.dropdown-toggle,:host.pl-button--primary:not(:disabled):not(.disabled).active,:host.pl-button--primary:not(:disabled):not(.disabled):active{color:#fff;background-color:#1a88ff}.show>:host.pl-button--primary.dropdown-toggle:focus,:host.pl-button--primary:not(:disabled):not(.disabled).active:focus,:host.pl-button--primary:not(:disabled):not(.disabled):active:focus{box-shadow:none}:host.pl-button--secondary{color:#007bff;background-color:#fff;border-color:#007bff;min-width:86px}:host.pl-button--secondary:not(:disabled):not(.disabled):hover{color:#006fe6;background-color:#fff;border-color:currentColor;box-shadow:0 3px 6px rgba(0,0,0,.16)}:host.pl-button--secondary.focus,:host.pl-button--secondary:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5),0 3px 6px rgba(0,0,0,.16)}:host.pl-button--secondary.disabled,:host.pl-button--secondary:disabled{color:#6c757d;background-color:#dee2e6;border-color:#dee2e6}.show>:host.pl-button--secondary.dropdown-toggle,:host.pl-button--secondary:not(:disabled):not(.disabled).active,:host.pl-button--secondary:not(:disabled):not(.disabled):active{color:#1a88ff;background-color:#fff;border-color:currentColor}.show>:host.pl-button--secondary.dropdown-toggle:focus,:host.pl-button--secondary:not(:disabled):not(.disabled).active:focus,:host.pl-button--secondary:not(:disabled):not(.disabled):active:focus{box-shadow:none}:host.pl-button--danger{color:#fff;background-color:#dc3545;box-shadow:none;min-width:86px}:host.pl-button--danger:not(:disabled):not(.disabled):hover{color:#fff;background-color:#d32535;box-shadow:0 3px 6px rgba(0,0,0,.16)}:host.pl-button--danger.focus,:host.pl-button--danger:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5),0 3px 6px rgba(0,0,0,.16)}:host.pl-button--danger.disabled,:host.pl-button--danger:disabled{color:#6c757d;background:#dee2e6}.show>:host.pl-button--danger.dropdown-toggle,:host.pl-button--danger:not(:disabled):not(.disabled).active,:host.pl-button--danger:not(:disabled):not(.disabled):active{color:#fff;background-color:#e04b59}.show>:host.pl-button--danger.dropdown-toggle:focus,:host.pl-button--danger:not(:disabled):not(.disabled).active:focus,:host.pl-button--danger:not(:disabled):not(.disabled):active:focus{box-shadow:none}:host.pl-button--clear{color:#007bff;padding:.375rem .5rem}:host.pl-button--clear:not(:disabled):not(.disabled):hover{color:#006fe6}:host.pl-button--clear.focus,:host.pl-button--clear:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}:host.pl-button--clear.disabled,:host.pl-button--clear:disabled{color:#6c757d}.show>:host.pl-button--clear.dropdown-toggle,:host.pl-button--clear:not(:disabled):not(.disabled).active,:host.pl-button--clear:not(:disabled):not(.disabled):active{color:#1a88ff}.show>:host.pl-button--clear.dropdown-toggle:focus,:host.pl-button--clear:not(:disabled):not(.disabled).active:focus,:host.pl-button--clear:not(:disabled):not(.disabled):active:focus{box-shadow:none}"]})],o)}(),l=function(){function o(){}return o=s([t.NgModule({declarations:[i],exports:[i],imports:[n.CommonModule]})],o)}(),c=function(){function o(){this.snackService=new e.Subject}return o.prototype.get=function(){return this.snackService.asObservable()},o.prototype.add=function(o){this.snackService.next({action:"add",data:o})},o.prototype.remove=function(o){this.snackService.next({action:"remove",id:o})},o.prototype.clear=function(){this.snackService.next({action:"clear"})},o=s([t.Injectable()],o)}(),d=function(){function o(o){var n=this;this.snackbarService=o,this.onAdd=new t.EventEmitter,this.onRemove=new t.EventEmitter,this.onClear=new t.EventEmitter,this.snacks=[],this.snackbarService.get().subscribe((function(o){"add"===o.action?n.add(o.data):"remove"===o.action?n.remove(o.id):"clear"===o.action&&n.clear()}))}return o.prototype.add=function(o){var t,n=this,e=this.uuid();this.max&&this.max>0&&this.snacks.length===this.max&&this.remove(this.snacks[0].id),(o.timeout||this.timeout)&&(t=setTimeout((function(){n.remove(e)}),o.timeout||this.timeout));var r=a({id:e,timeoutObj:t},o);o.onAdd&&o.onAdd(r),this.onAdd&&this.onAdd.emit(r),this.snacks.push(r)},o.prototype.onClick=function(o){var t=o.action.onClick;t&&"function"==typeof t&&t(o),this.remove(o.id)},o.prototype.remove=function(o){var t=this.snacks.find((function(t){return t.id===o}));t&&(t.onRemove&&t.onRemove(t),this.onRemove&&this.onRemove.emit(t),t.timeoutObj&&clearTimeout(t.timeoutObj)),this.snacks=this.snacks.filter((function(t){return t.id!==o}))},o.prototype.clear=function(){this.snacks=[],this.onClear&&this.onClear.emit(!0)},o.prototype.uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(o){var t=16*Math.random()|0;return("x"===o?t:3&t|8).toString(16)}))},o.prototype.calcTextColor=function(o){if(!o)return null;var t=function(o){o=o.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(o,t,n,e){return t+t+n+n+e+e}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}(o);if(!t)return null;for(var n=[t.r/255,t.g/255,t.b/255],e=0;e<n.length;++e)n[e]<=.03928?n[e]=n[e]/12.92:n[e]=Math.pow((n[e]+.055)/1.055,2.4);return.2126*n[0]+.7152*n[1]+.0722*n[2]>.179?"#000":"#fff"},o.ctorParameters=function(){return[{type:c}]},s([t.Input()],o.prototype,"position",void 0),s([t.Input()],o.prototype,"max",void 0),s([t.Input()],o.prototype,"background",void 0),s([t.Input()],o.prototype,"accent",void 0),s([t.Input()],o.prototype,"color",void 0),s([t.Input()],o.prototype,"customClass",void 0),s([t.Input()],o.prototype,"timeout",void 0),s([t.Output()],o.prototype,"onAdd",void 0),s([t.Output()],o.prototype,"onRemove",void 0),s([t.Output()],o.prototype,"onClear",void 0),o=s([t.Component({selector:"flx-snackbar",template:'\n    <div class="pl-snackbars" [ngClass]="position || \'bottom-right\'">\n      <flx-snack\n        *ngFor="let snackbar of snacks"\n        [background]="snackbar.background || background"\n        [customClass]="snackbar.customClass || customClass"\n        [color]="\n          snackbar.color ||\n          color ||\n          calcTextColor(snackbar.background || background)\n        "\n      >\n        <div class="pl-snack--content">\n          <div\n            class="pl-snack--text"\n            [innerHtml]="snackbar.msg | safeHtml"\n          ></div>\n\n          <div\n            *ngIf="snackbar.action?.text"\n            class="pl-snack--action"\n            (click)="onClick(snackbar)"\n            [ngStyle]="{ color: snackbar.action.color || accent }"\n          >\n            {{ snackbar.action.text }}\n          </div>\n        </div>\n\n        <div class="pl-snack--close" *ngIf="!snackbar.hideClose">\n          <button\n            type="button"\n            class="close"\n            aria-label="Close"\n            (click)="remove(snackbar.id)"\n          >\n            <span aria-hidden="true">&times;</span>\n          </button>\n        </div>\n      </flx-snack>\n    </div>\n  ',styles:[".pl-snackbars{position:fixed;z-index:99999;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.pl-snackbars.bottom-left{left:30px;bottom:20px;-webkit-box-align:start;align-items:flex-start}.pl-snackbars.bottom-center{left:50%;-webkit-transform:translate(-50%,0);transform:translate(-50%,0);bottom:20px;-webkit-box-align:center;align-items:center}.pl-snackbars.bottom-right{right:30px;bottom:20px;-webkit-box-align:end;align-items:flex-end}.pl-snackbars.top-left{left:30px;top:30px;-webkit-box-align:start;align-items:flex-start}.pl-snackbars.top-center{left:50%;-webkit-transform:translate(-50%,0);transform:translate(-50%,0);top:30px;-webkit-box-align:center;align-items:center}.pl-snackbars.top-right{right:30px;top:30px;-webkit-box-align:end;align-items:flex-end}"]})],o)}(),p=function(){function o(){}return s([t.Input()],o.prototype,"background",void 0),s([t.Input()],o.prototype,"color",void 0),s([t.Input()],o.prototype,"customClass",void 0),o=s([t.Component({selector:"flx-snack",template:'\n    <div\n      class="pl-snack"\n      [ngStyle]="{ background: background, color: color }"\n      [ngClass]="customClass"\n    >\n      <ng-content></ng-content>\n    </div>\n  ',changeDetection:t.ChangeDetectionStrategy.OnPush,styles:['.close{float:right;font-size:1.5rem;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.5}.close:hover{color:#000;text-decoration:none}.close:not(:disabled):not(.disabled):focus,.close:not(:disabled):not(.disabled):hover{opacity:.75}button.close{padding:0;background-color:transparent;border:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}a.close.disabled{pointer-events:none}:host ::ng-deep .pl-snack{background:#343a40;color:#f8f9fa;position:relative;min-width:360px;max-width:480px;border-radius:4px;min-height:48px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:justify;justify-content:space-between;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";margin-bottom:.5rem}:host ::ng-deep .pl-snack--content{display:-webkit-box;display:flex;-webkit-box-align:start;align-items:flex-start;-webkit-box-flex:1;flex:1;-webkit-box-pack:justify;justify-content:space-between;flex-wrap:wrap;padding:1rem .5rem .5rem 1rem}:host ::ng-deep .pl-snack--text{word-wrap:break-word;overflow:hidden;font-weight:300;margin-bottom:.5rem}:host ::ng-deep .pl-snack--action{cursor:pointer;color:#007bff;margin-bottom:.5rem}:host ::ng-deep .pl-snack--close{align-self:flex-start;padding:.25rem .5rem}:host ::ng-deep .pl-snack--close .close{color:#f8f9fa;opacity:1;font-size:1.8rem;background-color:transparent;border:none;padding:0}']})],o)}(),u=function(){function o(o){this.sanitized=o}return o.prototype.transform=function(o){return this.sanitized.bypassSecurityTrustHtml(o)},o.ctorParameters=function(){return[{type:r.DomSanitizer}]},o=s([t.Pipe({name:"safeHtml"})],o)}(),b=function(){function o(){}return o=s([t.NgModule({declarations:[u],imports:[n.CommonModule],exports:[u]})],o)}(),f=function(){function o(){}var e;return e=o,o.forRoot=function(){return{ngModule:e,providers:[c]}},o=e=s([t.NgModule({declarations:[d,p],imports:[n.CommonModule,b],exports:[d]})],o)}(),m=function(){function o(){}return o.prototype.ngOnInit=function(){},o=s([t.Component({selector:"flx-title",template:"<ng-content></ng-content>\n",styles:[""]})],o)}(),h=function(){function o(){}return o=s([t.NgModule({declarations:[m],imports:[n.CommonModule],exports:[m]})],o)}();o.ButtonComponent=i,o.ButtonModule=l,o.SnackbarComponent=d,o.SnackbarModule=f,o.SnackbarService=c,o.TitleComponent=m,o.TitleModule=h,o.UtilsModule=b,Object.defineProperty(o,"__esModule",{value:!0})}));
//# sourceMappingURL=fluxit-components.umd.min.js.map