1import{f as B,g as y,r as N,h as x,c as d,o as _,b as i,w as p,i as t,a as n,t as c,n as H,j as L,F as U,k as W,l as $,m as g,p as Y,q as G,d as Q,e as J,u as K,s as X}from"./Hgc-fbXd.js";import{_ as Z}from"./D9ybPAN2.js";const q={key:0,class:"max-w-xl mx-auto"},tt={class:"mb-6"},et={class:"flex justify-between text-sm mb-2 text-accent"},nt={class:"w-full h-2 bg-gray-200 rounded-full overflow-hidden"},st={key:0},ot={class:"space-y-2 mb-6"},lt=["onClick"],at={class:"flex justify-between items-center"},it=["disabled"],rt=["disabled"],ct={key:1,class:"text-center py-10"},ut={class:"flex flex-col items-center gap-4"},dt={key:2,class:"text-center"},_t={class:"flex flex-col items-center"},ft=["src","alt"],pt={class:"py-3"},ht={class:"text-balance"},mt={class:"text-balance"},bt={key:1,class:"text-center text-white"},vt=B({__name:"CharacterQuiz",setup(M){const l=y("questions"),j=y("characters"),u=y("quiz");function w(e){const s=[...e];for(let a=s.length-1;a>0;a--){const r=Math.floor(Math.random()*(a+1));[s[a],s[r]]=[s[r],s[a]]}return s}const k=l.map(e=>{const s=[e.fields.option_a&&e.fields.option_a_character?{key:`${e.id}-a`,text:e.fields.option_a,characterId:e.fields.option_a_character}:null,e.fields.option_b&&e.fields.option_b_character?{key:`${e.id}-b`,text:e.fields.option_b,characterId:e.fields.option_b_character}:null,e.fields.option_c&&e.fields.option_c_character?{key:`${e.id}-c`,text:e.fields.option_c,characterId:e.fields.option_c_character}:null,e.fields.option_d&&e.fields.option_d_character?{key:`${e.id}-d`,text:e.fields.option_d,characterId:e.fields.option_d_character}:null].filter(a=>!!a);return w(s)}),o=N(0),f=N(l.map(()=>null)),m=N(!1),V=e=>{const s=e?.fields?.weighting,a=Number(s);return Number.isFinite(a)?a:100},I=x(()=>l[o.value]??null),F=x(()=>k[o.value]??[]),S=x(()=>f.value.filter(e=>e!==null).length),O=x(()=>l.length?Math.round(S.value/l.length*100):0),C=x(()=>l.length>0&&S.value===l.length),P=e=>f.value[o.value]===e.characterId,R=()=>{f.value[o.value]&&o.value<l.length-1&&(o.value+=1)},T=()=>{o.value>0&&(o.value-=1)},A=()=>{C.value&&(m.value||(m.value=!0,window.setTimeout(()=>{m.value=!1},5e3)))},E=e=>{if(f.value[o.value]=e.characterId,o.value<l.length-1){o.value+=1;return}A()},b=x(()=>{if(!C.value||m.value)return null;const e={};if(f.value.forEach((r,h)=>{if(!r)return;const z=l[h],v=V(z);e[r]=(e[r]||0)+v}),!Object.keys(e).length)return null;let s=null,a=-1/0;for(const r of j){const h=e[r.id]??0;h>a&&(a=h,s=r)}return!s||a<=0?null:s}),D=()=>{f.value=l.map(()=>null),o.value=0,m.value=!1};return(e,s)=>{const a=L,r=G,h=J,z=Z;return _(),d("div",null,[i(z,{class:"border-2 border-accent"},{default:p(()=>[t(l).length?(_(),d("div",q,[n("div",tt,[n("div",et,[n("span",null," Question "+c(t(o)+1)+" of "+c(t(l).length),1),n("span",null,c(t(O))+"% complete",1)]),n("div",nt,[n("div",{class:"h-full bg-linear-to-r from-[#deb841] via-accent to-[#deb841] transition-all duration-300",style:H({width:t(O)+"%"})},null,4)])]),t(C)?t(m)?(_(),d("div",ct,[n("div",ut,[s[0]||(s[0]=n("h4",{class:"mb-0"},"Loading your results...",-1)),s[1]||(s[1]=n("div",{class:"size-10 rounded-full border-4 border-white/30 border-t-accent animate-spin"},null,-1)),i(a,{white:"",large:"",content:t(u).loading_text},null,8,["content"])])])):(_(),d("div",dt,[s[3]||(s[3]=n("div",{class:"my-6"},[n("img",{src:g,"data-nosnippet":"",role:"presentation",alt:"",class:"mx-auto"})],-1)),n("div",_t,[t(b)?.fields.image?(_(),d("img",{key:0,src:t(b).fields.image,alt:t(b).fields.name,class:"size-64 rounded-full object-cover mb-4 border-2 border-accent"},null,8,ft)):Y("",!0),n("h3",null,"You are "+c(t(b)?.fields.name),1),i(a,{white:"",content:t(b)?.fields.result_text},null,8,["content"]),i(r,{type:"button",onClick:D},{default:p(()=>[...s[2]||(s[2]=[Q(" Retake quiz ",-1)])]),_:1})]),s[4]||(s[4]=n("div",{class:"mt-6"},[n("img",{src:g,"data-nosnippet":"",role:"presentation",alt:"",class:"mx-auto"})],-1)),n("div",pt,[n("h3",ht,c(t(u).cta_title),1),i(a,{white:"",content:t(u).cta_body},null,8,["content"]),i(a,{white:""},{default:p(()=>[n("p",null,[n("i",null,c(t(b)?.fields.cta_text),1)])]),_:1}),i(h,{href:t(u).cta_button_link,external:"",target:"_blank"},{default:p(()=>[i(r,null,{default:p(()=>[Q(c(t(u).cta_button_text),1)]),_:1})]),_:1},8,["href"])]),s[5]||(s[5]=n("div",{class:"mt-6 mb-3"}
1,[n("img",{src:g,"data-nosnippet":"",role:"presentation",alt:"",class:"mx-auto"})],-1)),n("div",null,[n("h4",mt,c(t(u).cta2_title),1),i(a,{white:"",content:t(u).cta2_body},null,8,["content"]),i(h,{href:t(u).cta2_button_link},{default:p(()=>[i(r,null,{default:p(()=>[Q(c(t(u).cta2_button_text),1)]),_:1})]),_:1},8,["href"])]),s[6]||(s[6]=n("div",{class:"mt-6"},[n("img",{src:g,"data-nosnippet":"",role:"presentation",alt:"",class:"mx-auto"})],-1))])):(_(),d("div",st,[n("h5",null,c(t(I)?.fields.question_title),1),i(a,{white:""},{default:p(()=>[n("p",null,c(t(I)?.fields.question),1)]),_:1}),n("div",ot,[(_(!0),d(U,null,W(t(F),v=>(_(),d("button",{key:v.key,type:"button",onClick:wt=>E(v),class:$(["w-full border rounded-lg px-4 py-3 text-left transition cursor-pointer",P(v)?"border-accent bg-linear-to-r from-[#deb841] via-accent to-[#deb841] hover:brightness-95":"border-gray-300 bg-white hover:border-gray-500 hover:bg-gray-100"])},c(v.text),11,lt))),128))]),n("div",at,[n("button",{type:"button",class:$(["underline text-white hover:text-accent disabled:opacity-40",{"cursor-pointer":t(o)>0,"cursor-not-allowed":t(o)===0}]),disabled:t(o)===0,onClick:T}," â Previous ",10,it),n("button",{type:"button",class:$(["underline text-white hover:text-accent disabled:opacity-40",{"cursor-pointer":t(o)<t(l).length-1&&t(f)[t(o)],"cursor-not-allowed":t(o)===t(l).length-1||!t(f)[t(o)]}]),disabled:t(o)===t(l).length-1||!t(f)[t(o)],onClick:R}," Next â ",10,rt)])]))])):(_(),d("p",bt,"No questions available."))]),_:1})])}}}),xt=Object.assign(vt,{__name:"UiCharacterQuiz"}),gt={class:"mx-auto max-w-3xl"},yt={class:"mb-4 md:mb-12"},zt=B({__name:"quiz",setup(M){const l=y("quiz");return K({title:"Quiz",meta:[{name:"description",content:l.meta_description},{name:"twitter:description",content:l.meta_description}]}),(j,u)=>{const w=L,k=xt,o=X;return _(),d("div",null,[i(o,{first:""},{default:p(()=>[n("div",gt,[n("div",yt,[n("h2",null,c(t(l)?.title),1),i(w,{white:"",content:t(l)?.description},null,8,["content"])])]),i(k)]),_:1})])}}});export{zt 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.