@edpire/sdk 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +2 -2
- package/dist/index.mjs +7 -7
- package/dist/react.mjs +10 -10
- package/dist/umd/index.global.js +159 -158
- package/package.json +3 -3
package/dist/react.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import"./chunk-76CZ6Z7T.mjs";import Ki,{useMemo as Xi}from"react";import{jsx as dr}from"react/jsx-runtime";import{useEffect as dt,useMemo as Pi,useRef as Mi}from"react";import xa from"mitt";var qe=class{constructor(){this.emitter=xa(),this.answers=new Map}emit(r){if(r.type==="answer:changed")this.answers.set(r.answer.nodeId,r.answer);else if(r.type==="answers:reset")this.answers.clear();else if(r.type==="answers:prefill")for(let t of r.answers)this.answers.set(t.nodeId,t);this.emitter.emit(r.type,r)}on(r,t){this.emitter.on(r,t)}off(r,t){this.emitter.off(r,t)}getAllAnswers(){return Array.from(this.answers.values())}clearAnswers(){this.answers.clear(),this.emit({type:"answers:reset"})}prefillAnswers(r){this.emit({type:"answers:prefill",answers:r})}submitAnswers(){this.emit({type:"answer:submitted",answers:this.getAllAnswers(),timestamp:Date.now()})}},An="__edpireGlobalAnswerBus",Cn=globalThis,Tr=Cn[An]??(Cn[An]=new qe);import{jsx as ya}from"react/jsx-runtime";import{createContext as va,useContext as wa}from"react";var En="__edpireAnswerBusContext",Pn=globalThis,Mn=Pn[En]??(Pn[En]=va(Tr));function de(){return wa(Mn)}function $r({children:e,bus:r=new qe}){return ya(Mn.Provider,{value:r,children:e})}import{Fragment as On,jsx as V,jsxs as Ve}from"react/jsx-runtime";import{Fragment as Oa,useState as Xr,useEffect as Kr,useMemo as ja,useRef as Ba}from"react";import $e from"clsx";import{jsx as q,jsxs as Sa}from"react/jsx-runtime";import ka from"katex";import"katex/dist/contrib/mhchem.js";var Ra={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function br(e,r,t=!0){try{return ka.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Ra,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function L(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function re(e){return{width:L(e),height:L(e)}}function Me(e){if(e==null||e==="")return;if(typeof e=="number")return L(e);let r=String(e).trim();return/^\d+(\.\d+)?px$/.test(r)?L(r):r}var In={1:{fontSize:"1.75em",fontWeight:700,lineHeight:1.2,margin:"0.6em 0 0.4em"},2:{fontSize:"1.4em",fontWeight:700,lineHeight:1.25,margin:"0.6em 0 0.35em"},3:{fontSize:"1.15em",fontWeight:600,lineHeight:1.3,margin:"0.5em 0 0.3em"}},Ln={border:"#2563eb",background:"#e0f2fe"},Tn={border:"#dc2626",background:"#fee2e2"};function _a(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Ln.border}`,background:e?.background||Ln.background,borderRadius:L("4px"),padding:"0.17em 0.37em"}}var Dr=`${L("6px")} ${L("8px")}`;function Na(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Tn.border}`,background:e?.background||Tn.background,borderRadius:r,padding:"0.15em 0.45em"}}function Se(e,r,t){return q("div",{className:"exercise-content",children:e.content.map((n,o)=>xe(n,`node-${o}`,r,t))})}var Aa=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,Ca=new Set(["blank","inlineChoiceSet"]);function $n(e,r,t,n){let o=[],a=e??[];for(let s=0;s<a.length;s++){let i=a[s],c=a[s+1],d=Ca.has(i.type)&&c?.type==="text"?Aa.exec(c.text??"")?.[0]:void 0;if(!d||!c){o.push(xe(i,`${r}-${s}`,t,n));continue}let l=(c.text??"").slice(d.length);o.push(Sa("span",{style:{whiteSpace:"nowrap"},children:[q("span",{style:{whiteSpace:"normal"},children:xe(i,`${r}-${s}-a`,t,n)}),xe({...c,text:d},`${r}-${s}-p`,t,n)]},`${r}-${s}`)),l&&o.push(xe({...c,text:l},`${r}-${s+1}`,t,n)),s++}return o}function xe(e,r,t,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return q(Fr,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?q(Or,{node:e,validationFeedback:t?.get(e.id)},r):q(jr,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return q(Br,{node:e},r);case"inlinePool":return q(qr,{node:e},r);case"matchingSet":return q(Wr,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return q(Ur,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return q(Hr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return q(Vr,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return q(Qr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},r);case"aiEvaluationConfig":return null;case"paragraph":{let o=e.attrs,a=o?.textAlign,s=o?.dir||void 0;return q("p",{dir:s,style:a?{textAlign:a}:void 0,children:$n(e.content,r,t,n)},r)}case"heading":{let o=e.attrs.level??1,a=`h${o}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,d=In[o]??In[3];return q(a,{dir:c,style:{...d,...i?{textAlign:i}:{}},children:$n(e.content,r,t,n)},r)}case"blockquote":{let o=e.attrs,a=o?.dir||void 0,s=o?.textAlign;return q("blockquote",{dir:a,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...s?{textAlign:s}:{}},children:e.content?.map((i,c)=>xe(i,`${r}-${c}`,t,n))},r)}case"text":{let o=e,a=o.text??"",s=o.marks??[];if(s.length===0)return q("span",{children:a},r);let i={};for(let d of s)d.type==="textStyle"&&(d.attrs?.color&&(i.color=d.attrs.color),d.attrs?.fontSize&&(i.fontSize=d.attrs.fontSize),d.attrs?.fontFamily&&(i.fontFamily=d.attrs.fontFamily));let c=a;for(let d of s)switch(d.type){case"bold":c=q("strong",{children:c});break;case"italic":c=q("em",{children:c});break;case"underline":c=q("u",{children:c});break;case"strike":c=q("s",{children:c});break;case"code":c=q("code",{children:c});break;case"subscript":c=q("sub",{children:c});break;case"superscript":c=q("sup",{children:c});break;case"boxedText":c=q("span",{style:_a(d.attrs),children:c});break;case"circleText":c=q("span",{style:Na(d.attrs),children:c});break}return q("span",{style:Object.keys(i).length>0?i:void 0,children:c},r)}case"hardBreak":return q("br",{},r);case"resizableImage":return q("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:Me(e.attrs?.width||void 0)??"auto",height:Me(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"resizableAudio":return q("span",{style:{display:"inline-flex",verticalAlign:"middle",alignItems:"center",background:"#f1f5f9",borderRadius:L("8px"),padding:`${L("4px")} ${L("8px")}`,maxWidth:"100%"},children:q("audio",{controls:!0,src:e.attrs?.src||void 0,style:{display:"block",width:L("320px"),maxWidth:"100%"}})},r);case"resizableVideo":return q("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Me(e.attrs?.width||void 0)??"auto",height:Me(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"youtubeEmbed":return q("iframe",{src:`https://www.youtube.com/embed/${e.attrs?.videoId||""}`,width:e.attrs?.width||480,height:e.attrs?.height||270,allowFullScreen:!0,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",style:{display:"inline-block",verticalAlign:"middle",border:0,width:Me(e.attrs?.width||480),height:Me(e.attrs?.height||270)}},r);case"inlineMath":return q("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:br(e.attrs?.latex??"",!1,!0)}},r);case"blockMath":return q("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:br(e.attrs?.latex??"",!0,!0)}},r);case"variable":return q("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let o=e;return o.type==="bulletList"?q("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>xe(a,`${r}-${s}`,t,n))},r):o.type==="orderedList"?q("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>xe(a,`${r}-${s}`,t,n))},r):o.type==="listItem"?q("li",{children:o.content?.map((a,s)=>xe(a,`${r}-${s}`,t,n))},r):o.type==="table"?q("div",{style:{overflowX:"auto",margin:`${L("1.25rem")} 0`},children:q("table",{style:{borderCollapse:"collapse",width:"100%",tableLayout:"fixed"},children:q("tbody",{children:o.content?.map((a,s)=>xe(a,`${r}-${s}`,t,n))})})},r):o.type==="tableRow"?q("tr",{children:o.content?.map((a,s)=>xe(a,`${r}-${s}`,t,n))},r):o.type==="tableCell"?q("td",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Dr,verticalAlign:"top"},children:o.content?.map((a,s)=>xe(a,`${r}-${s}`,t,n))},r):o.type==="tableHeader"?q("th",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Dr,verticalAlign:"top",background:"#f3f4f6",fontWeight:600},children:o.content?.map((a,s)=>xe(a,`${r}-${s}`,t,n))},r):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function oe(e,r){return e.map(t=>{if(t.type==="text"){let n=Ze(t.text??""),o=t.marks??[],a=[];for(let s of o)s.type==="textStyle"&&(s.attrs?.color&&a.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&a.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&a.push(`font-family:${s.attrs.fontFamily}`));a.length>0&&(n=`<span style="${a.join(";")}">${n}</span>`);for(let s of o)switch(s.type){case"bold":n=`<strong>${n}</strong>`;break;case"italic":n=`<em>${n}</em>`;break;case"underline":n=`<u>${n}</u>`;break;case"strike":n=`<s>${n}</s>`;break;case"code":n=`<code>${n}</code>`;break;case"subscript":n=`<sub>${n}</sub>`;break;case"superscript":n=`<sup>${n}</sup>`;break;case"boxedText":{let i=s.attrs?.border||"#2563eb",c=s.attrs?.background||"#e0f2fe";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${L("4px")};padding:0.17em 0.37em">${n}</span>`;break}case"circleText":{let i=s.attrs?.border||"#dc2626",c=s.attrs?.background||"#fee2e2",d=s.attrs?.shape==="circle"?"50%":"9999px";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${d};padding:0.15em 0.45em">${n}</span>`;break}}return n}if(t.type==="paragraph"){let n=t.content?oe(t.content,r):"",o=t.attrs?.dir,a=t.attrs?.textAlign,s=o?` dir="${o}"`:"",i=a?` style="text-align:${a}"`:"";return r?.stripParagraphs?n:`<p${s}${i}>${n}</p>`}if(t.type==="hardBreak")return"<br/>";if(t.type==="table"){let n=t.content?oe(t.content,r):"";return`<div style="overflow-x:auto;margin:${L("1.25rem")} 0"><table style="border-collapse:collapse;width:100%;table-layout:fixed"><tbody>${n}</tbody></table></div>`}if(t.type==="tableRow")return`<tr>${t.content?oe(t.content,r):""}</tr>`;if(t.type==="tableCell"){let n=t.content?oe(t.content,r):"",o=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",a=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<td${o}${a} style="border:1px solid #d1d5db;padding:${Dr};vertical-align:top">${n}</td>`}if(t.type==="tableHeader"){let n=t.content?oe(t.content,r):"",o=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",a=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<th${o}${a} style="border:1px solid #d1d5db;padding:${Dr};vertical-align:top;background:#f3f4f6;font-weight:600">${n}</th>`}if(t.type==="bulletList")return`<ul style="list-style-type:disc;padding-left:1.5em">${t.content?oe(t.content,r):""}</ul>`;if(t.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${t.content?oe(t.content,r):""}</ol>`;if(t.type==="listItem")return`<li>${t.content?oe(t.content,r):""}</li>`;if(t.type==="blockquote"){let n=t.content?oe(t.content,r):"";return`<blockquote${t.attrs?.dir?` dir="${t.attrs.dir}"`:""} style="border-inline-start:3px solid #d6d3cc;padding-inline-start:1em;margin:0.75em 0;color:#565b66;font-style:italic">${n}</blockquote>`}if(t.type==="resizableImage"){let n=t.attrs??{},o=zr(n.width),a=zr(n.height);return`<img src="${Ze(n.src??"")}" alt="${Ze(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"/>`}if(t.type==="resizableAudio"){let n=t.attrs??{};return`<span style="display:inline-flex;vertical-align:middle;align-items:center;background:#f1f5f9;border-radius:${L("8px")};padding:${L("4px")} ${L("8px")};max-width:100%"><audio controls src="${Ze(n.src??"")}" style="display:block;width:${L("320px")};max-width:100%"></audio></span>`}if(t.type==="resizableVideo"){let n=t.attrs??{},o=zr(n.width),a=zr(n.height);return`<video src="${Ze(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"></video>`}if(t.type==="youtubeEmbed"){let n=t.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Ze(n.videoId??"")}" width="${n.width||480}" height="${n.height||270}" allowfullscreen frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" style="display:inline-block;vertical-align:middle;border:0;width:${Me(n.width||480)};height:${Me(n.height||270)}"></iframe>`}return t.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${br(t.attrs?.latex??"",!1,!0)}</span>`:t.type==="blockMath"?`<div dir="ltr" class="math-block" style="unicode-bidi:isolate;text-align:center;margin:1em 0">${br(t.attrs?.latex??"",!0,!0)}</div>`:t.type==="variable"?`<span class="variable">{${Ze(t.attrs?.name??"")}}</span>`:""}).join("")}function zr(e){return e==null||e===""?null:Me(e)??null}function Ze(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}import{jsx as Ea}from"react/jsx-runtime";import{createContext as Pa,useContext as zn}from"react";var or={submitButton:"Submit",showHint:"Show hint",clickToRemove:"Click to remove",blankAnswerAria:"Your answer",aiEvaluationInProgress:"AI evaluation in progress\u2026",aiEvaluationInProgressAria:"AI evaluation in progress",shortAnswerPlaceholder:"Short answer\u2026",longAnswerPlaceholder:"Write your answer here\u2026",minWordsLabel:e=>`Min: ${e}`,wordBank:"Word Bank",chooseN:e=>`(choose ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Open ${e}`,annexClose:"Close",referenceInPanel:e=>`This exercise's text is in ${e}.`,readReference:"Read it",referenceForExercise:e=>`Exercise ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),openResponseTextPlaceholder:"Write your answer here\u2026",openResponseWords:"words",openResponseChars:"chars",openResponseDropZoneLabel:"Drag & drop files here, or",openResponseDropZoneBrowse:"browse",openResponseUploading:"Uploading\u2026",openResponseNoSubmission:"No submission",openResponseFile:"File",openResponseAttachFile:"Attach a file",openResponseAttachFiles:"Attach files",openResponseAttachedFiles:"Attached files",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Video",openResponseTypeVideoLink:"Video link",openResponseVideoLinkPlaceholder:"Paste YouTube or Vimeo URL\u2026",openResponseAddVideoLink:"Add",openResponseTapToRecord:"Tap to start recording",openResponseTapToRecordScreen:"Click to start screen recording",openResponseRequestingPermission:"Requesting permission\u2026",openResponsePermissionDenied:"Microphone/camera access denied. Please allow access in your browser settings.",openResponseMediaHandlerRequired:"A media handler is required to save recordings.",openResponseStopRecording:"Stop",openResponseReRecord:"Re-record",openResponseConfirmRecording:"Use this recording",openResponseRecordingSubmitted:"Recording submitted",openResponseAwaitingReview:"Submitted, awaiting teacher review",openResponseTeacherFeedbackLabel:"Teacher feedback",openResponseGradeThisResponse:"Grade this response",openResponseGradeScoreLabel:e=>`Score (max ${e})`,openResponseGradeFeedbackLabel:"Feedback (optional)",openResponseGradeFeedbackPlaceholder:"Add feedback for the student\u2026",openResponseSubmitGrade:"Submit Grade",openResponseGradeSubmitted:(e,r)=>`Grade submitted: ${e} / ${r}`,openResponseRubricTitle:"Rubric",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} pts`,openResponseAiSuggestionTitle:"AI Pre-grading Suggestion",openResponseAiSuggestedScore:(e,r)=>`Suggested score: ${e} / ${r}`,openResponseAiEvidence:"Evidence:",openResponseAiApplySuggestion:"Apply suggestion",openResponseStudentAnswerTitle:"Student answer"};var Gr={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",blankAnswerAria:"Votre r\xE9ponse",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",minWordsLabel:e=>`Min. : ${e}`,wordBank:"Banque de mots",chooseN:e=>`(choisir ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Ouvrir ${e}`,annexClose:"Fermer",referenceInPanel:e=>`Le texte de cet exercice est dans \xAB ${e} \xBB.`,readReference:"Le lire",referenceForExercise:e=>`Exercice ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),openResponseTextPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glissez-d\xE9posez des fichiers ici, ou",openResponseDropZoneBrowse:"parcourir",openResponseUploading:"Envoi en cours\u2026",openResponseNoSubmission:"Aucun fichier d\xE9pos\xE9",openResponseFile:"Fichier",openResponseAttachFile:"Joindre un fichier",openResponseAttachFiles:"Joindre des fichiers",openResponseAttachedFiles:"Fichiers joints",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Vid\xE9o",openResponseTypeVideoLink:"Lien vid\xE9o",openResponseVideoLinkPlaceholder:"Coller un lien YouTube ou Vimeo\u2026",openResponseAddVideoLink:"Ajouter",openResponseTapToRecord:"Appuyer pour d\xE9marrer l'enregistrement",openResponseTapToRecordScreen:"Cliquer pour d\xE9marrer l'enregistrement d'\xE9cran",openResponseRequestingPermission:"Demande d'autorisation\u2026",openResponsePermissionDenied:"Acc\xE8s au micro/cam\xE9ra refus\xE9. Autorise l'acc\xE8s dans les param\xE8tres du navigateur.",openResponseMediaHandlerRequired:"Un gestionnaire de m\xE9dias est requis pour sauvegarder les enregistrements.",openResponseStopRecording:"Arr\xEAter",openResponseReRecord:"R\xE9enregistrer",openResponseConfirmRecording:"Utiliser cet enregistrement",openResponseRecordingSubmitted:"Enregistrement soumis",openResponseAwaitingReview:"Soumis, en attente de correction par l'enseignant",openResponseTeacherFeedbackLabel:"Commentaire de l'enseignant",openResponseGradeThisResponse:"Corriger cette r\xE9ponse",openResponseGradeScoreLabel:e=>`Note (max ${e})`,openResponseGradeFeedbackLabel:"Commentaire (facultatif)",openResponseGradeFeedbackPlaceholder:"Ajouter un commentaire pour l'\xE9l\xE8ve\u2026",openResponseSubmitGrade:"Valider la note",openResponseGradeSubmitted:(e,r)=>`Note envoy\xE9e : ${e} / ${r}`,openResponseRubricTitle:"Grille d'\xE9valuation",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} pts`,openResponseAiSuggestionTitle:"Suggestion de correction par IA",openResponseAiSuggestedScore:(e,r)=>`Score sugg\xE9r\xE9 : ${e} / ${r}`,openResponseAiEvidence:"Extrait :",openResponseAiApplySuggestion:"Appliquer la suggestion",openResponseStudentAnswerTitle:"R\xE9ponse de l'\xE9l\xE8ve"};var Yr={submitButton:"\u0625\u0631\u0633\u0627\u0644",showHint:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062A\u0644\u0645\u064A\u062D",clickToRemove:"\u0627\u0646\u0642\u0631 \u0644\u0644\u0625\u0632\u0627\u0644\u0629",blankAnswerAria:"\u0625\u062C\u0627\u0628\u062A\u0643",aiEvaluationInProgress:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u2026",aiEvaluationInProgressAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",shortAnswerPlaceholder:"\u0625\u062C\u0627\u0628\u0629 \u0642\u0635\u064A\u0631\u0629\u2026",longAnswerPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",minWordsLabel:e=>`\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649: ${e}`,wordBank:"\u0628\u0646\u0643 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",chooseN:e=>`(\u0627\u062E\u062A\u0631 ${e})`,annexDefaultLabel:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexOpen:e=>`\u0641\u062A\u062D ${e}`,annexClose:"\u0625\u063A\u0644\u0627\u0642",referenceInPanel:e=>`\u0646\u0635 \u0647\u0630\u0627 \u0627\u0644\u062A\u0645\u0631\u064A\u0646 \u0641\u064A \xAB${e}\xBB.`,readReference:"\u0627\u0642\u0631\u0623\u0647",referenceForExercise:e=>`\u0627\u0644\u062A\u0645\u0631\u064A\u0646 ${e}`,choiceLetters:["\u0623","\u0628","\u062C","\u062F","\u0647\u0640","\u0648","\u0632","\u062D","\u0637","\u064A","\u0643","\u0644","\u0645","\u0646","\u0633","\u0639","\u0641","\u0635","\u0642","\u0631","\u0634","\u062A","\u062B","\u062E","\u0630","\u0636","\u0638","\u063A"],openResponseTextPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",openResponseWords:"\u0643\u0644\u0645\u0629",openResponseChars:"\u062D\u0631\u0641",openResponseDropZoneLabel:"\u0627\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0648\u0623\u0641\u0644\u062A\u0647\u0627 \u0647\u0646\u0627\u060C \u0623\u0648",openResponseDropZoneBrowse:"\u062A\u0635\u0641\u0651\u062D",openResponseUploading:"\u062C\u0627\u0631\u064D \u0627\u0644\u0631\u0641\u0639\u2026",openResponseNoSubmission:"\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0633\u0644\u064A\u0645",openResponseFile:"\u0645\u0644\u0641",openResponseAttachFile:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641",openResponseAttachFiles:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",openResponseAttachedFiles:"\u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0627\u0644\u0645\u0631\u0641\u0642\u0629",openResponseTypeImage:"\u0635\u0648\u0631\u0629",openResponseTypePdf:"PDF",openResponseTypeAudio:"\u0635\u0648\u062A",openResponseTypeVideo:"\u0641\u064A\u062F\u064A\u0648",openResponseTypeVideoLink:"\u0631\u0627\u0628\u0637 \u0641\u064A\u062F\u064A\u0648",openResponseVideoLinkPlaceholder:"\u0627\u0644\u0635\u0642 \u0631\u0627\u0628\u0637 \u064A\u0648\u062A\u064A\u0648\u0628 \u0623\u0648 Vimeo\u2026",openResponseAddVideoLink:"\u0625\u0636\u0627\u0641\u0629",openResponseTapToRecord:"\u0627\u0646\u0642\u0631 \u0644\u0628\u062F\u0621 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseTapToRecordScreen:"\u0627\u0646\u0642\u0631 \u0644\u0628\u062F\u0621 \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0634\u0627\u0634\u0629",openResponseRequestingPermission:"\u062C\u0627\u0631\u064D \u0637\u0644\u0628 \u0627\u0644\u0625\u0630\u0646\u2026",openResponsePermissionDenied:"\u062A\u0645 \u0631\u0641\u0636 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646/\u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627. \u064A\u064F\u0631\u062C\u0649 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0627\u0644\u0648\u0635\u0648\u0644 \u0645\u0646 \u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062A\u0635\u0641\u062D.",openResponseMediaHandlerRequired:"\u064A\u0644\u0632\u0645 \u0645\u0639\u0627\u0644\u062C \u0648\u0633\u0627\u0626\u0637 \u0644\u062D\u0641\u0638 \u0627\u0644\u062A\u0633\u062C\u064A\u0644\u0627\u062A.",openResponseStopRecording:"\u0625\u064A\u0642\u0627\u0641",openResponseReRecord:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseConfirmRecording:"\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0647\u0630\u0627 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseRecordingSubmitted:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseAwaitingReview:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u060C \u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0645\u0631\u0627\u062C\u0639\u0629 \u0627\u0644\u0645\u0639\u0644\u0645",openResponseTeacherFeedbackLabel:"\u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0627\u0644\u0645\u0639\u0644\u0645",openResponseGradeThisResponse:"\u062A\u0635\u062D\u064A\u062D \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",openResponseGradeScoreLabel:e=>`\u0627\u0644\u062F\u0631\u062C\u0629 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 ${e})`,openResponseGradeFeedbackLabel:"\u0645\u0644\u0627\u062D\u0638\u0627\u062A (\u0627\u062E\u062A\u064A\u0627\u0631\u064A)",openResponseGradeFeedbackPlaceholder:"\u0623\u0636\u0641 \u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0644\u0644\u0637\u0627\u0644\u0628\u2026",openResponseSubmitGrade:"\u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629",openResponseGradeSubmitted:(e,r)=>`\u062A\u0645 \u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629: ${e} / ${r}`,openResponseRubricTitle:"\u0633\u0644\u0651\u0645 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} \u0646\u0642\u0637\u0629`,openResponseAiSuggestionTitle:"\u0627\u0642\u062A\u0631\u0627\u062D \u0627\u0644\u062A\u0635\u062D\u064A\u062D \u0627\u0644\u0645\u0633\u0628\u0642 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",openResponseAiSuggestedScore:(e,r)=>`\u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0645\u0642\u062A\u0631\u062D\u0629: ${e} / ${r}`,openResponseAiEvidence:"\u0627\u0644\u0623\u062F\u0644\u0629:",openResponseAiApplySuggestion:"\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0627\u0642\u062A\u0631\u0627\u062D",openResponseStudentAnswerTitle:"\u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0627\u0644\u0628"};var Ma={en:or,fr:Gr,ar:Yr},Nt=Pa(null);function te(){return zn(Nt)??or}function xr(e){let r=zn(Nt);return e&&Ma[e]||r||or}function yr({locale:e,children:r}){let t=xr(e);return Ea(Nt.Provider,{value:t,children:r})}import{jsx as Ia}from"react/jsx-runtime";import{createContext as La,useContext as Dn,useMemo as Fn}from"react";var Ta={sm:.875,md:1,lg:1.25,xl:1.5},At=La(null);function $a(e,r){let t={...e??{}};if(r)for(let[n,o]of Object.entries(r))o!==void 0&&(t[n]=o);return t}function za(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?Ta[e]??1:1}function _e(e){let r=e??{};return{scale:za(r.size),sizeSet:r.size!==void 0,choiceLabels:r.choiceLabels??"marks",choiceColumns:r.choiceColumns,layoutBy:r.layoutBy??"window",motion:r.motion??"full",shuffleSeed:r.shuffleSeed}}function ke(e){let r=Dn(At);return Fn(()=>$a(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Ie(){let e=Dn(At);return Fn(()=>_e(e),[e])}function Re({display:e,children:r}){let t=ke(e);return Ia(At.Provider,{value:t,children:r})}function Ne(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function er(){let{motion:e}=Ie();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function Da(e){let r=2166136261;for(let t=0;t<e.length;t++)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0}function Fa(e){return()=>{e=e+1831565813|0;let r=Math.imul(e^e>>>15,1|e);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function vr(e,r){let t=[...e],n=Fa(Da(r));for(let o=t.length-1;o>0;o--){let a=Math.floor(n()*(o+1));[t[o],t[a]]=[t[a],t[o]]}return t}function Ct({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return V(On,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=V("strong",{children:r}):t.type==="italic"?r=V("em",{children:r}):t.type==="underline"?r=V("u",{children:r}):t.type==="strike"?r=V("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=V("span",{style:{color:t.attrs.color},children:r}));return V(On,{children:r})}return e.type==="paragraph"?V("span",{className:"block",children:e.content?.map((r,t)=>V(Ct,{node:r},t))??V("br",{})}):e.type==="hardBreak"?V("br",{}):e.content?V("span",{className:"block",children:e.content.map((r,t)=>V(Ct,{node:r},t))}):null}function qa({nodes:e}){return V("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>V(Ct,{node:r},t))})}function jn({hint:e}){let r=te(),[t,n]=Xr(!1),[o,a]=Xr(!1),s=Ba(null);return Kr(()=>{if(!o)return;let l=m=>{s.current&&!s.current.contains(m.target)&&(a(!1),n(!1))};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),Ve("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{o||n(!1)},children:[V("button",{type:"button",onClick:l=>{l.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},className:$e("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&V("span",{className:"player-blank-hint-pop",onClick:l=>l.stopPropagation(),children:V(qa,{nodes:e})})]})}function Wa(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var Ua=e=>e.replace(/ {2,}/g,r=>" ".repeat(r.length-1)+" "),Ha=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function Wn(e){return(e??[]).some(r=>Ha.has(r?.type)||Wn(r?.content))}var Bn=()=>V("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:V("path",{d:"M5 13l4 4L19 7"})}),qn=()=>V("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:V("path",{d:"M6 6l12 12M18 6L6 18"})});function Fr({node:e,validationFeedback:r}){let t=de(),n=te(),o=Ie(),a=er(),{id:s,content:i,attrs:c}=e,d=c.shuffle??!1,l="prompt"in c?c.prompt:void 0,m="separator"in c?c.separator??"/":"/",y="pickLimit"in c&&c.pickLimit?c.pickLimit:1,b="layout"in c?c.layout??"row":"row",S=e.type==="inlineChoiceSet",f=JSON.stringify(i),g=d&&o.shuffleSeed!==void 0,w=ja(()=>g?vr(i,`${o.shuffleSeed}:${s}`):null,[g,o.shuffleSeed,s,f]),[h,_]=Xr(i);Kr(()=>{g||_(d?Wa(i):i)},[d,g,f]);let u=w??h,[x,N]=Xr(new Set),C=r?.showFeedback??!1,$=r?.correctChoiceIds||[];Kr(()=>{let U=X=>{let P=X.answers.find(D=>D.nodeId===s&&D.type==="choiceSet");P&&"selectedIds"in P.answer&&N(new Set(P.answer.selectedIds))};return t.on("answers:prefill",U),()=>t.off("answers:prefill",U)},[s,t]),Kr(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(x)}}})},[x,s,t]);let k=U=>{C||N(X=>{let R=new Set(X);return y===1?R.has(U)?R.delete(U):(R.clear(),R.add(U)):R.has(U)?R.delete(U):R.size<y&&R.add(U),R})},p=U=>Ua(oe(U.content)),T=U=>{let X=x.has(U),R=$.includes(U);return C?R&&X?"correct":R&&!X?"correct-unchosen":!R&&X?"incorrect":"muted":X?"selected":"idle"},E={idle:"",selected:"player-choice--selected",correct:$e("player-choice--correct",a.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:$e("player-choice--incorrect",a.shake),muted:"player-choice--muted"},W={idle:"",selected:"player-inline-choice--selected",correct:$e("player-inline-choice--correct",a.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:$e("player-inline-choice--incorrect",a.shake),muted:"player-inline-choice--muted"};if(S)return Ve("span",{className:"inline-choice",children:[l&&Ve("span",{className:"mr-2 font-medium",children:[l,y>1?V("span",{className:"ml-1 opacity-60",children:n.chooseN(y)}):null]}),u.map((U,X)=>Ve(Oa,{children:[V("button",{type:"button",disabled:C,onClick:()=>k(U.id),className:$e("player-inline-choice",W[T(U.id)]),"aria-pressed":x.has(U.id),dangerouslySetInnerHTML:{__html:p(U)}}),X<u.length-1&&V("span",{className:"mx-1",children:m})]},U.id)),c.hint&&c.hint.length>0&&V(jn,{hint:c.hint})]});let v=o.layoutBy==="box",M=o.choiceColumns?Math.min(o.choiceColumns,u.length):0,F=M?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${M}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},z=u.some(U=>Wn(U.content)),j=o.choiceLabels==="letters",H=U=>n.choiceLetters[U]??String(U+1);return Ve("div",{className:$e("cs-player my-4 space-y-3",v&&"cs-player--box"),children:[l&&Ve("p",{className:"font-medium",children:[l,y>1?Ve("span",{className:"ml-2 text-sm opacity-70",children:["(choose ",y,")"]}):null]}),c.hint&&c.hint.length>0&&V(jn,{hint:c.hint}),V("div",{className:$e("cs-player__grid",b==="row"&&"cs-player__grid--row"),style:F,children:u.map((U,X)=>{let R=T(U.id),P=R==="incorrect"?"incorrect":R==="correct"||R==="correct-unchosen"?"correct":null;return Ve("button",{type:"button",disabled:C,onClick:()=>k(U.id),className:$e("player-choice",z&&"player-choice--tile",E[R]),"aria-pressed":x.has(U.id),children:[V("span",{className:$e("player-choice__mark",y>1?"player-choice__mark--box":"player-choice__mark--radio",j&&"player-choice__mark--letter"),children:j?H(X):R==="incorrect"?V(qn,{}):V(Bn,{})}),V("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:p(U)}}),j&&P&&V("span",{className:`player-choice__verdict player-choice__verdict--${P}`,"aria-hidden":"true",children:P==="incorrect"?V(qn,{}):V(Bn,{})})]},U.id)})})]})}import{Fragment as Et,jsx as J,jsxs as Jr}from"react/jsx-runtime";import{useState as Pt,useEffect as Zr,useRef as Un,useCallback as Va}from"react";import Qe from"clsx";function Mt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return J(Et,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=J("strong",{children:r}):t.type==="italic"?r=J("em",{children:r}):t.type==="underline"?r=J("u",{children:r}):t.type==="strike"?r=J("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=J("span",{style:{color:t.attrs.color},children:r}));return J(Et,{children:r})}return e.type==="paragraph"?J("span",{className:"block",children:e.content?.map((r,t)=>J(Mt,{node:r},t))??J("br",{})}):e.type==="hardBreak"?J("br",{}):e.content?J("span",{className:"block",children:e.content.map((r,t)=>J(Mt,{node:r},t))}):null}function Qa({nodes:e}){return J("span",{className:"block space-y-1",children:e.map((r,t)=>J(Mt,{node:r},t))})}function Ga({hint:e}){let r=te(),[t,n]=Pt(!1),[o,a]=Pt(!1),s=Un(null);return Zr(()=>{if(!o)return;let l=m=>{s.current&&!s.current.contains(m.target)&&(a(!1),n(!1))};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),Jr("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{o||n(!1)},children:[J("button",{type:"button",onClick:l=>{l.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},className:Qe("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&J("span",{className:"player-blank-hint-pop",onClick:l=>l.stopPropagation(),children:J(Qa,{nodes:e})})]})}function Or({node:e,validationFeedback:r}){let t=de(),n=te(),o=er(),{id:a,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:d}=s,l=Un(null),m=i.trim().split(/\s+/).filter(Boolean).length,y=c==="auto"&&m>=4,[b,S]=Pt(""),f=r?.showFeedback??!1,g=r?.state,w=g==="validating",h=r?.displayAnswer,_=r?.message;Zr(()=>{let C=$=>{let p=$.answers.find(T=>T.nodeId===a&&T.type==="blank");p&&"mode"in p.answer&&p.answer.mode==="typed"&&"text"in p.answer&&S(p.answer.text)};return t.on("answers:prefill",C),()=>t.off("answers:prefill",C)},[a,t]),Zr(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:b}}})},[b,a,t]);let u=C=>{S(C.target.value)},x=Va(()=>{let C=l.current;C&&(C.style.height="auto",C.style.height=`${C.scrollHeight}px`)},[]);Zr(()=>{x()},[b,x]);let N=f&&!w;return Jr("span",{className:Qe("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",y&&"w-full"),children:[J("span",{className:Qe("relative inline-block shrink-0 min-w-0 max-w-full",y&&"w-full flex-1"),children:N?J("span",{className:Qe("player-typed-blank-feedback",y&&"w-full",g==="correct"&&Qe("player-typed-blank-feedback--correct",o.hop),g==="partial"&&"player-typed-blank-feedback--partial",g==="incorrect"&&Qe("player-typed-blank-feedback--incorrect",o.wobble)),children:b||J("span",{className:"opacity-40",children:i})}):Jr(Et,{children:[J("textarea",{ref:l,"aria-label":n.blankAnswerAria,placeholder:i,value:b,onChange:u,disabled:f,rows:1,className:Qe("player-typed-blank",y&&"w-full",w&&"player-typed-blank--pending"),style:c!=="auto"?{width:c}:y?{width:"100%"}:{width:`${Math.max(7,b.length+1)}ch`,maxWidth:"100%"}}),!b&&!w&&J("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 pointer-events-none text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:"\u270E"}),w&&J("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:J("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),f&&g==="incorrect"&&h&&Jr("span",{className:"player-blank-reveal",children:["(",h,")"]}),f&&_&&J("span",{className:Qe("player-blank-feedback",g==="correct"&&"player-blank-feedback--correct",g==="partial"&&"player-blank-feedback--partial",g==="incorrect"&&"player-blank-feedback--incorrect"),children:_}),d&&d.length>0&&J(Ga,{hint:d})]})}import{jsx as rt,Fragment as Xn,jsxs as $t}from"react/jsx-runtime";import{useEffect as Jn}from"react";import tt from"clsx";import{useDroppable as is,useDndContext as cs}from"@dnd-kit/core";import{jsx as Ya}from"react/jsx-runtime";import{createContext as Ka,useCallback as Ge,useContext as Xa,useEffect as Ja,useMemo as Hn,useRef as Za,useState as It}from"react";import{useDndMonitor as es}from"@dnd-kit/core";var Qn=Ka(null);function ze(){let e=Xa(Qn);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function Vn(e){let r={};for(let t of e??[])t.type==="blank"&&"mode"in t.answer&&t.answer.mode==="choice"&&"choiceId"in t.answer&&t.answer.choiceId&&(r[t.nodeId]={choiceId:t.answer.choiceId,poolId:t.answer.poolId||"",value:t.answer.value||""});return r}function et({children:e,initialAnswers:r}){let t=de(),n=Hn(()=>Vn(r),[r]),[o,a]=It(n),[s,i]=It({}),[c,d]=It({}),l=Za(new Set);Ja(()=>{let u=x=>{let N=Vn(x.answers);Object.keys(N).length!==0&&a(C=>{if(!Object.entries(N).some(([p,T])=>C[p]?.choiceId!==T.choiceId||C[p]?.poolId!==T.poolId||C[p]?.value!==T.value))return C;let k={...C,...N};return i(p=>{let T={...p};for(let[E,W]of Object.entries(p)){let v=new Set(Object.values(k).filter(M=>M.poolId===E).map(M=>M.choiceId));T[E]={...W,available:new Set(W.choices.map(M=>M.id).filter(M=>!v.has(M)))}}return T}),k})};return t.on("answers:prefill",u),()=>t.off("answers:prefill",u)},[t]);let m=Ge((u,x)=>{i(N=>{let C=N[u];if(!C){let E=new Set;for(let v of Object.values(o))v.poolId===u&&E.add(v.choiceId);let W=new Set(x.map(v=>v.id).filter(v=>!E.has(v)));return{...N,[u]:{choices:x,available:W}}}let $=new Set(C.choices.map(E=>E.id)),k=new Set(x.map(E=>E.id));if(!(x.some(E=>!$.has(E.id))||C.choices.some(E=>!k.has(E.id))))return N;let T=new Set;for(let E of C.available)k.has(E)&&T.add(E);for(let E of x)$.has(E.id)||T.add(E.id);return{...N,[u]:{choices:x,available:T}}})},[o]),y=Ge((u,x)=>{d(N=>{let C=N[u]??[];return C.includes(x)?N:{...N,[u]:[...C,x]}}),!l.current.has(x)&&!o[x]&&(l.current.add(x),t.emit({type:"answer:changed",answer:{nodeId:x,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}}))},[o,t]),b=Ge(u=>(c[u]??[]).find(N=>!o[N])??null,[c,o]),S=Ge((u,x,N,C)=>{a($=>{let k=$[u];return k&&i(p=>{let T=p[k.poolId];if(!T)return p;let E=new Set(T.available);return E.add(k.choiceId),{...p,[k.poolId]:{...T,available:E}}}),{...$,[u]:{choiceId:N,value:C,poolId:x}}}),i($=>{let k=$[x];if(!k)return $;let p=new Set(k.available);return p.delete(N),{...$,[x]:{...k,available:p}}}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:N,poolId:x,value:C}}})},[t]),f=Ge(u=>{let x=o[u];if(!x)return;let{poolId:N,choiceId:C}=x;i($=>{let k=$[N];if(!k)return $;let p=new Set(k.available);return p.add(C),{...$,[N]:{...k,available:p}}}),a($=>{let{[u]:k,...p}=$;return p}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:N,value:""}}})},[o,t]),g=Ge((u,x)=>s[u]?.available.has(x)??!1,[s]),w=Ge((u,x)=>s[u]?.choices.find(N=>N.id===x),[s]),h=Ge(()=>{a({}),i(u=>{let x={};for(let[N,C]of Object.entries(u))x[N]={choices:C.choices,available:new Set(C.choices.map($=>$.id))};return x});for(let[u,x]of Object.entries(c))for(let N of x)t.emit({type:"answer:changed",answer:{nodeId:N,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}})},[c,t]);es({onDragEnd(u){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:u.active,over:u.over}}))}});let _=Hn(()=>({blanks:o,pools:s,registerPool:m,registerBlank:y,fill:S,back:f,isAvailable:g,getChoice:w,firstEmptyBlank:b,resetAllAnswers:h}),[o,s,m,y,S,f,g,w,b,h]);return Ya(Qn.Provider,{value:_,children:e})}import{Fragment as Gn,jsx as ce,jsxs as rs}from"react/jsx-runtime";import{useState as Lt,useEffect as Kn,useRef as Yn,useLayoutEffect as ts}from"react";import ns from"clsx";var os=typeof window<"u"?ts:Kn;function Tt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return ce(Gn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=ce("strong",{children:r}):t.type==="italic"?r=ce("em",{children:r}):t.type==="underline"?r=ce("u",{children:r}):t.type==="strike"?r=ce("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=ce("span",{style:{color:t.attrs.color},children:r}));return ce(Gn,{children:r})}return e.type==="paragraph"?ce("span",{className:"block",children:e.content?.map((r,t)=>ce(Tt,{node:r},t))??ce("br",{})}):e.type==="hardBreak"?ce("br",{}):e.content?ce("span",{className:"block",children:e.content.map((r,t)=>ce(Tt,{node:r},t))}):null}function as({nodes:e}){return ce("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>ce(Tt,{node:r},t))})}function ss({hint:e}){let r=te(),[t,n]=Lt(!1),[o,a]=Lt(!1),[s,i]=Lt(null),c=Yn(null),d=Yn(null);return Kn(()=>{if(!o)return;let b=S=>{let f=S.target;c.current&&!c.current.contains(f)&&d.current&&!d.current.contains(f)&&(a(!1),n(!1))};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),os(()=>{if(!t){i(null);return}let b=c.current,S=d.current;if(!b||!S)return;let f=b.getBoundingClientRect(),g=S.getBoundingClientRect(),w=8,h=f.top-g.height-w;h<w&&(h=f.bottom+w);let _=f.left+f.width/2-g.width/2;_=Math.max(w,Math.min(_,window.innerWidth-g.width-w)),i({top:h,left:_})},[t]),rs("span",{ref:c,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{o||n(!1)},children:[ce("button",{type:"button",onClick:b=>{b.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},className:ns("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&ce("span",{ref:d,className:"player-blank-hint-pop",onClick:b=>b.stopPropagation(),style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:ce(as,{nodes:e})})]})}function De({hint:e}){return!e||e.length===0?null:ce(ss,{hint:e})}function jr({node:e,validationFeedback:r}){let{id:t,attrs:n}=e,{poolId:o,placeholder:a="___",hint:s}=n,{blanks:i,fill:c,back:d,getChoice:l,registerBlank:m}=ze(),y=te(),b=er(),S=i[t],f=!!S?.choiceId,g=r?.showFeedback??!1,w=r?.state,h=r?.correctChoiceIds??[],_=g&&w==="incorrect"&&h.length>0?l(o||"",h[0]):void 0,u=_?_.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:x,isOver:N}=is({id:t,data:{type:"blank",blankId:t,poolId:o}}),{active:C}=cs(),$=!!C&&C.data.current?.poolId===o;return Jn(()=>{m(o||"",t)},[o,t,m]),Jn(()=>{let T=E=>{let W=E,{active:v,over:M}=W.detail||{};if(!M||M.id!==t)return;let{choiceId:F,poolId:z}=v?.data.current||{};if(!F||z!==o)return;let j=l(o||"",F);if(!j)return;let H=j.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,o||"",F,H)};return window.addEventListener("dnd-drop",T),()=>window.removeEventListener("dnd-drop",T)},[t,o,l,c]),$t(Xn,{children:[rt("span",{ref:x,onClick:()=>{f&&!g&&d(t)},className:tt("player-choice-blank",N&&"player-choice-blank--over",!N&&$&&!f&&!g&&"player-choice-blank--target",f&&!g&&!N&&"player-choice-blank--filled",g&&w==="correct"&&tt("player-choice-blank--correct",b.hop),g&&w==="partial"&&tt("player-choice-blank--partial",b.hop),g&&w==="incorrect"&&tt("player-choice-blank--incorrect",b.wobble)),title:f&&!g?y.clickToRemove:void 0,"data-node-id":t,"data-pool-id":o,children:f?$t(Xn,{children:[rt("span",{children:S.value}),!g&&rt("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):a}),u&&$t("span",{className:"player-blank-reveal",children:["(",u,")"]}),rt(De,{hint:s})]})}import{jsx as zt,jsxs as ps}from"react/jsx-runtime";import{useEffect as eo,useState as ms}from"react";import us from"clsx";import{jsx as Zn}from"react/jsx-runtime";import ls from"clsx";import{useDraggable as ds}from"@dnd-kit/core";function ar({poolId:e,data:r,isInline:t=!1}){let{isAvailable:n,firstEmptyBlank:o,fill:a}=ze(),{id:s,html:i}=r,c=!n(e,s),{setNodeRef:d,attributes:l,listeners:m,transform:y,isDragging:b}=ds({id:s,data:{type:"choice",choiceId:s,poolId:e,html:i},disabled:c});if(c)return null;let S=h=>h.replace(/<\/?[^>]+(>|$)/g,""),f=()=>{let h=o(e);if(h){let _=S(i);a(h,e,s,_)}},g=y?{transform:`translate3d(${y.x}px, ${y.y}px, 0)`}:void 0;return Zn(t?"span":"div",{ref:d,style:g,className:ls("player-bank-pill",b&&"player-bank-pill--dragging",t&&"mx-1"),...l,...m,onClick:f,children:Zn("span",{dangerouslySetInnerHTML:{__html:i},className:"pointer-events-none whitespace-pre-wrap break-words"})})}function Br({node:e}){let r=te(),{id:t,attrs:n,content:o}=e,{shuffle:a=!0,equalWidth:s=!1}=n,{registerPool:i}=ze(),[c,d]=ms(()=>o.map(l=>({id:l.id,html:oe(l.content)})));return eo(()=>{let l=o.map(m=>({id:m.id,html:oe(m.content)}));d(a?[...l].map(m=>({v:m,r:Math.random()})).sort((m,y)=>m.r-y.r).map(m=>m.v):l)},[a,JSON.stringify(o)]),eo(()=>{i(t,c)},[t,c,i]),ps("div",{className:"player-word-bank",children:[zt("div",{className:"player-word-bank__label",children:r.wordBank}),zt("div",{className:us("player-word-bank__items",s&&"player-word-bank__items--grid"),children:c.map(l=>zt(ar,{poolId:t,data:l},l.id))})]})}import{jsx as Dt,jsxs as fs}from"react/jsx-runtime";import{useEffect as ro,useState as hs}from"react";function qr({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:o=!0,separator:a=" "}=t,{registerPool:s}=ze(),[i,c]=hs(()=>n.map(d=>({id:d.id,html:oe(d.content,{stripParagraphs:!0})})));return ro(()=>{let d=n.map(l=>({id:l.id,html:oe(l.content,{stripParagraphs:!0})}));c(o?[...d].map(l=>({v:l,r:Math.random()})).sort((l,m)=>l.r-m.r).map(l=>l.v):d)},[o,JSON.stringify(n)]),ro(()=>{s(r,i)},[r,i,s]),Dt("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:L("0.25rem"),alignItems:"center"},children:i.map((d,l)=>fs("span",{children:[Dt(ar,{poolId:r,data:d,isInline:!0}),l<i.length-1&&Dt("span",{children:a})]},d.id))})}import{jsx as sr,jsxs as jt}from"react/jsx-runtime";import{useState as Bt,useEffect as qt,useMemo as ys}from"react";import{Check as vs,X as ws}from"lucide-react";import{jsx as me,jsxs as rr}from"react/jsx-runtime";import{useState as Ft,useMemo as Ot,useRef as nt,useCallback as gs,useLayoutEffect as bs}from"react";var to="#1d2025",no="#8d93a0",oo="#1f8a4c",ao="#d23b2b",xs=11;function so({leftItems:e,rightItems:r,connections:t,direction:n,disabled:o,feedback:a,onConnectionsChange:s}){let[i,c]=Ft(null),[d,l]=Ft(null),[m,y]=Ft(new Map),b=nt(null),S=nt(new Map),f=nt("mouse"),g=a?.showFeedback??!1,w=Ot(()=>{let R=new Map;if(a?.pairFeedback)for(let P of a.pairFeedback)R.set(`${P.leftId}-${P.rightId}`,P.correct);return R},[a]),h=Ot(()=>{let R=new Map;return a?.correctPairings?.forEach(P=>R.set(P.leftId,P.rightId)),R},[a]),_=Ot(()=>{let R=new Map;return a?.correctPairings?.forEach(P=>R.set(P.rightId,P.leftId)),R},[a]),u=new Map,x=new Map;t.forEach((R,P)=>{u.set(R.leftId,P),x.set(R.rightId,P)});let N=R=>{let P=t[R];if(!g||!P)return null;let D=w.get(`${P.leftId}-${P.rightId}`);return D===!0?"correct":D===!1?"incorrect":null},C=gs(()=>{if(!b.current)return;let R=b.current.getBoundingClientRect(),P=new Map;S.current.forEach((D,G)=>{if(D){let Y=D.getBoundingClientRect();P.set(G,new DOMRect(Y.left-R.left,Y.top-R.top,Y.width,Y.height))}}),y(P)},[]);bs(()=>{C();let R=new ResizeObserver(C);return b.current&&R.observe(b.current),()=>R.disconnect()},[C,t,e,r]);let $=8,k=(R,P)=>{let D=m.get(R);if(!D)return null;let G=D.y+D.height/2;return P==="left"?{x:D.x+D.width,y:G}:{x:D.x-$,y:G}},p=(R,P)=>{if(o)return;let G=(P==="left"?u:x).has(R),Y=i?.id===R&&i?.side===P,be=i!==null&&i.side!==P;if(Y){c(null);return}if(be){let ne=P==="right"?i.id:R,ee=P==="left"?i.id:R,se=t.filter(ie=>ie.leftId!==ne&&ie.rightId!==ee);se.push({leftId:ne,rightId:ee}),s(se),c(null);return}if(G&&!i){let ne=P==="left"?t.filter(ee=>ee.leftId!==R):t.filter(ee=>ee.rightId!==R);s(ne);return}c({id:R,side:P})},T=nt(null),E=(R,P,D)=>{if(o||(f.current=D.pointerType,D.pointerType==="touch"))return;D.currentTarget.setPointerCapture(D.pointerId);let G=b.current.getBoundingClientRect();T.current={x:D.clientX-G.left,y:D.clientY-G.top},l({fromId:R,fromSide:P,x:D.clientX-G.left,y:D.clientY-G.top,overId:null,overSide:null})},W=R=>{if(!d)return;let P=b.current.getBoundingClientRect(),D=R.clientX-P.left,G=R.clientY-P.top,Y=d.fromSide==="left"?"right":"left",be=Y==="left"?e:r,ne=null,ee=null;for(let se of be){let ie=m.get(se.id);if(ie&&D>=ie.x&&D<=ie.x+ie.width&&G>=ie.y&&G<=ie.y+ie.height){ne=se.id,ee=Y;break}}l(se=>se?{...se,x:D,y:G,overId:ne,overSide:ee}:null)},v=R=>{if(!d)return;let P=b.current.getBoundingClientRect(),D=R.clientX-P.left,G=R.clientY-P.top,Y=T.current;if((Y?Math.hypot(D-Y.x,G-Y.y):999)<8){l(null),p(d.fromId,d.fromSide);return}if(d.overId&&d.overSide){let ne=d.fromSide==="left"?d.fromId:d.overId,ee=d.fromSide==="right"?d.fromId:d.overId,se=t.filter(ie=>ie.leftId!==ne&&ie.rightId!==ee);se.push({leftId:ne,rightId:ee}),s(se)}l(null),c(null)},M=(R,P)=>{if(!g)return null;let G=(P==="left"?u:x).get(R.id);if(G!==void 0){let Y=t[G];if(w.get(`${Y.leftId}-${Y.rightId}`)===!0)return null}if(P==="left"){let Y=h.get(R.id);return r.find(be=>be.id===Y)?.content??null}else{let Y=_.get(R.id);return e.find(be=>be.id===Y)?.content??null}},F=(R,P)=>{let G=(P==="left"?u:x).get(R.id),Y=G!==void 0,be=i?.id===R.id&&i?.side===P,ne=i!==null&&i.side!==P&&!Y,ee=d?.overId===R.id&&d?.overSide===P,se=Y?N(G):null,ie=Y?G+1:null,we="matching-player__item";Y&&(we+=" matching-player__item--matched"),se==="correct"&&(we+=" matching-player__item--correct"),se==="incorrect"&&(we+=" matching-player__item--incorrect"),be&&(we+=" matching-player__item--selected"),(ne||ee)&&(we+=" matching-player__item--available"),o&&(we+=" matching-player__item--disabled");let Q=M(R,P);return rr("button",{ref:Je=>{Je?S.current.set(R.id,Je):S.current.delete(R.id)},type:"button",className:we,onPointerDown:Je=>E(R.id,P,Je),onClick:()=>{f.current==="touch"&&p(R.id,P)},"aria-pressed":be,children:[P==="right"&&me("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:rr("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[me("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),me("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),Y&&P==="left"&&me("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ie}),me("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:oe(R.content)}}),Q&&rr("span",{className:"matching-player__correct-hint",children:["(",me("span",{dangerouslySetInnerHTML:{__html:oe(Q)}}),")"]}),Y&&P==="right"&&me("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ie}),P==="left"&&me("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:rr("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[me("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),me("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},R.id)},z=n==="ltr"?e:r,j=n==="ltr"?r:e,H=n==="ltr"?"left":"right",U=n==="ltr"?"right":"left";return rr("div",{ref:b,className:`matching-player__arena${d?" matching-player__arena--dragging":""}`,onPointerMove:W,onPointerUp:v,children:[rr("svg",{className:"matching-player__svg","aria-hidden":!0,children:[me("defs",{children:[["mp-arrow-ink",to],["mp-arrow-correct",oo],["mp-arrow-incorrect",ao],["mp-arrow-ghost",no]].map(([R,P])=>me("marker",{id:R,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:me("polygon",{points:"0 0, 11 4.5, 0 9",fill:P})},R))}),t.map(R=>{let P=k(R.leftId,"left"),D=k(R.rightId,"right");if(!P||!D)return null;let G=D.x-xs,Y=Math.max(16,Math.abs(G-P.x)*.4),be=`M ${P.x} ${P.y} C ${P.x+Y} ${P.y}, ${G-Y} ${D.y}, ${G} ${D.y}`,ne=g?w.get(`${R.leftId}-${R.rightId}`):void 0;return me("path",{d:be,stroke:ne===!0?oo:ne===!1?ao:to,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${ne===!0?"mp-arrow-correct":ne===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${R.leftId}-${R.rightId}`)}),d&&(()=>{let R=k(d.fromId,d.fromSide);if(!R)return null;let P=Math.abs(d.x-R.x)*.35,D=`M ${R.x} ${R.y} C ${R.x+P} ${R.y}, ${d.x-P} ${d.y}, ${d.x} ${d.y}`;return me("path",{d:D,stroke:no,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),rr("div",{className:"matching-player__columns",children:[me("div",{className:"matching-player__column",children:z.map(R=>F(R,H))}),me("div",{className:"matching-player__column",children:j.map(R=>F(R,U))})]})]})}var io=e=>Number.isInteger(e)?String(e):e.toFixed(2);function co(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function Wr({node:e,validationFeedback:r}){let t=de(),{shuffleSeed:n,layoutBy:o}=Ie(),{id:a,attrs:s,leftItems:i,rightItems:c}=e,{direction:d,shuffle:l,hint:m}=s,y=JSON.stringify(i),b=JSON.stringify(c),S=l&&n!==void 0,f=ys(()=>S?{left:vr(i,`${n}:${a}:left`),right:vr(c,`${n}:${a}:right`)}:null,[S,n,a,y,b]),[g,w]=Bt(i),[h,_]=Bt(c);qt(()=>{S||(l?(w(co(i)),_(co(c))):(w(i),_(c)))},[l,S,y,b]);let u=f?.left??g,x=f?.right??h,[N,C]=Bt([]),$=r?.showFeedback??!1;qt(()=>{let v=M=>{let z=M.answers.find(j=>j.nodeId===a&&j.type==="matchingSet");z&&"connections"in z.answer&&C(z.answer.connections)};return t.on("answers:prefill",v),()=>t.off("answers:prefill",v)},[t,a]),qt(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"matchingSet",timestamp:Date.now(),answer:{connections:N}}})},[t,a,N]);let k=v=>{$||C(v)},p=r?.score,T=r?.maxScore,E=$&&p!=null&&T!=null,W=E?p>=T?"correct":p>0?"partial":"incorrect":null;return jt("div",{className:o==="box"?"matching-player matching-player--box":"matching-player",children:[m&&m.length>0&&sr("div",{className:"matching-player-hintrow",children:sr(De,{hint:m})}),sr(so,{leftItems:u,rightItems:x,connections:N,direction:d,disabled:$,feedback:r,onConnectionsChange:k}),E&&jt("div",{className:"matching-player-feedback matching-player-feedback--"+W,children:[W==="correct"&&sr(vs,{size:15,style:re(15)}),W==="incorrect"&&sr(ws,{size:15,style:re(15)}),sr("span",{children:W==="correct"?"All matched":W==="partial"?"Partial credit":"Not matched"}),jt("span",{className:"matching-player-score",children:[io(p)," / ",io(T)]})]})]})}import{jsxs as ir,jsx as Fe,Fragment as ks}from"react/jsx-runtime";import{useState as lo,useEffect as Wt,useRef as Rs,useCallback as po}from"react";import ot from"clsx";function Ur({node:e,validationFeedback:r}){let t=de(),n=te(),{id:o,attrs:a}=e,{placeholder:s,minWords:i=0,maxWords:c=500,hint:d}=a,[l,m]=lo(""),[y,b]=lo(0),S=r?.showFeedback??!1,f=r?.state,g=c<=30,w=po(p=>p.trim().split(/\s+/).filter(Boolean).length,[]);Wt(()=>{let p=T=>{let W=T.answers?.find(v=>v.nodeId===o&&v.type==="aiAnswer");if(W&&W.answer?.text!=null){let v=W.answer.text;m(v),b(w(v))}};return t.on("answers:prefill",p),()=>t.off("answers:prefill",p)},[o,t,w]),Wt(()=>{let p=()=>{m(""),b(0)};return t.on("answers:reset",p),()=>t.off("answers:reset",p)},[t]);let h=Rs(null),_=po((p,T)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"aiAnswer",timestamp:Date.now(),answer:{text:p,wordCount:T}}})},300)},[o,t]);Wt(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let u=p=>{if(S)return;let T=w(p);m(p),b(T),_(p,T)},x=f==="validating",N=ot("player-ai-count",y>c&&"player-ai-count--over"),C=!S||x?"":f==="correct"?"player-ai-input--correct":f==="incorrect"?"player-ai-input--incorrect":f==="partial"?"player-ai-input--partial":"",$=f==="correct"?"player-ai-feedback--correct":f==="incorrect"?"player-ai-feedback--incorrect":f==="partial"?"player-ai-feedback--partial":"",k=p=>Number.isInteger(p)?String(p):p.toFixed(2);return ir("div",{className:"player-ai",children:[ir("div",{className:"player-ai-counts",children:[ir("span",{className:N,children:[y," / ",c," ",n.openResponseWords]}),i>0&&y<i&&Fe("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),Fe("span",{style:{marginInlineStart:"auto"},children:Fe(De,{hint:d})})]}),g?Fe("input",{type:"text",value:l,onChange:p=>u(p.target.value),placeholder:s??n.shortAnswerPlaceholder,"aria-label":n.blankAnswerAria,disabled:S,className:ot("player-ai-input",C)}):Fe("textarea",{value:l,onChange:p=>u(p.target.value),placeholder:s??n.longAnswerPlaceholder,"aria-label":n.blankAnswerAria,disabled:S,rows:5,className:ot("player-ai-input player-ai-input--multiline",C)}),S&&r&&Fe("div",{className:ot("player-ai-feedback",$),children:x?ir("div",{className:"player-ai-validating",children:[Fe("span",{className:"player-ai-spinner"}),Fe("span",{children:n.aiEvaluationInProgress})]}):ir(ks,{children:[r.message&&Fe("p",{className:"player-ai-message",children:r.message}),r.score!=null&&r.maxScore!=null&&Fe("div",{className:"player-ai-score-row",children:ir("span",{className:"player-ai-score",children:[k(r.score)," / ",k(r.maxScore)]})})]})})]})}import{Fragment as mo,jsx as A,jsxs as K}from"react/jsx-runtime";import{useState as he,useEffect as Ce,useRef as Ae,useCallback as at}from"react";import{useEditor as Ss,EditorContent as _s}from"@tiptap/react";import Ns from"@tiptap/starter-kit";import Oe from"clsx";import{FolderOpen as As,Mic as Cs,Video as ho,Monitor as Es,Clock as Ps,Image as Ms,FileText as go,Music as Is,Link2 as Ls}from"lucide-react";function bo(e){return e.trim().split(/\s+/).filter(Boolean).length}function xo(e){return e.length}function Ts(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return bo(r(e))}function $s(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return xo(r(e))}function Ut({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return A(mo,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=A("strong",{children:r}):t.type==="italic"?r=A("em",{children:r}):t.type==="underline"?r=A("u",{children:r}):t.type==="strike"?r=A("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=A("span",{style:{color:t.attrs.color},children:r}));return A(mo,{children:r})}return e.type==="paragraph"?A("span",{className:"block",children:e.content?.map((r,t)=>A(Ut,{node:r},t))??A("br",{})}):e.type==="hardBreak"?A("br",{}):e.content?A("span",{className:"block",children:e.content.map((r,t)=>A(Ut,{node:r},t))}):null}function zs({nodes:e}){return A("span",{className:"block space-y-1 text-amber-900",children:e.map((r,t)=>A(Ut,{node:r},t))})}function Ds({hint:e}){let r=te(),[t,n]=he(!1),[o,a]=he(!1),s=Ae(null);return Ce(()=>{if(!o)return;let i=c=>{s.current&&!s.current.contains(c.target)&&(a(!1),n(!1))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),K("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{o||n(!1)},children:[A("button",{type:"button",onClick:i=>{i.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},className:Oe("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&A("span",{className:"player-blank-hint-pop",onClick:i=>i.stopPropagation(),children:A(zs,{nodes:e})})]})}function uo(e){if(!isFinite(e.duration)){e.currentTime=1e101;let r=()=>{e.currentTime=0,e.removeEventListener("timeupdate",r)};e.addEventListener("timeupdate",r)}}function Fs(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function Os(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function fo(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function Hr({node:e,validationFeedback:r,readOnly:t=!1,mediaHandler:n}){let o=de(),a=te(),{id:s,attrs:i}=e,{mode:c,placeholder:d,allowFormatting:l,wordLimit:m,characterLimit:y,allowedTypes:b,allowMultiple:S,fileInstructions:f,maxDuration:g,hint:w}=i,h=t||(r?.showFeedback??!1),_=r?.state,u=Ae(null),x=at(p=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let T=p.files?.map(E=>({url:E.url,mimeType:E.kind==="videoLink"?"video/x-link":E.mimeType,name:E.kind==="videoLink"?void 0:E.name,duration:E.kind==="videoLink"?void 0:E.duration}));o.emit({type:"answer:changed",answer:{nodeId:s,type:"openResponse",timestamp:Date.now(),answer:{...p,files:T}}})},300)},[s,o]);Ce(()=>{x({})},[]);let[N,C]=he([]);Ce(()=>{(c==="file"||c==="text+file")&&c==="file"&&x({files:N})},[N,c]),Ce(()=>{let p=()=>{C([])};return o.on("answers:reset",p),()=>o.off("answers:reset",p)},[o]),Ce(()=>{let p=T=>{let W=(T.answers??[]).find(v=>v.nodeId===s&&v.type==="openResponse");W?.answer?.files&&C(W.answer.files)};return o.on("answers:prefill",p),()=>o.off("answers:prefill",p)},[s,o]);let $=r?.showFeedback,k=Oe(!$&&"player-or-field--pre",$&&_==="correct"&&"player-or-field--correct",$&&_==="partial"&&"player-or-field--partial",$&&_==="incorrect"&&"player-or-field--incorrect",$&&_==="awaiting_review"&&"player-or-field--review");return K("div",{className:"my-3 space-y-2",children:[!h&&w&&w.length>0&&A("div",{className:"flex justify-end",children:A(Ds,{hint:w})}),c==="text"&&A(yo,{nodeId:s,placeholder:d,allowFormatting:l,wordLimit:m,characterLimit:y,isDisabled:h,feedbackBorderClass:k,emitAnswer:p=>x({text:p}),answerBus:o}),c==="file"&&A(Ht,{allowedTypes:b??["image"],allowMultiple:!!S,fileInstructions:f,isDisabled:h,feedbackBorderClass:k,files:N,setFiles:C,mediaHandler:n,t:a}),(c==="audio"||c==="video"||c==="screen")&&A(Us,{kind:c,maxDuration:g,isDisabled:h,feedbackBorderClass:k,mediaHandler:n,emitAnswer:p=>x({recording:p}),t:a}),c==="text+file"&&A(Ws,{nodeId:s,placeholder:d,allowFormatting:l,wordLimit:m,characterLimit:y,allowedTypes:b??["image"],allowMultiple:!!S,fileInstructions:f,isDisabled:h,feedbackBorderClass:k,files:N,setFiles:C,emitAnswer:x,answerBus:o,mediaHandler:n,t:a}),r?.showFeedback&&_==="awaiting_review"&&K("div",{className:"flex items-center gap-2 text-sm border rounded px-3 py-2",style:{color:"var(--almost-ink, #8a5a08)",background:"var(--almost-soft, #fbf1dc)",borderColor:"var(--almost, #c8810e)"},children:[A(Ps,{size:15,style:re(15),className:"animate-pulse"}),A("span",{children:a.openResponseAwaitingReview})]}),r?.showFeedback&&_!=="awaiting_review"&&r.teacherFeedback&&A(Hs,{feedback:r.teacherFeedback,feedbackState:_,score:r.score,t:a})]})}function yo({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,isDisabled:a,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let d=te(),[l,m]=he(""),[y,b]=he(0),[S,f]=he(0),g=Ae(null),w=at(()=>{let M=g.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[]),h=Ss({extensions:[Ns.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!a,content:"",onUpdate({editor:M}){if(a)return;let z=M.getJSON().content??[],j=Ts(z),H=$s(z);b(j),f(H),i({content:z,wordCount:j})}});Ce(()=>{h&&h.setEditable(!a)},[a,h]);let _=Ae(null);Ce(()=>{h&&_.current!==null&&(h.commands.setContent({type:"doc",content:_.current}),_.current=null)},[h]),Ce(()=>{let M=F=>{let z=(F.answers??[]).find(H=>H.nodeId===e&&H.type==="openResponse");if(!z?.answer?.text)return;let j=z.answer.text.content??[];if(t)h?h.commands.setContent({type:"doc",content:j}):_.current=j;else{let H=j.flatMap(U=>U.content?.map(X=>X.text??"")??[U.text??""]).join(`
|
|
2
|
-
`);m(H),setTimeout(w,0)}};return c.on("answers:prefill",M),()=>c.off("answers:prefill",M)},[e,c,t,h]),Ce(()=>{let M=()=>{t&&h?h.commands.clearContent():(m(""),setTimeout(w,0)),b(0),f(0)};return c.on("answers:reset",M),()=>c.off("answers:reset",M)},[c,t,h,w]);let u=!!n,x=!!o&&!n,N=u?y:S,C=u?n?.max:o?.max,$=u?n?.min:o?.min,k=C!=null&&N>C,p=C!=null&&N>=C*.8&&!k,T=$!=null&&N<$&&N>0,E="text-xs tabular-nums",W=k?{color:"var(--pen, #d23b2b)",fontWeight:500}:p||T?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},v=u?C?`${y} / ${C} ${d.openResponseWords}`:$?`${y} ${d.openResponseWords} (min. ${$})`:`${y} ${d.openResponseWords}`:x?C?`${S} / ${C} ${d.openResponseChars}`:`${S} ${d.openResponseChars}`:null;return t?K("div",{className:"relative",children:[K("div",{className:Oe("rounded border transition-colors min-h-[120px]",s),children:[!a&&K("div",{className:"sticky top-0 z-10 flex gap-1 px-2 pt-1.5 pb-1 border-b border-gray-100 bg-white rounded-t",children:[[{label:"B",cmd:"toggleBold",style:"font-bold"},{label:"I",cmd:"toggleItalic",style:"italic"}].map(({label:M,cmd:F,style:z})=>A("button",{type:"button",onMouseDown:j=>{j.preventDefault(),h?.chain().focus()?.[F]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${z}`,children:M},M)),A("button",{type:"button",onMouseDown:M=>{M.preventDefault(),h?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),A(_s,{editor:h,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),v&&A("div",{className:Oe("absolute bottom-2 right-3",E),style:W,children:v})]}):K("div",{className:"relative",children:[A("textarea",{ref:g,value:l,onChange:M=>{if(a)return;let F=M.target.value;m(F);let z=bo(F),j=xo(F);b(z),f(j),w(),i({content:[{type:"paragraph",content:[{type:"text",text:F}]}],wordCount:z})},onInput:w,disabled:a,placeholder:r||d.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:Oe("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,a&&"cursor-default")}),v&&A("div",{className:Oe("absolute bottom-2 right-3",E),children:v})]})}var js={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},Bs={image:A(Ms,{size:12,style:re(12)}),pdf:A(go,{size:12,style:re(12)}),audio:A(Is,{size:12,style:re(12)}),video:A(ho,{size:12,style:re(12)}),videoLink:A(Ls,{size:12,style:re(12)})};function Ht({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:o,setFiles:a,mediaHandler:s,t:i,compact:c=!1}){let d=Ae(null),[l,m]=he(!1),[y,b]=he(!1),[S,f]=he(""),g=e.some(p=>p!=="videoLink"),w=e.includes("videoLink"),h=r||o.length===0,_=e.filter(p=>p!=="videoLink").map(p=>js[p]).filter(Boolean).join(","),u=at(p=>{a(T=>r?[...T,p]:[p])},[r,a]),x=at(p=>{a(T=>T.filter((E,W)=>W!==p))},[a]),N=async p=>{if(!(!h||n)){m(!0);try{let T=p.type.startsWith("image/")?"image":p.type==="application/pdf"?"document":p.type.startsWith("audio/")?"audio":p.type.startsWith("video/")?"video":"file";if(s){let E=await s.upload(p,T);u({kind:"file",url:E.url,mimeType:E.mimeType??p.type,name:p.name})}else{let E=URL.createObjectURL(p);u({kind:"file",url:E,mimeType:p.type,name:p.name})}}finally{m(!1)}}},C=async p=>{if(p.preventDefault(),b(!1),n||!h)return;let T=p.dataTransfer.files?.[0];T&&await N(T)},$=()=>{let p=S.trim();p&&(u({kind:"videoLink",url:p,platform:Fs(p)}),f(""))},k={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return K("div",{className:"space-y-2",children:[t&&!c&&A("p",{className:"text-sm text-gray-600 italic",children:t}),o.length>0&&A("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:o.map((p,T)=>A(qs,{file:p,onRemove:n?void 0:()=>x(T),compact:c,t:i},T))}),!n&&h&&K("div",{className:"space-y-2",children:[g&&!c&&K("div",{onDragOver:p=>{p.preventDefault(),b(!0)},onDragLeave:()=>b(!1),onDrop:C,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:y?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:y?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>d.current?.click(),children:[A(As,{size:26,className:"mx-auto mb-2",style:{...re(26),color:"var(--ink-soft, #565b66)"}}),A("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),A("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),l&&A("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),A("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(p=>p!=="videoLink").map(p=>K("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[Bs[p]," ",k[p]]},p))})]}),g&&c&&A("button",{type:"button",onClick:()=>d.current?.click(),disabled:l,className:"text-xs px-3 py-1.5 rounded border border-dashed disabled:opacity-50",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink-soft, #565b66)"},children:l?i.openResponseUploading:`+ ${i.openResponseAttachFile}`}),A("input",{ref:d,type:"file",accept:_,onChange:async p=>{let T=p.target.files?.[0];T&&(await N(T),p.target.value="")},className:"hidden"}),w&&K("div",{className:"flex gap-2 flex-wrap",children:[A("input",{type:"url",value:S,onChange:p=>f(p.target.value),placeholder:i.openResponseVideoLinkPlaceholder,className:"flex-1 text-sm border rounded px-2 py-1.5 outline-none",style:{borderColor:"var(--line-strong, #d6d3cc)"},onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),$())}}),A("button",{type:"button",onClick:$,disabled:!S.trim(),className:"text-sm px-3 py-1.5 rounded text-white disabled:opacity-50",style:{background:"var(--ink, #1d2025)"},children:i.openResponseAddVideoLink})]})]}),n&&o.length===0&&A("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function qs({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let o=e.platform==="youtube"?Os(e.url):null;return K("div",{className:Oe("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-3 space-y-1"),children:[o&&!t&&A("iframe",{src:`https://www.youtube.com/embed/${o}`,width:240,height:135,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"rounded w-full"}),A("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 underline truncate block max-w-[200px]",children:e.url}),r&&A("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return K("div",{className:Oe("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-2 flex items-center gap-2"),children:[e.mimeType?.startsWith("image/")?A("img",{src:e.url,alt:e.name??"upload",className:t?"h-6 w-6 object-cover rounded":"h-16 w-16 object-cover rounded"}):e.mimeType?.startsWith("audio/")?A("audio",{src:e.url,controls:!0,className:t?"hidden":"h-8 max-w-[240px]"}):e.mimeType?.startsWith("video/")?A("video",{src:e.url,controls:!0,className:t?"hidden":"h-16 max-w-[240px] rounded"}):A(go,{size:20,style:{...re(20),color:"var(--ink-soft, #565b66)"}}),K("div",{className:"flex-1 min-w-0",children:[A("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-gray-700 truncate block hover:underline",children:e.name??n.openResponseFile}),t&&e.mimeType?.startsWith("audio/")&&A("audio",{src:e.url,controls:!0,className:"h-6 max-w-[160px] mt-0.5"})]}),r&&A("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function Ws({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:d,files:l,setFiles:m,emitAnswer:y,answerBus:b,mediaHandler:S,t:f}){let[g,w]=he(null),[h,_]=he(!1);return Ce(()=>{y({...g&&{text:g},files:l.length>0?l:void 0})},[g,l]),K("div",{className:"space-y-2",children:[A(yo,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,isDisabled:c,feedbackBorderClass:d,emitAnswer:u=>w(u),answerBus:b}),!c&&K("div",{children:[K("button",{type:"button",onClick:()=>_(!h),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[A("span",{children:h?"\u25BE":"\u25B8"}),K("span",{children:[f.openResponseAttachFiles,l.length>0&&A("span",{className:"ml-1 rounded-full px-1.5 py-0.5 text-[10px]",style:{background:"var(--ui-muted, #f5f4f1)",color:"var(--ink, #1d2025)"},children:l.length})]})]}),h&&A("div",{className:"mt-1.5",children:A(Ht,{allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:d,files:l,setFiles:m,mediaHandler:S,t:f,compact:!0})})]}),c&&l.length>0&&K("div",{className:"space-y-1",children:[A("p",{className:"text-xs text-gray-500 font-medium",children:f.openResponseAttachedFiles}),A(Ht,{allowedTypes:a,allowMultiple:s,isDisabled:!0,feedbackBorderClass:d,files:l,setFiles:m,t:f,compact:!0})]})]})}function Us({kind:e,maxDuration:r,isDisabled:t,feedbackBorderClass:n,mediaHandler:o,emitAnswer:a,t:s}){let[i,c]=he("idle"),[d,l]=he(0),[m,y]=he(null),[b,S]=he("audio/webm"),[f,g]=he(null),w=Ae(null),h=Ae(null),_=Ae([]),u=Ae(null),x=Ae(null),N=Ae(null),C=Ae(0);Ce(()=>()=>{$(),u.current&&clearInterval(u.current),cancelAnimationFrame(C.current)},[]),Ce(()=>{i==="recording"&&e==="audio"&&h.current&&W(h.current)},[i]);let $=()=>{h.current?.getTracks().forEach(v=>v.stop()),h.current=null},k=async()=>{if(!o){g(s.openResponseMediaHandlerRequired);return}g(null),c("requesting");try{let v;if(e==="screen"){let z=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1});try{let H=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];H&&z.addTrack(H)}catch{}z.getVideoTracks()[0]?.addEventListener("ended",()=>{w.current?.state==="recording"&&p()}),v=z,x.current&&(x.current.srcObject=v,x.current.play())}else e==="video"?(v=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"environment"}}),x.current&&(x.current.srcObject=v,x.current.play())):v=await navigator.mediaDevices.getUserMedia({audio:!0});h.current=v;let M=e==="audio"?"audio/webm":"video/webm";S(M);let F=new MediaRecorder(v,{mimeType:M});w.current=F,_.current=[],F.ondataavailable=z=>{z.data.size>0&&_.current.push(z.data)},F.onstop=()=>{let z=new Blob(_.current,{type:M}),j=URL.createObjectURL(z);y(j),c("reviewing"),$(),cancelAnimationFrame(C.current)},F.start(200),c("recording"),l(0),u.current=setInterval(()=>{l(z=>{let j=z+1;return r&&j>=r&&p(),j})},1e3)}catch{c("idle"),g(s.openResponsePermissionDenied)}},p=()=>{u.current&&(clearInterval(u.current),u.current=null),w.current?.stop()},T=async()=>{if(!m||!o)return;c("submitted");let M=await(await fetch(m)).blob(),F=e==="screen"?"video":e,z=new File([M],"recording.webm",{type:b}),j=await o.upload(z,F);URL.revokeObjectURL(m),a({url:j.url,mimeType:j.mimeType??b,duration:d,kind:F})},E=()=>{m&&URL.revokeObjectURL(m),y(null),l(0),c("idle")},W=v=>{let M=new AudioContext,F=M.createMediaStreamSource(v),z=M.createAnalyser();z.fftSize=64,F.connect(z);let j=new Uint8Array(z.frequencyBinCount),H=N.current;if(!H)return;let U=()=>{z.getByteFrequencyData(j);let X=H.getContext("2d");if(!X)return;X.clearRect(0,0,H.width,H.height);let R=H.width/j.length*2.5,P=0;for(let D=0;D<j.length;D++){let G=j[D]/255*H.height;X.fillStyle="#1d2025",X.fillRect(P,H.height-G,R,G),P+=R+1}C.current=requestAnimationFrame(U)};U()};return t?A("div",{className:Oe("rounded border p-4 text-center text-sm text-gray-400",n),children:s.openResponseRecordingSubmitted}):K("div",{className:Oe("rounded border p-4 space-y-3",n),children:[f&&A("p",{className:"text-sm",style:{color:"var(--pen, #d23b2b)"},children:f}),(e==="video"||e==="screen")&&i==="recording"&&A("video",{ref:x,muted:!0,className:"w-full rounded max-h-48 bg-black",playsInline:!0}),e==="audio"&&i==="recording"&&A("canvas",{ref:N,width:300,height:48,className:"w-full rounded bg-gray-900"}),i==="reviewing"&&m&&(e==="audio"?A("audio",{src:m,controls:!0,className:"w-full",onLoadedMetadata:v=>uo(v.currentTarget)}):A("video",{src:m,controls:!0,className:"w-full rounded max-h-48",onLoadedMetadata:v=>uo(v.currentTarget)})),K("div",{className:"flex items-center justify-center gap-3",children:[i==="idle"&&K("button",{type:"button",onClick:k,className:"flex flex-col items-center gap-1 px-6 py-3 rounded-full font-medium text-white transition-colors",style:{background:"var(--ink, #1d2025)"},children:[e==="audio"?A(Cs,{size:22,style:re(22)}):e==="screen"?A(Es,{size:22,style:re(22)}):A(ho,{size:22,style:re(22)}),A("span",{className:"text-sm",children:e==="screen"?s.openResponseTapToRecordScreen:s.openResponseTapToRecord})]}),i==="requesting"&&A("p",{className:"text-sm text-gray-500 animate-pulse",children:s.openResponseRequestingPermission}),i==="recording"&&K("div",{className:"flex flex-col items-center gap-2",children:[K("div",{className:"flex items-center gap-2 font-mono text-lg",style:{color:"var(--pen, #d23b2b)"},children:[A("span",{className:"animate-pulse",children:"\u25CF"}),A("span",{children:fo(d)}),r&&K("span",{className:"text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:["/ ",fo(r)]})]}),A("button",{type:"button",onClick:p,className:"px-5 py-2 rounded-full text-white text-sm font-medium",style:{background:"var(--pen, #d23b2b)"},children:s.openResponseStopRecording})]}),i==="reviewing"&&K("div",{className:"flex gap-2",children:[A("button",{type:"button",onClick:E,className:"px-4 py-1.5 rounded border text-sm",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink, #1d2025)"},children:s.openResponseReRecord}),A("button",{type:"button",onClick:T,className:"px-4 py-1.5 rounded text-white text-sm",style:{background:"var(--ink, #1d2025)"},children:s.openResponseConfirmRecording})]}),i==="submitted"&&K("p",{className:"text-sm",style:{color:"var(--ok, #1f8a4c)"},children:["\u2713 ",s.openResponseRecordingSubmitted]})]})]})}function Hs({feedback:e,feedbackState:r,score:t,t:n}){let o=r==="correct"?{bg:"var(--ok-soft, #ecf8f0)",border:"var(--ok, #1f8a4c)",ink:"var(--ok, #1f8a4c)"}:r==="incorrect"?{bg:"var(--pen-soft, #fdeeec)",border:"var(--pen, #d23b2b)",ink:"var(--pen, #d23b2b)"}:{bg:"var(--almost-soft, #fbf1dc)",border:"var(--almost, #c8810e)",ink:"var(--almost-ink, #8a5a08)"};return K("div",{className:"rounded p-3 text-sm border",style:{background:o.bg,borderColor:o.border,color:"var(--ink, #1d2025)"},children:[A("p",{className:"text-xs font-medium mb-1 opacity-70",children:n.openResponseTeacherFeedbackLabel}),e.flatMap(a=>a.content?.map(s=>s.text??"")??[a.text??""]).join(" "),t!=null&&K("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:L("1.4rem"),lineHeight:1,color:o.ink},children:[t," pts"]})]})}import{jsx as Ye,jsxs as cr,Fragment as vo}from"react/jsx-runtime";import{useEffect as Vt,useRef as Vs,useState as wo}from"react";function Qs(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function Vr({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:o=!1}){let a=de(),s=Vs(null),[i,c]=wo(""),[d,l]=wo(!1),m=Qs(n),y=n?.score,b=n?.maxScore,S=w=>Number.isInteger(w)?String(w):w.toFixed(2);Vt(()=>{import("mathlive").then(()=>{l(!0)}).catch(()=>{})},[]),Vt(()=>{let w=h=>{let _=h.answers?.find(u=>u.nodeId===e&&u.type==="mathResponse");_?.answer?.latex!==void 0&&(c(_.answer.latex),s.current&&(s.current.value=_.answer.latex))};return a.on("answers:prefill",w),()=>a.off("answers:prefill",w)},[a,e]),Vt(()=>{a.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:i}}})},[i,e,a]);let f=w=>{let h=w.target?.value??"";c(h)},g=m==="correct"?"player-math-field--correct":m==="incorrect"?"player-math-field--incorrect":m==="validating"?"player-math-field--validating":"";return cr("div",{dir:"ltr",className:"math-response-player",children:[cr("span",{style:{display:"inline-flex",alignItems:"center",gap:L("0.4rem")},children:[Ye("div",{className:"player-math-field"+(g?" "+g:"")+(o?" player-math-field--readonly":""),children:d?Ye("math-field",{ref:s,value:i,onInput:f,"virtual-keyboard-mode":"onfocus","smart-fence":"true",className:"player-math-field__input",style:{opacity:o?.7:1,pointerEvents:o?"none":"auto"}}):Ye("input",{type:"text",value:i,onChange:w=>c(w.target.value),placeholder:r||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:o,className:"player-math-field__fallback"})}),Ye(De,{hint:t})]}),n?.showFeedback&&cr("div",{className:"player-math-feedback player-math-feedback--"+m,children:[m==="validating"&&cr(vo,{children:[Ye("span",{className:"player-math-spinner"}),Ye("span",{children:"Checking your answer\u2026"})]}),m==="correct"&&cr(vo,{children:[Ye("span",{children:"\u2713 Correct"}),y!=null&&cr("span",{className:"player-math-score",children:[S(y),b!=null?` / ${S(b)}`:""]})]}),m==="incorrect"&&Ye("span",{children:"\u2717 Incorrect"})]})]})}import{jsx as Z,jsxs as pe,Fragment as Rr}from"react/jsx-runtime";import{useCallback as di,useEffect as pi,useRef as mi,useState as kr}from"react";import{Play as ui,Lock as fi,Check as Gt,X as So}from"lucide-react";function ct(e,r){if(e===r)return!0;if(e===null||r===null||typeof e!=typeof r||typeof e!="object")return!1;let t=Array.isArray(e),n=Array.isArray(r);if(t!==n)return!1;if(t&&n){let c=e,d=r;return c.length!==d.length?!1:c.every((l,m)=>ct(l,d[m]))}let o=e,a=r,s=Object.keys(o),i=Object.keys(a);return s.length!==i.length?!1:s.every(c=>ct(o[c],a[c]))}var Gs=`
|
|
1
|
+
import"./chunk-76CZ6Z7T.mjs";import mc,{useMemo as uc}from"react";import{jsx as dr}from"react/jsx-runtime";import{useEffect as ut,useMemo as Vi,useRef as Qi}from"react";import Eo from"mitt";var We=class{constructor(){this.emitter=Eo(),this.answers=new Map}emit(r){if(r.type==="answer:changed")this.answers.set(r.answer.nodeId,r.answer);else if(r.type==="answers:reset")this.answers.clear();else if(r.type==="answers:prefill")for(let t of r.answers)this.answers.set(t.nodeId,t);this.emitter.emit(r.type,r)}on(r,t){this.emitter.on(r,t)}off(r,t){this.emitter.off(r,t)}getAllAnswers(){return Array.from(this.answers.values())}clearAnswers(){this.answers.clear(),this.emit({type:"answers:reset"})}prefillAnswers(r){this.emit({type:"answers:prefill",answers:r})}submitAnswers(){this.emit({type:"answer:submitted",answers:this.getAllAnswers(),timestamp:Date.now()})}},zn="__edpireGlobalAnswerBus",Fn=globalThis,Fr=Fn[zn]??(Fn[zn]=new We);import{jsx as Po}from"react/jsx-runtime";import{createContext as Lo,useContext as Mo}from"react";var Dn="__edpireAnswerBusContext",On=globalThis,jn=On[Dn]??(On[Dn]=Lo(Fr));function de(){return Mo(jn)}function Dr({children:e,bus:r=new We}){return Po(jn.Provider,{value:r,children:e})}import{Fragment as Yn,jsx as V,jsxs as Ve}from"react/jsx-runtime";import{Fragment as es,useState as et,useEffect as Zr,useMemo as rs,useRef as ts}from"react";import $e from"clsx";import{jsx as O,jsxs as Hn}from"react/jsx-runtime";import To from"katex";import"katex/dist/contrib/mhchem.js";var Io={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function br(e,r,t=!0){try{return To.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Io,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function P(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function re(e){return{width:P(e),height:P(e)}}function Le(e){if(e==null||e==="")return;if(typeof e=="number")return P(e);let r=String(e).trim();return/^\d+(\.\d+)?px$/.test(r)?P(r):r}import{createContext as $o}from"react";var xr=$o(!1),Or="1px solid #d1d5db",zo="#f3f4f6",Fo="#e3e1dc",Do="var(--card, #fff)",yr="edp-table-first",Pt={overflowX:"auto",margin:`${P("1.25rem")} 0`},Lt={borderCollapse:"separate",borderSpacing:0,width:"100%",tableLayout:"auto",fontSize:P("0.875rem"),lineHeight:1.3,borderBlockStart:Or,borderInlineStart:Or};function vr(e){let r=e.gray?Fo:e.header?zo:e.sticky?Do:void 0;return{borderBlockEnd:Or,borderInlineEnd:Or,padding:`${P("4px")} ${P("6px")}`,verticalAlign:"middle",overflowWrap:"normal",wordBreak:"normal",hyphens:"manual",...r?{background:r}:{},...e.header?{fontWeight:600}:{},...e.sticky?{position:"sticky",insetInlineStart:0,zIndex:1}:{}}}function wr(e){return Object.entries(e).map(([r,t])=>`${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${t}`).join(";")}function Mt(e){let r=[],t=new Set,n=[];(e??[]).forEach((o,i)=>{let c=0;(o.content??[]).forEach(d=>{for(;n[i]?.[c];)c++;let l=Math.max(1,d.attrs?.colspan??1),p=Math.max(1,d.attrs?.rowspan??1);for(let f=i;f<i+p;f++){let b=n[f]??(n[f]=[]);for(let v=c;v<c+l;v++)b[v]=!0}for(let f=0;f<l;f++){let b=d.attrs?.colwidth?.[f];b&&r[c+f]==null&&(r[c+f]=b)}c===0&&l===1&&t.add(d),c+=l})});let a=n.reduce((o,i)=>Math.max(o,i.length),0);return{columnWidths:r.some(o=>o!=null)?Array.from({length:a},(o,i)=>r[i]??null):[],stickyCells:t}}function Tt(e){return e.replace(/(\d) (?=\d)/g,"$1\xA0").replace(/(\d) (?=[\p{L}%\p{Sc}]{1,3}(?![\p{L}\p{N}]))/gu,"$1\xA0")}var Bn={1:{fontSize:"1.75em",fontWeight:700,lineHeight:1.2,margin:"0.6em 0 0.4em"},2:{fontSize:"1.4em",fontWeight:700,lineHeight:1.25,margin:"0.6em 0 0.35em"},3:{fontSize:"1.15em",fontWeight:600,lineHeight:1.3,margin:"0.5em 0 0.3em"}},Wn={border:"#2563eb",background:"#e0f2fe"},qn={border:"#dc2626",background:"#fee2e2"};function Oo(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Wn.border}`,background:e?.background||Wn.background,borderRadius:P("4px"),padding:"0.17em 0.37em"}}function jo(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||qn.border}`,background:e?.background||qn.background,borderRadius:r,padding:"0.15em 0.45em"}}function Bo(e,r){if(!(!e&&!r))return{...e?{textAlign:e}:{},...r?{margin:0}:{}}}function Se(e,r,t){return O("div",{className:"exercise-content",children:e.content.map((n,a)=>xe(n,`node-${a}`,r,t))})}var Wo=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,qo=new Set(["blank","inlineChoiceSet"]);function Un(e,r,t,n){let a=[],s=e??[];for(let o=0;o<s.length;o++){let i=s[o],c=s[o+1],d=qo.has(i.type)&&c?.type==="text"?Wo.exec(c.text??"")?.[0]:void 0;if(!d||!c){a.push(xe(i,`${r}-${o}`,t,n));continue}let l=(c.text??"").slice(d.length);a.push(Hn("span",{style:{whiteSpace:"nowrap"},children:[O("span",{style:{whiteSpace:"normal"},children:xe(i,`${r}-${o}-a`,t,n)}),xe({...c,text:d},`${r}-${o}-p`,t,n)]},`${r}-${o}`)),l&&a.push(xe({...c,text:l},`${r}-${o+1}`,t,n)),o++}return a}function xe(e,r,t,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return O(Br,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?O(Wr,{node:e,validationFeedback:t?.get(e.id)},r):O(qr,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return O(Ur,{node:e},r);case"inlinePool":return O(Hr,{node:e},r);case"matchingSet":return O(Vr,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return O(Qr,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return O(Gr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return O(Yr,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return O(Kr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},r);case"aiEvaluationConfig":return null;case"paragraph":{let a=e.attrs,s=a?.textAlign,o=a?.dir||void 0;return O("p",{dir:o,style:Bo(s,n?.inTable),children:Un(e.content,r,t,n)},r)}case"heading":{let a=e.attrs.level??1,s=`h${a}`,o=e.attrs,i=o?.textAlign,c=o?.dir||void 0,d=Bn[a]??Bn[3];return O(s,{dir:c,style:{...d,...i?{textAlign:i}:{}},children:Un(e.content,r,t,n)},r)}case"blockquote":{let a=e.attrs,s=a?.dir||void 0,o=a?.textAlign;return O("blockquote",{dir:s,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...o?{textAlign:o}:{}},children:e.content?.map((i,c)=>xe(i,`${r}-${c}`,t,n))},r)}case"text":{let a=e,s=n?.inTable?Tt(a.text??""):a.text??"",o=a.marks??[];if(o.length===0)return O("span",{children:s},r);let i={};for(let d of o)d.type==="textStyle"&&(d.attrs?.color&&(i.color=d.attrs.color),d.attrs?.fontSize&&(i.fontSize=d.attrs.fontSize),d.attrs?.fontFamily&&(i.fontFamily=d.attrs.fontFamily));let c=s;for(let d of o)switch(d.type){case"bold":c=O("strong",{children:c});break;case"italic":c=O("em",{children:c});break;case"underline":c=O("u",{children:c});break;case"strike":c=O("s",{children:c});break;case"code":c=O("code",{children:c});break;case"subscript":c=O("sub",{children:c});break;case"superscript":c=O("sup",{children:c});break;case"boxedText":c=O("span",{style:Oo(d.attrs),children:c});break;case"circleText":c=O("span",{style:jo(d.attrs),children:c});break}return O("span",{style:Object.keys(i).length>0?i:void 0,children:c},r)}case"hardBreak":return O("br",{},r);case"resizableImage":return O("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:Le(e.attrs?.width||void 0)??"auto",height:Le(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"resizableAudio":return O("span",{style:{display:"inline-flex",verticalAlign:"middle",alignItems:"center",background:"#f1f5f9",borderRadius:P("8px"),padding:`${P("4px")} ${P("8px")}`,maxWidth:"100%"},children:O("audio",{controls:!0,src:e.attrs?.src||void 0,style:{display:"block",width:P("320px"),maxWidth:"100%"}})},r);case"resizableVideo":return O("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Le(e.attrs?.width||void 0)??"auto",height:Le(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"youtubeEmbed":return O("iframe",{src:`https://www.youtube.com/embed/${e.attrs?.videoId||""}`,width:e.attrs?.width||480,height:e.attrs?.height||270,allowFullScreen:!0,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",style:{display:"inline-block",verticalAlign:"middle",border:0,width:Le(e.attrs?.width||480),height:Le(e.attrs?.height||270)}},r);case"inlineMath":return O("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:br(e.attrs?.latex??"",!1,!0)}},r);case"blockMath":return O("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:br(e.attrs?.latex??"",!0,!0)}},r);case"variable":return O("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let a=e;if(a.type==="bulletList")return O("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((s,o)=>xe(s,`${r}-${o}`,t,n))},r);if(a.type==="orderedList")return O("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((s,o)=>xe(s,`${r}-${o}`,t,n))},r);if(a.type==="listItem")return O("li",{children:a.content?.map((s,o)=>xe(s,`${r}-${o}`,t,n))},r);if(a.type==="table"){let s=Mt(a.content),o={...n,inTable:!0,stickyCells:s.stickyCells};return O("div",{style:Pt,children:Hn("table",{style:Lt,children:[s.columnWidths.length>0&&O("colgroup",{children:s.columnWidths.map((i,c)=>O("col",{style:i?{width:P(i)}:void 0},c))}),O("tbody",{children:a.content?.map((i,c)=>xe(i,`${r}-${c}`,t,o))})]})},r)}return a.type==="tableRow"?O("tr",{children:a.content?.map((s,o)=>xe(s,`${r}-${o}`,t,n))},r):a.type==="tableCell"?O("td",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,className:n?.stickyCells?.has(a)?yr:void 0,style:vr({header:!1,gray:!!a.attrs?.gray,sticky:!!n?.stickyCells?.has(a)}),children:O(xr.Provider,{value:!0,children:a.content?.map((s,o)=>xe(s,`${r}-${o}`,t,n))})},r):a.type==="tableHeader"?O("th",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,className:n?.stickyCells?.has(a)?yr:void 0,style:vr({header:!0,gray:!!a.attrs?.gray,sticky:!!n?.stickyCells?.has(a)}),children:O(xr.Provider,{value:!0,children:a.content?.map((s,o)=>xe(s,`${r}-${o}`,t,n))})},r):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function ae(e,r){return e.map(t=>{if(t.type==="text"){let n=Ze(r?.inTable?Tt(t.text??""):t.text??""),a=t.marks??[],s=[];for(let o of a)o.type==="textStyle"&&(o.attrs?.color&&s.push(`color:${o.attrs.color}`),o.attrs?.fontSize&&s.push(`font-size:${o.attrs.fontSize}`),o.attrs?.fontFamily&&s.push(`font-family:${o.attrs.fontFamily}`));s.length>0&&(n=`<span style="${s.join(";")}">${n}</span>`);for(let o of a)switch(o.type){case"bold":n=`<strong>${n}</strong>`;break;case"italic":n=`<em>${n}</em>`;break;case"underline":n=`<u>${n}</u>`;break;case"strike":n=`<s>${n}</s>`;break;case"code":n=`<code>${n}</code>`;break;case"subscript":n=`<sub>${n}</sub>`;break;case"superscript":n=`<sup>${n}</sup>`;break;case"boxedText":{let i=o.attrs?.border||"#2563eb",c=o.attrs?.background||"#e0f2fe";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${P("4px")};padding:0.17em 0.37em">${n}</span>`;break}case"circleText":{let i=o.attrs?.border||"#dc2626",c=o.attrs?.background||"#fee2e2",d=o.attrs?.shape==="circle"?"50%":"9999px";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${d};padding:0.15em 0.45em">${n}</span>`;break}}return n}if(t.type==="paragraph"){let n=t.content?ae(t.content,r):"",a=t.attrs?.dir,s=t.attrs?.textAlign,o=a?` dir="${a}"`:"",i=[s?`text-align:${s}`:"",r?.inTable?"margin:0":""].filter(Boolean).join(";"),c=i?` style="${i}"`:"";return r?.stripParagraphs?n:`<p${o}${c}>${n}</p>`}if(t.type==="hardBreak")return"<br/>";if(t.type==="table"){let n=Mt(t.content),a=t.content?ae(t.content,{...r,inTable:!0,stickyCells:n.stickyCells}):"",s=n.columnWidths.length?`<colgroup>${n.columnWidths.map(o=>o?`<col style="width:${P(o)}">`:"<col>").join("")}</colgroup>`:"";return`<div style="${wr(Pt)}"><table style="${wr(Lt)}">${s}<tbody>${a}</tbody></table></div>`}if(t.type==="tableRow")return`<tr>${t.content?ae(t.content,r):""}</tr>`;if(t.type==="tableCell"){let n=t.content?ae(t.content,r):"",a=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",s=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"",o=!!r?.stickyCells?.has(t),i=o?` class="${yr}"`:"";return`<td${a}${s}${i} style="${wr(vr({header:!1,gray:!!t.attrs?.gray,sticky:o}))}">${n}</td>`}if(t.type==="tableHeader"){let n=t.content?ae(t.content,r):"",a=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",s=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"",o=!!r?.stickyCells?.has(t),i=o?` class="${yr}"`:"";return`<th${a}${s}${i} style="${wr(vr({header:!0,gray:!!t.attrs?.gray,sticky:o}))}">${n}</th>`}if(t.type==="bulletList")return`<ul style="list-style-type:disc;padding-left:1.5em">${t.content?ae(t.content,r):""}</ul>`;if(t.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${t.content?ae(t.content,r):""}</ol>`;if(t.type==="listItem")return`<li>${t.content?ae(t.content,r):""}</li>`;if(t.type==="blockquote"){let n=t.content?ae(t.content,r):"";return`<blockquote${t.attrs?.dir?` dir="${t.attrs.dir}"`:""} style="border-inline-start:3px solid #d6d3cc;padding-inline-start:1em;margin:0.75em 0;color:#565b66;font-style:italic">${n}</blockquote>`}if(t.type==="resizableImage"){let n=t.attrs??{},a=jr(n.width),s=jr(n.height);return`<img src="${Ze(n.src??"")}" alt="${Ze(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${a?`width:${a};`:""}${s?`height:${s};`:""}"/>`}if(t.type==="resizableAudio"){let n=t.attrs??{};return`<span style="display:inline-flex;vertical-align:middle;align-items:center;background:#f1f5f9;border-radius:${P("8px")};padding:${P("4px")} ${P("8px")};max-width:100%"><audio controls src="${Ze(n.src??"")}" style="display:block;width:${P("320px")};max-width:100%"></audio></span>`}if(t.type==="resizableVideo"){let n=t.attrs??{},a=jr(n.width),s=jr(n.height);return`<video src="${Ze(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${a?`width:${a};`:""}${s?`height:${s};`:""}"></video>`}if(t.type==="youtubeEmbed"){let n=t.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Ze(n.videoId??"")}" width="${n.width||480}" height="${n.height||270}" allowfullscreen frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" style="display:inline-block;vertical-align:middle;border:0;width:${Le(n.width||480)};height:${Le(n.height||270)}"></iframe>`}return t.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${br(t.attrs?.latex??"",!1,!0)}</span>`:t.type==="blockMath"?`<div dir="ltr" class="math-block" style="unicode-bidi:isolate;text-align:center;margin:1em 0">${br(t.attrs?.latex??"",!0,!0)}</div>`:t.type==="variable"?`<span class="variable">{${Ze(t.attrs?.name??"")}}</span>`:""}).join("")}function jr(e){return e==null||e===""?null:Le(e)??null}function Ze(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}import{jsx as Uo}from"react/jsx-runtime";import{createContext as Ho,useContext as Vn}from"react";var ar={submitButton:"Submit",showHint:"Show hint",clickToRemove:"Click to remove",blankAnswerAria:"Your answer",aiEvaluationInProgress:"AI evaluation in progress\u2026",aiEvaluationInProgressAria:"AI evaluation in progress",shortAnswerPlaceholder:"Short answer\u2026",longAnswerPlaceholder:"Write your answer here\u2026",minWordsLabel:e=>`Min: ${e}`,wordBank:"Word Bank",chooseN:e=>`(choose ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Open ${e}`,annexClose:"Close",referenceInPanel:e=>`This exercise's text is in ${e}.`,readReference:"Read it",referenceForExercise:e=>`Exercise ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),openResponseTextPlaceholder:"Write your answer here\u2026",openResponseWords:"words",openResponseChars:"chars",openResponseDropZoneLabel:"Drag & drop files here, or",openResponseDropZoneBrowse:"browse",openResponseUploading:"Uploading\u2026",openResponseNoSubmission:"No submission",openResponseFile:"File",openResponseAttachFile:"Attach a file",openResponseAttachFiles:"Attach files",openResponseAttachedFiles:"Attached files",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Video",openResponseTypeVideoLink:"Video link",openResponseVideoLinkPlaceholder:"Paste YouTube or Vimeo URL\u2026",openResponseAddVideoLink:"Add",openResponseTapToRecord:"Tap to start recording",openResponseTapToRecordScreen:"Click to start screen recording",openResponseRequestingPermission:"Requesting permission\u2026",openResponsePermissionDenied:"Microphone/camera access denied. Please allow access in your browser settings.",openResponseMediaHandlerRequired:"A media handler is required to save recordings.",openResponseStopRecording:"Stop",openResponseReRecord:"Re-record",openResponseConfirmRecording:"Use this recording",openResponseRecordingSubmitted:"Recording submitted",openResponseAwaitingReview:"Submitted, awaiting teacher review",openResponseTeacherFeedbackLabel:"Teacher feedback",openResponseGradeThisResponse:"Grade this response",openResponseGradeScoreLabel:e=>`Score (max ${e})`,openResponseGradeFeedbackLabel:"Feedback (optional)",openResponseGradeFeedbackPlaceholder:"Add feedback for the student\u2026",openResponseSubmitGrade:"Submit Grade",openResponseGradeSubmitted:(e,r)=>`Grade submitted: ${e} / ${r}`,openResponseRubricTitle:"Rubric",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} pts`,openResponseAiSuggestionTitle:"AI Pre-grading Suggestion",openResponseAiSuggestedScore:(e,r)=>`Suggested score: ${e} / ${r}`,openResponseAiEvidence:"Evidence:",openResponseAiApplySuggestion:"Apply suggestion",openResponseStudentAnswerTitle:"Student answer"};var Xr={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",blankAnswerAria:"Votre r\xE9ponse",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",minWordsLabel:e=>`Min. : ${e}`,wordBank:"Banque de mots",chooseN:e=>`(choisir ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Ouvrir ${e}`,annexClose:"Fermer",referenceInPanel:e=>`Le texte de cet exercice est dans \xAB ${e} \xBB.`,readReference:"Le lire",referenceForExercise:e=>`Exercice ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),openResponseTextPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glissez-d\xE9posez des fichiers ici, ou",openResponseDropZoneBrowse:"parcourir",openResponseUploading:"Envoi en cours\u2026",openResponseNoSubmission:"Aucun fichier d\xE9pos\xE9",openResponseFile:"Fichier",openResponseAttachFile:"Joindre un fichier",openResponseAttachFiles:"Joindre des fichiers",openResponseAttachedFiles:"Fichiers joints",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Vid\xE9o",openResponseTypeVideoLink:"Lien vid\xE9o",openResponseVideoLinkPlaceholder:"Coller un lien YouTube ou Vimeo\u2026",openResponseAddVideoLink:"Ajouter",openResponseTapToRecord:"Appuyer pour d\xE9marrer l'enregistrement",openResponseTapToRecordScreen:"Cliquer pour d\xE9marrer l'enregistrement d'\xE9cran",openResponseRequestingPermission:"Demande d'autorisation\u2026",openResponsePermissionDenied:"Acc\xE8s au micro/cam\xE9ra refus\xE9. Autorise l'acc\xE8s dans les param\xE8tres du navigateur.",openResponseMediaHandlerRequired:"Un gestionnaire de m\xE9dias est requis pour sauvegarder les enregistrements.",openResponseStopRecording:"Arr\xEAter",openResponseReRecord:"R\xE9enregistrer",openResponseConfirmRecording:"Utiliser cet enregistrement",openResponseRecordingSubmitted:"Enregistrement soumis",openResponseAwaitingReview:"Soumis, en attente de correction par l'enseignant",openResponseTeacherFeedbackLabel:"Commentaire de l'enseignant",openResponseGradeThisResponse:"Corriger cette r\xE9ponse",openResponseGradeScoreLabel:e=>`Note (max ${e})`,openResponseGradeFeedbackLabel:"Commentaire (facultatif)",openResponseGradeFeedbackPlaceholder:"Ajouter un commentaire pour l'\xE9l\xE8ve\u2026",openResponseSubmitGrade:"Valider la note",openResponseGradeSubmitted:(e,r)=>`Note envoy\xE9e : ${e} / ${r}`,openResponseRubricTitle:"Grille d'\xE9valuation",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} pts`,openResponseAiSuggestionTitle:"Suggestion de correction par IA",openResponseAiSuggestedScore:(e,r)=>`Score sugg\xE9r\xE9 : ${e} / ${r}`,openResponseAiEvidence:"Extrait :",openResponseAiApplySuggestion:"Appliquer la suggestion",openResponseStudentAnswerTitle:"R\xE9ponse de l'\xE9l\xE8ve"};var Jr={submitButton:"\u0625\u0631\u0633\u0627\u0644",showHint:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062A\u0644\u0645\u064A\u062D",clickToRemove:"\u0627\u0646\u0642\u0631 \u0644\u0644\u0625\u0632\u0627\u0644\u0629",blankAnswerAria:"\u0625\u062C\u0627\u0628\u062A\u0643",aiEvaluationInProgress:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u2026",aiEvaluationInProgressAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",shortAnswerPlaceholder:"\u0625\u062C\u0627\u0628\u0629 \u0642\u0635\u064A\u0631\u0629\u2026",longAnswerPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",minWordsLabel:e=>`\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649: ${e}`,wordBank:"\u0628\u0646\u0643 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",chooseN:e=>`(\u0627\u062E\u062A\u0631 ${e})`,annexDefaultLabel:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexOpen:e=>`\u0641\u062A\u062D ${e}`,annexClose:"\u0625\u063A\u0644\u0627\u0642",referenceInPanel:e=>`\u0646\u0635 \u0647\u0630\u0627 \u0627\u0644\u062A\u0645\u0631\u064A\u0646 \u0641\u064A \xAB${e}\xBB.`,readReference:"\u0627\u0642\u0631\u0623\u0647",referenceForExercise:e=>`\u0627\u0644\u062A\u0645\u0631\u064A\u0646 ${e}`,choiceLetters:["\u0623","\u0628","\u062C","\u062F","\u0647\u0640","\u0648","\u0632","\u062D","\u0637","\u064A","\u0643","\u0644","\u0645","\u0646","\u0633","\u0639","\u0641","\u0635","\u0642","\u0631","\u0634","\u062A","\u062B","\u062E","\u0630","\u0636","\u0638","\u063A"],openResponseTextPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627\u2026",openResponseWords:"\u0643\u0644\u0645\u0629",openResponseChars:"\u062D\u0631\u0641",openResponseDropZoneLabel:"\u0627\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0648\u0623\u0641\u0644\u062A\u0647\u0627 \u0647\u0646\u0627\u060C \u0623\u0648",openResponseDropZoneBrowse:"\u062A\u0635\u0641\u0651\u062D",openResponseUploading:"\u062C\u0627\u0631\u064D \u0627\u0644\u0631\u0641\u0639\u2026",openResponseNoSubmission:"\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0633\u0644\u064A\u0645",openResponseFile:"\u0645\u0644\u0641",openResponseAttachFile:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641",openResponseAttachFiles:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",openResponseAttachedFiles:"\u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0627\u0644\u0645\u0631\u0641\u0642\u0629",openResponseTypeImage:"\u0635\u0648\u0631\u0629",openResponseTypePdf:"PDF",openResponseTypeAudio:"\u0635\u0648\u062A",openResponseTypeVideo:"\u0641\u064A\u062F\u064A\u0648",openResponseTypeVideoLink:"\u0631\u0627\u0628\u0637 \u0641\u064A\u062F\u064A\u0648",openResponseVideoLinkPlaceholder:"\u0627\u0644\u0635\u0642 \u0631\u0627\u0628\u0637 \u064A\u0648\u062A\u064A\u0648\u0628 \u0623\u0648 Vimeo\u2026",openResponseAddVideoLink:"\u0625\u0636\u0627\u0641\u0629",openResponseTapToRecord:"\u0627\u0646\u0642\u0631 \u0644\u0628\u062F\u0621 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseTapToRecordScreen:"\u0627\u0646\u0642\u0631 \u0644\u0628\u062F\u0621 \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0634\u0627\u0634\u0629",openResponseRequestingPermission:"\u062C\u0627\u0631\u064D \u0637\u0644\u0628 \u0627\u0644\u0625\u0630\u0646\u2026",openResponsePermissionDenied:"\u062A\u0645 \u0631\u0641\u0636 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646/\u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627. \u064A\u064F\u0631\u062C\u0649 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0627\u0644\u0648\u0635\u0648\u0644 \u0645\u0646 \u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062A\u0635\u0641\u062D.",openResponseMediaHandlerRequired:"\u064A\u0644\u0632\u0645 \u0645\u0639\u0627\u0644\u062C \u0648\u0633\u0627\u0626\u0637 \u0644\u062D\u0641\u0638 \u0627\u0644\u062A\u0633\u062C\u064A\u0644\u0627\u062A.",openResponseStopRecording:"\u0625\u064A\u0642\u0627\u0641",openResponseReRecord:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseConfirmRecording:"\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0647\u0630\u0627 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseRecordingSubmitted:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",openResponseAwaitingReview:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u060C \u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0645\u0631\u0627\u062C\u0639\u0629 \u0627\u0644\u0645\u0639\u0644\u0645",openResponseTeacherFeedbackLabel:"\u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0627\u0644\u0645\u0639\u0644\u0645",openResponseGradeThisResponse:"\u062A\u0635\u062D\u064A\u062D \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",openResponseGradeScoreLabel:e=>`\u0627\u0644\u062F\u0631\u062C\u0629 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 ${e})`,openResponseGradeFeedbackLabel:"\u0645\u0644\u0627\u062D\u0638\u0627\u062A (\u0627\u062E\u062A\u064A\u0627\u0631\u064A)",openResponseGradeFeedbackPlaceholder:"\u0623\u0636\u0641 \u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0644\u0644\u0637\u0627\u0644\u0628\u2026",openResponseSubmitGrade:"\u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629",openResponseGradeSubmitted:(e,r)=>`\u062A\u0645 \u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629: ${e} / ${r}`,openResponseRubricTitle:"\u0633\u0644\u0651\u0645 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",openResponseRubricCriterionPoints:(e,r)=>`${e} / ${r} \u0646\u0642\u0637\u0629`,openResponseAiSuggestionTitle:"\u0627\u0642\u062A\u0631\u0627\u062D \u0627\u0644\u062A\u0635\u062D\u064A\u062D \u0627\u0644\u0645\u0633\u0628\u0642 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",openResponseAiSuggestedScore:(e,r)=>`\u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0645\u0642\u062A\u0631\u062D\u0629: ${e} / ${r}`,openResponseAiEvidence:"\u0627\u0644\u0623\u062F\u0644\u0629:",openResponseAiApplySuggestion:"\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0627\u0642\u062A\u0631\u0627\u062D",openResponseStudentAnswerTitle:"\u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0627\u0644\u0628"};var Vo={en:ar,fr:Xr,ar:Jr},It=Ho(null);function te(){return Vn(It)??ar}function kr(e){let r=Vn(It);return e&&Vo[e]||r||ar}function Rr({locale:e,children:r}){let t=kr(e);return Uo(It.Provider,{value:t,children:r})}import{jsx as Qo}from"react/jsx-runtime";import{createContext as Go,useContext as Qn,useMemo as Gn}from"react";var Yo={sm:.875,md:1,lg:1.25,xl:1.5},$t=Go(null);function Ko(e,r){let t={...e??{}};if(r)for(let[n,a]of Object.entries(r))a!==void 0&&(t[n]=a);return t}function Xo(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?Yo[e]??1:1}function _e(e){let r=e??{};return{scale:Xo(r.size),sizeSet:r.size!==void 0,choiceLabels:r.choiceLabels??"marks",choiceColumns:r.choiceColumns,layoutBy:r.layoutBy??"window",motion:r.motion??"full",shuffleSeed:r.shuffleSeed}}function ke(e){let r=Qn($t);return Gn(()=>Ko(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Me(){let e=Qn($t);return Gn(()=>_e(e),[e])}function Re({display:e,children:r}){let t=ke(e);return Qo($t.Provider,{value:t,children:r})}function Ce(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function er(){let{motion:e}=Me();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function Jo(e){let r=2166136261;for(let t=0;t<e.length;t++)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0}function Zo(e){return()=>{e=e+1831565813|0;let r=Math.imul(e^e>>>15,1|e);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function Sr(e,r){let t=[...e],n=Zo(Jo(r));for(let a=t.length-1;a>0;a--){let s=Math.floor(n()*(a+1));[t[a],t[s]]=[t[s],t[a]]}return t}function zt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return V(Yn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=V("strong",{children:r}):t.type==="italic"?r=V("em",{children:r}):t.type==="underline"?r=V("u",{children:r}):t.type==="strike"?r=V("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=V("span",{style:{color:t.attrs.color},children:r}));return V(Yn,{children:r})}return e.type==="paragraph"?V("span",{className:"block",children:e.content?.map((r,t)=>V(zt,{node:r},t))??V("br",{})}):e.type==="hardBreak"?V("br",{}):e.content?V("span",{className:"block",children:e.content.map((r,t)=>V(zt,{node:r},t))}):null}function ns({nodes:e}){return V("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>V(zt,{node:r},t))})}function Kn({hint:e}){let r=te(),[t,n]=et(!1),[a,s]=et(!1),o=ts(null);return Zr(()=>{if(!a)return;let l=p=>{o.current&&!o.current.contains(p.target)&&(s(!1),n(!1))};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[a]),Ve("span",{ref:o,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[V("button",{type:"button",onClick:l=>{l.stopPropagation(),a?(s(!1),n(!1)):(s(!0),n(!0))},className:$e("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&V("span",{className:"player-blank-hint-pop",onClick:l=>l.stopPropagation(),children:V(ns,{nodes:e})})]})}function as(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var os=e=>e.replace(/ {2,}/g,r=>" ".repeat(r.length-1)+" "),ss=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function Zn(e){return(e??[]).some(r=>ss.has(r?.type)||Zn(r?.content))}var Xn=()=>V("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:V("path",{d:"M5 13l4 4L19 7"})}),Jn=()=>V("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:V("path",{d:"M6 6l12 12M18 6L6 18"})});function Br({node:e,validationFeedback:r}){let t=de(),n=te(),a=Me(),s=er(),{id:o,content:i,attrs:c}=e,d=c.shuffle??!1,l="prompt"in c?c.prompt:void 0,p="separator"in c?c.separator??"/":"/",f="pickLimit"in c&&c.pickLimit?c.pickLimit:1,b="layout"in c?c.layout??"row":"row",v=e.type==="inlineChoiceSet",g=JSON.stringify(i),x=d&&a.shuffleSeed!==void 0,y=rs(()=>x?Sr(i,`${a.shuffleSeed}:${o}`):null,[x,a.shuffleSeed,o,g]),[h,_]=et(i);Zr(()=>{x||_(d?as(i):i)},[d,x,g]);let u=y??h,[w,C]=et(new Set),M=r?.showFeedback??!1,$=r?.correctChoiceIds||[];Zr(()=>{let U=X=>{let E=X.answers.find(F=>F.nodeId===o&&F.type==="choiceSet");E&&"selectedIds"in E.answer&&C(new Set(E.answer.selectedIds))};return t.on("answers:prefill",U),()=>t.off("answers:prefill",U)},[o,t]),Zr(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(w)}}})},[w,o,t]);let R=U=>{M||C(X=>{let S=new Set(X);return f===1?S.has(U)?S.delete(U):(S.clear(),S.add(U)):S.has(U)?S.delete(U):S.size<f&&S.add(U),S})},m=U=>os(ae(U.content)),I=U=>{let X=w.has(U),S=$.includes(U);return M?S&&X?"correct":S&&!X?"correct-unchosen":!S&&X?"incorrect":"muted":X?"selected":"idle"},N={idle:"",selected:"player-choice--selected",correct:$e("player-choice--correct",s.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:$e("player-choice--incorrect",s.shake),muted:"player-choice--muted"},q={idle:"",selected:"player-inline-choice--selected",correct:$e("player-inline-choice--correct",s.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:$e("player-inline-choice--incorrect",s.shake),muted:"player-inline-choice--muted"};if(v)return Ve("span",{className:"inline-choice",children:[l&&Ve("span",{className:"mr-2 font-medium",children:[l,f>1?V("span",{className:"ml-1 opacity-60",children:n.chooseN(f)}):null]}),u.map((U,X)=>Ve(es,{children:[V("button",{type:"button",disabled:M,onClick:()=>R(U.id),className:$e("player-inline-choice",q[I(U.id)]),"aria-pressed":w.has(U.id),dangerouslySetInnerHTML:{__html:m(U)}}),X<u.length-1&&V("span",{className:"mx-1",children:p})]},U.id)),c.hint&&c.hint.length>0&&V(Kn,{hint:c.hint})]});let k=a.layoutBy==="box",L=a.choiceColumns?Math.min(a.choiceColumns,u.length):0,D=L?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${L}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},z=u.some(U=>Zn(U.content)),B=a.choiceLabels==="letters",H=U=>n.choiceLetters[U]??String(U+1);return Ve("div",{className:$e("cs-player my-4 space-y-3",k&&"cs-player--box"),children:[l&&Ve("p",{className:"font-medium",children:[l,f>1?Ve("span",{className:"ml-2 text-sm opacity-70",children:["(choose ",f,")"]}):null]}),c.hint&&c.hint.length>0&&V(Kn,{hint:c.hint}),V("div",{className:$e("cs-player__grid",b==="row"&&"cs-player__grid--row"),style:D,children:u.map((U,X)=>{let S=I(U.id),E=S==="incorrect"?"incorrect":S==="correct"||S==="correct-unchosen"?"correct":null;return Ve("button",{type:"button",disabled:M,onClick:()=>R(U.id),className:$e("player-choice",z&&"player-choice--tile",N[S]),"aria-pressed":w.has(U.id),children:[V("span",{className:$e("player-choice__mark",f>1?"player-choice__mark--box":"player-choice__mark--radio",B&&"player-choice__mark--letter"),children:B?H(X):S==="incorrect"?V(Jn,{}):V(Xn,{})}),V("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:m(U)}}),B&&E&&V("span",{className:`player-choice__verdict player-choice__verdict--${E}`,"aria-hidden":"true",children:E==="incorrect"?V(Jn,{}):V(Xn,{})})]},U.id)})})]})}import{Fragment as Ft,jsx as J,jsxs as rt}from"react/jsx-runtime";import{useContext as is,useState as Dt,useEffect as tt,useRef as ea,useCallback as cs}from"react";import Qe from"clsx";function Ot({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return J(Ft,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=J("strong",{children:r}):t.type==="italic"?r=J("em",{children:r}):t.type==="underline"?r=J("u",{children:r}):t.type==="strike"?r=J("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=J("span",{style:{color:t.attrs.color},children:r}));return J(Ft,{children:r})}return e.type==="paragraph"?J("span",{className:"block",children:e.content?.map((r,t)=>J(Ot,{node:r},t))??J("br",{})}):e.type==="hardBreak"?J("br",{}):e.content?J("span",{className:"block",children:e.content.map((r,t)=>J(Ot,{node:r},t))}):null}function ls({nodes:e}){return J("span",{className:"block space-y-1",children:e.map((r,t)=>J(Ot,{node:r},t))})}function ds({hint:e}){let r=te(),[t,n]=Dt(!1),[a,s]=Dt(!1),o=ea(null);return tt(()=>{if(!a)return;let l=p=>{o.current&&!o.current.contains(p.target)&&(s(!1),n(!1))};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[a]),rt("span",{ref:o,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[J("button",{type:"button",onClick:l=>{l.stopPropagation(),a?(s(!1),n(!1)):(s(!0),n(!0))},className:Qe("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&J("span",{className:"player-blank-hint-pop",onClick:l=>l.stopPropagation(),children:J(ls,{nodes:e})})]})}function Wr({node:e,validationFeedback:r}){let t=de(),n=te(),a=er(),{id:s,attrs:o}=e,{placeholder:i="___",width:c="auto",hint:d}=o,l=ea(null),p=i.trim().split(/\s+/).filter(Boolean).length,f=is(xr),b=!f&&c==="auto"&&p>=4,[v,g]=Dt(""),x=r?.showFeedback??!1,y=r?.state,h=y==="validating",_=r?.displayAnswer,u=r?.message;tt(()=>{let $=R=>{let I=R.answers.find(N=>N.nodeId===s&&N.type==="blank");I&&"mode"in I.answer&&I.answer.mode==="typed"&&"text"in I.answer&&g(I.answer.text)};return t.on("answers:prefill",$),()=>t.off("answers:prefill",$)},[s,t]),tt(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:v}}})},[v,s,t]);let w=$=>{g($.target.value)},C=cs(()=>{let $=l.current;$&&($.style.height="auto",$.style.height=`${$.scrollHeight}px`)},[]);tt(()=>{C()},[v,C]);let M=x&&!h;return rt("span",{className:f?"player-blank-cell":Qe("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",b&&"w-full"),children:[J("span",{className:f?"player-blank-cell__box":Qe("relative inline-block shrink-0 min-w-0 max-w-full",b&&"w-full flex-1"),children:M?J("span",{className:Qe("player-typed-blank-feedback",f&&"player-typed-blank-feedback--cell",b&&"w-full",y==="correct"&&Qe("player-typed-blank-feedback--correct",a.hop),y==="partial"&&"player-typed-blank-feedback--partial",y==="incorrect"&&Qe("player-typed-blank-feedback--incorrect",a.wobble)),children:v||J("span",{className:"opacity-40",children:i})}):rt(Ft,{children:[J("textarea",{ref:l,"aria-label":n.blankAnswerAria,placeholder:i,value:v,onChange:w,disabled:x,rows:1,wrap:f?"off":void 0,className:Qe("player-typed-blank",f&&"player-typed-blank--cell",b&&"w-full",h&&"player-typed-blank--pending"),style:f?void 0:c!=="auto"?{width:c}:b?{width:"100%"}:{width:`${Math.max(7,v.length+1)}ch`,maxWidth:"100%"}}),!v&&!h&&!f&&J("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 pointer-events-none text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:"\u270E"}),h&&J("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:J("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),x&&y==="incorrect"&&_&&rt("span",{className:"player-blank-reveal",children:["(",_,")"]}),x&&u&&J("span",{className:Qe("player-blank-feedback",y==="correct"&&"player-blank-feedback--correct",y==="partial"&&"player-blank-feedback--partial",y==="incorrect"&&"player-blank-feedback--incorrect"),children:u}),d&&d.length>0&&J(ds,{hint:d})]})}import{jsx as at,Fragment as ia,jsxs as qt}from"react/jsx-runtime";import{useEffect as ca}from"react";import ot from"clsx";import{useDroppable as Rs,useDndContext as Ss}from"@dnd-kit/core";import{jsx as ps}from"react/jsx-runtime";import{createContext as ms,useCallback as Ge,useContext as us,useEffect as fs,useMemo as ra,useRef as hs,useState as jt}from"react";import{useDndMonitor as gs}from"@dnd-kit/core";var na=ms(null);function ze(){let e=us(na);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function ta(e){let r={};for(let t of e??[])t.type==="blank"&&"mode"in t.answer&&t.answer.mode==="choice"&&"choiceId"in t.answer&&t.answer.choiceId&&(r[t.nodeId]={choiceId:t.answer.choiceId,poolId:t.answer.poolId||"",value:t.answer.value||""});return r}function nt({children:e,initialAnswers:r}){let t=de(),n=ra(()=>ta(r),[r]),[a,s]=jt(n),[o,i]=jt({}),[c,d]=jt({}),l=hs(new Set);fs(()=>{let u=w=>{let C=ta(w.answers);Object.keys(C).length!==0&&s(M=>{if(!Object.entries(C).some(([m,I])=>M[m]?.choiceId!==I.choiceId||M[m]?.poolId!==I.poolId||M[m]?.value!==I.value))return M;let R={...M,...C};return i(m=>{let I={...m};for(let[N,q]of Object.entries(m)){let k=new Set(Object.values(R).filter(L=>L.poolId===N).map(L=>L.choiceId));I[N]={...q,available:new Set(q.choices.map(L=>L.id).filter(L=>!k.has(L)))}}return I}),R})};return t.on("answers:prefill",u),()=>t.off("answers:prefill",u)},[t]);let p=Ge((u,w)=>{i(C=>{let M=C[u];if(!M){let N=new Set;for(let k of Object.values(a))k.poolId===u&&N.add(k.choiceId);let q=new Set(w.map(k=>k.id).filter(k=>!N.has(k)));return{...C,[u]:{choices:w,available:q}}}let $=new Set(M.choices.map(N=>N.id)),R=new Set(w.map(N=>N.id));if(!(w.some(N=>!$.has(N.id))||M.choices.some(N=>!R.has(N.id))))return C;let I=new Set;for(let N of M.available)R.has(N)&&I.add(N);for(let N of w)$.has(N.id)||I.add(N.id);return{...C,[u]:{choices:w,available:I}}})},[a]),f=Ge((u,w)=>{d(C=>{let M=C[u]??[];return M.includes(w)?C:{...C,[u]:[...M,w]}}),!l.current.has(w)&&!a[w]&&(l.current.add(w),t.emit({type:"answer:changed",answer:{nodeId:w,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}}))},[a,t]),b=Ge(u=>(c[u]??[]).find(C=>!a[C])??null,[c,a]),v=Ge((u,w,C,M)=>{s($=>{let R=$[u];return R&&i(m=>{let I=m[R.poolId];if(!I)return m;let N=new Set(I.available);return N.add(R.choiceId),{...m,[R.poolId]:{...I,available:N}}}),{...$,[u]:{choiceId:C,value:M,poolId:w}}}),i($=>{let R=$[w];if(!R)return $;let m=new Set(R.available);return m.delete(C),{...$,[w]:{...R,available:m}}}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:C,poolId:w,value:M}}})},[t]),g=Ge(u=>{let w=a[u];if(!w)return;let{poolId:C,choiceId:M}=w;i($=>{let R=$[C];if(!R)return $;let m=new Set(R.available);return m.add(M),{...$,[C]:{...R,available:m}}}),s($=>{let{[u]:R,...m}=$;return m}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:C,value:""}}})},[a,t]),x=Ge((u,w)=>o[u]?.available.has(w)??!1,[o]),y=Ge((u,w)=>o[u]?.choices.find(C=>C.id===w),[o]),h=Ge(()=>{s({}),i(u=>{let w={};for(let[C,M]of Object.entries(u))w[C]={choices:M.choices,available:new Set(M.choices.map($=>$.id))};return w});for(let[u,w]of Object.entries(c))for(let C of w)t.emit({type:"answer:changed",answer:{nodeId:C,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}})},[c,t]);gs({onDragEnd(u){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:u.active,over:u.over}}))}});let _=ra(()=>({blanks:a,pools:o,registerPool:p,registerBlank:f,fill:v,back:g,isAvailable:x,getChoice:y,firstEmptyBlank:b,resetAllAnswers:h}),[a,o,p,f,v,g,x,y,b,h]);return ps(na.Provider,{value:_,children:e})}import{Fragment as aa,jsx as ce,jsxs as bs}from"react/jsx-runtime";import{useState as Bt,useEffect as sa,useRef as oa,useLayoutEffect as xs}from"react";import ys from"clsx";var vs=typeof window<"u"?xs:sa;function Wt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return ce(aa,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=ce("strong",{children:r}):t.type==="italic"?r=ce("em",{children:r}):t.type==="underline"?r=ce("u",{children:r}):t.type==="strike"?r=ce("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=ce("span",{style:{color:t.attrs.color},children:r}));return ce(aa,{children:r})}return e.type==="paragraph"?ce("span",{className:"block",children:e.content?.map((r,t)=>ce(Wt,{node:r},t))??ce("br",{})}):e.type==="hardBreak"?ce("br",{}):e.content?ce("span",{className:"block",children:e.content.map((r,t)=>ce(Wt,{node:r},t))}):null}function ws({nodes:e}){return ce("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>ce(Wt,{node:r},t))})}function ks({hint:e}){let r=te(),[t,n]=Bt(!1),[a,s]=Bt(!1),[o,i]=Bt(null),c=oa(null),d=oa(null);return sa(()=>{if(!a)return;let b=v=>{let g=v.target;c.current&&!c.current.contains(g)&&d.current&&!d.current.contains(g)&&(s(!1),n(!1))};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[a]),vs(()=>{if(!t){i(null);return}let b=c.current,v=d.current;if(!b||!v)return;let g=b.getBoundingClientRect(),x=v.getBoundingClientRect(),y=8,h=g.top-x.height-y;h<y&&(h=g.bottom+y);let _=g.left+g.width/2-x.width/2;_=Math.max(y,Math.min(_,window.innerWidth-x.width-y)),i({top:h,left:_})},[t]),bs("span",{ref:c,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[ce("button",{type:"button",onClick:b=>{b.stopPropagation(),a?(s(!1),n(!1)):(s(!0),n(!0))},className:ys("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&ce("span",{ref:d,className:"player-blank-hint-pop",onClick:b=>b.stopPropagation(),style:{position:"fixed",top:o?o.top:0,left:o?o.left:0,bottom:"auto",transform:"none",margin:0,visibility:o?"visible":"hidden"},children:ce(ws,{nodes:e})})]})}function Fe({hint:e}){return!e||e.length===0?null:ce(ks,{hint:e})}function qr({node:e,validationFeedback:r}){let{id:t,attrs:n}=e,{poolId:a,placeholder:s="___",hint:o}=n,{blanks:i,fill:c,back:d,getChoice:l,registerBlank:p}=ze(),f=te(),b=er(),v=i[t],g=!!v?.choiceId,x=r?.showFeedback??!1,y=r?.state,h=r?.correctChoiceIds??[],_=x&&y==="incorrect"&&h.length>0?l(a||"",h[0]):void 0,u=_?_.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:w,isOver:C}=Rs({id:t,data:{type:"blank",blankId:t,poolId:a}}),{active:M}=Ss(),$=!!M&&M.data.current?.poolId===a;return ca(()=>{p(a||"",t)},[a,t,p]),ca(()=>{let I=N=>{let q=N,{active:k,over:L}=q.detail||{};if(!L||L.id!==t)return;let{choiceId:D,poolId:z}=k?.data.current||{};if(!D||z!==a)return;let B=l(a||"",D);if(!B)return;let H=B.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,a||"",D,H)};return window.addEventListener("dnd-drop",I),()=>window.removeEventListener("dnd-drop",I)},[t,a,l,c]),qt(ia,{children:[at("span",{ref:w,onClick:()=>{g&&!x&&d(t)},className:ot("player-choice-blank",C&&"player-choice-blank--over",!C&&$&&!g&&!x&&"player-choice-blank--target",g&&!x&&!C&&"player-choice-blank--filled",x&&y==="correct"&&ot("player-choice-blank--correct",b.hop),x&&y==="partial"&&ot("player-choice-blank--partial",b.hop),x&&y==="incorrect"&&ot("player-choice-blank--incorrect",b.wobble)),title:g&&!x?f.clickToRemove:void 0,"data-node-id":t,"data-pool-id":a,children:g?qt(ia,{children:[at("span",{children:v.value}),!x&&at("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):s}),u&&qt("span",{className:"player-blank-reveal",children:["(",u,")"]}),at(Fe,{hint:o})]})}import{jsx as Ut,jsxs as Ns}from"react/jsx-runtime";import{useEffect as da,useState as As}from"react";import Es from"clsx";import{jsx as la}from"react/jsx-runtime";import _s from"clsx";import{useDraggable as Cs}from"@dnd-kit/core";function or({poolId:e,data:r,isInline:t=!1}){let{isAvailable:n,firstEmptyBlank:a,fill:s}=ze(),{id:o,html:i}=r,c=!n(e,o),{setNodeRef:d,attributes:l,listeners:p,transform:f,isDragging:b}=Cs({id:o,data:{type:"choice",choiceId:o,poolId:e,html:i},disabled:c});if(c)return null;let v=h=>h.replace(/<\/?[^>]+(>|$)/g,""),g=()=>{let h=a(e);if(h){let _=v(i);s(h,e,o,_)}},x=f?{transform:`translate3d(${f.x}px, ${f.y}px, 0)`}:void 0;return la(t?"span":"div",{ref:d,style:x,className:_s("player-bank-pill",b&&"player-bank-pill--dragging",t&&"mx-1"),...l,...p,onClick:g,children:la("span",{dangerouslySetInnerHTML:{__html:i},className:"pointer-events-none whitespace-pre-wrap break-words"})})}function Ur({node:e}){let r=te(),{id:t,attrs:n,content:a}=e,{shuffle:s=!0,equalWidth:o=!1}=n,{registerPool:i}=ze(),[c,d]=As(()=>a.map(l=>({id:l.id,html:ae(l.content)})));return da(()=>{let l=a.map(p=>({id:p.id,html:ae(p.content)}));d(s?[...l].map(p=>({v:p,r:Math.random()})).sort((p,f)=>p.r-f.r).map(p=>p.v):l)},[s,JSON.stringify(a)]),da(()=>{i(t,c)},[t,c,i]),Ns("div",{className:"player-word-bank",children:[Ut("div",{className:"player-word-bank__label",children:r.wordBank}),Ut("div",{className:Es("player-word-bank__items",o&&"player-word-bank__items--grid"),children:c.map(l=>Ut(or,{poolId:t,data:l},l.id))})]})}import{jsx as Ht,jsxs as Ps}from"react/jsx-runtime";import{useEffect as pa,useState as Ls}from"react";function Hr({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:a=!0,separator:s=" "}=t,{registerPool:o}=ze(),[i,c]=Ls(()=>n.map(d=>({id:d.id,html:ae(d.content,{stripParagraphs:!0})})));return pa(()=>{let d=n.map(l=>({id:l.id,html:ae(l.content,{stripParagraphs:!0})}));c(a?[...d].map(l=>({v:l,r:Math.random()})).sort((l,p)=>l.r-p.r).map(l=>l.v):d)},[a,JSON.stringify(n)]),pa(()=>{o(r,i)},[r,i,o]),Ht("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:P("0.25rem"),alignItems:"center"},children:i.map((d,l)=>Ps("span",{children:[Ht(or,{poolId:r,data:d,isInline:!0}),l<i.length-1&&Ht("span",{children:s})]},d.id))})}import{jsx as sr,jsxs as Gt}from"react/jsx-runtime";import{useState as Yt,useEffect as Kt,useMemo as $s}from"react";import{Check as zs,X as Fs}from"lucide-react";import{jsx as me,jsxs as rr}from"react/jsx-runtime";import{useState as Vt,useMemo as Qt,useRef as st,useCallback as Ms,useLayoutEffect as Ts}from"react";var ma="#1d2025",ua="#8d93a0",fa="#1f8a4c",ha="#d23b2b",Is=11;function ga({leftItems:e,rightItems:r,connections:t,direction:n,disabled:a,feedback:s,onConnectionsChange:o}){let[i,c]=Vt(null),[d,l]=Vt(null),[p,f]=Vt(new Map),b=st(null),v=st(new Map),g=st("mouse"),x=s?.showFeedback??!1,y=Qt(()=>{let S=new Map;if(s?.pairFeedback)for(let E of s.pairFeedback)S.set(`${E.leftId}-${E.rightId}`,E.correct);return S},[s]),h=Qt(()=>{let S=new Map;return s?.correctPairings?.forEach(E=>S.set(E.leftId,E.rightId)),S},[s]),_=Qt(()=>{let S=new Map;return s?.correctPairings?.forEach(E=>S.set(E.rightId,E.leftId)),S},[s]),u=new Map,w=new Map;t.forEach((S,E)=>{u.set(S.leftId,E),w.set(S.rightId,E)});let C=S=>{let E=t[S];if(!x||!E)return null;let F=y.get(`${E.leftId}-${E.rightId}`);return F===!0?"correct":F===!1?"incorrect":null},M=Ms(()=>{if(!b.current)return;let S=b.current.getBoundingClientRect(),E=new Map;v.current.forEach((F,G)=>{if(F){let Y=F.getBoundingClientRect();E.set(G,new DOMRect(Y.left-S.left,Y.top-S.top,Y.width,Y.height))}}),f(E)},[]);Ts(()=>{M();let S=new ResizeObserver(M);return b.current&&S.observe(b.current),()=>S.disconnect()},[M,t,e,r]);let $=8,R=(S,E)=>{let F=p.get(S);if(!F)return null;let G=F.y+F.height/2;return E==="left"?{x:F.x+F.width,y:G}:{x:F.x-$,y:G}},m=(S,E)=>{if(a)return;let G=(E==="left"?u:w).has(S),Y=i?.id===S&&i?.side===E,be=i!==null&&i.side!==E;if(Y){c(null);return}if(be){let ne=E==="right"?i.id:S,ee=E==="left"?i.id:S,se=t.filter(ie=>ie.leftId!==ne&&ie.rightId!==ee);se.push({leftId:ne,rightId:ee}),o(se),c(null);return}if(G&&!i){let ne=E==="left"?t.filter(ee=>ee.leftId!==S):t.filter(ee=>ee.rightId!==S);o(ne);return}c({id:S,side:E})},I=st(null),N=(S,E,F)=>{if(a||(g.current=F.pointerType,F.pointerType==="touch"))return;F.currentTarget.setPointerCapture(F.pointerId);let G=b.current.getBoundingClientRect();I.current={x:F.clientX-G.left,y:F.clientY-G.top},l({fromId:S,fromSide:E,x:F.clientX-G.left,y:F.clientY-G.top,overId:null,overSide:null})},q=S=>{if(!d)return;let E=b.current.getBoundingClientRect(),F=S.clientX-E.left,G=S.clientY-E.top,Y=d.fromSide==="left"?"right":"left",be=Y==="left"?e:r,ne=null,ee=null;for(let se of be){let ie=p.get(se.id);if(ie&&F>=ie.x&&F<=ie.x+ie.width&&G>=ie.y&&G<=ie.y+ie.height){ne=se.id,ee=Y;break}}l(se=>se?{...se,x:F,y:G,overId:ne,overSide:ee}:null)},k=S=>{if(!d)return;let E=b.current.getBoundingClientRect(),F=S.clientX-E.left,G=S.clientY-E.top,Y=I.current;if((Y?Math.hypot(F-Y.x,G-Y.y):999)<8){l(null),m(d.fromId,d.fromSide);return}if(d.overId&&d.overSide){let ne=d.fromSide==="left"?d.fromId:d.overId,ee=d.fromSide==="right"?d.fromId:d.overId,se=t.filter(ie=>ie.leftId!==ne&&ie.rightId!==ee);se.push({leftId:ne,rightId:ee}),o(se)}l(null),c(null)},L=(S,E)=>{if(!x)return null;let G=(E==="left"?u:w).get(S.id);if(G!==void 0){let Y=t[G];if(y.get(`${Y.leftId}-${Y.rightId}`)===!0)return null}if(E==="left"){let Y=h.get(S.id);return r.find(be=>be.id===Y)?.content??null}else{let Y=_.get(S.id);return e.find(be=>be.id===Y)?.content??null}},D=(S,E)=>{let G=(E==="left"?u:w).get(S.id),Y=G!==void 0,be=i?.id===S.id&&i?.side===E,ne=i!==null&&i.side!==E&&!Y,ee=d?.overId===S.id&&d?.overSide===E,se=Y?C(G):null,ie=Y?G+1:null,we="matching-player__item";Y&&(we+=" matching-player__item--matched"),se==="correct"&&(we+=" matching-player__item--correct"),se==="incorrect"&&(we+=" matching-player__item--incorrect"),be&&(we+=" matching-player__item--selected"),(ne||ee)&&(we+=" matching-player__item--available"),a&&(we+=" matching-player__item--disabled");let Q=L(S,E);return rr("button",{ref:Je=>{Je?v.current.set(S.id,Je):v.current.delete(S.id)},type:"button",className:we,onPointerDown:Je=>N(S.id,E,Je),onClick:()=>{g.current==="touch"&&m(S.id,E)},"aria-pressed":be,children:[E==="right"&&me("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:rr("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[me("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),me("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),Y&&E==="left"&&me("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ie}),me("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:ae(S.content)}}),Q&&rr("span",{className:"matching-player__correct-hint",children:["(",me("span",{dangerouslySetInnerHTML:{__html:ae(Q)}}),")"]}),Y&&E==="right"&&me("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ie}),E==="left"&&me("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:rr("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[me("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),me("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},S.id)},z=n==="ltr"?e:r,B=n==="ltr"?r:e,H=n==="ltr"?"left":"right",U=n==="ltr"?"right":"left";return rr("div",{ref:b,className:`matching-player__arena${d?" matching-player__arena--dragging":""}`,onPointerMove:q,onPointerUp:k,children:[rr("svg",{className:"matching-player__svg","aria-hidden":!0,children:[me("defs",{children:[["mp-arrow-ink",ma],["mp-arrow-correct",fa],["mp-arrow-incorrect",ha],["mp-arrow-ghost",ua]].map(([S,E])=>me("marker",{id:S,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:me("polygon",{points:"0 0, 11 4.5, 0 9",fill:E})},S))}),t.map(S=>{let E=R(S.leftId,"left"),F=R(S.rightId,"right");if(!E||!F)return null;let G=F.x-Is,Y=Math.max(16,Math.abs(G-E.x)*.4),be=`M ${E.x} ${E.y} C ${E.x+Y} ${E.y}, ${G-Y} ${F.y}, ${G} ${F.y}`,ne=x?y.get(`${S.leftId}-${S.rightId}`):void 0;return me("path",{d:be,stroke:ne===!0?fa:ne===!1?ha:ma,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${ne===!0?"mp-arrow-correct":ne===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${S.leftId}-${S.rightId}`)}),d&&(()=>{let S=R(d.fromId,d.fromSide);if(!S)return null;let E=Math.abs(d.x-S.x)*.35,F=`M ${S.x} ${S.y} C ${S.x+E} ${S.y}, ${d.x-E} ${d.y}, ${d.x} ${d.y}`;return me("path",{d:F,stroke:ua,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),rr("div",{className:"matching-player__columns",children:[me("div",{className:"matching-player__column",children:z.map(S=>D(S,H))}),me("div",{className:"matching-player__column",children:B.map(S=>D(S,U))})]})]})}var ba=e=>Number.isInteger(e)?String(e):e.toFixed(2);function xa(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function Vr({node:e,validationFeedback:r}){let t=de(),{shuffleSeed:n,layoutBy:a}=Me(),{id:s,attrs:o,leftItems:i,rightItems:c}=e,{direction:d,shuffle:l,hint:p}=o,f=JSON.stringify(i),b=JSON.stringify(c),v=l&&n!==void 0,g=$s(()=>v?{left:Sr(i,`${n}:${s}:left`),right:Sr(c,`${n}:${s}:right`)}:null,[v,n,s,f,b]),[x,y]=Yt(i),[h,_]=Yt(c);Kt(()=>{v||(l?(y(xa(i)),_(xa(c))):(y(i),_(c)))},[l,v,f,b]);let u=g?.left??x,w=g?.right??h,[C,M]=Yt([]),$=r?.showFeedback??!1;Kt(()=>{let k=L=>{let z=L.answers.find(B=>B.nodeId===s&&B.type==="matchingSet");z&&"connections"in z.answer&&M(z.answer.connections)};return t.on("answers:prefill",k),()=>t.off("answers:prefill",k)},[t,s]),Kt(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"matchingSet",timestamp:Date.now(),answer:{connections:C}}})},[t,s,C]);let R=k=>{$||M(k)},m=r?.score,I=r?.maxScore,N=$&&m!=null&&I!=null,q=N?m>=I?"correct":m>0?"partial":"incorrect":null;return Gt("div",{className:a==="box"?"matching-player matching-player--box":"matching-player",children:[p&&p.length>0&&sr("div",{className:"matching-player-hintrow",children:sr(Fe,{hint:p})}),sr(ga,{leftItems:u,rightItems:w,connections:C,direction:d,disabled:$,feedback:r,onConnectionsChange:R}),N&&Gt("div",{className:"matching-player-feedback matching-player-feedback--"+q,children:[q==="correct"&&sr(zs,{size:15,style:re(15)}),q==="incorrect"&&sr(Fs,{size:15,style:re(15)}),sr("span",{children:q==="correct"?"All matched":q==="partial"?"Partial credit":"Not matched"}),Gt("span",{className:"matching-player-score",children:[ba(m)," / ",ba(I)]})]})]})}import{jsxs as ir,jsx as De,Fragment as Ds}from"react/jsx-runtime";import{useState as ya,useEffect as Xt,useRef as Os,useCallback as va}from"react";import it from"clsx";function Qr({node:e,validationFeedback:r}){let t=de(),n=te(),{id:a,attrs:s}=e,{placeholder:o,minWords:i=0,maxWords:c=500,hint:d}=s,[l,p]=ya(""),[f,b]=ya(0),v=r?.showFeedback??!1,g=r?.state,x=c<=30,y=va(m=>m.trim().split(/\s+/).filter(Boolean).length,[]);Xt(()=>{let m=I=>{let q=I.answers?.find(k=>k.nodeId===a&&k.type==="aiAnswer");if(q&&q.answer?.text!=null){let k=q.answer.text;p(k),b(y(k))}};return t.on("answers:prefill",m),()=>t.off("answers:prefill",m)},[a,t,y]),Xt(()=>{let m=()=>{p(""),b(0)};return t.on("answers:reset",m),()=>t.off("answers:reset",m)},[t]);let h=Os(null),_=va((m,I)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:m,wordCount:I}}})},300)},[a,t]);Xt(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let u=m=>{if(v)return;let I=y(m);p(m),b(I),_(m,I)},w=g==="validating",C=it("player-ai-count",f>c&&"player-ai-count--over"),M=!v||w?"":g==="correct"?"player-ai-input--correct":g==="incorrect"?"player-ai-input--incorrect":g==="partial"?"player-ai-input--partial":"",$=g==="correct"?"player-ai-feedback--correct":g==="incorrect"?"player-ai-feedback--incorrect":g==="partial"?"player-ai-feedback--partial":"",R=m=>Number.isInteger(m)?String(m):m.toFixed(2);return ir("div",{className:"player-ai",children:[ir("div",{className:"player-ai-counts",children:[ir("span",{className:C,children:[f," / ",c," ",n.openResponseWords]}),i>0&&f<i&&De("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),De("span",{style:{marginInlineStart:"auto"},children:De(Fe,{hint:d})})]}),x?De("input",{type:"text",value:l,onChange:m=>u(m.target.value),placeholder:o??n.shortAnswerPlaceholder,"aria-label":n.blankAnswerAria,disabled:v,className:it("player-ai-input",M)}):De("textarea",{value:l,onChange:m=>u(m.target.value),placeholder:o??n.longAnswerPlaceholder,"aria-label":n.blankAnswerAria,disabled:v,rows:5,className:it("player-ai-input player-ai-input--multiline",M)}),v&&r&&De("div",{className:it("player-ai-feedback",$),children:w?ir("div",{className:"player-ai-validating",children:[De("span",{className:"player-ai-spinner"}),De("span",{children:n.aiEvaluationInProgress})]}):ir(Ds,{children:[r.message&&De("p",{className:"player-ai-message",children:r.message}),r.score!=null&&r.maxScore!=null&&De("div",{className:"player-ai-score-row",children:ir("span",{className:"player-ai-score",children:[R(r.score)," / ",R(r.maxScore)]})})]})})]})}import{Fragment as wa,jsx as A,jsxs as K}from"react/jsx-runtime";import{useState as he,useEffect as Ae,useRef as Ne,useCallback as ct}from"react";import{useEditor as js,EditorContent as Bs}from"@tiptap/react";import Ws from"@tiptap/starter-kit";import Oe from"clsx";import{FolderOpen as qs,Mic as Us,Video as Sa,Monitor as Hs,Clock as Vs,Image as Qs,FileText as _a,Music as Gs,Link2 as Ys}from"lucide-react";function Ca(e){return e.trim().split(/\s+/).filter(Boolean).length}function Na(e){return e.length}function Ks(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return Ca(r(e))}function Xs(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return Na(r(e))}function Jt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return A(wa,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=A("strong",{children:r}):t.type==="italic"?r=A("em",{children:r}):t.type==="underline"?r=A("u",{children:r}):t.type==="strike"?r=A("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=A("span",{style:{color:t.attrs.color},children:r}));return A(wa,{children:r})}return e.type==="paragraph"?A("span",{className:"block",children:e.content?.map((r,t)=>A(Jt,{node:r},t))??A("br",{})}):e.type==="hardBreak"?A("br",{}):e.content?A("span",{className:"block",children:e.content.map((r,t)=>A(Jt,{node:r},t))}):null}function Js({nodes:e}){return A("span",{className:"block space-y-1 text-amber-900",children:e.map((r,t)=>A(Jt,{node:r},t))})}function Zs({hint:e}){let r=te(),[t,n]=he(!1),[a,s]=he(!1),o=Ne(null);return Ae(()=>{if(!a)return;let i=c=>{o.current&&!o.current.contains(c.target)&&(s(!1),n(!1))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]),K("span",{ref:o,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[A("button",{type:"button",onClick:i=>{i.stopPropagation(),a?(s(!1),n(!1)):(s(!0),n(!0))},className:Oe("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&A("span",{className:"player-blank-hint-pop",onClick:i=>i.stopPropagation(),children:A(Js,{nodes:e})})]})}function ka(e){if(!isFinite(e.duration)){e.currentTime=1e101;let r=()=>{e.currentTime=0,e.removeEventListener("timeupdate",r)};e.addEventListener("timeupdate",r)}}function ei(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function ri(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function Ra(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function Gr({node:e,validationFeedback:r,readOnly:t=!1,mediaHandler:n}){let a=de(),s=te(),{id:o,attrs:i}=e,{mode:c,placeholder:d,allowFormatting:l,wordLimit:p,characterLimit:f,allowedTypes:b,allowMultiple:v,fileInstructions:g,maxDuration:x,hint:y}=i,h=t||(r?.showFeedback??!1),_=r?.state,u=Ne(null),w=ct(m=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let I=m.files?.map(N=>({url:N.url,mimeType:N.kind==="videoLink"?"video/x-link":N.mimeType,name:N.kind==="videoLink"?void 0:N.name,duration:N.kind==="videoLink"?void 0:N.duration}));a.emit({type:"answer:changed",answer:{nodeId:o,type:"openResponse",timestamp:Date.now(),answer:{...m,files:I}}})},300)},[o,a]);Ae(()=>{w({})},[]);let[C,M]=he([]);Ae(()=>{(c==="file"||c==="text+file")&&c==="file"&&w({files:C})},[C,c]),Ae(()=>{let m=()=>{M([])};return a.on("answers:reset",m),()=>a.off("answers:reset",m)},[a]),Ae(()=>{let m=I=>{let q=(I.answers??[]).find(k=>k.nodeId===o&&k.type==="openResponse");q?.answer?.files&&M(q.answer.files)};return a.on("answers:prefill",m),()=>a.off("answers:prefill",m)},[o,a]);let $=r?.showFeedback,R=Oe(!$&&"player-or-field--pre",$&&_==="correct"&&"player-or-field--correct",$&&_==="partial"&&"player-or-field--partial",$&&_==="incorrect"&&"player-or-field--incorrect",$&&_==="awaiting_review"&&"player-or-field--review");return K("div",{className:"my-3 space-y-2",children:[!h&&y&&y.length>0&&A("div",{className:"flex justify-end",children:A(Zs,{hint:y})}),c==="text"&&A(Aa,{nodeId:o,placeholder:d,allowFormatting:l,wordLimit:p,characterLimit:f,isDisabled:h,feedbackBorderClass:R,emitAnswer:m=>w({text:m}),answerBus:a}),c==="file"&&A(Zt,{allowedTypes:b??["image"],allowMultiple:!!v,fileInstructions:g,isDisabled:h,feedbackBorderClass:R,files:C,setFiles:M,mediaHandler:n,t:s}),(c==="audio"||c==="video"||c==="screen")&&A(si,{kind:c,maxDuration:x,isDisabled:h,feedbackBorderClass:R,mediaHandler:n,emitAnswer:m=>w({recording:m}),t:s}),c==="text+file"&&A(oi,{nodeId:o,placeholder:d,allowFormatting:l,wordLimit:p,characterLimit:f,allowedTypes:b??["image"],allowMultiple:!!v,fileInstructions:g,isDisabled:h,feedbackBorderClass:R,files:C,setFiles:M,emitAnswer:w,answerBus:a,mediaHandler:n,t:s}),r?.showFeedback&&_==="awaiting_review"&&K("div",{className:"flex items-center gap-2 text-sm border rounded px-3 py-2",style:{color:"var(--almost-ink, #8a5a08)",background:"var(--almost-soft, #fbf1dc)",borderColor:"var(--almost, #c8810e)"},children:[A(Vs,{size:15,style:re(15),className:"animate-pulse"}),A("span",{children:s.openResponseAwaitingReview})]}),r?.showFeedback&&_!=="awaiting_review"&&r.teacherFeedback&&A(ii,{feedback:r.teacherFeedback,feedbackState:_,score:r.score,t:s})]})}function Aa({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:s,feedbackBorderClass:o,emitAnswer:i,answerBus:c}){let d=te(),[l,p]=he(""),[f,b]=he(0),[v,g]=he(0),x=Ne(null),y=ct(()=>{let L=x.current;L&&(L.style.height="auto",L.style.height=`${L.scrollHeight}px`)},[]),h=js({extensions:[Ws.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!s,content:"",onUpdate({editor:L}){if(s)return;let z=L.getJSON().content??[],B=Ks(z),H=Xs(z);b(B),g(H),i({content:z,wordCount:B})}});Ae(()=>{h&&h.setEditable(!s)},[s,h]);let _=Ne(null);Ae(()=>{h&&_.current!==null&&(h.commands.setContent({type:"doc",content:_.current}),_.current=null)},[h]),Ae(()=>{let L=D=>{let z=(D.answers??[]).find(H=>H.nodeId===e&&H.type==="openResponse");if(!z?.answer?.text)return;let B=z.answer.text.content??[];if(t)h?h.commands.setContent({type:"doc",content:B}):_.current=B;else{let H=B.flatMap(U=>U.content?.map(X=>X.text??"")??[U.text??""]).join(`
|
|
2
|
+
`);p(H),setTimeout(y,0)}};return c.on("answers:prefill",L),()=>c.off("answers:prefill",L)},[e,c,t,h]),Ae(()=>{let L=()=>{t&&h?h.commands.clearContent():(p(""),setTimeout(y,0)),b(0),g(0)};return c.on("answers:reset",L),()=>c.off("answers:reset",L)},[c,t,h,y]);let u=!!n,w=!!a&&!n,C=u?f:v,M=u?n?.max:a?.max,$=u?n?.min:a?.min,R=M!=null&&C>M,m=M!=null&&C>=M*.8&&!R,I=$!=null&&C<$&&C>0,N="text-xs tabular-nums",q=R?{color:"var(--pen, #d23b2b)",fontWeight:500}:m||I?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},k=u?M?`${f} / ${M} ${d.openResponseWords}`:$?`${f} ${d.openResponseWords} (min. ${$})`:`${f} ${d.openResponseWords}`:w?M?`${v} / ${M} ${d.openResponseChars}`:`${v} ${d.openResponseChars}`:null;return t?K("div",{className:"relative",children:[K("div",{className:Oe("rounded border transition-colors min-h-[120px]",o),children:[!s&&K("div",{className:"sticky top-0 z-10 flex gap-1 px-2 pt-1.5 pb-1 border-b border-gray-100 bg-white rounded-t",children:[[{label:"B",cmd:"toggleBold",style:"font-bold"},{label:"I",cmd:"toggleItalic",style:"italic"}].map(({label:L,cmd:D,style:z})=>A("button",{type:"button",onMouseDown:B=>{B.preventDefault(),h?.chain().focus()?.[D]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${z}`,children:L},L)),A("button",{type:"button",onMouseDown:L=>{L.preventDefault(),h?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),A(Bs,{editor:h,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),k&&A("div",{className:Oe("absolute bottom-2 right-3",N),style:q,children:k})]}):K("div",{className:"relative",children:[A("textarea",{ref:x,value:l,onChange:L=>{if(s)return;let D=L.target.value;p(D);let z=Ca(D),B=Na(D);b(z),g(B),y(),i({content:[{type:"paragraph",content:[{type:"text",text:D}]}],wordCount:z})},onInput:y,disabled:s,placeholder:r||d.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:Oe("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",o,s&&"cursor-default")}),k&&A("div",{className:Oe("absolute bottom-2 right-3",N),children:k})]})}var ti={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},ni={image:A(Qs,{size:12,style:re(12)}),pdf:A(_a,{size:12,style:re(12)}),audio:A(Gs,{size:12,style:re(12)}),video:A(Sa,{size:12,style:re(12)}),videoLink:A(Ys,{size:12,style:re(12)})};function Zt({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:a,setFiles:s,mediaHandler:o,t:i,compact:c=!1}){let d=Ne(null),[l,p]=he(!1),[f,b]=he(!1),[v,g]=he(""),x=e.some(m=>m!=="videoLink"),y=e.includes("videoLink"),h=r||a.length===0,_=e.filter(m=>m!=="videoLink").map(m=>ti[m]).filter(Boolean).join(","),u=ct(m=>{s(I=>r?[...I,m]:[m])},[r,s]),w=ct(m=>{s(I=>I.filter((N,q)=>q!==m))},[s]),C=async m=>{if(!(!h||n)){p(!0);try{let I=m.type.startsWith("image/")?"image":m.type==="application/pdf"?"document":m.type.startsWith("audio/")?"audio":m.type.startsWith("video/")?"video":"file";if(o){let N=await o.upload(m,I);u({kind:"file",url:N.url,mimeType:N.mimeType??m.type,name:m.name})}else{let N=URL.createObjectURL(m);u({kind:"file",url:N,mimeType:m.type,name:m.name})}}finally{p(!1)}}},M=async m=>{if(m.preventDefault(),b(!1),n||!h)return;let I=m.dataTransfer.files?.[0];I&&await C(I)},$=()=>{let m=v.trim();m&&(u({kind:"videoLink",url:m,platform:ei(m)}),g(""))},R={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return K("div",{className:"space-y-2",children:[t&&!c&&A("p",{className:"text-sm text-gray-600 italic",children:t}),a.length>0&&A("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:a.map((m,I)=>A(ai,{file:m,onRemove:n?void 0:()=>w(I),compact:c,t:i},I))}),!n&&h&&K("div",{className:"space-y-2",children:[x&&!c&&K("div",{onDragOver:m=>{m.preventDefault(),b(!0)},onDragLeave:()=>b(!1),onDrop:M,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:f?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:f?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>d.current?.click(),children:[A(qs,{size:26,className:"mx-auto mb-2",style:{...re(26),color:"var(--ink-soft, #565b66)"}}),A("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),A("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),l&&A("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),A("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(m=>m!=="videoLink").map(m=>K("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[ni[m]," ",R[m]]},m))})]}),x&&c&&A("button",{type:"button",onClick:()=>d.current?.click(),disabled:l,className:"text-xs px-3 py-1.5 rounded border border-dashed disabled:opacity-50",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink-soft, #565b66)"},children:l?i.openResponseUploading:`+ ${i.openResponseAttachFile}`}),A("input",{ref:d,type:"file",accept:_,onChange:async m=>{let I=m.target.files?.[0];I&&(await C(I),m.target.value="")},className:"hidden"}),y&&K("div",{className:"flex gap-2 flex-wrap",children:[A("input",{type:"url",value:v,onChange:m=>g(m.target.value),placeholder:i.openResponseVideoLinkPlaceholder,className:"flex-1 text-sm border rounded px-2 py-1.5 outline-none",style:{borderColor:"var(--line-strong, #d6d3cc)"},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),$())}}),A("button",{type:"button",onClick:$,disabled:!v.trim(),className:"text-sm px-3 py-1.5 rounded text-white disabled:opacity-50",style:{background:"var(--ink, #1d2025)"},children:i.openResponseAddVideoLink})]})]}),n&&a.length===0&&A("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function ai({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let a=e.platform==="youtube"?ri(e.url):null;return K("div",{className:Oe("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-3 space-y-1"),children:[a&&!t&&A("iframe",{src:`https://www.youtube.com/embed/${a}`,width:240,height:135,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"rounded w-full"}),A("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 underline truncate block max-w-[200px]",children:e.url}),r&&A("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return K("div",{className:Oe("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-2 flex items-center gap-2"),children:[e.mimeType?.startsWith("image/")?A("img",{src:e.url,alt:e.name??"upload",className:t?"h-6 w-6 object-cover rounded":"h-16 w-16 object-cover rounded"}):e.mimeType?.startsWith("audio/")?A("audio",{src:e.url,controls:!0,className:t?"hidden":"h-8 max-w-[240px]"}):e.mimeType?.startsWith("video/")?A("video",{src:e.url,controls:!0,className:t?"hidden":"h-16 max-w-[240px] rounded"}):A(_a,{size:20,style:{...re(20),color:"var(--ink-soft, #565b66)"}}),K("div",{className:"flex-1 min-w-0",children:[A("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-gray-700 truncate block hover:underline",children:e.name??n.openResponseFile}),t&&e.mimeType?.startsWith("audio/")&&A("audio",{src:e.url,controls:!0,className:"h-6 max-w-[160px] mt-0.5"})]}),r&&A("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function oi({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,allowedTypes:s,allowMultiple:o,fileInstructions:i,isDisabled:c,feedbackBorderClass:d,files:l,setFiles:p,emitAnswer:f,answerBus:b,mediaHandler:v,t:g}){let[x,y]=he(null),[h,_]=he(!1);return Ae(()=>{f({...x&&{text:x},files:l.length>0?l:void 0})},[x,l]),K("div",{className:"space-y-2",children:[A(Aa,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:c,feedbackBorderClass:d,emitAnswer:u=>y(u),answerBus:b}),!c&&K("div",{children:[K("button",{type:"button",onClick:()=>_(!h),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[A("span",{children:h?"\u25BE":"\u25B8"}),K("span",{children:[g.openResponseAttachFiles,l.length>0&&A("span",{className:"ml-1 rounded-full px-1.5 py-0.5 text-[10px]",style:{background:"var(--ui-muted, #f5f4f1)",color:"var(--ink, #1d2025)"},children:l.length})]})]}),h&&A("div",{className:"mt-1.5",children:A(Zt,{allowedTypes:s,allowMultiple:o,fileInstructions:i,isDisabled:c,feedbackBorderClass:d,files:l,setFiles:p,mediaHandler:v,t:g,compact:!0})})]}),c&&l.length>0&&K("div",{className:"space-y-1",children:[A("p",{className:"text-xs text-gray-500 font-medium",children:g.openResponseAttachedFiles}),A(Zt,{allowedTypes:s,allowMultiple:o,isDisabled:!0,feedbackBorderClass:d,files:l,setFiles:p,t:g,compact:!0})]})]})}function si({kind:e,maxDuration:r,isDisabled:t,feedbackBorderClass:n,mediaHandler:a,emitAnswer:s,t:o}){let[i,c]=he("idle"),[d,l]=he(0),[p,f]=he(null),[b,v]=he("audio/webm"),[g,x]=he(null),y=Ne(null),h=Ne(null),_=Ne([]),u=Ne(null),w=Ne(null),C=Ne(null),M=Ne(0);Ae(()=>()=>{$(),u.current&&clearInterval(u.current),cancelAnimationFrame(M.current)},[]),Ae(()=>{i==="recording"&&e==="audio"&&h.current&&q(h.current)},[i]);let $=()=>{h.current?.getTracks().forEach(k=>k.stop()),h.current=null},R=async()=>{if(!a){x(o.openResponseMediaHandlerRequired);return}x(null),c("requesting");try{let k;if(e==="screen"){let z=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1});try{let H=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];H&&z.addTrack(H)}catch{}z.getVideoTracks()[0]?.addEventListener("ended",()=>{y.current?.state==="recording"&&m()}),k=z,w.current&&(w.current.srcObject=k,w.current.play())}else e==="video"?(k=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"environment"}}),w.current&&(w.current.srcObject=k,w.current.play())):k=await navigator.mediaDevices.getUserMedia({audio:!0});h.current=k;let L=e==="audio"?"audio/webm":"video/webm";v(L);let D=new MediaRecorder(k,{mimeType:L});y.current=D,_.current=[],D.ondataavailable=z=>{z.data.size>0&&_.current.push(z.data)},D.onstop=()=>{let z=new Blob(_.current,{type:L}),B=URL.createObjectURL(z);f(B),c("reviewing"),$(),cancelAnimationFrame(M.current)},D.start(200),c("recording"),l(0),u.current=setInterval(()=>{l(z=>{let B=z+1;return r&&B>=r&&m(),B})},1e3)}catch{c("idle"),x(o.openResponsePermissionDenied)}},m=()=>{u.current&&(clearInterval(u.current),u.current=null),y.current?.stop()},I=async()=>{if(!p||!a)return;c("submitted");let L=await(await fetch(p)).blob(),D=e==="screen"?"video":e,z=new File([L],"recording.webm",{type:b}),B=await a.upload(z,D);URL.revokeObjectURL(p),s({url:B.url,mimeType:B.mimeType??b,duration:d,kind:D})},N=()=>{p&&URL.revokeObjectURL(p),f(null),l(0),c("idle")},q=k=>{let L=new AudioContext,D=L.createMediaStreamSource(k),z=L.createAnalyser();z.fftSize=64,D.connect(z);let B=new Uint8Array(z.frequencyBinCount),H=C.current;if(!H)return;let U=()=>{z.getByteFrequencyData(B);let X=H.getContext("2d");if(!X)return;X.clearRect(0,0,H.width,H.height);let S=H.width/B.length*2.5,E=0;for(let F=0;F<B.length;F++){let G=B[F]/255*H.height;X.fillStyle="#1d2025",X.fillRect(E,H.height-G,S,G),E+=S+1}M.current=requestAnimationFrame(U)};U()};return t?A("div",{className:Oe("rounded border p-4 text-center text-sm text-gray-400",n),children:o.openResponseRecordingSubmitted}):K("div",{className:Oe("rounded border p-4 space-y-3",n),children:[g&&A("p",{className:"text-sm",style:{color:"var(--pen, #d23b2b)"},children:g}),(e==="video"||e==="screen")&&i==="recording"&&A("video",{ref:w,muted:!0,className:"w-full rounded max-h-48 bg-black",playsInline:!0}),e==="audio"&&i==="recording"&&A("canvas",{ref:C,width:300,height:48,className:"w-full rounded bg-gray-900"}),i==="reviewing"&&p&&(e==="audio"?A("audio",{src:p,controls:!0,className:"w-full",onLoadedMetadata:k=>ka(k.currentTarget)}):A("video",{src:p,controls:!0,className:"w-full rounded max-h-48",onLoadedMetadata:k=>ka(k.currentTarget)})),K("div",{className:"flex items-center justify-center gap-3",children:[i==="idle"&&K("button",{type:"button",onClick:R,className:"flex flex-col items-center gap-1 px-6 py-3 rounded-full font-medium text-white transition-colors",style:{background:"var(--ink, #1d2025)"},children:[e==="audio"?A(Us,{size:22,style:re(22)}):e==="screen"?A(Hs,{size:22,style:re(22)}):A(Sa,{size:22,style:re(22)}),A("span",{className:"text-sm",children:e==="screen"?o.openResponseTapToRecordScreen:o.openResponseTapToRecord})]}),i==="requesting"&&A("p",{className:"text-sm text-gray-500 animate-pulse",children:o.openResponseRequestingPermission}),i==="recording"&&K("div",{className:"flex flex-col items-center gap-2",children:[K("div",{className:"flex items-center gap-2 font-mono text-lg",style:{color:"var(--pen, #d23b2b)"},children:[A("span",{className:"animate-pulse",children:"\u25CF"}),A("span",{children:Ra(d)}),r&&K("span",{className:"text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:["/ ",Ra(r)]})]}),A("button",{type:"button",onClick:m,className:"px-5 py-2 rounded-full text-white text-sm font-medium",style:{background:"var(--pen, #d23b2b)"},children:o.openResponseStopRecording})]}),i==="reviewing"&&K("div",{className:"flex gap-2",children:[A("button",{type:"button",onClick:N,className:"px-4 py-1.5 rounded border text-sm",style:{borderColor:"var(--line-strong, #d6d3cc)",color:"var(--ink, #1d2025)"},children:o.openResponseReRecord}),A("button",{type:"button",onClick:I,className:"px-4 py-1.5 rounded text-white text-sm",style:{background:"var(--ink, #1d2025)"},children:o.openResponseConfirmRecording})]}),i==="submitted"&&K("p",{className:"text-sm",style:{color:"var(--ok, #1f8a4c)"},children:["\u2713 ",o.openResponseRecordingSubmitted]})]})]})}function ii({feedback:e,feedbackState:r,score:t,t:n}){let a=r==="correct"?{bg:"var(--ok-soft, #ecf8f0)",border:"var(--ok, #1f8a4c)",ink:"var(--ok, #1f8a4c)"}:r==="incorrect"?{bg:"var(--pen-soft, #fdeeec)",border:"var(--pen, #d23b2b)",ink:"var(--pen, #d23b2b)"}:{bg:"var(--almost-soft, #fbf1dc)",border:"var(--almost, #c8810e)",ink:"var(--almost-ink, #8a5a08)"};return K("div",{className:"rounded p-3 text-sm border",style:{background:a.bg,borderColor:a.border,color:"var(--ink, #1d2025)"},children:[A("p",{className:"text-xs font-medium mb-1 opacity-70",children:n.openResponseTeacherFeedbackLabel}),e.flatMap(s=>s.content?.map(o=>o.text??"")??[s.text??""]).join(" "),t!=null&&K("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:P("1.4rem"),lineHeight:1,color:a.ink},children:[t," pts"]})]})}import{jsx as Ye,jsxs as cr,Fragment as Ea}from"react/jsx-runtime";import{useEffect as en,useRef as ci,useState as Pa}from"react";function li(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function Yr({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:a=!1}){let s=de(),o=ci(null),[i,c]=Pa(""),[d,l]=Pa(!1),p=li(n),f=n?.score,b=n?.maxScore,v=y=>Number.isInteger(y)?String(y):y.toFixed(2);en(()=>{import("mathlive").then(()=>{l(!0)}).catch(()=>{})},[]),en(()=>{let y=h=>{let _=h.answers?.find(u=>u.nodeId===e&&u.type==="mathResponse");_?.answer?.latex!==void 0&&(c(_.answer.latex),o.current&&(o.current.value=_.answer.latex))};return s.on("answers:prefill",y),()=>s.off("answers:prefill",y)},[s,e]),en(()=>{s.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:i}}})},[i,e,s]);let g=y=>{let h=y.target?.value??"";c(h)},x=p==="correct"?"player-math-field--correct":p==="incorrect"?"player-math-field--incorrect":p==="validating"?"player-math-field--validating":"";return cr("div",{dir:"ltr",className:"math-response-player",children:[cr("span",{style:{display:"inline-flex",alignItems:"center",gap:P("0.4rem")},children:[Ye("div",{className:"player-math-field"+(x?" "+x:"")+(a?" player-math-field--readonly":""),children:d?Ye("math-field",{ref:o,value:i,onInput:g,"virtual-keyboard-mode":"onfocus","smart-fence":"true",className:"player-math-field__input",style:{opacity:a?.7:1,pointerEvents:a?"none":"auto"}}):Ye("input",{type:"text",value:i,onChange:y=>c(y.target.value),placeholder:r||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:a,className:"player-math-field__fallback"})}),Ye(Fe,{hint:t})]}),n?.showFeedback&&cr("div",{className:"player-math-feedback player-math-feedback--"+p,children:[p==="validating"&&cr(Ea,{children:[Ye("span",{className:"player-math-spinner"}),Ye("span",{children:"Checking your answer\u2026"})]}),p==="correct"&&cr(Ea,{children:[Ye("span",{children:"\u2713 Correct"}),f!=null&&cr("span",{className:"player-math-score",children:[v(f),b!=null?` / ${v(b)}`:""]})]}),p==="incorrect"&&Ye("span",{children:"\u2717 Incorrect"})]})]})}import{jsx as Z,jsxs as pe,Fragment as Nr}from"react/jsx-runtime";import{useCallback as Ci,useEffect as Ni,useRef as Ai,useState as Cr}from"react";import{Play as Ei,Lock as Pi,Check as tn,X as Ta}from"lucide-react";function pt(e,r){if(e===r)return!0;if(e===null||r===null||typeof e!=typeof r||typeof e!="object")return!1;let t=Array.isArray(e),n=Array.isArray(r);if(t!==n)return!1;if(t&&n){let c=e,d=r;return c.length!==d.length?!1:c.every((l,p)=>pt(l,d[p]))}let a=e,s=r,o=Object.keys(a),i=Object.keys(s);return o.length!==i.length?!1:o.every(c=>pt(a[c],s[c]))}var di=`
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
5
|
// Capture console output for stdio mode
|
|
@@ -36,17 +36,17 @@ self.onmessage = async function(e) {
|
|
|
36
36
|
self.postMessage({ testId, passed: false, stderr: String(err), errored: true, durationMs: Date.now() - start });
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
`;async function
|
|
39
|
+
`;async function pi(e,r,t,n,a,s,o,i,c){return new Promise(d=>{let l=new Blob([di],{type:"text/javascript"}),p=URL.createObjectURL(l),f=new Worker(p),b=setTimeout(()=>{f.terminate(),URL.revokeObjectURL(p),d({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);f.onmessage=v=>{clearTimeout(b),f.terminate(),URL.revokeObjectURL(p);let g=v.data;if(r==="function"&&!g.errored){let x=pt(g.actual,s);d({testId:n,passed:x,actual:g.actual,stderr:g.stderr,durationMs:g.durationMs})}else d({testId:n,passed:g.passed??!1,actualStdout:g.actualStdout,stderr:g.stderr,durationMs:g.durationMs,errored:g.errored})},f.onerror=v=>{clearTimeout(b),f.terminate(),URL.revokeObjectURL(p),d({testId:n,passed:!1,stderr:v.message,errored:!0})},f.postMessage({testId:n,source:e,mode:r,entryFunction:t,args:a,expectedStdout:i,timeout:c})})}var mi="0.27.7";function ui(){let e=globalThis.EDPIRE_PYODIDE_INDEX_URL;return typeof e=="string"&&e?e.endsWith("/")?e:e+"/":`https://cdn.jsdelivr.net/pyodide/v${globalThis.EDPIRE_PYODIDE_VERSION||mi}/full/`}var _r=null;function fi(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():_r||(_r=new Promise((r,t)=>{if(typeof document>"u"){t(new Error("Pyodide can only be loaded in a browser environment"));return}let n=document.createElement("script");n.src=`${e}pyodide.js`,n.async=!0,n.onload=()=>r(),n.onerror=()=>{_r=null,t(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),_r)}var lt=null;async function hi(){if(lt)return lt;let e=ui();await fi(e);let r=globalThis.loadPyodide;if(typeof r!="function")throw new Error("Pyodide global not available after loading the CDN script");return lt=await r({indexURL:e}),lt}async function gi(e,r,t,n,a,s,o,i,c){let d=Date.now();try{let l=await hi();if(r==="stdio"){l.runPython(`
|
|
40
40
|
import sys, io
|
|
41
41
|
_stdout_capture = io.StringIO()
|
|
42
42
|
sys.stdout = _stdout_capture
|
|
43
|
-
`),
|
|
43
|
+
`),o&&l.runPython(`
|
|
44
44
|
import io
|
|
45
|
-
sys.stdin = io.StringIO(${JSON.stringify(
|
|
46
|
-
`),l.runPython(e);let
|
|
47
|
-
`),d=c.trim()===(n||"").trim();return s.close(),{testId:r,passed:d,actualStdout:c,durationMs:Date.now()-o}}catch(a){return{testId:r,passed:!1,stderr:String(a),errored:!0,durationMs:Date.now()-o}}}async function ni(e){let{transform:r}=await import("./esm-RQP7AIMT.mjs");return r(e,{transforms:["typescript"]}).code}var lr=class{supports(r){return["javascript","typescript","python","sql"].includes(r)}async run(r){let{language:t,source:n,mode:o,entryFunction:a,tests:s,timeoutMs:i=5e3}=r;if(!this.supports(t))return s.map(l=>({testId:l.id,passed:!1,stderr:`Language "${t}" cannot run in-browser. Configure a RemoteExecutor for compiled languages.`,errored:!0}));let c=n;if(t==="typescript")try{c=await ni(n)}catch(l){return s.map(m=>({testId:m.id,passed:!1,stderr:`TypeScript compile error: ${l.message}`,errored:!0}))}let d=[];for(let l of s){let m;t==="python"?m=await ei(c,o,a,l.id,l.args,l.expectedReturn,l.stdin,l.expectedStdout,i):t==="sql"?m=await ti(c,l.id,l.stdin,l.expectedStdout):m=await Ys(c,o,a,l.id,l.args,l.expectedReturn,l.stdin,l.expectedStdout,i),d.push(m)}return d}};import{jsx as ko}from"react/jsx-runtime";import{forwardRef as oi,useEffect as ai,useImperativeHandle as si,useRef as ii,useState as ci}from"react";function li(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Qt=oi(function({value:r,onChange:t,language:n="javascript",readOnly:o=!1,readOnlyRanges:a,placeholder:s,height:i=300,className:c,autoFocus:d},l){let[m,y]=ci(null),{scale:b}=Ie(),S=ii(null);ai(()=>{import("./dist-RXTJ74FF.mjs").then(h=>{y(()=>h.default)}).catch(()=>{})},[]),si(l,()=>({getValue(){return S.current?.getValue?.()??r},focus(){S.current?.focus?.()},insert(h){let _=S.current;if(!_)return;let u=_.getSelection();_.executeEdits("insert",[{range:u,text:h,forceMoveMarkers:!0}])}}));function f(h){S.current=h,d&&h.focus(),a?.length&&h.onDidAttemptReadOnlyEdit(()=>{})}function g(h){t(h??"")}let w=typeof i=="number"?i*b:i;return m?ko(m,{className:c,height:w,language:li(n),value:r,onChange:g,onMount:f,options:{readOnly:o,minimap:{enabled:!1},fontSize:14*b,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):ko("textarea",{className:c,value:r,onChange:h=>t(h.target.value),readOnly:o,placeholder:s,style:{width:"100%",height:typeof i=="number"?L(i):i,fontFamily:"monospace",fontSize:L(14),padding:L("0.5rem"),border:"1px solid #e2e8f0",borderRadius:L("0.375rem"),resize:"vertical",background:o?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:d})});var hi=new lr;function gi(e){return e?.showFeedback?e.state??"idle":"idle"}function Ro(e){let r={};for(let t of e.attrs.starters??[])r[t.language]=t.code;return r}function bi({sample:e,result:r,mode:t}){let n=r?.passed,o=r?.errored,a=r!==void 0,s=a?o?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=a?o?"\u26A0":null:"\u25CB";return pe("div",{style:{padding:`${L("0.5rem")} ${L("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:L("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[pe("div",{style:{display:"flex",alignItems:"center",gap:L("0.5rem")},children:[Z("span",{style:{color:s,fontWeight:700,fontSize:L("0.875rem"),display:"inline-flex"},children:i??(n?Z(Gt,{size:15,style:re(15)}):Z(So,{size:15}))}),Z("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),a&&!n&&pe("div",{style:{marginTop:L("0.25rem"),paddingLeft:L("1.5rem")},children:[t==="function"?Z(Rr,{children:r?.actual!==void 0&&pe("div",{style:{color:"var(--ink-soft, #565b66)"},children:[Z("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),Z("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(r.actual)}),Z("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),Z("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):Z(Rr,{children:r?.actualStdout!==void 0&&pe("div",{style:{color:"var(--ink-soft, #565b66)"},children:[pe("div",{children:[Z("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),Z("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:r.actualStdout||"(empty)"})]}),pe("div",{children:[Z("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),Z("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),r?.stderr&&Z("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:L("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function Qr({node:e,validationFeedback:r,readOnly:t=!1,executor:n=hi,gradingTests:o}){let a=de(),s=mi(null),{attrs:i}=e,c=e.id,[d,l]=kr(i.defaultLanguage),[m,y]=kr(()=>Ro(e)),[b,S]=kr([]),[f,g]=kr(!1),[w,h]=kr(!1),_=m[d]??"",u=gi(r);pi(()=>{let v=F=>{let z=F.answers?.find(j=>j.nodeId===c&&j.type==="codingResponse");z?.answer&&(z.answer.language&&l(z.answer.language),z.answer.sourceByLanguage&&y(z.answer.sourceByLanguage),z.answer.testResults&&S(z.answer.testResults))},M=()=>{y(Ro(e)),S([]),h(!1)};return a.on("answers:prefill",v),a.on("answers:reset",M),()=>{a.off("answers:prefill",v),a.off("answers:reset",M)}},[a,c,e]);let x=di((v,M,F)=>{a.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:v,sourceByLanguage:M,source:M[v]??"",testResults:F}}})},[a,c]),N=v=>{let M={...m,[d]:v};y(M),x(d,M,b)},C=v=>{l(v),S([]),x(v,m,[])},$=async()=>{if(f)return;g(!0),S([]);let v=o??i.visibleSamples??[];if(v.length===0){g(!1);return}try{let M=await n.run({language:d,source:_,mode:i.testMode,entryFunction:i.entryFunction,tests:v,timeoutMs:5e3});S(M),x(d,m,M)}catch(M){let F=v.map(z=>({testId:z.id,passed:!1,stderr:String(M),errored:!0}));S(F),x(d,m,F)}finally{g(!1)}},k=()=>{w||(h(!0),x(d,m,b))},p=(o??[]).filter(v=>v.hidden).length,T=p>0?b.filter(v=>(o??[]).find(F=>F.id===v.testId)?.hidden&&v.passed).length:0,E=o?o.filter(v=>!v.hidden):i.visibleSamples??[],W=u==="correct"?"var(--ok, #1f8a4c)":u==="partial"?"var(--almost, #c8810e)":u==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return pe("div",{style:{margin:`${L("0.75rem")} 0`,border:`1px solid ${W}`,borderRadius:L("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[pe("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${L("0.5rem")} ${L("0.75rem")}`,display:"flex",alignItems:"center",gap:L("0.5rem"),flexWrap:"wrap"},children:[Z("div",{style:{display:"flex",gap:L("0.25rem")},children:i.languages.map(v=>Z("button",{onClick:()=>!t&&C(v),disabled:t,style:{padding:`${L("0.2rem")} ${L("0.6rem")}`,borderRadius:L("0.375rem"),border:"1px solid",borderColor:d===v?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:d===v?"var(--ink, #1d2025)":"var(--card, #fff)",color:d===v?"#fff":"var(--ink-soft, #565b66)",fontSize:L("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:v},v))}),Z("div",{style:{flex:1}}),Z(De,{hint:i.hint}),!t&&pe(Rr,{children:[pe("button",{onClick:$,disabled:f,style:{padding:`${L("0.25rem")} ${L("0.75rem")}`,borderRadius:L("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:f?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:L("0.8125rem"),fontWeight:600,cursor:f?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:L("0.35rem")},children:[Z(ui,{size:13,style:re(13)})," ",f?"Running\u2026":"Run"]}),pe("button",{onClick:k,disabled:w,style:{padding:`${L("0.3rem")} ${L("0.85rem")}`,borderRadius:L("0.5rem"),border:"none",background:w?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:w?"var(--ok, #1f8a4c)":"#fff",fontSize:L("0.8125rem"),fontWeight:600,cursor:w?"default":"pointer",display:"inline-flex",alignItems:"center",gap:L("0.35rem")},children:[w&&Z(Gt,{size:13,style:re(13)})," ",w?"Submitted":"Submit"]})]})]}),Z(Qt,{ref:s,value:_,onChange:N,language:d,readOnly:t,readOnlyRanges:i.starters.find(v=>v.language===d)?.readOnlyRanges,height:320}),(b.length>0||E.length>0)&&pe("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[Z("div",{style:{padding:`${L("0.5rem")} ${L("0.75rem")}`,fontSize:L("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),E.map(v=>Z(bi,{sample:v,result:b.find(M=>M.testId===v.id),mode:i.testMode},v.id)),p>0&&pe("div",{style:{padding:`${L("0.5rem")} ${L("0.75rem")}`,fontSize:L("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:L("0.4rem")},children:[Z(fi,{size:13,style:re(13)})," Hidden tests: ",T,"/",p," passed"]})]}),r?.showFeedback&&pe("div",{style:{padding:`${L("0.55rem")} ${L("0.75rem")}`,fontSize:L("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:L("0.45rem"),background:u==="correct"?"var(--ok-soft, #ecf8f0)":u==="partial"?"var(--almost-soft, #fbf1dc)":u==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:u==="correct"?"var(--ok, #1f8a4c)":u==="partial"?"var(--almost-ink, #8a5a08)":u==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[u==="correct"&&pe(Rr,{children:[Z(Gt,{size:15,style:re(15)})," All tests passed"]}),u==="partial"&&"Partial credit",u==="incorrect"&&pe(Rr,{children:[Z(So,{size:15,style:re(15)})," Tests failed"]}),u==="validating"&&"Evaluating\u2026",u==="awaiting_review"&&"Awaiting teacher review",r.score!==void 0&&pe("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:L("1.5rem"),lineHeight:1},children:[r.score," / ",r.maxScore??i.maxScore]})]})]})}import{Fragment as vi,jsx as Xt,jsxs as wi}from"react/jsx-runtime";import{createContext as ki,useContext as Ri}from"react";import{DndContext as Si,MouseSensor as _i,TouchSensor as Ni,KeyboardSensor as Ai,useSensor as Jt,useSensors as Ci}from"@dnd-kit/core";import{jsx as Yt}from"react/jsx-runtime";import{DragOverlay as xi,useDndContext as yi}from"@dnd-kit/core";function Kt(){let{active:e}=yi();if(!e)return null;let r=e.data.current?.html??"";return Yt(xi,{dropAnimation:null,children:Yt("div",{style:{display:"inline-block",padding:"0.375rem 0.75rem",borderRadius:"9999px",backgroundColor:"white",border:"1px solid #e5e7eb",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",cursor:"grabbing",maxWidth:"20rem"},children:Yt("span",{dangerouslySetInnerHTML:{__html:r},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}var _o=ki(!1),Ei={acceleration:3,threshold:{x:0,y:.12}};function lt({children:e}){let r=Ri(_o),t=Jt(_i,{activationConstraint:{distance:8}}),n=Jt(Ni,{activationConstraint:{delay:250,tolerance:5}}),o=Jt(Ai),a=Ci(t,n,o);return r?Xt(vi,{children:e}):Xt(_o.Provider,{value:!0,children:wi(Si,{sensors:a,autoScroll:Ei,children:[e,Xt(Kt,{})]})})}function pr({content:e,onAnswersChange:r,onSubmit:t,answerBus:n,namespace:o,initialAnswers:a,validationFeedback:s,className:i="",locale:c,readOnly:d=!1,mediaHandler:l,codeExecutor:m,display:y}){let b=ke(y),S=Pi(()=>_e(b),[b]),f=Mi(null);f.current||(f.current=new qe);let g=n??f.current;dt(()=>{a&&a.length>0&&g.prefillAnswers(a)},[a,g]),dt(()=>{if(!r)return;let h=()=>{let _=g.getAllAnswers();r(_)};return g.on("answer:changed",h),()=>g.off("answer:changed",h)},[g,r]),dt(()=>{if(!t)return;let h=_=>{t(_.answers)};return g.on("answer:submitted",h),()=>g.off("answer:submitted",h)},[g,t]),dt(()=>{document.querySelectorAll("[data-audio]").forEach(_=>{let u=_.querySelector("audio"),x=_.querySelector("svg");!u||!x||(_.onclick=()=>{u.paused?(u.play(),x.innerHTML='<path d="M6 4h4v16H6zm8 0h4v16h-4z"/>',x.dataset.icon="pause"):(u.pause(),x.innerHTML='<path d="M6 4v16l12-8z"/>',x.dataset.icon="play")},u.onended=()=>{x.innerHTML='<path d="M6 4v16l12-8z"/>',x.dataset.icon="play"})})},[e]);let w=Se(e,s,{readOnly:d,mediaHandler:l,codeExecutor:m});return dr(yr,{locale:c,children:dr(Re,{display:b,children:dr($r,{bus:g,children:dr(lt,{children:dr(et,{initialAnswers:a,children:dr("div",{className:`question-runtime ${i}${S.sizeSet?" edp-scaled":""}`,"data-namespace":o,style:{fontSize:L("1.125rem"),lineHeight:"1.75",...Ne(S)},children:w})})})})})})}import{jsx as mr,jsxs as ut}from"react/jsx-runtime";import{memo as $i,useCallback as Po,useMemo as zi,useRef as Eo}from"react";var No={words:80,media:1,tableRows:6},Ii=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function Ao(e){let r={words:0,media:0,tableRows:0},t=n=>{if(typeof n.text=="string"&&(r.words+=n.text.split(/\s+/).filter(o=>/[\p{L}\p{N}]/u.test(o)).length),n.type&&Ii.has(n.type)&&r.media++,n.type==="table"){let o=(n.content??[]).filter(a=>a.type==="tableRow").length;r.tableRows=Math.max(r.tableRows,o)}for(let o of n.content??[])t(o)};return e&&t(e),r}function Sr(e,r=No){let t=Ao(e);return t.words>r.words||t.media>r.media||t.tableRows>r.tableRows}import{createContext as Li,useContext as Ti}from"react";var Co=Li(null),pt=Co.Provider;function mt(){return Ti(Co)}function ft({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:o,renderSeparator:a,className:s="",locale:i,display:c}){let d=ke(c),l=zi(()=>_e(d),[d]),m=Eo(new Map),y=Eo({exercise:e,onAnswersChange:r});y.current={exercise:e,onAnswersChange:r};let b=Po((h,_)=>{m.current.set(h,_);let{exercise:u,onAnswersChange:x}=y.current;if(x){let N={exerciseId:u.id,questionAnswers:u.questions.map(C=>({questionId:C.id,answers:m.current.get(C.id)??[]}))};x(N)}},[]),S=mt(),f=xr(i),g=!!(S&&e.sharedContext&&Sr(e.sharedContext)),w=e.sharedContext?g?ut("p",{className:"exercise-reference-cue",children:[mr("span",{children:f.referenceInPanel(S.label)})," ",ut("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>S.showExerciseReference(e.id),children:[f.readReference,mr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):mr("div",{className:"exercise-shared-context",children:Se(e.sharedContext)}):null;return mr(Re,{display:d,children:ut("div",{className:`exercise-runtime ${s}`,style:Ne(l),children:[w&&(n?n(w):w),e.questions.map((h,_)=>{let u=t?.get(h.id),x=mr(Di,{questionId:h.id,content:h.content,onQuestionAnswers:b,validationFeedback:u,locale:i},h.id);return ut("div",{children:[o?o(h,x,_):x,a&&_<e.questions.length-1?a(_):null]},h.id)})]})})}var Di=$i(function({questionId:r,content:t,onQuestionAnswers:n,validationFeedback:o,locale:a}){let s=Po(i=>n(r,i),[n,r]);return mr(pr,{content:t,onAnswersChange:s,validationFeedback:o,locale:a})});import{jsx as Zt,jsxs as Fi}from"react/jsx-runtime";import{useCallback as Oi,useEffect as ji,useMemo as Bi,useRef as Mo}from"react";function Ke({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:o,renderSeparator:a,className:s="",brandingConfig:i,locale:c,display:d}){let l=Mo(new Map),m=ke(d),y=Bi(()=>_e(m),[m]);ji(()=>{if(!i?.fontUrl)return;let g=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(g))return;let w=document.createElement("link");w.id=g,w.rel="stylesheet",w.href=i.fontUrl,document.head.appendChild(w)},[i?.fontUrl]);let b={...Ne(y)};i?.fontFamily&&(b["--brand-font"]=i.fontFamily);let S=Mo({assessment:e,onAnswersChange:r});S.current={assessment:e,onAnswersChange:r};let f=Oi(g=>{l.current.set(g.exerciseId,g);let{assessment:w,onAnswersChange:h}=S.current;if(h){let _={exerciseAnswers:w.exercises.map(u=>l.current.get(u.id)??{exerciseId:u.id,questionAnswers:[]})};h(_)}},[]);return Zt(Re,{display:m,children:Zt("div",{className:`assessment-runtime ${s}`,style:Object.keys(b).length?b:void 0,children:e.exercises.map((g,w)=>{let h=t?.get(g.id),_=Zt(ft,{exercise:g,onAnswersChange:f,validationFeedback:h,renderSharedContext:o?u=>o(u,g):void 0,locale:c},g.id);return Fi("div",{children:[n?n(g,_,w):_,a&&w<e.exercises.length-1?a(w):null]},g.id)})})})}import{jsx as Io}from"react/jsx-runtime";import{useMemo as qi}from"react";function ur({content:e,className:r,display:t}){let n=ke(t),o=qi(()=>_e(n),[n]);return Io(Re,{display:n,children:Io("div",{className:`content-view ${r??""}`,style:Ne(o),children:Se(e)})})}import{jsx as _r,Fragment as Lo,jsxs as ht}from"react/jsx-runtime";import{useMemo as Wi}from"react";function Nr({item:e,className:r,renderFigureLabel:t,display:n}){let o=ke(n),a=Wi(()=>_e(o),[o]);return _r(Re,{display:o,children:ht("div",{className:`annex-item-view ${r??""}${a.sizeSet?" edp-scaled":""}`,style:Ne(a),children:[e.type==="text-document"&&ht(Lo,{children:[e.title&&_r("h3",{className:"text-base font-semibold mb-2",children:e.title}),Se(e.content)]}),e.type==="figure"&&ht("figure",{children:[Se(e.content),_r("figcaption",{children:t?t(e.label):_r("span",{children:e.label})})]}),e.type==="rich-block"&&ht(Lo,{children:[e.title&&_r("h3",{className:"text-base font-semibold mb-2",children:e.title}),Se(e.content)]})]})})}import{jsx as Dm,jsxs as Fm}from"react/jsx-runtime";import{useState as jm}from"react";import{jsx as Vm,jsxs as Qm}from"react/jsx-runtime";import{useState as Ym,useCallback as Km,useMemo as Xm}from"react";import{useEditor as Zm,EditorContent as eu}from"@tiptap/react";import tu from"@tiptap/starter-kit";import{jsx as su,jsxs as iu,Fragment as cu}from"react/jsx-runtime";import{useMemo as du,useState as pu}from"react";function tr(e,{insertAt:r}={}){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",r==="top"&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}tr(`:root{--ink: #1d2025;--ink-soft: #565b66;--ink-faint: #8d93a0;--ui-muted: #f5f4f1;--line: #e7e5e0;--line-strong: #d6d3cc;--ok: #1f8a4c;--ok-soft: #ecf8f0;--pen: #d23b2b;--pen-soft: #fdeeec;--almost: #c8810e;--almost-ink: #8a5a08;--almost-soft: #fbf1dc;--font-hand: "Caveat", cursive}@keyframes answer-shake{10%,90%{transform:translate(-2px)}20%,80%{transform:translate(4px)}30%,50%,70%{transform:translate(-6px)}40%,60%{transform:translate(6px)}}@keyframes hop{0%,to{transform:translateY(0) scale(1)}40%{transform:translateY(-6%) scale(1.05)}}@keyframes wobble{0%,to{transform:translate(0)}15%,85%{transform:translate(-4px)}30%,70%{transform:translate(4px)}45%,55%{transform:translate(-2px)}}.animate-shake{animation:answer-shake .4s both}.animate-hop{animation:hop .5s ease-out}.animate-wobble{animation:wobble .5s ease}.cs-player__grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:repeat(1,minmax(0,1fr))}@media(min-width:40rem){:where(.cs-player:not(.cs-player--box)) .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.cs-player--box{container-type:inline-size}@container (min-width: 35.5em){.cs-player--box .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.player-choice{position:relative;display:inline-flex;align-items:center;gap:calc(.75rem * var(--edp-scale, 1));flex-wrap:wrap;width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:1.5px solid var(--line, #e7e5e0);border-radius:calc(.75rem * var(--edp-scale, 1));background-color:#fff;color:var(--ink, #1d2025);cursor:pointer;user-select:none;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;font-weight:500;text-align:start}.player-choice:hover:not(:disabled){background-color:var(--ui-muted, #f5f4f1);border-color:var(--line-strong, #d6d3cc)}.player-choice:disabled{cursor:default}.player-choice>img{flex-shrink:0}.player-choice__mark{flex:none;display:grid;place-items:center;width:calc(20px * var(--edp-scale, 1));height:calc(20px * var(--edp-scale, 1));border:1.5px solid var(--ink-faint, #8d93a0);background:#fff;color:#fff;transition:border-color .15s,background .15s}.player-choice__mark--radio{border-radius:999px}.player-choice__mark--box{border-radius:calc(6px * var(--edp-scale, 1))}.player-choice__mark>svg{width:calc(13px * var(--edp-scale, 1));height:calc(13px * var(--edp-scale, 1));opacity:0}.player-choice__text{flex:1;min-width:0}.player-choice{height:100%}.player-choice__text img,.player-choice__text video,.player-choice__text iframe{max-height:calc(120px * var(--edp-scale, 1));width:auto;max-width:100%}.player-choice--tile{flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(1rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__mark{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-start:calc(.5rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__text{flex:0 1 auto;width:100%;text-align:center}.player-choice--tile .player-choice__text img,.player-choice--tile .player-choice__text video,.player-choice--tile .player-choice__text iframe{display:block!important;margin-inline:auto;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice--selected{background-color:var(--ui-muted, #f5f4f1);border-color:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark>svg{opacity:1}.player-choice--correct{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark{border-color:var(--ok, #1f8a4c);background:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark>svg{opacity:1}.player-choice--correct-unchosen{background-color:#fff;border-color:var(--ok, #1f8a4c);border-style:dashed}.player-choice--correct-unchosen .player-choice__mark{border-color:var(--ok, #1f8a4c)}.player-choice--incorrect{background-color:var(--pen-soft, #fdeeec);border-color:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark{border-color:var(--pen, #d23b2b);background:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark>svg{opacity:1}.player-choice--muted{opacity:.55}.player-choice--partial{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--disabled{cursor:default}.player-choice__mark--letter{width:calc(1.625rem * var(--edp-scale, 1));height:calc(1.625rem * var(--edp-scale, 1));color:var(--ink, #1d2025);font-size:.8em;font-weight:700;line-height:1}.player-choice--selected .player-choice__mark--letter,.player-choice--correct .player-choice__mark--letter,.player-choice--incorrect .player-choice__mark--letter{color:#fff}.player-choice--correct-unchosen .player-choice__mark--letter{color:var(--ok, #1f8a4c)}.player-choice__verdict{flex:none;display:grid;place-items:center;margin-inline-start:auto}.player-choice__verdict>svg{width:calc(1.125rem * var(--edp-scale, 1));height:calc(1.125rem * var(--edp-scale, 1))}.player-choice__verdict--correct{color:var(--ok, #1f8a4c)}.player-choice__verdict--incorrect{color:var(--pen, #d23b2b)}.player-choice--tile .player-choice__verdict{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-end:calc(.5rem * var(--edp-scale, 1));margin:0}.player-inline-choice{display:inline-flex;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:.05em .55em;border:1.5px solid var(--line-strong, #d6d3cc);border-radius:999px;background:#fff;color:var(--ink, #1d2025);font-size:.9em;line-height:inherit;cursor:pointer;user-select:none;transition:border-color .15s,background .15s}.player-inline-choice:hover:not(:disabled){background:var(--ui-muted, #f5f4f1)}.player-inline-choice:disabled{cursor:default}.player-inline-choice--selected{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-inline-choice--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-inline-choice--correct-unchosen{border-color:var(--ok, #1f8a4c);border-style:dashed}.player-inline-choice--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-inline-choice--muted{opacity:.55}.player-inline-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input{display:inline-block;min-width:3ch;padding:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:none;border-bottom:2px solid var(--line-strong, #d6d3cc);background-color:transparent;font-size:inherit;font-family:inherit;transition:all .2s ease;outline:none}.player-blank-input:focus{border-bottom-color:var(--ink, #1d2025);background-color:var(--ui-muted, #f5f4f1)}.player-blank-input--correct{border-bottom-color:var(--ok, #1f8a4c);background-color:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-input--incorrect{border-bottom-color:var(--pen, #d23b2b);background-color:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-input:disabled{opacity:.7;cursor:not-allowed}.player-typed-blank{display:inline-block;min-width:7ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);outline:none;resize:none;overflow:hidden;vertical-align:middle}.player-typed-blank::placeholder{color:var(--ink-faint, #8d93a0);font-weight:500}.player-typed-blank:focus{border-color:var(--ink, #1d2025)}.player-typed-blank--pending{border-color:var(--ink-faint, #8d93a0);background:var(--card, #ffffff)}.player-typed-blank-feedback{display:inline-block;min-width:2ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));overflow-x:auto;cursor:default;vertical-align:middle}.player-typed-blank-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--partial{border-color:var(--ok, #1f8a4c);border-style:dashed;background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b);text-decoration:line-through}.player-typed-blank-spinner{display:inline-block;width:calc(.75rem * var(--edp-scale, 1));height:calc(.75rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:blank-spin .7s linear infinite}@keyframes blank-spin{to{transform:rotate(360deg)}}.player-blank-reveal{font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;word-break:break-word;min-width:0}.player-blank-feedback{display:inline-block;font-size:.8em;font-weight:500;line-height:1.3;padding:calc(2px * var(--edp-scale, 1)) calc(8px * var(--edp-scale, 1));border-radius:999px;word-break:break-word;min-width:0;background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66)}.player-blank-feedback--correct{background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-feedback--incorrect{background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-hint-btn{width:calc(1rem * var(--edp-scale, 1));height:calc(1rem * var(--edp-scale, 1));border:0;border-radius:999px;background:#fbbf24;color:#fff;font-size:calc(10px * var(--edp-scale, 1));font-weight:700;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .12s}.player-blank-hint-btn:hover,.player-blank-hint-btn--pinned{background:#f59e0b}.player-blank-hint-pop{position:absolute;bottom:100%;left:50%;transform:translate(-50%);margin-bottom:calc(.5rem * var(--edp-scale, 1));z-index:9999;min-width:calc(180px * var(--edp-scale, 1));max-width:calc(300px * var(--edp-scale, 1));width:max-content;background:#fffbeb;border:1px solid #fde68a;border-radius:calc(14px * var(--edp-scale, 1));box-shadow:0 8px 24px #92400e2e;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:#78350f}.matching-player-hintrow{display:flex;justify-content:flex-start;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice-blank{display:inline-flex;align-items:center;justify-content:center;min-width:4ch;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:2px dashed var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));color:var(--ink-faint, #8d93a0);background:transparent;transition:border-color .15s,background .15s,transform .15s,color .15s;vertical-align:middle}.player-choice-blank--target{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-choice-blank--over{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);transform:scale(1.05)}.player-choice-blank--filled{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);cursor:pointer}.player-choice-blank--correct,.player-choice-blank--partial{border-style:solid;border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-choice-blank--incorrect{border-style:solid;border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-choice-blank__clear{margin-inline-start:calc(.25rem * var(--edp-scale, 1));opacity:0;font-size:calc(.75rem * var(--edp-scale, 1));line-height:1;transition:opacity .12s}.player-choice-blank--filled:hover .player-choice-blank__clear{opacity:.6}.player-word-bank{margin:calc(1rem * var(--edp-scale, 1)) 0;position:relative;border:1px solid var(--line, #e7e5e0);border-radius:calc(14px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-word-bank__label{margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:.7em;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft, #565b66);user-select:none}.player-word-bank__items{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.player-word-bank__items--grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(calc(10rem * var(--edp-scale, 1)),1fr));gap:calc(.5rem * var(--edp-scale, 1))}.player-bank-pill{display:inline-block;padding:calc(.35rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);user-select:none;-webkit-touch-callout:none;touch-action:manipulation;cursor:grab;transition:border-color .15s,background .15s,box-shadow .15s}.player-bank-pill:hover{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-bank-pill--dragging{opacity:.5;cursor:grabbing;box-shadow:0 8px 24px #1d20252e}.exercise-runtime{font-family:var(--brand-font, "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif);font-size:calc(1.25rem * var(--edp-scale, 1));line-height:1.6;color:#1f2937}.exercise-runtime input,.exercise-runtime textarea{font-family:inherit}@media(min-width:640px){.exercise-runtime{font-size:calc(1.5rem * var(--edp-scale, 1))}}@media(min-width:768px){.exercise-runtime{font-size:calc(1.5rem * var(--edp-scale, 1))}}@media(min-width:1024px){.exercise-runtime{font-size:calc(2.25rem * var(--edp-scale, 1))}}@media(min-width:1280px){.exercise-runtime{font-size:calc(2.25rem * var(--edp-scale, 1))}}.exercise-runtime :lang(ar),.exercise-runtime [lang=ar],.exercise-runtime [dir=rtl]{direction:rtl;font-family:Arial,Scheherazade New,Amiri,sans-serif;text-align:right}.exercise-runtime p{margin:.5em 0;min-height:1.5em}.exercise-runtime p:empty:after{content:"\\a0";display:inline-block;min-height:1em}.exercise-runtime strong{font-weight:600;color:inherit}.exercise-runtime em{font-style:italic}.exercise-runtime ul,.exercise-runtime ol{list-style:revert;margin-left:calc(1.25rem * var(--edp-scale, 1));padding-left:0}.exercise-runtime img{max-width:100%;height:auto;vertical-align:middle;display:inline-block;margin:0 calc(4px * var(--edp-scale, 1))}.exercise-runtime .inline-math{display:inline-block;vertical-align:middle;margin:0 calc(2px * var(--edp-scale, 1))}.exercise-runtime .math-formula{display:flex;justify-content:center;margin:1em 0}.choice-set-player{margin:calc(1rem * var(--edp-scale, 1)) 0}.choice-set-player__prompt{font-weight:600;margin-bottom:calc(.75rem * var(--edp-scale, 1));color:#374151}.choice-set-player__prompt-hint{margin-left:calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));opacity:.7;font-weight:400}.choice-set-player__choices{display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-scale, 1))}.choice-set-player__choices--grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:1fr}@media(min-width:640px){.choice-set-player__choices--grid{grid-template-columns:repeat(2,1fr)}}.choice-set-player--inline{display:inline-flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));flex-wrap:wrap}.choice-set-player--inline .player-choice{width:auto;padding:calc(.5rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}@media(prefers-contrast:high){.player-choice{border-width:3px}.player-choice--correct{border-color:#15803d}.player-choice--incorrect{border-color:#991b1b}}@media(prefers-reduced-motion:reduce){.animate-shake,.animate-hop,.animate-wobble{animation:none}.player-choice{transition:none}}@media print{.exercise-runtime{font-size:12pt;color:#000}.player-choice{border:1px solid black;background-color:#fff;page-break-inside:avoid}.player-choice--correct:after{content:" \\2713";font-weight:700}.player-choice--incorrect:after{content:" \\2717";font-weight:700}}.matching-player{margin:calc(1rem * var(--edp-scale, 1)) 0}.matching-player-feedback{display:flex;align-items:center;gap:calc(.45rem * var(--edp-scale, 1));margin-top:calc(.6rem * var(--edp-scale, 1));padding:calc(.55rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));font-size:calc(.85rem * var(--edp-scale, 1));font-weight:600}.matching-player-feedback--correct{color:var(--ok, #1f8a4c);border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.matching-player-feedback--partial{color:var(--almost-ink, #8a5a08);border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc)}.matching-player-feedback--incorrect{color:var(--pen, #d23b2b);border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.matching-player-score{margin-inline-start:auto;font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1}.matching-player__instruction{display:none}.matching-player__arena{position:relative;display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.matching-player__arena--dragging{user-select:none;touch-action:none}.matching-player__svg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:1}.matching-player__columns{display:grid;grid-template-columns:1fr 1fr;gap:calc(5rem * var(--edp-scale, 1));align-items:start;position:relative}.matching-player__column{display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.matching-player__item{display:flex;align-items:center;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1));width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:2px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);text-align:left;transition:border-color .15s,background .15s,box-shadow .15s,transform .1s;font-size:inherit;font-family:inherit;color:var(--ink, #1d2025);min-height:calc(52px * var(--edp-scale, 1));user-select:none;-webkit-tap-highlight-color:transparent}.matching-player__item:not(.matching-player__item--disabled){cursor:grab}.matching-player__item:not(.matching-player__item--disabled):active{cursor:grabbing}.matching-player__item:hover:not(.matching-player__item--disabled){border-color:var(--line-strong, #d6d3cc);background:var(--ui-muted, #f5f4f1)}.matching-player__item--selected{border-color:var(--ink, #1d2025)!important;background:var(--ui-muted, #f5f4f1)!important;box-shadow:0 0 0 3px #1d20251f;transform:scale(1.02)}.matching-player__item--available{border-color:var(--ink-faint, #8d93a0);border-style:dashed}.matching-player__item--available:hover{border-color:var(--ink, #1d2025);border-style:solid;background:var(--ui-muted, #f5f4f1)}.matching-player__item--matched{border-width:2px;border-color:var(--ink, #1d2025)}.matching-player__item--matched:hover:not(.matching-player__item--disabled){background:var(--ui-muted, #f5f4f1)}.matching-player__item--correct,.matching-player__item--correct:hover{border-color:var(--ok, #1f8a4c)!important;background:var(--ok-soft, #ecf8f0)!important}.matching-player__item--incorrect,.matching-player__item--incorrect:hover{border-color:var(--pen, #d23b2b)!important;background:var(--pen-soft, #fdeeec)!important}.matching-player__item--disabled{cursor:default;pointer-events:none}.matching-player__item-text{flex:1;min-width:0;line-height:1.4}.matching-player__item-text p{margin:0}.matching-player__pair-num{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:calc(22px * var(--edp-scale, 1));height:calc(22px * var(--edp-scale, 1));border-radius:50%;font-size:calc(.7rem * var(--edp-scale, 1));font-weight:700;line-height:1;background:var(--ink, #1d2025);color:#fff}.matching-player__item--correct .matching-player__pair-num{background:var(--ok, #1f8a4c)}.matching-player__item--incorrect .matching-player__pair-num{background:var(--pen, #d23b2b)}.matching-player__connector{flex-shrink:0;color:var(--ink-faint, #8d93a0);display:flex;align-items:center;transition:color .2s,transform .2s;border-radius:50%}.matching-player__item:hover .matching-player__connector{color:var(--ink, #1d2025);transform:scale(1.25)}.matching-player__connector--left{order:10;margin-left:calc(6px * var(--edp-scale, 1))}.matching-player__connector--right{order:-1;margin-right:calc(6px * var(--edp-scale, 1))}.matching-player__connector svg{width:calc(18px * var(--edp-scale, 1));height:calc(18px * var(--edp-scale, 1))}.matching-player__correct-hint{width:100%;order:20;font-weight:700;color:var(--ok, #1f8a4c);font-size:.82em;line-height:1.4;padding-top:.1em;word-break:break-word}.matching-player__correct-hint p{display:inline;margin:0}.matching-player__item:focus-visible{outline:3px solid var(--ink, #1d2025);outline-offset:2px}.blank-correct-hint{display:inline;font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;margin-left:.3em;word-break:break-word}@keyframes matching-pulse{0%{opacity:.5}to{opacity:1}}@media(prefers-reduced-motion:reduce){.matching-player__item{transition:none}}@media(max-width:600px){:where(.matching-player:not(.matching-player--box)) .matching-player__columns{gap:calc(1rem * var(--edp-scale, 1))}:where(.matching-player:not(.matching-player--box)) .matching-player__item{padding:calc(.5rem * var(--edp-scale, 1)) calc(.6rem * var(--edp-scale, 1));min-height:calc(44px * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));gap:calc(.35rem * var(--edp-scale, 1))}.matching-player__item:not(.matching-player__item--disabled){cursor:pointer}.matching-player__item:not(.matching-player__item--disabled):active{cursor:pointer}:where(.matching-player:not(.matching-player--box)) .matching-player__connector svg{width:calc(15px * var(--edp-scale, 1));height:calc(15px * var(--edp-scale, 1))}}.matching-player--box{container-type:inline-size}@container (max-width: 33.3em){.matching-player--box .matching-player__columns{gap:calc(1rem * var(--edp-scale, 1))}.matching-player--box .matching-player__item{padding:calc(.5rem * var(--edp-scale, 1)) calc(.6rem * var(--edp-scale, 1));min-height:calc(44px * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));gap:calc(.35rem * var(--edp-scale, 1))}.matching-player--box .matching-player__connector svg{width:calc(15px * var(--edp-scale, 1));height:calc(15px * var(--edp-scale, 1))}}.math-response-player{margin:calc(.5rem * var(--edp-scale, 1)) 0}.player-math-field{border:2px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));padding:calc(.375rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff);transition:border-color .2s ease,background .2s ease}.player-math-field:focus-within{border-color:var(--ink, #1d2025)}.player-math-field--readonly{background:var(--ui-muted, #f5f4f1)}.player-math-field__input{width:100%;min-height:calc(2.5rem * var(--edp-scale, 1));font-size:calc(1.1rem * var(--edp-scale, 1));outline:none;--primary: var(--ink, #1d2025);--caret-color: var(--ink, #1d2025);--selection-background-color: var(--ink-soft, #565b66);--contains-highlight-background-color: var(--ui-muted, #f5f4f1)}.player-math-field__input::part(virtual-keyboard-toggle),.player-math-field__input::part(menu-toggle){color:var(--ink-faint, #8d93a0)}.player-math-field__fallback{width:100%;border:none;outline:none;font-size:calc(1rem * var(--edp-scale, 1));font-family:monospace;background:transparent;color:var(--ink, #1d2025)}.player-math-field--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-math-field--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-math-field--validating{border-color:var(--ink-faint, #8d93a0)}.player-math-feedback{margin-top:calc(.4rem * var(--edp-scale, 1));font-size:calc(.8rem * var(--edp-scale, 1));font-weight:600;display:flex;align-items:center;gap:calc(.4rem * var(--edp-scale, 1))}.player-math-feedback--correct{color:var(--ok, #1f8a4c)}.player-math-feedback--incorrect{color:var(--pen, #d23b2b)}.player-math-feedback--validating{color:var(--ink-soft, #565b66)}.player-math-score{margin-inline-start:auto;font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1;color:var(--ok, #1f8a4c)}.player-math-spinner{display:inline-block;width:calc(.9rem * var(--edp-scale, 1));height:calc(.9rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:50%;animation:player-math-spin .7s linear infinite}@keyframes player-math-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.player-math-spinner{animation:none}}.player-ai{margin:calc(1rem * var(--edp-scale, 1)) 0;padding:calc(.5rem * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-radius:calc(.875rem * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1)}.player-ai-counts{display:flex;justify-content:flex-end;gap:calc(.5rem * var(--edp-scale, 1))}.player-ai-count{font-size:calc(.75rem * var(--edp-scale, 1));font-weight:600;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border-radius:999px;background:var(--card, #ffffff);border:1px solid var(--line, #e7e5e0);color:var(--ink-soft, #565b66)}.player-ai-count--over{color:var(--pen, #d23b2b);border-color:var(--pen, #d23b2b)}.player-ai-count--min{color:var(--ink-faint, #8d93a0)}.player-ai-input{width:100%;box-sizing:border-box;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(1rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);color:var(--ink, #1d2025);outline:none;transition:border-color .2s ease,background .2s ease}.player-ai-input::placeholder{color:var(--ink-faint, #8d93a0)}.player-ai-input:focus{border-color:var(--ink, #1d2025)}.player-ai-input--multiline{min-height:calc(120px * var(--edp-scale, 1));resize:vertical}.player-ai-input:disabled{cursor:default}.player-ai-input--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-ai-input--partial{border-color:var(--almost, #c8810e);border-style:dashed;background:var(--almost-soft, #fbf1dc)}.player-ai-input--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-ai-feedback{display:flex;flex-direction:column;gap:calc(.25rem * var(--edp-scale, 1));padding:calc(.75rem * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);background:var(--card, #ffffff);color:var(--ink, #1d2025)}.player-ai-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-ai-feedback--partial{border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc);color:var(--almost-ink, #8a5a08)}.player-ai-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-ai-message{margin:0}.player-ai-score-row{display:flex;justify-content:flex-end}.player-ai-score{font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));font-weight:600;line-height:1;padding:0 calc(.35rem * var(--edp-scale, 1));color:inherit}.player-ai-validating{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(.25rem * var(--edp-scale, 1)) 0;color:var(--ink-soft, #565b66)}.player-ai-spinner{display:inline-block;width:calc(.9rem * var(--edp-scale, 1));height:calc(.9rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:ai-answer-spin .7s linear infinite}@keyframes ai-answer-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.player-ai-spinner{animation:none}}.player-or-field--pre{border-color:var(--line-strong, #d6d3cc)!important}.player-or-field--correct{border-color:var(--ok, #1f8a4c)!important;background:var(--ok-soft, #ecf8f0)!important}.player-or-field--partial,.player-or-field--review{border-color:var(--almost, #c8810e)!important;background:var(--almost-soft, #fbf1dc)!important}.player-or-field--review{border-style:dashed!important}.player-or-field--incorrect{border-color:var(--pen, #d23b2b)!important;background:var(--pen-soft, #fdeeec)!important}.edp-scaled .text-xs{font-size:calc(.75rem * var(--edp-scale, 1));line-height:calc(1 / .75)}.edp-scaled .text-sm{font-size:calc(.875rem * var(--edp-scale, 1));line-height:calc(1.25 / .875)}.edp-scaled .text-base{font-size:calc(1rem * var(--edp-scale, 1));line-height:1.5}.edp-scaled .text-lg{font-size:calc(1.125rem * var(--edp-scale, 1));line-height:calc(1.75 / 1.125)}.edp-scaled .text-\\[10px\\]{font-size:calc(10px * var(--edp-scale, 1))}.edp-scaled .prose-sm{font-size:calc(.875rem * var(--edp-scale, 1))}.edp-scaled .p-2{padding:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .p-3{padding:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .p-4{padding:calc(1rem * var(--edp-scale, 1))}.edp-scaled .p-6{padding:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .pb-1{padding-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .pt-1\\.5{padding-top:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .px-1\\.5{padding-left:calc(.375rem * var(--edp-scale, 1));padding-right:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .px-2{padding-left:calc(.5rem * var(--edp-scale, 1));padding-right:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .px-3{padding-left:calc(.75rem * var(--edp-scale, 1));padding-right:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .px-4{padding-left:calc(1rem * var(--edp-scale, 1));padding-right:calc(1rem * var(--edp-scale, 1))}.edp-scaled .px-5{padding-left:calc(1.25rem * var(--edp-scale, 1));padding-right:calc(1.25rem * var(--edp-scale, 1))}.edp-scaled .px-6{padding-left:calc(1.5rem * var(--edp-scale, 1));padding-right:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .py-0\\.5{padding-top:calc(.125rem * var(--edp-scale, 1));padding-bottom:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .py-1{padding-top:calc(.25rem * var(--edp-scale, 1));padding-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .py-1\\.5{padding-top:calc(.375rem * var(--edp-scale, 1));padding-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .py-2{padding-top:calc(.5rem * var(--edp-scale, 1));padding-bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .py-3{padding-top:calc(.75rem * var(--edp-scale, 1));padding-bottom:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .mb-1{margin-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .mb-2{margin-bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .ml-1{margin-left:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .ml-2{margin-left:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .mr-2{margin-right:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .mt-0\\.5{margin-top:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .mt-1{margin-top:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .mt-1\\.5{margin-top:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .mt-3{margin-top:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .mx-1{margin-left:calc(.25rem * var(--edp-scale, 1));margin-right:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .my-3{margin-top:calc(.75rem * var(--edp-scale, 1));margin-bottom:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .my-4{margin-top:calc(1rem * var(--edp-scale, 1));margin-bottom:calc(1rem * var(--edp-scale, 1))}.edp-scaled .gap-1{gap:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .gap-1\\.5{gap:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .gap-2{gap:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .gap-3{gap:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .gap-x-1{column-gap:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .gap-y-0\\.5{row-gap:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .w-6{width:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .w-16{width:calc(4rem * var(--edp-scale, 1))}.edp-scaled .h-6{height:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .h-8{height:calc(2rem * var(--edp-scale, 1))}.edp-scaled .h-16{height:calc(4rem * var(--edp-scale, 1))}.edp-scaled .max-h-48{max-height:calc(12rem * var(--edp-scale, 1))}.edp-scaled .right-1{right:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .right-3{right:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .bottom-2{bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .max-w-\\[160px\\]{max-width:calc(160px * var(--edp-scale, 1))}.edp-scaled .max-w-\\[200px\\]{max-width:calc(200px * var(--edp-scale, 1))}.edp-scaled .max-w-\\[240px\\]{max-width:calc(240px * var(--edp-scale, 1))}.edp-scaled .min-h-\\[100px\\]{min-height:calc(100px * var(--edp-scale, 1))}.edp-scaled .min-h-\\[120px\\]{min-height:calc(120px * var(--edp-scale, 1))}.edp-scaled .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\] .ProseMirror{min-height:calc(80px * var(--edp-scale, 1))}.math-inline,.math-block,.math-response-player,.katex,.katex-display{direction:ltr;unicode-bidi:isolate}.exercise-shared-context{font-size:calc(1.125rem * var(--edp-scale, 1));margin-bottom:calc(1rem * var(--edp-scale, 1))}.exercise-reference-cue{display:flex;flex-wrap:wrap;align-items:baseline;gap:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));margin:0 0 calc(1rem * var(--edp-scale, 1));padding:calc(.625rem * var(--edp-scale, 1)) calc(.875rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-inline-start:3px solid var(--ink-soft, #565b66);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66);font-size:calc(1rem * var(--edp-scale, 1));line-height:1.5}.exercise-reference-cue__link{font:inherit;font-weight:600;color:var(--ink, #1d2025);background:none;border:0;padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.exercise-reference-cue__link:hover{text-decoration-thickness:2px}.exercise-reference-cue__link:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px;border-radius:2px}.exercise-reference-cue__arrow{display:inline-block;margin-inline-start:.25em}.exercise-reference-cue__arrow:dir(rtl){transform:scaleX(-1)}
|
|
45
|
+
sys.stdin = io.StringIO(${JSON.stringify(o)})
|
|
46
|
+
`),l.runPython(e);let p=l.runPython("_stdout_capture.getvalue()");l.runPython("sys.stdout = sys.__stdout__");let f=p.trim()===(i||"").trim();return{testId:n,passed:f,actualStdout:p,durationMs:Date.now()-d}}else{l.runPython(e);let p=(a||[]).map(v=>JSON.stringify(v)).join(", "),f=l.runPython(`${t}(${p})`),b=pt(f,s);return{testId:n,passed:b,actual:f,durationMs:Date.now()-d}}}catch(l){return{testId:n,passed:!1,stderr:String(l),errored:!0,durationMs:Date.now()-d}}}var dt=null;async function bi(){if(dt)return dt;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return dt=await(e.default??e)(),dt}async function xi(e,r,t,n){let a=Date.now();try{let s=await bi(),o=new s.Database;t&&o.run(t);let c=o.exec(e).flatMap(l=>l.values.map(p=>p.map(String).join("|"))).join(`
|
|
47
|
+
`),d=c.trim()===(n||"").trim();return o.close(),{testId:r,passed:d,actualStdout:c,durationMs:Date.now()-a}}catch(s){return{testId:r,passed:!1,stderr:String(s),errored:!0,durationMs:Date.now()-a}}}async function yi(e){let{transform:r}=await import("./esm-RQP7AIMT.mjs");return r(e,{transforms:["typescript"]}).code}var lr=class{supports(r){return["javascript","typescript","python","sql"].includes(r)}async run(r){let{language:t,source:n,mode:a,entryFunction:s,tests:o,timeoutMs:i=5e3}=r;if(!this.supports(t))return o.map(l=>({testId:l.id,passed:!1,stderr:`Language "${t}" cannot run in-browser. Configure a RemoteExecutor for compiled languages.`,errored:!0}));let c=n;if(t==="typescript")try{c=await yi(n)}catch(l){return o.map(p=>({testId:p.id,passed:!1,stderr:`TypeScript compile error: ${l.message}`,errored:!0}))}let d=[];for(let l of o){let p;t==="python"?p=await gi(c,a,s,l.id,l.args,l.expectedReturn,l.stdin,l.expectedStdout,i):t==="sql"?p=await xi(c,l.id,l.stdin,l.expectedStdout):p=await pi(c,a,s,l.id,l.args,l.expectedReturn,l.stdin,l.expectedStdout,i),d.push(p)}return d}};import{jsx as La}from"react/jsx-runtime";import{forwardRef as vi,useEffect as wi,useImperativeHandle as ki,useRef as Ri,useState as Si}from"react";function _i(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var rn=vi(function({value:r,onChange:t,language:n="javascript",readOnly:a=!1,readOnlyRanges:s,placeholder:o,height:i=300,className:c,autoFocus:d},l){let[p,f]=Si(null),{scale:b}=Me(),v=Ri(null);wi(()=>{import("./dist-RXTJ74FF.mjs").then(h=>{f(()=>h.default)}).catch(()=>{})},[]),ki(l,()=>({getValue(){return v.current?.getValue?.()??r},focus(){v.current?.focus?.()},insert(h){let _=v.current;if(!_)return;let u=_.getSelection();_.executeEdits("insert",[{range:u,text:h,forceMoveMarkers:!0}])}}));function g(h){v.current=h,d&&h.focus(),s?.length&&h.onDidAttemptReadOnlyEdit(()=>{})}function x(h){t(h??"")}let y=typeof i=="number"?i*b:i;return p?La(p,{className:c,height:y,language:_i(n),value:r,onChange:x,onMount:g,options:{readOnly:a,minimap:{enabled:!1},fontSize:14*b,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):La("textarea",{className:c,value:r,onChange:h=>t(h.target.value),readOnly:a,placeholder:o,style:{width:"100%",height:typeof i=="number"?P(i):i,fontFamily:"monospace",fontSize:P(14),padding:P("0.5rem"),border:"1px solid #e2e8f0",borderRadius:P("0.375rem"),resize:"vertical",background:a?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:d})});var Li=new lr;function Mi(e){return e?.showFeedback?e.state??"idle":"idle"}function Ma(e){let r={};for(let t of e.attrs.starters??[])r[t.language]=t.code;return r}function Ti({sample:e,result:r,mode:t}){let n=r?.passed,a=r?.errored,s=r!==void 0,o=s?a?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=s?a?"\u26A0":null:"\u25CB";return pe("div",{style:{padding:`${P("0.5rem")} ${P("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:P("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[pe("div",{style:{display:"flex",alignItems:"center",gap:P("0.5rem")},children:[Z("span",{style:{color:o,fontWeight:700,fontSize:P("0.875rem"),display:"inline-flex"},children:i??(n?Z(tn,{size:15,style:re(15)}):Z(Ta,{size:15}))}),Z("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),s&&!n&&pe("div",{style:{marginTop:P("0.25rem"),paddingLeft:P("1.5rem")},children:[t==="function"?Z(Nr,{children:r?.actual!==void 0&&pe("div",{style:{color:"var(--ink-soft, #565b66)"},children:[Z("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),Z("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(r.actual)}),Z("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),Z("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):Z(Nr,{children:r?.actualStdout!==void 0&&pe("div",{style:{color:"var(--ink-soft, #565b66)"},children:[pe("div",{children:[Z("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),Z("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:r.actualStdout||"(empty)"})]}),pe("div",{children:[Z("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),Z("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),r?.stderr&&Z("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:P("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function Kr({node:e,validationFeedback:r,readOnly:t=!1,executor:n=Li,gradingTests:a}){let s=de(),o=Ai(null),{attrs:i}=e,c=e.id,[d,l]=Cr(i.defaultLanguage),[p,f]=Cr(()=>Ma(e)),[b,v]=Cr([]),[g,x]=Cr(!1),[y,h]=Cr(!1),_=p[d]??"",u=Mi(r);Ni(()=>{let k=D=>{let z=D.answers?.find(B=>B.nodeId===c&&B.type==="codingResponse");z?.answer&&(z.answer.language&&l(z.answer.language),z.answer.sourceByLanguage&&f(z.answer.sourceByLanguage),z.answer.testResults&&v(z.answer.testResults))},L=()=>{f(Ma(e)),v([]),h(!1)};return s.on("answers:prefill",k),s.on("answers:reset",L),()=>{s.off("answers:prefill",k),s.off("answers:reset",L)}},[s,c,e]);let w=Ci((k,L,D)=>{s.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:k,sourceByLanguage:L,source:L[k]??"",testResults:D}}})},[s,c]),C=k=>{let L={...p,[d]:k};f(L),w(d,L,b)},M=k=>{l(k),v([]),w(k,p,[])},$=async()=>{if(g)return;x(!0),v([]);let k=a??i.visibleSamples??[];if(k.length===0){x(!1);return}try{let L=await n.run({language:d,source:_,mode:i.testMode,entryFunction:i.entryFunction,tests:k,timeoutMs:5e3});v(L),w(d,p,L)}catch(L){let D=k.map(z=>({testId:z.id,passed:!1,stderr:String(L),errored:!0}));v(D),w(d,p,D)}finally{x(!1)}},R=()=>{y||(h(!0),w(d,p,b))},m=(a??[]).filter(k=>k.hidden).length,I=m>0?b.filter(k=>(a??[]).find(D=>D.id===k.testId)?.hidden&&k.passed).length:0,N=a?a.filter(k=>!k.hidden):i.visibleSamples??[],q=u==="correct"?"var(--ok, #1f8a4c)":u==="partial"?"var(--almost, #c8810e)":u==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return pe("div",{style:{margin:`${P("0.75rem")} 0`,border:`1px solid ${q}`,borderRadius:P("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[pe("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${P("0.5rem")} ${P("0.75rem")}`,display:"flex",alignItems:"center",gap:P("0.5rem"),flexWrap:"wrap"},children:[Z("div",{style:{display:"flex",gap:P("0.25rem")},children:i.languages.map(k=>Z("button",{onClick:()=>!t&&M(k),disabled:t,style:{padding:`${P("0.2rem")} ${P("0.6rem")}`,borderRadius:P("0.375rem"),border:"1px solid",borderColor:d===k?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:d===k?"var(--ink, #1d2025)":"var(--card, #fff)",color:d===k?"#fff":"var(--ink-soft, #565b66)",fontSize:P("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:k},k))}),Z("div",{style:{flex:1}}),Z(Fe,{hint:i.hint}),!t&&pe(Nr,{children:[pe("button",{onClick:$,disabled:g,style:{padding:`${P("0.25rem")} ${P("0.75rem")}`,borderRadius:P("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:g?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:P("0.8125rem"),fontWeight:600,cursor:g?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:P("0.35rem")},children:[Z(Ei,{size:13,style:re(13)})," ",g?"Running\u2026":"Run"]}),pe("button",{onClick:R,disabled:y,style:{padding:`${P("0.3rem")} ${P("0.85rem")}`,borderRadius:P("0.5rem"),border:"none",background:y?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:y?"var(--ok, #1f8a4c)":"#fff",fontSize:P("0.8125rem"),fontWeight:600,cursor:y?"default":"pointer",display:"inline-flex",alignItems:"center",gap:P("0.35rem")},children:[y&&Z(tn,{size:13,style:re(13)})," ",y?"Submitted":"Submit"]})]})]}),Z(rn,{ref:o,value:_,onChange:C,language:d,readOnly:t,readOnlyRanges:i.starters.find(k=>k.language===d)?.readOnlyRanges,height:320}),(b.length>0||N.length>0)&&pe("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[Z("div",{style:{padding:`${P("0.5rem")} ${P("0.75rem")}`,fontSize:P("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),N.map(k=>Z(Ti,{sample:k,result:b.find(L=>L.testId===k.id),mode:i.testMode},k.id)),m>0&&pe("div",{style:{padding:`${P("0.5rem")} ${P("0.75rem")}`,fontSize:P("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:P("0.4rem")},children:[Z(Pi,{size:13,style:re(13)})," Hidden tests: ",I,"/",m," passed"]})]}),r?.showFeedback&&pe("div",{style:{padding:`${P("0.55rem")} ${P("0.75rem")}`,fontSize:P("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:P("0.45rem"),background:u==="correct"?"var(--ok-soft, #ecf8f0)":u==="partial"?"var(--almost-soft, #fbf1dc)":u==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:u==="correct"?"var(--ok, #1f8a4c)":u==="partial"?"var(--almost-ink, #8a5a08)":u==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[u==="correct"&&pe(Nr,{children:[Z(tn,{size:15,style:re(15)})," All tests passed"]}),u==="partial"&&"Partial credit",u==="incorrect"&&pe(Nr,{children:[Z(Ta,{size:15,style:re(15)})," Tests failed"]}),u==="validating"&&"Evaluating\u2026",u==="awaiting_review"&&"Awaiting teacher review",r.score!==void 0&&pe("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:P("1.5rem"),lineHeight:1},children:[r.score," / ",r.maxScore??i.maxScore]})]})]})}import{Fragment as zi,jsx as on,jsxs as Fi}from"react/jsx-runtime";import{createContext as Di,useContext as Oi}from"react";import{DndContext as ji,MouseSensor as Bi,TouchSensor as Wi,KeyboardSensor as qi,useSensor as sn,useSensors as Ui}from"@dnd-kit/core";import{jsx as nn}from"react/jsx-runtime";import{DragOverlay as Ii,useDndContext as $i}from"@dnd-kit/core";function an(){let{active:e}=$i();if(!e)return null;let r=e.data.current?.html??"";return nn(Ii,{dropAnimation:null,children:nn("div",{style:{display:"inline-block",padding:"0.375rem 0.75rem",borderRadius:"9999px",backgroundColor:"white",border:"1px solid #e5e7eb",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",cursor:"grabbing",maxWidth:"20rem"},children:nn("span",{dangerouslySetInnerHTML:{__html:r},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}var Ia=Di(!1),Hi={acceleration:3,threshold:{x:0,y:.12}};function mt({children:e}){let r=Oi(Ia),t=sn(Bi,{activationConstraint:{distance:8}}),n=sn(Wi,{activationConstraint:{delay:250,tolerance:5}}),a=sn(qi),s=Ui(t,n,a);return r?on(zi,{children:e}):on(Ia.Provider,{value:!0,children:Fi(ji,{sensors:s,autoScroll:Hi,children:[e,on(an,{})]})})}function pr({content:e,onAnswersChange:r,onSubmit:t,answerBus:n,namespace:a,initialAnswers:s,validationFeedback:o,className:i="",locale:c,readOnly:d=!1,mediaHandler:l,codeExecutor:p,display:f}){let b=ke(f),v=Vi(()=>_e(b),[b]),g=Qi(null);g.current||(g.current=new We);let x=n??g.current;ut(()=>{s&&s.length>0&&x.prefillAnswers(s)},[s,x]),ut(()=>{if(!r)return;let h=()=>{let _=x.getAllAnswers();r(_)};return x.on("answer:changed",h),()=>x.off("answer:changed",h)},[x,r]),ut(()=>{if(!t)return;let h=_=>{t(_.answers)};return x.on("answer:submitted",h),()=>x.off("answer:submitted",h)},[x,t]),ut(()=>{document.querySelectorAll("[data-audio]").forEach(_=>{let u=_.querySelector("audio"),w=_.querySelector("svg");!u||!w||(_.onclick=()=>{u.paused?(u.play(),w.innerHTML='<path d="M6 4h4v16H6zm8 0h4v16h-4z"/>',w.dataset.icon="pause"):(u.pause(),w.innerHTML='<path d="M6 4v16l12-8z"/>',w.dataset.icon="play")},u.onended=()=>{w.innerHTML='<path d="M6 4v16l12-8z"/>',w.dataset.icon="play"})})},[e]);let y=Se(e,o,{readOnly:d,mediaHandler:l,codeExecutor:p});return dr(Rr,{locale:c,children:dr(Re,{display:b,children:dr(Dr,{bus:x,children:dr(mt,{children:dr(nt,{initialAnswers:s,children:dr("div",{className:`question-runtime ${i}${v.sizeSet?" edp-scaled":""}`,"data-namespace":a,style:{fontSize:P("1.125rem"),lineHeight:"1.75",...Ce(v)},children:y})})})})})})}import{jsx as mr,jsxs as gt}from"react/jsx-runtime";import{memo as Xi,useCallback as Oa,useMemo as Ji,useRef as Da}from"react";var $a={words:80,media:1,tableRows:6},Gi=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function za(e){let r={words:0,media:0,tableRows:0},t=n=>{if(typeof n.text=="string"&&(r.words+=n.text.split(/\s+/).filter(a=>/[\p{L}\p{N}]/u.test(a)).length),n.type&&Gi.has(n.type)&&r.media++,n.type==="table"){let a=(n.content??[]).filter(s=>s.type==="tableRow").length;r.tableRows=Math.max(r.tableRows,a)}for(let a of n.content??[])t(a)};return e&&t(e),r}function Ar(e,r=$a){let t=za(e);return t.words>r.words||t.media>r.media||t.tableRows>r.tableRows}import{createContext as Yi,useContext as Ki}from"react";var Fa=Yi(null),ft=Fa.Provider;function ht(){return Ki(Fa)}function bt({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:a,renderSeparator:s,className:o="",locale:i,display:c}){let d=ke(c),l=Ji(()=>_e(d),[d]),p=Da(new Map),f=Da({exercise:e,onAnswersChange:r});f.current={exercise:e,onAnswersChange:r};let b=Oa((h,_)=>{p.current.set(h,_);let{exercise:u,onAnswersChange:w}=f.current;if(w){let C={exerciseId:u.id,questionAnswers:u.questions.map(M=>({questionId:M.id,answers:p.current.get(M.id)??[]}))};w(C)}},[]),v=ht(),g=kr(i),x=!!(v&&e.sharedContext&&Ar(e.sharedContext)),y=e.sharedContext?x?gt("p",{className:"exercise-reference-cue",children:[mr("span",{children:g.referenceInPanel(v.label)})," ",gt("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>v.showExerciseReference(e.id),children:[g.readReference,mr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):mr("div",{className:"exercise-shared-context",children:Se(e.sharedContext)}):null;return mr(Re,{display:d,children:gt("div",{className:`exercise-runtime ${o}`,style:Ce(l),children:[y&&(n?n(y):y),e.questions.map((h,_)=>{let u=t?.get(h.id),w=mr(Zi,{questionId:h.id,content:h.content,onQuestionAnswers:b,validationFeedback:u,locale:i},h.id);return gt("div",{children:[a?a(h,w,_):w,s&&_<e.questions.length-1?s(_):null]},h.id)})]})})}var Zi=Xi(function({questionId:r,content:t,onQuestionAnswers:n,validationFeedback:a,locale:s}){let o=Oa(i=>n(r,i),[n,r]);return mr(pr,{content:t,onAnswersChange:o,validationFeedback:a,locale:s})});import{jsx as cn,jsxs as ec}from"react/jsx-runtime";import{useCallback as rc,useEffect as tc,useMemo as nc,useRef as ja}from"react";function Ke({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:a,renderSeparator:s,className:o="",brandingConfig:i,locale:c,display:d}){let l=ja(new Map),p=ke(d),f=nc(()=>_e(p),[p]);tc(()=>{if(!i?.fontUrl)return;let x=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(x))return;let y=document.createElement("link");y.id=x,y.rel="stylesheet",y.href=i.fontUrl,document.head.appendChild(y)},[i?.fontUrl]);let b={...Ce(f)};i?.fontFamily&&(b["--brand-font"]=i.fontFamily);let v=ja({assessment:e,onAnswersChange:r});v.current={assessment:e,onAnswersChange:r};let g=rc(x=>{l.current.set(x.exerciseId,x);let{assessment:y,onAnswersChange:h}=v.current;if(h){let _={exerciseAnswers:y.exercises.map(u=>l.current.get(u.id)??{exerciseId:u.id,questionAnswers:[]})};h(_)}},[]);return cn(Re,{display:p,children:cn("div",{className:`assessment-runtime ${o}`,style:Object.keys(b).length?b:void 0,children:e.exercises.map((x,y)=>{let h=t?.get(x.id),_=cn(bt,{exercise:x,onAnswersChange:g,validationFeedback:h,renderSharedContext:a?u=>a(u,x):void 0,locale:c},x.id);return ec("div",{children:[n?n(x,_,y):_,s&&y<e.exercises.length-1?s(y):null]},x.id)})})})}import{jsx as Ba}from"react/jsx-runtime";import{useMemo as ac}from"react";function ur({content:e,className:r,display:t}){let n=ke(t),a=ac(()=>_e(n),[n]);return Ba(Re,{display:n,children:Ba("div",{className:`content-view ${r??""}`,style:Ce(a),children:Se(e)})})}import{jsx as Er,Fragment as Wa,jsxs as xt}from"react/jsx-runtime";import{useMemo as oc}from"react";function Pr({item:e,className:r,renderFigureLabel:t,display:n}){let a=ke(n),s=oc(()=>_e(a),[a]);return Er(Re,{display:a,children:xt("div",{className:`annex-item-view ${r??""}${s.sizeSet?" edp-scaled":""}`,style:Ce(s),children:[e.type==="text-document"&&xt(Wa,{children:[e.title&&Er("h3",{className:"text-base font-semibold mb-2",children:e.title}),Se(e.content)]}),e.type==="figure"&&xt("figure",{children:[Se(e.content),Er("figcaption",{children:t?t(e.label):Er("span",{children:e.label})})]}),e.type==="rich-block"&&xt(Wa,{children:[e.title&&Er("h3",{className:"text-base font-semibold mb-2",children:e.title}),Se(e.content)]})]})})}import{jsx as ou,jsxs as su}from"react/jsx-runtime";import{useState as cu}from"react";import{jsx as fu,jsxs as hu}from"react/jsx-runtime";import{useState as bu,useCallback as xu,useMemo as yu}from"react";import{useEditor as wu,EditorContent as ku}from"@tiptap/react";import Su from"@tiptap/starter-kit";import{jsx as Au,jsxs as Eu,Fragment as Pu}from"react/jsx-runtime";import{useMemo as Mu,useState as Tu}from"react";function tr(e,{insertAt:r}={}){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",r==="top"&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}tr(`:root{--ink: #1d2025;--ink-soft: #565b66;--ink-faint: #8d93a0;--ui-muted: #f5f4f1;--line: #e7e5e0;--line-strong: #d6d3cc;--ok: #1f8a4c;--ok-soft: #ecf8f0;--pen: #d23b2b;--pen-soft: #fdeeec;--almost: #c8810e;--almost-ink: #8a5a08;--almost-soft: #fbf1dc;--font-hand: "Caveat", cursive}@keyframes answer-shake{10%,90%{transform:translate(-2px)}20%,80%{transform:translate(4px)}30%,50%,70%{transform:translate(-6px)}40%,60%{transform:translate(6px)}}@keyframes hop{0%,to{transform:translateY(0) scale(1)}40%{transform:translateY(-6%) scale(1.05)}}@keyframes wobble{0%,to{transform:translate(0)}15%,85%{transform:translate(-4px)}30%,70%{transform:translate(4px)}45%,55%{transform:translate(-2px)}}.animate-shake{animation:answer-shake .4s both}.animate-hop{animation:hop .5s ease-out}.animate-wobble{animation:wobble .5s ease}.cs-player__grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:repeat(1,minmax(0,1fr))}@media(min-width:40rem){:where(.cs-player:not(.cs-player--box)) .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.cs-player--box{container-type:inline-size}@container (min-width: 35.5em){.cs-player--box .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.player-choice{position:relative;display:inline-flex;align-items:center;gap:calc(.75rem * var(--edp-scale, 1));flex-wrap:wrap;width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:1.5px solid var(--line, #e7e5e0);border-radius:calc(.75rem * var(--edp-scale, 1));background-color:#fff;color:var(--ink, #1d2025);cursor:pointer;user-select:none;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;font-weight:500;text-align:start}.player-choice:hover:not(:disabled){background-color:var(--ui-muted, #f5f4f1);border-color:var(--line-strong, #d6d3cc)}.player-choice:disabled{cursor:default}.player-choice>img{flex-shrink:0}.player-choice__mark{flex:none;display:grid;place-items:center;width:calc(20px * var(--edp-scale, 1));height:calc(20px * var(--edp-scale, 1));border:1.5px solid var(--ink-faint, #8d93a0);background:#fff;color:#fff;transition:border-color .15s,background .15s}.player-choice__mark--radio{border-radius:999px}.player-choice__mark--box{border-radius:calc(6px * var(--edp-scale, 1))}.player-choice__mark>svg{width:calc(13px * var(--edp-scale, 1));height:calc(13px * var(--edp-scale, 1));opacity:0}.player-choice__text{flex:1;min-width:0}.player-choice{height:100%}.player-choice__text img,.player-choice__text video,.player-choice__text iframe{max-height:calc(120px * var(--edp-scale, 1));width:auto;max-width:100%}.player-choice--tile{flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(1rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__mark{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-start:calc(.5rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__text{flex:0 1 auto;width:100%;text-align:center}.player-choice--tile .player-choice__text img,.player-choice--tile .player-choice__text video,.player-choice--tile .player-choice__text iframe{display:block!important;margin-inline:auto;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice--selected{background-color:var(--ui-muted, #f5f4f1);border-color:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark>svg{opacity:1}.player-choice--correct{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark{border-color:var(--ok, #1f8a4c);background:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark>svg{opacity:1}.player-choice--correct-unchosen{background-color:#fff;border-color:var(--ok, #1f8a4c);border-style:dashed}.player-choice--correct-unchosen .player-choice__mark{border-color:var(--ok, #1f8a4c)}.player-choice--incorrect{background-color:var(--pen-soft, #fdeeec);border-color:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark{border-color:var(--pen, #d23b2b);background:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark>svg{opacity:1}.player-choice--muted{opacity:.55}.player-choice--partial{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--disabled{cursor:default}.player-choice__mark--letter{width:calc(1.625rem * var(--edp-scale, 1));height:calc(1.625rem * var(--edp-scale, 1));color:var(--ink, #1d2025);font-size:.8em;font-weight:700;line-height:1}.player-choice--selected .player-choice__mark--letter,.player-choice--correct .player-choice__mark--letter,.player-choice--incorrect .player-choice__mark--letter{color:#fff}.player-choice--correct-unchosen .player-choice__mark--letter{color:var(--ok, #1f8a4c)}.player-choice__verdict{flex:none;display:grid;place-items:center;margin-inline-start:auto}.player-choice__verdict>svg{width:calc(1.125rem * var(--edp-scale, 1));height:calc(1.125rem * var(--edp-scale, 1))}.player-choice__verdict--correct{color:var(--ok, #1f8a4c)}.player-choice__verdict--incorrect{color:var(--pen, #d23b2b)}.player-choice--tile .player-choice__verdict{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-end:calc(.5rem * var(--edp-scale, 1));margin:0}.player-inline-choice{display:inline-flex;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:.05em .55em;border:1.5px solid var(--line-strong, #d6d3cc);border-radius:999px;background:#fff;color:var(--ink, #1d2025);font-size:.9em;line-height:inherit;cursor:pointer;user-select:none;transition:border-color .15s,background .15s}.player-inline-choice:hover:not(:disabled){background:var(--ui-muted, #f5f4f1)}.player-inline-choice:disabled{cursor:default}.player-inline-choice--selected{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-inline-choice--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-inline-choice--correct-unchosen{border-color:var(--ok, #1f8a4c);border-style:dashed}.player-inline-choice--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-inline-choice--muted{opacity:.55}.player-inline-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input{display:inline-block;min-width:3ch;padding:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:none;border-bottom:2px solid var(--line-strong, #d6d3cc);background-color:transparent;font-size:inherit;font-family:inherit;transition:all .2s ease;outline:none}.player-blank-input:focus{border-bottom-color:var(--ink, #1d2025);background-color:var(--ui-muted, #f5f4f1)}.player-blank-input--correct{border-bottom-color:var(--ok, #1f8a4c);background-color:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-input--incorrect{border-bottom-color:var(--pen, #d23b2b);background-color:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-input:disabled{opacity:.7;cursor:not-allowed}.player-typed-blank{display:inline-block;min-width:7ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);outline:none;resize:none;overflow:hidden;vertical-align:middle}.player-typed-blank::placeholder{color:var(--ink-faint, #8d93a0);font-weight:500}.player-typed-blank:focus{border-color:var(--ink, #1d2025)}.player-typed-blank--pending{border-color:var(--ink-faint, #8d93a0);background:var(--card, #ffffff)}.player-blank-cell{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.125rem * var(--edp-scale, 1)) calc(.25rem * var(--edp-scale, 1));width:100%}.player-blank-cell__box{position:relative;display:block;flex:1 1 100%;min-width:0}.player-typed-blank--cell{display:block;box-sizing:border-box;width:100%;min-width:6.5ch;padding:calc(1px * var(--edp-scale, 1)) calc(2px * var(--edp-scale, 1));font:inherit;font-weight:600;line-height:1.3;white-space:nowrap;overflow-x:hidden}.player-typed-blank-feedback--cell{display:block;box-sizing:border-box;width:max-content;min-width:100%;max-width:none;white-space:nowrap;overflow:visible}.player-blank-cell .player-blank-reveal{white-space:nowrap;font-size:.9em}@media(max-width:640px){.edp-table-first{max-width:38vw}}.player-typed-blank-feedback{display:inline-block;min-width:2ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));overflow-x:auto;cursor:default;vertical-align:middle}.player-typed-blank-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--partial{border-color:var(--ok, #1f8a4c);border-style:dashed;background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b);text-decoration:line-through}.player-typed-blank-spinner{display:inline-block;width:calc(.75rem * var(--edp-scale, 1));height:calc(.75rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:blank-spin .7s linear infinite}@keyframes blank-spin{to{transform:rotate(360deg)}}.player-blank-reveal{font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;word-break:break-word;min-width:0}.player-blank-feedback{display:inline-block;font-size:.8em;font-weight:500;line-height:1.3;padding:calc(2px * var(--edp-scale, 1)) calc(8px * var(--edp-scale, 1));border-radius:999px;word-break:break-word;min-width:0;background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66)}.player-blank-feedback--correct{background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-feedback--incorrect{background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-hint-btn{width:calc(1rem * var(--edp-scale, 1));height:calc(1rem * var(--edp-scale, 1));border:0;border-radius:999px;background:#fbbf24;color:#fff;font-size:calc(10px * var(--edp-scale, 1));font-weight:700;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .12s}.player-blank-hint-btn:hover,.player-blank-hint-btn--pinned{background:#f59e0b}.player-blank-hint-pop{position:absolute;bottom:100%;left:50%;transform:translate(-50%);margin-bottom:calc(.5rem * var(--edp-scale, 1));z-index:9999;min-width:calc(180px * var(--edp-scale, 1));max-width:calc(300px * var(--edp-scale, 1));width:max-content;background:#fffbeb;border:1px solid #fde68a;border-radius:calc(14px * var(--edp-scale, 1));box-shadow:0 8px 24px #92400e2e;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:#78350f}.matching-player-hintrow{display:flex;justify-content:flex-start;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice-blank{display:inline-flex;align-items:center;justify-content:center;min-width:4ch;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:2px dashed var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));color:var(--ink-faint, #8d93a0);background:transparent;transition:border-color .15s,background .15s,transform .15s,color .15s;vertical-align:middle}.player-choice-blank--target{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-choice-blank--over{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);transform:scale(1.05)}.player-choice-blank--filled{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);cursor:pointer}.player-choice-blank--correct,.player-choice-blank--partial{border-style:solid;border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-choice-blank--incorrect{border-style:solid;border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-choice-blank__clear{margin-inline-start:calc(.25rem * var(--edp-scale, 1));opacity:0;font-size:calc(.75rem * var(--edp-scale, 1));line-height:1;transition:opacity .12s}.player-choice-blank--filled:hover .player-choice-blank__clear{opacity:.6}.player-word-bank{margin:calc(1rem * var(--edp-scale, 1)) 0;position:relative;border:1px solid var(--line, #e7e5e0);border-radius:calc(14px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-word-bank__label{margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:.7em;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft, #565b66);user-select:none}.player-word-bank__items{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.player-word-bank__items--grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(calc(10rem * var(--edp-scale, 1)),1fr));gap:calc(.5rem * var(--edp-scale, 1))}.player-bank-pill{display:inline-block;padding:calc(.35rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);user-select:none;-webkit-touch-callout:none;touch-action:manipulation;cursor:grab;transition:border-color .15s,background .15s,box-shadow .15s}.player-bank-pill:hover{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-bank-pill--dragging{opacity:.5;cursor:grabbing;box-shadow:0 8px 24px #1d20252e}.exercise-runtime{font-family:var(--brand-font, "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif);font-size:calc(1.25rem * var(--edp-scale, 1));line-height:1.6;color:#1f2937}.exercise-runtime input,.exercise-runtime textarea{font-family:inherit}@media(min-width:640px){.exercise-runtime{font-size:calc(1.5rem * var(--edp-scale, 1))}}@media(min-width:768px){.exercise-runtime{font-size:calc(1.5rem * var(--edp-scale, 1))}}@media(min-width:1024px){.exercise-runtime{font-size:calc(2.25rem * var(--edp-scale, 1))}}@media(min-width:1280px){.exercise-runtime{font-size:calc(2.25rem * var(--edp-scale, 1))}}.exercise-runtime :lang(ar),.exercise-runtime [lang=ar],.exercise-runtime [dir=rtl]{direction:rtl;font-family:Arial,Scheherazade New,Amiri,sans-serif;text-align:right}.exercise-runtime p{margin:.5em 0;min-height:1.5em}.exercise-runtime p:empty:after{content:"\\a0";display:inline-block;min-height:1em}.exercise-runtime strong{font-weight:600;color:inherit}.exercise-runtime em{font-style:italic}.exercise-runtime ul,.exercise-runtime ol{list-style:revert;margin-left:calc(1.25rem * var(--edp-scale, 1));padding-left:0}.exercise-runtime img{max-width:100%;height:auto;vertical-align:middle;display:inline-block;margin:0 calc(4px * var(--edp-scale, 1))}.exercise-runtime .inline-math{display:inline-block;vertical-align:middle;margin:0 calc(2px * var(--edp-scale, 1))}.exercise-runtime .math-formula{display:flex;justify-content:center;margin:1em 0}.choice-set-player{margin:calc(1rem * var(--edp-scale, 1)) 0}.choice-set-player__prompt{font-weight:600;margin-bottom:calc(.75rem * var(--edp-scale, 1));color:#374151}.choice-set-player__prompt-hint{margin-left:calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));opacity:.7;font-weight:400}.choice-set-player__choices{display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-scale, 1))}.choice-set-player__choices--grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:1fr}@media(min-width:640px){.choice-set-player__choices--grid{grid-template-columns:repeat(2,1fr)}}.choice-set-player--inline{display:inline-flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));flex-wrap:wrap}.choice-set-player--inline .player-choice{width:auto;padding:calc(.5rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}@media(prefers-contrast:high){.player-choice{border-width:3px}.player-choice--correct{border-color:#15803d}.player-choice--incorrect{border-color:#991b1b}}@media(prefers-reduced-motion:reduce){.animate-shake,.animate-hop,.animate-wobble{animation:none}.player-choice{transition:none}}@media print{.exercise-runtime{font-size:12pt;color:#000}.player-choice{border:1px solid black;background-color:#fff;page-break-inside:avoid}.player-choice--correct:after{content:" \\2713";font-weight:700}.player-choice--incorrect:after{content:" \\2717";font-weight:700}}.matching-player{margin:calc(1rem * var(--edp-scale, 1)) 0}.matching-player-feedback{display:flex;align-items:center;gap:calc(.45rem * var(--edp-scale, 1));margin-top:calc(.6rem * var(--edp-scale, 1));padding:calc(.55rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));font-size:calc(.85rem * var(--edp-scale, 1));font-weight:600}.matching-player-feedback--correct{color:var(--ok, #1f8a4c);border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.matching-player-feedback--partial{color:var(--almost-ink, #8a5a08);border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc)}.matching-player-feedback--incorrect{color:var(--pen, #d23b2b);border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.matching-player-score{margin-inline-start:auto;font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1}.matching-player__instruction{display:none}.matching-player__arena{position:relative;display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.matching-player__arena--dragging{user-select:none;touch-action:none}.matching-player__svg{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:1}.matching-player__columns{display:grid;grid-template-columns:1fr 1fr;gap:calc(5rem * var(--edp-scale, 1));align-items:start;position:relative}.matching-player__column{display:flex;flex-direction:column;gap:calc(.5rem * var(--edp-scale, 1))}.matching-player__item{display:flex;align-items:center;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1));width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:2px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);text-align:left;transition:border-color .15s,background .15s,box-shadow .15s,transform .1s;font-size:inherit;font-family:inherit;color:var(--ink, #1d2025);min-height:calc(52px * var(--edp-scale, 1));user-select:none;-webkit-tap-highlight-color:transparent}.matching-player__item:not(.matching-player__item--disabled){cursor:grab}.matching-player__item:not(.matching-player__item--disabled):active{cursor:grabbing}.matching-player__item:hover:not(.matching-player__item--disabled){border-color:var(--line-strong, #d6d3cc);background:var(--ui-muted, #f5f4f1)}.matching-player__item--selected{border-color:var(--ink, #1d2025)!important;background:var(--ui-muted, #f5f4f1)!important;box-shadow:0 0 0 3px #1d20251f;transform:scale(1.02)}.matching-player__item--available{border-color:var(--ink-faint, #8d93a0);border-style:dashed}.matching-player__item--available:hover{border-color:var(--ink, #1d2025);border-style:solid;background:var(--ui-muted, #f5f4f1)}.matching-player__item--matched{border-width:2px;border-color:var(--ink, #1d2025)}.matching-player__item--matched:hover:not(.matching-player__item--disabled){background:var(--ui-muted, #f5f4f1)}.matching-player__item--correct,.matching-player__item--correct:hover{border-color:var(--ok, #1f8a4c)!important;background:var(--ok-soft, #ecf8f0)!important}.matching-player__item--incorrect,.matching-player__item--incorrect:hover{border-color:var(--pen, #d23b2b)!important;background:var(--pen-soft, #fdeeec)!important}.matching-player__item--disabled{cursor:default;pointer-events:none}.matching-player__item-text{flex:1;min-width:0;line-height:1.4}.matching-player__item-text p{margin:0}.matching-player__pair-num{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;width:calc(22px * var(--edp-scale, 1));height:calc(22px * var(--edp-scale, 1));border-radius:50%;font-size:calc(.7rem * var(--edp-scale, 1));font-weight:700;line-height:1;background:var(--ink, #1d2025);color:#fff}.matching-player__item--correct .matching-player__pair-num{background:var(--ok, #1f8a4c)}.matching-player__item--incorrect .matching-player__pair-num{background:var(--pen, #d23b2b)}.matching-player__connector{flex-shrink:0;color:var(--ink-faint, #8d93a0);display:flex;align-items:center;transition:color .2s,transform .2s;border-radius:50%}.matching-player__item:hover .matching-player__connector{color:var(--ink, #1d2025);transform:scale(1.25)}.matching-player__connector--left{order:10;margin-left:calc(6px * var(--edp-scale, 1))}.matching-player__connector--right{order:-1;margin-right:calc(6px * var(--edp-scale, 1))}.matching-player__connector svg{width:calc(18px * var(--edp-scale, 1));height:calc(18px * var(--edp-scale, 1))}.matching-player__correct-hint{width:100%;order:20;font-weight:700;color:var(--ok, #1f8a4c);font-size:.82em;line-height:1.4;padding-top:.1em;word-break:break-word}.matching-player__correct-hint p{display:inline;margin:0}.matching-player__item:focus-visible{outline:3px solid var(--ink, #1d2025);outline-offset:2px}.blank-correct-hint{display:inline;font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;margin-left:.3em;word-break:break-word}@keyframes matching-pulse{0%{opacity:.5}to{opacity:1}}@media(prefers-reduced-motion:reduce){.matching-player__item{transition:none}}@media(max-width:600px){:where(.matching-player:not(.matching-player--box)) .matching-player__columns{gap:calc(1rem * var(--edp-scale, 1))}:where(.matching-player:not(.matching-player--box)) .matching-player__item{padding:calc(.5rem * var(--edp-scale, 1)) calc(.6rem * var(--edp-scale, 1));min-height:calc(44px * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));gap:calc(.35rem * var(--edp-scale, 1))}.matching-player__item:not(.matching-player__item--disabled){cursor:pointer}.matching-player__item:not(.matching-player__item--disabled):active{cursor:pointer}:where(.matching-player:not(.matching-player--box)) .matching-player__connector svg{width:calc(15px * var(--edp-scale, 1));height:calc(15px * var(--edp-scale, 1))}}.matching-player--box{container-type:inline-size}@container (max-width: 33.3em){.matching-player--box .matching-player__columns{gap:calc(1rem * var(--edp-scale, 1))}.matching-player--box .matching-player__item{padding:calc(.5rem * var(--edp-scale, 1)) calc(.6rem * var(--edp-scale, 1));min-height:calc(44px * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));gap:calc(.35rem * var(--edp-scale, 1))}.matching-player--box .matching-player__connector svg{width:calc(15px * var(--edp-scale, 1));height:calc(15px * var(--edp-scale, 1))}}.math-response-player{margin:calc(.5rem * var(--edp-scale, 1)) 0}.player-math-field{border:2px solid var(--line, #e7e5e0);border-radius:calc(.625rem * var(--edp-scale, 1));padding:calc(.375rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff);transition:border-color .2s ease,background .2s ease}.player-math-field:focus-within{border-color:var(--ink, #1d2025)}.player-math-field--readonly{background:var(--ui-muted, #f5f4f1)}.player-math-field__input{width:100%;min-height:calc(2.5rem * var(--edp-scale, 1));font-size:calc(1.1rem * var(--edp-scale, 1));outline:none;--primary: var(--ink, #1d2025);--caret-color: var(--ink, #1d2025);--selection-background-color: var(--ink-soft, #565b66);--contains-highlight-background-color: var(--ui-muted, #f5f4f1)}.player-math-field__input::part(virtual-keyboard-toggle),.player-math-field__input::part(menu-toggle){color:var(--ink-faint, #8d93a0)}.player-math-field__fallback{width:100%;border:none;outline:none;font-size:calc(1rem * var(--edp-scale, 1));font-family:monospace;background:transparent;color:var(--ink, #1d2025)}.player-math-field--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-math-field--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-math-field--validating{border-color:var(--ink-faint, #8d93a0)}.player-math-feedback{margin-top:calc(.4rem * var(--edp-scale, 1));font-size:calc(.8rem * var(--edp-scale, 1));font-weight:600;display:flex;align-items:center;gap:calc(.4rem * var(--edp-scale, 1))}.player-math-feedback--correct{color:var(--ok, #1f8a4c)}.player-math-feedback--incorrect{color:var(--pen, #d23b2b)}.player-math-feedback--validating{color:var(--ink-soft, #565b66)}.player-math-score{margin-inline-start:auto;font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));line-height:1;color:var(--ok, #1f8a4c)}.player-math-spinner{display:inline-block;width:calc(.9rem * var(--edp-scale, 1));height:calc(.9rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:50%;animation:player-math-spin .7s linear infinite}@keyframes player-math-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.player-math-spinner{animation:none}}.player-ai{margin:calc(1rem * var(--edp-scale, 1)) 0;padding:calc(.5rem * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-radius:calc(.875rem * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1)}.player-ai-counts{display:flex;justify-content:flex-end;gap:calc(.5rem * var(--edp-scale, 1))}.player-ai-count{font-size:calc(.75rem * var(--edp-scale, 1));font-weight:600;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border-radius:999px;background:var(--card, #ffffff);border:1px solid var(--line, #e7e5e0);color:var(--ink-soft, #565b66)}.player-ai-count--over{color:var(--pen, #d23b2b);border-color:var(--pen, #d23b2b)}.player-ai-count--min{color:var(--ink-faint, #8d93a0)}.player-ai-input{width:100%;box-sizing:border-box;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(1rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);color:var(--ink, #1d2025);outline:none;transition:border-color .2s ease,background .2s ease}.player-ai-input::placeholder{color:var(--ink-faint, #8d93a0)}.player-ai-input:focus{border-color:var(--ink, #1d2025)}.player-ai-input--multiline{min-height:calc(120px * var(--edp-scale, 1));resize:vertical}.player-ai-input:disabled{cursor:default}.player-ai-input--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-ai-input--partial{border-color:var(--almost, #c8810e);border-style:dashed;background:var(--almost-soft, #fbf1dc)}.player-ai-input--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-ai-feedback{display:flex;flex-direction:column;gap:calc(.25rem * var(--edp-scale, 1));padding:calc(.75rem * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);background:var(--card, #ffffff);color:var(--ink, #1d2025)}.player-ai-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-ai-feedback--partial{border-color:var(--almost, #c8810e);background:var(--almost-soft, #fbf1dc);color:var(--almost-ink, #8a5a08)}.player-ai-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-ai-message{margin:0}.player-ai-score-row{display:flex;justify-content:flex-end}.player-ai-score{font-family:var(--font-hand, "Caveat", cursive);font-size:calc(1.5rem * var(--edp-scale, 1));font-weight:600;line-height:1;padding:0 calc(.35rem * var(--edp-scale, 1));color:inherit}.player-ai-validating{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(.25rem * var(--edp-scale, 1)) 0;color:var(--ink-soft, #565b66)}.player-ai-spinner{display:inline-block;width:calc(.9rem * var(--edp-scale, 1));height:calc(.9rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:ai-answer-spin .7s linear infinite}@keyframes ai-answer-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.player-ai-spinner{animation:none}}.player-or-field--pre{border-color:var(--line-strong, #d6d3cc)!important}.player-or-field--correct{border-color:var(--ok, #1f8a4c)!important;background:var(--ok-soft, #ecf8f0)!important}.player-or-field--partial,.player-or-field--review{border-color:var(--almost, #c8810e)!important;background:var(--almost-soft, #fbf1dc)!important}.player-or-field--review{border-style:dashed!important}.player-or-field--incorrect{border-color:var(--pen, #d23b2b)!important;background:var(--pen-soft, #fdeeec)!important}.edp-scaled .text-xs{font-size:calc(.75rem * var(--edp-scale, 1));line-height:calc(1 / .75)}.edp-scaled .text-sm{font-size:calc(.875rem * var(--edp-scale, 1));line-height:calc(1.25 / .875)}.edp-scaled .text-base{font-size:calc(1rem * var(--edp-scale, 1));line-height:1.5}.edp-scaled .text-lg{font-size:calc(1.125rem * var(--edp-scale, 1));line-height:calc(1.75 / 1.125)}.edp-scaled .text-\\[10px\\]{font-size:calc(10px * var(--edp-scale, 1))}.edp-scaled .prose-sm{font-size:calc(.875rem * var(--edp-scale, 1))}.edp-scaled .p-2{padding:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .p-3{padding:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .p-4{padding:calc(1rem * var(--edp-scale, 1))}.edp-scaled .p-6{padding:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .pb-1{padding-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .pt-1\\.5{padding-top:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .px-1\\.5{padding-left:calc(.375rem * var(--edp-scale, 1));padding-right:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .px-2{padding-left:calc(.5rem * var(--edp-scale, 1));padding-right:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .px-3{padding-left:calc(.75rem * var(--edp-scale, 1));padding-right:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .px-4{padding-left:calc(1rem * var(--edp-scale, 1));padding-right:calc(1rem * var(--edp-scale, 1))}.edp-scaled .px-5{padding-left:calc(1.25rem * var(--edp-scale, 1));padding-right:calc(1.25rem * var(--edp-scale, 1))}.edp-scaled .px-6{padding-left:calc(1.5rem * var(--edp-scale, 1));padding-right:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .py-0\\.5{padding-top:calc(.125rem * var(--edp-scale, 1));padding-bottom:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .py-1{padding-top:calc(.25rem * var(--edp-scale, 1));padding-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .py-1\\.5{padding-top:calc(.375rem * var(--edp-scale, 1));padding-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .py-2{padding-top:calc(.5rem * var(--edp-scale, 1));padding-bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .py-3{padding-top:calc(.75rem * var(--edp-scale, 1));padding-bottom:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .mb-1{margin-bottom:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .mb-2{margin-bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .ml-1{margin-left:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .ml-2{margin-left:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .mr-2{margin-right:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .mt-0\\.5{margin-top:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .mt-1{margin-top:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .mt-1\\.5{margin-top:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .mt-3{margin-top:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .mx-1{margin-left:calc(.25rem * var(--edp-scale, 1));margin-right:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .my-3{margin-top:calc(.75rem * var(--edp-scale, 1));margin-bottom:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .my-4{margin-top:calc(1rem * var(--edp-scale, 1));margin-bottom:calc(1rem * var(--edp-scale, 1))}.edp-scaled .gap-1{gap:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .gap-1\\.5{gap:calc(.375rem * var(--edp-scale, 1))}.edp-scaled .gap-2{gap:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .gap-3{gap:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .gap-x-1{column-gap:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .gap-y-0\\.5{row-gap:calc(.125rem * var(--edp-scale, 1))}.edp-scaled .w-6{width:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .w-16{width:calc(4rem * var(--edp-scale, 1))}.edp-scaled .h-6{height:calc(1.5rem * var(--edp-scale, 1))}.edp-scaled .h-8{height:calc(2rem * var(--edp-scale, 1))}.edp-scaled .h-16{height:calc(4rem * var(--edp-scale, 1))}.edp-scaled .max-h-48{max-height:calc(12rem * var(--edp-scale, 1))}.edp-scaled .right-1{right:calc(.25rem * var(--edp-scale, 1))}.edp-scaled .right-3{right:calc(.75rem * var(--edp-scale, 1))}.edp-scaled .bottom-2{bottom:calc(.5rem * var(--edp-scale, 1))}.edp-scaled .max-w-\\[160px\\]{max-width:calc(160px * var(--edp-scale, 1))}.edp-scaled .max-w-\\[200px\\]{max-width:calc(200px * var(--edp-scale, 1))}.edp-scaled .max-w-\\[240px\\]{max-width:calc(240px * var(--edp-scale, 1))}.edp-scaled .min-h-\\[100px\\]{min-height:calc(100px * var(--edp-scale, 1))}.edp-scaled .min-h-\\[120px\\]{min-height:calc(120px * var(--edp-scale, 1))}.edp-scaled .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\] .ProseMirror{min-height:calc(80px * var(--edp-scale, 1))}.math-inline,.math-block,.math-response-player,.katex,.katex-display{direction:ltr;unicode-bidi:isolate}.exercise-shared-context{font-size:calc(1.125rem * var(--edp-scale, 1));margin-bottom:calc(1rem * var(--edp-scale, 1))}.exercise-reference-cue{display:flex;flex-wrap:wrap;align-items:baseline;gap:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));margin:0 0 calc(1rem * var(--edp-scale, 1));padding:calc(.625rem * var(--edp-scale, 1)) calc(.875rem * var(--edp-scale, 1));border:1px solid var(--line, #e7e5e0);border-inline-start:3px solid var(--ink-soft, #565b66);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66);font-size:calc(1rem * var(--edp-scale, 1));line-height:1.5}.exercise-reference-cue__link{font:inherit;font-weight:600;color:var(--ink, #1d2025);background:none;border:0;padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.exercise-reference-cue__link:hover{text-decoration-thickness:2px}.exercise-reference-cue__link:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px;border-radius:2px}.exercise-reference-cue__arrow{display:inline-block;margin-inline-start:.25em}.exercise-reference-cue__arrow:dir(rtl){transform:scaleX(-1)}
|
|
48
48
|
`);import"katex/dist/katex.min.css";tr(`/*! tailwindcss v4.2.0 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){.edpire-scope *,.edpire-scope :before,.edpire-scope :after,.edpire-scope ::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{.edpire-scope{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-950:oklch(25.8% .092 26.042);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-900:oklch(41.4% .112 45.904);--color-blue-600:oklch(54.6% .245 262.881);--color-rose-500:oklch(64.5% .246 16.439);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-800:oklch(27.9% .041 260.031);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-black:900;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}.edpire-scope .\\@container{container-type:inline-size}.edpire-scope .pointer-events-none{pointer-events:none}.edpire-scope .collapse{visibility:collapse}.edpire-scope .invisible{visibility:hidden}.edpire-scope .visible{visibility:visible}.edpire-scope .absolute{position:absolute}.edpire-scope .fixed{position:fixed}.edpire-scope .relative{position:relative}.edpire-scope .static{position:static}.edpire-scope .sticky{position:sticky}.edpire-scope .inset-0{inset:calc(var(--spacing) * 0)}.edpire-scope .start{inset-inline-start:var(--spacing)}.edpire-scope .start-0{inset-inline-start:calc(var(--spacing) * 0)}.edpire-scope .start-2{inset-inline-start:calc(var(--spacing) * 2)}.edpire-scope .end{inset-inline-end:var(--spacing)}.edpire-scope .end-2{inset-inline-end:calc(var(--spacing) * 2)}.edpire-scope .top-0{top:calc(var(--spacing) * 0)}.edpire-scope .top-1\\/2{top:50%}.edpire-scope .top-2{top:calc(var(--spacing) * 2)}.edpire-scope .top-4{top:calc(var(--spacing) * 4)}.edpire-scope .right-1{right:calc(var(--spacing) * 1)}.edpire-scope .right-3{right:calc(var(--spacing) * 3)}.edpire-scope .bottom-2{bottom:calc(var(--spacing) * 2)}.edpire-scope .isolate{isolation:isolate}.edpire-scope .z-10{z-index:10}.edpire-scope .z-20{z-index:20}.edpire-scope .z-30{z-index:30}.edpire-scope .z-40{z-index:40}.edpire-scope .z-50{z-index:50}.edpire-scope .z-\\[60\\]{z-index:60}.edpire-scope .container{width:100%}@media(min-width:40rem){.edpire-scope .container{max-width:40rem}}@media(min-width:48rem){.edpire-scope .container{max-width:48rem}}@media(min-width:64rem){.edpire-scope .container{max-width:64rem}}@media(min-width:80rem){.edpire-scope .container{max-width:80rem}}@media(min-width:96rem){.edpire-scope .container{max-width:96rem}}.edpire-scope .-mx-3{margin-inline:calc(var(--spacing) * -3)}.edpire-scope .mx-1{margin-inline:calc(var(--spacing) * 1)}.edpire-scope .mx-4{margin-inline:calc(var(--spacing) * 4)}.edpire-scope .mx-auto{margin-inline:auto}.edpire-scope .my-1{margin-block:calc(var(--spacing) * 1)}.edpire-scope .my-3{margin-block:calc(var(--spacing) * 3)}.edpire-scope .my-4{margin-block:calc(var(--spacing) * 4)}.edpire-scope .ms-2{margin-inline-start:calc(var(--spacing) * 2)}.edpire-scope .ms-auto{margin-inline-start:auto}.edpire-scope .mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.edpire-scope .mt-1{margin-top:calc(var(--spacing) * 1)}.edpire-scope .mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.edpire-scope .mt-2{margin-top:calc(var(--spacing) * 2)}.edpire-scope .mt-3{margin-top:calc(var(--spacing) * 3)}.edpire-scope .mt-px{margin-top:1px}.edpire-scope .mr-2{margin-right:calc(var(--spacing) * 2)}.edpire-scope .mb-1{margin-bottom:calc(var(--spacing) * 1)}.edpire-scope .mb-2{margin-bottom:calc(var(--spacing) * 2)}.edpire-scope .mb-3{margin-bottom:calc(var(--spacing) * 3)}.edpire-scope .mb-5{margin-bottom:calc(var(--spacing) * 5)}.edpire-scope .ml-1{margin-left:calc(var(--spacing) * 1)}.edpire-scope .ml-2{margin-left:calc(var(--spacing) * 2)}.edpire-scope .ml-auto{margin-left:auto}.edpire-scope .block{display:block}.edpire-scope .contents{display:contents}.edpire-scope .flex{display:flex}.edpire-scope .grid{display:grid}.edpire-scope .hidden{display:none}.edpire-scope .inline{display:inline}.edpire-scope .inline-block{display:inline-block}.edpire-scope .inline-flex{display:inline-flex}.edpire-scope .table{display:table}.edpire-scope .h-2{height:calc(var(--spacing) * 2)}.edpire-scope .h-3{height:calc(var(--spacing) * 3)}.edpire-scope .h-4{height:calc(var(--spacing) * 4)}.edpire-scope .h-5{height:calc(var(--spacing) * 5)}.edpire-scope .h-6{height:calc(var(--spacing) * 6)}.edpire-scope .h-7{height:calc(var(--spacing) * 7)}.edpire-scope .h-8{height:calc(var(--spacing) * 8)}.edpire-scope .h-9{height:calc(var(--spacing) * 9)}.edpire-scope .h-11{height:calc(var(--spacing) * 11)}.edpire-scope .h-16{height:calc(var(--spacing) * 16)}.edpire-scope .h-24{height:calc(var(--spacing) * 24)}.edpire-scope .h-\\[600px\\]{height:600px}.edpire-scope .h-dvh{height:100dvh}.edpire-scope .h-full{height:100%}.edpire-scope .h-screen{height:100vh}.edpire-scope .max-h-48{max-height:calc(var(--spacing) * 48)}.edpire-scope .max-h-\\[calc\\(100svh-6rem\\)\\]{max-height:calc(100svh - 6rem)}.edpire-scope .max-h-\\[calc\\(100vh-8rem\\)\\]{max-height:calc(100vh - 8rem)}.edpire-scope .min-h-0{min-height:calc(var(--spacing) * 0)}.edpire-scope .min-h-\\[72px\\]{min-height:72px}.edpire-scope .min-h-\\[100px\\]{min-height:100px}.edpire-scope .min-h-\\[120px\\]{min-height:120px}.edpire-scope .min-h-\\[200px\\]{min-height:200px}.edpire-scope .w-3{width:calc(var(--spacing) * 3)}.edpire-scope .w-4{width:calc(var(--spacing) * 4)}.edpire-scope .w-5{width:calc(var(--spacing) * 5)}.edpire-scope .w-6{width:calc(var(--spacing) * 6)}.edpire-scope .w-7{width:calc(var(--spacing) * 7)}.edpire-scope .w-9{width:calc(var(--spacing) * 9)}.edpire-scope .w-11{width:calc(var(--spacing) * 11)}.edpire-scope .w-12{width:calc(var(--spacing) * 12)}.edpire-scope .w-16{width:calc(var(--spacing) * 16)}.edpire-scope .w-24{width:calc(var(--spacing) * 24)}.edpire-scope .w-\\[88\\%\\]{width:88%}.edpire-scope .w-full{width:100%}.edpire-scope .w-px{width:1px}.edpire-scope .max-w-3xl{max-width:var(--container-3xl)}.edpire-scope .max-w-\\[32ch\\]{max-width:32ch}.edpire-scope .max-w-\\[160px\\]{max-width:160px}.edpire-scope .max-w-\\[200px\\]{max-width:200px}.edpire-scope .max-w-\\[240px\\]{max-width:240px}.edpire-scope .max-w-full{max-width:100%}.edpire-scope .max-w-none{max-width:none}.edpire-scope .max-w-sm{max-width:var(--container-sm)}.edpire-scope .max-w-xs{max-width:var(--container-xs)}.edpire-scope .min-w-0{min-width:calc(var(--spacing) * 0)}.edpire-scope .min-w-\\[80px\\]{min-width:80px}.edpire-scope .min-w-\\[140px\\]{min-width:140px}.edpire-scope .flex-1{flex:1}.edpire-scope .flex-none{flex:none}.edpire-scope .flex-shrink-0,.edpire-scope .shrink-0{flex-shrink:0}.edpire-scope .grow{flex-grow:1}.edpire-scope .-translate-x-\\[110\\%\\]{--tw-translate-x: -110% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .translate-x-0{--tw-translate-x:calc(var(--spacing) * 0);translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope .transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.edpire-scope .animate-pulse{animation:var(--animate-pulse)}.edpire-scope .animate-spin{animation:var(--animate-spin)}.edpire-scope .cursor-default{cursor:default}.edpire-scope .cursor-pointer{cursor:pointer}.edpire-scope .resize{resize:both}.edpire-scope .flex-col{flex-direction:column}.edpire-scope .flex-wrap{flex-wrap:wrap}.edpire-scope .items-baseline{align-items:baseline}.edpire-scope .items-center{align-items:center}.edpire-scope .items-start{align-items:flex-start}.edpire-scope .justify-between{justify-content:space-between}.edpire-scope .justify-center{justify-content:center}.edpire-scope .justify-end{justify-content:flex-end}.edpire-scope .gap-0\\.5{gap:calc(var(--spacing) * .5)}.edpire-scope .gap-1{gap:calc(var(--spacing) * 1)}.edpire-scope .gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.edpire-scope .gap-2{gap:calc(var(--spacing) * 2)}.edpire-scope .gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.edpire-scope .gap-3{gap:calc(var(--spacing) * 3)}.edpire-scope .gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .gap-5{gap:calc(var(--spacing) * 5)}.edpire-scope .gap-6{gap:calc(var(--spacing) * 6)}.edpire-scope :where(.edpire-scope .space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope :where(.edpire-scope .space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.edpire-scope .gap-x-1{column-gap:calc(var(--spacing) * 1)}.edpire-scope .gap-x-4{column-gap:calc(var(--spacing) * 4)}.edpire-scope .gap-y-0\\.5{row-gap:calc(var(--spacing) * .5)}.edpire-scope .gap-y-2{row-gap:calc(var(--spacing) * 2)}.edpire-scope .self-start{align-self:flex-start}.edpire-scope .self-stretch{align-self:stretch}.edpire-scope .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.edpire-scope .overflow-hidden{overflow:hidden}.edpire-scope .overflow-y-auto{overflow-y:auto}.edpire-scope .rounded{border-radius:.25rem}.edpire-scope .rounded-2xl{border-radius:var(--radius-2xl)}.edpire-scope .rounded-\\[10px\\]{border-radius:10px}.edpire-scope .rounded-\\[14px\\]{border-radius:14px}.edpire-scope .rounded-full{border-radius:3.40282e38px}.edpire-scope .rounded-lg{border-radius:var(--radius-lg)}.edpire-scope .rounded-md{border-radius:var(--radius-md)}.edpire-scope .rounded-sm{border-radius:var(--radius-sm)}.edpire-scope .rounded-xl{border-radius:var(--radius-xl)}.edpire-scope .rounded-e-lg{border-start-end-radius:var(--radius-lg);border-end-end-radius:var(--radius-lg)}.edpire-scope .rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.edpire-scope .border{border-style:var(--tw-border-style);border-width:1px}.edpire-scope .border-2{border-style:var(--tw-border-style);border-width:2px}.edpire-scope .border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.edpire-scope .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.edpire-scope .border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.edpire-scope .border-dashed{--tw-border-style:dashed;border-style:dashed}.edpire-scope .border-\\[\\#c5e8d1\\]{border-color:#c5e8d1}.edpire-scope .border-\\[\\#d6d3cc\\]{border-color:#d6d3cc}.edpire-scope .border-\\[\\#e7e5e0\\]{border-color:#e7e5e0}.edpire-scope .border-\\[\\#f2e2bf\\]{border-color:#f2e2bf}.edpire-scope .border-\\[\\#f6cfc9\\]{border-color:#f6cfc9}.edpire-scope .border-amber-200{border-color:var(--color-amber-200)}.edpire-scope .border-gray-100{border-color:var(--color-gray-100)}.edpire-scope .border-gray-200{border-color:var(--color-gray-200)}.edpire-scope .border-gray-300{border-color:var(--color-gray-300)}.edpire-scope .bg-\\[\\#1d2025\\]{background-color:#1d2025}.edpire-scope .bg-\\[\\#e7e5e0\\]{background-color:#e7e5e0}.edpire-scope .bg-\\[\\#ecf8f0\\]{background-color:#ecf8f0}.edpire-scope .bg-\\[\\#f1efe9\\]{background-color:#f1efe9}.edpire-scope .bg-\\[\\#f2e2bf\\]{background-color:#f2e2bf}.edpire-scope .bg-\\[\\#f5f4f1\\]{background-color:#f5f4f1}.edpire-scope .bg-\\[\\#fbf1dc\\]{background-color:#fbf1dc}.edpire-scope .bg-\\[\\#fbfaf7\\]{background-color:#fbfaf7}.edpire-scope .bg-\\[\\#fdeeec\\]{background-color:#fdeeec}.edpire-scope .bg-amber-50{background-color:var(--color-amber-50)}.edpire-scope .bg-black{background-color:var(--color-black)}.edpire-scope .bg-black\\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-black\\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.edpire-scope .bg-black\\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-black\\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.edpire-scope .bg-gray-50{background-color:var(--color-gray-50)}.edpire-scope .bg-gray-100{background-color:var(--color-gray-100)}.edpire-scope .bg-gray-300{background-color:var(--color-gray-300)}.edpire-scope .bg-gray-900{background-color:var(--color-gray-900)}.edpire-scope .bg-red-950\\/80{background-color:#460809cc}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-red-950\\/80{background-color:color-mix(in oklab,var(--color-red-950) 80%,transparent)}}.edpire-scope .bg-white{background-color:var(--color-white)}.edpire-scope .bg-white\\/60{background-color:#fff9}@supports (color:color-mix(in lab,red,red)){.edpire-scope .bg-white\\/60{background-color:color-mix(in oklab,var(--color-white) 60%,transparent)}}.edpire-scope .object-contain{object-fit:contain}.edpire-scope .object-cover{object-fit:cover}.edpire-scope .p-1{padding:calc(var(--spacing) * 1)}.edpire-scope .p-1\\.5{padding:calc(var(--spacing) * 1.5)}.edpire-scope .p-2{padding:calc(var(--spacing) * 2)}.edpire-scope .p-3{padding:calc(var(--spacing) * 3)}.edpire-scope .p-4{padding:calc(var(--spacing) * 4)}.edpire-scope .p-6{padding:calc(var(--spacing) * 6)}.edpire-scope .px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.edpire-scope .px-2{padding-inline:calc(var(--spacing) * 2)}.edpire-scope .px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.edpire-scope .px-3{padding-inline:calc(var(--spacing) * 3)}.edpire-scope .px-3\\.5{padding-inline:calc(var(--spacing) * 3.5)}.edpire-scope .px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .px-5{padding-inline:calc(var(--spacing) * 5)}.edpire-scope .px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .px-10{padding-inline:calc(var(--spacing) * 10)}.edpire-scope .py-0\\.5{padding-block:calc(var(--spacing) * .5)}.edpire-scope .py-1{padding-block:calc(var(--spacing) * 1)}.edpire-scope .py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.edpire-scope .py-2{padding-block:calc(var(--spacing) * 2)}.edpire-scope .py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.edpire-scope .py-3{padding-block:calc(var(--spacing) * 3)}.edpire-scope .py-5{padding-block:calc(var(--spacing) * 5)}.edpire-scope .py-8{padding-block:calc(var(--spacing) * 8)}.edpire-scope .ps-2{padding-inline-start:calc(var(--spacing) * 2)}.edpire-scope .ps-\\[23px\\]{padding-inline-start:23px}.edpire-scope .pe-2\\.5{padding-inline-end:calc(var(--spacing) * 2.5)}.edpire-scope .pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.edpire-scope .pt-2{padding-top:calc(var(--spacing) * 2)}.edpire-scope .pb-1{padding-bottom:calc(var(--spacing) * 1)}.edpire-scope .pb-5{padding-bottom:calc(var(--spacing) * 5)}.edpire-scope .pl-2{padding-left:calc(var(--spacing) * 2)}.edpire-scope .text-center{text-align:center}.edpire-scope .text-right{text-align:right}.edpire-scope .text-start{text-align:start}.edpire-scope .align-middle{vertical-align:middle}.edpire-scope .font-mono{font-family:var(--font-mono)}.edpire-scope .font-sans{font-family:var(--font-sans)}.edpire-scope .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.edpire-scope .text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.edpire-scope .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.edpire-scope .text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.edpire-scope .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.edpire-scope .text-\\[1\\.6rem\\]{font-size:1.6rem}.edpire-scope .text-\\[10px\\]{font-size:10px}.edpire-scope .text-\\[11px\\]{font-size:11px}.edpire-scope .leading-none{--tw-leading:1;line-height:1}.edpire-scope .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.edpire-scope .leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.edpire-scope .font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.edpire-scope .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.edpire-scope .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.edpire-scope .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.edpire-scope .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.edpire-scope .tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.edpire-scope .tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.edpire-scope .tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.edpire-scope .break-words{overflow-wrap:break-word}.edpire-scope .whitespace-pre-wrap{white-space:pre-wrap}.edpire-scope .text-\\[\\#1d2025\\]{color:#1d2025}.edpire-scope .text-\\[\\#1f8a4c\\]{color:#1f8a4c}.edpire-scope .text-\\[\\#8a5a08\\]{color:#8a5a08}.edpire-scope .text-\\[\\#8d93a0\\]{color:#8d93a0}.edpire-scope .text-\\[\\#565b66\\]{color:#565b66}.edpire-scope .text-\\[\\#a32b1e\\]{color:#a32b1e}.edpire-scope .text-\\[\\#c8810e\\]{color:#c8810e}.edpire-scope .text-\\[\\#d23b2b\\]{color:#d23b2b}.edpire-scope .text-amber-900{color:var(--color-amber-900)}.edpire-scope .text-blue-600{color:var(--color-blue-600)}.edpire-scope .text-gray-400{color:var(--color-gray-400)}.edpire-scope .text-gray-500{color:var(--color-gray-500)}.edpire-scope .text-gray-600{color:var(--color-gray-600)}.edpire-scope .text-gray-700{color:var(--color-gray-700)}.edpire-scope .text-gray-800{color:var(--color-gray-800)}.edpire-scope .text-red-200{color:var(--color-red-200)}.edpire-scope .text-red-300{color:var(--color-red-300)}.edpire-scope .text-slate-500{color:var(--color-slate-500)}.edpire-scope .text-slate-800{color:var(--color-slate-800)}.edpire-scope .text-white{color:var(--color-white)}.edpire-scope .uppercase{text-transform:uppercase}.edpire-scope .italic{font-style:italic}.edpire-scope .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.edpire-scope .line-through{text-decoration-line:line-through}.edpire-scope .underline{text-decoration-line:underline}.edpire-scope .underline-offset-2{text-underline-offset:2px}.edpire-scope .underline-offset-4{text-underline-offset:4px}.edpire-scope .opacity-40{opacity:.4}.edpire-scope .opacity-60{opacity:.6}.edpire-scope .opacity-70{opacity:.7}.edpire-scope .shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope .outline{outline-style:var(--tw-outline-style);outline-width:1px}.edpire-scope .grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.edpire-scope .backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.edpire-scope .transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.edpire-scope .duration-300{--tw-duration:.3s;transition-duration:.3s}.edpire-scope .duration-700{--tw-duration:.7s;transition-duration:.7s}.edpire-scope .ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.edpire-scope .ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.edpire-scope .outline-none{--tw-outline-style:none;outline-style:none}.edpire-scope .select-none{-webkit-user-select:none;user-select:none}.edpire-scope :is(.edpire-scope .group-open\\:rotate-90):is(:where(.group):is([open],.edpire-scope :popover-open,.edpire-scope :open) *){rotate:90deg}@media(hover:hover){.edpire-scope :is(.edpire-scope .group-hover\\:text-\\[\\#1d2025\\]):is(:where(.group):hover *){color:#1d2025}.edpire-scope :is(.edpire-scope .group-hover\\:shadow-md):is(:where(.group):hover *){--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope :is(.edpire-scope .hover\\:border-\\[\\#8d93a0\\]):hover{border-color:#8d93a0}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#31353c\\]):hover{background-color:#31353c}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#e7e5e0\\]):hover{background-color:#e7e5e0}.edpire-scope :is(.edpire-scope .hover\\:bg-\\[\\#f1efe9\\]):hover{background-color:#f1efe9}.edpire-scope :is(.edpire-scope .hover\\:bg-gray-100):hover{background-color:var(--color-gray-100)}.edpire-scope :is(.edpire-scope .hover\\:bg-white):hover{background-color:var(--color-white)}.edpire-scope :is(.edpire-scope .hover\\:text-\\[\\#1d2025\\]):hover{color:#1d2025}.edpire-scope :is(.edpire-scope .hover\\:text-gray-700):hover{color:var(--color-gray-700)}.edpire-scope :is(.edpire-scope .hover\\:text-rose-500):hover{color:var(--color-rose-500)}.edpire-scope :is(.edpire-scope .hover\\:underline):hover{text-decoration-line:underline}}.edpire-scope :is(.edpire-scope .focus\\:outline-none):focus{--tw-outline-style:none;outline-style:none}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-2):focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-\\[\\#8d93a0\\]):focus-visible{--tw-ring-color:#8d93a0}.edpire-scope :is(.edpire-scope .focus-visible\\:ring-offset-2):focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.edpire-scope :is(.edpire-scope .focus-visible\\:outline-2):focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.edpire-scope :is(.edpire-scope .focus-visible\\:outline-\\[\\#1d2025\\]):focus-visible{outline-color:#1d2025}.edpire-scope :is(.edpire-scope .disabled\\:cursor-not-allowed):disabled{cursor:not-allowed}.edpire-scope :is(.edpire-scope .disabled\\:opacity-50):disabled{opacity:.5}.edpire-scope :is(.edpire-scope .data-\\[flash\\=true\\]\\:bg-\\[\\#fbf1dc\\])[data-flash=true]{background-color:#fbf1dc}.edpire-scope :is(.edpire-scope .data-\\[flash\\=true\\]\\:duration-150)[data-flash=true]{--tw-duration:.15s;transition-duration:.15s}@media(min-width:40rem){.edpire-scope .sm\\:block{display:block}.edpire-scope .sm\\:hidden{display:none}.edpire-scope .sm\\:inline{display:inline}.edpire-scope .sm\\:inline-flex{display:inline-flex}.edpire-scope .sm\\:flex-row{flex-direction:row}.edpire-scope .sm\\:flex-nowrap{flex-wrap:nowrap}.edpire-scope .sm\\:items-center{align-items:center}.edpire-scope .sm\\:gap-4{gap:calc(var(--spacing) * 4)}.edpire-scope .sm\\:px-4{padding-inline:calc(var(--spacing) * 4)}.edpire-scope .sm\\:px-6{padding-inline:calc(var(--spacing) * 6)}.edpire-scope .sm\\:py-4{padding-block:calc(var(--spacing) * 4)}.edpire-scope .sm\\:text-\\[2rem\\]{font-size:2rem}}@container (min-width:72rem){.edpire-scope .\\@6xl\\:flex{display:flex}.edpire-scope .\\@6xl\\:hidden{display:none}}.edpire-scope :is(.edpire-scope .rtl\\:translate-x-\\[110\\%\\]):where(:dir(rtl),.edpire-scope [dir=rtl],.edpire-scope [dir=rtl] *){--tw-translate-x:110%;translate:var(--tw-translate-x) var(--tw-translate-y)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:min-h-\\[80px\\]) .ProseMirror{min-height:80px}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror\\]\\:outline-none) .ProseMirror{--tw-outline-style:none;outline-style:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:pointer-events-none) .ProseMirror p.is-editor-empty:first-child:before{pointer-events:none}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:float-left) .ProseMirror p.is-editor-empty:first-child:before{float:left}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:h-0) .ProseMirror p.is-editor-empty:first-child:before{height:calc(var(--spacing) * 0)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:text-gray-400) .ProseMirror p.is-editor-empty:first-child:before{color:var(--color-gray-400)}.edpire-scope :is(.edpire-scope .\\[\\&_\\.ProseMirror_p\\.is-editor-empty\\:first-child\\:\\:before\\]\\:content-\\[attr\\(data-placeholder\\)\\]) .ProseMirror p.is-editor-empty:first-child:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}@layer base{.edpire-scope *,.edpire-scope :after,.edpire-scope :before,.edpire-scope ::backdrop{border-color:var(--color-gray-200,currentColor)}.edpire-scope ::file-selector-button{border-color:var(--color-gray-200,currentColor)}}@supports not (height:100dvh){.edpire-scope .h-dvh{height:100vh}}.edpire-scope :where(span:has(>textarea.player-typed-blank)){line-height:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
|
|
49
|
-
`);import{jsx as
|
|
49
|
+
`);import{jsx as ln}from"react/jsx-runtime";var qa=mc.memo(function({content:r,onAnswersChange:t,feedback:n,initialAnswers:a,readOnly:s,className:o,dir:i}){let c=uc(()=>{if(n)return new Map(Object.entries(n))},[n]),d=ln(pr,{content:r,onAnswersChange:t,initialAnswers:a,validationFeedback:c,readOnly:s,className:o});return ln("div",{className:"edpire-scope",style:{display:"contents"},children:i?ln("div",{dir:i,children:d}):d})});import{useEffect as nl,useRef as kn}from"react";import xo from"react";import{createRoot as yo}from"react-dom/client";import{useCallback as fo,useMemo as Xc,useState as Jc}from"react";import{cloneElement as oo,isValidElement as so,useCallback as Xe,useEffect as xn,useMemo as Te,useRef as wt,useState as je}from"react";import{Send as io,Loader2 as fn,BarChart2 as co,CheckCircle2 as Oc,XCircle as jc,RotateCcw as Bc,X as hn,Clock as hr,AlertTriangle as Wc,Check as qc,CloudOff as Uc}from"lucide-react";import{clsx as fc}from"clsx";import{twMerge as hc}from"tailwind-merge";function ye(...e){return hc(fc(e))}import{Fragment as vc,jsx as ge,jsxs as dn}from"react/jsx-runtime";function gc({accent:e}){return ge("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function bc({accent:e}){return ge("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(r=>ge("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${r*.2}s infinite`}},r))})}function xc({accent:e}){return dn("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(r=>ge("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${r*.8}s infinite`}},r)),ge("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function yc({accent:e}){return ge("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(r=>ge("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${r*.15}s infinite`}},r))})}function Ua({visible:e,bgColor:r="rgba(0,0,0,0.55)",accentColor:t="#6366f1",text:n="Evaluating your answers\u2026",aiText:a="Some answers are being reviewed by AI, this may take a few seconds.",spinnerTheme:s="default",animationUrl:o,hasAiNodes:i=!1,contained:c=!1}){return e?dn(vc,{children:[ge("style",{children:`
|
|
50
50
|
@keyframes edpire-spin {
|
|
51
51
|
to { transform: rotate(360deg); }
|
|
52
52
|
}
|
|
@@ -62,5 +62,5 @@ sys.stdin = io.StringIO(${JSON.stringify(s)})
|
|
|
62
62
|
0%, 100% { height: 12px; }
|
|
63
63
|
50% { height: 40px; }
|
|
64
64
|
}
|
|
65
|
-
`}),ge("div",{style:{background:r},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:rn("div",{className:"flex flex-col items-center gap-5 bg-white rounded-2xl shadow-2xl px-10 py-8 max-w-xs text-center",children:[(()=>{if(s)return ge("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(a){case"dots":return ge(rc,{accent:t});case"pulse":return ge(tc,{accent:t});case"bars":return ge(nc,{accent:t});default:return ge(ec,{accent:t})}})(),ge("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&ge("p",{className:"text-xs text-slate-500 leading-snug",children:o})]})})]}):null}import{useCallback as zo,useEffect as ac,useMemo as Do,useRef as gt,useState as sc}from"react";import{BookOpen as Fo,X as ic}from"lucide-react";import{Fragment as lc,jsx as le,jsxs as Ee}from"react/jsx-runtime";function tn(e){return e.exercises.flatMap((r,t)=>r.sharedContext&&Sr(r.sharedContext)?[{id:r.id,index:t,content:r.sharedContext}]:[])}var Oo=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function cc(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function jo({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:d,t:l,footer:m}){let[y,b]=sc(!1),S=e.annex,f=S?.tabLabel||l("annexDocuments"),g=Do(()=>tn(e),[e]),w=gt(null),h=gt(null),_=gt(null),u=gt(null),x=()=>(w.current?.getClientRects().length??0)>0,N=zo((E,W)=>{let v=E?.querySelector(`[data-reference-for="${CSS.escape(W)}"]`);if(!E||!v)return;let M=v.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-12;E.scrollTo({top:M,behavior:Oo()?"auto":"smooth"}),cc(v)},[]),C=zo(E=>{if(x()){N(h.current,E);return}b(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>N(u.current,E)))},[N]),$=E=>{let W=x()?w.current:_.current;x()||b(!1),Array.from(W?.querySelectorAll(`[data-exercise-id="${CSS.escape(E)}"]`)??[]).find(M=>M.getClientRects().length>0)?.scrollIntoView({behavior:Oo()?"auto":"smooth",block:"start"})};ac(()=>{let E=w.current;if(!E||g.length===0||typeof IntersectionObserver>"u")return;let W=new Set(g.map(F=>F.id)),v=null,M=new IntersectionObserver(F=>{if(!x())return;let j=F.filter(H=>H.isIntersecting&&W.has(H.target.dataset.exerciseId??"")).sort((H,U)=>H.boundingClientRect.top-U.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!j||j===v||(v=j,N(h.current,j))},{root:E,rootMargin:"0px 0px -60% 0px"});return E.querySelectorAll("[data-exercise-id]").forEach(F=>M.observe(F)),()=>M.disconnect()},[g,N]);let k=Do(()=>({label:f,showExerciseReference:C}),[f,C]),p=Ee(lc,{children:[S?.items.map(E=>le(Nr,{item:E},E.id)),S?.items.length&&g.length?le("div",{className:"border-t border-[#e7e5e0]"}):null,g.map(E=>Ee("section",{"data-reference-for":E.id,className:"-mx-3 flex flex-col gap-2 rounded-[10px] px-3 py-2 transition-colors duration-700 data-[flash=true]:bg-[#fbf1dc] data-[flash=true]:duration-150",children:[le("button",{type:"button",onClick:()=>$(E.id),className:"self-start cursor-pointer text-xs font-bold uppercase tracking-widest text-[#565b66] underline-offset-4 hover:text-[#1d2025] hover:underline focus-visible:outline-2 focus-visible:outline-[#1d2025] rounded-sm",children:l("exercise",{index:E.index+1})}),le(ur,{content:E.content})]},E.id))]}),T=le(Ke,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});return le(pt,{value:k,children:Ee("div",{className:ye("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ee("div",{ref:w,className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Ee("div",{className:"flex-1 sticky top-4 max-h-[calc(100svh-6rem)] flex flex-col bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[Ee("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[le(Fo,{size:14,className:"text-[#8d93a0]"}),le("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:f})]}),le("div",{ref:h,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:p})]}),le("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),le("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Ee("div",{className:"px-6 py-5 flex flex-col gap-4",children:[T,m]})})]}),Ee("div",{className:"@6xl:hidden flex-1 relative overflow-hidden",children:[le("div",{ref:_,className:"absolute inset-0 overflow-y-auto",children:Ee("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:d},children:[T,m]})}),y&&le("div",{className:ye("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>b(!1)}),Ee("div",{role:"dialog","aria-label":f,"aria-hidden":!y,className:ye("top-1/2 start-2 -translate-y-1/2 z-40 w-[88%] bg-[#f1efe9] rounded-2xl shadow-2xl flex flex-col overflow-hidden transition-transform duration-300 ease-in-out",i?"absolute":"fixed",y?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Ee("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[le("span",{className:"text-sm font-bold text-[#1d2025]",children:f}),le("button",{onClick:()=>b(!1),"aria-label":l("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:le(ic,{size:18})})]}),le("div",{ref:u,className:"overflow-y-auto max-h-[calc(100vh-8rem)] px-5 pb-5 flex flex-col gap-5",children:p})]})]}),!y&&Ee("button",{onClick:()=>b(!0),"aria-label":f,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:ye("@6xl:hidden top-1/2 start-0 z-20 flex flex-col items-center gap-1 py-3 px-1.5 bg-[#1d2025] text-white text-[10px] font-bold uppercase tracking-wider rounded-e-lg shadow-md hover:bg-[#31353c] transition-colors",i?"absolute":"fixed"),children:[le(Fo,{size:12}),le("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:f})]})]})})}import{useState as dc}from"react";import{BookOpen as Bo,Plus as pc,X as mc}from"lucide-react";import{jsx as ue,jsxs as We}from"react/jsx-runtime";function qo({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:d,t:l,onAddAnnex:m,footer:y}){let[b,S]=dc(!1),f=ue(Ke,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});if(b)return ue("div",{className:"flex-1 overflow-y-auto",children:We("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:d},children:[f,y]})});let g=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),m())},w=_=>We("span",{style:s?{backgroundColor:s}:void 0,className:ye("flex-none inline-flex items-center gap-1.5 rounded-lg bg-[#1d2025] text-white font-semibold shadow-sm group-hover:shadow-md transition-shadow",_?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[ue(pc,{size:13}),l("annexEmptyCta")]}),h=_=>ue("button",{type:"button",onClick:u=>{u.stopPropagation(),S(!0)},"aria-label":l("annexEmptyDismiss"),title:l("annexEmptyDismiss"),className:ye("flex-none flex items-center justify-center w-7 h-7 rounded-lg text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] transition-colors cursor-pointer",_&&"absolute top-2 end-2 z-10"),children:ue(mc,{size:15})});return We("div",{className:ye("@container flex-1 min-h-0 flex",i&&"relative"),children:[We("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[ue("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:We("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:g,className:"group relative flex-1 w-full flex flex-col items-center justify-center gap-3 text-center rounded-[14px] border-2 border-dashed border-[#d6d3cc] bg-white/60 hover:border-[#8d93a0] hover:bg-white transition-colors cursor-pointer px-6 py-8 outline-none focus-visible:ring-2 focus-visible:ring-[#8d93a0] focus-visible:ring-offset-2",children:[h(!0),ue("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:ue(Bo,{size:20})}),ue("span",{className:"text-sm font-bold text-[#565b66]",children:l("annexEmptyTitle")}),ue("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:l("annexEmptyBody")}),w(!1)]})}),ue("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ue("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:We("div",{className:"px-6 py-5 flex flex-col gap-4",children:[f,y]})})]}),ue("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:We("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:d},children:[We("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:g,className:"group flex items-center gap-3 rounded-[14px] border-2 border-dashed border-[#d6d3cc] bg-white/60 hover:border-[#8d93a0] hover:bg-white transition-colors cursor-pointer px-4 py-2.5 outline-none focus-visible:ring-2 focus-visible:ring-[#8d93a0]",children:[ue("span",{className:"flex-none flex items-center justify-center w-9 h-9 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:ue(Bo,{size:16})}),We("div",{className:"flex-1 min-w-0",children:[ue("div",{className:"text-xs font-bold text-[#565b66]",children:l("annexEmptyTitle")}),ue("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:l("annexEmptyBody")})]}),w(!0),h(!1)]}),f,y]})})]})}function nn(e){let r=new Map;for(let t of e){let n=new Map;for(let o of t.questions){let a=new Map;for(let s of o.nodeResults){let i={state:s.status,showFeedback:!0,score:s.score,...s.feedback!==void 0?{message:s.feedback}:{},...s.displayAnswer!==void 0?{displayAnswer:s.displayAnswer}:{},...s.teacherFeedback!==void 0?{teacherFeedback:s.teacherFeedback}:{}};s.detail?.type==="choiceSet"?i.correctChoiceIds=s.detail.correctChoiceIds:s.detail?.type==="matchingSet"&&(i.pairFeedback=s.detail.pairFeedback,i.correctPairings=s.detail.correctPairings),a.set(s.nodeId,i)}n.set(o.questionId,a)}r.set(t.exerciseId,n)}return r}import{jsx as Wo,jsxs as uc}from"react/jsx-runtime";function on({content:e,label:r}){return uc("div",{className:"player-ai-feedback mt-3 mb-3",children:[Wo("p",{className:"text-xs font-semibold",children:r}),Wo(ur,{content:e})]})}var fc=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),hc=new Set(["blankPool","inlinePool"]);function gc(e){switch(e.type){case"choiceSet":case"inlineChoiceSet":return e.answer.selectedIds.length>0;case"blank":return e.answer.mode==="choice"?e.answer.choiceId.length>0:e.answer.text.trim().length>0;case"matchingSet":return e.answer.connections.length>0;case"aiAnswer":return e.answer.text.trim().length>0;case"openResponse":{let r=e.answer;return r.recording||r.files&&r.files.length>0?!0:(r.text?.wordCount??0)>0}case"mathResponse":return e.answer.latex.trim().length>0;case"codingResponse":return e.answer.source.trim().length>0;default:{let r=e;return!0}}}function bc(e){let r=0,t=n=>{if(Array.isArray(n)){for(let s of n)t(s);return}if(!n||typeof n!="object")return;let{type:o,content:a}=n;if(typeof o=="string"){if(fc.has(o)){r+=1;return}if(hc.has(o))return}a!==void 0&&t(a)};return t(e),r}function Uo(e,r){let t=new Map;for(let o of r?.exerciseAnswers??[])for(let a of o.questionAnswers){let s=t.get(a.questionId);s||(s=new Set,t.set(a.questionId,s));for(let i of a.answers)gc(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((o,a)=>{o.questions.forEach((s,i)=>{let c=bc(s.content);c!==0&&(t.get(s.id)?.size??0)<c&&n.push({questionId:s.id,exerciseIndex:a,questionIndex:i,only:o.questions.length===1})})}),n}var xc={exercise:"Exercise {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Submit Assessment",submitting:"Submitting...",confirmTitle:"Submit Assessment",confirmDescription:"Are you sure you want to submit? You cannot change your answers after submitting.",unansweredOne:"1 question is not fully answered.",unansweredMany:"{count} questions are not fully answered.",unansweredMore:"and {count} more",confirmSubmit:"Submit",confirmCancel:"Cancel",assessmentPassed:"Assessment passed",assessmentNotPassed:"Assessment not passed",awaitingReview:"Awaiting review",awaitingReviewDesc:"Your teacher is reviewing your open responses. Your final score will be available once grading is complete.",beingMarked:"Being marked",beingMarkedDesc:"Some answers are still being marked. Your final score will be available once every answer is marked.",pendingReview:"Pending review",viewFullReport:"View Full Report",explanation:"Explanation",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI, this may take a few seconds.",reset:"Reset",back:"Back",annexDocuments:"Documents",annexEmptyTitle:"No reference yet",annexEmptyBody:"A text, figure, table or document that stays in view across the whole assessment while students answer.",annexEmptyCta:"Add reference",annexEmptyDismiss:"Hide","timeUp.title":"Time's up","timeUp.submitting":"Submitting your answers\u2026",yourScore:"Your score",answersSaving:"Saving\u2026",answersSaved:"Answers saved",answersNotSaved:"Your answers aren't being saved. Check your connection.",resumeRestored:"Welcome back. Your answers are here.",resumeFresh:"Welcome back.",resumeTimeLeft:"The clock kept running: {minutes} min left.",close:"Close"},yc={exercise:"Exercice {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Soumettre l'\xE9valuation",submitting:"Soumission...",confirmTitle:"Soumettre l'\xE9valuation",confirmDescription:"\xCAtes-vous s\xFBr de vouloir soumettre ? Vous ne pourrez pas modifier vos r\xE9ponses.",unansweredOne:"1 question n'est pas enti\xE8rement remplie.",unansweredMany:"{count} questions ne sont pas enti\xE8rement remplies.",unansweredMore:"et {count} autres",confirmSubmit:"Soumettre",confirmCancel:"Annuler",assessmentPassed:"\xC9valuation r\xE9ussie",assessmentNotPassed:"\xC9valuation non r\xE9ussie",awaitingReview:"En attente de correction",awaitingReviewDesc:"Votre professeur examine vos r\xE9ponses ouvertes. Votre note finale sera disponible une fois la correction termin\xE9e.",beingMarked:"Correction en cours",beingMarkedDesc:"Certaines r\xE9ponses sont encore en cours de correction. Votre note finale sera disponible d\xE8s que toutes les r\xE9ponses seront corrig\xE9es.",pendingReview:"En attente de correction",viewFullReport:"Voir le rapport complet",explanation:"Explication",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA, cela peut prendre quelques secondes.",reset:"R\xE9initialiser",back:"Retour",annexDocuments:"Documents",annexEmptyTitle:"Aucune annexe pour l'instant",annexEmptyBody:"Un texte, une figure, un tableau ou un document qui reste visible pour toute l'\xE9valuation pendant que les \xE9l\xE8ves r\xE9pondent.",annexEmptyCta:"Ajouter une annexe",annexEmptyDismiss:"Masquer","timeUp.title":"Temps \xE9coul\xE9","timeUp.submitting":"Envoi de vos r\xE9ponses\u2026",yourScore:"Votre score",answersSaving:"Enregistrement\u2026",answersSaved:"R\xE9ponses enregistr\xE9es",answersNotSaved:"Vos r\xE9ponses ne sont pas enregistr\xE9es. V\xE9rifiez votre connexion.",resumeRestored:"Bon retour. Vos r\xE9ponses sont l\xE0.",resumeFresh:"Bon retour.",resumeTimeLeft:"Le chrono a continu\xE9 : il reste {minutes} min.",close:"Fermer"},vc={exercise:"\u062A\u0645\u0631\u064A\u0646 {index}",question:"\u0633\u0624\u0627\u0644 {index}",points:"\u0646\u0642\u0637\u0629","points.two":"\u0646\u0642\u0637\u062A\u0627\u0646","points.few":"\u0646\u0642\u0627\u0637",submit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",submitting:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644...",confirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",confirmDescription:"\u0647\u0644 \u0623\u0646\u062A \u0645\u062A\u0623\u0643\u062F \u0645\u0646 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u061F \u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u063A\u064A\u064A\u0631 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",unansweredOne:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 \u0633\u0624\u0627\u0644 \u0648\u0627\u062D\u062F.",unansweredMany:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 {count} \u0645\u0646 \u0627\u0644\u0623\u0633\u0626\u0644\u0629.",unansweredMore:"\u0648{count} \u0623\u062E\u0631\u0649",confirmSubmit:"\u0625\u0631\u0633\u0627\u0644",confirmCancel:"\u0625\u0644\u063A\u0627\u0621",assessmentPassed:"\u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",assessmentNotPassed:"\u0644\u0645 \u064A\u062A\u0645 \u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",awaitingReview:"\u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",awaitingReviewDesc:"\u064A\u0642\u0648\u0645 \u0645\u0639\u0644\u0645\u0643 \u0628\u0645\u0631\u0627\u062C\u0639\u0629 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0627\u0644\u0645\u0641\u062A\u0648\u062D\u0629. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u0627\u0643\u062A\u0645\u0627\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D.",beingMarked:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",beingMarkedDesc:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0645\u0627 \u0632\u0627\u0644\u062A \u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u062A\u0635\u062D\u064A\u062D \u062C\u0645\u064A\u0639 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A.",pendingReview:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",viewFullReport:"\u0639\u0631\u0636 \u0627\u0644\u062A\u0642\u0631\u064A\u0631 \u0627\u0644\u0643\u0627\u0645\u0644",explanation:"\u0634\u0631\u062D",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Edpire",evaluating:"\u062C\u0627\u0631\u064D \u062A\u0642\u064A\u064A\u0645 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",aiEvaluating:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0642\u064A\u062F \u0627\u0644\u0645\u0631\u0627\u062C\u0639\u0629 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u060C \u0642\u062F \u064A\u0633\u062A\u063A\u0631\u0642 \u0630\u0644\u0643 \u0628\u0636\u0639 \u062B\u0648\u0627\u0646\u064D.",reset:"\u0625\u0639\u0627\u062F\u0629 \u062A\u0639\u064A\u064A\u0646",back:"\u0631\u062C\u0648\u0639",annexDocuments:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexEmptyTitle:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u064F\u0644\u062D\u064E\u0642 \u0628\u0639\u062F",annexEmptyBody:"\u0646\u0635 \u0623\u0648 \u0635\u0648\u0631\u0629 \u0623\u0648 \u062C\u062F\u0648\u0644 \u0623\u0648 \u0645\u0633\u062A\u0646\u062F \u064A\u0628\u0642\u0649 \u0638\u0627\u0647\u0631\u064B\u0627 \u0637\u0648\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0623\u062B\u0646\u0627\u0621 \u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0644\u0627\u0628.",annexEmptyCta:"\u0625\u0636\u0627\u0641\u0629 \u0645\u064F\u0644\u062D\u064E\u0642",annexEmptyDismiss:"\u0625\u062E\u0641\u0627\u0621","timeUp.title":"\u0627\u0646\u062A\u0647\u0649 \u0627\u0644\u0648\u0642\u062A","timeUp.submitting":"\u062C\u0627\u0631\u064D \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",yourScore:"\u0646\u062A\u064A\u062C\u062A\u0643",answersSaving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",answersSaved:"\u062A\u0645 \u062D\u0641\u0638 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",answersNotSaved:"\u0644\u0627 \u064A\u062A\u0645 \u062D\u0641\u0638 \u0625\u062C\u0627\u0628\u0627\u062A\u0643. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",resumeRestored:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643. \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0647\u0646\u0627.",resumeFresh:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643.",resumeTimeLeft:"\u0627\u0633\u062A\u0645\u0631\u0651 \u0627\u0644\u0645\u0624\u0642\u0651\u062A: \u062A\u0628\u0642\u0651\u0649 {minutes} \u062F\u0642\u064A\u0642\u0629.",close:"\u0625\u063A\u0644\u0627\u0642"},fr={en:xc,fr:yc,ar:vc};function wc(e,r,t){let o=(fr[e]??fr.en)[r]??fr.en[r]??r;return t?Object.entries(t).reduce((a,[s,i])=>a.replace(`{${s}}`,String(i)),o):o}function Ho(e,r){let t=new Intl.PluralRules(e).select(r),n=fr[e]??fr.en;return n[`points.${t}`]??n.points??fr.en.points}function Vo(e){return(r,t)=>wc(e,r,t)}function Qo(e){return e==="ar"}function bt(e){return e==="en"?"en":"fr"}var Go="48rem";import"katex/dist/katex.min.css";tr(`.edpire-annex-layout{display:flex;flex:1;min-width:0;height:100%;overflow:hidden;position:relative}.edpire-annex-main{flex:1;min-width:0;overflow:hidden;display:flex;flex-direction:column}.edpire-annex-panel{width:38%;min-width:calc(280px * var(--edp-scale, 1));max-width:calc(480px * var(--edp-scale, 1));flex-shrink:0;display:flex;flex-direction:column;border-right:1px solid #e5e7eb;background:#fff;overflow:hidden}.edpire-annex-panel__header{flex-shrink:0;padding:calc(12px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb}.edpire-annex-panel__header-label{font-size:calc(11px * var(--edp-scale, 1));font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#6b7280}.edpire-annex-panel__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-tab,.edpire-annex-drawer,.edpire-annex-backdrop{display:none}@media(max-width:1023px){.edpire-annex-panel{display:none}.edpire-annex-tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(8px * var(--edp-scale, 1));position:fixed;left:0;top:50%;transform:translateY(-50%);z-index:40;background:var(--edpire-annex-tab-bg, #2563eb);color:var(--edpire-annex-tab-color, #ffffff);border:none;border-radius:0 calc(10px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1)) 0;padding:calc(18px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1));cursor:pointer;box-shadow:2px 2px 16px #0000002e;transition:filter .15s}.edpire-annex-tab:hover{filter:brightness(.88)}.edpire-annex-tab__label{writing-mode:vertical-rl;text-orientation:mixed;transform:rotate(180deg);font-size:calc(11px * var(--edp-scale, 1));font-weight:700;letter-spacing:.07em;text-transform:uppercase;white-space:nowrap}.edpire-annex-drawer{display:flex;flex-direction:column;position:fixed;left:0;top:0;bottom:0;width:min(84vw,calc(440px * var(--edp-scale, 1)));background:#fff;z-index:50;transform:translate(-100%);transition:transform .28s cubic-bezier(.4,0,.2,1);box-shadow:4px 0 32px #00000021;overflow:hidden}.edpire-annex-drawer--open{transform:translate(0)}.edpire-annex-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:calc(16px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb;flex-shrink:0}.edpire-annex-drawer__label{font-size:calc(13px * var(--edp-scale, 1));font-weight:700;color:#111827}.edpire-annex-drawer__close{display:flex;align-items:center;justify-content:center;width:calc(28px * var(--edp-scale, 1));height:calc(28px * var(--edp-scale, 1));background:none;border:none;cursor:pointer;font-size:calc(20px * var(--edp-scale, 1));line-height:1;color:#9ca3af;border-radius:calc(6px * var(--edp-scale, 1));transition:color .15s,background .15s}.edpire-annex-drawer__close:hover{color:#111827;background:#f3f4f6}.edpire-annex-drawer__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-backdrop{display:block;position:fixed;inset:0;background:#00000061;z-index:45;cursor:pointer}}
|
|
66
|
-
`);import{Fragment as ln,jsx as I,jsxs as O}from"react/jsx-runtime";var Cc="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f46e5'%3E%3Cpath d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18L19.5 8 12 11.82 4.5 8 12 4.18zM4 9.6l7 3.5v7.3L4 16.9V9.6zm9 10.8v-7.3l7-3.5v7.3L13 20.4z'/%3E%3C/svg%3E";function Ec(e){for(let r of e.exercises)for(let t of r.questions)if((t.content.content??[]).some(o=>o.type==="aiAnswerInput"))return!0;return!1}function ra(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function Zo(e){return e.questions.reduce((r,t)=>r+ra(t),0)}function Ue(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var cn=5;function ta(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function Pc({outcome:e}){let r=e==="full"?"M20 54 L41 75 L82 24":e==="none"?"M27 27 L73 73 M73 27 L27 73":"M14 58 C29 33 40 33 52 51 C64 69 74 69 88 42";return I("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:ta(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:I("path",{d:r})})}function Mc({score:e,weight:r,unit:t,t:n}){if(e){if(e.awaiting)return O("span",{className:"inline-flex items-center gap-1 rounded-lg border border-[#f2e2bf] bg-[#fbf1dc] px-2 py-0.5 text-xs font-semibold text-[#8a5a08]",children:[I(hr,{size:11}),n("pendingReview")]});let o=e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return O("span",{className:"inline-flex items-center gap-1.5 rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] ps-2 pe-2.5 py-0.5",children:[I(Pc,{outcome:o}),O("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:ta(o)},children:[Ue(e.s)," / ",Ue(e.m)]})]})}return r>0?O("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[Ue(r)," ",t(r)]}):null}function ea(e){let r=new Map;for(let t of e?.exerciseAnswers??[])for(let n of t.questionAnswers)r.set(n.questionId,n.answers);return r}function Ic(e,r){return r.size===0?e:{exerciseAnswers:e.exerciseAnswers.map(t=>({...t,questionAnswers:t.questionAnswers.map(n=>n.answers.length===0&&r.has(n.questionId)?{...n,answers:r.get(n.questionId)}:n)}))}}function Lc({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,o=new Date(r).getTime()+n,[a,s]=je(()=>Math.max(o-Date.now(),0)),i=xt(t);i.current=t,dn(()=>{if(a<=0){i.current();return}let f=setInterval(()=>{let g=Math.max(o-Date.now(),0);s(g),g<=0&&(clearInterval(f),i.current())},1e3);return()=>clearInterval(f)},[o]);let c=a/n,d=c<.1?"bg-[#fdeeec] text-[#a32b1e] border-[#f6cfc9] animate-pulse":c<.25?"bg-[#fbf1dc] text-[#8a5a08] border-[#f2e2bf]":"bg-[#f5f4f1] text-[#565b66] border-[#e7e5e0]",l=Math.ceil(a/1e3),m=Math.floor(l/3600),y=Math.floor(l%3600/60),b=l%60,S=m>0?`${m}:${String(y).padStart(2,"0")}:${String(b).padStart(2,"0")}`:`${y}:${String(b).padStart(2,"0")}`;return O("span",{className:ye("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-bold tabular-nums transition-colors",d),children:[I(hr,{size:12}),S]})}function Ar({assessment:e,meta:r,locale:t="en",branding:n,timeLimitMinutes:o,startedAt:a,initialAnswers:s,onAnswersChange:i,saveState:c,resumed:d=!1,onSubmit:l,review:m,onViewReport:y,reportLabel:b,onBack:S,backLabel:f,allowReset:g,onReset:w,overlayConfig:h,contained:_=!1,layout:u,onClose:x,mediaHandler:N,onAddAnnex:C,fallbackLogoUrl:$}){let k=Le(()=>Vo(t),[t]),p=Xe(B=>Ho(t,B),[t]),T=Qo(t)?"rtl":"ltr",E=xt(null),W=u?.maxWidth??Go,v=n?.branding?.primaryColor,M=n?.branding?.accentColor,F=n?.branding?.fontFamily,z=n?.branding?.fontUrl,j=n?.branding?.showPoweredBy!==!1;dn(()=>{if(!z||typeof document>"u"||document.querySelector(`link[href="${z}"]`))return;let ae=document.createElement("link");ae.rel="stylesheet",ae.href=z,document.head.appendChild(ae)},[z]);let[H,U]=je(()=>m?.answers??s??{exerciseAnswers:[]}),[X]=je(()=>m?new Map:ea(s)),R=xt(i);R.current=i;let P=Xe(B=>{let ae=Ic(B,X);U(ae),R.current?.(ae)},[X]),[D,G]=je(null);dn(()=>{G(Date.now())},[]);let[Y,be]=je(d&&!m),ne=Le(()=>{if(D===null||!o||o<=0||!a)return null;let B=new Date(a).getTime()+o*6e4-D;return B>0?Math.max(1,Math.floor(B/6e4)):null},[D,o,a]),[ee,se]=je(!1),[ie,we]=je(!1),[Q,Je]=je(m?.result??null),hn=Le(()=>ea(m?.answers),[m]),[gn,Cr]=je(null),[yt,bn]=je(!1),xn=xt(!1),pa=Le(()=>Ec(e),[e]),yn=Le(()=>ie?Uo(e,H):[],[ie,e,H]),gr=yn.length,ma=Xe(B=>{we(!1);let ae=E.current?.querySelectorAll(`[data-question-id="${CSS.escape(B)}"]`),ve=Array.from(ae??[]).find(Pe=>Pe.getClientRects().length>0);ve&&requestAnimationFrame(()=>ve.scrollIntoView({block:"start",behavior:"smooth"}))},[]),vt=Le(()=>e.exercises.reduce((B,ae)=>B+Zo(ae),0),[e]),wt=Le(()=>Q?nn(Q.exerciseFeedback):void 0,[Q]),vn=Le(()=>{let B=new Map;for(let ae of Q?.exerciseFeedback??[])for(let ve of ae.questions)ve.explanation&&B.set(ve.questionId,ve.explanation);return B},[Q]),wn=Le(()=>{if(!Q)return{};let B={};for(let ae of Q.exerciseFeedback){let ve=0,Pe=0,fe=!1;for(let nr of ae.questions)for(let Be of nr.nodeResults)ve+=Be.score,Pe+=Be.maxScore,Be.status==="awaiting_review"&&(fe=!0);B[ae.exerciseId]={score:ve,maxScore:Pe,awaiting:fe}}return B},[Q]),kn=Le(()=>{if(!Q)return{};let B={};for(let ae of Q.exerciseFeedback)for(let ve of ae.questions){let Pe=0,fe=0,nr=!1;for(let Be of ve.nodeResults)Pe+=Be.score,fe+=Be.maxScore,Be.status==="awaiting_review"&&(nr=!0);B[ve.questionId]={score:Pe,maxScore:fe,awaiting:nr}}return B},[Q]),ua=Xe(async()=>{se(!0),Cr(null);try{let B=await l(H);Je(B),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(B){Cr(B instanceof Error?B.message:k("confirmCancel"))}finally{se(!1),we(!1)}},[H,l,k]),Rn=Xe(()=>{!Q||!y||y(Q)},[Q,y]),fa=Xe(()=>{xn.current||ee||Q||(xn.current=!0,bn(!0),we(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{se(!0),Cr(null),l(H).then(B=>{Je(B),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(B=>{Cr(B instanceof Error?B.message:"submit_error")}).finally(()=>{se(!1),bn(!1)})},800))},[H,ee,l,Q]),kt=Xe((B,ae,ve)=>{let Pe=Zo(B),fe=wn[B.id],nr=B.questions.length>1,Be=Ko(ae)?Yo(ae,{renderQuestion:(Mr,_t,ga)=>{let He=Mr.id,Sn=X.get(He),_n={...N?{mediaHandler:N}:{},...m?{initialAnswers:hn.get(He)??[],readOnly:!0}:Sn?{initialAnswers:Sn}:{}},Nn=Object.keys(_n).length>0&&Ko(_t)?Yo(_t,_n):_t,Ir=vn.get(He);if(!nr)return O("div",{"data-question-id":He,children:[Nn,Ir&&I(on,{content:Ir,label:k("explanation")})]},He);let Lr=kn[He],ba=ra(Mr);return O("div",{"data-question-id":He,children:[O("div",{className:"flex items-center gap-2.5 mb-3",children:[I("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f1efe9] px-3 py-1 text-xs font-bold tracking-tight text-[#1d2025]",children:k("question",{index:ga+1})}),I(Mc,{score:Lr?{s:Lr.score,m:Lr.maxScore,awaiting:Lr.awaiting}:null,weight:ba,unit:p,t:k})]}),Nn,Ir&&I(on,{content:Ir,label:k("explanation")})]},He)},renderSeparator:Mr=>I("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Mr}`)}):ae;return O("div",{"data-exercise-id":B.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[O("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:M?{backgroundColor:M}:void 0,children:[I("span",{className:"text-sm font-bold text-[#1d2025]",children:k("exercise",{index:ve+1})}),fe?.awaiting?O("span",{className:"inline-flex items-center gap-1 text-xs font-semibold text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-full px-2 py-0.5",children:[I(hr,{size:11}),k("pendingReview")]}):fe?O("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:fe.maxScore>0&&fe.score>=fe.maxScore?"#1f8a4c":fe.maxScore>0&&fe.score>0?"#c8810e":fe.maxScore>0?"#d23b2b":"#8d93a0"},children:[Ue(fe.score)," / ",Ue(fe.maxScore)]}):Pe>0?O("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",Ue(Pe)," ",p(Pe)]}):null]}),I("div",{className:"p-4",children:Be})]},B.id)},[k,p,wn,kn,M,N,m,hn,X,vn]),ha=Le(()=>tn(e).length>0,[e]),Rt=Xe(B=>O("div",{className:"flex items-center gap-3 py-2",children:[I("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),I("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:k("exercise",{index:B+2})}),I("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${B}`),[k]),St=j?I("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:k("poweredBy")}):null,Te=Q!==null,Er=Q?.showVerdict!==!1,Pr=Er?Q?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return I("div",{className:"edpire-scope",style:{display:"contents"},children:O("div",{ref:E,dir:T,className:ye("flex flex-col",_?"h-full":"h-dvh"),style:F?{fontFamily:F}:void 0,children:[I($o,{visible:ee&&!yt,hasAiNodes:pa,text:k("evaluating"),aiText:k("aiEvaluating"),contained:_,...h}),yt&&O("div",{className:ye("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",_&&"absolute"),children:[I(hr,{size:40,className:"text-red-300"}),I("p",{className:"text-xl font-black text-white tracking-tight",children:k("timeUp.title")}),I("p",{className:"text-sm text-red-200",children:k("timeUp.submitting")})]}),O("div",{className:"sticky top-0 z-10 flex-shrink-0 flex items-center justify-between px-4 py-2.5 border-b border-[#e7e5e0] bg-[#fbfaf7]",style:M?{backgroundColor:M}:void 0,children:[O("div",{className:"flex items-center gap-3",children:[I("img",{src:n?.logoUrl??$??Cc,alt:n?.name??"Edpire",width:24,height:24,loading:"lazy",className:"rounded object-contain"}),O("div",{children:[I("h1",{className:"text-sm font-bold text-[#1d2025]",children:r.title}),I("p",{className:"text-[11px] text-[#8d93a0]",children:vt>0&&O("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",Ue(vt)," ",p(vt)]})})]}),!Te&&D!==null&&o&&o>0&&a&&I(Lc,{timeLimitMinutes:o,startedAt:a,onExpire:fa}),!Te&&(c==="saving"||c==="saved")&&O("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[c==="saved"?I(Nc,{size:12}):I(an,{size:12,className:"animate-spin"}),k(c==="saved"?"answersSaved":"answersSaving")]})]}),O("div",{className:"flex items-center gap-2",children:[g&&O("button",{onClick:w,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[I(Sc,{size:13}),k("reset")]}),(!Te||m)&&S&&O("button",{onClick:S,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[I(sn,{size:13}),f??k("back")]}),x&&I("button",{onClick:x,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:I(sn,{size:15})}),!Te&&I("button",{onClick:()=>we(!0),disabled:ee,style:v?{backgroundColor:v}:void 0,className:"flex flex-shrink-0 items-center gap-2 px-3.5 sm:px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:ee?O(ln,{children:[I(an,{size:14,className:"animate-spin"}),k("submitting")]}):O(ln,{children:[I(Xo,{size:14}),I("span",{className:"sm:hidden",children:k("confirmSubmit")}),I("span",{className:"hidden sm:inline",children:k("submit")})]})})]})]}),gn&&I("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:gn}),!Te&&c==="failed"&&O("div",{role:"alert",className:"flex-shrink-0 flex items-center gap-2 bg-[#fbf1dc] border-b border-[#f2e2bf] px-4 py-2 text-sm font-semibold text-[#8a5a08]",children:[I(Ac,{size:15,className:"flex-shrink-0"}),k("answersNotSaved")]}),!Te&&Y&&(X.size>0||ne!==null)&&O("div",{role:"status",className:"flex-shrink-0 flex items-center gap-2 bg-[#f5f4f1] border-b border-[#e7e5e0] px-4 py-2 text-sm text-[#1d2025]",children:[ne!==null&&I(hr,{size:15,className:"flex-shrink-0 text-[#565b66]"}),O("span",{className:"flex-1 min-w-0",children:[X.size>0?k("resumeRestored"):k("resumeFresh"),ne!==null&&O(ln,{children:[" ",k("resumeTimeLeft",{minutes:ne})]})]}),I("button",{type:"button",onClick:()=>be(!1),"aria-label":k("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:I(sn,{size:14})})]}),Te&&Q&&(Q.awaitingManualGrading?I("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:I("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:W},children:O("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[O("div",{className:"flex items-center gap-2",children:[I(hr,{size:20,className:"text-[#c8810e] flex-shrink-0"}),I("span",{className:"text-sm font-semibold text-[#8a5a08]",children:Q.aiPending?k("beingMarked"):k("awaitingReview")})]}),I("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),I("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:Q.aiPending?k("beingMarkedDesc"):k("awaitingReviewDesc")}),y&&O("button",{onClick:Rn,style:v?{backgroundColor:v}:void 0,className:"flex-shrink-0 flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:[I(Jo,{size:14}),b??k("viewFullReport")]})]})})}):I("div",{className:ye("flex-shrink-0 border-b",Er?Q.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:I("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:W},children:O("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[O("div",{className:"flex items-center gap-2",children:[Er?Q.passed?I(kc,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):I(Rc,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,I("span",{className:"text-sm font-semibold",style:{color:Pr},children:Er?Q.passed?k("assessmentPassed"):k("assessmentNotPassed"):k("yourScore")})]}),I("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),O("div",{className:"flex items-baseline gap-1.5",children:[O("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:Pr},children:[Ue(Q.totalScore)," / ",Ue(Q.maxScore)]}),I("span",{className:"text-sm text-[#8d93a0] font-medium",children:p(Q.maxScore)})]}),O("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[I("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:I("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${Q.percentage}%`,backgroundColor:Pr}})}),O("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Pr},children:[Q.percentage,"%"]})]}),y&&O("button",{onClick:Rn,style:v?{backgroundColor:v}:void 0,className:"flex-shrink-0 flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:[I(Jo,{size:14}),b??k("viewFullReport")]})]})})})),I("div",{className:ye("flex-1 overflow-hidden flex flex-col",yt&&"pointer-events-none opacity-60"),children:e.annex||ha?I(jo,{assessment:e,isSubmitted:Te,setAnswers:P,validationFeedback:wt,renderExercise:kt,renderSeparator:Rt,primaryColor:v,contained:_,locale:bt(t),contentMaxWidth:W,t:k,footer:St}):C?I(qo,{assessment:e,isSubmitted:Te,setAnswers:P,validationFeedback:wt,renderExercise:kt,renderSeparator:Rt,primaryColor:v,contained:_,locale:bt(t),contentMaxWidth:W,t:k,onAddAnnex:C,footer:St}):I("div",{className:"flex-1 overflow-y-auto",children:O("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:W},children:[I(Ke,{assessment:e,onAnswersChange:Te?void 0:P,validationFeedback:wt,renderExercise:kt,renderSeparator:Rt,locale:bt(t)}),St]})})}),ie&&I("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:O("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edpire-submit-confirm-title",className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[I("h3",{id:"edpire-submit-confirm-title",className:"text-base font-bold text-[#1d2025] mb-2",children:k("confirmTitle")}),gr>0&&O("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[O("p",{className:"flex items-start gap-2 font-semibold",children:[I(_c,{size:15,className:"flex-shrink-0 mt-px"}),I("span",{children:gr===1?k("unansweredOne"):k("unansweredMany",{count:gr})})]}),O("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[yn.slice(0,cn).map(B=>I("li",{children:I("button",{type:"button",onClick:()=>ma(B.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:B.only?k("exercise",{index:B.exerciseIndex+1}):`${k("exercise",{index:B.exerciseIndex+1})} \xB7 ${k("question",{index:B.questionIndex+1})}`})},B.questionId)),gr>cn&&I("li",{children:k("unansweredMore",{count:gr-cn})})]})]}),I("p",{className:"text-sm text-[#565b66] mb-5",children:k("confirmDescription")}),O("div",{className:"flex gap-3 justify-end",children:[I("button",{onClick:()=>we(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:k("confirmCancel")}),O("button",{onClick:ua,disabled:ee,style:v?{backgroundColor:v}:void 0,className:"flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:[ee?I(an,{size:14,className:"animate-spin"}):I(Xo,{size:14}),k("confirmSubmit")]})]})]})})]})})}function pn(e){return(e??[]).map(r=>({exerciseId:r.exercise_id,questions:r.questions.map(t=>({questionId:t.question_id,...t.explanation?{explanation:t.explanation}:{},nodeResults:t.node_results.map(n=>({nodeId:n.node_id,status:n.status,score:n.score,maxScore:n.max_score,...n.feedback!==void 0?{feedback:n.feedback}:{},...n.display_answer!==void 0?{displayAnswer:n.display_answer}:{},...n.detail!==void 0?{detail:n.detail}:{},...n.teacher_feedback!==void 0?{teacherFeedback:n.teacher_feedback}:{}}))}))}))}import{jsx as zc}from"react/jsx-runtime";function mn(e,r){let t=pn(e.exercise_feedback);return{submissionId:e.submission_id,totalScore:e.score,maxScore:e.max_score,percentage:e.percentage,passed:e.passed,returnUrl:r??null,exerciseFeedback:t,awaitingManualGrading:e.awaiting_manual_grading??!1,aiPending:e.ai_pending??!1}}function un(e){return{annex:e.annex??void 0,exercises:e.exercises.map(r=>({id:r.id,sharedContext:r.sharedContext,questions:r.questions.map(t=>({id:t.id,version:"1.0",content:t.content,answerKeys:[]}))}))}}function oa({token:e,data:r,baseUrl:t,options:n}){let{locale:o,branding:a,returnUrl:s,reportLabel:i,backLabel:c,onBack:d,overlayConfig:l,layout:m,mediaHandler:y,onComplete:b,onError:S}=n,f=a??r.branding??void 0,g=o??r.meta.language??"en",w=Tc(()=>un(r.assessment),[r]),[h]=$c(()=>new Date().toISOString()),_=na(async x=>{let N=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:x})});if(!N.ok){let $=await N.json().catch(()=>({})),k=typeof $.error=="string"?$.error:"Submission failed",p=N.status===401?"TOKEN_INVALID":N.status===409?"TOKEN_USED":N.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw S?.({code:p,message:k}),new Error(k)}let C=await N.json();return b?.(C),mn(C,s)},[t,e,b,S,s]),u=na(x=>{if(s)try{let N=new URL(s);N.searchParams.set("submission_id",x.submissionId),x.awaitingManualGrading||(N.searchParams.set("score",String(x.totalScore)),N.searchParams.set("max_score",String(x.maxScore))),window.location.href=N.toString()}catch{window.location.href=s}},[s]);return zc(Ar,{assessment:w,meta:{title:r.meta.title,category:r.meta.category??null},locale:g,branding:f,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:h,onSubmit:_,onViewReport:s?u:void 0,reportLabel:i,onBack:d,backLabel:c,overlayConfig:l,layout:m,mediaHandler:y})}import{useMemo as aa}from"react";import{jsx as Fc}from"react/jsx-runtime";function Dc(){return Promise.reject(new Error("A review cannot be submitted"))}function sa({review:e,locale:r,branding:t,layout:n,onBack:o,backLabel:a}){let s=aa(()=>un(e.assessment),[e]),i=aa(()=>({answers:e.answers,result:mn({submission_id:e.submission.id,score:e.submission.score,max_score:e.submission.max_score,percentage:e.submission.percentage,passed:e.submission.passed,awaiting_manual_grading:e.submission.awaiting_manual_grading,ai_pending:e.submission.ai_pending,exercise_feedback:e.exercise_feedback})}),[e]),c=r??e.meta.language??"en";return Fc(Ar,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,onSubmit:Dc,onBack:o,backLabel:a,layout:n})}import th from"react";import{createRoot as oh}from"react-dom/client";var Oc="https://edpire.com";function la(e,r,t){e.textContent="";let n=document.createElement("div");n.style.cssText="padding:32px;text-align:center;color:#dc2626;font-family:sans-serif";let o=document.createElement("div");if(o.textContent=r,n.appendChild(o),t){let a=document.createElement("div");a.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",a.textContent=t,n.appendChild(a)}e.appendChild(n)}var da={mount(e){let{token:r,container:t,baseUrl:n=Oc,onError:o}=e,a=typeof t=="string"?document.querySelector(t):t;if(!a){let d={code:"UNKNOWN",message:`Container not found: ${t}`};return o?.(d),{unmount:()=>{}}}let s=null,i=!1;function c(){if(i)return;i=!0;let d=s;s=null,setTimeout(()=>{d?.unmount()},0)}return(async()=>{a.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let d;try{let l=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(r)}`,{method:"GET"});if(!l.ok){let m=await l.json().catch(()=>({})),y=typeof m.error=="string"?m.error:"Failed to load assessment",b=l.status===401?"TOKEN_INVALID":l.status===403?"ORIGIN_NOT_ALLOWED":l.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";o?.({code:b,message:y});let S=b==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";la(a,y,S);return}d=await l.json()}catch{o?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),la(a,"Failed to connect to Edpire. Please try again.","");return}i||(a.innerHTML="",s=ca(a),s.render(ia.createElement(oa,{token:r,data:d,baseUrl:n,options:e})))})(),{unmount:c}},review(e){let{container:r,...t}=e,n=typeof r=="string"?document.querySelector(r):r;if(!n)return{unmount:()=>{}};n.textContent="";let o=ca(n);return o.render(ia.createElement(sa,t)),{unmount(){let a=o;o=null,setTimeout(()=>a?.unmount(),0)}}}};import{jsx as qc}from"react/jsx-runtime";function Bc({tokenEndpoint:e,assessmentId:r,tokenBody:t,className:n,style:o,onComplete:a,onError:s,...i}){let c=fn(null),d=fn(a);d.current=a;let l=fn(s);return l.current=s,jc(()=>{let m=c.current;if(!m)return;let y=!1,b=null;return(async()=>{let S;try{let f=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assessmentId:r,...t})});if(y)return;if(!f.ok){let w=await f.json().catch(()=>({}));l.current?.({code:"TOKEN_INVALID",message:typeof w.error=="string"?w.error:`Token endpoint returned ${f.status}`});return}let g=await f.json();if(!g.token){l.current?.({code:"TOKEN_INVALID",message:"Token endpoint did not return a token"});return}S=g.token}catch{y||l.current?.({code:"NETWORK_ERROR",message:"Failed to fetch embed token"});return}y||(b=da.mount({token:S,container:m,...i,onComplete:f=>d.current?.(f),onError:f=>l.current?.(f)}))})(),()=>{y=!0,b?.unmount()}},[e,r]),qc("div",{ref:c,className:n,style:n?void 0:o??{width:"100%",height:"100%"}})}export{Ar as AssessmentShell,Bc as EdpireAssessmentPlayer,To as EdpireQuestion};
|
|
65
|
+
`}),ge("div",{style:{background:r},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:dn("div",{className:"flex flex-col items-center gap-5 bg-white rounded-2xl shadow-2xl px-10 py-8 max-w-xs text-center",children:[(()=>{if(o)return ge("img",{src:o,alt:"",className:"w-24 h-24 object-contain"});switch(s){case"dots":return ge(bc,{accent:t});case"pulse":return ge(xc,{accent:t});case"bars":return ge(yc,{accent:t});default:return ge(gc,{accent:t})}})(),ge("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&ge("p",{className:"text-xs text-slate-500 leading-snug",children:a})]})})]}):null}import{useCallback as Ha,useEffect as wc,useMemo as Va,useRef as yt,useState as kc}from"react";import{BookOpen as Qa,X as Rc}from"lucide-react";import{Fragment as _c,jsx as le,jsxs as Ee}from"react/jsx-runtime";function pn(e){return e.exercises.flatMap((r,t)=>r.sharedContext&&Ar(r.sharedContext)?[{id:r.id,index:t,content:r.sharedContext}]:[])}var Ga=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Sc(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Ya({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:s,primaryColor:o,contained:i=!1,locale:c,contentMaxWidth:d,t:l,footer:p}){let[f,b]=kc(!1),v=e.annex,g=v?.tabLabel||l("annexDocuments"),x=Va(()=>pn(e),[e]),y=yt(null),h=yt(null),_=yt(null),u=yt(null),w=()=>(y.current?.getClientRects().length??0)>0,C=Ha((N,q)=>{let k=N?.querySelector(`[data-reference-for="${CSS.escape(q)}"]`);if(!N||!k)return;let L=k.getBoundingClientRect().top-N.getBoundingClientRect().top+N.scrollTop-12;N.scrollTo({top:L,behavior:Ga()?"auto":"smooth"}),Sc(k)},[]),M=Ha(N=>{if(w()){C(h.current,N);return}b(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>C(u.current,N)))},[C]),$=N=>{let q=w()?y.current:_.current;w()||b(!1),Array.from(q?.querySelectorAll(`[data-exercise-id="${CSS.escape(N)}"]`)??[]).find(L=>L.getClientRects().length>0)?.scrollIntoView({behavior:Ga()?"auto":"smooth",block:"start"})};wc(()=>{let N=y.current;if(!N||x.length===0||typeof IntersectionObserver>"u")return;let q=new Set(x.map(D=>D.id)),k=null,L=new IntersectionObserver(D=>{if(!w())return;let B=D.filter(H=>H.isIntersecting&&q.has(H.target.dataset.exerciseId??"")).sort((H,U)=>H.boundingClientRect.top-U.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!B||B===k||(k=B,C(h.current,B))},{root:N,rootMargin:"0px 0px -60% 0px"});return N.querySelectorAll("[data-exercise-id]").forEach(D=>L.observe(D)),()=>L.disconnect()},[x,C]);let R=Va(()=>({label:g,showExerciseReference:M}),[g,M]),m=Ee(_c,{children:[v?.items.map(N=>le(Pr,{item:N},N.id)),v?.items.length&&x.length?le("div",{className:"border-t border-[#e7e5e0]"}):null,x.map(N=>Ee("section",{"data-reference-for":N.id,className:"-mx-3 flex flex-col gap-2 rounded-[10px] px-3 py-2 transition-colors duration-700 data-[flash=true]:bg-[#fbf1dc] data-[flash=true]:duration-150",children:[le("button",{type:"button",onClick:()=>$(N.id),className:"self-start cursor-pointer text-xs font-bold uppercase tracking-widest text-[#565b66] underline-offset-4 hover:text-[#1d2025] hover:underline focus-visible:outline-2 focus-visible:outline-[#1d2025] rounded-sm",children:l("exercise",{index:N.index+1})}),le(ur,{content:N.content})]},N.id))]}),I=le(Ke,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:s,locale:c});return le(ft,{value:R,children:Ee("div",{className:ye("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ee("div",{ref:y,className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Ee("div",{className:"flex-1 sticky top-4 max-h-[calc(100svh-6rem)] flex flex-col bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[Ee("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[le(Qa,{size:14,className:"text-[#8d93a0]"}),le("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:g})]}),le("div",{ref:h,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:m})]}),le("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),le("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Ee("div",{className:"px-6 py-5 flex flex-col gap-4",children:[I,p]})})]}),Ee("div",{className:"@6xl:hidden flex-1 relative overflow-hidden",children:[le("div",{ref:_,className:"absolute inset-0 overflow-y-auto",children:Ee("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:d},children:[I,p]})}),f&&le("div",{className:ye("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>b(!1)}),Ee("div",{role:"dialog","aria-label":g,"aria-hidden":!f,className:ye("top-1/2 start-2 -translate-y-1/2 z-40 w-[88%] bg-[#f1efe9] rounded-2xl shadow-2xl flex flex-col overflow-hidden transition-transform duration-300 ease-in-out",i?"absolute":"fixed",f?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Ee("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[le("span",{className:"text-sm font-bold text-[#1d2025]",children:g}),le("button",{onClick:()=>b(!1),"aria-label":l("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:le(Rc,{size:18})})]}),le("div",{ref:u,className:"overflow-y-auto max-h-[calc(100vh-8rem)] px-5 pb-5 flex flex-col gap-5",children:m})]})]}),!f&&Ee("button",{onClick:()=>b(!0),"aria-label":g,style:{transform:"translateY(-50%)",...o?{backgroundColor:o}:{}},className:ye("@6xl:hidden top-1/2 start-0 z-20 flex flex-col items-center gap-1 py-3 px-1.5 bg-[#1d2025] text-white text-[10px] font-bold uppercase tracking-wider rounded-e-lg shadow-md hover:bg-[#31353c] transition-colors",i?"absolute":"fixed"),children:[le(Qa,{size:12}),le("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:g})]})]})})}import{useState as Cc}from"react";import{BookOpen as Ka,Plus as Nc,X as Ac}from"lucide-react";import{jsx as ue,jsxs as qe}from"react/jsx-runtime";function Xa({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:s,primaryColor:o,contained:i=!1,locale:c,contentMaxWidth:d,t:l,onAddAnnex:p,footer:f}){let[b,v]=Cc(!1),g=ue(Ke,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:s,locale:c});if(b)return ue("div",{className:"flex-1 overflow-y-auto",children:qe("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:d},children:[g,f]})});let x=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),p())},y=_=>qe("span",{style:o?{backgroundColor:o}:void 0,className:ye("flex-none inline-flex items-center gap-1.5 rounded-lg bg-[#1d2025] text-white font-semibold shadow-sm group-hover:shadow-md transition-shadow",_?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[ue(Nc,{size:13}),l("annexEmptyCta")]}),h=_=>ue("button",{type:"button",onClick:u=>{u.stopPropagation(),v(!0)},"aria-label":l("annexEmptyDismiss"),title:l("annexEmptyDismiss"),className:ye("flex-none flex items-center justify-center w-7 h-7 rounded-lg text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] transition-colors cursor-pointer",_&&"absolute top-2 end-2 z-10"),children:ue(Ac,{size:15})});return qe("div",{className:ye("@container flex-1 min-h-0 flex",i&&"relative"),children:[qe("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[ue("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:qe("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:x,className:"group relative flex-1 w-full flex flex-col items-center justify-center gap-3 text-center rounded-[14px] border-2 border-dashed border-[#d6d3cc] bg-white/60 hover:border-[#8d93a0] hover:bg-white transition-colors cursor-pointer px-6 py-8 outline-none focus-visible:ring-2 focus-visible:ring-[#8d93a0] focus-visible:ring-offset-2",children:[h(!0),ue("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:ue(Ka,{size:20})}),ue("span",{className:"text-sm font-bold text-[#565b66]",children:l("annexEmptyTitle")}),ue("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:l("annexEmptyBody")}),y(!1)]})}),ue("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ue("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:qe("div",{className:"px-6 py-5 flex flex-col gap-4",children:[g,f]})})]}),ue("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:qe("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:d},children:[qe("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:x,className:"group flex items-center gap-3 rounded-[14px] border-2 border-dashed border-[#d6d3cc] bg-white/60 hover:border-[#8d93a0] hover:bg-white transition-colors cursor-pointer px-4 py-2.5 outline-none focus-visible:ring-2 focus-visible:ring-[#8d93a0]",children:[ue("span",{className:"flex-none flex items-center justify-center w-9 h-9 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:ue(Ka,{size:16})}),qe("div",{className:"flex-1 min-w-0",children:[ue("div",{className:"text-xs font-bold text-[#565b66]",children:l("annexEmptyTitle")}),ue("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:l("annexEmptyBody")})]}),y(!0),h(!1)]}),g,f]})})]})}function mn(e){let r=new Map;for(let t of e){let n=new Map;for(let a of t.questions){let s=new Map;for(let o of a.nodeResults){let i={state:o.status,showFeedback:!0,score:o.score,...o.feedback!==void 0?{message:o.feedback}:{},...o.displayAnswer!==void 0?{displayAnswer:o.displayAnswer}:{},...o.teacherFeedback!==void 0?{teacherFeedback:o.teacherFeedback}:{}};o.detail?.type==="choiceSet"?i.correctChoiceIds=o.detail.correctChoiceIds:o.detail?.type==="matchingSet"&&(i.pairFeedback=o.detail.pairFeedback,i.correctPairings=o.detail.correctPairings),s.set(o.nodeId,i)}n.set(a.questionId,s)}r.set(t.exerciseId,n)}return r}import{Lightbulb as Ec}from"lucide-react";import{jsx as un,jsxs as Ja}from"react/jsx-runtime";function Pc(e){return e.length===0||e.some(r=>r.status==="awaiting_review")?null:e.every(r=>r.status==="correct")?"correct":e.some(r=>r.score>0)?"partial":"incorrect"}function Za({content:e,nodeResults:r,label:t}){let n=Pc(r);return Ja("div",{className:`player-ai-feedback mt-3 mb-3${n?` player-ai-feedback--${n}`:""}`,children:[Ja("p",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[un(Ec,{size:14,"aria-hidden":!0}),t]}),un("div",{className:"text-[#1d2025]",children:un(ur,{content:e})})]})}var Lc=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),Mc=new Set(["blankPool","inlinePool"]);function Tc(e){switch(e.type){case"choiceSet":case"inlineChoiceSet":return e.answer.selectedIds.length>0;case"blank":return e.answer.mode==="choice"?e.answer.choiceId.length>0:e.answer.text.trim().length>0;case"matchingSet":return e.answer.connections.length>0;case"aiAnswer":return e.answer.text.trim().length>0;case"openResponse":{let r=e.answer;return r.recording||r.files&&r.files.length>0?!0:(r.text?.wordCount??0)>0}case"mathResponse":return e.answer.latex.trim().length>0;case"codingResponse":return e.answer.source.trim().length>0;default:{let r=e;return!0}}}function Ic(e){let r=0,t=n=>{if(Array.isArray(n)){for(let o of n)t(o);return}if(!n||typeof n!="object")return;let{type:a,content:s}=n;if(typeof a=="string"){if(Lc.has(a)){r+=1;return}if(Mc.has(a))return}s!==void 0&&t(s)};return t(e),r}function eo(e,r){let t=new Map;for(let a of r?.exerciseAnswers??[])for(let s of a.questionAnswers){let o=t.get(s.questionId);o||(o=new Set,t.set(s.questionId,o));for(let i of s.answers)Tc(i)&&o.add(i.nodeId)}let n=[];return e.exercises.forEach((a,s)=>{a.questions.forEach((o,i)=>{let c=Ic(o.content);c!==0&&(t.get(o.id)?.size??0)<c&&n.push({questionId:o.id,exerciseIndex:s,questionIndex:i,only:a.questions.length===1})})}),n}var $c={exercise:"Exercise {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Submit Assessment",submitting:"Submitting...",confirmTitle:"Submit Assessment",confirmDescription:"Are you sure you want to submit? You cannot change your answers after submitting.",unansweredOne:"1 question is not fully answered.",unansweredMany:"{count} questions are not fully answered.",unansweredMore:"and {count} more",confirmSubmit:"Submit",confirmCancel:"Cancel",assessmentPassed:"Assessment passed",assessmentNotPassed:"Assessment not passed",awaitingReview:"Awaiting review",awaitingReviewDesc:"Your teacher is reviewing your open responses. Your final score will be available once grading is complete.",beingMarked:"Being marked",beingMarkedDesc:"Some answers are still being marked. Your final score will be available once every answer is marked.",pendingReview:"Pending review",viewFullReport:"View Full Report",explanation:"Explanation",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI, this may take a few seconds.",reset:"Reset",back:"Back",annexDocuments:"Documents",annexEmptyTitle:"No reference yet",annexEmptyBody:"A text, figure, table or document that stays in view across the whole assessment while students answer.",annexEmptyCta:"Add reference",annexEmptyDismiss:"Hide","timeUp.title":"Time's up","timeUp.submitting":"Submitting your answers\u2026",yourScore:"Your score",answersSaving:"Saving\u2026",answersSaved:"Answers saved",answersNotSaved:"Your answers aren't being saved. Check your connection.",resumeRestored:"Welcome back. Your answers are here.",resumeFresh:"Welcome back.",resumeTimeLeft:"The clock kept running: {minutes} min left.",close:"Close"},zc={exercise:"Exercice {index}",question:"Question {index}",points:"pts","points.one":"pt",submit:"Soumettre l'\xE9valuation",submitting:"Soumission...",confirmTitle:"Soumettre l'\xE9valuation",confirmDescription:"\xCAtes-vous s\xFBr de vouloir soumettre ? Vous ne pourrez pas modifier vos r\xE9ponses.",unansweredOne:"1 question n'est pas enti\xE8rement remplie.",unansweredMany:"{count} questions ne sont pas enti\xE8rement remplies.",unansweredMore:"et {count} autres",confirmSubmit:"Soumettre",confirmCancel:"Annuler",assessmentPassed:"\xC9valuation r\xE9ussie",assessmentNotPassed:"\xC9valuation non r\xE9ussie",awaitingReview:"En attente de correction",awaitingReviewDesc:"Votre professeur examine vos r\xE9ponses ouvertes. Votre note finale sera disponible une fois la correction termin\xE9e.",beingMarked:"Correction en cours",beingMarkedDesc:"Certaines r\xE9ponses sont encore en cours de correction. Votre note finale sera disponible d\xE8s que toutes les r\xE9ponses seront corrig\xE9es.",pendingReview:"En attente de correction",viewFullReport:"Voir le rapport complet",explanation:"Explication",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA, cela peut prendre quelques secondes.",reset:"R\xE9initialiser",back:"Retour",annexDocuments:"Documents",annexEmptyTitle:"Aucune annexe pour l'instant",annexEmptyBody:"Un texte, une figure, un tableau ou un document qui reste visible pour toute l'\xE9valuation pendant que les \xE9l\xE8ves r\xE9pondent.",annexEmptyCta:"Ajouter une annexe",annexEmptyDismiss:"Masquer","timeUp.title":"Temps \xE9coul\xE9","timeUp.submitting":"Envoi de vos r\xE9ponses\u2026",yourScore:"Votre score",answersSaving:"Enregistrement\u2026",answersSaved:"R\xE9ponses enregistr\xE9es",answersNotSaved:"Vos r\xE9ponses ne sont pas enregistr\xE9es. V\xE9rifiez votre connexion.",resumeRestored:"Bon retour. Vos r\xE9ponses sont l\xE0.",resumeFresh:"Bon retour.",resumeTimeLeft:"Le chrono a continu\xE9 : il reste {minutes} min.",close:"Fermer"},Fc={exercise:"\u062A\u0645\u0631\u064A\u0646 {index}",question:"\u0633\u0624\u0627\u0644 {index}",points:"\u0646\u0642\u0637\u0629","points.two":"\u0646\u0642\u0637\u062A\u0627\u0646","points.few":"\u0646\u0642\u0627\u0637",submit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",submitting:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644...",confirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",confirmDescription:"\u0647\u0644 \u0623\u0646\u062A \u0645\u062A\u0623\u0643\u062F \u0645\u0646 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u061F \u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u063A\u064A\u064A\u0631 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",unansweredOne:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 \u0633\u0624\u0627\u0644 \u0648\u0627\u062D\u062F.",unansweredMany:"\u0644\u0645 \u062A\u064F\u0643\u0645\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u0639\u0646 {count} \u0645\u0646 \u0627\u0644\u0623\u0633\u0626\u0644\u0629.",unansweredMore:"\u0648{count} \u0623\u062E\u0631\u0649",confirmSubmit:"\u0625\u0631\u0633\u0627\u0644",confirmCancel:"\u0625\u0644\u063A\u0627\u0621",assessmentPassed:"\u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",assessmentNotPassed:"\u0644\u0645 \u064A\u062A\u0645 \u0627\u062C\u062A\u064A\u0627\u0632 \u0627\u0644\u062A\u0642\u064A\u064A\u0645",awaitingReview:"\u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",awaitingReviewDesc:"\u064A\u0642\u0648\u0645 \u0645\u0639\u0644\u0645\u0643 \u0628\u0645\u0631\u0627\u062C\u0639\u0629 \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0627\u0644\u0645\u0641\u062A\u0648\u062D\u0629. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u0627\u0643\u062A\u0645\u0627\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D.",beingMarked:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",beingMarkedDesc:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0645\u0627 \u0632\u0627\u0644\u062A \u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u062A\u0635\u062D\u064A\u062D \u062C\u0645\u064A\u0639 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A.",pendingReview:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",viewFullReport:"\u0639\u0631\u0636 \u0627\u0644\u062A\u0642\u0631\u064A\u0631 \u0627\u0644\u0643\u0627\u0645\u0644",explanation:"\u0634\u0631\u062D",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Edpire",evaluating:"\u062C\u0627\u0631\u064D \u062A\u0642\u064A\u064A\u0645 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",aiEvaluating:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0642\u064A\u062F \u0627\u0644\u0645\u0631\u0627\u062C\u0639\u0629 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u060C \u0642\u062F \u064A\u0633\u062A\u063A\u0631\u0642 \u0630\u0644\u0643 \u0628\u0636\u0639 \u062B\u0648\u0627\u0646\u064D.",reset:"\u0625\u0639\u0627\u062F\u0629 \u062A\u0639\u064A\u064A\u0646",back:"\u0631\u062C\u0648\u0639",annexDocuments:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexEmptyTitle:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u064F\u0644\u062D\u064E\u0642 \u0628\u0639\u062F",annexEmptyBody:"\u0646\u0635 \u0623\u0648 \u0635\u0648\u0631\u0629 \u0623\u0648 \u062C\u062F\u0648\u0644 \u0623\u0648 \u0645\u0633\u062A\u0646\u062F \u064A\u0628\u0642\u0649 \u0638\u0627\u0647\u0631\u064B\u0627 \u0637\u0648\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0623\u062B\u0646\u0627\u0621 \u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0644\u0627\u0628.",annexEmptyCta:"\u0625\u0636\u0627\u0641\u0629 \u0645\u064F\u0644\u062D\u064E\u0642",annexEmptyDismiss:"\u0625\u062E\u0641\u0627\u0621","timeUp.title":"\u0627\u0646\u062A\u0647\u0649 \u0627\u0644\u0648\u0642\u062A","timeUp.submitting":"\u062C\u0627\u0631\u064D \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",yourScore:"\u0646\u062A\u064A\u062C\u062A\u0643",answersSaving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",answersSaved:"\u062A\u0645 \u062D\u0641\u0638 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",answersNotSaved:"\u0644\u0627 \u064A\u062A\u0645 \u062D\u0641\u0638 \u0625\u062C\u0627\u0628\u0627\u062A\u0643. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",resumeRestored:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643. \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0647\u0646\u0627.",resumeFresh:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643.",resumeTimeLeft:"\u0627\u0633\u062A\u0645\u0631\u0651 \u0627\u0644\u0645\u0624\u0642\u0651\u062A: \u062A\u0628\u0642\u0651\u0649 {minutes} \u062F\u0642\u064A\u0642\u0629.",close:"\u0625\u063A\u0644\u0627\u0642"},fr={en:$c,fr:zc,ar:Fc};function Dc(e,r,t){let a=(fr[e]??fr.en)[r]??fr.en[r]??r;return t?Object.entries(t).reduce((s,[o,i])=>s.replace(`{${o}}`,String(i)),a):a}function ro(e,r){let t=new Intl.PluralRules(e).select(r),n=fr[e]??fr.en;return n[`points.${t}`]??n.points??fr.en.points}function to(e){return(r,t)=>Dc(e,r,t)}function no(e){return e==="ar"}function vt(e){return e==="en"?"en":"fr"}var ao="48rem";import"katex/dist/katex.min.css";tr(`.edpire-annex-layout{display:flex;flex:1;min-width:0;height:100%;overflow:hidden;position:relative}.edpire-annex-main{flex:1;min-width:0;overflow:hidden;display:flex;flex-direction:column}.edpire-annex-panel{width:38%;min-width:calc(280px * var(--edp-scale, 1));max-width:calc(480px * var(--edp-scale, 1));flex-shrink:0;display:flex;flex-direction:column;border-right:1px solid #e5e7eb;background:#fff;overflow:hidden}.edpire-annex-panel__header{flex-shrink:0;padding:calc(12px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb}.edpire-annex-panel__header-label{font-size:calc(11px * var(--edp-scale, 1));font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#6b7280}.edpire-annex-panel__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-tab,.edpire-annex-drawer,.edpire-annex-backdrop{display:none}@media(max-width:1023px){.edpire-annex-panel{display:none}.edpire-annex-tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(8px * var(--edp-scale, 1));position:fixed;left:0;top:50%;transform:translateY(-50%);z-index:40;background:var(--edpire-annex-tab-bg, #2563eb);color:var(--edpire-annex-tab-color, #ffffff);border:none;border-radius:0 calc(10px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1)) 0;padding:calc(18px * var(--edp-scale, 1)) calc(10px * var(--edp-scale, 1));cursor:pointer;box-shadow:2px 2px 16px #0000002e;transition:filter .15s}.edpire-annex-tab:hover{filter:brightness(.88)}.edpire-annex-tab__label{writing-mode:vertical-rl;text-orientation:mixed;transform:rotate(180deg);font-size:calc(11px * var(--edp-scale, 1));font-weight:700;letter-spacing:.07em;text-transform:uppercase;white-space:nowrap}.edpire-annex-drawer{display:flex;flex-direction:column;position:fixed;left:0;top:0;bottom:0;width:min(84vw,calc(440px * var(--edp-scale, 1)));background:#fff;z-index:50;transform:translate(-100%);transition:transform .28s cubic-bezier(.4,0,.2,1);box-shadow:4px 0 32px #00000021;overflow:hidden}.edpire-annex-drawer--open{transform:translate(0)}.edpire-annex-drawer__header{display:flex;align-items:center;justify-content:space-between;padding:calc(16px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));border-bottom:1px solid #f3f4f6;background:#f9fafb;flex-shrink:0}.edpire-annex-drawer__label{font-size:calc(13px * var(--edp-scale, 1));font-weight:700;color:#111827}.edpire-annex-drawer__close{display:flex;align-items:center;justify-content:center;width:calc(28px * var(--edp-scale, 1));height:calc(28px * var(--edp-scale, 1));background:none;border:none;cursor:pointer;font-size:calc(20px * var(--edp-scale, 1));line-height:1;color:#9ca3af;border-radius:calc(6px * var(--edp-scale, 1));transition:color .15s,background .15s}.edpire-annex-drawer__close:hover{color:#111827;background:#f3f4f6}.edpire-annex-drawer__scroll{flex:1;overflow-y:auto;padding:calc(24px * var(--edp-scale, 1)) calc(20px * var(--edp-scale, 1));display:flex;flex-direction:column;gap:calc(32px * var(--edp-scale, 1))}.edpire-annex-backdrop{display:block;position:fixed;inset:0;background:#00000061;z-index:45;cursor:pointer}}
|
|
66
|
+
`);import{Fragment as bn,jsx as T,jsxs as j}from"react/jsx-runtime";var Hc="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234f46e5'%3E%3Cpath d='M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18L19.5 8 12 11.82 4.5 8 12 4.18zM4 9.6l7 3.5v7.3L4 16.9V9.6zm9 10.8v-7.3l7-3.5v7.3L13 20.4z'/%3E%3C/svg%3E";function Vc(e){for(let r of e.exercises)for(let t of r.questions)if((t.content.content??[]).some(a=>a.type==="aiAnswerInput"))return!0;return!1}function mo(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function lo(e){return e.questions.reduce((r,t)=>r+mo(t),0)}function Ue(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var gn=5;function uo(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function Qc({outcome:e}){let r=e==="full"?"M20 54 L41 75 L82 24":e==="none"?"M27 27 L73 73 M73 27 L27 73":"M14 58 C29 33 40 33 52 51 C64 69 74 69 88 42";return T("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:uo(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:T("path",{d:r})})}function Gc({score:e,weight:r,unit:t,t:n}){if(e){if(e.awaiting)return j("span",{className:"inline-flex items-center gap-1 rounded-lg border border-[#f2e2bf] bg-[#fbf1dc] px-2 py-0.5 text-xs font-semibold text-[#8a5a08]",children:[T(hr,{size:11}),n("pendingReview")]});let a=e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return j("span",{className:"inline-flex items-center gap-1.5 rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] ps-2 pe-2.5 py-0.5",children:[T(Qc,{outcome:a}),j("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:uo(a)},children:[Ue(e.s)," / ",Ue(e.m)]})]})}return r>0?j("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[Ue(r)," ",t(r)]}):null}function po(e){let r=new Map;for(let t of e?.exerciseAnswers??[])for(let n of t.questionAnswers)r.set(n.questionId,n.answers);return r}function Yc(e,r){return r.size===0?e:{exerciseAnswers:e.exerciseAnswers.map(t=>({...t,questionAnswers:t.questionAnswers.map(n=>n.answers.length===0&&r.has(n.questionId)?{...n,answers:r.get(n.questionId)}:n)}))}}function Kc({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,a=new Date(r).getTime()+n,[s,o]=je(()=>Math.max(a-Date.now(),0)),i=wt(t);i.current=t,xn(()=>{if(s<=0){i.current();return}let g=setInterval(()=>{let x=Math.max(a-Date.now(),0);o(x),x<=0&&(clearInterval(g),i.current())},1e3);return()=>clearInterval(g)},[a]);let c=s/n,d=c<.1?"bg-[#fdeeec] text-[#a32b1e] border-[#f6cfc9] animate-pulse":c<.25?"bg-[#fbf1dc] text-[#8a5a08] border-[#f2e2bf]":"bg-[#f5f4f1] text-[#565b66] border-[#e7e5e0]",l=Math.ceil(s/1e3),p=Math.floor(l/3600),f=Math.floor(l%3600/60),b=l%60,v=p>0?`${p}:${String(f).padStart(2,"0")}:${String(b).padStart(2,"0")}`:`${f}:${String(b).padStart(2,"0")}`;return j("span",{className:ye("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-bold tabular-nums transition-colors",d),children:[T(hr,{size:12}),v]})}function Lr({assessment:e,meta:r,locale:t="en",branding:n,timeLimitMinutes:a,startedAt:s,initialAnswers:o,onAnswersChange:i,saveState:c,resumed:d=!1,onSubmit:l,review:p,onViewReport:f,reportLabel:b,onBack:v,backLabel:g,allowReset:x,onReset:y,overlayConfig:h,contained:_=!1,layout:u,onClose:w,mediaHandler:C,onAddAnnex:M,fallbackLogoUrl:$}){let R=Te(()=>to(t),[t]),m=Xe(W=>ro(t,W),[t]),I=no(t)?"rtl":"ltr",N=wt(null),q=u?.maxWidth??ao,k=n?.branding?.primaryColor,L=n?.branding?.accentColor,D=n?.branding?.fontFamily,z=n?.branding?.fontUrl,B=n?.branding?.showPoweredBy!==!1;xn(()=>{if(!z||typeof document>"u"||document.querySelector(`link[href="${z}"]`))return;let oe=document.createElement("link");oe.rel="stylesheet",oe.href=z,document.head.appendChild(oe)},[z]);let[H,U]=je(()=>p?.answers??o??{exerciseAnswers:[]}),[X]=je(()=>p?new Map:po(o)),S=wt(i);S.current=i;let E=Xe(W=>{let oe=Yc(W,X);U(oe),S.current?.(oe)},[X]),[F,G]=je(null);xn(()=>{G(Date.now())},[]);let[Y,be]=je(d&&!p),ne=Te(()=>{if(F===null||!a||a<=0||!s)return null;let W=new Date(s).getTime()+a*6e4-F;return W>0?Math.max(1,Math.floor(W/6e4)):null},[F,a,s]),[ee,se]=je(!1),[ie,we]=je(!1),[Q,Je]=je(p?.result??null),Rn=Te(()=>po(p?.answers),[p]),[Sn,Mr]=je(null),[kt,_n]=je(!1),Cn=wt(!1),ko=Te(()=>Vc(e),[e]),Nn=Te(()=>ie?eo(e,H):[],[ie,e,H]),gr=Nn.length,Ro=Xe(W=>{we(!1);let oe=N.current?.querySelectorAll(`[data-question-id="${CSS.escape(W)}"]`),ve=Array.from(oe??[]).find(Pe=>Pe.getClientRects().length>0);ve&&requestAnimationFrame(()=>ve.scrollIntoView({block:"start",behavior:"smooth"}))},[]),Rt=Te(()=>e.exercises.reduce((W,oe)=>W+lo(oe),0),[e]),St=Te(()=>Q?mn(Q.exerciseFeedback):void 0,[Q]),An=Te(()=>{let W=new Map;for(let oe of Q?.exerciseFeedback??[])for(let ve of oe.questions)ve.explanation&&W.set(ve.questionId,ve);return W},[Q]),En=Te(()=>{if(!Q)return{};let W={};for(let oe of Q.exerciseFeedback){let ve=0,Pe=0,fe=!1;for(let nr of oe.questions)for(let Be of nr.nodeResults)ve+=Be.score,Pe+=Be.maxScore,Be.status==="awaiting_review"&&(fe=!0);W[oe.exerciseId]={score:ve,maxScore:Pe,awaiting:fe}}return W},[Q]),Pn=Te(()=>{if(!Q)return{};let W={};for(let oe of Q.exerciseFeedback)for(let ve of oe.questions){let Pe=0,fe=0,nr=!1;for(let Be of ve.nodeResults)Pe+=Be.score,fe+=Be.maxScore,Be.status==="awaiting_review"&&(nr=!0);W[ve.questionId]={score:Pe,maxScore:fe,awaiting:nr}}return W},[Q]),So=Xe(async()=>{se(!0),Mr(null);try{let W=await l(H);Je(W),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(W){Mr(W instanceof Error?W.message:R("confirmCancel"))}finally{se(!1),we(!1)}},[H,l,R]),Ln=Xe(()=>{!Q||!f||f(Q)},[Q,f]),_o=Xe(()=>{Cn.current||ee||Q||(Cn.current=!0,_n(!0),we(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{se(!0),Mr(null),l(H).then(W=>{Je(W),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(W=>{Mr(W instanceof Error?W.message:"submit_error")}).finally(()=>{se(!1),_n(!1)})},800))},[H,ee,l,Q]),_t=Xe((W,oe,ve)=>{let Pe=lo(W),fe=En[W.id],nr=W.questions.length>1,Be=so(oe)?oo(oe,{renderQuestion:($r,At,No)=>{let He=$r.id,Mn=X.get(He),Tn={...C?{mediaHandler:C}:{},...p?{initialAnswers:Rn.get(He)??[],readOnly:!0}:Mn?{initialAnswers:Mn}:{}},In=Object.keys(Tn).length>0&&so(At)?oo(At,Tn):At,Et=An.get(He),$n=Et?.explanation?T(Za,{content:Et.explanation,nodeResults:Et.nodeResults,label:R("explanation")}):null;if(!nr)return j("div",{"data-question-id":He,children:[In,$n]},He);let zr=Pn[He],Ao=mo($r);return j("div",{"data-question-id":He,children:[j("div",{className:"flex items-center gap-2.5 mb-3",children:[T("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f1efe9] px-3 py-1 text-xs font-bold tracking-tight text-[#1d2025]",children:R("question",{index:No+1})}),T(Gc,{score:zr?{s:zr.score,m:zr.maxScore,awaiting:zr.awaiting}:null,weight:Ao,unit:m,t:R})]}),In,$n]},He)},renderSeparator:$r=>T("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${$r}`)}):oe;return j("div",{"data-exercise-id":W.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[j("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:L?{backgroundColor:L}:void 0,children:[T("span",{className:"text-sm font-bold text-[#1d2025]",children:R("exercise",{index:ve+1})}),fe?.awaiting?j("span",{className:"inline-flex items-center gap-1 text-xs font-semibold text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-full px-2 py-0.5",children:[T(hr,{size:11}),R("pendingReview")]}):fe?j("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:fe.maxScore>0&&fe.score>=fe.maxScore?"#1f8a4c":fe.maxScore>0&&fe.score>0?"#c8810e":fe.maxScore>0?"#d23b2b":"#8d93a0"},children:[Ue(fe.score)," / ",Ue(fe.maxScore)]}):Pe>0?j("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",Ue(Pe)," ",m(Pe)]}):null]}),T("div",{className:"p-4",children:Be})]},W.id)},[R,m,En,Pn,L,C,p,Rn,X,An]),Co=Te(()=>pn(e).length>0,[e]),Ct=Xe(W=>j("div",{className:"flex items-center gap-3 py-2",children:[T("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),T("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:R("exercise",{index:W+2})}),T("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${W}`),[R]),Nt=B?T("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:R("poweredBy")}):null,Ie=Q!==null,Tr=Q?.showVerdict!==!1,Ir=Tr?Q?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return T("div",{className:"edpire-scope",style:{display:"contents"},children:j("div",{ref:N,dir:I,className:ye("flex flex-col",_?"h-full":"h-dvh"),style:D?{fontFamily:D}:void 0,children:[T(Ua,{visible:ee&&!kt,hasAiNodes:ko,text:R("evaluating"),aiText:R("aiEvaluating"),contained:_,...h}),kt&&j("div",{className:ye("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",_&&"absolute"),children:[T(hr,{size:40,className:"text-red-300"}),T("p",{className:"text-xl font-black text-white tracking-tight",children:R("timeUp.title")}),T("p",{className:"text-sm text-red-200",children:R("timeUp.submitting")})]}),j("div",{className:"sticky top-0 z-10 flex-shrink-0 flex items-center justify-between px-4 py-2.5 border-b border-[#e7e5e0] bg-[#fbfaf7]",style:L?{backgroundColor:L}:void 0,children:[j("div",{className:"flex items-center gap-3",children:[T("img",{src:n?.logoUrl??$??Hc,alt:n?.name??"Edpire",width:24,height:24,loading:"lazy",className:"rounded object-contain"}),j("div",{children:[T("h1",{className:"text-sm font-bold text-[#1d2025]",children:r.title}),T("p",{className:"text-[11px] text-[#8d93a0]",children:Rt>0&&j("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",Ue(Rt)," ",m(Rt)]})})]}),!Ie&&F!==null&&a&&a>0&&s&&T(Kc,{timeLimitMinutes:a,startedAt:s,onExpire:_o}),!Ie&&(c==="saving"||c==="saved")&&j("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[c==="saved"?T(qc,{size:12}):T(fn,{size:12,className:"animate-spin"}),R(c==="saved"?"answersSaved":"answersSaving")]})]}),j("div",{className:"flex items-center gap-2",children:[x&&j("button",{onClick:y,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[T(Bc,{size:13}),R("reset")]}),(!Ie||p)&&v&&j("button",{onClick:v,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[T(hn,{size:13}),g??R("back")]}),w&&T("button",{onClick:w,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:T(hn,{size:15})}),!Ie&&T("button",{onClick:()=>we(!0),disabled:ee,style:k?{backgroundColor:k}:void 0,className:"flex flex-shrink-0 items-center gap-2 px-3.5 sm:px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:ee?j(bn,{children:[T(fn,{size:14,className:"animate-spin"}),R("submitting")]}):j(bn,{children:[T(io,{size:14}),T("span",{className:"sm:hidden",children:R("confirmSubmit")}),T("span",{className:"hidden sm:inline",children:R("submit")})]})})]})]}),Sn&&T("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:Sn}),!Ie&&c==="failed"&&j("div",{role:"alert",className:"flex-shrink-0 flex items-center gap-2 bg-[#fbf1dc] border-b border-[#f2e2bf] px-4 py-2 text-sm font-semibold text-[#8a5a08]",children:[T(Uc,{size:15,className:"flex-shrink-0"}),R("answersNotSaved")]}),!Ie&&Y&&(X.size>0||ne!==null)&&j("div",{role:"status",className:"flex-shrink-0 flex items-center gap-2 bg-[#f5f4f1] border-b border-[#e7e5e0] px-4 py-2 text-sm text-[#1d2025]",children:[ne!==null&&T(hr,{size:15,className:"flex-shrink-0 text-[#565b66]"}),j("span",{className:"flex-1 min-w-0",children:[X.size>0?R("resumeRestored"):R("resumeFresh"),ne!==null&&j(bn,{children:[" ",R("resumeTimeLeft",{minutes:ne})]})]}),T("button",{type:"button",onClick:()=>be(!1),"aria-label":R("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:T(hn,{size:14})})]}),Ie&&Q&&(Q.awaitingManualGrading?T("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:T("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:q},children:j("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[j("div",{className:"flex items-center gap-2",children:[T(hr,{size:20,className:"text-[#c8810e] flex-shrink-0"}),T("span",{className:"text-sm font-semibold text-[#8a5a08]",children:Q.aiPending?R("beingMarked"):R("awaitingReview")})]}),T("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),T("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:Q.aiPending?R("beingMarkedDesc"):R("awaitingReviewDesc")}),f&&j("button",{onClick:Ln,style:k?{backgroundColor:k}:void 0,className:"flex-shrink-0 flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:[T(co,{size:14}),b??R("viewFullReport")]})]})})}):T("div",{className:ye("flex-shrink-0 border-b",Tr?Q.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:T("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:q},children:j("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[j("div",{className:"flex items-center gap-2",children:[Tr?Q.passed?T(Oc,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):T(jc,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,T("span",{className:"text-sm font-semibold",style:{color:Ir},children:Tr?Q.passed?R("assessmentPassed"):R("assessmentNotPassed"):R("yourScore")})]}),T("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),j("div",{className:"flex items-baseline gap-1.5",children:[j("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:Ir},children:[Ue(Q.totalScore)," / ",Ue(Q.maxScore)]}),T("span",{className:"text-sm text-[#8d93a0] font-medium",children:m(Q.maxScore)})]}),j("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[T("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:T("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${Q.percentage}%`,backgroundColor:Ir}})}),j("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Ir},children:[Q.percentage,"%"]})]}),f&&j("button",{onClick:Ln,style:k?{backgroundColor:k}:void 0,className:"flex-shrink-0 flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:[T(co,{size:14}),b??R("viewFullReport")]})]})})})),T("div",{className:ye("flex-1 overflow-hidden flex flex-col",kt&&"pointer-events-none opacity-60"),children:e.annex||Co?T(Ya,{assessment:e,isSubmitted:Ie,setAnswers:E,validationFeedback:St,renderExercise:_t,renderSeparator:Ct,primaryColor:k,contained:_,locale:vt(t),contentMaxWidth:q,t:R,footer:Nt}):M?T(Xa,{assessment:e,isSubmitted:Ie,setAnswers:E,validationFeedback:St,renderExercise:_t,renderSeparator:Ct,primaryColor:k,contained:_,locale:vt(t),contentMaxWidth:q,t:R,onAddAnnex:M,footer:Nt}):T("div",{className:"flex-1 overflow-y-auto",children:j("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:q},children:[T(Ke,{assessment:e,onAnswersChange:Ie?void 0:E,validationFeedback:St,renderExercise:_t,renderSeparator:Ct,locale:vt(t)}),Nt]})})}),ie&&T("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:j("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edpire-submit-confirm-title",className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[T("h3",{id:"edpire-submit-confirm-title",className:"text-base font-bold text-[#1d2025] mb-2",children:R("confirmTitle")}),gr>0&&j("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[j("p",{className:"flex items-start gap-2 font-semibold",children:[T(Wc,{size:15,className:"flex-shrink-0 mt-px"}),T("span",{children:gr===1?R("unansweredOne"):R("unansweredMany",{count:gr})})]}),j("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[Nn.slice(0,gn).map(W=>T("li",{children:T("button",{type:"button",onClick:()=>Ro(W.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:W.only?R("exercise",{index:W.exerciseIndex+1}):`${R("exercise",{index:W.exerciseIndex+1})} \xB7 ${R("question",{index:W.questionIndex+1})}`})},W.questionId)),gr>gn&&T("li",{children:R("unansweredMore",{count:gr-gn})})]})]}),T("p",{className:"text-sm text-[#565b66] mb-5",children:R("confirmDescription")}),j("div",{className:"flex gap-3 justify-end",children:[T("button",{onClick:()=>we(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:R("confirmCancel")}),j("button",{onClick:So,disabled:ee,style:k?{backgroundColor:k}:void 0,className:"flex items-center gap-2 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors disabled:opacity-50",children:[ee?T(fn,{size:14,className:"animate-spin"}):T(io,{size:14}),R("confirmSubmit")]})]})]})})]})})}function yn(e){return(e??[]).map(r=>({exerciseId:r.exercise_id,questions:r.questions.map(t=>({questionId:t.question_id,...t.explanation?{explanation:t.explanation}:{},nodeResults:t.node_results.map(n=>({nodeId:n.node_id,status:n.status,score:n.score,maxScore:n.max_score,...n.feedback!==void 0?{feedback:n.feedback}:{},...n.display_answer!==void 0?{displayAnswer:n.display_answer}:{},...n.detail!==void 0?{detail:n.detail}:{},...n.teacher_feedback!==void 0?{teacherFeedback:n.teacher_feedback}:{}}))}))}))}import{jsx as Zc}from"react/jsx-runtime";function vn(e,r){let t=yn(e.exercise_feedback);return{submissionId:e.submission_id,totalScore:e.score,maxScore:e.max_score,percentage:e.percentage,passed:e.passed,returnUrl:r??null,exerciseFeedback:t,awaitingManualGrading:e.awaiting_manual_grading??!1,aiPending:e.ai_pending??!1}}function wn(e){return{annex:e.annex??void 0,exercises:e.exercises.map(r=>({id:r.id,sharedContext:r.sharedContext,questions:r.questions.map(t=>({id:t.id,version:"1.0",content:t.content,answerKeys:[]}))}))}}function ho({token:e,data:r,baseUrl:t,options:n}){let{locale:a,branding:s,returnUrl:o,reportLabel:i,backLabel:c,onBack:d,overlayConfig:l,layout:p,mediaHandler:f,onComplete:b,onError:v}=n,g=s??r.branding??void 0,x=a??r.meta.language??"en",y=Xc(()=>wn(r.assessment),[r]),[h]=Jc(()=>new Date().toISOString()),_=fo(async w=>{let C=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:w})});if(!C.ok){let $=await C.json().catch(()=>({})),R=typeof $.error=="string"?$.error:"Submission failed",m=C.status===401?"TOKEN_INVALID":C.status===409?"TOKEN_USED":C.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw v?.({code:m,message:R}),new Error(R)}let M=await C.json();return b?.(M),vn(M,o)},[t,e,b,v,o]),u=fo(w=>{if(o)try{let C=new URL(o);C.searchParams.set("submission_id",w.submissionId),w.awaitingManualGrading||(C.searchParams.set("score",String(w.totalScore)),C.searchParams.set("max_score",String(w.maxScore))),window.location.href=C.toString()}catch{window.location.href=o}},[o]);return Zc(Lr,{assessment:y,meta:{title:r.meta.title,category:r.meta.category??null},locale:x,branding:g,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:h,onSubmit:_,onViewReport:o?u:void 0,reportLabel:i,onBack:d,backLabel:c,overlayConfig:l,layout:p,mediaHandler:f})}import{useMemo as go}from"react";import{jsx as rl}from"react/jsx-runtime";function el(){return Promise.reject(new Error("A review cannot be submitted"))}function bo({review:e,locale:r,branding:t,layout:n,onBack:a,backLabel:s}){let o=go(()=>wn(e.assessment),[e]),i=go(()=>({answers:e.answers,result:vn({submission_id:e.submission.id,score:e.submission.score,max_score:e.submission.max_score,percentage:e.submission.percentage,passed:e.submission.passed,awaiting_manual_grading:e.submission.awaiting_manual_grading,ai_pending:e.submission.ai_pending,exercise_feedback:e.exercise_feedback})}),[e]),c=r??e.meta.language??"en";return rl(Lr,{assessment:o,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,onSubmit:el,onBack:a,backLabel:s,layout:n})}import _h from"react";import{createRoot as Nh}from"react-dom/client";var tl="https://edpire.com";function vo(e,r,t){e.textContent="";let n=document.createElement("div");n.style.cssText="padding:32px;text-align:center;color:#dc2626;font-family:sans-serif";let a=document.createElement("div");if(a.textContent=r,n.appendChild(a),t){let s=document.createElement("div");s.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",s.textContent=t,n.appendChild(s)}e.appendChild(n)}var wo={mount(e){let{token:r,container:t,baseUrl:n=tl,onError:a}=e,s=typeof t=="string"?document.querySelector(t):t;if(!s){let d={code:"UNKNOWN",message:`Container not found: ${t}`};return a?.(d),{unmount:()=>{}}}let o=null,i=!1;function c(){if(i)return;i=!0;let d=o;o=null,setTimeout(()=>{d?.unmount()},0)}return(async()=>{s.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let d;try{let l=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(r)}`,{method:"GET"});if(!l.ok){let p=await l.json().catch(()=>({})),f=typeof p.error=="string"?p.error:"Failed to load assessment",b=l.status===401?"TOKEN_INVALID":l.status===403?"ORIGIN_NOT_ALLOWED":l.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";a?.({code:b,message:f});let v=b==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";vo(s,f,v);return}d=await l.json()}catch{a?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),vo(s,"Failed to connect to Edpire. Please try again.","");return}i||(s.innerHTML="",o=yo(s),o.render(xo.createElement(ho,{token:r,data:d,baseUrl:n,options:e})))})(),{unmount:c}},review(e){let{container:r,...t}=e,n=typeof r=="string"?document.querySelector(r):r;if(!n)return{unmount:()=>{}};n.textContent="";let a=yo(n);return a.render(xo.createElement(bo,t)),{unmount(){let s=a;a=null,setTimeout(()=>s?.unmount(),0)}}}};import{jsx as ol}from"react/jsx-runtime";function al({tokenEndpoint:e,assessmentId:r,tokenBody:t,className:n,style:a,onComplete:s,onError:o,...i}){let c=kn(null),d=kn(s);d.current=s;let l=kn(o);return l.current=o,nl(()=>{let p=c.current;if(!p)return;let f=!1,b=null;return(async()=>{let v;try{let g=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assessmentId:r,...t})});if(f)return;if(!g.ok){let y=await g.json().catch(()=>({}));l.current?.({code:"TOKEN_INVALID",message:typeof y.error=="string"?y.error:`Token endpoint returned ${g.status}`});return}let x=await g.json();if(!x.token){l.current?.({code:"TOKEN_INVALID",message:"Token endpoint did not return a token"});return}v=x.token}catch{f||l.current?.({code:"NETWORK_ERROR",message:"Failed to fetch embed token"});return}f||(b=wo.mount({token:v,container:p,...i,onComplete:g=>d.current?.(g),onError:g=>l.current?.(g)}))})(),()=>{f=!0,b?.unmount()}},[e,r]),ol("div",{ref:c,className:n,style:n?void 0:a??{width:"100%",height:"100%"}})}export{Lr as AssessmentShell,al as EdpireAssessmentPlayer,qa as EdpireQuestion};
|