PageSourceSearch

https://anirudhatalmale6-alt.github.io/assets/PlacementV0-B41l5-U_.js

js anirudhatalmale6-alt.github.io collected 2026-10-03 08:37:48 UTC 4,906 bytes, 1 lines download raw bytes

1import{u as q,r as l,d as N,R as e,C as B,o as _,q as T,A as x,l as z}from"./index-OsocBMuz.js";import{R as L}from"./refresh-cw-CXpWHVr5.js";const M=[{id:"p1",q:"She _____ to school every morning.",options:["go","goes","going","gone"],level:"A2"},{id:"p2",q:"We _____ been waiting for an hour.",options:["have","has","had","are"],level:"B1"},{id:"p3",q:"If I _____ more time, I would study harder.",options:["have","had","will have","having"],level:"B1"},{id:"p4",q:"The report _____ submitted by Friday.",options:["must","must be","must being","must been"],level:"B2"},{id:"p5",q:"Choose the sentence with correct punctuation:",options:["Its a beautiful day, isn't it.","It's a beautiful day, isn't it?","It's a beautiful day isn't it?","Its a beautiful day isn't it?"],level:"B2"}],b={level:"A2",percent:78,total:5,levelEvidence:{A1:{correct:2,total:2},A2:{correct:2,total:2},B1:{correct:1,total:1}}},P=["A1","A2","B1","B2","C1","C2"];function $({preview:n=!1}){q();const[s,y]=l.useState(n?M:[]),[m,h]=l.useState(0),[d,g]=l.useState({}),[c,E]=l.useState(n&&typeof window<"u"&&window.location.search.includes("result")?b:null),[k,w]=l.useState(!n),[v,u]=l.useState(!1),[o,i]=l.useState("");l.useEffect(()=>{n||N.levelCheck().then(t=>{if(!Array.isArray(t.items)||!t.items.length)throw new Error("No placement questions are available on this deployment.");y(t.items)}).catch(t=>i(t.message||"The level check could not be loaded.")).finally(()=>w(!1))},[n]);const a=s[m],p=Object.keys(d).length,f=l.useMemo(()=>s.length?Math.round(p/s.length*100):0,[p,s.length]);async function C(){if(!(!s.length||p!==s.length)){if(n){E(b);return}u(!0),i("");try{const t=s.map(r=>({itemId:r.id,answerIndex:d[r.id]}));E(await N.scoreLevelCheck(t))}catch(t){i(t.message||"The level check could not be scored.")}finally{u(!1)}}}async function S(){if(!n){u(!0);try{await z.updateMe({cefr_level:c.level}),window.location.assign("/learn")}catch(t){i(t.message||"The recommended level could not be saved."),u(!1)}}}function I(){g({}),h(0),E(null),i("")}return k?e.createElement("div",{className:"pc-wrap"},e.createElement("div",{className:"db-skel"},"Preparing your level check…")):o&&!s.length?e.createElement("div",{className:"pc-wrap"},e.createElement("div",{className:"pl-err"},o)):c?e.createElement("div",{className:"pc-wrap pc-center"},e.createElement("div",{className:"pc-result"},e.createElement(B,{className:"pc-result__tick",size:44}),e.createElement("p",{className:"pc-result__ey"},"Your result"),e.createElement("span",{className:"pc-result__badge"},c.level),e.createElement("h1",null,"Recommended starting point"),e.createElement("p",{className:"pc-result__lead"},c.percent,"% across ",c.total," server-scored questions. This guides your course entry — speaking, writing and teacher evidence can refine it later."),e.createElement("div",{className:"pc-scale"},P.map(t=>e.createElement("div",{key:t,className:`pc-scale__c ${t===c.level?"is-on":""}`},t))),o&&e.createElement("div",{className:"pl-err"},o),e.createElement("div",{className:"pc-actions"},e.createElement("button",{className:"pc-btn is-outline",onClick:I},e.createElement(L,{size:16})," Retake"),e.createElement("button",{className:"pc-btn is-coral",disabled:v,onClick:S},"Start at ",c.level," ",e.createElement(_,{size:16}))))):e.createElement("div",{className:"pc-wrap"},e.createElement("div",{className:"pc-head"},e.createElement("span",{className:"pc-head__ic"},e.createElement(T,{size:16})),e.createElement("div",{className:"pc-head__bar"},e.createElement("div",{className:"pc-head__meta"},e.createElement("span",null,"Question ",Math.min(m+1,s.length)," of ",s.length),e.createElement("span",null,f,"%")),e.createElement("div",{className:"pc-progress"},e.createElement("div",{className:"pc-progress__fill",style:{width:`${f}%`}})))),e.createElement("div",{className:"pc-q"},e.createElement("p",{className:"pc-q__ey"},(a==null?void 0:a.level)||"A1–C2"," · Grammar"),e.createElement("h2",null,(a==null?void 0:a.q)||(a==null?void 0:a.prompt)),e.createElement("div",{className:"pc-opts"},((a==null?void 0:a.options)||[]).map((t,r)=>{const A=d[a.id]===r;return e.createElement("button",{key:r,className:`pc-opt ${A?"is-sel":""}`,onClick:()=>g(R=>({...R,[a.id]:r}))},e.createElement("span",{className:"pc-opt__k"},String.fromCharCode(65+r)),t)})),o&&e.createElement("div",{className:"pl-err"},o),e.createElement("div",{className:"pc-nav"},e.createElement("button",{className:"pc-btn is-outline",disabled:m===0,onClick:()=>h(t=>Math.max(0,t-1))},e.createElement(x,{size:16})," Back"),m<s.length-1?e.createElement("button",{className:"pc-btn is-coral",disabled:d[a==null?void 0:a.id]==null,onClick:()=>h(t=>Math.min(s.length-1,t+1))},"Next ",e.createElement(_,{size:16})):e.createElement("button",{className:"pc-btn is-coral",disabled:v||p!==s.length,onClick:C},v?"Scoring…":"See my result"," ",e.createElement(_,{size:16})))))}export{$ 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.