analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
1,158 lines (1,096 loc) • 66.8 kB
JavaScript
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
var _chunkXOJ3ERALjs = require('./chunk-XOJ3ERAL.js');
var _chunk7W6XZZKKjs = require('./chunk-7W6XZZKK.js');
var _chunkHYCL2IYZjs = require('./chunk-HYCL2IYZ.js');
var _chunkYBM4EYPAjs = require('./chunk-YBM4EYPA.js');
var _chunkOKU4RHFXjs = require('./chunk-OKU4RHFX.js');
var _chunkDR7XX7RNjs = require('./chunk-DR7XX7RN.js');
var _chunkRPDDVEWKjs = require('./chunk-RPDDVEWK.js');
var _chunkHZE6VBF5js = require('./chunk-HZE6VBF5.js');
var _chunkCMW67SFKjs = require('./chunk-CMW67SFK.js');
var _chunkSZD7L65Qjs = require('./chunk-SZD7L65Q.js');
var _chunkJR4KWECXjs = require('./chunk-JR4KWECX.js');
var _chunkBJMKBBN3js = require('./chunk-BJMKBBN3.js');
var _chunkTCLRDUMFjs = require('./chunk-TCLRDUMF.js');
var _chunk34ST3MKOjs = require('./chunk-34ST3MKO.js');
var _chunkANT66KVKjs = require('./chunk-ANT66KVK.js');
var _chunkTN3AYOMVjs = require('./chunk-TN3AYOMV.js');
// src/components/CorrectActivityModal/CorrectActivityModal.tsx
var _react = require('react');
var _PencilSimple = require('@phosphor-icons/react/dist/csr/PencilSimple');
var _Paperclip = require('@phosphor-icons/react/dist/csr/Paperclip');
var _X = require('@phosphor-icons/react/dist/csr/X');
var _Image = require('@phosphor-icons/react/dist/csr/Image');
// src/utils/studentActivityCorrection/constants.ts
var QUESTION_STATUS = {
CORRETA: "CORRETA",
INCORRETA: "INCORRETA",
EM_BRANCO: "EM_BRANCO",
/** Reserved for future use - pending teacher evaluation for essay questions */
PENDENTE: "PENDENTE"
};
// src/utils/studentActivityCorrection/utils.ts
var getIsCorrect = (answerStatus) => {
if (answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */) return true;
if (answerStatus === "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */) return false;
return null;
};
var mapAnswerStatusToQuestionStatus = (answerStatus) => {
switch (answerStatus) {
case "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */:
return QUESTION_STATUS.CORRETA;
case "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */:
return QUESTION_STATUS.INCORRETA;
case "NAO_RESPONDIDO" /* NAO_RESPONDIDO */:
return QUESTION_STATUS.EM_BRANCO;
case "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */:
return QUESTION_STATUS.PENDENTE;
default:
return QUESTION_STATUS.EM_BRANCO;
}
};
var getQuestionStatusBadgeConfig = (status) => {
const configs = {
[QUESTION_STATUS.CORRETA]: {
label: "Correta",
bgColor: "bg-success-background",
textColor: "text-success-800"
},
[QUESTION_STATUS.INCORRETA]: {
label: "Incorreta",
bgColor: "bg-error-background",
textColor: "text-error-800"
},
[QUESTION_STATUS.EM_BRANCO]: {
label: "Em branco",
bgColor: "bg-gray-100",
textColor: "text-gray-600"
},
[QUESTION_STATUS.PENDENTE]: {
label: "Pendente",
bgColor: "bg-warning-background",
textColor: "text-warning-800"
}
};
const defaultConfig = {
label: "Sem categoria",
bgColor: "bg-gray-100",
textColor: "text-gray-600"
};
return _nullishCoalesce(configs[status], () => ( defaultConfig));
};
var canAutoValidate = (questionData) => {
const { result } = questionData;
if (result.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
return false;
}
return true;
};
var hasIsCorrect = (op) => {
return op.isCorrect != null;
};
var validateAlternativa = (selected, options) => {
if (selected.size !== 1) return "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
const [selectedId] = selected;
return _optionalChain([options, 'access', _ => _.find, 'call', _2 => _2((o) => o.id === selectedId), 'optionalAccess', _3 => _3.isCorrect]) ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
};
var validateMultiplaEscolha = (selected, options) => {
const allMatch = options.every((op) => selected.has(op.id) === op.isCorrect);
return allMatch ? "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */ : "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */;
};
var validateVerdadeiroFalso = validateMultiplaEscolha;
var validators = {
["ALTERNATIVA" /* ALTERNATIVA */]: validateAlternativa,
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: validateMultiplaEscolha,
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: validateVerdadeiroFalso
};
var autoValidateQuestion = (questionData) => {
const { result } = questionData;
if (!canAutoValidate(questionData) || !result.options) return null;
const validOptions = result.options.filter(hasIsCorrect);
if (validOptions.length === 0) return null;
const selected = new Set(
_nullishCoalesce(_optionalChain([result, 'access', _4 => _4.selectedOptions, 'optionalAccess', _5 => _5.map, 'call', _6 => _6((o) => o.optionId)]), () => ( []))
);
if (selected.size === 0) return "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
const validator = validators[result.questionType];
if (!validator) return null;
return validator(selected, validOptions);
};
var getQuestionStatusFromData = (questionData) => {
const { result } = questionData;
if (result.answerStatus === "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && canAutoValidate(questionData)) {
const autoValidatedStatus = autoValidateQuestion(questionData);
if (autoValidatedStatus !== null) {
return mapAnswerStatusToQuestionStatus(autoValidatedStatus);
}
}
return mapAnswerStatusToQuestionStatus(result.answerStatus);
};
// src/utils/studentActivityCorrection/converter.ts
var buildQuestionFromAnswer = (answer) => {
return {
id: answer.questionId,
statement: answer.statement,
questionType: answer.questionType,
difficultyLevel: answer.difficultyLevel,
description: "",
examBoard: null,
examYear: null,
solutionExplanation: answer.solutionExplanation || null,
additionalContent: answer.additionalContent || null,
answer: null,
answerStatus: answer.answerStatus,
options: answer.options || [],
knowledgeMatrix: answer.knowledgeMatrix.map((matrix) => ({
areaKnowledge: matrix.areaKnowledge || {
id: "",
name: ""
},
subject: matrix.subject || {
id: "",
name: "",
color: "",
icon: ""
},
topic: matrix.topic || {
id: "",
name: ""
},
subtopic: matrix.subtopic || {
id: "",
name: ""
},
content: matrix.content || {
id: "",
name: ""
}
})),
correctOptionIds: _optionalChain([answer, 'access', _7 => _7.options, 'optionalAccess', _8 => _8.filter, 'call', _9 => _9((opt) => opt.isCorrect), 'access', _10 => _10.map, 'call', _11 => _11((opt) => opt.id)]) || []
};
};
var buildEssayCorrection = (answer) => {
if (answer.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
return {
isCorrect: getIsCorrect(answer.answerStatus),
teacherFeedback: answer.teacherFeedback || ""
};
}
return void 0;
};
var convertAnswerToQuestionData = (answer, index) => {
const question = buildQuestionFromAnswer(answer);
const correction = buildEssayCorrection(answer);
return {
question,
result: answer,
questionNumber: index + 1,
correction
};
};
var convertApiResponseToCorrectionData = (apiResponse, studentId, studentName, observation, attachment) => {
const { answers, statistics } = apiResponse.data;
const correctCount = statistics.correctAnswers;
const incorrectCount = statistics.incorrectAnswers;
const blankCount = statistics.totalAnswered - correctCount - incorrectCount;
const questions = answers.map(
(answer, index) => convertAnswerToQuestionData(answer, index)
);
return {
studentId,
studentName,
score: _nullishCoalesce(statistics.score, () => ( null)),
correctCount,
incorrectCount,
blankCount,
questions,
observation,
attachment
};
};
// src/utils/questionRenderer/alternative/index.tsx
var _jsxruntime = require('react/jsx-runtime');
var renderQuestionAlternative = ({
question,
result
}) => {
const hasAutoValidation = _optionalChain([result, 'optionalAccess', _12 => _12.options, 'optionalAccess', _13 => _13.some, 'call', _14 => _14(
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
)]);
const alternatives = _optionalChain([question, 'access', _15 => _15.options, 'optionalAccess', _16 => _16.map, 'call', _17 => _17((option) => {
const isCorrectOption = _optionalChain([result, 'optionalAccess', _18 => _18.options, 'optionalAccess', _19 => _19.find, 'call', _20 => _20((op) => op.id === option.id), 'optionalAccess', _21 => _21.isCorrect]) || false;
const isSelected = _optionalChain([result, 'optionalAccess', _22 => _22.selectedOptions, 'optionalAccess', _23 => _23.some, 'call', _24 => _24(
(selectedOption) => selectedOption.optionId === option.id
)]) || false;
const shouldShowCorrectAnswers = _optionalChain([result, 'optionalAccess', _25 => _25.answerStatus]) !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ || hasAutoValidation;
let status;
if (shouldShowCorrectAnswers) {
if (isCorrectOption) {
status = "correct" /* CORRECT */;
} else if (isSelected && !isCorrectOption) {
status = "incorrect" /* INCORRECT */;
} else {
status = "neutral" /* NEUTRAL */;
}
} else {
status = "neutral" /* NEUTRAL */;
}
return {
label: option.option,
value: option.id,
status
};
})]);
if (!alternatives || alternatives.length === 0) {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "sm", weight: "normal", children: "N\xE3o h\xE1 Alternativas" }) });
}
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pt-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkDR7XX7RNjs.AlternativesList,
{
mode: "readonly",
name: `question-${question.id}`,
layout: "compact",
alternatives,
selectedValue: _optionalChain([result, 'optionalAccess', _26 => _26.selectedOptions, 'optionalAccess', _27 => _27[0], 'optionalAccess', _28 => _28.optionId]) || ""
},
`question-${question.id}`
) });
};
// src/utils/questionRenderer/multipleChoice/index.tsx
var renderQuestionMultipleChoice = ({
question,
result
}) => {
const hasAutoValidation = _optionalChain([result, 'optionalAccess', _29 => _29.options, 'optionalAccess', _30 => _30.some, 'call', _31 => _31(
(op) => op.isCorrect !== void 0 && op.isCorrect !== null
)]);
const choices = _optionalChain([question, 'access', _32 => _32.options, 'optionalAccess', _33 => _33.map, 'call', _34 => _34((option) => {
const isCorrectOption = _optionalChain([result, 'optionalAccess', _35 => _35.options, 'optionalAccess', _36 => _36.find, 'call', _37 => _37((op) => op.id === option.id), 'optionalAccess', _38 => _38.isCorrect]) || false;
const isSelected = _optionalChain([result, 'optionalAccess', _39 => _39.selectedOptions, 'optionalAccess', _40 => _40.some, 'call', _41 => _41(
(op) => op.optionId === option.id
)]);
const shouldShowCorrectAnswers = _optionalChain([result, 'optionalAccess', _42 => _42.answerStatus]) !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && _optionalChain([result, 'optionalAccess', _43 => _43.answerStatus]) !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */ || hasAutoValidation;
let status;
if (shouldShowCorrectAnswers) {
if (isCorrectOption) {
status = "correct" /* CORRECT */;
} else if (isSelected && !isCorrectOption) {
status = "incorrect" /* INCORRECT */;
} else {
status = "neutral" /* NEUTRAL */;
}
} else {
status = "neutral" /* NEUTRAL */;
}
return {
label: option.option,
value: option.id,
status
};
})]);
if (!choices || choices.length === 0) {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "sm", weight: "normal", children: "N\xE3o h\xE1 Caixas de sele\xE7\xE3o" }) });
}
const selectedValues = _optionalChain([result, 'optionalAccess', _44 => _44.selectedOptions, 'optionalAccess', _45 => _45.map, 'call', _46 => _46((op) => op.optionId)]) || [];
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pt-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkRPDDVEWKjs.MultipleChoiceList,
{
mode: "readonly",
name: `question-${question.id}`,
choices,
selectedValues
},
`question-${question.id}`
) });
};
// src/utils/questionRenderer/components/index.tsx
var _CheckCircle = require('@phosphor-icons/react/dist/csr/CheckCircle');
var _XCircle = require('@phosphor-icons/react/dist/csr/XCircle');
var getStatusBadge = (status) => {
switch (status) {
case "correct" /* CORRECT */:
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBJMKBBN3js.Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckCircle.CheckCircleIcon, {}), children: "Resposta correta" });
case "incorrect" /* INCORRECT */:
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBJMKBBN3js.Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _XCircle.XCircleIcon, {}), children: "Resposta incorreta" });
default:
return null;
}
};
var QuestionContainer = ({
children,
className
}) => {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"div",
{
className: _chunkTN3AYOMVjs.cn.call(void 0,
"bg-background rounded-t-xl px-4 pt-4 pb-[80px] h-auto flex flex-col gap-4 mb-auto",
className
),
children
}
);
};
var QuestionSubTitle = ({ subTitle }) => {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "md", weight: "bold", color: "text-text-950", children: subTitle }) });
};
var FillQuestionContent = ({
question,
result
}) => {
const baseId = _react.useId.call(void 0, );
const additionalContent = _optionalChain([result, 'optionalAccess', _47 => _47.additionalContent]) || question.additionalContent || question.statement || "";
const cleanText = _chunkOKU4RHFXjs.stripHtmlTags.call(void 0, additionalContent);
const options = _optionalChain([result, 'optionalAccess', _48 => _48.options]) || question.options || [];
const optionTextMap = {};
options.forEach((opt) => {
optionTextMap[opt.id] = opt.option;
});
const fillAnswers = {};
try {
const resultWithFill = result;
if (_optionalChain([resultWithFill, 'optionalAccess', _49 => _49.fillAnswers])) {
Object.assign(fillAnswers, resultWithFill.fillAnswers);
} else if (_optionalChain([result, 'optionalAccess', _50 => _50.answer])) {
const parsed = typeof result.answer === "string" ? JSON.parse(result.answer) : result.answer;
if (typeof parsed === "object") {
Object.assign(fillAnswers, parsed);
}
}
} catch (e2) {
}
const getOptionTextById = (optionId) => {
if (!optionId) return null;
return _nullishCoalesce(optionTextMap[optionId], () => ( null));
};
const isAnswerCorrect = (placeholderId) => {
const selectedOptionId = fillAnswers[placeholderId];
return selectedOptionId === placeholderId;
};
const renderStudentBadge = (placeholderId) => {
const selectedOptionId = fillAnswers[placeholderId];
const selectedOptionText = getOptionTextById(selectedOptionId);
const isCorrect = isAnswerCorrect(placeholderId);
if (!selectedOptionId) {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "inline-block align-middle mx-1 my-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkBJMKBBN3js.Badge_default,
{
variant: "solid",
action: "error",
iconRight: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _XCircle.XCircleIcon, {}),
size: "large",
className: "py-1 px-2",
children: "N\xE3o respondido"
}
) });
}
const displayText = _nullishCoalesce(selectedOptionText, () => ( "Op\xE7\xE3o n\xE3o encontrada"));
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "inline-block align-middle mx-1 my-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkBJMKBBN3js.Badge_default,
{
variant: "solid",
action: isCorrect ? "success" : "error",
iconRight: isCorrect ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _CheckCircle.CheckCircleIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _XCircle.XCircleIcon, {}),
size: "large",
className: "py-1 px-2",
children: displayText
}
) });
};
const renderCorrectAnswer = (placeholderId) => {
const correctOptionText = getOptionTextById(placeholderId);
const displayText = _nullishCoalesce(correctOptionText, () => ( "[Resposta n\xE3o dispon\xEDvel]"));
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "inline mx-1 text-success-600 font-semibold border-b-2 border-success-600", children: displayText });
};
const renderTextWithElements = (text, isCorrectAnswer) => {
const elements = [];
let lastIndex = 0;
const nextId = () => elements.length;
const regex = /\{([a-zA-Z0-9-]+)\}/g;
let match;
while ((match = regex.exec(text)) !== null) {
const [fullMatch, placeholderId] = match;
const startIndex = match.index;
if (startIndex > lastIndex) {
elements.push({
element: text.slice(lastIndex, startIndex),
id: `${baseId}-text-${nextId()}`
});
}
if (isCorrectAnswer) {
elements.push({
element: renderCorrectAnswer(placeholderId),
id: `${baseId}-answer-sheet-${nextId()}`
});
} else {
elements.push({
element: renderStudentBadge(placeholderId),
id: `${baseId}-student-${nextId()}`
});
}
lastIndex = match.index + fullMatch.length;
}
if (lastIndex < text.length) {
elements.push({
element: text.slice(lastIndex),
id: `${baseId}-text-${nextId()}`
});
}
return elements;
};
if (!additionalContent) {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pt-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "md", color: "text-text-600", weight: "normal", children: "Nenhum conte\xFAdo dispon\xEDvel para esta quest\xE3o." }) });
}
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pt-2 space-y-4", children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "xs", weight: "normal", color: "text-text-500", children: "Resposta do aluno:" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-3 bg-background-50 rounded-lg border border-border-100", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkANT66KVKjs.Text_default,
{
as: "div",
size: "md",
color: "text-text-900",
weight: "normal",
className: "leading-[2.5] *:inline",
children: renderTextWithElements(cleanText, false).map((element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Fragment, { children: element.element }, element.id))
}
) })
] }),
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "xs", weight: "normal", color: "text-text-500", children: "Gabarito:" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-3 bg-background-50 rounded-lg border border-border-100", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkANT66KVKjs.Text_default,
{
as: "div",
size: "md",
color: "text-text-900",
weight: "normal",
className: "leading-[2.5] *:inline",
children: renderTextWithElements(cleanText, true).map((element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Fragment, { children: element.element }, element.id))
}
) })
] })
] });
};
// src/utils/questionRenderer/trueOrFalse/index.tsx
var renderQuestionTrueOrFalse = ({
question,
result
}) => {
const options = question.options || [];
const getLetterByIndex = (index) => String.fromCodePoint(97 + index);
const shouldShowStatus = _optionalChain([result, 'optionalAccess', _51 => _51.answerStatus]) !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && _optionalChain([result, 'optionalAccess', _52 => _52.answerStatus]) !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pt-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-3.5", children: options.map((option, index) => {
const studentSelection = _optionalChain([result, 'optionalAccess', _53 => _53.selectedOptions, 'optionalAccess', _54 => _54.find, 'call', _55 => _55(
(op) => op.optionId === option.id
)]);
const correctAnswerOption = _optionalChain([result, 'optionalAccess', _56 => _56.options, 'optionalAccess', _57 => _57.find, 'call', _58 => _58(
(op) => op.id === option.id
)]);
const hasCorrectAnswer = _optionalChain([correctAnswerOption, 'optionalAccess', _59 => _59.isCorrect]) !== void 0;
const statementIsTrue = _nullishCoalesce(_optionalChain([correctAnswerOption, 'optionalAccess', _60 => _60.isCorrect]), () => ( false));
const hasAnswered = studentSelection !== void 0;
const studentMarkedTrue = _nullishCoalesce(_optionalChain([studentSelection, 'optionalAccess', _61 => _61.isCorrect]), () => ( false));
const isStudentCorrect = hasCorrectAnswer && hasAnswered && studentMarkedTrue === statementIsTrue;
const canShowCorrectness = shouldShowStatus && hasCorrectAnswer;
const variantCorrect = isStudentCorrect ? "correct" /* CORRECT */ : "incorrect" /* INCORRECT */;
const studentAnswer = studentMarkedTrue ? "V" /* VERDADEIRO */ : "F" /* FALSO */;
const correctAnswer = statementIsTrue ? "V" /* VERDADEIRO */ : "F" /* FALSO */;
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
"section",
{
className: "flex flex-col gap-2",
children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
"div",
{
className: _chunkTN3AYOMVjs.cn.call(void 0,
"flex flex-row justify-between items-center gap-2 p-2 rounded-md border",
canShowCorrectness && hasAnswered ? _chunkOKU4RHFXjs.getStatusStyles.call(void 0, variantCorrect) : ""
),
children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkANT66KVKjs.Text_default, { as: "span", size: "sm", weight: "normal", color: "text-text-900", children: [
getLetterByIndex(index).concat(") "),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHZE6VBF5js.HtmlMathRenderer_default, { content: option.option, inline: true })
] }),
canShowCorrectness && hasAnswered && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-shrink-0", children: getStatusBadge(
isStudentCorrect ? "correct" /* CORRECT */ : "incorrect" /* INCORRECT */
) })
]
}
),
canShowCorrectness && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-row gap-2 items-center flex-wrap", children: hasAnswered ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkANT66KVKjs.Text_default, { size: "2xs", weight: "normal", color: "text-text-800", children: [
"Resposta selecionada: ",
studentAnswer
] }),
!isStudentCorrect && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkANT66KVKjs.Text_default, { size: "2xs", weight: "normal", color: "text-text-800", children: [
"| Resposta correta: ",
correctAnswer
] })
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkANT66KVKjs.Text_default, { size: "2xs", weight: "normal", color: "text-text-800", children: [
"N\xE3o respondida | Resposta correta: ",
correctAnswer
] }) })
]
},
option.id || `option-${index}`
);
}) }) });
};
// src/utils/questionRenderer/dissertative/index.tsx
var renderQuestionDissertative = ({
result
}) => {
const localAnswer = _optionalChain([result, 'optionalAccess', _62 => _62.answer]) || "";
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pt-2 space-y-4", children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "sm", weight: "normal", color: "text-text-950", children: "Resposta do aluno" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-3 bg-background-50 rounded-lg border border-border-100", children: localAnswer ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkHZE6VBF5js.HtmlMathRenderer_default,
{
content: localAnswer,
className: "text-sm text-text-700"
}
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "sm", weight: "normal", color: "text-text-700", children: "Nenhuma resposta fornecida" }) })
] }),
_optionalChain([result, 'optionalAccess', _63 => _63.answerStatus]) === "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && _optionalChain([result, 'optionalAccess', _64 => _64.teacherFeedback]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "xs", weight: "normal", color: "text-text-500", children: "Observa\xE7\xE3o do professor:" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-3 bg-background-50 rounded-lg border border-border-100", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkHZE6VBF5js.HtmlMathRenderer_default,
{
content: result.teacherFeedback,
className: "text-sm text-text-700"
}
) })
] })
] });
};
// src/utils/questionRenderer/fill/index.tsx
var renderQuestionFill = ({
question,
result
}) => {
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FillQuestionContent, { question, result });
};
// src/utils/questionRenderer/image/index.tsx
var renderQuestionImage = ({
result
}) => {
const correctPositionRelative = { x: 0.48, y: 0.45 };
const correctRadiusRelative = 0.1;
let userPositionRelative = null;
try {
if (_optionalChain([result, 'optionalAccess', _65 => _65.answer])) {
const parsed = typeof result.answer === "string" ? JSON.parse(result.answer) : result.answer;
if (parsed && typeof parsed.x === "number" && typeof parsed.y === "number") {
userPositionRelative = { x: parsed.x, y: parsed.y };
}
}
} catch (e3) {
userPositionRelative = null;
}
const isCorrect = userPositionRelative ? Math.sqrt(
Math.pow(userPositionRelative.x - correctPositionRelative.x, 2) + Math.pow(userPositionRelative.y - correctPositionRelative.y, 2)
) <= correctRadiusRelative : false;
const getUserCircleColorClasses = () => {
if (!userPositionRelative) return "";
return isCorrect ? "bg-success-600/70 border-white" : "bg-indicator-error/70 border-white";
};
const getPositionDescription = (x, y) => {
const xPercent = Math.round(x * 100);
const yPercent = Math.round(y * 100);
return `${xPercent}% da esquerda, ${yPercent}% do topo`;
};
const getSpatialRelationship = () => {
if (!userPositionRelative) {
return `\xC1rea correta localizada em ${getPositionDescription(
correctPositionRelative.x,
correctPositionRelative.y
)}. Nenhuma resposta do aluno fornecida.`;
}
const deltaX = userPositionRelative.x - correctPositionRelative.x;
const deltaY = userPositionRelative.y - correctPositionRelative.y;
const distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
const distancePercent = Math.round(distance * 100);
let direction;
if (Math.abs(deltaX) > Math.abs(deltaY)) {
direction = deltaX > 0 ? "\xE0 direita" : "\xE0 esquerda";
} else {
direction = deltaY > 0 ? "abaixo" : "acima";
}
const correctPos = getPositionDescription(
correctPositionRelative.x,
correctPositionRelative.y
);
const userPos = getPositionDescription(
userPositionRelative.x,
userPositionRelative.y
);
return `\xC1rea correta localizada em ${correctPos}. Resposta do aluno em ${userPos}. A resposta do aluno est\xE1 ${distancePercent}% de dist\xE2ncia ${direction} da \xE1rea correta. ${isCorrect ? "A resposta est\xE1 dentro da \xE1rea de toler\xE2ncia e \xE9 considerada correta." : "A resposta est\xE1 fora da \xE1rea de toler\xE2ncia e \xE9 considerada incorreta."}`;
};
const correctPositionDescription = getPositionDescription(
correctPositionRelative.x,
correctPositionRelative.y
);
const imageAltText = `Quest\xE3o de imagem com \xE1rea correta localizada em ${correctPositionDescription}`;
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pt-2 space-y-4", children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs", children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-3 h-3 rounded-full bg-indicator-primary/70 border border-[#F8CC2E]" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "sm", weight: "normal", color: "text-text-600", children: "\xC1rea correta" })
] }),
userPositionRelative && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-3 h-3 rounded-full bg-success-600/70 border border-white" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "sm", weight: "normal", color: "text-text-600", children: "Resposta correta" })
] }),
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-3 h-3 rounded-full bg-indicator-error/70 border border-white" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "sm", weight: "normal", color: "text-text-600", children: "Resposta incorreta" })
] })
] })
] }),
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative w-full", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "sr-only", children: getSpatialRelationship() }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"img",
{
src: _chunkOKU4RHFXjs.mock_image_question_default,
alt: imageAltText,
className: "w-full h-auto rounded-md"
}
),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"div",
{
role: "img",
"aria-label": `\xC1rea correta marcada em ${correctPositionDescription}`,
className: "absolute rounded-full bg-indicator-primary/70 border-4 border-[#F8CC2E] pointer-events-none",
style: {
minWidth: "50px",
maxWidth: "160px",
width: "15%",
aspectRatio: "1 / 1",
left: `calc(${correctPositionRelative.x * 100}% - 7.5%)`,
top: `calc(${correctPositionRelative.y * 100}% - 15%)`
},
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
_chunkANT66KVKjs.Text_default,
{
size: "sm",
weight: "normal",
color: "text-text-600",
className: "sr-only",
children: [
"C\xEDrculo amarelo indicando a \xE1rea correta da resposta, posicionado em",
" ",
correctPositionDescription
]
}
)
}
),
userPositionRelative && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
"div",
{
role: "img",
"aria-label": `Resposta do aluno marcada em ${getPositionDescription(
userPositionRelative.x,
userPositionRelative.y
)}, ${isCorrect ? "correta" : "incorreta"}`,
className: `absolute rounded-full border-4 pointer-events-none ${getUserCircleColorClasses()}`,
style: {
minWidth: "30px",
maxWidth: "52px",
width: "5%",
aspectRatio: "1 / 1",
left: `calc(${userPositionRelative.x * 100}% - 2.5%)`,
top: `calc(${userPositionRelative.y * 100}% - 2.5%)`
},
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
_chunkANT66KVKjs.Text_default,
{
size: "sm",
weight: "normal",
color: "text-text-600",
className: "sr-only",
children: [
"C\xEDrculo ",
isCorrect ? "verde" : "vermelho",
" indicando a resposta do aluno, posicionado em",
" ",
getPositionDescription(
userPositionRelative.x,
userPositionRelative.y
),
". A resposta est\xE1",
" ",
Math.round(
Math.sqrt(
Math.pow(
userPositionRelative.x - correctPositionRelative.x,
2
) + Math.pow(
userPositionRelative.y - correctPositionRelative.y,
2
)
) * 100
),
"% de dist\xE2ncia da \xE1rea correta e \xE9 considerada",
" ",
isCorrect ? "correta" : "incorreta",
"."
]
}
)
}
)
] })
] });
};
// src/utils/questionRenderer/connectDots/index.tsx
var renderQuestionConnectDots = ({
paddingBottom
} = {}) => {
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, QuestionSubTitle, { subTitle: "Tipo de quest\xE3o: Ligar Pontos" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, QuestionContainer, { className: _chunkTN3AYOMVjs.cn.call(void 0, "", paddingBottom), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { size: "md", weight: "normal", color: "text-text-600", children: "Tipo de quest\xE3o: Ligar Pontos (n\xE3o implementado)" }) }) })
] });
};
// src/utils/questionRenderer/index.tsx
var questionRendererMap = {
["ALTERNATIVA" /* ALTERNATIVA */]: renderQuestionAlternative,
["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: renderQuestionMultipleChoice,
["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: renderQuestionTrueOrFalse,
["DISSERTATIVA" /* DISSERTATIVA */]: renderQuestionDissertative,
["PREENCHER_LACUNAS" /* PREENCHER_LACUNAS */]: renderQuestionFill,
["IMAGEM" /* IMAGEM */]: renderQuestionImage,
["RELACIONAR" /* RELACIONAR */]: renderQuestionConnectDots
};
var renderFromMap = (renderers, questionType) => {
if (!questionType) return null;
const renderer = renderers[questionType];
return renderer ? renderer() : null;
};
// src/components/CorrectActivityModal/CorrectActivityModal.tsx
var EssayCorrectionField = {
IsCorrect: "isCorrect",
TeacherFeedback: "teacherFeedback"
};
var CorrectActivityModal = ({
isOpen,
onClose,
data,
isViewOnly = false,
onObservationSubmit,
onQuestionCorrectionSubmit,
answerSheetImageUrl,
onViewScannedAnswerSheet
}) => {
const [observation, setObservation] = _react.useState.call(void 0, "");
const [isObservationExpanded, setIsObservationExpanded] = _react.useState.call(void 0, false);
const [isObservationSaved, setIsObservationSaved] = _react.useState.call(void 0, false);
const [savedObservation, setSavedObservation] = _react.useState.call(void 0, "");
const [attachedFiles, setAttachedFiles] = _react.useState.call(void 0, []);
const [savedFiles, setSavedFiles] = _react.useState.call(void 0, []);
const [existingAttachment, setExistingAttachment] = _react.useState.call(void 0,
null
);
const fileInputRef = _react.useRef.call(void 0, null);
const addToast = _chunkHYCL2IYZjs.ToastStore_default.call(void 0, (state) => state.addToast);
const [essayCorrections, setEssayCorrections] = _react.useState.call(void 0, {});
_react.useEffect.call(void 0, () => {
if (isOpen) {
setObservation("");
setIsObservationExpanded(false);
setAttachedFiles([]);
setSavedFiles([]);
setExistingAttachment(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _66 => _66.attachment]), () => ( null)));
if (_optionalChain([data, 'optionalAccess', _67 => _67.observation]) || _optionalChain([data, 'optionalAccess', _68 => _68.attachment])) {
setIsObservationSaved(true);
setSavedObservation(data.observation || "");
} else {
setIsObservationSaved(false);
setSavedObservation("");
}
const initialCorrections = {};
_optionalChain([data, 'optionalAccess', _69 => _69.questions, 'optionalAccess', _70 => _70.forEach, 'call', _71 => _71((questionData) => {
if (questionData.question.questionType === "DISSERTATIVA" /* DISSERTATIVA */) {
initialCorrections[questionData.questionNumber] = {
isCorrect: _nullishCoalesce(_optionalChain([questionData, 'access', _72 => _72.correction, 'optionalAccess', _73 => _73.isCorrect]), () => ( null)),
teacherFeedback: _optionalChain([questionData, 'access', _74 => _74.correction, 'optionalAccess', _75 => _75.teacherFeedback]) || "",
isSaving: false,
isSaved: _optionalChain([questionData, 'access', _76 => _76.correction, 'optionalAccess', _77 => _77.isCorrect]) != null
};
}
})]);
setEssayCorrections(initialCorrections);
}
}, [
isOpen,
_optionalChain([data, 'optionalAccess', _78 => _78.studentId]),
_optionalChain([data, 'optionalAccess', _79 => _79.observation]),
_optionalChain([data, 'optionalAccess', _80 => _80.attachment]),
_optionalChain([data, 'optionalAccess', _81 => _81.questions])
]);
const handleOpenObservation = () => {
setIsObservationExpanded(true);
};
const handleFilesAdd = (files) => {
const newFile = files[0];
if (newFile) {
setAttachedFiles([{ file: newFile, id: _chunkCMW67SFKjs.generateFileId.call(void 0, ) }]);
}
};
const handleFileRemove = (id) => {
setAttachedFiles((prev) => prev.filter((f) => f.id !== id));
};
const handleSaveObservation = () => {
if (observation.trim() || attachedFiles.length > 0 || existingAttachment) {
if (!_optionalChain([data, 'optionalAccess', _82 => _82.studentId])) {
return;
}
setSavedObservation(observation);
setSavedFiles([...attachedFiles]);
setIsObservationSaved(true);
setIsObservationExpanded(false);
_optionalChain([onObservationSubmit, 'optionalCall', _83 => _83(
data.studentId,
observation,
attachedFiles.map((f) => f.file),
existingAttachment
)]);
}
};
const handleEditObservation = () => {
setObservation(savedObservation);
setAttachedFiles([...savedFiles]);
setIsObservationSaved(false);
setIsObservationExpanded(true);
};
const handleSaveEssayCorrection = _react.useCallback.call(void 0,
async (questionNumber) => {
if (!_optionalChain([data, 'optionalAccess', _84 => _84.studentId]) || !onQuestionCorrectionSubmit) return;
const correction = essayCorrections[questionNumber];
if (_optionalChain([correction, 'optionalAccess', _85 => _85.isCorrect]) == null) {
return;
}
setEssayCorrections((prev) => ({
...prev,
[questionNumber]: { ...prev[questionNumber], isSaving: true }
}));
try {
const questionData = _optionalChain([data, 'optionalAccess', _86 => _86.questions, 'access', _87 => _87.find, 'call', _88 => _88(
(q) => q.questionNumber === questionNumber
)]);
if (!questionData) {
console.error("Quest\xE3o n\xE3o encontrada:", questionNumber);
return;
}
await onQuestionCorrectionSubmit(data.studentId, {
questionId: questionData.question.id,
isCorrect: correction.isCorrect,
teacherFeedback: correction.teacherFeedback
});
setEssayCorrections((prev) => ({
...prev,
[questionNumber]: {
...prev[questionNumber],
isSaving: false,
isSaved: true
}
}));
addToast({
title: "Corre\xE7\xE3o salva",
description: `A corre\xE7\xE3o da quest\xE3o ${questionNumber} foi salva com sucesso.`,
variant: "solid",
action: "success",
position: "top-right"
});
} catch (error) {
console.error("Erro ao salvar corre\xE7\xE3o da quest\xE3o:", error);
setEssayCorrections((prev) => ({
...prev,
[questionNumber]: { ...prev[questionNumber], isSaving: false }
}));
addToast({
title: "Erro ao salvar corre\xE7\xE3o",
description: "N\xE3o foi poss\xEDvel salvar a corre\xE7\xE3o. Tente novamente.",
variant: "solid",
action: "warning",
position: "top-right"
});
}
},
[
_optionalChain([data, 'optionalAccess', _89 => _89.studentId]),
_optionalChain([data, 'optionalAccess', _90 => _90.questions]),
essayCorrections,
onQuestionCorrectionSubmit,
addToast
]
);
const updateEssayCorrection = _react.useCallback.call(void 0,
(questionNumber, field, value) => {
setEssayCorrections((prev) => ({
...prev,
[questionNumber]: {
...prev[questionNumber],
[field]: value,
// Reset isSaved when isCorrect changes so badge doesn't update until saved
...field === EssayCorrectionField.IsCorrect ? { isSaved: false } : {}
}
}));
},
[]
);
const getAccordionTitle = (questionType) => {
switch (questionType) {
case "ALTERNATIVA" /* ALTERNATIVA */:
case "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */:
case "VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */:
return "Alternativas";
case "DISSERTATIVA" /* DISSERTATIVA */:
return "Resposta";
case "PREENCHER_LACUNAS" /* PREENCHER_LACUNAS */:
return "Preencher Lacunas";
case "IMAGEM" /* IMAGEM */:
return "Imagem";
case "RELACIONAR" /* RELACIONAR */:
return "Ligar Pontos";
default:
return "Resposta";
}
};
const renderQuestionContent = (questionData) => {
const { question, result } = questionData;
const questionType = question.questionType;
const accordionTitle = getAccordionTitle(questionType);
let content;
switch (questionType) {
case "ALTERNATIVA" /* ALTERNATIVA */:
content = renderQuestionAlternative({
question,
result
});
break;
case "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */:
content = renderQuestionMultipleChoice({
question,
result
});
break;
case "VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */:
content = renderQuestionTrueOrFalse({
question,
result
});
break;
case "DISSERTATIVA" /* DISSERTATIVA */:
content = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
renderQuestionDissertative({
result
}),
onQuestionCorrectionSubmit && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4 border-t border-border-100 pt-4 mt-4", children: renderEssayCorrectionFields(questionData) })
] });
break;
case "PREENCHER_LACUNAS" /* PREENCHER_LACUNAS */:
content = renderQuestionFill({
question,
result
});
break;
case "IMAGEM" /* IMAGEM */:
content = renderQuestionImage({
result
});
break;
case "RELACIONAR" /* RELACIONAR */:
content = renderQuestionConnectDots({ paddingBottom: "" });
break;
default:
if (question.options && question.options.length > 0) {
content = renderQuestionAlternative({
question,
result
});
} else {
content = renderQuestionDissertative({
result
});
}
}
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkYBM4EYPAjs.CardAccordation,
{
value: `accordion-${questionData.questionNumber}`,
className: "border border-border-100 rounded-lg",
trigger: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "py-3 pr-2 w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { className: "text-sm font-bold text-text-950", children: accordionTitle }) }),
children: content
}
);
};
const renderEssayCorrectionFields = (questionData) => {
const correction = essayCorrections[questionData.questionNumber] || {
isCorrect: null,
teacherFeedback: "",
isSaving: false
};
let radioValue;
if (correction.isCorrect === null) {
radioValue = void 0;
} else if (correction.isCorrect) {
radioValue = "true";
} else {
radioValue = "false";
}
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { className: "text-sm font-semibold text-text-950", children: "Resposta est\xE1 correta?" }),
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-4", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkJR4KWECXjs.Radio_default,
{
name: `isCorrect-${questionData.questionNumber}`,
value: "true",
id: `correct-yes-${questionData.questionNumber}`,
label: "Sim",
size: "medium",
checked: radioValue === "true",
onChange: (e) => {
if (e.target.checked) {
updateEssayCorrection(
questionData.questionNumber,
EssayCorrectionField.IsCorrect,
true
);
}
}
}
),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
_chunkJR4KWECXjs.Radio_default,
{
name: `isCorrect-${questionData.questionNumber}`,
value: "false",
id: `correct-no-${questionData.questionNumber}`,
label: "N\xE3o",
size: "medium",
checked: radioValue === "false",
onChange: (e) => {
if (e.target.checked) {
updateEssayCorrection(
questionData.questionNumber,
EssayCorrectionField.IsCorrect,
false
);
}
}
}
)
] })
] }),
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkANT66KVKjs.Text_default, { className: "text-sm font-semibold text-text-950", children: "Incluir observa\xE7\xE3o" }),
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,