analytica-frontend-lib 1.0.85 → 1.0.87

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.
Files changed (291) hide show
  1. package/dist/Accordation/index.js +0 -1
  2. package/dist/Accordation/index.mjs +0 -1
  3. package/dist/Alert/index.js +0 -1
  4. package/dist/Alert/index.mjs +0 -1
  5. package/dist/AlertDialog/index.js +0 -1
  6. package/dist/AlertDialog/index.mjs +0 -1
  7. package/dist/Alternative/index.js +0 -1
  8. package/dist/Alternative/index.mjs +0 -1
  9. package/dist/Auth/AuthProvider/index.js +0 -1
  10. package/dist/Auth/AuthProvider/index.mjs +0 -1
  11. package/dist/Auth/ProtectedRoute/index.js +0 -1
  12. package/dist/Auth/ProtectedRoute/index.mjs +0 -1
  13. package/dist/Auth/PublicRoute/index.js +0 -1
  14. package/dist/Auth/PublicRoute/index.mjs +0 -1
  15. package/dist/Auth/getRootDomain/index.js +0 -1
  16. package/dist/Auth/getRootDomain/index.mjs +0 -1
  17. package/dist/Auth/index.js +0 -1
  18. package/dist/Auth/index.mjs +0 -1
  19. package/dist/Auth/useApiConfig/index.js +0 -1
  20. package/dist/Auth/useApiConfig/index.mjs +0 -1
  21. package/dist/Auth/useAuth/index.js +0 -1
  22. package/dist/Auth/useAuth/index.mjs +0 -1
  23. package/dist/Auth/useAuthGuard/index.js +0 -1
  24. package/dist/Auth/useAuthGuard/index.mjs +0 -1
  25. package/dist/Auth/useRouteAuth/index.js +0 -1
  26. package/dist/Auth/useRouteAuth/index.mjs +0 -1
  27. package/dist/Auth/useUrlAuthentication/index.js +0 -1
  28. package/dist/Auth/useUrlAuthentication/index.mjs +0 -1
  29. package/dist/Auth/withAuth/index.js +0 -1
  30. package/dist/Auth/withAuth/index.mjs +0 -1
  31. package/dist/Auth/zustandAuthAdapter/index.js +0 -1
  32. package/dist/Auth/zustandAuthAdapter/index.mjs +0 -1
  33. package/dist/Badge/index.js +0 -1
  34. package/dist/Badge/index.mjs +0 -1
  35. package/dist/Button/index.js +0 -1
  36. package/dist/Button/index.mjs +0 -1
  37. package/dist/Calendar/index.js +0 -1
  38. package/dist/Calendar/index.mjs +0 -1
  39. package/dist/Card/index.js +0 -1
  40. package/dist/Card/index.mjs +0 -1
  41. package/dist/CheckBox/index.js +0 -1
  42. package/dist/CheckBox/index.mjs +0 -1
  43. package/dist/Chips/index.js +0 -1
  44. package/dist/Chips/index.mjs +0 -1
  45. package/dist/Divider/index.js +0 -1
  46. package/dist/Divider/index.mjs +0 -1
  47. package/dist/DropdownMenu/index.js +0 -1
  48. package/dist/DropdownMenu/index.mjs +0 -1
  49. package/dist/IconButton/index.js +0 -1
  50. package/dist/IconButton/index.mjs +0 -1
  51. package/dist/IconRoundedButton/index.js +0 -1
  52. package/dist/IconRoundedButton/index.mjs +0 -1
  53. package/dist/Input/index.js +0 -1
  54. package/dist/Input/index.mjs +0 -1
  55. package/dist/Menu/index.js +0 -1
  56. package/dist/Menu/index.mjs +0 -1
  57. package/dist/Modal/index.js +0 -1
  58. package/dist/Modal/index.mjs +0 -1
  59. package/dist/MultipleChoice/index.js +660 -0
  60. package/dist/MultipleChoice/index.mjs +647 -0
  61. package/dist/NavButton/index.js +0 -1
  62. package/dist/NavButton/index.mjs +0 -1
  63. package/dist/NotFound/index.js +0 -1
  64. package/dist/NotFound/index.mjs +0 -1
  65. package/dist/ProgressBar/index.js +0 -1
  66. package/dist/ProgressBar/index.mjs +0 -1
  67. package/dist/ProgressCircle/index.js +0 -1
  68. package/dist/ProgressCircle/index.mjs +0 -1
  69. package/dist/Quiz/index.js +957 -298
  70. package/dist/Quiz/index.mjs +974 -297
  71. package/dist/Quiz/useQuizStore/index.js +79 -35
  72. package/dist/Quiz/useQuizStore/index.mjs +79 -35
  73. package/dist/Radio/index.js +0 -1
  74. package/dist/Radio/index.mjs +0 -1
  75. package/dist/Select/index.js +2 -3
  76. package/dist/Select/index.mjs +2 -3
  77. package/dist/SelectionButton/index.js +0 -1
  78. package/dist/SelectionButton/index.mjs +0 -1
  79. package/dist/Skeleton/index.js +0 -1
  80. package/dist/Skeleton/index.mjs +0 -1
  81. package/dist/Stepper/index.js +0 -1
  82. package/dist/Stepper/index.mjs +0 -1
  83. package/dist/Table/index.js +0 -1
  84. package/dist/Table/index.mjs +0 -1
  85. package/dist/Text/index.js +0 -1
  86. package/dist/Text/index.mjs +0 -1
  87. package/dist/TextArea/index.js +0 -1
  88. package/dist/TextArea/index.mjs +0 -1
  89. package/dist/Toast/ToastStore/index.js +0 -1
  90. package/dist/Toast/ToastStore/index.mjs +0 -1
  91. package/dist/Toast/Toaster/index.js +0 -1
  92. package/dist/Toast/Toaster/index.mjs +0 -1
  93. package/dist/Toast/index.js +0 -1
  94. package/dist/Toast/index.mjs +0 -1
  95. package/dist/index.css +46 -1
  96. package/dist/index.js +1399 -937
  97. package/dist/index.mjs +1340 -868
  98. package/dist/styles.css +46 -1
  99. package/package.json +4 -2
  100. package/dist/Accordation/index.d.mts +0 -12
  101. package/dist/Accordation/index.d.ts +0 -12
  102. package/dist/Accordation/index.js.map +0 -1
  103. package/dist/Accordation/index.mjs.map +0 -1
  104. package/dist/Alert/index.d.mts +0 -13
  105. package/dist/Alert/index.d.ts +0 -13
  106. package/dist/Alert/index.js.map +0 -1
  107. package/dist/Alert/index.mjs.map +0 -1
  108. package/dist/AlertDialog/index.d.mts +0 -36
  109. package/dist/AlertDialog/index.d.ts +0 -36
  110. package/dist/AlertDialog/index.js.map +0 -1
  111. package/dist/AlertDialog/index.mjs.map +0 -1
  112. package/dist/Alternative/index.d.mts +0 -81
  113. package/dist/Alternative/index.d.ts +0 -81
  114. package/dist/Alternative/index.js.map +0 -1
  115. package/dist/Alternative/index.mjs.map +0 -1
  116. package/dist/Auth/AuthProvider/index.d.mts +0 -3
  117. package/dist/Auth/AuthProvider/index.d.ts +0 -3
  118. package/dist/Auth/AuthProvider/index.js.map +0 -1
  119. package/dist/Auth/AuthProvider/index.mjs.map +0 -1
  120. package/dist/Auth/ProtectedRoute/index.d.mts +0 -3
  121. package/dist/Auth/ProtectedRoute/index.d.ts +0 -3
  122. package/dist/Auth/ProtectedRoute/index.js.map +0 -1
  123. package/dist/Auth/ProtectedRoute/index.mjs.map +0 -1
  124. package/dist/Auth/PublicRoute/index.d.mts +0 -3
  125. package/dist/Auth/PublicRoute/index.d.ts +0 -3
  126. package/dist/Auth/PublicRoute/index.js.map +0 -1
  127. package/dist/Auth/PublicRoute/index.mjs.map +0 -1
  128. package/dist/Auth/getRootDomain/index.d.mts +0 -3
  129. package/dist/Auth/getRootDomain/index.d.ts +0 -3
  130. package/dist/Auth/getRootDomain/index.js.map +0 -1
  131. package/dist/Auth/getRootDomain/index.mjs.map +0 -1
  132. package/dist/Auth/index.d.mts +0 -312
  133. package/dist/Auth/index.d.ts +0 -312
  134. package/dist/Auth/index.js.map +0 -1
  135. package/dist/Auth/index.mjs.map +0 -1
  136. package/dist/Auth/useApiConfig/index.d.mts +0 -43
  137. package/dist/Auth/useApiConfig/index.d.ts +0 -43
  138. package/dist/Auth/useApiConfig/index.js.map +0 -1
  139. package/dist/Auth/useApiConfig/index.mjs.map +0 -1
  140. package/dist/Auth/useAuth/index.d.mts +0 -3
  141. package/dist/Auth/useAuth/index.d.ts +0 -3
  142. package/dist/Auth/useAuth/index.js.map +0 -1
  143. package/dist/Auth/useAuth/index.mjs.map +0 -1
  144. package/dist/Auth/useAuthGuard/index.d.mts +0 -3
  145. package/dist/Auth/useAuthGuard/index.d.ts +0 -3
  146. package/dist/Auth/useAuthGuard/index.js.map +0 -1
  147. package/dist/Auth/useAuthGuard/index.mjs.map +0 -1
  148. package/dist/Auth/useRouteAuth/index.d.mts +0 -3
  149. package/dist/Auth/useRouteAuth/index.d.ts +0 -3
  150. package/dist/Auth/useRouteAuth/index.js.map +0 -1
  151. package/dist/Auth/useRouteAuth/index.mjs.map +0 -1
  152. package/dist/Auth/useUrlAuthentication/index.d.mts +0 -58
  153. package/dist/Auth/useUrlAuthentication/index.d.ts +0 -58
  154. package/dist/Auth/useUrlAuthentication/index.js.map +0 -1
  155. package/dist/Auth/useUrlAuthentication/index.mjs.map +0 -1
  156. package/dist/Auth/withAuth/index.d.mts +0 -3
  157. package/dist/Auth/withAuth/index.d.ts +0 -3
  158. package/dist/Auth/withAuth/index.js.map +0 -1
  159. package/dist/Auth/withAuth/index.mjs.map +0 -1
  160. package/dist/Auth/zustandAuthAdapter/index.d.mts +0 -75
  161. package/dist/Auth/zustandAuthAdapter/index.d.ts +0 -75
  162. package/dist/Auth/zustandAuthAdapter/index.js.map +0 -1
  163. package/dist/Auth/zustandAuthAdapter/index.mjs.map +0 -1
  164. package/dist/Badge/index.d.mts +0 -46
  165. package/dist/Badge/index.d.ts +0 -46
  166. package/dist/Badge/index.js.map +0 -1
  167. package/dist/Badge/index.mjs.map +0 -1
  168. package/dist/Button/index.d.mts +0 -45
  169. package/dist/Button/index.d.ts +0 -45
  170. package/dist/Button/index.js.map +0 -1
  171. package/dist/Button/index.mjs.map +0 -1
  172. package/dist/Calendar/index.d.mts +0 -60
  173. package/dist/Calendar/index.d.ts +0 -60
  174. package/dist/Calendar/index.js.map +0 -1
  175. package/dist/Calendar/index.mjs.map +0 -1
  176. package/dist/Card/index.d.mts +0 -150
  177. package/dist/Card/index.d.ts +0 -150
  178. package/dist/Card/index.js.map +0 -1
  179. package/dist/Card/index.mjs.map +0 -1
  180. package/dist/CheckBox/index.d.mts +0 -74
  181. package/dist/CheckBox/index.d.ts +0 -74
  182. package/dist/CheckBox/index.js.map +0 -1
  183. package/dist/CheckBox/index.mjs.map +0 -1
  184. package/dist/Chips/index.d.mts +0 -41
  185. package/dist/Chips/index.d.ts +0 -41
  186. package/dist/Chips/index.js.map +0 -1
  187. package/dist/Chips/index.mjs.map +0 -1
  188. package/dist/Divider/index.d.mts +0 -32
  189. package/dist/Divider/index.d.ts +0 -32
  190. package/dist/Divider/index.js.map +0 -1
  191. package/dist/Divider/index.mjs.map +0 -1
  192. package/dist/DropdownMenu/index.d.mts +0 -68
  193. package/dist/DropdownMenu/index.d.ts +0 -68
  194. package/dist/DropdownMenu/index.js.map +0 -1
  195. package/dist/DropdownMenu/index.mjs.map +0 -1
  196. package/dist/IconButton/index.d.mts +0 -76
  197. package/dist/IconButton/index.d.ts +0 -76
  198. package/dist/IconButton/index.js.map +0 -1
  199. package/dist/IconButton/index.mjs.map +0 -1
  200. package/dist/IconRoundedButton/index.d.mts +0 -34
  201. package/dist/IconRoundedButton/index.d.ts +0 -34
  202. package/dist/IconRoundedButton/index.js.map +0 -1
  203. package/dist/IconRoundedButton/index.mjs.map +0 -1
  204. package/dist/Input/index.d.mts +0 -27
  205. package/dist/Input/index.d.ts +0 -27
  206. package/dist/Input/index.js.map +0 -1
  207. package/dist/Input/index.mjs.map +0 -1
  208. package/dist/Menu/index.d.mts +0 -48
  209. package/dist/Menu/index.d.ts +0 -48
  210. package/dist/Menu/index.js.map +0 -1
  211. package/dist/Menu/index.mjs.map +0 -1
  212. package/dist/Modal/index.d.mts +0 -66
  213. package/dist/Modal/index.d.ts +0 -66
  214. package/dist/Modal/index.js.map +0 -1
  215. package/dist/Modal/index.mjs.map +0 -1
  216. package/dist/NavButton/index.d.mts +0 -57
  217. package/dist/NavButton/index.d.ts +0 -57
  218. package/dist/NavButton/index.js.map +0 -1
  219. package/dist/NavButton/index.mjs.map +0 -1
  220. package/dist/NotFound/index.d.mts +0 -58
  221. package/dist/NotFound/index.d.ts +0 -58
  222. package/dist/NotFound/index.js.map +0 -1
  223. package/dist/NotFound/index.mjs.map +0 -1
  224. package/dist/ProgressBar/index.d.mts +0 -95
  225. package/dist/ProgressBar/index.d.ts +0 -95
  226. package/dist/ProgressBar/index.js.map +0 -1
  227. package/dist/ProgressBar/index.mjs.map +0 -1
  228. package/dist/ProgressCircle/index.d.mts +0 -60
  229. package/dist/ProgressCircle/index.d.ts +0 -60
  230. package/dist/ProgressCircle/index.js.map +0 -1
  231. package/dist/ProgressCircle/index.mjs.map +0 -1
  232. package/dist/Quiz/index.d.mts +0 -52
  233. package/dist/Quiz/index.d.ts +0 -52
  234. package/dist/Quiz/index.js.map +0 -1
  235. package/dist/Quiz/index.mjs.map +0 -1
  236. package/dist/Quiz/useQuizStore/index.d.mts +0 -140
  237. package/dist/Quiz/useQuizStore/index.d.ts +0 -140
  238. package/dist/Quiz/useQuizStore/index.js.map +0 -1
  239. package/dist/Quiz/useQuizStore/index.mjs.map +0 -1
  240. package/dist/Radio/index.d.mts +0 -203
  241. package/dist/Radio/index.d.ts +0 -203
  242. package/dist/Radio/index.js.map +0 -1
  243. package/dist/Radio/index.mjs.map +0 -1
  244. package/dist/Select/index.d.mts +0 -58
  245. package/dist/Select/index.d.ts +0 -58
  246. package/dist/Select/index.js.map +0 -1
  247. package/dist/Select/index.mjs.map +0 -1
  248. package/dist/SelectionButton/index.d.mts +0 -57
  249. package/dist/SelectionButton/index.d.ts +0 -57
  250. package/dist/SelectionButton/index.js.map +0 -1
  251. package/dist/SelectionButton/index.mjs.map +0 -1
  252. package/dist/Skeleton/index.d.mts +0 -40
  253. package/dist/Skeleton/index.d.ts +0 -40
  254. package/dist/Skeleton/index.js.map +0 -1
  255. package/dist/Skeleton/index.mjs.map +0 -1
  256. package/dist/Stepper/index.d.mts +0 -169
  257. package/dist/Stepper/index.d.ts +0 -169
  258. package/dist/Stepper/index.js.map +0 -1
  259. package/dist/Stepper/index.mjs.map +0 -1
  260. package/dist/Table/index.d.mts +0 -17
  261. package/dist/Table/index.d.ts +0 -17
  262. package/dist/Table/index.js.map +0 -1
  263. package/dist/Table/index.mjs.map +0 -1
  264. package/dist/Text/index.d.mts +0 -58
  265. package/dist/Text/index.d.ts +0 -58
  266. package/dist/Text/index.js.map +0 -1
  267. package/dist/Text/index.mjs.map +0 -1
  268. package/dist/TextArea/index.d.mts +0 -70
  269. package/dist/TextArea/index.d.ts +0 -70
  270. package/dist/TextArea/index.js.map +0 -1
  271. package/dist/TextArea/index.mjs.map +0 -1
  272. package/dist/Toast/ToastStore/index.d.mts +0 -19
  273. package/dist/Toast/ToastStore/index.d.ts +0 -19
  274. package/dist/Toast/ToastStore/index.js.map +0 -1
  275. package/dist/Toast/ToastStore/index.mjs.map +0 -1
  276. package/dist/Toast/Toaster/index.d.mts +0 -16
  277. package/dist/Toast/Toaster/index.d.ts +0 -16
  278. package/dist/Toast/Toaster/index.js.map +0 -1
  279. package/dist/Toast/Toaster/index.mjs.map +0 -1
  280. package/dist/Toast/index.d.mts +0 -17
  281. package/dist/Toast/index.d.ts +0 -17
  282. package/dist/Toast/index.js.map +0 -1
  283. package/dist/Toast/index.mjs.map +0 -1
  284. package/dist/index.css.map +0 -1
  285. package/dist/index.d.mts +0 -41
  286. package/dist/index.d.ts +0 -41
  287. package/dist/index.js.map +0 -1
  288. package/dist/index.mjs.map +0 -1
  289. package/dist/styles.css.map +0 -1
  290. package/dist/styles.d.mts +0 -2
  291. package/dist/styles.d.ts +0 -2
