PageSourceSearch

https://gospring.ai/chunk-MPUKB2JP.js

js gospring.ai collected 2026-10-03 19:26:45 UTC 74,039 bytes, 10 lines download raw bytes

1import{a as bt}from"./chunk-YPXMN7TG.js";import{a as jt,b as zt}from"./chunk-ADCIAUQL.js";import{a as kt}from"./chunk-RHFBLODE.js";import{b as Dt}from"./chunk-EI6ZAIRF.js";import"./chunk-ONDLIFS3.js";import{a as Pt}from"./chunk-RCVP7PML.js";import{g as It}from"./chunk-YIKGPRPW.js";import{a as _t}from"./chunk-C2WG6HVI.js";import{b as Ct}from"./chunk-STJLRGYE.js";import{a as Ht}from"./chunk-NSGMQPEW.js";import"./chunk-C5IG3EE3.js";import{a as wt}from"./chunk-6TM2IQQP.js";import{a as yt,b as ke,c as vt,d as St,h as Qt}from"./chunk-MI267A4R.js";import"./chunk-6WMR65GN.js";import{H as qt,U as Tt}from"./chunk-4AGL4IFN.js";import{a as xt}from"./chunk-3SJUOXSC.js";import{a as Qe}from"./chunk-NAPW52VV.js";import{b as gt,c as ze}from"./chunk-WSCWC6WU.js";import{b as Te}from"./chunk-T75NPQZT.js";import{a as Ve}from"./chunk-I7PLSVRC.js";import{$b as at,$d as Z,Ae as V,Bg as pe,Cb as S,Db as w,De as Xe,Ea as x,Eb as Y,Ee as Je,Fe as $,Ga as h,Kd as W,L as fe,Nb as Ie,Nd as ce,Ob as tt,Pa as l,Pb as _e,Q as J,Qa as p,Qb as we,R as ge,Ra as _,Sf as Pe,T as O,Va as R,Vb as it,Wb as Ce,Wd as ht,X as ye,Xd as je,Y as ve,Ya as A,Yb as nt,Zb as st,_a as g,ba as M,bd as He,be as xe,c as Re,ca as B,ce as k,de as pt,ec as rt,fc as ot,fe as L,ge as P,jb as m,jc as be,je as N,kb as C,ke as T,lb as ae,lc as ct,lg as mt,mb as re,mc as Ue,na as G,nb as Ke,pa as Ze,pb as Se,pe as le,ra as se,re as ut,sa as Le,se as j,te as q,tg as he,ua as $e,ud as U,ue as H,vb as Q,vd as oe,vg as ft,wa as o,wb as Ne,wg as K,xa as d,xb as et,xc as Ye,xd as lt,xe as dt,xg as ee,ye as I,zg as qe}from"./chunk-672O2MLB.js";import"./chunk-QIBCMFWO.js";import{a as F,b as E,f as me,h as v}from"./chunk-V6KAXZDU.js";var X=me(Ve());var Lt=me(Ve());var De=class a{constructor(t,e){this.firestore=t;this.userService=e;this.instanceRef=He(this.firestore,"htFaceMash",this.htFachMashId,"instances")}instanceRef;htFachMashId="ZTveFRuSkERnERegYm4H";getInstanceById(t){return new Promise((e,i)=>{let s=P(this.instanceRef,t);N(s).then(n=>{let r=null;r=n.data(),r.id=n.id,e(r)}).catch(n=>{i(n)})})}createInstance(t){var e=this.userService.getUserContentRef();return new Promise((i,s)=>{let n=q();var r=E(F({},t),{viewed:!0,started:!0,completed:!1,refContentId:e.contentId,refAccountId:e.refAccountId,viewedOn:n,startedOn:n,createdOn:n,completedCount:0});xe(this.instanceRef,r).then(c=>{i(c)}).catch(c=>{s(c)})})}updateInstance(t,e){return new Promise((i,s)=>{e.started&&(e.startedOn=q()),e.completed&&(e.completedOn=q()),e.updatedOn=q();let n=P(this.instanceRef,t);ce(n,e,{merge:!0}).then(r=>{i(r)}).catch(r=>{s(r)})})}updateInstanceForPlayAgain(t){return new Promise((e,i)=>{let s=E(F({},t),{completed:!1,started:!0,startedOn:q(),updatedOn:q(),completedOn:L(),accuracyPoint:L(),speedBonus:L(),totalPoints:L(),totalCorrect:L(),totalQuestions:L(),totalTimeTaken:L(),currentlyDisplayed:L()}),n=P(this.instanceRef,t.id);ce(n,s,{merge:!0}).then(r=>{e(!0)}).catch(r=>{i(r)})})}updateInstanceStats(t,e){let i=P(this.firestore,"instance_stats",t);e.completed&&(e.completedOn=q()),e.updatedOn=q(),ce(i,e,{merge:!0})}updateInstanceCategoryStats(t,e){let i=P(this.firestore,"instance_category_stats",t);e.completed&&(e.completedOn=q()),e.updatedOn=q(),ce(i,e,{merge:!0})}getInstanceStatsByInstanceId(t){return new Promise((e,i)=>{let s=P(this.firestore,"instance_stats",t);N(s).then(n=>{let r=n.data();e(r)}).catch(n=>{i(n)})})}getInstanceCategoryStatsByInstanceId(t){return new Promise((e,i)=>{let s=P(this.firestore,"instance_category_stats",t);N(s).then(n=>{let r=n.data();e(r)}).catch(n=>{i(n)})})}getQuizStats(t){return new Promise((e,i)=>{let s=P(this.firestore,"quiz_stats",t);N(s).then(n=>{let r=null;r=n.data(),e(r)}).catch(n=>{i(n)})})}getInstanceDetailsById(t){return new Promise((e,i)=>{let s=P(this.firestore,"htFaceMash",this.htFachMashId,"instances",t);N(s).then(n=>{let r;r=n.data(),r.id=n.id,e(r)}).catch(n=>{i(n)})})}getInstanceDetailsByQuizId(t,e,i){return new Promise((s,n)=>{let r,c=j(this.instanceRef,U("quiz","==",t),oe(e,i),le(1));W(c).then(u=>v(this,null,function*(){yield u.forEach(f=>{e==="totalPoints"&&(r=f.data().totalPoints),e==="createdOn"&&(r=f.data().startedOn),f.data().startedOn||(r=f.data().createdOn)}),s(r)}
1)).catch(u=>{console.log(u),n(u)})})}getQuizDuration(t){if(!(t&&t.startedOn&&t.completedOn))return"0 Seconds";let e=t.startedOn,s=t.completedOn-e,n=Number(s),r=Math.floor(n%(3600*24)/3600),c=Math.floor(n%3600/60),u=Math.floor(n%60),f=r>0?r+(r==1?" Hour, ":" Hours, "):"",y=c>0?c+(c==1?" Minute, ":" Minutes, "):"",z=u>0?u+(u==1?" Second":" Seconds"):"";return f+y+z}getInstanceDetails(t){return new Promise((e,i)=>{let s=[],n=j(this.instanceRef,U("id","in",t),U("completed","==",!0),oe("createdOn"));W(n).then(r=>{r.forEach(c=>{s.push(c.data().quiz)}),e(s)}).catch(r=>{console.log(r),i(r)})})}getinstanceByplayerIdAndQuizId(t,e){return new Promise((i,s)=>{let n=j(this.instanceRef,U("quiz","==",t),U("refPlayerId","==",e),U("completed","==",!0),le(1)),r;W(n).then(c=>{c.forEach(u=>{r=u.data()}),i(r||!1)}).catch(c=>{console.log(c),i(!1)})})}getChainDetails(t){return new Promise((e,i)=>v(this,null,function*(){let s=j(pt(this.firestore,"quizChain"),U("chainId","==",t)),n=yield W(s),r;n.forEach(c=>{r=c.data()}),e(r||null)}))}getChainDetailsForHtFaceMash(t){return new Promise((e,i)=>v(this,null,function*(){let s=j(He(this.firestore,"htFaceMash",this.htFachMashId,"quizChain")),n=yield W(s),r,c;n.forEach(u=>{r=u.data().nodes,r&&r.forEach(f=>{if(t.quizId==f.quizId){c=u.data().chainId;return}})}),e(c||null)}))}static \u0275fac=function(e){return new(e||a)(O(Z),O(ee))};static \u0275prov=J({token:a,factory:a.\u0275fac,providedIn:"root"})};var Ot=me(Ve());var Fe=class a{constructor(t,e){this.firestore=t;this.cookieService=e}htFachMashId="ZTveFRuSkERnERegYm4H";createAnswer(t){var e=k(this.firestore,"htFaceMash",this.htFachMashId,"answers");let i=q();var s=E(F({},t),{createdOn:i,updatedOn:i});xe(e,s).then(n=>{}).catch(function(n){console.error("Error saving Answer: ",n)})}getAnswer(t){return new Promise((e,i)=>{let s=[],n=j(k(this.firestore,"htFaceMash",this.htFachMashId,"answers"),I("instance","==",t),ut("createdOn"));T(n).then(r=>{r.forEach(c=>{s.push(c.data())}),e(s)}).catch(r=>{i(r)})})}addQuestionsInAnswersCollection(t,e,i,s,n){let r=q();t.forEach(c=>{var u=P(this.firestore,"htFaceMash",this.htFachMashId,"answers",i+"_"+c.questionId),f={question:c.questionId,refPlayerId:n,relatedInstanceId:e,answerStatus:"n",createdOn:r};H(u,f).then(y=>{}).catch(y=>{console.log(y)})})}updateAnswerStatusinAnswersCollection(t){return new Promise((e,i)=>{let s=P(this.firestore,"htFaceMash",this.htFachMashId,"answers",t.instance+"_"+t.question),n=q();var r=E(F({},t),{createdOn:n,answerStatus:"c",updatedOn:n});dt(s,r).then(c=>{e(c)}).catch(c=>{i(c)})})}checkRelatedInstanceId(t,e,i,s){return new Promise((n,r)=>{let c=[],u=[],f=[],y=j(k(this.firestore,"htFaceMash",this.htFachMashId,"answers"),I("relatedInstanceId","==",e),I("refPlayerId","==",s));T(y).then(z=>{z.forEach(b=>{b.data()&&c.push(b.data())}),t.forEach(b=>{let D=Ot.find(c,{question:b.questionId});D?D.answerStatus=="n"&&u.push(b):f.push(b)}),t=u.concat(f),n(t)}).catch(z=>{r(z)})})}static \u0275fac=function(e){return new(e||a)(O(Z),O($))};static \u0275prov=J({token:a,factory:a.\u0275fac,providedIn:"root"})};var ue=me(Ht());var Ee=class a{constructor(t,e,i){this.firestore=t;this.helperService=e}user;userContentAccount;contentAccountMapping;isLoggedIn;isVerified;isBrowser=!1;__challengeDetail={};checkChallengeFriendRegistered(t,e){return new Promise((i,s)=>v(this,null,function*(){if(t){let n=null,r=j(k(this.firestore,"player"),I("refAccountId","==",e),I("emailId","==",t));yield T(r).then(c=>v(this,null,function*(){if(c.forEach(u=>{n||(n=u.data()),n.email=t}),n==null&&t.length>4){let u=j(k(this.firestore,"player"),I("refAccountId","==",e),I("phone","==",t));yield T(u).then(f=>{f.forEach(y=>{n||(n=y.data()),n.phone=t})})}})),i(n)}else s(null)}))}getChallengerDetails(t){return v(this,null,function*(){return new Promise((e,i)=>{let s=null;if(t){let n=P(this.firestore,"player",t);N(n).then(r=>{s=r.data(),e(s)})}else i(null)})})}getAnyoneRendomPlayerDetails(t,e){return new Promise((i,s)=>v(this,null,function*(){if(t){let n=null,r=j(k(this.firestore,"player"),I("refAccountId","==",t),oe("creationDate"),lt(1));yield T(r).then(c=>
1v(this,null,function*(){c.forEach(u=>v(this,null,function*(){let f=u.data().serialNumber,y=Math.floor(Math.random()*f)+1,z=j(k(this.firestore,"player"),I("refAccountId","==",t),I("serialNumber","==",y),le(1));yield T(z).then(b=>v(this,null,function*(){b.forEach(D=>{n=D.data()}),i(n)}))}))}))}else s(null)}))}createChallenge(t){return new Promise((e,i)=>{this.getChallenges(t).then(s=>{s?e("already"):t?(t.creationDate=je(),t.id=this.helperService.uuidv4(),t.status="n",H(P(this.firestore,"challenges",t.id),t,{merge:!0}).then(n=>{e(!0)}).catch(n=>{i(!1)})):i(!1)})})}getChallenges(t=null){return new Promise((e,i)=>v(this,null,function*(){if(t){let s=null,n=j(k(this.firestore,"challenges"),I("challengeFrom","==",t.challengeFrom),I("challengeTo","==",t.challengeTo),I("challengerAccountId","==",t.challengerAccountId),I("quizId","==",t.quizId));yield T(n).then(r=>v(this,null,function*(){r.forEach(c=>{s=c.data()})})),e(s)}else i(null)}))}getUnreadChallenges(t,e){return new Promise((i,s)=>v(this,null,function*(){if(t){let n=[],r=j(k(this.firestore,"challenges"),I("challengerAccountId","==",t),I("challengeTo","==",e),I("status","==","n"));yield T(r).then(u=>v(this,null,function*(){u.forEach(f=>{let y=f.data(),z=(0,ue.default)(new Date(y.creationDate?.seconds*1e3)).format("DD/MM/YYYY hh:mmA");this.getPlayer(y.challengeTo,y.challengeFrom).then(b=>{let D=E(F({},y),{dateTime:z,challengeFromFullName:b.challengeFromFullName,challengeToFullName:b.challengeToFullName});n.push(D)})})}));let c=j(k(this.firestore,"challenges"),I("challengerAccountId","==",t),I("challengeFrom","==",e),I("status","==","n"));yield T(c).then(u=>v(this,null,function*(){u.forEach(f=>{let y=f.data(),z=(0,ue.default)(new Date(y.creationDate?.seconds*1e3)).format("DD/MM/YYYY hh:mmA");this.getPlayer(y.challengeTo,y.challengeFrom).then(b=>{let D=E(F({},y),{dateTime:z,challengeFromFullName:b.challengeFromFullName,challengeToFullName:b.challengeToFullName});n.push(D)})})})),i(n)}else s(null)}))}getCompletedChallenges(t,e){return new Promise((i,s)=>v(this,null,function*(){if(t){let n=[],r=j(k(this.firestore,"challenges"),I("challengerAccountId","==",t),I("challengeTo","==",e),I("status","!=","n"));yield T(r).then(u=>v(this,null,function*(){u.forEach(f=>{let y=f.data(),z=(0,ue.default)(new Date(y.completionDate?.seconds*1e3)).format("DD/MM/YYYY hh:mmA");this.getPlayer(y.challengeTo,y.challengeFrom).then(b=>{let D=E(F({},y),{dateTime:z,challengeFromFullName:b.challengeFromFullName,challengeToFullName:b.challengeToFullName});n.push(D)})})}));let c=j(k(this.firestore,"challenges"),I("challengerAccountId","==",t),I("challengeFrom","==",e),I("status","!=","n"));yield T(c).then(u=>v(this,null,function*(){u.forEach(f=>{let y=f.data(),z=(0,ue.default)(new Date(y.completionDate?.seconds*1e3)).format("DD/MM/YYYY hh:mmA");this.getPlayer(y.challengeTo,y.challengeFrom).then(b=>{let D=E(F({},y),{dateTime:z,challengeFromFullName:b.challengeFromFullName,challengeToFullName:b.challengeToFullName});n.push(D)})})})),i(n)}else s(null)}))}updateOpenChallenges(t){return new Promise((e,i)=>{t.forEach(s=>{let n=E(F({},s),{read:!0});H(P(this.firestore,"challenges",n.id),n,{merge:!0}).then(r=>{e(!0)}).catch(r=>{i(!1)})})})}updateCompletedChallenge(t,e){return new Promise((i,s)=>{let n=E(F({},t),{read:!0,accepted:!0,status:"c",completionDate:je(),challengeToScore:e});H(P(this.firestore,"challenges",t.id),n,{merge:!0}).then(r=>{i(n)}).catch(r=>{s(!1)})})}getChallengeDetailById(t){return new Promise((e,i)=>{let s=null;if(t){let n=P(this.firestore,"challenges",t);N(n).then(r=>{s=r.data(),e(s)})}else i(null)})}getChallengeDetails(t){return new Promise((e,i)=>{if(t){let s=[];if(t.refAccountId&&t.refPlayerId&&t.quiz){let n=j(k(this.firestore,"challenges"),I("challengerAccountId","==",t.refAccountId),I("challengeTo","==",t.refPlayerId),I("quizId","==",t.quiz));T(n).then(r=>{r.forEach(c=>{let u=c.data();s.push(u)}),e(s)}).catch(r=>{console.log("Getting the document failed due to an error in the method getChallengeDetails : ",r)})}}else i(null)}).catch(e=>{console.log("Promise returned with an error : ",e)})}declined(t){return new Promise((e,i)=>{t.forEach(s=>{let n=E(F({},s),{status:"d",isSelected:ht(),completionDate:je()});H(P(this.firestore,"challenges",s.id),n,{merge:!0}).then(r=>{e(n)}).catch(r=>{i(!1)})})})}getPlayer(t,e){return v(this,null,function*(){if(t){let i={},s=j(k(this.firestore,"player"),I("playerId","==",t));yield T(s).then(r=>v(this,null,function*(){r.forEach(c=>{c.challengeToFullName||(i.challengeToFullName=c.data().fullName)})}));let n=j(k(this.firestore,"player"),I("playerId","==",e));return yield T(n).then(r=>v(this,null,function*(){r.forEach(c=>{c.challengeFromFullName||(i.challengeFromFullName=c.data().fullName)})})),i}else return null})}static \u0275fac=function(e){return new(e||a)(O(Z),O(K),O(G))};static \u0275prov=J({token:a,factory:a.\u0275fac,providedIn:"root"})};var ri=(a,t,e)=>({"dark-mode-background":a,"disable-scroll":t,"ht-result-container":e}),oi=a=>({"background-image":a}),Nt=a=>({"ht-score-notes":a}),ci=a=>({transform:a}),Bt=a=>({"score-meter-part-1-2-active":a}),li=a=>({"score-meter-part-3-active":a}),Rt=a=>({"ht-progress-bar":a}),hi=a=>({left:a}),Oe=a=>({"ht-play-again-btn":a});function pi(a,t){if(a&1&&(l(0,"div",14)(1,"span"),m(2),p()()),a&2){let e=g(2);h("ngClass",Q(2,Nt,e.htFaceMashPlayer)),o(2),C(e.scoreNote)}}function ui(a,t){if(a&1&&(l(0,"span",18),m(1),S(2,"translate"),l(3,"b",19),m(4),S(5,"translate"),p()()),a&2){let e=g(3);o(),ae("",w(2,3,"player_resultv2_youhit")," "),o(3),re("",w(5,5,"common_questiontext")," #",e.answers.length,"")}}function di(a,t){if(a&1&&(l(0,"span",18),m(1),S(2,"translate"),S(3,"translate"),p()),a&2){let e=g(3);o(),Ke("",w(2,3,"player_resultv2_with")," ",e.answers.length-(e.instance==null?null:e.instance.totalCorrect)," ",w(3,5,"player_resultv2_lives"),"")}}function mi(a,t){if(a&1&&(l(0,"div"),m(1),S(2,"translate"),p()),a&2){let e=g(3);o(),re("(",w(2,2,"player_resultv2_in")," ",e.timeTaken,")")}}function fi(a,t){if(a&1&&(l(0,"div"),m(1),S(2,"translate"),S(3,"translate"),S(4,"translate"),p()),a&2){let e=g(3);o(),Se("",w(2,5,"player_resultv2_yougot")," ",e.instance==null?null:e.instance.totalCorrect," ",w(3,7,"player_resultv2_outof")," ",e.instance.totalQuestions," ",w(4,9,"player_resultv2_correct"),"")}}function gi(a,t){if(a&1&&(l(0,"div"),m(1),S(2,"translate"),S(3,"translate"),S(4,"translate"),p()),a&2){let e=g(3);o(),Se("",w(2,5,"player_resultv2_yougot")," ",e.instance==null?null:e.instance.totalCorrect," ",w(3,7,"player_resultv2_outof")," ",e.instance.length&&e.instance.totalQuestions!=0?e.instance.totalQuestions:e.answers.length," ",w(4,9,"player_resultv2_correct"),"")}}function yi(a,t){if(a&1&&(l(0,"div",15),x(1,ui,6,7,"span",16)(2,di,4,7,"span",16)(3,mi,3,4,"div",17)(4,fi,5,11,"div",17)(5,gi,5,11,"div",17),p()),a&2){let e=g(2);o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.nLives)||(e.projectSettings==null?null:e.projectSettings.timeBound)),o(),h("ngIf",e.projectSettings==null?null:e.projectSettings.nLives),o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.nLives)&&(e.projectSettings==null?null:e.projectSettings.useTimer)&&e.mode!="p"),o(),h("ngIf",!(e.projectSettings!=null&&e.projectSettings.nLives)&&e.mode!="p"),o(),h("ngIf",e.mode==="p")}}function vi(a,t){a&1&&(l(0,"span"),m(1),S(2,"translate"),p()),a&2&&(
1o(),C(w(2,1,"player_resultv2_min")))}function Si(a,t){a&1&&(l(0,"span"),m(1),S(2,"translate"),p()),a&2&&(o(),C(w(2,1,"player_resultv2_mins")))}function Ii(a,t){if(a&1&&(l(0,"div",20),m(1),S(2,"translate"),S(3,"translate"),x(4,vi,3,3,"span",17)(5,Si,3,3,"span",17),p()),a&2){let e=g(2);o(),Se(" ",e.instance==null?null:e.instance.totalCorrect," ",w(2,7,"player_resultv2_correct")," (",w(3,9,"player_resultv2_attempted")," ",e.answers.length,") in ",e.projectSettings.timeBoundOption/60," "),o(3),h("ngIf",e.projectSettings.timeBoundOption==60),o(),h("ngIf",e.projectSettings.timeBoundOption>60)}}function _i(a,t){a&1&&(l(0,"div",21)(1,"span"),m(2),S(3,"translate"),p()()),a&2&&(o(2),C(w(3,1,"player_resultv2_yourscore")))}function wi(a,t){a&1&&(l(0,"span"),_(1,"img",27),p())}function Ci(a,t){a&1&&(l(0,"span"),_(1,"img",28),p())}function bi(a,t){a&1&&(l(0,"span"),_(1,"img",29),p())}function ji(a,t){a&1&&(l(0,"span"),_(1,"img",30),p())}function xi(a,t){a&1&&(l(0,"span"),_(1,"img",31),p())}function Pi(a,t){a&1&&(l(0,"span"),_(1,"img",32),p())}function qi(a,t){if(a&1&&(l(0,"div",22)(1,"div",23)(2,"span"),m(3),p()(),_(4,"div",23),l(5,"div",23)(6,"span"),m(7),p()(),_(8,"div",23),l(9,"div",23)(10,"span"),m(11),p()(),l(12,"div",24),x(13,wi,2,0,"span",17)(14,Ci,2,0,"span",17),p(),l(15,"div",23),m(16,"+"),p(),l(17,"div",25),x(18,bi,2,0,"span",17)(19,ji,2,0,"span",17),p(),l(20,"div",23),m(21,"="),p(),l(22,"div",24),x(23,xi,2,0,"span",17)(24,Pi,2,0,"span",17),p(),l(25,"div",26),m(26),S(27,"translate"),p(),_(28,"div",23),l(29,"div",26),m(30),S(31,"translate"),p(),_(32,"div",23),l(33,"div",26),m(34),S(35,"translate"),p()()),a&2){let e=g(2);o(3),C(e.speedBonus),o(4),C(e.accuracyPoint),o(4),C(e.speedBonus+e.accuracyPoint),o(2),h("ngIf",e.projectSettings.mode!="dark"),o(),h("ngIf",e.projectSettings.mode=="dark"),o(4),h("ngIf",e.projectSettings.mode!="dark"),o(),h("ngIf",e.projectSettings.mode=="dark"),o(4),h("ngIf",e.projectSettings.mode!="dark"),o(),h("ngIf",e.projectSettings.mode=="dark"),o(2),C(w(27,12,"player_resultv2_speed")),o(4),C(w(31,14,"player_resultv2_accuracy")),o(4),C(w(35,16,"player_resultv2_score"))}}function zi(a,t){a&1&&_(0,"div",46)}function ki(a,t){a&1&&_(0,"div",47)}function Ti(a,t){if(a&1&&(l(0,"div",33)(1,"div",34)(2,"div",35)(3,"div",36)(4,"div",37),x(5,zi,1,0,"div",38)(6,ki,1,0,"div",39),p()(),l(7,"span",40),m(8),S(9,"number"),p()(),l(10,"div",41),_(11,"div",42)(12,"div",43)(13,"div",44),p()(),l(14,"span",45),m(15),S(16,"translate"),p()()),a&2){let e=g(2);o(4),h("ngStyle",Q(13,ci,"rotate("+e.accuracyPoint/e.maxpoint*100*1.8+"deg)")),o(),h("ngIf",e.projectSettings.mode!="dark"),o(),h("ngIf",e.projectSettings.mode=="dark"),o(2),ae("",Y(9,8,e.accuracyPoint/e.maxpoint*100,"1.0-0"),"%"),o(3),h("ngClass",Q(15,Bt,e.accuracyPoint/e.maxpoint*100<26)),o(),h("ngClass",Q(17,li,e.accuracyPoint/e.maxpoint*100>=26&&e.accuracyPoint/e.maxpoint*100<=75)),o(),h("ngClass",Q(19,Bt,e.accuracyPoint/e.maxpoint*100>75)),o(2),C(w(16,11,"player_resultv2_score"))}}function Qi(a,t){a&1&&(l(0,"div"),m(1),S(2,"translate"),p()),a&2&&(o(),C(w(2,1,"player_resultv2_your")))}function Di(a,t){a&1&&(l(0,"div"),m(1),S(2,"translate"),p()),a&2&&(o(),C(w(2,1,"player_resultv2_you")))}function Fi(a,t){if(a&1&&(l(0,"div",48)(1,"div",14)(2,"span"),m(3),S(4,"translate"),p()(),l(5,"div",49)(6,"div"),m(7),S(8,"translate"),p(),l(9,"div",50),_(10,"mat-progress-bar",51),S(11,"number"),l(12,"span",52),m(13),p()()(),l(14,"div",49),x(15,Qi,3,3,"div",17)(16,Di,3,3,"div",17),l(17,"div",50),_(18,"mat-progress-bar",53),S(19,"number"),l(20,"span",54),S(21,"percent"),m(22),p()()()()),a&2){let e=g(2);o(),h("ngClass",Q(25,Nt,e.htFaceMashPlayer)),o(2),C(w(4,12,"player_resultv2_scorenotestitle")),o(2),h("ngClass",Q(27,Rt,e.htFaceMashPlayer)),o(2),C(w(8,14,"player_resultv2_top")),o(3),h("value",Y(11,16,e.topUserScore/(e.maxpoint/100),"1.0-0")),o(3),C(e.topUserScore),o(),h("ngClass",Q(29,Rt,e.htFaceMashPlayer)),o(),h("ngIf",e.projectSettings==null?null:e.projectSettings.useTimer),o(),h("ngIf",!(e.projectSettings!=null&&e.projectSettings.useTimer)),o(2),h("value",Y(19,19,(e.speedBonus+e.accuracyPoint)/(e.maxpoint/100),"1.0-0")),o(2),h("ngStyle",Q(31,hi,((e.speedBonus+e.accuracyPoint)/(e.maxpoint/100)>100?100:Y(21,22,(e.speedBonus+e.accuracyPoint)/(e.maxpoint/100),"1.0-0"))+"%")),o(2),C(e.speedBonus+e.accuracyPoint)}}function Ei(a,t){if(a&1&&(l(0,"span",57),m(1),p()),a&2){let e=g(3);o(),C(e.quizChainDetails==null?null:e.quizChainDetails.last_quiz_message)}}function Ai(a,t){if(a&1&&(l(0,"div",55),x(1,Ei,2,1,"span",56),p()),a&2){let e=g(2);o(),h("ngIf",e.quizChainDetails==null?null:e.quizChainDetails.last_quiz_message)}}function Oi(a,t){if(a&1){let e=R();l(0,"button",58),A("click",function(){M(e);let s=g(2);return B(s.playAgain())}),m(1),S(2,"translate"),p()}if(a&2){let e=g(2);h("ngClass",Q(4,Oe,e.htFaceMashPlayer)),o(),C(w(2,2,"player_resultv2_playagainbutton"))}}function Mi(a,t){if(a&1){let e=R();l(0,"button",59),A("click",function(){M(e);let s=g(2);return B(s.htPlayNextQuizOfChain())}),m(1),S(2,"translate"),p()}if(a&2){let e=g(2);h("ngClass",Q(4,Oe,e.htFaceMashPlayer)),o(),C(w(2,2,"player_resultv2_playnext"))}}function Bi(a,t){if(a&1){let e=R();l(0,"button",59),A("click",function(){M(e);let s=g(2);return B(s.playNextQuizOfChain("quizchain"))}),m(1),S(2,"translate"),p()}if(a&2){let e=g(2);h("ngClass",Q(4,Oe,e.htFaceMashPlayer)),o(),C(w(2,2,"player_resultv2_playnext"))}}function Ri(a,t){if(a&1){let e=R();l(0,"button",60),A("click",function(){M(e);let s=g(2);return B(s.playNextQuizOfChain("nextquiz"))}),m(1),S(2,"translate"),p()}a&2&&(o(),C(w(2,1,"player_resultv2_playnext")))}function Li(a,t){if(a&1){let e=R();l(0,"button",58),A("click",function(){M(e);let s=g(2);return B(s.playAgain())}),m(1),S(2,"translate"),p()}if(a&2){let e=g(2);h("ngClass",Q(4,Oe,e.htFaceMashPlayer)),o(),C(w(2,2,"player_resultv2_playagainbutton"))}}function Ni(a,t){if(a&1&&(l(0,"div",1)(1,"div",2),x(2,pi,3,4,"div",3)(3,yi,6,5,"div",4)(4,Ii,6,11,"div",5)(5,_i,4,3,"div",6)(6,qi,36,18,"div",7)(7,Ti,17,21,"div",8)(8,Fi,23,33,"div",9)(9,Ai,2,1,"div",10)(10,Oi,3,6,"button",11)(11,Mi,3,6,"button",12),p(),x(12,Bi,3,6,"button",12)(13,Ri,3,3,"button",13)(14,Li,3,6,"button",11),p()),a&2){let e=g();h("ngClass",et(15,ri,(e.projectSettings==null?null:e.projectSettings.mode)=="dark",e.isPopUp,e.htFaceMashPlayer))("ngStyle",Q(19,oi,e.projectSettings.mode=="dark"?"url("+e.backgroundImage+")":"")),o(2),h("ngIf",(e.projectSettings==null?null:e.projectSettings.showScoreNote)&&(e.projectSettings==null?null:e.projectSettings.showScore)&&(e.projectSettings==null?null:e.projectSettings.enablePointsForCorrAns)),o(),h("ngIf",!(e.projectSettings!=null&&e.projectSettings.timeBound)&&(e.projectSettings==null?null:e.projectSettings.enablePointsForCorrAns)),o(),h("ngIf",e.projectSettings==null?null:e.projectSettings.timeBound),o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.useTimer)&&(e.projectSettings==null?null:e.projectSettings.pointsForTime)&&(e.projectSettings==null?null:e.projectSettings.enablePointsForCorrAns)&&(e.projectSettings==null?null:e.projectSettings.showScore)),o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.useTimer)&&(e.projectSettings==null?null:e.projectSettings.pointsForTime)&&(e.projectSettings==null?null:e.projectSettings.showScore)),o(),h("ngIf",!(e.projectSettings!=null&&e.projectSettings.useTimer&&(e.projectSettings!=null&&e.projectSettings.pointsForTime))&&!(e.projectSettings!=null&&e.projectSettings.nLives||e.projectSettings!=null&&e.projectSettings.timeBound)&&(e.projectSettings==null?null:e.projectSettings.showScore)&&(e.projectSettings==null?null:e.projectSettings.enablePointsForCorrAns)),o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.showScore)&&(e.projectSettings==null?null:e.projectSettings.enablePointsForCorrAns)),o(),h("ngIf",e.isLastChainQuiz==!0),o(),h("ngIf",e.htFaceMashPlayer&&e.isLastChainQuiz),o(),h("ngIf",e.isLastChainQuiz==!1&&e.htFaceMashPlayer&&!e.isFirstCurrentDateQuiz),o(),h("ngIf",e.isLastChainQuiz==!1&&e.quizChainDetails),o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.playNextQuiz)&&(e.hasMoreQuestion||!e.projectSettings.xOutOfYEnableCookie)&&!e.quizChainDetails),o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.quizRetake)&&!e.htFaceMashPlayer&&!e.isLastChainQuiz)}}var Ae=class a{constructor(t,e,i,s,n,r,c,u,f,y,z,b,D,Yt,Ge,ie,We,ne,de,an,rn,on,cn,ln,hn,pn,un,dn,mn,fn){this._dialog=t;this.accountService=e;this.htInstanceService=i;this.feedbackService=s;this.translate=n;this.route=r;this.router=c;this.dialog=u;this.metaService=y;this.titleService=z;this.snackBar=b;this.projectSettingsService=D;this.previewstore=Yt;this.projectService=Ge;this.instanceService=ie;this.answerService=We;this.questionService=ne;this.helper=de;this.userService=an;this.messageService=rn;this.userProfileService=on;this.resultService=cn;this.storageService=ln;this.tempAccMapService=hn;this.cookieService=pn;this.quizChainService=un;this.htAnswerService=dn;this.playerService=mn;this.challengeService=fn;n.addLangs(["en","bn"]),n.setDefaultLang("en")}htAccountId="QLKcgdxAMGfkx5X6QUxzAIbtkq93";link;htFaceMashPlayer=!1;quizId;isPreview=!0;instanceId;quiz;quizStats;questions=[];instance;instanceStats;answers=[];shortUrl="";isBrowser;mode;maxPointsPerQuestion;projectSettings;maxpoint;leaders=[];youPosition=[];isLoaded=!1;_quizId;_createdBy="";timePerQuestion;accuracyPoint;speedBonus;contentId;previewDevice;timeTaken;scoreNote;score;ans=[];isLoadMore=!1;topUserScore=0;email;backgroundImage;isEmailSent=!1;oneClick=!1;quizChainDetails;isLastChainQuiz=!1;isOnBottom=!0;liveQuizId;isFirstCurrentDateQuiz=!1;isMicroWebsite=!1;hasMoreQuestion=!1;gifImages={awesome:["https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2Fimages%2Fresult-page-gif%2Fawesome-1.gif?alt=media&token=a371fb09-37a9-4b5f-be40-962e853b0f58"],highfive:["https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2Fimages%2Fresult-page-gif%2Fhigh-five-1.gif?alt=media&token=efb349ec-0834-413b-b2a2-f6d497a92a1e","https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2Fimages%2Fresult-page-gif%2Fhigh-five-2.gif?alt=media&token=2d40077d-9295-4972-87b8-8f28ccddf0d8"],good:["https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2Fimages%2Fresult-page-gif%2Fgood-1.gif?alt=media&token=2d28edd4-2108-4823-baab-301b0c86a740","https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2Fimages%2Fresult-page-gif%2Fgood-2.gif?alt=media&token=8a3b4819-2ebc-4322-afe1-ea17793591ca","https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2Fimages%2Fresult-page-gif%2Fgood-3.gif?alt=media&token=2f1e5c36-4fe4-4679-b9f5-bea52c198ea4"],applause:["https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2Fimages%2Fresult-page-gif%2Fapplause-1.gif?alt=media&token=015dc099-e2fc-4d98-b3a0-94afe8a0ba3b"],sad:["https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2Fimages%2Fresult-page-gif%2Fsad-1.gif?alt=media&token=14830431-09c0-4e24-8b9b-bb2e8a12d7dd"]};imgUrl;isIntQuiz=!1;isPopUp=!1;isLeaveAFeedback=!1;alreadyGivenFeedback=!1;openFromResult=!1;challengeId;challengeDetail={};accountDetails;embedPlayer=!1;totalQuestion;ngAfterViewChecked(){setTimeout(()=>{this.onScroll()},100)}set totalQuestionLength(t){}set hasMoreQuestionForXY(t){this.hasMoreQuestion=t}set projectSetting(t){this.projectSettings=t,this.maxPointsPerQuestion=this.projectSettings.pointsPerQuestion,this.projectSettings.useTimer||(this.maxpoint=this.projectSettings.pointsPerQuestion*this.totalQuestion),this.timePerQuestion=this.projectSettings.timePerQuestion}set isLastQuizOnChain(t){this.isLastChainQuiz=t}set chainDetails(t){this.quizChainDetails=t}set instanceObj(t){t&&t.id&&(this.instance=t,this.speedBonus=this.instance.speedBonus?this.instance.speedBonus:0,this.timeTaken=this.instance.totalTimeTaken?this.instance.totalTimeTaken:0,this.quizId=this.instance.quiz,this.totalQuestion=this.instance.totalQuestions,this.accuracyPoint=this.instance.accuracyPoint,this.getQuizStats(),this.isLoaded=!0,this.embedPlayer=!0)}language(t){t==null?this.translate.use("en"):this.translate.use(t)}getScoreNotes(){this.getTopUserData();let t=this.speedBonus+this.accuracyPoint;this.scoreNote=this.resultService.getScoreNote(t,this.projectSettings),this.isLoaded=!0}getQuizStats(){if(!this.quizId)return;let t=this.liveQuizId?this.liveQuizId:this.quizId;this.resultService.getQuizStats(t).then(e=>{this.quizStats=e}).catch(e=>{console.log("error",e)})}getQuizAccountTemplateMap(){!this.previewDevice&&this.quiz&&this.quiz.refAccountId&&this.tempAccMapService.getTemplateAccountMapDetails(this.quiz.refAccountId).then(t=>{t&&t.cssPath&&document.getElementById("theme")?.setAttribute("href",t.cssPath)})}getScore(){}ngOnInit(){return v(this,null,function*(){this.getTopUserData(),this.get
1ScoreNotes()})}playAgain(){let t=this.userService.getUserContentRef(),e=V.playerUrl,i;if(this.mode=="p"&&(i=e+"/pl/q/p/"+this.quizId+"?cid="+t.contentId+"&t=false"),this.mode=="i"&&!this.htFaceMashPlayer&&(this.projectSettings.quizRetake&&this.cookieService.check(this.quizId)&&this.cookieService.set(this.quizId,"{}",-1,"/",void 0,!1,"None"),i=e+"/pl/q/u/"+this.quizId+"?cid="+t.contentId+"&t=false"),this.mode=="i"&&this.htFaceMashPlayer){let r={quizId:this.quizChainDetails.nodes[0].quizId,completed:!1};var s=JSON.stringify(r);this.helper.checkCookieIsSupported("**XYZ**",{abc:"1234"})?this.cookieService.set(this.instance.chainId,s,60,"/",void 0,!1,"None"):window.localStorage.setItem(this.instance.chainId,s),i=e+"/pl/h/u/"+this.instance.chainId+"?cid="+t.contentId+"&t=false"}window.open(i,"_self")}updateTags(){if(this.quiz){this.titleService.setTitle(this.quiz.name);var t=[{name:"description",content:this.quiz.description},{name:"robots",content:"noindex,nofollow"},{property:"og:title",content:this.quiz.name},{property:"og:type",content:"website"},{property:"og:description",content:this.quiz.description},{property:"twitter:card",content:"summary_large_image"},{property:"twitter:title",content:this.quiz.name},{property:"twitter:description",content:this.quiz.description},{property:"og:type",content:"website"},{property:"og:type",content:"website"}];this.quiz.image&&(t.push({property:"og:image",content:this.quiz.image}),t.push({property:"twitter:image",content:this.quiz.image})),this.metaService.addTags(t)}}getQuiz(){return v(this,null,function*(){this.getQuizStats(),this.projectService.getQuizDetailsById(this.quizId).then(e=>v(this,null,function*(){if(e){this.quiz=e,this.getQuizAccountTemplateMap(),this._createdBy=this.quiz.createdBy,this.quiz&&(this.quiz.isTemplate||this.quiz.hasOwnsettings)?this.projectSettings=yield this.projectSettingsService.getProjectSettingsById(this.quiz.quizId):this.quiz.refTemplateId&&(this.projectSettings=yield this.projectSettingsService.getProjectSettingsById(this.quiz.refTemplateId)),this.projectSettings.mode=="dark"&&(this.messageService.changeColor("dark"),this.backgroundImage=this.storageService.getCoverImage(),!this.backgroundImage&&this.quiz&&(this.backgroundImage=this.quiz.coverImageUrl)),this.language(this.projectSettings.language),yield this.getQuestions(),"timePerQuestion"in this.projectSettings&&(this.timePerQuestion=this.projectSettings.timePerQuestion);var i="pointsPerQuestion"in this.projectSettings?this.projectSettings.pointsPerQuestion:0;if(this.maxPointsPerQuestion=i,"pointsForTime"in this.projectSettings&&this.projectSettings.pointsForTime&&(this.maxPointsPerQuestion=i+i),this.projectSettings.xOutOfY&&this.projectSettings.xOutOfYEnableCookie){var s={};if(this.cookieService.check(this.quizId)){var n=this.cookieService.get(this.quizId);s=JSON.parse(n)}else if(window.localStorage.getItem(this.quizId)!=null){var r=window.localStorage.getItem(this.quizId);s=JSON.parse(r)}s.hasMoreQuestionForXY&&(this.hasMoreQuestion=s.hasMoreQuestionForXY)}this.updateTags(),this.getUniqueUrl(),this.checkFeedback()}else this.router.navigateByUrl("./404?t=false")}),this.onError)})}onError=t=>{var e="Oops! Unable to contact server. Try refreshing.";this.snackBar.open(e,"",{duration:5e3})};getInstance(t){this.instance&&(this.quizId=this.instance.quiz,this.userService.getUserContentAccMapByContentId(this.instance.refContentId).then(e=>{this.userService.setUserContentRef(e),this.getQuiz(),this.mode=="i"&&this.getQuizChainDetails()}))}updateInstancForLiveQuiz(){this.instanceService.updateInstance(this.instance.id,{isLiveQuizCompleted:!0}).then(t=>{}).catch(t=>{console.log(t)})}getQuizChainDetails(){return v(this,null,function*(){if(this.htFaceMashPlayer){if(this.quizChainDetails=yield this.htInstanceService.getChainDetails(this.instance.chainId),this.quizChainDetails){let t;if(this.quizChainDetails&&this.cookieService.check(this.instance.chainId)?t=JSON.parse(this.cookieService.get(this.instance.chainId)):t=window.localStorage.getItem(this.instance.chainId),t&&t.quizId){let i=this.quizChainDetails.nodes.map(function(s){return s.quizId}).indexOf(t.quizId)===this.quizChainDetails.nodes.length-1}}localStorage.removeItem("answerObj")}else this.quizChainService.getChainByquizId(this.quizId).then(t=>{t&&(this.quizChainDetails=t,t&&t.nodes[t.nodes.length-1]==this.quizId)})})}setQuizChainCookie(){let t={quizId:this.instance.quiz,completed:!0};var e=JSON.stringify(t);this.helper.checkCookieIsSupported("**XYZ**",{abc:"1234"})?this.cookieService.set(this.instance.chainId,e,60,"/",void 0,!1,"None"):window.localStorage.setItem(this.instance.chainId,e)}playNextQuizOfChain(t){let e=this.userService.getUserContentRef(),i=V.playerUrl,s;t=="quizchain"?s=i+"/pll/ee/u/"+this.quizChainDetails?.chainId+"?cid="+e.contentId+"&t=false":t=="nextquiz"&&(s=i+"/pll/ee/p/"+this.quizId+"?cid="+e.contentId+"&t=false"),window.open(s,"_self")}htPlayNextQuizOfChain(){let t=this.userService.getUserContentRef(),e=V.playerUrl,i;this.mode=="i"&&(i=e+"/pl/h/u/"+this.instance.chainId+"?cid="+t.contentId+"&t=false");let s=new URLSearchParams(window.location.href);for(let[n,r]of s)n.includes("embedparenturl")&&(i=i+"&embedparenturl="+r);
1window.open(i,"_self")}getAnswers(){var t=new Re;this.htFaceMashPlayer?t.pipe(fe(i=>this.htAnswerService.getAnswer(this.instanceId))).subscribe(i=>{i.empty&&(this.answers=null),this.answers=[],i.forEach(s=>{let n=s;this.instance.startedOn<=n.createdOn&&this.answers.push(n)})}):t.pipe(fe(i=>this.answerService.getAnswer(this.instanceId))).subscribe(i=>{i.empty&&(this.answers=null),this.answers=[],i.forEach(s=>{let n=s;this.instance.startedOn<=n.createdOn&&this.answers.push(n)})}),t.next(this.quizId)}getQuestions(){return new Promise((t,e)=>{var i=new Re;i.pipe(fe(n=>this.questionService.getAllQuestionsByProjectId(n))).subscribe(n=>v(this,null,function*(){if(this.questions=[],n.empty)this.questions=[],t(this.projectSettings.pointsForTime);else{if(n.forEach(u=>{this.questions.push(u),u.questionType=="s"&&!this.liveQuizId&&(this.projectSettings.pointsForTime=!1)}),this.mode=="p"){this.answers=[];var r=0,c=this.previewstore.getquestion(this.quizId);c&&(this.questions.forEach((u,f)=>{let y=Lt.default.find(c,function(z){if(z.question==u.questionId)return!0});y&&(c[f]?.correct&&r++,this.answers.push({quiz:this.quizId,question:u.questionId,answer:y.answer,correct:y.correct,timeTaken:y.timeTaken}))}),this.instanceStats.totalCorrect=r)}if(!this.isLoadMore)for(let u=0;5>u;u++)this.ans.push(this.answers[u]);t(this.projectSettings.pointsForTime)}}),n=>{e(n)}),i.next(this.quizId)})}loadMore(){if(this.isLoadMore=!0,this.isLoadMore){this.ans=[];for(let t=0;this.answers.length>t;t++)this.ans.push(this.answers[t])}}getUniqueUrl(){this.getScoreNotes(),this.helper.getShortUrl({quizId:this.quizId}).then(this.onShortUrl).catch(t=>{console.log(t),this.onShortUrl(null)})}onShortUrl=t=>{if(this.quiz.refAccountId==this.htAccountId)this.getHtFaceMashQuizUrl();else if(t&&(this.shortUrl=t),!this.shortUrl&&this.isBrowser){let e=V.playerUrl,i=this.userService.getUserContentRef();this.shortUrl=e+"/pl/q/u/"+this.quizId+"?cid="+i.contentId+"&t=false"}};getUniqueLink(){let t=new URLSearchParams(window.location.href);for(let[e,i]of t)if(e.includes("embedparenturl"))return i;if(this.shortUrl)return this.shortUrl;if(this.isBrowser){let e=V.playerUrl,i=this.userService.getUserContentRef();return e+"/pl/q/u/"+this.quizId+"?cid="+i.contentId+"&t=false"}}getFacebookLink(){this.quiz.refAccountId==this.htAccountId?this.getHtFaceMashQuizUrl():this.link=this.getUniqueLink();let t="https://www.facebook.com/sharer/sharer.php?u="+this.link;window.open(t,"_blank")}shareQuizComment(){let t="";return this.projectSettings.resultPageWithComment&&(t=this.projectSettings.resultPageCommentMessage+" "),t}getTwitterLink(){this.quiz.refAccountId==this.htAccountId?this.getHtFaceMashQuizUrl():this.link=this.getUniqueLink();let t,e=this.shareQuizComment();this.projectSettings.shareResultWithScore&&this.projectSettings.showScore?t="http://twitter.com/share?text=Hey! I scored "+(this.accuracyPoint+this.speedBonus)+" in this quiz- "+this.quiz.quizName+". I invite you to give it a try! - "+e+this.link+"&hashtags=CuriosityRoad":t="http://twitter.com/share?text="+e+this.link,window.open(t,"_blank")}getLinkedInLink(){this.quiz.refAccountId==this.htAccountId?this.getHtFaceMashQuizUrl():this.link=this.getUniqueLink();let t="http://www.linkedin.com/shareArticle?mini=true&url="+this.link;window.open(t,"_blank")}getWhatsAppLink(){this.quiz.refAccountId==this.htAccountId?this.getHtFaceMashQuizUrl():this.link=this.getUniqueLink();let t,e=this.shareQuizComment();this.projectSettings.shareResultWithScore&&this.projectSettings.showScore?t="https://api.whatsapp.com/send?text=Hey! I scored "+(this.accuracyPoint+this.speedBonus)+" in the quiz - "+this.quiz.quizName+". I invite you to give it a try! - "+e+this.link:t="https://api.whatsapp.com/send?text="+e+this.link,window.open(t,"_blank")}getHtFaceMashQuizUrl(){return v(this,null,function*(){let t,e;yield this.accountService.getAccountDetails(this.quiz.refAccountId).then(i=>{i&&(t=i)}),e=yield this.helper.getEmbedUrlForQuiz(t,this.quiz),this.link=e,this.link=this.link.replace("%23","#")})}copyLink(){return v(this,null,function*(){var t=document.createElement("textarea");this.quiz.refAccountId==this.htAccountId?yield this.getHtFaceMashQuizUrl():(this.link=this.getUniqueLink(),this.link=this.link.replace("%23","#"));let e=this.shareQuizComment();this.projectSettings.shareResultWithScore&&this.projectSettings.showScore?t.value=this.link:t.value=this.link,t.setAttribute("readonly",""),document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t);var i="Copied to clipboard.";this.snackBar.open(i,"",{duration:2e3})})}initiateWebShare(){var t=this.getUniqueLink();if(this.isBrowser){let e;e=window.navigator,e&&e.share?e.share({url:t}).catch(i=>console.log("Error sharing",i)):alert("Share not supported")}}getPointsAndBonus(){let t=0,e=0,i=this.projectSettings.pointsForTime;var s="pointsPerQuestion"in this.projectSettings?this.projectSettings.pointsPerQuestion:0;
1return t=this.instance.accuracyPoint,this.answers.forEach(n=>{n.correct&&i&&(e=e+this.getSpeedBonusForAnswer(n,s))}),[t,e]}getSpeedBonusForAnswer(t,e){let i=this.timePerQuestion-t.timeTaken,s=0;return i>=20?s=e:i>=15?s=e*.8:i>=10?s=e*.6:i>=5?s=e*.4:i>=0?s=e*.2:s=0,s}isQuestion(t){return!!(t&&t.questionType!="None")}getLeaderboard(){if(!this.quizId)return;let t=Xe(Ye());var e=Je(t,"getLeaderboardList");if(this.liveQuizId)var i={liveQuizId:this.liveQuizId,limit:5,pageNo:1,instance:this.instanceId};else var i={quiz:this.quizId,limit:5,pageNo:1,instance:this.instanceId};e(i).then(this.onLeaderboard,this.onLeaderboardError)}onLeaderboardError=t=>{console.log(t)};onLeaderboard=t=>{let e=[];t?.data?.leaders&&(e=JSON.parse(JSON.stringify(t.data.leaders))),t?.data?.yourPosition&&(e=e.concat(t.data.yourPosition));let i=[];e.forEach(n=>{i.push(this.getPlayerDetails(n.instance))});let s={};Promise.all(i).then(n=>{n&&n.forEach(r=>{let c={};r.id&&r.name?(c.name=r.name,c.isLive=r.isLive):(c.name="",c.isLive=r.isLive),s[r.id]=c}),t?.data?.leaders&&(t.data.leaders=t.data.leaders.map(r=>(s[r.instance]?(r.name=s[r.instance].name,r.isLive=s[r.instance].isLive):r.name="",r)),this.leaders=t.data.leaders),t?.data?.yourPosition&&(e=e.concat(t.data.yourPosition),t.data.yourPosition=t.data.yourPosition.map(r=>(s[r.instance]?(r.name=s[r.instance].name,r.isLive=s[r.instance].isLive):r.name="",r)),this.youPosition=t.data.yourPosition)})};getPlayerDetails(t){let e={id:t,name:"",isLive:!1};return new Promise((i,s)=>{this.htFaceMashPlayer?this.htInstanceService.getInstanceDetailsById(t).then(n=>{n&&n.nickName?(e.name=n.nickName,i(e)):n&&n.refPlayerId?this.userProfileService.getPlayerDetailsByIdPromise(n.refPlayerId).then(r=>{r&&r.fullName&&(e.name=r.fullName),i(e)}):i(e)}):this.instanceService.getInstanceDetailsById(t).then(n=>{n&&(n.nickName||n.name)?(e.name=n.nickName?n.nickName:n.name,e.isLive=!!n.liveQuizId,i(e)):n&&n.refPlayerId?this.userProfileService.getPlayerDetailsByIdPromise(n.refPlayerId).then(r=>{r&&r.fullName&&(e.name=r.fullName),e.isLive=!!n.liveQuizId,i(e)}):i(e)})})}getTopUserData(){this.instanceService.getInstanceDetailsByQuizId(this.quizId,"totalPoints","desc").then(t=>{this.topUserScore=t,this.projectSettings.useTimer&&(this.maxpoint=this.topUserScore)})}playOtherQuiz(){let t=this.quiz.refAccountId,e=this.userService.getUserContentRef();window.self!==window.top&&this.isIntQuiz?window.parent.location.href=V.playerUrl+"/micro/"+t:this.isBrowser&&window.open("/pl/quizlist?cr="+this._createdBy+"&qi="+this.quizId+"&cid="+e.contentId+"&lan=en","_blank")}getEmail(t){this.email=t.target.value}validateEmail(){var t=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4}(\.[A-Za-z]{2,4})?)$/;return t.test(this.email)!==!1}shareAnswerOnEmail(){if(this.oneClick=!0,!!this.quizId){var t={instance:this.instance,quiz:this.quiz,questions:this.questions,answers:this.answers,top:this.topUserScore,maxpoint:this.maxpoint,email:this.email};this.callAnswerPreviewListApi(t)}}callAnswerPreviewListApi(t){let e=Math.floor(this.quizStats.totalPoints/this.quizStats.completedCount),i=this.speedBonus+this.accuracyPoint;t.average=e,t.you=i;let s=Xe(Ye());var n=Je(s,"getAnswerPreviewList");n(t).then(r=>{if(r.data&&r.data.id){if(this.isEmailSent=!0,this.liveQuizId){let u=JSON.stringify({sent:!0});window.localStorage.setItem("mail_sent_"+this.liveQuizId,u)}var c="Email sent successfullly.";this.snackBar.open(c,"",{duration:5e3})}else{this.isEmailSent=!1;var c="Email sent fail.";this.snackBar.open(c,"",{duration:5e3})}}).catch(r=>{console.log(r)})}redirectTo(){window.open("https://gospring.ai","_blank")}onScroll(){this.isBrowser&&(window.innerHeight+window.scrollY>=document.body.offsetHeight?this.isOnBottom=!1:this.isOnBottom=!0)}scroll(){this.isBrowser&&(window.scrollTo(0,window.scrollY+window.innerHeight),this.onScroll())}viewResults(){this.isPopUp=!1}openMicroLeaveAFeedback(t=null){t&&(this.openFromResult=t),this.isPopUp=!0,this.isLeaveAFeedback=!0}onBackResultPage(t){this.checkFeedback(),t?this.isPopUp=!1:this.isLeaveAFeedback=!1}checkFeedback(){this.projectSettings?.quizFeedback||(this.isPopUp=!1),this.feedbackService.getFeedbackByInstanceId(this.instanceId).then(t=>{t&&t.rating&&t.comment&&t.type=="o"&&t.source=="p"&&(this.alreadyGivenFeedback=!0)})}getChallengeDetails(t){this.challengeService.getChallengeDetails(t).then(e=>{e&&e.forEach(i=>
1{this.challengeDetail=i,this._updateCompletedChallenge(this.challengeDetail)})})}_updateCompletedChallenge(t){this.challengeService.updateCompletedChallenge(t,this.instanceStats.totalPoints).then(e=>{this.challengeDetail=e})}getAccountDetails(t){this.accountService.getAccountDetails(t).then(e=>{e&&(this.accountDetails=e)})}static \u0275fac=function(e){return new(e||a)(d(he),d(Ct),d(De),d(kt),d(ke),d(be),d(ct),d(he),d(G),d(rt),d(ot),d(mt),d(qe),d(bt),d(pe),d(Te),d(Qe),d(ze),d(K),d(ee),d(ft),d(It),d(zt),d(gt),d(jt),d($),d(pe),d(Fe),d(wt),d(Ee))};static \u0275cmp=ye({type:a,selectors:[["app-player-embed-result"]],hostBindings:function(e,i){e&1&&A("scroll",function(){return i.onScroll()},!1,$e)},inputs:{totalQuestionLength:"totalQuestionLength",hasMoreQuestionForXY:"hasMoreQuestionForXY",projectSetting:"projectSetting",isLastQuizOnChain:"isLastQuizOnChain",chainDetails:"chainDetails",instanceObj:"instanceObj"},decls:1,vars:1,consts:[["class","result-container",3,"ngClass","ngStyle",4,"ngIf"],[1,"result-container",3,"ngClass","ngStyle"],[1,"score"],["class","score-notes",3,"ngClass",4,"ngIf"],["class","hit-question",4,"ngIf"],["class","_timeBound",4,"ngIf"],["class","score-notes",4,"ngIf"],["class","_your-score",4,"ngIf"],["class","score-meter-container",4,"ngIf"],["class","score-notesParent",4,"ngIf"],["class","share",4,"ngIf"],["mat-button","","class","play-again-btn",3,"ngClass","click",4,"ngIf"],["mat-button","","class","play-again-btn other-play-next",3,"ngClass","click",4,"ngIf"],["mat-button","","class","play-again-btn submit",3,"click",4,"ngIf"],[1,"score-notes",3,"ngClass"],[1,"hit-question"],["class","bold",4,"ngIf"],[4,"ngIf"],[1,"bold"],[1,"text-black"],[1,"_timeBound"],[1,"score-notes"],[1,"_your-score"],[1,"sub-item"],[1,"sub-item","add-bg-color"],[1,"sub-item","add-bg-color",2,"margin-left","22px"],[1,"sub-item","_opesity"],["src","assets/images/speed.png"],["src","assets/images/dark-speed.svg"],["src","assets/images/accuracy.png"],["src","assets/images/dark-accuracy.svg"],["src","assets/images/score.png"],["src","assets/images/dark-score.svg"],[1,"score-meter-container"],[1,"score-meter"],[1,"score-meter-inner-div"],[1,"arrow-center"],[1,"score-arrow",3,"ngStyle"],["class","arrow-icon",4,"ngIf"],["class","arrow-icon-dark",4,"ngIf"],[1,"score-number"],[1,"score-meter",2,"height","84px"],[1,"score-meter-part-1",3,"ngClass"],[1,"score-meter-part-3",3,"ngClass"],[1,"score-meter-part-2",3,"ngClass"],[1,"score-text"],[1,"arrow-icon"],[1,"arrow-icon-dark"],[1,"score-notesParent"],[1,"common","progress-bar",3,"ngClass"],[2,"position","relative","width","210px","height","24px"],["mode","determinate",3,"value"],[1,"progress-score"],["mode","determinate",1,"_your",3,"value"],[1,"progress-score",3,"ngStyle"],[1,"share"],["class","share-text",4,"ngIf"],[1,"share-text"],["mat-button","",1,"play-again-btn",3,"click","ngClass"],["mat-button","",1,"play-again-btn","other-play-next",3,"click","ngClass"],["mat-button","",1,"play-again-btn","submit",3,"click"]],template:function(e,i){e&1&&x(0,Ni,15,21,"div",0),e&2&&h("ngIf",i.isLoaded)},dependencies:[Ie,_e,we,Pe,qt,it,Ce,vt]})};var Yi=(a,t)=>({"font-weight":a,"pointer-events":t}),Hi=(a,t)=>({rightanswer:a,wronganswer:t});function Vi(a,t){if(a&1){let e=R();l(0,"div",5)(1,"div",6)(2,"div",7),_(3,"img",8),p(),l(4,"div",9)(5,"div",10),_(6,"img",11),p(),l(7,"span",12),m(8),p()(),l(9,"div",13)(10,"span",14),m(11),p(),_(12,"p",15),p()(),l(13,"div",16)(14,"button",17),A("click",function(){M(e);let s=g();return B(s.startQuiz())}),m(15," Let\u2019s Play"),p()(),l(16,"div",18)(17,"a",19),_(18,"img",20),p()()()}if(a&2){let e=g();o(3),h("src",e.projectDetails==null?null:e.projectDetails.coverImageUrl,Le),o(3),h("src",e.projectDetails==null?null:e.projectDetails.creatorImageUrl,Le),o(2),C(e.projectDetails==null?null:e.projectDetails.creatorName),o(3),ae("",e.projectDetails==null?null:e.projectDetails.quizName," "),o(),h("innerHTML",e.projectDetails==null?null:e.projectDetails.quizDescription,se),o(2),h("disabled",(e.totalQuestions==null?null:e.totalQuestions.length)<=0)}}function Xi(a,t){if(a&1&&_(0,"app-timer",29),a&2){let e=g(2);h("maxTime",e.maxTime)("answered",e.answerConfirmation)}}function Ji(a,t){if(a&1){let e=R();l(0,"div",30)(1,"h2",31),m(2,"Explanation"),p(),_(3,"div",32),l(4,"button",33),A("click",function(){M(e);let s=g(2);return B(s.nextQuestionDesc())}),m(5,"Next question"),p()()}if(a&2){let e=g(2);o(3),h("innerHTML",e.ansDescription,se)}}function Gi(a,t){a&1&&_(0,"img",43)}function Wi(a,t){a&1&&_(0,"img",44)}function Zi(a,t){if(a&1&&(l(0,"span"),m(1),S(2,"percent"),p()),a&2){let e=g(2).$implicit,i=g(3);o(),C(Y(2,1,i.calculateQuestionStatsWidth(i.questionStatus,e),"1.0-0"))}}function $i(a,t){if(a&1&&(l(0,"div",39),x(1,Gi,1,0,"img",40)(2,Wi,1,0,"img",41),l(3,"div"),x(4,Zi,3,4,"span",42),p()()),a&2){let e=g().$implicit,i=g(3);o(),h("ngIf",e==i.correctOption),o(),h("ngIf",e==i.wrongAns),o(2),h("ngIf",i.answerConfirmation&&(i.projectSettings==null?null:i.projectSettings.showAnswerStats))}}function Ki(a,t){if(a&1){let e=R();l(0,"div")(1,"div",37),A("click",function(){let s=M(e).$implicit,n=g(3);return B(n.ansGiven(s))}),l(2,"span"),m(3),p(),x(4,$i,5,3,"div",38),p()()}if(a&2){let e=t.$implicit,i=g(3);o(),h("ngStyle",Ne(4,Yi,i.answerConfirmation?"500":"400",i.answerConfirmation?"none":"all"))("ngClass",Ne(7,Hi,i.answerConfirmation&&e==i.correctOption&&i.projectSettings.answerConfirmation,i.answerConfirmation&&e==i.wrongAns&&e!=i.correctOption&&i.projectSettings.answerConfirmation)),o(2),C(e),o(),h("ngIf",i.answerConfirmation)}}function en(a,t){if(a&1&&(l(0,"div",34),_(1,"div",35),x(2,Ki,5,10,"div",36),p()),a&2){let e=g(2);o(),h("innerHtml",e.questionText,se),o(),h("ngForOf",e.options)}}function tn(a,t){if(a&1&&(l(0,"div",21)(1,"div",22)(2,"div",23)(3,"div",24),_(4,"h2"),p(),l(5,"span",25),m(6),p()(),x(7,Xi,1,2,"app-timer",26),p(),x(8,Ji,6,1,"div",27)(9,en,3,2,"div",28),l(10,"div",18)(11,"a",19),_(12,"img",20),p()()()),a&2){let e=g();o(3),h("innerHTML",e.projectDetails==null?null:e.projectDetails.quizName,se),o(3),re("Question ",e.k,"/",e.totalQuestions==null?null:e.totalQuestions.length,""),o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.useTimer)||e.projectSettings.timeBound),o(),h("ngIf",(e.projectSettings==null?null:e.projectSettings.showAnswerDuringQuiz)&&e.ansDesc),o(),h("ngIf",!e.ansDesc)}}function nn(a,t){if(a&1&&(l(0,"div",45),_(1,"app-player-embed-result",46),l(2,"div",47)(3,"a",19),_(4,"img",20),p()()()),a&2){let e=g();o(),h("hasMoreQuestionForXY",e.hasMoreQuestionForXY)("isLastQuizOnChain",e.isLastQuizOnChain)("chainDetails",e.chainDetails)("totalQuestionLength",e.totalQuestions==null?null:e.totalQuestions.length)("instanceObj",e.instanceDetails)("projectSetting",e.projectSettings)}}var Me=class a{constructor(t,e,i,s,n,r,c,u,f,y,z,b,D,Yt){this.translate=t;this.route=i;this.projectService=s;this.projectSettingService=n;this.questionsService=r;this.instanceService=c;this.cookieService=u;this.state=f;this.helper=y;this.answerService=z;this.dialog=b;this.sharedService=D;this.userService=Yt;this.isBrowser=st(e),this.isBrowser&&(this.correctAudio=new Audio("https://firebasestorage.googleapis.com/v0/b/curiosity-road.appspot.com/o/quiz42%2Faudio_files%2Fsound%20-%20correct%20answer.mp3?alt=media&token=3130c517-7981-456b-af9e-6fd7e543f897"),this.correctAudio.load(),this.incorrectAudio=new Audio("https://firebasestorage.googleapis.com/v0/b/curiosity-road.appspot.com/o/quiz42%2Faudio_files%2Fsound%20-%20wrong%20answer.mp3?alt=media&token=9b61fcd1-01ae-4faf-9774-c228e29f13ed"),this.incorrectAudio.load(),this.route.queryParams.subscribe(Ge=>
1{let ie=this.route.snapshot.paramMap.get("id");this.cid=Ge.cid,this.cid&&ie&&this.userService.getUserContentAccMapByContentId(this.cid).then(We=>{this.userService.setUserContentRef(We),this.helper.getChainDetails(ie).then(ne=>{if(ne)if(this.chainDetails=ne,this.chianId=ie,this.cookieService.check(this.chianId)){let de=JSON.parse(this.cookieService.get(this.chianId));de.completed===!0?this.checkQuizIdInNode(de.quizId):(this.projectId=de.quizId,this.projectId&&this.normalFlow())}else this.chainDetails?.dateFlow?this.dateFlowQuizChain(ne):(this.projectId=ne.nodes[0].quizId,this.projectId&&this.normalFlow());else this.projectId=ie,this.normalFlow()})})}))}project={};k=1;imageToShow;projectSettings={};letsStart=!1;instance;instanceId;INSTANCE_TAGS_KEY="RenderComponent_InstanceTagsState";QUIZ_TAGS_KEY="RenderComponent_QuizTagsState";projectId;playerDetails;isIntQuiz;groupSessionId;cookiId;locationAndDeviceInfo;instanceDetails;options=[];questionText;totalQuestions;result=!1;projectDetails;correctOption;correctAudio;incorrectAudio;answerConfirmation=!1;previewDevice=!1;SoundEffects;enablePointsForCorrAns=!0;pointsPerQuestion=5;useTimer;pointsForTime;timeLeft;timePerQuestion;totalCorrect=0;totalPoints=0;showAnswerStats;questionId;questionStatus={};isLastQuestion=!1;cid;accuracyPoint=0;maxpoint;maxTime;obj=[];wrongAns;chianId;ansDesc=!1;timeout=!1;subscription;ansDescription;playerId="";hasMoreQuestionForXY=!1;answers=[];chainDetails;isLastQuizOnChain=!1;interval;speedBonus=0;delayTimer;prepTimer;readTimeSecond=5e3;isBrowser=!0;ngOnInit(){}startTimerWithDelay(){this.timeLeft=this.maxTime,this.sharedService.sharedValue.next(this.timeLeft),this.delayTimer=setTimeout(()=>{clearTimeout(this.delayTimer),this.answerConfirmation||this.startTimer()},this.readTimeSecond)}startTimer(){let t=new Date;this.projectSettings.prepTimer||(this.timeLeft=this.maxTime);let e=this.timeLeft;if(!this.answerConfirmation){var i=this.timeLeft;this.interval=setInterval(()=>{if(this.answerConfirmation)this.clearAllInterval();else if(this.timeLeft>0){let n=new Date().getTime()-t.getTime();n/=1e3;let r=Math.round(n);r>e&&this.clearAllInterval(),i=e-r,this.timeLeft=Math.floor(i),this.sharedService.sharedValue.next(this.timeLeft)}else this.ansGiven(),this.clearAllInterval()},10)}}clearAllInterval(){clearInterval(this.interval),clearTimeout(this.delayTimer)}checkQuizIdInNode(t){let e=0;for(;e<this.chainDetails.nodes.length;){if(this.chainDetails.nodes[e].quizId===t){e==this.chainDetails.nodes.length-1?(this.projectId=this.chainDetails.nodes[e].quizId,this.isLastQuizOnChain=!0):this.projectId=this.chainDetails.nodes[e+1].quizId;break}e++}this.projectId&&this.normalFlow()}dateFlowQuizChain(t){let e=0,i=new Date;i.setHours(0,0,0,0);let s=i.toLocaleDateString();for(;e<t.nodes.length;){let n=new Date(t.nodes[e].date.seconds*1e3).toLocaleDateString();if(s===n){this.projectId=t.nodes[e].quizId,e==t.nodes.length-1&&(this.isLastQuizOnChain=!0);break}e++}this.projectId?(this.projectId,this.normalFlow()):(this.projectId=t.nodes[0].quizId,this.normalFlow())}calculateQuestionStatsWidth(t,e){let i=0;var s=this.getTotalValidAnswers(t),n=0;return t&&e+"_totalCount"in t&&(n=t[e+"_totalCount"]),e==this.correctOption&&(n=n+1),i=n/s,i}getTotalValidAnswers(t){var e=1;return this.options.forEach(i=>{t&&t[i+"_totalCount"]&&(e=e+t[i+"_totalCount"])}),e}startQuiz(){this.letsStart=!0,this.instanceDetails.started=!0,this.projectSettings?.useTimer&&(this.projectSettings.prepTimer?this.startTimerWithDelay():this.startTimer())}normalFlow(){this.projectSettingService.getProjectSettingsById(this.projectId).then(t=>{t?(this.projectSettings=t,this.pointsPerQuestion=this.projectSettings.pointsPerQuestion,this.useTimer=this.projectSettings.useTimer,this.SoundEffects=this.projectSettings.enableQuizSound,this.showAnswerStats=this.projectSettings.showAnswerStats,this.maxTime=this.projectSettings.timePerQuestion,this.timeLeft=this.projectSettings.timePerQuestion,this.pointsForTime=this.projectSettings.pointsForTime,this.timePerQuestion=this.projectSettings.timePerQuestion,this.prepTimer=this.projectSettings.prepTimer,this.enablePointsForCorrAns=this.projectSettings.enablePointsForCorrAns,this.SoundEffects=this.projectSettings.enableQuizSound):console.log("Err=> setting not saved  or not available "),this.projectService.getProjectDetailsByIdPromise(this.projectId).then(e=>{this.projectDetails=e,this.projectDetails.creatorImageUrl==""&&(this.projectDetails.creatorImageUrl="https://firebasestorage.googleapis.com/v0/b/quiz42.appspot.com/o/quiz42%2F22kFKMtAWT
1VkMOJa7ngoxCGuWDy1%2F1650988601252_profile-icon-design-free-vector.jpg?alt=media&token=ff993a5b-6993-48d5-af40-f888c1acf197")});try{if(this.cookieService.check(this.projectId)){let e=JSON.parse(this.cookieService.get(this.projectId));this.projectSettings.xOutOfY&&e.hasMoreQuestionForXY?(this.createInstance(this.projectId,"link"),setTimeout(()=>{this.instanceId&&this.initializeQuiz()},3e3)):e&&(this.instanceId=e.instance,this.instanceId?this.initializeQuiz():(this.createInstance(this.projectId,"link"),setTimeout(()=>{this.instanceId&&this.initializeQuiz()},3e3)))}else this.createInstance(this.projectId,"link"),setTimeout(()=>{this.instanceId&&this.initializeQuiz()},3e3)}catch{console.log("you have Opened in incognito mood and blocked the cookies in iframe"),this.createInstance(this.projectId,"link"),setTimeout(()=>{this.instanceId&&this.initializeQuiz()},2e3)}})}ansGiven(t=null){if(this.projectSettings?.showAnswerStats||(this.correctOption==t?(this.options=[],this.options.push(t)):(this.options=[],this.options.push(this.correctOption),this.options.push(t))),this.timeLeft=this.maxTime,this.answerConfirmation=!0,t!=null)if(t==this.correctOption){this.correctConfetti(),this.totalCorrect++,this.totalPoints+=this.pointsPerQuestion,this.instanceDetails.totalCorrect=this.totalCorrect,this.instanceDetails.totalPoints=this.totalPoints,this.k==this.totalQuestions.length&&this.updateInstanceAtLast();let i={accuracyPoint:this.pointsPerQuestion,answer:[t],answerStatus:"c",correct:!0,instance:this.instanceId,points:this.pointsPerQuestion,question:this.questionId,quiz:this.projectId,refAccountId:this.cid,refContentId:this.cid,refPlayerId:this.playerId,speedBonus:0,timeTaken:0,updatedOn:q()};if(this.projectSettings.xOutOfY&&this.projectSettings.xOutOfYEnableCookie){if(this.answers.push(i),this.isLastQuestion){for(let r=0;r<this.answers.length;r++){let c=this.answers[r];this.answerService.updateAnswerStatusinAnswersCollection(c)}let s;this.cookieService.check(this.projectId)?s=JSON.parse(this.cookieService.get(this.projectId)):s=window.localStorage.getItem(this.projectId),s.hasMoreQuestionForXY=this.hasMoreQuestionForXY;var e=JSON.stringify(s);this.helper.checkCookieIsSupported("**XYZ**",{abc:"1234"})?this.cookieService.set(this.projectId,e,60,"/",void 0,!1,"None"):window.localStorage.setItem(this.projectId,e)}}else this.answerService.createAnswer(i)}else{this.questionStatus.answeredCount++,this.questionStatus.incorrectCount++;let i=`${t}_totalCount`;this.questionStatus[`${i}`]++,this.wrongAns=t,this.SoundEffects&&this.answerConfirmation&&(this.incorrectAudio.currentTime=.01,this.incorrectAudio.play()),this.k==this.totalQuestions.length&&this.updateInstanceAtLast();let s={accuracyPoint:0,answer:[t],answerStatus:"c",correct:!1,createdOn:q(),instance:this.instanceId,points:this.pointsPerQuestion,question:this.questionId,quiz:this.projectId,refAccountId:this.cid,refContentId:this.cid,refPlayerId:this.playerId,speedBonus:0,timeTaken:0,updatedOn:q()};if(this.projectSettings.xOutOfY&&this.projectSettings.xOutOfYEnableCookie){if(this.answers.push(s),this.isLastQuestion){for(let u=0;u<this.answers.length;u++){let f=this.answers[u];this.answerService.updateAnswerStatusinAnswersCollection(f)}let n;this.cookieService.check(this.projectId)?n=JSON.parse(this.cookieService.get(this.projectId)):n=window.localStorage.getItem(this.projectId),n.hasMoreQuestionForXY=this.hasMoreQuestionForXY;var e=JSON.stringify(n);this.helper.checkCookieIsSupported("**XYZ**",{abc:"1234"})?this.cookieService.set(this.projectId,e,60,"/",void 0,!1,"None"):window.localStorage.setItem(this.projectId,e)}}else this.answerService.createAnswer(s)}else this.SoundEffects&&this.answerConfirmation&&(this.incorrectAudio.currentTime=.01,this.incorrectAudio.play()),this.k==this.totalQuestions.length&&this.updateInstanceAtLast();this.projectSettings.shuffle&&!this.isLastQuestion?setTimeout(()=>{this.questionText=this.totalQuestions[this.k].questionText,this.options=X.default.shuffle(this.totalQuestions[this.k].options),this.correctOption=this.totalQuestions[this.k].correctAnswer[0],this.questionId=this.totalQuestions[this.k].questionId,this.totalQuestions[this.k-1].showAnswerInfo&&(this.ansDescription=this.totalQuestions[this.k-1].answerDescription),this.projectSettings.showAnswerStats&&this.questionsService.getQuestionStatsByQuestionId(this.totalQuestions[this.k]).then(i=>{i?(this.questionStatus={},this.questionStatus=i):(this.questionStatus={},this.options.forEach(s=>{this.questionStatus[`${s}_totalCount`]=0}),this.questionStatus.incorrectCount=0,this.questionStatus.correctCount=0,this.questionStatus.answeredCount=0,this.questionStatus.quiz=this.projectId,this.questionStatus.totalPoints=this.instanceDetails.totalPoints?this.instanceDetails.totalPoints:0,this.questionStatus.totalTimeTaken=this.instanceDetails.totalTimeTaken?this.instanceDetails.totalTimeTaken:0)}),this.projectSettings.showAnswerDuringQuiz&&this.totalQuestions[this.k-1]?.showAnswerInfo?(this.ansDesc=!0,this.ansDescription=this.totalQuestions[this.k-1].answerDescription,this.answerConfirmation=!1):(this.k++,this.answerConfirmation=!1,this.projectSettings?.useTimer&&(this.projectSettings.prepTimer?this.startTimerWithDelay():this.startTimer()))},2e3):this.isLastQuestion||setTimeout(()=>{this.questionText=this.totalQuestions[this.k].questionText,this.options=X.default.shuffle(this.totalQuestions[this.k].options),this.correctOption=this.totalQuestions[this.k].correctAnswer[0],this.questionId=this.totalQuestions[this.k].questionId,this.totalQuestions[this.k-1].showAnswerInfo&&(this.ansDescription=this.totalQuestions[this.k-1].answerDescription),this.projectSettings.showAnswerStats&&this.questionsService.getQuestionStatsByQuestionId(this.totalQuestions[this.k]).then(i=>{i?(this.questionStatus={},this.questionStatus=i):(this.questionStatus={},this.options.forEach(s=>{this.questionStatus[`${s}_totalCount`]=0}),this.questionStatus.incorrectCount=0,this.questionStatus.correctCount=0,this.questionStatus.answeredCount=0,this.questionStatus.quiz=this.projectId,this.questionStatus.totalPoints=this.instanceDetails.totalPoints?this.instanceDetails.totalPoints:0,this.questionStatus.totalTimeTaken=this.instanceDetails.totalTimeTaken?this.instanceDetails.totalTimeTaken:0)}),this.projectSettings.showAnswerDuringQuiz&&this.totalQuestions[this.k-1]?.showAnswerInfo?(this.ansDesc=!0,this.ansDescription=this.totalQuestions[this.k-1].answerDescription,this.answerConfirmation=!1):(this.k++,this.answerConfirmation=!1,this.projectSettings?.useTimer&&(this.projectSettings.prepTimer?this.startTimerWithDelay():this.startTimer()))},2e3),this.k==this.totalQuestions.length&&(this.projectSettings.showAnswerDuringQuiz&&this.totalQuestions[this.k-1]?.showAnswerInfo?(this.ansDescription=this.totalQuestions[this.k-1].answerDescription,this.ansDesc=!0,this.chianId&&(this.setQuizIdCookie
1sTrueForChainQuiz(),this.chainDetails)):(this.chianId&&this.setQuizIdCookiesTrueForChainQuiz(),setTimeout(()=>{this.result=!0},2e3)))}updateInstanceAtLast(){this.instanceDetails.completed=!0,this.isLastQuestion=!0,this.instanceDetails.completedOn=q(),this.instanceDetails.speedBonus=this.speedBonus,this.accuracyPoint=this.totalCorrect*this.pointsPerQuestion,this.instanceDetails.totalPoints=this.accuracyPoint+this.speedBonus,this.instanceDetails.accuracyPoint=this.totalCorrect*this.pointsPerQuestion,this.instanceService.updateInstance(this.instanceId,this.instanceDetails)}setQuizIdCookiesTrueForChainQuiz(){try{let e={quizId:this.projectId,completed:!0};var t=JSON.stringify(e);this.helper.checkCookieIsSupported("**XYZ**",{abc:"1234"})&&this.cookieService.set(this.chianId,t,60,"/",void 0,!1,"None")}catch(e){console.log("error=>",e)}}initializeQuiz(){this.instanceService.getInstanceDetailsById(this.instanceId).then(t=>v(this,null,function*(){this.instanceDetails=t,this.instanceDetails.completed==!1?this.projectSettings.xOutOfY?yield this.xoutY():this.questionsService.getAllQuestionsByProjectId(this.projectId).then(e=>{this.totalQuestions=e,this.totalQuestions&&this.afterGettingQuestions()}):this.instanceDetails.completed&&this.chainDetails&&!this.isLastQuizOnChain?this.checkQuizIdInNode(this.projectId):this.instanceDetails.completed?(this.result=!0,this.letsStart=!0,this.ansDesc=!1):(this.createInstance(this.projectId,"link"),setTimeout(()=>{this.instanceId&&this.initializeQuiz()},3e3))}))}afterGettingQuestions(){this.instanceDetails.totalQuestions==null||this.instanceDetails.totalQuestions==null?this.instanceDetails.totalQuestions=this.totalQuestions.length:this.instanceDetails.totalQuestions=this.totalQuestions.length,this.instanceDetails.totalCorrect==null||this.instanceDetails.totalCorrect?this.instanceDetails.totalCorrect=0:this.instanceDetails.totalCorrect=0,this.instanceDetails.totalPoints==null||this.instanceDetails.totalPoints?this.instanceDetails.totalPoints=0:this.instanceDetails.totalPoints=0,this.projectSettings.shuffle?(this.totalQuestions=X.default.shuffle(this.totalQuestions),this.questionText=this.totalQuestions[0].questionText,this.options=X.default.shuffle(this.totalQuestions[0].options),this.correctOption=this.totalQuestions[0].correctAnswer[0],this.questionId=this.totalQuestions[0].questionId,this.totalQuestions[0].showAnswerInfo&&(this.ansDescription=this.totalQuestions[0].answerDescription),this.projectSettings.showAnswerStats&&this.questionsService.getQuestionStatsByQuestionId(this.totalQuestions[0]).then(t=>{t?this.options.forEach(e=>{this.questionStatus[`${e}_totalCount`]=0}):(this.questionStatus={},this.options.forEach(e=>{this.questionStatus[`${e}_totalCount`]=0}),this.questionStatus.incorrectCount=0,this.questionStatus.correctCount=0,this.questionStatus.answeredCount=0,this.questionStatus.quiz=this.projectId,this.questionStatus.totalPoints=this.instanceDetails.totalPoints?this.instanceDetails.totalPoints:0,this.questionStatus.totalTimeTaken=this.instanceDetails.totalTimeTaken?this.instanceDetails.totalTimeTaken:0)})):(this.questionText=this.totalQuestions[0].questionText,this.options=this.totalQuestions[0].options,this.correctOption=this.totalQuestions[0].correctAnswer[0],this.questionId=this.totalQuestions[0].questionId,this.totalQuestions[0].showAnswerInfo&&(this.ansDescription=this.totalQuestions[0].answerDescription),this.projectSettings.showAnswerStats&&this.questionsService.getQuestionStatsByQuestionId(this.totalQuestions[0]).then(t=>{t?this.options.forEach(e=>{this.questionStatus[`${e}_totalCount`]=0}):(this.questionStatus={},this.options.forEach(e=>{this.questionStatus[`${e}_totalCount`]=0}),this.questionStatus.incorrectCount=0,this.questionStatus.correctCount=0,this.questionStatus.answeredCount=0,this.questionStatus.quiz=this.projectId,this.questionStatus.totalPoints=this.instanceDetails.totalPoints?this.instanceDetails.totalPoints:0,this.questionStatus.totalTimeTaken=this.instanceDetails.totalTimeTaken?this.instanceDetails.totalTimeTaken:0)}))}correctConfetti(){let t=0,e=0;if(this.answerConfirmation){var i=document.getElementById("custom-canvas");i&&(i.style.display="block",i.getContext("2d"),i.getBoundingClientRect()),this.previewDevice||(i=void 0),xt.create(i,{resize:!0,useWorker:!1})({particleCount:100,spread:70,origin:{y:.6}}),setTimeout(()=>
1{i&&(i.style.display="none")},2e3)}if(this.SoundEffects&&this.answerConfirmation&&(this.correctAudio.currentTime=.01,this.correctAudio.play()),this.enablePointsForCorrAns&&(t=this.pointsPerQuestion),this.useTimer&&this.pointsForTime){let s=this.timeLeft/this.timePerQuestion;s=Number(s.toFixed(2)),e=this.pointsPerQuestion*s}else e=0;this.speedBonus+=e}createInstance(t,e){if(this.instance=this.state.get(this.INSTANCE_TAGS_KEY,null),this.instance&&!this.projectSettings.xOutOfY)return this.instanceId=this.instance.id,this.instance;{let s,n=this.sharedService.getChainDetails();if(n&&n.id?s=this.cookieService.get("refPlayerId"+n.id):this.isIntQuiz&&this.playerDetails&&this.playerDetails.playerId?s=this.playerDetails.playerId:(!this.projectSettings.xOutOfY||this.projectSettings.xOutOfYEnableCookie)&&(s=this.cookieService.get("refPlayerId"+this.projectId)),s)var i={quiz:this.projectId,mode:e};else var i={quiz:this.projectId,mode:e};this.groupSessionId&&(i.groupSession=this.groupSessionId),this.instanceService.createInstance(i).then(r=>v(this,null,function*(){this.instanceId=r.id,yield this.onInstanceCreated(r)})).catch(r=>{console.log(r)})}}xoutY(){return v(this,null,function*(){try{if(this.projectSettings.xOutOfY){let i=yield this.questionsService.getAllQuestionsByProjectId(this.projectId);if(this.projectSettings.xOutOfYEnableCookie){let s=[];var t;t=X.default.shuffle(i);let n;if(this.cookieService.check(this.projectId)?n=JSON.parse(this.cookieService.get(this.projectId)):n=window.localStorage.getItem(this.projectId),n&&n.instances)var e=n.instances;let r=yield this.answerService.checkRelatedInstanceId(t,e[0],this.instanceId,this.playerId);if(t=r,r.length)for(let c=0;c<this.projectSettings.xOutOfYValue;c++)r[c]&&s.push(r[c]);this.totalQuestions=s,this.totalQuestions.length>0&&this.afterGettingQuestions(),this.answerService.addQuestionsInAnswersCollection(s,e[0],this.instanceId,this.projectId,this.playerId),r.length>=this.projectSettings.xOutOfYValue*2&&(this.hasMoreQuestionForXY=!0)}else{let s=[];for(let n=0;n<this.projectSettings.xOutOfYValue;n++){let r=i[Math.floor(Math.random()*i.length)];s.includes(r)?--n:s.push(r)}this.instanceService.getInstanceById(this.instanceId).then(n=>{n&&n.refPlayerId&&(this.playerId=n.refPlayerId)}),this.totalQuestions=X.default.shuffle(s),this.totalQuestions&&this.afterGettingQuestions()}}}catch(i){console.log("error=>",i)}})}nextQuestionDesc(){this.ansDesc=!1,this.projectSettings?.useTimer&&(this.projectSettings.prepTimer?this.startTimerWithDelay():this.startTimer()),this.isLastQuestion?this.result=!0:this.k++}onInstanceCreated=t=>v(this,null,function*(){if(this.projectSettings.xOutOfY){if(this.instanceId=t.id,this.instance=t,this.state.set(this.INSTANCE_TAGS_KEY,this.instance),this.projectSettings.xOutOfYEnableCookie){let u=[];var e;try{this.cookieService.check(this.projectId)?e=JSON.parse(this.cookieService.get(this.projectId)):e=window.localStorage.getItem(this.projectId),e&&e.instances&&(u=e.instances),u.push(t.id);var i={instance:this.instanceId,instances:u},s=JSON.stringify(i);this.helper.checkCookieIsSupported("**XYZ**",{abc:"1234"})?this.cookieService.set(this.projectId,s,60,"/",void 0,!1,"None"):window.localStorage.setItem(this.projectId,s)}catch{u.push(t.id)}}}else if(this.chainDetails){this.instanceId=t.id,this.instance=t;let u={instance:this.instanceId},f={quizId:this.projectId,completed:!1};var n=JSON.stringify(u),r=JSON.stringify(f);this.helper.checkCookieIsSupported("**XYZ**",{abc:"1234"})?(this.cookieService.set(this.chianId,r,60,"/",void 0,!1,"None"),this.cookieService.set(this.projectId,n,60,"/",void 0,!1,"None")):(window.localStorage.setItem(this.chianId,r),window.localStorage.setItem(this.projectId,n))}else try{this.instanceId=t.id,this.instance=t,this.state.set(this.INSTANCE_TAGS_KEY,this.instance);var c={instance:this.instanceId},s=JSON.stringify(c);this.helper.checkCookieIsSupported("**XYZ**",{abc:"1234"})?this.cookieService.set(this.projectId,s,60,"/",void 0,!1,"None"):window.localStorage.setItem(this.projectId,s)}catch{this.instanceId=t.id,this.instance=t}this.projectId&&this.helper.getLocationAndDeviceInfo().then(u=>{u&&(this.locationAndDeviceInfo=u.data,this.instanceService.updateInstance(this.instanceId,{id:this.instanceId,locationInfo:u.data.locationInfo,deviceInfo:u.data.deviceInfo}).then(f=>{}).catch(f=>{console.log(f)}))}).catch(u=>{console.log(u)})});static \u0275fac=function(e){return new(e||a)(d(ke),d(G),d(be),d(pe),d(qe),d(ze),d(Te),d($),d(Ze),d(K),d(Qe),d(he),d(_t),d(ee))};static \u0275cmp=ye({type:a,selectors:[["app-player-embed"]],decls:5,vars:3,consts:[["id","main"],["
1id","main2"],["class","coverpageMain",4,"ngIf"],["class","questionMain",4,"ngIf"],["class","result-page",4,"ngIf"],[1,"coverpageMain"],[1,"coverPage"],[1,"CoverImg"],[2,"width","100%","height","inherit",3,"src"],[1,"creatorNameAndPic"],[1,"creator-image"],[2,"width","100%","border-radius","100px",3,"src"],[1,"creator-name"],[1,"titleDesc"],[1,"cover-name"],[1,"cover-desc",3,"innerHTML"],[1,"startbtn"],["mat-button","",1,"startbtn",3,"click","disabled"],[1,"footerImg"],["target","_blank","href","https://gospring.ai/"],["src","../../assets/images/powered by spring.png","alt","",2,"height","14px"],[1,"questionMain"],[1,"QuestionHeader"],[1,"titlediv"],[2,"font-size","18px","font-weight","bold",3,"innerHTML"],[2,"opacity","0.5","font-family","Roboto","font-size","14px"],["class","apptimer","style",`position: relative;
2                bottom: 24px;
3                left: 55px;
4                height: 48px;`,3,"maxTime","answered",4,"ngIf"],["class","mainDesc",4,"ngIf"],["class","questionAndOptions",4,"ngIf"],[1,"apptimer",2,"position","relative","bottom","24px","left","55px","height","48px",3,"maxTime","answered"],[1,"mainDesc"],[2,"font-family","Roboto","font-size","16px","font-weight","bold","margin-bottom","8px"],[3,"innerHTML"],["mat-button","",1,"nextbtn",3,"click"],[1,"questionAndOptions"],[1,"question",2,"width","100%",3,"innerHtml"],[4,"ngFor","ngForOf"],[1,"option",2,"width","92%","padding","9px 9px 9px 9px","border-radius","6px",3,"click","ngStyle","ngClass"],["class","imgdiv",4,"ngIf"],[1,"imgdiv"],["style",`
5                            float: right;
6                           
7                        `,"src","../../assets/images/right option.svg","alt","",4,"ngIf"],["style",`
8                            float: right;
9                           
10                        `,"src","../../assets/images/worng .svg","alt","",4,"ngIf"],[4,"ngIf"],["src","../../assets/images/right option.svg","alt","",2,"float","right"],["src","../../assets/images/worng .svg","alt","",2,"float","right"],[1,"result-page"],[2,"height","inherit","width","inherit","overflow","auto",3,"hasMoreQuestionForXY","isLastQuizOnChain","chainDetails","totalQuestionLength","instanceObj","projectSetting"],[1,"footerImg",2,"margin-bottom","0px"]],template:function(e,i){e&1&&(l(0,"div",0)(1,"div",1),x(2,Vi,19,6,"div",2)(3,tn,13,6,"div",3)(4,nn,5,6,"div",4),p()()),e&2&&(o(2),h("ngIf",!i.letsStart),o(),h("ngIf",i.letsStart&&!i.result),o(),h("ngIf",i.result&&!i.ansDesc))},dependencies:[Ie,tt,_e,we,Pt,Pe,Ae,Ce]})};var sn=[{path:"",component:Me}],Be=class a{static \u0275fac=function(e){return new(e||a)};static \u0275mod=ve({type:a});static \u0275inj=ge({imports:[Ue.forChild(sn),Ue]})};var Ut=class a{static \u0275fac=function(e){return new(e||a)};static \u0275mod=ve({type:a});static \u0275inj=ge({imports:[nt,Be,Qt,Tt,St.forRoot({loader:{provide:yt,useFactory:Dt,deps:[at]}})]})};export{Ut as PlayerEmbedModule};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.