(self.webpackChunkgabinete_digital=self.webpackChunkgabinete_digital||[]).push([[6158],{26158:function(t,e,n){"use strict";n.r(e),n.d(e,{LoginPageModule:function(){return _}});var i=n(38583),o=n(3679),r=n(35957),c=n(39895),s=n(64762),a=n(92340),g=n(2527),d=n.n(g),l=n(37716),u=n(79744),p=n(37556),h=n(84465),f=n(66096);function m(t,e){if(1&t){const t=l.EpF();l.TgZ(0,"div",4),l.TgZ(1,"div",5),l.TgZ(2,"div",6),l.TgZ(3,"div",7),l.TgZ(4,"div",8),l.TgZ(5,"div",9),l._UZ(6,"img",10),l.qZA(),l.qZA(),l.qZA(),l.qZA(),l.qZA(),l.TgZ(7,"h3",11),l._uU(8,"Inicie a sess\xe3o"),l.qZA(),l.TgZ(9,"form",12),l.TgZ(10,"p",13),l._uU(11,"Email"),l.qZA(),l.TgZ(12,"ion-item",14),l.TgZ(13,"ion-input",15),l.NdJ("ngModelChange",function(e){return l.CHM(t),l.oxw().username=e}),l.qZA(),l.qZA(),l.TgZ(14,"p",13),l._uU(15,"Palavra-passe"),l.qZA(),l.TgZ(16,"ion-item",14),l.TgZ(17,"ion-input",16),l.NdJ("keyup.enter",function(){return l.CHM(t),l.oxw().Login()})("ngModelChange",function(e){return l.CHM(t),l.oxw().password=e}),l.qZA(),l.qZA(),l.TgZ(18,"div",17),l.TgZ(19,"button",18),l.NdJ("click",function(){return l.CHM(t),l.oxw().Login()}),l._uU(20,"Iniciar"),l.qZA(),l.qZA(),l.qZA(),l.TgZ(21,"div",19),l.TgZ(22,"p",20),l._uU(23,"Uma iniciativa do Gabinete do Presidente da Rep\xfablica"),l.qZA(),l.qZA(),l.qZA()}if(2&t){const t=l.oxw();l.xp6(13),l.Q6J("ngModel",t.username),l.xp6(4),l.Q6J("ngModel",t.password)}}function b(t,e){1&t&&(l.TgZ(0,"ion-title",34),l._uU(1,"Digite o PIN"),l.qZA())}function v(t,e){1&t&&(l.TgZ(0,"ion-title",34),l._uU(1,"Digite o novo PIN"),l.qZA())}function x(t,e){if(1&t){const t=l.EpF();l.TgZ(0,"div",35),l.NdJ("click",function(){return l.CHM(t),l.oxw(2).loginPreference="none"}),l._uU(1," Entrar com senha "),l.qZA()}}function C(t,e){if(1&t){const t=l.EpF();l.TgZ(0,"div",21),l.TgZ(1,"div",22),l.TgZ(2,"div",23),l.TgZ(3,"div",9),l._UZ(4,"img",24),l.qZA(),l.qZA(),l.YNc(5,b,2,0,"ion-title",25),l.YNc(6,v,2,0,"ion-title",25),l.TgZ(7,"div",26),l._UZ(8,"div",27),l._UZ(9,"div",27),l._UZ(10,"div",27),l._UZ(11,"div",27),l.qZA(),l.TgZ(12,"div",28),l.TgZ(13,"div",29),l.TgZ(14,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("1")}),l._uU(15,"1"),l.qZA(),l.TgZ(16,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("2")}),l._uU(17,"2"),l.qZA(),l.TgZ(18,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("3")}),l._uU(19,"3"),l.qZA(),l.qZA(),l.TgZ(20,"div",29),l.TgZ(21,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("4")}),l._uU(22,"4"),l.qZA(),l.TgZ(23,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("5")}),l._uU(24,"5"),l.qZA(),l.TgZ(25,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("6")}),l._uU(26,"6"),l.qZA(),l.qZA(),l.TgZ(27,"div",29),l.TgZ(28,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("7")}),l._uU(29,"7"),l.qZA(),l.TgZ(30,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("8")}),l._uU(31,"8"),l.qZA(),l.TgZ(32,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("9")}),l._uU(33,"9"),l.qZA(),l.qZA(),l.TgZ(34,"div",31),l.TgZ(35,"div",30),l.NdJ("click",function(){return l.CHM(t),l.oxw().setCode("0")}),l._uU(36,"0"),l.qZA(),l.qZA(),l.qZA(),l.YNc(37,x,2,0,"div",32),l.TgZ(38,"div",33),l.NdJ("click",function(){return l.CHM(t),l.oxw().clearCode()}),l._uU(39," Limpar "),l.qZA(),l.qZA(),l.qZA()}if(2&t){const t=l.oxw();l.xp6(5),l.Q6J("ngIf",t.hasPin),l.xp6(1),l.Q6J("ngIf",!t.hasPin),l.xp6(2),l.ekj("dot-active",t.code.length>=1),l.xp6(1),l.ekj("dot-active",t.code.length>=2),l.xp6(1),l.ekj("dot-active",t.code.length>=3),l.xp6(1),l.ekj("dot-active",t.code.length>=4),l.xp6(26),l.Q6J("ngIf",t.hasPin)}}const P=[{path:"",component:(()=>{class t{constructor(t,e,n,i,o,r){this.notificatinsservice=t,this.router=e,this.authService=n,this.toastService=i,this.alertController=o,this.localstoreService=r,this.username=a.N.defaultuser,this.password=a.N.defaultuserpwd,this.code=[],this.hasSession=!1,this.setPin=!1}ngOnInit(){window.localStorage.clear(),this.hasSession=!!this.localstoreService.get("UserData",!1);let t=this.localstoreService.get("UserData",{});const e=null==t?void 0:t.loginPreference;this.hasPin=!!(null==t?void 0:t.PIN),this.loginPreference=e||""}validateUsername(){return this.username.trim().length>0}validatePassword(){return this.password.trim().length>0}presentAlert(t){return(0,s.mG)(this,void 0,void 0,function*(){const e=yield this.alertController.create({cssClass:"my-custom-class",header:"Mensagem do sistema",message:t,buttons:["OK"]});yield e.present()})}getToken(){this.notificatinsservice.getAndpostToken(this.username)}Login(){return(0,s.mG)(this,void 0,void 0,function*(){this.validateUsername()?this.validatePassword()?(this.userattempt={username:this.username,password:this.password,domainName:a.N.domain,BasicAuthKey:""},(yield this.authService.login(this.userattempt))&&(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"]))):this.toastService.badRequest("Por favor, insira a sua palavra-passe"):this.toastService.badRequest("Por favor, insira o seu nome de utilizador")})}setCode(t){if(this.code.length<4&&this.code.push(t),4==this.code.length){const t=this.code.join("");d().SHA1(t),this.hasPin?this.pinLogin():this.storePin()}}clearCode(){this.code=[]}pinLogin(){const t=this.code.join(""),e=d().SHA1(t);this.localstoreService.get("UserData",{}),e==this.localstoreService.get("UserData",!1)?this.router.navigate(["/home/events"]):(this.toastService.badRequest("Pin incorreto"),this.code=[])}storePin(){const t=this.code.join(""),e=d().SHA1(t);let n=this.localstoreService.get("UserData",{});n.PIN=e,n.loginPreference="none",this.localstoreService.set("UserData",n),this.localstoreService.set("PIN",e),this.router.navigate(["/home/events"])}}return t.\u0275fac=function(e){return new(e||t)(l.Y36(u.T),l.Y36(c.F0),l.Y36(p.e),l.Y36(h.k),l.Y36(r.Br),l.Y36(f.L))},t.\u0275cmp=l.Xpm({type:t,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(t,e){1&t&&(l.TgZ(0,"ion-content",0),l.TgZ(1,"div",1),l.YNc(2,m,24,2,"div",2),l.YNc(3,C,40,11,"div",3),l.qZA(),l.qZA()),2&t&&(l.xp6(2),l.Q6J("ngIf",!e.hasSession&&!e.setPin||"none"==e.loginPreference&&!e.setPin),l.xp6(1),l.Q6J("ngIf",e.setPin||e.hasSession&&"pin"==e.loginPreference))},directives:[r.W2,i.O5,o._Y,o.JL,o.F,r.Ie,r.pK,r.j9,o.JJ,o.On,r.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}}"]}),t})()}];let Z=(()=>{class t{}return t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=l.oAB({type:t}),t.\u0275inj=l.cJS({imports:[[c.Bz.forChild(P)],c.Bz]}),t})(),_=(()=>{class t{}return t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=l.oAB({type:t}),t.\u0275inj=l.cJS({imports:[[i.ez,o.u5,r.Pc,Z]]}),t})()}}]);