PageSourceSearch

https://fliplab.io.vn/assets/js/QuickTestPage-P9Q0sJCB.js

js fliplab.io.vn collected 2026-10-02 02:12:59 UTC 10,701 bytes, 1 lines download raw bytes

1var A=(o,n,d)=>new Promise((t,x)=>{var f=r=>{try{u(d.next(r))}catch(b){x(b)}},m=r=>{try{u(d.throw(r))}catch(b){x(b)}},u=r=>r.done?t(r.value):Promise.resolve(r.value).then(f,m);u((d=d.apply(o,n)).next())});import{k as Q,c as F,u as O,r as h,j as e}from"./react-vendor-BaX8wFxW.js";import{u as G,e as X,f as H,aa as D,a7 as J,a0 as K}from"./index-CLYH3Hla.js";import{M as _}from"./MainLayout-DUhX1UlE.js";import{aw as M,bI as $,h as U,a2 as V,B as W,au as Y,a6 as Z,ax as ee}from"./icons-hi2-zdK1GiMw.js";import"./data-vendor-B9G6AmzB.js";import"./charts-vendor-BEN4kyo5.js";import"./motion-vendor-C9lJIqxK.js";import"./icons-other-B4wTEEQh.js";import"./FeedbackWidget-7MzlXCQp.js";import"./useUnreadChat-CkQymoUe.js";import"./chatQuery-DjJAzUWq.js";import"./useDashboardDataRQ-Q_7TA60m.js";import"./xpService-C6Rjgg6K.js";import"./documentHubService-Czor3o78.js";import"./useProStatus-B2wkFa91.js";import"./billingService-Boi-1Fyr.js";function C(o){const n=[...o];for(let d=n.length-1;d>0;d--){const t=Math.floor(Math.random()*(d+1));[n[d],n[t]]=[n[t],n[d]]}return n}function P(o,n){return o.length<2?[]:C(o).slice(0,Math.min(n.count,o.length)).map((x,f)=>{let m;n.direction==="term-to-def"?m=!0:n.direction==="def-to-term"?m=!1:m=Math.random()>.5;const u=m?x.term:x.definition,r=m?x.definition:x.term,b=o.filter(c=>c._id!==x._id),v=C(b).slice(0,3).map(c=>m?c.definition:c.term),p=C([r,...v]),k=p.indexOf(r);return{id:`${x._id}-${f}`,prompt:u,correctAnswer:r,options:p,correctIndex:k}})}const ge=()=>{const{setId:o}=Q(),n=F(),d=O(),{t}=G(),{openChat:x}=X(),f=h.useMemo(()=>{var a;return(a=d.state)!=null?a:{count:10,direction:"term-to-def"}},[d.state]),[m,u]=h.useState("loading"),[r,b]=h.useState([]),[w,v]=h.useState(""),[p,k]=h.useState(0),[c,q]=h.useState(null),[g,y]=h.useState(!1),[N,z]=h.useState([]);h.useEffect(()=>{o&&A(null,null,function*(){try{const s=(yield H.getById(o)).data.flashcardSet;v(s.name);const l=P(s.cards,f);b(l),u("question")}catch(a){n(-1)}})},[o,f,n]);const i=r[p],S=p===r.length-1,{correctCount:I,scorePercent:j}=h.useMemo(()=>{const a=N.filter(s=>s.isCorrect).length;return{correctCount:a,scorePercent:r.length>0?Math.round(a/r.length*100):0}},[N,r.length]),L=a=>{if(g)return;q(a),y(!0);const s=a===i.correctIndex;s?D():J(),z(l=>[...l,{question:i,selectedIndex:a,isCorrect:s}])},E=()=>{S?(K(),u("result")):(k(a=>a+1),q(null),y(!1))},R=()=>{k(0),q(null),y(!1),z([]),o&&(u("loading"),H.getById(o).then(a=>{const s=P(a.data.flashcardSet.cards,f);b(s),u("question")}))};if(m==="loading")return e.jsx(_,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-4",children:[e.jsx("div",{className:"w-10 h-10 border-4 border-indigo-200 border-t-indigo-600 rounded-full animate-spin"}),e.jsx("p",{className:"text-muted font-medium",children:t("quiz.quick_loading")})]})});if(m==="result"){const a=j>=90?"text-emerald-600 dark:text-emerald-400":j>=70?"text-blue-600 dark:text-blue-400":j>=50?"text-amber-600 dark:text-amber-400":"text-red-500 dark:text-red-400",s=j>=90?t("quiz.quick_score_excellent"):j>=70?t("quiz.quick_score_good"):j>=50?t("quiz.quick_score_ok"):t("quiz.quick_score_poor");return e.jsx(_,{children:e.jsxs("div",{className:"max-w-4xl mx-auto py-10 px-4 animate-in fade-in duration-500",children:[e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-[2rem] border border-slate-200 dark:border-slate-700 p-8 text-center mb-6",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-indigo-100 dark:bg-indigo-900/30 flex items-center justify-center",children:e.jsx(M,{className:"w-8 h-8 text-indigo-500"})}),e.jsx("h1",{className:"text-2xl font-extrabold text-slate-900 dark:text-white mb-1",children:t("quiz.quick_result_title")}),e.jsx("p",{className:"text-sm text-muted mb-6",children:w}),e.jsxs("div",{className:`text-6xl font-black mb-2 ${a}`,children:[j,"%"]}),e.jsx("p",{className:`text-lg font-bold mb-4 ${a}`,children:s}),e.jsxs("div",{className:"flex items-center justify-center gap-6 text-sm",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-2xl font-extrabold text-emerald-600 dark:text-emerald-400",children:I}),e.jsx("p",{className:"text-muted",children:t("quiz.quick_correct")})]}),e.jsx("div",{className:"w-px h-10 bg-slate-200 dark:bg-slate-700"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-2xl font-extrabold text-red-500",children:r.length-I}),e.jsx("p",{className:"text-muted",children:t("quiz.quick_wrong")})]}),e.jsx("div",{className:"w-px h-10 bg-slate-200 dark:bg-slate-700"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-2xl font-extrabold text-slate-700 dark:text-slate-200",children:r.length}),e.jsx("p",{className:"text-muted",children:t("quiz.quick_total")})]})]})]}),N.some(l=>!l.isCorrect)&&e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-[2rem] border border-slate-200 dark:border-slate-700 p-6 mb-6",children:[e.jsxs("h2",{className:"font-extrabold text-slate-800 dark:text-slate-100 mb-4 flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5 text-red-500"}),t("quiz.quick_wrong_answers_title")]}),e.jsx("div",{className:"space-y-3",children:N.filter(l=>!l.isCorrect).map((l,B)=>e.jsxs("div",{className:"rounded-xl border border-red-100 dark:border-red-900/40 bg-red-50 dark:bg-red-900/10 p-3",children:[e.jsx("p",{className:"text-xs text-muted mb-1",children:t("quiz.quick_question_label")}),e.jsx("p",{className:"text-sm font-semibold text-slate-800 dark:text-slate-100 mb-2",children:l.question.prompt}),e.jsxs("div",{className:"flex flex-col gap-1",children:[l.selectedIndex!==null&&e.jsxs("p",{className:"text-xs",children:[e.jsxs("span",{className:"text-red-500 font-bold",children:[t("quiz.quick_you_chose")," "]}),e.jsx("span",{className:"text-secondary",children:l.question.options[l.selectedIndex]})]}),e.jsxs("p",{className:"text-xs",children:[e.jsxs("span",{className:"text-emerald-600 font-bold",children:[t("quiz.quick_correct_answer")," "]}),e.jsx("span",{className:"text-secondary",children:l.question.correctAnswer})]})]})]},B))})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{onClick:R,className:"flex-1 flex items-center justify-center gap-2 py-3 bg-indigo-600 hover:bg-indigo-700 text-white rounded-[1.25rem] font-bold transition-colors cursor-pointer",children:[e.jsx(U,{className:"w-5 h-5"}),t("quiz.quick_retry")]}),e.jsxs("button",{onClick:()=>n("/"),className:"flex-1 flex items-center justify-center gap-2 py-3 bg-slate-100 dar
1k:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 text-slate-700 dark:text-slate-200 rounded-[1.25rem] font-bold border border-slate-200 dark:border-slate-700 transition-colors cursor-pointer",children:[e.jsx(V,{className:"w-5 h-5"}),t("quiz.quick_home")]})]})]})})}const T=p/r.length*100;return e.jsx(_,{children:e.jsxs("div",{className:"max-w-4xl mx-auto pt-2 pb-6 px-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("button",{onClick:()=>n(-1),className:"w-9 h-9 flex items-center justify-center rounded-xl border border-slate-200 dark:border-slate-700 text-slate-500 hover:text-slate-800 dark:hover:text-white hover:border-slate-400 transition-colors cursor-pointer",children:e.jsx(W,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("div",{className:"flex items-center gap-1.5 text-sm font-bold text-muted",children:t("quiz.quick_title")}),e.jsxs("span",{className:"text-sm font-bold text-muted",children:[p+1," / ",r.length]})]}),e.jsx("div",{className:"h-2 bg-slate-100 dark:bg-slate-700 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-indigo-500 transition-all duration-500",style:{width:`${T}%`}})})]})]}),e.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-3xl border border-slate-200 dark:border-slate-700 p-6 mb-4 min-h-[100px] flex items-center justify-center text-center animate-in fade-in duration-300",children:e.jsx("p",{className:"text-2xl font-extrabold text-slate-900 dark:text-white leading-snug",children:i.prompt})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-6",children:i.options.map((a,s)=>{let l="border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 hover:border-indigo-400 dark:hover:border-indigo-500 text-slate-800 dark:text-slate-100 cursor-pointer";return g&&(s===i.correctIndex?l="border-emerald-500 bg-emerald-50 dark:bg-emerald-900/20 text-emerald-800 dark:text-emerald-200 cursor-default":s===c?l="border-red-500 bg-red-50 dark:bg-red-900/20 text-red-700 dark:text-red-300 cursor-default":l="border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-400 dark:text-slate-600 cursor-default opacity-60"),e.jsxs("button",{onClick:()=>L(s),disabled:g,className:`flex items-start gap-3 px-5 py-4 rounded-2xl border-2 text-left font-semibold transition-all ${l}`,children:[g&&s===i.correctIndex&&e.jsx(Y,{className:"w-5 h-5 text-emerald-500 flex-shrink-0 mt-0.5"}),g&&s===c&&s!==i.correctIndex&&e.jsx($,{className:"w-5 h-5 text-red-500 flex-shrink-0 mt-0.5"}),(!g||s!==i.correctIndex&&s!==c)&&e.jsx("span",{className:"w-5 h-5 flex-shrink-0 rounded-full border-2 border-current flex items-center justify-center text-xs font-black mt-0.5",children:String.fromCharCode(65+s)}),e.jsx("span",{className:"text-sm leading-snug flex-1 break-words",children:a})]},s)})}),g&&e.jsxs("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300 space-y-2",children:[c!==i.correctIndex&&e.jsxs("button",{onClick:()=>x(`Giải thích tại sao đáp án đúng là "${i.correctAnswer}" chứ không phải "${c!==null?i.options[c]:"?"}". Câu hỏi: ${i.prompt}`,{pageContext:"quiz",deckId:o,deckName:w,quizContext:{question:i.prompt,userAnswer:c!==null?i.options[c]:"",correctAnswer:i.correctAnswer,correct:!1}}),className:"w-full flex items-center justify-center gap-2 py-2.5 rounded-[1.25rem] border border-violet-200 dark:border-violet-800 bg-violet-50 dark:bg-violet-950/40 text-violet-700 dark:text-violet-300 hover:bg-violet-100 dark:hover:bg-violet-900/50 font-semibold text-sm transition-colors cursor-pointer",children:[e.jsx(Z,{className:"w-4 h-4"}),t("quiz.flipie_explain")]}),e.jsx("button",{onClick:E,className:"w-full flex items-center justify-center gap-2 py-3.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-[1.25rem] font-extrabold text-base transition-colors cursor-pointer",children:S?e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"w-5 h-5"}),t("quiz.quick_see_result")]}):e.jsxs(e.Fragment,{children:[t("quiz.quick_next"),e.jsx(ee,{className:"w-5 h-5"})]})})]})]})})};export{ge 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.