!function(){function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n=1),p.xp6(1),p.ekj("dot-active",i.code.length>=2),p.xp6(1),p.ekj("dot-active",i.code.length>=3),p.xp6(1),p.ekj("dot-active",i.code.length>=4),p.xp6(26),p.Q6J("ngIf",i.hasPin)}}var _,M,w=[{path:"",component:(_=function(){function n(t,i,o,r,a,c){e(this,n),this.notificatinsservice=t,this.router=i,this.authService=o,this.toastService=r,this.alertController=a,this.localstoreService=c,this.username=d.N.defaultuser,this.password=d.N.defaultuserpwd,this.code=[],this.hasSession=!1,this.setPin=!1}var i,o,r;return i=n,(o=[{key:"ngOnInit",value:function(){window.localStorage.clear(),this.hasSession=!!this.localstoreService.get("UserData",!1);var e=this.localstoreService.get("UserData",{}),t=null==e?void 0:e.loginPreference;this.hasPin=!!(null==e?void 0:e.PIN),this.loginPreference=t||""}},{key:"validateUsername",value:function(){return this.username.trim().length>0}},{key:"validatePassword",value:function(){return this.password.trim().length>0}},{key:"presentAlert",value:function(e){return(0,g.mG)(this,void 0,void 0,regeneratorRuntime.mark(function t(){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.alertController.create({cssClass:"my-custom-class",header:"Mensagem do sistema",message:e,buttons:["OK"]});case 2:return n=t.sent,t.next=5,n.present();case 5:case"end":return t.stop()}},t,this)}))}},{key:"getToken",value:function(){this.notificatinsservice.getAndpostToken(this.username)}},{key:"Login",value:function(){return(0,g.mG)(this,void 0,void 0,regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.validateUsername()){e.next=13;break}if(!this.validatePassword()){e.next=10;break}return this.userattempt={username:this.username,password:this.password,domainName:d.N.domain,BasicAuthKey:""},e.next=5,this.authService.login(this.userattempt);case 5:if(e.t0=e.sent,!e.t0){e.next=8;break}this.authService.loginChat(this.userattempt),this.getToken(),this.hasSession=!0,this.hasPin=!1,this.setPin=!0,!this.hasPin||this.hasPin||this.router.navigate(["/home/events"]);case 8:e.next=11;break;case 10:this.toastService.badRequest("Por favor, insira a sua palavra-passe");case 11:e.next=14;break;case 13:this.toastService.badRequest("Por favor, insira o seu nome de utilizador");case 14:case"end":return e.stop()}},e,this)}))}},{key:"setCode",value:function(e){if(this.code.length<4&&this.code.push(e),4==this.code.length){var t=this.code.join("");l().SHA1(t),this.hasPin?this.pinLogin():this.storePin()}}},{key:"clearCode",value:function(){this.code=[]}},{key:"pinLogin",value:function(){var e=this.code.join(""),t=l().SHA1(e);this.localstoreService.get("UserData",{}),t==this.localstoreService.get("UserData",!1)?this.router.navigate(["/home/events"]):(this.toastService.badRequest("Pin incorreto"),this.code=[])}},{key:"storePin",value:function(){var e=this.code.join(""),t=l().SHA1(e),n=this.localstoreService.get("UserData",{});n.PIN=t,n.loginPreference="none",this.localstoreService.set("UserData",n),this.localstoreService.set("PIN",t),this.router.navigate(["/home/events"])}}])&&t(i.prototype,o),r&&t(i,r),n}(),_.\u0275fac=function(e){return new(e||_)(p.Y36(f.T),p.Y36(s.F0),p.Y36(h.e),p.Y36(v.k),p.Y36(c.Br),p.Y36(m.L))},_.\u0275cmp=p.Xpm({type:_,selectors:[["app-login"]],decls:4,vars:2,consts:[[1,"text-white"],[1,"main-wrapper"],["class","wrapper",4,"ngIf"],["class","main-content height-100",4,"ngIf"],[1,"wrapper"],[1,"bg-1","d-flex","justify-center","align-center"],[1,"bg-2","d-flex","justify-center","align-center"],[1,"bg-3","d-flex","justify-center","align-center"],[1,"bg-4","d-flex","justify-center","align-center"],[1,"div-logo"],["src","assets/images/fullLogo.png","alt","logo"],[1,"center","text-white"],[1,"form"],[1,"form-label","text-white"],[1,"form-input"],["type","text","name","input-username",3,"ngModel","ngModelChange"],["type","password","name","input-password",3,"ngModel","keyup.enter","ngModelChange"],[1,"d-flex","pt-25"],["fill","clear","expand","block","shape","round",1,"btn-ok","btn-login",3,"click"],[1,"msg-bottom","d-flex"],[1,"msg-bottom-p"],[1,"main-content","height-100"],[1,"align-center","justify-center"],[1,"div-top-header"],["src","assets/images/logo-bg.png","alt","logo"],["class","title",4,"ngIf"],[1,"d-flex","pt-25","align-center","justify-center"],[1,"dot"],[1,"terminal"],[1,"d-flex"],[1,"circle",3,"click"],[1,"d-flex","align-center","justify-center"],["class","voltar d-flex align-center justify-center pt-25 clear",3,"click",4,"ngIf"],["id","clear",1,"cy-clear","voltar","d-flex","align-center","justify-center","pt-25","clear",3,"click"],[1,"title"],[1,"voltar","d-flex","align-center","justify-center","pt-25","clear",3,"click"]],template:function(e,t){1&e&&(p.TgZ(0,"ion-content",0),p.TgZ(1,"div",1),p.YNc(2,b,24,2,"div",2),p.YNc(3,Z,40,11,"div",3),p.qZA(),p.qZA()),2&e&&(p.xp6(2),p.Q6J("ngIf",!t.hasSession&&!t.setPin||"none"==t.loginPreference&&!t.setPin),p.xp6(1),p.Q6J("ngIf",t.setPin||t.hasSession&&"pin"==t.loginPreference))},directives:[c.W2,r.O5,a._Y,a.JL,a.F,c.Ie,c.pK,c.j9,a.JJ,a.On,c.wd],styles:["[_nghost-%COMP%] ion-content[_ngcontent-%COMP%], app-login[_ngcontent-%COMP%] ion-content[_ngcontent-%COMP%]{background:linear-gradient(180deg,#42b9fe,#0782c9)!important}ion-content[_ngcontent-%COMP%]{background-color:#fff!important}.main-wrapper[_ngcontent-%COMP%]{background:linear-gradient(180deg,#42b9fe,#0782c9)!important;display:flex;width:100vw;height:100vh;overflow:auto}.wrapper[_ngcontent-%COMP%]{width:400px;height:auto;padding:0!important;margin:auto!important;overflow:auto}.logo[_ngcontent-%COMP%]{width:400px;height:400px;background-image:url(/assets/background/auth.svg);background-position:50%;background-repeat:no-repeat}.bg-1[_ngcontent-%COMP%]{width:250px;height:250px;background:#4cb9f825}.bg-1[_ngcontent-%COMP%], .bg-1[_ngcontent-%COMP%] .bg-2[_ngcontent-%COMP%]{overflow:auto;border-radius:50%;margin:auto}.bg-1[_ngcontent-%COMP%] .bg-2[_ngcontent-%COMP%]{width:225px;height:225px;background:#61bdf2b4}.bg-1[_ngcontent-%COMP%] .bg-2[_ngcontent-%COMP%] .bg-3[_ngcontent-%COMP%]{width:200px;height:200px;background:#96d3f8be}.bg-1[_ngcontent-%COMP%] .bg-2[_ngcontent-%COMP%] .bg-3[_ngcontent-%COMP%], .bg-1[_ngcontent-%COMP%] .bg-2[_ngcontent-%COMP%] .bg-3[_ngcontent-%COMP%] .bg-4[_ngcontent-%COMP%]{overflow:auto;border-radius:50%;margin:auto}.bg-1[_ngcontent-%COMP%] .bg-2[_ngcontent-%COMP%] .bg-3[_ngcontent-%COMP%] .bg-4[_ngcontent-%COMP%]{width:175px;height:175px;background:hsla(0,0%,100%,.918);padding:15px}.bg-1[_ngcontent-%COMP%] .bg-2[_ngcontent-%COMP%] .bg-3[_ngcontent-%COMP%] .bg-4[_ngcontent-%COMP%] .bg-4[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%}.div-logo[_ngcontent-%COMP%]{width:200px!important;margin:0 auto;padding-bottom:15px}.wrapper[_ngcontent-%COMP%] ion-input[_ngcontent-%COMP%]{font-size:16px}.wrapper[_ngcontent-%COMP%] ion-button[_ngcontent-%COMP%]{font-size:medium;margin-top:16px}ion-item[_ngcontent-%COMP%]{--background:transparent}.form[_ngcontent-%COMP%]{width:300px;margin:auto;overflow:auto}.form-label[_ngcontent-%COMP%]{margin:15px 0 5px;font-size:15px}.form-input[_ngcontent-%COMP%]{--background:#fff;--color:#000;border-radius:22.5px;margin:10px 0}.btn-login[_ngcontent-%COMP%]{font-size:16px}.div-top-header[_ngcontent-%COMP%]{margin:0 1.25em;padding-top:.9375em;border:0!important}.div-logo[_ngcontent-%COMP%]{background:transparent;width:8.75em;justify-content:center;display:flex}.div-logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;margin:0 auto}.circle[_ngcontent-%COMP%]{color:#fff;width:70px;height:70px;display:flex;align-items:center;justify-content:center;font-size:19pt;background:#44b5ea;border-radius:56px;margin-left:30px;margin-bottom:15px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.title[_ngcontent-%COMP%]{padding-top:32px}.terminal[_ngcontent-%COMP%]{padding-top:112px;margin-left:-30px;justify-content:center;display:flex;flex-direction:column;align-items:center}.clear[_ngcontent-%COMP%]{color:#44b5ea;font-size:12pt}.dot-active[_ngcontent-%COMP%]{background:#44b5ea}.dot[_ngcontent-%COMP%]{width:25px;height:25px;margin:0 10px 0 0;border:3px solid #44b5ea;box-sizing:border-box;border-radius:50px;-webkit-border-radius:50px;-moz-border-radius:50px;-ms-border-radius:50px;-o-border-radius:50px}.main-content[_ngcontent-%COMP%]{width:100vw;height:100vh;background-color:#fff;text-align:center;align-items:center;justify-content:center;background-image:url(/assets/background/auth.svg);background-size:686px 674px;background-position:50%;background-position-y:110px;background-repeat:no-repeat;margin:auto}.voltar[_ngcontent-%COMP%]{-webkit-user-select:none;-moz-user-select:none;user-select:none}.msg-bottom[_ngcontent-%COMP%]{width:100%;color:#fff;align-items:center;justify-content:center}.msg-bottom[_ngcontent-%COMP%] .msg-bottom-p[_ngcontent-%COMP%]{width:220px;position:absolute;bottom:0!important;text-align:center}@media only screen and (max-height: 746px){.msg-bottom-p[_ngcontent-%COMP%]{padding-top:20px;position:unset!important}}"]}),_)}],k=function(){var t=function t(){e(this,t)};return t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=p.oAB({type:t}),t.\u0275inj=p.cJS({imports:[[s.Bz.forChild(w)],s.Bz]}),t}(),O=((M=function t(){e(this,t)}).\u0275fac=function(e){return new(e||M)},M.\u0275mod=p.oAB({type:M}),M.\u0275inj=p.cJS({imports:[[r.ez,a.u5,c.Pc,k]]}),M)}}])}();