!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common"),require("@angular/material")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/forms","@angular/common","@angular/material"],e):e(t.ngxMaterialPasswordStrength={},t.ng.core,null,t.ng.common,t.ng.material)}(this,function(t,e,n,a,r){"use strict";var o="primary",i="accent",s="warn",c={at_least_eight_chars:0,at_least_one_lower_case_char:1,at_least_one_upper_case_char:2,at_least_one_digit_char:3,at_least_one_special_char:4};c[c.at_least_eight_chars]="at_least_eight_chars",c[c.at_least_one_lower_case_char]="at_least_one_lower_case_char",c[c.at_least_one_upper_case_char]="at_least_one_upper_case_char",c[c.at_least_one_digit_char]="at_least_one_digit_char",c[c.at_least_one_special_char]="at_least_one_special_char";var p=function(){function t(){var t=this;this.validators=Object.keys(c).map(function(t){return c[t]}),this.onStrengthChanged=new e.EventEmitter,this.criteriaMap=new Map,this.criteriaMap.set(c.at_least_eight_chars,RegExp(/^.{8,63}$/)),this.criteriaMap.set(c.at_least_one_lower_case_char,RegExp(/^(?=.*?[a-z])/)),this.criteriaMap.set(c.at_least_one_upper_case_char,RegExp(/^(?=.*?[A-Z])/)),this.criteriaMap.set(c.at_least_one_digit_char,RegExp(/^(?=.*?[0-9])/)),this.criteriaMap.set(c.at_least_one_special_char,RegExp(/^(?=.*?[" !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"])/)),this.passwordFormControl=new n.FormControl("",this.validators.map(function(e){return n.Validators.pattern(t.criteriaMap.get(e))}).slice())}return t.prototype.ngOnInit=function(){},t.prototype.ngOnChanges=function(t){t.externalError&&t.externalError.firstChange?this._color=o:t.externalError&&t.externalError.currentValue?this._color=s:this.password&&this.password.length>0?this.calculatePasswordStrength():this.reset()},Object.defineProperty(t.prototype,"strength",{get:function(){return this._strength?this._strength:0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._strength<=20?s:this._strength<=80?i:o},enumerable:!0,configurable:!0}),t.prototype._containAtLeastEightChars=function(){return this.containAtLeastEightChars=this.password.length>=8,this.containAtLeastEightChars},t.prototype._containAtLeastOneLowerCaseLetter=function(){return this.containAtLeastOneLowerCaseLetter=this.criteriaMap.get(c.at_least_one_lower_case_char).test(this.password),this.containAtLeastOneLowerCaseLetter},t.prototype._containAtLeastOneUpperCaseLetter=function(){return this.containAtLeastOneUpperCaseLetter=this.criteriaMap.get(c.at_least_one_upper_case_char).test(this.password),this.containAtLeastOneUpperCaseLetter},t.prototype._containAtLeastOneDigit=function(){return this.containAtLeastOneDigit=this.criteriaMap.get(c.at_least_one_digit_char).test(this.password),this.containAtLeastOneDigit},t.prototype._containAtLeastOneSpecialChar=function(){return this.containAtLeastOneSpecialChar=this.criteriaMap.get(c.at_least_one_special_char).test(this.password),this.containAtLeastOneSpecialChar},t.prototype.calculatePasswordStrength=function(){var t=[];t.push(this._containAtLeastEightChars(),this._containAtLeastOneLowerCaseLetter(),this._containAtLeastOneUpperCaseLetter(),this._containAtLeastOneDigit(),this._containAtLeastOneSpecialChar()),this._strength=20*t.filter(function(t){return t}).length,this.onStrengthChanged.emit(this.strength)},t.prototype.reset=function(){this._strength=0,this.containAtLeastEightChars=this.containAtLeastOneLowerCaseLetter=this.containAtLeastOneUpperCaseLetter=this.containAtLeastOneDigit=this.containAtLeastOneSpecialChar=!1},t.decorators=[{type:e.Component,args:[{selector:"ngx-material-password-strength",template:'\n    <mat-progress-bar mode="determinate"\n                      [color]="color"\n                      [value]="strength">\n    </mat-progress-bar>\n  ',styles:["\n\n  "]}]}],t.ctorParameters=function(){return[]},t.propDecorators={password:[{type:e.Input}],validators:[{type:e.Input}],externalError:[{type:e.Input}],onStrengthChanged:[{type:e.Output}]},t}(),l=function(){function t(){}return t.prototype.ngOnInit=function(){},t.decorators=[{type:e.Component,args:[{selector:"ngx-material-password-strength-info",template:'\n    <mat-card>\n      <mat-card-content fxLayout="column" fxLayoutAlign="start">\n\n        <div class="info-row">\n          <div *ngIf="passwordComponent.containAtLeastOneLowerCaseLetter; then done else error">\n          </div>\n          <ng-template #done>\n            <mat-icon color="primary">done</mat-icon>\n          </ng-template>\n          <ng-template #error>\n            <mat-icon color="warn">error</mat-icon>\n          </ng-template>\n          <div>\n            <p>contains at least one lower character</p>\n          </div>\n        </div>\n\n        <div class="info-row">\n          <div *ngIf="passwordComponent.containAtLeastOneUpperCaseLetter; then done else error">\n          </div>\n          <ng-template #done>\n            <mat-icon color="primary">done</mat-icon>\n          </ng-template>\n          <ng-template #error>\n            <mat-icon color="warn">error</mat-icon>\n          </ng-template>\n          <div>\n            <p>contains at least one upper character</p>\n          </div>\n        </div>\n\n        <div class="info-row">\n          <div *ngIf="passwordComponent.containAtLeastOneDigit; then done else error">\n          </div>\n          <ng-template #done>\n            <mat-icon color="primary">done</mat-icon>\n          </ng-template>\n          <ng-template #error>\n            <mat-icon color="warn">error</mat-icon>\n          </ng-template>\n          <div>\n            <p>contains at least one digit character</p>\n          </div>\n        </div>\n\n        <div class="info-row">\n          <div *ngIf="passwordComponent.containAtLeastOneSpecialChar; then done else error">\n          </div>\n          <ng-template #done>\n            <mat-icon color="primary">done</mat-icon>\n          </ng-template>\n          <ng-template #error>\n            <mat-icon color="warn">error</mat-icon>\n          </ng-template>\n          <div>\n            <p>contains at least one special character</p>\n          </div>\n        </div>\n\n        <div class="info-row">\n          <div *ngIf="passwordComponent.containAtLeastEightChars; then done else error">\n          </div>\n          <ng-template #done>\n            <mat-icon color="primary">done</mat-icon>\n          </ng-template>\n          <ng-template #error>\n            <mat-icon color="warn">error</mat-icon>\n          </ng-template>\n          <div>\n            <p>contains at least eight characters</p>\n          </div>\n        </div>\n\n        <div class="info-row">\n          <div *ngIf="passwordComponent.strength === 100; then done else error">\n          </div>\n          <ng-template #done>\n            <mat-icon color="primary">done</mat-icon>\n          </ng-template>\n          <ng-template #error>\n            <mat-icon color="warn">error</mat-icon>\n          </ng-template>\n          <div>\n            <p>Password\'s strength = {{passwordComponent.strength}} %100</p>\n          </div>\n        </div>\n\n      </mat-card-content>\n    </mat-card>\n  ',styles:["\n    mat-card{flex-direction:row;place-content:stretch center;flex:1 1 0%}mat-card,mat-card mat-card-content{box-sizing:border-box;display:flex;align-items:stretch}mat-card mat-card-content{flex-direction:column;max-width:100%;place-content:stretch flex-start}mat-card mat-card-content mat-icon{margin-right:10px}mat-card mat-card-content .info-row{flex-direction:row;box-sizing:border-box;display:flex}\n  "]}]}],t.ctorParameters=function(){return[]},t.propDecorators={passwordComponent:[{type:e.Input}]},t}(),h=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t.decorators=[{type:e.NgModule,args:[{imports:[a.CommonModule,r.MatProgressBarModule,r.MatCardModule,r.MatIconModule],exports:[p,l],declarations:[p,l]}]}],t}();t.PasswordStrengthComponent=p,t.NgxMaterialPasswordStrengthInfoComponent=l,t.NgxMaterialPasswordStrengthModule=h,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-material-password-strength.umd.min.js.map