@@ -28,6 +28,7 @@ __export(Quiz_exports, {
28
28
  QuizHeaderResult: () => QuizHeaderResult,
29
29
  QuizListResult: () => QuizListResult,
30
30
  QuizListResultByMateria: () => QuizListResultByMateria,
31
+ QuizMultipleChoice: () => QuizMultipleChoice,
31
32
  QuizQuestionList: () => QuizQuestionList,
32
33
  QuizResultHeaderTitle: () => QuizResultHeaderTitle,
33
34
  QuizResultPerformance: () => QuizResultPerformance,
@@ -35,7 +36,7 @@ __export(Quiz_exports, {
35
36
  QuizTitle: () => QuizTitle
36
37
  });
37
38
  module.exports = __toCommonJS(Quiz_exports);
38
- var import_phosphor_react6 = require("phosphor-react");
39
+ var import_phosphor_react8 = require("phosphor-react");
39
40
 
40
41
  // src/components/Badge/Badge.tsx
41
42
  var import_phosphor_react = require("phosphor-react");
@@ -951,7 +952,7 @@ IconButton.displayName = "IconButton";
951
952
  var IconButton_default = IconButton;
952
953
 
953
954
  // src/components/Quiz/Quiz.tsx
954
- var import_react8 = require("react");
955
+ var import_react11 = require("react");
955
956
 
956
957
  // src/components/Quiz/useQuizStore.ts
957
958
  var import_zustand2 = require("zustand");
@@ -992,6 +993,7 @@ var useQuizStore = (0, import_zustand2.create)()(
992
993
  setByActivity: (atividade) => set({ byActivity: atividade }),
993
994
  setByQuestionary: (aula) => set({ byQuestionary: aula }),
994
995
  setUserId: (userId) => set({ userId }),
996
+ setUserAnswers: (userAnswers) => set({ userAnswers }),
995
997
  getUserId: () => get().userId,
996
998
  // Navigation
997
999
  goToNextQuestion: () => {
@@ -1028,16 +1030,9 @@ var useQuizStore = (0, import_zustand2.create)()(
1028
1030
  const { getActiveQuiz, userAnswers } = get();
1029
1031
  const activeQuiz = getActiveQuiz();
1030
1032
  if (!activeQuiz) return;
1031
- const updatedQuestions = activeQuiz.quiz.questions.map(
1032
- (question) => question.id === questionId ? { ...question, answerKey: answerId } : question
1033
- );
1034
- const updatedQuiz = {
1035
- ...activeQuiz.quiz,
1036
- questions: updatedQuestions
1037
- };
1038
1033
  const activityId = activeQuiz.quiz.id;
1039
1034
  const userId = get().getUserId();
1040
- if (!userId) {
1035
+ if (!userId || userId === "") {
1041
1036
  console.warn("selectAnswer called before userId is set");
1042
1037
  return;
1043
1038
  }
@@ -1048,7 +1043,7 @@ var useQuizStore = (0, import_zustand2.create)()(
1048
1043
  questionId,
1049
1044
  activityId,
1050
1045
  userId,
1051
- answer: answerId,
1046
+ answer: null,
1052
1047
  optionId: answerId
1053
1048
  };
1054
1049
  let updatedUserAnswers;
@@ -1059,7 +1054,36 @@ var useQuizStore = (0, import_zustand2.create)()(
1059
1054
  updatedUserAnswers = [...userAnswers, newUserAnswer];
1060
1055
  }
1061
1056
  set({
1062
- [activeQuiz.type]: updatedQuiz,
1057
+ userAnswers: updatedUserAnswers
1058
+ });
1059
+ },
1060
+ selectMultipleAnswer: (questionId, answerIds) => {
1061
+ const { getActiveQuiz, userAnswers } = get();
1062
+ const activeQuiz = getActiveQuiz();
1063
+ if (!activeQuiz) return;
1064
+ const activityId = activeQuiz.quiz.id;
1065
+ const userId = get().getUserId();
1066
+ if (!userId || userId === "") {
1067
+ console.warn("selectMultipleAnswer called before userId is set");
1068
+ return;
1069
+ }
1070
+ const filteredUserAnswers = userAnswers.filter(
1071
+ (answer) => answer.questionId !== questionId
1072
+ );
1073
+ const newUserAnswers = answerIds.map(
1074
+ (answerId) => ({
1075
+ questionId,
1076
+ activityId,
1077
+ userId,
1078
+ answer: null,
1079
+ optionId: answerId
1080
+ })
1081
+ );
1082
+ const updatedUserAnswers = [
1083
+ ...filteredUserAnswers,
1084
+ ...newUserAnswers
1085
+ ];
1086
+ set({
1063
1087
  userAnswers: updatedUserAnswers
1064
1088
  });
1065
1089
  },
@@ -1071,6 +1095,10 @@ var useQuizStore = (0, import_zustand2.create)()(
1071
1095
  if (currentQuestion) {
1072
1096
  const activityId = activeQuiz.quiz.id;
1073
1097
  const userId = get().getUserId();
1098
+ if (!userId || userId === "") {
1099
+ console.warn("skipQuestion called before userId is set");
1100
+ return;
1101
+ }
1074
1102
  const existingAnswerIndex = userAnswers.findIndex(
1075
1103
  (answer) => answer.questionId === currentQuestion.id
1076
1104
  );
@@ -1099,6 +1127,10 @@ var useQuizStore = (0, import_zustand2.create)()(
1099
1127
  if (!activeQuiz) return;
1100
1128
  const activityId = activeQuiz.quiz.id;
1101
1129
  const userId = get().getUserId();
1130
+ if (!userId || userId === "") {
1131
+ console.warn("addUserAnswer called before userId is set");
1132
+ return;
1133
+ }
1102
1134
  const existingAnswerIndex = userAnswers.findIndex(
1103
1135
  (answer) => answer.questionId === questionId
1104
1136
  );
@@ -1106,7 +1138,7 @@ var useQuizStore = (0, import_zustand2.create)()(
1106
1138
  questionId,
1107
1139
  activityId,
1108
1140
  userId,
1109
- answer: answerId || null,
1141
+ answer: null,
1110
1142
  optionId: answerId || null
1111
1143
  };
1112
1144
  if (existingAnswerIndex !== -1) {
@@ -1157,7 +1189,7 @@ var useQuizStore = (0, import_zustand2.create)()(
1157
1189
  },
1158
1190
  getAnsweredQuestions: () => {
1159
1191
  const { userAnswers } = get();
1160
- return userAnswers.filter((answer) => answer.answer !== null).length;
1192
+ return userAnswers.filter((answer) => answer.optionId !== null).length;
1161
1193
  },
1162
1194
  getUnansweredQuestions: () => {
1163
1195
  const { getActiveQuiz, userAnswers } = get();
@@ -1168,8 +1200,8 @@ var useQuizStore = (0, import_zustand2.create)()(
1168
1200
  const userAnswer = userAnswers.find(
1169
1201
  (answer) => answer.questionId === question.id
1170
1202
  );
1171
- const isAnswered = userAnswer && userAnswer.answer !== null;
1172
- const isSkipped = userAnswer && userAnswer.answer === null;
1203
+ const isAnswered = userAnswer && userAnswer.optionId !== null;
1204
+ const isSkipped = userAnswer && userAnswer.optionId === null;
1173
1205
  if (!isAnswered && !isSkipped) {
1174
1206
  unansweredQuestions.push(index + 1);
1175
1207
  }
@@ -1178,7 +1210,7 @@ var useQuizStore = (0, import_zustand2.create)()(
1178
1210
  },
1179
1211
  getSkippedQuestions: () => {
1180
1212
  const { userAnswers } = get();
1181
- return userAnswers.filter((answer) => answer.answer === null).length;
1213
+ return userAnswers.filter((answer) => answer.optionId === null).length;
1182
1214
  },
1183
1215
  getProgress: () => {
1184
1216
  const { getTotalQuestions, getAnsweredQuestions } = get();
@@ -1191,14 +1223,14 @@ var useQuizStore = (0, import_zustand2.create)()(
1191
1223
  const userAnswer = userAnswers.find(
1192
1224
  (answer) => answer.questionId === questionId
1193
1225
  );
1194
- return userAnswer ? userAnswer.answer !== null : false;
1226
+ return userAnswer ? userAnswer.optionId !== null : false;
1195
1227
  },
1196
1228
  isQuestionSkipped: (questionId) => {
1197
1229
  const { userAnswers } = get();
1198
1230
  const userAnswer = userAnswers.find(
1199
1231
  (answer) => answer.questionId === questionId
1200
1232
  );
1201
- return userAnswer ? userAnswer.answer === null : false;
1233
+ return userAnswer ? userAnswer.optionId === null : false;
1202
1234
  },
1203
1235
  getCurrentAnswer: () => {
1204
1236
  const { getCurrentQuestion, userAnswers } = get();
@@ -1207,7 +1239,16 @@ var useQuizStore = (0, import_zustand2.create)()(
1207
1239
  const userAnswer = userAnswers.find(
1208
1240
  (answer) => answer.questionId === currentQuestion.id
1209
1241
  );
1210
- return userAnswer?.answer;
1242
+ return userAnswer?.optionId;
1243
+ },
1244
+ getAllCurrentAnswer: () => {
1245
+ const { getCurrentQuestion, userAnswers } = get();
1246
+ const currentQuestion = getCurrentQuestion();
1247
+ if (!currentQuestion) return void 0;
1248
+ const userAnswer = userAnswers.filter(
1249
+ (answer) => answer.questionId === currentQuestion.id
1250
+ );
1251
+ return userAnswer;
1211
1252
  },
1212
1253
  getQuizTitle: () => {
1213
1254
  const { getActiveQuiz } = get();
@@ -1220,18 +1261,8 @@ var useQuizStore = (0, import_zustand2.create)()(
1220
1261
  return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
1221
1262
  },
1222
1263
  getUserAnswers: () => {
1223
- const { getActiveQuiz, userAnswers } = get();
1224
- const activeQuiz = getActiveQuiz();
1225
- if (!activeQuiz) return [];
1226
- return activeQuiz.quiz.questions.map((question) => {
1227
- const userAnswer = userAnswers.find(
1228
- (answer) => answer.questionId === question.id
1229
- );
1230
- return {
1231
- ...question,
1232
- isSkipped: userAnswer ? userAnswer.answer === null : false
1233
- };
1234
- });
1264
+ const { userAnswers } = get();
1265
+ return userAnswers;
1235
1266
  },
1236
1267
  getUnansweredQuestionsFromUserAnswers: () => {
1237
1268
  const { getActiveQuiz, userAnswers } = get();
@@ -1242,8 +1273,8 @@ var useQuizStore = (0, import_zustand2.create)()(
1242
1273
  const userAnswer = userAnswers.find(
1243
1274
  (answer) => answer.questionId === question.id
1244
1275
  );
1245
- const hasAnswer = userAnswer && userAnswer.answer !== null;
1246
- const isSkipped = userAnswer && userAnswer.answer === null;
1276
+ const hasAnswer = userAnswer && userAnswer.optionId !== null;
1277
+ const isSkipped = userAnswer && userAnswer.optionId === null;
1247
1278
  if (!hasAnswer || isSkipped) {
1248
1279
  unansweredQuestions.push(index + 1);
1249
1280
  }
@@ -1274,7 +1305,7 @@ var useQuizStore = (0, import_zustand2.create)()(
1274
1305
  const answer = userAnswers.find(
1275
1306
  (answer2) => answer2.questionId === questionId
1276
1307
  );
1277
- return answer ? answer.answer !== null : false;
1308
+ return answer ? answer.optionId !== null : false;
1278
1309
  },
1279
1310
  getQuestionStatusFromUserAnswers: (questionId) => {
1280
1311
  const { userAnswers } = get();
@@ -1282,12 +1313,27 @@ var useQuizStore = (0, import_zustand2.create)()(
1282
1313
  (answer2) => answer2.questionId === questionId
1283
1314
  );
1284
1315
  if (!answer) return "unanswered";
1285
- if (answer.answer === null) return "skipped";
1316
+ if (answer.optionId === null) return "skipped";
1286
1317
  return "answered";
1287
1318
  },
1288
1319
  getUserAnswersForActivity: () => {
1289
1320
  const { userAnswers } = get();
1290
1321
  return userAnswers;
1322
+ },
1323
+ setCurrentQuestion: (question) => {
1324
+ const { getActiveQuiz } = get();
1325
+ const activeQuiz = getActiveQuiz();
1326
+ if (!activeQuiz) return;
1327
+ const questionIndex = activeQuiz.quiz.questions.findIndex(
1328
+ (q) => q.id === question.id
1329
+ );
1330
+ if (questionIndex === -1) {
1331
+ console.warn(
1332
+ `Question with id "${question.id}" not found in active quiz`
1333
+ );
1334
+ return;
1335
+ }
1336
+ set({ currentQuestionIndex: questionIndex });
1291
1337
  }
1292
1338
  };
1293
1339
  },
@@ -1792,7 +1838,7 @@ var SelectContent = (0, import_react6.forwardRef)(
1792
1838
  role: "menu",
1793
1839
  ref,
1794
1840
  className: cn(
1795
- "bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border-100",
1841
+ "bg-secondary z-50 min-w-[210px] overflow-hidden rounded-md border p-1 shadow-md border-border-100",
1796
1842
  getPositionClasses(),
1797
1843
  className
1798
1844
  ),
@@ -1837,7 +1883,7 @@ var SelectItem = (0, import_react6.forwardRef)(
1837
1883
  "aria-disabled": disabled,
1838
1884
  ref,
1839
1885
  className: `
1840
- focus-visible:bg-background-50
1886
+ bg-secondary focus-visible:bg-background-50
1841
1887
  relative flex select-none items-center gap-2 rounded-sm p-3 outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
1842
1888
  ${className}
1843
1889
  ${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
@@ -3711,10 +3757,484 @@ var ProgressCircle = ({
3711
3757
  };
3712
3758
  var ProgressCircle_default = ProgressCircle;
3713
3759
 
3714
- // src/components/Quiz/Quiz.tsx
3760
+ // src/components/MultipleChoice/MultipleChoice.tsx
3761
+ var import_react10 = require("react");
3762
+
3763
+ // src/components/CheckBox/CheckboxList.tsx
3764
+ var import_react9 = require("react");
3765
+ var import_zustand4 = require("zustand");
3766
+
3767
+ // src/components/CheckBox/CheckBox.tsx
3768
+ var import_react8 = require("react");
3769
+ var import_phosphor_react6 = require("phosphor-react");
3715
3770
  var import_jsx_runtime13 = require("react/jsx-runtime");
3716
- var Quiz = (0, import_react8.forwardRef)(({ children, className, ...props }, ref) => {
3717
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3771
+ var SIZE_CLASSES9 = {
3772
+ small: {
3773
+ checkbox: "w-4 h-4",
3774
+ // 16px x 16px
3775
+ textSize: "sm",
3776
+ spacing: "gap-1.5",
3777
+ // 6px
3778
+ borderWidth: "border-2",
3779
+ iconSize: 14,
3780
+ // pixels for Phosphor icons
3781
+ labelHeight: "h-[21px]"
3782
+ },
3783
+ medium: {
3784
+ checkbox: "w-5 h-5",
3785
+ // 20px x 20px
3786
+ textSize: "md",
3787
+ spacing: "gap-2",
3788
+ // 8px
3789
+ borderWidth: "border-2",
3790
+ iconSize: 16,
3791
+ // pixels for Phosphor icons
3792
+ labelHeight: "h-6"
3793
+ },
3794
+ large: {
3795
+ checkbox: "w-6 h-6",
3796
+ // 24px x 24px
3797
+ textSize: "lg",
3798
+ spacing: "gap-2",
3799
+ // 8px
3800
+ borderWidth: "border-[3px]",
3801
+ // 3px border
3802
+ iconSize: 20,
3803
+ // pixels for Phosphor icons
3804
+ labelHeight: "h-[27px]"
3805
+ }
3806
+ };
3807
+ var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
3808
+ var STATE_CLASSES2 = {
3809
+ default: {
3810
+ unchecked: "border-border-400 bg-background hover:border-border-500",
3811
+ checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
3812
+ },
3813
+ hovered: {
3814
+ unchecked: "border-border-500 bg-background",
3815
+ checked: "border-primary-800 bg-primary-800 text-text"
3816
+ },
3817
+ focused: {
3818
+ unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
3819
+ checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
3820
+ },
3821
+ invalid: {
3822
+ unchecked: "border-error-700 bg-background hover:border-error-600",
3823
+ checked: "border-error-700 bg-primary-950 text-text"
3824
+ },
3825
+ disabled: {
3826
+ unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
3827
+ checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
3828
+ }
3829
+ };
3830
+ var CheckBox = (0, import_react8.forwardRef)(
3831
+ ({
3832
+ label,
3833
+ size = "medium",
3834
+ state = "default",
3835
+ indeterminate = false,
3836
+ errorMessage,
3837
+ helperText,
3838
+ className = "",
3839
+ labelClassName = "",
3840
+ checked: checkedProp,
3841
+ disabled,
3842
+ id,
3843
+ onChange,
3844
+ ...props
3845
+ }, ref) => {
3846
+ const generatedId = (0, import_react8.useId)();
3847
+ const inputId = id ?? `checkbox-${generatedId}`;
3848
+ const [internalChecked, setInternalChecked] = (0, import_react8.useState)(false);
3849
+ const isControlled = checkedProp !== void 0;
3850
+ const checked = isControlled ? checkedProp : internalChecked;
3851
+ const handleChange = (event) => {
3852
+ if (!isControlled) {
3853
+ setInternalChecked(event.target.checked);
3854
+ }
3855
+ onChange?.(event);
3856
+ };
3857
+ const currentState = disabled ? "disabled" : state;
3858
+ const sizeClasses = SIZE_CLASSES9[size];
3859
+ const checkVariant = checked || indeterminate ? "checked" : "unchecked";
3860
+ const stylingClasses = STATE_CLASSES2[currentState][checkVariant];
3861
+ const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
3862
+ const checkboxClasses = cn(
3863
+ BASE_CHECKBOX_CLASSES,
3864
+ sizeClasses.checkbox,
3865
+ borderWidthClass,
3866
+ stylingClasses,
3867
+ className
3868
+ );
3869
+ const renderIcon = () => {
3870
+ if (indeterminate) {
3871
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3872
+ import_phosphor_react6.Minus,
3873
+ {
3874
+ size: sizeClasses.iconSize,
3875
+ weight: "bold",
3876
+ color: "currentColor"
3877
+ }
3878
+ );
3879
+ }
3880
+ if (checked) {
3881
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3882
+ import_phosphor_react6.Check,
3883
+ {
3884
+ size: sizeClasses.iconSize,
3885
+ weight: "bold",
3886
+ color: "currentColor"
3887
+ }
3888
+ );
3889
+ }
3890
+ return null;
3891
+ };
3892
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col", children: [
3893
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3894
+ "div",
3895
+ {
3896
+ className: cn(
3897
+ "flex flex-row items-center",
3898
+ sizeClasses.spacing,
3899
+ disabled ? "opacity-40" : ""
3900
+ ),
3901
+ children: [
3902
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3903
+ "input",
3904
+ {
3905
+ ref,
3906
+ type: "checkbox",
3907
+ id: inputId,
3908
+ checked,
3909
+ disabled,
3910
+ onChange: handleChange,
3911
+ className: "sr-only",
3912
+ ...props
3913
+ }
3914
+ ),
3915
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
3916
+ label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3917
+ "div",
3918
+ {
3919
+ className: cn(
3920
+ "flex flex-row items-center",
3921
+ sizeClasses.labelHeight
3922
+ ),
3923
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3924
+ Text_default,
3925
+ {
3926
+ as: "label",
3927
+ htmlFor: inputId,
3928
+ size: sizeClasses.textSize,
3929
+ weight: "normal",
3930
+ className: cn(
3931
+ "cursor-pointer select-none leading-[150%] flex items-center font-roboto",
3932
+ labelClassName
3933
+ ),
3934
+ children: label
3935
+ }
3936
+ )
3937
+ }
3938
+ )
3939
+ ]
3940
+ }
3941
+ ),
3942
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3943
+ Text_default,
3944
+ {
3945
+ size: "sm",
3946
+ weight: "normal",
3947
+ className: "mt-1.5",
3948
+ color: "text-error-600",
3949
+ children: errorMessage
3950
+ }
3951
+ ),
3952
+ helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3953
+ Text_default,
3954
+ {
3955
+ size: "sm",
3956
+ weight: "normal",
3957
+ className: "mt-1.5",
3958
+ color: "text-text-500",
3959
+ children: helperText
3960
+ }
3961
+ )
3962
+ ] });
3963
+ }
3964
+ );
3965
+ CheckBox.displayName = "CheckBox";
3966
+ var CheckBox_default = CheckBox;
3967
+
3968
+ // src/components/CheckBox/CheckboxList.tsx
3969
+ var import_jsx_runtime14 = require("react/jsx-runtime");
3970
+ var createCheckboxListStore = (name, defaultValues, disabled, onValuesChange) => (0, import_zustand4.create)((set, get) => ({
3971
+ values: defaultValues,
3972
+ setValues: (values) => {
3973
+ if (!get().disabled) {
3974
+ set({ values });
3975
+ get().onValuesChange?.(values);
3976
+ }
3977
+ },
3978
+ toggleValue: (value) => {
3979
+ if (!get().disabled) {
3980
+ const currentValues = get().values;
3981
+ const newValues = currentValues.includes(value) ? currentValues.filter((v) => v !== value) : [...currentValues, value];
3982
+ set({ values: newValues });
3983
+ get().onValuesChange?.(newValues);
3984
+ }
3985
+ },
3986
+ onValuesChange,
3987
+ disabled,
3988
+ name
3989
+ }));
3990
+ var useCheckboxListStore = (externalStore) => {
3991
+ if (!externalStore) {
3992
+ throw new Error("CheckboxListItem must be used within a CheckboxList");
3993
+ }
3994
+ return externalStore;
3995
+ };
3996
+ var injectStore3 = (children, store) => import_react9.Children.map(children, (child) => {
3997
+ if (!(0, import_react9.isValidElement)(child)) return child;
3998
+ const typedChild = child;
3999
+ const shouldInject = typedChild.type === CheckboxListItem;
4000
+ return (0, import_react9.cloneElement)(typedChild, {
4001
+ ...shouldInject ? { store } : {},
4002
+ ...typedChild.props.children ? { children: injectStore3(typedChild.props.children, store) } : {}
4003
+ });
4004
+ });
4005
+ var CheckboxList = (0, import_react9.forwardRef)(
4006
+ ({
4007
+ values: propValues,
4008
+ defaultValues = [],
4009
+ onValuesChange,
4010
+ name: propName,
4011
+ disabled = false,
4012
+ className = "",
4013
+ children,
4014
+ ...props
4015
+ }, ref) => {
4016
+ const generatedId = (0, import_react9.useId)();
4017
+ const name = propName || `checkbox-list-${generatedId}`;
4018
+ const storeRef = (0, import_react9.useRef)(null);
4019
+ storeRef.current ??= createCheckboxListStore(
4020
+ name,
4021
+ defaultValues,
4022
+ disabled,
4023
+ onValuesChange
4024
+ );
4025
+ const store = storeRef.current;
4026
+ const { setValues } = (0, import_zustand4.useStore)(store, (s) => s);
4027
+ (0, import_react9.useEffect)(() => {
4028
+ const currentValues = store.getState().values;
4029
+ if (currentValues.length > 0 && onValuesChange) {
4030
+ onValuesChange(currentValues);
4031
+ }
4032
+ }, []);
4033
+ (0, import_react9.useEffect)(() => {
4034
+ if (propValues !== void 0) {
4035
+ setValues(propValues);
4036
+ }
4037
+ }, [propValues, setValues]);
4038
+ (0, import_react9.useEffect)(() => {
4039
+ store.setState({ disabled });
4040
+ }, [disabled, store]);
4041
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4042
+ "div",
4043
+ {
4044
+ ref,
4045
+ className: cn("flex flex-col gap-2 w-full", className),
4046
+ "aria-label": name,
4047
+ ...props,
4048
+ children: injectStore3(children, store)
4049
+ }
4050
+ );
4051
+ }
4052
+ );
4053
+ CheckboxList.displayName = "CheckboxList";
4054
+ var CheckboxListItem = (0, import_react9.forwardRef)(
4055
+ ({
4056
+ value,
4057
+ store: externalStore,
4058
+ disabled: itemDisabled,
4059
+ size = "medium",
4060
+ state = "default",
4061
+ className = "",
4062
+ id,
4063
+ ...props
4064
+ }, ref) => {
4065
+ const store = useCheckboxListStore(externalStore);
4066
+ const {
4067
+ values: groupValues,
4068
+ toggleValue,
4069
+ disabled: groupDisabled,
4070
+ name
4071
+ } = (0, import_zustand4.useStore)(store);
4072
+ const generatedId = (0, import_react9.useId)();
4073
+ const inputId = id ?? `checkbox-item-${generatedId}`;
4074
+ const isChecked = groupValues.includes(value);
4075
+ const isDisabled = groupDisabled || itemDisabled;
4076
+ const currentState = isDisabled ? "disabled" : state;
4077
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4078
+ CheckBox_default,
4079
+ {
4080
+ ref,
4081
+ id: inputId,
4082
+ name,
4083
+ value,
4084
+ checked: isChecked,
4085
+ disabled: isDisabled,
4086
+ size,
4087
+ state: currentState,
4088
+ className,
4089
+ onChange: () => {
4090
+ if (!isDisabled) {
4091
+ toggleValue(value);
4092
+ }
4093
+ },
4094
+ ...props
4095
+ }
4096
+ );
4097
+ }
4098
+ );
4099
+ CheckboxListItem.displayName = "CheckboxListItem";
4100
+ var CheckboxList_default = CheckboxList;
4101
+
4102
+ // src/components/MultipleChoice/MultipleChoice.tsx
4103
+ var import_phosphor_react7 = require("phosphor-react");
4104
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4105
+ var MultipleChoiceList = ({
4106
+ disabled = false,
4107
+ className = "",
4108
+ choices,
4109
+ name,
4110
+ selectedValues,
4111
+ onHandleSelectedValues,
4112
+ mode = "interactive"
4113
+ }) => {
4114
+ const [actualValue, setActualValue] = (0, import_react10.useState)(selectedValues);
4115
+ (0, import_react10.useEffect)(() => {
4116
+ setActualValue(selectedValues);
4117
+ }, [selectedValues]);
4118
+ const getStatusBadge = (status) => {
4119
+ switch (status) {
4120
+ case "correct":
4121
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_phosphor_react7.CheckCircle, {}), children: "Resposta correta" });
4122
+ case "incorrect":
4123
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_phosphor_react7.XCircle, {}), children: "Resposta incorreta" });
4124
+ default:
4125
+ return null;
4126
+ }
4127
+ };
4128
+ const getStatusStyles = (status) => {
4129
+ switch (status) {
4130
+ case "correct":
4131
+ return "bg-success-background border-success-300";
4132
+ case "incorrect":
4133
+ return "bg-error-background border-error-300";
4134
+ default:
4135
+ return `bg-background border-border-100`;
4136
+ }
4137
+ };
4138
+ const renderVisualCheckbox = (isSelected, isDisabled) => {
4139
+ const checkboxClasses = cn(
4140
+ "w-5 h-5 rounded border-2 cursor-default transition-all duration-200 flex items-center justify-center",
4141
+ isSelected ? "border-primary-950 bg-primary-950 text-text" : "border-border-400 bg-background",
4142
+ isDisabled && "opacity-40 cursor-not-allowed"
4143
+ );
4144
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: checkboxClasses, children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_phosphor_react7.Check, { size: 16, weight: "bold" }) });
4145
+ };
4146
+ if (mode === "readonly") {
4147
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn("flex flex-col gap-2", className), children: choices.map((choice, i) => {
4148
+ const isSelected = actualValue?.includes(choice.value) || false;
4149
+ const statusStyles = getStatusStyles(choice.status);
4150
+ const statusBadge = getStatusBadge(choice.status);
4151
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4152
+ "div",
4153
+ {
4154
+ className: cn(
4155
+ "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
4156
+ statusStyles,
4157
+ choice.disabled ? "opacity-50 cursor-not-allowed" : ""
4158
+ ),
4159
+ children: [
4160
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
4161
+ renderVisualCheckbox(isSelected, choice.disabled || disabled),
4162
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4163
+ "span",
4164
+ {
4165
+ className: cn(
4166
+ "flex-1",
4167
+ isSelected || choice.status && choice.status != "neutral" ? "text-text-950" : "text-text-600",
4168
+ choice.disabled || disabled ? "cursor-not-allowed" : "cursor-default"
4169
+ ),
4170
+ children: choice.label
4171
+ }
4172
+ )
4173
+ ] }),
4174
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
4175
+ ]
4176
+ },
4177
+ `readonly-${choice.value}-${i}`
4178
+ );
4179
+ }) });
4180
+ }
4181
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4182
+ "div",
4183
+ {
4184
+ className: cn(
4185
+ "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
4186
+ disabled ? "opacity-50 cursor-not-allowed" : "",
4187
+ className
4188
+ ),
4189
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4190
+ CheckboxList_default,
4191
+ {
4192
+ name,
4193
+ values: actualValue,
4194
+ onValuesChange: (v) => {
4195
+ setActualValue(v);
4196
+ onHandleSelectedValues?.(v);
4197
+ },
4198
+ disabled,
4199
+ children: choices.map((choice, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4200
+ "div",
4201
+ {
4202
+ className: "flex flex-row gap-2 items-center",
4203
+ children: [
4204
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4205
+ CheckboxListItem,
4206
+ {
4207
+ value: choice.value,
4208
+ id: `interactive-${choice.value}-${i}`,
4209
+ disabled: choice.disabled || disabled
4210
+ }
4211
+ ),
4212
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4213
+ "label",
4214
+ {
4215
+ htmlFor: `interactive-${choice.value}-${i}`,
4216
+ className: cn(
4217
+ "flex-1",
4218
+ actualValue?.includes(choice.value) ? "text-text-950" : "text-text-600",
4219
+ choice.disabled || disabled ? "cursor-not-allowed" : "cursor-pointer"
4220
+ ),
4221
+ children: choice.label
4222
+ }
4223
+ )
4224
+ ]
4225
+ },
4226
+ `interactive-${choice.value}-${i}`
4227
+ ))
4228
+ }
4229
+ )
4230
+ }
4231
+ );
4232
+ };
4233
+
4234
+ // src/components/Quiz/Quiz.tsx
4235
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4236
+ var Quiz = (0, import_react11.forwardRef)(({ children, className, ...props }, ref) => {
4237
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3718
4238
  "div",
3719
4239
  {
3720
4240
  ref,
@@ -3727,31 +4247,56 @@ var Quiz = (0, import_react8.forwardRef)(({ children, className, ...props }, ref
3727
4247
  }
3728
4248
  );
3729
4249
  });
3730
- var QuizHeaderResult = (0, import_react8.forwardRef)(
4250
+ var QuizHeaderResult = (0, import_react11.forwardRef)(
3731
4251
  ({ className, ...props }, ref) => {
3732
- const { getCurrentQuestion, getCurrentAnswer } = useQuizStore();
4252
+ const { getCurrentQuestion, getCurrentAnswer, getAllCurrentAnswer } = useQuizStore();
3733
4253
  const currentQuestion = getCurrentQuestion();
3734
4254
  const userAnswer = getCurrentAnswer();
3735
- const isCorrect = userAnswer === currentQuestion?.correctOptionId;
3736
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4255
+ const [isCorrect, setIsCorrect] = (0, import_react11.useState)(false);
4256
+ (0, import_react11.useEffect)(() => {
4257
+ if (currentQuestion?.type === "MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */) {
4258
+ const allCurrentAnswers = getAllCurrentAnswer();
4259
+ const isCorrectOption = currentQuestion.options.filter(
4260
+ (op) => op.isCorrect
4261
+ );
4262
+ if (allCurrentAnswers?.length !== isCorrectOption.length) {
4263
+ setIsCorrect(false);
4264
+ return;
4265
+ }
4266
+ setIsCorrect(true);
4267
+ allCurrentAnswers.forEach((answer) => {
4268
+ const findInCorrectOptions = isCorrectOption.find(
4269
+ (op) => op.id === answer.optionId
4270
+ );
4271
+ if (!findInCorrectOptions) {
4272
+ setIsCorrect(false);
4273
+ }
4274
+ });
4275
+ } else {
4276
+ setIsCorrect(
4277
+ currentQuestion?.options.find((op) => op.id === userAnswer)?.isCorrect || false
4278
+ );
4279
+ }
4280
+ }, [currentQuestion, getAllCurrentAnswer]);
4281
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3737
4282
  "div",
3738
4283
  {
3739
4284
  ref,
3740
4285
  className: cn(
3741
- "flex flex-row items-center gap-10 p-3.5 rounded-xl",
4286
+ "flex flex-row items-center gap-10 p-3.5 rounded-xl mb-4",
3742
4287
  isCorrect ? "bg-success-background" : "bg-error-background",
3743
4288
  className
3744
4289
  ),
3745
4290
  ...props,
3746
4291
  children: [
3747
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
3748
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-700 text-md", children: isCorrect ? "\u{1F389} Parab\xE9ns!!" : "N\xE3o foi dessa vez..." })
4292
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
4293
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-700 text-md", children: isCorrect ? "\u{1F389} Parab\xE9ns!!" : "N\xE3o foi dessa vez..." })
3749
4294
  ]
3750
4295
  }
3751
4296
  );
3752
4297
  }
3753
4298
  );
3754
- var QuizTitle = (0, import_react8.forwardRef)(
4299
+ var QuizTitle = (0, import_react11.forwardRef)(
3755
4300
  ({ className, ...props }, ref) => {
3756
4301
  const {
3757
4302
  currentQuestionIndex,
@@ -3763,7 +4308,7 @@ var QuizTitle = (0, import_react8.forwardRef)(
3763
4308
  } = useQuizStore();
3764
4309
  const totalQuestions = getTotalQuestions();
3765
4310
  const quizTitle = getQuizTitle();
3766
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4311
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3767
4312
  "div",
3768
4313
  {
3769
4314
  ref,
@@ -3773,11 +4318,11 @@ var QuizTitle = (0, import_react8.forwardRef)(
3773
4318
  ),
3774
4319
  ...props,
3775
4320
  children: [
3776
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
3777
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
3778
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
4321
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
4322
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
4323
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
3779
4324
  ] }),
3780
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "absolute right-2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.Clock, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
4325
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "absolute right-2", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react8.Clock, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
3781
4326
  ]
3782
4327
  }
3783
4328
  );
@@ -3786,7 +4331,7 @@ var QuizTitle = (0, import_react8.forwardRef)(
3786
4331
  var QuizHeader = () => {
3787
4332
  const { getCurrentQuestion } = useQuizStore();
3788
4333
  const currentQuestion = getCurrentQuestion();
3789
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4334
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3790
4335
  HeaderAlternative,
3791
4336
  {
3792
4337
  title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
@@ -3795,10 +4340,12 @@ var QuizHeader = () => {
3795
4340
  }
3796
4341
  );
3797
4342
  };
3798
- var QuizContent = (0, import_react8.forwardRef)(({ type = "Alternativas", children, className, ...props }, ref) => {
3799
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3800
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "font-bold text-lg text-text-950", children: type }) }),
3801
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4343
+ var QuizContent = (0, import_react11.forwardRef)(({ type = "Alternativas", className, variant, ...props }, ref) => {
4344
+ const { getCurrentQuestion } = useQuizStore();
4345
+ const currentQuestion = getCurrentQuestion();
4346
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
4347
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "font-bold text-lg text-text-950", children: type }) }),
4348
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3802
4349
  "div",
3803
4350
  {
3804
4351
  ref,
@@ -3807,7 +4354,11 @@ var QuizContent = (0, import_react8.forwardRef)(({ type = "Alternativas", childr
3807
4354
  className
3808
4355
  ),
3809
4356
  ...props,
3810
- children
4357
+ children: currentQuestion && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
4358
+ currentQuestion.type === "ALTERNATIVA" /* ALTERNATIVA */ && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(QuizAlternative, { variant }),
4359
+ currentQuestion.type === "MULTIPLA_CHOICE" /* MULTIPLA_CHOICE */ && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(QuizMultipleChoice, { variant }),
4360
+ currentQuestion.type === "DISSERTATIVA" /* DISSERTATIVA */ && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: "Componente de dissertativa" })
4361
+ ] })
3811
4362
  }
3812
4363
  )
3813
4364
  ] });
@@ -3819,9 +4370,12 @@ var QuizAlternative = ({ variant = "default" }) => {
3819
4370
  const alternatives = currentQuestion?.options?.map((option) => {
3820
4371
  let status = "neutral" /* NEUTRAL */;
3821
4372
  if (variant === "result") {
3822
- if (option.id === currentQuestion.correctOptionId) {
4373
+ const isCorrectOption = currentQuestion.options.find(
4374
+ (op) => op.isCorrect
4375
+ );
4376
+ if (isCorrectOption?.id === option.id) {
3823
4377
  status = "correct" /* CORRECT */;
3824
- } else if (currentAnswer === option.id && option.id !== currentQuestion.correctOptionId) {
4378
+ } else if (currentAnswer === option.id && option.id !== isCorrectOption?.id) {
3825
4379
  status = "incorrect" /* INCORRECT */;
3826
4380
  }
3827
4381
  }
@@ -3832,8 +4386,8 @@ var QuizAlternative = ({ variant = "default" }) => {
3832
4386
  };
3833
4387
  });
3834
4388
  if (!alternatives)
3835
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: "N\xE3o h\xE1 Alternativas" }) });
3836
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4389
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: "N\xE3o h\xE1 Alternativas" }) });
4390
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3837
4391
  AlternativesList,
3838
4392
  {
3839
4393
  mode: variant === "default" ? "interactive" : "readonly",
@@ -3851,6 +4405,77 @@ var QuizAlternative = ({ variant = "default" }) => {
3851
4405
  `question-${currentQuestion?.id || "1"}`
3852
4406
  ) });
3853
4407
  };
4408
+ var QuizMultipleChoice = ({
4409
+ variant = "default"
4410
+ }) => {
4411
+ const { getCurrentQuestion, selectMultipleAnswer, getAllCurrentAnswer } = useQuizStore();
4412
+ const currentQuestion = getCurrentQuestion();
4413
+ const allCurrentAnswers = getAllCurrentAnswer();
4414
+ const prevSelectedValuesRef = (0, import_react11.useRef)([]);
4415
+ const prevQuestionIdRef = (0, import_react11.useRef)("");
4416
+ const allCurrentAnswerIds = (0, import_react11.useMemo)(() => {
4417
+ return allCurrentAnswers?.map((answer) => answer.optionId) || [];
4418
+ }, [allCurrentAnswers]);
4419
+ const selectedValues = (0, import_react11.useMemo)(() => {
4420
+ return allCurrentAnswerIds?.filter((id) => id !== null) || [];
4421
+ }, [allCurrentAnswerIds]);
4422
+ const stableSelectedValues = (0, import_react11.useMemo)(() => {
4423
+ const currentQuestionId = currentQuestion?.id || "";
4424
+ const hasQuestionChanged = prevQuestionIdRef.current !== currentQuestionId;
4425
+ if (hasQuestionChanged) {
4426
+ prevQuestionIdRef.current = currentQuestionId;
4427
+ prevSelectedValuesRef.current = selectedValues;
4428
+ return selectedValues;
4429
+ }
4430
+ const hasValuesChanged = JSON.stringify(prevSelectedValuesRef.current) !== JSON.stringify(selectedValues);
4431
+ if (hasValuesChanged) {
4432
+ prevSelectedValuesRef.current = selectedValues;
4433
+ return selectedValues;
4434
+ }
4435
+ return prevSelectedValuesRef.current;
4436
+ }, [selectedValues, currentQuestion?.id]);
4437
+ const handleSelectedValues = (0, import_react11.useCallback)(
4438
+ (values) => {
4439
+ if (currentQuestion) {
4440
+ selectMultipleAnswer(currentQuestion.id, values);
4441
+ }
4442
+ },
4443
+ [currentQuestion, selectMultipleAnswer]
4444
+ );
4445
+ const questionKey = (0, import_react11.useMemo)(
4446
+ () => `question-${currentQuestion?.id || "1"}`,
4447
+ [currentQuestion?.id]
4448
+ );
4449
+ const choices = currentQuestion?.options?.map((option) => {
4450
+ let status = "neutral" /* NEUTRAL */;
4451
+ if (variant === "result") {
4452
+ const isAllCorrectOptionId = currentQuestion.options.filter((op) => op.isCorrect).map((op) => op.id);
4453
+ if (isAllCorrectOptionId.includes(option.id)) {
4454
+ status = "correct" /* CORRECT */;
4455
+ } else if (allCurrentAnswerIds?.includes(option.id) && !isAllCorrectOptionId.includes(option.id)) {
4456
+ status = "incorrect" /* INCORRECT */;
4457
+ }
4458
+ }
4459
+ return {
4460
+ label: option.option,
4461
+ value: option.id,
4462
+ status
4463
+ };
4464
+ });
4465
+ if (!choices)
4466
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: "N\xE3o h\xE1 Escolhas Multiplas" }) });
4467
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4468
+ MultipleChoiceList,
4469
+ {
4470
+ choices,
4471
+ name: questionKey,
4472
+ selectedValues: stableSelectedValues,
4473
+ onHandleSelectedValues: handleSelectedValues,
4474
+ mode: variant === "default" ? "interactive" : "readonly"
4475
+ },
4476
+ questionKey
4477
+ ) });
4478
+ };
3854
4479
  var QuizQuestionList = ({
3855
4480
  filterType = "all",
3856
4481
  onQuestionClick
@@ -3902,16 +4527,16 @@ var QuizQuestionList = ({
3902
4527
  return "Em branco";
3903
4528
  }
3904
4529
  };
3905
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
3906
- ([subjectId, questions]) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "flex flex-col gap-2", children: [
3907
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
3908
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.BookOpen, { size: 17, className: "text-white" }) }),
3909
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
4530
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
4531
+ ([subjectId, questions]) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: "flex flex-col gap-2", children: [
4532
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
4533
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react8.BookOpen, { size: 17, className: "text-white" }) }),
4534
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
3910
4535
  ] }),
3911
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
4536
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
3912
4537
  const status = getQuestionStatus(question.id);
3913
4538
  const questionNumber = getQuestionIndex(question.id);
3914
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4539
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3915
4540
  CardStatus,
3916
4541
  {
3917
4542
  header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
@@ -3927,236 +4552,255 @@ var QuizQuestionList = ({
3927
4552
  ] }, subjectId)
3928
4553
  ) });
3929
4554
  };
3930
- var QuizFooter = (0, import_react8.forwardRef)(({ className, onGoToSimulated, onDetailResult, ...props }, ref) => {
3931
- const {
3932
- currentQuestionIndex,
3933
- getUserAnswers,
3934
- getTotalQuestions,
3935
- goToNextQuestion,
3936
- goToPreviousQuestion,
3937
- getUnansweredQuestionsFromUserAnswers,
3938
- getCurrentAnswer,
3939
- skipQuestion,
3940
- getCurrentQuestion,
3941
- getQuestionStatusFromUserAnswers
3942
- } = useQuizStore();
3943
- const totalQuestions = getTotalQuestions();
3944
- const isFirstQuestion = currentQuestionIndex === 0;
3945
- const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
3946
- const currentAnswer = getCurrentAnswer();
3947
- const currentQuestion = getCurrentQuestion();
3948
- const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
3949
- const [alertDialogOpen, setAlertDialogOpen] = (0, import_react8.useState)(false);
3950
- const [modalResultOpen, setModalResultOpen] = (0, import_react8.useState)(false);
3951
- const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react8.useState)(false);
3952
- const [filterType, setFilterType] = (0, import_react8.useState)("all");
3953
- const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
3954
- const userAnswers = getUserAnswers();
3955
- const allQuestions = getTotalQuestions();
3956
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3957
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3958
- "footer",
3959
- {
3960
- ref,
3961
- className: cn(
3962
- "w-full px-2 bg-background lg:max-w-[1000px] not-lg:max-w-[calc(100vw-32px)] border-t border-border-50 fixed bottom-0 min-h-[80px] flex flex-row justify-between items-center",
3963
- className
3964
- ),
3965
- ...props,
3966
- children: [
3967
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
3968
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3969
- IconButton_default,
3970
- {
3971
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.SquaresFour, { size: 24, className: "text-text-950" }),
3972
- size: "md",
3973
- onClick: () => setModalNavigateOpen(true)
3974
- }
3975
- ),
3976
- isFirstQuestion ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4555
+ var QuizFooter = (0, import_react11.forwardRef)(
4556
+ ({
4557
+ className,
4558
+ onGoToSimulated,
4559
+ onDetailResult,
4560
+ variant = "default",
4561
+ ...props
4562
+ }, ref) => {
4563
+ const {
4564
+ currentQuestionIndex,
4565
+ getUserAnswers,
4566
+ getTotalQuestions,
4567
+ goToNextQuestion,
4568
+ goToPreviousQuestion,
4569
+ getUnansweredQuestionsFromUserAnswers,
4570
+ getCurrentAnswer,
4571
+ skipQuestion,
4572
+ getCurrentQuestion,
4573
+ getQuestionStatusFromUserAnswers,
4574
+ getActiveQuiz
4575
+ } = useQuizStore();
4576
+ const totalQuestions = getTotalQuestions();
4577
+ const isFirstQuestion = currentQuestionIndex === 0;
4578
+ const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
4579
+ const currentAnswer = getCurrentAnswer();
4580
+ const currentQuestion = getCurrentQuestion();
4581
+ const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
4582
+ const [alertDialogOpen, setAlertDialogOpen] = (0, import_react11.useState)(false);
4583
+ const [modalResultOpen, setModalResultOpen] = (0, import_react11.useState)(false);
4584
+ const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react11.useState)(false);
4585
+ const [filterType, setFilterType] = (0, import_react11.useState)("all");
4586
+ const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
4587
+ const userAnswers = getUserAnswers();
4588
+ const allQuestions = getTotalQuestions();
4589
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
4590
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4591
+ "footer",
4592
+ {
4593
+ ref,
4594
+ className: cn(
4595
+ "w-full px-2 bg-background lg:max-w-[1000px] not-lg:max-w-[calc(100vw-32px)] border-t border-border-50 fixed bottom-0 min-h-[80px] flex flex-row justify-between items-center",
4596
+ className
4597
+ ),
4598
+ ...props,
4599
+ children: variant === "default" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
4600
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
4601
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4602
+ IconButton_default,
4603
+ {
4604
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react8.SquaresFour, { size: 24, className: "text-text-950" }),
4605
+ size: "md",
4606
+ onClick: () => setModalNavigateOpen(true)
4607
+ }
4608
+ ),
4609
+ isFirstQuestion ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4610
+ Button_default,
4611
+ {
4612
+ variant: "outline",
4613
+ size: "small",
4614
+ onClick: () => {
4615
+ skipQuestion();
4616
+ goToNextQuestion();
4617
+ },
4618
+ children: "Pular"
4619
+ }
4620
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4621
+ Button_default,
4622
+ {
4623
+ size: "medium",
4624
+ variant: "link",
4625
+ action: "primary",
4626
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react8.CaretLeft, { size: 18 }),
4627
+ onClick: () => {
4628
+ goToPreviousQuestion();
4629
+ },
4630
+ children: "Voltar"
4631
+ }
4632
+ )
4633
+ ] }),
4634
+ !isFirstQuestion && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3977
4635
  Button_default,
3978
4636
  {
3979
- variant: "outline",
3980
4637
  size: "small",
4638
+ variant: "outline",
4639
+ action: "primary",
3981
4640
  onClick: () => {
3982
4641
  skipQuestion();
3983
4642
  goToNextQuestion();
3984
4643
  },
3985
4644
  children: "Pular"
3986
4645
  }
3987
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4646
+ ),
4647
+ isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4648
+ Button_default,
4649
+ {
4650
+ size: "medium",
4651
+ variant: "solid",
4652
+ action: "primary",
4653
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
4654
+ onClick: () => {
4655
+ if (unansweredQuestions.length > 0) {
4656
+ setAlertDialogOpen(true);
4657
+ } else {
4658
+ setModalResultOpen(true);
4659
+ }
4660
+ },
4661
+ children: "Finalizar"
4662
+ }
4663
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3988
4664
  Button_default,
3989
4665
  {
3990
4666
  size: "medium",
3991
4667
  variant: "link",
3992
4668
  action: "primary",
3993
- iconLeft: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.CaretLeft, { size: 18 }),
4669
+ iconRight: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react8.CaretRight, { size: 18 }),
4670
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
3994
4671
  onClick: () => {
3995
- goToPreviousQuestion();
4672
+ goToNextQuestion();
3996
4673
  },
3997
- children: "Voltar"
4674
+ children: "Avan\xE7ar"
3998
4675
  }
3999
4676
  )
4000
- ] }),
4001
- !isFirstQuestion && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4002
- Button_default,
4003
- {
4004
- size: "small",
4005
- variant: "outline",
4006
- action: "primary",
4007
- onClick: () => {
4008
- skipQuestion();
4009
- goToNextQuestion();
4010
- },
4011
- children: "Pular"
4012
- }
4013
- ),
4014
- isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4015
- Button_default,
4016
- {
4017
- size: "medium",
4018
- variant: "solid",
4019
- action: "primary",
4020
- disabled: !currentAnswer && !isCurrentQuestionSkipped,
4021
- onClick: () => {
4022
- if (unansweredQuestions.length > 0) {
4023
- setAlertDialogOpen(true);
4024
- } else {
4025
- setModalResultOpen(true);
4026
- }
4027
- },
4028
- children: "Finalizar"
4029
- }
4030
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4031
- Button_default,
4032
- {
4033
- size: "medium",
4034
- variant: "link",
4035
- action: "primary",
4036
- iconRight: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.CaretRight, { size: 18 }),
4037
- disabled: !currentAnswer && !isCurrentQuestionSkipped,
4038
- onClick: () => {
4039
- goToNextQuestion();
4040
- },
4041
- children: "Avan\xE7ar"
4042
- }
4043
- )
4044
- ]
4045
- }
4046
- ),
4047
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4048
- AlertDialog,
4049
- {
4050
- isOpen: alertDialogOpen,
4051
- onChangeOpen: setAlertDialogOpen,
4052
- title: "Finalizar simulado?",
4053
- description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : "Tem certeza que deseja finalizar o simulado?",
4054
- cancelButtonLabel: "Voltar e revisar",
4055
- submitButtonLabel: "Finalizar Mesmo Assim",
4056
- onSubmit: () => {
4057
- setModalResultOpen(true);
4677
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-row items-center justify-end w-full", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button_default, { variant: "solid", action: "primary", size: "medium", children: "Ver Resolu\xE7\xE3o" }) })
4058
4678
  }
4059
- }
4060
- ),
4061
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4062
- Modal_default,
4063
- {
4064
- isOpen: modalResultOpen,
4065
- onClose: () => setModalResultOpen(false),
4066
- title: "",
4067
- closeOnBackdropClick: false,
4068
- closeOnEscape: false,
4069
- hideCloseButton: true,
4070
- size: "md",
4071
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
4072
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4073
- "img",
4074
- {
4075
- src: simulated_result_default,
4076
- alt: "Simulated Result",
4077
- className: "w-[282px] h-auto object-cover"
4078
- }
4079
- ),
4080
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
4081
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
4082
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "text-text-500 font-sm", children: [
4083
- "Voc\xEA acertou",
4084
- " ",
4085
- userAnswers.filter(
4086
- (answer) => answer.answerKey === answer.correctOptionId
4087
- ).length,
4088
- " ",
4089
- "de ",
4090
- allQuestions,
4091
- " quest\xF5es."
4092
- ] })
4093
- ] }),
4094
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
4095
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4096
- Button_default,
4679
+ ),
4680
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4681
+ AlertDialog,
4682
+ {
4683
+ isOpen: alertDialogOpen,
4684
+ onChangeOpen: setAlertDialogOpen,
4685
+ title: "Finalizar simulado?",
4686
+ description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : "Tem certeza que deseja finalizar o simulado?",
4687
+ cancelButtonLabel: "Voltar e revisar",
4688
+ submitButtonLabel: "Finalizar Mesmo Assim",
4689
+ onSubmit: () => {
4690
+ setModalResultOpen(true);
4691
+ }
4692
+ }
4693
+ ),
4694
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4695
+ Modal_default,
4696
+ {
4697
+ isOpen: modalResultOpen,
4698
+ onClose: () => setModalResultOpen(false),
4699
+ title: "",
4700
+ closeOnBackdropClick: false,
4701
+ closeOnEscape: false,
4702
+ hideCloseButton: true,
4703
+ size: "md",
4704
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
4705
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4706
+ "img",
4097
4707
  {
4098
- variant: "outline",
4099
- className: "w-full",
4100
- size: "small",
4101
- onClick: onGoToSimulated,
4102
- children: "Ir para simulados"
4708
+ src: simulated_result_default,
4709
+ alt: "Simulated Result",
4710
+ className: "w-[282px] h-auto object-cover"
4103
4711
  }
4104
4712
  ),
4105
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
4106
- ] })
4107
- ] })
4108
- }
4109
- ),
4110
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4111
- Modal_default,
4112
- {
4113
- isOpen: modalNavigateOpen,
4114
- onClose: () => setModalNavigateOpen(false),
4115
- title: "Quest\xF5es",
4116
- size: "lg",
4117
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col w-full h-full", children: [
4118
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
4119
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
4120
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Select_default, { value: filterType, onValueChange: setFilterType, children: [
4121
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
4122
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(SelectContent, { children: [
4123
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectItem, { value: "all", children: "Todas" }),
4124
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectItem, { value: "unanswered", children: "Em branco" }),
4125
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectItem, { value: "answered", children: "Respondidas" })
4713
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
4714
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
4715
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "text-text-500 font-sm", children: [
4716
+ "Voc\xEA acertou",
4717
+ " ",
4718
+ (() => {
4719
+ const activeQuiz = getActiveQuiz();
4720
+ if (!activeQuiz) return 0;
4721
+ return userAnswers.filter((answer) => {
4722
+ const question = activeQuiz.quiz.questions.find(
4723
+ (q) => q.id === answer.questionId
4724
+ );
4725
+ const isCorrectOption = question?.options.find(
4726
+ (op) => op.isCorrect
4727
+ );
4728
+ return question && answer.optionId === isCorrectOption?.id;
4729
+ }).length;
4730
+ })(),
4731
+ " ",
4732
+ "de ",
4733
+ allQuestions,
4734
+ " quest\xF5es."
4126
4735
  ] })
4127
- ] }) })
4128
- ] }),
4129
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4130
- QuizQuestionList,
4131
- {
4132
- filterType,
4133
- onQuestionClick: () => setModalNavigateOpen(false)
4134
- }
4135
- ) })
4136
- ] })
4137
- }
4138
- )
4139
- ] });
4140
- });
4141
- var QuizResultHeaderTitle = (0, import_react8.forwardRef)(({ className, ...props }, ref) => {
4736
+ ] }),
4737
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
4738
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4739
+ Button_default,
4740
+ {
4741
+ variant: "outline",
4742
+ className: "w-full",
4743
+ size: "small",
4744
+ onClick: onGoToSimulated,
4745
+ children: "Ir para simulados"
4746
+ }
4747
+ ),
4748
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
4749
+ ] })
4750
+ ] })
4751
+ }
4752
+ ),
4753
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4754
+ Modal_default,
4755
+ {
4756
+ isOpen: modalNavigateOpen,
4757
+ onClose: () => setModalNavigateOpen(false),
4758
+ title: "Quest\xF5es",
4759
+ size: "lg",
4760
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col w-full h-full", children: [
4761
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
4762
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
4763
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Select_default, { value: filterType, onValueChange: setFilterType, children: [
4764
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
4765
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(SelectContent, { children: [
4766
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectItem, { value: "all", children: "Todas" }),
4767
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectItem, { value: "unanswered", children: "Em branco" }),
4768
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SelectItem, { value: "answered", children: "Respondidas" })
4769
+ ] })
4770
+ ] }) })
4771
+ ] }),
4772
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4773
+ QuizQuestionList,
4774
+ {
4775
+ filterType,
4776
+ onQuestionClick: () => setModalNavigateOpen(false)
4777
+ }
4778
+ ) })
4779
+ ] })
4780
+ }
4781
+ )
4782
+ ] });
4783
+ }
4784
+ );
4785
+ var QuizResultHeaderTitle = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
4142
4786
  const { bySimulated } = useQuizStore();
4143
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4787
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4144
4788
  "div",
4145
4789
  {
4146
4790
  ref,
4147
4791
  className: cn("flex flex-row pt-4 justify-between", className),
4148
4792
  ...props,
4149
4793
  children: [
4150
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
4151
- bySimulated && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
4794
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
4795
+ bySimulated && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
4152
4796
  ]
4153
4797
  }
4154
4798
  );
4155
4799
  });
4156
- var QuizResultTitle = (0, import_react8.forwardRef)(({ className, ...props }, ref) => {
4800
+ var QuizResultTitle = (0, import_react11.forwardRef)(({ className, ...props }, ref) => {
4157
4801
  const { getQuizTitle } = useQuizStore();
4158
4802
  const quizTitle = getQuizTitle();
4159
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4803
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4160
4804
  "p",
4161
4805
  {
4162
4806
  className: cn("pt-6 pb-4 text-text-950 font-bold text-lg", className),
@@ -4166,7 +4810,7 @@ var QuizResultTitle = (0, import_react8.forwardRef)(({ className, ...props }, re
4166
4810
  }
4167
4811
  );
4168
4812
  });
4169
- var QuizResultPerformance = (0, import_react8.forwardRef)(
4813
+ var QuizResultPerformance = (0, import_react11.forwardRef)(
4170
4814
  ({ ...props }, ref) => {
4171
4815
  const {
4172
4816
  getTotalQuestions,
@@ -4174,7 +4818,8 @@ var QuizResultPerformance = (0, import_react8.forwardRef)(
4174
4818
  formatTime,
4175
4819
  bySimulated,
4176
4820
  byActivity,
4177
- byQuestionary
4821
+ byQuestionary,
4822
+ getUserAnswerByQuestionId
4178
4823
  } = useQuizStore();
4179
4824
  const totalQuestions = getTotalQuestions();
4180
4825
  const quiz = bySimulated || byActivity || byQuestionary;
@@ -4187,8 +4832,10 @@ var QuizResultPerformance = (0, import_react8.forwardRef)(
4187
4832
  let totalDifficultQuestions = 0;
4188
4833
  if (quiz) {
4189
4834
  quiz.questions.forEach((question) => {
4190
- const userAnswer = question.answerKey;
4191
- const isCorrect = userAnswer && userAnswer === question.correctOptionId;
4835
+ const userAnswerItem = getUserAnswerByQuestionId(question.id);
4836
+ const userAnswer = userAnswerItem?.optionId;
4837
+ const isCorrectOption = question?.options.find((op) => op.isCorrect);
4838
+ const isCorrect = userAnswer && userAnswer === isCorrectOption?.id;
4192
4839
  if (isCorrect) {
4193
4840
  correctAnswers++;
4194
4841
  }
@@ -4211,15 +4858,15 @@ var QuizResultPerformance = (0, import_react8.forwardRef)(
4211
4858
  });
4212
4859
  }
4213
4860
  const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
4214
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4861
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
4215
4862
  "div",
4216
4863
  {
4217
4864
  className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
4218
4865
  ref,
4219
4866
  ...props,
4220
4867
  children: [
4221
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative", children: [
4222
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4868
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative", children: [
4869
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4223
4870
  ProgressCircle_default,
4224
4871
  {
4225
4872
  size: "medium",
@@ -4229,21 +4876,21 @@ var QuizResultPerformance = (0, import_react8.forwardRef)(
4229
4876
  label: ""
4230
4877
  }
4231
4878
  ),
4232
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
4233
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
4234
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
4235
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime(timeElapsed) })
4879
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
4880
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
4881
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react8.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
4882
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime(timeElapsed) })
4236
4883
  ] }),
4237
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
4884
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
4238
4885
  correctAnswers,
4239
4886
  " de ",
4240
4887
  totalQuestions
4241
4888
  ] }),
4242
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
4889
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
4243
4890
  ] })
4244
4891
  ] }),
4245
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
4246
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4892
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
4893
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4247
4894
  ProgressBar_default,
4248
4895
  {
4249
4896
  className: "w-full",
@@ -4257,7 +4904,7 @@ var QuizResultPerformance = (0, import_react8.forwardRef)(
4257
4904
  percentageClassName: "text-xs font-medium leading-[14px] text-right"
4258
4905
  }
4259
4906
  ),
4260
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4907
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4261
4908
  ProgressBar_default,
4262
4909
  {
4263
4910
  className: "w-full",
@@ -4271,7 +4918,7 @@ var QuizResultPerformance = (0, import_react8.forwardRef)(
4271
4918
  percentageClassName: "text-xs font-medium leading-[14px] text-right"
4272
4919
  }
4273
4920
  ),
4274
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4921
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4275
4922
  ProgressBar_default,
4276
4923
  {
4277
4924
  className: "w-full",
@@ -4291,8 +4938,12 @@ var QuizResultPerformance = (0, import_react8.forwardRef)(
4291
4938
  );
4292
4939
  }
4293
4940
  );
4294
- var QuizListResult = (0, import_react8.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
4295
- const { getQuestionsGroupedBySubject, isQuestionAnswered } = useQuizStore();
4941
+ var QuizListResult = (0, import_react11.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
4942
+ const {
4943
+ getQuestionsGroupedBySubject,
4944
+ isQuestionAnswered,
4945
+ getUserAnswerByQuestionId
4946
+ } = useQuizStore();
4296
4947
  const groupedQuestions = getQuestionsGroupedBySubject();
4297
4948
  const subjectsStats = Object.entries(groupedQuestions).map(
4298
4949
  ([subjectId, questions]) => {
@@ -4300,8 +4951,10 @@ var QuizListResult = (0, import_react8.forwardRef)(({ className, onSubjectClick,
4300
4951
  let incorrect = 0;
4301
4952
  questions.forEach((question) => {
4302
4953
  if (isQuestionAnswered(question.id)) {
4303
- const userAnswer = question.answerKey;
4304
- if (userAnswer === question.correctOptionId) {
4954
+ const userAnswerItem = getUserAnswerByQuestionId(question.id);
4955
+ const userAnswer = userAnswerItem?.optionId;
4956
+ const isCorrectOption = question?.options.find((op) => op.isCorrect);
4957
+ if (userAnswer === isCorrectOption?.id) {
4305
4958
  correct++;
4306
4959
  } else {
4307
4960
  incorrect++;
@@ -4316,9 +4969,9 @@ var QuizListResult = (0, import_react8.forwardRef)(({ className, onSubjectClick,
4316
4969
  };
4317
4970
  }
4318
4971
  );
4319
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { ref, className, ...props, children: [
4320
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
4321
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4972
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { ref, className, ...props, children: [
4973
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
4974
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4322
4975
  CardResults,
4323
4976
  {
4324
4977
  onClick: () => onSubjectClick?.(subject.subject),
@@ -4326,7 +4979,7 @@ var QuizListResult = (0, import_react8.forwardRef)(({ className, onSubjectClick,
4326
4979
  header: subject.subject,
4327
4980
  correct_answers: subject.correct,
4328
4981
  incorrect_answers: subject.incorrect,
4329
- icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.Book, { size: 20 }),
4982
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react8.Book, { size: 20 }),
4330
4983
  direction: "row"
4331
4984
  }
4332
4985
  ) }, subject.subject)) })
@@ -4336,19 +4989,25 @@ var QuizListResultByMateria = ({
4336
4989
  subject,
4337
4990
  onQuestionClick
4338
4991
  }) => {
4339
- const { getQuestionsGroupedBySubject } = useQuizStore();
4992
+ const { getQuestionsGroupedBySubject, getUserAnswerByQuestionId } = useQuizStore();
4340
4993
  const groupedQuestions = getQuestionsGroupedBySubject();
4341
4994
  const answeredQuestions = groupedQuestions[subject] || [];
4342
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
4343
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
4344
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "flex flex-col ", children: [
4345
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
4346
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4995
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
4996
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
4997
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: "flex flex-col ", children: [
4998
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
4999
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4347
5000
  CardStatus,
4348
5001
  {
4349
5002
  className: "max-w-full",
4350
5003
  header: `Quest\xE3o ${question.id}`,
4351
- status: question.answerKey === question.correctOptionId ? "correct" : "incorrect",
5004
+ status: (() => {
5005
+ const userAnswer = getUserAnswerByQuestionId(question.id);
5006
+ const isCorrectOption = question?.options.find(
5007
+ (op) => op.isCorrect
5008
+ );
5009
+ return userAnswer && userAnswer.optionId === isCorrectOption?.id ? "correct" : "incorrect";
5010
+ })(),
4352
5011
  onClick: () => onQuestionClick?.(question)
4353
5012
  }
4354
5013
  ) }, question.id)) })
@@ -4365,10 +5024,10 @@ var QuizListResultByMateria = ({
4365
5024
  QuizHeaderResult,
4366
5025
  QuizListResult,
4367
5026
  QuizListResultByMateria,
5027
+ QuizMultipleChoice,
4368
5028
  QuizQuestionList,
4369
5029
  QuizResultHeaderTitle,
4370
5030
  QuizResultPerformance,
4371
5031
  QuizResultTitle,
4372
5032
  QuizTitle
4373
5033
  });
4374
- //# sourceMappingURL=index.js.map