@edpire/sdk 0.9.0 → 0.9.1

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/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import"./chunk-76CZ6Z7T.mjs";import Qa from"react";import{createRoot as Ya}from"react-dom/client";import{useCallback as Wa,useMemo as uc,useState as fc}from"react";import{cloneElement as $a,isValidElement as za,useCallback as dr,useEffect as tn,useMemo as $e,useRef as nn,useState as ze}from"react";import{jsx as ir}from"react/jsx-runtime";import{useEffect as nt,useMemo as mi,useRef as ui}from"react";import no from"mitt";var Fe=class{constructor(){this.emitter=no(),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()})}},xn="__edpireGlobalAnswerBus",yn=globalThis,Ar=yn[xn]??(yn[xn]=new Fe);import{jsx as ao}from"react/jsx-runtime";import{createContext as oo,useContext as so}from"react";var vn="__edpireAnswerBusContext",wn=globalThis,kn=wn[vn]??(wn[vn]=oo(Ar));function de(){return so(kn)}function Pr({children:e,bus:r=new Fe}){return ao(kn.Provider,{value:r,children:e})}import{Fragment as Pn,jsx as G,jsxs as Be}from"react/jsx-runtime";import{Fragment as ko,useState as Hr,useEffect as Ur,useMemo as Ro,useRef as So}from"react";import Pe from"clsx";import{jsx as O}from"react/jsx-runtime";import io from"katex";import"katex/dist/contrib/mhchem.js";var co={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function ur(e,r,t=!0){try{return io.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:co,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 ee(e){return{width:L(e),height:L(e)}}function Ne(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 Rn={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"}},Sn={border:"#2563eb",background:"#e0f2fe"},_n={border:"#dc2626",background:"#fee2e2"};function lo(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Sn.border}`,background:e?.background||Sn.background,borderRadius:L("4px"),padding:"0.17em 0.37em"}}var Mr=`${L("6px")} ${L("8px")}`;function po(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||_n.border}`,background:e?.background||_n.background,borderRadius:r,padding:"0.15em 0.45em"}}function we(e,r,t){return O("div",{className:"exercise-content",children:e.content.map((n,a)=>xe(n,`node-${a}`,r,t))})}function xe(e,r,t,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return O(Lr,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?O(Ir,{node:e,validationFeedback:t?.get(e.id)},r):O(Tr,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return O($r,{node:e},r);case"inlinePool":return O(zr,{node:e},r);case"matchingSet":return O(Dr,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return O(Fr,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return O(jr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return O(Or,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return O(Br,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},r);case"aiEvaluationConfig":return null;case"paragraph":{let a=e.attrs,o=a?.textAlign,s=a?.dir||void 0;return O("p",{dir:s,style:o?{textAlign:o}:void 0,children:e.content?.map((i,c)=>xe(i,`${r}-${c}`,t,n))},r)}case"heading":{let a=e.attrs.level??1,o=`h${a}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,l=Rn[a]??Rn[3];return O(o,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:e.content?.map((d,p)=>xe(d,`${r}-${p}`,t,n))},r)}case"blockquote":{let a=e.attrs,o=a?.dir||void 0,s=a?.textAlign;return O("blockquote",{dir:o,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 a=e,o=a.text??"",s=a.marks??[];if(s.length===0)return O("span",{children:o},r);let i={};for(let l of s)l.type==="textStyle"&&(l.attrs?.color&&(i.color=l.attrs.color),l.attrs?.fontSize&&(i.fontSize=l.attrs.fontSize),l.attrs?.fontFamily&&(i.fontFamily=l.attrs.fontFamily));let c=o;for(let l of s)switch(l.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:lo(l.attrs),children:c});break;case"circleText":c=O("span",{style:po(l.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:Ne(e.attrs?.width||void 0)??"auto",height:Ne(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:L("8px"),padding:`${L("4px")} ${L("8px")}`,maxWidth:"100%"},children:O("audio",{controls:!0,src:e.attrs?.src||void 0,style:{display:"block",width:L("320px"),maxWidth:"100%"}})},r);case"resizableVideo":return O("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Ne(e.attrs?.width||void 0)??"auto",height:Ne(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:Ne(e.attrs?.width||480),height:Ne(e.attrs?.height||270)}},r);case"inlineMath":return O("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:ur(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:ur(e.attrs?.latex??"",!0,!0)}},r);case"variable":return O("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let a=e;return a.type==="bulletList"?O("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((o,s)=>xe(o,`${r}-${s}`,t,n))},r):a.type==="orderedList"?O("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((o,s)=>xe(o,`${r}-${s}`,t,n))},r):a.type==="listItem"?O("li",{children:a.content?.map((o,s)=>xe(o,`${r}-${s}`,t,n))},r):a.type==="table"?O("div",{style:{overflowX:"auto",margin:`${L("1.25rem")} 0`},children:O("table",{style:{borderCollapse:"collapse",width:"100%",tableLayout:"fixed"},children:O("tbody",{children:a.content?.map((o,s)=>xe(o,`${r}-${s}`,t,n))})})},r):a.type==="tableRow"?O("tr",{children:a.content?.map((o,s)=>xe(o,`${r}-${s}`,t,n))},r):a.type==="tableCell"?O("td",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Mr,verticalAlign:"top"},children:a.content?.map((o,s)=>xe(o,`${r}-${s}`,t,n))},r):a.type==="tableHeader"?O("th",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Mr,verticalAlign:"top",background:"#f3f4f6",fontWeight:600},children:a.content?.map((o,s)=>xe(o,`${r}-${s}`,t,n))},r):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function te(e,r){return e.map(t=>{if(t.type==="text"){let n=Ye(t.text??""),a=t.marks??[],o=[];for(let s of a)s.type==="textStyle"&&(s.attrs?.color&&o.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&o.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&o.push(`font-family:${s.attrs.fontFamily}`));o.length>0&&(n=`<span style="${o.join(";")}">${n}</span>`);for(let s of a)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",l=s.attrs?.shape==="circle"?"50%":"9999px";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${l};padding:0.15em 0.45em">${n}</span>`;break}}return n}if(t.type==="paragraph"){let n=t.content?te(t.content,r):"",a=t.attrs?.dir,o=t.attrs?.textAlign,s=a?` dir="${a}"`:"",i=o?` style="text-align:${o}"`:"";return r?.stripParagraphs?n:`<p${s}${i}>${n}</p>`}if(t.type==="hardBreak")return"<br/>";if(t.type==="table"){let n=t.content?te(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?te(t.content,r):""}</tr>`;if(t.type==="tableCell"){let n=t.content?te(t.content,r):"",a=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",o=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<td${a}${o} style="border:1px solid #d1d5db;padding:${Mr};vertical-align:top">${n}</td>`}if(t.type==="tableHeader"){let n=t.content?te(t.content,r):"",a=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",o=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<th${a}${o} style="border:1px solid #d1d5db;padding:${Mr};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?te(t.content,r):""}</ul>`;if(t.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${t.content?te(t.content,r):""}</ol>`;if(t.type==="listItem")return`<li>${t.content?te(t.content,r):""}</li>`;if(t.type==="blockquote"){let n=t.content?te(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=Er(n.width),o=Er(n.height);return`<img src="${Ye(n.src??"")}" alt="${Ye(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${a?`width:${a};`:""}${o?`height:${o};`:""}"/>`}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="${Ye(n.src??"")}" style="display:block;width:${L("320px")};max-width:100%"></audio></span>`}if(t.type==="resizableVideo"){let n=t.attrs??{},a=Er(n.width),o=Er(n.height);return`<video src="${Ye(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${a?`width:${a};`:""}${o?`height:${o};`:""}"></video>`}if(t.type==="youtubeEmbed"){let n=t.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Ye(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:${Ne(n.width||480)};height:${Ne(n.height||270)}"></iframe>`}return t.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${ur(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">${ur(t.attrs?.latex??"",!0,!0)}</div>`:t.type==="variable"?`<span class="variable">{${Ye(t.attrs?.name??"")}}</span>`:""}).join("")}function Er(e){return e==null||e===""?null:Ne(e)??null}function Ye(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as mo}from"react/jsx-runtime";import{createContext as uo,useContext as Nn}from"react";var rr={submitButton:"Submit",showHint:"Show hint",clickToRemove:"Click to remove",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 qr={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9cris ta 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:"\xC9cris ta r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glisse-d\xE9pose 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 Wr={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",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 fo={en:rr,fr:qr,ar:Wr},wt=uo(null);function re(){return Nn(wt)??rr}function fr(e){let r=Nn(wt);return e&&fo[e]||r||rr}function hr({locale:e,children:r}){let t=fr(e);return mo(wt.Provider,{value:t,children:r})}import{jsx as ho}from"react/jsx-runtime";import{createContext as go,useContext as Cn,useMemo as An}from"react";var bo={sm:.875,md:1,lg:1.25,xl:1.5},kt=go(null);function xo(e,r){let t={...e??{}};if(r)for(let[n,a]of Object.entries(r))a!==void 0&&(t[n]=a);return t}function yo(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?bo[e]??1:1}function ke(e){let r=e??{};return{scale:yo(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 ye(e){let r=Cn(kt);return An(()=>xo(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Ce(){let e=Cn(kt);return An(()=>ke(e),[e])}function ve({display:e,children:r}){let t=ye(e);return ho(kt.Provider,{value:t,children:r})}function Re(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function Ke(){let{motion:e}=Ce();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function vo(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 wo(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 gr(e,r){let t=[...e],n=wo(vo(r));for(let a=t.length-1;a>0;a--){let o=Math.floor(n()*(a+1));[t[a],t[o]]=[t[o],t[a]]}return t}function Rt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return G(Pn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=G("strong",{children:r}):t.type==="italic"?r=G("em",{children:r}):t.type==="underline"?r=G("u",{children:r}):t.type==="strike"?r=G("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=G("span",{style:{color:t.attrs.color},children:r}));return G(Pn,{children:r})}return e.type==="paragraph"?G("span",{className:"block",children:e.content?.map((r,t)=>G(Rt,{node:r},t))??G("br",{})}):e.type==="hardBreak"?G("br",{}):e.content?G("span",{className:"block",children:e.content.map((r,t)=>G(Rt,{node:r},t))}):null}function _o({nodes:e}){return G("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>G(Rt,{node:r},t))})}function En({hint:e}){let r=re(),[t,n]=Hr(!1),[a,o]=Hr(!1),s=So(null);return Ur(()=>{if(!a)return;let d=p=>{s.current&&!s.current.contains(p.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),Be("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[G("button",{type:"button",onClick:d=>{d.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Pe("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&G("span",{className:"player-blank-hint-pop",onClick:d=>d.stopPropagation(),children:G(_o,{nodes:e})})]})}function No(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var Co=e=>e.replace(/ {2,}/g,r=>"&nbsp;".repeat(r.length-1)+" "),Ao=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function In(e){return(e??[]).some(r=>Ao.has(r?.type)||In(r?.content))}var Mn=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M5 13l4 4L19 7"})}),Ln=()=>G("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:G("path",{d:"M6 6l12 12M18 6L6 18"})});function Lr({node:e,validationFeedback:r}){let t=de(),n=re(),a=Ce(),o=Ke(),{id:s,content:i,attrs:c}=e,l=c.shuffle??!1,d="prompt"in c?c.prompt:void 0,p="separator"in c?c.separator??"/":"/",g="pickLimit"in c&&c.pickLimit?c.pickLimit:1,h="layout"in c?c.layout??"row":"row",v=e.type==="inlineChoiceSet",y=JSON.stringify(i),x=l&&a.shuffleSeed!==void 0,k=Ro(()=>x?gr(i,`${a.shuffleSeed}:${s}`):null,[x,a.shuffleSeed,s,y]),[f,C]=Hr(i);Ur(()=>{x||C(l?No(i):i)},[l,x,y]);let u=k??f,[b,P]=Hr(new Set),E=r?.showFeedback??!1,z=r?.correctChoiceIds||[];Ur(()=>{let q=R=>{let D=R.answers.find(H=>H.nodeId===s&&H.type==="choiceSet");D&&"selectedIds"in D.answer&&P(new Set(D.answer.selectedIds))};return t.on("answers:prefill",q),()=>t.off("answers:prefill",q)},[s,t]),Ur(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(b)}}})},[b,s,t]);let w=q=>{E||P(R=>{let _=new Set(R);return g===1?_.has(q)?_.delete(q):(_.clear(),_.add(q)):_.has(q)?_.delete(q):_.size<g&&_.add(q),_})},m=q=>Co(te(q.content)),N=q=>{let R=b.has(q),_=z.includes(q);return E?_&&R?"correct":_&&!R?"correct-unchosen":!_&&R?"incorrect":"muted":R?"selected":"idle"},I={idle:"",selected:"player-choice--selected",correct:Pe("player-choice--correct",o.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:Pe("player-choice--incorrect",o.shake),muted:"player-choice--muted"},j={idle:"",selected:"player-inline-choice--selected",correct:Pe("player-inline-choice--correct",o.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:Pe("player-inline-choice--incorrect",o.shake),muted:"player-inline-choice--muted"};if(v)return Be("span",{className:"inline-choice",children:[d&&Be("span",{className:"mr-2 font-medium",children:[d,g>1?G("span",{className:"ml-1 opacity-60",children:n.chooseN(g)}):null]}),u.map((q,R)=>Be(ko,{children:[G("button",{type:"button",disabled:E,onClick:()=>w(q.id),className:Pe("player-inline-choice",j[N(q.id)]),"aria-pressed":b.has(q.id),dangerouslySetInnerHTML:{__html:m(q)}}),R<u.length-1&&G("span",{className:"mx-1",children:p})]},q.id)),c.hint&&c.hint.length>0&&G(En,{hint:c.hint})]});let S=a.layoutBy==="box",M=a.choiceColumns?Math.min(a.choiceColumns,u.length):0,W=M?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${M}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},$=u.some(q=>In(q.content)),F=a.choiceLabels==="letters",Q=q=>n.choiceLetters[q]??String(q+1);return Be("div",{className:Pe("cs-player my-4 space-y-3",S&&"cs-player--box"),children:[d&&Be("p",{className:"font-medium",children:[d,g>1?Be("span",{className:"ml-2 text-sm opacity-70",children:["(choose ",g,")"]}):null]}),c.hint&&c.hint.length>0&&G(En,{hint:c.hint}),G("div",{className:Pe("cs-player__grid",h==="row"&&"cs-player__grid--row"),style:W,children:u.map((q,R)=>{let _=N(q.id),D=_==="incorrect"?"incorrect":_==="correct"||_==="correct-unchosen"?"correct":null;return Be("button",{type:"button",disabled:E,onClick:()=>w(q.id),className:Pe("player-choice",$&&"player-choice--tile",I[_]),"aria-pressed":b.has(q.id),children:[G("span",{className:Pe("player-choice__mark",g>1?"player-choice__mark--box":"player-choice__mark--radio",F&&"player-choice__mark--letter"),children:F?Q(R):_==="incorrect"?G(Ln,{}):G(Mn,{})}),G("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:m(q)}}),F&&D&&G("span",{className:`player-choice__verdict player-choice__verdict--${D}`,"aria-hidden":"true",children:D==="incorrect"?G(Ln,{}):G(Mn,{})})]},q.id)})})]})}import{Fragment as St,jsx as J,jsxs as Vr}from"react/jsx-runtime";import{useState as _t,useEffect as Gr,useRef as Tn,useCallback as Po}from"react";import qe from"clsx";function Nt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return J(St,{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(St,{children:r})}return e.type==="paragraph"?J("span",{className:"block",children:e.content?.map((r,t)=>J(Nt,{node:r},t))??J("br",{})}):e.type==="hardBreak"?J("br",{}):e.content?J("span",{className:"block",children:e.content.map((r,t)=>J(Nt,{node:r},t))}):null}function Eo({nodes:e}){return J("span",{className:"block space-y-1",children:e.map((r,t)=>J(Nt,{node:r},t))})}function Mo({hint:e}){let r=re(),[t,n]=_t(!1),[a,o]=_t(!1),s=Tn(null);return Gr(()=>{if(!a)return;let d=p=>{s.current&&!s.current.contains(p.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),Vr("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[J("button",{type:"button",onClick:d=>{d.stopPropagation(),a?(o(!1),n(!1)):(o(!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:d=>d.stopPropagation(),children:J(Eo,{nodes:e})})]})}function Ir({node:e,validationFeedback:r}){let t=de(),n=re(),a=Ke(),{id:o,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,d=Tn(null),p=i.trim().split(/\s+/).filter(Boolean).length,g=c==="auto"&&p>=4,[h,v]=_t(""),y=r?.showFeedback??!1,x=r?.state,k=x==="validating",f=r?.displayAnswer,C=r?.message;Gr(()=>{let E=z=>{let m=z.answers.find(N=>N.nodeId===o&&N.type==="blank");m&&"mode"in m.answer&&m.answer.mode==="typed"&&"text"in m.answer&&v(m.answer.text)};return t.on("answers:prefill",E),()=>t.off("answers:prefill",E)},[o,t]),Gr(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:h}}})},[h,o,t]);let u=E=>{v(E.target.value)},b=Po(()=>{let E=d.current;E&&(E.style.height="auto",E.style.height=`${E.scrollHeight}px`)},[]);Gr(()=>{b()},[h,b]);let P=y&&!k;return Vr("span",{className:qe("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",g&&"w-full"),children:[J("span",{className:qe("relative inline-block shrink-0 min-w-0 max-w-full",g&&"w-full flex-1"),children:P?J("span",{className:qe("player-typed-blank-feedback",g&&"w-full",x==="correct"&&qe("player-typed-blank-feedback--correct",a.hop),x==="partial"&&"player-typed-blank-feedback--partial",x==="incorrect"&&qe("player-typed-blank-feedback--incorrect",a.wobble)),children:h||J("span",{className:"opacity-40",children:i})}):Vr(St,{children:[J("textarea",{ref:d,placeholder:i,value:h,onChange:u,disabled:y,rows:1,className:qe("player-typed-blank",g&&"w-full",k&&"player-typed-blank--pending"),style:c!=="auto"?{width:c}:g?{width:"100%"}:{width:`${Math.max(7,h.length+1)}ch`,maxWidth:"100%"}}),!h&&!k&&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"}),k&&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})})]})}),y&&x==="incorrect"&&f&&Vr("span",{className:"player-blank-reveal",children:["(",f,")"]}),y&&C&&J("span",{className:qe("player-blank-feedback",x==="correct"&&"player-blank-feedback--correct",x==="partial"&&"player-blank-feedback--partial",x==="incorrect"&&"player-blank-feedback--incorrect"),children:C}),l&&l.length>0&&J(Mo,{hint:l})]})}import{jsx as Yr,Fragment as Bn,jsxs as Et}from"react/jsx-runtime";import{useEffect as qn}from"react";import Kr from"clsx";import{useDroppable as Uo,useDndContext as Ho}from"@dnd-kit/core";import{jsx as Lo}from"react/jsx-runtime";import{createContext as Io,useCallback as We,useContext as To,useEffect as $o,useMemo as $n,useRef as zo,useState as Ct}from"react";import{useDndMonitor as Do}from"@dnd-kit/core";var Dn=Io(null);function Ee(){let e=To(Dn);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function zn(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 Qr({children:e,initialAnswers:r}){let t=de(),n=$n(()=>zn(r),[r]),[a,o]=Ct(n),[s,i]=Ct({}),[c,l]=Ct({}),d=zo(new Set);$o(()=>{let u=b=>{let P=zn(b.answers);Object.keys(P).length!==0&&o(E=>{if(!Object.entries(P).some(([m,N])=>E[m]?.choiceId!==N.choiceId||E[m]?.poolId!==N.poolId||E[m]?.value!==N.value))return E;let w={...E,...P};return i(m=>{let N={...m};for(let[I,j]of Object.entries(m)){let S=new Set(Object.values(w).filter(M=>M.poolId===I).map(M=>M.choiceId));N[I]={...j,available:new Set(j.choices.map(M=>M.id).filter(M=>!S.has(M)))}}return N}),w})};return t.on("answers:prefill",u),()=>t.off("answers:prefill",u)},[t]);let p=We((u,b)=>{i(P=>{let E=P[u];if(!E){let I=new Set;for(let S of Object.values(a))S.poolId===u&&I.add(S.choiceId);let j=new Set(b.map(S=>S.id).filter(S=>!I.has(S)));return{...P,[u]:{choices:b,available:j}}}let z=new Set(E.choices.map(I=>I.id)),w=new Set(b.map(I=>I.id));if(!(b.some(I=>!z.has(I.id))||E.choices.some(I=>!w.has(I.id))))return P;let N=new Set;for(let I of E.available)w.has(I)&&N.add(I);for(let I of b)z.has(I.id)||N.add(I.id);return{...P,[u]:{choices:b,available:N}}})},[a]),g=We((u,b)=>{l(P=>{let E=P[u]??[];return E.includes(b)?P:{...P,[u]:[...E,b]}}),!d.current.has(b)&&!a[b]&&(d.current.add(b),t.emit({type:"answer:changed",answer:{nodeId:b,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}}))},[a,t]),h=We(u=>(c[u]??[]).find(P=>!a[P])??null,[c,a]),v=We((u,b,P,E)=>{o(z=>{let w=z[u];return w&&i(m=>{let N=m[w.poolId];if(!N)return m;let I=new Set(N.available);return I.add(w.choiceId),{...m,[w.poolId]:{...N,available:I}}}),{...z,[u]:{choiceId:P,value:E,poolId:b}}}),i(z=>{let w=z[b];if(!w)return z;let m=new Set(w.available);return m.delete(P),{...z,[b]:{...w,available:m}}}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:P,poolId:b,value:E}}})},[t]),y=We(u=>{let b=a[u];if(!b)return;let{poolId:P,choiceId:E}=b;i(z=>{let w=z[P];if(!w)return z;let m=new Set(w.available);return m.add(E),{...z,[P]:{...w,available:m}}}),o(z=>{let{[u]:w,...m}=z;return m}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:P,value:""}}})},[a,t]),x=We((u,b)=>s[u]?.available.has(b)??!1,[s]),k=We((u,b)=>s[u]?.choices.find(P=>P.id===b),[s]),f=We(()=>{o({}),i(u=>{let b={};for(let[P,E]of Object.entries(u))b[P]={choices:E.choices,available:new Set(E.choices.map(z=>z.id))};return b});for(let[u,b]of Object.entries(c))for(let P of b)t.emit({type:"answer:changed",answer:{nodeId:P,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}})},[c,t]);Do({onDragEnd(u){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:u.active,over:u.over}}))}});let C=$n(()=>({blanks:a,pools:s,registerPool:p,registerBlank:g,fill:v,back:y,isAvailable:x,getChoice:k,firstEmptyBlank:h,resetAllAnswers:f}),[a,s,p,g,v,y,x,k,h,f]);return Lo(Dn.Provider,{value:C,children:e})}import{Fragment as Fn,jsx as ie,jsxs as Fo}from"react/jsx-runtime";import{useState as At,useEffect as On,useRef as jn,useLayoutEffect as jo}from"react";import Oo from"clsx";var Bo=typeof window<"u"?jo:On;function Pt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return ie(Fn,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=ie("strong",{children:r}):t.type==="italic"?r=ie("em",{children:r}):t.type==="underline"?r=ie("u",{children:r}):t.type==="strike"?r=ie("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=ie("span",{style:{color:t.attrs.color},children:r}));return ie(Fn,{children:r})}return e.type==="paragraph"?ie("span",{className:"block",children:e.content?.map((r,t)=>ie(Pt,{node:r},t))??ie("br",{})}):e.type==="hardBreak"?ie("br",{}):e.content?ie("span",{className:"block",children:e.content.map((r,t)=>ie(Pt,{node:r},t))}):null}function qo({nodes:e}){return ie("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>ie(Pt,{node:r},t))})}function Wo({hint:e}){let r=re(),[t,n]=At(!1),[a,o]=At(!1),[s,i]=At(null),c=jn(null),l=jn(null);return On(()=>{if(!a)return;let h=v=>{let y=v.target;c.current&&!c.current.contains(y)&&l.current&&!l.current.contains(y)&&(o(!1),n(!1))};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[a]),Bo(()=>{if(!t){i(null);return}let h=c.current,v=l.current;if(!h||!v)return;let y=h.getBoundingClientRect(),x=v.getBoundingClientRect(),k=8,f=y.top-x.height-k;f<k&&(f=y.bottom+k);let C=y.left+y.width/2-x.width/2;C=Math.max(k,Math.min(C,window.innerWidth-x.width-k)),i({top:f,left:C})},[t]),Fo("span",{ref:c,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[ie("button",{type:"button",onClick:h=>{h.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Oo("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&ie("span",{ref:l,className:"player-blank-hint-pop",onClick:h=>h.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:ie(qo,{nodes:e})})]})}function Me({hint:e}){return!e||e.length===0?null:ie(Wo,{hint:e})}function Tr({node:e,validationFeedback:r}){let{id:t,attrs:n}=e,{poolId:a,placeholder:o="___",hint:s}=n,{blanks:i,fill:c,back:l,getChoice:d,registerBlank:p}=Ee(),g=re(),h=Ke(),v=i[t],y=!!v?.choiceId,x=r?.showFeedback??!1,k=r?.state,f=r?.correctChoiceIds??[],C=x&&k==="incorrect"&&f.length>0?d(a||"",f[0]):void 0,u=C?C.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:b,isOver:P}=Uo({id:t,data:{type:"blank",blankId:t,poolId:a}}),{active:E}=Ho(),z=!!E&&E.data.current?.poolId===a;return qn(()=>{p(a||"",t)},[a,t,p]),qn(()=>{let N=I=>{let j=I,{active:S,over:M}=j.detail||{};if(!M||M.id!==t)return;let{choiceId:W,poolId:$}=S?.data.current||{};if(!W||$!==a)return;let F=d(a||"",W);if(!F)return;let Q=F.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,a||"",W,Q)};return window.addEventListener("dnd-drop",N),()=>window.removeEventListener("dnd-drop",N)},[t,a,d,c]),Et(Bn,{children:[Yr("span",{ref:b,onClick:()=>{y&&!x&&l(t)},className:Kr("player-choice-blank",P&&"player-choice-blank--over",!P&&z&&!y&&!x&&"player-choice-blank--target",y&&!x&&!P&&"player-choice-blank--filled",x&&k==="correct"&&Kr("player-choice-blank--correct",h.hop),x&&k==="partial"&&Kr("player-choice-blank--partial",h.hop),x&&k==="incorrect"&&Kr("player-choice-blank--incorrect",h.wobble)),title:y&&!x?g.clickToRemove:void 0,"data-node-id":t,"data-pool-id":a,children:y?Et(Bn,{children:[Yr("span",{children:v.value}),Yr("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):o}),u&&Et("span",{className:"player-blank-reveal",children:["(",u,")"]}),Yr(Me,{hint:s})]})}import{jsx as Mt,jsxs as Qo}from"react/jsx-runtime";import{useEffect as Un,useState as Yo}from"react";import Ko from"clsx";import{jsx as Wn}from"react/jsx-runtime";import Vo from"clsx";import{useDraggable as Go}from"@dnd-kit/core";function tr({poolId:e,data:r,isInline:t=!1}){let{isAvailable:n,firstEmptyBlank:a,fill:o}=Ee(),{id:s,html:i}=r,c=!n(e,s),{setNodeRef:l,attributes:d,listeners:p,transform:g,isDragging:h}=Go({id:s,data:{type:"choice",choiceId:s,poolId:e,html:i},disabled:c});if(c)return null;let v=f=>f.replace(/<\/?[^>]+(>|$)/g,""),y=()=>{let f=a(e);if(f){let C=v(i);o(f,e,s,C)}},x=g?{transform:`translate3d(${g.x}px, ${g.y}px, 0)`}:void 0;return Wn(t?"span":"div",{ref:l,style:x,className:Vo("player-bank-pill",h&&"player-bank-pill--dragging",t&&"mx-1"),...d,...p,onClick:y,children:Wn("span",{dangerouslySetInnerHTML:{__html:i},className:"pointer-events-none whitespace-pre-wrap break-words"})})}function $r({node:e}){let r=re(),{id:t,attrs:n,content:a}=e,{shuffle:o=!0,equalWidth:s=!1}=n,{registerPool:i}=Ee(),[c,l]=Yo(()=>a.map(d=>({id:d.id,html:te(d.content)})));return Un(()=>{let d=a.map(p=>({id:p.id,html:te(p.content)}));l(o?[...d].map(p=>({v:p,r:Math.random()})).sort((p,g)=>p.r-g.r).map(p=>p.v):d)},[o,JSON.stringify(a)]),Un(()=>{i(t,c)},[t,c,i]),Qo("div",{className:"player-word-bank",children:[Mt("div",{className:"player-word-bank__label",children:r.wordBank}),Mt("div",{className:Ko("player-word-bank__items",s&&"player-word-bank__items--grid"),children:c.map(d=>Mt(tr,{poolId:t,data:d},d.id))})]})}import{jsx as Lt,jsxs as Jo}from"react/jsx-runtime";import{useEffect as Hn,useState as Xo}from"react";function zr({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:a=!0,separator:o=" "}=t,{registerPool:s}=Ee(),[i,c]=Xo(()=>n.map(l=>({id:l.id,html:te(l.content,{stripParagraphs:!0})})));return Hn(()=>{let l=n.map(d=>({id:d.id,html:te(d.content,{stripParagraphs:!0})}));c(a?[...l].map(d=>({v:d,r:Math.random()})).sort((d,p)=>d.r-p.r).map(d=>d.v):l)},[a,JSON.stringify(n)]),Hn(()=>{s(r,i)},[r,i,s]),Lt("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:L("0.25rem"),alignItems:"center"},children:i.map((l,d)=>Jo("span",{children:[Lt(tr,{poolId:r,data:l,isInline:!0}),d<i.length-1&&Lt("span",{children:o})]},l.id))})}import{jsx as nr,jsxs as zt}from"react/jsx-runtime";import{useState as Dt,useEffect as Ft,useMemo as ts}from"react";import{Check as ns,X as as}from"lucide-react";import{jsx as ue,jsxs as Je}from"react/jsx-runtime";import{useState as It,useMemo as Tt,useRef as $t,useCallback as Zo,useLayoutEffect as es}from"react";var Vn="#1d2025",Gn="#8d93a0",Qn="#1f8a4c",Yn="#d23b2b",rs=11;function Kn({leftItems:e,rightItems:r,connections:t,direction:n,disabled:a,feedback:o,onConnectionsChange:s}){let[i,c]=It(null),[l,d]=It(null),[p,g]=It(new Map),h=$t(null),v=$t(new Map),y=$t("mouse"),x=o?.showFeedback??!1,k=Tt(()=>{let R=new Map;if(o?.pairFeedback)for(let _ of o.pairFeedback)R.set(`${_.leftId}-${_.rightId}`,_.correct);return R},[o]),f=Tt(()=>{let R=new Map;return o?.correctPairings?.forEach(_=>R.set(_.leftId,_.rightId)),R},[o]),C=Tt(()=>{let R=new Map;return o?.correctPairings?.forEach(_=>R.set(_.rightId,_.leftId)),R},[o]),u=new Map,b=new Map;t.forEach((R,_)=>{u.set(R.leftId,_),b.set(R.rightId,_)});let P=R=>{let _=t[R];if(!x||!_)return null;let D=k.get(`${_.leftId}-${_.rightId}`);return D===!0?"correct":D===!1?"incorrect":null},E=Zo(()=>{if(!h.current)return;let R=h.current.getBoundingClientRect(),_=new Map;v.current.forEach((D,H)=>{if(D){let V=D.getBoundingClientRect();_.set(H,new DOMRect(V.left-R.left,V.top-R.top,V.width,V.height))}}),g(_)},[]);es(()=>{E();let R=new ResizeObserver(E);return h.current&&R.observe(h.current),()=>R.disconnect()},[E,t,e,r]);let z=8,w=(R,_)=>{let D=p.get(R);if(!D)return null;let H=D.y+D.height/2;return _==="left"?{x:D.x+D.width,y:H}:{x:D.x-z,y:H}},m=(R,_)=>{if(a)return;let H=(_==="left"?u:b).has(R),V=i?.id===R&&i?.side===_,le=i!==null&&i.side!==_;if(V){c(null);return}if(le){let Z=_==="right"?i.id:R,oe=_==="left"?i.id:R,se=t.filter(ne=>ne.leftId!==Z&&ne.rightId!==oe);se.push({leftId:Z,rightId:oe}),s(se),c(null);return}if(H&&!i){let Z=_==="left"?t.filter(oe=>oe.leftId!==R):t.filter(oe=>oe.rightId!==R);s(Z);return}c({id:R,side:_})},N=(R,_,D)=>{if(a||(y.current=D.pointerType,D.pointerType==="touch"))return;D.currentTarget.setPointerCapture(D.pointerId);let H=h.current.getBoundingClientRect();d({fromId:R,fromSide:_,x:D.clientX-H.left,y:D.clientY-H.top,overId:null,overSide:null})},I=R=>{if(!l)return;let _=h.current.getBoundingClientRect(),D=R.clientX-_.left,H=R.clientY-_.top,V=l.fromSide==="left"?"right":"left",le=V==="left"?e:r,Z=null,oe=null;for(let se of le){let ne=p.get(se.id);if(ne&&D>=ne.x&&D<=ne.x+ne.width&&H>=ne.y&&H<=ne.y+ne.height){Z=se.id,oe=V;break}}d(se=>se?{...se,x:D,y:H,overId:Z,overSide:oe}:null)},j=R=>{if(!l)return;let _=h.current.getBoundingClientRect(),D=R.clientX-_.left,H=R.clientY-_.top,V=w(l.fromId,l.fromSide);if((V?Math.hypot(D-V.x,H-V.y):999)<8){d(null),m(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let Z=l.fromSide==="left"?l.fromId:l.overId,oe=l.fromSide==="right"?l.fromId:l.overId,se=t.filter(ne=>ne.leftId!==Z&&ne.rightId!==oe);se.push({leftId:Z,rightId:oe}),s(se)}d(null),c(null)},S=(R,_)=>{if(!x)return null;let H=(_==="left"?u:b).get(R.id);if(H!==void 0){let V=t[H];if(k.get(`${V.leftId}-${V.rightId}`)===!0)return null}if(_==="left"){let V=f.get(R.id);return r.find(le=>le.id===V)?.content??null}else{let V=C.get(R.id);return e.find(le=>le.id===V)?.content??null}},M=(R,_)=>{let H=(_==="left"?u:b).get(R.id),V=H!==void 0,le=i?.id===R.id&&i?.side===_,Z=i!==null&&i.side!==_&&!V,oe=l?.overId===R.id&&l?.overSide===_,se=V?P(H):null,ne=V?H+1:null,U="matching-player__item";V&&(U+=" matching-player__item--matched"),se==="correct"&&(U+=" matching-player__item--correct"),se==="incorrect"&&(U+=" matching-player__item--incorrect"),le&&(U+=" matching-player__item--selected"),(Z||oe)&&(U+=" matching-player__item--available"),a&&(U+=" matching-player__item--disabled");let mr=S(R,_);return Je("button",{ref:Ve=>{Ve?v.current.set(R.id,Ve):v.current.delete(R.id)},type:"button",className:U,onPointerDown:Ve=>N(R.id,_,Ve),onClick:()=>{y.current==="touch"&&m(R.id,_)},"aria-pressed":le,children:[_==="right"&&ue("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:Je("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[ue("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),ue("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),V&&_==="left"&&ue("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),ue("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:te(R.content)}}),mr&&Je("span",{className:"matching-player__correct-hint",children:["(",ue("span",{dangerouslySetInnerHTML:{__html:te(mr)}}),")"]}),V&&_==="right"&&ue("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),_==="left"&&ue("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:Je("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[ue("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),ue("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},R.id)},W=n==="ltr"?e:r,$=n==="ltr"?r:e,F=n==="ltr"?"left":"right",Q=n==="ltr"?"right":"left";return Je("div",{ref:h,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:I,onPointerUp:j,children:[Je("svg",{className:"matching-player__svg","aria-hidden":!0,children:[ue("defs",{children:[["mp-arrow-ink",Vn],["mp-arrow-correct",Qn],["mp-arrow-incorrect",Yn],["mp-arrow-ghost",Gn]].map(([R,_])=>ue("marker",{id:R,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:ue("polygon",{points:"0 0, 11 4.5, 0 9",fill:_})},R))}),t.map(R=>{let _=w(R.leftId,"left"),D=w(R.rightId,"right");if(!_||!D)return null;let H=D.x-rs,V=Math.max(16,Math.abs(H-_.x)*.4),le=`M ${_.x} ${_.y} C ${_.x+V} ${_.y}, ${H-V} ${D.y}, ${H} ${D.y}`,Z=x?k.get(`${R.leftId}-${R.rightId}`):void 0;return ue("path",{d:le,stroke:Z===!0?Qn:Z===!1?Yn:Vn,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${Z===!0?"mp-arrow-correct":Z===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${R.leftId}-${R.rightId}`)}),l&&(()=>{let R=w(l.fromId,l.fromSide);if(!R)return null;let _=Math.abs(l.x-R.x)*.35,D=`M ${R.x} ${R.y} C ${R.x+_} ${R.y}, ${l.x-_} ${l.y}, ${l.x} ${l.y}`;return ue("path",{d:D,stroke:Gn,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),Je("div",{className:"matching-player__columns",children:[ue("div",{className:"matching-player__column",children:W.map(R=>M(R,F))}),ue("div",{className:"matching-player__column",children:$.map(R=>M(R,Q))})]})]})}var Jn=e=>Number.isInteger(e)?String(e):e.toFixed(2);function Xn(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function Dr({node:e,validationFeedback:r}){let t=de(),{shuffleSeed:n,layoutBy:a}=Ce(),{id:o,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:d,hint:p}=s,g=JSON.stringify(i),h=JSON.stringify(c),v=d&&n!==void 0,y=ts(()=>v?{left:gr(i,`${n}:${o}:left`),right:gr(c,`${n}:${o}:right`)}:null,[v,n,o,g,h]),[x,k]=Dt(i),[f,C]=Dt(c);Ft(()=>{v||(d?(k(Xn(i)),C(Xn(c))):(k(i),C(c)))},[d,v,g,h]);let u=y?.left??x,b=y?.right??f,[P,E]=Dt([]),z=r?.showFeedback??!1;Ft(()=>{let S=M=>{let $=M.answers.find(F=>F.nodeId===o&&F.type==="matchingSet");$&&"connections"in $.answer&&E($.answer.connections)};return t.on("answers:prefill",S),()=>t.off("answers:prefill",S)},[t,o]),Ft(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"matchingSet",timestamp:Date.now(),answer:{connections:P}}})},[t,o,P]);let w=S=>{z||E(S)},m=r?.score,N=r?.maxScore,I=z&&m!=null&&N!=null,j=I?m>=N?"correct":m>0?"partial":"incorrect":null;return zt("div",{className:a==="box"?"matching-player matching-player--box":"matching-player",children:[p&&p.length>0&&nr("div",{className:"matching-player-hintrow",children:nr(Me,{hint:p})}),nr(Kn,{leftItems:u,rightItems:b,connections:P,direction:l,disabled:z,feedback:r,onConnectionsChange:w}),I&&zt("div",{className:"matching-player-feedback matching-player-feedback--"+j,children:[j==="correct"&&nr(ns,{size:15,style:ee(15)}),j==="incorrect"&&nr(as,{size:15,style:ee(15)}),nr("span",{children:j==="correct"?"All matched":j==="partial"?"Partial credit":"Not matched"}),zt("span",{className:"matching-player-score",children:[Jn(m)," / ",Jn(N)]})]})]})}import{jsxs as ar,jsx as Le,Fragment as os}from"react/jsx-runtime";import{useState as Zn,useEffect as jt,useRef as ss,useCallback as ea}from"react";import Jr from"clsx";function Fr({node:e,validationFeedback:r}){let t=de(),n=re(),{id:a,attrs:o}=e,{placeholder:s,minWords:i=0,maxWords:c=500,hint:l}=o,[d,p]=Zn(""),[g,h]=Zn(0),v=r?.showFeedback??!1,y=r?.state,x=c<=30,k=ea(m=>m.trim().split(/\s+/).filter(Boolean).length,[]);jt(()=>{let m=N=>{let j=N.answers?.find(S=>S.nodeId===a&&S.type==="aiAnswer");if(j&&j.answer?.text!=null){let S=j.answer.text;p(S),h(k(S))}};return t.on("answers:prefill",m),()=>t.off("answers:prefill",m)},[a,t,k]),jt(()=>{let m=()=>{p(""),h(0)};return t.on("answers:reset",m),()=>t.off("answers:reset",m)},[t]);let f=ss(null),C=ea((m,N)=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:m,wordCount:N}}})},300)},[a,t]);jt(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let u=m=>{if(v)return;let N=k(m);p(m),h(N),C(m,N)},b=y==="validating",P=Jr("player-ai-count",g>c&&"player-ai-count--over"),E=!v||b?"":y==="correct"?"player-ai-input--correct":y==="incorrect"?"player-ai-input--incorrect":y==="partial"?"player-ai-input--partial":"",z=y==="correct"?"player-ai-feedback--correct":y==="incorrect"?"player-ai-feedback--incorrect":y==="partial"?"player-ai-feedback--partial":"",w=m=>Number.isInteger(m)?String(m):m.toFixed(2);return ar("div",{className:"player-ai",children:[ar("div",{className:"player-ai-counts",children:[ar("span",{className:P,children:[g," / ",c]}),i>0&&g<i&&Le("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),Le("span",{style:{marginInlineStart:"auto"},children:Le(Me,{hint:l})})]}),x?Le("input",{type:"text",value:d,onChange:m=>u(m.target.value),placeholder:s??n.shortAnswerPlaceholder,disabled:v,className:Jr("player-ai-input",E)}):Le("textarea",{value:d,onChange:m=>u(m.target.value),placeholder:s??n.longAnswerPlaceholder,disabled:v,rows:5,className:Jr("player-ai-input player-ai-input--multiline",E)}),v&&r&&Le("div",{className:Jr("player-ai-feedback",z),children:b?ar("div",{className:"player-ai-validating",children:[Le("span",{className:"player-ai-spinner"}),Le("span",{children:n.aiEvaluationInProgress})]}):ar(os,{children:[r.message&&Le("p",{className:"player-ai-message",children:r.message}),r.score!=null&&r.maxScore!=null&&Le("div",{className:"player-ai-score-row",children:ar("span",{className:"player-ai-score",children:[w(r.score)," / ",w(r.maxScore)]})})]})})]})}import{Fragment as ra,jsx as A,jsxs as K}from"react/jsx-runtime";import{useState as he,useEffect as _e,useRef as Se,useCallback as Xr}from"react";import{useEditor as is,EditorContent as cs}from"@tiptap/react";import ls from"@tiptap/starter-kit";import Ie from"clsx";import{FolderOpen as ds,Mic as ps,Video as aa,Monitor as ms,Clock as us,Image as fs,FileText as oa,Music as hs,Link2 as gs}from"lucide-react";function sa(e){return e.trim().split(/\s+/).filter(Boolean).length}function ia(e){return e.length}function bs(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return sa(r(e))}function xs(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return ia(r(e))}function Ot({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return A(ra,{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(ra,{children:r})}return e.type==="paragraph"?A("span",{className:"block",children:e.content?.map((r,t)=>A(Ot,{node:r},t))??A("br",{})}):e.type==="hardBreak"?A("br",{}):e.content?A("span",{className:"block",children:e.content.map((r,t)=>A(Ot,{node:r},t))}):null}function ys({nodes:e}){return A("span",{className:"block space-y-1 text-amber-900",children:e.map((r,t)=>A(Ot,{node:r},t))})}function vs({hint:e}){let r=re(),[t,n]=he(!1),[a,o]=he(!1),s=Se(null);return _e(()=>{if(!a)return;let i=c=>{s.current&&!s.current.contains(c.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]),K("span",{ref:s,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?(o(!1),n(!1)):(o(!0),n(!0))},className:Ie("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(ys,{nodes:e})})]})}function ta(e){if(!isFinite(e.duration)){e.currentTime=1e101;let r=()=>{e.currentTime=0,e.removeEventListener("timeupdate",r)};e.addEventListener("timeupdate",r)}}function ws(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function ks(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function na(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function jr({node:e,validationFeedback:r,readOnly:t=!1,mediaHandler:n}){let a=de(),o=re(),{id:s,attrs:i}=e,{mode:c,placeholder:l,allowFormatting:d,wordLimit:p,characterLimit:g,allowedTypes:h,allowMultiple:v,fileInstructions:y,maxDuration:x,hint:k}=i,f=t||(r?.showFeedback??!1),C=r?.state,u=Se(null),b=Xr(m=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let N=m.files?.map(I=>({url:I.url,mimeType:I.kind==="videoLink"?"video/x-link":I.mimeType,name:I.kind==="videoLink"?void 0:I.name,duration:I.kind==="videoLink"?void 0:I.duration}));a.emit({type:"answer:changed",answer:{nodeId:s,type:"openResponse",timestamp:Date.now(),answer:{...m,files:N}}})},300)},[s,a]);_e(()=>{b({})},[]);let[P,E]=he([]);_e(()=>{(c==="file"||c==="text+file")&&c==="file"&&b({files:P})},[P,c]),_e(()=>{let m=()=>{E([])};return a.on("answers:reset",m),()=>a.off("answers:reset",m)},[a]),_e(()=>{let m=N=>{let j=(N.answers??[]).find(S=>S.nodeId===s&&S.type==="openResponse");j?.answer?.files&&E(j.answer.files)};return a.on("answers:prefill",m),()=>a.off("answers:prefill",m)},[s,a]);let z=r?.showFeedback,w=Ie(!z&&"player-or-field--pre",z&&C==="correct"&&"player-or-field--correct",z&&C==="partial"&&"player-or-field--partial",z&&C==="incorrect"&&"player-or-field--incorrect",z&&C==="awaiting_review"&&"player-or-field--review");return K("div",{className:"my-3 space-y-2",children:[!f&&k&&k.length>0&&A("div",{className:"flex justify-end",children:A(vs,{hint:k})}),c==="text"&&A(ca,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:p,characterLimit:g,isDisabled:f,feedbackBorderClass:w,emitAnswer:m=>b({text:m}),answerBus:a}),c==="file"&&A(Bt,{allowedTypes:h??["image"],allowMultiple:!!v,fileInstructions:y,isDisabled:f,feedbackBorderClass:w,files:P,setFiles:E,mediaHandler:n,t:o}),(c==="audio"||c==="video"||c==="screen")&&A(Cs,{kind:c,maxDuration:x,isDisabled:f,feedbackBorderClass:w,mediaHandler:n,emitAnswer:m=>b({recording:m}),t:o}),c==="text+file"&&A(Ns,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:p,characterLimit:g,allowedTypes:h??["image"],allowMultiple:!!v,fileInstructions:y,isDisabled:f,feedbackBorderClass:w,files:P,setFiles:E,emitAnswer:b,answerBus:a,mediaHandler:n,t:o}),r?.showFeedback&&C==="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(us,{size:15,style:ee(15),className:"animate-pulse"}),A("span",{children:o.openResponseAwaitingReview})]}),r?.showFeedback&&C!=="awaiting_review"&&r.teacherFeedback&&A(As,{feedback:r.teacherFeedback,feedbackState:C,score:r.score,t:o})]})}function ca({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:o,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=re(),[d,p]=he(""),[g,h]=he(0),[v,y]=he(0),x=Se(null),k=Xr(()=>{let M=x.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[]),f=is({extensions:[ls.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!o,content:"",onUpdate({editor:M}){if(o)return;let $=M.getJSON().content??[],F=bs($),Q=xs($);h(F),y(Q),i({content:$,wordCount:F})}});_e(()=>{f&&f.setEditable(!o)},[o,f]);let C=Se(null);_e(()=>{f&&C.current!==null&&(f.commands.setContent({type:"doc",content:C.current}),C.current=null)},[f]),_e(()=>{let M=W=>{let $=(W.answers??[]).find(Q=>Q.nodeId===e&&Q.type==="openResponse");if(!$?.answer?.text)return;let F=$.answer.text.content??[];if(t)f?f.commands.setContent({type:"doc",content:F}):C.current=F;else{let Q=F.flatMap(q=>q.content?.map(R=>R.text??"")??[q.text??""]).join(`
2
- `);p(Q),setTimeout(k,0)}};return c.on("answers:prefill",M),()=>c.off("answers:prefill",M)},[e,c,t,f]),_e(()=>{let M=()=>{t&&f?f.commands.clearContent():(p(""),setTimeout(k,0)),h(0),y(0)};return c.on("answers:reset",M),()=>c.off("answers:reset",M)},[c,t,f,k]);let u=!!n,b=!!a&&!n,P=u?g:v,E=u?n?.max:a?.max,z=u?n?.min:a?.min,w=E!=null&&P>E,m=E!=null&&P>=E*.8&&!w,N=z!=null&&P<z&&P>0,I="text-xs tabular-nums",j=w?{color:"var(--pen, #d23b2b)",fontWeight:500}:m||N?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},S=u?E?`${g} / ${E} ${l.openResponseWords}`:z?`${g} ${l.openResponseWords} (min. ${z})`:`${g} ${l.openResponseWords}`:b?E?`${v} / ${E} ${l.openResponseChars}`:`${v} ${l.openResponseChars}`:null;return t?K("div",{className:"relative",children:[K("div",{className:Ie("rounded border transition-colors min-h-[120px]",s),children:[!o&&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:W,style:$})=>A("button",{type:"button",onMouseDown:F=>{F.preventDefault(),f?.chain().focus()?.[W]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${$}`,children:M},M)),A("button",{type:"button",onMouseDown:M=>{M.preventDefault(),f?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),A(cs,{editor:f,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),S&&A("div",{className:Ie("absolute bottom-2 right-3",I),style:j,children:S})]}):K("div",{className:"relative",children:[A("textarea",{ref:x,value:d,onChange:M=>{if(o)return;let W=M.target.value;p(W);let $=sa(W),F=ia(W);h($),y(F),k(),i({content:[{type:"paragraph",content:[{type:"text",text:W}]}],wordCount:$})},onInput:k,disabled:o,placeholder:r||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:Ie("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,o&&"cursor-default")}),S&&A("div",{className:Ie("absolute bottom-2 right-3",I),children:S})]})}var Rs={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},Ss={image:A(fs,{size:12,style:ee(12)}),pdf:A(oa,{size:12,style:ee(12)}),audio:A(hs,{size:12,style:ee(12)}),video:A(aa,{size:12,style:ee(12)}),videoLink:A(gs,{size:12,style:ee(12)})};function Bt({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:a,setFiles:o,mediaHandler:s,t:i,compact:c=!1}){let l=Se(null),[d,p]=he(!1),[g,h]=he(!1),[v,y]=he(""),x=e.some(m=>m!=="videoLink"),k=e.includes("videoLink"),f=r||a.length===0,C=e.filter(m=>m!=="videoLink").map(m=>Rs[m]).filter(Boolean).join(","),u=Xr(m=>{o(N=>r?[...N,m]:[m])},[r,o]),b=Xr(m=>{o(N=>N.filter((I,j)=>j!==m))},[o]),P=async m=>{if(!(!f||n)){p(!0);try{let N=m.type.startsWith("image/")?"image":m.type==="application/pdf"?"document":m.type.startsWith("audio/")?"audio":m.type.startsWith("video/")?"video":"file";if(s){let I=await s.upload(m,N);u({kind:"file",url:I.url,mimeType:I.mimeType??m.type,name:m.name})}else{let I=URL.createObjectURL(m);u({kind:"file",url:I,mimeType:m.type,name:m.name})}}finally{p(!1)}}},E=async m=>{if(m.preventDefault(),h(!1),n||!f)return;let N=m.dataTransfer.files?.[0];N&&await P(N)},z=()=>{let m=v.trim();m&&(u({kind:"videoLink",url:m,platform:ws(m)}),y(""))},w={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,N)=>A(_s,{file:m,onRemove:n?void 0:()=>b(N),compact:c,t:i},N))}),!n&&f&&K("div",{className:"space-y-2",children:[x&&!c&&K("div",{onDragOver:m=>{m.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:E,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:g?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:g?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[A(ds,{size:26,className:"mx-auto mb-2",style:{...ee(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}),d&&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:[Ss[m]," ",w[m]]},m))})]}),x&&c&&A("button",{type:"button",onClick:()=>l.current?.click(),disabled:d,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:d?i.openResponseUploading:`+ ${i.openResponseAttachFile}`}),A("input",{ref:l,type:"file",accept:C,onChange:async m=>{let N=m.target.files?.[0];N&&(await P(N),m.target.value="")},className:"hidden"}),k&&K("div",{className:"flex gap-2 flex-wrap",children:[A("input",{type:"url",value:v,onChange:m=>y(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(),z())}}),A("button",{type:"button",onClick:z,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 _s({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let a=e.platform==="youtube"?ks(e.url):null;return K("div",{className:Ie("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:Ie("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(oa,{size:20,style:{...ee(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 Ns({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:p,emitAnswer:g,answerBus:h,mediaHandler:v,t:y}){let[x,k]=he(null),[f,C]=he(!1);return _e(()=>{g({...x&&{text:x},files:d.length>0?d:void 0})},[x,d]),K("div",{className:"space-y-2",children:[A(ca,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:c,feedbackBorderClass:l,emitAnswer:u=>k(u),answerBus:h}),!c&&K("div",{children:[K("button",{type:"button",onClick:()=>C(!f),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[A("span",{children:f?"\u25BE":"\u25B8"}),K("span",{children:[y.openResponseAttachFiles,d.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:d.length})]})]}),f&&A("div",{className:"mt-1.5",children:A(Bt,{allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:p,mediaHandler:v,t:y,compact:!0})})]}),c&&d.length>0&&K("div",{className:"space-y-1",children:[A("p",{className:"text-xs text-gray-500 font-medium",children:y.openResponseAttachedFiles}),A(Bt,{allowedTypes:o,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:d,setFiles:p,t:y,compact:!0})]})]})}function Cs({kind:e,maxDuration:r,isDisabled:t,feedbackBorderClass:n,mediaHandler:a,emitAnswer:o,t:s}){let[i,c]=he("idle"),[l,d]=he(0),[p,g]=he(null),[h,v]=he("audio/webm"),[y,x]=he(null),k=Se(null),f=Se(null),C=Se([]),u=Se(null),b=Se(null),P=Se(null),E=Se(0);_e(()=>()=>{z(),u.current&&clearInterval(u.current),cancelAnimationFrame(E.current)},[]),_e(()=>{i==="recording"&&e==="audio"&&f.current&&j(f.current)},[i]);let z=()=>{f.current?.getTracks().forEach(S=>S.stop()),f.current=null},w=async()=>{if(!a){x(s.openResponseMediaHandlerRequired);return}x(null),c("requesting");try{let S;if(e==="screen"){let $=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1});try{let Q=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];Q&&$.addTrack(Q)}catch{}$.getVideoTracks()[0]?.addEventListener("ended",()=>{k.current?.state==="recording"&&m()}),S=$,b.current&&(b.current.srcObject=S,b.current.play())}else e==="video"?(S=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"environment"}}),b.current&&(b.current.srcObject=S,b.current.play())):S=await navigator.mediaDevices.getUserMedia({audio:!0});f.current=S;let M=e==="audio"?"audio/webm":"video/webm";v(M);let W=new MediaRecorder(S,{mimeType:M});k.current=W,C.current=[],W.ondataavailable=$=>{$.data.size>0&&C.current.push($.data)},W.onstop=()=>{let $=new Blob(C.current,{type:M}),F=URL.createObjectURL($);g(F),c("reviewing"),z(),cancelAnimationFrame(E.current)},W.start(200),c("recording"),d(0),u.current=setInterval(()=>{d($=>{let F=$+1;return r&&F>=r&&m(),F})},1e3)}catch{c("idle"),x(s.openResponsePermissionDenied)}},m=()=>{u.current&&(clearInterval(u.current),u.current=null),k.current?.stop()},N=async()=>{if(!p||!a)return;c("submitted");let M=await(await fetch(p)).blob(),W=e==="screen"?"video":e,$=new File([M],"recording.webm",{type:h}),F=await a.upload($,W);URL.revokeObjectURL(p),o({url:F.url,mimeType:F.mimeType??h,duration:l,kind:W})},I=()=>{p&&URL.revokeObjectURL(p),g(null),d(0),c("idle")},j=S=>{let M=new AudioContext,W=M.createMediaStreamSource(S),$=M.createAnalyser();$.fftSize=64,W.connect($);let F=new Uint8Array($.frequencyBinCount),Q=P.current;if(!Q)return;let q=()=>{$.getByteFrequencyData(F);let R=Q.getContext("2d");if(!R)return;R.clearRect(0,0,Q.width,Q.height);let _=Q.width/F.length*2.5,D=0;for(let H=0;H<F.length;H++){let V=F[H]/255*Q.height;R.fillStyle="#1d2025",R.fillRect(D,Q.height-V,_,V),D+=_+1}E.current=requestAnimationFrame(q)};q()};return t?A("div",{className:Ie("rounded border p-4 text-center text-sm text-gray-400",n),children:s.openResponseRecordingSubmitted}):K("div",{className:Ie("rounded border p-4 space-y-3",n),children:[y&&A("p",{className:"text-sm",style:{color:"var(--pen, #d23b2b)"},children:y}),(e==="video"||e==="screen")&&i==="recording"&&A("video",{ref:b,muted:!0,className:"w-full rounded max-h-48 bg-black",playsInline:!0}),e==="audio"&&i==="recording"&&A("canvas",{ref:P,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:S=>ta(S.currentTarget)}):A("video",{src:p,controls:!0,className:"w-full rounded max-h-48",onLoadedMetadata:S=>ta(S.currentTarget)})),K("div",{className:"flex items-center justify-center gap-3",children:[i==="idle"&&K("button",{type:"button",onClick:w,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(ps,{size:22,style:ee(22)}):e==="screen"?A(ms,{size:22,style:ee(22)}):A(aa,{size:22,style:ee(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:na(l)}),r&&K("span",{className:"text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:["/ ",na(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:s.openResponseStopRecording})]}),i==="reviewing"&&K("div",{className:"flex gap-2",children:[A("button",{type:"button",onClick:I,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:N,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 As({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(o=>o.content?.map(s=>s.text??"")??[o.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:a.ink},children:[t," pts"]})]})}import{jsx as Ue,jsxs as or,Fragment as la}from"react/jsx-runtime";import{useEffect as qt,useRef as Ps,useState as da}from"react";function Es(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function Or({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:a=!1}){let o=de(),s=Ps(null),[i,c]=da(""),[l,d]=da(!1),p=Es(n),g=n?.score,h=n?.maxScore,v=k=>Number.isInteger(k)?String(k):k.toFixed(2);qt(()=>{import("mathlive").then(()=>{d(!0)}).catch(()=>{})},[]),qt(()=>{let k=f=>{let C=f.answers?.find(u=>u.nodeId===e&&u.type==="mathResponse");C?.answer?.latex!==void 0&&(c(C.answer.latex),s.current&&(s.current.value=C.answer.latex))};return o.on("answers:prefill",k),()=>o.off("answers:prefill",k)},[o,e]),qt(()=>{o.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:i}}})},[i,e,o]);let y=k=>{let f=k.target?.value??"";c(f)},x=p==="correct"?"player-math-field--correct":p==="incorrect"?"player-math-field--incorrect":p==="validating"?"player-math-field--validating":"";return or("div",{dir:"ltr",className:"math-response-player",children:[or("span",{style:{display:"inline-flex",alignItems:"center",gap:L("0.4rem")},children:[Ue("div",{className:"player-math-field"+(x?" "+x:"")+(a?" player-math-field--readonly":""),children:l?Ue("math-field",{ref:s,value:i,onInput:y,"virtual-keyboard-mode":"onfocus","smart-fence":"true",className:"player-math-field__input",style:{opacity:a?.7:1,pointerEvents:a?"none":"auto"}}):Ue("input",{type:"text",value:i,onChange:k=>c(k.target.value),placeholder:r||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:a,className:"player-math-field__fallback"})}),Ue(Me,{hint:t})]}),n?.showFeedback&&or("div",{className:"player-math-feedback player-math-feedback--"+p,children:[p==="validating"&&or(la,{children:[Ue("span",{className:"player-math-spinner"}),Ue("span",{children:"Checking your answer\u2026"})]}),p==="correct"&&or(la,{children:[Ue("span",{children:"\u2713 Correct"}),g!=null&&or("span",{className:"player-math-score",children:[v(g),h!=null?` / ${v(h)}`:""]})]}),p==="incorrect"&&Ue("span",{children:"\u2717 Incorrect"})]})]})}import{jsx as X,jsxs as pe,Fragment as yr}from"react/jsx-runtime";import{useCallback as Gs,useEffect as Qs,useRef as Ys,useState as xr}from"react";import{Play as Ks,Lock as Js,Check as Ut,X as ua}from"lucide-react";function rt(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,l=r;return c.length!==l.length?!1:c.every((d,p)=>rt(d,l[p]))}let a=e,o=r,s=Object.keys(a),i=Object.keys(o);return s.length!==i.length?!1:s.every(c=>rt(a[c],o[c]))}var Ms=`
1
+ import"./chunk-76CZ6Z7T.mjs";import ro from"react";import{createRoot as to}from"react-dom/client";import{useCallback as Ka,useMemo as Sc,useState as _c}from"react";import{cloneElement as qa,isValidElement as Wa,useCallback as Ke,useEffect as sn,useMemo as Fe,useRef as ht,useState as je}from"react";import{jsx as lr}from"react/jsx-runtime";import{useEffect as ot,useMemo as Ri,useRef as Si}from"react";import mo from"mitt";var Be=class{constructor(){this.emitter=mo(),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()})}},Rn="__edpireGlobalAnswerBus",Sn=globalThis,Er=Sn[Rn]??(Sn[Rn]=new Be);import{jsx as uo}from"react/jsx-runtime";import{createContext as fo,useContext as ho}from"react";var _n="__edpireAnswerBusContext",Nn=globalThis,Cn=Nn[_n]??(Nn[_n]=fo(Er));function le(){return ho(Cn)}function Mr({children:e,bus:r=new Be}){return uo(Cn.Provider,{value:r,children:e})}import{Fragment as $n,jsx as Q,jsxs as He}from"react/jsx-runtime";import{Fragment as Lo,useState as Gr,useEffect as Vr,useMemo as To,useRef as $o}from"react";import Le from"clsx";import{jsx as B,jsxs as xo}from"react/jsx-runtime";import go from"katex";import"katex/dist/contrib/mhchem.js";var bo={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function hr(e,r,t=!0){try{return go.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:bo,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function I(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function ee(e){return{width:I(e),height:I(e)}}function Pe(e){if(e==null||e==="")return;if(typeof e=="number")return I(e);let r=String(e).trim();return/^\d+(\.\d+)?px$/.test(r)?I(r):r}var An={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"}},Pn={border:"#2563eb",background:"#e0f2fe"},En={border:"#dc2626",background:"#fee2e2"};function yo(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Pn.border}`,background:e?.background||Pn.background,borderRadius:I("4px"),padding:"0.17em 0.37em"}}var Lr=`${I("6px")} ${I("8px")}`;function vo(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||En.border}`,background:e?.background||En.background,borderRadius:r,padding:"0.15em 0.45em"}}function we(e,r,t){return B("div",{className:"exercise-content",children:e.content.map((n,a)=>be(n,`node-${a}`,r,t))})}var wo=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,ko=new Set(["blank","inlineChoiceSet"]);function Mn(e,r,t,n){let a=[],o=e??[];for(let s=0;s<o.length;s++){let i=o[s],c=o[s+1],l=ko.has(i.type)&&c?.type==="text"?wo.exec(c.text??"")?.[0]:void 0;if(!l||!c){a.push(be(i,`${r}-${s}`,t,n));continue}let d=(c.text??"").slice(l.length);a.push(xo("span",{style:{whiteSpace:"nowrap"},children:[B("span",{style:{whiteSpace:"normal"},children:be(i,`${r}-${s}-a`,t,n)}),be({...c,text:l},`${r}-${s}-p`,t,n)]},`${r}-${s}`)),d&&a.push(be({...c,text:d},`${r}-${s+1}`,t,n)),s++}return a}function be(e,r,t,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return B(Tr,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?B($r,{node:e,validationFeedback:t?.get(e.id)},r):B(zr,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return B(Dr,{node:e},r);case"inlinePool":return B(Fr,{node:e},r);case"matchingSet":return B(jr,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return B(Or,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return B(Br,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return B(qr,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return B(Wr,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},r);case"aiEvaluationConfig":return null;case"paragraph":{let a=e.attrs,o=a?.textAlign,s=a?.dir||void 0;return B("p",{dir:s,style:o?{textAlign:o}:void 0,children:Mn(e.content,r,t,n)},r)}case"heading":{let a=e.attrs.level??1,o=`h${a}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,l=An[a]??An[3];return B(o,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:Mn(e.content,r,t,n)},r)}case"blockquote":{let a=e.attrs,o=a?.dir||void 0,s=a?.textAlign;return B("blockquote",{dir:o,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...s?{textAlign:s}:{}},children:e.content?.map((i,c)=>be(i,`${r}-${c}`,t,n))},r)}case"text":{let a=e,o=a.text??"",s=a.marks??[];if(s.length===0)return B("span",{children:o},r);let i={};for(let l of s)l.type==="textStyle"&&(l.attrs?.color&&(i.color=l.attrs.color),l.attrs?.fontSize&&(i.fontSize=l.attrs.fontSize),l.attrs?.fontFamily&&(i.fontFamily=l.attrs.fontFamily));let c=o;for(let l of s)switch(l.type){case"bold":c=B("strong",{children:c});break;case"italic":c=B("em",{children:c});break;case"underline":c=B("u",{children:c});break;case"strike":c=B("s",{children:c});break;case"code":c=B("code",{children:c});break;case"subscript":c=B("sub",{children:c});break;case"superscript":c=B("sup",{children:c});break;case"boxedText":c=B("span",{style:yo(l.attrs),children:c});break;case"circleText":c=B("span",{style:vo(l.attrs),children:c});break}return B("span",{style:Object.keys(i).length>0?i:void 0,children:c},r)}case"hardBreak":return B("br",{},r);case"resizableImage":return B("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:Pe(e.attrs?.width||void 0)??"auto",height:Pe(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"resizableAudio":return B("span",{style:{display:"inline-flex",verticalAlign:"middle",alignItems:"center",background:"#f1f5f9",borderRadius:I("8px"),padding:`${I("4px")} ${I("8px")}`,maxWidth:"100%"},children:B("audio",{controls:!0,src:e.attrs?.src||void 0,style:{display:"block",width:I("320px"),maxWidth:"100%"}})},r);case"resizableVideo":return B("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Pe(e.attrs?.width||void 0)??"auto",height:Pe(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"youtubeEmbed":return B("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:Pe(e.attrs?.width||480),height:Pe(e.attrs?.height||270)}},r);case"inlineMath":return B("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:hr(e.attrs?.latex??"",!1,!0)}},r);case"blockMath":return B("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:hr(e.attrs?.latex??"",!0,!0)}},r);case"variable":return B("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let a=e;return a.type==="bulletList"?B("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="orderedList"?B("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="listItem"?B("li",{children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="table"?B("div",{style:{overflowX:"auto",margin:`${I("1.25rem")} 0`},children:B("table",{style:{borderCollapse:"collapse",width:"100%",tableLayout:"fixed"},children:B("tbody",{children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))})})},r):a.type==="tableRow"?B("tr",{children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="tableCell"?B("td",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Lr,verticalAlign:"top"},children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):a.type==="tableHeader"?B("th",{colSpan:a.attrs?.colspan,rowSpan:a.attrs?.rowspan,style:{border:"1px solid #d1d5db",padding:Lr,verticalAlign:"top",background:"#f3f4f6",fontWeight:600},children:a.content?.map((o,s)=>be(o,`${r}-${s}`,t,n))},r):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function te(e,r){return e.map(t=>{if(t.type==="text"){let n=Je(t.text??""),a=t.marks??[],o=[];for(let s of a)s.type==="textStyle"&&(s.attrs?.color&&o.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&o.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&o.push(`font-family:${s.attrs.fontFamily}`));o.length>0&&(n=`<span style="${o.join(";")}">${n}</span>`);for(let s of a)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:${I("4px")};padding:0.17em 0.37em">${n}</span>`;break}case"circleText":{let i=s.attrs?.border||"#dc2626",c=s.attrs?.background||"#fee2e2",l=s.attrs?.shape==="circle"?"50%":"9999px";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${l};padding:0.15em 0.45em">${n}</span>`;break}}return n}if(t.type==="paragraph"){let n=t.content?te(t.content,r):"",a=t.attrs?.dir,o=t.attrs?.textAlign,s=a?` dir="${a}"`:"",i=o?` style="text-align:${o}"`:"";return r?.stripParagraphs?n:`<p${s}${i}>${n}</p>`}if(t.type==="hardBreak")return"<br/>";if(t.type==="table"){let n=t.content?te(t.content,r):"";return`<div style="overflow-x:auto;margin:${I("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?te(t.content,r):""}</tr>`;if(t.type==="tableCell"){let n=t.content?te(t.content,r):"",a=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",o=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<td${a}${o} style="border:1px solid #d1d5db;padding:${Lr};vertical-align:top">${n}</td>`}if(t.type==="tableHeader"){let n=t.content?te(t.content,r):"",a=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",o=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"";return`<th${a}${o} style="border:1px solid #d1d5db;padding:${Lr};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?te(t.content,r):""}</ul>`;if(t.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${t.content?te(t.content,r):""}</ol>`;if(t.type==="listItem")return`<li>${t.content?te(t.content,r):""}</li>`;if(t.type==="blockquote"){let n=t.content?te(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=Ir(n.width),o=Ir(n.height);return`<img src="${Je(n.src??"")}" alt="${Je(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${a?`width:${a};`:""}${o?`height:${o};`:""}"/>`}if(t.type==="resizableAudio"){let n=t.attrs??{};return`<span style="display:inline-flex;vertical-align:middle;align-items:center;background:#f1f5f9;border-radius:${I("8px")};padding:${I("4px")} ${I("8px")};max-width:100%"><audio controls src="${Je(n.src??"")}" style="display:block;width:${I("320px")};max-width:100%"></audio></span>`}if(t.type==="resizableVideo"){let n=t.attrs??{},a=Ir(n.width),o=Ir(n.height);return`<video src="${Je(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${a?`width:${a};`:""}${o?`height:${o};`:""}"></video>`}if(t.type==="youtubeEmbed"){let n=t.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Je(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:${Pe(n.width||480)};height:${Pe(n.height||270)}"></iframe>`}return t.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${hr(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">${hr(t.attrs?.latex??"",!0,!0)}</div>`:t.type==="variable"?`<span class="variable">{${Je(t.attrs?.name??"")}}</span>`:""}).join("")}function Ir(e){return e==null||e===""?null:Pe(e)??null}function Je(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as Ro}from"react/jsx-runtime";import{createContext as So,useContext as In}from"react";var nr={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 Ur={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:"\xC9cris ta 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:"\xC9cris ta r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glisse-d\xE9pose 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 Hr={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 _o={en:nr,fr:Ur,ar:Hr},_t=So(null);function re(){return In(_t)??nr}function gr(e){let r=In(_t);return e&&_o[e]||r||nr}function br({locale:e,children:r}){let t=gr(e);return Ro(_t.Provider,{value:t,children:r})}import{jsx as No}from"react/jsx-runtime";import{createContext as Co,useContext as Ln,useMemo as Tn}from"react";var Ao={sm:.875,md:1,lg:1.25,xl:1.5},Nt=Co(null);function Po(e,r){let t={...e??{}};if(r)for(let[n,a]of Object.entries(r))a!==void 0&&(t[n]=a);return t}function Eo(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?Ao[e]??1:1}function ke(e){let r=e??{};return{scale:Eo(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 ye(e){let r=Ln(Nt);return Tn(()=>Po(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Ee(){let e=Ln(Nt);return Tn(()=>ke(e),[e])}function ve({display:e,children:r}){let t=ye(e);return No(Nt.Provider,{value:t,children:r})}function Re(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function Ze(){let{motion:e}=Ee();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function Mo(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 Io(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 xr(e,r){let t=[...e],n=Io(Mo(r));for(let a=t.length-1;a>0;a--){let o=Math.floor(n()*(a+1));[t[a],t[o]]=[t[o],t[a]]}return t}function Ct({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return Q($n,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=Q("strong",{children:r}):t.type==="italic"?r=Q("em",{children:r}):t.type==="underline"?r=Q("u",{children:r}):t.type==="strike"?r=Q("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=Q("span",{style:{color:t.attrs.color},children:r}));return Q($n,{children:r})}return e.type==="paragraph"?Q("span",{className:"block",children:e.content?.map((r,t)=>Q(Ct,{node:r},t))??Q("br",{})}):e.type==="hardBreak"?Q("br",{}):e.content?Q("span",{className:"block",children:e.content.map((r,t)=>Q(Ct,{node:r},t))}):null}function zo({nodes:e}){return Q("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>Q(Ct,{node:r},t))})}function zn({hint:e}){let r=re(),[t,n]=Gr(!1),[a,o]=Gr(!1),s=$o(null);return Vr(()=>{if(!a)return;let d=p=>{s.current&&!s.current.contains(p.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),He("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[Q("button",{type:"button",onClick:d=>{d.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Le("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&Q("span",{className:"player-blank-hint-pop",onClick:d=>d.stopPropagation(),children:Q(zo,{nodes:e})})]})}function Do(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var Fo=e=>e.replace(/ {2,}/g,r=>"&nbsp;".repeat(r.length-1)+" "),jo=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function jn(e){return(e??[]).some(r=>jo.has(r?.type)||jn(r?.content))}var Dn=()=>Q("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:Q("path",{d:"M5 13l4 4L19 7"})}),Fn=()=>Q("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:Q("path",{d:"M6 6l12 12M18 6L6 18"})});function Tr({node:e,validationFeedback:r}){let t=le(),n=re(),a=Ee(),o=Ze(),{id:s,content:i,attrs:c}=e,l=c.shuffle??!1,d="prompt"in c?c.prompt:void 0,p="separator"in c?c.separator??"/":"/",g="pickLimit"in c&&c.pickLimit?c.pickLimit:1,f="layout"in c?c.layout??"row":"row",S=e.type==="inlineChoiceSet",x=JSON.stringify(i),b=l&&a.shuffleSeed!==void 0,k=To(()=>b?xr(i,`${a.shuffleSeed}:${s}`):null,[b,a.shuffleSeed,s,x]),[h,_]=Gr(i);Vr(()=>{b||_(l?Do(i):i)},[l,b,x]);let u=k??h,[y,C]=Gr(new Set),P=r?.showFeedback??!1,$=r?.correctChoiceIds||[];Vr(()=>{let U=R=>{let D=R.answers.find(H=>H.nodeId===s&&H.type==="choiceSet");D&&"selectedIds"in D.answer&&C(new Set(D.answer.selectedIds))};return t.on("answers:prefill",U),()=>t.off("answers:prefill",U)},[s,t]),Vr(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(y)}}})},[y,s,t]);let w=U=>{P||C(R=>{let N=new Set(R);return g===1?N.has(U)?N.delete(U):(N.clear(),N.add(U)):N.has(U)?N.delete(U):N.size<g&&N.add(U),N})},m=U=>Fo(te(U.content)),T=U=>{let R=y.has(U),N=$.includes(U);return P?N&&R?"correct":N&&!R?"correct-unchosen":!N&&R?"incorrect":"muted":R?"selected":"idle"},E={idle:"",selected:"player-choice--selected",correct:Le("player-choice--correct",o.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:Le("player-choice--incorrect",o.shake),muted:"player-choice--muted"},q={idle:"",selected:"player-inline-choice--selected",correct:Le("player-inline-choice--correct",o.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:Le("player-inline-choice--incorrect",o.shake),muted:"player-inline-choice--muted"};if(S)return He("span",{className:"inline-choice",children:[d&&He("span",{className:"mr-2 font-medium",children:[d,g>1?Q("span",{className:"ml-1 opacity-60",children:n.chooseN(g)}):null]}),u.map((U,R)=>He(Lo,{children:[Q("button",{type:"button",disabled:P,onClick:()=>w(U.id),className:Le("player-inline-choice",q[T(U.id)]),"aria-pressed":y.has(U.id),dangerouslySetInnerHTML:{__html:m(U)}}),R<u.length-1&&Q("span",{className:"mx-1",children:p})]},U.id)),c.hint&&c.hint.length>0&&Q(zn,{hint:c.hint})]});let v=a.layoutBy==="box",M=a.choiceColumns?Math.min(a.choiceColumns,u.length):0,F=M?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${M}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},z=u.some(U=>jn(U.content)),j=a.choiceLabels==="letters",V=U=>n.choiceLetters[U]??String(U+1);return He("div",{className:Le("cs-player my-4 space-y-3",v&&"cs-player--box"),children:[d&&He("p",{className:"font-medium",children:[d,g>1?He("span",{className:"ml-2 text-sm opacity-70",children:["(choose ",g,")"]}):null]}),c.hint&&c.hint.length>0&&Q(zn,{hint:c.hint}),Q("div",{className:Le("cs-player__grid",f==="row"&&"cs-player__grid--row"),style:F,children:u.map((U,R)=>{let N=T(U.id),D=N==="incorrect"?"incorrect":N==="correct"||N==="correct-unchosen"?"correct":null;return He("button",{type:"button",disabled:P,onClick:()=>w(U.id),className:Le("player-choice",z&&"player-choice--tile",E[N]),"aria-pressed":y.has(U.id),children:[Q("span",{className:Le("player-choice__mark",g>1?"player-choice__mark--box":"player-choice__mark--radio",j&&"player-choice__mark--letter"),children:j?V(R):N==="incorrect"?Q(Fn,{}):Q(Dn,{})}),Q("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:m(U)}}),j&&D&&Q("span",{className:`player-choice__verdict player-choice__verdict--${D}`,"aria-hidden":"true",children:D==="incorrect"?Q(Fn,{}):Q(Dn,{})})]},U.id)})})]})}import{Fragment as At,jsx as X,jsxs as Qr}from"react/jsx-runtime";import{useState as Pt,useEffect as Yr,useRef as On,useCallback as Oo}from"react";import Ve from"clsx";function Et({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return X(At,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=X("strong",{children:r}):t.type==="italic"?r=X("em",{children:r}):t.type==="underline"?r=X("u",{children:r}):t.type==="strike"?r=X("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=X("span",{style:{color:t.attrs.color},children:r}));return X(At,{children:r})}return e.type==="paragraph"?X("span",{className:"block",children:e.content?.map((r,t)=>X(Et,{node:r},t))??X("br",{})}):e.type==="hardBreak"?X("br",{}):e.content?X("span",{className:"block",children:e.content.map((r,t)=>X(Et,{node:r},t))}):null}function Bo({nodes:e}){return X("span",{className:"block space-y-1",children:e.map((r,t)=>X(Et,{node:r},t))})}function qo({hint:e}){let r=re(),[t,n]=Pt(!1),[a,o]=Pt(!1),s=On(null);return Yr(()=>{if(!a)return;let d=p=>{s.current&&!s.current.contains(p.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]),Qr("span",{ref:s,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[X("button",{type:"button",onClick:d=>{d.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Ve("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&X("span",{className:"player-blank-hint-pop",onClick:d=>d.stopPropagation(),children:X(Bo,{nodes:e})})]})}function $r({node:e,validationFeedback:r}){let t=le(),n=re(),a=Ze(),{id:o,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,d=On(null),p=i.trim().split(/\s+/).filter(Boolean).length,g=c==="auto"&&p>=4,[f,S]=Pt(""),x=r?.showFeedback??!1,b=r?.state,k=b==="validating",h=r?.displayAnswer,_=r?.message;Yr(()=>{let P=$=>{let m=$.answers.find(T=>T.nodeId===o&&T.type==="blank");m&&"mode"in m.answer&&m.answer.mode==="typed"&&"text"in m.answer&&S(m.answer.text)};return t.on("answers:prefill",P),()=>t.off("answers:prefill",P)},[o,t]),Yr(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:f}}})},[f,o,t]);let u=P=>{S(P.target.value)},y=Oo(()=>{let P=d.current;P&&(P.style.height="auto",P.style.height=`${P.scrollHeight}px`)},[]);Yr(()=>{y()},[f,y]);let C=x&&!k;return Qr("span",{className:Ve("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",g&&"w-full"),children:[X("span",{className:Ve("relative inline-block shrink-0 min-w-0 max-w-full",g&&"w-full flex-1"),children:C?X("span",{className:Ve("player-typed-blank-feedback",g&&"w-full",b==="correct"&&Ve("player-typed-blank-feedback--correct",a.hop),b==="partial"&&"player-typed-blank-feedback--partial",b==="incorrect"&&Ve("player-typed-blank-feedback--incorrect",a.wobble)),children:f||X("span",{className:"opacity-40",children:i})}):Qr(At,{children:[X("textarea",{ref:d,"aria-label":n.blankAnswerAria,placeholder:i,value:f,onChange:u,disabled:x,rows:1,className:Ve("player-typed-blank",g&&"w-full",k&&"player-typed-blank--pending"),style:c!=="auto"?{width:c}:g?{width:"100%"}:{width:`${Math.max(7,f.length+1)}ch`,maxWidth:"100%"}}),!f&&!k&&X("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"}),k&&X("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:X("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),x&&b==="incorrect"&&h&&Qr("span",{className:"player-blank-reveal",children:["(",h,")"]}),x&&_&&X("span",{className:Ve("player-blank-feedback",b==="correct"&&"player-blank-feedback--correct",b==="partial"&&"player-blank-feedback--partial",b==="incorrect"&&"player-blank-feedback--incorrect"),children:_}),l&&l.length>0&&X(qo,{hint:l})]})}import{jsx as Xr,Fragment as Gn,jsxs as Tt}from"react/jsx-runtime";import{useEffect as Qn}from"react";import Jr from"clsx";import{useDroppable as rs,useDndContext as ts}from"@dnd-kit/core";import{jsx as Wo}from"react/jsx-runtime";import{createContext as Uo,useCallback as Ge,useContext as Ho,useEffect as Vo,useMemo as Bn,useRef as Go,useState as Mt}from"react";import{useDndMonitor as Qo}from"@dnd-kit/core";var Wn=Uo(null);function Te(){let e=Ho(Wn);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function qn(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 Kr({children:e,initialAnswers:r}){let t=le(),n=Bn(()=>qn(r),[r]),[a,o]=Mt(n),[s,i]=Mt({}),[c,l]=Mt({}),d=Go(new Set);Vo(()=>{let u=y=>{let C=qn(y.answers);Object.keys(C).length!==0&&o(P=>{if(!Object.entries(C).some(([m,T])=>P[m]?.choiceId!==T.choiceId||P[m]?.poolId!==T.poolId||P[m]?.value!==T.value))return P;let w={...P,...C};return i(m=>{let T={...m};for(let[E,q]of Object.entries(m)){let v=new Set(Object.values(w).filter(M=>M.poolId===E).map(M=>M.choiceId));T[E]={...q,available:new Set(q.choices.map(M=>M.id).filter(M=>!v.has(M)))}}return T}),w})};return t.on("answers:prefill",u),()=>t.off("answers:prefill",u)},[t]);let p=Ge((u,y)=>{i(C=>{let P=C[u];if(!P){let E=new Set;for(let v of Object.values(a))v.poolId===u&&E.add(v.choiceId);let q=new Set(y.map(v=>v.id).filter(v=>!E.has(v)));return{...C,[u]:{choices:y,available:q}}}let $=new Set(P.choices.map(E=>E.id)),w=new Set(y.map(E=>E.id));if(!(y.some(E=>!$.has(E.id))||P.choices.some(E=>!w.has(E.id))))return C;let T=new Set;for(let E of P.available)w.has(E)&&T.add(E);for(let E of y)$.has(E.id)||T.add(E.id);return{...C,[u]:{choices:y,available:T}}})},[a]),g=Ge((u,y)=>{l(C=>{let P=C[u]??[];return P.includes(y)?C:{...C,[u]:[...P,y]}}),!d.current.has(y)&&!a[y]&&(d.current.add(y),t.emit({type:"answer:changed",answer:{nodeId:y,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}}))},[a,t]),f=Ge(u=>(c[u]??[]).find(C=>!a[C])??null,[c,a]),S=Ge((u,y,C,P)=>{o($=>{let w=$[u];return w&&i(m=>{let T=m[w.poolId];if(!T)return m;let E=new Set(T.available);return E.add(w.choiceId),{...m,[w.poolId]:{...T,available:E}}}),{...$,[u]:{choiceId:C,value:P,poolId:y}}}),i($=>{let w=$[y];if(!w)return $;let m=new Set(w.available);return m.delete(C),{...$,[y]:{...w,available:m}}}),t.emit({type:"answer:changed",answer:{nodeId:u,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:C,poolId:y,value:P}}})},[t]),x=Ge(u=>{let y=a[u];if(!y)return;let{poolId:C,choiceId:P}=y;i($=>{let w=$[C];if(!w)return $;let m=new Set(w.available);return m.add(P),{...$,[C]:{...w,available:m}}}),o($=>{let{[u]:w,...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]),b=Ge((u,y)=>s[u]?.available.has(y)??!1,[s]),k=Ge((u,y)=>s[u]?.choices.find(C=>C.id===y),[s]),h=Ge(()=>{o({}),i(u=>{let y={};for(let[C,P]of Object.entries(u))y[C]={choices:P.choices,available:new Set(P.choices.map($=>$.id))};return y});for(let[u,y]of Object.entries(c))for(let C of y)t.emit({type:"answer:changed",answer:{nodeId:C,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:u,value:""}}})},[c,t]);Qo({onDragEnd(u){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:u.active,over:u.over}}))}});let _=Bn(()=>({blanks:a,pools:s,registerPool:p,registerBlank:g,fill:S,back:x,isAvailable:b,getChoice:k,firstEmptyBlank:f,resetAllAnswers:h}),[a,s,p,g,S,x,b,k,f,h]);return Wo(Wn.Provider,{value:_,children:e})}import{Fragment as Un,jsx as ie,jsxs as Yo}from"react/jsx-runtime";import{useState as It,useEffect as Vn,useRef as Hn,useLayoutEffect as Ko}from"react";import Xo from"clsx";var Jo=typeof window<"u"?Ko:Vn;function Lt({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return ie(Un,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=ie("strong",{children:r}):t.type==="italic"?r=ie("em",{children:r}):t.type==="underline"?r=ie("u",{children:r}):t.type==="strike"?r=ie("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=ie("span",{style:{color:t.attrs.color},children:r}));return ie(Un,{children:r})}return e.type==="paragraph"?ie("span",{className:"block",children:e.content?.map((r,t)=>ie(Lt,{node:r},t))??ie("br",{})}):e.type==="hardBreak"?ie("br",{}):e.content?ie("span",{className:"block",children:e.content.map((r,t)=>ie(Lt,{node:r},t))}):null}function Zo({nodes:e}){return ie("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>ie(Lt,{node:r},t))})}function es({hint:e}){let r=re(),[t,n]=It(!1),[a,o]=It(!1),[s,i]=It(null),c=Hn(null),l=Hn(null);return Vn(()=>{if(!a)return;let f=S=>{let x=S.target;c.current&&!c.current.contains(x)&&l.current&&!l.current.contains(x)&&(o(!1),n(!1))};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a]),Jo(()=>{if(!t){i(null);return}let f=c.current,S=l.current;if(!f||!S)return;let x=f.getBoundingClientRect(),b=S.getBoundingClientRect(),k=8,h=x.top-b.height-k;h<k&&(h=x.bottom+k);let _=x.left+x.width/2-b.width/2;_=Math.max(k,Math.min(_,window.innerWidth-b.width-k)),i({top:h,left:_})},[t]),Yo("span",{ref:c,className:"relative inline-flex items-center align-middle",onMouseEnter:()=>n(!0),onMouseLeave:()=>{a||n(!1)},children:[ie("button",{type:"button",onClick:f=>{f.stopPropagation(),a?(o(!1),n(!1)):(o(!0),n(!0))},className:Xo("player-blank-hint-btn select-none",a&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,children:"?"}),t&&ie("span",{ref:l,className:"player-blank-hint-pop",onClick:f=>f.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:ie(Zo,{nodes:e})})]})}function $e({hint:e}){return!e||e.length===0?null:ie(es,{hint:e})}function zr({node:e,validationFeedback:r}){let{id:t,attrs:n}=e,{poolId:a,placeholder:o="___",hint:s}=n,{blanks:i,fill:c,back:l,getChoice:d,registerBlank:p}=Te(),g=re(),f=Ze(),S=i[t],x=!!S?.choiceId,b=r?.showFeedback??!1,k=r?.state,h=r?.correctChoiceIds??[],_=b&&k==="incorrect"&&h.length>0?d(a||"",h[0]):void 0,u=_?_.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:y,isOver:C}=rs({id:t,data:{type:"blank",blankId:t,poolId:a}}),{active:P}=ts(),$=!!P&&P.data.current?.poolId===a;return Qn(()=>{p(a||"",t)},[a,t,p]),Qn(()=>{let T=E=>{let q=E,{active:v,over:M}=q.detail||{};if(!M||M.id!==t)return;let{choiceId:F,poolId:z}=v?.data.current||{};if(!F||z!==a)return;let j=d(a||"",F);if(!j)return;let V=j.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,a||"",F,V)};return window.addEventListener("dnd-drop",T),()=>window.removeEventListener("dnd-drop",T)},[t,a,d,c]),Tt(Gn,{children:[Xr("span",{ref:y,onClick:()=>{x&&!b&&l(t)},className:Jr("player-choice-blank",C&&"player-choice-blank--over",!C&&$&&!x&&!b&&"player-choice-blank--target",x&&!b&&!C&&"player-choice-blank--filled",b&&k==="correct"&&Jr("player-choice-blank--correct",f.hop),b&&k==="partial"&&Jr("player-choice-blank--partial",f.hop),b&&k==="incorrect"&&Jr("player-choice-blank--incorrect",f.wobble)),title:x&&!b?g.clickToRemove:void 0,"data-node-id":t,"data-pool-id":a,children:x?Tt(Gn,{children:[Xr("span",{children:S.value}),!b&&Xr("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):o}),u&&Tt("span",{className:"player-blank-reveal",children:["(",u,")"]}),Xr($e,{hint:s})]})}import{jsx as $t,jsxs as os}from"react/jsx-runtime";import{useEffect as Kn,useState as ss}from"react";import is from"clsx";import{jsx as Yn}from"react/jsx-runtime";import ns from"clsx";import{useDraggable as as}from"@dnd-kit/core";function ar({poolId:e,data:r,isInline:t=!1}){let{isAvailable:n,firstEmptyBlank:a,fill:o}=Te(),{id:s,html:i}=r,c=!n(e,s),{setNodeRef:l,attributes:d,listeners:p,transform:g,isDragging:f}=as({id:s,data:{type:"choice",choiceId:s,poolId:e,html:i},disabled:c});if(c)return null;let S=h=>h.replace(/<\/?[^>]+(>|$)/g,""),x=()=>{let h=a(e);if(h){let _=S(i);o(h,e,s,_)}},b=g?{transform:`translate3d(${g.x}px, ${g.y}px, 0)`}:void 0;return Yn(t?"span":"div",{ref:l,style:b,className:ns("player-bank-pill",f&&"player-bank-pill--dragging",t&&"mx-1"),...d,...p,onClick:x,children:Yn("span",{dangerouslySetInnerHTML:{__html:i},className:"pointer-events-none whitespace-pre-wrap break-words"})})}function Dr({node:e}){let r=re(),{id:t,attrs:n,content:a}=e,{shuffle:o=!0,equalWidth:s=!1}=n,{registerPool:i}=Te(),[c,l]=ss(()=>a.map(d=>({id:d.id,html:te(d.content)})));return Kn(()=>{let d=a.map(p=>({id:p.id,html:te(p.content)}));l(o?[...d].map(p=>({v:p,r:Math.random()})).sort((p,g)=>p.r-g.r).map(p=>p.v):d)},[o,JSON.stringify(a)]),Kn(()=>{i(t,c)},[t,c,i]),os("div",{className:"player-word-bank",children:[$t("div",{className:"player-word-bank__label",children:r.wordBank}),$t("div",{className:is("player-word-bank__items",s&&"player-word-bank__items--grid"),children:c.map(d=>$t(ar,{poolId:t,data:d},d.id))})]})}import{jsx as zt,jsxs as cs}from"react/jsx-runtime";import{useEffect as Xn,useState as ls}from"react";function Fr({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:a=!0,separator:o=" "}=t,{registerPool:s}=Te(),[i,c]=ls(()=>n.map(l=>({id:l.id,html:te(l.content,{stripParagraphs:!0})})));return Xn(()=>{let l=n.map(d=>({id:d.id,html:te(d.content,{stripParagraphs:!0})}));c(a?[...l].map(d=>({v:d,r:Math.random()})).sort((d,p)=>d.r-p.r).map(d=>d.v):l)},[a,JSON.stringify(n)]),Xn(()=>{s(r,i)},[r,i,s]),zt("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:I("0.25rem"),alignItems:"center"},children:i.map((l,d)=>cs("span",{children:[zt(ar,{poolId:r,data:l,isInline:!0}),d<i.length-1&&zt("span",{children:o})]},l.id))})}import{jsx as or,jsxs as Ot}from"react/jsx-runtime";import{useState as Bt,useEffect as qt,useMemo as us}from"react";import{Check as fs,X as hs}from"lucide-react";import{jsx as pe,jsxs as er}from"react/jsx-runtime";import{useState as Dt,useMemo as Ft,useRef as jt,useCallback as ds,useLayoutEffect as ps}from"react";var Jn="#1d2025",Zn="#8d93a0",ea="#1f8a4c",ra="#d23b2b",ms=11;function ta({leftItems:e,rightItems:r,connections:t,direction:n,disabled:a,feedback:o,onConnectionsChange:s}){let[i,c]=Dt(null),[l,d]=Dt(null),[p,g]=Dt(new Map),f=jt(null),S=jt(new Map),x=jt("mouse"),b=o?.showFeedback??!1,k=Ft(()=>{let R=new Map;if(o?.pairFeedback)for(let N of o.pairFeedback)R.set(`${N.leftId}-${N.rightId}`,N.correct);return R},[o]),h=Ft(()=>{let R=new Map;return o?.correctPairings?.forEach(N=>R.set(N.leftId,N.rightId)),R},[o]),_=Ft(()=>{let R=new Map;return o?.correctPairings?.forEach(N=>R.set(N.rightId,N.leftId)),R},[o]),u=new Map,y=new Map;t.forEach((R,N)=>{u.set(R.leftId,N),y.set(R.rightId,N)});let C=R=>{let N=t[R];if(!b||!N)return null;let D=k.get(`${N.leftId}-${N.rightId}`);return D===!0?"correct":D===!1?"incorrect":null},P=ds(()=>{if(!f.current)return;let R=f.current.getBoundingClientRect(),N=new Map;S.current.forEach((D,H)=>{if(D){let G=D.getBoundingClientRect();N.set(H,new DOMRect(G.left-R.left,G.top-R.top,G.width,G.height))}}),g(N)},[]);ps(()=>{P();let R=new ResizeObserver(P);return f.current&&R.observe(f.current),()=>R.disconnect()},[P,t,e,r]);let $=8,w=(R,N)=>{let D=p.get(R);if(!D)return null;let H=D.y+D.height/2;return N==="left"?{x:D.x+D.width,y:H}:{x:D.x-$,y:H}},m=(R,N)=>{if(a)return;let H=(N==="left"?u:y).has(R),G=i?.id===R&&i?.side===N,ge=i!==null&&i.side!==N;if(G){c(null);return}if(ge){let oe=N==="right"?i.id:R,ae=N==="left"?i.id:R,Z=t.filter(ne=>ne.leftId!==oe&&ne.rightId!==ae);Z.push({leftId:oe,rightId:ae}),s(Z),c(null);return}if(H&&!i){let oe=N==="left"?t.filter(ae=>ae.leftId!==R):t.filter(ae=>ae.rightId!==R);s(oe);return}c({id:R,side:N})},T=(R,N,D)=>{if(a||(x.current=D.pointerType,D.pointerType==="touch"))return;D.currentTarget.setPointerCapture(D.pointerId);let H=f.current.getBoundingClientRect();d({fromId:R,fromSide:N,x:D.clientX-H.left,y:D.clientY-H.top,overId:null,overSide:null})},E=R=>{if(!l)return;let N=f.current.getBoundingClientRect(),D=R.clientX-N.left,H=R.clientY-N.top,G=l.fromSide==="left"?"right":"left",ge=G==="left"?e:r,oe=null,ae=null;for(let Z of ge){let ne=p.get(Z.id);if(ne&&D>=ne.x&&D<=ne.x+ne.width&&H>=ne.y&&H<=ne.y+ne.height){oe=Z.id,ae=G;break}}d(Z=>Z?{...Z,x:D,y:H,overId:oe,overSide:ae}:null)},q=R=>{if(!l)return;let N=f.current.getBoundingClientRect(),D=R.clientX-N.left,H=R.clientY-N.top,G=w(l.fromId,l.fromSide);if((G?Math.hypot(D-G.x,H-G.y):999)<8){d(null),m(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let oe=l.fromSide==="left"?l.fromId:l.overId,ae=l.fromSide==="right"?l.fromId:l.overId,Z=t.filter(ne=>ne.leftId!==oe&&ne.rightId!==ae);Z.push({leftId:oe,rightId:ae}),s(Z)}d(null),c(null)},v=(R,N)=>{if(!b)return null;let H=(N==="left"?u:y).get(R.id);if(H!==void 0){let G=t[H];if(k.get(`${G.leftId}-${G.rightId}`)===!0)return null}if(N==="left"){let G=h.get(R.id);return r.find(ge=>ge.id===G)?.content??null}else{let G=_.get(R.id);return e.find(ge=>ge.id===G)?.content??null}},M=(R,N)=>{let H=(N==="left"?u:y).get(R.id),G=H!==void 0,ge=i?.id===R.id&&i?.side===N,oe=i!==null&&i.side!==N&&!G,ae=l?.overId===R.id&&l?.overSide===N,Z=G?C(H):null,ne=G?H+1:null,Ce="matching-player__item";G&&(Ce+=" matching-player__item--matched"),Z==="correct"&&(Ce+=" matching-player__item--correct"),Z==="incorrect"&&(Ce+=" matching-player__item--incorrect"),ge&&(Ce+=" matching-player__item--selected"),(oe||ae)&&(Ce+=" matching-player__item--available"),a&&(Ce+=" matching-player__item--disabled");let Ue=v(R,N);return er("button",{ref:Y=>{Y?S.current.set(R.id,Y):S.current.delete(R.id)},type:"button",className:Ce,onPointerDown:Y=>T(R.id,N,Y),onClick:()=>{x.current==="touch"&&m(R.id,N)},"aria-pressed":ge,children:[N==="right"&&pe("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:er("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[pe("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),pe("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),G&&N==="left"&&pe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),pe("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:te(R.content)}}),Ue&&er("span",{className:"matching-player__correct-hint",children:["(",pe("span",{dangerouslySetInnerHTML:{__html:te(Ue)}}),")"]}),G&&N==="right"&&pe("span",{className:"matching-player__pair-num","aria-hidden":!0,children:ne}),N==="left"&&pe("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:er("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[pe("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),pe("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},R.id)},F=n==="ltr"?e:r,z=n==="ltr"?r:e,j=n==="ltr"?"left":"right",V=n==="ltr"?"right":"left";return er("div",{ref:f,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:E,onPointerUp:q,children:[er("svg",{className:"matching-player__svg","aria-hidden":!0,children:[pe("defs",{children:[["mp-arrow-ink",Jn],["mp-arrow-correct",ea],["mp-arrow-incorrect",ra],["mp-arrow-ghost",Zn]].map(([R,N])=>pe("marker",{id:R,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:pe("polygon",{points:"0 0, 11 4.5, 0 9",fill:N})},R))}),t.map(R=>{let N=w(R.leftId,"left"),D=w(R.rightId,"right");if(!N||!D)return null;let H=D.x-ms,G=Math.max(16,Math.abs(H-N.x)*.4),ge=`M ${N.x} ${N.y} C ${N.x+G} ${N.y}, ${H-G} ${D.y}, ${H} ${D.y}`,oe=b?k.get(`${R.leftId}-${R.rightId}`):void 0;return pe("path",{d:ge,stroke:oe===!0?ea:oe===!1?ra:Jn,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${oe===!0?"mp-arrow-correct":oe===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${R.leftId}-${R.rightId}`)}),l&&(()=>{let R=w(l.fromId,l.fromSide);if(!R)return null;let N=Math.abs(l.x-R.x)*.35,D=`M ${R.x} ${R.y} C ${R.x+N} ${R.y}, ${l.x-N} ${l.y}, ${l.x} ${l.y}`;return pe("path",{d:D,stroke:Zn,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),er("div",{className:"matching-player__columns",children:[pe("div",{className:"matching-player__column",children:F.map(R=>M(R,j))}),pe("div",{className:"matching-player__column",children:z.map(R=>M(R,V))})]})]})}var na=e=>Number.isInteger(e)?String(e):e.toFixed(2);function aa(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function jr({node:e,validationFeedback:r}){let t=le(),{shuffleSeed:n,layoutBy:a}=Ee(),{id:o,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:d,hint:p}=s,g=JSON.stringify(i),f=JSON.stringify(c),S=d&&n!==void 0,x=us(()=>S?{left:xr(i,`${n}:${o}:left`),right:xr(c,`${n}:${o}:right`)}:null,[S,n,o,g,f]),[b,k]=Bt(i),[h,_]=Bt(c);qt(()=>{S||(d?(k(aa(i)),_(aa(c))):(k(i),_(c)))},[d,S,g,f]);let u=x?.left??b,y=x?.right??h,[C,P]=Bt([]),$=r?.showFeedback??!1;qt(()=>{let v=M=>{let z=M.answers.find(j=>j.nodeId===o&&j.type==="matchingSet");z&&"connections"in z.answer&&P(z.answer.connections)};return t.on("answers:prefill",v),()=>t.off("answers:prefill",v)},[t,o]),qt(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"matchingSet",timestamp:Date.now(),answer:{connections:C}}})},[t,o,C]);let w=v=>{$||P(v)},m=r?.score,T=r?.maxScore,E=$&&m!=null&&T!=null,q=E?m>=T?"correct":m>0?"partial":"incorrect":null;return Ot("div",{className:a==="box"?"matching-player matching-player--box":"matching-player",children:[p&&p.length>0&&or("div",{className:"matching-player-hintrow",children:or($e,{hint:p})}),or(ta,{leftItems:u,rightItems:y,connections:C,direction:l,disabled:$,feedback:r,onConnectionsChange:w}),E&&Ot("div",{className:"matching-player-feedback matching-player-feedback--"+q,children:[q==="correct"&&or(fs,{size:15,style:ee(15)}),q==="incorrect"&&or(hs,{size:15,style:ee(15)}),or("span",{children:q==="correct"?"All matched":q==="partial"?"Partial credit":"Not matched"}),Ot("span",{className:"matching-player-score",children:[na(m)," / ",na(T)]})]})]})}import{jsxs as sr,jsx as ze,Fragment as gs}from"react/jsx-runtime";import{useState as oa,useEffect as Wt,useRef as bs,useCallback as sa}from"react";import Zr from"clsx";function Or({node:e,validationFeedback:r}){let t=le(),n=re(),{id:a,attrs:o}=e,{placeholder:s,minWords:i=0,maxWords:c=500,hint:l}=o,[d,p]=oa(""),[g,f]=oa(0),S=r?.showFeedback??!1,x=r?.state,b=c<=30,k=sa(m=>m.trim().split(/\s+/).filter(Boolean).length,[]);Wt(()=>{let m=T=>{let q=T.answers?.find(v=>v.nodeId===a&&v.type==="aiAnswer");if(q&&q.answer?.text!=null){let v=q.answer.text;p(v),f(k(v))}};return t.on("answers:prefill",m),()=>t.off("answers:prefill",m)},[a,t,k]),Wt(()=>{let m=()=>{p(""),f(0)};return t.on("answers:reset",m),()=>t.off("answers:reset",m)},[t]);let h=bs(null),_=sa((m,T)=>{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:T}}})},300)},[a,t]);Wt(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let u=m=>{if(S)return;let T=k(m);p(m),f(T),_(m,T)},y=x==="validating",C=Zr("player-ai-count",g>c&&"player-ai-count--over"),P=!S||y?"":x==="correct"?"player-ai-input--correct":x==="incorrect"?"player-ai-input--incorrect":x==="partial"?"player-ai-input--partial":"",$=x==="correct"?"player-ai-feedback--correct":x==="incorrect"?"player-ai-feedback--incorrect":x==="partial"?"player-ai-feedback--partial":"",w=m=>Number.isInteger(m)?String(m):m.toFixed(2);return sr("div",{className:"player-ai",children:[sr("div",{className:"player-ai-counts",children:[sr("span",{className:C,children:[g," / ",c]}),i>0&&g<i&&ze("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),ze("span",{style:{marginInlineStart:"auto"},children:ze($e,{hint:l})})]}),b?ze("input",{type:"text",value:d,onChange:m=>u(m.target.value),placeholder:s??n.shortAnswerPlaceholder,disabled:S,className:Zr("player-ai-input",P)}):ze("textarea",{value:d,onChange:m=>u(m.target.value),placeholder:s??n.longAnswerPlaceholder,disabled:S,rows:5,className:Zr("player-ai-input player-ai-input--multiline",P)}),S&&r&&ze("div",{className:Zr("player-ai-feedback",$),children:y?sr("div",{className:"player-ai-validating",children:[ze("span",{className:"player-ai-spinner"}),ze("span",{children:n.aiEvaluationInProgress})]}):sr(gs,{children:[r.message&&ze("p",{className:"player-ai-message",children:r.message}),r.score!=null&&r.maxScore!=null&&ze("div",{className:"player-ai-score-row",children:sr("span",{className:"player-ai-score",children:[w(r.score)," / ",w(r.maxScore)]})})]})})]})}import{Fragment as ia,jsx as A,jsxs as K}from"react/jsx-runtime";import{useState as fe,useEffect as _e,useRef as Se,useCallback as et}from"react";import{useEditor as xs,EditorContent as ys}from"@tiptap/react";import vs from"@tiptap/starter-kit";import De from"clsx";import{FolderOpen as ws,Mic as ks,Video as da,Monitor as Rs,Clock as Ss,Image as _s,FileText as pa,Music as Ns,Link2 as Cs}from"lucide-react";function ma(e){return e.trim().split(/\s+/).filter(Boolean).length}function ua(e){return e.length}function As(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return ma(r(e))}function Ps(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return ua(r(e))}function Ut({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return A(ia,{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(ia,{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 Es({nodes:e}){return A("span",{className:"block space-y-1 text-amber-900",children:e.map((r,t)=>A(Ut,{node:r},t))})}function Ms({hint:e}){let r=re(),[t,n]=fe(!1),[a,o]=fe(!1),s=Se(null);return _e(()=>{if(!a)return;let i=c=>{s.current&&!s.current.contains(c.target)&&(o(!1),n(!1))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]),K("span",{ref:s,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?(o(!1),n(!1)):(o(!0),n(!0))},className:De("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(Es,{nodes:e})})]})}function ca(e){if(!isFinite(e.duration)){e.currentTime=1e101;let r=()=>{e.currentTime=0,e.removeEventListener("timeupdate",r)};e.addEventListener("timeupdate",r)}}function Is(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function Ls(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function la(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function Br({node:e,validationFeedback:r,readOnly:t=!1,mediaHandler:n}){let a=le(),o=re(),{id:s,attrs:i}=e,{mode:c,placeholder:l,allowFormatting:d,wordLimit:p,characterLimit:g,allowedTypes:f,allowMultiple:S,fileInstructions:x,maxDuration:b,hint:k}=i,h=t||(r?.showFeedback??!1),_=r?.state,u=Se(null),y=et(m=>{u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{let T=m.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}));a.emit({type:"answer:changed",answer:{nodeId:s,type:"openResponse",timestamp:Date.now(),answer:{...m,files:T}}})},300)},[s,a]);_e(()=>{y({})},[]);let[C,P]=fe([]);_e(()=>{(c==="file"||c==="text+file")&&c==="file"&&y({files:C})},[C,c]),_e(()=>{let m=()=>{P([])};return a.on("answers:reset",m),()=>a.off("answers:reset",m)},[a]),_e(()=>{let m=T=>{let q=(T.answers??[]).find(v=>v.nodeId===s&&v.type==="openResponse");q?.answer?.files&&P(q.answer.files)};return a.on("answers:prefill",m),()=>a.off("answers:prefill",m)},[s,a]);let $=r?.showFeedback,w=De(!$&&"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&&k&&k.length>0&&A("div",{className:"flex justify-end",children:A(Ms,{hint:k})}),c==="text"&&A(fa,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:p,characterLimit:g,isDisabled:h,feedbackBorderClass:w,emitAnswer:m=>y({text:m}),answerBus:a}),c==="file"&&A(Ht,{allowedTypes:f??["image"],allowMultiple:!!S,fileInstructions:x,isDisabled:h,feedbackBorderClass:w,files:C,setFiles:P,mediaHandler:n,t:o}),(c==="audio"||c==="video"||c==="screen")&&A(Fs,{kind:c,maxDuration:b,isDisabled:h,feedbackBorderClass:w,mediaHandler:n,emitAnswer:m=>y({recording:m}),t:o}),c==="text+file"&&A(Ds,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:p,characterLimit:g,allowedTypes:f??["image"],allowMultiple:!!S,fileInstructions:x,isDisabled:h,feedbackBorderClass:w,files:C,setFiles:P,emitAnswer:y,answerBus:a,mediaHandler:n,t:o}),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(Ss,{size:15,style:ee(15),className:"animate-pulse"}),A("span",{children:o.openResponseAwaitingReview})]}),r?.showFeedback&&_!=="awaiting_review"&&r.teacherFeedback&&A(js,{feedback:r.teacherFeedback,feedbackState:_,score:r.score,t:o})]})}function fa({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:o,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=re(),[d,p]=fe(""),[g,f]=fe(0),[S,x]=fe(0),b=Se(null),k=et(()=>{let M=b.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[]),h=xs({extensions:[vs.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!o,content:"",onUpdate({editor:M}){if(o)return;let z=M.getJSON().content??[],j=As(z),V=Ps(z);f(j),x(V),i({content:z,wordCount:j})}});_e(()=>{h&&h.setEditable(!o)},[o,h]);let _=Se(null);_e(()=>{h&&_.current!==null&&(h.commands.setContent({type:"doc",content:_.current}),_.current=null)},[h]),_e(()=>{let M=F=>{let z=(F.answers??[]).find(V=>V.nodeId===e&&V.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 V=j.flatMap(U=>U.content?.map(R=>R.text??"")??[U.text??""]).join(`
2
+ `);p(V),setTimeout(k,0)}};return c.on("answers:prefill",M),()=>c.off("answers:prefill",M)},[e,c,t,h]),_e(()=>{let M=()=>{t&&h?h.commands.clearContent():(p(""),setTimeout(k,0)),f(0),x(0)};return c.on("answers:reset",M),()=>c.off("answers:reset",M)},[c,t,h,k]);let u=!!n,y=!!a&&!n,C=u?g:S,P=u?n?.max:a?.max,$=u?n?.min:a?.min,w=P!=null&&C>P,m=P!=null&&C>=P*.8&&!w,T=$!=null&&C<$&&C>0,E="text-xs tabular-nums",q=w?{color:"var(--pen, #d23b2b)",fontWeight:500}:m||T?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},v=u?P?`${g} / ${P} ${l.openResponseWords}`:$?`${g} ${l.openResponseWords} (min. ${$})`:`${g} ${l.openResponseWords}`:y?P?`${S} / ${P} ${l.openResponseChars}`:`${S} ${l.openResponseChars}`:null;return t?K("div",{className:"relative",children:[K("div",{className:De("rounded border transition-colors min-h-[120px]",s),children:[!o&&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(ys,{editor:h,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),v&&A("div",{className:De("absolute bottom-2 right-3",E),style:q,children:v})]}):K("div",{className:"relative",children:[A("textarea",{ref:b,value:d,onChange:M=>{if(o)return;let F=M.target.value;p(F);let z=ma(F),j=ua(F);f(z),x(j),k(),i({content:[{type:"paragraph",content:[{type:"text",text:F}]}],wordCount:z})},onInput:k,disabled:o,placeholder:r||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:De("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,o&&"cursor-default")}),v&&A("div",{className:De("absolute bottom-2 right-3",E),children:v})]})}var Ts={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},$s={image:A(_s,{size:12,style:ee(12)}),pdf:A(pa,{size:12,style:ee(12)}),audio:A(Ns,{size:12,style:ee(12)}),video:A(da,{size:12,style:ee(12)}),videoLink:A(Cs,{size:12,style:ee(12)})};function Ht({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:a,setFiles:o,mediaHandler:s,t:i,compact:c=!1}){let l=Se(null),[d,p]=fe(!1),[g,f]=fe(!1),[S,x]=fe(""),b=e.some(m=>m!=="videoLink"),k=e.includes("videoLink"),h=r||a.length===0,_=e.filter(m=>m!=="videoLink").map(m=>Ts[m]).filter(Boolean).join(","),u=et(m=>{o(T=>r?[...T,m]:[m])},[r,o]),y=et(m=>{o(T=>T.filter((E,q)=>q!==m))},[o]),C=async m=>{if(!(!h||n)){p(!0);try{let T=m.type.startsWith("image/")?"image":m.type==="application/pdf"?"document":m.type.startsWith("audio/")?"audio":m.type.startsWith("video/")?"video":"file";if(s){let E=await s.upload(m,T);u({kind:"file",url:E.url,mimeType:E.mimeType??m.type,name:m.name})}else{let E=URL.createObjectURL(m);u({kind:"file",url:E,mimeType:m.type,name:m.name})}}finally{p(!1)}}},P=async m=>{if(m.preventDefault(),f(!1),n||!h)return;let T=m.dataTransfer.files?.[0];T&&await C(T)},$=()=>{let m=S.trim();m&&(u({kind:"videoLink",url:m,platform:Is(m)}),x(""))},w={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,T)=>A(zs,{file:m,onRemove:n?void 0:()=>y(T),compact:c,t:i},T))}),!n&&h&&K("div",{className:"space-y-2",children:[b&&!c&&K("div",{onDragOver:m=>{m.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:P,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:g?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:g?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[A(ws,{size:26,className:"mx-auto mb-2",style:{...ee(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}),d&&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:[$s[m]," ",w[m]]},m))})]}),b&&c&&A("button",{type:"button",onClick:()=>l.current?.click(),disabled:d,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:d?i.openResponseUploading:`+ ${i.openResponseAttachFile}`}),A("input",{ref:l,type:"file",accept:_,onChange:async m=>{let T=m.target.files?.[0];T&&(await C(T),m.target.value="")},className:"hidden"}),k&&K("div",{className:"flex gap-2 flex-wrap",children:[A("input",{type:"url",value:S,onChange:m=>x(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:!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&&a.length===0&&A("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function zs({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let a=e.platform==="youtube"?Ls(e.url):null;return K("div",{className:De("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:De("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(pa,{size:20,style:{...ee(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 Ds({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:p,emitAnswer:g,answerBus:f,mediaHandler:S,t:x}){let[b,k]=fe(null),[h,_]=fe(!1);return _e(()=>{g({...b&&{text:b},files:d.length>0?d:void 0})},[b,d]),K("div",{className:"space-y-2",children:[A(fa,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:a,isDisabled:c,feedbackBorderClass:l,emitAnswer:u=>k(u),answerBus:f}),!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:[x.openResponseAttachFiles,d.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:d.length})]})]}),h&&A("div",{className:"mt-1.5",children:A(Ht,{allowedTypes:o,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:p,mediaHandler:S,t:x,compact:!0})})]}),c&&d.length>0&&K("div",{className:"space-y-1",children:[A("p",{className:"text-xs text-gray-500 font-medium",children:x.openResponseAttachedFiles}),A(Ht,{allowedTypes:o,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:d,setFiles:p,t:x,compact:!0})]})]})}function Fs({kind:e,maxDuration:r,isDisabled:t,feedbackBorderClass:n,mediaHandler:a,emitAnswer:o,t:s}){let[i,c]=fe("idle"),[l,d]=fe(0),[p,g]=fe(null),[f,S]=fe("audio/webm"),[x,b]=fe(null),k=Se(null),h=Se(null),_=Se([]),u=Se(null),y=Se(null),C=Se(null),P=Se(0);_e(()=>()=>{$(),u.current&&clearInterval(u.current),cancelAnimationFrame(P.current)},[]),_e(()=>{i==="recording"&&e==="audio"&&h.current&&q(h.current)},[i]);let $=()=>{h.current?.getTracks().forEach(v=>v.stop()),h.current=null},w=async()=>{if(!a){b(s.openResponseMediaHandlerRequired);return}b(null),c("requesting");try{let v;if(e==="screen"){let z=await navigator.mediaDevices.getDisplayMedia({video:{cursor:"always"},audio:!1});try{let V=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];V&&z.addTrack(V)}catch{}z.getVideoTracks()[0]?.addEventListener("ended",()=>{k.current?.state==="recording"&&m()}),v=z,y.current&&(y.current.srcObject=v,y.current.play())}else e==="video"?(v=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"environment"}}),y.current&&(y.current.srcObject=v,y.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});k.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);g(j),c("reviewing"),$(),cancelAnimationFrame(P.current)},F.start(200),c("recording"),d(0),u.current=setInterval(()=>{d(z=>{let j=z+1;return r&&j>=r&&m(),j})},1e3)}catch{c("idle"),b(s.openResponsePermissionDenied)}},m=()=>{u.current&&(clearInterval(u.current),u.current=null),k.current?.stop()},T=async()=>{if(!p||!a)return;c("submitted");let M=await(await fetch(p)).blob(),F=e==="screen"?"video":e,z=new File([M],"recording.webm",{type:f}),j=await a.upload(z,F);URL.revokeObjectURL(p),o({url:j.url,mimeType:j.mimeType??f,duration:l,kind:F})},E=()=>{p&&URL.revokeObjectURL(p),g(null),d(0),c("idle")},q=v=>{let M=new AudioContext,F=M.createMediaStreamSource(v),z=M.createAnalyser();z.fftSize=64,F.connect(z);let j=new Uint8Array(z.frequencyBinCount),V=C.current;if(!V)return;let U=()=>{z.getByteFrequencyData(j);let R=V.getContext("2d");if(!R)return;R.clearRect(0,0,V.width,V.height);let N=V.width/j.length*2.5,D=0;for(let H=0;H<j.length;H++){let G=j[H]/255*V.height;R.fillStyle="#1d2025",R.fillRect(D,V.height-G,N,G),D+=N+1}P.current=requestAnimationFrame(U)};U()};return t?A("div",{className:De("rounded border p-4 text-center text-sm text-gray-400",n),children:s.openResponseRecordingSubmitted}):K("div",{className:De("rounded border p-4 space-y-3",n),children:[x&&A("p",{className:"text-sm",style:{color:"var(--pen, #d23b2b)"},children:x}),(e==="video"||e==="screen")&&i==="recording"&&A("video",{ref:y,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:v=>ca(v.currentTarget)}):A("video",{src:p,controls:!0,className:"w-full rounded max-h-48",onLoadedMetadata:v=>ca(v.currentTarget)})),K("div",{className:"flex items-center justify-center gap-3",children:[i==="idle"&&K("button",{type:"button",onClick:w,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(ks,{size:22,style:ee(22)}):e==="screen"?A(Rs,{size:22,style:ee(22)}):A(da,{size:22,style:ee(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:la(l)}),r&&K("span",{className:"text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:["/ ",la(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: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 js({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(o=>o.content?.map(s=>s.text??"")??[o.text??""]).join(" "),t!=null&&K("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:I("1.4rem"),lineHeight:1,color:a.ink},children:[t," pts"]})]})}import{jsx as Qe,jsxs as ir,Fragment as ha}from"react/jsx-runtime";import{useEffect as Vt,useRef as Os,useState as ga}from"react";function Bs(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function qr({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:a=!1}){let o=le(),s=Os(null),[i,c]=ga(""),[l,d]=ga(!1),p=Bs(n),g=n?.score,f=n?.maxScore,S=k=>Number.isInteger(k)?String(k):k.toFixed(2);Vt(()=>{import("mathlive").then(()=>{d(!0)}).catch(()=>{})},[]),Vt(()=>{let k=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 o.on("answers:prefill",k),()=>o.off("answers:prefill",k)},[o,e]),Vt(()=>{o.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:i}}})},[i,e,o]);let x=k=>{let h=k.target?.value??"";c(h)},b=p==="correct"?"player-math-field--correct":p==="incorrect"?"player-math-field--incorrect":p==="validating"?"player-math-field--validating":"";return ir("div",{dir:"ltr",className:"math-response-player",children:[ir("span",{style:{display:"inline-flex",alignItems:"center",gap:I("0.4rem")},children:[Qe("div",{className:"player-math-field"+(b?" "+b:"")+(a?" player-math-field--readonly":""),children:l?Qe("math-field",{ref:s,value:i,onInput:x,"virtual-keyboard-mode":"onfocus","smart-fence":"true",className:"player-math-field__input",style:{opacity:a?.7:1,pointerEvents:a?"none":"auto"}}):Qe("input",{type:"text",value:i,onChange:k=>c(k.target.value),placeholder:r||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:a,className:"player-math-field__fallback"})}),Qe($e,{hint:t})]}),n?.showFeedback&&ir("div",{className:"player-math-feedback player-math-feedback--"+p,children:[p==="validating"&&ir(ha,{children:[Qe("span",{className:"player-math-spinner"}),Qe("span",{children:"Checking your answer\u2026"})]}),p==="correct"&&ir(ha,{children:[Qe("span",{children:"\u2713 Correct"}),g!=null&&ir("span",{className:"player-math-score",children:[S(g),f!=null?` / ${S(f)}`:""]})]}),p==="incorrect"&&Qe("span",{children:"\u2717 Incorrect"})]})]})}import{jsx as J,jsxs as de,Fragment as wr}from"react/jsx-runtime";import{useCallback as ai,useEffect as oi,useRef as si,useState as vr}from"react";import{Play as ii,Lock as ci,Check as Qt,X as ya}from"lucide-react";function nt(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,l=r;return c.length!==l.length?!1:c.every((d,p)=>nt(d,l[p]))}let a=e,o=r,s=Object.keys(a),i=Object.keys(o);return s.length!==i.length?!1:s.every(c=>nt(a[c],o[c]))}var qs=`
3
3
  "use strict";
4
4
 
5
5
  // Capture console output for stdio mode
@@ -36,15 +36,15 @@ 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 Ls(e,r,t,n,a,o,s,i,c){return new Promise(l=>{let d=new Blob([Ms],{type:"text/javascript"}),p=URL.createObjectURL(d),g=new Worker(p),h=setTimeout(()=>{g.terminate(),URL.revokeObjectURL(p),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);g.onmessage=v=>{clearTimeout(h),g.terminate(),URL.revokeObjectURL(p);let y=v.data;if(r==="function"&&!y.errored){let x=rt(y.actual,o);l({testId:n,passed:x,actual:y.actual,stderr:y.stderr,durationMs:y.durationMs})}else l({testId:n,passed:y.passed??!1,actualStdout:y.actualStdout,stderr:y.stderr,durationMs:y.durationMs,errored:y.errored})},g.onerror=v=>{clearTimeout(h),g.terminate(),URL.revokeObjectURL(p),l({testId:n,passed:!1,stderr:v.message,errored:!0})},g.postMessage({testId:n,source:e,mode:r,entryFunction:t,args:a,expectedStdout:i,timeout:c})})}var Is="0.27.7";function Ts(){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||Is}/full/`}var br=null;function $s(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():br||(br=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=()=>{br=null,t(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),br)}var Zr=null;async function zs(){if(Zr)return Zr;let e=Ts();await $s(e);let r=globalThis.loadPyodide;if(typeof r!="function")throw new Error("Pyodide global not available after loading the CDN script");return Zr=await r({indexURL:e}),Zr}async function Ds(e,r,t,n,a,o,s,i,c){let l=Date.now();try{let d=await zs();if(r==="stdio"){d.runPython(`
39
+ `;async function Ws(e,r,t,n,a,o,s,i,c){return new Promise(l=>{let d=new Blob([qs],{type:"text/javascript"}),p=URL.createObjectURL(d),g=new Worker(p),f=setTimeout(()=>{g.terminate(),URL.revokeObjectURL(p),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);g.onmessage=S=>{clearTimeout(f),g.terminate(),URL.revokeObjectURL(p);let x=S.data;if(r==="function"&&!x.errored){let b=nt(x.actual,o);l({testId:n,passed:b,actual:x.actual,stderr:x.stderr,durationMs:x.durationMs})}else l({testId:n,passed:x.passed??!1,actualStdout:x.actualStdout,stderr:x.stderr,durationMs:x.durationMs,errored:x.errored})},g.onerror=S=>{clearTimeout(f),g.terminate(),URL.revokeObjectURL(p),l({testId:n,passed:!1,stderr:S.message,errored:!0})},g.postMessage({testId:n,source:e,mode:r,entryFunction:t,args:a,expectedStdout:i,timeout:c})})}var Us="0.27.7";function Hs(){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||Us}/full/`}var yr=null;function Vs(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():yr||(yr=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=()=>{yr=null,t(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),yr)}var rt=null;async function Gs(){if(rt)return rt;let e=Hs();await Vs(e);let r=globalThis.loadPyodide;if(typeof r!="function")throw new Error("Pyodide global not available after loading the CDN script");return rt=await r({indexURL:e}),rt}async function Qs(e,r,t,n,a,o,s,i,c){let l=Date.now();try{let d=await Gs();if(r==="stdio"){d.runPython(`
40
40
  import sys, io
41
41
  _stdout_capture = io.StringIO()
42
42
  sys.stdout = _stdout_capture
43
43
  `),s&&d.runPython(`
44
44
  import io
45
45
  sys.stdin = io.StringIO(${JSON.stringify(s)})
46
- `),d.runPython(e);let p=d.runPython("_stdout_capture.getvalue()");d.runPython("sys.stdout = sys.__stdout__");let g=p.trim()===(i||"").trim();return{testId:n,passed:g,actualStdout:p,durationMs:Date.now()-l}}else{d.runPython(e);let p=(a||[]).map(v=>JSON.stringify(v)).join(", "),g=d.runPython(`${t}(${p})`),h=rt(g,o);return{testId:n,passed:h,actual:g,durationMs:Date.now()-l}}}catch(d){return{testId:n,passed:!1,stderr:String(d),errored:!0,durationMs:Date.now()-l}}}var et=null;async function Fs(){if(et)return et;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return et=await(e.default??e)(),et}async function js(e,r,t,n){let a=Date.now();try{let o=await Fs(),s=new o.Database;t&&s.run(t);let c=s.exec(e).flatMap(d=>d.values.map(p=>p.map(String).join("|"))).join(`
47
- `),l=c.trim()===(n||"").trim();return s.close(),{testId:r,passed:l,actualStdout:c,durationMs:Date.now()-a}}catch(o){return{testId:r,passed:!1,stderr:String(o),errored:!0,durationMs:Date.now()-a}}}async function Os(e){let{transform:r}=await import("./esm-RQP7AIMT.mjs");return r(e,{transforms:["typescript"]}).code}var sr=class{supports(r){return["javascript","typescript","python","sql"].includes(r)}async run(r){let{language:t,source:n,mode:a,entryFunction:o,tests:s,timeoutMs:i=5e3}=r;if(!this.supports(t))return s.map(d=>({testId:d.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 Os(n)}catch(d){return s.map(p=>({testId:p.id,passed:!1,stderr:`TypeScript compile error: ${d.message}`,errored:!0}))}let l=[];for(let d of s){let p;t==="python"?p=await Ds(c,a,o,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i):t==="sql"?p=await js(c,d.id,d.stdin,d.expectedStdout):p=await Ls(c,a,o,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i),l.push(p)}return l}};import{jsx as pa}from"react/jsx-runtime";import{forwardRef as Bs,useEffect as qs,useImperativeHandle as Ws,useRef as Us,useState as Hs}from"react";function Vs(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Wt=Bs(function({value:r,onChange:t,language:n="javascript",readOnly:a=!1,readOnlyRanges:o,placeholder:s,height:i=300,className:c,autoFocus:l},d){let[p,g]=Hs(null),{scale:h}=Ce(),v=Us(null);qs(()=>{import("./dist-RXTJ74FF.mjs").then(f=>{g(()=>f.default)}).catch(()=>{})},[]),Ws(d,()=>({getValue(){return v.current?.getValue?.()??r},focus(){v.current?.focus?.()},insert(f){let C=v.current;if(!C)return;let u=C.getSelection();C.executeEdits("insert",[{range:u,text:f,forceMoveMarkers:!0}])}}));function y(f){v.current=f,l&&f.focus(),o?.length&&f.onDidAttemptReadOnlyEdit(()=>{})}function x(f){t(f??"")}let k=typeof i=="number"?i*h:i;return p?pa(p,{className:c,height:k,language:Vs(n),value:r,onChange:x,onMount:y,options:{readOnly:a,minimap:{enabled:!1},fontSize:14*h,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):pa("textarea",{className:c,value:r,onChange:f=>t(f.target.value),readOnly:a,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:a?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var Xs=new sr;function Zs(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 ei({sample:e,result:r,mode:t}){let n=r?.passed,a=r?.errored,o=r!==void 0,s=o?a?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=o?a?"\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:[X("span",{style:{color:s,fontWeight:700,fontSize:L("0.875rem"),display:"inline-flex"},children:i??(n?X(Ut,{size:15,style:ee(15)}):X(ua,{size:15}))}),X("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),o&&!n&&pe("div",{style:{marginTop:L("0.25rem"),paddingLeft:L("1.5rem")},children:[t==="function"?X(yr,{children:r?.actual!==void 0&&pe("div",{style:{color:"var(--ink-soft, #565b66)"},children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),X("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(r.actual)}),X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),X("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):X(yr,{children:r?.actualStdout!==void 0&&pe("div",{style:{color:"var(--ink-soft, #565b66)"},children:[pe("div",{children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),X("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:r.actualStdout||"(empty)"})]}),pe("div",{children:[X("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),X("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),r?.stderr&&X("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:L("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function Br({node:e,validationFeedback:r,readOnly:t=!1,executor:n=Xs,gradingTests:a}){let o=de(),s=Ys(null),{attrs:i}=e,c=e.id,[l,d]=xr(i.defaultLanguage),[p,g]=xr(()=>ma(e)),[h,v]=xr([]),[y,x]=xr(!1),[k,f]=xr(!1),C=p[l]??"",u=Zs(r);Qs(()=>{let S=W=>{let $=W.answers?.find(F=>F.nodeId===c&&F.type==="codingResponse");$?.answer&&($.answer.language&&d($.answer.language),$.answer.sourceByLanguage&&g($.answer.sourceByLanguage),$.answer.testResults&&v($.answer.testResults))},M=()=>{g(ma(e)),v([]),f(!1)};return o.on("answers:prefill",S),o.on("answers:reset",M),()=>{o.off("answers:prefill",S),o.off("answers:reset",M)}},[o,c,e]);let b=Gs((S,M,W)=>{o.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:S,sourceByLanguage:M,source:M[S]??"",testResults:W}}})},[o,c]),P=S=>{let M={...p,[l]:S};g(M),b(l,M,h)},E=S=>{d(S),v([]),b(S,p,[])},z=async()=>{if(y)return;x(!0),v([]);let S=a??i.visibleSamples??[];if(S.length===0){x(!1);return}try{let M=await n.run({language:l,source:C,mode:i.testMode,entryFunction:i.entryFunction,tests:S,timeoutMs:5e3});v(M),b(l,p,M)}catch(M){let W=S.map($=>({testId:$.id,passed:!1,stderr:String(M),errored:!0}));v(W),b(l,p,W)}finally{x(!1)}},w=()=>{k||(f(!0),b(l,p,h))},m=(a??[]).filter(S=>S.hidden).length,N=m>0?h.filter(S=>(a??[]).find(W=>W.id===S.testId)?.hidden&&S.passed).length:0,I=a?a.filter(S=>!S.hidden):i.visibleSamples??[],j=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 ${j}`,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:[X("div",{style:{display:"flex",gap:L("0.25rem")},children:i.languages.map(S=>X("button",{onClick:()=>!t&&E(S),disabled:t,style:{padding:`${L("0.2rem")} ${L("0.6rem")}`,borderRadius:L("0.375rem"),border:"1px solid",borderColor:l===S?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===S?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===S?"#fff":"var(--ink-soft, #565b66)",fontSize:L("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:S},S))}),X("div",{style:{flex:1}}),X(Me,{hint:i.hint}),!t&&pe(yr,{children:[pe("button",{onClick:z,disabled:y,style:{padding:`${L("0.25rem")} ${L("0.75rem")}`,borderRadius:L("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:y?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:L("0.8125rem"),fontWeight:600,cursor:y?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:L("0.35rem")},children:[X(Ks,{size:13,style:ee(13)})," ",y?"Running\u2026":"Run"]}),pe("button",{onClick:w,disabled:k,style:{padding:`${L("0.3rem")} ${L("0.85rem")}`,borderRadius:L("0.5rem"),border:"none",background:k?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:k?"var(--ok, #1f8a4c)":"#fff",fontSize:L("0.8125rem"),fontWeight:600,cursor:k?"default":"pointer",display:"inline-flex",alignItems:"center",gap:L("0.35rem")},children:[k&&X(Ut,{size:13,style:ee(13)})," ",k?"Submitted":"Submit"]})]})]}),X(Wt,{ref:s,value:C,onChange:P,language:l,readOnly:t,readOnlyRanges:i.starters.find(S=>S.language===l)?.readOnlyRanges,height:320}),(h.length>0||I.length>0)&&pe("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[X("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"}),I.map(S=>X(ei,{sample:S,result:h.find(M=>M.testId===S.id),mode:i.testMode},S.id)),m>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:[X(Js,{size:13,style:ee(13)})," Hidden tests: ",N,"/",m," 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(yr,{children:[X(Ut,{size:15,style:ee(15)})," All tests passed"]}),u==="partial"&&"Partial credit",u==="incorrect"&&pe(yr,{children:[X(ua,{size:15,style:ee(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 ni,jsx as Gt,jsxs as ai}from"react/jsx-runtime";import{createContext as oi,useContext as si}from"react";import{DndContext as ii,MouseSensor as ci,TouchSensor as li,KeyboardSensor as di,useSensor as Qt,useSensors as pi}from"@dnd-kit/core";import{jsx as Ht}from"react/jsx-runtime";import{DragOverlay as ri,useDndContext as ti}from"@dnd-kit/core";function Vt(){let{active:e}=ti();if(!e)return null;let r=e.data.current?.html??"";return Ht(ri,{dropAnimation:null,children:Ht("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:Ht("span",{dangerouslySetInnerHTML:{__html:r},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}var fa=oi(!1);function tt({children:e}){let r=si(fa),t=Qt(ci,{activationConstraint:{distance:8}}),n=Qt(li,{activationConstraint:{delay:120,tolerance:8}}),a=Qt(di),o=pi(t,n,a);return r?Gt(ni,{children:e}):Gt(fa.Provider,{value:!0,children:ai(ii,{sensors:o,children:[e,Gt(Vt,{})]})})}function cr({content:e,onAnswersChange:r,onSubmit:t,answerBus:n,namespace:a,initialAnswers:o,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:d,codeExecutor:p,display:g}){let h=ye(g),v=mi(()=>ke(h),[h]),y=ui(null);y.current||(y.current=new Fe);let x=n??y.current;nt(()=>{o&&o.length>0&&x.prefillAnswers(o)},[o,x]),nt(()=>{if(!r)return;let f=()=>{let C=x.getAllAnswers();r(C)};return x.on("answer:changed",f),()=>x.off("answer:changed",f)},[x,r]),nt(()=>{if(!t)return;let f=C=>{t(C.answers)};return x.on("answer:submitted",f),()=>x.off("answer:submitted",f)},[x,t]),nt(()=>{document.querySelectorAll("[data-audio]").forEach(C=>{let u=C.querySelector("audio"),b=C.querySelector("svg");!u||!b||(C.onclick=()=>{u.paused?(u.play(),b.innerHTML='<path d="M6 4h4v16H6zm8 0h4v16h-4z"/>',b.dataset.icon="pause"):(u.pause(),b.innerHTML='<path d="M6 4v16l12-8z"/>',b.dataset.icon="play")},u.onended=()=>{b.innerHTML='<path d="M6 4v16l12-8z"/>',b.dataset.icon="play"})})},[e]);let k=we(e,s,{readOnly:l,mediaHandler:d,codeExecutor:p});return ir(hr,{locale:c,children:ir(ve,{display:h,children:ir(Pr,{bus:x,children:ir(tt,{children:ir(Qr,{initialAnswers:o,children:ir("div",{className:`question-runtime ${i}${v.sizeSet?" edp-scaled":""}`,"data-namespace":a,style:{fontSize:L("1.125rem"),lineHeight:"1.75",...Re(v)},children:k})})})})})})}import{jsx as lr,jsxs as st}from"react/jsx-runtime";import{memo as bi,useCallback as ya,useMemo as xi,useRef as xa}from"react";var ha={words:80,media:1,tableRows:6},fi=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function ga(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&&fi.has(n.type)&&r.media++,n.type==="table"){let a=(n.content??[]).filter(o=>o.type==="tableRow").length;r.tableRows=Math.max(r.tableRows,a)}for(let a of n.content??[])t(a)};return e&&t(e),r}function vr(e,r=ha){let t=ga(e);return t.words>r.words||t.media>r.media||t.tableRows>r.tableRows}import{createContext as hi,useContext as gi}from"react";var ba=hi(null),at=ba.Provider;function ot(){return gi(ba)}function it({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:a,renderSeparator:o,className:s="",locale:i,display:c}){let l=ye(c),d=xi(()=>ke(l),[l]),p=xa(new Map),g=xa({exercise:e,onAnswersChange:r});g.current={exercise:e,onAnswersChange:r};let h=ya((f,C)=>{p.current.set(f,C);let{exercise:u,onAnswersChange:b}=g.current;if(b){let P={exerciseId:u.id,questionAnswers:u.questions.map(E=>({questionId:E.id,answers:p.current.get(E.id)??[]}))};b(P)}},[]),v=ot(),y=fr(i),x=!!(v&&e.sharedContext&&vr(e.sharedContext)),k=e.sharedContext?x?st("p",{className:"exercise-reference-cue",children:[lr("span",{children:y.referenceInPanel(v.label)})," ",st("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>v.showExerciseReference(e.id),children:[y.readReference,lr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):lr("div",{className:"exercise-shared-context",children:we(e.sharedContext)}):null;return lr(ve,{display:l,children:st("div",{className:`exercise-runtime ${s}`,style:Re(d),children:[k&&(n?n(k):k),e.questions.map((f,C)=>{let u=t?.get(f.id),b=lr(yi,{questionId:f.id,content:f.content,onQuestionAnswers:h,validationFeedback:u,locale:i},f.id);return st("div",{children:[a?a(f,b,C):b,o&&C<e.questions.length-1?o(C):null]},f.id)})]})})}var yi=bi(function({questionId:r,content:t,onQuestionAnswers:n,validationFeedback:a,locale:o}){let s=ya(i=>n(r,i),[n,r]);return lr(cr,{content:t,onAnswersChange:s,validationFeedback:a,locale:o})});import{jsx as Yt,jsxs as vi}from"react/jsx-runtime";import{useCallback as wi,useEffect as ki,useMemo as Ri,useRef as va}from"react";function He({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:a,renderSeparator:o,className:s="",brandingConfig:i,locale:c,display:l}){let d=va(new Map),p=ye(l),g=Ri(()=>ke(p),[p]);ki(()=>{if(!i?.fontUrl)return;let x=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(x))return;let k=document.createElement("link");k.id=x,k.rel="stylesheet",k.href=i.fontUrl,document.head.appendChild(k)},[i?.fontUrl]);let h={...Re(g)};i?.fontFamily&&(h["--brand-font"]=i.fontFamily);let v=va({assessment:e,onAnswersChange:r});v.current={assessment:e,onAnswersChange:r};let y=wi(x=>{d.current.set(x.exerciseId,x);let{assessment:k,onAnswersChange:f}=v.current;if(f){let C={exerciseAnswers:k.exercises.map(u=>d.current.get(u.id)??{exerciseId:u.id,questionAnswers:[]})};f(C)}},[]);return Yt(ve,{display:p,children:Yt("div",{className:`assessment-runtime ${s}`,style:Object.keys(h).length?h:void 0,children:e.exercises.map((x,k)=>{let f=t?.get(x.id),C=Yt(it,{exercise:x,onAnswersChange:y,validationFeedback:f,renderSharedContext:a?u=>a(u,x):void 0,locale:c},x.id);return vi("div",{children:[n?n(x,C,k):C,o&&k<e.exercises.length-1?o(k):null]},x.id)})})})}import{jsx as wa}from"react/jsx-runtime";import{useMemo as Si}from"react";function ct({content:e,className:r,display:t}){let n=ye(t),a=Si(()=>ke(n),[n]);return wa(ve,{display:n,children:wa("div",{className:`content-view ${r??""}`,style:Re(a),children:we(e)})})}import{jsx as wr,Fragment as ka,jsxs as lt}from"react/jsx-runtime";import{useMemo as _i}from"react";function kr({item:e,className:r,renderFigureLabel:t,display:n}){let a=ye(n),o=_i(()=>ke(a),[a]);return wr(ve,{display:a,children:lt("div",{className:`annex-item-view ${r??""}${o.sizeSet?" edp-scaled":""}`,style:Re(o),children:[e.type==="text-document"&&lt(ka,{children:[e.title&&wr("h3",{className:"text-base font-semibold mb-2",children:e.title}),we(e.content)]}),e.type==="figure"&&lt("figure",{children:[we(e.content),wr("figcaption",{children:t?t(e.label):wr("span",{children:e.label})})]}),e.type==="rich-block"&&lt(ka,{children:[e.title&&wr("h3",{className:"text-base font-semibold mb-2",children:e.title}),we(e.content)]})]})})}import{jsx as wm,jsxs as km}from"react/jsx-runtime";import{useState as Sm}from"react";import{jsx as Em,jsxs as Mm}from"react/jsx-runtime";import{useState as Im,useCallback as Tm,useMemo as $m}from"react";import{useEditor as Dm,EditorContent as Fm}from"@tiptap/react";import Om from"@tiptap/starter-kit";import{jsx as Um,jsxs as Hm,Fragment as Vm}from"react/jsx-runtime";import{useMemo as Qm,useState as Ym}from"react";import{Send as Da,Loader2 as Zt,BarChart2 as Fa,CheckCircle2 as rc,XCircle as tc,RotateCcw as nc,X as en,Clock as pr,AlertTriangle as ac,Check as oc,CloudOff as sc}from"lucide-react";import{clsx as Li}from"clsx";import{twMerge as Ii}from"tailwind-merge";function be(...e){return Ii(Li(e))}import{Fragment as Fi,jsx as ge,jsxs as Kt}from"react/jsx-runtime";function Ti({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 $i({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 zi({accent:e}){return Kt("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 Di({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 Ra({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 \u2014 this may take a few seconds.",spinnerTheme:o="default",animationUrl:s,hasAiNodes:i=!1,contained:c=!1}){return e?Kt(Fi,{children:[ge("style",{children:`
46
+ `),d.runPython(e);let p=d.runPython("_stdout_capture.getvalue()");d.runPython("sys.stdout = sys.__stdout__");let g=p.trim()===(i||"").trim();return{testId:n,passed:g,actualStdout:p,durationMs:Date.now()-l}}else{d.runPython(e);let p=(a||[]).map(S=>JSON.stringify(S)).join(", "),g=d.runPython(`${t}(${p})`),f=nt(g,o);return{testId:n,passed:f,actual:g,durationMs:Date.now()-l}}}catch(d){return{testId:n,passed:!1,stderr:String(d),errored:!0,durationMs:Date.now()-l}}}var tt=null;async function Ys(){if(tt)return tt;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return tt=await(e.default??e)(),tt}async function Ks(e,r,t,n){let a=Date.now();try{let o=await Ys(),s=new o.Database;t&&s.run(t);let c=s.exec(e).flatMap(d=>d.values.map(p=>p.map(String).join("|"))).join(`
47
+ `),l=c.trim()===(n||"").trim();return s.close(),{testId:r,passed:l,actualStdout:c,durationMs:Date.now()-a}}catch(o){return{testId:r,passed:!1,stderr:String(o),errored:!0,durationMs:Date.now()-a}}}async function Xs(e){let{transform:r}=await import("./esm-RQP7AIMT.mjs");return r(e,{transforms:["typescript"]}).code}var cr=class{supports(r){return["javascript","typescript","python","sql"].includes(r)}async run(r){let{language:t,source:n,mode:a,entryFunction:o,tests:s,timeoutMs:i=5e3}=r;if(!this.supports(t))return s.map(d=>({testId:d.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 Xs(n)}catch(d){return s.map(p=>({testId:p.id,passed:!1,stderr:`TypeScript compile error: ${d.message}`,errored:!0}))}let l=[];for(let d of s){let p;t==="python"?p=await Qs(c,a,o,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i):t==="sql"?p=await Ks(c,d.id,d.stdin,d.expectedStdout):p=await Ws(c,a,o,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i),l.push(p)}return l}};import{jsx as ba}from"react/jsx-runtime";import{forwardRef as Js,useEffect as Zs,useImperativeHandle as ei,useRef as ri,useState as ti}from"react";function ni(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Gt=Js(function({value:r,onChange:t,language:n="javascript",readOnly:a=!1,readOnlyRanges:o,placeholder:s,height:i=300,className:c,autoFocus:l},d){let[p,g]=ti(null),{scale:f}=Ee(),S=ri(null);Zs(()=>{import("./dist-RXTJ74FF.mjs").then(h=>{g(()=>h.default)}).catch(()=>{})},[]),ei(d,()=>({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 x(h){S.current=h,l&&h.focus(),o?.length&&h.onDidAttemptReadOnlyEdit(()=>{})}function b(h){t(h??"")}let k=typeof i=="number"?i*f:i;return p?ba(p,{className:c,height:k,language:ni(n),value:r,onChange:b,onMount:x,options:{readOnly:a,minimap:{enabled:!1},fontSize:14*f,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):ba("textarea",{className:c,value:r,onChange:h=>t(h.target.value),readOnly:a,placeholder:s,style:{width:"100%",height:typeof i=="number"?I(i):i,fontFamily:"monospace",fontSize:I(14),padding:I("0.5rem"),border:"1px solid #e2e8f0",borderRadius:I("0.375rem"),resize:"vertical",background:a?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var li=new cr;function di(e){return e?.showFeedback?e.state??"idle":"idle"}function xa(e){let r={};for(let t of e.attrs.starters??[])r[t.language]=t.code;return r}function pi({sample:e,result:r,mode:t}){let n=r?.passed,a=r?.errored,o=r!==void 0,s=o?a?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=o?a?"\u26A0":null:"\u25CB";return de("div",{style:{padding:`${I("0.5rem")} ${I("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:I("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[de("div",{style:{display:"flex",alignItems:"center",gap:I("0.5rem")},children:[J("span",{style:{color:s,fontWeight:700,fontSize:I("0.875rem"),display:"inline-flex"},children:i??(n?J(Qt,{size:15,style:ee(15)}):J(ya,{size:15}))}),J("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),o&&!n&&de("div",{style:{marginTop:I("0.25rem"),paddingLeft:I("1.5rem")},children:[t==="function"?J(wr,{children:r?.actual!==void 0&&de("div",{style:{color:"var(--ink-soft, #565b66)"},children:[J("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),J("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(r.actual)}),J("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),J("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):J(wr,{children:r?.actualStdout!==void 0&&de("div",{style:{color:"var(--ink-soft, #565b66)"},children:[de("div",{children:[J("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),J("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:r.actualStdout||"(empty)"})]}),de("div",{children:[J("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),J("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),r?.stderr&&J("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:I("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function Wr({node:e,validationFeedback:r,readOnly:t=!1,executor:n=li,gradingTests:a}){let o=le(),s=si(null),{attrs:i}=e,c=e.id,[l,d]=vr(i.defaultLanguage),[p,g]=vr(()=>xa(e)),[f,S]=vr([]),[x,b]=vr(!1),[k,h]=vr(!1),_=p[l]??"",u=di(r);oi(()=>{let v=F=>{let z=F.answers?.find(j=>j.nodeId===c&&j.type==="codingResponse");z?.answer&&(z.answer.language&&d(z.answer.language),z.answer.sourceByLanguage&&g(z.answer.sourceByLanguage),z.answer.testResults&&S(z.answer.testResults))},M=()=>{g(xa(e)),S([]),h(!1)};return o.on("answers:prefill",v),o.on("answers:reset",M),()=>{o.off("answers:prefill",v),o.off("answers:reset",M)}},[o,c,e]);let y=ai((v,M,F)=>{o.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:v,sourceByLanguage:M,source:M[v]??"",testResults:F}}})},[o,c]),C=v=>{let M={...p,[l]:v};g(M),y(l,M,f)},P=v=>{d(v),S([]),y(v,p,[])},$=async()=>{if(x)return;b(!0),S([]);let v=a??i.visibleSamples??[];if(v.length===0){b(!1);return}try{let M=await n.run({language:l,source:_,mode:i.testMode,entryFunction:i.entryFunction,tests:v,timeoutMs:5e3});S(M),y(l,p,M)}catch(M){let F=v.map(z=>({testId:z.id,passed:!1,stderr:String(M),errored:!0}));S(F),y(l,p,F)}finally{b(!1)}},w=()=>{k||(h(!0),y(l,p,f))},m=(a??[]).filter(v=>v.hidden).length,T=m>0?f.filter(v=>(a??[]).find(F=>F.id===v.testId)?.hidden&&v.passed).length:0,E=a?a.filter(v=>!v.hidden):i.visibleSamples??[],q=u==="correct"?"var(--ok, #1f8a4c)":u==="partial"?"var(--almost, #c8810e)":u==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return de("div",{style:{margin:`${I("0.75rem")} 0`,border:`1px solid ${q}`,borderRadius:I("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[de("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${I("0.5rem")} ${I("0.75rem")}`,display:"flex",alignItems:"center",gap:I("0.5rem"),flexWrap:"wrap"},children:[J("div",{style:{display:"flex",gap:I("0.25rem")},children:i.languages.map(v=>J("button",{onClick:()=>!t&&P(v),disabled:t,style:{padding:`${I("0.2rem")} ${I("0.6rem")}`,borderRadius:I("0.375rem"),border:"1px solid",borderColor:l===v?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===v?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===v?"#fff":"var(--ink-soft, #565b66)",fontSize:I("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:v},v))}),J("div",{style:{flex:1}}),J($e,{hint:i.hint}),!t&&de(wr,{children:[de("button",{onClick:$,disabled:x,style:{padding:`${I("0.25rem")} ${I("0.75rem")}`,borderRadius:I("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:x?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:I("0.8125rem"),fontWeight:600,cursor:x?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:I("0.35rem")},children:[J(ii,{size:13,style:ee(13)})," ",x?"Running\u2026":"Run"]}),de("button",{onClick:w,disabled:k,style:{padding:`${I("0.3rem")} ${I("0.85rem")}`,borderRadius:I("0.5rem"),border:"none",background:k?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:k?"var(--ok, #1f8a4c)":"#fff",fontSize:I("0.8125rem"),fontWeight:600,cursor:k?"default":"pointer",display:"inline-flex",alignItems:"center",gap:I("0.35rem")},children:[k&&J(Qt,{size:13,style:ee(13)})," ",k?"Submitted":"Submit"]})]})]}),J(Gt,{ref:s,value:_,onChange:C,language:l,readOnly:t,readOnlyRanges:i.starters.find(v=>v.language===l)?.readOnlyRanges,height:320}),(f.length>0||E.length>0)&&de("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[J("div",{style:{padding:`${I("0.5rem")} ${I("0.75rem")}`,fontSize:I("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),E.map(v=>J(pi,{sample:v,result:f.find(M=>M.testId===v.id),mode:i.testMode},v.id)),m>0&&de("div",{style:{padding:`${I("0.5rem")} ${I("0.75rem")}`,fontSize:I("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:I("0.4rem")},children:[J(ci,{size:13,style:ee(13)})," Hidden tests: ",T,"/",m," passed"]})]}),r?.showFeedback&&de("div",{style:{padding:`${I("0.55rem")} ${I("0.75rem")}`,fontSize:I("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:I("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"&&de(wr,{children:[J(Qt,{size:15,style:ee(15)})," All tests passed"]}),u==="partial"&&"Partial credit",u==="incorrect"&&de(wr,{children:[J(ya,{size:15,style:ee(15)})," Tests failed"]}),u==="validating"&&"Evaluating\u2026",u==="awaiting_review"&&"Awaiting teacher review",r.score!==void 0&&de("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:I("1.5rem"),lineHeight:1},children:[r.score," / ",r.maxScore??i.maxScore]})]})]})}import{Fragment as fi,jsx as Xt,jsxs as hi}from"react/jsx-runtime";import{createContext as gi,useContext as bi}from"react";import{DndContext as xi,MouseSensor as yi,TouchSensor as vi,KeyboardSensor as wi,useSensor as Jt,useSensors as ki}from"@dnd-kit/core";import{jsx as Yt}from"react/jsx-runtime";import{DragOverlay as mi,useDndContext as ui}from"@dnd-kit/core";function Kt(){let{active:e}=ui();if(!e)return null;let r=e.data.current?.html??"";return Yt(mi,{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 va=gi(!1);function at({children:e}){let r=bi(va),t=Jt(yi,{activationConstraint:{distance:8}}),n=Jt(vi,{activationConstraint:{delay:120,tolerance:8}}),a=Jt(wi),o=ki(t,n,a);return r?Xt(fi,{children:e}):Xt(va.Provider,{value:!0,children:hi(xi,{sensors:o,children:[e,Xt(Kt,{})]})})}function dr({content:e,onAnswersChange:r,onSubmit:t,answerBus:n,namespace:a,initialAnswers:o,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:d,codeExecutor:p,display:g}){let f=ye(g),S=Ri(()=>ke(f),[f]),x=Si(null);x.current||(x.current=new Be);let b=n??x.current;ot(()=>{o&&o.length>0&&b.prefillAnswers(o)},[o,b]),ot(()=>{if(!r)return;let h=()=>{let _=b.getAllAnswers();r(_)};return b.on("answer:changed",h),()=>b.off("answer:changed",h)},[b,r]),ot(()=>{if(!t)return;let h=_=>{t(_.answers)};return b.on("answer:submitted",h),()=>b.off("answer:submitted",h)},[b,t]),ot(()=>{document.querySelectorAll("[data-audio]").forEach(_=>{let u=_.querySelector("audio"),y=_.querySelector("svg");!u||!y||(_.onclick=()=>{u.paused?(u.play(),y.innerHTML='<path d="M6 4h4v16H6zm8 0h4v16h-4z"/>',y.dataset.icon="pause"):(u.pause(),y.innerHTML='<path d="M6 4v16l12-8z"/>',y.dataset.icon="play")},u.onended=()=>{y.innerHTML='<path d="M6 4v16l12-8z"/>',y.dataset.icon="play"})})},[e]);let k=we(e,s,{readOnly:l,mediaHandler:d,codeExecutor:p});return lr(br,{locale:c,children:lr(ve,{display:f,children:lr(Mr,{bus:b,children:lr(at,{children:lr(Kr,{initialAnswers:o,children:lr("div",{className:`question-runtime ${i}${S.sizeSet?" edp-scaled":""}`,"data-namespace":a,style:{fontSize:I("1.125rem"),lineHeight:"1.75",...Re(S)},children:k})})})})})})}import{jsx as pr,jsxs as ct}from"react/jsx-runtime";import{memo as Ai,useCallback as _a,useMemo as Pi,useRef as Sa}from"react";var wa={words:80,media:1,tableRows:6},_i=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function ka(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&&_i.has(n.type)&&r.media++,n.type==="table"){let a=(n.content??[]).filter(o=>o.type==="tableRow").length;r.tableRows=Math.max(r.tableRows,a)}for(let a of n.content??[])t(a)};return e&&t(e),r}function kr(e,r=wa){let t=ka(e);return t.words>r.words||t.media>r.media||t.tableRows>r.tableRows}import{createContext as Ni,useContext as Ci}from"react";var Ra=Ni(null),st=Ra.Provider;function it(){return Ci(Ra)}function lt({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:a,renderSeparator:o,className:s="",locale:i,display:c}){let l=ye(c),d=Pi(()=>ke(l),[l]),p=Sa(new Map),g=Sa({exercise:e,onAnswersChange:r});g.current={exercise:e,onAnswersChange:r};let f=_a((h,_)=>{p.current.set(h,_);let{exercise:u,onAnswersChange:y}=g.current;if(y){let C={exerciseId:u.id,questionAnswers:u.questions.map(P=>({questionId:P.id,answers:p.current.get(P.id)??[]}))};y(C)}},[]),S=it(),x=gr(i),b=!!(S&&e.sharedContext&&kr(e.sharedContext)),k=e.sharedContext?b?ct("p",{className:"exercise-reference-cue",children:[pr("span",{children:x.referenceInPanel(S.label)})," ",ct("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>S.showExerciseReference(e.id),children:[x.readReference,pr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):pr("div",{className:"exercise-shared-context",children:we(e.sharedContext)}):null;return pr(ve,{display:l,children:ct("div",{className:`exercise-runtime ${s}`,style:Re(d),children:[k&&(n?n(k):k),e.questions.map((h,_)=>{let u=t?.get(h.id),y=pr(Ei,{questionId:h.id,content:h.content,onQuestionAnswers:f,validationFeedback:u,locale:i},h.id);return ct("div",{children:[a?a(h,y,_):y,o&&_<e.questions.length-1?o(_):null]},h.id)})]})})}var Ei=Ai(function({questionId:r,content:t,onQuestionAnswers:n,validationFeedback:a,locale:o}){let s=_a(i=>n(r,i),[n,r]);return pr(dr,{content:t,onAnswersChange:s,validationFeedback:a,locale:o})});import{jsx as Zt,jsxs as Mi}from"react/jsx-runtime";import{useCallback as Ii,useEffect as Li,useMemo as Ti,useRef as Na}from"react";function Ye({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:a,renderSeparator:o,className:s="",brandingConfig:i,locale:c,display:l}){let d=Na(new Map),p=ye(l),g=Ti(()=>ke(p),[p]);Li(()=>{if(!i?.fontUrl)return;let b=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(b))return;let k=document.createElement("link");k.id=b,k.rel="stylesheet",k.href=i.fontUrl,document.head.appendChild(k)},[i?.fontUrl]);let f={...Re(g)};i?.fontFamily&&(f["--brand-font"]=i.fontFamily);let S=Na({assessment:e,onAnswersChange:r});S.current={assessment:e,onAnswersChange:r};let x=Ii(b=>{d.current.set(b.exerciseId,b);let{assessment:k,onAnswersChange:h}=S.current;if(h){let _={exerciseAnswers:k.exercises.map(u=>d.current.get(u.id)??{exerciseId:u.id,questionAnswers:[]})};h(_)}},[]);return Zt(ve,{display:p,children:Zt("div",{className:`assessment-runtime ${s}`,style:Object.keys(f).length?f:void 0,children:e.exercises.map((b,k)=>{let h=t?.get(b.id),_=Zt(lt,{exercise:b,onAnswersChange:x,validationFeedback:h,renderSharedContext:a?u=>a(u,b):void 0,locale:c},b.id);return Mi("div",{children:[n?n(b,_,k):_,o&&k<e.exercises.length-1?o(k):null]},b.id)})})})}import{jsx as Ca}from"react/jsx-runtime";import{useMemo as $i}from"react";function dt({content:e,className:r,display:t}){let n=ye(t),a=$i(()=>ke(n),[n]);return Ca(ve,{display:n,children:Ca("div",{className:`content-view ${r??""}`,style:Re(a),children:we(e)})})}import{jsx as Rr,Fragment as Aa,jsxs as pt}from"react/jsx-runtime";import{useMemo as zi}from"react";function Sr({item:e,className:r,renderFigureLabel:t,display:n}){let a=ye(n),o=zi(()=>ke(a),[a]);return Rr(ve,{display:a,children:pt("div",{className:`annex-item-view ${r??""}${o.sizeSet?" edp-scaled":""}`,style:Re(o),children:[e.type==="text-document"&&pt(Aa,{children:[e.title&&Rr("h3",{className:"text-base font-semibold mb-2",children:e.title}),we(e.content)]}),e.type==="figure"&&pt("figure",{children:[we(e.content),Rr("figcaption",{children:t?t(e.label):Rr("span",{children:e.label})})]}),e.type==="rich-block"&&pt(Aa,{children:[e.title&&Rr("h3",{className:"text-base font-semibold mb-2",children:e.title}),we(e.content)]})]})})}import{jsx as Im,jsxs as Lm}from"react/jsx-runtime";import{useState as $m}from"react";import{jsx as Bm,jsxs as qm}from"react/jsx-runtime";import{useState as Um,useCallback as Hm,useMemo as Vm}from"react";import{useEditor as Qm,EditorContent as Ym}from"@tiptap/react";import Xm from"@tiptap/starter-kit";import{jsx as ru,jsxs as tu,Fragment as nu}from"react/jsx-runtime";import{useMemo as ou,useState as su}from"react";import{Send as Ua,Loader2 as tn,BarChart2 as Ha,CheckCircle2 as mc,XCircle as uc,RotateCcw as fc,X as nn,Clock as ur,AlertTriangle as hc,Check as gc,CloudOff as bc}from"lucide-react";import{clsx as Wi}from"clsx";import{twMerge as Ui}from"tailwind-merge";function xe(...e){return Ui(Wi(e))}import{Fragment as Yi,jsx as he,jsxs as en}from"react/jsx-runtime";function Hi({accent:e}){return he("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function Vi({accent:e}){return he("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(r=>he("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${r*.2}s infinite`}},r))})}function Gi({accent:e}){return en("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(r=>he("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${r*.8}s infinite`}},r)),he("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function Qi({accent:e}){return he("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(r=>he("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${r*.15}s infinite`}},r))})}function Pa({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 \u2014 this may take a few seconds.",spinnerTheme:o="default",animationUrl:s,hasAiNodes:i=!1,contained:c=!1}){return e?en(Yi,{children:[he("style",{children:`
48
48
  @keyframes edpire-spin {
49
49
  to { transform: rotate(360deg); }
50
50
  }
@@ -60,7 +60,7 @@ sys.stdin = io.StringIO(${JSON.stringify(s)})
60
60
  0%, 100% { height: 12px; }
61
61
  50% { height: 40px; }
62
62
  }
63
- `}),ge("div",{style:{background:r},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:Kt("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(o){case"dots":return ge($i,{accent:t});case"pulse":return ge(zi,{accent:t});case"bars":return ge(Di,{accent:t});default:return ge(Ti,{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 Sa,useEffect as ji,useMemo as _a,useRef as dt,useState as Oi}from"react";import{BookOpen as Na,X as Bi}from"lucide-react";import{Fragment as Wi,jsx as ae,jsxs as Te}from"react/jsx-runtime";function Jt(e){return e.exercises.flatMap((r,t)=>r.sharedContext&&vr(r.sharedContext)?[{id:r.id,index:t,content:r.sharedContext}]:[])}var Ca=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function qi(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Aa({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:o,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d}){let[p,g]=Oi(!1),h=e.annex,v=h?.tabLabel||d("annexDocuments"),y=_a(()=>Jt(e),[e]),x=dt(null),k=dt(null),f=dt(null),C=dt(null),u=()=>(x.current?.getClientRects().length??0)>0,b=Sa((N,I)=>{let j=N?.querySelector(`[data-reference-for="${CSS.escape(I)}"]`);if(!N||!j)return;let S=j.getBoundingClientRect().top-N.getBoundingClientRect().top+N.scrollTop-12;N.scrollTo({top:S,behavior:Ca()?"auto":"smooth"}),qi(j)},[]),P=Sa(N=>{if(u()){b(k.current,N);return}g(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>b(C.current,N)))},[b]),E=N=>{let I=u()?x.current:f.current;u()||g(!1),Array.from(I?.querySelectorAll(`[data-exercise-id="${CSS.escape(N)}"]`)??[]).find(S=>S.getClientRects().length>0)?.scrollIntoView({behavior:Ca()?"auto":"smooth",block:"start"})};ji(()=>{let N=x.current;if(!N||y.length===0||typeof IntersectionObserver>"u")return;let I=new Set(y.map(M=>M.id)),j=null,S=new IntersectionObserver(M=>{if(!u())return;let $=M.filter(F=>F.isIntersecting&&I.has(F.target.dataset.exerciseId??"")).sort((F,Q)=>F.boundingClientRect.top-Q.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!$||$===j||(j=$,b(k.current,$))},{root:N,rootMargin:"0px 0px -60% 0px"});return N.querySelectorAll("[data-exercise-id]").forEach(M=>S.observe(M)),()=>S.disconnect()},[y,b]);let z=_a(()=>({label:v,showExerciseReference:P}),[v,P]),w=Te(Wi,{children:[h?.items.map(N=>ae(kr,{item:N},N.id)),h?.items.length&&y.length?ae("div",{className:"border-t border-[#e7e5e0]"}):null,y.map(N=>Te("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:[ae("button",{type:"button",onClick:()=>E(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:d("exercise",{index:N.index+1})}),ae(ct,{content:N.content})]},N.id))]}),m=ae(He,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c});return ae(at,{value:z,children:Te("div",{className:be("@container flex-1 min-h-0 flex",i&&"relative"),children:[Te("div",{ref:x,className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Te("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:[Te("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[ae(Na,{size:14,className:"text-[#8d93a0]"}),ae("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:v})]}),ae("div",{ref:k,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:w})]}),ae("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ae("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:ae("div",{className:"px-6 py-5 flex flex-col gap-4",children:m})})]}),Te("div",{className:"@6xl:hidden flex-1 relative overflow-hidden",children:[ae("div",{ref:f,className:"absolute inset-0 overflow-y-auto",children:ae("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:m})}),p&&ae("div",{className:be("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>g(!1)}),Te("div",{role:"dialog","aria-label":v,"aria-hidden":!p,className:be("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",p?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Te("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[ae("span",{className:"text-sm font-bold text-[#1d2025]",children:v}),ae("button",{onClick:()=>g(!1),"aria-label":d("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:ae(Bi,{size:18})})]}),ae("div",{ref:C,className:"overflow-y-auto max-h-[calc(100vh-8rem)] px-5 pb-5 flex flex-col gap-5",children:w})]})]}),!p&&Te("button",{onClick:()=>g(!0),"aria-label":v,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:be("@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:[ae(Na,{size:12}),ae("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:v})]})]})})}import{useState as Ui}from"react";import{BookOpen as Pa,Plus as Hi,X as Vi}from"lucide-react";import{jsx as ce,jsxs as Xe}from"react/jsx-runtime";function Ea({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:o,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,onAddAnnex:p}){let[g,h]=Ui(!1),v=ce(He,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c});if(g)return ce("div",{className:"flex-1 overflow-y-auto",children:ce("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:v})});let y=f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),p())},x=f=>Xe("span",{style:s?{backgroundColor:s}:void 0,className:be("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",f?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[ce(Hi,{size:13}),d("annexEmptyCta")]}),k=f=>ce("button",{type:"button",onClick:C=>{C.stopPropagation(),h(!0)},"aria-label":d("annexEmptyDismiss"),title:d("annexEmptyDismiss"),className:be("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",f&&"absolute top-2 end-2 z-10"),children:ce(Vi,{size:15})});return Xe("div",{className:be("@container flex-1 min-h-0 flex",i&&"relative"),children:[Xe("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[ce("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:Xe("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:y,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:[k(!0),ce("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:ce(Pa,{size:20})}),ce("span",{className:"text-sm font-bold text-[#565b66]",children:d("annexEmptyTitle")}),ce("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:d("annexEmptyBody")}),x(!1)]})}),ce("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ce("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:ce("div",{className:"px-6 py-5 flex flex-col gap-4",children:v})})]}),ce("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:Xe("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[Xe("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:y,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:[ce("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:ce(Pa,{size:16})}),Xe("div",{className:"flex-1 min-w-0",children:[ce("div",{className:"text-xs font-bold text-[#565b66]",children:d("annexEmptyTitle")}),ce("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:d("annexEmptyBody")})]}),x(!0),k(!1)]}),v]})})]})}function pt(e){let r=new Map;for(let t of e){let n=new Map;for(let a of t.questions){let o=new Map;for(let s of a.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),o.set(s.nodeId,i)}n.set(a.questionId,o)}r.set(t.exerciseId,n)}return r}var Gi=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),Qi=new Set(["blankPool","inlinePool"]);function Yi(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 Ki(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:a,content:o}=n;if(typeof a=="string"){if(Gi.has(a)){r+=1;return}if(Qi.has(a))return}o!==void 0&&t(o)};return t(e),r}function Ma(e,r){let t=new Map;for(let a of r?.exerciseAnswers??[])for(let o of a.questionAnswers){let s=t.get(o.questionId);s||(s=new Set,t.set(o.questionId,s));for(let i of o.answers)Yi(i)&&s.add(i.nodeId)}let n=0;for(let a of e.exercises)for(let o of a.questions){let s=Ki(o.content);s!==0&&(t.get(o.id)?.size??0)<s&&(n+=1)}return n}var Ji={exercise:"Exercise {index}",question:"Question {index}",points:"pts",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.",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",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI \u2014 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"},Xi={exercise:"Exercice {index}",question:"Question {index}",points:"pts",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.",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",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA \u2014 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"},Zi={exercise:"\u062A\u0645\u0631\u064A\u0646 {index}",question:"\u0633\u0624\u0627\u0644 {index}",points:"\u0646\u0642\u0637\u0629",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.",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",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 \u2014 \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"},Xt={en:Ji,fr:Xi,ar:Zi};function ec(e,r,t){let a=(Xt[e]??Xt.en)[r]??Xt.en[r]??r;return t?Object.entries(t).reduce((o,[s,i])=>o.replace(`{${s}}`,String(i)),a):a}function La(e){return(r,t)=>ec(e,r,t)}function Ia(e){return e==="ar"}function mt(e){return e==="en"?"en":"fr"}var Ta="48rem";function Ze(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))}Ze(`: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;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)}
64
- `);import"katex/dist/katex.min.css";Ze(`.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}}
65
- `);Ze(`/*! 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 .end-3{inset-inline-end:calc(var(--spacing) * 3)}.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-y-0\\.5{row-gap:calc(var(--spacing) * .5)}.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-4{padding-block:calc(var(--spacing) * 4)}.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 .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 .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-\\[10px\\]{font-size:10px}.edpire-scope .text-\\[11px\\]{font-size:11px}.edpire-scope .text-\\[20px\\]{font-size:20px}.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-black\\/20{color:#0003}@supports (color:color-mix(in lab,red,red)){.edpire-scope .text-black\\/20{color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.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 .capitalize{text-transform:capitalize}.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-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\\:inline-flex{display:inline-flex}.edpire-scope .sm\\:flex-row{flex-direction:row}.edpire-scope .sm\\:items-center{align-items:center}}@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}}
66
- `);import{Fragment as rn,jsx as T,jsxs as B}from"react/jsx-runtime";var ic="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 cc(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 Ba(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function ja(e){return e.questions.reduce((r,t)=>r+Ba(t),0)}function je(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}function qa(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function lc({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:qa(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:T("path",{d:r})})}function dc({score:e,weight:r,t}){if(e){if(e.awaiting)return B("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(pr,{size:11}),t("pendingReview")]});let n=e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return B("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(lc,{outcome:n}),B("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:qa(n)},children:[je(e.s)," / ",je(e.m)]})]})}return r>0?B("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[je(r)," ",t("points")]}):null}function Oa(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 pc(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 mc({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,a=new Date(r).getTime()+n,[o,s]=ze(()=>Math.max(a-Date.now(),0)),i=nn(t);i.current=t,tn(()=>{if(o<=0){i.current();return}let y=setInterval(()=>{let x=Math.max(a-Date.now(),0);s(x),x<=0&&(clearInterval(y),i.current())},1e3);return()=>clearInterval(y)},[a]);let c=o/n,l=c<.1?"bg-[#fdeeec] text-[#a32b1e] border-[#f6cfc9] animate-pulse":c<.25?"bg-[#fbf1dc] text-[#8a5a08] border-[#f2e2bf]":"bg-[#f5f4f1] text-[#565b66] border-[#e7e5e0]",d=Math.ceil(o/1e3),p=Math.floor(d/3600),g=Math.floor(d%3600/60),h=d%60,v=p>0?`${p}:${String(g).padStart(2,"0")}:${String(h).padStart(2,"0")}`:`${g}:${String(h).padStart(2,"0")}`;return B("span",{className:be("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-bold tabular-nums transition-colors",l),children:[T(pr,{size:12}),v]})}function ut({assessment:e,meta:r,locale:t="en",branding:n,timeLimitMinutes:a,startedAt:o,initialAnswers:s,onAnswersChange:i,saveState:c,resumed:l=!1,onSubmit:d,review:p,onViewReport:g,reportLabel:h,onBack:v,backLabel:y,allowReset:x,onReset:k,overlayConfig:f,contained:C=!1,layout:u,onClose:b,mediaHandler:P,onAddAnnex:E,fallbackLogoUrl:z}){let w=$e(()=>La(t),[t]),m=Ia(t)?"rtl":"ltr",N=u?.maxWidth??Ta,I=n?.branding?.primaryColor,j=n?.branding?.accentColor,S=n?.branding?.fontFamily,M=n?.branding?.fontUrl,W=n?.branding?.showPoweredBy!==!1;tn(()=>{if(!M||typeof document>"u"||document.querySelector(`link[href="${M}"]`))return;let me=document.createElement("link");me.rel="stylesheet",me.href=M,document.head.appendChild(me)},[M]);let[$,F]=ze(()=>p?.answers??s??{exerciseAnswers:[]}),[Q]=ze(()=>p?new Map:Oa(s)),q=nn(i);q.current=i;let R=dr(Y=>{let me=pc(Y,Q);F(me),q.current?.(me)},[Q]),[_,D]=ze(null);tn(()=>{D(Date.now())},[]);let[H,V]=ze(l&&!p),le=$e(()=>{if(_===null||!a||a<=0||!o)return null;let Y=new Date(o).getTime()+a*6e4-_;return Y>0?Math.max(1,Math.floor(Y/6e4)):null},[_,a,o]),[Z,oe]=ze(!1),[se,ne]=ze(!1),[U,mr]=ze(p?.result??null),Ve=$e(()=>Oa(p?.answers),[p]),[cn,Rr]=ze(null),[ht,ln]=ze(!1),dn=nn(!1),Ja=$e(()=>cc(e),[e]),gt=$e(()=>se?Ma(e,$):0,[se,e,$]),pn=$e(()=>e.exercises.reduce((Y,me)=>Y+ja(me),0),[e]),bt=$e(()=>U?pt(U.exerciseFeedback):void 0,[U]),mn=$e(()=>{if(!U)return{};let Y={};for(let me of U.exerciseFeedback){let Ge=0,Oe=0,fe=!1;for(let er of me.questions)for(let De of er.nodeResults)Ge+=De.score,Oe+=De.maxScore,De.status==="awaiting_review"&&(fe=!0);Y[me.exerciseId]={score:Ge,maxScore:Oe,awaiting:fe}}return Y},[U]),un=$e(()=>{if(!U)return{};let Y={};for(let me of U.exerciseFeedback)for(let Ge of me.questions){let Oe=0,fe=0,er=!1;for(let De of Ge.nodeResults)Oe+=De.score,fe+=De.maxScore,De.status==="awaiting_review"&&(er=!0);Y[Ge.questionId]={score:Oe,maxScore:fe,awaiting:er}}return Y},[U]),Xa=dr(async()=>{oe(!0),Rr(null);try{let Y=await d($);mr(Y),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(Y){Rr(Y instanceof Error?Y.message:w("confirmCancel"))}finally{oe(!1),ne(!1)}},[$,d,w]),fn=dr(()=>{!U||!g||g(U)},[U,g]),Za=dr(()=>{dn.current||Z||U||(dn.current=!0,ln(!0),ne(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{oe(!0),Rr(null),d($).then(Y=>{mr(Y),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(Y=>{Rr(Y instanceof Error?Y.message:"submit_error")}).finally(()=>{oe(!1),ln(!1)})},800))},[$,Z,d,U]),xt=dr((Y,me,Ge)=>{let Oe=ja(Y),fe=mn[Y.id],er=Y.questions.length>1,De=za(me)?$a(me,{renderQuestion:(Nr,vt,ro)=>{let Qe=Nr.id,hn=Q.get(Qe),gn={...P?{mediaHandler:P}:{},...p?{initialAnswers:Ve.get(Qe)??[],readOnly:!0}:hn?{initialAnswers:hn}:{}},bn=Object.keys(gn).length>0&&za(vt)?$a(vt,gn):vt;if(!er)return T("div",{"data-question-id":Qe,children:bn},Qe);let Cr=un[Qe],to=Ba(Nr);return B("div",{"data-question-id":Qe,children:[B("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:w("question",{index:ro+1})}),T(dc,{score:Cr?{s:Cr.score,m:Cr.maxScore,awaiting:Cr.awaiting}:null,weight:to,t:w})]}),bn]},Qe)},renderSeparator:Nr=>T("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Nr}`)}):me;return B("div",{"data-exercise-id":Y.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[B("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:j?{backgroundColor:j}:void 0,children:[T("span",{className:"text-sm font-bold text-[#1d2025]",children:w("exercise",{index:Ge+1})}),fe?.awaiting?B("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(pr,{size:11}),w("pendingReview")]}):fe?B("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:[je(fe.score)," / ",je(fe.maxScore)]}):Oe>0?B("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",je(Oe)," ",w("points")]}):null]}),T("div",{className:"p-4",children:De})]},Y.id)},[w,mn,un,j,P,p,Ve,Q]),eo=$e(()=>Jt(e).length>0,[e]),yt=dr(Y=>B("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:w("exercise",{index:Y+2})}),T("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${Y}`),[w]),Ae=U!==null,Sr=U?.showVerdict!==!1,_r=Sr?U?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return T("div",{className:"edpire-scope",style:{display:"contents"},children:B("div",{dir:m,className:be("flex flex-col",C?"h-full":"h-dvh"),style:S?{fontFamily:S}:void 0,children:[T(Ra,{visible:Z&&!ht,hasAiNodes:Ja,text:w("evaluating"),aiText:w("aiEvaluating"),contained:C,...f}),ht&&B("div",{className:be("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",C&&"absolute"),children:[T(pr,{size:40,className:"text-red-300"}),T("p",{className:"text-xl font-black text-white tracking-tight",children:w("timeUp.title")}),T("p",{className:"text-sm text-red-200",children:w("timeUp.submitting")})]}),B("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:j?{backgroundColor:j}:void 0,children:[B("div",{className:"flex items-center gap-3",children:[T("img",{src:n?.logoUrl??z??ic,alt:n?.name??"Edpire",width:24,height:24,loading:"lazy",className:"rounded object-contain"}),B("div",{children:[T("h1",{className:"text-sm font-bold text-[#1d2025]",children:r.title}),T("p",{className:"text-[11px] text-[#8d93a0] capitalize",children:pn>0&&B("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",je(pn)," ",w("points")]})})]}),!Ae&&_!==null&&a&&a>0&&o&&T(mc,{timeLimitMinutes:a,startedAt:o,onExpire:Za}),!Ae&&(c==="saving"||c==="saved")&&B("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[c==="saved"?T(oc,{size:12}):T(Zt,{size:12,className:"animate-spin"}),w(c==="saved"?"answersSaved":"answersSaving")]})]}),B("div",{className:"flex items-center gap-2",children:[x&&B("button",{onClick:k,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(nc,{size:13}),w("reset")]}),(!Ae||p)&&v&&B("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(en,{size:13}),y??w("back")]}),b&&T("button",{onClick:b,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:T(en,{size:15})}),!Ae&&T("button",{onClick:()=>ne(!0),disabled:Z,style:I?{backgroundColor:I}: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:Z?B(rn,{children:[T(Zt,{size:14,className:"animate-spin"}),w("submitting")]}):B(rn,{children:[T(Da,{size:14}),w("submit")]})})]})]}),cn&&T("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:cn}),!Ae&&c==="failed"&&B("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(sc,{size:15,className:"flex-shrink-0"}),w("answersNotSaved")]}),!Ae&&H&&(Q.size>0||le!==null)&&B("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:[le!==null&&T(pr,{size:15,className:"flex-shrink-0 text-[#565b66]"}),B("span",{className:"flex-1 min-w-0",children:[Q.size>0?w("resumeRestored"):w("resumeFresh"),le!==null&&B(rn,{children:[" ",w("resumeTimeLeft",{minutes:le})]})]}),T("button",{type:"button",onClick:()=>V(!1),"aria-label":w("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:T(en,{size:14})})]}),Ae&&U&&(U.awaitingManualGrading?T("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:T("div",{className:"mx-auto px-6 py-4",style:{maxWidth:N},children:B("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[B("div",{className:"flex items-center gap-2",children:[T(pr,{size:20,className:"text-[#c8810e] flex-shrink-0"}),T("span",{className:"text-sm font-semibold text-[#8a5a08]",children:U.aiPending?w("beingMarked"):w("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:U.aiPending?w("beingMarkedDesc"):w("awaitingReviewDesc")}),g&&B("button",{onClick:fn,style:I?{backgroundColor:I}: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(Fa,{size:14}),h??w("viewFullReport")]})]})})}):T("div",{className:be("flex-shrink-0 border-b",Sr?U.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:T("div",{className:"mx-auto px-6 py-4",style:{maxWidth:N},children:B("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[B("div",{className:"flex items-center gap-2",children:[Sr?U.passed?T(rc,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):T(tc,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,T("span",{className:"text-sm font-semibold",style:{color:_r},children:Sr?U.passed?w("assessmentPassed"):w("assessmentNotPassed"):w("yourScore")})]}),T("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),B("div",{className:"flex items-baseline gap-1.5",children:[B("span",{className:"leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"2rem",color:_r},children:[je(U.totalScore)," / ",je(U.maxScore)]}),T("span",{className:"text-sm text-[#8d93a0] font-medium",children:w("points")})]}),B("div",{className:"flex-1 flex items-center gap-3 min-w-0",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:`${U.percentage}%`,backgroundColor:_r}})}),B("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:_r},children:[U.percentage,"%"]})]}),g&&B("button",{onClick:fn,style:I?{backgroundColor:I}: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(Fa,{size:14}),h??w("viewFullReport")]})]})})})),T("div",{className:be("flex-1 overflow-hidden flex flex-col",ht&&"pointer-events-none opacity-60"),children:e.annex||eo?T(Aa,{assessment:e,isSubmitted:Ae,setAnswers:R,validationFeedback:bt,renderExercise:xt,renderSeparator:yt,primaryColor:I,contained:C,locale:mt(t),contentMaxWidth:N,t:w}):E?T(Ea,{assessment:e,isSubmitted:Ae,setAnswers:R,validationFeedback:bt,renderExercise:xt,renderSeparator:yt,primaryColor:I,contained:C,locale:mt(t),contentMaxWidth:N,t:w,onAddAnnex:E}):T("div",{className:"flex-1 overflow-y-auto",children:T("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:N},children:T(He,{assessment:e,onAnswersChange:Ae?void 0:R,validationFeedback:bt,renderExercise:xt,renderSeparator:yt,locale:mt(t)})})})}),W&&T("div",{className:"fixed bottom-2 end-3 text-[20px] text-black/20 pointer-events-none select-none z-10",children:w("poweredBy")}),se&&T("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:B("div",{className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[T("h3",{className:"text-base font-bold text-[#1d2025] mb-2",children:w("confirmTitle")}),gt>0&&B("p",{className:"flex items-start gap-2 text-sm font-semibold text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[T(ac,{size:15,className:"flex-shrink-0 mt-px"}),T("span",{children:gt===1?w("unansweredOne"):w("unansweredMany",{count:gt})})]}),T("p",{className:"text-sm text-[#565b66] mb-5",children:w("confirmDescription")}),B("div",{className:"flex gap-3 justify-end",children:[T("button",{onClick:()=>ne(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:w("confirmCancel")}),B("button",{onClick:Xa,disabled:Z,style:I?{backgroundColor:I}: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:[Z?T(Zt,{size:14,className:"animate-spin"}):T(Da,{size:14}),w("confirmSubmit")]})]})]})})]})})}function ft(e){return(e??[]).map(r=>({exerciseId:r.exercise_id,questions:r.questions.map(t=>({questionId:t.question_id,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 hc}from"react/jsx-runtime";function an(e,r){let t=ft(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 on(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 Ua({token:e,data:r,baseUrl:t,options:n}){let{locale:a,branding:o,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:d,layout:p,mediaHandler:g,onComplete:h,onError:v}=n,y=o??r.branding??void 0,x=a??r.meta.language??"en",k=uc(()=>on(r.assessment),[r]),[f]=fc(()=>new Date().toISOString()),C=Wa(async b=>{let P=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:b})});if(!P.ok){let z=await P.json().catch(()=>({})),w=typeof z.error=="string"?z.error:"Submission failed",m=P.status===401?"TOKEN_INVALID":P.status===409?"TOKEN_USED":P.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw v?.({code:m,message:w}),new Error(w)}let E=await P.json();return h?.(E),an(E,s)},[t,e,h,v,s]),u=Wa(b=>{if(s)try{let P=new URL(s);P.searchParams.set("submission_id",b.submissionId),b.awaitingManualGrading||(P.searchParams.set("score",String(b.totalScore)),P.searchParams.set("max_score",String(b.maxScore))),window.location.href=P.toString()}catch{window.location.href=s}},[s]);return hc(ut,{assessment:k,meta:{title:r.meta.title,category:r.meta.category??null},locale:x,branding:y,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:f,onSubmit:C,onViewReport:s?u:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:d,layout:p,mediaHandler:g})}import{useMemo as Ha}from"react";import{jsx as bc}from"react/jsx-runtime";function gc(){return Promise.reject(new Error("A review cannot be submitted"))}function Va({review:e,locale:r,branding:t,layout:n,onBack:a,backLabel:o}){let s=Ha(()=>on(e.assessment),[e]),i=Ha(()=>({answers:e.answers,result:an({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 bc(ut,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,onSubmit:gc,onBack:a,backLabel:o,layout:n})}import vc from"react";import{createRoot as wc}from"react-dom/client";import xc,{useMemo as yc}from"react";import"katex/dist/katex.min.css";import{jsx as sn}from"react/jsx-runtime";var Ga=xc.memo(function({content:r,onAnswersChange:t,feedback:n,initialAnswers:a,readOnly:o,className:s,dir:i}){let c=yc(()=>{if(n)return new Map(Object.entries(n))},[n]),l=sn(cr,{content:r,onAnswersChange:t,initialAnswers:a,validationFeedback:c,readOnly:o,className:s});return sn("div",{className:"edpire-scope",style:{display:"contents"},children:i?sn("div",{dir:i,children:l}):l})});function kc(e){let{container:r,content:t,onAnswersChange:n,feedback:a,initialAnswers:o,readOnly:s,dir:i}=e,c=typeof r=="string"?document.querySelector(r):r;if(!c)throw new Error(`EdpireSDK.renderQuestion: container not found: ${String(r)}`);let l={content:t,onAnswersChange:n,feedback:a,initialAnswers:o,readOnly:s,dir:i},d=wc(c);function p(){d.render(vc.createElement(Ga,l))}return p(),{setContent(g){l={...l,content:g,feedback:null},p()},setFeedback(g){l={...l,feedback:g},p()},setInitialAnswers(g){l={...l,initialAnswers:g},p()},unmount(){d.unmount()}}}function Rc(e){let r=[],t=0;for(let n of e.exercises)for(let a of n.questions)r.push({exerciseId:n.id,questionId:a.id,content:a.content_ast,points:a.points,sequenceNumber:a.sequence_number,index:t++});return r}function Sc(e){let r=pt(ft(e.exercise_feedback)),t=new Map;for(let o of e.answers.exerciseAnswers)for(let s of o.questionAnswers)t.set(s.questionId,s.answers);let n=[],a=0;for(let o of e.assessment.exercises){let s=r.get(o.id);for(let i of o.questions){let c=s?.get(i.id),l=e.exercise_feedback.find(h=>h.exercise_id===o.id)?.questions.find(h=>h.question_id===i.id)?.node_results??[],d=0,p=0,g=!1;for(let h of l)d+=h.score,p+=h.max_score,h.status==="awaiting_review"&&(g=!0);n.push({exerciseId:o.id,questionId:i.id,content:i.content,sharedContext:o.sharedContext??null,answers:t.get(i.id)??[],feedback:c?Object.fromEntries(c):{},score:d,maxScore:p,status:g?"awaiting_review":p===0?"unscored":d>=p?"correct":d>0?"partial":"incorrect",index:a++})}}return n}function _c(e){let r=new Map;for(let t of e)r.has(t.exerciseId)||r.set(t.exerciseId,[]),r.get(t.exerciseId).push({questionId:t.questionId,answers:t.answers});return{exerciseAnswers:Array.from(r.entries()).map(([t,n])=>({exerciseId:t,questionAnswers:n}))}}var Nc="https://edpire.com";function Ka(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 o=document.createElement("div");o.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",o.textContent=t,n.appendChild(o)}e.appendChild(n)}var Qf={mount(e){let{token:r,container:t,baseUrl:n=Nc,onError:a}=e,o=typeof t=="string"?document.querySelector(t):t;if(!o){let l={code:"UNKNOWN",message:`Container not found: ${t}`};return a?.(l),{unmount:()=>{}}}let s=null,i=!1;function c(){if(i)return;i=!0;let l=s;s=null,setTimeout(()=>{l?.unmount()},0)}return(async()=>{o.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let l;try{let d=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(r)}`,{method:"GET"});if(!d.ok){let p=await d.json().catch(()=>({})),g=typeof p.error=="string"?p.error:"Failed to load assessment",h=d.status===401?"TOKEN_INVALID":d.status===403?"ORIGIN_NOT_ALLOWED":d.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";a?.({code:h,message:g});let v=h==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";Ka(o,g,v);return}l=await d.json()}catch{a?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),Ka(o,"Failed to connect to Edpire. Please try again.","");return}i||(o.innerHTML="",s=Ya(o),s.render(Qa.createElement(Ua,{token:r,data:l,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=Ya(n);return a.render(Qa.createElement(Va,t)),{unmount(){let o=a;a=null,setTimeout(()=>o?.unmount(),0)}}}};export{Qf as EdpireAssessment,_c as buildSubmitPayload,Rc as flattenAssessment,Sc as flattenReview,kc as renderQuestion};
63
+ `}),he("div",{style:{background:r},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:en("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 he("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(o){case"dots":return he(Vi,{accent:t});case"pulse":return he(Gi,{accent:t});case"bars":return he(Qi,{accent:t});default:return he(Hi,{accent:t})}})(),he("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&he("p",{className:"text-xs text-slate-500 leading-snug",children:a})]})})]}):null}import{useCallback as Ea,useEffect as Ki,useMemo as Ma,useRef as mt,useState as Xi}from"react";import{BookOpen as Ia,X as Ji}from"lucide-react";import{Fragment as ec,jsx as ce,jsxs as Ne}from"react/jsx-runtime";function rn(e){return e.exercises.flatMap((r,t)=>r.sharedContext&&kr(r.sharedContext)?[{id:r.id,index:t,content:r.sharedContext}]:[])}var La=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Zi(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Ta({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:o,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,footer:p}){let[g,f]=Xi(!1),S=e.annex,x=S?.tabLabel||d("annexDocuments"),b=Ma(()=>rn(e),[e]),k=mt(null),h=mt(null),_=mt(null),u=mt(null),y=()=>(k.current?.getClientRects().length??0)>0,C=Ea((E,q)=>{let v=E?.querySelector(`[data-reference-for="${CSS.escape(q)}"]`);if(!E||!v)return;let M=v.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-12;E.scrollTo({top:M,behavior:La()?"auto":"smooth"}),Zi(v)},[]),P=Ea(E=>{if(y()){C(h.current,E);return}f(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>C(u.current,E)))},[C]),$=E=>{let q=y()?k.current:_.current;y()||f(!1),Array.from(q?.querySelectorAll(`[data-exercise-id="${CSS.escape(E)}"]`)??[]).find(M=>M.getClientRects().length>0)?.scrollIntoView({behavior:La()?"auto":"smooth",block:"start"})};Ki(()=>{let E=k.current;if(!E||b.length===0||typeof IntersectionObserver>"u")return;let q=new Set(b.map(F=>F.id)),v=null,M=new IntersectionObserver(F=>{if(!y())return;let j=F.filter(V=>V.isIntersecting&&q.has(V.target.dataset.exerciseId??"")).sort((V,U)=>V.boundingClientRect.top-U.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!j||j===v||(v=j,C(h.current,j))},{root:E,rootMargin:"0px 0px -60% 0px"});return E.querySelectorAll("[data-exercise-id]").forEach(F=>M.observe(F)),()=>M.disconnect()},[b,C]);let w=Ma(()=>({label:x,showExerciseReference:P}),[x,P]),m=Ne(ec,{children:[S?.items.map(E=>ce(Sr,{item:E},E.id)),S?.items.length&&b.length?ce("div",{className:"border-t border-[#e7e5e0]"}):null,b.map(E=>Ne("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:[ce("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:d("exercise",{index:E.index+1})}),ce(dt,{content:E.content})]},E.id))]}),T=ce(Ye,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c});return ce(st,{value:w,children:Ne("div",{className:xe("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ne("div",{ref:k,className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Ne("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:[Ne("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[ce(Ia,{size:14,className:"text-[#8d93a0]"}),ce("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:x})]}),ce("div",{ref:h,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:m})]}),ce("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),ce("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Ne("div",{className:"px-6 py-5 flex flex-col gap-4",children:[T,p]})})]}),Ne("div",{className:"@6xl:hidden flex-1 relative overflow-hidden",children:[ce("div",{ref:_,className:"absolute inset-0 overflow-y-auto",children:Ne("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[T,p]})}),g&&ce("div",{className:xe("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>f(!1)}),Ne("div",{role:"dialog","aria-label":x,"aria-hidden":!g,className:xe("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",g?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Ne("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[ce("span",{className:"text-sm font-bold text-[#1d2025]",children:x}),ce("button",{onClick:()=>f(!1),"aria-label":d("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:ce(Ji,{size:18})})]}),ce("div",{ref:u,className:"overflow-y-auto max-h-[calc(100vh-8rem)] px-5 pb-5 flex flex-col gap-5",children:m})]})]}),!g&&Ne("button",{onClick:()=>f(!0),"aria-label":x,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:xe("@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:[ce(Ia,{size:12}),ce("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:x})]})]})})}import{useState as rc}from"react";import{BookOpen as $a,Plus as tc,X as nc}from"lucide-react";import{jsx as me,jsxs as qe}from"react/jsx-runtime";function za({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:a,renderSeparator:o,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,onAddAnnex:p,footer:g}){let[f,S]=rc(!1),x=me(Ye,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:a,renderSeparator:o,locale:c});if(f)return me("div",{className:"flex-1 overflow-y-auto",children:qe("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:[x,g]})});let b=_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),p())},k=_=>qe("span",{style:s?{backgroundColor:s}:void 0,className:xe("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:[me(tc,{size:13}),d("annexEmptyCta")]}),h=_=>me("button",{type:"button",onClick:u=>{u.stopPropagation(),S(!0)},"aria-label":d("annexEmptyDismiss"),title:d("annexEmptyDismiss"),className:xe("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:me(nc,{size:15})});return qe("div",{className:xe("@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:[me("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:b,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),me("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:me($a,{size:20})}),me("span",{className:"text-sm font-bold text-[#565b66]",children:d("annexEmptyTitle")}),me("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:d("annexEmptyBody")}),k(!1)]})}),me("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),me("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:[x,g]})})]}),me("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:l},children:[qe("div",{role:"button",tabIndex:0,onClick:p,onKeyDown:b,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:[me("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:me($a,{size:16})}),qe("div",{className:"flex-1 min-w-0",children:[me("div",{className:"text-xs font-bold text-[#565b66]",children:d("annexEmptyTitle")}),me("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:d("annexEmptyBody")})]}),k(!0),h(!1)]}),x,g]})})]})}function ut(e){let r=new Map;for(let t of e){let n=new Map;for(let a of t.questions){let o=new Map;for(let s of a.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),o.set(s.nodeId,i)}n.set(a.questionId,o)}r.set(t.exerciseId,n)}return r}var ac=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),oc=new Set(["blankPool","inlinePool"]);function sc(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 s of n)t(s);return}if(!n||typeof n!="object")return;let{type:a,content:o}=n;if(typeof a=="string"){if(ac.has(a)){r+=1;return}if(oc.has(a))return}o!==void 0&&t(o)};return t(e),r}function Da(e,r){let t=new Map;for(let a of r?.exerciseAnswers??[])for(let o of a.questionAnswers){let s=t.get(o.questionId);s||(s=new Set,t.set(o.questionId,s));for(let i of o.answers)sc(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((a,o)=>{a.questions.forEach((s,i)=>{let c=ic(s.content);c!==0&&(t.get(s.id)?.size??0)<c&&n.push({questionId:s.id,exerciseIndex:o,questionIndex:i,only:a.questions.length===1})})}),n}var cc={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",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI \u2014 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"},lc={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",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA \u2014 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"},dc={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",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 \u2014 \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"},mr={en:cc,fr:lc,ar:dc};function pc(e,r,t){let a=(mr[e]??mr.en)[r]??mr.en[r]??r;return t?Object.entries(t).reduce((o,[s,i])=>o.replace(`{${s}}`,String(i)),a):a}function Fa(e,r){let t=new Intl.PluralRules(e).select(r),n=mr[e]??mr.en;return n[`points.${t}`]??n.points??mr.en.points}function ja(e){return(r,t)=>pc(e,r,t)}function Oa(e){return e==="ar"}function ft(e){return e==="en"?"en":"fr"}var Ba="48rem";function rr(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))}rr(`: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;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)}
64
+ `);import"katex/dist/katex.min.css";rr(`.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}}
65
+ `);rr(`/*! 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}}
66
+ `);import{Fragment as on,jsx as L,jsxs as O}from"react/jsx-runtime";var xc="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 yc(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 Qa(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function Va(e){return e.questions.reduce((r,t)=>r+Qa(t),0)}function We(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var an=5;function Ya(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function vc({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 L("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:Ya(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:L("path",{d:r})})}function wc({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:[L(ur,{size:11}),n("pendingReview")]});let a=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:[L(vc,{outcome:a}),O("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:Ya(a)},children:[We(e.s)," / ",We(e.m)]})]})}return r>0?O("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[We(r)," ",t(r)]}):null}function Ga(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 kc(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 Rc({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,a=new Date(r).getTime()+n,[o,s]=je(()=>Math.max(a-Date.now(),0)),i=ht(t);i.current=t,sn(()=>{if(o<=0){i.current();return}let x=setInterval(()=>{let b=Math.max(a-Date.now(),0);s(b),b<=0&&(clearInterval(x),i.current())},1e3);return()=>clearInterval(x)},[a]);let c=o/n,l=c<.1?"bg-[#fdeeec] text-[#a32b1e] border-[#f6cfc9] animate-pulse":c<.25?"bg-[#fbf1dc] text-[#8a5a08] border-[#f2e2bf]":"bg-[#f5f4f1] text-[#565b66] border-[#e7e5e0]",d=Math.ceil(o/1e3),p=Math.floor(d/3600),g=Math.floor(d%3600/60),f=d%60,S=p>0?`${p}:${String(g).padStart(2,"0")}:${String(f).padStart(2,"0")}`:`${g}:${String(f).padStart(2,"0")}`;return O("span",{className:xe("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-bold tabular-nums transition-colors",l),children:[L(ur,{size:12}),S]})}function gt({assessment:e,meta:r,locale:t="en",branding:n,timeLimitMinutes:a,startedAt:o,initialAnswers:s,onAnswersChange:i,saveState:c,resumed:l=!1,onSubmit:d,review:p,onViewReport:g,reportLabel:f,onBack:S,backLabel:x,allowReset:b,onReset:k,overlayConfig:h,contained:_=!1,layout:u,onClose:y,mediaHandler:C,onAddAnnex:P,fallbackLogoUrl:$}){let w=Fe(()=>ja(t),[t]),m=Ke(W=>Fa(t,W),[t]),T=Oa(t)?"rtl":"ltr",E=ht(null),q=u?.maxWidth??Ba,v=n?.branding?.primaryColor,M=n?.branding?.accentColor,F=n?.branding?.fontFamily,z=n?.branding?.fontUrl,j=n?.branding?.showPoweredBy!==!1;sn(()=>{if(!z||typeof document>"u"||document.querySelector(`link[href="${z}"]`))return;let se=document.createElement("link");se.rel="stylesheet",se.href=z,document.head.appendChild(se)},[z]);let[V,U]=je(()=>p?.answers??s??{exerciseAnswers:[]}),[R]=je(()=>p?new Map:Ga(s)),N=ht(i);N.current=i;let D=Ke(W=>{let se=kc(W,R);U(se),N.current?.(se)},[R]),[H,G]=je(null);sn(()=>{G(Date.now())},[]);let[ge,oe]=je(l&&!p),ae=Fe(()=>{if(H===null||!a||a<=0||!o)return null;let W=new Date(o).getTime()+a*6e4-H;return W>0?Math.max(1,Math.floor(W/6e4)):null},[H,a,o]),[Z,ne]=je(!1),[Ce,Ue]=je(!1),[Y,pn]=je(p?.result??null),mn=Fe(()=>Ga(p?.answers),[p]),[un,_r]=je(null),[xt,fn]=je(!1),hn=ht(!1),ao=Fe(()=>yc(e),[e]),gn=Fe(()=>Ce?Da(e,V):[],[Ce,e,V]),fr=gn.length,oo=Ke(W=>{Ue(!1);let se=E.current?.querySelectorAll(`[data-question-id="${CSS.escape(W)}"]`),Ie=Array.from(se??[]).find(Ae=>Ae.getClientRects().length>0);Ie&&requestAnimationFrame(()=>Ie.scrollIntoView({block:"start",behavior:"smooth"}))},[]),yt=Fe(()=>e.exercises.reduce((W,se)=>W+Va(se),0),[e]),vt=Fe(()=>Y?ut(Y.exerciseFeedback):void 0,[Y]),bn=Fe(()=>{if(!Y)return{};let W={};for(let se of Y.exerciseFeedback){let Ie=0,Ae=0,ue=!1;for(let tr of se.questions)for(let Oe of tr.nodeResults)Ie+=Oe.score,Ae+=Oe.maxScore,Oe.status==="awaiting_review"&&(ue=!0);W[se.exerciseId]={score:Ie,maxScore:Ae,awaiting:ue}}return W},[Y]),xn=Fe(()=>{if(!Y)return{};let W={};for(let se of Y.exerciseFeedback)for(let Ie of se.questions){let Ae=0,ue=0,tr=!1;for(let Oe of Ie.nodeResults)Ae+=Oe.score,ue+=Oe.maxScore,Oe.status==="awaiting_review"&&(tr=!0);W[Ie.questionId]={score:Ae,maxScore:ue,awaiting:tr}}return W},[Y]),so=Ke(async()=>{ne(!0),_r(null);try{let W=await d(V);pn(W),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(W){_r(W instanceof Error?W.message:w("confirmCancel"))}finally{ne(!1),Ue(!1)}},[V,d,w]),yn=Ke(()=>{!Y||!g||g(Y)},[Y,g]),io=Ke(()=>{hn.current||Z||Y||(hn.current=!0,fn(!0),Ue(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{ne(!0),_r(null),d(V).then(W=>{pn(W),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(W=>{_r(W instanceof Error?W.message:"submit_error")}).finally(()=>{ne(!1),fn(!1)})},800))},[V,Z,d,Y]),wt=Ke((W,se,Ie)=>{let Ae=Va(W),ue=bn[W.id],tr=W.questions.length>1,Oe=Wa(se)?qa(se,{renderQuestion:(Ar,St,lo)=>{let Xe=Ar.id,vn=R.get(Xe),wn={...C?{mediaHandler:C}:{},...p?{initialAnswers:mn.get(Xe)??[],readOnly:!0}:vn?{initialAnswers:vn}:{}},kn=Object.keys(wn).length>0&&Wa(St)?qa(St,wn):St;if(!tr)return L("div",{"data-question-id":Xe,children:kn},Xe);let Pr=xn[Xe],po=Qa(Ar);return O("div",{"data-question-id":Xe,children:[O("div",{className:"flex items-center gap-2.5 mb-3",children:[L("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:w("question",{index:lo+1})}),L(wc,{score:Pr?{s:Pr.score,m:Pr.maxScore,awaiting:Pr.awaiting}:null,weight:po,unit:m,t:w})]}),kn]},Xe)},renderSeparator:Ar=>L("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Ar}`)}):se;return O("div",{"data-exercise-id":W.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:[L("span",{className:"text-sm font-bold text-[#1d2025]",children:w("exercise",{index:Ie+1})}),ue?.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:[L(ur,{size:11}),w("pendingReview")]}):ue?O("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:ue.maxScore>0&&ue.score>=ue.maxScore?"#1f8a4c":ue.maxScore>0&&ue.score>0?"#c8810e":ue.maxScore>0?"#d23b2b":"#8d93a0"},children:[We(ue.score)," / ",We(ue.maxScore)]}):Ae>0?O("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",We(Ae)," ",m(Ae)]}):null]}),L("div",{className:"p-4",children:Oe})]},W.id)},[w,m,bn,xn,M,C,p,mn,R]),co=Fe(()=>rn(e).length>0,[e]),kt=Ke(W=>O("div",{className:"flex items-center gap-3 py-2",children:[L("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),L("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:w("exercise",{index:W+2})}),L("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${W}`),[w]),Rt=j?L("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:w("poweredBy")}):null,Me=Y!==null,Nr=Y?.showVerdict!==!1,Cr=Nr?Y?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return L("div",{className:"edpire-scope",style:{display:"contents"},children:O("div",{ref:E,dir:T,className:xe("flex flex-col",_?"h-full":"h-dvh"),style:F?{fontFamily:F}:void 0,children:[L(Pa,{visible:Z&&!xt,hasAiNodes:ao,text:w("evaluating"),aiText:w("aiEvaluating"),contained:_,...h}),xt&&O("div",{className:xe("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",_&&"absolute"),children:[L(ur,{size:40,className:"text-red-300"}),L("p",{className:"text-xl font-black text-white tracking-tight",children:w("timeUp.title")}),L("p",{className:"text-sm text-red-200",children:w("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:[L("img",{src:n?.logoUrl??$??xc,alt:n?.name??"Edpire",width:24,height:24,loading:"lazy",className:"rounded object-contain"}),O("div",{children:[L("h1",{className:"text-sm font-bold text-[#1d2025]",children:r.title}),L("p",{className:"text-[11px] text-[#8d93a0]",children:yt>0&&O("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",We(yt)," ",m(yt)]})})]}),!Me&&H!==null&&a&&a>0&&o&&L(Rc,{timeLimitMinutes:a,startedAt:o,onExpire:io}),!Me&&(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"?L(gc,{size:12}):L(tn,{size:12,className:"animate-spin"}),w(c==="saved"?"answersSaved":"answersSaving")]})]}),O("div",{className:"flex items-center gap-2",children:[b&&O("button",{onClick:k,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:[L(fc,{size:13}),w("reset")]}),(!Me||p)&&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:[L(nn,{size:13}),x??w("back")]}),y&&L("button",{onClick:y,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:L(nn,{size:15})}),!Me&&L("button",{onClick:()=>Ue(!0),disabled:Z,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:Z?O(on,{children:[L(tn,{size:14,className:"animate-spin"}),w("submitting")]}):O(on,{children:[L(Ua,{size:14}),L("span",{className:"sm:hidden",children:w("confirmSubmit")}),L("span",{className:"hidden sm:inline",children:w("submit")})]})})]})]}),un&&L("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:un}),!Me&&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:[L(bc,{size:15,className:"flex-shrink-0"}),w("answersNotSaved")]}),!Me&&ge&&(R.size>0||ae!==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:[ae!==null&&L(ur,{size:15,className:"flex-shrink-0 text-[#565b66]"}),O("span",{className:"flex-1 min-w-0",children:[R.size>0?w("resumeRestored"):w("resumeFresh"),ae!==null&&O(on,{children:[" ",w("resumeTimeLeft",{minutes:ae})]})]}),L("button",{type:"button",onClick:()=>oe(!1),"aria-label":w("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:L(nn,{size:14})})]}),Me&&Y&&(Y.awaitingManualGrading?L("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:L("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:q},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:[L(ur,{size:20,className:"text-[#c8810e] flex-shrink-0"}),L("span",{className:"text-sm font-semibold text-[#8a5a08]",children:Y.aiPending?w("beingMarked"):w("awaitingReview")})]}),L("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),L("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:Y.aiPending?w("beingMarkedDesc"):w("awaitingReviewDesc")}),g&&O("button",{onClick:yn,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:[L(Ha,{size:14}),f??w("viewFullReport")]})]})})}):L("div",{className:xe("flex-shrink-0 border-b",Nr?Y.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:L("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:q},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:[Nr?Y.passed?L(mc,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):L(uc,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,L("span",{className:"text-sm font-semibold",style:{color:Cr},children:Nr?Y.passed?w("assessmentPassed"):w("assessmentNotPassed"):w("yourScore")})]}),L("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:Cr},children:[We(Y.totalScore)," / ",We(Y.maxScore)]}),L("span",{className:"text-sm text-[#8d93a0] font-medium",children:m(Y.maxScore)})]}),O("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[L("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:L("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${Y.percentage}%`,backgroundColor:Cr}})}),O("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Cr},children:[Y.percentage,"%"]})]}),g&&O("button",{onClick:yn,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:[L(Ha,{size:14}),f??w("viewFullReport")]})]})})})),L("div",{className:xe("flex-1 overflow-hidden flex flex-col",xt&&"pointer-events-none opacity-60"),children:e.annex||co?L(Ta,{assessment:e,isSubmitted:Me,setAnswers:D,validationFeedback:vt,renderExercise:wt,renderSeparator:kt,primaryColor:v,contained:_,locale:ft(t),contentMaxWidth:q,t:w,footer:Rt}):P?L(za,{assessment:e,isSubmitted:Me,setAnswers:D,validationFeedback:vt,renderExercise:wt,renderSeparator:kt,primaryColor:v,contained:_,locale:ft(t),contentMaxWidth:q,t:w,onAddAnnex:P,footer:Rt}):L("div",{className:"flex-1 overflow-y-auto",children:O("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:q},children:[L(Ye,{assessment:e,onAnswersChange:Me?void 0:D,validationFeedback:vt,renderExercise:wt,renderSeparator:kt,locale:ft(t)}),Rt]})})}),Ce&&L("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:O("div",{className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[L("h3",{className:"text-base font-bold text-[#1d2025] mb-2",children:w("confirmTitle")}),fr>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:[L(hc,{size:15,className:"flex-shrink-0 mt-px"}),L("span",{children:fr===1?w("unansweredOne"):w("unansweredMany",{count:fr})})]}),O("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[gn.slice(0,an).map(W=>L("li",{children:L("button",{type:"button",onClick:()=>oo(W.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:W.only?w("exercise",{index:W.exerciseIndex+1}):`${w("exercise",{index:W.exerciseIndex+1})} \xB7 ${w("question",{index:W.questionIndex+1})}`})},W.questionId)),fr>an&&L("li",{children:w("unansweredMore",{count:fr-an})})]})]}),L("p",{className:"text-sm text-[#565b66] mb-5",children:w("confirmDescription")}),O("div",{className:"flex gap-3 justify-end",children:[L("button",{onClick:()=>Ue(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:w("confirmCancel")}),O("button",{onClick:so,disabled:Z,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:[Z?L(tn,{size:14,className:"animate-spin"}):L(Ua,{size:14}),w("confirmSubmit")]})]})]})})]})})}function bt(e){return(e??[]).map(r=>({exerciseId:r.exercise_id,questions:r.questions.map(t=>({questionId:t.question_id,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 Nc}from"react/jsx-runtime";function cn(e,r){let t=bt(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 ln(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 Xa({token:e,data:r,baseUrl:t,options:n}){let{locale:a,branding:o,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:d,layout:p,mediaHandler:g,onComplete:f,onError:S}=n,x=o??r.branding??void 0,b=a??r.meta.language??"en",k=Sc(()=>ln(r.assessment),[r]),[h]=_c(()=>new Date().toISOString()),_=Ka(async y=>{let C=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:y})});if(!C.ok){let $=await C.json().catch(()=>({})),w=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 S?.({code:m,message:w}),new Error(w)}let P=await C.json();return f?.(P),cn(P,s)},[t,e,f,S,s]),u=Ka(y=>{if(s)try{let C=new URL(s);C.searchParams.set("submission_id",y.submissionId),y.awaitingManualGrading||(C.searchParams.set("score",String(y.totalScore)),C.searchParams.set("max_score",String(y.maxScore))),window.location.href=C.toString()}catch{window.location.href=s}},[s]);return Nc(gt,{assessment:k,meta:{title:r.meta.title,category:r.meta.category??null},locale:b,branding:x,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:h,onSubmit:_,onViewReport:s?u:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:d,layout:p,mediaHandler:g})}import{useMemo as Ja}from"react";import{jsx as Ac}from"react/jsx-runtime";function Cc(){return Promise.reject(new Error("A review cannot be submitted"))}function Za({review:e,locale:r,branding:t,layout:n,onBack:a,backLabel:o}){let s=Ja(()=>ln(e.assessment),[e]),i=Ja(()=>({answers:e.answers,result:cn({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 Ac(gt,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,onSubmit:Cc,onBack:a,backLabel:o,layout:n})}import Mc from"react";import{createRoot as Ic}from"react-dom/client";import Pc,{useMemo as Ec}from"react";import"katex/dist/katex.min.css";import{jsx as dn}from"react/jsx-runtime";var eo=Pc.memo(function({content:r,onAnswersChange:t,feedback:n,initialAnswers:a,readOnly:o,className:s,dir:i}){let c=Ec(()=>{if(n)return new Map(Object.entries(n))},[n]),l=dn(dr,{content:r,onAnswersChange:t,initialAnswers:a,validationFeedback:c,readOnly:o,className:s});return dn("div",{className:"edpire-scope",style:{display:"contents"},children:i?dn("div",{dir:i,children:l}):l})});function Lc(e){let{container:r,content:t,onAnswersChange:n,feedback:a,initialAnswers:o,readOnly:s,dir:i}=e,c=typeof r=="string"?document.querySelector(r):r;if(!c)throw new Error(`EdpireSDK.renderQuestion: container not found: ${String(r)}`);let l={content:t,onAnswersChange:n,feedback:a,initialAnswers:o,readOnly:s,dir:i},d=Ic(c);function p(){d.render(Mc.createElement(eo,l))}return p(),{setContent(g){l={...l,content:g,feedback:null},p()},setFeedback(g){l={...l,feedback:g},p()},setInitialAnswers(g){l={...l,initialAnswers:g},p()},unmount(){d.unmount()}}}function Tc(e){let r=[],t=0;for(let n of e.exercises)for(let a of n.questions)r.push({exerciseId:n.id,questionId:a.id,content:a.content_ast,points:a.points,sequenceNumber:a.sequence_number,index:t++});return r}function $c(e){let r=ut(bt(e.exercise_feedback)),t=new Map;for(let o of e.answers.exerciseAnswers)for(let s of o.questionAnswers)t.set(s.questionId,s.answers);let n=[],a=0;for(let o of e.assessment.exercises){let s=r.get(o.id);for(let i of o.questions){let c=s?.get(i.id),l=e.exercise_feedback.find(f=>f.exercise_id===o.id)?.questions.find(f=>f.question_id===i.id)?.node_results??[],d=0,p=0,g=!1;for(let f of l)d+=f.score,p+=f.max_score,f.status==="awaiting_review"&&(g=!0);n.push({exerciseId:o.id,questionId:i.id,content:i.content,sharedContext:o.sharedContext??null,answers:t.get(i.id)??[],feedback:c?Object.fromEntries(c):{},score:d,maxScore:p,status:g?"awaiting_review":p===0?"unscored":d>=p?"correct":d>0?"partial":"incorrect",index:a++})}}return n}function zc(e){let r=new Map;for(let t of e)r.has(t.exerciseId)||r.set(t.exerciseId,[]),r.get(t.exerciseId).push({questionId:t.questionId,answers:t.answers});return{exerciseAnswers:Array.from(r.entries()).map(([t,n])=>({exerciseId:t,questionAnswers:n}))}}var Dc="https://edpire.com";function no(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 o=document.createElement("div");o.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",o.textContent=t,n.appendChild(o)}e.appendChild(n)}var oh={mount(e){let{token:r,container:t,baseUrl:n=Dc,onError:a}=e,o=typeof t=="string"?document.querySelector(t):t;if(!o){let l={code:"UNKNOWN",message:`Container not found: ${t}`};return a?.(l),{unmount:()=>{}}}let s=null,i=!1;function c(){if(i)return;i=!0;let l=s;s=null,setTimeout(()=>{l?.unmount()},0)}return(async()=>{o.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let l;try{let d=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(r)}`,{method:"GET"});if(!d.ok){let p=await d.json().catch(()=>({})),g=typeof p.error=="string"?p.error:"Failed to load assessment",f=d.status===401?"TOKEN_INVALID":d.status===403?"ORIGIN_NOT_ALLOWED":d.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";a?.({code:f,message:g});let S=f==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";no(o,g,S);return}l=await d.json()}catch{a?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),no(o,"Failed to connect to Edpire. Please try again.","");return}i||(o.innerHTML="",s=to(o),s.render(ro.createElement(Xa,{token:r,data:l,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=to(n);return a.render(ro.createElement(Za,t)),{unmount(){let o=a;a=null,setTimeout(()=>o?.unmount(),0)}}}};export{oh as EdpireAssessment,zc as buildSubmitPayload,Tc as flattenAssessment,$c as flattenReview,Lc as renderQuestion};