"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[1109],{1109:(I,h,s)=>{s.r(h),s.d(h,{YourturnPageModule:()=>S});var f=s(6019),p=s(9133),u=s(4599),l=s(8699),d=s(7582),O=s(4799),g=s(9550),m=s(7899),t=s(3668),C=s(2670),Y=s(4987),P=s(4501),T=s(6875),U=s(7086),G=s(8410);const R=[{path:"",component:(()=>{class n{constructor(e,i,r,o,c,v,y,E){this.gamesService=e,this.siteService=i,this.userService=r,this.alertController=o,this.translate=c,this.pushService=v,this.notificationService=y,this.router=E,this.giveUpAlertIsOpen=!1}ngOnInit(){this.notifcationChannel||(this.notifcationChannel=this.pushService.notificationChannel.subscribe(e=>{"/yourturn"===this.router.url&&this.getGames()})),this.gameDataChannel=this.gamesService.getGameDataObservable().subscribe(e=>{this.updateChildComponents()})}ngOnDestroy(){this.notifcationChannel&&this.notifcationChannel.unsubscribe(),this.gameDataChannel&&this.gameDataChannel.unsubscribe()}ionViewDidEnter(){}doRefresh(e){this.gamesService.doRefresh(e)}updateChildComponents(){if(this.listOfButtonLists&&this.listOfButtonLists.length>0)for(const e of this.listOfButtonLists)e.updateComponent()}clickOnButton(e){this.gamesService.activeGame=e,this.gamesService.activeQuiz=this.gamesService.returnQuizByGame(e),this.router.navigate(["break",{backTo:"wait"}])}clickOnDelete(e){this.presentGiveUpAlert(e)}presentGiveUpAlert(e){return(0,d.mG)(this,void 0,void 0,function*(){if(this.giveUpAlertIsOpen)return;this.giveUpAlertIsOpen=!0;const i=yield this.translate.get(["DOYOUREALLYWANTTOGIVEUP","CANCEL","IGIVEUP"]).toPromise(),r=i.DOYOUREALLYWANTTOGIVEUP,o=i.CANCEL,c=i.IGIVEUP;yield(yield this.alertController.create({message:r,buttons:[{text:o,role:"cancel",handler:()=>{this.giveUpAlertIsOpen=!1,this.updateChildComponents()}},{text:c,handler:()=>{this.giveUpAlertIsOpen=!1,this.gamesService.giveUpGame(e).pipe().subscribe({complete:()=>{this.getGames()}})}}]})).present()})}getGames(){this.siteService.userToken?this.userService.returnActiveUser().pipe((0,O.b)(e=>this.gamesService.getGames())).subscribe({error:e=>{if(console.error(e.message,e.name),"TIMEOUTERROR"===e)this.notificationService.showError("TIMEOUTERROR");else{if(!e.message.includes("nomooduellincourses"))throw"invalidtoken"===e.message&&this.header.onLogoutClick(),Error(e);this.notificationService.showWarning("NOMOODUELLINCOURSES")}},complete:()=>{this.updateChildComponents()}}):this.router.navigate(["/login"])}}return n.\u0275fac=function(e){return new(e||n)(t.Y36(C.B),t.Y36(Y.P),t.Y36(P.K),t.Y36(u.Br),t.Y36(T.sK),t.Y36(U._),t.Y36(G.g),t.Y36(l.F0))},n.\u0275cmp=t.Xpm({type:n,selectors:[["app-yourturn"]],viewQuery:function(e,i){if(1&e&&(t.Gf(m.G,5),t.Gf(g.F,5)),2&e){let r;t.iGM(r=t.CRH())&&(i.header=r.first),t.iGM(r=t.CRH())&&(i.listOfButtonLists=r)}},decls:7,vars:1,consts:[[1,"ion-no-border"],["slot","fixed",3,"ionRefresh"],[1,"pull-fab"],["name","crescent"],["avoid-super-tabs","true",3,"type","transmitClickOnButton","transmitDeleteThisButton"]],template:function(e,i){1&e&&(t.TgZ(0,"ion-header",0),t._UZ(1,"app-header"),t.qZA(),t.TgZ(2,"ion-content"),t.TgZ(3,"ion-refresher",1),t.NdJ("ionRefresh",function(o){return i.doRefresh(o)}),t.TgZ(4,"div",2),t._UZ(5,"ion-spinner",3),t.qZA(),t.qZA(),t.TgZ(6,"app-buttonlist",4),t.NdJ("transmitClickOnButton",function(o){return i.clickOnButton(o)})("transmitDeleteThisButton",function(o){return i.clickOnDelete(o)}),t.qZA(),t.qZA()),2&e&&(t.xp6(6),t.Q6J("type","YOURTURN"))},directives:[u.Gu,m.G,u.W2,u.nJ,u.PQ,g.F],styles:[""]}),n})()}];let A=(()=>{class n{}return n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=t.oAB({type:n}),n.\u0275inj=t.cJS({imports:[[l.Bz.forChild(R)],l.Bz]}),n})();var B=s(1382);let S=(()=>{class n{}return n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=t.oAB({type:n}),n.\u0275inj=t.cJS({imports:[[f.ez,p.u5,u.Pc,A,B.m]]}),n})()}}]);