PageSourceSearch

https://english-ease.eu/assets/AdminQuestionsBulk-BV7dLb0W.js

js english-ease.eu collected 2026-10-03 18:44:26 UTC 19,516 bytes, 7 lines download raw bytes

1import{c as Q,j as s,r as V}from"./vendor-react-core-C1Dw5D_W.js";import{T as Y,a as Z,b as L,c as G}from"./tabs-CiK-3-QR.js";import{ba as E,b8 as $,b9 as q,ax as J,c as D,bd as F,bc as R,av as U,aw as z,t as O,s as k,d6 as ee,cM as se,bb as te,v as ie}from"./seo-leaves-BMSG-wqE.js";import{D as re,i as ae,j as ne,k as oe,l as le}from"./index-DLA-Kcn6.js";import{A as H,b as W}from"./alert-CZa0Lrcb.js";import{c as B,b as ce,T as K,a as P,e as de,d as ue}from"./table-D7PYtuvh.js";import"./vendor-supabase-Ds0jIvEe.js";import"./vendor-utils-DRU7gPsF.js";import"./vendor-router-aghDRLMw.js";import"./vendor-query-DrkdRe4t.js";import"./vendor-motion-QAyZxYtn.js";import"./mistake-diagnostic-tags-D-s5KNjj.js";function me(t){const e=Q.c(16),{bulkText:r,exampleQuestions:o,isProcessing:i,onTextChange:a,onProcess:l}=t;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(E,{children:[s.jsx($,{children:"Question Input"}),s.jsx(q,{children:"Enter your questions using the pipe (|) character as a delimiter. Each line represents one question."})]}),e[0]=c):c=e[0];let m;e[1]!==a?(m=x=>a(x.target.value),e[1]=a,e[2]=m):m=e[2];let u;e[3]!==r||e[4]!==o||e[5]!==m?(u=s.jsx(J,{value:r,onChange:m,placeholder:o,className:"min-h-[300px] font-mono text-sm"}),e[3]=r,e[4]=o,e[5]=m,e[6]=u):u=e[6];let n;e[7]!==r||e[8]!==i?(n=i||!r.trim(),e[7]=r,e[8]=i,e[9]=n):n=e[9];let d;e[10]!==l||e[11]!==n?(d=s.jsx(D,{onClick:l,disabled:n,className:"w-full md:w-auto",children:"Check Questions"}),e[10]=l,e[11]=n,e[12]=d):d=e[12];let p;return e[13]!==u||e[14]!==d?(p=s.jsxs(F,{children:[c,s.jsxs(R,{className:"space-y-4",children:[u,d]})]}),e[13]=u,e[14]=d,e[15]=p):p=e[15],p}function fe(){const t=Q.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs(E,{children:[s.jsx($,{children:"CSV Format"}),s.jsx(q,{children:"Each line should follow this format, using the pipe (|) character as a delimiter:"})]}),t[0]=e):e=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("code",{className:"block whitespace-pre-wrap bg-muted p-4 rounded-md",children:"question_text | question_type | skill_focus | category | difficulty | hint | correct_answer | wrong_answer1 | wrong_answer2 | wrong_answer3 | cefr_level | grammar_topic | vocabulary_topic | tags"}),t[1]=r):r=t[1];let o,i;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("li",{children:[s.jsx("strong",{children:"question_text:"})," The actual question"]}),i=s.jsx("strong",{children:"question_type:"}),t[2]=o,t[3]=i):(o=t[2],i=t[3]);let a,l;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("li",{children:[i," One of:",s.jsxs("ul",{className:"list-disc ml-6 mt-1",children:[s.jsx("li",{children:"multiple_choice"}),s.jsx("li",{children:"fill_in_blank"}),s.jsx("li",{children:"true_false"})]})]}),l=s.jsx("strong",{children:"skill_focus:"}),t[4]=a,t[5]=l):(a=t[4],l=t[5]);let c;return t[6]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(F,{children:[e,s.jsxs(R,{children:[r,s.jsxs("ul",{className:"list-disc ml-6 mt-4 space-y-2",children:[o,a,s.jsxs("li",{children:[l," One of:",s.jsxs("ul",{className:"list-disc ml-6 mt-1",children:[s.jsx("li",{children:"Grammar"}),s.jsx("li",{children:"Vocabulary"}),s.jsx("li",{children:"Reading"}),s.jsx("li",{children:"Listening"}),s.jsx("li",{children:"Writing"})]})]}),s.jsxs("li",{children:[s.jsx("strong",{children:"category:"})," Free text for categorization"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"difficulty:"})," Number from 1-5"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"hint:"})," Optional hint for the question"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"correct_answer:"})," The correct answer"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"wrong_answer1-3:"})," Incorrect options"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"cefr_level:"})," One of: A1, A2, B1, B2, C1, C2"]})]})]})]}),t[6]=c):c=t[6],c}function pe(t){const e=Q.c(25),{title:r,showDescription:o,newOption:i,description:a,onOptionChange:l,onDescriptionChange:c,onAdd:m}=t;let u;e[0]!==r?(u=s.jsx(re,{children:s.jsxs(ae,{children:["Add New ",r]})}),e[0]=r,e[1]=u):u=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(U,{htmlFor:"name",children:"Name"}),e[2]=n):n=e[2];let d;
1e[3]!==l?(d=g=>l(g.target.value),e[3]=l,e[4]=d):d=e[4];let p;e[5]!==r?(p=r.toLowerCase(),e[5]=r,e[6]=p):p=e[6];const x=`Enter ${p} name`;let j;e[7]!==i||e[8]!==d||e[9]!==x?(j=s.jsxs("div",{children:[n,s.jsx(z,{id:"name",value:i,onChange:d,placeholder:x})]}),e[7]=i,e[8]=d,e[9]=x,e[10]=j):j=e[10];let v;e[11]!==a||e[12]!==c||e[13]!==o?(v=o&&s.jsxs("div",{children:[s.jsx(U,{htmlFor:"description",children:"Description (optional)"}),s.jsx(z,{id:"description",value:a,onChange:g=>c(g.target.value),placeholder:"Enter description"})]}),e[11]=a,e[12]=c,e[13]=o,e[14]=v):v=e[14];let b;e[15]!==m||e[16]!==r?(b=s.jsxs(D,{onClick:m,children:["Add ",r]}),e[15]=m,e[16]=r,e[17]=b):b=e[17];let y;e[18]!==j||e[19]!==v||e[20]!==b?(y=s.jsxs("div",{className:"space-y-4",children:[j,v,b]}),e[18]=j,e[19]=v,e[20]=b,e[21]=y):y=e[21];let T;return e[22]!==u||e[23]!==y?(T=s.jsxs(ne,{children:[u,y]}),e[22]=u,e[23]=y,e[24]=T):T=e[24],T}async function X(t,e,r){try{if(!e.trim())return O.error("Please enter a name for the new option"),!1;const o=e.trim(),i=t==="tags"?"tag":"topic_name";let a;if(t==="tags"?a=await k.from("tags").select().eq("tag",o):t==="grammar_topics"?a=await k.from("grammar_topics").select().eq("topic_name",o):a=await k.from("vocabulary_topics").select().eq("topic_name",o),a.error)return console.error("Error checking existing option:",a.error),O.error(`Failed to check existing ${t.replace("_"," ")}`),!1;if(a.data&&a.data.length>0)return!0;let l;t==="tags"?l={tag:o,unregistered_user_id:"system"}:l={topic_name:o,description:r||null,sub_topic:null};let c;return t==="tags"?c=await k.from("tags").insert([l]):t==="grammar_topics"?c=await k.from("grammar_topics").insert([l]):c=await k.from("vocabulary_topics").insert([l]),c.error?(console.error("Error adding option:",c.error),O.error(`Failed to add new ${t.replace("_"," ")}`),!1):(O.success(`New ${t.replace("_"," ")} added successfully`),!0)}catch(o){return console.error("Error adding option:",o),O.error(`Failed to add new ${t.replace("_"," ")}`),!1}}function I(t){const e=Q.c(30),{title:r,description:o,options:i,table:a,onOptionAdded:l}=t,[c,m]=V.useState(!1),[u,n]=V.useState(""),[d,p]=V.useState("");let x;e[0]!==d||e[1]!==u||e[2]!==l||e[3]!==a?(x=async()=>{await X(a,u,d)&&(m(!1),n(""),p(""),l())},e[0]=d,e[1]=u,e[2]=l,e[3]=a,e[4]=x):x=e[4];const j=x;let v;e[5]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(oe,{asChild:!0,children:s.jsx(D,{variant:"outline",size:"icon",children:s.jsx(ee,{className:"h-4 w-4"})})}),e[5]=v):v=e[5];const b=a!=="tags";let y;e[6]!==d||e[7]!==j||e[8]!==u||e[9]!==b||e[10]!==r?(y=s.jsx(pe,{title:r,showDescription:b,newOption:u,description:d,onOptionChange:n,onDescriptionChange:p,onAdd:j}),e[6]=d,e[7]=j,e[8]=u,e[9]=b,e[10]=r,e[11]=y):y=e[11];let T;e[12]!==c||e[13]!==y?(T=s.jsxs(le,{open:c,onOpenChange:m,children:[v,y]}),e[12]=c,e[13]=y,e[14]=T):T=e[14];let g;e[15]!==T||e[16]!==r?(g=s.jsxs($,{className:"flex justify-between items-center",children:[r,T]}),e[15]=T,e[16]=r,e[17]=g):g=e[17];let f;e[18]!==o?(f=s.jsx(q,{children:o}),e[18]=o,e[19]=f):f=e[19];let w;e[20]!==g||e[21]!==f?(w=s.jsxs(E,{children:[g,f]}),e[20]=g,e[21]=f,e[22]=w):w=e[22];let h;e[23]!==i?(h=i.map(he),e[23]=i,e[24]=h):h=e[24];let A;e[25]!==h?(A=s.jsx(R,{children:s.jsx("ul",{className:"list-disc ml-6 space-y-2",children:h})}),e[25]=h,e[26]=A):A=e[26];let N;return e[27]!==A||e[28]!==w?(N=s.jsxs(F,{children:[w,A]}),e[27]=A,e[28]=w,e[29]=N):N=e[29],N}function he(t){return s.jsxs("li",{children:[s.jsx("strong",{children:t.name}),t.description&&s.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]},t.id)}function ge(t){const e=Q.c(19),{grammarTopics:r,vocabularyTopics:o,tags:i,onRefresh:a}=t;let l;e[0]!==r?(l=r.map(je),e[0]=r,e[1]=l):l=e[1];let c;e[2]!==a||e[3]!==l?(c=s.jsx(I,{title:"Grammar Topics",description:"Available grammar topics for questions",options:l,table:"grammar_topics",onOptionAdded:a}),e[2]=a,e[3]=l,e[4]=c):c=e[4];let m;e[5]!==o?(m=o.map(_e),e[5]=o,e[6]=m):m=e[6];let u;e[7]!==a||e[8]!==m?(u=s.jsx(I,{title:"Vocabulary Topics",description:"Available vocabulary topics for questions",options:m,table:"vocabulary_topics",onOptionAdded:a}),e[7]=a,e[8]=m,e[9]=u):u=e[9];let n;e[10]!==i?(n=i.map(xe),e[10]=i,e[11]=n):n=e[11];let d;e[12]!==a||e[13]!==n?(d=s.jsx(I,{title:"Tags",description:"Available tags for question classification",options:n,table:"tags",onOptionAdded:a}),e[12]=a,e[13]=n,e[14]=d):d=e[14];let p;return e[15]!==c||e[16]!==u||e[17]!==d?(p=s.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[c,u,d]}),e[15]=c,e[16]=u,e[17]=d,e[18]=p):p=e[18],p}function xe(t){return{id:parseInt(t.id),name:t.tag,description:null}}function _e(t){return{id:t.vocab_id,name:t.topic_name,description:t.description}}function je(t){return{id:t.grammar_id,name:t.topic_name,description:t.description}}function be(t){const e=Q.c(7),{isAllSelected:r,onToggleAll:o}=t;let i;e[0]!==r||e[1]!==o?(i=s.jsx(B,{className:"w-[50px]",children:s.jsx("input",{type:"checkbox",checked:r,onChange:o,className:"rounded border-gray-300"})}),e[0]=r,e[1]=o,e[2]=i):i=e[2];let a,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(B,{className:"w-[100px]",children:"Validate"}),l=s.jsx(B,{children:"Question Text"}),e[3]=a,e[4]=l):(a=e[3],l=e[4]);let c;return e[5]!==i?(c=s.jsx(ce,{children:s.jsxs(K,{children:[i,a,l]})}),e[5]=i,e[6]=c):c=e[6],c}function we(t){const e=Q.c(13),{question:r,isSelected:o,onToggleSelect:i,onRecheck:a,originalText:l}=t,c=Object.values(r).some(ye);let m;e[0]!==o||e[1]!==i?(m=s.jsx(P,{className:"w-[50px]",children:s.jsx("input",{type:"checkbox",checked:o,onChange:i,className:"rounded border-gray-300"})}),e[0]=o,e[1]=i,e[2]=m):m=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(se,{className:"h-4 w-4"}),e[3]=u):u=e[3];let n;e[4]!==a?(n=s.jsx(P,{className:"w-[100px]",children:s.jsx(D,{variant:"ghost",size:"icon",onClick:a,className:"h-8 w-8",children:u})}),e[4]=a,e[5]=n):n=e[5];const d=`min-h-[80px] resize-y w-full font-mono ${c?"border-red-500 text-red-600":"border-green-500"}`;let p;e[6]!==l||e[7]!==d?(p=s.jsx(P,{className:"w-full",children:s.jsx(J,{value:l,className:d,readOnly:!0})}),e[6]=l,e[7]=d,e[8]=p):p=e[8];let x;return e[9]!==m||e[10]!==n||e[11]!==p?(x=s.jsxs(K,{className:"hover:bg-gray-50",children:[m,n,p]}),e[9]=m,e[10]=n,e[11]=p,e[12]=x):x=e[12],x}function ye(t){return!t.isValid||!t.existsInDb}function ve(t){const e=Q.c(30),{questions:r,originalTexts:o,onFieldU
1pdate:i,onAddOption:a,onRecheck:l}=t;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=new Set,e[0]=c):c=e[0];const[m,u]=V.useState(c),[n,d]=V.useState(!1);let p;e[1]!==r.length||e[2]!==m?(p=f=>{const w=new Set(m);w.has(f)?w.delete(f):w.add(f),u(w),d(w.size===r.length)},e[1]=r.length,e[2]=m,e[3]=p):p=e[3];const x=p;let j;e[4]!==n||e[5]!==r?(j=()=>{u(n?new Set:new Set(r.map(Te))),d(!n)},e[4]=n,e[5]=r,e[6]=j):j=e[6];const v=j;let b;e[7]!==n||e[8]!==v?(b=s.jsx(be,{isAllSelected:n,onToggleAll:v}),e[7]=n,e[8]=v,e[9]=b):b=e[9];let y;if(e[10]!==a||e[11]!==i||e[12]!==l||e[13]!==o||e[14]!==r||e[15]!==m||e[16]!==x){let f;e[18]!==a||e[19]!==i||e[20]!==l||e[21]!==o||e[22]!==m||e[23]!==x?(f=(w,h)=>s.jsx(we,{question:w,index:h,isSelected:m.has(h),onToggleSelect:()=>x(h),onFieldUpdate:(A,N)=>i(h,A,N),onRecheck:()=>l(h),onAddOption:a,originalText:o[h]},h),e[18]=a,e[19]=i,e[20]=l,e[21]=o,e[22]=m,e[23]=x,e[24]=f):f=e[24],y=r.map(f),e[10]=a,e[11]=i,e[12]=l,e[13]=o,e[14]=r,e[15]=m,e[16]=x,e[17]=y}else y=e[17];let T;e[25]!==y?(T=s.jsx(de,{children:y}),e[25]=y,e[26]=T):T=e[26];let g;return e[27]!==b||e[28]!==T?(g=s.jsx("div",{className:"space-y-4",children:s.jsxs(ue,{children:[b,T]})}),e[27]=b,e[28]=T,e[29]=g):g=e[29],g}function Te(t,e){return e}function Ne(t){const e=Q.c(19),{questions:r,originalTexts:o,validQuestionCount:i,onFieldUpdate:a,onAddOption:l,onRecheck:c}=t;let m;e[0]!==r?(m=r.filter(Ce),e[0]=r,e[1]=m):m=e[1];const u=m;let n;if(e[2]!==o||e[3]!==r){let b;e[5]!==r?(b=(y,T)=>Object.values(r[T]).some(Ae),e[5]=r,e[6]=b):b=e[6],n=o.filter(b),e[2]=o,e[3]=r,e[4]=n}else n=e[4];const d=n;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs(E,{children:[s.jsx($,{children:"Validation Results"}),s.jsx(q,{children:"Review and correct any issues before proceeding."})]}),e[7]=p):p=e[7];let x;e[8]!==i?(x=i>0&&s.jsxs(H,{className:"bg-green-50 border-green-200",children:[s.jsx(ie,{className:"h-4 w-4 text-green-500"}),s.jsxs(W,{className:"text-green-700",children:[i," question",i!==1?"s":""," successfully added to the database."]})]}),e[8]=i,e[9]=x):x=e[9];let j;e[10]!==u||e[11]!==d||e[12]!==l||e[13]!==a||e[14]!==c?(j=u.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs(H,{variant:"destructive",children:[s.jsx(te,{className:"h-4 w-4"}),s.jsxs(W,{children:[u.length," question",u.length!==1?"s have":" has"," validation errors. Please correct them before proceeding."]})]}),s.jsx(ve,{questions:u,originalTexts:d,onFieldUpdate:a,onAddOption:l,onRecheck:c})]}),e[10]=u,e[11]=d,e[12]=l,e[13]=a,e[14]=c,e[15]=j):j=e[15];let v;return e[16]!==x||e[17]!==j?(v=s.jsxs(F,{children:[p,s.jsxs(R,{className:"space-y-4",children:[x,j]})]}),e[16]=x,e[17]=j,e[18]=v):v=e[18],v}function Ae(t){return!t.isValid}function Ce(t){return Object.values(t).some(Se)}function Se(t){return!t.isValid}function S(t,e,r){let o=t.trim().length>0,i=!0;t==="null"&&(e==="vocabulary"||e==="hint")?(o=!0,i=!0):e==="type"?o=["multiple_choice","fill_in_blank","true_false"].includes(t):e==="skill"?o=["Grammar","Vocabulary","Reading","Listening","Writing"].includes(t):e==="difficulty"?o=!isNaN(Number(t))&&Number(t)>=1&&Number(t)<=5:e==="cefr"?o=["A1","A2","B1","B2","C1","C2"].includes(t):r&&(e==="tags"?i=t.split(",").map(c=>c.trim()).every(c=>r.includes(c)):i=r.includes(t));let a;return e==="grammar"?a="grammar_topics":e==="vocabulary"?a="vocabulary_topics":e==="tags"&&(a="tags"),{value:t,isValid:o,existsInDb:i,table:a}}function ke(t,e,r,o){const i=t.split("|").map(a=>a.trim());return{questionText:S(i[0]||"","text"),questionType:S(i[1]||"","type"),skillFocus:S(i[2]||"","skill"),category:S(i[3]||"","text"),difficulty:S(i[4]||"","difficulty"),hint:S(i[5]||"","hint"),correctAnswer:S(i[6]||"","text"),wrongAnswer1:S(i[7]||"","text"),wrongAnswer2:S(i[8]||"","text"),wrongAnswer3:S(i[9]||"","text"),cefrLevel:S(i[10]||"","cefr"),grammarTopic:S(i[11]||"","grammar",e),vocabularyTopic:S(i[12]||"","vocabulary",r),tags:S(i[13]||"","tags",o)}}async function M(t,e,r,o){try{const{data:i,error:a}=await k.from("questions").insert({question_text:t.questionText.value,question_type:t.questionType.value,skill_focus:t.skillFocus.value,category:t.category.value,difficulty:parseInt(t.difficulty.value),hint:t.hint.value==="null"?null:t.hint.value}).select().single();if(a)throw console.error("Error inserting question:",a),a;const l=[{answer_text:t.correctAnswer.value,is_correct:!0},{answer_text:t.wrongAnswer1.value,is_correct:!1},{answer_text:t.wrongAnswer2.value,is_correct:!1},{answer_text:t.wrongAnswer3.value,is_correct:!1}].map(n=>({...n,question_id:i.question_id})),{error:c}=await k.from("answers").insert(l);if(c)throw console.error("Error inserting answers:",c),c;if(t.grammarTopic.value!=="null"){const n=e.find(d=>d.topic_name===t.grammarTopic.value);if(n?.grammar_id){const{error:d}=await k.from("question_grammar").insert({question_id:i.question_id,grammar_id:n.grammar_id});if(d)throw console.error("Error inserting grammar topic:",d),d}}if(t.vocabularyTopic.value!=="null"){const n=r.find(d=>d.topic_name===t.vocabularyTopic.value);if(n?.vocab_id){const{error:d}=await k.from("question_vocabulary").insert({question_id:i.question_id,vocab_id:n.vocab_id});if(d)throw console.error("Error inserting vocabulary topic:",d),d}}const m=t.tags.value.split(",").map(n=>n.trim()),u=o.filter(n=>m.includes(n.tag||"")).map(n=>parseInt(n.id||"0")).filter(n=>!isNaN(n)&&n>0);if(u.length>0){const{error:n}=await k.from("question_tags").insert(u.map(d=>({question_id:i.question_id,tag_id:d})));if(n)throw console.error("Error inserting tags:",n),n}return!0}catch(i){return console.error("Error inserting question:",i),!1}}const Le=()=>{const[t,e]=V.useState(""),[r,o]=V.useState([]),[i,a]=V.useState([]),[l,c]=V.useState([]),[m,u]=V.useState([]),[n,d]=V.useState(0),[p,x]=V.useState(!1),j=`What is the past tense of "go"? | multiple_choice | Grammar | Basic Verbs | 1 | Think about irregular verb
1s | went | goed | gone | going | A1 | Basic Tenses | null | Beginner,Grammar Basics
2
3Choose the correct word: "The doctor ___ treating patients." | multiple_choice | Grammar | Present Continuous | 2 | Look for the correct form of "be" | is | are | am | be | A2 | Present Continuous | Professional | Intermediate,Medical English`,v=async()=>{try{const[g,f,w]=await Promise.all([k.from("grammar_topics").select("grammar_id, topic_name, description"),k.from("vocabulary_topics").select("vocab_id, topic_name, description"),k.from("tags").select("id, tag")]);if(g.error)throw g.error;if(f.error)throw f.error;if(w.error)throw w.error;o(g.data.map(h=>({...h}))),a(f.data.map(h=>({...h}))),c(w.data.map(h=>({id:h.id,tag_name:h.tag})))}catch(g){console.error("Error fetching data:",g),O.error("Failed to load options")}},b=async()=>{x(!0);const g=t.split(`
4`).filter(_=>_.trim()),f=g.map(_=>ke(_,r.map(C=>C.topic_name||""),i.map(C=>C.topic_name||""),l.map(C=>C.tag||""))),w=f.filter(_=>_.questionText.isValid&&_.questionType.isValid&&_.skillFocus.isValid&&_.category.isValid&&_.difficulty.isValid&&_.correctAnswer.isValid&&_.wrongAnswer1.isValid&&_.wrongAnswer2.isValid&&_.wrongAnswer3.isValid&&_.cefrLevel.isValid&&_.grammarTopic.isValid&&_.vocabularyTopic.isValid&&_.tags.isValid);let h=0;for(const _ of w)await M(_,r,i,l)&&h++;const A=f.filter(_=>!w.includes(_));u(A),d(_=>_+h),g.filter((_,C)=>A.includes(f[C]));const N=t.split(`
5`).filter((_,C)=>A.includes(f[C])).join(`
6`);e(N),x(!1),h>0&&O.success(`Successfully added ${h} question${h!==1?"s":""} to the database`)},y=(g,f,w)=>{const h=[...m],A={...h[g]};let N="text";f==="questionType"?N="type":f==="skillFocus"?N="skill":f==="difficulty"?N="difficulty":f==="cefrLevel"?N="cefr":f==="grammarTopic"?N="grammar":f==="vocabularyTopic"?N="vocabulary":f==="tags"&&(N="tags");let _;f==="grammarTopic"?_=r.map(C=>C.topic_name||""):f==="vocabularyTopic"?_=i.map(C=>C.topic_name||""):f==="tags"&&(_=l.map(C=>C.tag||"")),A[f]=S(w,N,_),h[g]=A,u(h)},T=async g=>{const f=m[g];await M(f,r,i,l)&&(d(h=>h+1),u(h=>h.filter((A,N)=>N!==g)),O.success("Question successfully added to the database"))};return s.jsxs("div",{className:"container mx-auto p-6 max-w-[95vw]",children:[s.jsx("h1",{className:"text-2xl font-bold mb-6",children:"Bulk Question Upload"}),s.jsxs("div",{className:"grid gap-6",children:[s.jsx(me,{bulkText:t,exampleQuestions:j,isProcessing:p,onTextChange:e,onProcess:b}),(m.length>0||n>0)&&s.jsx(Ne,{questions:m,originalTexts:t.split(`
7`).filter(g=>g.trim()),validQuestionCount:n,onFieldUpdate:y,onAddOption:X,onRecheck:T}),s.jsxs(Y,{defaultValue:"format",className:"w-full",children:[s.jsxs(Z,{children:[s.jsx(L,{value:"format",children:"Format Guide"}),s.jsx(L,{value:"options",children:"Available Options"})]}),s.jsx(G,{value:"format",children:s.jsx(fe,{})}),s.jsx(G,{value:"options",children:s.jsx(ge,{grammarTopics:r,vocabularyTopics:i,tags:l,onRefresh:v})})]})]})]})};export{Le 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.