@edpire/sdk 0.12.3 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.mjs CHANGED
@@ -1,5 +1,10 @@
1
- import"./chunk-76CZ6Z7T.mjs";import Hl,{useMemo as Vl}from"react";import{jsx as zr}from"react/jsx-runtime";import{useEffect as Un,useMemo as Cl,useRef as _l}from"react";import Ms from"mitt";var Ze=class{constructor(){this.emitter=Ms(),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()})}},Co="__edpireGlobalAnswerBus",_o=globalThis,ht=_o[Co]??(_o[Co]=new Ze);import{jsx as Ls}from"react/jsx-runtime";import{createContext as Is,useContext as $s}from"react";var No="__edpireAnswerBusContext",Ao=globalThis,Eo=Ao[No]??(Ao[No]=Is(ht));function xe(){return $s(Eo)}function gt({children:e,bus:r=new Ze}){return Ls(Eo.Provider,{value:r,children:e})}import{jsx as ve,jsxs as Tr}from"react/jsx-runtime";import{Fragment as Si,useState as Go,useEffect as wn,useMemo as Ci}from"react";import er from"clsx";import{jsx as V,jsxs as qo}from"react/jsx-runtime";import{jsx as Me,jsxs as dn}from"react/jsx-runtime";import{createContext as Os,useCallback as pn,useContext as js,useEffect as Kr,useMemo as Bs,useRef as Er,useState as br}from"react";import{Pause as qs,Play as Ws,RotateCcw as Us}from"lucide-react";import{jsx as zs}from"react/jsx-runtime";import{createContext as Ds,useContext as Po}from"react";var Ar={submitButton:"Submit",showHint:"Show hint",clickToRemove:"Click to remove",blankAnswerAria:"Your answer",aiEvaluationInProgress:"AI evaluation in progress\u2026",aiEvaluationInProgressAria:"AI evaluation in progress",shortAnswerPlaceholder:"Short answer\u2026",longAnswerPlaceholder:"Write your answer here\u2026",minWordsLabel:e=>`Min: ${e}`,wordBank:"Word Bank",chooseN:e=>`(choose ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Open ${e}`,annexClose:"Close",referenceInPanel:e=>`This exercise's text is in ${e}.`,readReference:"Read it",referenceForExercise:e=>`Exercise ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),tableScrollLeft:"Show the columns on the left",tableScrollRight:"Show the columns on the right",mathChecking:"Checking your answer\u2026",mathCorrect:"Correct",mathIncorrect:"Incorrect",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",audioPlay:"Play",audioPause:"Pause",audioReplay:"Play again",audioSpeed:e=>`Speed ${e}`,audioRate:e=>`${e}\xD7`,audioPosition:"Position in the audio",audioTimeOf:(e,r)=>`${e} of ${r}`,audioPlaysLeft:e=>e===1?"1 play left":`${e} plays left`,audioNoPlaysLeft:"No plays left",audioUnavailable:"This audio can't be played.",recorderUpTo:e=>`Up to ${e}`,recorderRecord:"Record",recorderRecordingAria:"Recording",recorderSaving:e=>`Saving ${e}%`,recorderSaved:"Saved",recorderRecordAgain:"Record again",recorderCancel:"Cancel",recorderFailed:"Your recording wasn't saved. Check your connection.",recorderRetry:"Try again",recorderUnsupported:"This browser can't record. Try an up-to-date Chrome, Safari or Firefox.",recorderUnavailableHere:"Recording isn't available here.",recorderNone:"No recording"};var bt={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",blankAnswerAria:"Votre r\xE9ponse",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",minWordsLabel:e=>`Min. : ${e}`,wordBank:"Banque de mots",chooseN:e=>`(choisir ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Ouvrir ${e}`,annexClose:"Fermer",referenceInPanel:e=>`Le texte de cet exercice est dans \xAB ${e} \xBB.`,readReference:"Le lire",referenceForExercise:e=>`Exercice ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),tableScrollLeft:"Voir les colonnes de gauche",tableScrollRight:"Voir les colonnes de droite",mathChecking:"V\xE9rification de votre r\xE9ponse\u2026",mathCorrect:"Juste",mathIncorrect:"Faux",openResponseTextPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glissez-d\xE9posez des fichiers ici, ou",openResponseDropZoneBrowse:"parcourir",openResponseUploading:"Envoi en cours\u2026",openResponseNoSubmission:"Aucun fichier d\xE9pos\xE9",openResponseFile:"Fichier",openResponseAttachFile:"Joindre un fichier",openResponseAttachFiles:"Joindre des fichiers",openResponseAttachedFiles:"Fichiers joints",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Vid\xE9o",openResponseTypeVideoLink:"Lien vid\xE9o",openResponseVideoLinkPlaceholder:"Coller un lien YouTube ou Vimeo\u2026",openResponseAddVideoLink:"Ajouter",openResponseTapToRecord:"Appuyer pour d\xE9marrer l'enregistrement",openResponseTapToRecordScreen:"Cliquer pour d\xE9marrer l'enregistrement d'\xE9cran",openResponseRequestingPermission:"Demande d'autorisation\u2026",openResponsePermissionDenied:"Acc\xE8s au micro ou \xE0 la cam\xE9ra refus\xE9. Autorisez-le dans les r\xE9glages 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",audioPlay:"\xC9couter",audioPause:"Pause",audioReplay:"R\xE9\xE9couter",audioSpeed:e=>`Vitesse ${e}`,audioRate:e=>`${String(e).replace(".",",")}\xD7`,audioPosition:"Position dans l'audio",audioTimeOf:(e,r)=>`${e} sur ${r}`,audioPlaysLeft:e=>e===1?"1 \xE9coute restante":`${e} \xE9coutes restantes`,audioNoPlaysLeft:"Plus d'\xE9coute restante",audioUnavailable:"Impossible de lire cet audio.",recorderUpTo:e=>`Jusqu'\xE0 ${e}`,recorderRecord:"Enregistrer",recorderRecordingAria:"Enregistrement en cours",recorderSaving:e=>`Envoi ${e}\u202F%`,recorderSaved:"Enregistr\xE9",recorderRecordAgain:"Recommencer",recorderCancel:"Annuler",recorderFailed:"Votre enregistrement n'a pas \xE9t\xE9 envoy\xE9. V\xE9rifiez votre connexion.",recorderRetry:"R\xE9essayer",recorderUnsupported:"Ce navigateur ne peut pas enregistrer. Essayez Chrome, Safari ou Firefox \xE0 jour.",recorderUnavailableHere:"L'enregistrement n'est pas disponible ici.",recorderNone:"Aucun enregistrement"};var yt={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"],tableScrollLeft:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0639\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",tableScrollRight:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0639\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",mathChecking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0642\u0642 \u0645\u0646 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",mathCorrect:"\u0635\u062D\u064A\u062D",mathIncorrect:"\u062E\u0637\u0623",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",audioPlay:"\u062A\u0634\u063A\u064A\u0644",audioPause:"\u0625\u064A\u0642\u0627\u0641 \u0645\u0624\u0642\u062A",audioReplay:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0627\u0633\u062A\u0645\u0627\u0639",audioSpeed:e=>`\u0627\u0644\u0633\u0631\u0639\u0629 ${e}`,audioRate:e=>`${e}\xD7`,audioPosition:"\u0627\u0644\u0645\u0648\u0636\u0639 \u0641\u064A \u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",audioTimeOf:(e,r)=>`${e} \u0645\u0646 ${r}`,audioPlaysLeft:e=>e===1?"\u0628\u0642\u064A \u0627\u0633\u062A\u0645\u0627\u0639 \u0648\u0627\u062D\u062F":e===2?"\u0628\u0642\u064A \u0627\u0633\u062A\u0645\u0627\u0639\u0627\u0646":`\u0628\u0642\u064A\u062A ${e} \u0627\u0633\u062A\u0645\u0627\u0639\u0627\u062A`,audioNoPlaysLeft:"\u0644\u0645 \u064A\u0628\u0642 \u0623\u064A \u0627\u0633\u062A\u0645\u0627\u0639",audioUnavailable:"\u062A\u0639\u0630\u0631 \u062A\u0634\u063A\u064A\u0644 \u0647\u0630\u0627 \u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0635\u0648\u062A\u064A.",recorderUpTo:e=>`\u062D\u062A\u0649 ${e}`,recorderRecord:"\u062A\u0633\u062C\u064A\u0644",recorderRecordingAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0633\u062C\u064A\u0644",recorderSaving:e=>`\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644 ${e}\u066A`,recorderSaved:"\u062A\u0645 \u0627\u0644\u062D\u0641\u0638",recorderRecordAgain:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",recorderCancel:"\u0625\u0644\u063A\u0627\u0621",recorderFailed:"\u0644\u0645 \u064A\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u062A\u0633\u062C\u064A\u0644\u0643. \u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",recorderRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",recorderUnsupported:"\u0644\u0627 \u064A\u0645\u0643\u0646 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D \u0627\u0644\u062A\u0633\u062C\u064A\u0644. \u062C\u0631\u0651\u0628 \u0625\u0635\u062F\u0627\u0631\u064B\u0627 \u062D\u062F\u064A\u062B\u064B\u0627 \u0645\u0646 Chrome \u0623\u0648 Safari \u0623\u0648 Firefox.",recorderUnavailableHere:"\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D \u0647\u0646\u0627.",recorderNone:"\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0633\u062C\u064A\u0644"};var Fs={en:Ar,fr:bt,ar:yt},ln=Ds(null);function se(){return Po(ln)??Ar}function Gr(e){let r=Po(ln);return e&&Fs[e]||r||Ar}function Yr({locale:e,children:r}){let t=Gr(e);return zs(ln.Provider,{value:t,children:r})}var To=Os(null);function xt({initial:e,onChange:r,children:t}){let n=Er({...e??{}}),o=Er(r);o.current=r;let a=Bs(()=>({get:s=>n.current[s]??0,set:(s,i)=>{n.current={...n.current,[s]:i},o.current?.(n.current)}}),[]);return Me(To.Provider,{value:a,children:t})}var un=[.75,1,1.25,1.5],mn=.5;function Pr(e){if(!Number.isFinite(e)||e<0)return"0:00";let r=Math.round(e);return`${Math.floor(r/60)}:${String(r%60).padStart(2,"0")}`}var fn="edpire:audio-play";function Ge({src:e,maxPlays:r,learnerSpeed:t,speed:n,allowSeek:o,durationHint:a,playsKey:s,playsUsed:i,onPlaysUsedChange:c,disabled:l=!1,label:d,className:m}){let p=se(),g=js(To),u=s??e,h=r&&r>0?Math.floor(r):0,v=o!==!1,R=t!==!1,w=n&&n>=.25&&n<=4?n:1,C=Er(null),y=Er(null),[S,k]=br(!1),[_,P]=br(0),[z,b]=br(a&&a>0?a:0),[T,f]=br(!1),[q,A]=br(!1),[L,Q]=br(w),[B,H]=br(()=>i??g?.get(u)??0),X=Er(!1),pe=Er(!1);Kr(()=>{i!==void 0&&H(i)},[i]),Kr(()=>Q(w),[w]),Kr(()=>{C.current&&(C.current.playbackRate=L)},[L]),Kr(()=>{A(!1),f(!1),P(0),k(!1),X.current=!1,a&&a>0||b(0);let O=C.current;O&&O.readyState>=1&&Number.isFinite(O.duration)&&O.duration>0&&b(O.duration)},[e]),Kr(()=>{let O=Y=>{let Z=C.current;Z&&Y.detail!==Z&&!Z.paused&&Z.pause()};return window.addEventListener(fn,O),()=>window.removeEventListener(fn,O)},[]);let ye=h>0&&B>=h&&!X.current,E=h>0?Math.max(0,h-B):null,x=l||q||ye,j=pn(()=>{if(h===0)return!0;if(B>=h)return!1;let O=B+1;return H(O),X.current=!0,i===void 0&&g?.set(u,O),c?.(O),!0},[h,B,i,g,u,c]),F=pn(()=>{let O=C.current;if(!O||l||q)return;if(!O.paused){O.pause();return}(T||O.currentTime<mn)&&!X.current&&!j()||((T||O.currentTime>=(O.duration||1/0))&&(O.currentTime=0),f(!1),O.playbackRate=L,window.dispatchEvent(new CustomEvent(fn,{detail:O})),O.play().catch(()=>k(!1)))},[l,q,T,j,L]),D=z>0?z:0,re=D>0?Math.min(1,_/D):0,ae=pn(O=>{let Y=C.current;if(!Y||!v||x||D===0)return;let Z=Math.max(0,Math.min(D,O));if(h>0&&Z<mn&&_>=mn&&X.current&&(X.current=!1,!Y.paused&&!j())){Y.pause();return}Y.currentTime=Z,P(Z),f(!1)},[v,x,D,h,_,j]),ie=O=>{let Y=y.current;if(!Y)return 0;let Z=Y.getBoundingClientRect(),Te=getComputedStyle(Y).direction==="rtl"?(Z.right-O)/Z.width:(O-Z.left)/Z.width;return Math.max(0,Math.min(1,Te))},ce=O=>{!v||x||D===0||(O.preventDefault(),pe.current=!0,O.currentTarget.setPointerCapture(O.pointerId),ae(ie(O.clientX)*D))},U=O=>{pe.current&&ae(ie(O.clientX)*D)},K=()=>{pe.current=!1},de=O=>{if(!v||x||D===0)return;let Y=y.current?getComputedStyle(y.current).direction==="rtl":!1,Z=5,me=null;O.key==="ArrowRight"?me=_+(Y?-Z:Z):O.key==="ArrowLeft"?me=_+(Y?Z:-Z):O.key==="ArrowUp"?me=_+Z:O.key==="ArrowDown"?me=_-Z:O.key==="Home"?me=0:O.key==="End"&&(me=D),me!==null&&(O.preventDefault(),ae(me))},te=()=>{let O=un.indexOf(L);Q(un[(O+1)%un.length]??1)},ee=(S||_>0)&&!T&&D>0,le=Pr(ee?D-_:D),ze=S?Me(qs,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0}):T&&!ye?Me(Us,{size:18,"aria-hidden":!0}):Me(Ws,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0,style:{marginInlineStart:2}}),He=S?p.audioPause:T?p.audioReplay:p.audioPlay;return dn("span",{role:"group","aria-label":d,className:`edp-audio${x?" edp-audio--off":""}${m?` ${m}`:""}`,"data-audio-player":"",children:[dn("span",{className:"edp-audio-bar",children:[Me("button",{type:"button",className:"edp-audio-play",onClick:F,disabled:x,"aria-label":He,children:ze}),dn("span",{ref:y,className:`edp-audio-track${v&&!x?" edp-audio-track--seek":""}`,role:"slider",tabIndex:v&&!x?0:-1,"aria-label":p.audioPosition,"aria-valuemin":0,"aria-valuemax":Math.round(D),"aria-valuenow":Math.round(_),"aria-valuetext":p.audioTimeOf(Pr(_),Pr(D)),"aria-disabled":!v||x,onPointerDown:ce,onPointerMove:U,onPointerUp:K,onPointerCancel:K,onKeyDown:de,children:[Me("span",{className:"edp-audio-rail",children:Me("span",{className:"edp-audio-fill",style:{width:`${re*100}%`}})}),v&&!x&&D>0&&Me("span",{className:"edp-audio-thumb",style:{insetInlineStart:`${re*100}%`}})]}),Me("span",{className:"edp-audio-time",dir:"ltr",children:le}),R&&!q&&Me("button",{type:"button",className:"edp-audio-speed",dir:"ltr",onClick:te,disabled:l,"aria-label":p.audioSpeed(p.audioRate(L)),children:p.audioRate(L)})]}),(q||E!==null)&&Me("span",{className:"edp-audio-note","aria-live":"polite",children:Me("bdi",{children:q?p.audioUnavailable:E===0&&!X.current?p.audioNoPlaysLeft:p.audioPlaysLeft(E??0)})}),Me("audio",{ref:C,src:e||void 0,preload:"metadata",onLoadedMetadata:O=>{let Y=O.currentTarget;Y.playbackRate=L,Number.isFinite(Y.duration)&&Y.duration>0?b(Y.duration):Hs(Y,Z=>b(me=>me>0?me:Z))},onDurationChange:O=>{let Y=O.currentTarget.duration;Number.isFinite(Y)&&Y>0&&b(Y)},onTimeUpdate:O=>{pe.current||P(O.currentTarget.currentTime)},onPlay:()=>k(!0),onPause:()=>k(!1),onEnded:()=>{k(!1),f(!0),X.current=!1,P(D)},onError:()=>{e&&A(!0)}})]})}function Hs(e,r){let t=()=>{e.removeEventListener("timeupdate",t),Number.isFinite(e.duration)&&e.duration>0&&r(e.duration),e.currentTime=0};e.addEventListener("timeupdate",t);try{e.currentTime=1e101}catch{e.removeEventListener("timeupdate",t)}}import Vs from"katex";import"katex/dist/contrib/mhchem.js";var Qs={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function yr(e,r,t=!0){try{return Vs.renderToString(e,{displayMode:r,output:t?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Qs,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 fe(e){return{width:I(e),height:I(e)}}function We(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}import{createContext as Gs}from"react";var Xr=Gs(!1),vt="1px solid #d1d5db",Ys="#f3f4f6",Ks="#e3e1dc",Xs="var(--card, #fff)",xr="edp-table-first",Mo={overflowX:"auto",margin:`${I("1.25rem")} 0`},Lo={left:!1,right:!1,held:0,rtl:!1};function Io(e,r,t,n=0){return{left:r.left<e.left-1,right:r.right>e.right+1,held:n,rtl:t}}function $o(e,r){return Math.max(80,Math.round((e-r)*.8))}var hn={borderCollapse:"separate",borderSpacing:0,width:"100%",tableLayout:"auto",fontSize:I("0.875rem"),lineHeight:1.3,borderBlockStart:vt,borderInlineStart:vt};function Jr(e){let r=e.gray?Ks:e.header?Ys:e.sticky?Xs:void 0;return{borderBlockEnd:vt,borderInlineEnd:vt,padding:`${I("4px")} ${I("6px")}`,verticalAlign:"middle",overflowWrap:"normal",wordBreak:"normal",hyphens:"manual",...r?{background:r}:{},...e.header?{fontWeight:600}:{},...e.sticky?{position:"sticky",insetInlineStart:0,zIndex:1}:{}}}function Zr(e){return Object.entries(e).map(([r,t])=>`${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${t}`).join(";")}function gn(e){let r=[],t=new Set,n=[];(e??[]).forEach((s,i)=>{let c=0;(s.content??[]).forEach(l=>{for(;n[i]?.[c];)c++;let d=Math.max(1,l.attrs?.colspan??1),m=Math.max(1,l.attrs?.rowspan??1);for(let p=i;p<i+m;p++){let g=n[p]??(n[p]=[]);for(let u=c;u<c+d;u++)g[u]=!0}for(let p=0;p<d;p++){let g=l.attrs?.colwidth?.[p];g&&r[c+p]==null&&(r[c+p]=g)}c===0&&d===1&&t.add(l),c+=d})});let o=n.reduce((s,i)=>Math.max(s,i.length),0);return{columnWidths:r.some(s=>s!=null)?Array.from({length:o},(s,i)=>r[i]??null):[],stickyCells:t}}function bn(e){return e.replace(/(\d) (?=\d)/g,"$1\xA0").replace(/(\d) (?=[\p{L}%\p{Sc}]{1,3}(?![\p{L}\p{N}]))/gu,"$1\xA0")}import{jsx as Ye,jsxs as yn}from"react/jsx-runtime";import{useCallback as Js,useEffect as Zs,useLayoutEffect as ei,useRef as ri,useState as ti}from"react";var ni=typeof window<"u"?ei:Zs;function zo({side:e}){return Ye("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:Ye("path",{d:e==="left"?"M15 6l-6 6 6 6":"M9 6l6 6-6 6"})})}function Do({children:e}){let r=se(),t=ri(null),[n,o]=ti(Lo),a=Js(()=>{let m=t.current,p=m?.querySelector("table");if(!m||!p)return;let g=m.querySelector(`.${xr}`),u=Io(m.getBoundingClientRect(),p.getBoundingClientRect(),getComputedStyle(m).direction==="rtl",g?g.getBoundingClientRect().width:0);o(h=>h.left===u.left&&h.right===u.right&&h.held===u.held&&h.rtl===u.rtl?h:u)},[]);ni(()=>{let m=t.current;if(!m)return;a(),m.addEventListener("scroll",a,{passive:!0});let p=typeof ResizeObserver<"u"?new ResizeObserver(a):null;p?.observe(m);let g=m.querySelector("table");return g&&p?.observe(g),()=>{m.removeEventListener("scroll",a),p?.disconnect()}},[a]);let s=m=>{let p=t.current;p&&p.scrollBy({left:m*$o(p.clientWidth,n.held),behavior:"smooth"})},i=n.left||n.right,c=m=>i?Ye("div",{className:`edp-table-arrows edp-table-arrows--${m}`,children:yn("span",{dir:"ltr",className:"edp-table-arrows__pair",children:[Ye("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(-1),disabled:!n.left,"aria-label":r.tableScrollLeft,children:Ye(zo,{side:"left"})}),Ye("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(1),disabled:!n.right,"aria-label":r.tableScrollRight,children:Ye(zo,{side:"right"})})]})}):null,l=n.rtl?0:n.held,d=n.rtl?n.held:0;return yn("div",{className:"edp-table-frame",style:{margin:`${I("1.25rem")} 0`},children:[c("top"),yn("div",{style:{position:"relative"},children:[Ye("div",{ref:t,className:"edp-table-scroll",style:{overflowX:"auto"},children:e}),n.left&&Ye("span",{className:"edp-table-shade edp-table-shade--left",style:{left:l},"aria-hidden":"true"}),n.right&&Ye("span",{className:"edp-table-shade edp-table-shade--right",style:{right:d},"aria-hidden":"true"})]}),c("bottom")]})}var Fo={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"}},Oo={border:"#2563eb",background:"#e0f2fe"},jo={border:"#dc2626",background:"#fee2e2"};function oi(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||Oo.border}`,background:e?.background||Oo.background,borderRadius:I("4px"),padding:"0.17em 0.37em"}}function ai(e){let r=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||jo.border}`,background:e?.background||jo.background,borderRadius:r,padding:"0.15em 0.45em"}}function si(e,r){if(!(!e&&!r))return{...e?{textAlign:e}:{},...r?{margin:0}:{}}}function De(e,r,t){return V("div",{className:"exercise-content",children:e.content.map((n,o)=>Ne(n,`node-${o}`,r,t))})}var ii=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,ci=new Set(["blank","inlineChoiceSet"]);function Bo(e,r,t,n){let o=[],a=e??[];for(let s=0;s<a.length;s++){let i=a[s],c=a[s+1],l=ci.has(i.type)&&c?.type==="text"?ii.exec(c.text??"")?.[0]:void 0;if(!l||!c){o.push(Ne(i,`${r}-${s}`,t,n));continue}let d=(c.text??"").slice(l.length);o.push(qo("span",{style:{whiteSpace:"nowrap"},children:[V("span",{style:{whiteSpace:"normal"},children:Ne(i,`${r}-${s}-a`,t,n)}),Ne({...c,text:l},`${r}-${s}-p`,t,n)]},`${r}-${s}`)),d&&o.push(Ne({...c,text:d},`${r}-${s+1}`,t,n)),s++}return o}function Ne(e,r,t,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return V(kt,{node:e,validationFeedback:t?.get(e.id)},r);case"blank":return e.attrs.mode==="typed"?V(Rt,{node:e,validationFeedback:t?.get(e.id)},r):V(St,{node:e,validationFeedback:t?.get(e.id)},r);case"blankPool":return V(Ct,{node:e},r);case"inlinePool":return V(_t,{node:e},r);case"matchingSet":return V(Nt,{node:e,validationFeedback:t?.get(e.id)},r);case"aiAnswerInput":return V(At,{node:e,validationFeedback:t?.get(e.id)},r);case"openResponseNode":return V(Et,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler},r);case"mathResponse":return V(Pt,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:t?.get(e.id),readOnly:n?.readOnly},r);case"codingResponse":return V(Tt,{node:e,validationFeedback:t?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},r);case"aiEvaluationConfig":return null;case"paragraph":{let o=e.attrs,a=o?.textAlign,s=o?.dir||void 0;return V("p",{dir:s,style:si(a,n?.inTable),children:Bo(e.content,r,t,n)},r)}case"heading":{let o=e.attrs.level??1,a=`h${o}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,l=Fo[o]??Fo[3];return V(a,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:Bo(e.content,r,t,n)},r)}case"blockquote":{let o=e.attrs,a=o?.dir||void 0,s=o?.textAlign;return V("blockquote",{dir:a,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...s?{textAlign:s}:{}},children:e.content?.map((i,c)=>Ne(i,`${r}-${c}`,t,n))},r)}case"text":{let o=e,a=n?.inTable?bn(o.text??""):o.text??"",s=o.marks??[];if(s.length===0)return V("span",{children:a},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=a;for(let l of s)switch(l.type){case"bold":c=V("strong",{children:c});break;case"italic":c=V("em",{children:c});break;case"underline":c=V("u",{children:c});break;case"strike":c=V("s",{children:c});break;case"code":c=V("code",{children:c});break;case"subscript":c=V("sub",{children:c});break;case"superscript":c=V("sup",{children:c});break;case"boxedText":c=V("span",{style:oi(l.attrs),children:c});break;case"circleText":c=V("span",{style:ai(l.attrs),children:c});break}return V("span",{style:Object.keys(i).length>0?i:void 0,children:c},r)}case"hardBreak":return V("br",{},r);case"resizableImage":return V("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:We(e.attrs?.width||void 0)??"auto",height:We(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"resizableAudio":{let o=e.attrs??{src:""},a=n?.readOnly===!0;return V(Ge,{src:o.src||"",maxPlays:a?null:o.maxPlays,learnerSpeed:o.learnerSpeed,speed:o.speed,allowSeek:a?null:o.allowSeek},r)}case"resizableVideo":return V("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:We(e.attrs?.width||void 0)??"auto",height:We(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},r);case"youtubeEmbed":return V("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:We(e.attrs?.width||480),height:We(e.attrs?.height||270)}},r);case"inlineMath":return V("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:yr(e.attrs?.latex??"",!1,!0)}},r);case"blockMath":return V("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:yr(e.attrs?.latex??"",!0,!0)}},r);case"variable":return V("span",{className:"variable",children:`{${e.attrs?.name}}`},r);default:{let o=e;if(o.type==="bulletList")return V("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Ne(a,`${r}-${s}`,t,n))},r);if(o.type==="orderedList")return V("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Ne(a,`${r}-${s}`,t,n))},r);if(o.type==="listItem")return V("li",{children:o.content?.map((a,s)=>Ne(a,`${r}-${s}`,t,n))},r);if(o.type==="table"){let a=gn(o.content),s={...n,inTable:!0,stickyCells:a.stickyCells};return V(Do,{children:qo("table",{style:hn,children:[a.columnWidths.length>0&&V("colgroup",{children:a.columnWidths.map((i,c)=>V("col",{style:i?{width:I(i)}:void 0},c))}),V("tbody",{children:o.content?.map((i,c)=>Ne(i,`${r}-${c}`,t,s))})]})},r)}return o.type==="tableRow"?V("tr",{children:o.content?.map((a,s)=>Ne(a,`${r}-${s}`,t,n))},r):o.type==="tableCell"?V("td",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?xr:void 0,style:Jr({header:!1,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:V(Xr.Provider,{value:!0,children:o.content?.map((a,s)=>Ne(a,`${r}-${s}`,t,n))})},r):o.type==="tableHeader"?V("th",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?xr:void 0,style:Jr({header:!0,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:V(Xr.Provider,{value:!0,children:o.content?.map((a,s)=>Ne(a,`${r}-${s}`,t,n))})},r):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function ue(e,r){return e.map(t=>{if(t.type==="text"){let n=vr(r?.inTable?bn(t.text??""):t.text??""),o=t.marks??[],a=[];for(let s of o)s.type==="textStyle"&&(s.attrs?.color&&a.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&a.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&a.push(`font-family:${s.attrs.fontFamily}`));a.length>0&&(n=`<span style="${a.join(";")}">${n}</span>`);for(let s of o)switch(s.type){case"bold":n=`<strong>${n}</strong>`;break;case"italic":n=`<em>${n}</em>`;break;case"underline":n=`<u>${n}</u>`;break;case"strike":n=`<s>${n}</s>`;break;case"code":n=`<code>${n}</code>`;break;case"subscript":n=`<sub>${n}</sub>`;break;case"superscript":n=`<sup>${n}</sup>`;break;case"boxedText":{let i=s.attrs?.border||"#2563eb",c=s.attrs?.background||"#e0f2fe";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${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?ue(t.content,r):"",o=t.attrs?.dir,a=t.attrs?.textAlign,s=o?` dir="${o}"`:"",i=[a?`text-align:${a}`:"",r?.inTable?"margin:0":""].filter(Boolean).join(";"),c=i?` style="${i}"`:"";return r?.stripParagraphs?n:`<p${s}${c}>${n}</p>`}if(t.type==="hardBreak")return"<br/>";if(t.type==="table"){let n=gn(t.content),o=t.content?ue(t.content,{...r,inTable:!0,stickyCells:n.stickyCells}):"",a=n.columnWidths.length?`<colgroup>${n.columnWidths.map(s=>s?`<col style="width:${I(s)}">`:"<col>").join("")}</colgroup>`:"";return`<div style="${Zr(Mo)}"><table style="${Zr(hn)}">${a}<tbody>${o}</tbody></table></div>`}if(t.type==="tableRow")return`<tr>${t.content?ue(t.content,r):""}</tr>`;if(t.type==="tableCell"){let n=t.content?ue(t.content,r):"",o=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",a=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"",s=!!r?.stickyCells?.has(t),i=s?` class="${xr}"`:"";return`<td${o}${a}${i} style="${Zr(Jr({header:!1,gray:!!t.attrs?.gray,sticky:s}))}">${n}</td>`}if(t.type==="tableHeader"){let n=t.content?ue(t.content,r):"",o=t.attrs?.colspan?` colspan="${t.attrs.colspan}"`:"",a=t.attrs?.rowspan?` rowspan="${t.attrs.rowspan}"`:"",s=!!r?.stickyCells?.has(t),i=s?` class="${xr}"`:"";return`<th${o}${a}${i} style="${Zr(Jr({header:!0,gray:!!t.attrs?.gray,sticky:s}))}">${n}</th>`}if(t.type==="bulletList")return`<ul style="list-style-type:disc;padding-left:1.5em">${t.content?ue(t.content,r):""}</ul>`;if(t.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${t.content?ue(t.content,r):""}</ol>`;if(t.type==="listItem")return`<li>${t.content?ue(t.content,r):""}</li>`;if(t.type==="blockquote"){let n=t.content?ue(t.content,r):"";return`<blockquote${t.attrs?.dir?` dir="${t.attrs.dir}"`:""} style="border-inline-start:3px solid #d6d3cc;padding-inline-start:1em;margin:0.75em 0;color:#565b66;font-style:italic">${n}</blockquote>`}if(t.type==="resizableImage"){let n=t.attrs??{},o=wt(n.width),a=wt(n.height);return`<img src="${vr(n.src??"")}" alt="${vr(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"/>`}if(t.type==="resizableAudio"){let n=t.attrs??{};return`<audio controls preload="metadata" src="${vr(n.src??"")}" style="display:inline-block;vertical-align:middle;width:${I("260px")};max-width:100%;height:${I("36px")}"></audio>`}if(t.type==="resizableVideo"){let n=t.attrs??{},o=wt(n.width),a=wt(n.height);return`<video src="${vr(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"></video>`}if(t.type==="youtubeEmbed"){let n=t.attrs??{};return`<iframe src="https://www.youtube.com/embed/${vr(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:${We(n.width||480)};height:${We(n.height||270)}"></iframe>`}return t.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${yr(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">${yr(t.attrs?.latex??"",!0,!0)}</div>`:t.type==="variable"?`<span class="variable">{${vr(t.attrs?.name??"")}}</span>`:""}).join("")}function wt(e){return e==null||e===""?null:We(e)??null}function vr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as li}from"react/jsx-runtime";import{createContext as di,useContext as Wo,useMemo as Uo}from"react";var pi={sm:.875,md:1,lg:1.25,xl:1.5},xn=di(null);function ui(e,r){let t={...e??{}};if(r)for(let[n,o]of Object.entries(r))o!==void 0&&(t[n]=o);return t}function mi(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?pi[e]??1:1}function Fe(e){let r=e??{};return{scale:mi(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 Le(e){let r=Wo(xn);return Uo(()=>ui(r,e),[r,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function Ie(){let e=Wo(xn);return Uo(()=>Fe(e),[e])}function $e({display:e,children:r}){let t=Le(e);return li(xn.Provider,{value:t,children:r})}function Oe(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function wr(){let{motion:e}=Ie();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function fi(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 hi(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 et(e,r){let t=[...e],n=hi(fi(r));for(let o=t.length-1;o>0;o--){let a=Math.floor(n()*(o+1));[t[o],t[a]]=[t[a],t[o]]}return t}import{Fragment as Ho,jsx as he,jsxs as gi}from"react/jsx-runtime";import{useState as Mt,useEffect as Qo,useRef as Vo,useLayoutEffect as bi,useCallback as yi}from"react";import{createPortal as xi}from"react-dom";import vi from"clsx";var wi=typeof window<"u"?bi:Qo;function vn({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return he(Ho,{children:e.text});let r=e.text||"";for(let t of e.marks)t.type==="bold"?r=he("strong",{children:r}):t.type==="italic"?r=he("em",{children:r}):t.type==="underline"?r=he("u",{children:r}):t.type==="strike"?r=he("s",{children:r}):t.type==="textStyle"&&t.attrs?.color&&(r=he("span",{style:{color:t.attrs.color},children:r}));return he(Ho,{children:r})}return e.type==="paragraph"?he("span",{className:"block",children:e.content?.map((r,t)=>he(vn,{node:r},t))??he("br",{})}):e.type==="hardBreak"?he("br",{}):e.content?he("span",{className:"block",children:e.content.map((r,t)=>he(vn,{node:r},t))}):null}function ki({nodes:e}){return he("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((r,t)=>he(vn,{node:r},t))})}function Ri(e,r,t,n=8){let o=e.top-r.height-n;o<n&&(o=e.bottom+n);let a=e.left+e.width/2-r.width/2;return a=Math.max(n,Math.min(a,t-r.width-n)),{top:o,left:a}}function lr({hint:e}){let r=se(),[t,n]=Mt(!1),[o,a]=Mt(!1),[s,i]=Mt(null),[c,l]=Mt({}),d=Vo(null),m=Vo(null);Qo(()=>{if(!o)return;let R=w=>{let C=w.target;d.current&&!d.current.contains(C)&&m.current&&!m.current.contains(C)&&(a(!1),n(!1))};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[o]);let p=yi(()=>{let R=d.current,w=m.current;!R||!w||i(Ri(R.getBoundingClientRect(),w.getBoundingClientRect(),window.innerWidth))},[]);wi(()=>{if(!t){i(null);return}let R=d.current;if(R){let w=getComputedStyle(R);l({direction:w.direction,fontFamily:w.fontFamily,"--edp-scale":w.getPropertyValue("--edp-scale").trim()||"1"})}return p(),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[t,p]);let g=()=>n(!0),u=()=>{o||n(!1)},h=R=>{R.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},v=t&&typeof document<"u"?xi(he("span",{className:"edpire-scope",style:{...c,display:"contents"},children:he("span",{ref:m,role:"tooltip",className:"player-blank-hint-pop",onClick:R=>R.stopPropagation(),onMouseEnter:g,onMouseLeave:u,style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:he(ki,{nodes:e})})}),document.body):null;return gi("span",{ref:d,className:"relative inline-flex items-center align-middle",onMouseEnter:g,onMouseLeave:u,children:[he("button",{type:"button",onClick:h,className:vi("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":r.showHint,"aria-expanded":t,children:"?"}),v]})}function Ke({hint:e}){return!e||e.length===0?null:he(lr,{hint:e})}function _i(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}var Ni=e=>e.replace(/ {2,}/g,r=>"&nbsp;".repeat(r.length-1)+" "),Ai=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function Xo(e){return(e??[]).some(r=>Ai.has(r?.type)||Xo(r?.content))}var Yo=()=>ve("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:ve("path",{d:"M5 13l4 4L19 7"})}),Ko=()=>ve("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:ve("path",{d:"M6 6l12 12M18 6L6 18"})});function kt({node:e,validationFeedback:r}){let t=xe(),n=se(),o=Ie(),a=wr(),{id:s,content:i,attrs:c}=e,l=c.shuffle??!1,d="prompt"in c?c.prompt:void 0,m="separator"in c?c.separator??"/":"/",p="pickLimit"in c&&c.pickLimit?c.pickLimit:1,g=c.hideCount===!0,u=g||p>1,h=!g&&p>1,v="layout"in c?c.layout??"row":"row",R=e.type==="inlineChoiceSet",w=JSON.stringify(i),C=l&&o.shuffleSeed!==void 0,y=Ci(()=>C?et(i,`${o.shuffleSeed}:${s}`):null,[C,o.shuffleSeed,s,w]),[S,k]=Go(i);wn(()=>{C||k(l?_i(i):i)},[l,C,w]);let _=y??S,[P,z]=Go(new Set),b=r?.showFeedback??!1,T=r?.correctChoiceIds||[];wn(()=>{let x=j=>{let D=j.answers.find(re=>re.nodeId===s&&re.type==="choiceSet");D&&"selectedIds"in D.answer&&z(new Set(D.answer.selectedIds))};return t.on("answers:prefill",x),()=>t.off("answers:prefill",x)},[s,t]),wn(()=>{t.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(P)}}})},[P,s,t]);let f=x=>{b||z(j=>{let F=new Set(j);return u?F.has(x)?F.delete(x):(g||F.size<p)&&F.add(x):F.has(x)?F.delete(x):(F.clear(),F.add(x)),F})},q=x=>Ni(ue(x.content)),A=x=>{let j=P.has(x),F=T.includes(x);return b?F&&j?"correct":F&&!j?"correct-unchosen":!F&&j?"incorrect":"muted":j?"selected":"idle"},L={idle:"",selected:"player-choice--selected",correct:er("player-choice--correct",a.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:er("player-choice--incorrect",a.shake),muted:"player-choice--muted"},Q={idle:"",selected:"player-inline-choice--selected",correct:er("player-inline-choice--correct",a.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:er("player-inline-choice--incorrect",a.shake),muted:"player-inline-choice--muted"};if(R)return Tr("span",{className:"inline-choice",children:[d&&Tr("span",{className:"mr-2 font-medium",children:[d,h?ve("span",{className:"ms-1 opacity-60",children:n.chooseN(p)}):null]}),_.map((x,j)=>Tr(Si,{children:[ve("button",{type:"button",disabled:b,onClick:()=>f(x.id),className:er("player-inline-choice",Q[A(x.id)]),"aria-pressed":P.has(x.id),dangerouslySetInnerHTML:{__html:q(x)}}),j<_.length-1&&ve("span",{className:"mx-1",children:m})]},x.id)),c.hint&&c.hint.length>0&&ve(lr,{hint:c.hint})]});let B=o.layoutBy==="box",H=o.choiceColumns?Math.min(o.choiceColumns,_.length):0,X=H?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${H}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},pe=_.some(x=>Xo(x.content)),ye=o.choiceLabels==="letters",E=x=>n.choiceLetters[x]??String(x+1);return Tr("div",{className:er("cs-player my-4 space-y-3",B&&"cs-player--box"),children:[d&&Tr("p",{className:"font-medium",children:[d,h?ve("span",{className:"ms-2 text-sm opacity-70",children:n.chooseN(p)}):null]}),c.hint&&c.hint.length>0&&ve(lr,{hint:c.hint}),ve("div",{className:er("cs-player__grid",v==="row"&&"cs-player__grid--row"),style:X,children:_.map((x,j)=>{let F=A(x.id),D=F==="incorrect"?"incorrect":F==="correct"||F==="correct-unchosen"?"correct":null;return Tr("button",{type:"button",disabled:b,onClick:()=>f(x.id),className:er("player-choice",pe&&"player-choice--tile",L[F]),"aria-pressed":P.has(x.id),children:[ve("span",{className:er("player-choice__mark",u?"player-choice__mark--box":"player-choice__mark--radio",ye&&"player-choice__mark--letter"),children:ye?E(j):F==="incorrect"?ve(Ko,{}):ve(Yo,{})}),ve("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:q(x)}}),ye&&D&&ve("span",{className:`player-choice__verdict player-choice__verdict--${D}`,"aria-hidden":"true",children:D==="incorrect"?ve(Ko,{}):ve(Yo,{})})]},x.id)})})]})}import{jsx as rr,Fragment as Ei,jsxs as kn}from"react/jsx-runtime";import{useContext as Pi,useState as Ti,useEffect as Rn,useRef as Mi,useCallback as Li}from"react";import kr from"clsx";function Rt({node:e,validationFeedback:r}){let t=xe(),n=se(),o=wr(),{id:a,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,d=Mi(null),m=i.trim().split(/\s+/).filter(Boolean).length,p=Pi(Xr),g=!p&&c==="auto"&&m>=4,[u,h]=Ti(""),v=r?.showFeedback??!1,R=r?.state,w=R==="validating",C=r?.displayAnswer,y=r?.message;Rn(()=>{let P=z=>{let T=z.answers.find(f=>f.nodeId===a&&f.type==="blank");T&&"mode"in T.answer&&T.answer.mode==="typed"&&"text"in T.answer&&h(T.answer.text)};return t.on("answers:prefill",P),()=>t.off("answers:prefill",P)},[a,t]),Rn(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:u}}})},[u,a,t]);let S=P=>{h(P.target.value)},k=Li(()=>{let P=d.current;P&&(P.style.height="auto",P.style.height=`${P.scrollHeight}px`)},[]);Rn(()=>{k()},[u,k]);let _=v&&!w;return kn("span",{className:p?"player-blank-cell":kr("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",g&&"w-full"),children:[rr("span",{className:p?"player-blank-cell__box":kr("relative inline-block shrink-0 min-w-0 max-w-full",g&&"w-full flex-1"),children:_?rr("span",{className:kr("player-typed-blank-feedback",p&&"player-typed-blank-feedback--cell",g&&"w-full",R==="correct"&&kr("player-typed-blank-feedback--correct",o.hop),R==="partial"&&"player-typed-blank-feedback--partial",R==="incorrect"&&kr("player-typed-blank-feedback--incorrect",o.wobble)),children:u||rr("span",{className:"opacity-40",children:i})}):kn(Ei,{children:[rr("textarea",{ref:d,"aria-label":n.blankAnswerAria,placeholder:i,value:u,onChange:S,disabled:v,rows:1,wrap:p?"off":void 0,className:kr("player-typed-blank",p&&"player-typed-blank--cell",g&&"w-full",w&&"player-typed-blank--pending"),style:p?void 0:c!=="auto"?{width:c}:g?{width:"100%"}:{width:`${Math.max(7,u.length+1)}ch`,maxWidth:"100%"}}),!u&&!w&&!p&&rr("span",{className:"absolute right-1 top-1/2 -translate-y-1/2 pointer-events-none text-sm",style:{color:"var(--ink-faint, #8d93a0)"},children:"\u270E"}),w&&rr("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:rr("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),v&&R==="incorrect"&&C&&kn("span",{className:"player-blank-reveal",children:["(",C,")"]}),v&&y&&rr("span",{className:kr("player-blank-feedback",R==="correct"&&"player-blank-feedback--correct",R==="partial"&&"player-blank-feedback--partial",R==="incorrect"&&"player-blank-feedback--incorrect"),children:y}),l&&l.length>0&&rr(lr,{hint:l})]})}import{jsx as It,Fragment as ra,jsxs as Cn}from"react/jsx-runtime";import{useEffect as ta}from"react";import $t from"clsx";import{useDroppable as ji,useDndContext as Bi}from"@dnd-kit/core";import{jsx as Ii}from"react/jsx-runtime";import{createContext as $i,useCallback as dr,useContext as zi,useEffect as Di,useMemo as Jo,useRef as Fi,useState as Sn}from"react";import{useDndMonitor as Oi}from"@dnd-kit/core";var ea=$i(null);function Xe(){let e=zi(ea);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function Zo(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 Lt({children:e,initialAnswers:r}){let t=xe(),n=Jo(()=>Zo(r),[r]),[o,a]=Sn(n),[s,i]=Sn({}),[c,l]=Sn({}),d=Fi(new Set);Di(()=>{let y=S=>{let k=Zo(S.answers);Object.keys(k).length!==0&&a(_=>{if(!Object.entries(k).some(([b,T])=>_[b]?.choiceId!==T.choiceId||_[b]?.poolId!==T.poolId||_[b]?.value!==T.value))return _;let z={..._,...k};return i(b=>{let T={...b};for(let[f,q]of Object.entries(b)){let A=new Set(Object.values(z).filter(L=>L.poolId===f).map(L=>L.choiceId));T[f]={...q,available:new Set(q.choices.map(L=>L.id).filter(L=>!A.has(L)))}}return T}),z})};return t.on("answers:prefill",y),()=>t.off("answers:prefill",y)},[t]);let m=dr((y,S)=>{i(k=>{let _=k[y];if(!_){let f=new Set;for(let A of Object.values(o))A.poolId===y&&f.add(A.choiceId);let q=new Set(S.map(A=>A.id).filter(A=>!f.has(A)));return{...k,[y]:{choices:S,available:q}}}let P=new Set(_.choices.map(f=>f.id)),z=new Set(S.map(f=>f.id));if(!(S.some(f=>!P.has(f.id))||_.choices.some(f=>!z.has(f.id))))return k;let T=new Set;for(let f of _.available)z.has(f)&&T.add(f);for(let f of S)P.has(f.id)||T.add(f.id);return{...k,[y]:{choices:S,available:T}}})},[o]),p=dr((y,S)=>{l(k=>{let _=k[y]??[];return _.includes(S)?k:{...k,[y]:[..._,S]}}),!d.current.has(S)&&!o[S]&&(d.current.add(S),t.emit({type:"answer:changed",answer:{nodeId:S,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:y,value:""}}}))},[o,t]),g=dr(y=>(c[y]??[]).find(k=>!o[k])??null,[c,o]),u=dr((y,S,k,_)=>{a(P=>{let z=P[y];return z&&i(b=>{let T=b[z.poolId];if(!T)return b;let f=new Set(T.available);return f.add(z.choiceId),{...b,[z.poolId]:{...T,available:f}}}),{...P,[y]:{choiceId:k,value:_,poolId:S}}}),i(P=>{let z=P[S];if(!z)return P;let b=new Set(z.available);return b.delete(k),{...P,[S]:{...z,available:b}}}),t.emit({type:"answer:changed",answer:{nodeId:y,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:k,poolId:S,value:_}}})},[t]),h=dr(y=>{let S=o[y];if(!S)return;let{poolId:k,choiceId:_}=S;i(P=>{let z=P[k];if(!z)return P;let b=new Set(z.available);return b.add(_),{...P,[k]:{...z,available:b}}}),a(P=>{let{[y]:z,...b}=P;return b}),t.emit({type:"answer:changed",answer:{nodeId:y,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:k,value:""}}})},[o,t]),v=dr((y,S)=>s[y]?.available.has(S)??!1,[s]),R=dr((y,S)=>s[y]?.choices.find(k=>k.id===S),[s]),w=dr(()=>{a({}),i(y=>{let S={};for(let[k,_]of Object.entries(y))S[k]={choices:_.choices,available:new Set(_.choices.map(P=>P.id))};return S});for(let[y,S]of Object.entries(c))for(let k of S)t.emit({type:"answer:changed",answer:{nodeId:k,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:y,value:""}}})},[c,t]);Oi({onDragEnd(y){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:y.active,over:y.over}}))}});let C=Jo(()=>({blanks:o,pools:s,registerPool:m,registerBlank:p,fill:u,back:h,isAvailable:v,getChoice:R,firstEmptyBlank:g,resetAllAnswers:w}),[o,s,m,p,u,h,v,R,g,w]);return Ii(ea.Provider,{value:C,children:e})}function St({node:e,validationFeedback:r}){let{id:t,attrs:n}=e,{poolId:o,placeholder:a="___",hint:s}=n,{blanks:i,fill:c,back:l,getChoice:d,registerBlank:m}=Xe(),p=se(),g=wr(),u=i[t],h=!!u?.choiceId,v=r?.showFeedback??!1,R=r?.state,w=r?.correctChoiceIds??[],C=v&&R==="incorrect"&&w.length>0?d(o||"",w[0]):void 0,y=C?C.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:S,isOver:k}=ji({id:t,data:{type:"blank",blankId:t,poolId:o}}),{active:_}=Bi(),P=!!_&&_.data.current?.poolId===o;return ta(()=>{m(o||"",t)},[o,t,m]),ta(()=>{let T=f=>{let q=f,{active:A,over:L}=q.detail||{};if(!L||L.id!==t)return;let{choiceId:Q,poolId:B}=A?.data.current||{};if(!Q||B!==o)return;let H=d(o||"",Q);if(!H)return;let X=H.html.replace(/<\/?[^>]+(>|$)/g,"");c(t,o||"",Q,X)};return window.addEventListener("dnd-drop",T),()=>window.removeEventListener("dnd-drop",T)},[t,o,d,c]),Cn(ra,{children:[It("span",{ref:S,onClick:()=>{h&&!v&&l(t)},className:$t("player-choice-blank",k&&"player-choice-blank--over",!k&&P&&!h&&!v&&"player-choice-blank--target",h&&!v&&!k&&"player-choice-blank--filled",v&&R==="correct"&&$t("player-choice-blank--correct",g.hop),v&&R==="partial"&&$t("player-choice-blank--partial",g.hop),v&&R==="incorrect"&&$t("player-choice-blank--incorrect",g.wobble)),title:h&&!v?p.clickToRemove:void 0,"data-node-id":t,"data-pool-id":o,children:h?Cn(ra,{children:[It("span",{children:u.value}),!v&&It("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):a}),y&&Cn("span",{className:"player-blank-reveal",children:["(",y,")"]}),It(Ke,{hint:s})]})}import{jsx as An,jsxs as Gi}from"react/jsx-runtime";import{useEffect as pa,useRef as Yi,useState as Ki}from"react";import Xi from"clsx";import{jsx as da,jsxs as Hi}from"react/jsx-runtime";import Vi from"clsx";import{useDraggable as Qi}from"@dnd-kit/core";import{jsx as Rr,jsxs as na}from"react/jsx-runtime";import{useEffect as oa,useState as aa}from"react";import qi from"clsx";var sa="edpire:tap-hint-placed",ia=2;function Wi(e){let t=(()=>{try{return Number(e?.getItem(sa))||0}catch{return 0}})(),n=new Set,o=new Set,a=()=>n.forEach(s=>s());return{done:()=>t>=ia,placed:()=>t,recordPlacement(){if(!(t>=ia)){t+=1;try{e?.setItem(sa,String(t))}catch{}a()}},setOnScreen(s,i){let c=o.has(s);i!==c&&(i?o.add(s):o.delete(s),a())},owner(){let s=null;for(let i of o)(!s||i.compareDocumentPosition(s)&4)&&(s=i);return s},subscribe(s){return n.add(s),()=>{n.delete(s)}}}}var _n=null;function Nn(){if(!_n){let e=null;try{e=typeof window<"u"?window.localStorage:null}catch{e=null}_n=Wi(e)}return _n}function ca(){typeof window>"u"||Nn().recordPlacement()}function Ui(){try{return window.matchMedia("(hover: none) and (pointer: coarse)").matches}catch{return!1}}function zt(e,r){let[,t]=aa(0),[n,o]=aa(!1);if(oa(()=>{o(Ui())},[]),oa(()=>{let s=e.current;if(!n||!s)return;let i=Nn();if(i.done())return;let c=i.subscribe(()=>t(d=>d+1));if(!r||typeof IntersectionObserver>"u")return()=>{i.setOnScreen(s,!1),c()};let l=new IntersectionObserver(d=>{for(let m of d)i.setOnScreen(s,m.isIntersecting)},{threshold:.6});return l.observe(s),()=>{l.disconnect(),i.setOnScreen(s,!1),c()}},[e,n,r]),!n||!r||typeof window>"u")return!1;let a=Nn();return!a.done()&&a.owner()===e.current}function la(){let{motion:e}=Ie();return na("span",{className:qi("player-tap-hint",e==="none"&&"player-tap-hint--still"),"aria-hidden":"true",children:[Rr("span",{className:"player-tap-hint__ripple"}),Rr("svg",{className:"player-tap-hint__hand",viewBox:"0 0 24 24",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[{stroke:"#ffffff",strokeWidth:4.5},{stroke:"currentColor",strokeWidth:1.75}].map((r,t)=>na("g",{...r,children:[Rr("path",{d:"M22 14a8 8 0 0 1-8 8"}),Rr("path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}),Rr("path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}),Rr("path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}),Rr("path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"})]},t))})]})}function Mr({poolId:e,data:r,isInline:t=!1,tapHint:n=!1}){let{isAvailable:o,firstEmptyBlank:a,fill:s}=Xe(),{id:i,html:c}=r,l=!o(e,i),{setNodeRef:d,attributes:m,listeners:p,transform:g,isDragging:u}=Qi({id:i,data:{type:"choice",choiceId:i,poolId:e,html:c},disabled:l});if(l)return null;let h=C=>C.replace(/<\/?[^>]+(>|$)/g,""),v=()=>{let C=a(e);if(C){let y=h(c);s(C,e,i,y),ca()}},R=g?{transform:`translate3d(${g.x}px, ${g.y}px, 0)`}:void 0;return Hi(t?"span":"div",{ref:d,style:R,className:Vi("player-bank-pill",u&&"player-bank-pill--dragging",n&&!u&&"player-bank-pill--hinted",t&&"mx-1"),...m,...p,onClick:v,children:[da("span",{dangerouslySetInnerHTML:{__html:c},className:"pointer-events-none whitespace-pre-wrap break-words"}),n&&!u&&da(la,{})]})}function Ct({node:e}){let r=se(),{id:t,attrs:n,content:o}=e,{shuffle:a=!0,equalWidth:s=!1}=n,{registerPool:i,isAvailable:c}=Xe(),l=Yi(null),[d,m]=Ki(()=>o.map(u=>({id:u.id,html:ue(u.content)})));pa(()=>{let u=o.map(h=>({id:h.id,html:ue(h.content)}));m(a?[...u].map(h=>({v:h,r:Math.random()})).sort((h,v)=>h.r-v.r).map(h=>h.v):u)},[a,JSON.stringify(o)]),pa(()=>{i(t,d)},[t,d,i]);let p=d.find(u=>c(t,u.id))?.id,g=zt(l,p!==void 0);return Gi("div",{ref:l,className:"player-word-bank",children:[An("div",{className:"player-word-bank__label",children:r.wordBank}),An("div",{className:Xi("player-word-bank__items",s&&"player-word-bank__items--grid"),children:d.map(u=>An(Mr,{poolId:t,data:u,tapHint:g&&u.id===p},u.id))})]})}import{jsx as En,jsxs as Ji}from"react/jsx-runtime";import{useEffect as ua,useRef as Zi,useState as ec}from"react";function _t({node:e}){let{id:r,attrs:t,content:n}=e,{shuffle:o=!0,separator:a=" "}=t,{registerPool:s,isAvailable:i}=Xe(),c=Zi(null),[l,d]=ec(()=>n.map(g=>({id:g.id,html:ue(g.content,{stripParagraphs:!0})})));ua(()=>{let g=n.map(u=>({id:u.id,html:ue(u.content,{stripParagraphs:!0})}));d(o?[...g].map(u=>({v:u,r:Math.random()})).sort((u,h)=>u.r-h.r).map(u=>u.v):g)},[o,JSON.stringify(n)]),ua(()=>{s(r,l)},[r,l,s]);let m=l.find(g=>i(r,g.id))?.id,p=zt(c,m!==void 0);return En("span",{ref:c,style:{display:"inline-flex",flexWrap:"wrap",gap:I("0.25rem"),alignItems:"center"},children:l.map((g,u)=>Ji("span",{children:[En(Mr,{poolId:r,data:g,isInline:!0,tapHint:p&&g.id===m}),u<l.length-1&&En("span",{children:a})]},g.id))})}import{jsx as Lr,jsxs as Mn}from"react/jsx-runtime";import{useState as Ln,useEffect as In,useMemo as oc}from"react";import{Check as ac,X as sc}from"lucide-react";import{jsx as Re,jsxs as Sr}from"react/jsx-runtime";import{useState as Pn,useMemo as Tn,useRef as Dt,useCallback as rc,useLayoutEffect as tc}from"react";var ma="#1d2025",fa="#8d93a0",ha="#1f8a4c",ga="#d23b2b",nc=11;function ba({leftItems:e,rightItems:r,connections:t,direction:n,disabled:o,feedback:a,onConnectionsChange:s}){let[i,c]=Pn(null),[l,d]=Pn(null),[m,p]=Pn(new Map),g=Dt(null),u=Dt(new Map),h=Dt("mouse"),v=a?.showFeedback??!1,R=Tn(()=>{let E=new Map;if(a?.pairFeedback)for(let x of a.pairFeedback)E.set(`${x.leftId}-${x.rightId}`,x.correct);return E},[a]),w=Tn(()=>{let E=new Map;return a?.correctPairings?.forEach(x=>E.set(x.leftId,x.rightId)),E},[a]),C=Tn(()=>{let E=new Map;return a?.correctPairings?.forEach(x=>E.set(x.rightId,x.leftId)),E},[a]),y=new Map,S=new Map;t.forEach((E,x)=>{y.set(E.leftId,x),S.set(E.rightId,x)});let k=E=>{let x=t[E];if(!v||!x)return null;let j=R.get(`${x.leftId}-${x.rightId}`);return j===!0?"correct":j===!1?"incorrect":null},_=rc(()=>{if(!g.current)return;let E=g.current.getBoundingClientRect(),x=new Map;u.current.forEach((j,F)=>{if(j){let D=j.getBoundingClientRect();x.set(F,new DOMRect(D.left-E.left,D.top-E.top,D.width,D.height))}}),p(x)},[]);tc(()=>{_();let E=new ResizeObserver(_);return g.current&&E.observe(g.current),()=>E.disconnect()},[_,t,e,r]);let P=8,z=(E,x)=>{let j=m.get(E);if(!j)return null;let F=j.y+j.height/2;return x==="left"?{x:j.x+j.width,y:F}:{x:j.x-P,y:F}},b=(E,x)=>{if(o)return;let F=(x==="left"?y:S).has(E),D=i?.id===E&&i?.side===x,re=i!==null&&i.side!==x;if(D){c(null);return}if(re){let ae=x==="right"?i.id:E,ie=x==="left"?i.id:E,ce=t.filter(U=>U.leftId!==ae&&U.rightId!==ie);ce.push({leftId:ae,rightId:ie}),s(ce),c(null);return}if(F&&!i){let ae=x==="left"?t.filter(ie=>ie.leftId!==E):t.filter(ie=>ie.rightId!==E);s(ae);return}c({id:E,side:x})},T=Dt(null),f=(E,x,j)=>{if(o||(h.current=j.pointerType,j.pointerType==="touch"))return;j.currentTarget.setPointerCapture(j.pointerId);let F=g.current.getBoundingClientRect();T.current={x:j.clientX-F.left,y:j.clientY-F.top},d({fromId:E,fromSide:x,x:j.clientX-F.left,y:j.clientY-F.top,overId:null,overSide:null})},q=E=>{if(!l)return;let x=g.current.getBoundingClientRect(),j=E.clientX-x.left,F=E.clientY-x.top,D=l.fromSide==="left"?"right":"left",re=D==="left"?e:r,ae=null,ie=null;for(let ce of re){let U=m.get(ce.id);if(U&&j>=U.x&&j<=U.x+U.width&&F>=U.y&&F<=U.y+U.height){ae=ce.id,ie=D;break}}d(ce=>ce?{...ce,x:j,y:F,overId:ae,overSide:ie}:null)},A=E=>{if(!l)return;let x=g.current.getBoundingClientRect(),j=E.clientX-x.left,F=E.clientY-x.top,D=T.current;if((D?Math.hypot(j-D.x,F-D.y):999)<8){d(null),b(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let ae=l.fromSide==="left"?l.fromId:l.overId,ie=l.fromSide==="right"?l.fromId:l.overId,ce=t.filter(U=>U.leftId!==ae&&U.rightId!==ie);ce.push({leftId:ae,rightId:ie}),s(ce)}d(null),c(null)},L=(E,x)=>{if(!v)return null;let F=(x==="left"?y:S).get(E.id);if(F!==void 0){let D=t[F];if(R.get(`${D.leftId}-${D.rightId}`)===!0)return null}if(x==="left"){let D=w.get(E.id);return r.find(re=>re.id===D)?.content??null}else{let D=C.get(E.id);return e.find(re=>re.id===D)?.content??null}},Q=(E,x)=>{let F=(x==="left"?y:S).get(E.id),D=F!==void 0,re=i?.id===E.id&&i?.side===x,ae=i!==null&&i.side!==x&&!D,ie=l?.overId===E.id&&l?.overSide===x,ce=D?k(F):null,U=D?F+1:null,K="matching-player__item";D&&(K+=" matching-player__item--matched"),ce==="correct"&&(K+=" matching-player__item--correct"),ce==="incorrect"&&(K+=" matching-player__item--incorrect"),re&&(K+=" matching-player__item--selected"),(ae||ie)&&(K+=" matching-player__item--available"),o&&(K+=" matching-player__item--disabled");let de=L(E,x);return Sr("button",{ref:te=>{te?u.current.set(E.id,te):u.current.delete(E.id)},type:"button",className:K,onPointerDown:te=>f(E.id,x,te),onClick:()=>{h.current==="touch"&&b(E.id,x)},"aria-pressed":re,children:[x==="right"&&Re("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:Sr("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[Re("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),Re("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),D&&x==="left"&&Re("span",{className:"matching-player__pair-num","aria-hidden":!0,children:U}),Re("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:ue(E.content)}}),de&&Sr("span",{className:"matching-player__correct-hint",children:["(",Re("span",{dangerouslySetInnerHTML:{__html:ue(de)}}),")"]}),D&&x==="right"&&Re("span",{className:"matching-player__pair-num","aria-hidden":!0,children:U}),x==="left"&&Re("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:Sr("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[Re("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),Re("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},E.id)},B=n==="ltr"?e:r,H=n==="ltr"?r:e,X=n==="ltr"?"left":"right",pe=n==="ltr"?"right":"left";return Sr("div",{ref:g,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:q,onPointerUp:A,children:[Sr("svg",{className:"matching-player__svg","aria-hidden":!0,children:[Re("defs",{children:[["mp-arrow-ink",ma],["mp-arrow-correct",ha],["mp-arrow-incorrect",ga],["mp-arrow-ghost",fa]].map(([E,x])=>Re("marker",{id:E,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:Re("polygon",{points:"0 0, 11 4.5, 0 9",fill:x})},E))}),t.map(E=>{let x=z(E.leftId,"left"),j=z(E.rightId,"right");if(!x||!j)return null;let F=j.x-nc,D=Math.max(16,Math.abs(F-x.x)*.4),re=`M ${x.x} ${x.y} C ${x.x+D} ${x.y}, ${F-D} ${j.y}, ${F} ${j.y}`,ae=v?R.get(`${E.leftId}-${E.rightId}`):void 0;return Re("path",{d:re,stroke:ae===!0?ha:ae===!1?ga:ma,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${ae===!0?"mp-arrow-correct":ae===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${E.leftId}-${E.rightId}`)}),l&&(()=>{let E=z(l.fromId,l.fromSide);if(!E)return null;let x=Math.abs(l.x-E.x)*.35,j=`M ${E.x} ${E.y} C ${E.x+x} ${E.y}, ${l.x-x} ${l.y}, ${l.x} ${l.y}`;return Re("path",{d:j,stroke:fa,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),Sr("div",{className:"matching-player__columns",children:[Re("div",{className:"matching-player__column",children:B.map(E=>Q(E,X))}),Re("div",{className:"matching-player__column",children:H.map(E=>Q(E,pe))})]})]})}var ya=e=>Number.isInteger(e)?String(e):e.toFixed(2);function xa(e){return[...e].map(r=>({v:r,r:Math.random()})).sort((r,t)=>r.r-t.r).map(r=>r.v)}function Nt({node:e,validationFeedback:r}){let t=xe(),{shuffleSeed:n,layoutBy:o}=Ie(),{id:a,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:d,hint:m}=s,p=JSON.stringify(i),g=JSON.stringify(c),u=d&&n!==void 0,h=oc(()=>u?{left:et(i,`${n}:${a}:left`),right:et(c,`${n}:${a}:right`)}:null,[u,n,a,p,g]),[v,R]=Ln(i),[w,C]=Ln(c);In(()=>{u||(d?(R(xa(i)),C(xa(c))):(R(i),C(c)))},[d,u,p,g]);let y=h?.left??v,S=h?.right??w,[k,_]=Ln([]),P=r?.showFeedback??!1;In(()=>{let A=L=>{let B=L.answers.find(H=>H.nodeId===a&&H.type==="matchingSet");B&&"connections"in B.answer&&_(B.answer.connections)};return t.on("answers:prefill",A),()=>t.off("answers:prefill",A)},[t,a]),In(()=>{t.emit({type:"answer:changed",answer:{nodeId:a,type:"matchingSet",timestamp:Date.now(),answer:{connections:k}}})},[t,a,k]);let z=A=>{P||_(A)},b=r?.score,T=r?.maxScore,f=P&&b!=null&&T!=null,q=f?b>=T?"correct":b>0?"partial":"incorrect":null;return Mn("div",{className:o==="box"?"matching-player matching-player--box":"matching-player",children:[m&&m.length>0&&Lr("div",{className:"matching-player-hintrow",children:Lr(Ke,{hint:m})}),Lr(ba,{leftItems:y,rightItems:S,connections:k,direction:l,disabled:P,feedback:r,onConnectionsChange:z}),f&&Mn("div",{className:"matching-player-feedback matching-player-feedback--"+q,children:[q==="correct"&&Lr(ac,{size:15,style:fe(15)}),q==="incorrect"&&Lr(sc,{size:15,style:fe(15)}),Lr("span",{children:q==="correct"?"All matched":q==="partial"?"Partial credit":"Not matched"}),Mn("span",{className:"matching-player-score",children:[ya(b)," / ",ya(T)]})]})]})}import{jsxs as Ir,jsx as Je,Fragment as ic}from"react/jsx-runtime";import{useState as va,useEffect as $n,useRef as cc,useCallback as wa}from"react";import Ft from"clsx";function At({node:e,validationFeedback:r}){let t=xe(),n=se(),{id:o,attrs:a}=e,{placeholder:s,minWords:i=0,maxWords:c=500,hint:l}=a,[d,m]=va(""),[p,g]=va(0),u=r?.showFeedback??!1,h=r?.state,v=c<=30,R=wa(b=>b.trim().split(/\s+/).filter(Boolean).length,[]);$n(()=>{let b=T=>{let q=T.answers?.find(A=>A.nodeId===o&&A.type==="aiAnswer");if(q&&q.answer?.text!=null){let A=q.answer.text;m(A),g(R(A))}};return t.on("answers:prefill",b),()=>t.off("answers:prefill",b)},[o,t,R]),$n(()=>{let b=()=>{m(""),g(0)};return t.on("answers:reset",b),()=>t.off("answers:reset",b)},[t]);let w=cc(null),C=wa((b,T)=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"aiAnswer",timestamp:Date.now(),answer:{text:b,wordCount:T}}})},300)},[o,t]);$n(()=>{t.emit({type:"answer:changed",answer:{nodeId:o,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let y=b=>{if(u)return;let T=R(b);m(b),g(T),C(b,T)},S=h==="validating",k=Ft("player-ai-count",p>c&&"player-ai-count--over"),_=!u||S?"":h==="correct"?"player-ai-input--correct":h==="incorrect"?"player-ai-input--incorrect":h==="partial"?"player-ai-input--partial":"",P=h==="correct"?"player-ai-feedback--correct":h==="incorrect"?"player-ai-feedback--incorrect":h==="partial"?"player-ai-feedback--partial":"",z=b=>Number.isInteger(b)?String(b):b.toFixed(2);return Ir("div",{className:"player-ai",children:[Ir("div",{className:"player-ai-counts",children:[Ir("span",{className:k,children:[p," / ",c," ",n.openResponseWords]}),i>0&&p<i&&Je("span",{className:"player-ai-count player-ai-count--min",children:n.minWordsLabel(i)}),Je("span",{style:{marginInlineStart:"auto"},children:Je(Ke,{hint:l})})]}),v?Je("input",{type:"text",value:d,onChange:b=>y(b.target.value),placeholder:s??n.shortAnswerPlaceholder,"aria-label":n.blankAnswerAria,disabled:u,className:Ft("player-ai-input",_)}):Je("textarea",{value:d,onChange:b=>y(b.target.value),placeholder:s??n.longAnswerPlaceholder,"aria-label":n.blankAnswerAria,disabled:u,rows:5,className:Ft("player-ai-input player-ai-input--multiline",_)}),u&&r&&Je("div",{className:Ft("player-ai-feedback",P),children:S?Ir("div",{className:"player-ai-validating",children:[Je("span",{className:"player-ai-spinner"}),Je("span",{children:n.aiEvaluationInProgress})]}):Ir(ic,{children:[r.message&&Je("p",{className:"player-ai-message",children:r.message}),r.score!=null&&r.maxScore!=null&&Je("div",{className:"player-ai-score-row",children:Ir("span",{className:"player-ai-score",children:[z(r.score)," / ",z(r.maxScore)]})})]})})]})}import{jsx as M,jsxs as J,Fragment as rt}from"react/jsx-runtime";import{useState as Ae,useEffect as Pe,useRef as Ce,useCallback as Ot}from"react";import{useEditor as lc,EditorContent as dc}from"@tiptap/react";import pc from"@tiptap/starter-kit";import tr from"clsx";import{FolderOpen as uc,Mic as mc,Video as ka,Monitor as fc,Clock as hc,Image as gc,FileText as Ra,Music as bc,Link2 as yc,Check as xc,AlertCircle as vc}from"lucide-react";function Sa(e){return e.trim().split(/\s+/).filter(Boolean).length}function Ca(e){return e.length}function wc(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join(" ");return Sa(r(e))}function kc(e){let r=t=>t.map(n=>(n.text??"")+(n.content?r(n.content):"")).join("");return Ca(r(e))}function Rc(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function Sc(e){let r=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return r?r[1]:null}function zn(e){let r=Math.floor(e/60),t=e%60;return`${r}:${t.toString().padStart(2,"0")}`}function Et({node:e,validationFeedback:r,readOnly:t=!1,mediaHandler:n}){let o=xe(),a=se(),{id:s,attrs:i}=e,{mode:c,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:p,allowedTypes:g,allowMultiple:u,fileInstructions:h,maxDuration:v,hint:R}=i,w=t||(r?.showFeedback??!1),C=r?.state,y=Ce(null),S=Ot(b=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{let T=b.files?.map(f=>({url:f.url,mimeType:f.kind==="videoLink"?"video/x-link":f.mimeType,name:f.kind==="videoLink"?void 0:f.name,duration:f.kind==="videoLink"?void 0:f.duration}));o.emit({type:"answer:changed",answer:{nodeId:s,type:"openResponse",timestamp:Date.now(),answer:{...b,files:T}}})},300)},[s,o]);Pe(()=>{S({})},[]);let[k,_]=Ae([]);Pe(()=>{(c==="file"||c==="text+file")&&c==="file"&&S({files:k})},[k,c]),Pe(()=>{let b=()=>{_([])};return o.on("answers:reset",b),()=>o.off("answers:reset",b)},[o]),Pe(()=>{let b=T=>{let q=(T.answers??[]).find(A=>A.nodeId===s&&A.type==="openResponse");q&&(y.current&&(clearTimeout(y.current),y.current=null),q.answer?.files&&_(q.answer.files))};return o.on("answers:prefill",b),()=>o.off("answers:prefill",b)},[s,o]);let P=r?.showFeedback,z=tr(!P&&"player-or-field--pre",P&&C==="correct"&&"player-or-field--correct",P&&C==="partial"&&"player-or-field--partial",P&&C==="incorrect"&&"player-or-field--incorrect",P&&C==="awaiting_review"&&"player-or-field--review");return J("div",{className:"my-3 space-y-2",children:[!w&&R&&R.length>0&&M("div",{className:"flex justify-end",children:M(lr,{hint:R})}),c==="text"&&M(_a,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:p,isDisabled:w,feedbackBorderClass:z,emitAnswer:b=>S({text:b}),answerBus:o}),c==="file"&&M(Dn,{allowedTypes:g??["image"],allowMultiple:!!u,fileInstructions:h,isDisabled:w,feedbackBorderClass:z,files:k,setFiles:_,mediaHandler:n,t:a}),(c==="audio"||c==="video"||c==="screen")&&M(Ic,{nodeId:s,answerBus:o,kind:c,maxDuration:v,isDisabled:w,feedbackBorderClass:z,mediaHandler:n,emitAnswer:b=>S({recording:b}),t:a}),c==="text+file"&&M(Ac,{nodeId:s,placeholder:l,allowFormatting:d,wordLimit:m,characterLimit:p,allowedTypes:g??["image"],allowMultiple:!!u,fileInstructions:h,isDisabled:w,feedbackBorderClass:z,files:k,setFiles:_,emitAnswer:S,answerBus:o,mediaHandler:n,t:a}),r?.showFeedback&&C==="awaiting_review"&&J("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:[M(hc,{size:15,style:fe(15),className:"animate-pulse"}),M("span",{children:a.openResponseAwaitingReview})]}),r?.showFeedback&&C!=="awaiting_review"&&r.teacherFeedback&&M($c,{feedback:r.teacherFeedback,feedbackState:C,score:r.score,t:a})]})}function _a({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,isDisabled:a,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=se(),[d,m]=Ae(""),[p,g]=Ae(0),[u,h]=Ae(0),v=Ce(null),R=Ot(()=>{let L=v.current;L&&(L.style.height="auto",L.style.height=`${L.scrollHeight}px`)},[]),w=lc({extensions:[pc.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!a,content:"",onUpdate({editor:L}){if(a||!t)return;let B=L.getJSON().content??[],H=wc(B),X=kc(B);g(H),h(X),i({content:B,wordCount:H})}});Pe(()=>{w&&w.setEditable(!a,!1)},[a,w]);let C=Ce(null);Pe(()=>{w&&C.current!==null&&(w.commands.setContent({type:"doc",content:C.current}),C.current=null)},[w]),Pe(()=>{let L=Q=>{let B=(Q.answers??[]).find(X=>X.nodeId===e&&X.type==="openResponse");if(!B?.answer?.text)return;let H=B.answer.text.content??[];if(t)w?w.commands.setContent({type:"doc",content:H}):C.current=H;else{let X=H.flatMap(pe=>pe.content?.map(ye=>ye.text??"")??[pe.text??""]).join(`
2
- `);m(X),setTimeout(R,0)}};return c.on("answers:prefill",L),()=>c.off("answers:prefill",L)},[e,c,t,w]),Pe(()=>{let L=()=>{t&&w?w.commands.clearContent():(m(""),setTimeout(R,0)),g(0),h(0)};return c.on("answers:reset",L),()=>c.off("answers:reset",L)},[c,t,w,R]);let y=!!n,S=!!o&&!n,k=y?p:u,_=y?n?.max:o?.max,P=y?n?.min:o?.min,z=_!=null&&k>_,b=_!=null&&k>=_*.8&&!z,T=P!=null&&k<P&&k>0,f="text-xs tabular-nums",q=z?{color:"var(--pen, #d23b2b)",fontWeight:500}:b||T?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},A=y?_?`${p} / ${_} ${l.openResponseWords}`:P?`${p} ${l.openResponseWords} (min. ${P})`:`${p} ${l.openResponseWords}`:S?_?`${u} / ${_} ${l.openResponseChars}`:`${u} ${l.openResponseChars}`:null;return t?J("div",{className:"relative",children:[J("div",{className:tr("rounded border transition-colors min-h-[120px]",s),children:[!a&&J("div",{className:"sticky top-0 z-10 flex gap-1 px-2 pt-1.5 pb-1 border-b border-gray-100 bg-white rounded-t",children:[[{label:"B",cmd:"toggleBold",style:"font-bold"},{label:"I",cmd:"toggleItalic",style:"italic"}].map(({label:L,cmd:Q,style:B})=>M("button",{type:"button",onMouseDown:H=>{H.preventDefault(),w?.chain().focus()?.[Q]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${B}`,children:L},L)),M("button",{type:"button",onMouseDown:L=>{L.preventDefault(),w?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),M(dc,{editor:w,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),A&&M("div",{className:tr("absolute bottom-2 right-3",f),style:q,children:A})]}):J("div",{className:"relative",children:[M("textarea",{ref:v,value:d,onChange:L=>{if(a)return;let Q=L.target.value;m(Q);let B=Sa(Q),H=Ca(Q);g(B),h(H),R(),i({content:[{type:"paragraph",content:[{type:"text",text:Q}]}],wordCount:B})},onInput:R,disabled:a,placeholder:r||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:tr("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,a&&"cursor-default")}),A&&M("div",{className:tr("absolute bottom-2 right-3",f),children:A})]})}var Cc={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},_c={image:M(gc,{size:12,style:fe(12)}),pdf:M(Ra,{size:12,style:fe(12)}),audio:M(bc,{size:12,style:fe(12)}),video:M(ka,{size:12,style:fe(12)}),videoLink:M(yc,{size:12,style:fe(12)})};function Dn({allowedTypes:e,allowMultiple:r,fileInstructions:t,isDisabled:n,files:o,setFiles:a,mediaHandler:s,t:i,compact:c=!1}){let l=Ce(null),[d,m]=Ae(!1),[p,g]=Ae(!1),[u,h]=Ae(""),v=e.some(b=>b!=="videoLink"),R=e.includes("videoLink"),w=r||o.length===0,C=e.filter(b=>b!=="videoLink").map(b=>Cc[b]).filter(Boolean).join(","),y=Ot(b=>{a(T=>r?[...T,b]:[b])},[r,a]),S=Ot(b=>{a(T=>T.filter((f,q)=>q!==b))},[a]),k=async b=>{if(!(!w||n)){m(!0);try{let T=b.type.startsWith("image/")?"image":b.type==="application/pdf"?"document":b.type.startsWith("audio/")?"audio":b.type.startsWith("video/")?"video":"file";if(s){let f=await s.upload(b,T);y({kind:"file",url:f.url,mimeType:f.mimeType??b.type,name:b.name})}else{let f=URL.createObjectURL(b);y({kind:"file",url:f,mimeType:b.type,name:b.name})}}finally{m(!1)}}},_=async b=>{if(b.preventDefault(),g(!1),n||!w)return;let T=b.dataTransfer.files?.[0];T&&await k(T)},P=()=>{let b=u.trim();b&&(y({kind:"videoLink",url:b,platform:Rc(b)}),h(""))},z={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return J("div",{className:"space-y-2",children:[t&&!c&&M("p",{className:"text-sm text-gray-600 italic",children:t}),o.length>0&&M("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:o.map((b,T)=>M(Nc,{file:b,onRemove:n?void 0:()=>S(T),compact:c,t:i},T))}),!n&&w&&J("div",{className:"space-y-2",children:[v&&!c&&J("div",{onDragOver:b=>{b.preventDefault(),g(!0)},onDragLeave:()=>g(!1),onDrop:_,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:p?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:p?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[M(uc,{size:26,className:"mx-auto mb-2",style:{...fe(26),color:"var(--ink-soft, #565b66)"}}),M("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),M("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),d&&M("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),M("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(b=>b!=="videoLink").map(b=>J("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[_c[b]," ",z[b]]},b))})]}),v&&c&&M("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}`}),M("input",{ref:l,type:"file",accept:C,onChange:async b=>{let T=b.target.files?.[0];T&&(await k(T),b.target.value="")},className:"hidden"}),R&&J("div",{className:"flex gap-2 flex-wrap",children:[M("input",{type:"url",value:u,onChange:b=>h(b.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:b=>{b.key==="Enter"&&(b.preventDefault(),P())}}),M("button",{type:"button",onClick:P,disabled:!u.trim(),className:"text-sm px-3 py-1.5 rounded text-white disabled:opacity-50",style:{background:"var(--ink, #1d2025)"},children:i.openResponseAddVideoLink})]})]}),n&&o.length===0&&M("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function Nc({file:e,onRemove:r,compact:t,t:n}){if(e.kind==="videoLink"){let o=e.platform==="youtube"?Sc(e.url):null;return J("div",{className:tr("bg-white rounded border border-gray-200",t?"px-2 py-1 flex items-center gap-1.5":"p-3 space-y-1"),children:[o&&!t&&M("iframe",{src:`https://www.youtube.com/embed/${o}`,width:240,height:135,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"rounded w-full"}),M("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&&M("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return J("div",{className:tr("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/")?M("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/")?t?null:M("span",{className:"flex-1 min-w-0",children:M(Ge,{src:e.url,durationHint:e.duration})}):e.mimeType?.startsWith("video/")?M("video",{src:e.url,controls:!0,className:t?"hidden":"h-16 max-w-[240px] rounded"}):M(Ra,{size:20,style:{...fe(20),color:"var(--ink-soft, #565b66)"}}),J("div",{className:"flex-1 min-w-0",children:[M("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/")&&M(Ge,{src:e.url,durationHint:e.duration})]}),r&&M("button",{type:"button",onClick:r,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function Ac({nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:m,emitAnswer:p,answerBus:g,mediaHandler:u,t:h}){let[v,R]=Ae(null),[w,C]=Ae(!1);return Pe(()=>{p({...v&&{text:v},files:d.length>0?d:void 0})},[v,d]),J("div",{className:"space-y-2",children:[M(_a,{nodeId:e,placeholder:r,allowFormatting:t,wordLimit:n,characterLimit:o,isDisabled:c,feedbackBorderClass:l,emitAnswer:y=>R(y),answerBus:g}),!c&&J("div",{children:[J("button",{type:"button",onClick:()=>C(!w),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[M("span",{children:w?"\u25BE":"\u25B8"}),J("span",{children:[h.openResponseAttachFiles,d.length>0&&M("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})]})]}),w&&M("div",{className:"mt-1.5",children:M(Dn,{allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:d,setFiles:m,mediaHandler:u,t:h,compact:!0})})]}),c&&d.length>0&&J("div",{className:"space-y-1",children:[M("p",{className:"text-xs text-gray-500 font-medium",children:h.openResponseAttachedFiles}),M(Dn,{allowedTypes:a,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:d,setFiles:m,t:h,compact:!0})]})]})}var Ec=180,Pc={audio:["audio/webm;codecs=opus","audio/webm","audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/aac","audio/ogg;codecs=opus"],video:["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm","video/mp4"]};function Tc(e){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return Pc[e].find(r=>MediaRecorder.isTypeSupported(r))}function Mc(e,r){let t=e.split(";")[0].trim().toLowerCase();return t.endsWith("/webm")?"webm":t.endsWith("/ogg")?"ogg":t.endsWith("/aac")?"aac":t.endsWith("/mp4")?r==="audio"?"m4a":"mp4":"webm"}function Lc(e){return e instanceof DOMException?e.name==="AbortError":e?.name==="AbortError"}function Ic({nodeId:e,kind:r,maxDuration:t,isDisabled:n,feedbackBorderClass:o,mediaHandler:a,emitAnswer:s,answerBus:i,t:c}){let l=r==="audio"?"audio":"video",d=t&&t>0?t:r==="audio"?Ec:null,[m,p]=Ae("idle"),[g,u]=Ae(null),[h,v]=Ae(null),[R,w]=Ae(0),[C,y]=Ae(null),[S,k]=Ae(null),_=Ce(null),P=Ce(null),z=Ce([]),b=Ce(0),T=Ce(null),f=Ce(null),q=Ce(null),A=Ce(null),L=Ce(0),Q=Ce(null),B=Ce(null),H=Ce(null);Pe(()=>{let U=de=>{let ee=(de.answers??[]).find(le=>le.nodeId===e&&le.type==="openResponse")?.answer?.recording;ee?.url&&(u(ee),p("saved"))},K=()=>{Q.current?.abort(),u(null),v(null),k(null),p("idle")};return i.on("answers:prefill",U),i.on("answers:reset",K),()=>{i.off("answers:prefill",U),i.off("answers:reset",K)}},[e,i]);let X=()=>{cancelAnimationFrame(L.current);let U=A.current;A.current=null,U&&U.state!=="closed"&&U.close().catch(()=>{})},pe=()=>{P.current?.getTracks().forEach(U=>U.stop()),P.current=null};Pe(()=>()=>{T.current&&clearInterval(T.current),X(),pe(),Q.current?.abort()},[]),Pe(()=>{let U=h?.url;return()=>{U&&URL.revokeObjectURL(U)}},[h?.url]);let ye=U=>{let K=q.current,de=window.AudioContext||window.webkitAudioContext;if(!K||!de)return;let te;try{te=new de}catch{return}A.current=te;let ee=te.createAnalyser();ee.fftSize=512,te.createMediaStreamSource(U).connect(ee);let le=new Uint8Array(ee.fftSize),ze=window.devicePixelRatio||1,He=Math.max(1,K.clientWidth),O=Math.max(1,K.clientHeight);K.width=Math.round(He*ze),K.height=Math.round(O*ze);let Y=K.getContext("2d");if(!Y)return;Y.scale(ze,ze);let Z=3,me=2,Te=[],G=Math.floor(He/(Z+me)),qr=0,Wr=Ur=>{if(L.current=requestAnimationFrame(Wr),Ur-qr<50)return;qr=Ur,ee.getByteTimeDomainData(le);let mr=0;for(let ir=0;ir<le.length;ir++){let fr=(le[ir]-128)/128;mr+=fr*fr}Te.push(Math.min(1,Math.sqrt(mr/le.length)*3)),Te.length>G&&Te.shift(),Y.clearRect(0,0,He,O),Y.fillStyle="#1d2025";let Hr=He-Te.length*(Z+me);Te.forEach((ir,fr)=>{let lt=Math.max(2,ir*O);Y.fillRect(Hr+fr*(Z+me),(O-lt)/2,Z,lt)})};L.current=requestAnimationFrame(Wr)};Pe(()=>{m==="recording"&&r==="audio"&&P.current&&ye(P.current)},[m]);let E=async(U,K)=>{if(!a)return;let de=new AbortController;Q.current=de,B.current={file:U,duration:K},k(null),y(0),p("uploading");try{let te=await a.upload(U,l,{onProgress:le=>{de.signal.aborted||y(Math.max(0,Math.min(1,le)))},signal:de.signal});if(de.signal.aborted)return;let ee={url:te.url,mimeType:te.mimeType??U.type,duration:K,kind:l};B.current=null,u(ee),p("saved"),s(ee)}catch(te){if(de.signal.aborted||Lc(te))return;p("failed"),k(c.recorderFailed)}finally{y(null)}},x=()=>{Q.current?.abort(),B.current=null,v(null),y(null),p(H.current?"saved":"idle")},j=()=>{let U=B.current;U&&E(U.file,U.duration)},F=()=>{T.current&&(clearInterval(T.current),T.current=null);let U=_.current;U&&U.state!=="inactive"&&U.stop()},D=async()=>{if(!a){k(c.recorderUnavailableHere);return}if(!(typeof MediaRecorder<"u"&&typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia&&(r!=="screen"||!!navigator.mediaDevices.getDisplayMedia))){k(c.recorderUnsupported);return}Q.current?.abort(),H.current=g,k(null),p("requesting");let K;try{if(r==="screen"){K=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1});try{let le=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];le&&K.addTrack(le)}catch{}K.getVideoTracks()[0]?.addEventListener("ended",()=>F())}else r==="video"?K=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"user"}}):K=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(ee){let le=ee?.name;p(g?"saved":"idle"),k(le==="NotAllowedError"||le==="SecurityError"||le==="NotFoundError"?c.openResponsePermissionDenied:c.recorderUnsupported);return}let de=Tc(l),te;try{te=de?new MediaRecorder(K,{mimeType:de}):new MediaRecorder(K)}catch{try{te=new MediaRecorder(K)}catch{K.getTracks().forEach(ee=>ee.stop()),p(g?"saved":"idle"),k(c.recorderUnsupported);return}}P.current=K,_.current=te,z.current=[],te.ondataavailable=ee=>{ee.data.size>0&&z.current.push(ee.data)},te.onstop=()=>{let ee=Math.max(1,Math.round((performance.now()-b.current)/1e3)),le=te.mimeType||de||`${l}/webm`,ze=new Blob(z.current,{type:le});if(z.current=[],X(),pe(),f.current&&(f.current.srcObject=null),ze.size===0){p(H.current?"saved":"idle"),k(c.recorderUnsupported);return}let He=new File([ze],`recording.${Mc(le,l)}`,{type:le});v({url:URL.createObjectURL(ze),duration:ee}),E(He,ee)},te.start(250),b.current=performance.now(),w(0),p("recording"),T.current=setInterval(()=>{let ee=(performance.now()-b.current)/1e3;w(ee),d&&ee>=d&&F()},200)};Pe(()=>{let U=f.current;m==="recording"&&U&&P.current&&(U.srcObject=P.current,U.play().catch(()=>{}))},[m]);let re=h?.url??g?.url??null,ae=h?.duration??g?.duration??null,ie=re?l==="audio"?M(Ge,{src:re,durationHint:ae}):M("video",{src:re,controls:!0,playsInline:!0,preload:"metadata"}):null;if(n)return M("div",{className:tr("edp-rec",o),children:g?l==="audio"?M(Ge,{src:g.url,durationHint:g.duration}):M("video",{src:g.url,controls:!0,playsInline:!0,preload:"metadata"}):M("p",{className:"edp-rec-message",children:c.recorderNone})});let ce=r==="audio"?M(mc,{"aria-hidden":!0}):r==="screen"?M(fc,{"aria-hidden":!0}):M(ka,{"aria-hidden":!0});return J("div",{className:tr("edp-rec",o),children:[(m==="idle"||m==="requesting")&&J("div",{className:"edp-rec-idle",children:[M("button",{type:"button",className:"edp-rec-record",onClick:D,disabled:m==="requesting"||!a,"aria-label":r==="screen"?c.openResponseTapToRecordScreen:c.recorderRecord,children:ce}),M("span",{className:"edp-rec-label",children:m==="requesting"?c.openResponseRequestingPermission:c.recorderRecord}),d&&M("span",{className:"edp-rec-limit",children:c.recorderUpTo(zn(d))}),!a&&M("p",{className:"edp-rec-message",children:c.recorderUnavailableHere})]}),m==="recording"&&J(rt,{children:[l==="video"&&M("video",{ref:f,muted:!0,playsInline:!0}),J("div",{className:"edp-rec-live",role:"status","aria-label":c.recorderRecordingAria,children:[r==="audio"?M("canvas",{ref:q,className:"edp-rec-level","aria-hidden":!0}):M("span",{style:{flex:1}}),J("span",{className:"edp-rec-clock",dir:"ltr",children:[M("span",{className:"edp-rec-dot","aria-hidden":!0}),zn(Math.floor(R)),d&&J("small",{children:["/ ",zn(d)]})]}),J("button",{type:"button",className:"edp-rec-stop",onClick:F,children:[M("i",{"aria-hidden":!0}),c.openResponseStopRecording]})]})]}),(m==="uploading"||m==="saved"||m==="failed")&&J(rt,{children:[ie,J("div",{className:"edp-rec-foot",children:[m==="uploading"&&J(rt,{children:[M("span",{className:"edp-rec-status","aria-live":"polite",children:C&&C>0?c.recorderSaving(Math.round(C*100)):c.openResponseUploading}),M("span",{className:"edp-rec-progress","aria-hidden":!0,children:M("span",{style:{width:`${Math.round((C??0)*100)}%`}})}),M("button",{type:"button",className:"edp-rec-link",onClick:x,children:c.recorderCancel})]}),m==="saved"&&J(rt,{children:[J("span",{className:"edp-rec-status edp-rec-status--ok","aria-live":"polite",children:[M(xc,{size:16,"aria-hidden":!0}),c.recorderSaved]}),M("button",{type:"button",className:"edp-rec-link",onClick:D,children:c.recorderRecordAgain})]}),m==="failed"&&J(rt,{children:[J("span",{className:"edp-rec-status edp-rec-status--error",role:"alert",children:[M(vc,{size:16,"aria-hidden":!0}),S??c.recorderFailed]}),J("span",{style:{display:"inline-flex",gap:"1rem"},children:[M("button",{type:"button",className:"edp-rec-link",onClick:j,children:c.recorderRetry}),M("button",{type:"button",className:"edp-rec-link",onClick:D,children:c.recorderRecordAgain})]})]})]})]}),S&&m!=="failed"&&M("p",{className:"edp-rec-message",role:"alert",children:S})]})}function $c({feedback:e,feedbackState:r,score:t,t:n}){let o=r==="correct"?{bg:"var(--ok-soft, #ecf8f0)",border:"var(--ok, #1f8a4c)",ink:"var(--ok, #1f8a4c)"}:r==="incorrect"?{bg:"var(--pen-soft, #fdeeec)",border:"var(--pen, #d23b2b)",ink:"var(--pen, #d23b2b)"}:{bg:"var(--almost-soft, #fbf1dc)",border:"var(--almost, #c8810e)",ink:"var(--almost-ink, #8a5a08)"};return J("div",{className:"rounded p-3 text-sm border",style:{background:o.bg,borderColor:o.border,color:"var(--ink, #1d2025)"},children:[M("p",{className:"text-xs font-medium mb-1 opacity-70",children:n.openResponseTeacherFeedbackLabel}),e.flatMap(a=>a.content?.map(s=>s.text??"")??[a.text??""]).join(" "),t!=null&&J("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:I("1.4rem"),lineHeight:1,color:o.ink},children:[t," pts"]})]})}import{jsx as Cr,jsxs as nr,Fragment as Na}from"react/jsx-runtime";import{useEffect as Fn,useMemo as zc,useRef as Dc,useState as Aa}from"react";function Fc(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function Pt({nodeId:e,placeholder:r,hint:t,validationFeedback:n,readOnly:o=!1}){let a=se(),s=xe(),i=Dc(null),[c,l]=Aa(""),[d,m]=Aa(!1),p=Fc(n),g=n?.score,u=n?.maxScore,h=y=>Number.isInteger(y)?String(y):y.toFixed(2),v=n?.displayAnswer,R=zc(()=>v?yr(v,!1):"",[v]);Fn(()=>{import("mathlive").then(()=>{m(!0)}).catch(()=>{})},[]),Fn(()=>{let y=S=>{let k=S.answers?.find(_=>_.nodeId===e&&_.type==="mathResponse");k?.answer?.latex!==void 0&&(l(k.answer.latex),i.current&&(i.current.value=k.answer.latex))};return s.on("answers:prefill",y),()=>s.off("answers:prefill",y)},[s,e]),Fn(()=>{s.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:c}}})},[c,e,s]);let w=y=>{let S=y.target?.value??"";l(S)},C=p==="correct"?"player-math-field--correct":p==="incorrect"?"player-math-field--incorrect":p==="validating"?"player-math-field--validating":"";return nr("div",{dir:"ltr",className:"math-response-player",children:[nr("span",{style:{display:"inline-flex",alignItems:"center",gap:I("0.4rem")},children:[Cr("div",{className:"player-math-field"+(C?" "+C:"")+(o?" player-math-field--readonly":""),children:d?Cr("math-field",{ref:i,value:c,onInput:w,"virtual-keyboard-mode":"onfocus","smart-fence":"true",className:"player-math-field__input",style:{opacity:o?.7:1,pointerEvents:o?"none":"auto"}}):Cr("input",{type:"text",value:c,onChange:y=>l(y.target.value),placeholder:r||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:o,className:"player-math-field__fallback"})}),Cr(Ke,{hint:t})]}),n?.showFeedback&&nr("div",{className:"player-math-feedback player-math-feedback--"+p,children:[p==="validating"&&nr(Na,{children:[Cr("span",{className:"player-math-spinner"}),Cr("span",{children:a.mathChecking})]}),p==="correct"&&nr(Na,{children:[nr("span",{children:["\u2713 ",a.mathCorrect]}),g!=null&&nr("span",{className:"player-math-score",children:[h(g),u!=null?` / ${h(u)}`:""]})]}),p==="incorrect"&&nr("span",{children:["\u2717 ",a.mathIncorrect]}),p==="incorrect"&&R&&nr("span",{className:"player-blank-reveal player-math-reveal",children:["(",Cr("span",{dangerouslySetInnerHTML:{__html:R}}),")"]})]})]})}import{jsx as oe,jsxs as we,Fragment as ot}from"react/jsx-runtime";import{useCallback as rl,useEffect as tl,useRef as nl,useState as nt}from"react";import{Play as ol,Lock as al,Check as jn,X as Ta}from"lucide-react";function qt(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,m)=>qt(d,l[m]))}let o=e,a=r,s=Object.keys(o),i=Object.keys(a);return s.length!==i.length?!1:s.every(c=>qt(o[c],a[c]))}var Oc=`
1
+ import"./chunk-76CZ6Z7T.mjs";import Ou,{useMemo as ju}from"react";import{jsx as Zt}from"react/jsx-runtime";import{useEffect as oa,useMemo as xu,useRef as vu}from"react";import Ec from"mitt";var lt=class{constructor(){this.emitter=Ec(),this.answers=new Map}emit(t){if(t.type==="answer:changed")this.answers.set(t.answer.nodeId,t.answer);else if(t.type==="answers:reset")this.answers.clear();else if(t.type==="answers:prefill")for(let r of t.answers)this.answers.set(r.nodeId,r);this.emitter.emit(t.type,t)}on(t,r){this.emitter.on(t,r)}off(t,r){this.emitter.off(t,r)}getAllAnswers(){return Array.from(this.answers.values())}clearAnswers(){this.answers.clear(),this.emit({type:"answers:reset"})}prefillAnswers(t){this.emit({type:"answers:prefill",answers:t})}submitAnswers(){this.emit({type:"answer:submitted",answers:this.getAllAnswers(),timestamp:Date.now()})}},Ba="__edpireGlobalAnswerBus",qa=globalThis,Ur=qa[Ba]??(qa[Ba]=new lt);import{jsx as Lc}from"react/jsx-runtime";import{createContext as Ic,useContext as $c}from"react";var Ha="__edpireAnswerBusContext",Wa=globalThis,Ua=Wa[Ha]??(Wa[Ha]=Ic(Ur));function ge(){return $c(Ua)}function Kr({children:e,bus:t=new lt}){return Lc(Ua.Provider,{value:t,children:e})}import{jsx as we,jsxs as Wt}from"react/jsx-runtime";import{Fragment as Rl,useState as ds,useEffect as io,useMemo as Cl}from"react";import dt from"clsx";import{jsx as V,jsxs as os}from"react/jsx-runtime";import{jsx as $e,jsxs as Yn}from"react/jsx-runtime";import{createContext as Oc,useCallback as Xn,useContext as jc,useEffect as mr,useMemo as Bc,useRef as qt,useState as Mt}from"react";import{Pause as qc,Play as Hc,RotateCcw as Wc}from"lucide-react";import{jsx as Fc}from"react/jsx-runtime";import{createContext as zc,useContext as Ka}from"react";var Bt={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(""),tableScrollLeft:"Show the columns on the left",tableScrollRight:"Show the columns on the right",mathChecking:"Checking your answer\u2026",mathCorrect:"Correct",mathIncorrect:"Incorrect",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,t)=>`Grade submitted: ${e} / ${t}`,openResponseRubricTitle:"Rubric",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} pts`,openResponseAiSuggestionTitle:"AI Pre-grading Suggestion",openResponseAiSuggestedScore:(e,t)=>`Suggested score: ${e} / ${t}`,openResponseAiEvidence:"Evidence:",openResponseAiApplySuggestion:"Apply suggestion",openResponseStudentAnswerTitle:"Student answer",audioPlay:"Play",audioPause:"Pause",audioReplay:"Play again",audioSpeed:e=>`Speed ${e}`,audioRate:e=>`${e}\xD7`,audioPosition:"Position in the audio",audioTimeOf:(e,t)=>`${e} of ${t}`,audioPlaysLeft:e=>e===1?"1 play left":`${e} plays left`,audioNoPlaysLeft:"No plays left",audioUnavailable:"This audio can't be played.",recorderUpTo:e=>`Up to ${e}`,recorderRecord:"Record",recorderRecordingAria:"Recording",recorderSaving:e=>`Saving ${e}%`,recorderSaved:"Saved",recorderRecordAgain:"Record again",recorderCancel:"Cancel",recorderFailed:"Your recording wasn't saved. Check your connection.",recorderRetry:"Try again",recorderUnsupported:"This browser can't record. Try an up-to-date Chrome, Safari or Firefox.",recorderUnavailableHere:"Recording isn't available here.",recorderNone:"No recording",sheetToolsAria:"Write your answer",sheetKeysAria:"Maths keys",sheetMoreKeys:"More",sheetKeyPower:"Squared",sheetKeyFraction:"Fraction",sheetKeyRoot:"Square root",sheetKeyPi:"Pi",sheetKeyLe:"Less than or equal to",sheetKeyGe:"Greater than or equal to",sheetKeyNe:"Not equal to",sheetKeyIn:"Belongs to",sheetFormulaUnwrap:"Back to text",sheetKeyboardClose:"Close the maths keyboard",sheetPhoto:"Photo of my copy",sheetHandwriting:"Write by hand",sheetPlaceholder:"Write your answer here, maths included: x^2, 1/2 or sqrt become x\xB2, \xBD, \u221A.",sheetClose:"Close",sheetPhotoTitle:"Photo of your copy",sheetPhotoPhoneHelp:"Scan this code with your phone and take photos of your copy. They will appear here.",sheetPhotoOr:"Or",sheetPhotoUpload:"Upload a photo",sheetPhotoWebcam:"Use this computer's camera",sheetPhotoTake:"Take a photo",sheetPhotoGallery:"Choose a photo",sheetPhotoShoot:"Take the photo",sheetPhotoReading:"Reading your copy\u2026",sheetPhotoCheck:"Check what was read and correct it before you submit.",sheetPhotoFailed:"We couldn't read this photo. Try again with more light, or type your answer.",sheetPhotoCameraFailed:"The camera didn't open. Upload a photo instead.",sheetPhotoRetry:"Try again",sheetPhotoYours:"Your photo",sheetPhotoRemove:"Remove this photo",sheetPadTitle:"Write a formula by hand",sheetPadHelp:"Write here with your finger or a pen.",sheetPadFailed:"Not recognised. Write a little bigger, or type it with the keys.",sheetPadUndo:"Undo",sheetPadClear:"Clear",sheetPadInsert:"Insert"};var Vr={submitButton:"Valider",showHint:"Voir l'indice",clickToRemove:"Cliquer pour retirer",blankAnswerAria:"Votre r\xE9ponse",aiEvaluationInProgress:"\xC9valuation IA en cours\u2026",aiEvaluationInProgressAria:"\xC9valuation IA en cours",shortAnswerPlaceholder:"R\xE9ponse courte\u2026",longAnswerPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",minWordsLabel:e=>`Min. : ${e}`,wordBank:"Banque de mots",chooseN:e=>`(choisir ${e})`,annexDefaultLabel:"Documents",annexOpen:e=>`Ouvrir ${e}`,annexClose:"Fermer",referenceInPanel:e=>`Le texte de cet exercice est dans \xAB ${e} \xBB.`,readReference:"Le lire",referenceForExercise:e=>`Exercice ${e}`,choiceLetters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),tableScrollLeft:"Voir les colonnes de gauche",tableScrollRight:"Voir les colonnes de droite",mathChecking:"V\xE9rification de votre r\xE9ponse\u2026",mathCorrect:"Juste",mathIncorrect:"Faux",openResponseTextPlaceholder:"\xC9crivez votre r\xE9ponse ici\u2026",openResponseWords:"mots",openResponseChars:"car.",openResponseDropZoneLabel:"Glissez-d\xE9posez des fichiers ici, ou",openResponseDropZoneBrowse:"parcourir",openResponseUploading:"Envoi en cours\u2026",openResponseNoSubmission:"Aucun fichier d\xE9pos\xE9",openResponseFile:"Fichier",openResponseAttachFile:"Joindre un fichier",openResponseAttachFiles:"Joindre des fichiers",openResponseAttachedFiles:"Fichiers joints",openResponseTypeImage:"Image",openResponseTypePdf:"PDF",openResponseTypeAudio:"Audio",openResponseTypeVideo:"Vid\xE9o",openResponseTypeVideoLink:"Lien vid\xE9o",openResponseVideoLinkPlaceholder:"Coller un lien YouTube ou Vimeo\u2026",openResponseAddVideoLink:"Ajouter",openResponseTapToRecord:"Appuyer pour d\xE9marrer l'enregistrement",openResponseTapToRecordScreen:"Cliquer pour d\xE9marrer l'enregistrement d'\xE9cran",openResponseRequestingPermission:"Demande d'autorisation\u2026",openResponsePermissionDenied:"Acc\xE8s au micro ou \xE0 la cam\xE9ra refus\xE9. Autorisez-le dans les r\xE9glages 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,t)=>`Note envoy\xE9e : ${e} / ${t}`,openResponseRubricTitle:"Grille d'\xE9valuation",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} pts`,openResponseAiSuggestionTitle:"Suggestion de correction par IA",openResponseAiSuggestedScore:(e,t)=>`Score sugg\xE9r\xE9 : ${e} / ${t}`,openResponseAiEvidence:"Extrait :",openResponseAiApplySuggestion:"Appliquer la suggestion",openResponseStudentAnswerTitle:"R\xE9ponse de l'\xE9l\xE8ve",audioPlay:"\xC9couter",audioPause:"Pause",audioReplay:"R\xE9\xE9couter",audioSpeed:e=>`Vitesse ${e}`,audioRate:e=>`${String(e).replace(".",",")}\xD7`,audioPosition:"Position dans l'audio",audioTimeOf:(e,t)=>`${e} sur ${t}`,audioPlaysLeft:e=>e===1?"1 \xE9coute restante":`${e} \xE9coutes restantes`,audioNoPlaysLeft:"Plus d'\xE9coute restante",audioUnavailable:"Impossible de lire cet audio.",recorderUpTo:e=>`Jusqu'\xE0 ${e}`,recorderRecord:"Enregistrer",recorderRecordingAria:"Enregistrement en cours",recorderSaving:e=>`Envoi ${e}\u202F%`,recorderSaved:"Enregistr\xE9",recorderRecordAgain:"Recommencer",recorderCancel:"Annuler",recorderFailed:"Votre enregistrement n'a pas \xE9t\xE9 envoy\xE9. V\xE9rifiez votre connexion.",recorderRetry:"R\xE9essayer",recorderUnsupported:"Ce navigateur ne peut pas enregistrer. Essayez Chrome, Safari ou Firefox \xE0 jour.",recorderUnavailableHere:"L'enregistrement n'est pas disponible ici.",recorderNone:"Aucun enregistrement",sheetToolsAria:"R\xE9diger votre r\xE9ponse",sheetKeysAria:"Touches de maths",sheetMoreKeys:"Plus",sheetKeyPower:"Au carr\xE9",sheetKeyFraction:"Fraction",sheetKeyRoot:"Racine carr\xE9e",sheetKeyPi:"Pi",sheetKeyLe:"Inf\xE9rieur ou \xE9gal \xE0",sheetKeyGe:"Sup\xE9rieur ou \xE9gal \xE0",sheetKeyNe:"Diff\xE9rent de",sheetKeyIn:"Appartient \xE0",sheetFormulaUnwrap:"Remettre en texte",sheetKeyboardClose:"Fermer le clavier de maths",sheetPhoto:"Photo de ma copie",sheetHandwriting:"\xC9crire \xE0 la main",sheetPlaceholder:"R\xE9digez votre r\xE9ponse ici, maths comprises : x^2, 1/2 ou sqrt deviennent x\xB2, \xBD, \u221A.",sheetClose:"Fermer",sheetPhotoTitle:"Photo de votre copie",sheetPhotoPhoneHelp:"Scannez ce code avec votre t\xE9l\xE9phone et photographiez votre copie. Les photos appara\xEEtront ici.",sheetPhotoOr:"Ou",sheetPhotoUpload:"T\xE9l\xE9verser une photo",sheetPhotoWebcam:"Utiliser la cam\xE9ra de cet ordinateur",sheetPhotoTake:"Prendre une photo",sheetPhotoGallery:"Choisir une photo",sheetPhotoShoot:"Prendre la photo",sheetPhotoReading:"Lecture de votre copie\u2026",sheetPhotoCheck:"V\xE9rifiez ce qui a \xE9t\xE9 lu et corrigez-le avant d'envoyer.",sheetPhotoFailed:"Impossible de lire cette photo. R\xE9essayez avec plus de lumi\xE8re, ou tapez votre r\xE9ponse.",sheetPhotoCameraFailed:"La cam\xE9ra ne s'est pas ouverte. T\xE9l\xE9versez plut\xF4t une photo.",sheetPhotoRetry:"R\xE9essayer",sheetPhotoYours:"Votre photo",sheetPhotoRemove:"Retirer cette photo",sheetPadTitle:"\xC9crire une formule \xE0 la main",sheetPadHelp:"\xC9crivez ici avec le doigt ou un stylet.",sheetPadFailed:"Non reconnu. \xC9crivez un peu plus grand, ou tapez-la avec les touches.",sheetPadUndo:"Annuler",sheetPadClear:"Effacer",sheetPadInsert:"Ins\xE9rer"};var Gr={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"],tableScrollLeft:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0639\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",tableScrollRight:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0639\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",mathChecking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0642\u0642 \u0645\u0646 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",mathCorrect:"\u0635\u062D\u064A\u062D",mathIncorrect:"\u062E\u0637\u0623",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,t)=>`\u062A\u0645 \u0627\u0639\u062A\u0645\u0627\u062F \u0627\u0644\u062F\u0631\u062C\u0629: ${e} / ${t}`,openResponseRubricTitle:"\u0633\u0644\u0651\u0645 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",openResponseRubricCriterionPoints:(e,t)=>`${e} / ${t} \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,t)=>`\u0627\u0644\u062F\u0631\u062C\u0629 \u0627\u0644\u0645\u0642\u062A\u0631\u062D\u0629: ${e} / ${t}`,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",audioPlay:"\u062A\u0634\u063A\u064A\u0644",audioPause:"\u0625\u064A\u0642\u0627\u0641 \u0645\u0624\u0642\u062A",audioReplay:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0627\u0633\u062A\u0645\u0627\u0639",audioSpeed:e=>`\u0627\u0644\u0633\u0631\u0639\u0629 ${e}`,audioRate:e=>`${e}\xD7`,audioPosition:"\u0627\u0644\u0645\u0648\u0636\u0639 \u0641\u064A \u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",audioTimeOf:(e,t)=>`${e} \u0645\u0646 ${t}`,audioPlaysLeft:e=>e===1?"\u0628\u0642\u064A \u0627\u0633\u062A\u0645\u0627\u0639 \u0648\u0627\u062D\u062F":e===2?"\u0628\u0642\u064A \u0627\u0633\u062A\u0645\u0627\u0639\u0627\u0646":`\u0628\u0642\u064A\u062A ${e} \u0627\u0633\u062A\u0645\u0627\u0639\u0627\u062A`,audioNoPlaysLeft:"\u0644\u0645 \u064A\u0628\u0642 \u0623\u064A \u0627\u0633\u062A\u0645\u0627\u0639",audioUnavailable:"\u062A\u0639\u0630\u0631 \u062A\u0634\u063A\u064A\u0644 \u0647\u0630\u0627 \u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u0635\u0648\u062A\u064A.",recorderUpTo:e=>`\u062D\u062A\u0649 ${e}`,recorderRecord:"\u062A\u0633\u062C\u064A\u0644",recorderRecordingAria:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0633\u062C\u064A\u0644",recorderSaving:e=>`\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644 ${e}\u066A`,recorderSaved:"\u062A\u0645 \u0627\u0644\u062D\u0641\u0638",recorderRecordAgain:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",recorderCancel:"\u0625\u0644\u063A\u0627\u0621",recorderFailed:"\u0644\u0645 \u064A\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u062A\u0633\u062C\u064A\u0644\u0643. \u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",recorderRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",recorderUnsupported:"\u0644\u0627 \u064A\u0645\u0643\u0646 \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D \u0627\u0644\u062A\u0633\u062C\u064A\u0644. \u062C\u0631\u0651\u0628 \u0625\u0635\u062F\u0627\u0631\u064B\u0627 \u062D\u062F\u064A\u062B\u064B\u0627 \u0645\u0646 Chrome \u0623\u0648 Safari \u0623\u0648 Firefox.",recorderUnavailableHere:"\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D \u0647\u0646\u0627.",recorderNone:"\u0644\u0627 \u064A\u0648\u062C\u062F \u062A\u0633\u062C\u064A\u0644",sheetToolsAria:"\u062D\u0631\u0651\u0631 \u0625\u062C\u0627\u0628\u062A\u0643",sheetKeysAria:"\u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A",sheetMoreKeys:"\u0627\u0644\u0645\u0632\u064A\u062F",sheetKeyPower:"\u0645\u0631\u0628\u0651\u0639",sheetKeyFraction:"\u0643\u0633\u0631",sheetKeyRoot:"\u062C\u0630\u0631 \u062A\u0631\u0628\u064A\u0639\u064A",sheetKeyPi:"\u0628\u0627\u064A",sheetKeyLe:"\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",sheetKeyGe:"\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",sheetKeyNe:"\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",sheetKeyIn:"\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",sheetFormulaUnwrap:"\u0625\u0631\u062C\u0627\u0639\u0647\u0627 \u0646\u0635\u064B\u0651\u0627",sheetKeyboardClose:"\u0625\u063A\u0644\u0627\u0642 \u0644\u0648\u062D\u0629 \u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A",sheetPhoto:"\u0635\u0648\u0631\u0629 \u0648\u0631\u0642\u062A\u064A",sheetHandwriting:"\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u0627\u0644\u064A\u062F",sheetPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643 \u0647\u0646\u0627 \u0645\u0639 \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0627\u062A: x^2 \u06481/2 \u0648sqrt \u062A\u0635\u0628\u062D x\xB2 \u0648\xBD \u0648\u221A.",sheetClose:"\u0625\u063A\u0644\u0627\u0642",sheetPhotoTitle:"\u0635\u0648\u0631\u0629 \u0648\u0631\u0642\u062A\u0643",sheetPhotoPhoneHelp:"\u0627\u0645\u0633\u062D \u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0628\u0647\u0627\u062A\u0641\u0643 \u0648\u0635\u0648\u0651\u0631 \u0648\u0631\u0642\u062A\u0643. \u0633\u062A\u0638\u0647\u0631 \u0627\u0644\u0635\u0648\u0631 \u0647\u0646\u0627.",sheetPhotoOr:"\u0623\u0648",sheetPhotoUpload:"\u062A\u062D\u0645\u064A\u0644 \u0635\u0648\u0631\u0629",sheetPhotoWebcam:"\u0627\u0633\u062A\u0639\u0645\u0627\u0644 \u0643\u0627\u0645\u064A\u0631\u0627 \u0647\u0630\u0627 \u0627\u0644\u062D\u0627\u0633\u0648\u0628",sheetPhotoTake:"\u0627\u0644\u062A\u0642\u0627\u0637 \u0635\u0648\u0631\u0629",sheetPhotoGallery:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0635\u0648\u0631\u0629",sheetPhotoShoot:"\u0627\u0644\u062A\u0642\u0637 \u0627\u0644\u0635\u0648\u0631\u0629",sheetPhotoReading:"\u062C\u0627\u0631\u064D \u0642\u0631\u0627\u0621\u0629 \u0648\u0631\u0642\u062A\u0643\u2026",sheetPhotoCheck:"\u0631\u0627\u062C\u0639 \u0645\u0627 \u062A\u0645\u0651\u062A \u0642\u0631\u0627\u0621\u062A\u0647 \u0648\u0635\u062D\u0651\u062D\u0647 \u0642\u0628\u0644 \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",sheetPhotoFailed:"\u062A\u0639\u0630\u0651\u0631\u062A \u0642\u0631\u0627\u0621\u0629 \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0645\u0639 \u0625\u0636\u0627\u0621\u0629 \u0623\u0641\u0636\u0644\u060C \u0623\u0648 \u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643.",sheetPhotoCameraFailed:"\u0644\u0645 \u062A\u064F\u0641\u062A\u062D \u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627. \u062D\u0645\u0651\u0644 \u0635\u0648\u0631\u0629 \u0628\u062F\u0644\u064B\u0627 \u0645\u0646 \u0630\u0644\u0643.",sheetPhotoRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",sheetPhotoYours:"\u0635\u0648\u0631\u062A\u0643",sheetPhotoRemove:"\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0635\u0648\u0631\u0629",sheetPadTitle:"\u0643\u062A\u0627\u0628\u0629 \u0635\u064A\u063A\u0629 \u0628\u0627\u0644\u064A\u062F",sheetPadHelp:"\u0627\u0643\u062A\u0628 \u0647\u0646\u0627 \u0628\u0625\u0635\u0628\u0639\u0643 \u0623\u0648 \u0628\u0642\u0644\u0645.",sheetPadFailed:"\u0644\u0645 \u064A\u062A\u0645\u0651 \u0627\u0644\u062A\u0639\u0631\u0651\u0641 \u0639\u0644\u064A\u0647\u0627. \u0627\u0643\u062A\u0628 \u0628\u062E\u0637 \u0623\u0643\u0628\u0631 \u0642\u0644\u064A\u0644\u064B\u0627\u060C \u0623\u0648 \u0627\u0643\u062A\u0628\u0647\u0627 \u0628\u0627\u0644\u0645\u0641\u0627\u062A\u064A\u062D.",sheetPadUndo:"\u062A\u0631\u0627\u062C\u0639",sheetPadClear:"\u0645\u0633\u062D",sheetPadInsert:"\u0625\u062F\u0631\u0627\u062C"};var Dc={en:Bt,fr:Vr,ar:Gr},Qn=zc(null);function re(){return Ka(Qn)??Bt}function pr(e){let t=Ka(Qn);return e&&Dc[e]||t||Bt}function ur({locale:e,children:t}){let r=pr(e);return Fc(Qn.Provider,{value:r,children:t})}var Va=Oc(null);function Qr({initial:e,onChange:t,children:r}){let n=qt({...e??{}}),o=qt(t);o.current=t;let a=Bc(()=>({get:s=>n.current[s]??0,set:(s,i)=>{n.current={...n.current,[s]:i},o.current?.(n.current)}}),[]);return $e(Va.Provider,{value:a,children:r})}var Jn=[.75,1,1.25,1.5],Zn=.5;function Ht(e){if(!Number.isFinite(e)||e<0)return"0:00";let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}var eo="edpire:audio-play";function rt({src:e,maxPlays:t,learnerSpeed:r,speed:n,allowSeek:o,durationHint:a,playsKey:s,playsUsed:i,onPlaysUsedChange:c,disabled:l=!1,label:p,className:f}){let m=re(),h=jc(Va),d=s??e,u=t&&t>0?Math.floor(t):0,v=o!==!1,R=r!==!1,S=n&&n>=.25&&n<=4?n:1,C=qt(null),w=qt(null),[N,k]=Mt(!1),[x,y]=Mt(0),[T,g]=Mt(a&&a>0?a:0),[P,A]=Mt(!1),[W,b]=Mt(!1),[M,$]=Mt(S),[B,J]=Mt(()=>i??h?.get(d)??0),Q=qt(!1),Y=qt(!1);mr(()=>{i!==void 0&&J(i)},[i]),mr(()=>$(S),[S]),mr(()=>{C.current&&(C.current.playbackRate=M)},[M]),mr(()=>{b(!1),A(!1),y(0),k(!1),Q.current=!1,a&&a>0||g(0);let H=C.current;H&&H.readyState>=1&&Number.isFinite(H.duration)&&H.duration>0&&g(H.duration)},[e]),mr(()=>{let H=ee=>{let te=C.current;te&&ee.detail!==te&&!te.paused&&te.pause()};return window.addEventListener(eo,H),()=>window.removeEventListener(eo,H)},[]);let ve=u>0&&B>=u&&!Q.current,L=u>0?Math.max(0,u-B):null,_=l||W||ve,q=Xn(()=>{if(u===0)return!0;if(B>=u)return!1;let H=B+1;return J(H),Q.current=!0,i===void 0&&h?.set(d,H),c?.(H),!0},[u,B,i,h,d,c]),z=Xn(()=>{let H=C.current;if(!H||l||W)return;if(!H.paused){H.pause();return}(P||H.currentTime<Zn)&&!Q.current&&!q()||((P||H.currentTime>=(H.duration||1/0))&&(H.currentTime=0),A(!1),H.playbackRate=M,window.dispatchEvent(new CustomEvent(eo,{detail:H})),H.play().catch(()=>k(!1)))},[l,W,P,q,M]),O=T>0?T:0,ne=O>0?Math.min(1,x/O):0,ce=Xn(H=>{let ee=C.current;if(!ee||!v||_||O===0)return;let te=Math.max(0,Math.min(O,H));if(u>0&&te<Zn&&x>=Zn&&Q.current&&(Q.current=!1,!ee.paused&&!q())){ee.pause();return}ee.currentTime=te,y(te),A(!1)},[v,_,O,u,x,q]),le=H=>{let ee=w.current;if(!ee)return 0;let te=ee.getBoundingClientRect(),je=getComputedStyle(ee).direction==="rtl"?(te.right-H)/te.width:(H-te.left)/te.width;return Math.max(0,Math.min(1,je))},ue=H=>{!v||_||O===0||(H.preventDefault(),Y.current=!0,H.currentTarget.setPointerCapture(H.pointerId),ce(le(H.clientX)*O))},U=H=>{Y.current&&ce(le(H.clientX)*O)},X=()=>{Y.current=!1},me=H=>{if(!v||_||O===0)return;let ee=w.current?getComputedStyle(w.current).direction==="rtl":!1,te=5,pe=null;H.key==="ArrowRight"?pe=x+(ee?-te:te):H.key==="ArrowLeft"?pe=x+(ee?te:-te):H.key==="ArrowUp"?pe=x+te:H.key==="ArrowDown"?pe=x-te:H.key==="Home"?pe=0:H.key==="End"&&(pe=O),pe!==null&&(H.preventDefault(),ce(pe))},ae=()=>{let H=Jn.indexOf(M);$(Jn[(H+1)%Jn.length]??1)},oe=(N||x>0)&&!P&&O>0,de=Ht(oe?O-x:O),Te=N?$e(qc,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0}):P&&!ve?$e(Wc,{size:18,"aria-hidden":!0}):$e(Hc,{size:18,fill:"currentColor",strokeWidth:0,"aria-hidden":!0,style:{marginInlineStart:2}}),Ze=N?m.audioPause:P?m.audioReplay:m.audioPlay;return Yn("span",{role:"group","aria-label":p,className:`edp-audio${_?" edp-audio--off":""}${f?` ${f}`:""}`,"data-audio-player":"",children:[Yn("span",{className:"edp-audio-bar",children:[$e("button",{type:"button",className:"edp-audio-play",onClick:z,disabled:_,"aria-label":Ze,children:Te}),Yn("span",{ref:w,className:`edp-audio-track${v&&!_?" edp-audio-track--seek":""}`,role:"slider",tabIndex:v&&!_?0:-1,"aria-label":m.audioPosition,"aria-valuemin":0,"aria-valuemax":Math.round(O),"aria-valuenow":Math.round(x),"aria-valuetext":m.audioTimeOf(Ht(x),Ht(O)),"aria-disabled":!v||_,onPointerDown:ue,onPointerMove:U,onPointerUp:X,onPointerCancel:X,onKeyDown:me,children:[$e("span",{className:"edp-audio-rail",children:$e("span",{className:"edp-audio-fill",style:{width:`${ne*100}%`}})}),v&&!_&&O>0&&$e("span",{className:"edp-audio-thumb",style:{insetInlineStart:`${ne*100}%`}})]}),$e("span",{className:"edp-audio-time",dir:"ltr",children:de}),R&&!W&&$e("button",{type:"button",className:"edp-audio-speed",dir:"ltr",onClick:ae,disabled:l,"aria-label":m.audioSpeed(m.audioRate(M)),children:m.audioRate(M)})]}),(W||L!==null)&&$e("span",{className:"edp-audio-note","aria-live":"polite",children:$e("bdi",{children:W?m.audioUnavailable:L===0&&!Q.current?m.audioNoPlaysLeft:m.audioPlaysLeft(L??0)})}),$e("audio",{ref:C,src:e||void 0,preload:"metadata",onLoadedMetadata:H=>{let ee=H.currentTarget;ee.playbackRate=M,Number.isFinite(ee.duration)&&ee.duration>0?g(ee.duration):Uc(ee,te=>g(pe=>pe>0?pe:te))},onDurationChange:H=>{let ee=H.currentTarget.duration;Number.isFinite(ee)&&ee>0&&g(ee)},onTimeUpdate:H=>{Y.current||y(H.currentTarget.currentTime)},onPlay:()=>k(!0),onPause:()=>k(!1),onEnded:()=>{k(!1),A(!0),Q.current=!1,y(O)},onError:()=>{e&&b(!0)}})]})}function Uc(e,t){let r=()=>{e.removeEventListener("timeupdate",r),Number.isFinite(e.duration)&&e.duration>0&&t(e.duration),e.currentTime=0};e.addEventListener("timeupdate",r);try{e.currentTime=1e101}catch{e.removeEventListener("timeupdate",r)}}import Kc from"katex";import"katex/dist/contrib/mhchem.js";var Vc={"\\d":"\\mathrm{d}","\\R":"\\mathbb{R}","\\N":"\\mathbb{N}","\\Z":"\\mathbb{Z}","\\Q":"\\mathbb{Q}","\\C":"\\mathbb{C}"};function Ne(e,t,r=!0){try{return Kc.renderToString(e,{displayMode:t,output:r?"htmlAndMathml":"html",throwOnError:!1,errorColor:"#cc0000",macros:Vc,strict:!1})}catch(n){return`<span class="katex-error" style="color:#cc0000" title="${String(n)}">${e}</span>`}}function F(e){return`calc(${typeof e=="number"?`${e}px`:e} * var(--edp-scale, 1))`}function be(e){return{width:F(e),height:F(e)}}function Qe(e){if(e==null||e==="")return;if(typeof e=="number")return F(e);let t=String(e).trim();return/^\d+(\.\d+)?px$/.test(t)?F(t):t}import{createContext as Gc}from"react";var fr=Gc(!1),Yr="1px solid #d1d5db",Qc="#f3f4f6",Yc="#e3e1dc",Xc="var(--card, #fff)",Et="edp-table-first",Ga={overflowX:"auto",margin:`${F("1.25rem")} 0`},Qa={left:!1,right:!1,held:0,rtl:!1};function Ya(e,t,r,n=0){return{left:t.left<e.left-1,right:t.right>e.right+1,held:n,rtl:r}}function Xa(e,t){return Math.max(80,Math.round((e-t)*.8))}var to={borderCollapse:"separate",borderSpacing:0,width:"100%",tableLayout:"auto",fontSize:F("0.875rem"),lineHeight:1.3,borderBlockStart:Yr,borderInlineStart:Yr};function hr(e){let t=e.gray?Yc:e.header?Qc:e.sticky?Xc:void 0;return{borderBlockEnd:Yr,borderInlineEnd:Yr,padding:`${F("4px")} ${F("6px")}`,verticalAlign:"middle",overflowWrap:"normal",wordBreak:"normal",hyphens:"manual",...t?{background:t}:{},...e.header?{fontWeight:600}:{},...e.sticky?{position:"sticky",insetInlineStart:0,zIndex:1}:{}}}function gr(e){return Object.entries(e).map(([t,r])=>`${t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}:${r}`).join(";")}function ro(e){let t=[],r=new Set,n=[];(e??[]).forEach((s,i)=>{let c=0;(s.content??[]).forEach(l=>{for(;n[i]?.[c];)c++;let p=Math.max(1,l.attrs?.colspan??1),f=Math.max(1,l.attrs?.rowspan??1);for(let m=i;m<i+f;m++){let h=n[m]??(n[m]=[]);for(let d=c;d<c+p;d++)h[d]=!0}for(let m=0;m<p;m++){let h=l.attrs?.colwidth?.[m];h&&t[c+m]==null&&(t[c+m]=h)}c===0&&p===1&&r.add(l),c+=p})});let o=n.reduce((s,i)=>Math.max(s,i.length),0);return{columnWidths:t.some(s=>s!=null)?Array.from({length:o},(s,i)=>t[i]??null):[],stickyCells:r}}function no(e){return e.replace(/(\d) (?=\d)/g,"$1\xA0").replace(/(\d) (?=[\p{L}%\p{Sc}]{1,3}(?![\p{L}\p{N}]))/gu,"$1\xA0")}import{jsx as nt,jsxs as oo}from"react/jsx-runtime";import{useCallback as Jc,useEffect as Zc,useLayoutEffect as el,useRef as tl,useState as rl}from"react";var nl=typeof window<"u"?el:Zc;function Ja({side:e}){return nt("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:nt("path",{d:e==="left"?"M15 6l-6 6 6 6":"M9 6l6 6-6 6"})})}function Za({children:e}){let t=re(),r=tl(null),[n,o]=rl(Qa),a=Jc(()=>{let f=r.current,m=f?.querySelector("table");if(!f||!m)return;let h=f.querySelector(`.${Et}`),d=Ya(f.getBoundingClientRect(),m.getBoundingClientRect(),getComputedStyle(f).direction==="rtl",h?h.getBoundingClientRect().width:0);o(u=>u.left===d.left&&u.right===d.right&&u.held===d.held&&u.rtl===d.rtl?u:d)},[]);nl(()=>{let f=r.current;if(!f)return;a(),f.addEventListener("scroll",a,{passive:!0});let m=typeof ResizeObserver<"u"?new ResizeObserver(a):null;m?.observe(f);let h=f.querySelector("table");return h&&m?.observe(h),()=>{f.removeEventListener("scroll",a),m?.disconnect()}},[a]);let s=f=>{let m=r.current;m&&m.scrollBy({left:f*Xa(m.clientWidth,n.held),behavior:"smooth"})},i=n.left||n.right,c=f=>i?nt("div",{className:`edp-table-arrows edp-table-arrows--${f}`,children:oo("span",{dir:"ltr",className:"edp-table-arrows__pair",children:[nt("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(-1),disabled:!n.left,"aria-label":t.tableScrollLeft,children:nt(Ja,{side:"left"})}),nt("button",{type:"button",className:"edp-table-arrow",onClick:()=>s(1),disabled:!n.right,"aria-label":t.tableScrollRight,children:nt(Ja,{side:"right"})})]})}):null,l=n.rtl?0:n.held,p=n.rtl?n.held:0;return oo("div",{className:"edp-table-frame",style:{margin:`${F("1.25rem")} 0`},children:[c("top"),oo("div",{style:{position:"relative"},children:[nt("div",{ref:r,className:"edp-table-scroll",style:{overflowX:"auto"},children:e}),n.left&&nt("span",{className:"edp-table-shade edp-table-shade--left",style:{left:l},"aria-hidden":"true"}),n.right&&nt("span",{className:"edp-table-shade edp-table-shade--right",style:{right:p},"aria-hidden":"true"})]}),c("bottom")]})}var es={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"}},ts={border:"#2563eb",background:"#e0f2fe"},rs={border:"#dc2626",background:"#fee2e2"};function ol(e){return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||ts.border}`,background:e?.background||ts.background,borderRadius:F("4px"),padding:"0.17em 0.37em"}}function al(e){let t=e?.shape==="circle"?"50%":"9999px";return{display:"inline-block",verticalAlign:"middle",border:`2px solid ${e?.border||rs.border}`,background:e?.background||rs.background,borderRadius:t,padding:"0.15em 0.45em"}}function sl(e,t){if(!(!e&&!t))return{...e?{textAlign:e}:{},...t?{margin:0}:{}}}function qe(e,t,r){return V("div",{className:"exercise-content",children:e.content.map((n,o)=>Me(n,`node-${o}`,t,r))})}var il=/^[\u00a0\u202f ]?[.,;:!?\u2026)\]}\u00bb\u201d\u2019%\u060c\u061b\u061f]+/,cl=new Set(["blank","inlineChoiceSet"]);function ns(e,t,r,n){let o=[],a=e??[];for(let s=0;s<a.length;s++){let i=a[s],c=a[s+1],l=cl.has(i.type)&&c?.type==="text"?il.exec(c.text??"")?.[0]:void 0;if(!l||!c){o.push(Me(i,`${t}-${s}`,r,n));continue}let p=(c.text??"").slice(l.length);o.push(os("span",{style:{whiteSpace:"nowrap"},children:[V("span",{style:{whiteSpace:"normal"},children:Me(i,`${t}-${s}-a`,r,n)}),Me({...c,text:l},`${t}-${s}-p`,r,n)]},`${t}-${s}`)),p&&o.push(Me({...c,text:p},`${t}-${s+1}`,r,n)),s++}return o}function Me(e,t,r,n){switch(e.type){case"choiceSet":case"inlineChoiceSet":return V(Jr,{node:e,validationFeedback:r?.get(e.id)},t);case"blank":return e.attrs.mode==="typed"?V(Zr,{node:e,validationFeedback:r?.get(e.id)},t):V(en,{node:e,validationFeedback:r?.get(e.id)},t);case"blankPool":return V(tn,{node:e},t);case"inlinePool":return V(rn,{node:e},t);case"matchingSet":return V(nn,{node:e,validationFeedback:r?.get(e.id)},t);case"aiAnswerInput":return V(on,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"openResponseNode":return V(an,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,mediaHandler:n?.mediaHandler,answerSheetHandler:n?.answerSheetHandler},t);case"mathResponse":return V(sn,{nodeId:e.id,placeholder:e.attrs?.placeholder,hint:e.attrs?.hint,validationFeedback:r?.get(e.id),readOnly:n?.readOnly},t);case"codingResponse":return V(cn,{node:e,validationFeedback:r?.get(e.id),readOnly:n?.readOnly,executor:n?.codeExecutor},t);case"aiEvaluationConfig":return null;case"paragraph":{let o=e.attrs,a=o?.textAlign,s=o?.dir||void 0;return V("p",{dir:s,style:sl(a,n?.inTable),children:ns(e.content,t,r,n)},t)}case"heading":{let o=e.attrs.level??1,a=`h${o}`,s=e.attrs,i=s?.textAlign,c=s?.dir||void 0,l=es[o]??es[3];return V(a,{dir:c,style:{...l,...i?{textAlign:i}:{}},children:ns(e.content,t,r,n)},t)}case"blockquote":{let o=e.attrs,a=o?.dir||void 0,s=o?.textAlign;return V("blockquote",{dir:a,style:{borderInlineStart:"3px solid #d6d3cc",paddingInlineStart:"1em",margin:"0.75em 0",color:"#565b66",fontStyle:"italic",...s?{textAlign:s}:{}},children:e.content?.map((i,c)=>Me(i,`${t}-${c}`,r,n))},t)}case"text":{let o=e,a=n?.inTable?no(o.text??""):o.text??"",s=o.marks??[];if(s.length===0)return V("span",{children:a},t);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=a;for(let l of s)switch(l.type){case"bold":c=V("strong",{children:c});break;case"italic":c=V("em",{children:c});break;case"underline":c=V("u",{children:c});break;case"strike":c=V("s",{children:c});break;case"code":c=V("code",{children:c});break;case"subscript":c=V("sub",{children:c});break;case"superscript":c=V("sup",{children:c});break;case"boxedText":c=V("span",{style:ol(l.attrs),children:c});break;case"circleText":c=V("span",{style:al(l.attrs),children:c});break}return V("span",{style:Object.keys(i).length>0?i:void 0,children:c},t)}case"hardBreak":return V("br",{},t);case"resizableImage":return V("img",{src:e.attrs?.src||void 0,alt:e.attrs?.alt||"",style:{display:"inline-block",verticalAlign:"middle",width:Qe(e.attrs?.width||void 0)??"auto",height:Qe(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"resizableAudio":{let o=e.attrs??{src:""},a=n?.readOnly===!0;return V(rt,{src:o.src||"",maxPlays:a?null:o.maxPlays,learnerSpeed:o.learnerSpeed,speed:o.speed,allowSeek:a?null:o.allowSeek},t)}case"resizableVideo":return V("video",{src:e.attrs?.src||void 0,controls:!0,style:{display:"inline-block",verticalAlign:"middle",width:Qe(e.attrs?.width||void 0)??"auto",height:Qe(e.attrs?.height||void 0)??"auto",maxWidth:"100%"}},t);case"youtubeEmbed":return V("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:Qe(e.attrs?.width||480),height:Qe(e.attrs?.height||270)}},t);case"inlineMath":return V("span",{dir:"ltr",style:{unicodeBidi:"isolate",display:"inline-block"},className:"math-inline",dangerouslySetInnerHTML:{__html:Ne(e.attrs?.latex??"",!1,!0)}},t);case"blockMath":return V("div",{dir:"ltr",style:{unicodeBidi:"isolate",textAlign:"center",margin:"1em 0"},className:"math-block",dangerouslySetInnerHTML:{__html:Ne(e.attrs?.latex??"",!0,!0)}},t);case"variable":return V("span",{className:"variable",children:`{${e.attrs?.name}}`},t);default:{let o=e;if(o.type==="bulletList")return V("ul",{style:{listStyleType:"disc",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))},t);if(o.type==="orderedList")return V("ol",{style:{listStyleType:"decimal",paddingLeft:"1.5em",margin:"0.5em 0"},children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))},t);if(o.type==="listItem")return V("li",{children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))},t);if(o.type==="table"){let a=ro(o.content),s={...n,inTable:!0,stickyCells:a.stickyCells};return V(Za,{children:os("table",{style:to,children:[a.columnWidths.length>0&&V("colgroup",{children:a.columnWidths.map((i,c)=>V("col",{style:i?{width:F(i)}:void 0},c))}),V("tbody",{children:o.content?.map((i,c)=>Me(i,`${t}-${c}`,r,s))})]})},t)}return o.type==="tableRow"?V("tr",{children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))},t):o.type==="tableCell"?V("td",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?Et:void 0,style:hr({header:!1,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:V(fr.Provider,{value:!0,children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))})},t):o.type==="tableHeader"?V("th",{colSpan:o.attrs?.colspan,rowSpan:o.attrs?.rowspan,className:n?.stickyCells?.has(o)?Et:void 0,style:hr({header:!0,gray:!!o.attrs?.gray,sticky:!!n?.stickyCells?.has(o)}),children:V(fr.Provider,{value:!0,children:o.content?.map((a,s)=>Me(a,`${t}-${s}`,r,n))})},t):(console.warn(`Unknown node type during interpretation: ${e.type}`),null)}}}function fe(e,t){return e.map(r=>{if(r.type==="text"){let n=Lt(t?.inTable?no(r.text??""):r.text??""),o=r.marks??[],a=[];for(let s of o)s.type==="textStyle"&&(s.attrs?.color&&a.push(`color:${s.attrs.color}`),s.attrs?.fontSize&&a.push(`font-size:${s.attrs.fontSize}`),s.attrs?.fontFamily&&a.push(`font-family:${s.attrs.fontFamily}`));a.length>0&&(n=`<span style="${a.join(";")}">${n}</span>`);for(let s of o)switch(s.type){case"bold":n=`<strong>${n}</strong>`;break;case"italic":n=`<em>${n}</em>`;break;case"underline":n=`<u>${n}</u>`;break;case"strike":n=`<s>${n}</s>`;break;case"code":n=`<code>${n}</code>`;break;case"subscript":n=`<sub>${n}</sub>`;break;case"superscript":n=`<sup>${n}</sup>`;break;case"boxedText":{let i=s.attrs?.border||"#2563eb",c=s.attrs?.background||"#e0f2fe";n=`<span style="display:inline-block;vertical-align:middle;border:2px solid ${i};background:${c};border-radius:${F("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(r.type==="paragraph"){let n=r.content?fe(r.content,t):"",o=r.attrs?.dir,a=r.attrs?.textAlign,s=o?` dir="${o}"`:"",i=[a?`text-align:${a}`:"",t?.inTable?"margin:0":""].filter(Boolean).join(";"),c=i?` style="${i}"`:"";return t?.stripParagraphs?n:`<p${s}${c}>${n}</p>`}if(r.type==="hardBreak")return"<br/>";if(r.type==="table"){let n=ro(r.content),o=r.content?fe(r.content,{...t,inTable:!0,stickyCells:n.stickyCells}):"",a=n.columnWidths.length?`<colgroup>${n.columnWidths.map(s=>s?`<col style="width:${F(s)}">`:"<col>").join("")}</colgroup>`:"";return`<div style="${gr(Ga)}"><table style="${gr(to)}">${a}<tbody>${o}</tbody></table></div>`}if(r.type==="tableRow")return`<tr>${r.content?fe(r.content,t):""}</tr>`;if(r.type==="tableCell"){let n=r.content?fe(r.content,t):"",o=r.attrs?.colspan?` colspan="${r.attrs.colspan}"`:"",a=r.attrs?.rowspan?` rowspan="${r.attrs.rowspan}"`:"",s=!!t?.stickyCells?.has(r),i=s?` class="${Et}"`:"";return`<td${o}${a}${i} style="${gr(hr({header:!1,gray:!!r.attrs?.gray,sticky:s}))}">${n}</td>`}if(r.type==="tableHeader"){let n=r.content?fe(r.content,t):"",o=r.attrs?.colspan?` colspan="${r.attrs.colspan}"`:"",a=r.attrs?.rowspan?` rowspan="${r.attrs.rowspan}"`:"",s=!!t?.stickyCells?.has(r),i=s?` class="${Et}"`:"";return`<th${o}${a}${i} style="${gr(hr({header:!0,gray:!!r.attrs?.gray,sticky:s}))}">${n}</th>`}if(r.type==="bulletList")return`<ul style="list-style-type:disc;padding-left:1.5em">${r.content?fe(r.content,t):""}</ul>`;if(r.type==="orderedList")return`<ol style="list-style-type:decimal;padding-left:1.5em">${r.content?fe(r.content,t):""}</ol>`;if(r.type==="listItem")return`<li>${r.content?fe(r.content,t):""}</li>`;if(r.type==="blockquote"){let n=r.content?fe(r.content,t):"";return`<blockquote${r.attrs?.dir?` dir="${r.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(r.type==="resizableImage"){let n=r.attrs??{},o=Xr(n.width),a=Xr(n.height);return`<img src="${Lt(n.src??"")}" alt="${Lt(n.alt??"")}" style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"/>`}if(r.type==="resizableAudio"){let n=r.attrs??{};return`<audio controls preload="metadata" src="${Lt(n.src??"")}" style="display:inline-block;vertical-align:middle;width:${F("260px")};max-width:100%;height:${F("36px")}"></audio>`}if(r.type==="resizableVideo"){let n=r.attrs??{},o=Xr(n.width),a=Xr(n.height);return`<video src="${Lt(n.src??"")}" controls style="display:inline-block;vertical-align:middle;max-width:100%;${o?`width:${o};`:""}${a?`height:${a};`:""}"></video>`}if(r.type==="youtubeEmbed"){let n=r.attrs??{};return`<iframe src="https://www.youtube.com/embed/${Lt(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:${Qe(n.width||480)};height:${Qe(n.height||270)}"></iframe>`}return r.type==="inlineMath"?`<span dir="ltr" class="math-inline" style="unicode-bidi:isolate;display:inline-block">${Ne(r.attrs?.latex??"",!1,!0)}</span>`:r.type==="blockMath"?`<div dir="ltr" class="math-block" style="unicode-bidi:isolate;text-align:center;margin:1em 0">${Ne(r.attrs?.latex??"",!0,!0)}</div>`:r.type==="variable"?`<span class="variable">{${Lt(r.attrs?.name??"")}}</span>`:""}).join("")}function Xr(e){return e==null||e===""?null:Qe(e)??null}function Lt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}import{jsx as ll}from"react/jsx-runtime";import{createContext as dl,useContext as as,useMemo as ss}from"react";var pl={sm:.875,md:1,lg:1.25,xl:1.5},ao=dl(null);function ul(e,t){let r={...e??{}};if(t)for(let[n,o]of Object.entries(t))o!==void 0&&(r[n]=o);return r}function ml(e){return typeof e=="number"?Number.isFinite(e)&&e>0?e:1:e?pl[e]??1:1}function He(e){let t=e??{};return{scale:ml(t.size),sizeSet:t.size!==void 0,choiceLabels:t.choiceLabels??"marks",choiceColumns:t.choiceColumns,layoutBy:t.layoutBy??"window",motion:t.motion??"full",shuffleSeed:t.shuffleSeed}}function Fe(e){let t=as(ao);return ss(()=>ul(t,e),[t,e?.size,e?.choiceLabels,e?.choiceColumns,e?.layoutBy,e?.motion,e?.shuffleSeed])}function ze(){let e=as(ao);return ss(()=>He(e),[e])}function De({display:e,children:t}){let r=Fe(e);return ll(ao.Provider,{value:r,children:t})}function We(e){if(e.sizeSet)return{"--edp-scale":String(e.scale)}}function It(){let{motion:e}=ze();return{hop:e==="none"?"":"animate-hop",shake:e==="full"?"animate-shake":"",wobble:e==="full"?"animate-wobble":""}}function fl(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function hl(e){return()=>{e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function br(e,t){let r=[...e],n=hl(fl(t));for(let o=r.length-1;o>0;o--){let a=Math.floor(n()*(o+1));[r[o],r[a]]=[r[a],r[o]]}return r}import{Fragment as is,jsx as he,jsxs as gl}from"react/jsx-runtime";import{useState as ln,useEffect as ls,useRef as cs,useLayoutEffect as bl,useCallback as yl}from"react";import{createPortal as xl}from"react-dom";import vl from"clsx";var wl=typeof window<"u"?bl:ls;function so({node:e}){if(e.type==="text"){if(!e.marks||e.marks.length===0)return he(is,{children:e.text});let t=e.text||"";for(let r of e.marks)r.type==="bold"?t=he("strong",{children:t}):r.type==="italic"?t=he("em",{children:t}):r.type==="underline"?t=he("u",{children:t}):r.type==="strike"?t=he("s",{children:t}):r.type==="textStyle"&&r.attrs?.color&&(t=he("span",{style:{color:r.attrs.color},children:t}));return he(is,{children:t})}if(e.type==="paragraph")return he("span",{className:"block",children:e.content?.map((t,r)=>he(so,{node:t},r))??he("br",{})});if(e.type==="hardBreak")return he("br",{});if(e.type==="inlineMath"||e.type==="blockMath"){let t=String(e.attrs?.latex??""),r=e.type==="blockMath";return he("span",{className:r?"block text-center":void 0,dir:"ltr",dangerouslySetInnerHTML:{__html:Ne(t,r)}})}return e.content?he("span",{className:"block",children:e.content.map((t,r)=>he(so,{node:t},r))}):null}function kl({nodes:e}){return he("span",{className:"block space-y-1",style:{color:"var(--ink, #1d2025)"},children:e.map((t,r)=>he(so,{node:t},r))})}function Sl(e,t,r,n=8){let o=e.top-t.height-n;o<n&&(o=e.bottom+n);let a=e.left+e.width/2-t.width/2;return a=Math.max(n,Math.min(a,r-t.width-n)),{top:o,left:a}}function kt({hint:e}){let t=re(),[r,n]=ln(!1),[o,a]=ln(!1),[s,i]=ln(null),[c,l]=ln({}),p=cs(null),f=cs(null);ls(()=>{if(!o)return;let R=S=>{let C=S.target;p.current&&!p.current.contains(C)&&f.current&&!f.current.contains(C)&&(a(!1),n(!1))};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[o]);let m=yl(()=>{let R=p.current,S=f.current;!R||!S||i(Sl(R.getBoundingClientRect(),S.getBoundingClientRect(),window.innerWidth))},[]);wl(()=>{if(!r){i(null);return}let R=p.current;if(R){let S=getComputedStyle(R);l({direction:S.direction,fontFamily:S.fontFamily,"--edp-scale":S.getPropertyValue("--edp-scale").trim()||"1"})}return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[r,m]);let h=()=>n(!0),d=()=>{o||n(!1)},u=R=>{R.stopPropagation(),o?(a(!1),n(!1)):(a(!0),n(!0))},v=r&&typeof document<"u"?xl(he("span",{className:"edpire-scope",style:{...c,display:"contents"},children:he("span",{ref:f,role:"tooltip",className:"player-blank-hint-pop",onClick:R=>R.stopPropagation(),onMouseEnter:h,onMouseLeave:d,style:{position:"fixed",top:s?s.top:0,left:s?s.left:0,bottom:"auto",transform:"none",margin:0,visibility:s?"visible":"hidden"},children:he(kl,{nodes:e})})}),document.body):null;return gl("span",{ref:p,className:"relative inline-flex items-center align-middle",onMouseEnter:h,onMouseLeave:d,children:[he("button",{type:"button",onClick:u,className:vl("player-blank-hint-btn select-none",o&&"player-blank-hint-btn--pinned"),"aria-label":t.showHint,"aria-expanded":r,children:"?"}),v]})}function ot({hint:e}){return!e||e.length===0?null:he(kt,{hint:e})}function Al(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}var Nl=e=>e.replace(/ {2,}/g,t=>"&nbsp;".repeat(t.length-1)+" "),_l=new Set(["image","resizableImage","resizableVideo","youtubeEmbed"]);function ms(e){return(e??[]).some(t=>_l.has(t?.type)||ms(t?.content))}var ps=()=>we("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:we("path",{d:"M5 13l4 4L19 7"})}),us=()=>we("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:3,children:we("path",{d:"M6 6l12 12M18 6L6 18"})});function Jr({node:e,validationFeedback:t}){let r=ge(),n=re(),o=ze(),a=It(),{id:s,content:i,attrs:c}=e,l=c.shuffle??!1,p="prompt"in c?c.prompt:void 0,f="separator"in c?c.separator??"/":"/",m="pickLimit"in c&&c.pickLimit?c.pickLimit:1,h=c.hideCount===!0,d=h||m>1,u=!h&&m>1,v="layout"in c?c.layout??"row":"row",R=e.type==="inlineChoiceSet",S=JSON.stringify(i),C=l&&o.shuffleSeed!==void 0,w=Cl(()=>C?br(i,`${o.shuffleSeed}:${s}`):null,[C,o.shuffleSeed,s,S]),[N,k]=ds(i);io(()=>{C||k(l?Al(i):i)},[l,C,S]);let x=w??N,[y,T]=ds(new Set),g=t?.showFeedback??!1,P=t?.correctChoiceIds||[];io(()=>{let _=q=>{let O=q.answers.find(ne=>ne.nodeId===s&&ne.type==="choiceSet");O&&"selectedIds"in O.answer&&T(new Set(O.answer.selectedIds))};return r.on("answers:prefill",_),()=>r.off("answers:prefill",_)},[s,r]),io(()=>{r.emit({type:"answer:changed",answer:{nodeId:s,type:"choiceSet",timestamp:Date.now(),answer:{selectedIds:Array.from(y)}}})},[y,s,r]);let A=_=>{g||T(q=>{let z=new Set(q);return d?z.has(_)?z.delete(_):(h||z.size<m)&&z.add(_):z.has(_)?z.delete(_):(z.clear(),z.add(_)),z})},W=_=>Nl(fe(_.content)),b=_=>{let q=y.has(_),z=P.includes(_);return g?z&&q?"correct":z&&!q?"correct-unchosen":!z&&q?"incorrect":"muted":q?"selected":"idle"},M={idle:"",selected:"player-choice--selected",correct:dt("player-choice--correct",a.hop),"correct-unchosen":"player-choice--correct-unchosen",incorrect:dt("player-choice--incorrect",a.shake),muted:"player-choice--muted"},$={idle:"",selected:"player-inline-choice--selected",correct:dt("player-inline-choice--correct",a.hop),"correct-unchosen":"player-inline-choice--correct-unchosen",incorrect:dt("player-inline-choice--incorrect",a.shake),muted:"player-inline-choice--muted"};if(R)return Wt("span",{className:"inline-choice",children:[p&&Wt("span",{className:"mr-2 font-medium",children:[p,u?we("span",{className:"ms-1 opacity-60",children:n.chooseN(m)}):null]}),x.map((_,q)=>Wt(Rl,{children:[we("button",{type:"button",disabled:g,onClick:()=>A(_.id),className:dt("player-inline-choice",$[b(_.id)]),"aria-pressed":y.has(_.id),dangerouslySetInnerHTML:{__html:W(_)}}),q<x.length-1&&we("span",{className:"mx-1",children:f})]},_.id)),c.hint&&c.hint.length>0&&we(kt,{hint:c.hint})]});let B=o.layoutBy==="box",J=o.choiceColumns?Math.min(o.choiceColumns,x.length):0,Q=J?{gridAutoRows:"1fr",gridTemplateColumns:`repeat(${J}, minmax(0, 1fr))`}:{gridAutoRows:"1fr"},Y=x.some(_=>ms(_.content)),ve=o.choiceLabels==="letters",L=_=>n.choiceLetters[_]??String(_+1);return Wt("div",{className:dt("cs-player my-4 space-y-3",B&&"cs-player--box"),children:[p&&Wt("p",{className:"font-medium",children:[p,u?we("span",{className:"ms-2 text-sm opacity-70",children:n.chooseN(m)}):null]}),c.hint&&c.hint.length>0&&we(kt,{hint:c.hint}),we("div",{className:dt("cs-player__grid",v==="row"&&"cs-player__grid--row"),style:Q,children:x.map((_,q)=>{let z=b(_.id),O=z==="incorrect"?"incorrect":z==="correct"||z==="correct-unchosen"?"correct":null;return Wt("button",{type:"button",disabled:g,onClick:()=>A(_.id),className:dt("player-choice",Y&&"player-choice--tile",M[z]),"aria-pressed":y.has(_.id),children:[we("span",{className:dt("player-choice__mark",d?"player-choice__mark--box":"player-choice__mark--radio",ve&&"player-choice__mark--letter"),children:ve?L(q):z==="incorrect"?we(us,{}):we(ps,{})}),we("span",{className:"player-choice__text",dangerouslySetInnerHTML:{__html:W(_)}}),ve&&O&&we("span",{className:`player-choice__verdict player-choice__verdict--${O}`,"aria-hidden":"true",children:O==="incorrect"?we(us,{}):we(ps,{})})]},_.id)})})]})}import{jsx as pt,Fragment as Pl,jsxs as co}from"react/jsx-runtime";import{useContext as Tl,useState as Ml,useEffect as lo,useRef as El,useCallback as Ll}from"react";import $t from"clsx";function Zr({node:e,validationFeedback:t}){let r=ge(),n=re(),o=It(),{id:a,attrs:s}=e,{placeholder:i="___",width:c="auto",hint:l}=s,p=El(null),f=i.trim().split(/\s+/).filter(Boolean).length,m=Tl(fr),h=!m&&c==="auto"&&f>=4,[d,u]=Ml(""),v=t?.showFeedback??!1,R=t?.state,S=R==="validating",C=t?.displayAnswer,w=t?.message;lo(()=>{let y=T=>{let P=T.answers.find(A=>A.nodeId===a&&A.type==="blank");P&&"mode"in P.answer&&P.answer.mode==="typed"&&"text"in P.answer&&u(P.answer.text)};return r.on("answers:prefill",y),()=>r.off("answers:prefill",y)},[a,r]),lo(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"blank",timestamp:Date.now(),answer:{mode:"typed",text:d}}})},[d,a,r]);let N=y=>{u(y.target.value)},k=Ll(()=>{let y=p.current;y&&(y.style.height="auto",y.style.height=`${y.scrollHeight}px`)},[]);lo(()=>{k()},[d,k]);let x=v&&!S;return co("span",{className:m?"player-blank-cell":$t("inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 align-middle max-w-full",h&&"w-full"),children:[pt("span",{className:m?"player-blank-cell__box":$t("relative inline-block shrink-0 min-w-0 max-w-full",h&&"w-full flex-1"),children:x?pt("span",{className:$t("player-typed-blank-feedback",m&&"player-typed-blank-feedback--cell",h&&"w-full",R==="correct"&&$t("player-typed-blank-feedback--correct",o.hop),R==="partial"&&"player-typed-blank-feedback--partial",R==="incorrect"&&$t("player-typed-blank-feedback--incorrect",o.wobble)),children:d||pt("span",{className:"opacity-40",children:i})}):co(Pl,{children:[pt("textarea",{ref:p,"aria-label":n.blankAnswerAria,placeholder:i,value:d,onChange:N,disabled:v,rows:1,wrap:m?"off":void 0,className:$t("player-typed-blank",m&&"player-typed-blank--cell",h&&"w-full",S&&"player-typed-blank--pending"),style:m?void 0:c!=="auto"?{width:c}:h?{width:"100%"}:{width:`${Math.max(7,d.length+1)}ch`,maxWidth:"100%"}}),!d&&!S&&!m&&pt("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"}),S&&pt("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:pt("span",{className:"player-typed-blank-spinner","aria-label":n.aiEvaluationInProgressAria})})]})}),v&&R==="incorrect"&&C&&co("span",{className:"player-blank-reveal",children:["(",C,")"]}),v&&w&&pt("span",{className:$t("player-blank-feedback",R==="correct"&&"player-blank-feedback--correct",R==="partial"&&"player-blank-feedback--partial",R==="incorrect"&&"player-blank-feedback--incorrect"),children:w}),l&&l.length>0&&pt(kt,{hint:l})]})}import{jsx as pn,Fragment as bs,jsxs as uo}from"react/jsx-runtime";import{useEffect as ys}from"react";import un from"clsx";import{useDroppable as jl,useDndContext as Bl}from"@dnd-kit/core";import{jsx as Il}from"react/jsx-runtime";import{createContext as $l,useCallback as St,useContext as Fl,useEffect as zl,useMemo as fs,useRef as Dl,useState as po}from"react";import{useDndMonitor as Ol}from"@dnd-kit/core";var gs=$l(null);function at(){let e=Fl(gs);if(!e)throw new Error("usePool must be used within a PoolProvider");return e}function hs(e){let t={};for(let r of e??[])r.type==="blank"&&"mode"in r.answer&&r.answer.mode==="choice"&&"choiceId"in r.answer&&r.answer.choiceId&&(t[r.nodeId]={choiceId:r.answer.choiceId,poolId:r.answer.poolId||"",value:r.answer.value||""});return t}function dn({children:e,initialAnswers:t}){let r=ge(),n=fs(()=>hs(t),[t]),[o,a]=po(n),[s,i]=po({}),[c,l]=po({}),p=Dl(new Set);zl(()=>{let w=N=>{let k=hs(N.answers);Object.keys(k).length!==0&&a(x=>{if(!Object.entries(k).some(([g,P])=>x[g]?.choiceId!==P.choiceId||x[g]?.poolId!==P.poolId||x[g]?.value!==P.value))return x;let T={...x,...k};return i(g=>{let P={...g};for(let[A,W]of Object.entries(g)){let b=new Set(Object.values(T).filter(M=>M.poolId===A).map(M=>M.choiceId));P[A]={...W,available:new Set(W.choices.map(M=>M.id).filter(M=>!b.has(M)))}}return P}),T})};return r.on("answers:prefill",w),()=>r.off("answers:prefill",w)},[r]);let f=St((w,N)=>{i(k=>{let x=k[w];if(!x){let A=new Set;for(let b of Object.values(o))b.poolId===w&&A.add(b.choiceId);let W=new Set(N.map(b=>b.id).filter(b=>!A.has(b)));return{...k,[w]:{choices:N,available:W}}}let y=new Set(x.choices.map(A=>A.id)),T=new Set(N.map(A=>A.id));if(!(N.some(A=>!y.has(A.id))||x.choices.some(A=>!T.has(A.id))))return k;let P=new Set;for(let A of x.available)T.has(A)&&P.add(A);for(let A of N)y.has(A.id)||P.add(A.id);return{...k,[w]:{choices:N,available:P}}})},[o]),m=St((w,N)=>{l(k=>{let x=k[w]??[];return x.includes(N)?k:{...k,[w]:[...x,N]}}),!p.current.has(N)&&!o[N]&&(p.current.add(N),r.emit({type:"answer:changed",answer:{nodeId:N,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:w,value:""}}}))},[o,r]),h=St(w=>(c[w]??[]).find(k=>!o[k])??null,[c,o]),d=St((w,N,k,x)=>{a(y=>{let T=y[w];return T&&i(g=>{let P=g[T.poolId];if(!P)return g;let A=new Set(P.available);return A.add(T.choiceId),{...g,[T.poolId]:{...P,available:A}}}),{...y,[w]:{choiceId:k,value:x,poolId:N}}}),i(y=>{let T=y[N];if(!T)return y;let g=new Set(T.available);return g.delete(k),{...y,[N]:{...T,available:g}}}),r.emit({type:"answer:changed",answer:{nodeId:w,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:k,poolId:N,value:x}}})},[r]),u=St(w=>{let N=o[w];if(!N)return;let{poolId:k,choiceId:x}=N;i(y=>{let T=y[k];if(!T)return y;let g=new Set(T.available);return g.add(x),{...y,[k]:{...T,available:g}}}),a(y=>{let{[w]:T,...g}=y;return g}),r.emit({type:"answer:changed",answer:{nodeId:w,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:k,value:""}}})},[o,r]),v=St((w,N)=>s[w]?.available.has(N)??!1,[s]),R=St((w,N)=>s[w]?.choices.find(k=>k.id===N),[s]),S=St(()=>{a({}),i(w=>{let N={};for(let[k,x]of Object.entries(w))N[k]={choices:x.choices,available:new Set(x.choices.map(y=>y.id))};return N});for(let[w,N]of Object.entries(c))for(let k of N)r.emit({type:"answer:changed",answer:{nodeId:k,type:"blank",timestamp:Date.now(),answer:{mode:"choice",choiceId:"",poolId:w,value:""}}})},[c,r]);Ol({onDragEnd(w){window.dispatchEvent(new CustomEvent("dnd-drop",{detail:{active:w.active,over:w.over}}))}});let C=fs(()=>({blanks:o,pools:s,registerPool:f,registerBlank:m,fill:d,back:u,isAvailable:v,getChoice:R,firstEmptyBlank:h,resetAllAnswers:S}),[o,s,f,m,d,u,v,R,h,S]);return Il(gs.Provider,{value:C,children:e})}function en({node:e,validationFeedback:t}){let{id:r,attrs:n}=e,{poolId:o,placeholder:a="___",hint:s}=n,{blanks:i,fill:c,back:l,getChoice:p,registerBlank:f}=at(),m=re(),h=It(),d=i[r],u=!!d?.choiceId,v=t?.showFeedback??!1,R=t?.state,S=t?.correctChoiceIds??[],C=v&&R==="incorrect"&&S.length>0?p(o||"",S[0]):void 0,w=C?C.html.replace(/<\/?[^>]+(>|$)/g,""):void 0,{setNodeRef:N,isOver:k}=jl({id:r,data:{type:"blank",blankId:r,poolId:o}}),{active:x}=Bl(),y=!!x&&x.data.current?.poolId===o;return ys(()=>{f(o||"",r)},[o,r,f]),ys(()=>{let P=A=>{let W=A,{active:b,over:M}=W.detail||{};if(!M||M.id!==r)return;let{choiceId:$,poolId:B}=b?.data.current||{};if(!$||B!==o)return;let J=p(o||"",$);if(!J)return;let Q=J.html.replace(/<\/?[^>]+(>|$)/g,"");c(r,o||"",$,Q)};return window.addEventListener("dnd-drop",P),()=>window.removeEventListener("dnd-drop",P)},[r,o,p,c]),uo(bs,{children:[pn("span",{ref:N,onClick:()=>{u&&!v&&l(r)},className:un("player-choice-blank",k&&"player-choice-blank--over",!k&&y&&!u&&!v&&"player-choice-blank--target",u&&!v&&!k&&"player-choice-blank--filled",v&&R==="correct"&&un("player-choice-blank--correct",h.hop),v&&R==="partial"&&un("player-choice-blank--partial",h.hop),v&&R==="incorrect"&&un("player-choice-blank--incorrect",h.wobble)),title:u&&!v?m.clickToRemove:void 0,"data-node-id":r,"data-pool-id":o,children:u?uo(bs,{children:[pn("span",{children:d.value}),!v&&pn("span",{className:"player-choice-blank__clear",children:"\xD7"})]}):a}),w&&uo("span",{className:"player-blank-reveal",children:["(",w,")"]}),pn(ot,{hint:s})]})}import{jsx as ho,jsxs as Gl}from"react/jsx-runtime";import{useEffect as Ns,useRef as Ql,useState as Yl}from"react";import Xl from"clsx";import{jsx as As,jsxs as Ul}from"react/jsx-runtime";import Kl from"clsx";import{useDraggable as Vl}from"@dnd-kit/core";import{jsx as Ft,jsxs as xs}from"react/jsx-runtime";import{useEffect as vs,useState as ws}from"react";import ql from"clsx";var ks="edpire:tap-hint-placed",Ss=2;function Hl(e){let r=(()=>{try{return Number(e?.getItem(ks))||0}catch{return 0}})(),n=new Set,o=new Set,a=()=>n.forEach(s=>s());return{done:()=>r>=Ss,placed:()=>r,recordPlacement(){if(!(r>=Ss)){r+=1;try{e?.setItem(ks,String(r))}catch{}a()}},setOnScreen(s,i){let c=o.has(s);i!==c&&(i?o.add(s):o.delete(s),a())},owner(){let s=null;for(let i of o)(!s||i.compareDocumentPosition(s)&4)&&(s=i);return s},subscribe(s){return n.add(s),()=>{n.delete(s)}}}}var mo=null;function fo(){if(!mo){let e=null;try{e=typeof window<"u"?window.localStorage:null}catch{e=null}mo=Hl(e)}return mo}function Rs(){typeof window>"u"||fo().recordPlacement()}function Wl(){try{return window.matchMedia("(hover: none) and (pointer: coarse)").matches}catch{return!1}}function mn(e,t){let[,r]=ws(0),[n,o]=ws(!1);if(vs(()=>{o(Wl())},[]),vs(()=>{let s=e.current;if(!n||!s)return;let i=fo();if(i.done())return;let c=i.subscribe(()=>r(p=>p+1));if(!t||typeof IntersectionObserver>"u")return()=>{i.setOnScreen(s,!1),c()};let l=new IntersectionObserver(p=>{for(let f of p)i.setOnScreen(s,f.isIntersecting)},{threshold:.6});return l.observe(s),()=>{l.disconnect(),i.setOnScreen(s,!1),c()}},[e,n,t]),!n||!t||typeof window>"u")return!1;let a=fo();return!a.done()&&a.owner()===e.current}function Cs(){let{motion:e}=ze();return xs("span",{className:ql("player-tap-hint",e==="none"&&"player-tap-hint--still"),"aria-hidden":"true",children:[Ft("span",{className:"player-tap-hint__ripple"}),Ft("svg",{className:"player-tap-hint__hand",viewBox:"0 0 24 24",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[{stroke:"#ffffff",strokeWidth:4.5},{stroke:"currentColor",strokeWidth:1.75}].map((t,r)=>xs("g",{...t,children:[Ft("path",{d:"M22 14a8 8 0 0 1-8 8"}),Ft("path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"}),Ft("path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"}),Ft("path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"}),Ft("path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"})]},r))})]})}function Ut({poolId:e,data:t,isInline:r=!1,tapHint:n=!1}){let{isAvailable:o,firstEmptyBlank:a,fill:s}=at(),{id:i,html:c}=t,l=!o(e,i),{setNodeRef:p,attributes:f,listeners:m,transform:h,isDragging:d}=Vl({id:i,data:{type:"choice",choiceId:i,poolId:e,html:c},disabled:l});if(l)return null;let u=C=>C.replace(/<\/?[^>]+(>|$)/g,""),v=()=>{let C=a(e);if(C){let w=u(c);s(C,e,i,w),Rs()}},R=h?{transform:`translate3d(${h.x}px, ${h.y}px, 0)`}:void 0;return Ul(r?"span":"div",{ref:p,style:R,className:Kl("player-bank-pill",d&&"player-bank-pill--dragging",n&&!d&&"player-bank-pill--hinted",r&&"mx-1"),...f,...m,onClick:v,children:[As("span",{dangerouslySetInnerHTML:{__html:c},className:"pointer-events-none whitespace-pre-wrap break-words"}),n&&!d&&As(Cs,{})]})}function tn({node:e}){let t=re(),{id:r,attrs:n,content:o}=e,{shuffle:a=!0,equalWidth:s=!1}=n,{registerPool:i,isAvailable:c}=at(),l=Ql(null),[p,f]=Yl(()=>o.map(d=>({id:d.id,html:fe(d.content)})));Ns(()=>{let d=o.map(u=>({id:u.id,html:fe(u.content)}));f(a?[...d].map(u=>({v:u,r:Math.random()})).sort((u,v)=>u.r-v.r).map(u=>u.v):d)},[a,JSON.stringify(o)]),Ns(()=>{i(r,p)},[r,p,i]);let m=p.find(d=>c(r,d.id))?.id,h=mn(l,m!==void 0);return Gl("div",{ref:l,className:"player-word-bank",children:[ho("div",{className:"player-word-bank__label",children:t.wordBank}),ho("div",{className:Xl("player-word-bank__items",s&&"player-word-bank__items--grid"),children:p.map(d=>ho(Ut,{poolId:r,data:d,tapHint:h&&d.id===m},d.id))})]})}import{jsx as go,jsxs as Jl}from"react/jsx-runtime";import{useEffect as _s,useRef as Zl,useState as ed}from"react";function rn({node:e}){let{id:t,attrs:r,content:n}=e,{shuffle:o=!0,separator:a=" "}=r,{registerPool:s,isAvailable:i}=at(),c=Zl(null),[l,p]=ed(()=>n.map(h=>({id:h.id,html:fe(h.content,{stripParagraphs:!0})})));_s(()=>{let h=n.map(d=>({id:d.id,html:fe(d.content,{stripParagraphs:!0})}));p(o?[...h].map(d=>({v:d,r:Math.random()})).sort((d,u)=>d.r-u.r).map(d=>d.v):h)},[o,JSON.stringify(n)]),_s(()=>{s(t,l)},[t,l,s]);let f=l.find(h=>i(t,h.id))?.id,m=mn(c,f!==void 0);return go("span",{ref:c,style:{display:"inline-flex",flexWrap:"wrap",gap:F("0.25rem"),alignItems:"center"},children:l.map((h,d)=>Jl("span",{children:[go(Ut,{poolId:t,data:h,isInline:!0,tapHint:m&&h.id===f}),d<l.length-1&&go("span",{children:a})]},h.id))})}import{jsx as Kt,jsxs as xo}from"react/jsx-runtime";import{useState as vo,useEffect as wo,useMemo as od}from"react";import{Check as ad,X as sd}from"lucide-react";import{jsx as Re,jsxs as zt}from"react/jsx-runtime";import{useState as bo,useMemo as yo,useRef as fn,useCallback as td,useLayoutEffect as rd}from"react";var Ps="#1d2025",Ts="#8d93a0",Ms="#1f8a4c",Es="#d23b2b",nd=11;function Ls({leftItems:e,rightItems:t,connections:r,direction:n,disabled:o,feedback:a,onConnectionsChange:s}){let[i,c]=bo(null),[l,p]=bo(null),[f,m]=bo(new Map),h=fn(null),d=fn(new Map),u=fn("mouse"),v=a?.showFeedback??!1,R=yo(()=>{let L=new Map;if(a?.pairFeedback)for(let _ of a.pairFeedback)L.set(`${_.leftId}-${_.rightId}`,_.correct);return L},[a]),S=yo(()=>{let L=new Map;return a?.correctPairings?.forEach(_=>L.set(_.leftId,_.rightId)),L},[a]),C=yo(()=>{let L=new Map;return a?.correctPairings?.forEach(_=>L.set(_.rightId,_.leftId)),L},[a]),w=new Map,N=new Map;r.forEach((L,_)=>{w.set(L.leftId,_),N.set(L.rightId,_)});let k=L=>{let _=r[L];if(!v||!_)return null;let q=R.get(`${_.leftId}-${_.rightId}`);return q===!0?"correct":q===!1?"incorrect":null},x=td(()=>{if(!h.current)return;let L=h.current.getBoundingClientRect(),_=new Map;d.current.forEach((q,z)=>{if(q){let O=q.getBoundingClientRect();_.set(z,new DOMRect(O.left-L.left,O.top-L.top,O.width,O.height))}}),m(_)},[]);rd(()=>{x();let L=new ResizeObserver(x);return h.current&&L.observe(h.current),()=>L.disconnect()},[x,r,e,t]);let y=8,T=(L,_)=>{let q=f.get(L);if(!q)return null;let z=q.y+q.height/2;return _==="left"?{x:q.x+q.width,y:z}:{x:q.x-y,y:z}},g=(L,_)=>{if(o)return;let z=(_==="left"?w:N).has(L),O=i?.id===L&&i?.side===_,ne=i!==null&&i.side!==_;if(O){c(null);return}if(ne){let ce=_==="right"?i.id:L,le=_==="left"?i.id:L,ue=r.filter(U=>U.leftId!==ce&&U.rightId!==le);ue.push({leftId:ce,rightId:le}),s(ue),c(null);return}if(z&&!i){let ce=_==="left"?r.filter(le=>le.leftId!==L):r.filter(le=>le.rightId!==L);s(ce);return}c({id:L,side:_})},P=fn(null),A=(L,_,q)=>{if(o||(u.current=q.pointerType,q.pointerType==="touch"))return;q.currentTarget.setPointerCapture(q.pointerId);let z=h.current.getBoundingClientRect();P.current={x:q.clientX-z.left,y:q.clientY-z.top},p({fromId:L,fromSide:_,x:q.clientX-z.left,y:q.clientY-z.top,overId:null,overSide:null})},W=L=>{if(!l)return;let _=h.current.getBoundingClientRect(),q=L.clientX-_.left,z=L.clientY-_.top,O=l.fromSide==="left"?"right":"left",ne=O==="left"?e:t,ce=null,le=null;for(let ue of ne){let U=f.get(ue.id);if(U&&q>=U.x&&q<=U.x+U.width&&z>=U.y&&z<=U.y+U.height){ce=ue.id,le=O;break}}p(ue=>ue?{...ue,x:q,y:z,overId:ce,overSide:le}:null)},b=L=>{if(!l)return;let _=h.current.getBoundingClientRect(),q=L.clientX-_.left,z=L.clientY-_.top,O=P.current;if((O?Math.hypot(q-O.x,z-O.y):999)<8){p(null),g(l.fromId,l.fromSide);return}if(l.overId&&l.overSide){let ce=l.fromSide==="left"?l.fromId:l.overId,le=l.fromSide==="right"?l.fromId:l.overId,ue=r.filter(U=>U.leftId!==ce&&U.rightId!==le);ue.push({leftId:ce,rightId:le}),s(ue)}p(null),c(null)},M=(L,_)=>{if(!v)return null;let z=(_==="left"?w:N).get(L.id);if(z!==void 0){let O=r[z];if(R.get(`${O.leftId}-${O.rightId}`)===!0)return null}if(_==="left"){let O=S.get(L.id);return t.find(ne=>ne.id===O)?.content??null}else{let O=C.get(L.id);return e.find(ne=>ne.id===O)?.content??null}},$=(L,_)=>{let z=(_==="left"?w:N).get(L.id),O=z!==void 0,ne=i?.id===L.id&&i?.side===_,ce=i!==null&&i.side!==_&&!O,le=l?.overId===L.id&&l?.overSide===_,ue=O?k(z):null,U=O?z+1:null,X="matching-player__item";O&&(X+=" matching-player__item--matched"),ue==="correct"&&(X+=" matching-player__item--correct"),ue==="incorrect"&&(X+=" matching-player__item--incorrect"),ne&&(X+=" matching-player__item--selected"),(ce||le)&&(X+=" matching-player__item--available"),o&&(X+=" matching-player__item--disabled");let me=M(L,_);return zt("button",{ref:ae=>{ae?d.current.set(L.id,ae):d.current.delete(L.id)},type:"button",className:X,onPointerDown:ae=>A(L.id,_,ae),onClick:()=>{u.current==="touch"&&g(L.id,_)},"aria-pressed":ne,children:[_==="right"&&Re("span",{className:"matching-player__connector matching-player__connector--right","aria-hidden":!0,children:zt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[Re("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),Re("path",{d:"M12 9H6M8.5 6.5L6 9l2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),O&&_==="left"&&Re("span",{className:"matching-player__pair-num","aria-hidden":!0,children:U}),Re("span",{className:"matching-player__item-text",dangerouslySetInnerHTML:{__html:fe(L.content)}}),me&&zt("span",{className:"matching-player__correct-hint",children:["(",Re("span",{dangerouslySetInnerHTML:{__html:fe(me)}}),")"]}),O&&_==="right"&&Re("span",{className:"matching-player__pair-num","aria-hidden":!0,children:U}),_==="left"&&Re("span",{className:"matching-player__connector matching-player__connector--left","aria-hidden":!0,children:zt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[Re("circle",{cx:"9",cy:"9",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.08"}),Re("path",{d:"M6 9h6M9.5 6.5L12 9l-2.5 2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},L.id)},B=n==="ltr"?e:t,J=n==="ltr"?t:e,Q=n==="ltr"?"left":"right",Y=n==="ltr"?"right":"left";return zt("div",{ref:h,className:`matching-player__arena${l?" matching-player__arena--dragging":""}`,onPointerMove:W,onPointerUp:b,children:[zt("svg",{className:"matching-player__svg","aria-hidden":!0,children:[Re("defs",{children:[["mp-arrow-ink",Ps],["mp-arrow-correct",Ms],["mp-arrow-incorrect",Es],["mp-arrow-ghost",Ts]].map(([L,_])=>Re("marker",{id:L,markerUnits:"userSpaceOnUse",markerWidth:"11",markerHeight:"9",refX:"0",refY:"4.5",orient:"auto",children:Re("polygon",{points:"0 0, 11 4.5, 0 9",fill:_})},L))}),r.map(L=>{let _=T(L.leftId,"left"),q=T(L.rightId,"right");if(!_||!q)return null;let z=q.x-nd,O=Math.max(16,Math.abs(z-_.x)*.4),ne=`M ${_.x} ${_.y} C ${_.x+O} ${_.y}, ${z-O} ${q.y}, ${z} ${q.y}`,ce=v?R.get(`${L.leftId}-${L.rightId}`):void 0;return Re("path",{d:ne,stroke:ce===!0?Ms:ce===!1?Es:Ps,strokeWidth:"2.5",fill:"none",markerEnd:`url(#${ce===!0?"mp-arrow-correct":ce===!1?"mp-arrow-incorrect":"mp-arrow-ink"})`},`${L.leftId}-${L.rightId}`)}),l&&(()=>{let L=T(l.fromId,l.fromSide);if(!L)return null;let _=Math.abs(l.x-L.x)*.35,q=`M ${L.x} ${L.y} C ${L.x+_} ${L.y}, ${l.x-_} ${l.y}, ${l.x} ${l.y}`;return Re("path",{d:q,stroke:Ts,strokeWidth:"2",strokeDasharray:"6 4",fill:"none",markerEnd:"url(#mp-arrow-ghost)"})})()]}),zt("div",{className:"matching-player__columns",children:[Re("div",{className:"matching-player__column",children:B.map(L=>$(L,Q))}),Re("div",{className:"matching-player__column",children:J.map(L=>$(L,Y))})]})]})}var Is=e=>Number.isInteger(e)?String(e):e.toFixed(2);function $s(e){return[...e].map(t=>({v:t,r:Math.random()})).sort((t,r)=>t.r-r.r).map(t=>t.v)}function nn({node:e,validationFeedback:t}){let r=ge(),{shuffleSeed:n,layoutBy:o}=ze(),{id:a,attrs:s,leftItems:i,rightItems:c}=e,{direction:l,shuffle:p,hint:f}=s,m=JSON.stringify(i),h=JSON.stringify(c),d=p&&n!==void 0,u=od(()=>d?{left:br(i,`${n}:${a}:left`),right:br(c,`${n}:${a}:right`)}:null,[d,n,a,m,h]),[v,R]=vo(i),[S,C]=vo(c);wo(()=>{d||(p?(R($s(i)),C($s(c))):(R(i),C(c)))},[p,d,m,h]);let w=u?.left??v,N=u?.right??S,[k,x]=vo([]),y=t?.showFeedback??!1;wo(()=>{let b=M=>{let B=M.answers.find(J=>J.nodeId===a&&J.type==="matchingSet");B&&"connections"in B.answer&&x(B.answer.connections)};return r.on("answers:prefill",b),()=>r.off("answers:prefill",b)},[r,a]),wo(()=>{r.emit({type:"answer:changed",answer:{nodeId:a,type:"matchingSet",timestamp:Date.now(),answer:{connections:k}}})},[r,a,k]);let T=b=>{y||x(b)},g=t?.score,P=t?.maxScore,A=y&&g!=null&&P!=null,W=A?g>=P?"correct":g>0?"partial":"incorrect":null;return xo("div",{className:o==="box"?"matching-player matching-player--box":"matching-player",children:[f&&f.length>0&&Kt("div",{className:"matching-player-hintrow",children:Kt(ot,{hint:f})}),Kt(Ls,{leftItems:w,rightItems:N,connections:k,direction:l,disabled:y,feedback:t,onConnectionsChange:T}),A&&xo("div",{className:"matching-player-feedback matching-player-feedback--"+W,children:[W==="correct"&&Kt(ad,{size:15,style:be(15)}),W==="incorrect"&&Kt(sd,{size:15,style:be(15)}),Kt("span",{children:W==="correct"?"All matched":W==="partial"?"Partial credit":"Not matched"}),xo("span",{className:"matching-player-score",children:[Is(g)," / ",Is(P)]})]})]})}import{jsxs as Xt,jsx as Ue,Fragment as ep}from"react/jsx-runtime";import{useState as mi,useEffect as Go,useRef as fi,useCallback as Qo}from"react";import Tr from"clsx";import{jsx as ct,jsxs as Yt,Fragment as Kd}from"react/jsx-runtime";import{useCallback as Vd,useEffect as Gd,useRef as di,useState as Ko}from"react";import Vo from"clsx";import{Camera as Qd,PenLine as Yd}from"lucide-react";import{jsx as At,jsxs as Rr}from"react/jsx-runtime";import{forwardRef as Td,useEffect as wn,useImperativeHandle as Md,useRef as ni}from"react";import Ed from"clsx";import{Keyboard as Ld}from"lucide-react";import{useEditor as Id,EditorContent as $d}from"@tiptap/react";import Fd from"@tiptap/starter-kit";import{Placeholder as zd}from"@tiptap/extensions";var j=(e,t,r,n)=>({insert:e,latex:t??e,...r?{width:r}:{},...n?{class:n}:{}}),Rt=(e,t,r)=>j(e,t,r,"small"),ko=["[left]","[right]","[backspace]","[hide-keyboard]"],hn=(e,t)=>`\\begin{pmatrix}${Array.from({length:e},()=>Array.from({length:t},()=>"#?").join("&")).join("\\\\")}\\end{pmatrix}`,Fs=e=>`\\begin{vmatrix}${Array.from({length:e},()=>Array.from({length:e},()=>"#?").join("&")).join("\\\\")}\\end{vmatrix}`,zs=e=>`\\begin{cases}${Array.from({length:e},()=>"#?").join("\\\\")}\\end{cases}`,Oe={lim:"\\lim\\limits_{x\\to#?}#?",matrix2:hn(2,2),matrix3:hn(3,3),column2:hn(2,1),column3:hn(3,1),det2:Fs(2),det3:Fs(3),system2:zs(2),system3:zs(3),identity3:"I_3",inverse:"#@^{-1}",openInterval:"\\rbrack #?;#?\\lbrack",closedInterval:"\\lbrack #?;#?\\rbrack",set:"\\lbrace #?\\rbrace"},id={id:"edp-analyse",label:"lim, \u221E",tooltip:"Analyse",rows:[[j(Oe.lim,"\\lim"),j("\\infty","\\infty"),j("+\\infty","+\\infty"),j("-\\infty","-\\infty"),j("#@^{+}","x^{+}"),j("#@^{-}","x^{-}"),j("#@'","f'"),j("\\circ","\\circ")],[j("\\ln(#0)","\\ln"),j("e^{#0}","e^{x}"),j("\\sqrt{#0}","\\sqrt{x}"),j("\\left|#0\\right|","|x|"),j("\\frac{#@}{#?}","\\frac{a}{b}"),j("#@^{#?}","x^{n}"),j("#@^{2}","x^{2}"),j("\\pi","\\pi")],[j("x"),j("f(x)","f(x)"),j("("),j(")"),j("="),j("\\ne"),j("\\le"),j("\\ge")],[j("<"),j(">"),j(","),j(";"),...ko]]},cd={id:"edp-sets",label:"\u211D, \u222A",tooltip:"Ensembles",rows:[[j("\\R","\\mathbb{R}"),j("\\N","\\mathbb{N}"),j("\\Z","\\mathbb{Z}"),j("\\Q","\\mathbb{Q}"),j("\\setminus","\\setminus"),j("\\cup","\\cup"),j("\\cap","\\cap"),j("\\emptyset","\\emptyset")],[j("\\in","\\in"),j("\\notin","\\notin"),j("\\subset","\\subset"),j(Oe.set,"\\lbrace\\,\\rbrace"),j(Oe.openInterval,"\\rbrack a;b\\lbrack"),j(Oe.closedInterval,"\\lbrack a;b\\rbrack"),j("\\rbrack","\\rbrack"),j("\\lbrack","\\lbrack")],[j(";"),j(","),j("("),j(")"),j("-\\infty","-\\infty"),j("+\\infty","+\\infty"),j("x"),j("=")],ko]},ld={id:"edp-matrices",label:"(\u25A6), {",tooltip:"Matrices",rows:[[Rt(Oe.matrix2,"\\begin{pmatrix}\\square&\\square\\\\\\square&\\square\\end{pmatrix}",1.5),Rt(Oe.matrix3,"\\begin{pmatrix}\\square&\\square&\\square\\\\\\square&\\square&\\square\\\\\\square&\\square&\\square\\end{pmatrix}",1.5),Rt(Oe.column2,"\\begin{pmatrix}\\square\\\\\\square\\end{pmatrix}"),Rt(Oe.column3,"\\begin{pmatrix}\\square\\\\\\square\\\\\\square\\end{pmatrix}")],[Rt(Oe.det2,"\\begin{vmatrix}\\square&\\square\\\\\\square&\\square\\end{vmatrix}",1.5),Rt(Oe.det3,"\\begin{vmatrix}\\square&\\square&\\square\\\\\\square&\\square&\\square\\\\\\square&\\square&\\square\\end{vmatrix}",1.5),Rt(Oe.system2,"\\begin{cases}\\square\\\\\\square\\end{cases}"),Rt(Oe.system3,"\\begin{cases}\\square\\\\\\square\\\\\\square\\end{cases}")],[j("I_3","I_3"),j(Oe.inverse,"A^{-1}"),j("\\times","\\times"),j("\\cdot","\\cdot"),j("\\det","\\det"),j("="),j(","),j(";")],ko]},dd=[id,cd,ld,"numeric","greek"],Ds=!1;function Os(){if(Ds||typeof window>"u")return;let e=window.mathVirtualKeyboard;if(e)try{e.layouts=dd,Ds=!0}catch{}}var pd=new Set(["ce-evaluate","ce-simplify","ce-solve","color","background-color","mode","variant","decoration"]);function gn(e){let t=e,r=t?.menuItems;if(!(!t||!Array.isArray(r)))try{t.menuItems=r.filter(n=>!n.id||!pd.has(n.id))}catch{}}import{Node as Ws,mergeAttributes as Us}from"@tiptap/core";import{Fragment as ud}from"@tiptap/pm/model";import{TextSelection as js}from"@tiptap/pm/state";var Ao={ownLine:!1,centred:!1,onOpenWindow:null};function md(e){return e.storage.mathTyping?.chip??{unwrap:"Back to text",ownLine:"On its own line"}}function Bs(e,t){let r=t==="start"?e.firstChild:e.lastChild;if(!r?.isText)return e;let n=t==="start"?(r.text??"").replace(/^\s+/,""):(r.text??"").replace(/\s+$/,"");if(n===r.text)return e;let o=t==="start"?0:e.childCount-1,a=n?e.content.replaceChild(o,e.type.schema.text(n,r.marks)):t==="start"?e.content.cut(r.nodeSize):e.content.cut(0,e.content.size-r.nodeSize);return e.copy(a)}function qs(e){let t=!1;return e.forEach(r=>{(!r.isText||(r.text??"").trim())&&(t=!0)}),t}var fd={le:"<=",leq:"<=",ge:">=",geq:">=",ne:"!=",neq:"!=",times:"*",cdot:"*",div:"/",pi:"\u03C0",in:"\u2208",infty:"\u221E",pm:"\xB1",lt:"<",gt:">",approx:"\u2248",degree:"\xB0",circ:"\xB0"};function yr(e,t){for(;e[t]===" ";)t++;if(e[t]!=="{")return[e[t]??"",t+1];let r=0;for(let n=t;n<e.length;n++)if(e[n]==="{")r++;else if(e[n]==="}"&&--r===0)return[e.slice(t+1,n),n+1];return[e.slice(t+1),e.length]}var So=e=>e.length>1&&!/^[\dA-Za-zπ.,]+$/.test(e)&&!/^\(.*\)$/.test(e)?`(${e})`:e;function xr(e){let t="",r=0,n=e.replace(/\\(left|right)\b/g,"").replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"");for(;r<n.length;){let o=n[r];if(o==="\\"){let a=n.slice(r+1).match(/^([A-Za-z]+|.)/)?.[1]??"";if(r+=1+a.length,a==="frac"||a==="dfrac"||a==="tfrac"){let[s,i]=yr(n,r),[c,l]=yr(n,i);t+=`${So(xr(s))}/${So(xr(c))}`,r=l}else if(a==="sqrt"){let[s,i]=yr(n,r);t+=`sqrt(${xr(s)})`,r=i}else if(a==="text"||a==="mathrm"||a==="operatorname"){let[s,i]=yr(n,r);t+=s,r=i}else a===","||a===" "||a===";"||a==="quad"?t+=" ":a==="{"||a==="}"?t+=a:t+=fd[a]??a}else if(o==="^"||o==="_"){let[a,s]=yr(n,r+1);t+=`${o}${So(xr(a))}`,r=s}else o==="{"||o==="}"||o===" "||(t+=o),r++}return t}function Ks(e,t,r){let n=e.doc.nodeAt(t);if(!n||n.type.name!=="inlineMath"&&n.type.name!=="blockMath")return null;let{schema:o}=e,a=r?o.text(r):null;if(n.type.name==="blockMath"){let i=e.tr.replaceWith(t,t+n.nodeSize,o.nodes.paragraph.create(null,a));return i.setSelection(js.create(i.doc,t+1+r.length))}let s=a?e.tr.replaceWith(t,t+n.nodeSize,a):e.tr.delete(t,t+n.nodeSize);return s.setSelection(js.create(s.doc,t+r.length))}function Vs(e,t){let r=e.doc.nodeAt(t),{schema:n}=e;if(!r||!n.nodes.blockMath||!n.nodes.inlineMath)return null;let o={...r.attrs};if(r.type.name==="blockMath"){let h=n.nodes.paragraph.create(null,n.nodes.inlineMath.create(o));return e.tr.replaceWith(t,t+r.nodeSize,h)}if(r.type.name!=="inlineMath")return null;let a=e.doc.resolve(t);if(a.depth<1)return null;let s=a.parent,i=t-a.start(),c=Bs(s.cut(0,i),"end"),l=Bs(s.cut(i+r.nodeSize),"start"),p=[...qs(c.content)?[c]:[],n.nodes.blockMath.create(o),...qs(l.content)?[l]:[]],f=a.node(a.depth-1),m=a.index(a.depth-1);return f.canReplace(m,m+1,ud.from(p))?e.tr.replaceWith(a.before(),a.after(),p):null}var Ro=null,No=!1;function Ye(){return Ro||(Ro=import("mathlive").then(({MathfieldElement:e})=>(e.soundsDirectory=null,Os(),No=!0,!0)).catch(()=>!1)),Ro}function _o(){return No}var Vt=new WeakMap,st={el:null};function it(){return window.mathVirtualKeyboard??null}function hd(){let e=it();e?.visible&&document.activeElement?.tagName!=="MATH-FIELD"&&e.hide()}var vr=null;function bn(){let e=vr;if(!e)return;let t=it(),r=!!t?.visible&&(t.boundingRect?.height??0)>0;e.hidden=!r,r&&t&&(e.style.bottom=`${Math.round(window.innerHeight-t.boundingRect.top+8)}px`)}function yn(e,t){if(!vr){let r=document.createElement("button");r.type="button",r.className="edp-mathkb-close",r.textContent="\u2715",r.hidden=!0,r.addEventListener("mousedown",n=>n.preventDefault()),r.addEventListener("click",()=>it()?.hide()),document.body.append(r),e.addEventListener("visibilitychange",bn),e.addEventListener("geometrychange",bn),window.addEventListener("resize",bn),vr=r}vr.title=t,vr.setAttribute("aria-label",t);for(let r of[0,120,400])setTimeout(bn,r)}function Gs(e){return e.shadowRoot?.querySelector(".ML__keyboard-sink")??null}function kr(e){Gs(e)?.setAttribute("inputmode",it()?.visible?"none":"text")}var wr={el:null},gd=/(=|\+|-|\\times|\\cdot|\\le|\\ge|\\ne|\\in|\\lt|\\gt|<|>|\(|\\left\()\s*$/,bd=/([.,;:])$/;function Qt(e,t,r,n,o){let a=0,s=()=>{let c=e.nodeDOM(t)?.querySelector?.("math-field");if(c&&typeof c.executeCommand=="function"){n&&Vt.set(c,n),c.focus();let l=Gs(c);l&&(kr(c),l.focus({preventScroll:!0})),document.activeElement!==c&&(wr.el=c,c.addEventListener("focus",()=>wr.el===c&&(wr.el=null),{once:!0})),r==="placeholder"?(c.position=0,c.executeCommand("moveToNextPlaceholder")):c.position=r==="end"?c.lastOffset??0:0,o&&(c.executeCommand(["typedText",o]),r==="placeholder"&&/^\d$/.test(o)&&c.executeCommand("moveAfterParent"));return}++a<60&&requestAnimationFrame(s)};s()}function Gt(e){e.view.focus()}function Hs(e,t,r){let n=e.chain().setTextSelection(t);r&&n.insertContent(r),n.run(),Gt(e)}var Co=class{constructor({node:t,editor:r,getPos:n,extension:o}){this.field=null,this.echoed=null,this.cleanups=[],this.fieldCleanup=null,this.node=t,this.editor=r,this.getPos=typeof n=="function"?n:()=>{},this.isLine=t.type.name==="blockMath",this.options={...Ao,...o?.options},this.editable=r.isEditable,this.dom=document.createElement(this.isLine?"div":"span"),this.dom.className=this.isLine?`edp-sheet-line${this.options.centred?" edp-sheet-line--centred":""}`:"edp-sheet-formula",this.dom.dir="ltr",this.dom.setAttribute(this.isLine?"data-block-math":"data-inline-math",""),this.render();let a=()=>{this.editor.isEditable!==this.editable&&(this.editable=this.editor.isEditable,this.render())};r.on("transaction",a),this.cleanups.push(()=>r.off("transaction",a));let s=this.options.onOpenWindow;if(s){let i=c=>{if(!this.editor.isEditable||c.target?.closest?.(".edp-math-chip"))return;let l=this.getPos();l!=null&&(c.preventDefault(),s({editor:this.editor,pos:l,latex:this.latex,block:this.isLine}))};this.dom.addEventListener("dblclick",i),this.cleanups.push(()=>this.dom.removeEventListener("dblclick",i))}}get latex(){return String(this.node.attrs.latex??"")}render(){if(this.dropField(),this.dom.replaceChildren(),this.editable&&No){this.mountField();return}let t=document.createElement(this.isLine?"div":"span");t.className="edp-sheet-static";let r=this.latex.replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"");t.innerHTML=r?Ne(r,!1):"",this.dom.append(t),this.editable&&Ye().then(n=>{n&&this.editable&&!this.field&&this.dom.isConnected&&this.render()})}mountField(){let t=document.createElement("math-field");if(t.className=this.isLine?"edp-sheet-mf edp-sheet-mf--line":"edp-sheet-mf",t.setAttribute("math-virtual-keyboard-policy","manual"),t.setAttribute("smart-fence","on"),t.value=this.latex,this.isLine&&this.options.centred){let d=document.createElement("span");d.className="edp-sheet-line-box",d.append(t,this.chip()),this.dom.append(d)}else this.dom.append(t,this.chip());this.field=t;let r=this.editor,n=()=>this.getPos(),o=d=>{let u=n();u!=null&&Hs(r,u+this.node.nodeSize,d)},a=()=>{let d=n();d!=null&&Hs(r,d)},s=()=>{let d=n();d!=null&&r.view.dispatch(r.state.tr.delete(d,d+this.node.nodeSize))},i=()=>t.position===t.lastOffset,c=()=>{Vt.delete(t),this.echoed=t.value;let d=n();d!=null&&r.view.dispatch(r.state.tr.setNodeMarkup(d,void 0,{...this.node.attrs,latex:t.value}))},l=()=>{st.el=t,gn(t)},p=()=>{st.el===t&&(st.el=null),setTimeout(()=>{!t.value&&t.isConnected&&document.activeElement!==t&&r.isEditable&&s(),hd()},0)},f=d=>{let u=d.detail?.direction;u==="backward"||u==="upward"?a():o()},m=d=>{if(d.key===" "&&!d.ctrlKey&&!d.metaKey){d.preventDefault(),d.stopPropagation(),Vt.delete(t);let u=t.position;if(t.executeCommand?.("moveAfterParent"),t.position!==u)return;if(!i()){t.position=t.lastOffset??t.position;return}if(!t.value||gd.test(t.value))return;let v=t.value.match(bd)?.[1],R=n();if(v&&R!=null&&t.value.length>1){let S=t.value.slice(0,-1);t.value=S,this.echoed=S,r.view.dispatch(r.state.tr.setNodeMarkup(R,void 0,{...this.node.attrs,latex:S})),o(`${v} `);return}o(" ")}else if((d.ctrlKey||d.metaKey)&&d.key.toLowerCase()==="z"&&!d.shiftKey&&Vt.has(t)){d.preventDefault(),d.stopPropagation();let u=Vt.get(t)??[];Vt.delete(t);let v=n();if(v==null)return;r.chain().insertContentAt({from:v,to:v+this.node.nodeSize},u).run(),Gt(r)}else if(d.key==="Enter"){d.preventDefault(),d.stopPropagation();let u=n();if(u==null)return;r.chain().setTextSelection(u+this.node.nodeSize).splitBlock().run(),Gt(r)}else d.key==="Backspace"&&!t.value?(d.preventDefault(),d.stopPropagation(),a(),s()):d.key==="Escape"&&(d.preventDefault(),o())};t.addEventListener("input",c),t.addEventListener("focus",l),t.addEventListener("focusout",p),t.addEventListener("move-out",f),t.addEventListener("keydown",m,!0);let h=()=>kr(t);t.addEventListener("pointerdown",h,!0),this.fieldCleanup=()=>{t.removeEventListener("pointerdown",h,!0),t.removeEventListener("input",c),t.removeEventListener("focus",l),t.removeEventListener("focusout",p),t.removeEventListener("move-out",f),t.removeEventListener("keydown",m,!0),st.el===t&&(st.el=null)}}chip(){let t=document.createElement("span");t.className="edp-math-chip",t.contentEditable="false";let r=(s,i,c)=>{let l=document.createElement("button");return l.type="button",l.className=`edp-math-chip-btn ${s}`,l.textContent=i,l.addEventListener("mousedown",p=>p.preventDefault()),l.addEventListener("click",p=>{p.preventDefault(),p.stopPropagation(),c()}),l},n=r("edp-math-chip-unwrap","\xD7",()=>this.unwrap()),o=this.options.ownLine?r("edp-math-chip-line","\u2195",()=>this.toggleLine()):null,a=()=>{let s=md(this.editor);n.title=s.unwrap,n.setAttribute("aria-label",s.unwrap),o&&(o.title=s.ownLine,o.setAttribute("aria-label",s.ownLine),o.setAttribute("aria-pressed",String(this.isLine)))};return a(),t.addEventListener("pointerenter",a),o&&t.append(o),t.append(n),t}plainText(){return xr(this.field?.value??this.latex)}unwrap(){let t=this.getPos();if(t==null)return;let r=Ks(this.editor.state,t,this.plainText());r&&(this.editor.view.dispatch(r),Gt(this.editor))}toggleLine(){let t=this.getPos();if(t==null)return;let r=Vs(this.editor.state,t);r&&this.editor.view.dispatch(r)}dropField(){this.fieldCleanup?.(),this.fieldCleanup=null,this.field=null}update(t){if(t.type!==this.node.type)return!1;this.node=t;let r=this.field;return r?r.value!==this.latex&&this.latex!==this.echoed&&document.activeElement!==r&&(r.value=this.latex):this.render(),!0}selectNode(){this.dom.classList.add("is-selected")}deselectNode(){this.dom.classList.remove("is-selected")}stopEvent(t){return!!t.target?.closest?.("math-field, .edp-math-chip")}ignoreMutation(){return!0}destroy(){this.dropField();for(let t of this.cleanups.splice(0))t()}},Qs=e=>new Co(e),Po=Ws.create({name:"inlineMath",addOptions(){return{...Ao}},group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"span[data-inline-math]"}]},renderHTML({HTMLAttributes:e}){return["span",Us(e,{"data-inline-math":""})]},addNodeView(){return Qs}}),To=Ws.create({name:"blockMath",addOptions(){return{...Ao}},group:"block",atom:!0,selectable:!0,addAttributes(){return{latex:{default:""}}},parseHTML(){return[{tag:"div[data-block-math]"}]},renderHTML({HTMLAttributes:e}){return["div",Us(e,{"data-block-math":""})]},addNodeView(){return Qs}});import{Extension as Sd}from"@tiptap/core";import{Plugin as Rd,PluginKey as Cd}from"@tiptap/pm/state";var Mo="\\placeholder{}",yd=/[A-Za-z0-9.,()[\]π²³+\-*×·−]/,Js=/^[+\-−*×·=/^)]/,xd=/[+\-−*×·=(]$/,vd=e=>/[A-Za-z]{2,}/.test(e.replace(/\([^()]*\)/g,""));function Ys(e){let t=e.endsWith(" ")?e.length-1:e.length,r="",n=null;for(;t>0;){let o=t;for(;o>0&&yd.test(e[o-1]);)o--;let a=e.slice(o,t);if(!a||vd(a)||n!==null&&!(xd.test(a)||Js.test(n))||(r=e.slice(o),n=a,o<2||e[o-1]!==" "))break;t=o-1}return r}function wd(e){if(e.endsWith(")")){let r=0;for(let n=e.length-1;n>=0;n--)if(e[n]===")")r++;else if(e[n]==="("&&--r===0)return e.slice(0,n).match(/[A-Za-z]$/)?e.slice(n-1):e.slice(n);return null}let t=e.match(/(\d+(?:[.,]\d+)?|[A-Za-zπ²³])$/);return t?t[0]:null}function Eo(e){return e.replace(/ /g,"").replace(/[*×·]/g,"\\times ").replace(/−/g,"-").replace(/π/g,"\\pi ").replace(/²/g,"^{2}").replace(/³/g,"^{3}")}var kd=e=>/[\d²³]|[+\-*×·−()]/.test(e)||/^[A-Za-zπ](\([^()]*\))?$/.test(e);function Xs(e,t){let n=e.slice(0,e.length-t.length).match(new RegExp("\uFFFC( ?)$"));if(!n)return 0;let o=t.trim();return o===""||Js.test(o)?n[0].length:0}function Lo(e,t){if(t==="t"&&/(^|[^A-Za-z])sqr$/.test(e))return{take:3,latex:`\\sqrt{${Mo}}`,placeholder:!0,merge:!1};if(/^[+\-−*×]$/.test(t)){let r=e.match(new RegExp("\uFFFC( ?)$"));if(!r)return null;let n=t==="*"||t==="\xD7"?"\\times ":t==="\u2212"?"-":t;return{take:r[0].length,latex:n,placeholder:!1,merge:!0}}if(t==="^"||t==="/"){if(e.endsWith(" "))return null;let r=Ys(e),n=r?wd(r):null;if(!r||!n)return null;let o=Eo(r.slice(0,r.length-n.length)),a=Eo(n),s=t==="^"?`${o}${a}^{${Mo}}`:`${o}\\frac{${a}}{${Mo}}`,i=Xs(e,r);return{take:r.length+i,latex:s,placeholder:!0,merge:i>0}}if(t==="="){let r=e.match(/([<>!])$/)?.[1],n=r?e.slice(0,-1):e,o=Ys(n),a=Xs(n,o),s=r==="<"?"\\le ":r===">"?"\\ge ":r==="!"?"\\ne ":"=";return!r&&!a&&(!o.trim()||!kd(o.trim()))?null:{take:o.length+a+(r?1:0),latex:`${Eo(o)}${s}`,placeholder:!1,merge:a>0}}return null}function Zs(e){return e.replace(/\\placeholder(\[[^\]]*\])?\{\}/g,"")}var Ct="\\placeholder{}",xn={power:{inField:"^{2}",create:"#@^{2}"},fraction:{inField:`\\frac{${Ct}}{${Ct}}`,create:`\\frac{${Ct}}{${Ct}}`},root:{inField:`\\sqrt{${Ct}}`,create:`\\sqrt{${Ct}}`},pi:{inField:"\\pi",create:"\\pi"},le:{inField:"\\le",create:"\\le"},ge:{inField:"\\ge",create:"\\ge"},ne:{inField:"\\ne",create:"\\ne"},in:{inField:"\\in",create:"\\in"}},Ad=new Set(["le","ge","ne","in"]);function $o(e,t){let r=e.doc.resolve(t),n=e.schema.nodes.inlineMath;return!n||!r.parent.isTextblock||r.parent.type.spec.code||r.marks().some(o=>o.type.spec.code)?!1:r.parent.canReplaceWith(r.index(),r.index(),n)}function ti(e,t,r,n){if(!$o(e,t))return null;let o=e.doc.resolve(t),a=t-o.parentOffset,s=e.doc.textBetween(Math.max(a,t-80),t,void 0,"\uFFFC"),i=Lo(s,r);if(!i)return null;let c=t-i.take,l=i.latex,p=[],f=s.slice(s.length-i.take)+r+(n??""),m={};if(i.merge){let d=e.doc.nodeAt(c);if(d?.type.name!=="inlineMath")return null;l=`${d.attrs.latex??""}${l}`,m=d.attrs,p.push({type:"inlineMath",attrs:{...d.attrs}}),f=f.slice(1)}return p.push({type:"text",text:f}),{tr:e.tr.replaceWith(c,t,e.schema.nodes.inlineMath.create({...m,latex:l})),pos:c,placeholder:i.placeholder,revert:p}}function Sr(e,t,r,n){if(!_o())return Ye(),!1;let o=ti(e.state,t,r,n);return o?(e.dispatch(o.tr),Qt(e,o.pos,o.placeholder?"placeholder":"end",n?void 0:o.revert,n),!0):!1}function Nd(e,t,r){let n=e.state.doc.resolve(t);if(!n.parent.isTextblock)return!1;let a=e.state.doc.textBetween(Math.max(t-n.parentOffset,t-2),t,void 0,"\uFFFC").match(new RegExp(`${"\uFFFC"}( ?)$`));if(!a)return!1;let s=t-a[0].length;a[1]&&e.dispatch(e.state.tr.delete(t-1,t)),Qt(e,s,"end");let i=Fo(e,s);return i?.executeCommand?.(["insert",r,{selectionMode:"after"}]),!!i}function Fo(e,t){return e.nodeDOM(t)?.querySelector?.("math-field")??null}function ri(e,t){let{from:r,empty:n,$from:o}=e.state.selection,a=n&&o.parent.isTextblock?r:e.state.selection.to;if(!$o(e.state,a))return null;if(e.chain().insertContentAt(a,{type:"inlineMath",attrs:{latex:""}}).run(),Qt(e.view,a,"end"),t){let s=t.includes(Ct)||t.includes("#");Fo(e.view,a)?.executeCommand?.(["insert",t,{selectionMode:s?"placeholder":"after"}])}return a}function vn(e,t){if(!e.isEditable)return;if(!_o()){Ye().then(a=>a&&vn(e,t));return}let r=xn[t],n=st.el;if(n&&e.view.dom.contains(n)){n.executeCommand?.(["insert",r.inField,{selectionMode:r.inField.includes(Ct)?"placeholder":"after"}]),n.focus();return}let{selection:o}=e.state;o.empty&&(t==="power"&&Sr(e.view,o.from,"^","2")||t==="fraction"&&Sr(e.view,o.from,"/")||Ad.has(t)&&Nd(e.view,o.from,r.inField))||ri(e,r.create)}function zo(e){if(!e.isEditable)return;let t=it();if(t?.visible){t.hide();return}it()?ei(e):Ye().then(r=>r&&ei(e))}function ei(e){let t=it();if(!t)return;let r=st.el;if(!r||!e.view.dom.contains(r)){let o=ri(e,"");r=o==null?null:Fo(e.view,o)}if(!r)return;let n=()=>{t.visible||(t.removeEventListener("visibilitychange",n),st.el&&kr(st.el))};t.addEventListener("visibilitychange",n),t.show(),yn(t,Pd(e).closeKeyboard),kr(r)}var _d=new Cd("edpMathTyping"),Do=Sd.create({name:"mathTyping",addStorage(){return{chip:{unwrap:"Back to text",ownLine:"On its own line",closeKeyboard:"Close the maths keyboard"}}},onCreate(){this.editor.isEditable&&Ye()},addProseMirrorPlugins(){return[new Rd({key:_d,props:{handleTextInput(e,t,r,n){return t!==r?!1:n.length===1?Sr(e,t,n):n.length===2&&n[0]==="^"?Sr(e,t,"^",n[1]):!1},handleKeyDown(e,t){let r=wr.el;if(r?.isConnected&&e.dom.contains(r)&&t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey)return r.executeCommand?.(["typedText",t.key]),t.preventDefault(),!0;let{selection:n}=e.state;if(!n.empty||t.ctrlKey||t.metaKey||t.altKey||t.isComposing)return!1;if(t.key.length===1&&Sr(e,n.from,t.key))return t.preventDefault(),!0;if(t.shiftKey)return!1;let o=getComputedStyle(e.dom).direction==="rtl",a=t.key==="Backspace"||t.key===(o?"ArrowRight":"ArrowLeft"),s=t.key===(o?"ArrowLeft":"ArrowRight"),{$from:i}=n;return a&&i.nodeBefore?.type.name==="inlineMath"?(Qt(e,i.pos-i.nodeBefore.nodeSize,"end"),!0):s&&i.nodeAfter?.type.name==="inlineMath"?(Qt(e,i.pos,"start"),!0):!1}}})]}});function Pd(e){return e.storage.mathTyping?.chip??{unwrap:"Back to text",ownLine:"On its own line",closeKeyboard:"Close the maths keyboard"}}function Oo(e,t){let r=e.storage.mathTyping;r&&(r.chip={...r.chip,...t})}var Dd={keysAria:"Maths keys",more:"More",power:"Squared",fraction:"Fraction",root:"Square root",pi:"Pi",le:"Less than or equal to",ge:"Greater than or equal to",ne:"Not equal to",in:"Belongs to",unwrap:"Back to text",closeKeyboard:"Close the maths keyboard"},kn={power:Rr("span",{className:"edp-key-pow",children:["x",At("sup",{children:"2"})]}),fraction:Rr("span",{className:"edp-key-frac",children:[At("span",{children:"a"}),At("span",{children:"b"})]}),root:"\u221A",pi:"\u03C0",le:"\u2264",ge:"\u2265",ne:"\u2260",in:"\u2208"},Od=["power","fraction","root","pi","le","ge","ne","in"];function jo(e){let t=[];for(let r of e){if(r.type==="inlineMath"||r.type==="blockMath"){let o=Zs(String(r.attrs?.latex??"")),a=r.type==="inlineMath"&&o.length>1?o.match(/([.,;:])$/)?.[1]:void 0;a&&(o=o.slice(0,-1)),o&&t.push({...r,attrs:{...r.attrs,latex:o}}),a&&t.push({type:"text",text:a});continue}let n=t[t.length-1];if(r.type==="text"&&n?.type==="text"&&!n.marks&&!r.marks){t[t.length-1]={...n,text:`${n.text??""}${r.text??""}`};continue}t.push(r.content?{...r,content:jo(r.content)}:r)}return t}var Bo=Td(function({initialContent:t,onChange:r,disabled:n=!1,placeholder:o,labels:a,extraTools:s,className:i,keys:c=!0,ariaLabel:l,ariaLabelledBy:p,dir:f},m){let h={...Dd,...a},d=ni(r);d.current=r;let u=Id({extensions:[Fd.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1}),Po,To,Do,zd.configure({placeholder:o??"",showOnlyWhenEditable:!0})],immediatelyRender:!1,editable:!n,content:t?.length?{type:"doc",content:t}:"",editorProps:{attributes:{class:"edp-sheet-doc",role:"textbox","aria-multiline":"true",...l?{"aria-label":l}:{},...p?{"aria-labelledby":p}:{},...f?{dir:f}:{}}},onUpdate({editor:C}){C.isEditable&&d.current(jo(C.getJSON().content??[]))}});wn(()=>{n||Ye()},[n]),wn(()=>{u&&Oo(u,{unwrap:h.unwrap,closeKeyboard:h.closeKeyboard})},[u,h.unwrap,h.closeKeyboard]),wn(()=>{u&&(u.setEditable(!n,!1),u.view.dispatch(u.state.tr.setMeta("edpSheetEditable",!n)))},[n,u]);let v=ni(null);wn(()=>{u&&v.current&&(u.commands.setContent({type:"doc",content:v.current},{emitUpdate:!1}),v.current=null)},[u]),Md(m,()=>({setContent(C){u?u.commands.setContent({type:"doc",content:C},{emitUpdate:!1}):v.current=C},clear(){u?.commands.clearContent(!1)},getContent(){return jo(u?.getJSON().content??[])},insertFormula(C){if(!u)return;let{to:w}=u.state.selection;u.chain().insertContentAt(w,[{type:"inlineMath",attrs:{latex:C}},{type:"text",text:" "}]).run(),Gt(u)}}),[u]);let R=C=>{u&&!n&&vn(u,C)},S=()=>{u&&!n&&zo(u)};return Rr("div",{className:Ed("edp-sheet-box",n&&"edp-sheet-box--readonly",i),children:[At("div",{className:"edp-sheet-page",children:At($d,{editor:u})}),!n&&(c||s)&&Rr("div",{className:"edp-sheet-keys",role:"toolbar","aria-label":h.keysAria,children:[c&&Od.map(C=>At("button",{type:"button",className:"edp-sheet-key",title:h[C],"aria-label":h[C],onMouseDown:w=>w.preventDefault(),onClick:()=>R(C),children:kn[C]},C)),c&&Rr("button",{type:"button",className:"edp-sheet-key edp-sheet-key--more",onMouseDown:C=>C.preventDefault(),onClick:S,children:[At(Ld,{size:16,"aria-hidden":"true"})," ",h.more]}),s&&At("span",{className:"edp-sheet-keys-extra",children:s})]})]})});function qo(e){return(e??[]).map(t=>t.type==="text"?t.text??"":t.type==="inlineMath"?t.attrs?.latex?`$${t.attrs.latex}$`:"":t.type==="hardBreak"?`
2
+ `:qo(t.content)).join("")}function Ho(e){let t=[],r=n=>{for(let o of n)o.type==="blockMath"?o.attrs?.latex&&t.push(`$$${o.attrs.latex}$$`):o.type==="paragraph"?t.push(qo(o.content)):o.type==="bulletList"||o.type==="orderedList"||o.type==="listItem"?r(o.content??[]):t.push(qo(o.content))};return r(e),t.join(`
3
+ `).replace(/\n{3,}/g,`
4
+
5
+ `).trim()}function Sn(e){let t=0,r=n=>{for(let o of n??[])o.type==="text"?t+=(o.text??"").trim().split(/\s+/).filter(a=>/[\p{L}\p{N}]/u.test(a)).length:(o.type==="inlineMath"||o.type==="blockMath")&&o.attrs?.latex?t+=1:r(o.content)};return r(e),t}function oi(e){return Sn(e)===0}function Cr(e){return(e??"").split(`
6
+ `).map(t=>{let r=t.trim().match(/^\$\$([\s\S]+)\$\$$/);if(r)return{type:"blockMath",attrs:{latex:r[1].trim()}};let n=[],o=/\$\$([^$]+)\$\$|\$([^$]+)\$/g,a=0;for(let s=o.exec(t);s;s=o.exec(t))s.index>a&&n.push({type:"text",text:t.slice(a,s.index)}),n.push({type:"inlineMath",attrs:{latex:(s[1]??s[2]).trim()}}),a=s.index+s[0].length;return a<t.length&&n.push({type:"text",text:t.slice(a)}),n.length?{type:"paragraph",content:n}:{type:"paragraph"}})}import{jsx as Ce,jsxs as ut,Fragment as jd}from"react/jsx-runtime";import{useEffect as ai,useRef as Ar,useState as Wo}from"react";var Bd=4,qd=1600;async function si(e){let t=await createImageBitmap(e),r=Math.min(1,qd/Math.max(t.width,t.height)),n=document.createElement("canvas");return n.width=Math.round(t.width*r),n.height=Math.round(t.height*r),n.getContext("2d")?.drawImage(t,0,0,n.width,n.height),t.close?.(),n.toDataURL("image/jpeg",.85)}function Hd(){return typeof window<"u"&&!!window.matchMedia?.("(pointer: coarse)").matches}function ii({nodeId:e,mediaHandler:t,handler:r,onRead:n,onClose:o}){let a=re(),s=Hd(),[i,c]=Wo("choose"),[l,p]=Wo(null),[f,m]=Wo(null),h=Ar(null),d=Ar(null),u=Ar(null),v=Ar(null),R=Ar(null),S=async(y,T)=>{if(!(!r.transcribePhotos||y.length===0&&T.length===0)){c("reading");try{let{content:g}=await r.transcribePhotos({images:y,photos:T},{nodeId:e});n(g,T)}catch{m(a.sheetPhotoFailed),c("error")}}},C=async y=>{let T=y.filter(g=>g.type.startsWith("image/")).slice(0,Bd);if(T.length!==0){c("uploading");try{let g=await Promise.all(T.map(A=>si(A))),P=[];if(t)for(let A of T){let{url:W,mimeType:b}=await t.upload(A,"image");P.push({url:W,mimeType:b??A.type,name:A.name})}await S(g,P)}catch{m(a.sheetPhotoFailed),c("error")}}};ai(()=>{if(s||!r.startPhoneCapture)return;let y=new AbortController;return R.current=y,r.startPhoneCapture({nodeId:e,signal:y.signal}).then(({url:T,qrImage:g,photos:P})=>{y.signal.aborted||(p({url:T,qrImage:g}),P.then(A=>{y.signal.aborted||S([],A)}).catch(()=>{}))}).catch(()=>{}),()=>y.abort()},[]);let w=()=>{v.current?.getTracks().forEach(y=>y.stop()),v.current=null};ai(()=>w,[]);let N=async()=>{R.current?.abort();try{let y=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});v.current=y,c("camera"),requestAnimationFrame(()=>{u.current&&(u.current.srcObject=y,u.current.play().catch(()=>{}))})}catch{m(a.sheetPhotoCameraFailed),c("error")}},k=()=>{let y=u.current;if(!y)return;let T=document.createElement("canvas");T.width=y.videoWidth,T.height=y.videoHeight,T.getContext("2d")?.drawImage(y,0,0),T.toBlob(g=>{w(),g&&C([new File([g],"copie.jpg",{type:"image/jpeg"})])},"image/jpeg",.9)},x=y=>{R.current?.abort();let T=Array.from(y.target.files??[]);y.target.value="",C(T)};return ut("div",{className:"edp-sheet-panel",role:"dialog","aria-label":a.sheetPhotoTitle,children:[ut("div",{className:"edp-sheet-panel-head",children:[Ce("strong",{children:a.sheetPhotoTitle}),Ce("button",{type:"button",className:"edp-sheet-panel-close",onClick:o,"aria-label":a.sheetClose,children:"\xD7"})]}),Ce("input",{ref:h,type:"file",accept:"image/*",capture:"environment",hidden:!0,onChange:x}),Ce("input",{ref:d,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:x}),i==="choose"&&s&&ut("div",{className:"edp-sheet-panel-actions",children:[Ce("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:()=>h.current?.click(),children:a.sheetPhotoTake}),Ce("button",{type:"button",className:"edp-sheet-btn",onClick:()=>d.current?.click(),children:a.sheetPhotoGallery})]}),i==="choose"&&!s&&ut(jd,{children:[r.startPhoneCapture&&ut("div",{className:"edp-sheet-qr",children:[l?Ce("img",{src:l.qrImage,alt:"",width:168,height:168}):Ce("span",{className:"edp-sheet-qr-wait"}),Ce("p",{children:a.sheetPhotoPhoneHelp})]}),Ce("p",{className:"edp-sheet-or",children:r.startPhoneCapture?a.sheetPhotoOr:null}),ut("div",{className:"edp-sheet-panel-actions",children:[Ce("button",{type:"button",className:"edp-sheet-btn",onClick:()=>d.current?.click(),children:a.sheetPhotoUpload}),Ce("button",{type:"button",className:"edp-sheet-btn",onClick:N,children:a.sheetPhotoWebcam})]})]}),i==="camera"&&ut("div",{className:"edp-sheet-camera",children:[Ce("video",{ref:u,playsInline:!0,muted:!0}),Ce("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",onClick:k,children:a.sheetPhotoShoot})]}),(i==="uploading"||i==="reading")&&ut("p",{className:"edp-sheet-progress",role:"status",children:[Ce("span",{className:"player-ai-spinner","aria-hidden":"true"}),i==="uploading"?a.openResponseUploading:a.sheetPhotoReading]}),i==="error"&&ut("div",{className:"edp-sheet-error",role:"alert",children:[Ce("p",{children:f}),Ce("button",{type:"button",className:"edp-sheet-btn",onClick:()=>{m(null),c("choose")},children:a.sheetPhotoRetry})]})]})}import{jsx as mt,jsxs as Rn}from"react/jsx-runtime";import{useCallback as ci,useEffect as Wd,useRef as Nr,useState as li}from"react";var Ud=900;function Uo({handler:e,onInsert:t,onClose:r}){let n=re(),o=Nr(null),a=Nr([]),s=Nr(null),i=Nr(null),c=Nr(null),[l,p]=li(""),[f,m]=li("idle"),h=ci(()=>{let N=o.current,k=N?.getContext("2d");if(!N||!k)return;let x=window.devicePixelRatio||1;k.setTransform(x,0,0,x,0,0),k.fillStyle="#ffffff",k.fillRect(0,0,N.width,N.height),k.strokeStyle="#1d2433",k.lineWidth=3,k.lineCap="round",k.lineJoin="round";for(let y of[...a.current,...s.current?[s.current]:[]])k.beginPath(),y.forEach((T,g)=>g?k.lineTo(T.x,T.y):k.moveTo(T.x,T.y)),k.stroke()},[]);Wd(()=>{let N=o.current;if(!N)return;let k=window.devicePixelRatio||1,x=N.getBoundingClientRect();return N.width=Math.round(x.width*k),N.height=Math.round(x.height*k),h(),()=>{i.current&&clearTimeout(i.current),c.current?.abort()}},[h]);let d=ci(()=>{let N=o.current;if(!N||a.current.length===0||!e.recognizeHandwriting)return;c.current?.abort();let k=new AbortController;c.current=k,m("reading"),N.toBlob(async x=>{if(!(!x||k.signal.aborted))try{let{latex:y}=await e.recognizeHandwriting(x,{signal:k.signal});k.signal.aborted||(p(y),m("idle"))}catch{k.signal.aborted||m("failed")}},"image/png")},[e]),u=N=>{let k=N.currentTarget.getBoundingClientRect();return{x:N.clientX-k.left,y:N.clientY-k.top}},v=N=>{N.currentTarget.setPointerCapture(N.pointerId),i.current&&clearTimeout(i.current),s.current=[u(N)]},R=N=>{s.current&&(s.current.push(u(N)),h())},S=()=>{s.current&&(s.current.length>1&&a.current.push(s.current),s.current=null,h(),i.current&&clearTimeout(i.current),i.current=setTimeout(d,Ud))},C=()=>{a.current=[],c.current?.abort(),p(""),m("idle"),h()},w=()=>{a.current.pop(),h(),a.current.length?d():C()};return Rn("div",{className:"edp-sheet-panel",role:"dialog","aria-label":n.sheetPadTitle,children:[Rn("div",{className:"edp-sheet-panel-head",children:[mt("strong",{children:n.sheetPadTitle}),mt("button",{type:"button",className:"edp-sheet-panel-close",onClick:r,"aria-label":n.sheetClose,children:"\xD7"})]}),Rn("div",{className:"edp-sheet-pad-result",dir:"ltr","aria-live":"polite",children:[f==="reading"&&mt("span",{className:"player-ai-spinner","aria-hidden":"true"}),l?mt("span",{dangerouslySetInnerHTML:{__html:Ne(l,!1)}}):mt("span",{className:"edp-sheet-pad-help",children:f==="failed"?n.sheetPadFailed:n.sheetPadHelp})]}),mt("canvas",{ref:o,className:"edp-sheet-pad",onPointerDown:v,onPointerMove:R,onPointerUp:S,onPointerCancel:S}),Rn("div",{className:"edp-sheet-panel-actions",children:[mt("button",{type:"button",className:"edp-sheet-btn",onClick:w,children:n.sheetPadUndo}),mt("button",{type:"button",className:"edp-sheet-btn",onClick:C,children:n.sheetPadClear}),mt("button",{type:"button",className:"edp-sheet-btn edp-sheet-btn--primary",disabled:!l||f==="reading",onClick:()=>t(l),children:n.sheetPadInsert})]})]})}function Xd(e){if(!e)return null;if(e.type==="aiAnswer"){let t=e.answer,r=t.content?.length?t.content:t.text?Cr(t.text):null;return r?{content:r,photos:t.photos??[]}:null}if(e.type==="openResponse"){let t=e.answer;return t.text?.content?{content:t.text.content,photos:t.photos??[]}:null}return null}function _r({nodeId:e,answerType:t,options:r,placeholder:n,disabled:o,stateClass:a,onChange:s,mediaHandler:i,answerSheetHandler:c}){let l=re(),p=ge(),f=di(null),[m,h]=Ko([]),[d,u]=Ko(null),[v,R]=Ko(!1),S=di([]);S.current=m;let C=!!r.photo&&!!c?.transcribePhotos,w=!!r.handwriting&&!!c?.recognizeHandwriting,N=r.math!==!1,k=Vd((g,P)=>{s({content:g,text:Ho(g),wordCount:Sn(g),photos:P})},[s]);Gd(()=>{let g=A=>{let W=(A.answers??[]).find(M=>M.nodeId===e&&M.type===t),b=Xd(W);b&&(h(b.photos),f.current?.setContent(b.content))},P=()=>{h([]),R(!1),f.current?.clear()};return p.on("answers:prefill",g),p.on("answers:reset",P),()=>{p.off("answers:prefill",g),p.off("answers:reset",P)}},[p,e,t]);let x=(g,P)=>{let A=[...S.current,...P];h(A),S.current=A;let W=f.current?.getContent()??[],b=oi(W)?g:[...W,...g];f.current?.setContent(b),k(b,A),R(!0),u(null)},y=g=>{let P=m.filter(A=>A.url!==g);h(P),S.current=P,k(f.current?.getContent()??[],P)},T=C||w?Yt(Kd,{children:[C&&Yt("button",{type:"button",className:Vo("edp-sheet-key edp-sheet-key--tool",d==="photo"&&"is-active"),onClick:()=>u(d==="photo"?null:"photo"),"aria-expanded":d==="photo",children:[ct(Qd,{size:16,"aria-hidden":"true"})," ",l.sheetPhoto]}),w&&Yt("button",{type:"button",className:Vo("edp-sheet-key edp-sheet-key--tool",d==="pad"&&"is-active"),onClick:()=>u(d==="pad"?null:"pad"),"aria-expanded":d==="pad",children:[ct(Yd,{size:16,"aria-hidden":"true"})," ",l.sheetHandwriting]})]}):null;return Yt("div",{className:Vo("edp-sheet",o&&"edp-sheet--readonly",a),children:[v&&!o&&ct("p",{className:"edp-sheet-notice",role:"status",children:l.sheetPhotoCheck}),ct(Bo,{ref:f,onChange:g=>k(g,S.current),disabled:o,placeholder:n||(N?l.sheetPlaceholder:l.longAnswerPlaceholder),keys:N,extraTools:T,ariaLabel:l.blankAnswerAria,labels:{keysAria:l.sheetKeysAria,more:l.sheetMoreKeys,power:l.sheetKeyPower,fraction:l.sheetKeyFraction,root:l.sheetKeyRoot,pi:l.sheetKeyPi,le:l.sheetKeyLe,ge:l.sheetKeyGe,ne:l.sheetKeyNe,in:l.sheetKeyIn,unwrap:l.sheetFormulaUnwrap,closeKeyboard:l.sheetKeyboardClose}}),d==="photo"&&C&&c&&ct(ii,{nodeId:e,mediaHandler:i,handler:c,onRead:x,onClose:()=>u(null)}),d==="pad"&&w&&c&&ct(Uo,{handler:c,onInsert:g=>{f.current?.insertFormula(g),u(null)},onClose:()=>u(null)}),m.length>0&&Yt("div",{className:"edp-sheet-photos",children:[ct("span",{className:"edp-sheet-photos-label",children:l.sheetPhotoYours}),m.map(g=>Yt("span",{className:"edp-sheet-photo",children:[ct("a",{href:g.url,target:"_blank",rel:"noreferrer",children:ct("img",{src:g.url,alt:l.sheetPhotoYours})}),!o&&ct("button",{type:"button",className:"edp-sheet-photo-remove",onClick:()=>y(g.url),"aria-label":l.sheetPhotoRemove,children:"\xD7"})]},g.url))]})]})}import{jsx as Pr,jsxs as Jd,Fragment as Zd}from"react/jsx-runtime";import{Fragment as pi}from"react";function ui({text:e}){let t=Cr(e);return Pr(Zd,{children:t.map((r,n)=>Jd(pi,{children:[n>0&&Pr("br",{}),r.type==="blockMath"?Pr("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Ne(String(r.attrs?.latex??""),!1)}}):(r.content??[]).map((o,a)=>o.type==="inlineMath"?Pr("span",{className:"edp-math-text-formula",dir:"ltr",dangerouslySetInnerHTML:{__html:Ne(String(o.attrs?.latex??""),!1)}},a):Pr(pi,{children:o.text},a))]},n))})}function on({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=ge(),s=re(),{id:i,attrs:c}=e,{placeholder:l,minWords:p=0,maxWords:f=500,hint:m}=c,h=!!(c.math||c.photo||c.handwriting),[d,u]=mi(""),[v,R]=mi(0),S=t?.showFeedback??!1,C=t?.state,w=f<=30,N=Qo($=>$.trim().split(/\s+/).filter(Boolean).length,[]);Go(()=>{let $=B=>{let Q=B.answers?.find(Y=>Y.nodeId===i&&Y.type==="aiAnswer");if(Q&&Q.answer?.text!=null){let Y=Q.answer.text;u(Y),R(N(Y))}};return a.on("answers:prefill",$),()=>a.off("answers:prefill",$)},[i,a,N]),Go(()=>{let $=()=>{u(""),R(0)};return a.on("answers:reset",$),()=>a.off("answers:reset",$)},[a]);let k=fi(null),x=Qo(($,B)=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:$,wordCount:B}}})},300)},[i,a]);Go(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:"",wordCount:0}}})},[]);let y=$=>{if(S)return;let B=N($);u($),R(B),x($,B)},T=fi(null),g=Qo($=>{R($.wordCount),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{a.emit({type:"answer:changed",answer:{nodeId:i,type:"aiAnswer",timestamp:Date.now(),answer:{text:$.text,wordCount:$.wordCount,content:$.content,...$.photos.length?{photos:$.photos}:{}}}})},300)},[i,a]),P=C==="validating",A=Tr("player-ai-count",v>f&&"player-ai-count--over"),W=!S||P?"":C==="correct"?"player-ai-input--correct":C==="incorrect"?"player-ai-input--incorrect":C==="partial"?"player-ai-input--partial":"",b=C==="correct"?"player-ai-feedback--correct":C==="incorrect"?"player-ai-feedback--incorrect":C==="partial"?"player-ai-feedback--partial":"",M=$=>Number.isInteger($)?String($):$.toFixed(2);return Xt("div",{className:Tr("player-ai",h&&"player-ai--sheet"),children:[Xt("div",{className:"player-ai-counts",children:[Xt("span",{className:A,children:[v," / ",f," ",s.openResponseWords]}),p>0&&v<p&&Ue("span",{className:"player-ai-count player-ai-count--min",children:s.minWordsLabel(p)}),Ue("span",{style:{marginInlineStart:"auto"},children:Ue(ot,{hint:m})})]}),h?Ue(_r,{nodeId:i,answerType:"aiAnswer",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:l,disabled:S||r,stateClass:W,onChange:g,mediaHandler:n,answerSheetHandler:o}):w?Ue("input",{type:"text",value:d,onChange:$=>y($.target.value),placeholder:l??s.shortAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:S,className:Tr("player-ai-input",W)}):Ue("textarea",{value:d,onChange:$=>y($.target.value),placeholder:l??s.longAnswerPlaceholder,"aria-label":s.blankAnswerAria,disabled:S,rows:5,className:Tr("player-ai-input player-ai-input--multiline",W)}),S&&t&&Ue("div",{className:Tr("player-ai-feedback",b),children:P?Xt("div",{className:"player-ai-validating",children:[Ue("span",{className:"player-ai-spinner"}),Ue("span",{children:s.aiEvaluationInProgress})]}):Xt(ep,{children:[t.message&&Ue("p",{className:"player-ai-message",children:c.math?Ue(ui,{text:t.message}):t.message}),t.score!=null&&t.maxScore!=null&&Ue("div",{className:"player-ai-score-row",children:Xt("span",{className:"player-ai-score",children:[M(t.score)," / ",M(t.maxScore)]})})]})})]})}import{jsx as I,jsxs as Z,Fragment as Mr}from"react/jsx-runtime";import{useState as Ee,useEffect as Ie,useRef as _e,useCallback as Cn}from"react";import{useEditor as tp,EditorContent as rp}from"@tiptap/react";import np from"@tiptap/starter-kit";import ft from"clsx";import{FolderOpen as op,Mic as ap,Video as hi,Monitor as sp,Clock as ip,Image as cp,FileText as gi,Music as lp,Link2 as dp,Check as pp,AlertCircle as up}from"lucide-react";function bi(e){return e.trim().split(/\s+/).filter(Boolean).length}function yi(e){return e.length}function mp(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join(" ");return bi(t(e))}function fp(e){let t=r=>r.map(n=>(n.text??"")+(n.content?t(n.content):"")).join("");return yi(t(e))}function hp(e){return/youtube\.com|youtu\.be/i.test(e)?"youtube":/vimeo\.com/i.test(e)?"vimeo":"other"}function gp(e){let t=e.match(/[?&]v=([^&]+)/)||e.match(/youtu\.be\/([^?]+)/)||e.match(/embed\/([^?]+)/);return t?t[1]:null}function Yo(e){let t=Math.floor(e/60),r=e%60;return`${t}:${r.toString().padStart(2,"0")}`}function an({node:e,validationFeedback:t,readOnly:r=!1,mediaHandler:n,answerSheetHandler:o}){let a=ge(),s=re(),{id:i,attrs:c}=e,{mode:l,placeholder:p,allowFormatting:f,wordLimit:m,characterLimit:h,allowedTypes:d,allowMultiple:u,fileInstructions:v,maxDuration:R,hint:S}=c,C=l==="text"&&!!(c.math||c.photo||c.handwriting),w=r||(t?.showFeedback??!1),N=t?.state,k=_e(null),x=Cn(A=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{let W=A.files?.map(b=>({url:b.url,mimeType:b.kind==="videoLink"?"video/x-link":b.mimeType,name:b.kind==="videoLink"?void 0:b.name,duration:b.kind==="videoLink"?void 0:b.duration}));a.emit({type:"answer:changed",answer:{nodeId:i,type:"openResponse",timestamp:Date.now(),answer:{...A,files:W}}})},300)},[i,a]);Ie(()=>{x({})},[]);let[y,T]=Ee([]);Ie(()=>{(l==="file"||l==="text+file")&&l==="file"&&x({files:y})},[y,l]),Ie(()=>{let A=()=>{T([])};return a.on("answers:reset",A),()=>a.off("answers:reset",A)},[a]),Ie(()=>{let A=W=>{let M=(W.answers??[]).find($=>$.nodeId===i&&$.type==="openResponse");M&&(k.current&&(clearTimeout(k.current),k.current=null),M.answer?.files&&T(M.answer.files))};return a.on("answers:prefill",A),()=>a.off("answers:prefill",A)},[i,a]);let g=t?.showFeedback,P=ft(!g&&"player-or-field--pre",g&&N==="correct"&&"player-or-field--correct",g&&N==="partial"&&"player-or-field--partial",g&&N==="incorrect"&&"player-or-field--incorrect",g&&N==="awaiting_review"&&"player-or-field--review");return Z("div",{className:"my-3 space-y-2",children:[!w&&S&&S.length>0&&I("div",{className:"flex justify-end",children:I(kt,{hint:S})}),C&&I(_r,{nodeId:i,answerType:"openResponse",options:{math:c.math,photo:c.photo,handwriting:c.handwriting},placeholder:p,disabled:w,stateClass:P,onChange:A=>x({text:{content:A.content,wordCount:A.wordCount},...A.photos.length?{photos:A.photos}:{}}),mediaHandler:n,answerSheetHandler:o}),l==="text"&&!C&&I(xi,{nodeId:i,placeholder:p,allowFormatting:f,wordLimit:m,characterLimit:h,isDisabled:w,feedbackBorderClass:P,emitAnswer:A=>x({text:A}),answerBus:a}),l==="file"&&I(Xo,{allowedTypes:d??["image"],allowMultiple:!!u,fileInstructions:v,isDisabled:w,feedbackBorderClass:P,files:y,setFiles:T,mediaHandler:n,t:s}),(l==="audio"||l==="video"||l==="screen")&&I(Ap,{nodeId:i,answerBus:a,kind:l,maxDuration:R,isDisabled:w,feedbackBorderClass:P,mediaHandler:n,emitAnswer:A=>x({recording:A}),t:s}),l==="text+file"&&I(vp,{nodeId:i,placeholder:p,allowFormatting:f,wordLimit:m,characterLimit:h,allowedTypes:d??["image"],allowMultiple:!!u,fileInstructions:v,isDisabled:w,feedbackBorderClass:P,files:y,setFiles:T,emitAnswer:x,answerBus:a,mediaHandler:n,t:s}),t?.showFeedback&&N==="awaiting_review"&&Z("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:[I(ip,{size:15,style:be(15),className:"animate-pulse"}),I("span",{children:s.openResponseAwaitingReview})]}),t?.showFeedback&&N!=="awaiting_review"&&t.teacherFeedback&&I(Np,{feedback:t.teacherFeedback,feedbackState:N,score:t.score,t:s})]})}function xi({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:a,feedbackBorderClass:s,emitAnswer:i,answerBus:c}){let l=re(),[p,f]=Ee(""),[m,h]=Ee(0),[d,u]=Ee(0),v=_e(null),R=Cn(()=>{let M=v.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[]),S=tp({extensions:[np.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1})],immediatelyRender:!1,editable:!a,content:"",onUpdate({editor:M}){if(a||!r)return;let B=M.getJSON().content??[],J=mp(B),Q=fp(B);h(J),u(Q),i({content:B,wordCount:J})}});Ie(()=>{S&&S.setEditable(!a,!1)},[a,S]);let C=_e(null);Ie(()=>{S&&C.current!==null&&(S.commands.setContent({type:"doc",content:C.current}),C.current=null)},[S]),Ie(()=>{let M=$=>{let B=($.answers??[]).find(Q=>Q.nodeId===e&&Q.type==="openResponse");if(!B?.answer?.text)return;let J=B.answer.text.content??[];if(r)S?S.commands.setContent({type:"doc",content:J}):C.current=J;else{let Q=J.flatMap(Y=>Y.content?.map(ve=>ve.text??"")??[Y.text??""]).join(`
7
+ `);f(Q),setTimeout(R,0)}};return c.on("answers:prefill",M),()=>c.off("answers:prefill",M)},[e,c,r,S]),Ie(()=>{let M=()=>{r&&S?S.commands.clearContent():(f(""),setTimeout(R,0)),h(0),u(0)};return c.on("answers:reset",M),()=>c.off("answers:reset",M)},[c,r,S,R]);let w=!!n,N=!!o&&!n,k=w?m:d,x=w?n?.max:o?.max,y=w?n?.min:o?.min,T=x!=null&&k>x,g=x!=null&&k>=x*.8&&!T,P=y!=null&&k<y&&k>0,A="text-xs tabular-nums",W=T?{color:"var(--pen, #d23b2b)",fontWeight:500}:g||P?{color:"var(--almost, #c8810e)"}:{color:"var(--ink-faint, #8d93a0)"},b=w?x?`${m} / ${x} ${l.openResponseWords}`:y?`${m} ${l.openResponseWords} (min. ${y})`:`${m} ${l.openResponseWords}`:N?x?`${d} / ${x} ${l.openResponseChars}`:`${d} ${l.openResponseChars}`:null;return r?Z("div",{className:"relative",children:[Z("div",{className:ft("rounded border transition-colors min-h-[120px]",s),children:[!a&&Z("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:$,style:B})=>I("button",{type:"button",onMouseDown:J=>{J.preventDefault(),S?.chain().focus()?.[$]().run()},className:`text-xs px-1.5 py-0.5 rounded hover:bg-gray-100 ${B}`,children:M},M)),I("button",{type:"button",onMouseDown:M=>{M.preventDefault(),S?.chain().focus().toggleBulletList().run()},className:"text-xs px-1.5 py-0.5 rounded hover:bg-gray-100",children:"\u2022\u2014"})]}),I(rp,{editor:S,className:"prose prose-sm max-w-none p-3 outline-none [&_.ProseMirror]:min-h-[80px] [&_.ProseMirror]:outline-none"})]}),b&&I("div",{className:ft("absolute bottom-2 right-3",A),style:W,children:b})]}):Z("div",{className:"relative",children:[I("textarea",{ref:v,value:p,onChange:M=>{if(a)return;let $=M.target.value;f($);let B=bi($),J=yi($);h(B),u(J),R(),i({content:[{type:"paragraph",content:[{type:"text",text:$}]}],wordCount:B})},onInput:R,disabled:a,placeholder:t||l.openResponseTextPlaceholder,rows:4,style:{resize:"none",overflow:"hidden"},className:ft("w-full px-3 py-2 text-base min-h-[100px] rounded border transition-colors outline-none",s,a&&"cursor-default")}),b&&I("div",{className:ft("absolute bottom-2 right-3",A),children:b})]})}var bp={image:"image/*",pdf:"application/pdf",audio:"audio/*",video:"video/*"},yp={image:I(cp,{size:12,style:be(12)}),pdf:I(gi,{size:12,style:be(12)}),audio:I(lp,{size:12,style:be(12)}),video:I(hi,{size:12,style:be(12)}),videoLink:I(dp,{size:12,style:be(12)})};function Xo({allowedTypes:e,allowMultiple:t,fileInstructions:r,isDisabled:n,files:o,setFiles:a,mediaHandler:s,t:i,compact:c=!1}){let l=_e(null),[p,f]=Ee(!1),[m,h]=Ee(!1),[d,u]=Ee(""),v=e.some(g=>g!=="videoLink"),R=e.includes("videoLink"),S=t||o.length===0,C=e.filter(g=>g!=="videoLink").map(g=>bp[g]).filter(Boolean).join(","),w=Cn(g=>{a(P=>t?[...P,g]:[g])},[t,a]),N=Cn(g=>{a(P=>P.filter((A,W)=>W!==g))},[a]),k=async g=>{if(!(!S||n)){f(!0);try{let P=g.type.startsWith("image/")?"image":g.type==="application/pdf"?"document":g.type.startsWith("audio/")?"audio":g.type.startsWith("video/")?"video":"file";if(s){let A=await s.upload(g,P);w({kind:"file",url:A.url,mimeType:A.mimeType??g.type,name:g.name})}else{let A=URL.createObjectURL(g);w({kind:"file",url:A,mimeType:g.type,name:g.name})}}finally{f(!1)}}},x=async g=>{if(g.preventDefault(),h(!1),n||!S)return;let P=g.dataTransfer.files?.[0];P&&await k(P)},y=()=>{let g=d.trim();g&&(w({kind:"videoLink",url:g,platform:hp(g)}),u(""))},T={image:i.openResponseTypeImage,pdf:i.openResponseTypePdf,audio:i.openResponseTypeAudio,video:i.openResponseTypeVideo,videoLink:i.openResponseTypeVideoLink};return Z("div",{className:"space-y-2",children:[r&&!c&&I("p",{className:"text-sm text-gray-600 italic",children:r}),o.length>0&&I("div",{className:c?"flex flex-wrap gap-1.5":"space-y-2",children:o.map((g,P)=>I(xp,{file:g,onRemove:n?void 0:()=>N(P),compact:c,t:i},P))}),!n&&S&&Z("div",{className:"space-y-2",children:[v&&!c&&Z("div",{onDragOver:g=>{g.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:x,className:"border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",style:{borderColor:m?"var(--ink-faint, #8d93a0)":"var(--line-strong, #d6d3cc)",background:m?"var(--ui-muted, #f5f4f1)":"transparent"},onClick:()=>l.current?.click(),children:[I(op,{size:26,className:"mx-auto mb-2",style:{...be(26),color:"var(--ink-soft, #565b66)"}}),I("p",{className:"text-sm font-medium",style:{color:"var(--ink-soft, #565b66)"},children:i.openResponseDropZoneLabel}),I("p",{className:"text-xs hover:underline mt-0.5",style:{color:"var(--ink, #1d2025)"},children:i.openResponseDropZoneBrowse}),p&&I("p",{className:"text-xs mt-1 animate-pulse",style:{color:"var(--ink-faint, #8d93a0)"},children:i.openResponseUploading}),I("div",{className:"flex flex-wrap justify-center gap-1.5 mt-3",children:e.filter(g=>g!=="videoLink").map(g=>Z("span",{className:"inline-flex items-center gap-1 text-[10px] px-2 py-0.5 bg-gray-100 text-gray-600 rounded-full",children:[yp[g]," ",T[g]]},g))})]}),v&&c&&I("button",{type:"button",onClick:()=>l.current?.click(),disabled:p,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:p?i.openResponseUploading:`+ ${i.openResponseAttachFile}`}),I("input",{ref:l,type:"file",accept:C,onChange:async g=>{let P=g.target.files?.[0];P&&(await k(P),g.target.value="")},className:"hidden"}),R&&Z("div",{className:"flex gap-2 flex-wrap",children:[I("input",{type:"url",value:d,onChange:g=>u(g.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:g=>{g.key==="Enter"&&(g.preventDefault(),y())}}),I("button",{type:"button",onClick:y,disabled:!d.trim(),className:"text-sm px-3 py-1.5 rounded text-white disabled:opacity-50",style:{background:"var(--ink, #1d2025)"},children:i.openResponseAddVideoLink})]})]}),n&&o.length===0&&I("p",{className:"text-sm text-gray-400 text-center py-3",children:i.openResponseNoSubmission})]})}function xp({file:e,onRemove:t,compact:r,t:n}){if(e.kind==="videoLink"){let o=e.platform==="youtube"?gp(e.url):null;return Z("div",{className:ft("bg-white rounded border border-gray-200",r?"px-2 py-1 flex items-center gap-1.5":"p-3 space-y-1"),children:[o&&!r&&I("iframe",{src:`https://www.youtube.com/embed/${o}`,width:240,height:135,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"rounded w-full"}),I("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 underline truncate block max-w-[200px]",children:e.url}),t&&I("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs",children:"\u2715"})]})}return Z("div",{className:ft("bg-white rounded border border-gray-200",r?"px-2 py-1 flex items-center gap-1.5":"p-2 flex items-center gap-2"),children:[e.mimeType?.startsWith("image/")?I("img",{src:e.url,alt:e.name??"upload",className:r?"h-6 w-6 object-cover rounded":"h-16 w-16 object-cover rounded"}):e.mimeType?.startsWith("audio/")?r?null:I("span",{className:"flex-1 min-w-0",children:I(rt,{src:e.url,durationHint:e.duration})}):e.mimeType?.startsWith("video/")?I("video",{src:e.url,controls:!0,className:r?"hidden":"h-16 max-w-[240px] rounded"}):I(gi,{size:20,style:{...be(20),color:"var(--ink-soft, #565b66)"}}),Z("div",{className:"flex-1 min-w-0",children:[I("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-gray-700 truncate block hover:underline",children:e.name??n.openResponseFile}),r&&e.mimeType?.startsWith("audio/")&&I(rt,{src:e.url,durationHint:e.duration})]}),t&&I("button",{type:"button",onClick:t,className:"ml-auto text-gray-400 hover:text-rose-500 text-xs shrink-0",children:"\u2715"})]})}function vp({nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:p,setFiles:f,emitAnswer:m,answerBus:h,mediaHandler:d,t:u}){let[v,R]=Ee(null),[S,C]=Ee(!1);return Ie(()=>{m({...v&&{text:v},files:p.length>0?p:void 0})},[v,p]),Z("div",{className:"space-y-2",children:[I(xi,{nodeId:e,placeholder:t,allowFormatting:r,wordLimit:n,characterLimit:o,isDisabled:c,feedbackBorderClass:l,emitAnswer:w=>R(w),answerBus:h}),!c&&Z("div",{children:[Z("button",{type:"button",onClick:()=>C(!S),className:"flex items-center gap-1.5 text-xs",style:{color:"var(--ink-soft, #565b66)"},children:[I("span",{children:S?"\u25BE":"\u25B8"}),Z("span",{children:[u.openResponseAttachFiles,p.length>0&&I("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:p.length})]})]}),S&&I("div",{className:"mt-1.5",children:I(Xo,{allowedTypes:a,allowMultiple:s,fileInstructions:i,isDisabled:c,feedbackBorderClass:l,files:p,setFiles:f,mediaHandler:d,t:u,compact:!0})})]}),c&&p.length>0&&Z("div",{className:"space-y-1",children:[I("p",{className:"text-xs text-gray-500 font-medium",children:u.openResponseAttachedFiles}),I(Xo,{allowedTypes:a,allowMultiple:s,isDisabled:!0,feedbackBorderClass:l,files:p,setFiles:f,t:u,compact:!0})]})]})}var wp=180,kp={audio:["audio/webm;codecs=opus","audio/webm","audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/aac","audio/ogg;codecs=opus"],video:["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm","video/mp4"]};function Sp(e){if(!(typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"))return kp[e].find(t=>MediaRecorder.isTypeSupported(t))}function Rp(e,t){let r=e.split(";")[0].trim().toLowerCase();return r.endsWith("/webm")?"webm":r.endsWith("/ogg")?"ogg":r.endsWith("/aac")?"aac":r.endsWith("/mp4")?t==="audio"?"m4a":"mp4":"webm"}function Cp(e){return e instanceof DOMException?e.name==="AbortError":e?.name==="AbortError"}function Ap({nodeId:e,kind:t,maxDuration:r,isDisabled:n,feedbackBorderClass:o,mediaHandler:a,emitAnswer:s,answerBus:i,t:c}){let l=t==="audio"?"audio":"video",p=r&&r>0?r:t==="audio"?wp:null,[f,m]=Ee("idle"),[h,d]=Ee(null),[u,v]=Ee(null),[R,S]=Ee(0),[C,w]=Ee(null),[N,k]=Ee(null),x=_e(null),y=_e(null),T=_e([]),g=_e(0),P=_e(null),A=_e(null),W=_e(null),b=_e(null),M=_e(0),$=_e(null),B=_e(null),J=_e(null);Ie(()=>{let U=me=>{let oe=(me.answers??[]).find(de=>de.nodeId===e&&de.type==="openResponse")?.answer?.recording;oe?.url&&(d(oe),m("saved"))},X=()=>{$.current?.abort(),d(null),v(null),k(null),m("idle")};return i.on("answers:prefill",U),i.on("answers:reset",X),()=>{i.off("answers:prefill",U),i.off("answers:reset",X)}},[e,i]);let Q=()=>{cancelAnimationFrame(M.current);let U=b.current;b.current=null,U&&U.state!=="closed"&&U.close().catch(()=>{})},Y=()=>{y.current?.getTracks().forEach(U=>U.stop()),y.current=null};Ie(()=>()=>{P.current&&clearInterval(P.current),Q(),Y(),$.current?.abort()},[]),Ie(()=>{let U=u?.url;return()=>{U&&URL.revokeObjectURL(U)}},[u?.url]);let ve=U=>{let X=W.current,me=window.AudioContext||window.webkitAudioContext;if(!X||!me)return;let ae;try{ae=new me}catch{return}b.current=ae;let oe=ae.createAnalyser();oe.fftSize=512,ae.createMediaStreamSource(U).connect(oe);let de=new Uint8Array(oe.fftSize),Te=window.devicePixelRatio||1,Ze=Math.max(1,X.clientWidth),H=Math.max(1,X.clientHeight);X.width=Math.round(Ze*Te),X.height=Math.round(H*Te);let ee=X.getContext("2d");if(!ee)return;ee.scale(Te,Te);let te=3,pe=2,je=[],ar=Math.floor(Ze/(te+pe)),xt=0,G=sr=>{if(M.current=requestAnimationFrame(G),sr-xt<50)return;xt=sr,oe.getByteTimeDomainData(de);let ir=0;for(let et=0;et<de.length;et++){let vt=(de[et]-128)/128;ir+=vt*vt}je.push(Math.min(1,Math.sqrt(ir/de.length)*3)),je.length>ar&&je.shift(),ee.clearRect(0,0,Ze,H),ee.fillStyle="#1d2025";let Or=Ze-je.length*(te+pe);je.forEach((et,vt)=>{let cr=Math.max(2,et*H);ee.fillRect(Or+vt*(te+pe),(H-cr)/2,te,cr)})};M.current=requestAnimationFrame(G)};Ie(()=>{f==="recording"&&t==="audio"&&y.current&&ve(y.current)},[f]);let L=async(U,X)=>{if(!a)return;let me=new AbortController;$.current=me,B.current={file:U,duration:X},k(null),w(0),m("uploading");try{let ae=await a.upload(U,l,{onProgress:de=>{me.signal.aborted||w(Math.max(0,Math.min(1,de)))},signal:me.signal});if(me.signal.aborted)return;let oe={url:ae.url,mimeType:ae.mimeType??U.type,duration:X,kind:l};B.current=null,d(oe),m("saved"),s(oe)}catch(ae){if(me.signal.aborted||Cp(ae))return;m("failed"),k(c.recorderFailed)}finally{w(null)}},_=()=>{$.current?.abort(),B.current=null,v(null),w(null),m(J.current?"saved":"idle")},q=()=>{let U=B.current;U&&L(U.file,U.duration)},z=()=>{P.current&&(clearInterval(P.current),P.current=null);let U=x.current;U&&U.state!=="inactive"&&U.stop()},O=async()=>{if(!a){k(c.recorderUnavailableHere);return}if(!(typeof MediaRecorder<"u"&&typeof navigator<"u"&&!!navigator.mediaDevices?.getUserMedia&&(t!=="screen"||!!navigator.mediaDevices.getDisplayMedia))){k(c.recorderUnsupported);return}$.current?.abort(),J.current=h,k(null),m("requesting");let X;try{if(t==="screen"){X=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1});try{let de=(await navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0];de&&X.addTrack(de)}catch{}X.getVideoTracks()[0]?.addEventListener("ended",()=>z())}else t==="video"?X=await navigator.mediaDevices.getUserMedia({audio:!0,video:{facingMode:"user"}}):X=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(oe){let de=oe?.name;m(h?"saved":"idle"),k(de==="NotAllowedError"||de==="SecurityError"||de==="NotFoundError"?c.openResponsePermissionDenied:c.recorderUnsupported);return}let me=Sp(l),ae;try{ae=me?new MediaRecorder(X,{mimeType:me}):new MediaRecorder(X)}catch{try{ae=new MediaRecorder(X)}catch{X.getTracks().forEach(oe=>oe.stop()),m(h?"saved":"idle"),k(c.recorderUnsupported);return}}y.current=X,x.current=ae,T.current=[],ae.ondataavailable=oe=>{oe.data.size>0&&T.current.push(oe.data)},ae.onstop=()=>{let oe=Math.max(1,Math.round((performance.now()-g.current)/1e3)),de=ae.mimeType||me||`${l}/webm`,Te=new Blob(T.current,{type:de});if(T.current=[],Q(),Y(),A.current&&(A.current.srcObject=null),Te.size===0){m(J.current?"saved":"idle"),k(c.recorderUnsupported);return}let Ze=new File([Te],`recording.${Rp(de,l)}`,{type:de});v({url:URL.createObjectURL(Te),duration:oe}),L(Ze,oe)},ae.start(250),g.current=performance.now(),S(0),m("recording"),P.current=setInterval(()=>{let oe=(performance.now()-g.current)/1e3;S(oe),p&&oe>=p&&z()},200)};Ie(()=>{let U=A.current;f==="recording"&&U&&y.current&&(U.srcObject=y.current,U.play().catch(()=>{}))},[f]);let ne=u?.url??h?.url??null,ce=u?.duration??h?.duration??null,le=ne?l==="audio"?I(rt,{src:ne,durationHint:ce}):I("video",{src:ne,controls:!0,playsInline:!0,preload:"metadata"}):null;if(n)return I("div",{className:ft("edp-rec",o),children:h?l==="audio"?I(rt,{src:h.url,durationHint:h.duration}):I("video",{src:h.url,controls:!0,playsInline:!0,preload:"metadata"}):I("p",{className:"edp-rec-message",children:c.recorderNone})});let ue=t==="audio"?I(ap,{"aria-hidden":!0}):t==="screen"?I(sp,{"aria-hidden":!0}):I(hi,{"aria-hidden":!0});return Z("div",{className:ft("edp-rec",o),children:[(f==="idle"||f==="requesting")&&Z("div",{className:"edp-rec-idle",children:[I("button",{type:"button",className:"edp-rec-record",onClick:O,disabled:f==="requesting"||!a,"aria-label":t==="screen"?c.openResponseTapToRecordScreen:c.recorderRecord,children:ue}),I("span",{className:"edp-rec-label",children:f==="requesting"?c.openResponseRequestingPermission:c.recorderRecord}),p&&I("span",{className:"edp-rec-limit",children:c.recorderUpTo(Yo(p))}),!a&&I("p",{className:"edp-rec-message",children:c.recorderUnavailableHere})]}),f==="recording"&&Z(Mr,{children:[l==="video"&&I("video",{ref:A,muted:!0,playsInline:!0}),Z("div",{className:"edp-rec-live",role:"status","aria-label":c.recorderRecordingAria,children:[t==="audio"?I("canvas",{ref:W,className:"edp-rec-level","aria-hidden":!0}):I("span",{style:{flex:1}}),Z("span",{className:"edp-rec-clock",dir:"ltr",children:[I("span",{className:"edp-rec-dot","aria-hidden":!0}),Yo(Math.floor(R)),p&&Z("small",{children:["/ ",Yo(p)]})]}),Z("button",{type:"button",className:"edp-rec-stop",onClick:z,children:[I("i",{"aria-hidden":!0}),c.openResponseStopRecording]})]})]}),(f==="uploading"||f==="saved"||f==="failed")&&Z(Mr,{children:[le,Z("div",{className:"edp-rec-foot",children:[f==="uploading"&&Z(Mr,{children:[I("span",{className:"edp-rec-status","aria-live":"polite",children:C&&C>0?c.recorderSaving(Math.round(C*100)):c.openResponseUploading}),I("span",{className:"edp-rec-progress","aria-hidden":!0,children:I("span",{style:{width:`${Math.round((C??0)*100)}%`}})}),I("button",{type:"button",className:"edp-rec-link",onClick:_,children:c.recorderCancel})]}),f==="saved"&&Z(Mr,{children:[Z("span",{className:"edp-rec-status edp-rec-status--ok","aria-live":"polite",children:[I(pp,{size:16,"aria-hidden":!0}),c.recorderSaved]}),I("button",{type:"button",className:"edp-rec-link",onClick:O,children:c.recorderRecordAgain})]}),f==="failed"&&Z(Mr,{children:[Z("span",{className:"edp-rec-status edp-rec-status--error",role:"alert",children:[I(up,{size:16,"aria-hidden":!0}),N??c.recorderFailed]}),Z("span",{style:{display:"inline-flex",gap:"1rem"},children:[I("button",{type:"button",className:"edp-rec-link",onClick:q,children:c.recorderRetry}),I("button",{type:"button",className:"edp-rec-link",onClick:O,children:c.recorderRecordAgain})]})]})]})]}),N&&f!=="failed"&&I("p",{className:"edp-rec-message",role:"alert",children:N})]})}function Np({feedback:e,feedbackState:t,score:r,t:n}){let o=t==="correct"?{bg:"var(--ok-soft, #ecf8f0)",border:"var(--ok, #1f8a4c)",ink:"var(--ok, #1f8a4c)"}:t==="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 Z("div",{className:"rounded p-3 text-sm border",style:{background:o.bg,borderColor:o.border,color:"var(--ink, #1d2025)"},children:[I("p",{className:"text-xs font-medium mb-1 opacity-70",children:n.openResponseTeacherFeedbackLabel}),e.flatMap(a=>a.content?.map(s=>s.text??"")??[a.text??""]).join(" "),r!=null&&Z("div",{className:"mt-1 text-right",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:F("1.4rem"),lineHeight:1,color:o.ink},children:[r," pts"]})]})}import{jsx as ht,jsxs as Xe,Fragment as vi}from"react/jsx-runtime";import{useEffect as Jo,useMemo as _p,useRef as Pp,useState as wi}from"react";import{Keyboard as Tp}from"lucide-react";var Mp=["power","fraction","root","pi","le","ge","ne","in"];function Ep(e){return e?.showFeedback?e.state==="validating"?"validating":e.state==="correct"?"correct":e.state==="incorrect"?"incorrect":"idle":"idle"}function sn({nodeId:e,placeholder:t,hint:r,validationFeedback:n,readOnly:o=!1}){let a=re(),s=ge(),i=Pp(null),[c,l]=wi(""),[p,f]=wi(!1),m=Ep(n),h=n?.score,d=n?.maxScore,u=x=>Number.isInteger(x)?String(x):x.toFixed(2),v=n?.displayAnswer,R=_p(()=>v?Ne(v,!1):"",[v]);Jo(()=>{let x=!0;return Ye().then(y=>x&&y&&f(!0)),()=>{x=!1}},[]);let S=()=>i.current,C=x=>{let y=S();if(!y||o)return;y.focus();let T=xn[x].inField;y.executeCommand?.(["insert",T,{selectionMode:T.includes("\\placeholder")?"placeholder":"after"}]),l(y.value)},w=()=>{let x=S(),y=it();if(!(!x||!y||o)){if(y.visible){y.hide();return}x.focus(),y.show(),yn(y,a.sheetKeyboardClose)}};Jo(()=>{let x=y=>{let T=y.answers?.find(g=>g.nodeId===e&&g.type==="mathResponse");T?.answer?.latex!==void 0&&(l(T.answer.latex),i.current&&(i.current.value=T.answer.latex))};return s.on("answers:prefill",x),()=>s.off("answers:prefill",x)},[s,e]),Jo(()=>{s.emit({type:"answer:changed",answer:{nodeId:e,type:"mathResponse",timestamp:Date.now(),answer:{latex:c}}})},[c,e,s]);let N=x=>{let y=x.target?.value??"";l(y)},k=m==="correct"?"player-math-field--correct":m==="incorrect"?"player-math-field--incorrect":m==="validating"?"player-math-field--validating":"";return Xe("div",{dir:"ltr",className:"math-response-player",children:[Xe("span",{style:{display:"inline-flex",alignItems:"center",gap:F("0.4rem")},children:[ht("div",{className:"player-math-field"+(k?" "+k:"")+(o?" player-math-field--readonly":""),children:p?ht("math-field",{ref:i,value:c,onInput:N,onFocus:x=>gn(x.currentTarget),"math-virtual-keyboard-policy":"manual","smart-fence":"true",className:"player-math-field__input",style:{opacity:o?.7:1,pointerEvents:o?"none":"auto"}}):ht("input",{type:"text",value:c,onChange:x=>l(x.target.value),placeholder:t||"Enter LaTeX (e.g. \\frac{x^2}{2})",readOnly:o,className:"player-math-field__fallback"})}),ht(ot,{hint:r})]}),p&&!o&&Xe("div",{className:"edp-sheet-keys player-math-keys",role:"toolbar","aria-label":a.sheetKeysAria,children:[Mp.map(x=>ht("button",{type:"button",className:"edp-sheet-key",title:ki(a,x),"aria-label":ki(a,x),onMouseDown:y=>y.preventDefault(),onClick:()=>C(x),children:kn[x]},x)),Xe("button",{type:"button",className:"edp-sheet-key edp-sheet-key--more",onMouseDown:x=>x.preventDefault(),onClick:w,children:[ht(Tp,{size:16,"aria-hidden":"true"})," ",a.sheetMoreKeys]})]}),n?.showFeedback&&Xe("div",{className:"player-math-feedback player-math-feedback--"+m,children:[m==="validating"&&Xe(vi,{children:[ht("span",{className:"player-math-spinner"}),ht("span",{children:a.mathChecking})]}),m==="correct"&&Xe(vi,{children:[Xe("span",{children:["\u2713 ",a.mathCorrect]}),h!=null&&Xe("span",{className:"player-math-score",children:[u(h),d!=null?` / ${u(d)}`:""]})]}),m==="incorrect"&&Xe("span",{children:["\u2717 ",a.mathIncorrect]}),m==="incorrect"&&R&&Xe("span",{className:"player-blank-reveal player-math-reveal",children:["(",ht("span",{dangerouslySetInnerHTML:{__html:R}}),")"]})]})]})}function ki(e,t){return{power:e.sheetKeyPower,fraction:e.sheetKeyFraction,root:e.sheetKeyRoot,pi:e.sheetKeyPi,le:e.sheetKeyLe,ge:e.sheetKeyGe,ne:e.sheetKeyNe,in:e.sheetKeyIn}[t]}import{jsx as ie,jsxs as ke,Fragment as Ir}from"react/jsx-runtime";import{useCallback as Qp,useEffect as Yp,useRef as Xp,useState as Lr}from"react";import{Play as Jp,Lock as Zp,Check as ea,X as Ci}from"lucide-react";function _n(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=typeof t||typeof e!="object")return!1;let r=Array.isArray(e),n=Array.isArray(t);if(r!==n)return!1;if(r&&n){let c=e,l=t;return c.length!==l.length?!1:c.every((p,f)=>_n(p,l[f]))}let o=e,a=t,s=Object.keys(o),i=Object.keys(a);return s.length!==i.length?!1:s.every(c=>_n(o[c],a[c]))}var Lp=`
3
8
  "use strict";
4
9
 
5
10
  // Capture console output for stdio mode
@@ -36,17 +41,17 @@ self.onmessage = async function(e) {
36
41
  self.postMessage({ testId, passed: false, stderr: String(err), errored: true, durationMs: Date.now() - start });
37
42
  }
38
43
  };
39
- `;async function jc(e,r,t,n,o,a,s,i,c){return new Promise(l=>{let d=new Blob([Oc],{type:"text/javascript"}),m=URL.createObjectURL(d),p=new Worker(m),g=setTimeout(()=>{p.terminate(),URL.revokeObjectURL(m),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);p.onmessage=u=>{clearTimeout(g),p.terminate(),URL.revokeObjectURL(m);let h=u.data;if(r==="function"&&!h.errored){let v=qt(h.actual,a);l({testId:n,passed:v,actual:h.actual,stderr:h.stderr,durationMs:h.durationMs})}else l({testId:n,passed:h.passed??!1,actualStdout:h.actualStdout,stderr:h.stderr,durationMs:h.durationMs,errored:h.errored})},p.onerror=u=>{clearTimeout(g),p.terminate(),URL.revokeObjectURL(m),l({testId:n,passed:!1,stderr:u.message,errored:!0})},p.postMessage({testId:n,source:e,mode:r,entryFunction:t,args:o,expectedStdout:i,timeout:c})})}var Bc="0.27.7";function qc(){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||Bc}/full/`}var tt=null;function Wc(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():tt||(tt=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=()=>{tt=null,t(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),tt)}var jt=null;async function Uc(){if(jt)return jt;let e=qc();await Wc(e);let r=globalThis.loadPyodide;if(typeof r!="function")throw new Error("Pyodide global not available after loading the CDN script");return jt=await r({indexURL:e}),jt}async function Hc(e,r,t,n,o,a,s,i,c){let l=Date.now();try{let d=await Uc();if(r==="stdio"){d.runPython(`
44
+ `;async function Ip(e,t,r,n,o,a,s,i,c){return new Promise(l=>{let p=new Blob([Lp],{type:"text/javascript"}),f=URL.createObjectURL(p),m=new Worker(f),h=setTimeout(()=>{m.terminate(),URL.revokeObjectURL(f),l({testId:n,passed:!1,stderr:`Execution timed out after ${c}ms`,errored:!0})},c);m.onmessage=d=>{clearTimeout(h),m.terminate(),URL.revokeObjectURL(f);let u=d.data;if(t==="function"&&!u.errored){let v=_n(u.actual,a);l({testId:n,passed:v,actual:u.actual,stderr:u.stderr,durationMs:u.durationMs})}else l({testId:n,passed:u.passed??!1,actualStdout:u.actualStdout,stderr:u.stderr,durationMs:u.durationMs,errored:u.errored})},m.onerror=d=>{clearTimeout(h),m.terminate(),URL.revokeObjectURL(f),l({testId:n,passed:!1,stderr:d.message,errored:!0})},m.postMessage({testId:n,source:e,mode:t,entryFunction:r,args:o,expectedStdout:i,timeout:c})})}var $p="0.27.7";function Fp(){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||$p}/full/`}var Er=null;function zp(e){return typeof globalThis.loadPyodide=="function"?Promise.resolve():Er||(Er=new Promise((t,r)=>{if(typeof document>"u"){r(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=()=>t(),n.onerror=()=>{Er=null,r(new Error(`Failed to load Pyodide from ${n.src}`))},document.head.appendChild(n)}),Er)}var An=null;async function Dp(){if(An)return An;let e=Fp();await zp(e);let t=globalThis.loadPyodide;if(typeof t!="function")throw new Error("Pyodide global not available after loading the CDN script");return An=await t({indexURL:e}),An}async function Op(e,t,r,n,o,a,s,i,c){let l=Date.now();try{let p=await Dp();if(t==="stdio"){p.runPython(`
40
45
  import sys, io
41
46
  _stdout_capture = io.StringIO()
42
47
  sys.stdout = _stdout_capture
43
- `),s&&d.runPython(`
48
+ `),s&&p.runPython(`
44
49
  import io
45
50
  sys.stdin = io.StringIO(${JSON.stringify(s)})
46
- `),d.runPython(e);let m=d.runPython("_stdout_capture.getvalue()");d.runPython("sys.stdout = sys.__stdout__");let p=m.trim()===(i||"").trim();return{testId:n,passed:p,actualStdout:m,durationMs:Date.now()-l}}else{d.runPython(e);let m=(o||[]).map(u=>JSON.stringify(u)).join(", "),p=d.runPython(`${t}(${m})`),g=qt(p,a);return{testId:n,passed:g,actual:p,durationMs:Date.now()-l}}}catch(d){return{testId:n,passed:!1,stderr:String(d),errored:!0,durationMs:Date.now()-l}}}var Bt=null;async function Vc(){if(Bt)return Bt;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return Bt=await(e.default??e)(),Bt}async function Qc(e,r,t,n){let o=Date.now();try{let a=await Vc(),s=new a.Database;t&&s.run(t);let c=s.exec(e).flatMap(d=>d.values.map(m=>m.map(String).join("|"))).join(`
47
- `),l=c.trim()===(n||"").trim();return s.close(),{testId:r,passed:l,actualStdout:c,durationMs:Date.now()-o}}catch(a){return{testId:r,passed:!1,stderr:String(a),errored:!0,durationMs:Date.now()-o}}}async function Gc(e){let{transform:r}=await import("./esm-RQP7AIMT.mjs");return r(e,{transforms:["typescript"]}).code}var $r=class{supports(r){return["javascript","typescript","python","sql"].includes(r)}async run(r){let{language:t,source:n,mode:o,entryFunction:a,tests:s,timeoutMs:i=5e3}=r;if(!this.supports(t))return s.map(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 Gc(n)}catch(d){return s.map(m=>({testId:m.id,passed:!1,stderr:`TypeScript compile error: ${d.message}`,errored:!0}))}let l=[];for(let d of s){let m;t==="python"?m=await Hc(c,o,a,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i):t==="sql"?m=await Qc(c,d.id,d.stdin,d.expectedStdout):m=await jc(c,o,a,d.id,d.args,d.expectedReturn,d.stdin,d.expectedStdout,i),l.push(m)}return l}};import{jsx as Ea}from"react/jsx-runtime";import{forwardRef as Yc,useEffect as Kc,useImperativeHandle as Xc,useRef as Jc,useState as Zc}from"react";function el(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var On=Yc(function({value:r,onChange:t,language:n="javascript",readOnly:o=!1,readOnlyRanges:a,placeholder:s,height:i=300,className:c,autoFocus:l},d){let[m,p]=Zc(null),{scale:g}=Ie(),u=Jc(null);Kc(()=>{import("./dist-RXTJ74FF.mjs").then(w=>{p(()=>w.default)}).catch(()=>{})},[]),Xc(d,()=>({getValue(){return u.current?.getValue?.()??r},focus(){u.current?.focus?.()},insert(w){let C=u.current;if(!C)return;let y=C.getSelection();C.executeEdits("insert",[{range:y,text:w,forceMoveMarkers:!0}])}}));function h(w){u.current=w,l&&w.focus(),a?.length&&w.onDidAttemptReadOnlyEdit(()=>{})}function v(w){t(w??"")}let R=typeof i=="number"?i*g:i;return m?Ea(m,{className:c,height:R,language:el(n),value:r,onChange:v,onMount:h,options:{readOnly:o,minimap:{enabled:!1},fontSize:14*g,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):Ea("textarea",{className:c,value:r,onChange:w=>t(w.target.value),readOnly:o,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:o?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var sl=new $r;function il(e){return e?.showFeedback?e.state??"idle":"idle"}function Pa(e){let r={};for(let t of e.attrs.starters??[])r[t.language]=t.code;return r}function cl({sample:e,result:r,mode:t}){let n=r?.passed,o=r?.errored,a=r!==void 0,s=a?o?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=a?o?"\u26A0":null:"\u25CB";return we("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:[we("div",{style:{display:"flex",alignItems:"center",gap:I("0.5rem")},children:[oe("span",{style:{color:s,fontWeight:700,fontSize:I("0.875rem"),display:"inline-flex"},children:i??(n?oe(jn,{size:15,style:fe(15)}):oe(Ta,{size:15}))}),oe("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),a&&!n&&we("div",{style:{marginTop:I("0.25rem"),paddingLeft:I("1.5rem")},children:[t==="function"?oe(ot,{children:r?.actual!==void 0&&we("div",{style:{color:"var(--ink-soft, #565b66)"},children:[oe("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),oe("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(r.actual)}),oe("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),oe("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):oe(ot,{children:r?.actualStdout!==void 0&&we("div",{style:{color:"var(--ink-soft, #565b66)"},children:[we("div",{children:[oe("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),oe("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:r.actualStdout||"(empty)"})]}),we("div",{children:[oe("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),oe("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),r?.stderr&&oe("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:I("0.125rem"),whiteSpace:"pre-wrap"},children:r.stderr})]})]})}function Tt({node:e,validationFeedback:r,readOnly:t=!1,executor:n=sl,gradingTests:o}){let a=xe(),s=nl(null),{attrs:i}=e,c=e.id,[l,d]=nt(i.defaultLanguage),[m,p]=nt(()=>Pa(e)),[g,u]=nt([]),[h,v]=nt(!1),[R,w]=nt(!1),C=m[l]??"",y=il(r);tl(()=>{let A=Q=>{let B=Q.answers?.find(H=>H.nodeId===c&&H.type==="codingResponse");B?.answer&&(B.answer.language&&d(B.answer.language),B.answer.sourceByLanguage&&p(B.answer.sourceByLanguage),B.answer.testResults&&u(B.answer.testResults))},L=()=>{p(Pa(e)),u([]),w(!1)};return a.on("answers:prefill",A),a.on("answers:reset",L),()=>{a.off("answers:prefill",A),a.off("answers:reset",L)}},[a,c,e]);let S=rl((A,L,Q)=>{a.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:A,sourceByLanguage:L,source:L[A]??"",testResults:Q}}})},[a,c]),k=A=>{let L={...m,[l]:A};p(L),S(l,L,g)},_=A=>{d(A),u([]),S(A,m,[])},P=async()=>{if(h)return;v(!0),u([]);let A=o??i.visibleSamples??[];if(A.length===0){v(!1);return}try{let L=await n.run({language:l,source:C,mode:i.testMode,entryFunction:i.entryFunction,tests:A,timeoutMs:5e3});u(L),S(l,m,L)}catch(L){let Q=A.map(B=>({testId:B.id,passed:!1,stderr:String(L),errored:!0}));u(Q),S(l,m,Q)}finally{v(!1)}},z=()=>{R||(w(!0),S(l,m,g))},b=(o??[]).filter(A=>A.hidden).length,T=b>0?g.filter(A=>(o??[]).find(Q=>Q.id===A.testId)?.hidden&&A.passed).length:0,f=o?o.filter(A=>!A.hidden):i.visibleSamples??[],q=y==="correct"?"var(--ok, #1f8a4c)":y==="partial"?"var(--almost, #c8810e)":y==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return we("div",{style:{margin:`${I("0.75rem")} 0`,border:`1px solid ${q}`,borderRadius:I("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[we("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:[oe("div",{style:{display:"flex",gap:I("0.25rem")},children:i.languages.map(A=>oe("button",{onClick:()=>!t&&_(A),disabled:t,style:{padding:`${I("0.2rem")} ${I("0.6rem")}`,borderRadius:I("0.375rem"),border:"1px solid",borderColor:l===A?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===A?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===A?"#fff":"var(--ink-soft, #565b66)",fontSize:I("0.75rem"),fontWeight:600,cursor:t?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:A},A))}),oe("div",{style:{flex:1}}),oe(Ke,{hint:i.hint}),!t&&we(ot,{children:[we("button",{onClick:P,disabled:h,style:{padding:`${I("0.25rem")} ${I("0.75rem")}`,borderRadius:I("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:h?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:I("0.8125rem"),fontWeight:600,cursor:h?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:I("0.35rem")},children:[oe(ol,{size:13,style:fe(13)})," ",h?"Running\u2026":"Run"]}),we("button",{onClick:z,disabled:R,style:{padding:`${I("0.3rem")} ${I("0.85rem")}`,borderRadius:I("0.5rem"),border:"none",background:R?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:R?"var(--ok, #1f8a4c)":"#fff",fontSize:I("0.8125rem"),fontWeight:600,cursor:R?"default":"pointer",display:"inline-flex",alignItems:"center",gap:I("0.35rem")},children:[R&&oe(jn,{size:13,style:fe(13)})," ",R?"Submitted":"Submit"]})]})]}),oe(On,{ref:s,value:C,onChange:k,language:l,readOnly:t,readOnlyRanges:i.starters.find(A=>A.language===l)?.readOnlyRanges,height:320}),(g.length>0||f.length>0)&&we("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[oe("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"}),f.map(A=>oe(cl,{sample:A,result:g.find(L=>L.testId===A.id),mode:i.testMode},A.id)),b>0&&we("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:[oe(al,{size:13,style:fe(13)})," Hidden tests: ",T,"/",b," passed"]})]}),r?.showFeedback&&we("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:y==="correct"?"var(--ok-soft, #ecf8f0)":y==="partial"?"var(--almost-soft, #fbf1dc)":y==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:y==="correct"?"var(--ok, #1f8a4c)":y==="partial"?"var(--almost-ink, #8a5a08)":y==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[y==="correct"&&we(ot,{children:[oe(jn,{size:15,style:fe(15)})," All tests passed"]}),y==="partial"&&"Partial credit",y==="incorrect"&&we(ot,{children:[oe(Ta,{size:15,style:fe(15)})," Tests failed"]}),y==="validating"&&"Evaluating\u2026",y==="awaiting_review"&&"Awaiting teacher review",r.score!==void 0&&we("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 pl,jsx as Wt,jsxs as ul}from"react/jsx-runtime";import{createContext as ml,useContext as fl,useEffect as hl}from"react";import{DndContext as gl,MouseSensor as bl,TouchSensor as yl,KeyboardSensor as xl,useDndContext as vl,useSensor as Wn,useSensors as wl}from"@dnd-kit/core";import{jsx as Bn}from"react/jsx-runtime";import{DragOverlay as ll,useDndContext as dl}from"@dnd-kit/core";function qn(){let{active:e}=dl();if(!e)return null;let r=e.data.current?.html??"";return Bn(ll,{dropAnimation:null,children:Bn("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:Bn("span",{dangerouslySetInnerHTML:{__html:r},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}function kl(e,r,t){let n=[],o=new Set,a=s=>{o.has(s)||(o.add(s),t(s)==="smooth"&&(n.push([s,s.style.scrollBehavior]),s.style.scrollBehavior="auto"))};for(let s=e;s;s=s.parentElement)a(s);return r&&a(r),()=>{for(let[s,i]of n)s.style.scrollBehavior=i}}function Rl(){let{activeNode:e}=vl();return hl(()=>{if(!(!e||typeof document>"u"))return kl(e,document.scrollingElement,r=>getComputedStyle(r).scrollBehavior)},[e]),null}var Ma=ml(!1),Sl={acceleration:3,threshold:{x:0,y:.25}};function Ut({children:e}){let r=fl(Ma),t=Wn(bl,{activationConstraint:{distance:8}}),n=Wn(yl,{activationConstraint:{delay:250,tolerance:5}}),o=Wn(xl),a=wl(t,n,o);return r?Wt(pl,{children:e}):Wt(Ma.Provider,{value:!0,children:ul(gl,{sensors:a,autoScroll:Sl,children:[e,Wt(qn,{}),Wt(Rl,{})]})})}function Dr({content:e,onAnswersChange:r,onSubmit:t,answerBus:n,namespace:o,initialAnswers:a,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:d,codeExecutor:m,display:p}){let g=Le(p),u=Cl(()=>Fe(g),[g]),h=_l(null);h.current||(h.current=new Ze);let v=n??h.current;Un(()=>{a&&a.length>0&&v.prefillAnswers(a)},[a,v]),Un(()=>{if(!r)return;let w=()=>{let C=v.getAllAnswers();r(C)};return v.on("answer:changed",w),()=>v.off("answer:changed",w)},[v,r]),Un(()=>{if(!t)return;let w=C=>{t(C.answers)};return v.on("answer:submitted",w),()=>v.off("answer:submitted",w)},[v,t]);let R=De(e,s,{readOnly:l,mediaHandler:d,codeExecutor:m});return zr(Yr,{locale:c,children:zr($e,{display:g,children:zr(gt,{bus:v,children:zr(Ut,{children:zr(Lt,{initialAnswers:a,children:zr("div",{className:`question-runtime ${i}${u.sizeSet?" edp-scaled":""}`,"data-namespace":o,style:{fontSize:I("1.125rem"),lineHeight:"1.75",...Oe(u)},children:R})})})})})})}import{jsx as Fr,jsxs as Qt}from"react/jsx-runtime";import{memo as Pl,useCallback as Da,useMemo as Tl,useRef as za}from"react";var La={words:80,media:1,tableRows:6},Nl=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function Ia(e){let r={words:0,media:0,tableRows:0},t=n=>{if(typeof n.text=="string"&&(r.words+=n.text.split(/\s+/).filter(o=>/[\p{L}\p{N}]/u.test(o)).length),n.type&&Nl.has(n.type)&&r.media++,n.type==="table"){let o=(n.content??[]).filter(a=>a.type==="tableRow").length;r.tableRows=Math.max(r.tableRows,o)}for(let o of n.content??[])t(o)};return e&&t(e),r}function at(e,r=La){let t=Ia(e);return t.words>r.words||t.media>r.media||t.tableRows>r.tableRows}import{createContext as Al,useContext as El}from"react";var $a=Al(null),Ht=$a.Provider;function Vt(){return El($a)}function Gt({exercise:e,onAnswersChange:r,validationFeedback:t,renderSharedContext:n,renderQuestion:o,renderSeparator:a,className:s="",locale:i,display:c}){let l=Le(c),d=Tl(()=>Fe(l),[l]),m=za(new Map),p=za({exercise:e,onAnswersChange:r});p.current={exercise:e,onAnswersChange:r};let g=Da((w,C)=>{m.current.set(w,C);let{exercise:y,onAnswersChange:S}=p.current;if(S){let k={exerciseId:y.id,questionAnswers:y.questions.map(_=>({questionId:_.id,answers:m.current.get(_.id)??[]}))};S(k)}},[]),u=Vt(),h=Gr(i),v=!!(u&&e.sharedContext&&at(e.sharedContext)),R=e.sharedContext?v?Qt("p",{className:"exercise-reference-cue",children:[Fr("span",{children:h.referenceInPanel(u.label)})," ",Qt("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>u.showExerciseReference(e.id),children:[h.readReference,Fr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):Fr("div",{className:"exercise-shared-context",children:De(e.sharedContext)}):null;return Fr($e,{display:l,children:Qt("div",{className:`exercise-runtime ${s}`,style:Oe(d),children:[R&&(n?n(R):R),e.questions.map((w,C)=>{let y=t?.get(w.id),S=Fr(Ml,{questionId:w.id,content:w.content,onQuestionAnswers:g,validationFeedback:y,locale:i},w.id);return Qt("div",{children:[o?o(w,S,C):S,a&&C<e.questions.length-1?a(C):null]},w.id)})]})})}var Ml=Pl(function({questionId:r,onQuestionAnswers:t,...n}){let o=Da(a=>t(r,a),[t,r]);return Fr(Dr,{...n,onAnswersChange:o})});import{jsx as Hn,jsxs as Ll}from"react/jsx-runtime";import{useCallback as Il,useEffect as $l,useMemo as zl,useRef as Fa}from"react";function pr({assessment:e,onAnswersChange:r,validationFeedback:t,renderExercise:n,renderSharedContext:o,renderSeparator:a,className:s="",brandingConfig:i,locale:c,display:l}){let d=Fa(new Map),m=Le(l),p=zl(()=>Fe(m),[m]);$l(()=>{if(!i?.fontUrl)return;let v=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(v))return;let R=document.createElement("link");R.id=v,R.rel="stylesheet",R.href=i.fontUrl,document.head.appendChild(R)},[i?.fontUrl]);let g={...Oe(p)};i?.fontFamily&&(g["--brand-font"]=i.fontFamily);let u=Fa({assessment:e,onAnswersChange:r});u.current={assessment:e,onAnswersChange:r};let h=Il(v=>{d.current.set(v.exerciseId,v);let{assessment:R,onAnswersChange:w}=u.current;if(w){let C={exerciseAnswers:R.exercises.map(y=>d.current.get(y.id)??{exerciseId:y.id,questionAnswers:[]})};w(C)}},[]);return Hn($e,{display:m,children:Hn("div",{className:`assessment-runtime ${s}`,style:Object.keys(g).length?g:void 0,children:e.exercises.map((v,R)=>{let w=t?.get(v.id),C=Hn(Gt,{exercise:v,onAnswersChange:h,validationFeedback:w,renderSharedContext:o?y=>o(y,v):void 0,locale:c},v.id);return Ll("div",{children:[n?n(v,C,R):C,a&&R<e.exercises.length-1?a(R):null]},v.id)})})})}import{jsx as Oa}from"react/jsx-runtime";import{useMemo as Dl}from"react";function Or({content:e,className:r,display:t}){let n=Le(t),o=Dl(()=>Fe(n),[n]);return Oa($e,{display:n,children:Oa("div",{className:`content-view ${r??""}`,style:Oe(o),children:De(e)})})}import{jsx as st,Fragment as ja,jsxs as Yt}from"react/jsx-runtime";import{useMemo as Fl}from"react";function it({item:e,className:r,renderFigureLabel:t,display:n}){let o=Le(n),a=Fl(()=>Fe(o),[o]);return st($e,{display:o,children:Yt("div",{className:`annex-item-view ${r??""}${a.sizeSet?" edp-scaled":""}`,style:Oe(a),children:[e.type==="text-document"&&Yt(ja,{children:[e.title&&st("h3",{className:"text-base font-semibold mb-2",children:e.title}),De(e.content)]}),e.type==="figure"&&Yt("figure",{children:[De(e.content),st("figcaption",{children:t?t(e.label):st("span",{children:e.label})})]}),e.type==="rich-block"&&Yt(ja,{children:[e.title&&st("h3",{className:"text-base font-semibold mb-2",children:e.title}),De(e.content)]})]})})}import{jsx as uh,jsxs as mh}from"react/jsx-runtime";import{useState as hh}from"react";import{jsx as wh,jsxs as kh}from"react/jsx-runtime";import{useState as Sh,useCallback as Ch,useMemo as _h}from"react";import{useEditor as Ah,EditorContent as Eh}from"@tiptap/react";import Th from"@tiptap/starter-kit";import{jsx as zh,jsxs as Dh,Fragment as Fh}from"react/jsx-runtime";import{useMemo as jh,useState as Bh}from"react";function _r(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))}_r(`:root{--ink: #1d2025;--ink-soft: #565b66;--ink-faint: #8d93a0;--ui-muted: #f5f4f1;--line: #e7e5e0;--line-strong: #d6d3cc;--ok: #1f8a4c;--ok-soft: #ecf8f0;--pen: #d23b2b;--pen-soft: #fdeeec;--almost: #c8810e;--almost-ink: #8a5a08;--almost-soft: #fbf1dc;--font-hand: "Caveat", cursive}@keyframes answer-shake{10%,90%{transform:translate(-2px)}20%,80%{transform:translate(4px)}30%,50%,70%{transform:translate(-6px)}40%,60%{transform:translate(6px)}}@keyframes hop{0%,to{transform:translateY(0) scale(1)}40%{transform:translateY(-6%) scale(1.05)}}@keyframes wobble{0%,to{transform:translate(0)}15%,85%{transform:translate(-4px)}30%,70%{transform:translate(4px)}45%,55%{transform:translate(-2px)}}.animate-shake{animation:answer-shake .4s both}.animate-hop{animation:hop .5s ease-out}.animate-wobble{animation:wobble .5s ease}.cs-player__grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:repeat(1,minmax(0,1fr))}@media(min-width:40rem){:where(.cs-player:not(.cs-player--box)) .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.cs-player--box{container-type:inline-size}@container (min-width: 35.5em){.cs-player--box .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.player-choice{position:relative;display:inline-flex;align-items:center;gap:calc(.75rem * var(--edp-scale, 1));flex-wrap:wrap;width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:1.5px solid var(--line, #e7e5e0);border-radius:calc(.75rem * var(--edp-scale, 1));background-color:#fff;color:var(--ink, #1d2025);cursor:pointer;user-select:none;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;font-weight:500;text-align:start}.player-choice:hover:not(:disabled){background-color:var(--ui-muted, #f5f4f1);border-color:var(--line-strong, #d6d3cc)}.player-choice:disabled{cursor:default}.player-choice>img{flex-shrink:0}.player-choice__mark{flex:none;display:grid;place-items:center;width:calc(20px * var(--edp-scale, 1));height:calc(20px * var(--edp-scale, 1));border:1.5px solid var(--ink-faint, #8d93a0);background:#fff;color:#fff;transition:border-color .15s,background .15s}.player-choice__mark--radio{border-radius:999px}.player-choice__mark--box{border-radius:calc(6px * var(--edp-scale, 1))}.player-choice__mark>svg{width:calc(13px * var(--edp-scale, 1));height:calc(13px * var(--edp-scale, 1));opacity:0}.player-choice__text{flex:1;min-width:0}.player-choice{height:100%}.player-choice__text img,.player-choice__text video,.player-choice__text iframe{max-height:calc(120px * var(--edp-scale, 1));width:auto;max-width:100%}.player-choice--tile{flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(1rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__mark{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-start:calc(.5rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__text{flex:0 1 auto;width:100%;text-align:center}.player-choice--tile .player-choice__text img,.player-choice--tile .player-choice__text video,.player-choice--tile .player-choice__text iframe{display:block!important;margin-inline:auto;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice--selected{background-color:var(--ui-muted, #f5f4f1);border-color:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark>svg{opacity:1}.player-choice--correct{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark{border-color:var(--ok, #1f8a4c);background:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark>svg{opacity:1}.player-choice--correct-unchosen{background-color:#fff;border-color:var(--ok, #1f8a4c);border-style:dashed}.player-choice--correct-unchosen .player-choice__mark{border-color:var(--ok, #1f8a4c)}.player-choice--incorrect{background-color:var(--pen-soft, #fdeeec);border-color:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark{border-color:var(--pen, #d23b2b);background:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark>svg{opacity:1}.player-choice--muted{opacity:.55}.player-choice--partial{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--disabled{cursor:default}.player-choice__mark--letter{width:calc(1.625rem * var(--edp-scale, 1));height:calc(1.625rem * var(--edp-scale, 1));color:var(--ink, #1d2025);font-size:.8em;font-weight:700;line-height:1}.player-choice--selected .player-choice__mark--letter,.player-choice--correct .player-choice__mark--letter,.player-choice--incorrect .player-choice__mark--letter{color:#fff}.player-choice--correct-unchosen .player-choice__mark--letter{color:var(--ok, #1f8a4c)}.player-choice__verdict{flex:none;display:grid;place-items:center;margin-inline-start:auto}.player-choice__verdict>svg{width:calc(1.125rem * var(--edp-scale, 1));height:calc(1.125rem * var(--edp-scale, 1))}.player-choice__verdict--correct{color:var(--ok, #1f8a4c)}.player-choice__verdict--incorrect{color:var(--pen, #d23b2b)}.player-choice--tile .player-choice__verdict{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-end:calc(.5rem * var(--edp-scale, 1));margin:0}.player-inline-choice{display:inline-flex;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:.05em .55em;border:1.5px solid var(--line-strong, #d6d3cc);border-radius:999px;background:#fff;color:var(--ink, #1d2025);font-size:.9em;line-height:inherit;cursor:pointer;user-select:none;transition:border-color .15s,background .15s}.player-inline-choice:hover:not(:disabled){background:var(--ui-muted, #f5f4f1)}.player-inline-choice:disabled{cursor:default}.player-inline-choice--selected{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-inline-choice--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-inline-choice--correct-unchosen{border-color:var(--ok, #1f8a4c);border-style:dashed}.player-inline-choice--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-inline-choice--muted{opacity:.55}.player-inline-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input{display:inline-block;min-width:3ch;padding:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:none;border-bottom:2px solid var(--line-strong, #d6d3cc);background-color:transparent;font-size:inherit;font-family:inherit;transition:all .2s ease;outline:none}.player-blank-input:focus{border-bottom-color:var(--ink, #1d2025);background-color:var(--ui-muted, #f5f4f1)}.player-blank-input--correct{border-bottom-color:var(--ok, #1f8a4c);background-color:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-input--incorrect{border-bottom-color:var(--pen, #d23b2b);background-color:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-input:disabled{opacity:.7;cursor:not-allowed}.player-typed-blank{display:inline-block;min-width:7ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);outline:none;resize:none;overflow:hidden;vertical-align:middle}.player-typed-blank::placeholder{color:var(--ink-faint, #8d93a0);font-weight:500}.player-typed-blank:focus{border-color:var(--ink, #1d2025)}.player-typed-blank--pending{border-color:var(--ink-faint, #8d93a0);background:var(--card, #ffffff)}.player-blank-cell{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.125rem * var(--edp-scale, 1)) calc(.25rem * var(--edp-scale, 1));width:100%}.player-blank-cell__box{position:relative;display:block;flex:1 1 100%;min-width:0}.player-typed-blank--cell{display:block;box-sizing:border-box;width:100%;min-width:6.5ch;padding:calc(1px * var(--edp-scale, 1)) calc(2px * var(--edp-scale, 1));font:inherit;font-weight:600;line-height:1.3;white-space:nowrap;overflow-x:hidden}.player-typed-blank-feedback--cell{display:block;box-sizing:border-box;width:max-content;min-width:100%;max-width:none;white-space:nowrap;overflow:visible}.player-blank-cell .player-blank-reveal{white-space:nowrap;font-size:.9em}.edp-table-arrows{display:flex;justify-content:flex-end}.edp-table-arrows--top{margin-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrows--bottom{margin-top:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrows__pair{display:inline-flex;gap:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrow{display:inline-flex;align-items:center;justify-content:center;width:calc(1.875rem * var(--edp-scale, 1));height:calc(1.875rem * var(--edp-scale, 1));padding:0;border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;transition:border-color .15s,background .15s,opacity .15s;-webkit-tap-highlight-color:transparent}.edp-table-arrow:hover:not(:disabled){border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.edp-table-arrow:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-table-arrow:disabled{opacity:.35;cursor:default}.edp-table-shade{position:absolute;top:0;bottom:0;width:calc(1.5rem * var(--edp-scale, 1));pointer-events:none;z-index:2}.edp-table-shade--left{background:linear-gradient(to right,#1d202529,#1d202500)}.edp-table-shade--right{background:linear-gradient(to left,#1d202529,#1d202500)}@media(max-width:640px){.edp-table-first{max-width:38vw}}.player-typed-blank-feedback{display:inline-block;min-width:2ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));overflow-x:auto;cursor:default;vertical-align:middle}.player-typed-blank-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--partial{border-color:var(--ok, #1f8a4c);border-style:dashed;background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b);text-decoration:line-through}.player-typed-blank-spinner{display:inline-block;width:calc(.75rem * var(--edp-scale, 1));height:calc(.75rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:blank-spin .7s linear infinite}@keyframes blank-spin{to{transform:rotate(360deg)}}.player-blank-reveal{font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;word-break:break-word;min-width:0}.player-blank-feedback{display:inline-block;font-size:.8em;font-weight:500;line-height:1.3;padding:calc(2px * var(--edp-scale, 1)) calc(8px * var(--edp-scale, 1));border-radius:999px;word-break:break-word;min-width:0;background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66)}.player-blank-feedback--correct{background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-feedback--incorrect{background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-hint-btn{width:calc(1rem * var(--edp-scale, 1));height:calc(1rem * var(--edp-scale, 1));border:0;border-radius:999px;background:#fbbf24;color:#fff;font-size:calc(10px * var(--edp-scale, 1));font-weight:700;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .12s}.player-blank-hint-btn:hover,.player-blank-hint-btn--pinned{background:#f59e0b}.player-blank-hint-pop{position:absolute;bottom:100%;left:50%;transform:translate(-50%);margin-bottom:calc(.5rem * var(--edp-scale, 1));z-index:9999;min-width:calc(180px * var(--edp-scale, 1));max-width:calc(300px * var(--edp-scale, 1));width:max-content;background:#fffbeb;border:1px solid #fde68a;border-radius:calc(14px * var(--edp-scale, 1));box-shadow:0 8px 24px #92400e2e;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:#78350f}.matching-player-hintrow{display:flex;justify-content:flex-start;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice-blank{display:inline-flex;align-items:center;justify-content:center;min-width:4ch;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:2px dashed var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));color:var(--ink-faint, #8d93a0);background:transparent;transition:border-color .15s,background .15s,transform .15s,color .15s;vertical-align:middle}.player-choice-blank--target{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-choice-blank--over{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);transform:scale(1.05)}.player-choice-blank--filled{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);cursor:pointer}.player-choice-blank--correct,.player-choice-blank--partial{border-style:solid;border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-choice-blank--incorrect{border-style:solid;border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-choice-blank__clear{margin-inline-start:calc(.25rem * var(--edp-scale, 1));opacity:0;font-size:calc(.75rem * var(--edp-scale, 1));line-height:1;transition:opacity .12s}.player-choice-blank--filled:hover .player-choice-blank__clear{opacity:.6}.player-word-bank{margin:calc(1rem * var(--edp-scale, 1)) 0;position:relative;border:1px solid var(--line, #e7e5e0);border-radius:calc(14px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-word-bank__label{margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:.7em;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft, #565b66);user-select:none}.player-word-bank__items{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.player-word-bank__items--grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(calc(10rem * var(--edp-scale, 1)),1fr));gap:calc(.5rem * var(--edp-scale, 1))}.player-bank-pill{display:inline-block;padding:calc(.35rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);user-select:none;-webkit-touch-callout:none;touch-action:manipulation;cursor:grab;transition:border-color .15s,background .15s,box-shadow .15s}.player-bank-pill:hover{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-bank-pill--dragging{opacity:.5;cursor:grabbing;box-shadow:0 8px 24px #1d20252e}.player-bank-pill--hinted{position:relative}.player-tap-hint{position:absolute;left:calc(50% - 10px * var(--edp-scale, 1));top:50%;width:calc(30px * var(--edp-scale, 1));height:calc(30px * var(--edp-scale, 1));z-index:2;pointer-events:none;color:var(--ink, #1d2025)}.player-tap-hint__hand{display:block;width:100%;height:100%;opacity:.92;filter:drop-shadow(0 2px 3px rgba(29,32,37,.25));transform-origin:33% 8%;animation:edp-tap-hand 1.8s ease-in-out infinite}.player-tap-hint__ripple{position:absolute;left:calc(10px * var(--edp-scale, 1) - 11px);top:-11px;width:22px;height:22px;border-radius:999px;border:2px solid var(--ink, #1d2025);opacity:0;animation:edp-tap-ripple 1.8s ease-out infinite}@keyframes edp-tap-hand{0%,to{transform:translateY(12px)}30%{transform:translateY(0) scale(1)}38%{transform:translateY(1px) scale(.88)}48%{transform:translateY(0) scale(1)}75%{transform:translateY(12px)}}@keyframes edp-tap-ripple{0%,34%{opacity:0;transform:scale(.4)}40%{opacity:.45;transform:scale(.6)}70%{opacity:0;transform:scale(1.5)}to{opacity:0}}.player-tap-hint--still .player-tap-hint__hand,.player-tap-hint--still .player-tap-hint__ripple{animation:none}@media(prefers-reduced-motion:reduce){.player-tap-hint__hand,.player-tap-hint__ripple{animation:none}}.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)}.edp-audio{--edp-a: var(--edp-scale, 1);display:flex;flex-direction:column;gap:calc(.25rem * var(--edp-a));width:100%;max-width:100%;margin:calc(.5rem * var(--edp-a)) 0;font-size:calc(.875rem * var(--edp-a));line-height:1.4;vertical-align:middle}.edp-audio-bar{display:flex;align-items:center;gap:calc(.75rem * var(--edp-a));min-width:0;padding:calc(.375rem * var(--edp-a));padding-inline-end:calc(.75rem * var(--edp-a));background:#fff;border:1px solid var(--line, #e7e5e0);border-radius:999px}.edp-audio-play{flex:none;display:inline-flex;align-items:center;justify-content:center;width:calc(2.75rem * var(--edp-a));height:calc(2.75rem * var(--edp-a));border:0;border-radius:999px;background:var(--ink, #1d2025);color:#fff;cursor:pointer;transition:transform 90ms ease-out,background-color .18s ease-out}.edp-audio-play:hover:not(:disabled){background:#33373e}.edp-audio-play:active:not(:disabled){transform:scale(.94)}.edp-audio-play:focus-visible,.edp-audio-speed:focus-visible,.edp-audio-track:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-audio-play:disabled{background:var(--line-strong, #d6d3cc);cursor:not-allowed}.edp-audio-play svg{width:calc(1.125rem * var(--edp-a));height:calc(1.125rem * var(--edp-a))}.edp-audio-track{position:relative;flex:1 1 auto;min-width:calc(3rem * var(--edp-a));height:calc(2rem * var(--edp-a));display:flex;align-items:center;touch-action:none;border-radius:4px}.edp-audio-track--seek{cursor:pointer}.edp-audio-rail{position:relative;display:block;width:100%;height:4px;border-radius:999px;background:var(--line, #e7e5e0);overflow:hidden}.edp-audio-fill{position:absolute;inset-block:0;inset-inline-start:0;background:var(--ink, #1d2025);border-radius:999px}.edp-audio-thumb{position:absolute;top:50%;width:12px;height:12px;margin-inline-start:-6px;margin-top:-6px;border-radius:999px;background:var(--ink, #1d2025);box-shadow:0 0 0 3px #fff;transition:transform .15s ease-out;pointer-events:none}.edp-audio-track--seek:hover .edp-audio-thumb,.edp-audio-track--seek:focus-visible .edp-audio-thumb{transform:scale(1.25)}.edp-audio-time{flex:none;min-width:2.6em;text-align:end;font-variant-numeric:tabular-nums;color:var(--ink-soft, #565b66);unicode-bidi:isolate}.edp-audio-speed{flex:none;min-width:3.1em;height:calc(1.75rem * var(--edp-a));padding:0 .5em;border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);font:inherit;font-size:.85em;font-weight:600;font-variant-numeric:tabular-nums;cursor:pointer;transition:border-color .18s ease-out}.edp-audio-speed:hover:not(:disabled){border-color:var(--ink-faint, #8d93a0)}.edp-audio-speed:active:not(:disabled){transform:scale(.97)}.edp-audio-note{display:block;margin:0;padding-inline-start:calc(.75rem * var(--edp-a));font-size:.9em;color:var(--ink-soft, #565b66)}.edp-audio--off .edp-audio-bar{background:var(--ui-muted, #f5f4f1)}.edp-audio--off .edp-audio-fill{background:var(--ink-faint, #8d93a0)}@media(max-width:380px){.edp-audio-bar{gap:calc(.5rem * var(--edp-a))}}@media(pointer:coarse){.edp-audio-speed{height:calc(2.5rem * var(--edp-a));min-width:3.6em}}.edp-rec{--edp-a: var(--edp-scale, 1);display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-a));padding:calc(1rem * var(--edp-a));border:1px solid var(--line, #e7e5e0);border-radius:14px;background:#fff;font-size:calc(.9375rem * var(--edp-a));line-height:1.4}.edp-rec .edp-audio{margin:0}.edp-rec-idle{display:flex;flex-direction:column;align-items:center;gap:calc(.5rem * var(--edp-a));padding:calc(.5rem * var(--edp-a)) 0}.edp-rec-record{display:inline-flex;align-items:center;justify-content:center;width:calc(4rem * var(--edp-a));height:calc(4rem * var(--edp-a));border:0;border-radius:999px;background:var(--pen, #d23b2b);color:#fff;cursor:pointer;box-shadow:0 0 0 5px var(--pen-soft, #fdeeec);transition:transform 90ms ease-out,box-shadow .18s ease-out}.edp-rec-record:hover:not(:disabled){box-shadow:0 0 0 7px var(--pen-soft, #fdeeec)}.edp-rec-record:active:not(:disabled){transform:scale(.95)}.edp-rec-record:disabled{background:var(--line-strong, #d6d3cc);box-shadow:none;cursor:not-allowed}.edp-rec-record svg{width:calc(1.6rem * var(--edp-a));height:calc(1.6rem * var(--edp-a))}.edp-rec-record:focus-visible,.edp-rec-stop:focus-visible,.edp-rec-link:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:3px}.edp-rec-label{font-weight:600;color:var(--ink, #1d2025)}.edp-rec-limit{font-size:.9em;color:var(--ink-soft, #565b66);font-variant-numeric:tabular-nums}.edp-rec-live{display:flex;align-items:center;gap:calc(.75rem * var(--edp-a))}.edp-rec-level{flex:1 1 auto;min-width:0;width:100%;height:calc(2.5rem * var(--edp-a));display:block}.edp-rec-clock{flex:none;display:inline-flex;align-items:center;gap:.4em;font-variant-numeric:tabular-nums;color:var(--ink, #1d2025);unicode-bidi:isolate}.edp-rec-clock small{color:var(--ink-faint, #8d93a0);font-size:.9em}.edp-rec-dot{width:.6em;height:.6em;border-radius:999px;background:var(--pen, #d23b2b);animation:edp-rec-dot 1.2s ease-in-out infinite}@keyframes edp-rec-dot{50%{opacity:.35}}.edp-rec-stop{flex:none;display:inline-flex;align-items:center;gap:.45em;height:calc(2.5rem * var(--edp-a));padding:0 1em;border:1px solid var(--ink, #1d2025);border-radius:999px;background:var(--ink, #1d2025);color:#fff;font:inherit;font-weight:600;cursor:pointer}.edp-rec-stop{transition:background-color .18s ease-out,transform 90ms ease-out}.edp-rec-stop:hover{background:#33373e}.edp-rec-stop:active{transform:scale(.97)}.edp-rec-stop i{display:inline-block;width:.7em;height:.7em;border-radius:2px;background:currentColor}.edp-rec-foot{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:calc(.5rem * var(--edp-a)) calc(1rem * var(--edp-a));min-height:1.75em}.edp-rec-status{display:inline-flex;align-items:center;gap:.4em;color:var(--ink-soft, #565b66)}.edp-rec-status--ok{color:var(--ok, #1f8a4c);font-weight:600}.edp-rec-status--error{color:var(--ink, #1d2025)}.edp-rec-status--error svg{color:var(--ink, #1d2025);flex:none}.edp-rec-progress{flex:1 1 8rem;height:4px;border-radius:999px;background:var(--line, #e7e5e0);overflow:hidden}.edp-rec-progress>span{display:block;height:100%;background:var(--ink, #1d2025);transition:width .15s ease-out}.edp-rec-link{font:inherit;font-weight:600;color:var(--ink, #1d2025);background:none;border:0;padding:.25em 0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.edp-rec-link:hover{text-decoration-thickness:2px}@media(pointer:coarse){.edp-rec-link{min-height:2.5rem;padding:0 .25em}}.edp-rec-level:dir(rtl){transform:scaleX(-1)}.edp-rec-message{margin:0;color:var(--ink-soft, #565b66);text-align:center}.edp-rec video{width:100%;max-height:16rem;border-radius:10px;background:#000}@media(prefers-reduced-motion:reduce){.edp-rec-dot{animation:none}.edp-audio-play,.edp-audio-thumb,.edp-rec-record,.edp-rec-stop,.edp-rec-progress>span{transition:none}}
48
- `);import"katex/dist/katex.min.css";_r(`/*! 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-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-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 .top-\\[calc\\(var\\(--edp-bar\\)\\+1rem\\)\\]{top:calc(var(--edp-bar) + 1rem)}.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-0\\.5{margin-inline-start:calc(var(--spacing) * .5)}.edpire-scope .ms-1{margin-inline-start:calc(var(--spacing) * 1)}.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-4{margin-top:calc(var(--spacing) * 4)}.edpire-scope .mt-6{margin-top:calc(var(--spacing) * 6)}.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-auto{margin-left:auto}.edpire-scope .line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.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\\(100dvh-8rem\\)\\]{max-height:calc(100dvh - 8rem)}.edpire-scope .max-h-\\[calc\\(100dvh-var\\(--edp-bar\\)-2rem\\)\\]{max-height:calc(100dvh - var(--edp-bar) - 2rem)}.edpire-scope .max-h-\\[calc\\(100svh-6rem\\)\\]{max-height:calc(100svh - 6rem)}.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 .min-h-dvh{min-height:100dvh}.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-\\[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-auto{overflow:auto}.edpire-scope .overflow-hidden{overflow:hidden}.edpire-scope .overflow-visible{overflow:visible}.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\\/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-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 .py-16{padding-block:calc(var(--spacing) * 16)}.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-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-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 .\\[overflow-wrap\\:anywhere\\]{overflow-wrap:anywhere}.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-\\[\\#8a8f99\\]{color:#8a8f99}.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 .\\[--edp-bar\\:0px\\]{--edp-bar:0px}.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)}.edpire-scope :is(.edpire-scope .\\[\\&_\\[data-exercise-id\\]\\]\\:scroll-mt-\\[calc\\(var\\(--edp-bar\\)\\+0\\.75rem\\)\\]) [data-exercise-id],.edpire-scope :is(.edpire-scope .\\[\\&_\\[data-question-id\\]\\]\\:scroll-mt-\\[calc\\(var\\(--edp-bar\\)\\+0\\.75rem\\)\\]) [data-question-id]{scroll-margin-top:calc(var(--edp-bar) + .75rem)}@layer base{.edpire-scope *,.edpire-scope :after,.edpire-scope :before,.edpire-scope ::backdrop{border-color:var(--color-gray-200,currentColor)}.edpire-scope ::file-selector-button{border-color:var(--color-gray-200,currentColor)}}@supports not (height:100dvh){.edpire-scope .h-dvh{height:100vh}}.edpire-scope :where(span:has(>textarea.player-typed-blank)){line-height:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
49
- `);import{jsx as Vn}from"react/jsx-runtime";var Ba=Hl.memo(function({content:r,onAnswersChange:t,feedback:n,initialAnswers:o,readOnly:a,className:s,dir:i}){let c=Vl(()=>{if(n)return new Map(Object.entries(n))},[n]),l=Vn(Dr,{content:r,onAnswersChange:t,initialAnswers:o,validationFeedback:c,readOnly:a,className:s});return Vn("div",{className:"edpire-scope",style:{display:"contents"},children:i?Vn("div",{dir:i,children:l}):l})});import{useEffect as $d,useRef as uo}from"react";import xs from"react";import{createRoot as vs}from"react-dom/client";import{useCallback as hs,useMemo as Ed,useState as Pd}from"react";import{cloneElement as as,isValidElement as ss,useCallback as Ue,useEffect as Xt,useMemo as Ee,useRef as ur,useState as Be}from"react";import{Send as is,Loader2 as no,BarChart2 as oo,CheckCircle2 as cs,XCircle as xd,RotateCcw as vd,X as ao,Clock as Br,AlertTriangle as wd,AlertCircle as kd,Check as Rd,CloudOff as Sd}from"lucide-react";import{clsx as Ql}from"clsx";import{twMerge as Gl}from"tailwind-merge";function ge(...e){return Gl(Ql(e))}function Nr(e,r,t){return r?.trim()||e("exercise",{index:t+1})}import{Fragment as Zl,jsx as _e,jsxs as Qn}from"react/jsx-runtime";function Yl({accent:e}){return _e("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function Kl({accent:e}){return _e("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(r=>_e("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${r*.2}s infinite`}},r))})}function Xl({accent:e}){return Qn("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(r=>_e("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${r*.8}s infinite`}},r)),_e("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function Jl({accent:e}){return _e("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(r=>_e("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${r*.15}s infinite`}},r))})}function qa({visible:e,bgColor:r="rgba(0,0,0,0.55)",accentColor:t="#6366f1",text:n="Evaluating your answers\u2026",aiText:o="Some answers are being reviewed by AI, this may take a few seconds.",spinnerTheme:a="default",animationUrl:s,hasAiNodes:i=!1,contained:c=!1}){return e?Qn(Zl,{children:[_e("style",{children:`
51
+ `),p.runPython(e);let f=p.runPython("_stdout_capture.getvalue()");p.runPython("sys.stdout = sys.__stdout__");let m=f.trim()===(i||"").trim();return{testId:n,passed:m,actualStdout:f,durationMs:Date.now()-l}}else{p.runPython(e);let f=(o||[]).map(d=>JSON.stringify(d)).join(", "),m=p.runPython(`${r}(${f})`),h=_n(m,a);return{testId:n,passed:h,actual:m,durationMs:Date.now()-l}}}catch(p){return{testId:n,passed:!1,stderr:String(p),errored:!0,durationMs:Date.now()-l}}}var Nn=null;async function jp(){if(Nn)return Nn;let e=await import("./sql-wasm-browser-NICPVFVD.mjs");return Nn=await(e.default??e)(),Nn}async function Bp(e,t,r,n){let o=Date.now();try{let a=await jp(),s=new a.Database;r&&s.run(r);let c=s.exec(e).flatMap(p=>p.values.map(f=>f.map(String).join("|"))).join(`
52
+ `),l=c.trim()===(n||"").trim();return s.close(),{testId:t,passed:l,actualStdout:c,durationMs:Date.now()-o}}catch(a){return{testId:t,passed:!1,stderr:String(a),errored:!0,durationMs:Date.now()-o}}}async function qp(e){let{transform:t}=await import("./esm-RQP7AIMT.mjs");return t(e,{transforms:["typescript"]}).code}var Jt=class{supports(t){return["javascript","typescript","python","sql"].includes(t)}async run(t){let{language:r,source:n,mode:o,entryFunction:a,tests:s,timeoutMs:i=5e3}=t;if(!this.supports(r))return s.map(p=>({testId:p.id,passed:!1,stderr:`Language "${r}" cannot run in-browser. Configure a RemoteExecutor for compiled languages.`,errored:!0}));let c=n;if(r==="typescript")try{c=await qp(n)}catch(p){return s.map(f=>({testId:f.id,passed:!1,stderr:`TypeScript compile error: ${p.message}`,errored:!0}))}let l=[];for(let p of s){let f;r==="python"?f=await Op(c,o,a,p.id,p.args,p.expectedReturn,p.stdin,p.expectedStdout,i):r==="sql"?f=await Bp(c,p.id,p.stdin,p.expectedStdout):f=await Ip(c,o,a,p.id,p.args,p.expectedReturn,p.stdin,p.expectedStdout,i),l.push(f)}return l}};import{jsx as Si}from"react/jsx-runtime";import{forwardRef as Hp,useEffect as Wp,useImperativeHandle as Up,useRef as Kp,useState as Vp}from"react";function Gp(e){return{javascript:"javascript",typescript:"typescript",python:"python",sql:"sql",java:"java",cpp:"cpp",go:"go"}[e]??"plaintext"}var Zo=Hp(function({value:t,onChange:r,language:n="javascript",readOnly:o=!1,readOnlyRanges:a,placeholder:s,height:i=300,className:c,autoFocus:l},p){let[f,m]=Vp(null),{scale:h}=ze(),d=Kp(null);Wp(()=>{import("./dist-RXTJ74FF.mjs").then(S=>{m(()=>S.default)}).catch(()=>{})},[]),Up(p,()=>({getValue(){return d.current?.getValue?.()??t},focus(){d.current?.focus?.()},insert(S){let C=d.current;if(!C)return;let w=C.getSelection();C.executeEdits("insert",[{range:w,text:S,forceMoveMarkers:!0}])}}));function u(S){d.current=S,l&&S.focus(),a?.length&&S.onDidAttemptReadOnlyEdit(()=>{})}function v(S){r(S??"")}let R=typeof i=="number"?i*h:i;return f?Si(f,{className:c,height:R,language:Gp(n),value:t,onChange:v,onMount:u,options:{readOnly:o,minimap:{enabled:!1},fontSize:14*h,lineNumbers:"on",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"on"}}):Si("textarea",{className:c,value:t,onChange:S=>r(S.target.value),readOnly:o,placeholder:s,style:{width:"100%",height:typeof i=="number"?F(i):i,fontFamily:"monospace",fontSize:F(14),padding:F("0.5rem"),border:"1px solid #e2e8f0",borderRadius:F("0.375rem"),resize:"vertical",background:o?"#f8fafc":"white",boxSizing:"border-box"},autoFocus:l})});var eu=new Jt;function tu(e){return e?.showFeedback?e.state??"idle":"idle"}function Ri(e){let t={};for(let r of e.attrs.starters??[])t[r.language]=r.code;return t}function ru({sample:e,result:t,mode:r}){let n=t?.passed,o=t?.errored,a=t!==void 0,s=a?o?"var(--almost, #c8810e)":n?"var(--ok, #1f8a4c)":"var(--pen, #d23b2b)":"var(--ink-faint, #8d93a0)",i=a?o?"\u26A0":null:"\u25CB";return ke("div",{style:{padding:`${F("0.5rem")} ${F("0.75rem")}`,borderBottom:"1px solid var(--line, #e7e5e0)",fontSize:F("0.8125rem"),fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:[ke("div",{style:{display:"flex",alignItems:"center",gap:F("0.5rem")},children:[ie("span",{style:{color:s,fontWeight:700,fontSize:F("0.875rem"),display:"inline-flex"},children:i??(n?ie(ea,{size:15,style:be(15)}):ie(Ci,{size:15}))}),ie("span",{style:{fontWeight:600,color:"var(--ink, #1d2025)"},children:e.name??`Test ${e.id}`})]}),a&&!n&&ke("div",{style:{marginTop:F("0.25rem"),paddingLeft:F("1.5rem")},children:[r==="function"?ie(Ir,{children:t?.actual!==void 0&&ke("div",{style:{color:"var(--ink-soft, #565b66)"},children:[ie("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),ie("span",{style:{color:"var(--pen, #d23b2b)"},children:JSON.stringify(t.actual)}),ie("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:" expected: "}),ie("span",{style:{color:"var(--ok, #1f8a4c)"},children:JSON.stringify(e.expectedReturn)})]})}):ie(Ir,{children:t?.actualStdout!==void 0&&ke("div",{style:{color:"var(--ink-soft, #565b66)"},children:[ke("div",{children:[ie("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"got: "}),ie("span",{style:{color:"var(--pen, #d23b2b)",whiteSpace:"pre-wrap"},children:t.actualStdout||"(empty)"})]}),ke("div",{children:[ie("span",{style:{color:"var(--ink-faint, #8d93a0)"},children:"expected: "}),ie("span",{style:{color:"var(--ok, #1f8a4c)",whiteSpace:"pre-wrap"},children:e.expectedStdout||"(empty)"})]})]})}),t?.stderr&&ie("div",{style:{color:"var(--almost-ink, #8a5a08)",marginTop:F("0.125rem"),whiteSpace:"pre-wrap"},children:t.stderr})]})]})}function cn({node:e,validationFeedback:t,readOnly:r=!1,executor:n=eu,gradingTests:o}){let a=ge(),s=Xp(null),{attrs:i}=e,c=e.id,[l,p]=Lr(i.defaultLanguage),[f,m]=Lr(()=>Ri(e)),[h,d]=Lr([]),[u,v]=Lr(!1),[R,S]=Lr(!1),C=f[l]??"",w=tu(t);Yp(()=>{let b=$=>{let B=$.answers?.find(J=>J.nodeId===c&&J.type==="codingResponse");B?.answer&&(B.answer.language&&p(B.answer.language),B.answer.sourceByLanguage&&m(B.answer.sourceByLanguage),B.answer.testResults&&d(B.answer.testResults))},M=()=>{m(Ri(e)),d([]),S(!1)};return a.on("answers:prefill",b),a.on("answers:reset",M),()=>{a.off("answers:prefill",b),a.off("answers:reset",M)}},[a,c,e]);let N=Qp((b,M,$)=>{a.emit({type:"answer:changed",answer:{nodeId:c,type:"codingResponse",timestamp:Date.now(),answer:{language:b,sourceByLanguage:M,source:M[b]??"",testResults:$}}})},[a,c]),k=b=>{let M={...f,[l]:b};m(M),N(l,M,h)},x=b=>{p(b),d([]),N(b,f,[])},y=async()=>{if(u)return;v(!0),d([]);let b=o??i.visibleSamples??[];if(b.length===0){v(!1);return}try{let M=await n.run({language:l,source:C,mode:i.testMode,entryFunction:i.entryFunction,tests:b,timeoutMs:5e3});d(M),N(l,f,M)}catch(M){let $=b.map(B=>({testId:B.id,passed:!1,stderr:String(M),errored:!0}));d($),N(l,f,$)}finally{v(!1)}},T=()=>{R||(S(!0),N(l,f,h))},g=(o??[]).filter(b=>b.hidden).length,P=g>0?h.filter(b=>(o??[]).find($=>$.id===b.testId)?.hidden&&b.passed).length:0,A=o?o.filter(b=>!b.hidden):i.visibleSamples??[],W=w==="correct"?"var(--ok, #1f8a4c)":w==="partial"?"var(--almost, #c8810e)":w==="incorrect"?"var(--pen, #d23b2b)":"var(--line-strong, #d6d3cc)";return ke("div",{style:{margin:`${F("0.75rem")} 0`,border:`1px solid ${W}`,borderRadius:F("0.875rem"),overflow:"hidden",transition:"border-color 0.2s"},children:[ke("div",{style:{background:"var(--ui-muted, #f5f4f1)",borderBottom:"1px solid var(--line, #e7e5e0)",padding:`${F("0.5rem")} ${F("0.75rem")}`,display:"flex",alignItems:"center",gap:F("0.5rem"),flexWrap:"wrap"},children:[ie("div",{style:{display:"flex",gap:F("0.25rem")},children:i.languages.map(b=>ie("button",{onClick:()=>!r&&x(b),disabled:r,style:{padding:`${F("0.2rem")} ${F("0.6rem")}`,borderRadius:F("0.375rem"),border:"1px solid",borderColor:l===b?"var(--ink, #1d2025)":"var(--line, #e7e5e0)",background:l===b?"var(--ink, #1d2025)":"var(--card, #fff)",color:l===b?"#fff":"var(--ink-soft, #565b66)",fontSize:F("0.75rem"),fontWeight:600,cursor:r?"default":"pointer",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:b},b))}),ie("div",{style:{flex:1}}),ie(ot,{hint:i.hint}),!r&&ke(Ir,{children:[ke("button",{onClick:y,disabled:u,style:{padding:`${F("0.25rem")} ${F("0.75rem")}`,borderRadius:F("0.5rem"),border:"1px solid var(--line-strong, #d6d3cc)",background:u?"var(--ui-muted, #f5f4f1)":"var(--card, #fff)",color:"var(--ink, #1d2025)",fontSize:F("0.8125rem"),fontWeight:600,cursor:u?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",gap:F("0.35rem")},children:[ie(Jp,{size:13,style:be(13)})," ",u?"Running\u2026":"Run"]}),ke("button",{onClick:T,disabled:R,style:{padding:`${F("0.3rem")} ${F("0.85rem")}`,borderRadius:F("0.5rem"),border:"none",background:R?"var(--ok-soft, #ecf8f0)":"var(--ink, #1d2025)",color:R?"var(--ok, #1f8a4c)":"#fff",fontSize:F("0.8125rem"),fontWeight:600,cursor:R?"default":"pointer",display:"inline-flex",alignItems:"center",gap:F("0.35rem")},children:[R&&ie(ea,{size:13,style:be(13)})," ",R?"Submitted":"Submit"]})]})]}),ie(Zo,{ref:s,value:C,onChange:k,language:l,readOnly:r,readOnlyRanges:i.starters.find(b=>b.language===l)?.readOnlyRanges,height:320}),(h.length>0||A.length>0)&&ke("div",{style:{borderTop:"1px solid var(--line, #e7e5e0)",background:"var(--paper, #fbfaf7)"},children:[ie("div",{style:{padding:`${F("0.5rem")} ${F("0.75rem")}`,fontSize:F("0.7rem"),fontWeight:700,color:"var(--ink-faint, #8d93a0)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Test Results"}),A.map(b=>ie(ru,{sample:b,result:h.find(M=>M.testId===b.id),mode:i.testMode},b.id)),g>0&&ke("div",{style:{padding:`${F("0.5rem")} ${F("0.75rem")}`,fontSize:F("0.8125rem"),color:"var(--ink-soft, #565b66)",borderTop:"1px solid var(--line, #e7e5e0)",fontStyle:"italic",display:"flex",alignItems:"center",gap:F("0.4rem")},children:[ie(Zp,{size:13,style:be(13)})," Hidden tests: ",P,"/",g," passed"]})]}),t?.showFeedback&&ke("div",{style:{padding:`${F("0.55rem")} ${F("0.75rem")}`,fontSize:F("0.85rem"),fontWeight:600,borderTop:"1px solid var(--line, #e7e5e0)",display:"flex",alignItems:"center",gap:F("0.45rem"),background:w==="correct"?"var(--ok-soft, #ecf8f0)":w==="partial"?"var(--almost-soft, #fbf1dc)":w==="incorrect"?"var(--pen-soft, #fdeeec)":"transparent",color:w==="correct"?"var(--ok, #1f8a4c)":w==="partial"?"var(--almost-ink, #8a5a08)":w==="incorrect"?"var(--pen, #d23b2b)":"var(--ink-soft, #565b66)"},children:[w==="correct"&&ke(Ir,{children:[ie(ea,{size:15,style:be(15)})," All tests passed"]}),w==="partial"&&"Partial credit",w==="incorrect"&&ke(Ir,{children:[ie(Ci,{size:15,style:be(15)})," Tests failed"]}),w==="validating"&&"Evaluating\u2026",w==="awaiting_review"&&"Awaiting teacher review",t.score!==void 0&&ke("span",{style:{marginLeft:"auto",fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:F("1.5rem"),lineHeight:1},children:[t.score," / ",t.maxScore??i.maxScore]})]})]})}import{Fragment as au,jsx as Pn,jsxs as su}from"react/jsx-runtime";import{createContext as iu,useContext as cu,useEffect as lu}from"react";import{DndContext as du,MouseSensor as pu,TouchSensor as uu,KeyboardSensor as mu,useDndContext as fu,useSensor as na,useSensors as hu}from"@dnd-kit/core";import{jsx as ta}from"react/jsx-runtime";import{DragOverlay as nu,useDndContext as ou}from"@dnd-kit/core";function ra(){let{active:e}=ou();if(!e)return null;let t=e.data.current?.html??"";return ta(nu,{dropAnimation:null,children:ta("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:ta("span",{dangerouslySetInnerHTML:{__html:t},style:{pointerEvents:"none",whiteSpace:"nowrap",lineHeight:"1.25"}})})})}function gu(e,t,r){let n=[],o=new Set,a=s=>{o.has(s)||(o.add(s),r(s)==="smooth"&&(n.push([s,s.style.scrollBehavior]),s.style.scrollBehavior="auto"))};for(let s=e;s;s=s.parentElement)a(s);return t&&a(t),()=>{for(let[s,i]of n)s.style.scrollBehavior=i}}function bu(){let{activeNode:e}=fu();return lu(()=>{if(!(!e||typeof document>"u"))return gu(e,document.scrollingElement,t=>getComputedStyle(t).scrollBehavior)},[e]),null}var Ai=iu(!1),yu={acceleration:3,threshold:{x:0,y:.25}};function Tn({children:e}){let t=cu(Ai),r=na(pu,{activationConstraint:{distance:8}}),n=na(uu,{activationConstraint:{delay:250,tolerance:5}}),o=na(mu),a=hu(r,n,o);return t?Pn(au,{children:e}):Pn(Ai.Provider,{value:!0,children:su(du,{sensors:a,autoScroll:yu,children:[e,Pn(ra,{}),Pn(bu,{})]})})}function er({content:e,onAnswersChange:t,onSubmit:r,answerBus:n,namespace:o,initialAnswers:a,validationFeedback:s,className:i="",locale:c,readOnly:l=!1,mediaHandler:p,answerSheetHandler:f,codeExecutor:m,display:h}){let d=Fe(h),u=xu(()=>He(d),[d]),v=vu(null);v.current||(v.current=new lt);let R=n??v.current;oa(()=>{a&&a.length>0&&R.prefillAnswers(a)},[a,R]),oa(()=>{if(!t)return;let C=()=>{let w=R.getAllAnswers();t(w)};return R.on("answer:changed",C),()=>R.off("answer:changed",C)},[R,t]),oa(()=>{if(!r)return;let C=w=>{r(w.answers)};return R.on("answer:submitted",C),()=>R.off("answer:submitted",C)},[R,r]);let S=qe(e,s,{readOnly:l,mediaHandler:p,answerSheetHandler:f,codeExecutor:m});return Zt(ur,{locale:c,children:Zt(De,{display:d,children:Zt(Kr,{bus:R,children:Zt(Tn,{children:Zt(dn,{initialAnswers:a,children:Zt("div",{className:`question-runtime ${i}${u.sizeSet?" edp-scaled":""}`,"data-namespace":o,style:{fontSize:F("1.125rem"),lineHeight:"1.75",...We(u)},children:S})})})})})})}import{jsx as tr,jsxs as Ln}from"react/jsx-runtime";import{memo as Ru,useCallback as Mi,useMemo as Cu,useRef as Ti}from"react";var Ni={words:80,media:1,tableRows:6},wu=new Set(["resizableImage","resizableVideo","youtubeEmbed"]);function _i(e){let t={words:0,media:0,tableRows:0},r=n=>{if(typeof n.text=="string"&&(t.words+=n.text.split(/\s+/).filter(o=>/[\p{L}\p{N}]/u.test(o)).length),n.type&&wu.has(n.type)&&t.media++,n.type==="table"){let o=(n.content??[]).filter(a=>a.type==="tableRow").length;t.tableRows=Math.max(t.tableRows,o)}for(let o of n.content??[])r(o)};return e&&r(e),t}function $r(e,t=Ni){let r=_i(e);return r.words>t.words||r.media>t.media||r.tableRows>t.tableRows}import{createContext as ku,useContext as Su}from"react";var Pi=ku(null),Mn=Pi.Provider;function En(){return Su(Pi)}function In({exercise:e,onAnswersChange:t,validationFeedback:r,renderSharedContext:n,renderQuestion:o,renderSeparator:a,className:s="",locale:i,display:c}){let l=Fe(c),p=Cu(()=>He(l),[l]),f=Ti(new Map),m=Ti({exercise:e,onAnswersChange:t});m.current={exercise:e,onAnswersChange:t};let h=Mi((S,C)=>{f.current.set(S,C);let{exercise:w,onAnswersChange:N}=m.current;if(N){let k={exerciseId:w.id,questionAnswers:w.questions.map(x=>({questionId:x.id,answers:f.current.get(x.id)??[]}))};N(k)}},[]),d=En(),u=pr(i),v=!!(d&&e.sharedContext&&$r(e.sharedContext)),R=e.sharedContext?v?Ln("p",{className:"exercise-reference-cue",children:[tr("span",{children:u.referenceInPanel(d.label)})," ",Ln("button",{type:"button",className:"exercise-reference-cue__link",onClick:()=>d.showExerciseReference(e.id),children:[u.readReference,tr("span",{"aria-hidden":"true",className:"exercise-reference-cue__arrow",children:"\u203A"})]})]}):tr("div",{className:"exercise-shared-context",children:qe(e.sharedContext)}):null;return tr(De,{display:l,children:Ln("div",{className:`exercise-runtime ${s}`,style:We(p),children:[R&&(n?n(R):R),e.questions.map((S,C)=>{let w=r?.get(S.id),N=tr(Au,{questionId:S.id,content:S.content,onQuestionAnswers:h,validationFeedback:w,locale:i},S.id);return Ln("div",{children:[o?o(S,N,C):N,a&&C<e.questions.length-1?a(C):null]},S.id)})]})})}var Au=Ru(function({questionId:t,onQuestionAnswers:r,...n}){let o=Mi(a=>r(t,a),[r,t]);return tr(er,{...n,onAnswersChange:o})});import{jsx as aa,jsxs as Nu}from"react/jsx-runtime";import{useCallback as _u,useEffect as Pu,useMemo as Tu,useRef as Ei}from"react";function Nt({assessment:e,onAnswersChange:t,validationFeedback:r,renderExercise:n,renderSharedContext:o,renderSeparator:a,className:s="",brandingConfig:i,locale:c,display:l}){let p=Ei(new Map),f=Fe(l),m=Tu(()=>He(f),[f]);Pu(()=>{if(!i?.fontUrl)return;let v=`edpire-brand-font-${i.fontUrl.replace(/\W/g,"").slice(-24)}`;if(document.getElementById(v))return;let R=document.createElement("link");R.id=v,R.rel="stylesheet",R.href=i.fontUrl,document.head.appendChild(R)},[i?.fontUrl]);let h={...We(m)};i?.fontFamily&&(h["--brand-font"]=i.fontFamily);let d=Ei({assessment:e,onAnswersChange:t});d.current={assessment:e,onAnswersChange:t};let u=_u(v=>{p.current.set(v.exerciseId,v);let{assessment:R,onAnswersChange:S}=d.current;if(S){let C={exerciseAnswers:R.exercises.map(w=>p.current.get(w.id)??{exerciseId:w.id,questionAnswers:[]})};S(C)}},[]);return aa(De,{display:f,children:aa("div",{className:`assessment-runtime ${s}`,style:Object.keys(h).length?h:void 0,children:e.exercises.map((v,R)=>{let S=r?.get(v.id),C=aa(In,{exercise:v,onAnswersChange:u,validationFeedback:S,renderSharedContext:o?w=>o(w,v):void 0,locale:c},v.id);return Nu("div",{children:[n?n(v,C,R):C,a&&R<e.exercises.length-1?a(R):null]},v.id)})})})}import{jsx as Li}from"react/jsx-runtime";import{useMemo as Mu}from"react";function rr({content:e,className:t,display:r}){let n=Fe(r),o=Mu(()=>He(n),[n]);return Li(De,{display:n,children:Li("div",{className:`content-view ${t??""}`,style:We(o),children:qe(e)})})}import{jsx as Fr,Fragment as Ii,jsxs as $n}from"react/jsx-runtime";import{useMemo as Eu}from"react";function zr({item:e,className:t,renderFigureLabel:r,display:n}){let o=Fe(n),a=Eu(()=>He(o),[o]);return Fr(De,{display:o,children:$n("div",{className:`annex-item-view ${t??""}${a.sizeSet?" edp-scaled":""}`,style:We(a),children:[e.type==="text-document"&&$n(Ii,{children:[e.title&&Fr("h3",{className:"text-base font-semibold mb-2",children:e.title}),qe(e.content)]}),e.type==="figure"&&$n("figure",{children:[qe(e.content),Fr("figcaption",{children:r?r(e.label):Fr("span",{children:e.label})})]}),e.type==="rich-block"&&$n(Ii,{children:[e.title&&Fr("h3",{className:"text-base font-semibold mb-2",children:e.title}),qe(e.content)]})]})})}import{jsx as ux,jsxs as mx}from"react/jsx-runtime";import{useState as hx}from"react";import{jsx as wx,jsxs as kx}from"react/jsx-runtime";import{useState as Rx,useCallback as Cx,useMemo as Ax}from"react";import{useEditor as _x,EditorContent as Px}from"@tiptap/react";import Mx from"@tiptap/starter-kit";import{jsx as Fx,jsxs as zx,Fragment as Dx}from"react/jsx-runtime";import{useMemo as jx,useState as Bx}from"react";function Dt(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Dt(`:root{--ink: #1d2025;--ink-soft: #565b66;--ink-faint: #8d93a0;--ui-muted: #f5f4f1;--line: #e7e5e0;--line-strong: #d6d3cc;--ok: #1f8a4c;--ok-soft: #ecf8f0;--pen: #d23b2b;--pen-soft: #fdeeec;--almost: #c8810e;--almost-ink: #8a5a08;--almost-soft: #fbf1dc;--font-hand: "Caveat", cursive}@keyframes answer-shake{10%,90%{transform:translate(-2px)}20%,80%{transform:translate(4px)}30%,50%,70%{transform:translate(-6px)}40%,60%{transform:translate(6px)}}@keyframes hop{0%,to{transform:translateY(0) scale(1)}40%{transform:translateY(-6%) scale(1.05)}}@keyframes wobble{0%,to{transform:translate(0)}15%,85%{transform:translate(-4px)}30%,70%{transform:translate(4px)}45%,55%{transform:translate(-2px)}}.animate-shake{animation:answer-shake .4s both}.animate-hop{animation:hop .5s ease-out}.animate-wobble{animation:wobble .5s ease}.cs-player__grid{display:grid;gap:calc(.75rem * var(--edp-scale, 1));grid-template-columns:repeat(1,minmax(0,1fr))}@media(min-width:40rem){:where(.cs-player:not(.cs-player--box)) .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.cs-player--box{container-type:inline-size}@container (min-width: 35.5em){.cs-player--box .cs-player__grid--row{grid-template-columns:repeat(2,minmax(0,1fr))}}.player-choice{position:relative;display:inline-flex;align-items:center;gap:calc(.75rem * var(--edp-scale, 1));flex-wrap:wrap;width:100%;padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1));border:1.5px solid var(--line, #e7e5e0);border-radius:calc(.75rem * var(--edp-scale, 1));background-color:#fff;color:var(--ink, #1d2025);cursor:pointer;user-select:none;transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease;font-weight:500;text-align:start}.player-choice:hover:not(:disabled){background-color:var(--ui-muted, #f5f4f1);border-color:var(--line-strong, #d6d3cc)}.player-choice:disabled{cursor:default}.player-choice>img{flex-shrink:0}.player-choice__mark{flex:none;display:grid;place-items:center;width:calc(20px * var(--edp-scale, 1));height:calc(20px * var(--edp-scale, 1));border:1.5px solid var(--ink-faint, #8d93a0);background:#fff;color:#fff;transition:border-color .15s,background .15s}.player-choice__mark--radio{border-radius:999px}.player-choice__mark--box{border-radius:calc(6px * var(--edp-scale, 1))}.player-choice__mark>svg{width:calc(13px * var(--edp-scale, 1));height:calc(13px * var(--edp-scale, 1));opacity:0}.player-choice__text{flex:1;min-width:0}.player-choice{height:100%}.player-choice__text img,.player-choice__text video,.player-choice__text iframe{max-height:calc(120px * var(--edp-scale, 1));width:auto;max-width:100%}.player-choice--tile{flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(1rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__mark{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-start:calc(.5rem * var(--edp-scale, 1))}.player-choice--tile .player-choice__text{flex:0 1 auto;width:100%;text-align:center}.player-choice--tile .player-choice__text img,.player-choice--tile .player-choice__text video,.player-choice--tile .player-choice__text iframe{display:block!important;margin-inline:auto;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice--selected{background-color:var(--ui-muted, #f5f4f1);border-color:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark{border-color:var(--ink, #1d2025);background:var(--ink, #1d2025)}.player-choice--selected .player-choice__mark>svg{opacity:1}.player-choice--correct{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark{border-color:var(--ok, #1f8a4c);background:var(--ok, #1f8a4c)}.player-choice--correct .player-choice__mark>svg{opacity:1}.player-choice--correct-unchosen{background-color:#fff;border-color:var(--ok, #1f8a4c);border-style:dashed}.player-choice--correct-unchosen .player-choice__mark{border-color:var(--ok, #1f8a4c)}.player-choice--incorrect{background-color:var(--pen-soft, #fdeeec);border-color:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark{border-color:var(--pen, #d23b2b);background:var(--pen, #d23b2b)}.player-choice--incorrect .player-choice__mark>svg{opacity:1}.player-choice--muted{opacity:.55}.player-choice--partial{background-color:var(--ok-soft, #ecf8f0);border-color:var(--ok, #1f8a4c)}.player-choice--disabled{cursor:default}.player-choice__mark--letter{width:calc(1.625rem * var(--edp-scale, 1));height:calc(1.625rem * var(--edp-scale, 1));color:var(--ink, #1d2025);font-size:.8em;font-weight:700;line-height:1}.player-choice--selected .player-choice__mark--letter,.player-choice--correct .player-choice__mark--letter,.player-choice--incorrect .player-choice__mark--letter{color:#fff}.player-choice--correct-unchosen .player-choice__mark--letter{color:var(--ok, #1f8a4c)}.player-choice__verdict{flex:none;display:grid;place-items:center;margin-inline-start:auto}.player-choice__verdict>svg{width:calc(1.125rem * var(--edp-scale, 1));height:calc(1.125rem * var(--edp-scale, 1))}.player-choice__verdict--correct{color:var(--ok, #1f8a4c)}.player-choice__verdict--incorrect{color:var(--pen, #d23b2b)}.player-choice--tile .player-choice__verdict{position:absolute;top:calc(.5rem * var(--edp-scale, 1));inset-inline-end:calc(.5rem * var(--edp-scale, 1));margin:0}.player-inline-choice{display:inline-flex;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:.05em .55em;border:1.5px solid var(--line-strong, #d6d3cc);border-radius:999px;background:#fff;color:var(--ink, #1d2025);font-size:.9em;line-height:inherit;cursor:pointer;user-select:none;transition:border-color .15s,background .15s}.player-inline-choice:hover:not(:disabled){background:var(--ui-muted, #f5f4f1)}.player-inline-choice:disabled{cursor:default}.player-inline-choice--selected{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-inline-choice--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.player-inline-choice--correct-unchosen{border-color:var(--ok, #1f8a4c);border-style:dashed}.player-inline-choice--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.player-inline-choice--muted{opacity:.55}.player-inline-choice:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.player-blank-input{display:inline-block;min-width:3ch;padding:calc(.25rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:none;border-bottom:2px solid var(--line-strong, #d6d3cc);background-color:transparent;font-size:inherit;font-family:inherit;transition:all .2s ease;outline:none}.player-blank-input:focus{border-bottom-color:var(--ink, #1d2025);background-color:var(--ui-muted, #f5f4f1)}.player-blank-input--correct{border-bottom-color:var(--ok, #1f8a4c);background-color:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-input--incorrect{border-bottom-color:var(--pen, #d23b2b);background-color:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-input:disabled{opacity:.7;cursor:not-allowed}.player-typed-blank{display:inline-block;min-width:7ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);outline:none;resize:none;overflow:hidden;vertical-align:middle}.player-typed-blank::placeholder{color:var(--ink-faint, #8d93a0);font-weight:500}.player-typed-blank:focus{border-color:var(--ink, #1d2025)}.player-typed-blank--pending{border-color:var(--ink-faint, #8d93a0);background:var(--card, #ffffff)}.player-blank-cell{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.125rem * var(--edp-scale, 1)) calc(.25rem * var(--edp-scale, 1));width:100%}.player-blank-cell__box{position:relative;display:block;flex:1 1 100%;min-width:0}.player-typed-blank--cell{display:block;box-sizing:border-box;width:100%;min-width:6.5ch;padding:calc(1px * var(--edp-scale, 1)) calc(2px * var(--edp-scale, 1));font:inherit;font-weight:600;line-height:1.3;white-space:nowrap;overflow-x:hidden}.player-typed-blank-feedback--cell{display:block;box-sizing:border-box;width:max-content;min-width:100%;max-width:none;white-space:nowrap;overflow:visible}.player-blank-cell .player-blank-reveal{white-space:nowrap;font-size:.9em}.edp-table-arrows{display:flex;justify-content:flex-end}.edp-table-arrows--top{margin-bottom:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrows--bottom{margin-top:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrows__pair{display:inline-flex;gap:calc(.375rem * var(--edp-scale, 1))}.edp-table-arrow{display:inline-flex;align-items:center;justify-content:center;width:calc(1.875rem * var(--edp-scale, 1));height:calc(1.875rem * var(--edp-scale, 1));padding:0;border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;transition:border-color .15s,background .15s,opacity .15s;-webkit-tap-highlight-color:transparent}.edp-table-arrow:hover:not(:disabled){border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.edp-table-arrow:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-table-arrow:disabled{opacity:.35;cursor:default}.edp-table-shade{position:absolute;top:0;bottom:0;width:calc(1.5rem * var(--edp-scale, 1));pointer-events:none;z-index:2}.edp-table-shade--left{background:linear-gradient(to right,#1d202529,#1d202500)}.edp-table-shade--right{background:linear-gradient(to left,#1d202529,#1d202500)}@media(max-width:640px){.edp-table-first{max-width:38vw}}.player-typed-blank-feedback{display:inline-block;min-width:2ch;max-width:100%;padding:0 calc(.25rem * var(--edp-scale, 1));font-weight:600;text-align:center;line-height:1.25;border:1px solid var(--line-strong, #d6d3cc);border-bottom-width:2px;border-radius:calc(2px * var(--edp-scale, 1));overflow-x:auto;cursor:default;vertical-align:middle}.player-typed-blank-feedback--correct{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--partial{border-color:var(--ok, #1f8a4c);border-style:dashed;background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-typed-blank-feedback--incorrect{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b);text-decoration:line-through}.player-typed-blank-spinner{display:inline-block;width:calc(.75rem * var(--edp-scale, 1));height:calc(.75rem * var(--edp-scale, 1));border:2px solid var(--ink-faint, #8d93a0);border-top-color:transparent;border-radius:999px;animation:blank-spin .7s linear infinite}@keyframes blank-spin{to{transform:rotate(360deg)}}.player-blank-reveal{font-weight:700;color:var(--ok, #1f8a4c);font-size:.875em;word-break:break-word;min-width:0}.player-blank-feedback{display:inline-block;font-size:.8em;font-weight:500;line-height:1.3;padding:calc(2px * var(--edp-scale, 1)) calc(8px * var(--edp-scale, 1));border-radius:999px;word-break:break-word;min-width:0;background:var(--ui-muted, #f5f4f1);color:var(--ink-soft, #565b66)}.player-blank-feedback--correct{background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-blank-feedback--incorrect{background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-blank-hint-btn{width:calc(1rem * var(--edp-scale, 1));height:calc(1rem * var(--edp-scale, 1));border:0;border-radius:999px;background:#fbbf24;color:#fff;font-size:calc(10px * var(--edp-scale, 1));font-weight:700;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .12s}.player-blank-hint-btn:hover,.player-blank-hint-btn--pinned{background:#f59e0b}.player-blank-hint-pop{position:absolute;bottom:100%;left:50%;transform:translate(-50%);margin-bottom:calc(.5rem * var(--edp-scale, 1));z-index:9999;min-width:calc(180px * var(--edp-scale, 1));max-width:calc(300px * var(--edp-scale, 1));width:max-content;background:#fffbeb;border:1px solid #fde68a;border-radius:calc(14px * var(--edp-scale, 1));box-shadow:0 8px 24px #92400e2e;padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:#78350f}.matching-player-hintrow{display:flex;justify-content:flex-start;margin-bottom:calc(.4rem * var(--edp-scale, 1))}.player-choice-blank{display:inline-flex;align-items:center;justify-content:center;min-width:4ch;padding:calc(.1rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border:2px dashed var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));color:var(--ink-faint, #8d93a0);background:transparent;transition:border-color .15s,background .15s,transform .15s,color .15s;vertical-align:middle}.player-choice-blank--target{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-choice-blank--over{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);transform:scale(1.05)}.player-choice-blank--filled{border-style:solid;border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);cursor:pointer}.player-choice-blank--correct,.player-choice-blank--partial{border-style:solid;border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0);color:var(--ok, #1f8a4c)}.player-choice-blank--incorrect{border-style:solid;border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec);color:var(--pen, #d23b2b)}.player-choice-blank__clear{margin-inline-start:calc(.25rem * var(--edp-scale, 1));opacity:0;font-size:calc(.75rem * var(--edp-scale, 1));line-height:1;transition:opacity .12s}.player-choice-blank--filled:hover .player-choice-blank__clear{opacity:.6}.player-word-bank{margin:calc(1rem * var(--edp-scale, 1)) 0;position:relative;border:1px solid var(--line, #e7e5e0);border-radius:calc(14px * var(--edp-scale, 1));background:var(--ui-muted, #f5f4f1);padding:calc(.75rem * var(--edp-scale, 1)) calc(1rem * var(--edp-scale, 1))}.player-word-bank__label{margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:.7em;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft, #565b66);user-select:none}.player-word-bank__items{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.player-word-bank__items--grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(calc(10rem * var(--edp-scale, 1)),1fr));gap:calc(.5rem * var(--edp-scale, 1))}.player-bank-pill{display:inline-block;padding:calc(.35rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--card, #ffffff);color:var(--ink, #1d2025);user-select:none;-webkit-touch-callout:none;touch-action:manipulation;cursor:grab;transition:border-color .15s,background .15s,box-shadow .15s}.player-bank-pill:hover{border-color:var(--ink, #1d2025);background:var(--ui-muted, #f5f4f1)}.player-bank-pill--dragging{opacity:.5;cursor:grabbing;box-shadow:0 8px 24px #1d20252e}.player-bank-pill--hinted{position:relative}.player-tap-hint{position:absolute;left:calc(50% - 10px * var(--edp-scale, 1));top:50%;width:calc(30px * var(--edp-scale, 1));height:calc(30px * var(--edp-scale, 1));z-index:2;pointer-events:none;color:var(--ink, #1d2025)}.player-tap-hint__hand{display:block;width:100%;height:100%;opacity:.92;filter:drop-shadow(0 2px 3px rgba(29,32,37,.25));transform-origin:33% 8%;animation:edp-tap-hand 1.8s ease-in-out infinite}.player-tap-hint__ripple{position:absolute;left:calc(10px * var(--edp-scale, 1) - 11px);top:-11px;width:22px;height:22px;border-radius:999px;border:2px solid var(--ink, #1d2025);opacity:0;animation:edp-tap-ripple 1.8s ease-out infinite}@keyframes edp-tap-hand{0%,to{transform:translateY(12px)}30%{transform:translateY(0) scale(1)}38%{transform:translateY(1px) scale(.88)}48%{transform:translateY(0) scale(1)}75%{transform:translateY(12px)}}@keyframes edp-tap-ripple{0%,34%{opacity:0;transform:scale(.4)}40%{opacity:.45;transform:scale(.6)}70%{opacity:0;transform:scale(1.5)}to{opacity:0}}.player-tap-hint--still .player-tap-hint__hand,.player-tap-hint--still .player-tap-hint__ripple{animation:none}@media(prefers-reduced-motion:reduce){.player-tap-hint__hand,.player-tap-hint__ripple{animation:none}}.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)}.edp-audio{--edp-a: var(--edp-scale, 1);display:flex;flex-direction:column;gap:calc(.25rem * var(--edp-a));width:100%;max-width:100%;margin:calc(.5rem * var(--edp-a)) 0;font-size:calc(.875rem * var(--edp-a));line-height:1.4;vertical-align:middle}.edp-audio-bar{display:flex;align-items:center;gap:calc(.75rem * var(--edp-a));min-width:0;padding:calc(.375rem * var(--edp-a));padding-inline-end:calc(.75rem * var(--edp-a));background:#fff;border:1px solid var(--line, #e7e5e0);border-radius:999px}.edp-audio-play{flex:none;display:inline-flex;align-items:center;justify-content:center;width:calc(2.75rem * var(--edp-a));height:calc(2.75rem * var(--edp-a));border:0;border-radius:999px;background:var(--ink, #1d2025);color:#fff;cursor:pointer;transition:transform 90ms ease-out,background-color .18s ease-out}.edp-audio-play:hover:not(:disabled){background:#33373e}.edp-audio-play:active:not(:disabled){transform:scale(.94)}.edp-audio-play:focus-visible,.edp-audio-speed:focus-visible,.edp-audio-track:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-audio-play:disabled{background:var(--line-strong, #d6d3cc);cursor:not-allowed}.edp-audio-play svg{width:calc(1.125rem * var(--edp-a));height:calc(1.125rem * var(--edp-a))}.edp-audio-track{position:relative;flex:1 1 auto;min-width:calc(3rem * var(--edp-a));height:calc(2rem * var(--edp-a));display:flex;align-items:center;touch-action:none;border-radius:4px}.edp-audio-track--seek{cursor:pointer}.edp-audio-rail{position:relative;display:block;width:100%;height:4px;border-radius:999px;background:var(--line, #e7e5e0);overflow:hidden}.edp-audio-fill{position:absolute;inset-block:0;inset-inline-start:0;background:var(--ink, #1d2025);border-radius:999px}.edp-audio-thumb{position:absolute;top:50%;width:12px;height:12px;margin-inline-start:-6px;margin-top:-6px;border-radius:999px;background:var(--ink, #1d2025);box-shadow:0 0 0 3px #fff;transition:transform .15s ease-out;pointer-events:none}.edp-audio-track--seek:hover .edp-audio-thumb,.edp-audio-track--seek:focus-visible .edp-audio-thumb{transform:scale(1.25)}.edp-audio-time{flex:none;min-width:2.6em;text-align:end;font-variant-numeric:tabular-nums;color:var(--ink-soft, #565b66);unicode-bidi:isolate}.edp-audio-speed{flex:none;min-width:3.1em;height:calc(1.75rem * var(--edp-a));padding:0 .5em;border:1px solid var(--line-strong, #d6d3cc);border-radius:999px;background:var(--ui-muted, #f5f4f1);color:var(--ink, #1d2025);font:inherit;font-size:.85em;font-weight:600;font-variant-numeric:tabular-nums;cursor:pointer;transition:border-color .18s ease-out}.edp-audio-speed:hover:not(:disabled){border-color:var(--ink-faint, #8d93a0)}.edp-audio-speed:active:not(:disabled){transform:scale(.97)}.edp-audio-note{display:block;margin:0;padding-inline-start:calc(.75rem * var(--edp-a));font-size:.9em;color:var(--ink-soft, #565b66)}.edp-audio--off .edp-audio-bar{background:var(--ui-muted, #f5f4f1)}.edp-audio--off .edp-audio-fill{background:var(--ink-faint, #8d93a0)}@media(max-width:380px){.edp-audio-bar{gap:calc(.5rem * var(--edp-a))}}@media(pointer:coarse){.edp-audio-speed{height:calc(2.5rem * var(--edp-a));min-width:3.6em}}.edp-rec{--edp-a: var(--edp-scale, 1);display:flex;flex-direction:column;gap:calc(.75rem * var(--edp-a));padding:calc(1rem * var(--edp-a));border:1px solid var(--line, #e7e5e0);border-radius:14px;background:#fff;font-size:calc(.9375rem * var(--edp-a));line-height:1.4}.edp-rec .edp-audio{margin:0}.edp-rec-idle{display:flex;flex-direction:column;align-items:center;gap:calc(.5rem * var(--edp-a));padding:calc(.5rem * var(--edp-a)) 0}.edp-rec-record{display:inline-flex;align-items:center;justify-content:center;width:calc(4rem * var(--edp-a));height:calc(4rem * var(--edp-a));border:0;border-radius:999px;background:var(--pen, #d23b2b);color:#fff;cursor:pointer;box-shadow:0 0 0 5px var(--pen-soft, #fdeeec);transition:transform 90ms ease-out,box-shadow .18s ease-out}.edp-rec-record:hover:not(:disabled){box-shadow:0 0 0 7px var(--pen-soft, #fdeeec)}.edp-rec-record:active:not(:disabled){transform:scale(.95)}.edp-rec-record:disabled{background:var(--line-strong, #d6d3cc);box-shadow:none;cursor:not-allowed}.edp-rec-record svg{width:calc(1.6rem * var(--edp-a));height:calc(1.6rem * var(--edp-a))}.edp-rec-record:focus-visible,.edp-rec-stop:focus-visible,.edp-rec-link:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:3px}.edp-rec-label{font-weight:600;color:var(--ink, #1d2025)}.edp-rec-limit{font-size:.9em;color:var(--ink-soft, #565b66);font-variant-numeric:tabular-nums}.edp-rec-live{display:flex;align-items:center;gap:calc(.75rem * var(--edp-a))}.edp-rec-level{flex:1 1 auto;min-width:0;width:100%;height:calc(2.5rem * var(--edp-a));display:block}.edp-rec-clock{flex:none;display:inline-flex;align-items:center;gap:.4em;font-variant-numeric:tabular-nums;color:var(--ink, #1d2025);unicode-bidi:isolate}.edp-rec-clock small{color:var(--ink-faint, #8d93a0);font-size:.9em}.edp-rec-dot{width:.6em;height:.6em;border-radius:999px;background:var(--pen, #d23b2b);animation:edp-rec-dot 1.2s ease-in-out infinite}@keyframes edp-rec-dot{50%{opacity:.35}}.edp-rec-stop{flex:none;display:inline-flex;align-items:center;gap:.45em;height:calc(2.5rem * var(--edp-a));padding:0 1em;border:1px solid var(--ink, #1d2025);border-radius:999px;background:var(--ink, #1d2025);color:#fff;font:inherit;font-weight:600;cursor:pointer}.edp-rec-stop{transition:background-color .18s ease-out,transform 90ms ease-out}.edp-rec-stop:hover{background:#33373e}.edp-rec-stop:active{transform:scale(.97)}.edp-rec-stop i{display:inline-block;width:.7em;height:.7em;border-radius:2px;background:currentColor}.edp-rec-foot{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:calc(.5rem * var(--edp-a)) calc(1rem * var(--edp-a));min-height:1.75em}.edp-rec-status{display:inline-flex;align-items:center;gap:.4em;color:var(--ink-soft, #565b66)}.edp-rec-status--ok{color:var(--ok, #1f8a4c);font-weight:600}.edp-rec-status--error{color:var(--ink, #1d2025)}.edp-rec-status--error svg{color:var(--ink, #1d2025);flex:none}.edp-rec-progress{flex:1 1 8rem;height:4px;border-radius:999px;background:var(--line, #e7e5e0);overflow:hidden}.edp-rec-progress>span{display:block;height:100%;background:var(--ink, #1d2025);transition:width .15s ease-out}.edp-rec-link{font:inherit;font-weight:600;color:var(--ink, #1d2025);background:none;border:0;padding:.25em 0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.edp-rec-link:hover{text-decoration-thickness:2px}@media(pointer:coarse){.edp-rec-link{min-height:2.5rem;padding:0 .25em}}.edp-rec-level:dir(rtl){transform:scaleX(-1)}.edp-rec-message{margin:0;color:var(--ink-soft, #565b66);text-align:center}.edp-rec video{width:100%;max-height:16rem;border-radius:10px;background:#000}@media(prefers-reduced-motion:reduce){.edp-rec-dot{animation:none}.edp-audio-play,.edp-audio-thumb,.edp-rec-record,.edp-rec-stop,.edp-rec-progress>span{transition:none}}.player-ai--sheet{padding:0;border:none;background:transparent}.edp-sheet-box{display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--card, #ffffff);color:var(--ink, #1d2025);transition:border-color .18s ease}.edp-sheet-box:focus-within{border-color:var(--ink, #1d2025)}.edp-sheet--readonly .edp-sheet-box{background:var(--paper, #fbfaf7)}.edp-sheet.player-ai-input--correct,.edp-sheet.player-ai-input--incorrect,.edp-sheet.player-ai-input--partial{border:none;background:transparent}.edp-sheet.player-ai-input--correct .edp-sheet-box{border-color:var(--ok, #1f8a4c);background:var(--ok-soft, #ecf8f0)}.edp-sheet.player-ai-input--incorrect .edp-sheet-box{border-color:var(--pen, #d23b2b);background:var(--pen-soft, #fdeeec)}.edp-sheet.player-ai-input--partial .edp-sheet-box{border-color:var(--almost, #c8810e);border-style:dashed;background:var(--almost-soft, #fbf1dc)}.edp-sheet-page{position:relative;padding:calc(.75rem * var(--edp-scale, 1)) calc(.875rem * var(--edp-scale, 1));min-height:calc(132px * var(--edp-scale, 1));font-size:calc(1rem * var(--edp-scale, 1));line-height:1.85}.edp-sheet-doc p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:inline-start;height:0;color:var(--ink-faint, #8d93a0);pointer-events:none}.edp-sheet-doc{outline:none;min-height:calc(108px * var(--edp-scale, 1));white-space:pre-wrap;overflow-wrap:break-word}.edp-sheet-doc p{margin:0}.edp-sheet-doc ul,.edp-sheet-doc ol{margin:0;padding-inline-start:calc(1.25rem * var(--edp-scale, 1))}.edp-sheet-formula{display:inline;unicode-bidi:isolate}.edp-sheet-line{display:block;unicode-bidi:isolate;margin:calc(.125rem * var(--edp-scale, 1)) 0}.edp-sheet-mf{display:inline-block;min-width:1ch;padding:0 calc(.1875rem * var(--edp-scale, 1));margin:0;vertical-align:baseline;font-size:1.05em;color:inherit;border:none;border-radius:calc(.3125rem * var(--edp-scale, 1));background:transparent;outline:none;transition:background-color .18s ease;--caret-color: var(--ink, #1d2025);--selection-background-color: var(--line, #e8e5de);--contains-highlight-background-color: transparent;--smart-fence-color: var(--ink-faint, #8d93a0);--placeholder-color: var(--ink-faint, #8d93a0)}.edp-sheet-mf:focus-within{background:var(--paper-deep, #f4f1ea)}.edp-sheet-mf::part(container),.edp-sheet-mf::part(content){padding:0}.edp-sheet-mf::part(menu-toggle),.edp-sheet-mf::part(virtual-keyboard-toggle){display:none}.edp-sheet-formula .edp-sheet-static{display:inline}.edp-sheet-line .edp-sheet-static{display:block;max-width:100%;overflow-x:auto}.edp-sheet-line.edp-sheet-line--centred[dir]{text-align:center;margin:calc(.375rem * var(--edp-scale, 1)) 0}.edp-sheet-formula,.edp-sheet-line{position:relative}.edp-math-chip{position:absolute;z-index:2;inset-block-start:0;inset-inline-end:-.35em;translate:0 calc(-100% - 3px);display:none;gap:1px;padding:1px;font:600 .75rem/1 system-ui,sans-serif;background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de);border-radius:999px;box-shadow:0 1px 2px #00000014;user-select:none}.edp-math-chip:after{content:"";position:absolute;inset-inline:0;inset-block-start:100%;height:5px}.edp-sheet-line-box{position:relative;display:inline-block;max-width:100%}.edp-sheet-formula:hover>.edp-math-chip,.edp-sheet-line:hover .edp-math-chip,.edp-sheet-formula:focus-within>.edp-math-chip,.edp-sheet-line:focus-within .edp-math-chip{display:inline-flex}.edp-math-chip-btn{display:inline-flex;align-items:center;justify-content:center;width:1.375rem;height:1.375rem;padding:0;font:inherit;color:var(--ink-soft, #5b6170);background:transparent;border:none;border-radius:999px;cursor:pointer;touch-action:manipulation}.edp-math-chip-btn:hover{color:var(--ink, #1d2025);background:var(--paper-deep, #f4f1ea)}.edp-math-chip-btn:focus-visible{outline:2px solid var(--pen, #d23b2b);outline-offset:1px}.edp-math-chip-btn[aria-pressed=true]{color:var(--pen, #d23b2b)}@media(pointer:coarse){.edp-math-chip-btn{width:1.75rem;height:1.75rem}}.edp-sheet-keys{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.25rem * var(--edp-scale, 1));padding:calc(.375rem * var(--edp-scale, 1)) calc(.5rem * var(--edp-scale, 1));border-top:1px solid var(--line, #e8e5de);background:var(--paper, #fbfaf7)}.edp-sheet-key{display:inline-flex;align-items:center;justify-content:center;gap:calc(.3125rem * var(--edp-scale, 1));min-width:calc(2.25rem * var(--edp-scale, 1));height:calc(2.25rem * var(--edp-scale, 1));padding:0 calc(.5rem * var(--edp-scale, 1));font-family:KaTeX_Main,Times New Roman,serif;font-size:calc(1.0625rem * var(--edp-scale, 1));line-height:1;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de);border-radius:calc(.5rem * var(--edp-scale, 1));cursor:pointer;touch-action:manipulation;transition:background-color .18s ease,border-color .18s ease}.edp-sheet-key:hover,.edp-sheet-key.is-active{background:var(--paper-deep, #f4f1ea);border-color:var(--line-strong, #d6d3cc)}.edp-sheet-key:active{background:var(--line, #e8e5de)}.edp-sheet-key:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-key-pow sup{margin-inline-start:.05em;font-size:.62em;line-height:0}.edp-key-frac{display:inline-flex;flex-direction:column;align-items:center;font-size:.72em;line-height:1.1}.edp-key-frac>span:first-child{padding:0 .15em;border-bottom:1px solid currentColor}.edp-sheet-key--more,.edp-sheet-key--tool{font-family:inherit;font-size:calc(.8125rem * var(--edp-scale, 1));font-weight:500}.edp-sheet-keys-extra{display:inline-flex;flex-wrap:wrap;gap:calc(.25rem * var(--edp-scale, 1));margin-inline-start:auto}.edp-sheet-notice{margin:0 0 calc(.5rem * var(--edp-scale, 1));padding:calc(.5rem * var(--edp-scale, 1)) calc(.75rem * var(--edp-scale, 1));font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink, #1d2025);background:var(--almost-soft, #fbf1dc);border-radius:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-photos{display:flex;flex-wrap:wrap;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));padding:calc(.5rem * var(--edp-scale, 1)) 0 0}.edp-sheet-photos-label{font-size:calc(.8125rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-photo{position:relative;display:inline-block}.edp-sheet-photo img{display:block;width:calc(4rem * var(--edp-scale, 1));height:calc(4rem * var(--edp-scale, 1));object-fit:cover;border-radius:calc(.375rem * var(--edp-scale, 1));border:1px solid var(--line, #e8e5de)}.edp-sheet-photo-remove{position:absolute;top:calc(-.5rem * var(--edp-scale, 1));inset-inline-end:calc(-.5rem * var(--edp-scale, 1));width:calc(1.5rem * var(--edp-scale, 1));height:calc(1.5rem * var(--edp-scale, 1));border-radius:999px;border:1px solid var(--line-strong, #d6d3cc);background:var(--card, #ffffff);color:var(--ink, #1d2025);cursor:pointer;line-height:1}.edp-sheet-panel{margin:calc(.5rem * var(--edp-scale, 1)) 0 0;padding:calc(.75rem * var(--edp-scale, 1));border:1px solid var(--line, #e8e5de);border-radius:calc(.625rem * var(--edp-scale, 1));background:var(--paper, #fbfaf7)}.edp-sheet-panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-panel-close{width:calc(2.25rem * var(--edp-scale, 1));height:calc(2.25rem * var(--edp-scale, 1));border:none;border-radius:calc(.5rem * var(--edp-scale, 1));background:transparent;font-size:calc(1.25rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170);cursor:pointer}.edp-sheet-panel-actions{display:flex;flex-wrap:wrap;gap:calc(.5rem * var(--edp-scale, 1))}.edp-sheet-btn{min-height:calc(2.5rem * var(--edp-scale, 1));padding:0 calc(.875rem * var(--edp-scale, 1));font-size:calc(.9375rem * var(--edp-scale, 1));font-weight:500;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));cursor:pointer;touch-action:manipulation}.edp-sheet-btn--primary{color:#fff;background:var(--ink, #1d2025);border-color:var(--ink, #1d2025)}.edp-sheet-btn:disabled{opacity:.45;cursor:default}.edp-sheet-btn,.edp-sheet-panel-close,.edp-sheet-photo-remove{transition:background-color .18s ease,border-color .18s ease}.edp-sheet-btn:hover:not(:disabled){background:var(--paper-deep, #f4f1ea);border-color:var(--ink, #1d2025)}.edp-sheet-btn--primary:hover:not(:disabled){background:var(--ink-soft, #2c313b)}.edp-sheet-panel-close:hover,.edp-sheet-photo-remove:hover{background:var(--paper-deep, #f4f1ea);color:var(--ink, #1d2025)}.edp-sheet-btn:focus-visible,.edp-sheet-panel-close:focus-visible,.edp-sheet-photo-remove:focus-visible{outline:2px solid var(--ink, #1d2025);outline-offset:2px}.edp-sheet-qr{display:flex;align-items:center;gap:calc(.875rem * var(--edp-scale, 1))}.edp-sheet-qr img,.edp-sheet-qr-wait{flex:none;width:calc(168px * var(--edp-scale, 1));height:calc(168px * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de)}.edp-sheet-qr p{margin:0;font-size:calc(.9375rem * var(--edp-scale, 1));line-height:1.5}.edp-sheet-or{margin:calc(.625rem * var(--edp-scale, 1)) 0 calc(.375rem * var(--edp-scale, 1));font-size:calc(.8125rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-camera video{display:block;width:100%;max-height:calc(320px * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));border-radius:calc(.5rem * var(--edp-scale, 1));background:#000}.edp-sheet-progress{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));margin:0;font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-error p{margin:0 0 calc(.5rem * var(--edp-scale, 1));color:var(--pen, #d23b2b);font-size:calc(.9375rem * var(--edp-scale, 1))}.edp-sheet-pad-result{display:flex;align-items:center;gap:calc(.5rem * var(--edp-scale, 1));min-height:calc(2.5rem * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));font-size:calc(1.6rem * var(--edp-scale, 1))}.edp-sheet-pad-help{font-size:calc(.875rem * var(--edp-scale, 1));color:var(--ink-soft, #5b6170)}.edp-sheet-pad{display:block;width:100%;height:calc(180px * var(--edp-scale, 1));margin-bottom:calc(.5rem * var(--edp-scale, 1));background:#fff;border:1px solid var(--line-strong, #d6d3cc);border-radius:calc(.5rem * var(--edp-scale, 1));touch-action:none;cursor:crosshair}@media(max-width:480px){.edp-sheet-key{min-width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}.edp-sheet-keys-extra{margin-inline-start:0}.edp-sheet-photo-remove{width:calc(2.5rem * var(--edp-scale, 1));height:calc(2.5rem * var(--edp-scale, 1))}.edp-sheet-qr{flex-direction:column;align-items:flex-start}}@media(prefers-reduced-motion:reduce){.edp-sheet-box,.edp-sheet-mf,.edp-sheet-key,.edp-sheet-btn,.edp-sheet-panel-close,.edp-sheet-photo-remove{transition:none}}.edp-mathkb-close{position:fixed;z-index:1000;inset-inline-end:12px;display:inline-flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;font:600 1rem/1 system-ui,sans-serif;color:var(--ink, #1d2025);background:var(--card, #ffffff);border:1px solid var(--line, #e8e5de);border-radius:999px;box-shadow:0 2px 8px #00000026;cursor:pointer;touch-action:manipulation}.edp-mathkb-close[hidden]{display:none}.edp-mathkb-close:hover{background:var(--paper-deep, #f4f1ea)}.edp-mathkb-close:focus-visible{outline:2px solid var(--pen, #d23b2b);outline-offset:2px}.edp-math-text-formula{unicode-bidi:isolate;white-space:nowrap}.player-math-keys{margin-top:calc(.375rem * var(--edp-scale, 1));padding:0;border-top:0;background:transparent}
53
+ `);import"katex/dist/katex.min.css";Dt(`/*! 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-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-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 .top-\\[calc\\(var\\(--edp-bar\\)\\+1rem\\)\\]{top:calc(var(--edp-bar) + 1rem)}.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-0\\.5{margin-inline-start:calc(var(--spacing) * .5)}.edpire-scope .ms-1{margin-inline-start:calc(var(--spacing) * 1)}.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-4{margin-top:calc(var(--spacing) * 4)}.edpire-scope .mt-6{margin-top:calc(var(--spacing) * 6)}.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-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.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-auto{margin-left:auto}.edpire-scope .line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.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\\(100dvh-8rem\\)\\]{max-height:calc(100dvh - 8rem)}.edpire-scope .max-h-\\[calc\\(100dvh-var\\(--edp-bar\\)-2rem\\)\\]{max-height:calc(100dvh - var(--edp-bar) - 2rem)}.edpire-scope .max-h-\\[calc\\(100svh-6rem\\)\\]{max-height:calc(100svh - 6rem)}.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 .min-h-dvh{min-height:100dvh}.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-\\[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-auto{overflow:auto}.edpire-scope .overflow-hidden{overflow:hidden}.edpire-scope .overflow-visible{overflow:visible}.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\\/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-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 .py-16{padding-block:calc(var(--spacing) * 16)}.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-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-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 .\\[overflow-wrap\\:anywhere\\]{overflow-wrap:anywhere}.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-\\[\\#5b6170\\]{color:#5b6170}.edpire-scope .text-\\[\\#8a5a08\\]{color:#8a5a08}.edpire-scope .text-\\[\\#8a8f99\\]{color:#8a8f99}.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{--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-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 .\\[--edp-bar\\:0px\\]{--edp-bar:0px}.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\\:border-\\[\\#1d2025\\]):focus{border-color:#1d2025}.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-40):disabled{opacity:.4}.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)}.edpire-scope :is(.edpire-scope .\\[\\&_\\[data-exercise-id\\]\\]\\:scroll-mt-\\[calc\\(var\\(--edp-bar\\)\\+0\\.75rem\\)\\]) [data-exercise-id],.edpire-scope :is(.edpire-scope .\\[\\&_\\[data-question-id\\]\\]\\:scroll-mt-\\[calc\\(var\\(--edp-bar\\)\\+0\\.75rem\\)\\]) [data-question-id]{scroll-margin-top:calc(var(--edp-bar) + .75rem)}@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}}
54
+ `);import{jsx as sa}from"react/jsx-runtime";var $i=Ou.memo(function({content:t,onAnswersChange:r,feedback:n,initialAnswers:o,readOnly:a,className:s,dir:i}){let c=ju(()=>{if(n)return new Map(Object.entries(n))},[n]),l=sa(er,{content:t,onAnswersChange:r,initialAnswers:o,validationFeedback:c,readOnly:a,className:s});return sa("div",{className:"edpire-scope",style:{display:"contents"},children:i?sa("div",{dir:i,children:l}):l})});import{useEffect as Tm,useRef as Aa}from"react";import yc from"react";import{createRoot as xc}from"react-dom/client";import{useCallback as mc,useMemo as fc,useState as Cm}from"react";import{cloneElement as rc,isValidElement as nc,useCallback as Je,useEffect as zn,useMemo as Le,useRef as _t,useState as Ve}from"react";import{Send as oc,Loader2 as ba,BarChart2 as ya,CheckCircle2 as ac,XCircle as mm,RotateCcw as fm,X as xa,Clock as or,AlertTriangle as hm,AlertCircle as gm,Check as bm,CloudOff as ym}from"lucide-react";import{clsx as Bu}from"clsx";import{twMerge as qu}from"tailwind-merge";function ye(...e){return qu(Bu(e))}function Ot(e,t,r){return t?.trim()||e("exercise",{index:r+1})}import{Fragment as Vu,jsx as Pe,jsxs as ia}from"react/jsx-runtime";function Hu({accent:e}){return Pe("div",{style:{width:48,height:48,borderRadius:"50%",border:`4px solid ${e}33`,borderTopColor:e,animation:"edpire-spin 0.8s linear infinite"}})}function Wu({accent:e}){return Pe("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[0,1,2].map(t=>Pe("div",{style:{width:12,height:12,borderRadius:"50%",background:e,animation:`edpire-bounce 1.2s ease-in-out ${t*.2}s infinite`}},t))})}function Uu({accent:e}){return ia("div",{style:{position:"relative",width:48,height:48},children:[[0,1].map(t=>Pe("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:e,opacity:.4,animation:`edpire-pulse 1.6s ease-out ${t*.8}s infinite`}},t)),Pe("div",{style:{position:"absolute",inset:"25%",borderRadius:"50%",background:e}})]})}function Ku({accent:e}){return Pe("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:40},children:[0,1,2,3].map(t=>Pe("div",{style:{width:8,borderRadius:4,background:e,animation:`edpire-bars 1s ease-in-out ${t*.15}s infinite`}},t))})}function Fi({visible:e,bgColor:t="rgba(0,0,0,0.55)",accentColor:r="#6366f1",text:n="Evaluating your answers\u2026",aiText:o="Some answers are being reviewed by AI, this may take a few seconds.",spinnerTheme:a="default",animationUrl:s,hasAiNodes:i=!1,contained:c=!1}){return e?ia(Vu,{children:[Pe("style",{children:`
50
55
  @keyframes edpire-spin {
51
56
  to { transform: rotate(360deg); }
52
57
  }
@@ -62,7 +67,7 @@ sys.stdin = io.StringIO(${JSON.stringify(s)})
62
67
  0%, 100% { height: 12px; }
63
68
  50% { height: 40px; }
64
69
  }
65
- `}),_e("div",{style:{background:r},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:Qn("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 _e("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(a){case"dots":return _e(Kl,{accent:t});case"pulse":return _e(Xl,{accent:t});case"bars":return _e(Jl,{accent:t});default:return _e(Yl,{accent:t})}})(),_e("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&_e("p",{className:"text-xs text-slate-500 leading-snug",children:o})]})})]}):null}import{useCallback as Wa,useEffect as ed,useMemo as Ua,useRef as Kt,useState as rd}from"react";import{BookOpen as Ha,X as td}from"lucide-react";import{Fragment as od,jsx as be,jsxs as je}from"react/jsx-runtime";function Gn(e){return e.exercises.flatMap((r,t)=>r.sharedContext&&at(r.sharedContext)?[{id:r.id,index:t,title:r.title,content:r.sharedContext}]:[])}var Va=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function nd(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Qa({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,footer:m}){let[p,g]=rd(!1),u=e.annex,h=u?.tabLabel||d("annexDocuments"),v=Ua(()=>Gn(e),[e]),R=Kt(null),w=Kt(null),C=Kt(null),y=Kt(null),S=()=>(R.current?.getClientRects().length??0)>0,k=Wa((f,q)=>{let A=f?.querySelector(`[data-reference-for="${CSS.escape(q)}"]`);if(!f||!A)return;let L=A.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop-12;f.scrollTo({top:L,behavior:Va()?"auto":"smooth"}),nd(A)},[]),_=Wa(f=>{if(S()){k(w.current,f);return}g(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>k(y.current,f)))},[k]),P=f=>{let q=S()?R.current:C.current;S()||g(!1),Array.from(q?.querySelectorAll(`[data-exercise-id="${CSS.escape(f)}"]`)??[]).find(L=>L.getClientRects().length>0)?.scrollIntoView({behavior:Va()?"auto":"smooth",block:"start"})};ed(()=>{let f=R.current;if(!f||v.length===0||typeof IntersectionObserver>"u")return;let q=i?f:null,A=new Set(v.map(B=>B.id)),L=null,Q=new IntersectionObserver(B=>{if(!S())return;let X=B.filter(pe=>pe.isIntersecting&&A.has(pe.target.dataset.exerciseId??"")).sort((pe,ye)=>pe.boundingClientRect.top-ye.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!X||X===L||(L=X,k(w.current,X))},{root:q,rootMargin:"0px 0px -60% 0px"});return f.querySelectorAll("[data-exercise-id]").forEach(B=>Q.observe(B)),()=>Q.disconnect()},[v,k,i]);let z=Ua(()=>({label:h,showExerciseReference:_}),[h,_]),b=je(od,{children:[u?.items.map(f=>be(it,{item:f},f.id)),u?.items.length&&v.length?be("div",{className:"border-t border-[#e7e5e0]"}):null,v.map(f=>je("section",{"data-reference-for":f.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:[be("button",{type:"button",onClick:()=>P(f.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:be("span",{dir:"auto",children:Nr(d,f.title,f.index)})}),be(Or,{content:f.content})]},f.id))]}),T=be(pr,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});return be(Ht,{value:z,children:je("div",{className:ge("@container flex-1 min-h-0 flex",i&&"relative"),children:[je("div",{ref:R,className:ge("hidden @6xl:flex flex-1 min-w-0 gap-4 p-4 bg-[#f5f4f1] items-start",i&&"overflow-y-auto"),children:[je("div",{className:ge("flex-1 sticky flex flex-col bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",i?"top-4 max-h-[calc(100svh-6rem)]":"top-[calc(var(--edp-bar)+1rem)] max-h-[calc(100dvh-var(--edp-bar)-2rem)]"),children:[je("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[be(Ha,{size:14,className:"text-[#8d93a0]"}),be("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:h})]}),be("div",{ref:w,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:b})]}),be("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),be("div",{className:"flex-1 min-w-0 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:je("div",{className:"px-6 py-5 flex flex-col gap-4",children:[T,m]})})]}),je("div",{className:ge("@6xl:hidden flex-1 min-w-0 relative",i&&"overflow-hidden"),children:[be("div",{ref:C,className:ge(i&&"absolute inset-0 overflow-y-auto"),children:je("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[T,m]})}),p&&be("div",{className:ge("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>g(!1)}),je("div",{role:"dialog","aria-label":h,"aria-hidden":!p,className:ge("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:[je("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[be("span",{className:"text-sm font-bold text-[#1d2025]",children:h}),be("button",{onClick:()=>g(!1),"aria-label":d("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:be(td,{size:18})})]}),be("div",{ref:y,className:"overflow-y-auto max-h-[calc(100dvh-8rem)] px-5 pb-5 flex flex-col gap-5",children:b})]})]}),!p&&je("button",{onClick:()=>g(!0),"aria-label":h,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:ge("@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:[be(Ha,{size:12}),be("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:h})]})]})})}import{useState as ad}from"react";import{BookOpen as Ga,Plus as sd,X as id}from"lucide-react";import{jsx as Se,jsxs as or}from"react/jsx-runtime";function Ya({assessment:e,isSubmitted:r,setAnswers:t,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:d,onAddAnnex:m,footer:p}){let[g,u]=ad(!1),h=Se(pr,{assessment:e,onAnswersChange:r?void 0:t,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});if(g)return Se("div",{className:"flex-1 overflow-y-auto",children:or("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:[h,p]})});let v=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),m())},R=C=>or("span",{style:s?{backgroundColor:s}:void 0,className:ge("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",C?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[Se(sd,{size:13}),d("annexEmptyCta")]}),w=C=>Se("button",{type:"button",onClick:y=>{y.stopPropagation(),u(!0)},"aria-label":d("annexEmptyDismiss"),title:d("annexEmptyDismiss"),className:ge("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",C&&"absolute top-2 end-2 z-10"),children:Se(id,{size:15})});return or("div",{className:ge("@container flex-1 min-h-0 flex",i&&"relative"),children:[or("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Se("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:or("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:v,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:[w(!0),Se("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:Se(Ga,{size:20})}),Se("span",{className:"text-sm font-bold text-[#565b66]",children:d("annexEmptyTitle")}),Se("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:d("annexEmptyBody")}),R(!1)]})}),Se("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),Se("div",{className:"flex-1 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:or("div",{className:"px-6 py-5 flex flex-col gap-4",children:[h,p]})})]}),Se("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:or("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[or("div",{role:"button",tabIndex:0,onClick:m,onKeyDown:v,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:[Se("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:Se(Ga,{size:16})}),or("div",{className:"flex-1 min-w-0",children:[Se("div",{className:"text-xs font-bold text-[#565b66]",children:d("annexEmptyTitle")}),Se("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:d("annexEmptyBody")})]}),R(!0),w(!1)]}),h,p]})})]})}function Yn(e){let r=new Map;for(let t of e){let n=new Map;for(let o of t.questions){let a=new Map;for(let s of o.nodeResults){let i={state:s.status,showFeedback:!0,score:s.score,...s.feedback!==void 0?{message:s.feedback}:{},...s.displayAnswer!==void 0?{displayAnswer:s.displayAnswer}:{},...s.teacherFeedback!==void 0?{teacherFeedback:s.teacherFeedback}:{}};s.detail?.type==="choiceSet"?i.correctChoiceIds=s.detail.correctChoiceIds:s.detail?.type==="matchingSet"&&(i.pairFeedback=s.detail.pairFeedback,i.correctPairings=s.detail.correctPairings),a.set(s.nodeId,i)}n.set(o.questionId,a)}r.set(t.exerciseId,n)}return r}import{Lightbulb as cd}from"lucide-react";import{jsx as Kn,jsxs as Ka}from"react/jsx-runtime";function ld(e){return e.length===0||e.some(r=>r.status==="awaiting_review")?null:e.every(r=>r.status==="correct")?"correct":e.some(r=>r.status==="partial"||r.status==="correct"||(r.score??0)>0)?"partial":"incorrect"}function Xa({content:e,nodeResults:r,label:t}){let n=ld(r);return Ka("div",{className:`player-ai-feedback mt-3 mb-3${n?` player-ai-feedback--${n}`:""}`,children:[Ka("p",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[Kn(cd,{size:14,"aria-hidden":!0}),t]}),Kn("div",{className:"text-[#1d2025]",children:Kn(Or,{content:e})})]})}import{jsx as ar,jsxs as Xn}from"react/jsx-runtime";function Ja({t:e,rtl:r,showClose:t,onContinue:n,continueLabel:o,primaryColor:a}){return Xn("div",{role:"status",className:"edp-thanks flex-1 flex items-center justify-center px-6 py-16",children:[ar("style",{children:dd}),Xn("div",{className:"flex flex-col items-center text-center",style:{maxWidth:"26rem"},children:[Xn("div",{className:"relative",style:{width:120,height:120},"aria-hidden":!0,children:[ar("svg",{className:"edp-thanks-blob absolute inset-0 overflow-visible",viewBox:"0 0 200 200",width:"120",height:"120",children:ar("path",{d:"M104 14c44 2 80 34 82 80s-34 94-86 92S12 150 16 98 58 12 104 14z",fill:"#ffd64a"})}),ar("svg",{className:"absolute inset-0 overflow-visible",viewBox:"0 0 100 100",width:"120",height:"120",children:ar("path",{className:"edp-thanks-check",d:"M26 54l17 17 33-39",fill:"none",stroke:"#1d2025",strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round",pathLength:1})})]}),ar("h2",{className:"edp-thanks-stamp mt-4 text-[#1d2025]",style:r?{fontSize:36,fontWeight:700,lineHeight:1.3,transform:"rotate(-3deg)"}:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:56,fontWeight:600,lineHeight:1,transform:"rotate(-4deg)"},children:e("formThanks")}),ar("p",{className:"edp-thanks-rise mt-4 text-base text-[#565b66]",style:{animationDelay:"750ms"},children:e("formThanksDesc")}),t&&!n&&ar("p",{className:"edp-thanks-rise mt-1 text-sm text-[#8a8f99]",style:{animationDelay:"850ms"},children:e("formThanksClose")}),n&&ar("button",{onClick:n,style:{animationDelay:"850ms",...a?{backgroundColor:a}:{}},className:"edp-thanks-rise mt-6 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:o??e("continue")})]})]})}var dd=`
70
+ `}),Pe("div",{style:{background:t},className:`${c?"absolute":"fixed"} inset-0 z-[60] flex items-center justify-center`,children:ia("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 Pe("img",{src:s,alt:"",className:"w-24 h-24 object-contain"});switch(a){case"dots":return Pe(Wu,{accent:r});case"pulse":return Pe(Uu,{accent:r});case"bars":return Pe(Ku,{accent:r});default:return Pe(Hu,{accent:r})}})(),Pe("p",{className:"text-sm font-semibold text-slate-800",children:n}),i&&Pe("p",{className:"text-xs text-slate-500 leading-snug",children:o})]})})]}):null}import{useCallback as zi,useEffect as Gu,useMemo as Di,useRef as Fn,useState as Qu}from"react";import{BookOpen as Oi,X as Yu}from"lucide-react";import{Fragment as Ju,jsx as xe,jsxs as Ke}from"react/jsx-runtime";function ca(e){return e.exercises.flatMap((t,r)=>t.sharedContext&&$r(t.sharedContext)?[{id:t.id,index:r,title:t.title,content:t.sharedContext}]:[])}var ji=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Xu(e){e.removeAttribute("data-flash"),e.offsetWidth,e.setAttribute("data-flash","true"),setTimeout(()=>e.removeAttribute("data-flash"),1200)}function Bi({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:p,footer:f}){let[m,h]=Qu(!1),d=e.annex,u=d?.tabLabel||p("annexDocuments"),v=Di(()=>ca(e),[e]),R=Fn(null),S=Fn(null),C=Fn(null),w=Fn(null),N=()=>(R.current?.getClientRects().length??0)>0,k=zi((A,W)=>{let b=A?.querySelector(`[data-reference-for="${CSS.escape(W)}"]`);if(!A||!b)return;let M=b.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop-12;A.scrollTo({top:M,behavior:ji()?"auto":"smooth"}),Xu(b)},[]),x=zi(A=>{if(N()){k(S.current,A);return}h(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>k(w.current,A)))},[k]),y=A=>{let W=N()?R.current:C.current;N()||h(!1),Array.from(W?.querySelectorAll(`[data-exercise-id="${CSS.escape(A)}"]`)??[]).find(M=>M.getClientRects().length>0)?.scrollIntoView({behavior:ji()?"auto":"smooth",block:"start"})};Gu(()=>{let A=R.current;if(!A||v.length===0||typeof IntersectionObserver>"u")return;let W=i?A:null,b=new Set(v.map(B=>B.id)),M=null,$=new IntersectionObserver(B=>{if(!N())return;let Q=B.filter(Y=>Y.isIntersecting&&b.has(Y.target.dataset.exerciseId??"")).sort((Y,ve)=>Y.boundingClientRect.top-ve.boundingClientRect.top)[0]?.target?.dataset.exerciseId;!Q||Q===M||(M=Q,k(S.current,Q))},{root:W,rootMargin:"0px 0px -60% 0px"});return A.querySelectorAll("[data-exercise-id]").forEach(B=>$.observe(B)),()=>$.disconnect()},[v,k,i]);let T=Di(()=>({label:u,showExerciseReference:x}),[u,x]),g=Ke(Ju,{children:[d?.items.map(A=>xe(zr,{item:A},A.id)),d?.items.length&&v.length?xe("div",{className:"border-t border-[#e7e5e0]"}):null,v.map(A=>Ke("section",{"data-reference-for":A.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:[xe("button",{type:"button",onClick:()=>y(A.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:xe("span",{dir:"auto",children:Ot(p,A.title,A.index)})}),xe(rr,{content:A.content})]},A.id))]}),P=xe(Nt,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});return xe(Mn,{value:T,children:Ke("div",{className:ye("@container flex-1 min-h-0 flex",i&&"relative"),children:[Ke("div",{ref:R,className:ye("hidden @6xl:flex flex-1 min-w-0 gap-4 p-4 bg-[#f5f4f1] items-start",i&&"overflow-y-auto"),children:[Ke("div",{className:ye("flex-1 sticky flex flex-col bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",i?"top-4 max-h-[calc(100svh-6rem)]":"top-[calc(var(--edp-bar)+1rem)] max-h-[calc(100dvh-var(--edp-bar)-2rem)]"),children:[Ke("div",{className:"flex items-center gap-2 px-5 py-3 border-b border-[#e7e5e0] flex-shrink-0",children:[xe(Oi,{size:14,className:"text-[#8d93a0]"}),xe("span",{className:"text-xs font-bold text-[#565b66] uppercase tracking-widest",children:u})]}),xe("div",{ref:S,className:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-6",children:g})]}),xe("div",{className:"w-px bg-[#e7e5e0] flex-shrink-0 self-stretch my-1 rounded-full"}),xe("div",{className:"flex-1 min-w-0 bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm",children:Ke("div",{className:"px-6 py-5 flex flex-col gap-4",children:[P,f]})})]}),Ke("div",{className:ye("@6xl:hidden flex-1 min-w-0 relative",i&&"overflow-hidden"),children:[xe("div",{ref:C,className:ye(i&&"absolute inset-0 overflow-y-auto"),children:Ke("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[P,f]})}),m&&xe("div",{className:ye("inset-0 z-30 bg-black/25",i?"absolute":"fixed"),onClick:()=>h(!1)}),Ke("div",{role:"dialog","aria-label":u,"aria-hidden":!m,className:ye("top-1/2 start-2 -translate-y-1/2 z-40 w-[88%] bg-[#f1efe9] rounded-2xl shadow-2xl flex flex-col overflow-hidden transition-transform duration-300 ease-in-out",i?"absolute":"fixed",m?"translate-x-0":"-translate-x-[110%] rtl:translate-x-[110%]"),children:[Ke("div",{className:"flex items-center justify-between px-5 py-3 flex-shrink-0",children:[xe("span",{className:"text-sm font-bold text-[#1d2025]",children:u}),xe("button",{onClick:()=>h(!1),"aria-label":p("close"),className:"p-1 text-[#8d93a0] hover:text-[#1d2025] rounded-lg transition-colors",children:xe(Yu,{size:18})})]}),xe("div",{ref:w,className:"overflow-y-auto max-h-[calc(100dvh-8rem)] px-5 pb-5 flex flex-col gap-5",children:g})]})]}),!m&&Ke("button",{onClick:()=>h(!0),"aria-label":u,style:{transform:"translateY(-50%)",...s?{backgroundColor:s}:{}},className:ye("@6xl:hidden top-1/2 start-0 z-20 flex flex-col items-center gap-1 py-3 px-1.5 bg-[#1d2025] text-white text-[10px] font-bold uppercase tracking-wider rounded-e-lg shadow-md hover:bg-[#31353c] transition-colors",i?"absolute":"fixed"),children:[xe(Oi,{size:12}),xe("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},children:u})]})]})})}import{useState as Zu}from"react";import{BookOpen as qi,Plus as em,X as tm}from"lucide-react";import{jsx as Ae,jsxs as gt}from"react/jsx-runtime";function Hi({assessment:e,isSubmitted:t,setAnswers:r,validationFeedback:n,renderExercise:o,renderSeparator:a,primaryColor:s,contained:i=!1,locale:c,contentMaxWidth:l,t:p,onAddAnnex:f,footer:m}){let[h,d]=Zu(!1),u=Ae(Nt,{assessment:e,onAnswersChange:t?void 0:r,validationFeedback:n,renderExercise:o,renderSeparator:a,locale:c});if(h)return Ae("div",{className:"flex-1 overflow-y-auto",children:gt("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:l},children:[u,m]})});let v=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),f())},R=C=>gt("span",{style:s?{backgroundColor:s}:void 0,className:ye("flex-none inline-flex items-center gap-1.5 rounded-lg bg-[#1d2025] text-white font-semibold shadow-sm group-hover:shadow-md transition-shadow",C?"px-3 py-1.5 text-xs":"mt-1 px-3.5 py-2 text-xs"),children:[Ae(em,{size:13}),p("annexEmptyCta")]}),S=C=>Ae("button",{type:"button",onClick:w=>{w.stopPropagation(),d(!0)},"aria-label":p("annexEmptyDismiss"),title:p("annexEmptyDismiss"),className:ye("flex-none flex items-center justify-center w-7 h-7 rounded-lg text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] transition-colors cursor-pointer",C&&"absolute top-2 end-2 z-10"),children:Ae(tm,{size:15})});return gt("div",{className:ye("@container flex-1 min-h-0 flex",i&&"relative"),children:[gt("div",{className:"hidden @6xl:flex flex-1 gap-4 p-4 bg-[#f5f4f1] items-start overflow-y-auto",children:[Ae("div",{className:"flex-1 sticky top-4 flex min-h-[200px] max-h-[calc(100svh-6rem)]",children:gt("div",{role:"button",tabIndex:0,onClick:f,onKeyDown:v,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:[S(!0),Ae("span",{className:"flex items-center justify-center w-11 h-11 rounded-full bg-[#f1efe9] text-[#8d93a0] group-hover:text-[#1d2025] transition-colors",children:Ae(qi,{size:20})}),Ae("span",{className:"text-sm font-bold text-[#565b66]",children:p("annexEmptyTitle")}),Ae("span",{className:"text-xs text-[#8d93a0] max-w-[32ch] leading-relaxed",children:p("annexEmptyBody")}),R(!1)]})}),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:gt("div",{className:"px-6 py-5 flex flex-col gap-4",children:[u,m]})})]}),Ae("div",{className:"@6xl:hidden flex-1 overflow-y-auto",children:gt("div",{className:"mx-auto px-5 py-5 flex flex-col gap-4",style:{maxWidth:l},children:[gt("div",{role:"button",tabIndex:0,onClick:f,onKeyDown:v,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:[Ae("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:Ae(qi,{size:16})}),gt("div",{className:"flex-1 min-w-0",children:[Ae("div",{className:"text-xs font-bold text-[#565b66]",children:p("annexEmptyTitle")}),Ae("div",{className:"text-[11px] text-[#8d93a0] leading-snug",children:p("annexEmptyBody")})]}),R(!0),S(!1)]}),u,m]})})]})}function la(e){let t=new Map;for(let r of e){let n=new Map;for(let o of r.questions){let a=new Map;for(let s of o.nodeResults){let i={state:s.status,showFeedback:!0,score:s.score,...s.feedback!==void 0?{message:s.feedback}:{},...s.displayAnswer!==void 0?{displayAnswer:s.displayAnswer}:{},...s.teacherFeedback!==void 0?{teacherFeedback:s.teacherFeedback}:{}};s.detail?.type==="choiceSet"?i.correctChoiceIds=s.detail.correctChoiceIds:s.detail?.type==="matchingSet"&&(i.pairFeedback=s.detail.pairFeedback,i.correctPairings=s.detail.correctPairings),a.set(s.nodeId,i)}n.set(o.questionId,a)}t.set(r.exerciseId,n)}return t}import{Lightbulb as rm}from"lucide-react";import{jsx as da,jsxs as Wi}from"react/jsx-runtime";function nm(e){return e.length===0||e.some(t=>t.status==="awaiting_review")?null:e.every(t=>t.status==="correct")?"correct":e.some(t=>t.status==="partial"||t.status==="correct"||(t.score??0)>0)?"partial":"incorrect"}function Ui({content:e,nodeResults:t,label:r}){let n=nm(t);return Wi("div",{className:`player-ai-feedback mt-3 mb-3${n?` player-ai-feedback--${n}`:""}`,children:[Wi("p",{className:"flex items-center gap-1.5 text-xs font-semibold",children:[da(rm,{size:14,"aria-hidden":!0}),r]}),da("div",{className:"text-[#1d2025]",children:da(rr,{content:e})})]})}import{useState as Ki}from"react";import{jsx as jt,jsxs as Vi}from"react/jsx-runtime";function Gi({questionId:e,onReport:t,t:r}){let[n,o]=Ki("closed"),[a,s]=Ki("");if(n==="sent")return jt("p",{role:"status",className:"mt-2 text-sm text-[#5b6170]",children:r("reportGradeSent")});if(n==="closed")return jt("button",{type:"button",onClick:()=>o("open"),className:"mt-2 text-sm text-[#5b6170] underline underline-offset-2 hover:text-[#1d2025]",children:r("reportGrade")});let i=async()=>{if(a.trim()){o("sending");try{await t(e,a.trim()),o("sent")}catch{o("failed")}}};return Vi("div",{className:"mt-2 rounded-lg border border-[#e7e5e0] bg-[#fbfaf7] p-3",children:[jt("label",{className:"mb-1.5 block text-sm font-medium text-[#1d2025]",htmlFor:`report-${e}`,children:r("reportGradePrompt")}),jt("textarea",{id:`report-${e}`,value:a,onChange:c=>s(c.target.value.slice(0,1e3)),rows:3,dir:"auto",className:"w-full rounded-md border border-[#d6d3cc] bg-white p-2 text-sm text-[#1d2025] outline-none focus:border-[#1d2025]"}),n==="failed"&&jt("p",{role:"alert",className:"mt-1 text-sm text-[#a32b1e]",children:r("reportGradeFailed")}),Vi("div",{className:"mt-2 flex gap-2",children:[jt("button",{type:"button",onClick:i,disabled:!a.trim()||n==="sending",className:"rounded-md bg-[#1d2025] px-3 py-1.5 text-sm font-medium text-white disabled:opacity-40",children:r("reportGradeSend")}),jt("button",{type:"button",onClick:()=>o("closed"),className:"rounded-md border border-[#d6d3cc] px-3 py-1.5 text-sm text-[#1d2025]",children:r("reportGradeCancel")})]})]})}import{jsx as bt,jsxs as pa}from"react/jsx-runtime";function Qi({t:e,rtl:t,showClose:r,onContinue:n,continueLabel:o,primaryColor:a}){return pa("div",{role:"status",className:"edp-thanks flex-1 flex items-center justify-center px-6 py-16",children:[bt("style",{children:om}),pa("div",{className:"flex flex-col items-center text-center",style:{maxWidth:"26rem"},children:[pa("div",{className:"relative",style:{width:120,height:120},"aria-hidden":!0,children:[bt("svg",{className:"edp-thanks-blob absolute inset-0 overflow-visible",viewBox:"0 0 200 200",width:"120",height:"120",children:bt("path",{d:"M104 14c44 2 80 34 82 80s-34 94-86 92S12 150 16 98 58 12 104 14z",fill:"#ffd64a"})}),bt("svg",{className:"absolute inset-0 overflow-visible",viewBox:"0 0 100 100",width:"120",height:"120",children:bt("path",{className:"edp-thanks-check",d:"M26 54l17 17 33-39",fill:"none",stroke:"#1d2025",strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round",pathLength:1})})]}),bt("h2",{className:"edp-thanks-stamp mt-4 text-[#1d2025]",style:t?{fontSize:36,fontWeight:700,lineHeight:1.3,transform:"rotate(-3deg)"}:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:56,fontWeight:600,lineHeight:1,transform:"rotate(-4deg)"},children:e("formThanks")}),bt("p",{className:"edp-thanks-rise mt-4 text-base text-[#565b66]",style:{animationDelay:"750ms"},children:e("formThanksDesc")}),r&&!n&&bt("p",{className:"edp-thanks-rise mt-1 text-sm text-[#8a8f99]",style:{animationDelay:"850ms"},children:e("formThanksClose")}),n&&bt("button",{onClick:n,style:{animationDelay:"850ms",...a?{backgroundColor:a}:{}},className:"edp-thanks-rise mt-6 px-4 py-2 bg-[#1d2025] text-white text-sm font-semibold rounded-lg hover:bg-[#31353c] transition-colors",children:o??e("continue")})]})]})}var om=`
66
71
  @keyframes edp-thanks-blob-in { from { transform: scale(0) rotate(-25deg); } }
67
72
  @keyframes edp-thanks-draw { to { stroke-dashoffset: 0; } }
68
73
  @keyframes edp-thanks-stamp-in { from { opacity: 0; transform: scale(1.8) rotate(-4deg); } }
@@ -75,5 +80,5 @@ sys.stdin = io.StringIO(${JSON.stringify(s)})
75
80
  .edp-thanks * { animation: none !important; }
76
81
  .edp-thanks .edp-thanks-check { stroke-dashoffset: 0; }
77
82
  }
78
- `;var pd=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),ud=new Set(["blankPool","inlinePool"]);function md(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 fd(e){let r=0,t=n=>{if(Array.isArray(n)){for(let s of n)t(s);return}if(!n||typeof n!="object")return;let{type:o,content:a}=n;if(typeof o=="string"){if(pd.has(o)){r+=1;return}if(ud.has(o))return}a!==void 0&&t(a)};return t(e),r}function Jn(e,r){let t=new Map;for(let o of r?.exerciseAnswers??[])for(let a of o.questionAnswers){let s=t.get(a.questionId);s||(s=new Set,t.set(a.questionId,s));for(let i of a.answers)md(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((o,a)=>{o.questions.forEach((s,i)=>{let c=fd(s.content);c!==0&&(t.get(s.id)?.size??0)<c&&n.push({questionId:s.id,exerciseIndex:a,...o.title?{exerciseTitle:o.title}:{},questionIndex:i,only:o.questions.length===1})})}),n}function Zn(e,r,t){let n=new Set(t);return n.size===0?[]:Jn(e,r).filter(o=>n.has(o.questionId))}function ro(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 es(e){let r=new Set,t=n=>{if(Array.isArray(n)){for(let c of n)t(c);return}if(!n||typeof n!="object")return;let{type:o,id:a,attrs:s,content:i}=n;if(o==="openResponseNode"){let{mode:c,allowFormatting:l}=s??{};typeof a=="string"&&(c==="text"||c==="text+file")&&!l&&r.add(a);return}i!==void 0&&t(i)};for(let n of e.exercises)for(let o of n.questions)t(o.content);return r}function eo(e){if(Array.isArray(e))return e.some(eo);if(!e||typeof e!="object")return!1;let{text:r,content:t}=e;return typeof r=="string"||t!==void 0&&eo(t)}function Za(e,r){if(e.type!=="openResponse"||!r.has(e.nodeId))return!1;let t=e.answer.text;return t!==void 0&&!eo(t.content)}function rs(e,r,t){return r.size===0?e:{...e,exerciseAnswers:e.exerciseAnswers.map(n=>({...n,questionAnswers:n.questionAnswers.map(o=>{let a=r.get(o.questionId);return a?o.answers.length===0?{...o,answers:a}:o.answers.some(s=>Za(s,t))?{...o,answers:o.answers.map(s=>{let i=s;if(i.type!=="openResponse"||!Za(i,t))return s;let c=a.find(d=>d.nodeId===i.nodeId&&d.type==="openResponse"),l=c?.type==="openResponse"?c.answer.text:void 0;return l?{...i,answer:{...i.answer,text:l}}:s})}:o:o})}))}}var hd={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.",submittedNoScore:"Your answers are in",submittedNoScoreDesc:"No score on this one: see below what you got right and what to look at again.",formThanks:"Thank you!",formThanksDesc:"Your answers have been sent.",formThanksClose:"You can close this page.",formSubmit:"Send",formSending:"Sending\u2026",formConfirmTitle:"Send your answers?",formConfirmDescription:"You won't be able to change them after sending.",required:"Required",requiredMissing:"This question is required",requiredBlocked:"A required question is unanswered: answer it, then send again.",continue:"Continue",beingMarked:"Being marked",beingMarkedDesc:"Some answers are still being marked. Your final score will be available once every answer is marked.",pendingReview:"Pending review",viewFullReport:"View Full Report",explanation:"Explanation",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI, this may take a few seconds.",reset:"Reset",back:"Back",annexDocuments:"Documents",annexEmptyTitle:"No reference yet",annexEmptyBody:"A text, figure, table or document that stays in view across the whole assessment while students answer.",annexEmptyCta:"Add reference",annexEmptyDismiss:"Hide","timeUp.title":"Time's up","timeUp.submitting":"Submitting your answers\u2026",yourScore:"Your score",answersSaving:"Saving\u2026",answersSaved:"Answers saved",answersNotSaved:"Your answers aren't being saved. Check your connection.",resumeRestored:"Welcome back. Your answers are here.",resumeFresh:"Welcome back.",resumeTimeLeft:"The clock kept running: {minutes} min left.",close:"Close"},gd={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.",submittedNoScore:"Vos r\xE9ponses sont envoy\xE9es",submittedNoScoreDesc:"Pas de note pour celle-ci : voyez ci-dessous ce qui est juste et ce qu'il faut revoir.",formThanks:"Merci !",formThanksDesc:"Vos r\xE9ponses ont bien \xE9t\xE9 envoy\xE9es.",formThanksClose:"Vous pouvez fermer cette page.",formSubmit:"Envoyer",formSending:"Envoi\u2026",formConfirmTitle:"Envoyer vos r\xE9ponses ?",formConfirmDescription:"Vous ne pourrez plus les modifier ensuite.",required:"Obligatoire",requiredMissing:"R\xE9ponse obligatoire",requiredBlocked:"Une question obligatoire est sans r\xE9ponse : r\xE9pondez-y, puis envoyez \xE0 nouveau.",continue:"Continuer",beingMarked:"Correction en cours",beingMarkedDesc:"Certaines r\xE9ponses sont encore en cours de correction. Votre note finale sera disponible d\xE8s que toutes les r\xE9ponses seront corrig\xE9es.",pendingReview:"En attente de correction",viewFullReport:"Voir le rapport complet",explanation:"Explication",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA, cela peut prendre quelques secondes.",reset:"R\xE9initialiser",back:"Retour",annexDocuments:"Documents",annexEmptyTitle:"Aucune annexe pour l'instant",annexEmptyBody:"Un texte, une figure, un tableau ou un document qui reste visible pour toute l'\xE9valuation pendant que les \xE9l\xE8ves r\xE9pondent.",annexEmptyCta:"Ajouter une annexe",annexEmptyDismiss:"Masquer","timeUp.title":"Temps \xE9coul\xE9","timeUp.submitting":"Envoi de vos r\xE9ponses\u2026",yourScore:"Votre score",answersSaving:"Enregistrement\u2026",answersSaved:"R\xE9ponses enregistr\xE9es",answersNotSaved:"Vos r\xE9ponses ne sont pas enregistr\xE9es. V\xE9rifiez votre connexion.",resumeRestored:"Bon retour. Vos r\xE9ponses sont l\xE0.",resumeFresh:"Bon retour.",resumeTimeLeft:"Le chrono a continu\xE9 : il reste {minutes} min.",close:"Fermer"},bd={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.",submittedNoScore:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643",submittedNoScoreDesc:"\u0644\u0627 \u0639\u0644\u0627\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062A\u0642\u064A\u064A\u0645: \u0627\u0646\u0638\u0631 \u0623\u062F\u0646\u0627\u0647 \u0645\u0627 \u0623\u062C\u0628\u062A \u0639\u0646\u0647 \u0628\u0634\u0643\u0644 \u0635\u062D\u064A\u062D \u0648\u0645\u0627 \u064A\u062C\u0628 \u0645\u0631\u0627\u062C\u0639\u062A\u0647.",formThanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643!",formThanksDesc:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643.",formThanksClose:"\u064A\u0645\u0643\u0646\u0643 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629.",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",formConfirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u061F",formConfirmDescription:"\u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u0639\u062F\u064A\u0644\u0647\u0627 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",required:"\u0645\u0637\u0644\u0648\u0628",requiredMissing:"\u0647\u0630\u0627 \u0633\u0624\u0627\u0644 \u0645\u0637\u0644\u0648\u0628",requiredBlocked:"\u0633\u0624\u0627\u0644 \u0645\u0637\u0644\u0648\u0628 \u0628\u0644\u0627 \u0625\u062C\u0627\u0628\u0629: \u0623\u062C\u0628 \u0639\u0646\u0647 \u062B\u0645 \u0623\u0631\u0633\u0644 \u0645\u0646 \u062C\u062F\u064A\u062F.",continue:"\u0645\u062A\u0627\u0628\u0639\u0629",beingMarked:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",beingMarkedDesc:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0645\u0627 \u0632\u0627\u0644\u062A \u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u062A\u0635\u062D\u064A\u062D \u062C\u0645\u064A\u0639 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A.",pendingReview:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",viewFullReport:"\u0639\u0631\u0636 \u0627\u0644\u062A\u0642\u0631\u064A\u0631 \u0627\u0644\u0643\u0627\u0645\u0644",explanation:"\u0634\u0631\u062D",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Edpire",evaluating:"\u062C\u0627\u0631\u064D \u062A\u0642\u064A\u064A\u0645 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",aiEvaluating:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0642\u064A\u062F \u0627\u0644\u0645\u0631\u0627\u062C\u0639\u0629 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u060C \u0642\u062F \u064A\u0633\u062A\u063A\u0631\u0642 \u0630\u0644\u0643 \u0628\u0636\u0639 \u062B\u0648\u0627\u0646\u064D.",reset:"\u0625\u0639\u0627\u062F\u0629 \u062A\u0639\u064A\u064A\u0646",back:"\u0631\u062C\u0648\u0639",annexDocuments:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexEmptyTitle:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u064F\u0644\u062D\u064E\u0642 \u0628\u0639\u062F",annexEmptyBody:"\u0646\u0635 \u0623\u0648 \u0635\u0648\u0631\u0629 \u0623\u0648 \u062C\u062F\u0648\u0644 \u0623\u0648 \u0645\u0633\u062A\u0646\u062F \u064A\u0628\u0642\u0649 \u0638\u0627\u0647\u0631\u064B\u0627 \u0637\u0648\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0623\u062B\u0646\u0627\u0621 \u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0644\u0627\u0628.",annexEmptyCta:"\u0625\u0636\u0627\u0641\u0629 \u0645\u064F\u0644\u062D\u064E\u0642",annexEmptyDismiss:"\u0625\u062E\u0641\u0627\u0621","timeUp.title":"\u0627\u0646\u062A\u0647\u0649 \u0627\u0644\u0648\u0642\u062A","timeUp.submitting":"\u062C\u0627\u0631\u064D \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",yourScore:"\u0646\u062A\u064A\u062C\u062A\u0643",answersSaving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",answersSaved:"\u062A\u0645 \u062D\u0641\u0638 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",answersNotSaved:"\u0644\u0627 \u064A\u062A\u0645 \u062D\u0641\u0638 \u0625\u062C\u0627\u0628\u0627\u062A\u0643. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",resumeRestored:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643. \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0647\u0646\u0627.",resumeFresh:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643.",resumeTimeLeft:"\u0627\u0633\u062A\u0645\u0631\u0651 \u0627\u0644\u0645\u0624\u0642\u0651\u062A: \u062A\u0628\u0642\u0651\u0649 {minutes} \u062F\u0642\u064A\u0642\u0629.",close:"\u0625\u063A\u0644\u0627\u0642"},jr={en:hd,fr:gd,ar:bd};function yd(e,r,t){let o=(jr[e]??jr.en)[r]??jr.en[r]??r;return t?Object.entries(t).reduce((a,[s,i])=>a.replace(`{${s}}`,String(i)),o):o}function ts(e,r){let t=new Intl.PluralRules(e).select(r),n=jr[e]??jr.en;return n[`points.${t}`]??n.points??jr.en.points}function ns(e){return(r,t)=>yd(e,r,t)}function to(e){return e==="ar"}var os="48rem";import"katex/dist/katex.min.css";_r(`.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}}
79
- `);import{Fragment as io,jsx as N,jsxs as W}from"react/jsx-runtime";var Cd="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 _d(e){for(let r of e.exercises)for(let t of r.questions)if((t.content.content??[]).some(o=>o.type==="aiAnswerInput"))return!0;return!1}function ms(e){let r=e;return typeof r.totalMaxScore=="number"?r.totalMaxScore:(r.answerKeys??[]).reduce((t,n)=>t+(n.scoring?.maxScore??0),0)}function ls(e){return e.questions.reduce((r,t)=>r+ms(t),0)}function sr(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var so=5;function ds({label:e}){return N("span",{className:"ms-0.5 text-[#d23b2b]",title:e,"aria-label":e,children:"*"})}function fs(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function ps({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 N("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:fs(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:N("path",{d:r})})}function Nd({score:e,weight:r,unit:t,t:n,hidden:o=!1}){if(e){if(e.awaiting)return W("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:[N(Br,{size:11}),n("pendingReview")]});let a=o?e.outcome:e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return o?N("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] px-2 py-1",children:N(ps,{outcome:a})}):W("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:[N(ps,{outcome:a}),W("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:fs(a)},children:[sr(e.s)," / ",sr(e.m)]})]})}return r>0&&!o?W("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[sr(r)," ",t(r)]}):null}function us(e){let r=0,t=0,n=!1,o=0,a=0;for(let i of e)r+=i.score??0,t+=i.maxScore??0,i.status==="awaiting_review"&&(n=!0),i.status==="correct"&&o++,(i.status==="correct"||i.status==="partial")&&a++;let s=e.length>0&&o===e.length?"full":a>0?"partial":"none";return{score:r,maxScore:t,awaiting:n,outcome:s}}function Ad({timeLimitMinutes:e,startedAt:r,onExpire:t}){let n=e*6e4,o=new Date(r).getTime()+n,[a,s]=Be(()=>Math.max(o-Date.now(),0)),i=ur(t);i.current=t,Xt(()=>{if(a<=0){i.current();return}let h=setInterval(()=>{let v=Math.max(o-Date.now(),0);s(v),v<=0&&(clearInterval(h),i.current())},1e3);return()=>clearInterval(h)},[o]);let c=a/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(a/1e3),m=Math.floor(d/3600),p=Math.floor(d%3600/60),g=d%60,u=m>0?`${m}:${String(p).padStart(2,"0")}:${String(g).padStart(2,"0")}`:`${p}:${String(g).padStart(2,"0")}`;return W("span",{className:ge("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:[N(Br,{size:12}),u]})}function ct({assessment:e,meta:r,scoreHidden:t=!1,isForm:n=!1,requiredQuestionIds:o,locale:a="en",branding:s,timeLimitMinutes:i,startedAt:c,initialAnswers:l,onAnswersChange:d,saveState:m,resumed:p=!1,onSubmit:g,review:u,onViewReport:h,reportLabel:v,onBack:R,backLabel:w,allowReset:C,onReset:y,overlayConfig:S,contained:k=!1,layout:_,onClose:P,mediaHandler:z,onAddAnnex:b,fallbackLogoUrl:T}){let f=Ee(()=>ns(a),[a]),q=Ue($=>ts(a,$),[a]),A=to(a)?"rtl":"ltr",L=ur(null),Q=ur(null);Xt(()=>{let $=Q.current,ne=L.current;if(!$||!ne||typeof ResizeObserver>"u")return;let ke=()=>ne.style.setProperty("--edp-bar",`${$.offsetHeight}px`);ke();let cr=new ResizeObserver(ke);return cr.observe($),()=>cr.disconnect()},[]);let B=_?.maxWidth??os,H=s?.branding?.primaryColor,X=s?.branding?.accentColor,pe=s?.branding?.fontFamily,ye=s?.branding?.fontUrl,E=s?.branding?.showPoweredBy!==!1;Xt(()=>{if(!ye||typeof document>"u"||document.querySelector(`link[href="${ye}"]`))return;let ne=document.createElement("link");ne.rel="stylesheet",ne.href=ye,document.head.appendChild(ne)},[ye]);let[x,j]=Be(()=>u?.answers??l??{exerciseAnswers:[]}),[F]=Be(()=>u?new Map:ro(l)),D=Ee(()=>es(e),[e]),re=ur(d);re.current=d;let[ae]=Be(()=>(u?u.answers:l)?.mediaPlays),ie=ur(ae),ce=Ue($=>ie.current&&Object.keys(ie.current).length>0?{...$,mediaPlays:ie.current}:$,[]),U=ur(x);U.current=x;let K=ur(!1),de=Ue($=>{let ne=ce(rs($,F,D));j(ne),re.current?.(ne)},[F,D,ce]),te=Ue($=>{if(ie.current=$,u||K.current)return;let ne=ce(U.current);j(ne),re.current?.(ne)},[u,ce]),[ee,le]=Be(null);Xt(()=>{le(Date.now())},[]);let[ze,He]=Be(p&&!u),O=Ee(()=>{if(ee===null||!i||i<=0||!c)return null;let $=new Date(c).getTime()+i*6e4-ee;return $>0?Math.max(1,Math.floor($/6e4)):null},[ee,i,c]),[Y,Z]=Be(!1),[me,Te]=Be(!1),[G,qr]=Be(u?.result??null);K.current=G!==null;let Wr=Ee(()=>ro(u?.answers),[u]),[Ur,mr]=Be(null),[Hr,ir]=Be(!1),fr=ur(!1),lt=Ee(()=>_d(e),[e]),mo=Ee(()=>me?Jn(e,x):[],[me,e,x]),Vr=mo.length,Jt=Ue($=>{Te(!1);let ne=L.current?.querySelectorAll(`[data-question-id="${CSS.escape($)}"]`),ke=Array.from(ne??[]).find(cr=>cr.getClientRects().length>0);ke&&requestAnimationFrame(()=>ke.scrollIntoView({block:"start",behavior:"smooth"}))},[]),Zt=(o??[]).join(" "),hr=Ee(()=>new Set(Zt?Zt.split(" "):[]),[Zt]),[fo,Rs]=Be(!1),en=Ee(()=>fo?Zn(e,x,hr).map($=>$.questionId).join(" "):"",[fo,e,x,hr]),ho=Ee(()=>new Set(en?en.split(" "):[]),[en]),Ss=Ue(()=>{let $=Zn(e,x,hr);if($.length===0){Te(!0);return}Rs(!0),Jt($[0].questionId)},[e,x,hr,Jt]),rn=Ee(()=>e.exercises.reduce(($,ne)=>$+ls(ne),0),[e]),tn=Ee(()=>G?Yn(G.exerciseFeedback):void 0,[G]),go=Ee(()=>{let $=new Map;for(let ne of G?.exerciseFeedback??[])for(let ke of ne.questions)ke.explanation&&$.set(ke.questionId,ke);return $},[G]),dt=t||G?.scoreHidden===!0,bo=Ee(()=>{if(!G)return{};let $={};for(let ne of G.exerciseFeedback)$[ne.exerciseId]=us(ne.questions.flatMap(ke=>ke.nodeResults));return $},[G]),yo=Ee(()=>{if(!G)return{};let $={};for(let ne of G.exerciseFeedback)for(let ke of ne.questions)ke.nodeResults.length>0&&($[ke.questionId]=us(ke.nodeResults));return $},[G]),Cs=Ue(async()=>{Z(!0),mr(null);try{let $=await g(x);qr($),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch($){mr($ instanceof Error?$.message==="required_unanswered"?f("requiredBlocked"):$.message:f("confirmCancel"))}finally{Z(!1),Te(!1)}},[x,g,f]),pt=Ue(()=>{!G||!h||h(G)},[G,h]),_s=Ue(()=>{fr.current||Y||G||(fr.current=!0,ir(!0),Te(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{Z(!0),mr(null),g(x).then($=>{qr($),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch($=>{mr($ instanceof Error?$.message:"submit_error")}).finally(()=>{Z(!1),ir(!1)})},800))},[x,Y,g,G]),nn=Ue(($,ne,ke)=>{let cr=ls($),Ve=bo[$.id],xo=$.questions.length>1,As=ss(ne)?as(ne,{renderQuestion:(ft,sn,Es)=>{let Qe=ft.id,vo=F.get(Qe),wo={...z?{mediaHandler:z}:{},...u?{initialAnswers:Wr.get(Qe)??[],readOnly:!0}:vo?{initialAnswers:vo}:{},...G!==null?{readOnly:!0}:{}},ko=Object.keys(wo).length>0&&ss(sn)?as(sn,wo):sn,Ps=hr.has(Qe),Ro=ho.has(Qe)?W("p",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-sm font-medium text-[#a32b1e]",children:[N(kd,{size:14,className:"flex-shrink-0"}),f("requiredMissing")]}):null,cn=go.get(Qe),So=cn?.explanation?N(Xa,{content:cn.explanation,nodeResults:cn.nodeResults,label:f("explanation")}):null;if(!xo)return W("div",{"data-question-id":Qe,children:[ko,Ro,So]},Qe);let Qr=yo[Qe],Ts=ms(ft);return W("div",{"data-question-id":Qe,children:[W("div",{className:"flex items-center gap-2.5 mb-3",children:[W("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:[f("question",{index:Es+1}),Ps&&N(ds,{label:f("required")})]}),N(Nd,{hidden:dt,score:Qr?{s:Qr.score,m:Qr.maxScore,awaiting:Qr.awaiting,outcome:Qr.outcome}:null,weight:Ts,unit:q,t:f})]}),ko,Ro,So]},Qe)},renderSeparator:ft=>N("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${ft}`)}):ne;return W("div",{"data-exercise-id":$.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[W("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:X?{backgroundColor:X}:void 0,children:[W("span",{dir:"auto",className:"min-w-0 text-sm font-bold text-[#1d2025] [overflow-wrap:anywhere]",children:[Nr(f,$.title,ke),!xo&&$.questions[0]&&hr.has($.questions[0].id)&&N(ds,{label:f("required")})]}),dt?null:Ve?.awaiting?W("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:[N(Br,{size:11}),f("pendingReview")]}):Ve?W("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:Ve.maxScore>0&&Ve.score>=Ve.maxScore?"#1f8a4c":Ve.maxScore>0&&Ve.score>0?"#c8810e":Ve.maxScore>0?"#d23b2b":"#8d93a0"},children:[sr(Ve.score)," / ",sr(Ve.maxScore)]}):cr>0?W("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",sr(cr)," ",q(cr)]}):null]}),N("div",{className:"p-4",children:As})]},$.id)},[f,q,bo,yo,X,z,u,Wr,F,go,dt,hr,ho,G]),Ns=Ee(()=>Gn(e).length>0,[e]),on=Ue($=>W("div",{className:"flex items-center gap-3 py-2",children:[N("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),N("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:Nr(f,e.exercises[$+1]?.title,$+1)}),N("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${$}`),[f,e]),an=E?N("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:f("poweredBy")}):null,qe=G!==null,gr=n||G?.isForm===!0,ut=G?.showVerdict!==!1,mt=ut?G?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return N(xt,{initial:ae,onChange:te,children:N("div",{className:"edpire-scope",style:{display:"contents"},children:W("div",{ref:L,dir:A,className:ge("flex flex-col [--edp-bar:0px] [&_[data-exercise-id]]:scroll-mt-[calc(var(--edp-bar)+0.75rem)] [&_[data-question-id]]:scroll-mt-[calc(var(--edp-bar)+0.75rem)]",k?"h-full":"min-h-dvh"),style:pe?{fontFamily:pe}:void 0,children:[N(qa,{visible:Y&&!Hr&&!gr,hasAiNodes:lt,text:f("evaluating"),aiText:f("aiEvaluating"),contained:k,...S}),Hr&&W("div",{className:ge("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",k&&"absolute"),children:[N(Br,{size:40,className:"text-red-300"}),N("p",{className:"text-xl font-black text-white tracking-tight",children:f("timeUp.title")}),N("p",{className:"text-sm text-red-200",children:f("timeUp.submitting")})]}),W("div",{ref:Q,className:"sticky top-0 z-10 flex-shrink-0 flex items-center justify-between gap-2 px-4 py-2.5 border-b border-[#e7e5e0] bg-[#fbfaf7]",style:X?{backgroundColor:X}:void 0,children:[W("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[N("img",{src:s?.logoUrl??T??Cd,alt:s?.name??"Edpire",width:24,height:24,loading:"lazy",className:"flex-none rounded object-contain"}),W("div",{className:"min-w-0",children:[N("h1",{dir:"auto",title:r.title,className:"line-clamp-2 text-sm font-bold leading-snug text-[#1d2025] [overflow-wrap:anywhere]",children:r.title}),N("p",{className:"text-[11px] text-[#8d93a0]",children:rn>0&&!dt&&W("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",sr(rn)," ",q(rn)]})})]}),!qe&&ee!==null&&i&&i>0&&c&&N(Ad,{timeLimitMinutes:i,startedAt:c,onExpire:_s}),!qe&&(m==="saving"||m==="saved")&&W("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[m==="saved"?N(Rd,{size:12}):N(no,{size:12,className:"animate-spin"}),f(m==="saved"?"answersSaved":"answersSaving")]})]}),W("div",{className:"flex flex-none items-center gap-2",children:[C&&W("button",{onClick:y,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[N(vd,{size:13}),f("reset")]}),(!qe||u)&&R&&W("button",{onClick:R,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:[N(ao,{size:13}),w??f("back")]}),P&&N("button",{onClick:P,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:N(ao,{size:15})}),!qe&&N("button",{onClick:Ss,disabled:Y,style:H?{backgroundColor:H}: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:Y?W(io,{children:[N(no,{size:14,className:"animate-spin"}),f(gr?"formSending":"submitting")]}):W(io,{children:[N(is,{size:14}),N("span",{className:"sm:hidden",children:f(gr?"formSubmit":"confirmSubmit")}),N("span",{className:"hidden sm:inline",children:f(gr?"formSubmit":"submit")})]})})]})]}),Ur&&N("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:Ur}),!qe&&m==="failed"&&W("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:[N(Sd,{size:15,className:"flex-shrink-0"}),f("answersNotSaved")]}),!qe&&ze&&(F.size>0||O!==null)&&W("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:[O!==null&&N(Br,{size:15,className:"flex-shrink-0 text-[#565b66]"}),W("span",{className:"flex-1 min-w-0",children:[F.size>0?f("resumeRestored"):f("resumeFresh"),O!==null&&W(io,{children:[" ",f("resumeTimeLeft",{minutes:O})]})]}),N("button",{type:"button",onClick:()=>He(!1),"aria-label":f("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:N(ao,{size:14})})]}),qe&&G?.isForm?N(Ja,{t:f,rtl:to(a),showClose:!k,onContinue:h&&G.returnUrl?pt:void 0,continueLabel:v,primaryColor:H}):qe&&G&&(G.awaitingManualGrading?N("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:N("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:B},children:W("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[W("div",{className:"flex items-center gap-2",children:[N(Br,{size:20,className:"text-[#c8810e] flex-shrink-0"}),N("span",{className:"text-sm font-semibold text-[#8a5a08]",children:G.aiPending?f("beingMarked"):f("awaitingReview")})]}),N("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),N("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:G.aiPending?f("beingMarkedDesc"):f("awaitingReviewDesc")}),h&&W("button",{onClick:pt,style:H?{backgroundColor:H}: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:[N(oo,{size:14}),v??f("viewFullReport")]})]})})}):G.scoreHidden?N("div",{className:"flex-shrink-0 border-b bg-[#f5f4f1] border-[#e7e5e0]",children:N("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:B},children:W("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[W("div",{className:"flex items-center gap-2",children:[N(cs,{size:20,className:"text-[#1d2025] flex-shrink-0"}),N("span",{className:"text-sm font-semibold text-[#1d2025]",children:f("submittedNoScore")})]}),N("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),N("p",{className:"text-sm text-[#565b66] flex-1 min-w-0",children:f("submittedNoScoreDesc")}),h&&W("button",{onClick:pt,style:H?{backgroundColor:H}: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:[N(oo,{size:14}),v??f("viewFullReport")]})]})})}):N("div",{className:ge("flex-shrink-0 border-b",ut?G.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:N("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:B},children:W("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[W("div",{className:"flex items-center gap-2",children:[ut?G.passed?N(cs,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):N(xd,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,N("span",{className:"text-sm font-semibold",style:{color:mt},children:ut?G.passed?f("assessmentPassed"):f("assessmentNotPassed"):f("yourScore")})]}),N("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),W("div",{className:"flex items-baseline gap-1.5",children:[W("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:mt},children:[sr(G.totalScore)," / ",sr(G.maxScore)]}),N("span",{className:"text-sm text-[#8d93a0] font-medium",children:q(G.maxScore)})]}),W("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[N("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:N("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${G.percentage}%`,backgroundColor:mt}})}),W("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:mt},children:[G.percentage,"%"]})]}),h&&W("button",{onClick:pt,style:H?{backgroundColor:H}: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:[N(oo,{size:14}),v??f("viewFullReport")]})]})})})),N("div",{className:ge("flex-1 flex flex-col",k&&"overflow-hidden",Hr&&"pointer-events-none opacity-60",G?.isForm&&"hidden"),children:e.annex||Ns?N(Qa,{assessment:e,isSubmitted:qe,setAnswers:de,validationFeedback:tn,renderExercise:nn,renderSeparator:on,primaryColor:H,contained:k,locale:a,contentMaxWidth:B,t:f,footer:an}):b?N(Ya,{assessment:e,isSubmitted:qe,setAnswers:de,validationFeedback:tn,renderExercise:nn,renderSeparator:on,primaryColor:H,contained:k,locale:a,contentMaxWidth:B,t:f,onAddAnnex:b,footer:an}):N("div",{className:ge("flex-1",k&&"overflow-y-auto"),children:W("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:B},children:[N(pr,{assessment:e,onAnswersChange:qe?void 0:de,validationFeedback:tn,renderExercise:nn,renderSeparator:on,locale:a}),an]})})}),me&&N("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:W("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edpire-submit-confirm-title",className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[N("h3",{id:"edpire-submit-confirm-title",className:"text-base font-bold text-[#1d2025] mb-2",children:f(gr?"formConfirmTitle":"confirmTitle")}),Vr>0&&W("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[W("p",{className:"flex items-start gap-2 font-semibold",children:[N(wd,{size:15,className:"flex-shrink-0 mt-px"}),N("span",{children:Vr===1?f("unansweredOne"):f("unansweredMany",{count:Vr})})]}),W("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[mo.slice(0,so).map($=>N("li",{children:N("button",{type:"button",onClick:()=>Jt($.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:$.only?Nr(f,$.exerciseTitle,$.exerciseIndex):`${Nr(f,$.exerciseTitle,$.exerciseIndex)} \xB7 ${f("question",{index:$.questionIndex+1})}`})},$.questionId)),Vr>so&&N("li",{children:f("unansweredMore",{count:Vr-so})})]})]}),N("p",{className:"text-sm text-[#565b66] mb-5",children:f(gr?"formConfirmDescription":"confirmDescription")}),W("div",{className:"flex gap-3 justify-end",children:[N("button",{onClick:()=>Te(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:f("confirmCancel")}),W("button",{onClick:Cs,disabled:Y,style:H?{backgroundColor:H}: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:[Y?N(no,{size:14,className:"animate-spin"}):N(is,{size:14}),f(gr?"formSubmit":"confirmSubmit")]})]})]})})]})})})}function co(e){return(e??[]).map(r=>({exerciseId:r.exercise_id,questions:r.questions.map(t=>({questionId:t.question_id,...t.explanation?{explanation:t.explanation}:{},nodeResults:t.node_results.map(n=>({nodeId:n.node_id,status:n.status,...n.score!==void 0?{score:n.score}:{},...n.max_score!==void 0?{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 Td}from"react/jsx-runtime";function lo(e,r){let t=co(e.exercise_feedback);return{submissionId:e.submission_id,totalScore:e.score??0,maxScore:e.max_score??0,percentage:e.percentage??0,passed:e.passed??!1,...e.score_hidden?{scoreHidden:!0}:{},returnUrl:r??null,exerciseFeedback:t,awaitingManualGrading:e.awaiting_manual_grading??!1,aiPending:e.ai_pending??!1}}function po(e){return{annex:e.annex??void 0,exercises:e.exercises.map(r=>({id:r.id,...r.title?{title:r.title}:{},sharedContext:r.sharedContext,questions:r.questions.map(t=>({id:t.id,version:"1.0",content:t.content,answerKeys:[]}))}))}}function gs({token:e,data:r,baseUrl:t,options:n}){let{locale:o,branding:a,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:d,layout:m,mediaHandler:p,onComplete:g,onError:u}=n,h=a??r.branding??void 0,v=o??r.meta.language??"en",R=Ed(()=>po(r.assessment),[r]),[w]=Pd(()=>new Date().toISOString()),C=hs(async S=>{let k=await fetch(`${t}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:S})});if(!k.ok){let P=await k.json().catch(()=>({}));if(k.status===422&&P.code==="required_unanswered")throw new Error("required_unanswered");let z=typeof P.error=="string"?P.error:"Submission failed",b=k.status===401?"TOKEN_INVALID":k.status===409?"TOKEN_USED":k.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw u?.({code:b,message:z}),new Error(z)}let _=await k.json();return g?.(_),lo(_,s)},[t,e,g,u,s]),y=hs(S=>{if(s)try{let k=new URL(s);k.searchParams.set("submission_id",S.submissionId),!S.awaitingManualGrading&&!S.scoreHidden&&(k.searchParams.set("score",String(S.totalScore)),k.searchParams.set("max_score",String(S.maxScore))),window.location.href=k.toString()}catch{window.location.href=s}},[s]);return Td(ct,{assessment:R,meta:{title:r.meta.title,category:r.meta.category??null},locale:v,branding:h,scoreHidden:r.meta.score_hidden===!0,requiredQuestionIds:r.meta.required_question_ids,timeLimitMinutes:r.meta.settings.time_limit_minutes,startedAt:w,onSubmit:C,onViewReport:s?y:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:d,layout:m,mediaHandler:p})}import{useMemo as bs}from"react";import{jsx as Ld}from"react/jsx-runtime";function Md(){return Promise.reject(new Error("A review cannot be submitted"))}function ys({review:e,locale:r,branding:t,layout:n,onBack:o,backLabel:a}){let s=bs(()=>po(e.assessment),[e]),i=bs(()=>({answers:e.answers,result:lo({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,score_hidden:e.submission.score_hidden,exercise_feedback:e.exercise_feedback})}),[e]),c=r??e.meta.language??"en";return Ld(ct,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:t??e.branding??void 0,review:i,scoreHidden:e.submission.score_hidden===!0,onSubmit:Md,onBack:o,backLabel:a,layout:n})}import Ob from"react";import{createRoot as Bb}from"react-dom/client";var Id="https://edpire.com";function ws(e,r,t){e.textContent="";let n=document.createElement("div");n.style.cssText="padding:32px;text-align:center;color:#dc2626;font-family:sans-serif";let o=document.createElement("div");if(o.textContent=r,n.appendChild(o),t){let a=document.createElement("div");a.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",a.textContent=t,n.appendChild(a)}e.appendChild(n)}var ks={mount(e){let{token:r,container:t,baseUrl:n=Id,onError:o}=e,a=typeof t=="string"?document.querySelector(t):t;if(!a){let l={code:"UNKNOWN",message:`Container not found: ${t}`};return o?.(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()=>{a.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 m=await d.json().catch(()=>({})),p=typeof m.error=="string"?m.error:"Failed to load assessment",g=d.status===401?"TOKEN_INVALID":d.status===403?"ORIGIN_NOT_ALLOWED":d.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";o?.({code:g,message:p});let u=g==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";ws(a,p,u);return}l=await d.json()}catch{o?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),ws(a,"Failed to connect to Edpire. Please try again.","");return}i||(a.innerHTML="",s=vs(a),s.render(xs.createElement(gs,{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 o=vs(n);return o.render(xs.createElement(ys,t)),{unmount(){let a=o;o=null,setTimeout(()=>a?.unmount(),0)}}}};import{jsx as Dd}from"react/jsx-runtime";function zd({tokenEndpoint:e,assessmentId:r,tokenBody:t,className:n,style:o,onComplete:a,onError:s,...i}){let c=uo(null),l=uo(a);l.current=a;let d=uo(s);return d.current=s,$d(()=>{let m=c.current;if(!m)return;let p=!1,g=null;return(async()=>{let u;try{let h=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assessmentId:r,...t})});if(p)return;if(!h.ok){let R=await h.json().catch(()=>({}));d.current?.({code:"TOKEN_INVALID",message:typeof R.error=="string"?R.error:`Token endpoint returned ${h.status}`});return}let v=await h.json();if(!v.token){d.current?.({code:"TOKEN_INVALID",message:"Token endpoint did not return a token"});return}u=v.token}catch{p||d.current?.({code:"NETWORK_ERROR",message:"Failed to fetch embed token"});return}p||(g=ks.mount({token:u,container:m,...i,onComplete:h=>l.current?.(h),onError:h=>d.current?.(h)}))})(),()=>{p=!0,g?.unmount()}},[e,r]),Dd("div",{ref:c,className:n,style:n?void 0:o??{width:"100%"}})}export{ct as AssessmentShell,zd as EdpireAssessmentPlayer,Ba as EdpireQuestion};
83
+ `;var am=new Set(["choiceSet","inlineChoiceSet","blank","aiAnswerInput","matchingSet","openResponseNode","mathResponse","codingResponse"]),sm=new Set(["blankPool","inlinePool"]);function im(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 t=e.answer;return t.recording||t.files&&t.files.length>0?!0:(t.text?.wordCount??0)>0}case"mathResponse":return e.answer.latex.trim().length>0;case"codingResponse":return e.answer.source.trim().length>0;default:{let t=e;return!0}}}function cm(e){let t=0,r=n=>{if(Array.isArray(n)){for(let s of n)r(s);return}if(!n||typeof n!="object")return;let{type:o,content:a}=n;if(typeof o=="string"){if(am.has(o)){t+=1;return}if(sm.has(o))return}a!==void 0&&r(a)};return r(e),t}function ua(e,t){let r=new Map;for(let o of t?.exerciseAnswers??[])for(let a of o.questionAnswers){let s=r.get(a.questionId);s||(s=new Set,r.set(a.questionId,s));for(let i of a.answers)im(i)&&s.add(i.nodeId)}let n=[];return e.exercises.forEach((o,a)=>{o.questions.forEach((s,i)=>{let c=cm(s.content);c!==0&&(r.get(s.id)?.size??0)<c&&n.push({questionId:s.id,exerciseIndex:a,...o.title?{exerciseTitle:o.title}:{},questionIndex:i,only:o.questions.length===1})})}),n}function ma(e,t,r){let n=new Set(r);return n.size===0?[]:ua(e,t).filter(o=>n.has(o.questionId))}function ha(e){let t=new Map;for(let r of e?.exerciseAnswers??[])for(let n of r.questionAnswers)t.set(n.questionId,n.answers);return t}function Xi(e){let t=new Set,r=n=>{if(Array.isArray(n)){for(let c of n)r(c);return}if(!n||typeof n!="object")return;let{type:o,id:a,attrs:s,content:i}=n;if(o==="openResponseNode"){let{mode:c,allowFormatting:l}=s??{};typeof a=="string"&&(c==="text"||c==="text+file")&&!l&&t.add(a);return}i!==void 0&&r(i)};for(let n of e.exercises)for(let o of n.questions)r(o.content);return t}function fa(e){if(Array.isArray(e))return e.some(fa);if(!e||typeof e!="object")return!1;let{text:t,content:r}=e;return typeof t=="string"||r!==void 0&&fa(r)}function Yi(e,t){if(e.type!=="openResponse"||!t.has(e.nodeId))return!1;let r=e.answer.text;return r!==void 0&&!fa(r.content)}function Ji(e,t,r){return t.size===0?e:{...e,exerciseAnswers:e.exerciseAnswers.map(n=>({...n,questionAnswers:n.questionAnswers.map(o=>{let a=t.get(o.questionId);return a?o.answers.length===0?{...o,answers:a}:o.answers.some(s=>Yi(s,r))?{...o,answers:o.answers.map(s=>{let i=s;if(i.type!=="openResponse"||!Yi(i,r))return s;let c=a.find(p=>p.nodeId===i.nodeId&&p.type==="openResponse"),l=c?.type==="openResponse"?c.answer.text:void 0;return l?{...i,answer:{...i.answer,text:l}}:s})}:o:o})}))}}var lm={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.",submittedNoScore:"Your answers are in",submittedNoScoreDesc:"No score on this one: see below what you got right and what to look at again.",formThanks:"Thank you!",formThanksDesc:"Your answers have been sent.",formThanksClose:"You can close this page.",formSubmit:"Send",formSending:"Sending\u2026",formConfirmTitle:"Send your answers?",formConfirmDescription:"You won't be able to change them after sending.",required:"Required",requiredMissing:"This question is required",requiredBlocked:"A required question is unanswered: answer it, then send again.",continue:"Continue",beingMarked:"Being marked",beingMarkedDesc:"Some answers are still being marked. Your final score will be available once every answer is marked.",pendingReview:"Pending review",viewFullReport:"View Full Report",explanation:"Explanation",reportGrade:"Report a marking mistake",reportGradePrompt:"What do you think is wrong with this mark?",reportGradeSend:"Send to my teacher",reportGradeCancel:"Cancel",reportGradeSent:"Sent to your teacher.",reportGradeFailed:"It could not be sent. Try again.",poweredBy:"Powered by Edpire",evaluating:"Evaluating your answers\u2026",aiEvaluating:"Some answers are being reviewed by AI, this may take a few seconds.",reset:"Reset",back:"Back",annexDocuments:"Documents",annexEmptyTitle:"No reference yet",annexEmptyBody:"A text, figure, table or document that stays in view across the whole assessment while students answer.",annexEmptyCta:"Add reference",annexEmptyDismiss:"Hide","timeUp.title":"Time's up","timeUp.submitting":"Submitting your answers\u2026",yourScore:"Your score",answersSaving:"Saving\u2026",answersSaved:"Answers saved",answersNotSaved:"Your answers aren't being saved. Check your connection.",resumeRestored:"Welcome back. Your answers are here.",resumeFresh:"Welcome back.",resumeTimeLeft:"The clock kept running: {minutes} min left.",close:"Close"},dm={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.",submittedNoScore:"Vos r\xE9ponses sont envoy\xE9es",submittedNoScoreDesc:"Pas de note pour celle-ci : voyez ci-dessous ce qui est juste et ce qu'il faut revoir.",formThanks:"Merci !",formThanksDesc:"Vos r\xE9ponses ont bien \xE9t\xE9 envoy\xE9es.",formThanksClose:"Vous pouvez fermer cette page.",formSubmit:"Envoyer",formSending:"Envoi\u2026",formConfirmTitle:"Envoyer vos r\xE9ponses ?",formConfirmDescription:"Vous ne pourrez plus les modifier ensuite.",required:"Obligatoire",requiredMissing:"R\xE9ponse obligatoire",requiredBlocked:"Une question obligatoire est sans r\xE9ponse : r\xE9pondez-y, puis envoyez \xE0 nouveau.",continue:"Continuer",beingMarked:"Correction en cours",beingMarkedDesc:"Certaines r\xE9ponses sont encore en cours de correction. Votre note finale sera disponible d\xE8s que toutes les r\xE9ponses seront corrig\xE9es.",pendingReview:"En attente de correction",viewFullReport:"Voir le rapport complet",explanation:"Explication",reportGrade:"Signaler une erreur de correction",reportGradePrompt:"Qu'est-ce qui vous semble faux dans cette note ?",reportGradeSend:"Envoyer \xE0 mon enseignant",reportGradeCancel:"Annuler",reportGradeSent:"Envoy\xE9 \xE0 votre enseignant.",reportGradeFailed:"L'envoi a \xE9chou\xE9. R\xE9essayez.",poweredBy:"Propuls\xE9 par Edpire",evaluating:"\xC9valuation de vos r\xE9ponses\u2026",aiEvaluating:"Certaines r\xE9ponses sont examin\xE9es par l'IA, cela peut prendre quelques secondes.",reset:"R\xE9initialiser",back:"Retour",annexDocuments:"Documents",annexEmptyTitle:"Aucune annexe pour l'instant",annexEmptyBody:"Un texte, une figure, un tableau ou un document qui reste visible pour toute l'\xE9valuation pendant que les \xE9l\xE8ves r\xE9pondent.",annexEmptyCta:"Ajouter une annexe",annexEmptyDismiss:"Masquer","timeUp.title":"Temps \xE9coul\xE9","timeUp.submitting":"Envoi de vos r\xE9ponses\u2026",yourScore:"Votre score",answersSaving:"Enregistrement\u2026",answersSaved:"R\xE9ponses enregistr\xE9es",answersNotSaved:"Vos r\xE9ponses ne sont pas enregistr\xE9es. V\xE9rifiez votre connexion.",resumeRestored:"Bon retour. Vos r\xE9ponses sont l\xE0.",resumeFresh:"Bon retour.",resumeTimeLeft:"Le chrono a continu\xE9 : il reste {minutes} min.",close:"Fermer"},pm={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.",submittedNoScore:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643",submittedNoScoreDesc:"\u0644\u0627 \u0639\u0644\u0627\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062A\u0642\u064A\u064A\u0645: \u0627\u0646\u0638\u0631 \u0623\u062F\u0646\u0627\u0647 \u0645\u0627 \u0623\u062C\u0628\u062A \u0639\u0646\u0647 \u0628\u0634\u0643\u0644 \u0635\u062D\u064A\u062D \u0648\u0645\u0627 \u064A\u062C\u0628 \u0645\u0631\u0627\u062C\u0639\u062A\u0647.",formThanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643!",formThanksDesc:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643.",formThanksClose:"\u064A\u0645\u0643\u0646\u0643 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u0635\u0641\u062D\u0629.",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",formConfirmTitle:"\u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u061F",formConfirmDescription:"\u0644\u0646 \u062A\u062A\u0645\u0643\u0646 \u0645\u0646 \u062A\u0639\u062F\u064A\u0644\u0647\u0627 \u0628\u0639\u062F \u0627\u0644\u0625\u0631\u0633\u0627\u0644.",required:"\u0645\u0637\u0644\u0648\u0628",requiredMissing:"\u0647\u0630\u0627 \u0633\u0624\u0627\u0644 \u0645\u0637\u0644\u0648\u0628",requiredBlocked:"\u0633\u0624\u0627\u0644 \u0645\u0637\u0644\u0648\u0628 \u0628\u0644\u0627 \u0625\u062C\u0627\u0628\u0629: \u0623\u062C\u0628 \u0639\u0646\u0647 \u062B\u0645 \u0623\u0631\u0633\u0644 \u0645\u0646 \u062C\u062F\u064A\u062F.",continue:"\u0645\u062A\u0627\u0628\u0639\u0629",beingMarked:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",beingMarkedDesc:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0645\u0627 \u0632\u0627\u0644\u062A \u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D. \u0633\u062A\u0638\u0647\u0631 \u0639\u0644\u0627\u0645\u062A\u0643 \u0627\u0644\u0646\u0647\u0627\u0626\u064A\u0629 \u0628\u0639\u062F \u062A\u0635\u062D\u064A\u062D \u062C\u0645\u064A\u0639 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A.",pendingReview:"\u0642\u064A\u062F \u0627\u0644\u062A\u0635\u062D\u064A\u062D",viewFullReport:"\u0639\u0631\u0636 \u0627\u0644\u062A\u0642\u0631\u064A\u0631 \u0627\u0644\u0643\u0627\u0645\u0644",explanation:"\u0634\u0631\u062D",reportGrade:"\u0627\u0644\u0625\u0628\u0644\u0627\u063A \u0639\u0646 \u062E\u0637\u0623 \u0641\u064A \u0627\u0644\u062A\u0635\u062D\u064A\u062D",reportGradePrompt:"\u0645\u0627 \u0627\u0644\u0630\u064A \u062A\u0631\u0627\u0647 \u062E\u0627\u0637\u0626\u064B\u0627 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0639\u062F\u062F\u061F",reportGradeSend:"\u0625\u0631\u0633\u0627\u0644 \u0625\u0644\u0649 \u0623\u0633\u062A\u0627\u0630\u064A",reportGradeCancel:"\u0625\u0644\u063A\u0627\u0621",reportGradeSent:"\u0623\u064F\u0631\u0633\u0644 \u0625\u0644\u0649 \u0623\u0633\u062A\u0627\u0630\u0643.",reportGradeFailed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629.",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Edpire",evaluating:"\u062C\u0627\u0631\u064D \u062A\u0642\u064A\u064A\u0645 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",aiEvaluating:"\u0628\u0639\u0636 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0642\u064A\u062F \u0627\u0644\u0645\u0631\u0627\u062C\u0639\u0629 \u0628\u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A\u060C \u0642\u062F \u064A\u0633\u062A\u063A\u0631\u0642 \u0630\u0644\u0643 \u0628\u0636\u0639 \u062B\u0648\u0627\u0646\u064D.",reset:"\u0625\u0639\u0627\u062F\u0629 \u062A\u0639\u064A\u064A\u0646",back:"\u0631\u062C\u0648\u0639",annexDocuments:"\u0627\u0644\u0645\u0633\u062A\u0646\u062F\u0627\u062A",annexEmptyTitle:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u064F\u0644\u062D\u064E\u0642 \u0628\u0639\u062F",annexEmptyBody:"\u0646\u0635 \u0623\u0648 \u0635\u0648\u0631\u0629 \u0623\u0648 \u062C\u062F\u0648\u0644 \u0623\u0648 \u0645\u0633\u062A\u0646\u062F \u064A\u0628\u0642\u0649 \u0638\u0627\u0647\u0631\u064B\u0627 \u0637\u0648\u0627\u0644 \u0627\u0644\u062A\u0642\u064A\u064A\u0645 \u0623\u062B\u0646\u0627\u0621 \u0625\u062C\u0627\u0628\u0629 \u0627\u0644\u0637\u0644\u0627\u0628.",annexEmptyCta:"\u0625\u0636\u0627\u0641\u0629 \u0645\u064F\u0644\u062D\u064E\u0642",annexEmptyDismiss:"\u0625\u062E\u0641\u0627\u0621","timeUp.title":"\u0627\u0646\u062A\u0647\u0649 \u0627\u0644\u0648\u0642\u062A","timeUp.submitting":"\u062C\u0627\u0631\u064D \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643\u2026",yourScore:"\u0646\u062A\u064A\u062C\u062A\u0643",answersSaving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",answersSaved:"\u062A\u0645 \u062D\u0641\u0638 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",answersNotSaved:"\u0644\u0627 \u064A\u062A\u0645 \u062D\u0641\u0638 \u0625\u062C\u0627\u0628\u0627\u062A\u0643. \u062A\u062D\u0642\u0651\u0642 \u0645\u0646 \u0627\u062A\u0635\u0627\u0644\u0643.",resumeRestored:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643. \u0625\u062C\u0627\u0628\u0627\u062A\u0643 \u0647\u0646\u0627.",resumeFresh:"\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0639\u0648\u062F\u062A\u0643.",resumeTimeLeft:"\u0627\u0633\u062A\u0645\u0631\u0651 \u0627\u0644\u0645\u0624\u0642\u0651\u062A: \u062A\u0628\u0642\u0651\u0649 {minutes} \u062F\u0642\u064A\u0642\u0629.",close:"\u0625\u063A\u0644\u0627\u0642"},nr={en:lm,fr:dm,ar:pm};function um(e,t,r){let o=(nr[e]??nr.en)[t]??nr.en[t]??t;return r?Object.entries(r).reduce((a,[s,i])=>a.replace(`{${s}}`,String(i)),o):o}function Zi(e,t){let r=new Intl.PluralRules(e).select(t),n=nr[e]??nr.en;return n[`points.${r}`]??n.points??nr.en.points}function ec(e){return(t,r)=>um(e,t,r)}function ga(e){return e==="ar"}var tc="48rem";import"katex/dist/katex.min.css";Dt(`.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}}
84
+ `);import{Fragment as wa,jsx as E,jsxs as K}from"react/jsx-runtime";var xm="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 vm(e){for(let t of e.exercises)for(let r of t.questions)if((r.content.content??[]).some(o=>o.type==="aiAnswerInput"))return!0;return!1}function dc(e){let t=e;return typeof t.totalMaxScore=="number"?t.totalMaxScore:(t.answerKeys??[]).reduce((r,n)=>r+(n.scoring?.maxScore??0),0)}function sc(e){return e.questions.reduce((t,r)=>t+dc(r),0)}function yt(e){return Number.isInteger(e)?String(e):parseFloat(e.toFixed(2)).toString()}var va=5;function ic({label:e}){return E("span",{className:"ms-0.5 text-[#d23b2b]",title:e,"aria-label":e,children:"*"})}function pc(e){return e==="full"?"#1f8a4c":e==="partial"?"#c8810e":"#d23b2b"}function cc({outcome:e}){let t=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 E("svg",{width:14,height:14,viewBox:"0 0 100 100",fill:"none",stroke:pc(e),strokeWidth:9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:E("path",{d:t})})}function wm({score:e,weight:t,unit:r,t:n,hidden:o=!1}){if(e){if(e.awaiting)return K("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:[E(or,{size:11}),n("pendingReview")]});let a=o?e.outcome:e.m>0&&e.s>=e.m?"full":e.s>0?"partial":"none";return o?E("span",{className:"inline-flex items-center rounded-lg border border-[#e7e5e0] bg-[#f5f4f1] px-2 py-1",children:E(cc,{outcome:a})}):K("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:[E(cc,{outcome:a}),K("span",{className:"font-bold leading-none",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.05rem",color:pc(a)},children:[yt(e.s)," / ",yt(e.m)]})]})}return t>0&&!o?K("span",{className:"text-xs font-semibold tabular-nums text-[#8d93a0]",children:[yt(t)," ",r(t)]}):null}function lc(e){let t=0,r=0,n=!1,o=0,a=0;for(let i of e)t+=i.score??0,r+=i.maxScore??0,i.status==="awaiting_review"&&(n=!0),i.status==="correct"&&o++,(i.status==="correct"||i.status==="partial")&&a++;let s=e.length>0&&o===e.length?"full":a>0?"partial":"none";return{score:t,maxScore:r,awaiting:n,outcome:s}}function km({timeLimitMinutes:e,startedAt:t,onExpire:r}){let n=e*6e4,o=new Date(t).getTime()+n,[a,s]=Ve(()=>Math.max(o-Date.now(),0)),i=_t(r);i.current=r,zn(()=>{if(a<=0){i.current();return}let u=setInterval(()=>{let v=Math.max(o-Date.now(),0);s(v),v<=0&&(clearInterval(u),i.current())},1e3);return()=>clearInterval(u)},[o]);let c=a/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]",p=Math.ceil(a/1e3),f=Math.floor(p/3600),m=Math.floor(p%3600/60),h=p%60,d=f>0?`${f}:${String(m).padStart(2,"0")}:${String(h).padStart(2,"0")}`:`${m}:${String(h).padStart(2,"0")}`;return K("span",{className:ye("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-xs font-bold tabular-nums transition-colors",l),children:[E(or,{size:12}),d]})}function Dr({assessment:e,meta:t,scoreHidden:r=!1,isForm:n=!1,requiredQuestionIds:o,locale:a="en",branding:s,timeLimitMinutes:i,startedAt:c,initialAnswers:l,onAnswersChange:p,saveState:f,resumed:m=!1,onSubmit:h,review:d,onViewReport:u,reportLabel:v,onBack:R,backLabel:S,allowReset:C,onReset:w,overlayConfig:N,contained:k=!1,layout:x,onClose:y,mediaHandler:T,answerSheetHandler:g,onReportGrade:P,onAddAnnex:A,fallbackLogoUrl:W}){let b=Le(()=>ec(a),[a]),M=Je(D=>Zi(a,D),[a]),$=ga(a)?"rtl":"ltr",B=_t(null),J=_t(null);zn(()=>{let D=J.current,se=B.current;if(!D||!se||typeof ResizeObserver>"u")return;let Se=()=>se.style.setProperty("--edp-bar",`${D.offsetHeight}px`);Se();let wt=new ResizeObserver(Se);return wt.observe(D),()=>wt.disconnect()},[]);let Q=x?.maxWidth??tc,Y=s?.branding?.primaryColor,ve=s?.branding?.accentColor,L=s?.branding?.fontFamily,_=s?.branding?.fontUrl,q=s?.branding?.showPoweredBy!==!1;zn(()=>{if(!_||typeof document>"u"||document.querySelector(`link[href="${_}"]`))return;let se=document.createElement("link");se.rel="stylesheet",se.href=_,document.head.appendChild(se)},[_]);let[z,O]=Ve(()=>d?.answers??l??{exerciseAnswers:[]}),[ne]=Ve(()=>d?new Map:ha(l)),ce=Le(()=>Xi(e),[e]),le=_t(p);le.current=p;let[ue]=Ve(()=>(d?d.answers:l)?.mediaPlays),U=_t(ue),X=Je(D=>U.current&&Object.keys(U.current).length>0?{...D,mediaPlays:U.current}:D,[]),me=_t(z);me.current=z;let ae=_t(!1),oe=Je(D=>{let se=X(Ji(D,ne,ce));O(se),le.current?.(se)},[ne,ce,X]),de=Je(D=>{if(U.current=D,d||ae.current)return;let se=X(me.current);O(se),le.current?.(se)},[d,X]),[Te,Ze]=Ve(null);zn(()=>{Ze(Date.now())},[]);let[H,ee]=Ve(m&&!d),te=Le(()=>{if(Te===null||!i||i<=0||!c)return null;let D=new Date(c).getTime()+i*6e4-Te;return D>0?Math.max(1,Math.floor(D/6e4)):null},[Te,i,c]),[pe,je]=Ve(!1),[ar,xt]=Ve(!1),[G,sr]=Ve(d?.result??null);ae.current=G!==null;let ir=Le(()=>ha(d?.answers),[d]),[Or,et]=Ve(null),[vt,cr]=Ve(!1),Na=_t(!1),kc=Le(()=>vm(e),[e]),_a=Le(()=>ar?ua(e,z):[],[ar,e,z]),lr=_a.length,Dn=Je(D=>{xt(!1);let se=B.current?.querySelectorAll(`[data-question-id="${CSS.escape(D)}"]`),Se=Array.from(se??[]).find(wt=>wt.getClientRects().length>0);Se&&requestAnimationFrame(()=>Se.scrollIntoView({block:"start",behavior:"smooth"}))},[]),On=(o??[]).join(" "),Pt=Le(()=>new Set(On?On.split(" "):[]),[On]),[Pa,Sc]=Ve(!1),jn=Le(()=>Pa?ma(e,z,Pt).map(D=>D.questionId).join(" "):"",[Pa,e,z,Pt]),Ta=Le(()=>new Set(jn?jn.split(" "):[]),[jn]),Rc=Je(()=>{let D=ma(e,z,Pt);if(D.length===0){xt(!0);return}Sc(!0),Dn(D[0].questionId)},[e,z,Pt,Dn]),Bn=Le(()=>e.exercises.reduce((D,se)=>D+sc(se),0),[e]),qn=Le(()=>G?la(G.exerciseFeedback):void 0,[G]),Ma=Le(()=>{let D=new Map;for(let se of G?.exerciseFeedback??[])for(let Se of se.questions)Se.explanation&&D.set(Se.questionId,Se);return D},[G]),jr=r||G?.scoreHidden===!0,Ea=Le(()=>{if(!G)return{};let D={};for(let se of G.exerciseFeedback)D[se.exerciseId]=lc(se.questions.flatMap(Se=>Se.nodeResults));return D},[G]),Hn=Le(()=>{if(!G)return{};let D={};for(let se of G.exerciseFeedback)for(let Se of se.questions)Se.nodeResults.length>0&&(D[Se.questionId]=lc(Se.nodeResults));return D},[G]),Cc=Je(async()=>{je(!0),et(null);try{let D=await h(z);sr(D),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}catch(D){et(D instanceof Error?D.message==="required_unanswered"?b("requiredBlocked"):D.message:b("confirmCancel"))}finally{je(!1),xt(!1)}},[z,h,b]),Br=Je(()=>{!G||!u||u(G)},[G,u]),Ac=Je(()=>{Na.current||pe||G||(Na.current=!0,cr(!0),xt(!1),typeof document<"u"&&document.activeElement?.blur(),setTimeout(()=>{je(!0),et(null),h(z).then(D=>{sr(D),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}).catch(D=>{et(D instanceof Error?D.message:"submit_error")}).finally(()=>{je(!1),cr(!1)})},800))},[z,pe,h,G]),Wn=Je((D,se,Se)=>{let wt=sc(D),tt=Ea[D.id],La=D.questions.length>1,_c=nc(se)?rc(se,{renderQuestion:(Wr,Vn,Pc)=>{let Be=Wr.id,Ia=ne.get(Be),$a={...T?{mediaHandler:T}:{},...g?{answerSheetHandler:g}:{},...d?{initialAnswers:ir.get(Be)??[],readOnly:!0}:Ia?{initialAnswers:Ia}:{},...G!==null?{readOnly:!0}:{}},Fa=Object.keys($a).length>0&&nc(Vn)?rc(Vn,$a):Vn,Tc=Pt.has(Be),za=Ta.has(Be)?K("p",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-sm font-medium text-[#a32b1e]",children:[E(gm,{size:14,className:"flex-shrink-0"}),b("requiredMissing")]}):null,Gn=Ma.get(Be),Da=Gn?.explanation?E(Ui,{content:Gn.explanation,nodeResults:Gn.nodeResults,label:b("explanation")}):null,Oa=Hn[Be],ja=G&&P&&Oa&&!Oa.awaiting?E(Gi,{questionId:Be,onReport:P,t:b}):null;if(!La)return K("div",{"data-question-id":Be,children:[Fa,za,Da,ja]},Be);let dr=Hn[Be],Mc=dc(Wr);return K("div",{"data-question-id":Be,children:[K("div",{className:"flex items-center gap-2.5 mb-3",children:[K("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:[b("question",{index:Pc+1}),Tc&&E(ic,{label:b("required")})]}),E(wm,{hidden:jr,score:dr?{s:dr.score,m:dr.maxScore,awaiting:dr.awaiting,outcome:dr.outcome}:null,weight:Mc,unit:M,t:b})]}),Fa,za,Da,ja]},Be)},renderSeparator:Wr=>E("div",{className:"border-t border-[#e7e5e0] my-1"},`qsep-${Wr}`)}):se;return K("div",{"data-exercise-id":D.id,className:"bg-white rounded-[14px] border border-[#e7e5e0] shadow-sm overflow-hidden",children:[K("div",{className:"flex items-center justify-between px-4 py-2.5 bg-[#f1efe9] border-b border-[#e7e5e0]",style:ve?{backgroundColor:ve}:void 0,children:[K("span",{dir:"auto",className:"min-w-0 text-sm font-bold text-[#1d2025] [overflow-wrap:anywhere]",children:[Ot(b,D.title,Se),!La&&D.questions[0]&&Pt.has(D.questions[0].id)&&E(ic,{label:b("required")})]}),jr?null:tt?.awaiting?K("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:[E(or,{size:11}),b("pendingReview")]}):tt?K("span",{className:"font-bold leading-none tabular-nums",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',fontSize:"1.15rem",color:tt.maxScore>0&&tt.score>=tt.maxScore?"#1f8a4c":tt.maxScore>0&&tt.score>0?"#c8810e":tt.maxScore>0?"#d23b2b":"#8d93a0"},children:[yt(tt.score)," / ",yt(tt.maxScore)]}):wt>0?K("span",{className:"text-xs font-semibold text-[#8d93a0] tabular-nums",children:["/ ",yt(wt)," ",M(wt)]}):null]}),E("div",{className:"p-4",children:_c})]},D.id)},[b,M,Ea,Hn,ve,T,g,P,d,ir,ne,Ma,jr,Pt,Ta,G]),Nc=Le(()=>ca(e).length>0,[e]),Un=Je(D=>K("div",{className:"flex items-center gap-3 py-2",children:[E("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"}),E("span",{className:"text-[10px] font-bold text-[#8d93a0] uppercase tracking-widest",children:Ot(b,e.exercises[D+1]?.title,D+1)}),E("div",{className:"flex-1 border-t border-dashed border-[#e7e5e0]"})]},`sep-${D}`),[b,e]),Kn=q?E("p",{className:"pt-2 pb-1 text-center text-xs text-[#8d93a0] select-none",children:b("poweredBy")}):null,Ge=G!==null,Tt=n||G?.isForm===!0,qr=G?.showVerdict!==!1,Hr=qr?G?.passed?"#1f8a4c":"#d23b2b":"#1d2025";return E(Qr,{initial:ue,onChange:de,children:E("div",{className:"edpire-scope",style:{display:"contents"},children:K("div",{ref:B,dir:$,className:ye("flex flex-col [--edp-bar:0px] [&_[data-exercise-id]]:scroll-mt-[calc(var(--edp-bar)+0.75rem)] [&_[data-question-id]]:scroll-mt-[calc(var(--edp-bar)+0.75rem)]",k?"h-full":"min-h-dvh"),style:L?{fontFamily:L}:void 0,children:[E(Fi,{visible:pe&&!vt&&!Tt,hasAiNodes:kc,text:b("evaluating"),aiText:b("aiEvaluating"),contained:k,...N}),vt&&K("div",{className:ye("fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-red-950/80 backdrop-blur-sm",k&&"absolute"),children:[E(or,{size:40,className:"text-red-300"}),E("p",{className:"text-xl font-black text-white tracking-tight",children:b("timeUp.title")}),E("p",{className:"text-sm text-red-200",children:b("timeUp.submitting")})]}),K("div",{ref:J,className:"sticky top-0 z-10 flex-shrink-0 flex items-center justify-between gap-2 px-4 py-2.5 border-b border-[#e7e5e0] bg-[#fbfaf7]",style:ve?{backgroundColor:ve}:void 0,children:[K("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[E("img",{src:s?.logoUrl??W??xm,alt:s?.name??"Edpire",width:24,height:24,loading:"lazy",className:"flex-none rounded object-contain"}),K("div",{className:"min-w-0",children:[E("h1",{dir:"auto",title:t.title,className:"line-clamp-2 text-sm font-bold leading-snug text-[#1d2025] [overflow-wrap:anywhere]",children:t.title}),E("p",{className:"text-[11px] text-[#8d93a0]",children:Bn>0&&!jr&&K("span",{className:"ms-2 font-semibold text-[#565b66]",children:["/ ",yt(Bn)," ",M(Bn)]})})]}),!Ge&&Te!==null&&i&&i>0&&c&&E(km,{timeLimitMinutes:i,startedAt:c,onExpire:Ac}),!Ge&&(f==="saving"||f==="saved")&&K("span",{role:"status",className:"hidden sm:inline-flex items-center gap-1 text-[11px] font-medium text-[#8d93a0]",children:[f==="saved"?E(bm,{size:12}):E(ba,{size:12,className:"animate-spin"}),b(f==="saved"?"answersSaved":"answersSaving")]})]}),K("div",{className:"flex flex-none items-center gap-2",children:[C&&K("button",{onClick:w,className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-[#565b66] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:[E(fm,{size:13}),b("reset")]}),(!Ge||d)&&R&&K("button",{onClick:R,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:[E(xa,{size:13}),S??b("back")]}),y&&E("button",{onClick:y,className:"p-1.5 text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#f1efe9] rounded-lg transition-colors",children:E(xa,{size:15})}),!Ge&&E("button",{onClick:Rc,disabled:pe,style:Y?{backgroundColor:Y}: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:pe?K(wa,{children:[E(ba,{size:14,className:"animate-spin"}),b(Tt?"formSending":"submitting")]}):K(wa,{children:[E(oc,{size:14}),E("span",{className:"sm:hidden",children:b(Tt?"formSubmit":"confirmSubmit")}),E("span",{className:"hidden sm:inline",children:b(Tt?"formSubmit":"submit")})]})})]})]}),Or&&E("div",{className:"flex-shrink-0 bg-[#fdeeec] border-b border-[#f6cfc9] px-4 py-2 text-sm text-[#a32b1e]",children:Or}),!Ge&&f==="failed"&&K("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:[E(ym,{size:15,className:"flex-shrink-0"}),b("answersNotSaved")]}),!Ge&&H&&(ne.size>0||te!==null)&&K("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:[te!==null&&E(or,{size:15,className:"flex-shrink-0 text-[#565b66]"}),K("span",{className:"flex-1 min-w-0",children:[ne.size>0?b("resumeRestored"):b("resumeFresh"),te!==null&&K(wa,{children:[" ",b("resumeTimeLeft",{minutes:te})]})]}),E("button",{type:"button",onClick:()=>ee(!1),"aria-label":b("close"),className:"flex-shrink-0 p-1 rounded-md text-[#8d93a0] hover:text-[#1d2025] hover:bg-[#e7e5e0] transition-colors",children:E(xa,{size:14})})]}),Ge&&G?.isForm?E(Qi,{t:b,rtl:ga(a),showClose:!k,onContinue:u&&G.returnUrl?Br:void 0,continueLabel:v,primaryColor:Y}):Ge&&G&&(G.awaitingManualGrading?E("div",{className:"flex-shrink-0 border-b bg-[#fbf1dc] border-[#f2e2bf]",children:E("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:Q},children:K("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[K("div",{className:"flex items-center gap-2",children:[E(or,{size:20,className:"text-[#c8810e] flex-shrink-0"}),E("span",{className:"text-sm font-semibold text-[#8a5a08]",children:G.aiPending?b("beingMarked"):b("awaitingReview")})]}),E("div",{className:"hidden sm:block w-px h-8 bg-[#f2e2bf]"}),E("p",{className:"text-sm text-[#8a5a08] flex-1 min-w-0",children:G.aiPending?b("beingMarkedDesc"):b("awaitingReviewDesc")}),u&&K("button",{onClick:Br,style:Y?{backgroundColor:Y}: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:[E(ya,{size:14}),v??b("viewFullReport")]})]})})}):G.scoreHidden?E("div",{className:"flex-shrink-0 border-b bg-[#f5f4f1] border-[#e7e5e0]",children:E("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:Q},children:K("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-4",children:[K("div",{className:"flex items-center gap-2",children:[E(ac,{size:20,className:"text-[#1d2025] flex-shrink-0"}),E("span",{className:"text-sm font-semibold text-[#1d2025]",children:b("submittedNoScore")})]}),E("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),E("p",{className:"text-sm text-[#565b66] flex-1 min-w-0",children:b("submittedNoScoreDesc")}),u&&K("button",{onClick:Br,style:Y?{backgroundColor:Y}: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:[E(ya,{size:14}),v??b("viewFullReport")]})]})})}):E("div",{className:ye("flex-shrink-0 border-b",qr?G.passed?"bg-[#ecf8f0] border-[#c5e8d1]":"bg-[#fdeeec] border-[#f6cfc9]":"bg-[#f5f4f1] border-[#e7e5e0]"),children:E("div",{className:"mx-auto px-4 py-3 sm:px-6 sm:py-4",style:{maxWidth:Q},children:K("div",{className:"flex flex-wrap sm:flex-nowrap items-center gap-x-4 gap-y-2",children:[K("div",{className:"flex items-center gap-2",children:[qr?G.passed?E(ac,{size:20,className:"text-[#1f8a4c] flex-shrink-0"}):E(mm,{size:20,className:"text-[#d23b2b] flex-shrink-0"}):null,E("span",{className:"text-sm font-semibold",style:{color:Hr},children:qr?G.passed?b("assessmentPassed"):b("assessmentNotPassed"):b("yourScore")})]}),E("div",{className:"hidden sm:block w-px h-8 bg-[#e7e5e0]"}),K("div",{className:"flex items-baseline gap-1.5",children:[K("span",{className:"leading-none tabular-nums text-[1.6rem] sm:text-[2rem]",style:{fontFamily:'var(--font-hand, "Caveat", cursive)',color:Hr},children:[yt(G.totalScore)," / ",yt(G.maxScore)]}),E("span",{className:"text-sm text-[#8d93a0] font-medium",children:M(G.maxScore)})]}),K("div",{className:"flex-1 flex items-center gap-3 min-w-[140px]",children:[E("div",{className:"flex-1 h-2 bg-[#e7e5e0] rounded-full overflow-hidden min-w-[80px]",children:E("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${G.percentage}%`,backgroundColor:Hr}})}),K("span",{className:"text-sm font-bold tabular-nums flex-shrink-0",style:{color:Hr},children:[G.percentage,"%"]})]}),u&&K("button",{onClick:Br,style:Y?{backgroundColor:Y}: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:[E(ya,{size:14}),v??b("viewFullReport")]})]})})})),E("div",{className:ye("flex-1 flex flex-col",k&&"overflow-hidden",vt&&"pointer-events-none opacity-60",G?.isForm&&"hidden"),children:e.annex||Nc?E(Bi,{assessment:e,isSubmitted:Ge,setAnswers:oe,validationFeedback:qn,renderExercise:Wn,renderSeparator:Un,primaryColor:Y,contained:k,locale:a,contentMaxWidth:Q,t:b,footer:Kn}):A?E(Hi,{assessment:e,isSubmitted:Ge,setAnswers:oe,validationFeedback:qn,renderExercise:Wn,renderSeparator:Un,primaryColor:Y,contained:k,locale:a,contentMaxWidth:Q,t:b,onAddAnnex:A,footer:Kn}):E("div",{className:ye("flex-1",k&&"overflow-y-auto"),children:K("div",{className:"mx-auto p-6 flex flex-col gap-4",style:{maxWidth:Q},children:[E(Nt,{assessment:e,onAnswersChange:Ge?void 0:oe,validationFeedback:qn,renderExercise:Wn,renderSeparator:Un,locale:a}),Kn]})})}),ar&&E("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:K("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edpire-submit-confirm-title",className:"bg-white rounded-[14px] shadow-xl p-6 max-w-sm mx-4",children:[E("h3",{id:"edpire-submit-confirm-title",className:"text-base font-bold text-[#1d2025] mb-2",children:b(Tt?"formConfirmTitle":"confirmTitle")}),lr>0&&K("div",{className:"text-sm text-[#8a5a08] bg-[#fbf1dc] border border-[#f2e2bf] rounded-lg px-3 py-2 mb-3",children:[K("p",{className:"flex items-start gap-2 font-semibold",children:[E(hm,{size:15,className:"flex-shrink-0 mt-px"}),E("span",{children:lr===1?b("unansweredOne"):b("unansweredMany",{count:lr})})]}),K("ul",{className:"mt-1 ps-[23px] flex flex-col gap-0.5",children:[_a.slice(0,va).map(D=>E("li",{children:E("button",{type:"button",onClick:()=>Dn(D.questionId),className:"text-start underline underline-offset-2 hover:text-[#1d2025] cursor-pointer",children:D.only?Ot(b,D.exerciseTitle,D.exerciseIndex):`${Ot(b,D.exerciseTitle,D.exerciseIndex)} \xB7 ${b("question",{index:D.questionIndex+1})}`})},D.questionId)),lr>va&&E("li",{children:b("unansweredMore",{count:lr-va})})]})]}),E("p",{className:"text-sm text-[#565b66] mb-5",children:b(Tt?"formConfirmDescription":"confirmDescription")}),K("div",{className:"flex gap-3 justify-end",children:[E("button",{onClick:()=>xt(!1),className:"px-4 py-2 text-sm font-medium text-[#565b66] hover:bg-[#f1efe9] rounded-lg transition-colors",children:b("confirmCancel")}),K("button",{onClick:Cc,disabled:pe,style:Y?{backgroundColor:Y}: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:[pe?E(ba,{size:14,className:"animate-spin"}):E(oc,{size:14}),b(Tt?"formSubmit":"confirmSubmit")]})]})]})})]})})})}function ka(e){return(e??[]).map(t=>({exerciseId:t.exercise_id,questions:t.questions.map(r=>({questionId:r.question_id,...r.explanation?{explanation:r.explanation}:{},nodeResults:r.node_results.map(n=>({nodeId:n.node_id,status:n.status,...n.score!==void 0?{score:n.score}:{},...n.max_score!==void 0?{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}:{}}))}))}))}function Sm(e,t){return new Promise((r,n)=>{let o=setTimeout(r,e);t.addEventListener("abort",()=>{clearTimeout(o),n(new Error("aborted"))},{once:!0})})}function Rm(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(String(n.result)),n.onerror=()=>r(n.error??new Error("read_failed")),n.readAsDataURL(e)})}function uc(e){let t={transcribePhotos:({images:o,photos:a},s)=>e.readPhotos({images:o,photos:a,nodeId:s?.nodeId}),recognizeHandwriting:async o=>e.readHandwriting(await Rm(o))},{startCapture:r,captureStatus:n}=e;return r&&n&&(t.startPhoneCapture=async({nodeId:o,signal:a})=>{let{captureId:s,url:i,qrImage:c}=await r(o),l=(async()=>{let p=Date.now()+12e5;for(;Date.now()<p;){await Sm(2500,a);let f=await n(s).catch(()=>null);if(f?.photos.length)return f.photos}throw new Error("expired")})();return{url:i,qrImage:c,photos:l}}),t}function Sa(e,t){let r=async n=>{let o=await fetch(`${e.replace(/\/$/,"")}/api/v1/embed/read`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,...n})}),a=await o.json().catch(()=>({}));if(!o.ok)throw new Error(a.error??"failed");return a};return uc({readPhotos:({images:n,nodeId:o})=>r({kind:"photos",images:n,...o?{node_id:o}:{}}),readHandwriting:n=>r({kind:"handwriting",image:n})})}import{jsx as Am}from"react/jsx-runtime";function Ra(e,t){let r=ka(e.exercise_feedback);return{submissionId:e.submission_id,totalScore:e.score??0,maxScore:e.max_score??0,percentage:e.percentage??0,passed:e.passed??!1,...e.score_hidden?{scoreHidden:!0}:{},returnUrl:t??null,exerciseFeedback:r,awaitingManualGrading:e.awaiting_manual_grading??!1,aiPending:e.ai_pending??!1}}function Ca(e){return{annex:e.annex??void 0,exercises:e.exercises.map(t=>({id:t.id,...t.title?{title:t.title}:{},sharedContext:t.sharedContext,questions:t.questions.map(r=>({id:r.id,version:"1.0",content:r.content,answerKeys:[]}))}))}}function hc({token:e,data:t,baseUrl:r,options:n}){let{locale:o,branding:a,returnUrl:s,reportLabel:i,backLabel:c,onBack:l,overlayConfig:p,layout:f,mediaHandler:m,answerSheetHandler:h,onComplete:d,onError:u}=n,v=fc(()=>Sa(r,e),[r,e]),R=a??t.branding??void 0,S=o??t.meta.language??"en",C=fc(()=>Ca(t.assessment),[t]),[w]=Cm(()=>new Date().toISOString()),N=mc(async x=>{let y=await fetch(`${r}/api/v1/embed/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,answers:x})});if(!y.ok){let g=await y.json().catch(()=>({}));if(y.status===422&&g.code==="required_unanswered")throw new Error("required_unanswered");let P=typeof g.error=="string"?g.error:"Submission failed",A=y.status===401?"TOKEN_INVALID":y.status===409?"TOKEN_USED":y.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";throw u?.({code:A,message:P}),new Error(P)}let T=await y.json();return d?.(T),Ra(T,s)},[r,e,d,u,s]),k=mc(x=>{if(s)try{let y=new URL(s);y.searchParams.set("submission_id",x.submissionId),!x.awaitingManualGrading&&!x.scoreHidden&&(y.searchParams.set("score",String(x.totalScore)),y.searchParams.set("max_score",String(x.maxScore))),window.location.href=y.toString()}catch{window.location.href=s}},[s]);return Am(Dr,{assessment:C,meta:{title:t.meta.title,category:t.meta.category??null},locale:S,branding:R,scoreHidden:t.meta.score_hidden===!0,requiredQuestionIds:t.meta.required_question_ids,timeLimitMinutes:t.meta.settings.time_limit_minutes,startedAt:w,onSubmit:N,onViewReport:s?k:void 0,reportLabel:i,onBack:l,backLabel:c,overlayConfig:p,layout:f,mediaHandler:m,answerSheetHandler:h??v})}import{useMemo as gc}from"react";import{jsx as _m}from"react/jsx-runtime";function Nm(){return Promise.reject(new Error("A review cannot be submitted"))}function bc({review:e,locale:t,branding:r,layout:n,onBack:o,backLabel:a}){let s=gc(()=>Ca(e.assessment),[e]),i=gc(()=>({answers:e.answers,result:Ra({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,score_hidden:e.submission.score_hidden,exercise_feedback:e.exercise_feedback})}),[e]),c=t??e.meta.language??"en";return _m(Dr,{assessment:s,meta:{title:e.meta.title,category:e.meta.category??null},locale:c,branding:r??e.branding??void 0,review:i,scoreHidden:e.submission.score_hidden===!0,onSubmit:Nm,onBack:o,backLabel:a,layout:n})}import Z0 from"react";import{createRoot as tw}from"react-dom/client";var Pm="https://edpire.com";function vc(e,t,r){e.textContent="";let n=document.createElement("div");n.style.cssText="padding:32px;text-align:center;color:#dc2626;font-family:sans-serif";let o=document.createElement("div");if(o.textContent=t,n.appendChild(o),r){let a=document.createElement("div");a.style.cssText="margin-top:8px;font-size:13px;color:#6b7280",a.textContent=r,n.appendChild(a)}e.appendChild(n)}var wc={mount(e){let{token:t,container:r,baseUrl:n=Pm,onError:o}=e,a=typeof r=="string"?document.querySelector(r):r;if(!a){let l={code:"UNKNOWN",message:`Container not found: ${r}`};return o?.(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()=>{a.innerHTML='<div style="padding:32px;text-align:center;color:#6b7280;font-family:sans-serif">Loading assessment\u2026</div>';let l;try{let p=await fetch(`${n}/api/v1/embed/assessments?token=${encodeURIComponent(t)}`,{method:"GET"});if(!p.ok){let f=await p.json().catch(()=>({})),m=typeof f.error=="string"?f.error:"Failed to load assessment",h=p.status===401?"TOKEN_INVALID":p.status===403?"ORIGIN_NOT_ALLOWED":p.status===404?"ASSESSMENT_NOT_FOUND":"UNKNOWN";o?.({code:h,message:m});let d=h==="ORIGIN_NOT_ALLOWED"?`Add ${typeof location<"u"?location.origin:"this origin"} to Allowed Embed Origins in Edpire, under Integrations then Origins.`:"";vc(a,m,d);return}l=await p.json()}catch{o?.({code:"NETWORK_ERROR",message:"Failed to connect to Edpire"}),vc(a,"Failed to connect to Edpire. Please try again.","");return}i||(a.innerHTML="",s=xc(a),s.render(yc.createElement(hc,{token:t,data:l,baseUrl:n,options:e})))})(),{unmount:c}},review(e){let{container:t,...r}=e,n=typeof t=="string"?document.querySelector(t):t;if(!n)return{unmount:()=>{}};n.textContent="";let o=xc(n);return o.render(yc.createElement(bc,r)),{unmount(){let a=o;o=null,setTimeout(()=>a?.unmount(),0)}}}};import{jsx as Em}from"react/jsx-runtime";function Mm({tokenEndpoint:e,assessmentId:t,tokenBody:r,className:n,style:o,onComplete:a,onError:s,...i}){let c=Aa(null),l=Aa(a);l.current=a;let p=Aa(s);return p.current=s,Tm(()=>{let f=c.current;if(!f)return;let m=!1,h=null;return(async()=>{let d;try{let u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assessmentId:t,...r})});if(m)return;if(!u.ok){let R=await u.json().catch(()=>({}));p.current?.({code:"TOKEN_INVALID",message:typeof R.error=="string"?R.error:`Token endpoint returned ${u.status}`});return}let v=await u.json();if(!v.token){p.current?.({code:"TOKEN_INVALID",message:"Token endpoint did not return a token"});return}d=v.token}catch{m||p.current?.({code:"NETWORK_ERROR",message:"Failed to fetch embed token"});return}m||(h=wc.mount({token:d,container:f,...i,onComplete:u=>l.current?.(u),onError:u=>p.current?.(u)}))})(),()=>{m=!0,h?.unmount()}},[e,t]),Em("div",{ref:c,className:n,style:n?void 0:o??{width:"100%"}})}export{Dr as AssessmentShell,Mm as EdpireAssessmentPlayer,$i as EdpireQuestion,uc as createAnswerSheetHandler,Sa as embedAnswerSheetHandler};