!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/animations"),require("@angular/core"),require("@ngx-translate/core"),require("@angular/http"),require("rxjs/add/operator/map"),require("rxjs/Subject"),require("rxjs/Rx"),require("rxjs/Observable"),require("@angular/router"),require("base-api-service"),require("@angular/forms"),require("@angular/common"),require("ngx-bootstrap"),require("ngx-bootstrap/dropdown")):"function"==typeof define&&define.amd?define(["exports","@angular/animations","@angular/core","@ngx-translate/core","@angular/http","rxjs/add/operator/map","rxjs/Subject","rxjs/Rx","rxjs/Observable","@angular/router","base-api-service","@angular/forms","@angular/common","ngx-bootstrap","ngx-bootstrap/dropdown"],e):e((t.ng=t.ng||{},t.ng.leafFramework=t.ng.leafFramework||{}),t._angular_animations,t.ng.core,t._ngxTranslate_core,t._angular_http,null,t.rxjs_Subject,t.rxjs_Rx,t.rxjs_Observable,t._angular_router,t.baseApiService,t._angular_forms,t._angular_common,t.ngxBootstrap,t.ngxBootstrap_dropdown)}(this,function(t,e,n,o,r,i,s,a,l,c,p,u,g,d,h){"use strict";function f(t){return new Q(t,"/assets/i18n/",".json")}function m(t,e){if(t)throw new Error(e+" has already been loaded. Import Core modules in the AppModule only.")}var y=e.trigger("fadeInAnimation",[e.transition(":enter",[e.style({opacity:0}),e.animate("0.3s",e.style({opacity:1}))])]),v=e.trigger("fadeInSlowAnimation",[e.transition(":enter",[e.style({opacity:0}),e.animate("0.6s",e.style({opacity:1}))]),e.transition(":leave",[e.style({opacity:1}),e.animate("0.6s",e.style({opacity:0}))])]),A=e.trigger("navUserItemEnter",[e.transition(":enter",[e.style({"max-height":0,"padding-top":"0px","padding-bottom":"0px",overflow:"hidden"}),e.animate("0.5s ease-out",e.style({"max-height":190,"padding-top":"33px","padding-bottom":"33px",overflow:"hidden"}))]),e.transition(":leave",[e.style({"max-height":190,"padding-top":"33px","padding-bottom":"33px",overflow:"hidden"}),e.animate("0.5s ease-out",e.style({"max-height":0,"padding-top":"0px","padding-bottom":"0px",overflow:"hidden"}))])]),b=function(){function t(){}return t}(),S=function(){function t(t){var e=this;this.provider=t,this.onLogout=new n.EventEmitter,t.getApplications().takeWhile(function(){return null==e.applications}).subscribe(function(t){e.applications=t})}return t.prototype.onApplicationChange=function(t){console.log(t)},t.prototype.clickLogout=function(){this.onLogout.emit()},t.decorators=[{type:n.Component,args:[{selector:"[leaf-application-changer]",template:'\n  <div class="btn-group" dropdown *ngIf="applications" [@fadeInAnimation]>\n    <button dropdownToggle type="button" class="btn btn-primary dropdown-toggle">\n      <i class="fa fa-cloud"></i>&nbsp; {{ \'leaf.application-changer.applications\' | translate }} <span class="caret"></span>\n    </button>\n    <ul *dropdownMenu class="dropdown-menu" role="menu">\n      <li role="menuitem" *ngFor="let app of applications" (click)="onApplicationChange(app)">\n          <a class="dropdown-item">{{app.name}}</a>\n      </li>\n      <li class="divider"></li>\n      <li role="menuitem" (click)="clickLogout()">\n          <a class="dropdown-item"><i class="fa fa-sign-out"></i>&nbsp; {{ \'leaf.common.signout\' | translate }}</a>\n      </li>\n    </ul>\n  </div>\n  ',animations:[y]}]}],t.ctorParameters=function(){return[{type:b}]},t.propDecorators={onLogout:[{type:n.Output}]},t}(),C=function(){function t(t,e,n){this.id=t,this.name=e,this.url=n}return t}(),I=function(){function t(t){this.http=t}return t.prototype.getData=function(){return this.http.get(this.getFilePath()).map(this.extractData)},t.prototype.extractData=function(t){var e=t.json()||{};return e.data||e},t}(),w=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),O=function(t){function e(e){var n=t.call(this,e)||this;return n.http=e,n}return w(e,t),e.prototype.getFilePath=function(){return"assets/data/languages.json"},e.decorators=[{type:n.Injectable}],e.ctorParameters=function(){return[{type:r.Http}]},e}(I),x=function(){function t(t,e){this.languageService=t,this.translate=e}return t.prototype.ngOnInit=function(){var t=this;this.languages&&0!==this.languages.length||this.languageService.getData().subscribe(function(e){t.languages=e,t.languageSelected=t.getInitialLanguageSelected(),t.saveLanguage(t.languageSelected)})},t.prototype.getInitialLanguageSelected=function(){var t=this.getLanguageFromLocalStorage(localStorage.language);return null==t&&(t=this.getDefaultLanguage()),t},t.prototype.getDefaultLanguage=function(){return this.languageSelected=this.languages[0]},t.prototype.getLanguageFromLocalStorage=function(t){if(null==t)return null;var e=null;return this.languages.forEach(function(n){if(t===n.id)return void(e=n)}),e},t.prototype.onLanguageChange=function(t){console.log("... language changed to: "+t),this.translate.use(t.id),this.saveLanguage(t),this.languageSelected=t},t.prototype.saveLanguage=function(t){localStorage&&(localStorage.language=t.id)},t.decorators=[{type:n.Component,args:[{selector:"leaf-language-selector",template:'\n  <div class="btn-group" dropdown *ngIf="languageSelected" [@fadeInAnimation]>\n    <button dropdownToggle type="button" class="btn btn-primary dropdown-toggle">\n      <i class="flag-icon flag-icon-squared {{languageSelected.icon}}" style="border: 2px solid #fff; border-radius: 50%; width: 22px; height: 22px;"></i>&nbsp; {{languageSelected.title}} <span class="caret"></span>\n    </button>\n    <ul *dropdownMenu class="dropdown-menu" role="menu">\n      <li role="menuitem" *ngFor="let lang of languages" (click)="onLanguageChange(lang)">\n          <a class="dropdown-item"><i class="flag-icon {{lang.icon}}"></i>&nbsp; {{lang.title}}</a>\n      </li>\n    </ul>\n  </div>\n  ',animations:[y]}]}],t.ctorParameters=function(){return[{type:O},{type:o.TranslateService}]},t.propDecorators={languages:[{type:n.Input}]},t}(),E=function(){function t(t,e,n){this.id=t,this.title=e,this.icon=n}return t}();!function(t){t.SUCCESS="SUCCESS",t.INFO="INFO",t.WARNING="WARNING",t.DANGER="DANGER"}(t.MessageStatus||(t.MessageStatus={})),function(t){t.BLOCKING="BLOCKING",t.CONFIRM="CONFIRM"}(t.MessageType||(t.MessageType={}));var M=function(){function e(e,n,o){if(void 0===n&&(n=t.MessageStatus.DANGER),void 0===o&&(o=t.MessageType.BLOCKING),this.text=e,this.status=n,this.type=o,(n=n.toUpperCase())!==t.MessageStatus.INFO&&n!==t.MessageStatus.SUCCESS&&n!==t.MessageStatus.WARNING&&n!==t.MessageStatus.DANGER)throw new Error("Invalid message status. Should be Info, Success, Warning or Danger.");if((o=o.toUpperCase())!==t.MessageType.BLOCKING&&o!==t.MessageType.CONFIRM)throw new Error("Invalid message type. Should be Blocking or Confirm.");this.text=e,this.status=n,this.type=o}return e}(),k=function(){function t(){this.subjectMsg=new s.Subject,this.subjectConfirmed=new s.Subject}return t.prototype.showMessage=function(t){this.subjectMsg.next(t)},t.prototype.confirmMessage=function(t){this.subjectConfirmed.next(t)},t.prototype.getMessage=function(){return this.subjectMsg.asObservable()},t.prototype.getConfirmed=function(){return this.subjectConfirmed.asObservable()},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[]},t}(),L=function(){function e(){this.onOk=new n.EventEmitter,this.onClose=new n.EventEmitter}return e.prototype.ngOnInit=function(){},e.prototype.getIcon=function(){switch(this.status){case t.MessageStatus.DANGER:return"fa-times";case t.MessageStatus.INFO:return"fa-info-circle";case t.MessageStatus.SUCCESS:return"fa-check ";case t.MessageStatus.WARNING:return"fa-exclamation-triangle";default:return"fa-times"}},e.prototype.getTitle=function(){switch(this.status){case t.MessageStatus.DANGER:return"Error";case t.MessageStatus.INFO:return"Info";case t.MessageStatus.SUCCESS:return"Success ";case t.MessageStatus.WARNING:return"Warning";default:return"Error"}},e.prototype.getOkTitle=function(){return"OK"},e.prototype.getCancelTitle=function(){return this.type===t.MessageType.BLOCKING?"Close":"Cancel"},e.prototype.show=function(){this.modal.show()},e.prototype.hide=function(){this.modal&&this.modal.isShown&&(this.type===t.MessageType.CONFIRM&&this.onOk.emit(!1),this.modal.hide(),this.onClose.emit(null))},e.prototype.onOKEvent=function(){this.onOk.emit(!0),this.modal.hide(),this.onClose.emit(null)},e.prototype.onCancelEvent=function(){this.hide()},e.decorators=[{type:n.Component,args:[{selector:"app-modal-message",template:'\n  <div class="modal fade" bsModal #modalMsg="bs-modal" [config]="{backdrop: \'static\'}" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">\n    <div class="modal-dialog modal-sm">\n      <div class="modal-content">\n        <div class="modal-header">\n          <h4 class="modal-title pull-left"><i class="fa {{getIcon()}}" aria-hidden="true"></i> {{getTitle()}}</h4>\n          <button type="button" class="close pull-right" aria-label="Close" (click)="modalMsg.hide()">\n            <span aria-hidden="true">&times;</span>\n          </button>\n        </div>\n        <div class="modal-body">{{message}}</div>\n        <div class="modal-footer">\n          <button type="button" class="btn btn-primary" (click)="onOKEvent()" *ngIf="type == \'CONFIRM\'">{{getOkTitle()}}</button>\n          <button type="button" class="btn btn-primary" (click)="onCancelEvent()">{{getCancelTitle()}}</button>\n        </div>\n      </div>\n    </div>\n  </div>\n  ',styles:["\n\n  .fa-times {\n      color: red;\n  }\n  .fa-info-circle {\n      color: blue;\n  }\n  .fa-exclamation-triangle {\n      color: orange;\n  }\n\n  .fa-exclamation-triangle {\n      color: orange;\n  }\n\n  .fa-check {\n      color: green;\n  }\n  "]}]}],e.ctorParameters=function(){return[]},e.propDecorators={message:[{type:n.Input}],status:[{type:n.Input}],type:[{type:n.Input}],onOk:[{type:n.Output}],onClose:[{type:n.Output}],modal:[{type:n.ViewChild,args:["modalMsg"]}]},e}(),R=e.trigger("navDropdownOpenClose",[e.state("true",e.style({opacity:1,left:"0px"})),e.state("false",e.style({opacity:0,left:"30px"})),e.state("void",e.style({opacity:0,left:"30px"})),e.transition("void => 1",e.animate("0.5s ease-out")),e.transition("0 => 1",e.animate("0.5s ease-out")),e.transition("1 => 0",e.animate("0s"))]),j=function(){function t(){}return t}(),P=function(){function t(t){this.loggerService=t,this.isShown=!1,this.onLogout=new n.EventEmitter}return t.prototype.ngOnInit=function(){this.loggerService.log("... initializing NavUserItemComponent from core module.")},t.prototype.clickLogout=function(){this.onLogout.emit()},t.prototype.onHidden=function(){this.loggerService.log("onHidden()"),this.isShown=!1},t.prototype.onShown=function(){this.loggerService.log("onShown()"),this.isShown=!0},t.prototype.isOpenChange=function(){console.log("Dropdown state is changed")},t.decorators=[{type:n.Component,args:[{selector:"[leaf-layout-navbar-user]",template:'\n  <span dropdown class="dropdown" (onShown)="onShown()" (onHidden)="onHidden()" (isOpenChange)="isOpenChange()">\n    <a dropdownToggle class="dropdown-toggle" >\n    <div>\n      <img alt="image" class="img-circle" src="http://10.129.100.30/rest/user/{{employee.id}}/photo?square=true" width="60" height="60">\n    </div>\n    <span class="block m-t-xs ng-binding">\n      <strong class="font-bold ng-binding">{{employee.name}}</strong><br>{{employee.surname}}\n    </span>\n    <small  ><span class="text-muted text-xs block">{{ \'leaf.common.options\' | translate }}&nbsp;&nbsp;<span class="fa fa-caret-down"></span></span></small>\n    </a>\n    <ul *dropdownMenu class="dropdown-menu" [@navDropdownOpenClose]="isShown">\n      <li><a>Mi perfil</a></li>\n      <li class="divider"></li>\n      <li (click)="clickLogout()"><a><i class="fa fa-sign-out"></i>&nbsp; {{ \'leaf.common.signout\' | translate }}</a></li>\n    </ul>\n  </span>\n  ',animations:[R]}]}],t.ctorParameters=function(){return[{type:j,decorators:[{type:n.Inject,args:["LoggerService"]}]}]},t.propDecorators={employee:[{type:n.Input,args:["leaf-layout-navbar-user"]}],onLogout:[{type:n.Output}]},t}(),U=function(){function t(){var t=this;this.response=l.Observable.create(function(e){return t.emitter=e})}return t.prototype.getSubscription=function(){return this.response},t.prototype.clear=function(){this.emitter.next([])},t}(),T=function(){function t(t,e){this.navSearchInputProvider=t,this.loggerService=e,this.counter=-1,this.focused=!1,this.isSearching=!1,this.previousSearch="",this.search={title:""}}return t.prototype.ngOnInit=function(){var t=this;this.loggerService.log("... initializing NavSearchInput from core module."),this.searchSubscription=this.navSearchInputProvider.getSubscription().subscribe(function(e){t.results=e,t.isSearching=!1}),this.subscription=a.Observable.interval(500).subscribe(function(){if(!t.isSearching){if(!t.search.title)return t.navSearchInputProvider.clear(),void(t.counter=-1);t.counter>0&&t.counter--,0==t.counter&&(t.counter--,t.isSearching=!0,t.navSearchInputProvider.search(t.search.title),t.previousSearch=t.search.title)}})},t.prototype.ngOnDestroy=function(){this.subscription.unsubscribe(),this.searchSubscription.unsubscribe()},t.prototype.onKeyUp=function(){this.waitStopWriting()},t.prototype.clearSearch=function(){this.search.title="",this.navSearchInputProvider.search(this.search.title),this.previousSearch=this.search.title,this.counter=-1},t.prototype.waitStopWriting=function(){this.search.title!=this.previousSearch&&(this.counter=4)},t.prototype.onBlur=function(){this.focused=!1},t.prototype.onFocus=function(){this.focused=!0},t.decorators=[{type:n.Component,args:[{selector:"[leaf-nav-search-input]",template:'\n    <style>\n    .leaf-nav-search .search-results {\n      position: relative;\n    }\n\n    .leaf-nav-search .search-results ul {\n      position: absolute;\n      margin: 0px;\n      padding: 0px;\n      background-color: white;\n      width: 100%;\n      border-radius: 0px 0px 16px 16px;\n      border: 1px solid #cccccc;\n      border-top: none;\n      list-style-type: none;\n      overflow: hidden;\n    }\n\n    .leaf-nav-search .search-results ul li {\n      padding: 10px;\n      border-top: 1px solid #cccccc;\n      cursor: pointer;\n    }\n\n    .leaf-nav-search .search-results ul li:hover {\n      background-color: #efefef;\n    }\n\n    </style>\n    <div class="leaf-nav-search">\n      <div style="position: relative;">\n        <div *ngIf="!isSearching && counter < 0 && search.title"\n        style="position: absolute; right: 0px; top: 0px; padding-top: 8px; padding-right: 12px;">\n          <i class="fa fa-times" style="cursor: pointer" (click)="clearSearch()"></i>\n        </div>\n        <div leaf-wait-and-load style="position: absolute; right: 0px; top: 0px; padding-top: 8px; padding-right: 10px;"\n          [dots]="3"\n          [currentDot]="counter"\n          [isLoading]="isSearching">\n        </div>\n      </div>\n      <input class="form-control icon-placeholder "\n      placeholder="&#xF002;"\n      maxlength="100"\n      [class.empty]="!search.title"\n      [(ngModel)]="search.title"\n      [class.focused]="focused"\n      [class.withResults]="search.title && results && results.length > 0"\n      (keyup)="onKeyUp()"\n      (blur)="onBlur()"\n      (focus)="onFocus()">\n\n      <div class="search-results" *ngIf="search.title && results && results.length > 0">\n        <ul>\n          <li *ngFor="let result of results" style="display: table; width: 100%">\n            <span [leaf-nav-employee-search-result]="result" *ngIf="result.type == \'EMPLOYEE\'" style="display: table-row;"></span>\n          </li>\n        </ul>\n      </div>\n\n    </div>\n  '}]}],t.ctorParameters=function(){return[{type:U},{type:j,decorators:[{type:n.Inject,args:["LoggerService"]}]}]},t}(),_=function(){function t(t,e,n,o){this.id=t,this.type=e,this.title=n,this.text=o}return t}(),D=function(){function t(){}return t.prototype.ngOnInit=function(){},t.prototype.ngOnDestroy=function(){},t.decorators=[{type:n.Component,args:[{selector:"[leaf-nav-employee-search-result]",template:'\n    <style>\n    </style>\n    <span style="display: table-cell; vertical-align: top; width: 1px; padding-right: 10px;">\n      <img alt="image" class="img-circle" src="http://10.129.100.30/rest/user/{{result.id}}/photo?square=true" width="40" height="40">\n    </span>\n    <span style="display: table-cell; vertical-align: top;">\n      <strong>{{result.title}}</strong><br/>\n      <small>{{result.text}}</small>\n    </span>\n  '}]}],t.ctorParameters=function(){return[]},t.propDecorators={result:[{type:n.Input,args:["leaf-nav-employee-search-result"]}]},t}(),H=function(){function t(){this.spinnerSubject=new s.Subject,this.spinnerState=this.spinnerSubject.asObservable()}return t.prototype.show=function(){this.spinnerSubject.next({show:!0})},t.prototype.hide=function(){this.spinnerSubject.next({show:!1})},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[]},t}(),N=function(){function t(t,e){this.loggerService=t,this.spinnerService=e,this.visible=!1,this.count=0}return t.prototype.ngOnInit=function(){var t=this;this.loggerService.log("... initializing spinner component from core module."),this.spinnerStateChanged=this.spinnerService.spinnerState.subscribe(function(e){e.show?t.count++:t.count--,t.count>0?t.visible=!0:t.visible=!1})},t.prototype.ngOnDestroy=function(){this.spinnerStateChanged.unsubscribe()},t.decorators=[{type:n.Component,args:[{selector:"[leaf-spinner]",template:'\n    <a class="btn btn-primary minimalize-styl-item" *ngIf="visible" [@fadeInAnimation]><i class="fa fa-circle-o-notch fa-spin"></i></a>\n  ',animations:[y]}]}],t.ctorParameters=function(){return[{type:j,decorators:[{type:n.Inject,args:["LoggerService"]}]},{type:H}]},t}(),F=function(){function t(t,e){this.field=t,this.reverse=e}return t}(),q=function(){function t(){}return t.prototype.onClickLink=function(){this.sortOptions.field==this.field?this.sortOptions.reverse=!this.sortOptions.reverse:(this.sortOptions.field=this.field,this.sortOptions.reverse=!1)},t.decorators=[{type:n.Component,args:[{selector:"[table-sort-link]",template:'\n    <a (click)="onClickLink()">\n      {{ label }}\n      <i class="fa" [class.fa-sort-asc]="sortOptions.field == field && !sortOptions.reverse" [class.fa-sort-desc]="sortOptions.field == field && sortOptions.reverse"></i>\n    </a>\n  '}]}],t.ctorParameters=function(){return[]},t.propDecorators={sortOptions:[{type:n.Input}],field:[{type:n.Input,args:["table-sort-link"]}],label:[{type:n.Input}]},t}(),B=function(){function t(){}return t.prototype.ngOnInit=function(){this.dotsArray=Array(this.dots).fill(this.dots).map(function(t,e){return e})},t.prototype.ngOnDestroy=function(){},t.decorators=[{type:n.Component,args:[{selector:"[leaf-wait-and-load]",template:'\n  <div *ngIf="currentDot > 0 && !isLoading">\n    <small>\n    <i class="fa" *ngFor="let dot of dotsArray; let i = index;"\n    style="padding-left: 4px;"\n    [class.fa-circle]="(dots - i) >= currentDot"\n    [class.fa-circle-thin]="(dots - i) < currentDot">\n    </i>\n\n    </small>\n  </div>\n  <div *ngIf="isLoading">\n    <i class="fa fa-circle-o-notch fa-spin"></i>\n  </div>\n  '}]}],t.ctorParameters=function(){return[]},t.propDecorators={dots:[{type:n.Input}],currentDot:[{type:n.Input}],isLoading:[{type:n.Input}]},t}();!function(t){t.USER_ID="userId",t.TOKEN_ID="token"}(t.CookieIdentifiers||(t.CookieIdentifiers={}));var G={"leaf.application-changer.applications":"Aplicaciones","leaf.common.signout":"Salir","leaf.common.options":"Opciones"},z={"leaf.application-changer.applications":"Applications","leaf.common.signout":"Sign out","leaf.common.options":"Options"},K=new Map;K.set("es",G),K.set("en",z);var Q=function(){function t(t,e,n){void 0===e&&(e="/assets/i18n/"),void 0===n&&(n=".json"),this.http=t,this.prefix=e,this.suffix=n}return t.prototype.getTranslation=function(t){return this.getLeafObservable(t).combineLatest(this.getHttpSuscriber(t),function(t,e){var n={};return Object.assign(n,t,e),n})},t.prototype.getLeafObservable=function(t){return l.Observable.of(K.get(t))},t.prototype.getHttpSuscriber=function(t){return this.http.get(""+this.prefix+t+this.suffix).map(function(t){return t.json()})},t}(),W=function(){function e(t){this.apiConfig=t}return e.prototype.isUserLogged=function(){if("SkypAuthService"===this.apiConfig.authService.name)return!0;var t=this.getUserLogged(),e=this.getToken();return!p.CommonUtil.isEmpty(t)&&!p.CommonUtil.isEmpty(e)},e.prototype.getUserLogged=function(){return"SkypAuthService"===this.apiConfig.authService.name?null:p.CommonUtil.getCookie(t.CookieIdentifiers.USER_ID)},e.prototype.getToken=function(){return"SkypAuthService"===this.apiConfig.authService.name?null:p.CommonUtil.getCookie(t.CookieIdentifiers.TOKEN_ID)},e.prototype.addUserInfo=function(e,n){var o=p.CommonUtil.changeExpiredTime(60*n*1e3);document.cookie=t.CookieIdentifiers.USER_ID+"="+e+"; expires="+o+"; path=/"},e.prototype.addTokenInfo=function(e,n){var o=p.CommonUtil.changeExpiredTime(60*n*1e3);document.cookie=t.CookieIdentifiers.TOKEN_ID+"="+e+"; expires="+o+"; path=/"},e.prototype.removeUserInfo=function(){var e=p.CommonUtil.changeExpiredTime(0);document.cookie=t.CookieIdentifiers.USER_ID+"=; expires="+e+"; path=/"},e.prototype.removeTokenInfo=function(){var e=p.CommonUtil.changeExpiredTime(0);document.cookie=t.CookieIdentifiers.TOKEN_ID+"=; expires="+e+"; path=/"},e.ctorParameters=function(){return[{type:p.ApiConfig,decorators:[{type:n.Inject,args:["api.config"]}]}]},e}(),Y=function(){function t(t,e){this.router=t,this.authHelper=e}return t.prototype.canActivate=function(t,e){return console.log("... check if can active menu"),this.authHelper.isUserLogged()?(console.log("... the user is logged so you can activate the menu"),!0):(console.log("... the user is NOT logged so you will be redirected to the login page"),this.router.navigate(["/loginfff"],{queryParams:{returnUrl:e.url}}),!1)},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[{type:c.Router},{type:W}]},t}(),V=function(){function t(t,e){this.router=t,this.authHelper=e}return t.prototype.canActivate=function(t,e){return this.authHelper.isUserLogged()&&this.router.navigate(["/"],{queryParams:{returnUrl:e.url}}),!0},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[{type:c.Router},{type:W}]},t}(),J=function(){function t(t){this.apiConfig=t}return t.prototype.unwrap=function(t){var e=t.rejection?t.rejection:t;return e=e.originalError?e.originalError:e.originalStack?e.originalStack:e},t.prototype.handleError=function(t){if(console.error(t),t=this.unwrap(t),401===t.status||403===t.status||"UNAUTHORIZED"===t)return console.log("... the authentication session has expires or the user is not authorised!"),void(location.href=this.apiConfig.loginApp+"?tokenStorer="+encodeURIComponent(this.apiConfig.storeTokenUrl)+"&page="+encodeURIComponent(location.href));if(t.status>=400&&t.status<500)return void console.log("... the request is incorrect!");if(t.status>=500)return void console.log("... the server is not responding. Contact the administrator!");var e="";if(t instanceof r.Response){var n=t.json()||"";n.error||JSON.stringify(n);t.status>0&&(e+=t.status+" - "),e+=""+(t.statusText||"Error in the application")}else e=t.message?t.message:t.toString();alert(e)},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[{type:p.ApiConfig}]},t}(),Z=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),X=function(e){function o(t,n,o,r){var i=e.call(this,t,n)||this;return i.spinnerService=o,i.authHelper=r,i.NOT_REQUIRE_AUTH=["/oauth/token","logout"],i.AUTH_TYPE="Bearer",i}return Z(o,e),o.prototype.get=function(t,n){var o=this;return this.isHttpService(t)?this.canCallHttp(t)?(this.requestInterceptor(t),e.prototype.get.call(this,t,this.getRequestOptionArgs(n)).finally(function(){return o.onFinally()})):this.getAuthError():e.prototype.get.call(this,t,this.getRequestOptionArgs(n))},o.prototype.post=function(t,n,o){var r=this;return this.isHttpService(t)?this.canCallHttp(t)?(this.requestInterceptor(t),e.prototype.post.call(this,t,n,this.getRequestOptionArgs(o)).finally(function(){return r.onFinally()})):this.getAuthError():e.prototype.post.call(this,t,n,this.getRequestOptionArgs(o))},o.prototype.put=function(t,n,o){var r=this;return this.isHttpService(t)?this.canCallHttp(t)?(this.requestInterceptor(t),e.prototype.put.call(this,t,n,this.getRequestOptionArgs(o)).finally(function(){return r.onFinally()})):this.getAuthError():e.prototype.put.call(this,t,n,this.getRequestOptionArgs(o))},o.prototype.delete=function(t,n){var o=this;return this.isHttpService(t)?this.canCallHttp(t)?(this.requestInterceptor(t),e.prototype.delete.call(this,t,this.getRequestOptionArgs(n)).finally(function(){return o.onFinally()})):this.getAuthError():e.prototype.delete.call(this,t,this.getRequestOptionArgs(n))},o.prototype.isHttpService=function(t){return t&&t.startsWith("http")},o.prototype.canCallHttp=function(t){return this.authHelper.isUserLogged||!this.needAuthBefore(t)},o.prototype.needAuthBefore=function(t){return null==t?null:null==this.NOT_REQUIRE_AUTH.find(function(e){return t.indexOf(e)>=0})},o.prototype.getAuthError=function(){return a.Observable.throw({status:401,statusText:"UNAUTHORIZED"})},o.prototype.getRequestOptionArgs=function(e){e=e||new r.RequestOptions,e.headers=e.headers||new r.Headers,e.headers.get("content-type")||e.headers.append("content-type","application/json; charset=utf-8");var n=p.CommonUtil.getCookie(t.CookieIdentifiers.TOKEN_ID);return p.CommonUtil.isEmpty(n)||e.headers.set("Authorization",this.AUTH_TYPE+" "+n),e},o.prototype.requestInterceptor=function(t){this.needAuthBefore(t)&&this.spinnerService.show()},o.prototype.responseInterceptor=function(){this.spinnerService.hide()},o.prototype.onFinally=function(){this.responseInterceptor()},o.decorators=[{type:n.Injectable}],o.ctorParameters=function(){return[{type:r.ConnectionBackend},{type:r.RequestOptions},{type:H},{type:W}]},o}(r.Http),$=function(){function t(){this.cssClass="fixed-sidebar fixed-nav md-skin pace-done"}return t.prototype.minimalize=function(){var t=this.cssClass.indexOf(" mini-navbar");this.cssClass=t<0?this.cssClass+" mini-navbar":this.cssClass.substring(0,t)+this.cssClass.substring(t+" mini-navbar".length)},t.propDecorators={cssClass:[{type:n.HostBinding,args:["class"]}]},t}(),tt=function(){function t(t){this.applicationRef=t}return t.prototype.minimaliza=function(){this.applicationRef.components[0].instance.minimalize()},t.decorators=[{type:n.Component,args:[{selector:"[leaf-layout-minimalize]",template:'\n  <a class="navbar-minimalize minimalize-styl-2 btn btn-primary" (click)="minimaliza()"><i class="fa fa-bars"></i> </a>\n  '}]}],t.ctorParameters=function(){return[{type:n.ApplicationRef}]},t}(),et=function(){function t(t,e,n){this.title=t,this.action=e,this.icon=n}return t}(),nt=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),ot=function(t){function e(e){var n=t.call(this,e)||this;return n.http=e,n}return nt(e,t),e.prototype.getFilePath=function(){return"assets/data/menu.json"},e.decorators=[{type:n.Injectable}],e.ctorParameters=function(){return[{type:r.Http}]},e}(I),rt=function(){function t(t){this.menuService=t}return t.prototype.ngOnInit=function(){var t=this;this.items&&0!==this.items.length||this.menuService.getData().subscribe(function(e){t.items=e})},t.decorators=[{type:n.Component,args:[{selector:"[leaf-layout-navbar]",template:'\n  <ng-content select="[top-list-items]"></ng-content>\n  <li *ngFor="let menu of items" [routerLinkActive]="[\'active\']" [routerLinkActiveOptions]="{exact:true}">\n    <a routerLink="{{menu.action}}">\n      <i class="fa {{menu.icon}}"></i>\n      <span class="nav-label ng-binding">{{menu.title}}</span>\n      <span class="fa arrow" *ngIf="menu.items"></span>\n    </a>\n  </li>\n  <ng-content select="[bottom-list-items]"></ng-content>\n  '}]}],t.ctorParameters=function(){return[{type:ot}]},t.propDecorators={items:[{type:n.Input}]},t}(),it=function(){function t(t,e){this.authHelper=t,this.loggerService=e}return t.prototype.ngOnInit=function(){this.loggerService.log("... initializing header component from core module.")},t.prototype.isActive=function(){return this.authHelper.isUserLogged()},t.prototype.getUser=function(){return this.authHelper.getUserLogged()},t.decorators=[{type:n.Component,args:[{selector:"[leaf-layout-header]",template:'\n  <div class="navbar-header" style="display: table;">\n    <div style="display: table-row;">\n      <div style="display: table-cell;"><a leaf-layout-minimalize></a></div>\n      <div style="display: table-cell; vertical-align: middle; height: 60px;">\n        <ng-content select="[header-left]"></ng-content>\n      </div>\n      <div style="display: table-cell; padding-left: 10px; vertical-align: middle;" leaf-spinner></div>\n    </div>\n  </div>\n  <ng-content select="[header-right]"></ng-content>\n  '}]}],t.ctorParameters=function(){return[{type:W},{type:j,decorators:[{type:n.Inject,args:["LoggerService"]}]}]},t}(),st=function(){function t(t){this.loggerService=t,this.year=(new Date).getFullYear()}return t.prototype.ngOnInit=function(){this.loggerService.log("... initializing footer component from core module.")},t.decorators=[{type:n.Component,args:[{selector:"[leaf-layout-footer]",template:'\n  <div class="pull-right">\n      Welcome to the jungle!\n  </div>\n  <div>\n      <strong>Copyright</strong> Demo full application &copy; {{year}}\n  </div>\n  '}]}],t.ctorParameters=function(){return[{type:j,decorators:[{type:n.Inject,args:["LoggerService"]}]}]},t}(),at=function(){function t(){}return t.getErrorMessage=function(t,e){var n=new Map;return n.set("required","This field is mandatory"),n.set("invalidCreditCard","Is invalid credit card number"),n.set("invalidEmailAddress","Invalid email address"),n.set("invalidPassword","Password must be at least 6 characters long, and contain a number."),n.set("minlength","Minimum length "+(e?e.requiredLength:0)),n.set("invalidPositiveNumber","The value is invalid"),n.get(t)},t.positiveNumberValidator=function(t){return parseInt(t.value,10)>=0?null:{invalidPositiveNumber:!0}},t.creditCardValidator=function(t){return t.value.match(/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/)?null:{invalidCreditCard:!0}},t.emailValidator=function(t){return t.value.match(/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/)?null:{invalidEmailAddress:!0}},t.passwordValidator=function(t){return t.value.match(/^(?=.*[0-9])[a-zA-Z0-9!@#$%^&*]{6,100}$/)?null:{invalidPassword:!0}},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[]},t}(),lt=function(){function t(){}return t.prototype.ngOnInit=function(){},t.prototype.isInvalid=function(){return this.control&&this.control.touched&&!this.control.valid},t.prototype.hasError=function(t){return this.control&&this.control.hasError(t)&&this.control.touched},Object.defineProperty(t.prototype,"errorMessage",{get:function(){
if(this.validator)this._errorMessage=this.hasError(this.validator)?this.message||at.getErrorMessage(this.validator):null;else if(this.control.errors)for(var t in this.control.errors)if(this.hasError(t)){this._errorMessage=this.message||at.getErrorMessage(t);break}return this._errorMessage},enumerable:!0,configurable:!0}),t.decorators=[{type:n.Component,args:[{selector:"app-control-messages",template:'\n<div *ngIf="isInvalid()" class="help-block">{{ errorMessage }}</div>\n  '}]}],t.ctorParameters=function(){return[]},t.propDecorators={control:[{type:n.Input}],message:[{type:n.Input}],validator:[{type:n.Input}]},t}(),ct=function(){function t(t){this.loggerService=t,this.title="Page not found",this.message="Sorry, This page is not available"}return t.prototype.ngOnInit=function(){this.loggerService.log("... initializing page not found component from shared module.")},t.decorators=[{type:n.Component,args:[{selector:"leaf-layout-page-not-found",template:'\n  <div class="container text-center">\n      <h2>{{title}}</h2>\n      <img class="img-responsive" src="assets/images/404-Page-Not-Found.png" class="text-center">\n      <h4>{{message}}</h4>\n  </div>\n  '}]}],t.ctorParameters=function(){return[{type:j,decorators:[{type:n.Inject,args:["LoggerService"]}]}]},t}(),pt=function(){function t(){}return t}(),ut=function(){function t(t,e,n,o){this.formBuilder=t,this.route=e,this.router=n,this.authService=o,this.loading=!1}return t.prototype.ngOnInit=function(){this.authService.logout(),this.f=this.formBuilder.group({username:["",u.Validators.required],password:["",u.Validators.required]})},t.prototype.isInvalid=function(t){return t&&t.touched&&!t.valid},t.prototype.errorClass=function(t){var e=this.isInvalid(t);return{"has-error":e,"has-feedback":e}},t.prototype.login=function(){var t=this;if(this.f.dirty&&this.f.valid){this.loading=!0;var e=this.f.value.username,n=this.f.value.password;this.authService.login(e,n).subscribe(function(e){t.loading=!1,e.access_token?t.router.navigate([t.route.snapshot.queryParams.returnUrl||"/"]):t.showAuthError("Token not sent from service during authentication.")},function(e){t.showAuthError("The user is not authorized"),t.loading=!1})}},t.prototype.showAuthError=function(t){var e=this;this.authError=t,setTimeout(function(){e.authError=null},1e3)},t.decorators=[{type:n.Component,args:[{selector:"app-login",template:'\n  <div class="col-md-6 col-md-offset-3">\n      <h2>Login</h2>\n      <form [formGroup]="f" (ngSubmit)="login()" novalidate>\n          <div *ngIf="authError" id="message" role="alert" class="alert alert-danger"><i class="fa fa-remove"></i> {{authError}}</div>\n          <div class="form-group" [ngClass]="errorClass(f.controls.username)">\n              <label for="username">User name:</label>\n              <input type="text" class="form-control" id="username" formControlName="username" placeholder="Enter user name ...">\n              <span *ngIf="isInvalid(f.controls.username)" class="glyphicon glyphicon-remove form-control-feedback"></span>\n              <leaf-layout-control-messages [formControl]="f.controls.username" [message]="\'Username is required!\'"></leaf-layout-control-messages>\n          </div>\n          <div class="form-group" [ngClass]="errorClass(f.controls.password)">\n              <label for="pwd">Password:</label>\n              <input type="password" class="form-control" id="pwd" formControlName="password" placeholder="Enter password ...">\n              <span *ngIf="isInvalid(f.controls.password)" class="glyphicon glyphicon-remove form-control-feedback"></span>\n              <leaf-layout-control-messages [formControl]="f.controls.password" [message]="\'Password is required!\'"></leaf-layout-control-messages>\n          </div>\n          <div class="form-group">\n              <button type="submit" class="btn btn-primary" [disabled]="(f.dirty && !f.valid) || loading">Login</button>\n              <img *ngIf="loading" src="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" />\n          </div>\n      </form>\n  </div>\n  '}]}],t.ctorParameters=function(){return[{type:u.FormBuilder},{type:c.ActivatedRoute},{type:c.Router},{type:pt,decorators:[{type:n.Inject,args:["AuthService"]}]}]},t}(),gt=e.trigger("titleTemplateAnimation",[e.transition(":enter",[e.style({opacity:0,position:"relative",top:"-40px","transition-timing-function":"ease-in"}),e.animate("0.3s",e.style({opacity:1,top:"0px"}))])]),dt=function(){function t(){}return t.prototype.ngOnInit=function(){},t.decorators=[{type:n.Component,args:[{selector:"[leaf-page-template]",template:'\n        <div class="row wrapper border-bottom white-bg page-heading ng-scope" *ngIf="title"\n             [@titleTemplateAnimation]>\n            <div [ngClass]="{\'col-sm-4\': (titleRightWrapper.children.length > 0), \'col-sm-12\' : (titleRightWrapper.children.length === 0)}">\n                <h2 class="m-b-xxs">{{ title }}</h2>\n            </div>\n            <div class="col-sm-8" [ngClass]="{\'hidden\': titleRightWrapper.children.length === 0}">\n                <div class="pull-right m-t-md" #titleRightWrapper>\n                    <ng-content select="[title-right]"></ng-content>\n                </div>\n            </div>\n        </div>\n        <div class="row">\n            <div class="col-lg-12">\n                <div class="wrapper wrapper-content">\n                    <ng-content select="[content]"></ng-content>\n                </div>\n            </div>\n        </div>\n    ',animations:[gt]}]}],t.ctorParameters=function(){return[]},t.propDecorators={title:[{type:n.Input}]},t}(),ht=function(){function t(){}return t.prototype.transform=function(t){return t?t.split("\n").map(function(t){return"<p>"+t+"</p>"}).join("\n"):t},t.decorators=[{type:n.Pipe,args:[{name:"simpleFormat"}]}],t.ctorParameters=function(){return[]},t}(),ft=function(){function t(){}return t.decorators=[{type:n.NgModule,args:[{imports:[g.CommonModule,r.HttpModule,u.FormsModule,u.ReactiveFormsModule,c.RouterModule,d.ModalModule.forRoot(),h.BsDropdownModule.forRoot(),o.TranslateModule],declarations:[ut,ct,lt,dt,B,ht],exports:[g.CommonModule,r.HttpModule,u.FormsModule,u.ReactiveFormsModule,c.RouterModule,o.TranslateModule,d.ModalModule,h.BsDropdownModule,ut,ct,lt,dt,B,ht],providers:[{provide:r.Http,useClass:X,deps:[r.XHRBackend,r.RequestOptions,H,W]}],schemas:[n.CUSTOM_ELEMENTS_SCHEMA]}]}],t.ctorParameters=function(){return[]},t}(),mt=function(){function t(t){m(t,"LeafFrameworkCore")}return t.decorators=[{type:n.NgModule,args:[{imports:[ft,o.TranslateModule.forRoot({loader:{provide:o.TranslateLoader,useFactory:f,deps:[r.Http]}})],declarations:[it,st,rt,P,T,D,tt,N,x,S,L],exports:[ft,it,st,rt,P,T,D,tt,N,x,S,L],providers:[H,ot,O,Y,V,W,k]}]}],t.ctorParameters=function(){return[{type:t,decorators:[{type:n.Optional},{type:n.SkipSelf}]}]},t}(),yt=function(){function t(){}return t.decorators=[{type:n.NgModule,args:[{declarations:[q],exports:[q],schemas:[n.CUSTOM_ELEMENTS_SCHEMA]}]}],t.ctorParameters=function(){return[]},t}(),vt=function(){function t(){}return t.prototype.login=function(t,e){},t.prototype.logout=function(){},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[]},t}(),At=function(){function t(t,e,n){this.http=t,this.apiConfig=e,this.authHelper=n}return t.prototype.getServiceUrl=function(){return p.CommonUtil.getApiUrl("OAUTH_SERVICE_URL",this.apiConfig)||""},t.prototype.login=function(t,e){var n=this,o="grant_type=password&username="+t+"&password="+e,i=new r.Headers;i.append("Authorization","Basic "+btoa(this.apiConfig.credentials.clientId+":"+this.apiConfig.credentials.clientSecret)),i.append("Content-Type","application/x-www-form-urlencoded");var s=new r.RequestOptions({headers:i}),a=this.getServiceUrl();return null==a?null:this.http.post(a,o,s).map(function(e){var o=e.json()||{},r=o.expires_in||n.apiConfig.timeExpired;return"mock"===n.apiConfig.apiEnv&&(o.access_token="12345-67890-5555"),o.access_token&&(n.authHelper.addUserInfo(t,r),n.authHelper.addTokenInfo(o.access_token,r)),o})},t.prototype.logout=function(){this.authHelper.removeUserInfo(),this.authHelper.removeTokenInfo()},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[{type:r.Http},{type:p.ApiConfig,decorators:[{type:n.Inject,args:["api.config"]}]},{type:W}]},t}(),bt=function(){function t(){}return t.prototype.log=function(t){console.log(t)},t.prototype.error=function(t){console.error(t)},t.prototype.warn=function(t){console.warn(t)},t.decorators=[{type:n.Injectable}],t.ctorParameters=function(){return[]},t}();t.fadeInAnimation=y,t.fadeInSlowAnimation=v,t.navUserItemEnter=A,t.ApplicationChangerComponent=S,t.ApplicationChangerItem=C,t.ApplicationChangerProvider=b,t.LanguageSelectorComponent=x,t.LanguageService=O,t.Language=E,t.Message=M,t.MessageService=k,t.ModalMessageComponent=L,t.NavUserItemComponent=P,t.NavSearchInputComponent=T,t.SearchResultItem=_,t.NavSearchInputProvider=U,t.NavSearchEmployeeResultTypeComponent=D,t.SpinnerComponent=N,t.SpinnerService=H,t.SortOptions=F,t.TableSortLink=q,t.WaitAndLoadComponent=B,t.createTranslateLoader=f,t.AuthGuard=Y,t.LoginGuard=V,t.throwIfAlreadyLoaded=m,t.SimpleErrorHandler=J,t.InterceptedHttp=X,t.BaseAppComponent=$,t.MinimalizeComponent=tt,t.Menu=et,t.MenuService=ot,t.NavComponent=rt,t.HeaderComponent=it,t.FooterComponent=st,t.ControlMessagesComponent=lt,t.PageNotFoundComponent=ct,t.LoginComponent=ut,t.LeafPageTemplate=dt,t.LeafFrameworkCore=mt,t.LeafFrameworkShared=ft,t.LeafTableUtilsModule=yt,t.SimpleFormatPipe=ht,t.AuthService=pt,t.SkypAuthService=vt,t.OAuthService=At,t.ConsoleLoggerService=bt,t.JsonFileService=I,t.LoggerService=j,t.ValidationService=at,t.AuthHelper=W,Object.defineProperty(t,"__esModule",{value:!0})});