1import{d as s,a as e,j as i}from"./Cm2J8wJT.js";import{ah as t,ak as n,J as o,L as u,M as r,U as a,V as l,S as c,a4 as h,Q as d,T as q,$ as _}from"./Cw52Jb_b.js";import"./oPzPbeIq.js";import"./Dv5-W7ly.js";const z=s({name:"QuizQuestion",props:["question","handleQuestionPick","showAnswers","handleNextQuestion","isLast"],data:()=>({}),methods:{handleElementClick(s){this.question.answers.map((s=>s.is_picked=!1)),s.is_picked=!0,this.question.answers=[...this.question.answers]}},computed:{canVote(){let s=!1;return this.question.answers.map((e=>{e.is_picked&&(s=!0)})),!this.showAnswers||this.showAnswers&&!s},correctTitle(){let s="";return this.question.answers.map((e=>{e.is_correct&&(s=e.title)})),s}}},"$fw275vHj2x"),p={class:"quiz__single-question quizQuestion",ref:"singleQuestion"},w={class:"quizQuestion__title"},m={key:0,class:"quizQuestion__image"},g=["src","alt"],y={key:0,class:"quizQuestion__image-text"},Q={key:0,class:"quizQuestion__image-author"},f={key:1,class:"quizQuestion__image-description"},k={class:"quizQuestion__list"},v=["onClick"],b={key:0,class:"quizQuestion__answer-text"},A={key:1,class:"quizQuestion__reason"},x={class:"quizQuestion__reason-title"},R=["innerHTML"],j={class:"more-icon"};const T=t(z,[["render",function(s,e,i,t,z,T){const $=n("font-awesome-icon");return o(),u("div",p,[r("h4",w,a(s.question.title),1),s.question.cover&&""!==s.question.cover?(o(),u("div",m,[r("img",{src:s.question.cover,alt:`Obrazek do pytania - ${s.question.title}`},null,8,g),""!==s.question.cover_author||""!==s.question.cover_description?(o(),u("span",y,[""!==s.question.cover_author?(o(),u("span",Q,"Fot. "+a(s.question.cover_author),1)):l("",!0),""!==s.question.cover_description?(o(),u("span",f,a(s.question.cover_description),1)):l("",!0)])):l("",!0)])):l("",!0),r("div",k,[(o(!0),u(c,null,h(s.question.answers,(i=>(o(),u("div",{class:d({quizQuestion__answer:!0,"quizQuestion__answer--danger":s.showAnswers&&i.is_picked&&0==i.is_correct,"quizQuestion__answer--success":s.showAnswers&&!s.canVote&&1==i.is_correct,"quizQuestion__answer--picked":i.is_picked}),onClick:e=>!!s.canVote&&s.handleElementClick(i)},[e[1]||(e[1]=r("span",{class:"quizQuestion__answer-square"},null,-1)),r("strong",null,a(i.title),1),s.showAnswers&&i.is_picked?(o(),u("span",b,a(1==i.is_correct?"Dobrze !":"Źle !"),1)):l("",!0)],10,v)))),256))]),s.showAnswers&&!s.canVote?(o(),u("div",A,[r("h4",x,a(s.correctTitle),1),r("div",{class:"quizQuestion__reason-text",innerHTML:s.question.description},null,8,R),s.isLast?l("",!0):(o(),u("span",{key:0,class:"quizQuestion__reason-more",onClick:e[0]||(e[0]=(...e)=>s.handleNextQuestion&&s.handleNextQuestion(...e))},[e[2]||(e[2]=q(" NastÄpne pytanie ")),r("span",j,[_($,{icon:["fas","chevron-down"]})])]))])):l("",!0)],512)}]]),$=s({name:"SingleQuiz",setup:()=>({store:e()}),props:["quiz","showQuizFace","resetQuiz"],components:{QuizQuestion:T,AdPlacement:i},data:()=>({loading:!1,showAnswers:!1,showResults:!1,showUncomplete:!1,originalQuiz:!1}),methods:{handleQuestionPick(s){this.quiz.questions=[...this.quiz.questions]},handleResultsShow(){this.showAnswers=!0,this.showResults=!0,this.$refs.singleQuiz.scrollIntoView({behavior:"smooth"});const s=new Date;$fetch(`/api/quiz/${this.quiz.uid}`,{method:"POST",body:{finish_date:this.answeredQuestions===this.quiz.questions.length?this.$datefns.format(s,"yyyy-MM-dd HH:mm"):null,all_answers:this.answeredQuestions,correct_answers:this.goodAnswers,finished:1,user_id:this.user?this.user.user_id:null}})},handleNextQuestion(s){const e="quizQuestion-"+(parseInt(s)+1);this.$refs[e]&&this.$refs[e][0].scrollIntoView({behavior:"smooth"})},handleUncompleteResult(){this.showUncomplete=!0,this.$refs.singleQuiz.scrollIntoView({behavior:"smooth"})},handleQuizClear(){this.resetQuiz(this.originalQuiz),this.showResults=!1,this.showUncomplete=!1,setTimeout((()=>{this.$refs.singleQuiz.scrollIntoView({behavior:"smooth"})}),100)}},computed:{user(){return this.store.user},answeredQuestions(){let s=0;return this.quiz.questions.map((e=>{for(let i of e.answers)if(i.is_picked){s+=1;break}})),s},goodAnswers(){let s=0;return this.quiz.questions.map((e=>
1{for(let i of e.answers)if(i.is_picked&&i.is_correct){s+=1;break}})),s},rangePercent(){return 0===this.goodAnswers?0:this.goodAnswers/this.quiz.questions.length*100},yourScore(){if(this.quiz.ranges&&this.quiz.ranges.length>0){const s=this.quiz.ranges.sort(((s,e)=>s.correct_number-e.correct_number));let e={title:s[0].title,description:s[0].description};for(let i of s)i.correct_number<=this.rangePercent&&(e.title=i.title,e.description=i.description);return e}return{title:"",description:""}},settings(){return this.store.settings},galleryAds(){return!(!this.settings||!this.settings.gallery_ads)&&this.settings.gallery_ads},placements(){return this.store&&this.store.placements}},watch:{quiz:{handler(){}}},mounted(){this.showAnswers=this.quiz&&1==this.quiz.type,this.quiz&&(this.originalQuiz=JSON.parse(JSON.stringify(this.quiz)))}},"$Cr9rvT6kLf"),C={key:0,class:"quiz__single"},L={class:"quiz__single-top",ref:"singleQuiz"},M={class:"quiz__single-title"},S={key:0,class:"quiz__uncomplete",ref:"uncompleteMessage"},N={class:"quiz__uncomplete-icon"},H={class:"quiz__uncomplete-title"},P={key:0,class:"quiz__single-image"},U=["src"],V={key:0,class:"imageDescription"},I={class:"imageDescription__name"},D={class:"imageDescription__desc"},O=["innerHTML"],W={key:2,class:"quiz__single-reason quizReason"},Z={class:"quizReason__left"},F={class:"quizReason__score"},J={key:0,class:"quizReason__bottom"},E={class:"quizReason__title"},B=["innerHTML"],G={key:0,class:"quiz__single-questions",ref:"quiz-questions"},K={key:0,class:"mb-5 mt-3 d-flex justify-content-center ad_container"},X={key:1,class:"quiz__single-bottom quiz__single-buttons"},Y={class:"btn-icon"},ss=["href"],es={class:"btn-icon"},is={key:2,class:"quiz__single-bottom"},ts={key:3,class:"quiz__single-bottom"};const ns=t($,[["render",function(s,e,t,z,p,w){const m=n("font-awesome-icon"),g=i,y=T;return s.quiz?(o(),u("article",C,[r("div",L,[r("h3",M,a(s.quiz.title),1),s.showUncomplete&&s.quiz.questions.length!==s.answeredQuestions?(o(),u("div",S,[r("div",N,[_(m,{icon:["fas","exclamation-triangle"]})]),r("div",H,"Brakuje jeszcze "+a(s.quiz.questions.length-s.answeredQuestions)+" odpowiedzi!",1),e[3]||(e[3]=r("div",{class:"quiz__uncomplete-text"},"WypeÅnij odpowiedzi na wszystkie pytania aby zobaczyÄ wynik.",-1))],512)):l("",!0),s.showResults?(o(),u("div",W,[r("div",Z,[e[4]||(e[4]=r("span",null,"Twój Wynik:",-1)),r("div",F,[r("span",null,a(s.goodAnswers),1),q("/"+a(s.quiz.questions.length),1)])]),e[5]||(e[5]=r("div",{class:"quizReason__right"},null,-1)),s.yourScore?(o(),u("div",J,[r("h4",E,a(s.yourScore.title),1),r("div",{innerHTML:s.yourScore.description},null,8,B)])):l("",!0)])):(o(),u(c,{key:1},[s.showQuizFace?(o(),u("div",P,[r("img",{src:s.quiz.cover,loading:"lazy",alt:""},null,8,U),""!==s.quiz.cover_author||""!==s.quiz.cover_description?(o(),u("span",V,[r("strong",I,a(s.quiz.cover_author),1),r("span",D,a(s.quiz.cover_description),1)])):l("",!0)])):l("",!0),r("div",{class:"quiz__single-summary",innerHTML:s.quiz.description},null,8,O)],64))],512),s.quiz?(o(),u("div",G,[(o(!0),u(c,null,h(s.quiz.questions,((e,i)=>(o(),u("div",{class:d("quizQuestion__container "+(s.showResults?"quizQuestion__container--results":"")),ref_for:!0,ref:"quizQuestion-"+i},[i%(s.galleryAds.frequency?s.galleryAds.frequency:5)==0&&i>0||2==i?(o(),u("div",K,[_(g,{placement:s.placements.quizes[`slot_quiz_${Math.floor(i/(s.galleryAds.frequency?s.galleryAds.frequency:5)+1)}`],index:Math.floor(i/(s.galleryAds.frequency?s.galleryAds.frequency:5)+1),fallback:s.placements.quizes.slot_quiz_x},null,8,["placement","index","fallback"])])):l("",!0),_(y,{question:e,handleQuestionPick:s.handleQuestionPick,showAnswers:s.showAnswers,isLast:i===s.quiz.questions.length-1,handleNextQuestion:e=>s.handleNextQuestion(i)},null,8,["question","handleQuestionPick","showAnswers","isLast","handleNextQuestion"])],2)))),256))],512)):l("",!0),s.showResults?(o(),u("div",X,[r("button",{class:"btn btn--prev",onClick:e[0]||(e[0]=(...e)=>s.handleQuizClear&&s.handleQuizClear(...e))},[r("span",Y,[_(m,{icon:["fas","chevron-left"],style:{"font-size":"30px"}})]),e[6]||(e[6]=r("span",{class:"btn-text"},"Zacznij ponownie",-1))]),s.quiz.next_url?(o(),u("a",{key:0,class:"btn btn--next",href:s.quiz.next_url},[e[7]||(e[7]=r("span",{class:"btn-text"},"RozwiÄ
ż kolejny QUIZ",-1)),r("span",es,[_(m,{icon:["fas","chevron-right"],style:{"font-size":"30px"}})])],8,ss)):l("",!0)])):s.answeredQuestions!==s.quiz.questions.length?(o(),u("div",is,[r("button",{class:"btn btn--special",onClick:e[1]||(e[1]=(...e)=>s.handleUncompleteResult&&s.handleUncompleteResult(...e))},"Zobacz Wyniki")])):1!==s.quiz.type&&!s.showAnswers||s.answeredQuestions===s.quiz.questions.length?(o(),u("div",ts,[r("button",{class:"btn btn--special",onClick:e[2]||(e[2]=(...e)=>s.handleResultsShow&&s.handleResultsShow(...e))},"Zobacz Wyniki")])):l("",!0)])):l("",!0)}]]);export{ns 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.