1import{d as xe,o as u,a as c,j as v,t as o,c as _e,g as E,x as Y,e as De,p as me,v as Fe,n as Q,b as i,i as e,F as N,r as ve,k as q,J as Ve,u as je,m as Ge,f as We,y as Oe,C as P,O as Me,S as ze,h as I,a2 as Je,w as Pe,q as Ye,P as Ze,L as Ke}from"./wkhaaVU9.js";import{u as Xe}from"./Ddik7K-L.js";import{C as es}from"./CcKMMr0j.js";import{u as ne}from"./BZIvD03W.js";import{u as He}from"./BdZITli6.js";import{u as ss}from"./CdUNrVzB.js";import{F as W}from"./B5BHioS8.js";import{P as ts}from"./YXHoL2PM.js";import{G as ns}from"./BJM29ZSk.js";import{s as as}from"./DIwSDAPA.js";import"./cHklLbEB.js";const os=xe({__name:"answer",props:{answer:{},selected:{type:Boolean}},setup(J){const Z=Y(!1),ae=J;return(r,L)=>{var x,S;return u(),c("li",{class:"answer",onMouseover:L[0]||(L[0]=f=>Z.value=!0),onMouseleave:L[1]||(L[1]=f=>Z.value=!1)},[v(o((x=ae.answer)==null?void 0:x.answer)+" ",1),J.selected||!((S=ae.answer)!=null&&S.hasOwnProperty("selected"))?(u(),_e(es,{key:0,class:"check"})):E("",!0)],32)}}}),is={class:"question-label"},ls=xe({__name:"question",props:{question:{},reset:{type:Boolean}},emits:["select"],setup(J,{emit:Z}){const L=De().$i18n.t,x=J,S=Z,f=q(()=>{var l;return((l=x.question)==null?void 0:l.question.length)<100}),O=q(()=>{var l,m;return((l=x.question)==null?void 0:l.correct_answers_count)&&((m=x.question)==null?void 0:m.correct_answers_count)>1}),K=q(()=>O.value?L("[exam_question] Choose all that apply"):L("[exam_question] Choose one answer")),n=Y(!1),h=Y([]);me(()=>x.reset,l=>{l&&(h.value=[])});const B=ne("exam","exam"),p=ne("exam","userExam"),g=q(()=>{var l,m,_,w,y,b,R,U,V;return(m=(l=B.value)==null?void 0:l.user_exam)!=null&&m.length&&(h.value=((y=(w=(_=B.value)==null?void 0:_.user_exam)==null?void 0:w.find(s=>s.question.id===x.question.id))==null?void 0:y.selected)||[]),(R=(b=p.value)==null?void 0:b.questions)!=null&&R.length&&(h.value=((V=(U=p.value)==null?void 0:U.questions.find(s=>s.question.id===x.question.id))==null?void 0:V.selected)||[]),h.value});me(B,(l,m)=>{m||(h.value=g.value)},{deep:!0}),me(p,()=>{h.value=g.value});const H=l=>{h.value=h.value.filter(m=>m!==l)},oe=l=>{var _;const m=((_=x.question)==null?void 0:_.correct_answers_count)||1;h.value.length>=m||(h.value=[...h.value,l])},ie=l=>{h.value=[l]},X=l=>{h.value.includes(l)?H(l):oe(l)},ue=l=>{O.value?X(l):ie(l),S("select",{question:x.question,selected:[...h.value]})},le=Fe(),ee=ne("exam","examResult"),z=q(()=>le.params.examId),$=q(()=>{var m,_;const l=()=>{var w,y,b,R,U,V,s,t,d;return{selected_answers:((b=(y=(w=B.value)==null?void 0:w.questions)==null?void 0:y.find(a=>a.id===x.question.id))==null?void 0:b.answers.filter(a=>a.selected).map(a=>a.id))||[],correct_answers:((V=(U=(R=B.value)==null?void 0:R.questions)==null?void 0:U.find(a=>a.id===x.question.id))==null?void 0:V.answers.filter(a=>!a.isWrong).map(a=>a.id))||[],wrong_answers:((d=(t=(s=B.value)==null?void 0:s.questions)==null?void 0:t.find(a=>a.id===x.question.id))==null?void 0:d.answers.filter(a=>a.selected&&a.isWrong).map(a=>a.id))||[]}};return z.value?l():(_=(m=ee.value)==null?void 0:m.questions)==null?void 0:_.find(w=>w.question.id===x.question.id)}),C=l=>{var m,_,w;return $.value?((m=$.value)==null?void 0:m.selected_answers.includes(l))&&!!((w=(_=$.value)==null?void 0:_.wrong_answers)!=null&&w.includes(l)):!1},se=l=>{var m,_,w;return $.value?(m=B.value)!=null&&m.show_correct_answers?(w=$.value)==null?void 0:w.correct_answers.includes(l):(_=$.value)==null?void 0:_.selected_answers.includes(l):h.value.includes(l)};return(l,m)=>{var _,w,y;return u(),c("div",{class:Q(["question",{"!h-auto !my-[100px]":((_=x.question)==null?void 0:_.answers.length)>6}])},[i("div",{class:Q(["question-title",{short:e(f)}])},[i("div",null,o((w=x.question)==null?void 0:w.question),1)],2),i("div",is,o(e(K)),1),i("ul",{class:Q(["answers",{hovering:e(n)}])},[(u(!0),c(N,null,ve((y=x.question)==null?void 0:y.answers,b=>(u(),_e(os,{key:b.id,answer:b,selected:b.selected,class:Q({selected:se(b.id)||b.selected,wrong:C(b.id)}),onClick:R=>ue(b.id)},null,8,["answer","selected","class","onClick"]))),128))],2)],2)}}}),rs={class:"flex items-center"},us={class:"side"},cs={class:"title"},ds={key:0},ms={key:1},vs={class:"flex items-center gap-4 mt-6"},xs={class:"module"},_s={class:"progress w-full"},ps={class:"labels flex items-center justify-between"},fs={class:"title-label"},hs={class:"procentage"},ws={class:"progress-bar"},gs={class:"question-box"},ys={key:0,class:"exam-results-label"},bs={class:"flex items-center"},ks={key:1,class:"submit-form"},qs={class:"title"},As=["onClick"],Is={key:0},Es={class:"controls flex items-center !max-w-[220px]"},$s={class:"flex items-center"},Cs={key:2,class:"submit-form"},Qs={class:"title"},Ss={class:"controls flex items-center !max-w-[220px]"},Ns={key:0,class:"loading-label flex items-center"},Ls={key:1,class:"flex items-center"},Bs={key:0,class:"submit-form"},Rs={class:"title"},Ts={key:1,class:"submit-form"},Ms={class:"title"},Ps={class:"counter"},Zs=xe({__name:"index",setup(J){const r=De().$i18n.t,L=s=>{const t=p.value[s-1].id,d=document.getElementById(t);d==null||d.scrollIntoView({behavior:"smooth"})},x=s=>{const t=(k,A=1)=>{const te=H.value[0];if(H.value.length===0)return"";const D=p.value.findIndex(T=>T.id===k),F=(()=>
1{if(H.value.length===0)return;const T=D+A;return T<p.value.length?T:p.value.findIndex(re=>re.id===te)})(),G=F?p.value[F]:void 0;return G?g.value.find(T=>T.question.id===G.id)?t(G.id,A+1):G.id:""},a=s?t(s):(()=>{const k=document.querySelectorAll(".question"),A=window.scrollY+100,D=Array.from(k).filter(j=>{const F=j.id;return H.value.includes(F)}).find(j=>j.getBoundingClientRect().top+window.scrollY>A);return(D==null?void 0:D.id)||H.value[0]})();Me(()=>{const k=a?document.getElementById(a):document.querySelector(".submit-form ");k==null||k.scrollIntoView({behavior:"smooth"})})},S=Xe(),f=Y(!1),O=Ve(S).isLoading,K=Y(!1),n=ne("exam","exam"),h=je(),B=q(()=>{var s,t,d;return r("[meta] Taking Exam")+" | "+((t=(s=n.value)==null?void 0:s.module)==null?void 0:t.title)+" | "+((d=h==null?void 0:h.generalSettings)==null?void 0:d.school_name)});Ge({title:B});const p=q(()=>{var s;return((s=n.value)==null?void 0:s.questions)||[]}),g=Y([]),H=q(()=>p.value.filter(s=>!g.value.find(t=>{const d=t.question.id===s.id,a=t.selected.length===s.correct_answers_count;return d&&a})).map(s=>s.id)),oe=q(()=>g.value.length>=p.value.length?!!g.value.every(d=>{const a=p.value.find(k=>k.id===d.question.id);return a?(a==null?void 0:a.correct_answers_count)===d.selected.length:!0}):!1),ie=q(()=>H.value.map(s=>p.value.findIndex(d=>d.id===s)+1)),X=q(()=>{let s;f.value?s=p.value.filter(a=>a.answers.some(k=>k.selected===!0)).length:s=g.value.length;const t=p.value.length,d=s>=t?100:s/t*100;return Math.round(d)}),ue=s=>{const t=()=>{g.value=g.value.filter(A=>A.question.id!==s.question.id)},d=()=>{p.value.find(A=>A.id===s.question.id)&&(g.value=[...g.value,s])};t();const a=p.value.find(A=>A.id===s.question.id);(a==null?void 0:a.correct_answers_count)&&s.selected.length<a.correct_answers_count||(d(),x(s.question.id)),S.submitQuestion(s)},le=Fe(),ee=We(),z=q(()=>le.params.moduleId),$=q(()=>le.params.examId),C=ne("exam","examResult"),se=async()=>{await S.submitExam(),ee.push(`/exam/check/${z.value}/${C.value.exam_id}`)},l=async()=>{C.value={},f.value=!1,K.value=!1,g.value=[],await S.resetExam(),ee.replace(`/exam/questions/${z.value}`)},m=s=>{s.length&&(g.value=s.filter(t=>p.value.find(d=>d.id===t.question.id)))},_=Y(0),w=Y(),y=Y(0),b=q(()=>{const s=Math.floor(y.value/6e4),t=Math.floor(y.value%6e4/1e3);return`${s>0?He(s):"00"}:${t>0?He(t):"00"}`}),{leaveExam:R}=ss(),U=()=>{const s=P.get("user_id");P.set(`exam${s}ExamIds`,JSON.stringify({examId:n.value.user_exam_id,moduleId:z.value,lessonId:n.value.lesson_id,courseId:n.value.course_id}),{expires:1})},V=()=>{var a;if(!n.value.exam_time||$.value)return;const s=(((a=n.value)==null?void 0:a.exam_time)||0)*6e4;if(f.value||!y)return;_.value=Number(n.value.exam_started_at)||0;const t=P.get("user_id"),d=t?Number(P.get(`exam${t}TimeLeft`)):0;y.value=d||s,P.set(`exam${t}ShouldSave`,n.value.preserve_progress,{expires:1}),P.set(`exam${t}TimeLimit`,s,{expires:1}),P.set(`exam${t}InitialTime`,_.value,{expires:1}),w.value=as(async()=>{y.value=Number(P.get(`exam${t}TimeLeft`))},100)};return Oe(async()=>{var s;try{const t=P.get("personal_token");await S.getExam(z.value,$.value,!!t)}catch(t){t.status===422&&ee.push("/error")}U(),V(),Me(()=>{const t=n.value.user_exam;m(t)}),$.value&&(f.value=!0,K.value=!((s=C.value)!=null&&s.passed)&&!n.value.passed)}),ze(()=>{clearInterval(w.value)}),(s,t)=>{var a,k,A,te,D,j,F,G,ce,T,de,re,pe,fe,he,we,ge,ye,be,ke,qe,Ae,Ie,Ee,$e,Ce,Qe,Se,Ne,Le,Be,Re,Te;const d=Ze;return u(),c("div",{class:Q(["exam",{check:e(f)}])},[i("div",rs,[i("div",us,[I(Ke,{"class-name":"sidebar-logo skillplate-logo"}),i("div",cs,o((k=(a=e(n))==null?void 0:a.module)==null?void 0:k.title),1),e(f)?(u(),c("p",ms,o(e(r)("[exam] Here you can review the questions and your answers so you can improve your score next time.")),1)):(u(),c("p",ds,o(e(r)("[exam] Read the questions carefully as some might have more than one correct answer. You can always change your answer before submitting the exam.")),1)),i("div",vs,[i("div",xs,o(e(r)("[exam] Module"))+" "+o((((te=(A=e(n))==null?void 0:A.module)==null?void 0:te.order)||0)+1),1),t[2]||(t[2]=i("div",{class:"status-badge"},null,-1))]),i("div",_s,[i("div",ps,[i("div",fs,o(e(r)("[exam] Progress")),1),i("div",hs,o(e(X))+"%",1)]),i("div",ws,[i("div",{class:"progress-thumb",style:Je({width:`${e(X)}%`})},null,4)])]),i("div",{class:Q(["controls grid gap-5",{"grid-cols-2":!e(f)||e(C).percentage!==100&&(!((D=e(n))!=null&&D.max_attempts)||((j=e(n))==null?void 0:j.max_attempts)>((F=e(n))==null?void 0:F.user_attempts))}])},[i("a",{onClick:t[0]||(t[0]=Pe((...M)=>e(R)&&e(R)(...M),["prevent"])),class:"btn empty-btn"},[e(f)?(u(),c(N,{key:0},[v(o(e(r)("[exam] Go Back")),1)],64)):(u(),c(N,{key:1},[v(o(e(r)("[exam] Leave Exam")),1)],64))]),e(X)<100&&!e($)?(u(),c("button",{key:0,class:"btn main-btn",onClick:t[1]||(t[1]=M=>x(void 0))},[v(o(e(r)("[exam] Next Question"))+" ",1),I(W,{class:"w-4 h-4"})])):e(f)?e(C).percentage!==100&&(!((G=e(n))!=null&&G.max_attempts)||((ce=e(n))==null?void 0:ce.max_attempts)>((T=e(n))==null?void 0:T.user_attempts))?(u(),c("button",{key:2,class:"btn main-btn",onClick:l},[v(o(e(r)("[exam] Retake Exam"))+" ",1),I(W,{class:"w-4 h-4"})])):E("",!0):(u(),c("button",{key:1,class:"btn main-btn",onClick:se}
1,[v(o(e(r)("[exam] Submit Exam"))+" ",1),I(W,{class:"w-4 h-4"})]))],2)]),i("div",gs,[e(f)?(u(),c("div",ys,[i("div",bs,[I(ts,{class:"w-6 h-6"}),v(" "+o(e(r)("[exam] Exam Results Review")),1)])])):E("",!0),(u(!0),c(N,null,ve(e(p),M=>(u(),_e(ls,{key:M.id,id:M.id,question:M,reset:!e(f),onSelect:ue},null,8,["id","question","reset"]))),128)),!e(oe)&&!e(f)?(u(),c("div",ks,[i("div",qs,o(e(r)("[exam] Almost There")),1),i("p",null,[v(o(e(r)("[exam] You still need to answer questions"))+" ",1),(u(!0),c(N,null,ve(e(ie),(M,Ue)=>(u(),c("a",{href:"#",onClick:Pe(Ys=>L(M),["prevent"])},[v(" #"+o(M),1),Ue<e(ie).length-1?(u(),c("span",Is,",")):E("",!0)],8,As))),256))]),i("div",Es,[i("button",{class:Q(["btn main-btn !w-full inactive",{loading:e(O)}]),onClick:se},[i("span",$s,[v(o(e(r)("[exam] Submit Exam"))+" ",1),I(W,{class:"w-5 h-5"})])],2)])])):E("",!0),e(oe)&&!e(f)?(u(),c("div",Cs,[i("div",Qs,o(e(r)("[exam] Well Done")),1),i("p",null,o(e(r)("[exam] You have answered all questions! You can go back and make changes or just go ahead and submit your answers.")),1),i("div",Ss,[i("button",{class:Q(["btn main-btn !w-full",{loading:e(O)}]),onClick:se},[e(O)?(u(),c("span",Ns,[I(e(ns),{class:"!w-[22px] !h-[22px] !animate-[spin_2s_linear_infinite]",weight:"bold"}),v(" "+o(e(r)("[global] Loading")),1)])):(u(),c("span",Ls,[v(o(e(r)("[exam] Submit Exam"))+" ",1),I(W,{class:"w-5 h-5"})]))],2)])])):E("",!0),e(f)?(u(),c(N,{key:3},[e(K)?(u(),c("div",Bs,[i("div",Rs,o(e(r)("[exam] Don't Give Up")),1),i("p",null,[v(o(e(r)("[exam] Unfortunately, you have failed the test."))+" ",1),!((de=e(n))!=null&&de.max_attempts)||((re=e(n))==null?void 0:re.max_attempts)>((pe=e(n))==null?void 0:pe.user_attempts)?(u(),c(N,{key:0},[v(o(e(r)("[exam] Don't worry, you can come back and retake this test at anytime.")),1)],64)):E("",!0)]),i("div",{class:Q(["controls flex items-center gap-5",{"justify-center":((fe=e(n))==null?void 0:fe.max_attempts)&&((he=e(n))==null?void 0:he.max_attempts)<=((we=e(n))==null?void 0:we.user_attempts)}])},[I(d,{to:`/courses/${(ge=e(n))==null?void 0:ge.course_id}/module/${(ye=e(n))==null?void 0:ye.module_id}/lesson/${(be=e(n))==null?void 0:be.lesson_id}`,class:"btn empty-btn"},{default:Ye(()=>[v(o(e(r)("[exam] Go Back")),1)]),_:1},8,["to"]),(!((ke=e(n))!=null&&ke.max_attempts)||((qe=e(n))==null?void 0:qe.max_attempts)>((Ae=e(n))==null?void 0:Ae.user_attempts))&&e(C).percentage<100?(u(),c("button",{key:0,class:"btn main-btn",onClick:l},[v(o(e(r)("[exam] Retake Exam"))+" ",1),I(W,{class:"w-5 h-5"})])):E("",!0)],2)])):(u(),c("div",Ts,[i("div",Ms,o(e(r)("[exam] Well Done")),1),i("p",null,[e(C).percentage===100?(u(),c(N,{key:0},[v(o(e(r)("[exam] You have successfully passed the exam with a perfect score!")),1)],64)):(u(),c(N,{key:1},[v(o(e(r)("[exam] You have successfully passed the exam!")),1)],64)),(Ie=e(n))!=null&&Ie.module.has_certificate?(u(),c(N,{key:2},[v(o(e(r)("[exam] You have received an email with your module certificate!")),1)],64)):E("",!0)]),i("div",{class:Q(["controls flex items-center gap-5",{"justify-center":e(C).percentage===100||((Ee=e(n))==null?void 0:Ee.max_attempts)&&(($e=e(n))==null?void 0:$e.max_attempts)<=((Ce=e(n))==null?void 0:Ce.user_attempts)}])},[I(d,{to:`/courses/${(Qe=e(n))==null?void 0:Qe.course_id}/module/${(Se=e(n))==null?void 0:Se.module_id}/lesson/${(Ne=e(n))==null?void 0:Ne.lesson_id}`,class:"btn empty-btn"},{default:Ye(()=>[v(o(e(r)("[exam] Go Back")),1)]),_:1},8,["to"]),e(C).percentage!==100&&(!((Le=e(n))!=null&&Le.max_attempts)||((Be=e(n))==null?void 0:Be.max_attempts)>((Re=e(n))==null?void 0:Re.user_attempts))?(u(),c("button",{key:0,class:"btn main-btn",onClick:l},[v(o(e(r)("[exam] Retake Exam"))+" ",1),I(W,{class:"w-5 h-5"})])):E("",!0)],2)]))],64)):E("",!0),(Te=e(n))!=null&&Te.exam_time&&!e(f)?(u(),c("div",{key:4,class:Q(["timer",{"last-minute":e(y)<=6e4}])},[v(o(e(r)("[exam] Time"))+":",1),i("span",null,o(e(b)),1)],2)):E("",!0),i("div",Ps,[v(o(e(r)("[exam] Answered"))+":",1),i("span",null,o(e(g).length),1),v(o(e(r)("[exam] of")),1),i("span",null,o(e(p).length),1)])])])],2)}}});export{Zs as default};
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.