analytica-frontend-lib 1.2.38 → 1.2.44

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 (96) hide show
  1. package/dist/Accordation/index.d.ts +4 -0
  2. package/dist/Accordation/index.d.ts.map +1 -1
  3. package/dist/Accordation/index.js +5 -2
  4. package/dist/Accordation/index.js.map +1 -1
  5. package/dist/Accordation/index.mjs +5 -2
  6. package/dist/Accordation/index.mjs.map +1 -1
  7. package/dist/ActivityCardQuestionBanks/index.css +24 -10
  8. package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
  9. package/dist/ActivityCardQuestionBanks/index.d.ts.map +1 -1
  10. package/dist/ActivityCardQuestionBanks/index.js +8 -6
  11. package/dist/ActivityCardQuestionBanks/index.js.map +1 -1
  12. package/dist/ActivityCardQuestionBanks/index.mjs +8 -6
  13. package/dist/ActivityCardQuestionBanks/index.mjs.map +1 -1
  14. package/dist/ActivityCardQuestionPreview/index.css +19307 -0
  15. package/dist/ActivityCardQuestionPreview/index.css.map +1 -0
  16. package/dist/ActivityCardQuestionPreview/index.d.ts +29 -0
  17. package/dist/ActivityCardQuestionPreview/index.d.ts.map +1 -0
  18. package/dist/ActivityCardQuestionPreview/index.js +3684 -0
  19. package/dist/ActivityCardQuestionPreview/index.js.map +1 -0
  20. package/dist/ActivityCardQuestionPreview/index.mjs +3692 -0
  21. package/dist/ActivityCardQuestionPreview/index.mjs.map +1 -0
  22. package/dist/ActivityDetails/index.css +24 -10
  23. package/dist/ActivityDetails/index.css.map +1 -1
  24. package/dist/ActivityDetails/index.js +83 -31
  25. package/dist/ActivityDetails/index.js.map +1 -1
  26. package/dist/ActivityDetails/index.mjs +84 -31
  27. package/dist/ActivityDetails/index.mjs.map +1 -1
  28. package/dist/ActivityFilters/index.css +24 -10
  29. package/dist/ActivityFilters/index.css.map +1 -1
  30. package/dist/ActivityFilters/index.js +83 -31
  31. package/dist/ActivityFilters/index.js.map +1 -1
  32. package/dist/ActivityFilters/index.mjs +84 -31
  33. package/dist/ActivityFilters/index.mjs.map +1 -1
  34. package/dist/ActivityPreview/index.css +19307 -0
  35. package/dist/ActivityPreview/index.css.map +1 -0
  36. package/dist/ActivityPreview/index.d.ts +34 -0
  37. package/dist/ActivityPreview/index.d.ts.map +1 -0
  38. package/dist/ActivityPreview/index.js +4458 -0
  39. package/dist/ActivityPreview/index.js.map +1 -0
  40. package/dist/ActivityPreview/index.mjs +4468 -0
  41. package/dist/ActivityPreview/index.mjs.map +1 -0
  42. package/dist/AlertManager/index.css +24 -10
  43. package/dist/AlertManager/index.css.map +1 -1
  44. package/dist/AlertManager/index.js +500 -389
  45. package/dist/AlertManager/index.js.map +1 -1
  46. package/dist/AlertManager/index.mjs +466 -354
  47. package/dist/AlertManager/index.mjs.map +1 -1
  48. package/dist/CorrectActivityModal/index.js +5 -2
  49. package/dist/CorrectActivityModal/index.js.map +1 -1
  50. package/dist/CorrectActivityModal/index.mjs +5 -2
  51. package/dist/CorrectActivityModal/index.mjs.map +1 -1
  52. package/dist/DropdownMenu/index.d.ts +7 -8
  53. package/dist/DropdownMenu/index.d.ts.map +1 -1
  54. package/dist/DropdownMenu/index.js +78 -29
  55. package/dist/DropdownMenu/index.js.map +1 -1
  56. package/dist/DropdownMenu/index.mjs +79 -29
  57. package/dist/DropdownMenu/index.mjs.map +1 -1
  58. package/dist/NotificationCard/index.js +78 -29
  59. package/dist/NotificationCard/index.js.map +1 -1
  60. package/dist/NotificationCard/index.mjs +79 -29
  61. package/dist/NotificationCard/index.mjs.map +1 -1
  62. package/dist/Search/index.js +78 -29
  63. package/dist/Search/index.js.map +1 -1
  64. package/dist/Search/index.mjs +79 -29
  65. package/dist/Search/index.mjs.map +1 -1
  66. package/dist/SendActivityModal/index.css +19307 -0
  67. package/dist/SendActivityModal/index.css.map +1 -0
  68. package/dist/SendActivityModal/index.d.ts +5 -0
  69. package/dist/SendActivityModal/index.d.ts.map +1 -0
  70. package/dist/SendActivityModal/index.js +6471 -0
  71. package/dist/SendActivityModal/index.js.map +1 -0
  72. package/dist/SendActivityModal/index.mjs +6493 -0
  73. package/dist/SendActivityModal/index.mjs.map +1 -0
  74. package/dist/TableProvider/index.css +24 -10
  75. package/dist/TableProvider/index.css.map +1 -1
  76. package/dist/TableProvider/index.js +83 -31
  77. package/dist/TableProvider/index.js.map +1 -1
  78. package/dist/TableProvider/index.mjs +84 -31
  79. package/dist/TableProvider/index.mjs.map +1 -1
  80. package/dist/index.css +24 -10
  81. package/dist/index.css.map +1 -1
  82. package/dist/index.d.ts +16 -3
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +3183 -1502
  85. package/dist/index.js.map +1 -1
  86. package/dist/index.mjs +2963 -1294
  87. package/dist/index.mjs.map +1 -1
  88. package/dist/styles.css +24 -10
  89. package/dist/styles.css.map +1 -1
  90. package/dist/types/activityDetails.d.ts +10 -0
  91. package/dist/types/activityDetails.d.ts.map +1 -1
  92. package/dist/types/questions.d.ts +100 -1
  93. package/dist/types/questions.d.ts.map +1 -1
  94. package/dist/utils/questionRenderer.d.ts +5 -0
  95. package/dist/utils/questionRenderer.d.ts.map +1 -0
  96. package/package.json +7 -1
@@ -0,0 +1,4458 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/ActivityPreview/ActivityPreview.tsx
31
+ var ActivityPreview_exports = {};
32
+ __export(ActivityPreview_exports, {
33
+ ActivityPreview: () => ActivityPreview
34
+ });
35
+ module.exports = __toCommonJS(ActivityPreview_exports);
36
+ var import_react11 = require("react");
37
+ var import_phosphor_react8 = require("phosphor-react");
38
+
39
+ // src/utils/utils.ts
40
+ var import_clsx = require("clsx");
41
+ var import_tailwind_merge = require("tailwind-merge");
42
+ function cn(...inputs) {
43
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
44
+ }
45
+ function getSubjectColorWithOpacity(hexColor, isDark) {
46
+ if (!hexColor) return void 0;
47
+ let color = hexColor.replace(/^#/, "").toLowerCase();
48
+ if (isDark) {
49
+ if (color.length === 8) {
50
+ color = color.slice(0, 6);
51
+ }
52
+ return `#${color}`;
53
+ } else {
54
+ let resultColor;
55
+ if (color.length === 6) {
56
+ resultColor = `#${color}4d`;
57
+ } else if (color.length === 8) {
58
+ resultColor = `#${color}`;
59
+ } else {
60
+ resultColor = `#${color}`;
61
+ }
62
+ return resultColor;
63
+ }
64
+ }
65
+
66
+ // src/components/Text/Text.tsx
67
+ var import_jsx_runtime = require("react/jsx-runtime");
68
+ var Text = ({
69
+ children,
70
+ size = "md",
71
+ weight = "normal",
72
+ color = "text-text-950",
73
+ as,
74
+ className = "",
75
+ ...props
76
+ }) => {
77
+ let sizeClasses = "";
78
+ let weightClasses = "";
79
+ const sizeClassMap = {
80
+ "2xs": "text-2xs",
81
+ xs: "text-xs",
82
+ sm: "text-sm",
83
+ md: "text-md",
84
+ lg: "text-lg",
85
+ xl: "text-xl",
86
+ "2xl": "text-2xl",
87
+ "3xl": "text-3xl",
88
+ "4xl": "text-4xl",
89
+ "5xl": "text-5xl",
90
+ "6xl": "text-6xl"
91
+ };
92
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
93
+ const weightClassMap = {
94
+ hairline: "font-hairline",
95
+ light: "font-light",
96
+ normal: "font-normal",
97
+ medium: "font-medium",
98
+ semibold: "font-semibold",
99
+ bold: "font-bold",
100
+ extrabold: "font-extrabold",
101
+ black: "font-black"
102
+ };
103
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
104
+ const baseClasses = "font-primary";
105
+ const Component = as ?? "p";
106
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
107
+ Component,
108
+ {
109
+ className: cn(baseClasses, sizeClasses, weightClasses, color, className),
110
+ ...props,
111
+ children
112
+ }
113
+ );
114
+ };
115
+ var Text_default = Text;
116
+
117
+ // src/components/Button/Button.tsx
118
+ var import_jsx_runtime2 = require("react/jsx-runtime");
119
+ var VARIANT_ACTION_CLASSES = {
120
+ solid: {
121
+ primary: "bg-primary-950 text-text border border-primary-950 hover:bg-primary-800 hover:border-primary-800 focus-visible:outline-none focus-visible:bg-primary-950 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-primary-700 active:border-primary-700 disabled:bg-primary-500 disabled:border-primary-500 disabled:opacity-40 disabled:cursor-not-allowed",
122
+ positive: "bg-success-500 text-text border border-success-500 hover:bg-success-600 hover:border-success-600 focus-visible:outline-none focus-visible:bg-success-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-success-700 active:border-success-700 disabled:bg-success-500 disabled:border-success-500 disabled:opacity-40 disabled:cursor-not-allowed",
123
+ negative: "bg-error-500 text-text border border-error-500 hover:bg-error-600 hover:border-error-600 focus-visible:outline-none focus-visible:bg-error-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-error-700 active:border-error-700 disabled:bg-error-500 disabled:border-error-500 disabled:opacity-40 disabled:cursor-not-allowed"
124
+ },
125
+ outline: {
126
+ primary: "bg-transparent text-primary-950 border border-primary-950 hover:bg-background-50 hover:text-primary-400 hover:border-primary-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 active:border-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
127
+ positive: "bg-transparent text-success-500 border border-success-300 hover:bg-background-50 hover:text-success-400 hover:border-success-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 active:border-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
128
+ negative: "bg-transparent text-error-500 border border-error-300 hover:bg-background-50 hover:text-error-400 hover:border-error-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 active:border-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
129
+ },
130
+ link: {
131
+ primary: "bg-transparent text-primary-950 hover:text-primary-400 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
132
+ positive: "bg-transparent text-success-500 hover:text-success-400 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
133
+ negative: "bg-transparent text-error-500 hover:text-error-400 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
134
+ }
135
+ };
136
+ var SIZE_CLASSES = {
137
+ "extra-small": "text-xs px-3.5 py-2",
138
+ small: "text-sm px-4 py-2.5",
139
+ medium: "text-md px-5 py-2.5",
140
+ large: "text-lg px-6 py-3",
141
+ "extra-large": "text-lg px-7 py-3.5"
142
+ };
143
+ var Button = ({
144
+ children,
145
+ iconLeft,
146
+ iconRight,
147
+ size = "medium",
148
+ variant = "solid",
149
+ action = "primary",
150
+ className = "",
151
+ disabled,
152
+ type = "button",
153
+ ...props
154
+ }) => {
155
+ const sizeClasses = SIZE_CLASSES[size];
156
+ const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
157
+ const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
158
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
159
+ "button",
160
+ {
161
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
162
+ disabled,
163
+ type,
164
+ ...props,
165
+ children: [
166
+ iconLeft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-2 flex items-center", children: iconLeft }),
167
+ children,
168
+ iconRight && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ml-2 flex items-center", children: iconRight })
169
+ ]
170
+ }
171
+ );
172
+ };
173
+ var Button_default = Button;
174
+
175
+ // src/components/Badge/Badge.tsx
176
+ var import_phosphor_react = require("phosphor-react");
177
+ var import_jsx_runtime3 = require("react/jsx-runtime");
178
+ var VARIANT_ACTION_CLASSES2 = {
179
+ solid: {
180
+ error: "bg-error-background text-error-700 focus-visible:outline-none",
181
+ warning: "bg-warning text-warning-800 focus-visible:outline-none",
182
+ success: "bg-success text-success-800 focus-visible:outline-none",
183
+ info: "bg-info text-info-800 focus-visible:outline-none",
184
+ muted: "bg-background-muted text-background-800 focus-visible:outline-none"
185
+ },
186
+ outlined: {
187
+ error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
188
+ warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
189
+ success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
190
+ info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
191
+ muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
192
+ },
193
+ exams: {
194
+ exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
195
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
196
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
197
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
198
+ },
199
+ examsOutlined: {
200
+ exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
201
+ exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
202
+ exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
203
+ exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
204
+ },
205
+ resultStatus: {
206
+ negative: "bg-error text-error-800 focus-visible:outline-none",
207
+ positive: "bg-success text-success-800 focus-visible:outline-none"
208
+ },
209
+ notification: "text-primary"
210
+ };
211
+ var SIZE_CLASSES2 = {
212
+ small: "text-2xs px-2 py-1",
213
+ medium: "text-xs px-2 py-1",
214
+ large: "text-sm px-2 py-1"
215
+ };
216
+ var SIZE_CLASSES_ICON = {
217
+ small: "size-3",
218
+ medium: "size-3.5",
219
+ large: "size-4"
220
+ };
221
+ var Badge = ({
222
+ children,
223
+ iconLeft,
224
+ iconRight,
225
+ size = "medium",
226
+ variant = "solid",
227
+ action = "error",
228
+ className = "",
229
+ notificationActive = false,
230
+ ...props
231
+ }) => {
232
+ const sizeClasses = SIZE_CLASSES2[size];
233
+ const sizeClassesIcon = SIZE_CLASSES_ICON[size];
234
+ const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
235
+ const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
236
+ const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
237
+ const baseClassesIcon = "flex items-center";
238
+ if (variant === "notification") {
239
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
240
+ "div",
241
+ {
242
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
243
+ ...props,
244
+ children: [
245
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
246
+ notificationActive && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
247
+ "span",
248
+ {
249
+ "data-testid": "notification-dot",
250
+ className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
251
+ }
252
+ )
253
+ ]
254
+ }
255
+ );
256
+ }
257
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
258
+ "div",
259
+ {
260
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
261
+ ...props,
262
+ children: [
263
+ iconLeft && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
264
+ children,
265
+ iconRight && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
266
+ ]
267
+ }
268
+ );
269
+ };
270
+ var Badge_default = Badge;
271
+
272
+ // src/components/LatexRenderer/LatexRenderer.tsx
273
+ var import_katex_min = require("katex/dist/katex.min.css");
274
+ var import_react_katex = require("react-katex");
275
+ var import_dompurify = __toESM(require("dompurify"));
276
+ var import_html_react_parser = __toESM(require("html-react-parser"));
277
+ var import_jsx_runtime4 = require("react/jsx-runtime");
278
+ var sanitizeHtml = (value) => {
279
+ return import_dompurify.default.sanitize(value, {
280
+ ADD_ATTR: ["data-latex", "data-display-mode", "data-math", "data-math-id"]
281
+ });
282
+ };
283
+ var decodeHtmlEntities = (str) => {
284
+ const textarea = document.createElement("textarea");
285
+ textarea.innerHTML = str;
286
+ return textarea.value;
287
+ };
288
+ var cleanLatex = (str) => {
289
+ return str.replaceAll(/[\u200B-\u200D\uFEFF]/g, "").trim();
290
+ };
291
+ var createMathReplacer = (mathParts, errorRenderer) => {
292
+ return (domNode) => {
293
+ if (domNode instanceof import_html_react_parser.Element && domNode.name === "span" && domNode.attribs["data-math-id"]) {
294
+ const mathId = Number.parseInt(domNode.attribs["data-math-id"], 10);
295
+ const mathPart = mathParts[mathId];
296
+ if (!mathPart) return domNode;
297
+ if (mathPart.type === "inline") {
298
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
299
+ import_react_katex.InlineMath,
300
+ {
301
+ math: mathPart.latex,
302
+ renderError: () => errorRenderer(mathPart.latex)
303
+ },
304
+ `math-${mathId}`
305
+ );
306
+ } else {
307
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "my-2.5 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
308
+ import_react_katex.BlockMath,
309
+ {
310
+ math: mathPart.latex,
311
+ renderError: () => errorRenderer(mathPart.latex)
312
+ }
313
+ ) }, `math-${mathId}`);
314
+ }
315
+ }
316
+ return domNode;
317
+ };
318
+ };
319
+ var LatexRenderer = ({
320
+ content,
321
+ className,
322
+ style,
323
+ onError
324
+ }) => {
325
+ const renderContentWithMath = (htmlContent) => {
326
+ if (!htmlContent) return null;
327
+ let processedContent = htmlContent;
328
+ const mathParts = [];
329
+ const mathFormulaPattern = /<span[^>]*class="math-formula"[^>]*data-latex="([^"]*)"[^>]*>[\s\S]*?<\/span>/g;
330
+ processedContent = processedContent.replaceAll(
331
+ mathFormulaPattern,
332
+ (match, latex) => {
333
+ const isDisplayMode = match.includes('data-display-mode="true"');
334
+ const id = mathParts.length;
335
+ mathParts.push({
336
+ id,
337
+ type: isDisplayMode ? "block" : "inline",
338
+ latex: cleanLatex(decodeHtmlEntities(latex))
339
+ });
340
+ return `<span data-math-id="${id}"></span>`;
341
+ }
342
+ );
343
+ const wrappedMathPattern = /<span[^>]*class="math-expression"[^>]*data-math="([^"]*)"[^>]*>.*?<\/span>/g;
344
+ processedContent = processedContent.replaceAll(
345
+ wrappedMathPattern,
346
+ (match, latex) => {
347
+ const id = mathParts.length;
348
+ mathParts.push({
349
+ id,
350
+ type: "inline",
351
+ latex: cleanLatex(decodeHtmlEntities(latex))
352
+ });
353
+ return `<span data-math-id="${id}"></span>`;
354
+ }
355
+ );
356
+ const doubleDollarPattern = /(?<!\\)\$\$([\s\S]+?)\$\$/g;
357
+ processedContent = processedContent.replaceAll(
358
+ doubleDollarPattern,
359
+ (match, latex) => {
360
+ const id = mathParts.length;
361
+ mathParts.push({
362
+ id,
363
+ type: "block",
364
+ latex: cleanLatex(latex)
365
+ });
366
+ return `<span data-math-id="${id}"></span>`;
367
+ }
368
+ );
369
+ const singleDollarPattern = /(?<!\\)\$([\s\S]+?)\$/g;
370
+ processedContent = processedContent.replaceAll(
371
+ singleDollarPattern,
372
+ (match, latex) => {
373
+ const id = mathParts.length;
374
+ mathParts.push({
375
+ id,
376
+ type: "inline",
377
+ latex: cleanLatex(latex)
378
+ });
379
+ return `<span data-math-id="${id}"></span>`;
380
+ }
381
+ );
382
+ const latexTagPattern = /(?:<latex>|&lt;latex&gt;)([\s\S]*?)(?:<\/latex>|&lt;\/latex&gt;)/g;
383
+ processedContent = processedContent.replaceAll(
384
+ latexTagPattern,
385
+ (match, latex) => {
386
+ const id = mathParts.length;
387
+ mathParts.push({
388
+ id,
389
+ type: "inline",
390
+ latex: cleanLatex(latex)
391
+ });
392
+ return `<span data-math-id="${id}"></span>`;
393
+ }
394
+ );
395
+ const latexEnvPattern = /\\begin\{([^}]+)\}([\s\S]*?)\\end\{\1\}/g;
396
+ processedContent = processedContent.replaceAll(latexEnvPattern, (match) => {
397
+ const id = mathParts.length;
398
+ mathParts.push({
399
+ id,
400
+ type: "block",
401
+ latex: cleanLatex(match)
402
+ });
403
+ return `<span data-math-id="${id}"></span>`;
404
+ });
405
+ const sanitizedContent = sanitizeHtml(processedContent);
406
+ const defaultErrorRenderer = (latex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "text-red-600", children: [
407
+ "Math Error: ",
408
+ latex
409
+ ] });
410
+ const errorRenderer = onError || defaultErrorRenderer;
411
+ const options = {
412
+ replace: createMathReplacer(mathParts, errorRenderer)
413
+ };
414
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: (0, import_html_react_parser.default)(sanitizedContent, options) });
415
+ };
416
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
417
+ "div",
418
+ {
419
+ className: cn("whitespace-pre-wrap leading-relaxed", className),
420
+ style,
421
+ children: renderContentWithMath(content)
422
+ }
423
+ );
424
+ };
425
+ var LatexRenderer_default = LatexRenderer;
426
+
427
+ // src/components/CheckBox/CheckBox.tsx
428
+ var import_react = require("react");
429
+ var import_phosphor_react2 = require("phosphor-react");
430
+ var import_jsx_runtime5 = require("react/jsx-runtime");
431
+ var SIZE_CLASSES3 = {
432
+ small: {
433
+ checkbox: "w-4 h-4",
434
+ // 16px x 16px
435
+ textSize: "sm",
436
+ spacing: "gap-1.5",
437
+ // 6px
438
+ borderWidth: "border-2",
439
+ iconSize: 14,
440
+ // pixels for Phosphor icons
441
+ labelHeight: "h-[21px]"
442
+ },
443
+ medium: {
444
+ checkbox: "w-5 h-5",
445
+ // 20px x 20px
446
+ textSize: "md",
447
+ spacing: "gap-2",
448
+ // 8px
449
+ borderWidth: "border-2",
450
+ iconSize: 16,
451
+ // pixels for Phosphor icons
452
+ labelHeight: "h-6"
453
+ },
454
+ large: {
455
+ checkbox: "w-6 h-6",
456
+ // 24px x 24px
457
+ textSize: "lg",
458
+ spacing: "gap-2",
459
+ // 8px
460
+ borderWidth: "border-[3px]",
461
+ // 3px border
462
+ iconSize: 20,
463
+ // pixels for Phosphor icons
464
+ labelHeight: "h-[27px]"
465
+ }
466
+ };
467
+ var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
468
+ var STATE_CLASSES = {
469
+ default: {
470
+ unchecked: "border-border-400 bg-background hover:border-border-500",
471
+ checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
472
+ },
473
+ hovered: {
474
+ unchecked: "border-border-500 bg-background",
475
+ checked: "border-primary-800 bg-primary-800 text-text"
476
+ },
477
+ focused: {
478
+ unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
479
+ checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
480
+ },
481
+ invalid: {
482
+ unchecked: "border-error-700 bg-background hover:border-error-600",
483
+ checked: "border-error-700 bg-primary-950 text-text"
484
+ },
485
+ disabled: {
486
+ unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
487
+ checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
488
+ }
489
+ };
490
+ var CheckBox = (0, import_react.forwardRef)(
491
+ ({
492
+ label,
493
+ size = "medium",
494
+ state = "default",
495
+ indeterminate = false,
496
+ errorMessage,
497
+ helperText,
498
+ className = "",
499
+ labelClassName = "",
500
+ checked: checkedProp,
501
+ disabled,
502
+ id,
503
+ onChange,
504
+ ...props
505
+ }, ref) => {
506
+ const generatedId = (0, import_react.useId)();
507
+ const inputId = id ?? `checkbox-${generatedId}`;
508
+ const [internalChecked, setInternalChecked] = (0, import_react.useState)(false);
509
+ const isControlled = checkedProp !== void 0;
510
+ const checked = isControlled ? checkedProp : internalChecked;
511
+ const handleChange = (event) => {
512
+ if (!isControlled) {
513
+ setInternalChecked(event.target.checked);
514
+ }
515
+ onChange?.(event);
516
+ };
517
+ const currentState = disabled ? "disabled" : state;
518
+ const sizeClasses = SIZE_CLASSES3[size];
519
+ const checkVariant = checked || indeterminate ? "checked" : "unchecked";
520
+ const stylingClasses = STATE_CLASSES[currentState][checkVariant];
521
+ const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
522
+ const checkboxClasses = cn(
523
+ BASE_CHECKBOX_CLASSES,
524
+ sizeClasses.checkbox,
525
+ borderWidthClass,
526
+ stylingClasses,
527
+ className
528
+ );
529
+ const renderIcon = () => {
530
+ if (indeterminate) {
531
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
532
+ import_phosphor_react2.Minus,
533
+ {
534
+ size: sizeClasses.iconSize,
535
+ weight: "bold",
536
+ color: "currentColor"
537
+ }
538
+ );
539
+ }
540
+ if (checked) {
541
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
542
+ import_phosphor_react2.Check,
543
+ {
544
+ size: sizeClasses.iconSize,
545
+ weight: "bold",
546
+ color: "currentColor"
547
+ }
548
+ );
549
+ }
550
+ return null;
551
+ };
552
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col", children: [
553
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
554
+ "div",
555
+ {
556
+ className: cn(
557
+ "flex flex-row items-center",
558
+ sizeClasses.spacing,
559
+ disabled ? "opacity-40" : ""
560
+ ),
561
+ children: [
562
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
563
+ "input",
564
+ {
565
+ ref,
566
+ type: "checkbox",
567
+ id: inputId,
568
+ checked,
569
+ disabled,
570
+ onChange: handleChange,
571
+ className: "sr-only",
572
+ ...props
573
+ }
574
+ ),
575
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
576
+ label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
577
+ "div",
578
+ {
579
+ className: cn(
580
+ "flex flex-row items-center",
581
+ sizeClasses.labelHeight
582
+ ),
583
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
584
+ Text_default,
585
+ {
586
+ as: "label",
587
+ htmlFor: inputId,
588
+ size: sizeClasses.textSize,
589
+ weight: "normal",
590
+ className: cn(
591
+ "cursor-pointer select-none leading-[150%] flex items-center font-roboto",
592
+ labelClassName
593
+ ),
594
+ children: label
595
+ }
596
+ )
597
+ }
598
+ )
599
+ ]
600
+ }
601
+ ),
602
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
603
+ Text_default,
604
+ {
605
+ size: "sm",
606
+ weight: "normal",
607
+ className: "mt-1.5",
608
+ color: "text-error-600",
609
+ children: errorMessage
610
+ }
611
+ ),
612
+ helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
613
+ Text_default,
614
+ {
615
+ size: "sm",
616
+ weight: "normal",
617
+ className: "mt-1.5",
618
+ color: "text-text-500",
619
+ children: helperText
620
+ }
621
+ )
622
+ ] });
623
+ }
624
+ );
625
+ CheckBox.displayName = "CheckBox";
626
+ var CheckBox_default = CheckBox;
627
+
628
+ // src/components/CheckBox/CheckboxList.tsx
629
+ var import_react2 = require("react");
630
+ var import_zustand = require("zustand");
631
+ var import_jsx_runtime6 = require("react/jsx-runtime");
632
+ var createCheckboxListStore = (name, defaultValues, disabled, onValuesChange) => (0, import_zustand.create)((set, get) => ({
633
+ values: defaultValues,
634
+ setValues: (values) => {
635
+ if (!get().disabled) {
636
+ set({ values });
637
+ get().onValuesChange?.(values);
638
+ }
639
+ },
640
+ toggleValue: (value) => {
641
+ if (!get().disabled) {
642
+ const currentValues = get().values;
643
+ const newValues = currentValues.includes(value) ? currentValues.filter((v) => v !== value) : [...currentValues, value];
644
+ set({ values: newValues });
645
+ get().onValuesChange?.(newValues);
646
+ }
647
+ },
648
+ onValuesChange,
649
+ disabled,
650
+ name
651
+ }));
652
+ var useCheckboxListStore = (externalStore) => {
653
+ if (!externalStore) {
654
+ throw new Error("CheckboxListItem must be used within a CheckboxList");
655
+ }
656
+ return externalStore;
657
+ };
658
+ var injectStore = (children, store) => import_react2.Children.map(children, (child) => {
659
+ if (!(0, import_react2.isValidElement)(child)) return child;
660
+ const typedChild = child;
661
+ const shouldInject = typedChild.type === CheckboxListItem;
662
+ return (0, import_react2.cloneElement)(typedChild, {
663
+ ...shouldInject ? { store } : {},
664
+ ...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
665
+ });
666
+ });
667
+ var CheckboxList = (0, import_react2.forwardRef)(
668
+ ({
669
+ values: propValues,
670
+ defaultValues = [],
671
+ onValuesChange,
672
+ name: propName,
673
+ disabled = false,
674
+ className = "",
675
+ children,
676
+ ...props
677
+ }, ref) => {
678
+ const generatedId = (0, import_react2.useId)();
679
+ const name = propName || `checkbox-list-${generatedId}`;
680
+ const storeRef = (0, import_react2.useRef)(null);
681
+ storeRef.current ??= createCheckboxListStore(
682
+ name,
683
+ defaultValues,
684
+ disabled,
685
+ onValuesChange
686
+ );
687
+ const store = storeRef.current;
688
+ const { setValues } = (0, import_zustand.useStore)(store, (s) => s);
689
+ (0, import_react2.useEffect)(() => {
690
+ const currentValues = store.getState().values;
691
+ if (currentValues.length > 0 && onValuesChange) {
692
+ onValuesChange(currentValues);
693
+ }
694
+ }, []);
695
+ (0, import_react2.useEffect)(() => {
696
+ if (propValues !== void 0) {
697
+ setValues(propValues);
698
+ }
699
+ }, [propValues, setValues]);
700
+ (0, import_react2.useEffect)(() => {
701
+ store.setState({ disabled });
702
+ }, [disabled, store]);
703
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
704
+ "div",
705
+ {
706
+ ref,
707
+ className: cn("flex flex-col gap-2 w-full", className),
708
+ "aria-label": name,
709
+ ...props,
710
+ children: injectStore(children, store)
711
+ }
712
+ );
713
+ }
714
+ );
715
+ CheckboxList.displayName = "CheckboxList";
716
+ var CheckboxListItem = (0, import_react2.forwardRef)(
717
+ ({
718
+ value,
719
+ store: externalStore,
720
+ disabled: itemDisabled,
721
+ size = "medium",
722
+ state = "default",
723
+ className = "",
724
+ id,
725
+ ...props
726
+ }, ref) => {
727
+ const store = useCheckboxListStore(externalStore);
728
+ const {
729
+ values: groupValues,
730
+ toggleValue,
731
+ disabled: groupDisabled,
732
+ name
733
+ } = (0, import_zustand.useStore)(store);
734
+ const generatedId = (0, import_react2.useId)();
735
+ const inputId = id ?? `checkbox-item-${generatedId}`;
736
+ const isChecked = groupValues.includes(value);
737
+ const isDisabled = groupDisabled || itemDisabled;
738
+ const currentState = isDisabled ? "disabled" : state;
739
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
740
+ CheckBox_default,
741
+ {
742
+ ref,
743
+ id: inputId,
744
+ name,
745
+ value,
746
+ checked: isChecked,
747
+ disabled: isDisabled,
748
+ size,
749
+ state: currentState,
750
+ className,
751
+ onChange: () => {
752
+ if (!isDisabled) {
753
+ toggleValue(value);
754
+ }
755
+ },
756
+ ...props
757
+ }
758
+ );
759
+ }
760
+ );
761
+ CheckboxListItem.displayName = "CheckboxListItem";
762
+ var CheckboxList_default = CheckboxList;
763
+
764
+ // src/components/Radio/Radio.tsx
765
+ var import_react3 = require("react");
766
+ var import_zustand2 = require("zustand");
767
+ var import_jsx_runtime7 = require("react/jsx-runtime");
768
+ var SIZE_CLASSES4 = {
769
+ small: {
770
+ radio: "w-5 h-5",
771
+ textSize: "sm",
772
+ spacing: "gap-1.5",
773
+ borderWidth: "border-2",
774
+ dotSize: "w-2.5 h-2.5",
775
+ labelHeight: "h-5"
776
+ },
777
+ medium: {
778
+ radio: "w-6 h-6",
779
+ textSize: "md",
780
+ spacing: "gap-2",
781
+ borderWidth: "border-2",
782
+ dotSize: "w-3 h-3",
783
+ labelHeight: "h-6"
784
+ },
785
+ large: {
786
+ radio: "w-7 h-7",
787
+ textSize: "lg",
788
+ spacing: "gap-2",
789
+ borderWidth: "border-2",
790
+ dotSize: "w-3.5 h-3.5",
791
+ labelHeight: "h-7"
792
+ },
793
+ extraLarge: {
794
+ radio: "w-8 h-8",
795
+ textSize: "xl",
796
+ spacing: "gap-3",
797
+ borderWidth: "border-2",
798
+ dotSize: "w-4 h-4",
799
+ labelHeight: "h-8"
800
+ }
801
+ };
802
+ var BASE_RADIO_CLASSES = "rounded-full border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
803
+ var STATE_CLASSES2 = {
804
+ default: {
805
+ unchecked: "border-border-400 bg-background hover:border-border-500",
806
+ checked: "border-primary-950 bg-background hover:border-primary-800"
807
+ },
808
+ hovered: {
809
+ unchecked: "border-border-500 bg-background",
810
+ checked: "border-info-700 bg-background"
811
+ },
812
+ focused: {
813
+ unchecked: "border-border-400 bg-background",
814
+ checked: "border-primary-950 bg-background"
815
+ },
816
+ invalid: {
817
+ unchecked: "border-border-400 bg-background",
818
+ checked: "border-primary-950 bg-background"
819
+ },
820
+ disabled: {
821
+ unchecked: "border-border-400 bg-background cursor-not-allowed",
822
+ checked: "border-primary-950 bg-background cursor-not-allowed"
823
+ }
824
+ };
825
+ var DOT_CLASSES = {
826
+ default: "bg-primary-950",
827
+ hovered: "bg-info-700",
828
+ focused: "bg-primary-950",
829
+ invalid: "bg-primary-950",
830
+ disabled: "bg-primary-950"
831
+ };
832
+ var Radio = (0, import_react3.forwardRef)(
833
+ ({
834
+ label,
835
+ size = "medium",
836
+ state = "default",
837
+ errorMessage,
838
+ helperText,
839
+ className = "",
840
+ labelClassName = "",
841
+ checked: checkedProp,
842
+ defaultChecked = false,
843
+ disabled,
844
+ id,
845
+ name,
846
+ value,
847
+ onChange,
848
+ ...props
849
+ }, ref) => {
850
+ const generatedId = (0, import_react3.useId)();
851
+ const inputId = id ?? `radio-${generatedId}`;
852
+ const inputRef = (0, import_react3.useRef)(null);
853
+ const [internalChecked, setInternalChecked] = (0, import_react3.useState)(defaultChecked);
854
+ const isControlled = checkedProp !== void 0;
855
+ const checked = isControlled ? checkedProp : internalChecked;
856
+ const handleChange = (event) => {
857
+ const newChecked = event.target.checked;
858
+ if (!isControlled) {
859
+ setInternalChecked(newChecked);
860
+ }
861
+ if (event.target) {
862
+ event.target.blur();
863
+ }
864
+ onChange?.(event);
865
+ };
866
+ const currentState = disabled ? "disabled" : state;
867
+ const sizeClasses = SIZE_CLASSES4[size];
868
+ const actualRadioSize = sizeClasses.radio;
869
+ const actualDotSize = sizeClasses.dotSize;
870
+ const radioVariant = checked ? "checked" : "unchecked";
871
+ const stylingClasses = STATE_CLASSES2[currentState][radioVariant];
872
+ const getBorderWidth = () => {
873
+ if (currentState === "focused") {
874
+ return "border-2";
875
+ }
876
+ return sizeClasses.borderWidth;
877
+ };
878
+ const borderWidthClass = getBorderWidth();
879
+ const radioClasses = cn(
880
+ BASE_RADIO_CLASSES,
881
+ actualRadioSize,
882
+ borderWidthClass,
883
+ stylingClasses,
884
+ className
885
+ );
886
+ const dotClasses = cn(
887
+ actualDotSize,
888
+ "rounded-full",
889
+ DOT_CLASSES[currentState],
890
+ "transition-all duration-200"
891
+ );
892
+ const isWrapperNeeded = currentState === "focused" || currentState === "invalid";
893
+ const wrapperBorderColor = currentState === "focused" ? "border-indicator-info" : "border-indicator-error";
894
+ const getTextColor = () => {
895
+ if (currentState === "disabled") {
896
+ return checked ? "text-text-900" : "text-text-600";
897
+ }
898
+ if (currentState === "focused") {
899
+ return "text-text-900";
900
+ }
901
+ return checked ? "text-text-900" : "text-text-600";
902
+ };
903
+ const getCursorClass = () => {
904
+ return currentState === "disabled" ? "cursor-not-allowed" : "cursor-pointer";
905
+ };
906
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col", children: [
907
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
908
+ "div",
909
+ {
910
+ className: cn(
911
+ "flex flex-row items-center",
912
+ isWrapperNeeded ? cn("p-1 border-2", wrapperBorderColor, "rounded-lg gap-1.5") : sizeClasses.spacing,
913
+ disabled ? "opacity-40" : ""
914
+ ),
915
+ children: [
916
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
917
+ "input",
918
+ {
919
+ ref: (node) => {
920
+ inputRef.current = node;
921
+ if (typeof ref === "function") ref(node);
922
+ else if (ref) ref.current = node;
923
+ },
924
+ type: "radio",
925
+ id: inputId,
926
+ checked,
927
+ disabled,
928
+ name,
929
+ value,
930
+ onChange: handleChange,
931
+ className: "sr-only",
932
+ style: {
933
+ position: "absolute",
934
+ left: "-9999px",
935
+ visibility: "hidden"
936
+ },
937
+ ...props
938
+ }
939
+ ),
940
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
941
+ "button",
942
+ {
943
+ type: "button",
944
+ className: radioClasses,
945
+ disabled,
946
+ "aria-pressed": checked,
947
+ onClick: (e) => {
948
+ e.preventDefault();
949
+ if (!disabled) {
950
+ if (inputRef.current) {
951
+ inputRef.current.click();
952
+ inputRef.current.blur();
953
+ }
954
+ }
955
+ },
956
+ onKeyDown: (e) => {
957
+ if ((e.key === "Enter" || e.key === " ") && !disabled) {
958
+ e.preventDefault();
959
+ if (inputRef.current) {
960
+ inputRef.current.click();
961
+ inputRef.current.blur();
962
+ }
963
+ }
964
+ },
965
+ children: checked && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: dotClasses })
966
+ }
967
+ ),
968
+ label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
969
+ "div",
970
+ {
971
+ className: cn(
972
+ "flex flex-row items-center",
973
+ sizeClasses.labelHeight,
974
+ "flex-1 min-w-0"
975
+ ),
976
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
977
+ Text_default,
978
+ {
979
+ as: "label",
980
+ htmlFor: inputId,
981
+ size: sizeClasses.textSize,
982
+ weight: "normal",
983
+ className: cn(
984
+ getCursorClass(),
985
+ "select-none leading-normal flex items-center font-roboto truncate",
986
+ labelClassName
987
+ ),
988
+ color: getTextColor(),
989
+ children: label
990
+ }
991
+ )
992
+ }
993
+ )
994
+ ]
995
+ }
996
+ ),
997
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
998
+ Text_default,
999
+ {
1000
+ size: "sm",
1001
+ weight: "normal",
1002
+ className: "mt-1.5 truncate",
1003
+ color: "text-error-600",
1004
+ children: errorMessage
1005
+ }
1006
+ ),
1007
+ helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1008
+ Text_default,
1009
+ {
1010
+ size: "sm",
1011
+ weight: "normal",
1012
+ className: "mt-1.5 truncate",
1013
+ color: "text-text-500",
1014
+ children: helperText
1015
+ }
1016
+ )
1017
+ ] });
1018
+ }
1019
+ );
1020
+ Radio.displayName = "Radio";
1021
+ var createRadioGroupStore = (name, defaultValue, disabled, onValueChange) => (0, import_zustand2.create)((set, get) => ({
1022
+ value: defaultValue,
1023
+ setValue: (value) => {
1024
+ if (!get().disabled) {
1025
+ set({ value });
1026
+ get().onValueChange?.(value);
1027
+ }
1028
+ },
1029
+ onValueChange,
1030
+ disabled,
1031
+ name
1032
+ }));
1033
+ var useRadioGroupStore = (externalStore) => {
1034
+ if (!externalStore) {
1035
+ throw new Error("RadioGroupItem must be used within a RadioGroup");
1036
+ }
1037
+ return externalStore;
1038
+ };
1039
+ var injectStore2 = (children, store) => import_react3.Children.map(children, (child) => {
1040
+ if (!(0, import_react3.isValidElement)(child)) return child;
1041
+ const typedChild = child;
1042
+ const shouldInject = typedChild.type === RadioGroupItem;
1043
+ return (0, import_react3.cloneElement)(typedChild, {
1044
+ ...shouldInject ? { store } : {},
1045
+ ...typedChild.props.children ? { children: injectStore2(typedChild.props.children, store) } : {}
1046
+ });
1047
+ });
1048
+ var RadioGroup = (0, import_react3.forwardRef)(
1049
+ ({
1050
+ value: propValue,
1051
+ defaultValue = "",
1052
+ onValueChange,
1053
+ name: propName,
1054
+ disabled = false,
1055
+ className = "",
1056
+ children,
1057
+ ...props
1058
+ }, ref) => {
1059
+ const generatedId = (0, import_react3.useId)();
1060
+ const name = propName || `radio-group-${generatedId}`;
1061
+ const storeRef = (0, import_react3.useRef)(null);
1062
+ storeRef.current ??= createRadioGroupStore(
1063
+ name,
1064
+ defaultValue,
1065
+ disabled,
1066
+ onValueChange
1067
+ );
1068
+ const store = storeRef.current;
1069
+ const { setValue } = (0, import_zustand2.useStore)(store, (s) => s);
1070
+ (0, import_react3.useEffect)(() => {
1071
+ const currentValue = store.getState().value;
1072
+ if (currentValue && onValueChange) {
1073
+ onValueChange(currentValue);
1074
+ }
1075
+ }, []);
1076
+ (0, import_react3.useEffect)(() => {
1077
+ if (propValue !== void 0) {
1078
+ setValue(propValue);
1079
+ }
1080
+ }, [propValue, setValue]);
1081
+ (0, import_react3.useEffect)(() => {
1082
+ store.setState({ disabled });
1083
+ }, [disabled, store]);
1084
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1085
+ "div",
1086
+ {
1087
+ ref,
1088
+ className,
1089
+ role: "radiogroup",
1090
+ "aria-label": name,
1091
+ ...props,
1092
+ children: injectStore2(children, store)
1093
+ }
1094
+ );
1095
+ }
1096
+ );
1097
+ RadioGroup.displayName = "RadioGroup";
1098
+ var RadioGroupItem = (0, import_react3.forwardRef)(
1099
+ ({
1100
+ value,
1101
+ store: externalStore,
1102
+ disabled: itemDisabled,
1103
+ size = "medium",
1104
+ state = "default",
1105
+ className = "",
1106
+ id,
1107
+ ...props
1108
+ }, ref) => {
1109
+ const store = useRadioGroupStore(externalStore);
1110
+ const {
1111
+ value: groupValue,
1112
+ setValue,
1113
+ disabled: groupDisabled,
1114
+ name
1115
+ } = (0, import_zustand2.useStore)(store);
1116
+ const generatedId = (0, import_react3.useId)();
1117
+ const inputId = id ?? `radio-item-${generatedId}`;
1118
+ const isChecked = groupValue === value;
1119
+ const isDisabled = groupDisabled || itemDisabled;
1120
+ const currentState = isDisabled ? "disabled" : state;
1121
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1122
+ Radio,
1123
+ {
1124
+ ref,
1125
+ id: inputId,
1126
+ name,
1127
+ value,
1128
+ checked: isChecked,
1129
+ disabled: isDisabled,
1130
+ size,
1131
+ state: currentState,
1132
+ className,
1133
+ onChange: (e) => {
1134
+ if (e.target.checked && !isDisabled) {
1135
+ setValue(value);
1136
+ }
1137
+ },
1138
+ ...props
1139
+ }
1140
+ );
1141
+ }
1142
+ );
1143
+ RadioGroupItem.displayName = "RadioGroupItem";
1144
+
1145
+ // src/components/ProgressBar/ProgressBar.tsx
1146
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1147
+ var SIZE_CLASSES5 = {
1148
+ small: {
1149
+ container: "h-1",
1150
+ // 4px height (h-1 = 4px in Tailwind)
1151
+ bar: "h-1",
1152
+ // 4px height for the fill bar
1153
+ spacing: "gap-2",
1154
+ // 8px gap between label and progress bar
1155
+ layout: "flex-col",
1156
+ // vertical layout for small
1157
+ borderRadius: "rounded-full"
1158
+ // 9999px border radius
1159
+ },
1160
+ medium: {
1161
+ container: "h-2",
1162
+ // 8px height (h-2 = 8px in Tailwind)
1163
+ bar: "h-2",
1164
+ // 8px height for the fill bar
1165
+ spacing: "gap-2",
1166
+ // 8px gap between progress bar and label
1167
+ layout: "flex-row items-center",
1168
+ // horizontal layout for medium
1169
+ borderRadius: "rounded-lg"
1170
+ // 8px border radius
1171
+ }
1172
+ };
1173
+ var VARIANT_CLASSES = {
1174
+ blue: {
1175
+ background: "bg-background-300",
1176
+ // Background track color (#D5D4D4)
1177
+ fill: "bg-primary-700"
1178
+ // Blue for activity progress (#2271C4)
1179
+ },
1180
+ green: {
1181
+ background: "bg-background-300",
1182
+ // Background track color (#D5D4D4)
1183
+ fill: "bg-success-200"
1184
+ // Green for performance (#84D3A2)
1185
+ }
1186
+ };
1187
+ var calculateProgressValues = (value, max) => {
1188
+ const safeValue = isNaN(value) ? 0 : value;
1189
+ const clampedValue = Math.max(0, Math.min(safeValue, max));
1190
+ const percentage = max === 0 ? 0 : clampedValue / max * 100;
1191
+ return { clampedValue, percentage };
1192
+ };
1193
+ var shouldShowHeader = (label, showPercentage, showHitCount) => {
1194
+ return !!(label || showPercentage || showHitCount);
1195
+ };
1196
+ var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
1197
+ if (showHitCount) {
1198
+ return {
1199
+ type: "hitCount",
1200
+ content: `${Math.round(clampedValue)} de ${max}`,
1201
+ hasMetrics: true
1202
+ };
1203
+ }
1204
+ if (showPercentage) {
1205
+ return {
1206
+ type: "percentage",
1207
+ content: `${Math.round(percentage)}%`,
1208
+ hasMetrics: true
1209
+ };
1210
+ }
1211
+ return {
1212
+ type: "label",
1213
+ content: label,
1214
+ hasMetrics: false
1215
+ };
1216
+ };
1217
+ var getCompactLayoutConfig = ({
1218
+ showPercentage,
1219
+ showHitCount,
1220
+ percentage,
1221
+ clampedValue,
1222
+ max,
1223
+ label,
1224
+ percentageClassName,
1225
+ labelClassName
1226
+ }) => {
1227
+ const displayPriority = getDisplayPriority(
1228
+ showHitCount,
1229
+ showPercentage,
1230
+ label,
1231
+ clampedValue,
1232
+ max,
1233
+ percentage
1234
+ );
1235
+ return {
1236
+ color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
1237
+ className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
1238
+ content: displayPriority.content
1239
+ };
1240
+ };
1241
+ var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
1242
+ showHeader: size === "small" && !!(label || showPercentage),
1243
+ showPercentage: size === "medium" && showPercentage,
1244
+ showLabel: size === "medium" && !!label && !showPercentage
1245
+ // Only show label when percentage is not shown
1246
+ });
1247
+ var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
1248
+ if (!showHitCount && !showPercentage) return null;
1249
+ const displayPriority = getDisplayPriority(
1250
+ showHitCount,
1251
+ showPercentage,
1252
+ null,
1253
+ // label is not relevant for stacked layout metrics display
1254
+ clampedValue,
1255
+ max,
1256
+ percentage
1257
+ );
1258
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1259
+ "div",
1260
+ {
1261
+ className: cn(
1262
+ "text-xs font-medium leading-[14px] text-right",
1263
+ percentageClassName
1264
+ ),
1265
+ children: displayPriority.type === "hitCount" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
1266
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-success-200", children: Math.round(clampedValue) }),
1267
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "text-text-600", children: [
1268
+ " de ",
1269
+ max
1270
+ ] })
1271
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
1272
+ Math.round(percentage),
1273
+ "%"
1274
+ ] })
1275
+ }
1276
+ );
1277
+ };
1278
+ var ProgressBarBase = ({
1279
+ clampedValue,
1280
+ max,
1281
+ percentage,
1282
+ label,
1283
+ variantClasses,
1284
+ containerClassName,
1285
+ fillClassName
1286
+ }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1287
+ "div",
1288
+ {
1289
+ className: cn(
1290
+ containerClassName,
1291
+ variantClasses.background,
1292
+ "overflow-hidden relative"
1293
+ ),
1294
+ children: [
1295
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1296
+ "progress",
1297
+ {
1298
+ value: clampedValue,
1299
+ max,
1300
+ "aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
1301
+ className: "absolute inset-0 w-full h-full opacity-0"
1302
+ }
1303
+ ),
1304
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1305
+ "div",
1306
+ {
1307
+ className: cn(
1308
+ fillClassName,
1309
+ variantClasses.fill,
1310
+ "transition-all duration-300 ease-out"
1311
+ ),
1312
+ style: { width: `${percentage}%` }
1313
+ }
1314
+ )
1315
+ ]
1316
+ }
1317
+ );
1318
+ var StackedLayout = ({
1319
+ className,
1320
+ label,
1321
+ showPercentage,
1322
+ showHitCount,
1323
+ labelClassName,
1324
+ percentageClassName,
1325
+ clampedValue,
1326
+ max,
1327
+ percentage,
1328
+ variantClasses,
1329
+ dimensions
1330
+ }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1331
+ "div",
1332
+ {
1333
+ className: cn(
1334
+ "flex flex-col items-start gap-2",
1335
+ dimensions.width,
1336
+ dimensions.height,
1337
+ className
1338
+ ),
1339
+ children: [
1340
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
1341
+ label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1342
+ Text_default,
1343
+ {
1344
+ as: "div",
1345
+ size: "md",
1346
+ weight: "medium",
1347
+ className: cn("text-text-600 leading-[19px]", labelClassName),
1348
+ children: label
1349
+ }
1350
+ ),
1351
+ renderStackedHitCountDisplay(
1352
+ showHitCount,
1353
+ showPercentage,
1354
+ clampedValue,
1355
+ max,
1356
+ percentage,
1357
+ percentageClassName
1358
+ )
1359
+ ] }),
1360
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1361
+ ProgressBarBase,
1362
+ {
1363
+ clampedValue,
1364
+ max,
1365
+ percentage,
1366
+ label,
1367
+ variantClasses,
1368
+ containerClassName: "w-full h-2 rounded-lg",
1369
+ fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
1370
+ }
1371
+ )
1372
+ ]
1373
+ }
1374
+ );
1375
+ var CompactLayout = ({
1376
+ className,
1377
+ label,
1378
+ showPercentage,
1379
+ showHitCount,
1380
+ labelClassName,
1381
+ percentageClassName,
1382
+ clampedValue,
1383
+ max,
1384
+ percentage,
1385
+ variantClasses,
1386
+ dimensions
1387
+ }) => {
1388
+ const {
1389
+ color,
1390
+ className: compactClassName,
1391
+ content
1392
+ } = getCompactLayoutConfig({
1393
+ showPercentage,
1394
+ showHitCount,
1395
+ percentage,
1396
+ clampedValue,
1397
+ max,
1398
+ label,
1399
+ percentageClassName,
1400
+ labelClassName
1401
+ });
1402
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1403
+ "div",
1404
+ {
1405
+ className: cn(
1406
+ "flex flex-col items-start gap-1",
1407
+ dimensions.width,
1408
+ dimensions.height,
1409
+ className
1410
+ ),
1411
+ children: [
1412
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1413
+ Text_default,
1414
+ {
1415
+ as: "div",
1416
+ size: "sm",
1417
+ weight: "medium",
1418
+ color,
1419
+ className: cn("leading-4 w-full", compactClassName),
1420
+ children: content
1421
+ }
1422
+ ),
1423
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1424
+ ProgressBarBase,
1425
+ {
1426
+ clampedValue,
1427
+ max,
1428
+ percentage,
1429
+ label,
1430
+ variantClasses,
1431
+ containerClassName: "w-full h-1 rounded-full",
1432
+ fillClassName: "h-1 rounded-full"
1433
+ }
1434
+ )
1435
+ ]
1436
+ }
1437
+ );
1438
+ };
1439
+ var DefaultLayout = ({
1440
+ className,
1441
+ size,
1442
+ sizeClasses,
1443
+ variantClasses,
1444
+ label,
1445
+ showPercentage,
1446
+ labelClassName,
1447
+ percentageClassName,
1448
+ clampedValue,
1449
+ max,
1450
+ percentage
1451
+ }) => {
1452
+ const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
1453
+ const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
1454
+ const displayConfig = getDefaultLayoutDisplayConfig(
1455
+ size,
1456
+ label,
1457
+ showPercentage
1458
+ );
1459
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cn("flex", sizeClasses.layout, gapClass, className), children: [
1460
+ displayConfig.showHeader && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
1461
+ label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1462
+ Text_default,
1463
+ {
1464
+ as: "div",
1465
+ size: "xs",
1466
+ weight: "medium",
1467
+ className: cn(
1468
+ "text-text-950 leading-none tracking-normal text-center",
1469
+ labelClassName
1470
+ ),
1471
+ children: label
1472
+ }
1473
+ ),
1474
+ showPercentage && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1475
+ Text_default,
1476
+ {
1477
+ size: "xs",
1478
+ weight: "medium",
1479
+ className: cn(
1480
+ "text-text-950 leading-none tracking-normal text-center",
1481
+ percentageClassName
1482
+ ),
1483
+ children: [
1484
+ Math.round(percentage),
1485
+ "%"
1486
+ ]
1487
+ }
1488
+ )
1489
+ ] }),
1490
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1491
+ ProgressBarBase,
1492
+ {
1493
+ clampedValue,
1494
+ max,
1495
+ percentage,
1496
+ label,
1497
+ variantClasses,
1498
+ containerClassName: cn(
1499
+ progressBarClass,
1500
+ sizeClasses.container,
1501
+ sizeClasses.borderRadius
1502
+ ),
1503
+ fillClassName: cn(
1504
+ sizeClasses.bar,
1505
+ sizeClasses.borderRadius,
1506
+ "shadow-hard-shadow-3"
1507
+ )
1508
+ }
1509
+ ),
1510
+ displayConfig.showPercentage && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1511
+ Text_default,
1512
+ {
1513
+ size: "xs",
1514
+ weight: "medium",
1515
+ className: cn(
1516
+ "text-text-950 leading-none tracking-normal text-center flex-none",
1517
+ percentageClassName
1518
+ ),
1519
+ children: [
1520
+ Math.round(percentage),
1521
+ "%"
1522
+ ]
1523
+ }
1524
+ ),
1525
+ displayConfig.showLabel && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1526
+ Text_default,
1527
+ {
1528
+ as: "div",
1529
+ size: "xs",
1530
+ weight: "medium",
1531
+ className: cn(
1532
+ "text-text-950 leading-none tracking-normal text-center flex-none",
1533
+ labelClassName
1534
+ ),
1535
+ children: label
1536
+ }
1537
+ )
1538
+ ] });
1539
+ };
1540
+ var ProgressBar = ({
1541
+ value,
1542
+ max = 100,
1543
+ size = "medium",
1544
+ variant = "blue",
1545
+ layout = "default",
1546
+ label,
1547
+ showPercentage = false,
1548
+ showHitCount = false,
1549
+ className = "",
1550
+ labelClassName = "",
1551
+ percentageClassName = "",
1552
+ stackedWidth,
1553
+ stackedHeight,
1554
+ compactWidth,
1555
+ compactHeight
1556
+ }) => {
1557
+ const { clampedValue, percentage } = calculateProgressValues(value, max);
1558
+ const sizeClasses = SIZE_CLASSES5[size];
1559
+ const variantClasses = VARIANT_CLASSES[variant];
1560
+ if (layout === "stacked") {
1561
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1562
+ StackedLayout,
1563
+ {
1564
+ className,
1565
+ label,
1566
+ showPercentage,
1567
+ showHitCount,
1568
+ labelClassName,
1569
+ percentageClassName,
1570
+ clampedValue,
1571
+ max,
1572
+ percentage,
1573
+ variantClasses,
1574
+ dimensions: {
1575
+ width: stackedWidth ?? "w-[380px]",
1576
+ height: stackedHeight ?? "h-[35px]"
1577
+ }
1578
+ }
1579
+ );
1580
+ }
1581
+ if (layout === "compact") {
1582
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1583
+ CompactLayout,
1584
+ {
1585
+ className,
1586
+ label,
1587
+ showPercentage,
1588
+ showHitCount,
1589
+ labelClassName,
1590
+ percentageClassName,
1591
+ clampedValue,
1592
+ max,
1593
+ percentage,
1594
+ variantClasses,
1595
+ dimensions: {
1596
+ width: compactWidth ?? "w-[131px]",
1597
+ height: compactHeight ?? "h-[24px]"
1598
+ }
1599
+ }
1600
+ );
1601
+ }
1602
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1603
+ DefaultLayout,
1604
+ {
1605
+ className,
1606
+ size,
1607
+ sizeClasses,
1608
+ variantClasses,
1609
+ label,
1610
+ showPercentage,
1611
+ labelClassName,
1612
+ percentageClassName,
1613
+ clampedValue,
1614
+ max,
1615
+ percentage
1616
+ }
1617
+ );
1618
+ };
1619
+ var ProgressBar_default = ProgressBar;
1620
+
1621
+ // src/components/Alternative/Alternative.tsx
1622
+ var import_phosphor_react3 = require("phosphor-react");
1623
+ var import_react4 = require("react");
1624
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1625
+ var AlternativesList = ({
1626
+ alternatives,
1627
+ name,
1628
+ defaultValue,
1629
+ value,
1630
+ onValueChange,
1631
+ disabled = false,
1632
+ layout = "default",
1633
+ className = "",
1634
+ mode = "interactive",
1635
+ selectedValue
1636
+ }) => {
1637
+ const uniqueId = (0, import_react4.useId)();
1638
+ const groupName = name || `alternatives-${uniqueId}`;
1639
+ const [actualValue, setActualValue] = (0, import_react4.useState)(value);
1640
+ const isReadonly = mode === "readonly";
1641
+ const getStatusStyles = (status, isReadonly2) => {
1642
+ const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
1643
+ switch (status) {
1644
+ case "correct":
1645
+ return "bg-success-background border-success-300";
1646
+ case "incorrect":
1647
+ return "bg-error-background border-error-300";
1648
+ default:
1649
+ return `bg-background border-border-100 ${hoverClass}`;
1650
+ }
1651
+ };
1652
+ const getStatusBadge = (status) => {
1653
+ switch (status) {
1654
+ case "correct":
1655
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react3.CheckCircle, {}), children: "Resposta correta" });
1656
+ case "incorrect":
1657
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react3.XCircle, {}), children: "Resposta incorreta" });
1658
+ default:
1659
+ return null;
1660
+ }
1661
+ };
1662
+ const getLayoutClasses = () => {
1663
+ switch (layout) {
1664
+ case "compact":
1665
+ return "gap-2";
1666
+ case "detailed":
1667
+ return "gap-4";
1668
+ default:
1669
+ return "gap-3.5";
1670
+ }
1671
+ };
1672
+ const renderReadonlyAlternative = (alternative) => {
1673
+ const alternativeId = alternative.value;
1674
+ const isUserSelected = selectedValue === alternative.value;
1675
+ const isCorrectAnswer = alternative.status === "correct";
1676
+ let displayStatus = void 0;
1677
+ if (isUserSelected && !isCorrectAnswer) {
1678
+ displayStatus = "incorrect";
1679
+ } else if (isCorrectAnswer) {
1680
+ displayStatus = "correct";
1681
+ }
1682
+ const statusStyles = getStatusStyles(displayStatus, true);
1683
+ const statusBadge = getStatusBadge(displayStatus);
1684
+ const renderRadio = () => {
1685
+ const radioClasses = `w-6 h-6 rounded-full border-2 cursor-default transition-all duration-200 flex items-center justify-center ${isUserSelected ? "border-primary-950 bg-background" : "border-border-400 bg-background"}`;
1686
+ const dotClasses = "w-3 h-3 rounded-full bg-primary-950 transition-all duration-200";
1687
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: radioClasses, children: isUserSelected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: dotClasses }) });
1688
+ };
1689
+ if (layout === "detailed") {
1690
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1691
+ "div",
1692
+ {
1693
+ className: cn(
1694
+ "border-2 rounded-lg p-4 w-full",
1695
+ statusStyles,
1696
+ alternative.disabled ? "opacity-50" : ""
1697
+ ),
1698
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
1699
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
1700
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-1", children: renderRadio() }),
1701
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1", children: [
1702
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1703
+ "p",
1704
+ {
1705
+ className: cn(
1706
+ "block font-medium",
1707
+ selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"
1708
+ ),
1709
+ children: alternative.label
1710
+ }
1711
+ ),
1712
+ alternative.description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
1713
+ ] })
1714
+ ] }),
1715
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
1716
+ ] })
1717
+ },
1718
+ alternativeId
1719
+ );
1720
+ }
1721
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1722
+ "div",
1723
+ {
1724
+ className: cn(
1725
+ "flex flex-row justify-between items-start gap-2 p-2 rounded-lg w-full",
1726
+ statusStyles,
1727
+ alternative.disabled ? "opacity-50" : ""
1728
+ ),
1729
+ children: [
1730
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
1731
+ renderRadio(),
1732
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1733
+ "span",
1734
+ {
1735
+ className: cn(
1736
+ "flex-1",
1737
+ selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"
1738
+ ),
1739
+ children: alternative.label
1740
+ }
1741
+ )
1742
+ ] }),
1743
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
1744
+ ]
1745
+ },
1746
+ alternativeId
1747
+ );
1748
+ };
1749
+ if (isReadonly) {
1750
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1751
+ "div",
1752
+ {
1753
+ className: cn("flex flex-col", getLayoutClasses(), "w-full", className),
1754
+ children: alternatives.map(
1755
+ (alternative) => renderReadonlyAlternative(alternative)
1756
+ )
1757
+ }
1758
+ );
1759
+ }
1760
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1761
+ RadioGroup,
1762
+ {
1763
+ name: groupName,
1764
+ defaultValue,
1765
+ value,
1766
+ onValueChange: (value2) => {
1767
+ setActualValue(value2);
1768
+ onValueChange?.(value2);
1769
+ },
1770
+ disabled,
1771
+ className: cn("flex flex-col", getLayoutClasses(), className),
1772
+ children: alternatives.map((alternative, index) => {
1773
+ const alternativeId = alternative.value || `alt-${index}`;
1774
+ const statusStyles = getStatusStyles(alternative.status, false);
1775
+ const statusBadge = getStatusBadge(alternative.status);
1776
+ if (layout === "detailed") {
1777
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1778
+ "div",
1779
+ {
1780
+ className: cn(
1781
+ "border-2 rounded-lg p-4 transition-all",
1782
+ statusStyles,
1783
+ alternative.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
1784
+ ),
1785
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
1786
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
1787
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1788
+ RadioGroupItem,
1789
+ {
1790
+ value: alternative.value,
1791
+ id: alternativeId,
1792
+ disabled: alternative.disabled,
1793
+ className: "mt-1"
1794
+ }
1795
+ ),
1796
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1", children: [
1797
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1798
+ "label",
1799
+ {
1800
+ htmlFor: alternativeId,
1801
+ className: cn(
1802
+ "block font-medium",
1803
+ actualValue === alternative.value ? "text-text-950" : "text-text-600",
1804
+ alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"
1805
+ ),
1806
+ children: alternative.label
1807
+ }
1808
+ ),
1809
+ alternative.description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
1810
+ ] })
1811
+ ] }),
1812
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
1813
+ ] })
1814
+ },
1815
+ alternativeId
1816
+ );
1817
+ }
1818
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1819
+ "div",
1820
+ {
1821
+ className: cn(
1822
+ "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
1823
+ statusStyles,
1824
+ alternative.disabled ? "opacity-50 cursor-not-allowed" : ""
1825
+ ),
1826
+ children: [
1827
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
1828
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1829
+ RadioGroupItem,
1830
+ {
1831
+ value: alternative.value,
1832
+ id: alternativeId,
1833
+ disabled: alternative.disabled
1834
+ }
1835
+ ),
1836
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1837
+ "label",
1838
+ {
1839
+ htmlFor: alternativeId,
1840
+ className: cn(
1841
+ "flex-1",
1842
+ actualValue === alternative.value ? "text-text-950" : "text-text-600",
1843
+ alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"
1844
+ ),
1845
+ children: alternative.label
1846
+ }
1847
+ )
1848
+ ] }),
1849
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
1850
+ ]
1851
+ },
1852
+ alternativeId
1853
+ );
1854
+ })
1855
+ }
1856
+ );
1857
+ };
1858
+ var HeaderAlternative = (0, import_react4.forwardRef)(
1859
+ ({ className, title, subTitle, content, ...props }, ref) => {
1860
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1861
+ "div",
1862
+ {
1863
+ ref,
1864
+ className: cn(
1865
+ "bg-background p-4 flex flex-col gap-4 rounded-xl",
1866
+ className
1867
+ ),
1868
+ ...props,
1869
+ children: [
1870
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "flex flex-col", children: [
1871
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-text-950 font-bold text-lg", children: title }),
1872
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-text-700 text-sm ", children: subTitle })
1873
+ ] }),
1874
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-text-950 text-md", children: content })
1875
+ ]
1876
+ }
1877
+ );
1878
+ }
1879
+ );
1880
+
1881
+ // src/components/Accordation/Accordation.tsx
1882
+ var import_react7 = require("react");
1883
+
1884
+ // src/components/Card/Card.tsx
1885
+ var import_react6 = require("react");
1886
+ var import_phosphor_react4 = require("phosphor-react");
1887
+
1888
+ // src/components/IconRender/IconRender.tsx
1889
+ var import_react5 = require("react");
1890
+ var PhosphorIcons = __toESM(require("phosphor-react"));
1891
+
1892
+ // src/assets/icons/subjects/ChatPT.tsx
1893
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1894
+ var ChatPT = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1895
+ "svg",
1896
+ {
1897
+ width: size,
1898
+ height: size,
1899
+ viewBox: "0 0 32 32",
1900
+ fill: "none",
1901
+ xmlns: "http://www.w3.org/2000/svg",
1902
+ children: [
1903
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1904
+ "path",
1905
+ {
1906
+ d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
1907
+ fill: color
1908
+ }
1909
+ ),
1910
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1911
+ "path",
1912
+ {
1913
+ d: "M21.1758 12V20.5312H19.7168V12H21.1758ZM23.8535 12V13.1719H17.0625V12H23.8535Z",
1914
+ fill: color
1915
+ }
1916
+ ),
1917
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1918
+ "path",
1919
+ {
1920
+ d: "M13.2402 17.3496H11.0195V16.1836H13.2402C13.627 16.1836 13.9395 16.1211 14.1777 15.9961C14.416 15.8711 14.5898 15.6992 14.6992 15.4805C14.8125 15.2578 14.8691 15.0039 14.8691 14.7188C14.8691 14.4492 14.8125 14.1973 14.6992 13.9629C14.5898 13.7246 14.416 13.5332 14.1777 13.3887C13.9395 13.2441 13.627 13.1719 13.2402 13.1719H11.4707V20.5312H10V12H13.2402C13.9004 12 14.4609 12.1172 14.9219 12.3516C15.3867 12.582 15.7402 12.9023 15.9824 13.3125C16.2246 13.7188 16.3457 14.1836 16.3457 14.707C16.3457 15.2578 16.2246 15.7305 15.9824 16.125C15.7402 16.5195 15.3867 16.8223 14.9219 17.0332C14.4609 17.2441 13.9004 17.3496 13.2402 17.3496Z",
1921
+ fill: color
1922
+ }
1923
+ )
1924
+ ]
1925
+ }
1926
+ );
1927
+
1928
+ // src/assets/icons/subjects/ChatEN.tsx
1929
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1930
+ var ChatEN = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1931
+ "svg",
1932
+ {
1933
+ width: size,
1934
+ height: size,
1935
+ viewBox: "0 0 32 32",
1936
+ fill: "none",
1937
+ xmlns: "http://www.w3.org/2000/svg",
1938
+ children: [
1939
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1940
+ "path",
1941
+ {
1942
+ d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
1943
+ fill: color
1944
+ }
1945
+ ),
1946
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1947
+ "path",
1948
+ {
1949
+ d: "M22.5488 12V20.5312H21.0781L17.252 14.4199V20.5312H15.7812V12H17.252L21.0898 18.123V12H22.5488Z",
1950
+ fill: color
1951
+ }
1952
+ ),
1953
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1954
+ "path",
1955
+ {
1956
+ d: "M14.584 19.3652V20.5312H10.0547V19.3652H14.584ZM10.4707 12V20.5312H9V12H10.4707ZM13.9922 15.5625V16.7109H10.0547V15.5625H13.9922ZM14.5547 12V13.1719H10.0547V12H14.5547Z",
1957
+ fill: color
1958
+ }
1959
+ )
1960
+ ]
1961
+ }
1962
+ );
1963
+
1964
+ // src/assets/icons/subjects/ChatES.tsx
1965
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1966
+ var ChatES = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1967
+ "svg",
1968
+ {
1969
+ width: size,
1970
+ height: size,
1971
+ viewBox: "0 0 32 32",
1972
+ fill: "none",
1973
+ xmlns: "http://www.w3.org/2000/svg",
1974
+ children: [
1975
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1976
+ "path",
1977
+ {
1978
+ d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
1979
+ fill: color
1980
+ }
1981
+ ),
1982
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1983
+ "path",
1984
+ {
1985
+ d: "M21.1426 17.8027C21.1426 17.627 21.1152 17.4707 21.0605 17.334C21.0098 17.1973 20.918 17.0723 20.7852 16.959C20.6523 16.8457 20.4648 16.7363 20.2227 16.6309C19.9844 16.5215 19.6797 16.4102 19.3086 16.2969C18.9023 16.1719 18.5273 16.0332 18.1836 15.8809C17.8438 15.7246 17.5469 15.5449 17.293 15.3418C17.0391 15.1348 16.8418 14.8984 16.7012 14.6328C16.5605 14.3633 16.4902 14.0527 16.4902 13.7012C16.4902 13.3535 16.5625 13.0371 16.707 12.752C16.8555 12.4668 17.0645 12.2207 17.334 12.0137C17.6074 11.8027 17.9297 11.6406 18.3008 11.5273C18.6719 11.4102 19.082 11.3516 19.5312 11.3516C20.1641 11.3516 20.709 11.4688 21.166 11.7031C21.627 11.9375 21.9805 12.252 22.2266 12.6465C22.4766 13.041 22.6016 13.4766 22.6016 13.9531H21.1426C21.1426 13.6719 21.082 13.4238 20.9609 13.209C20.8438 12.9902 20.6641 12.8184 20.4219 12.6934C20.1836 12.5684 19.8809 12.5059 19.5137 12.5059C19.166 12.5059 18.877 12.5586 18.6465 12.6641C18.416 12.7695 18.2441 12.9121 18.1309 13.0918C18.0176 13.2715 17.9609 13.4746 17.9609 13.7012C17.9609 13.8613 17.998 14.0078 18.0723 14.1406C18.1465 14.2695 18.2598 14.3906 18.4121 14.5039C18.5645 14.6133 18.7559 14.7168 18.9863 14.8145C19.2168 14.9121 19.4883 15.0059 19.8008 15.0957C20.2734 15.2363 20.6855 15.3926 21.0371 15.5645C21.3887 15.7324 21.6816 15.9238 21.916 16.1387C22.1504 16.3535 22.3262 16.5977 22.4434 16.8711C22.5605 17.1406 22.6191 17.4473 22.6191 17.791C22.6191 18.1504 22.5469 18.4746 22.4023 18.7637C22.2578 19.0488 22.0508 19.293 21.7812 19.4961C21.5156 19.6953 21.1953 19.8496 20.8203 19.959C20.4492 20.0645 20.0352 20.1172 19.5781 20.1172C19.168 20.1172 18.7637 20.0625 18.3652 19.9531C17.9707 19.8438 17.6113 19.6777 17.2871 19.4551C16.9629 19.2285 16.7051 18.9473 16.5137 18.6113C16.3223 18.2715 16.2266 17.875 16.2266 17.4219H17.6973C17.6973 17.6992 17.7441 17.9355 17.8379 18.1309C17.9355 18.3262 18.0703 18.4863 18.2422 18.6113C18.4141 18.7324 18.6133 18.8223 18.8398 18.8809C19.0703 18.9395 19.3164 18.9688 19.5781 18.9688C19.9219 18.9688 20.209 18.9199 20.4395 18.8223C20.6738 18.7246 20.8496 18.5879 20.9668 18.4121C21.084 18.2363 21.1426 18.0332 21.1426 17.8027Z",
1986
+ fill: color
1987
+ }
1988
+ ),
1989
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1990
+ "path",
1991
+ {
1992
+ d: "M15.4512 18.834V20H10.9219V18.834H15.4512ZM11.3379 11.4688V20H9.86719V11.4688H11.3379ZM14.8594 15.0312V16.1797H10.9219V15.0312H14.8594ZM15.4219 11.4688V12.6406H10.9219V11.4688H15.4219Z",
1993
+ fill: color
1994
+ }
1995
+ )
1996
+ ]
1997
+ }
1998
+ );
1999
+
2000
+ // src/components/IconRender/IconRender.tsx
2001
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2002
+ var IconRender = ({
2003
+ iconName,
2004
+ color = "#000000",
2005
+ size = 24,
2006
+ weight = "regular"
2007
+ }) => {
2008
+ if (typeof iconName === "string") {
2009
+ switch (iconName) {
2010
+ case "Chat_PT":
2011
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChatPT, { size, color });
2012
+ case "Chat_EN":
2013
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChatEN, { size, color });
2014
+ case "Chat_ES":
2015
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChatES, { size, color });
2016
+ default: {
2017
+ const IconComponent = PhosphorIcons[iconName] || PhosphorIcons.Question;
2018
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconComponent, { size, color, weight });
2019
+ }
2020
+ }
2021
+ } else {
2022
+ return (0, import_react5.cloneElement)(iconName, {
2023
+ size,
2024
+ color: "currentColor"
2025
+ });
2026
+ }
2027
+ };
2028
+ var IconRender_default = IconRender;
2029
+
2030
+ // src/components/Card/Card.tsx
2031
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2032
+ var CARD_BASE_CLASSES = {
2033
+ default: "w-full bg-background border border-border-50 rounded-xl",
2034
+ compact: "w-full bg-background border border-border-50 rounded-lg",
2035
+ minimal: "w-full bg-background border border-border-100 rounded-md"
2036
+ };
2037
+ var CARD_PADDING_CLASSES = {
2038
+ none: "",
2039
+ small: "p-2",
2040
+ medium: "p-4",
2041
+ large: "p-6"
2042
+ };
2043
+ var CARD_MIN_HEIGHT_CLASSES = {
2044
+ none: "",
2045
+ small: "min-h-16",
2046
+ medium: "min-h-20",
2047
+ large: "min-h-24"
2048
+ };
2049
+ var CARD_LAYOUT_CLASSES = {
2050
+ horizontal: "flex flex-row",
2051
+ vertical: "flex flex-col"
2052
+ };
2053
+ var CARD_CURSOR_CLASSES = {
2054
+ default: "",
2055
+ pointer: "cursor-pointer"
2056
+ };
2057
+ var CardBase = (0, import_react6.forwardRef)(
2058
+ ({
2059
+ children,
2060
+ variant = "default",
2061
+ layout = "horizontal",
2062
+ padding = "medium",
2063
+ minHeight = "medium",
2064
+ cursor = "default",
2065
+ className = "",
2066
+ ...props
2067
+ }, ref) => {
2068
+ const baseClasses = CARD_BASE_CLASSES[variant];
2069
+ const paddingClasses = CARD_PADDING_CLASSES[padding];
2070
+ const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
2071
+ const layoutClasses = CARD_LAYOUT_CLASSES[layout];
2072
+ const cursorClasses = CARD_CURSOR_CLASSES[cursor];
2073
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2074
+ "div",
2075
+ {
2076
+ ref,
2077
+ className: cn(
2078
+ baseClasses,
2079
+ paddingClasses,
2080
+ minHeightClasses,
2081
+ layoutClasses,
2082
+ cursorClasses,
2083
+ className
2084
+ ),
2085
+ ...props,
2086
+ children
2087
+ }
2088
+ );
2089
+ }
2090
+ );
2091
+ var ACTION_CARD_CLASSES = {
2092
+ warning: "bg-warning-background",
2093
+ success: "bg-success-200",
2094
+ error: "bg-error-100",
2095
+ info: "bg-info-background"
2096
+ };
2097
+ var ACTION_ICON_CLASSES = {
2098
+ warning: "bg-warning-300 text-text",
2099
+ success: "bg-indicator-positive text-text-950",
2100
+ error: "bg-indicator-negative text-text",
2101
+ info: "bg-info-500 text-text"
2102
+ };
2103
+ var ACTION_SUBTITLE_CLASSES = {
2104
+ warning: "text-warning-600",
2105
+ success: "text-success-700",
2106
+ error: "text-error-700",
2107
+ info: "text-info-700"
2108
+ };
2109
+ var ACTION_HEADER_CLASSES = {
2110
+ warning: "text-warning-300",
2111
+ success: "text-success-300",
2112
+ error: "text-error-300",
2113
+ info: "text-info-300"
2114
+ };
2115
+ var CardActivitiesResults = (0, import_react6.forwardRef)(
2116
+ ({
2117
+ icon,
2118
+ title,
2119
+ subTitle,
2120
+ header,
2121
+ extended = false,
2122
+ action = "success",
2123
+ description,
2124
+ className,
2125
+ ...props
2126
+ }, ref) => {
2127
+ const actionCardClasses = ACTION_CARD_CLASSES[action];
2128
+ const actionIconClasses = ACTION_ICON_CLASSES[action];
2129
+ const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
2130
+ const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
2131
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2132
+ "div",
2133
+ {
2134
+ ref,
2135
+ className: cn(
2136
+ "w-full flex flex-col border border-border-50 bg-background rounded-xl",
2137
+ className
2138
+ ),
2139
+ ...props,
2140
+ children: [
2141
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2142
+ "div",
2143
+ {
2144
+ className: cn(
2145
+ "flex flex-col gap-1 items-center justify-center p-4",
2146
+ actionCardClasses,
2147
+ extended ? "rounded-t-xl" : "rounded-xl"
2148
+ ),
2149
+ children: [
2150
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2151
+ "span",
2152
+ {
2153
+ className: cn(
2154
+ "size-7.5 rounded-full flex items-center justify-center",
2155
+ actionIconClasses
2156
+ ),
2157
+ children: icon
2158
+ }
2159
+ ),
2160
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2161
+ Text_default,
2162
+ {
2163
+ size: "2xs",
2164
+ weight: "medium",
2165
+ className: "text-text-800 uppercase truncate",
2166
+ children: title
2167
+ }
2168
+ ),
2169
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2170
+ "p",
2171
+ {
2172
+ className: cn("text-lg font-bold truncate", actionSubTitleClasses),
2173
+ children: subTitle
2174
+ }
2175
+ )
2176
+ ]
2177
+ }
2178
+ ),
2179
+ extended && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
2180
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2181
+ "p",
2182
+ {
2183
+ className: cn(
2184
+ "text-2xs font-medium uppercase truncate",
2185
+ actionHeaderClasses
2186
+ ),
2187
+ children: header
2188
+ }
2189
+ ),
2190
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Badge_default, { size: "large", action: "info", children: description })
2191
+ ] })
2192
+ ]
2193
+ }
2194
+ );
2195
+ }
2196
+ );
2197
+ var CardQuestions = (0, import_react6.forwardRef)(
2198
+ ({
2199
+ header,
2200
+ state = "undone",
2201
+ className,
2202
+ onClickButton,
2203
+ valueButton,
2204
+ ...props
2205
+ }, ref) => {
2206
+ const isDone = state === "done";
2207
+ const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
2208
+ const buttonLabel = isDone ? "Ver Resultado" : "Responder";
2209
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2210
+ CardBase,
2211
+ {
2212
+ ref,
2213
+ layout: "horizontal",
2214
+ padding: "medium",
2215
+ minHeight: "medium",
2216
+ className: cn("justify-between gap-4", className),
2217
+ ...props,
2218
+ children: [
2219
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
2220
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "font-bold text-xs text-text-950 truncate", children: header }),
2221
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-row gap-6 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2222
+ Badge_default,
2223
+ {
2224
+ size: "medium",
2225
+ variant: "solid",
2226
+ action: isDone ? "success" : "error",
2227
+ children: stateLabel
2228
+ }
2229
+ ) })
2230
+ ] }),
2231
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2232
+ Button_default,
2233
+ {
2234
+ size: "extra-small",
2235
+ onClick: () => onClickButton?.(valueButton),
2236
+ className: "min-w-fit",
2237
+ children: buttonLabel
2238
+ }
2239
+ ) })
2240
+ ]
2241
+ }
2242
+ );
2243
+ }
2244
+ );
2245
+ var CardProgress = (0, import_react6.forwardRef)(
2246
+ ({
2247
+ header,
2248
+ subhead,
2249
+ initialDate,
2250
+ endDate,
2251
+ progress = 0,
2252
+ direction = "horizontal",
2253
+ icon,
2254
+ color = "#B7DFFF",
2255
+ progressVariant = "blue",
2256
+ showDates = true,
2257
+ className,
2258
+ ...props
2259
+ }, ref) => {
2260
+ const isHorizontal = direction === "horizontal";
2261
+ const contentComponent = {
2262
+ horizontal: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2263
+ showDates && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-row gap-6 items-center", children: [
2264
+ initialDate && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
2265
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
2266
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-600", children: initialDate })
2267
+ ] }),
2268
+ endDate && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
2269
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-800 font-semibold", children: "Fim" }),
2270
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-600", children: endDate })
2271
+ ] })
2272
+ ] }),
2273
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
2274
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2275
+ ProgressBar_default,
2276
+ {
2277
+ size: "small",
2278
+ value: progress,
2279
+ variant: progressVariant,
2280
+ "data-testid": "progress-bar"
2281
+ }
2282
+ ),
2283
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2284
+ Text_default,
2285
+ {
2286
+ size: "xs",
2287
+ weight: "medium",
2288
+ className: cn(
2289
+ "text-text-950 leading-none tracking-normal text-center flex-none"
2290
+ ),
2291
+ children: [
2292
+ Math.round(progress),
2293
+ "%"
2294
+ ]
2295
+ }
2296
+ )
2297
+ ] })
2298
+ ] }),
2299
+ vertical: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm text-text-800", children: subhead })
2300
+ };
2301
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2302
+ CardBase,
2303
+ {
2304
+ ref,
2305
+ layout: isHorizontal ? "horizontal" : "vertical",
2306
+ padding: "none",
2307
+ minHeight: "medium",
2308
+ cursor: "pointer",
2309
+ className: cn(isHorizontal ? "h-20" : "", className),
2310
+ ...props,
2311
+ children: [
2312
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2313
+ "div",
2314
+ {
2315
+ className: cn(
2316
+ "flex justify-center items-center [&>svg]:size-6 text-text-950",
2317
+ isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl",
2318
+ !color.startsWith("#") ? `${color}` : ""
2319
+ ),
2320
+ style: color.startsWith("#") ? { backgroundColor: color } : void 0,
2321
+ "data-testid": "icon-container",
2322
+ children: icon
2323
+ }
2324
+ ),
2325
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2326
+ "div",
2327
+ {
2328
+ className: cn(
2329
+ "p-4 flex flex-col justify-between w-full h-full",
2330
+ !isHorizontal && "gap-4"
2331
+ ),
2332
+ children: [
2333
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
2334
+ contentComponent[direction]
2335
+ ]
2336
+ }
2337
+ )
2338
+ ]
2339
+ }
2340
+ );
2341
+ }
2342
+ );
2343
+ var CardTopic = (0, import_react6.forwardRef)(
2344
+ ({
2345
+ header,
2346
+ subHead,
2347
+ progress,
2348
+ showPercentage = false,
2349
+ progressVariant = "blue",
2350
+ className = "",
2351
+ ...props
2352
+ }, ref) => {
2353
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2354
+ CardBase,
2355
+ {
2356
+ ref,
2357
+ layout: "vertical",
2358
+ padding: "small",
2359
+ minHeight: "medium",
2360
+ cursor: "pointer",
2361
+ className: cn("justify-center gap-2 py-2 px-4", className),
2362
+ ...props,
2363
+ children: [
2364
+ subHead && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react6.Fragment, { children: [
2365
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: text }),
2366
+ index < subHead.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: "\u2022" })
2367
+ ] }, `${text} - ${index}`)) }),
2368
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
2369
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
2370
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2371
+ ProgressBar_default,
2372
+ {
2373
+ size: "small",
2374
+ value: progress,
2375
+ variant: progressVariant,
2376
+ "data-testid": "progress-bar"
2377
+ }
2378
+ ),
2379
+ showPercentage && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2380
+ Text_default,
2381
+ {
2382
+ size: "xs",
2383
+ weight: "medium",
2384
+ className: cn(
2385
+ "text-text-950 leading-none tracking-normal text-center flex-none"
2386
+ ),
2387
+ children: [
2388
+ Math.round(progress),
2389
+ "%"
2390
+ ]
2391
+ }
2392
+ )
2393
+ ] })
2394
+ ]
2395
+ }
2396
+ );
2397
+ }
2398
+ );
2399
+ var CardPerformance = (0, import_react6.forwardRef)(
2400
+ ({
2401
+ header,
2402
+ progress,
2403
+ description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
2404
+ actionVariant = "button",
2405
+ progressVariant = "blue",
2406
+ labelProgress = "",
2407
+ className = "",
2408
+ onClickButton,
2409
+ valueButton,
2410
+ ...props
2411
+ }, ref) => {
2412
+ const hasProgress = progress !== void 0;
2413
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2414
+ CardBase,
2415
+ {
2416
+ ref,
2417
+ layout: "horizontal",
2418
+ padding: "medium",
2419
+ minHeight: "none",
2420
+ className: cn(
2421
+ actionVariant == "caret" ? "cursor-pointer" : "",
2422
+ className
2423
+ ),
2424
+ onClick: () => actionVariant == "caret" && onClickButton?.(valueButton),
2425
+ ...props,
2426
+ children: [
2427
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w-full flex flex-col justify-between gap-2", children: [
2428
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-row justify-between items-center gap-2", children: [
2429
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-lg font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
2430
+ actionVariant === "button" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2431
+ Button_default,
2432
+ {
2433
+ variant: "outline",
2434
+ size: "extra-small",
2435
+ onClick: () => onClickButton?.(valueButton),
2436
+ className: "min-w-fit flex-shrink-0",
2437
+ children: "Ver Aula"
2438
+ }
2439
+ )
2440
+ ] }),
2441
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2442
+ ProgressBar_default,
2443
+ {
2444
+ value: progress,
2445
+ label: `${progress}% ${labelProgress}`,
2446
+ variant: progressVariant
2447
+ }
2448
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-text-600 truncate", children: description }) })
2449
+ ] }),
2450
+ actionVariant == "caret" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2451
+ import_phosphor_react4.CaretRight,
2452
+ {
2453
+ className: "size-4.5 text-text-800 cursor-pointer",
2454
+ "data-testid": "caret-icon"
2455
+ }
2456
+ )
2457
+ ]
2458
+ }
2459
+ );
2460
+ }
2461
+ );
2462
+ var CardResults = (0, import_react6.forwardRef)(
2463
+ ({
2464
+ header,
2465
+ correct_answers,
2466
+ incorrect_answers,
2467
+ icon,
2468
+ direction = "col",
2469
+ color = "#B7DFFF",
2470
+ className,
2471
+ ...props
2472
+ }, ref) => {
2473
+ const isRow = direction == "row";
2474
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2475
+ CardBase,
2476
+ {
2477
+ ref,
2478
+ layout: "horizontal",
2479
+ padding: "none",
2480
+ minHeight: "medium",
2481
+ className: cn("items-stretch cursor-pointer pr-4", className),
2482
+ ...props,
2483
+ children: [
2484
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2485
+ "div",
2486
+ {
2487
+ className: cn(
2488
+ "flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-full rounded-l-xl"
2489
+ ),
2490
+ style: {
2491
+ backgroundColor: color
2492
+ },
2493
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconRender_default, { iconName: icon, color: "currentColor", size: 20 })
2494
+ }
2495
+ ),
2496
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w-full flex flex-row justify-between items-center", children: [
2497
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2498
+ "div",
2499
+ {
2500
+ className: cn(
2501
+ "p-4 flex flex-wrap justify-between w-full h-full",
2502
+ isRow ? "flex-row items-center gap-2" : "flex-col"
2503
+ ),
2504
+ children: [
2505
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm font-bold text-text-950 flex-1", children: header }),
2506
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "flex flex-wrap flex-row gap-1 items-center", children: [
2507
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2508
+ Badge_default,
2509
+ {
2510
+ action: "success",
2511
+ variant: "solid",
2512
+ size: "large",
2513
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.CheckCircle, {}),
2514
+ children: [
2515
+ correct_answers,
2516
+ " Corretas"
2517
+ ]
2518
+ }
2519
+ ),
2520
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2521
+ Badge_default,
2522
+ {
2523
+ action: "error",
2524
+ variant: "solid",
2525
+ size: "large",
2526
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.XCircle, {}),
2527
+ children: [
2528
+ incorrect_answers,
2529
+ " Incorretas"
2530
+ ]
2531
+ }
2532
+ )
2533
+ ] })
2534
+ ]
2535
+ }
2536
+ ),
2537
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
2538
+ ] })
2539
+ ]
2540
+ }
2541
+ );
2542
+ }
2543
+ );
2544
+ var CardStatus = (0, import_react6.forwardRef)(
2545
+ ({ header, className, status, label, ...props }, ref) => {
2546
+ const getLabelBadge = (status2) => {
2547
+ switch (status2) {
2548
+ case "correct":
2549
+ return "Correta";
2550
+ case "incorrect":
2551
+ return "Incorreta";
2552
+ case "unanswered":
2553
+ return "Em branco";
2554
+ case "pending":
2555
+ return "Avalia\xE7\xE3o pendente";
2556
+ default:
2557
+ return "Em branco";
2558
+ }
2559
+ };
2560
+ const getIconBadge = (status2) => {
2561
+ switch (status2) {
2562
+ case "correct":
2563
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.CheckCircle, {});
2564
+ case "incorrect":
2565
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.XCircle, {});
2566
+ case "pending":
2567
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.Clock, {});
2568
+ default:
2569
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.XCircle, {});
2570
+ }
2571
+ };
2572
+ const getActionBadge = (status2) => {
2573
+ switch (status2) {
2574
+ case "correct":
2575
+ return "success";
2576
+ case "incorrect":
2577
+ return "error";
2578
+ case "pending":
2579
+ return "info";
2580
+ default:
2581
+ return "info";
2582
+ }
2583
+ };
2584
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2585
+ CardBase,
2586
+ {
2587
+ ref,
2588
+ layout: "horizontal",
2589
+ padding: "medium",
2590
+ minHeight: "medium",
2591
+ className: cn("items-center cursor-pointer", className),
2592
+ ...props,
2593
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
2594
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
2595
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
2596
+ status && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2597
+ Badge_default,
2598
+ {
2599
+ action: getActionBadge(status),
2600
+ variant: "solid",
2601
+ size: "medium",
2602
+ iconLeft: getIconBadge(status),
2603
+ children: getLabelBadge(status)
2604
+ }
2605
+ ),
2606
+ label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm text-text-800", children: label })
2607
+ ] }),
2608
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
2609
+ ] })
2610
+ }
2611
+ );
2612
+ }
2613
+ );
2614
+ var CardSettings = (0, import_react6.forwardRef)(
2615
+ ({ header, className, icon, ...props }, ref) => {
2616
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2617
+ CardBase,
2618
+ {
2619
+ ref,
2620
+ layout: "horizontal",
2621
+ padding: "small",
2622
+ minHeight: "none",
2623
+ className: cn(
2624
+ "border-none items-center gap-2 text-text-700",
2625
+ className
2626
+ ),
2627
+ ...props,
2628
+ children: [
2629
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "[&>svg]:size-6", children: icon }),
2630
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "w-full text-sm truncate", children: header }),
2631
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.CaretRight, { size: 24, className: "cursor-pointer" })
2632
+ ]
2633
+ }
2634
+ );
2635
+ }
2636
+ );
2637
+ var CardSupport = (0, import_react6.forwardRef)(
2638
+ ({ header, className, direction = "col", children, ...props }, ref) => {
2639
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2640
+ CardBase,
2641
+ {
2642
+ ref,
2643
+ layout: "horizontal",
2644
+ padding: "medium",
2645
+ minHeight: "none",
2646
+ className: cn(
2647
+ "border-none items-center gap-2 text-text-700",
2648
+ className
2649
+ ),
2650
+ ...props,
2651
+ children: [
2652
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2653
+ "div",
2654
+ {
2655
+ className: cn(
2656
+ "w-full flex",
2657
+ direction == "col" ? "flex-col" : "flex-row items-center"
2658
+ ),
2659
+ children: [
2660
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
2661
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex flex-row gap-1", children })
2662
+ ]
2663
+ }
2664
+ ),
2665
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
2666
+ ]
2667
+ }
2668
+ );
2669
+ }
2670
+ );
2671
+ var CardForum = (0, import_react6.forwardRef)(
2672
+ ({
2673
+ title,
2674
+ content,
2675
+ comments,
2676
+ onClickComments,
2677
+ valueComments,
2678
+ onClickProfile,
2679
+ valueProfile,
2680
+ className = "",
2681
+ date,
2682
+ hour,
2683
+ ...props
2684
+ }, ref) => {
2685
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2686
+ CardBase,
2687
+ {
2688
+ ref,
2689
+ layout: "horizontal",
2690
+ padding: "medium",
2691
+ minHeight: "none",
2692
+ variant: "minimal",
2693
+ className: cn("w-auto h-auto gap-3", className),
2694
+ ...props,
2695
+ children: [
2696
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2697
+ "button",
2698
+ {
2699
+ type: "button",
2700
+ "aria-label": "Ver perfil",
2701
+ onClick: () => onClickProfile?.(valueProfile),
2702
+ className: "min-w-8 h-8 rounded-full bg-background-950"
2703
+ }
2704
+ ),
2705
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
2706
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
2707
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
2708
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "text-xs text-text-600", children: [
2709
+ "\u2022 ",
2710
+ date,
2711
+ " \u2022 ",
2712
+ hour
2713
+ ] })
2714
+ ] }),
2715
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
2716
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2717
+ "button",
2718
+ {
2719
+ type: "button",
2720
+ "aria-label": "Ver coment\xE1rios",
2721
+ onClick: () => onClickComments?.(valueComments),
2722
+ className: "text-text-600 flex flex-row gap-2 items-center",
2723
+ children: [
2724
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.ChatCircleText, { "aria-hidden": "true", size: 16 }),
2725
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "text-xs", children: [
2726
+ comments,
2727
+ " respostas"
2728
+ ] })
2729
+ ]
2730
+ }
2731
+ )
2732
+ ] })
2733
+ ]
2734
+ }
2735
+ );
2736
+ }
2737
+ );
2738
+ var CardAudio = (0, import_react6.forwardRef)(
2739
+ ({
2740
+ src,
2741
+ title,
2742
+ onPlay,
2743
+ onPause,
2744
+ onEnded,
2745
+ onAudioTimeUpdate,
2746
+ loop = false,
2747
+ preload = "metadata",
2748
+ tracks,
2749
+ className,
2750
+ ...props
2751
+ }, ref) => {
2752
+ const [isPlaying, setIsPlaying] = (0, import_react6.useState)(false);
2753
+ const [currentTime, setCurrentTime] = (0, import_react6.useState)(0);
2754
+ const [duration, setDuration] = (0, import_react6.useState)(0);
2755
+ const [volume, setVolume] = (0, import_react6.useState)(1);
2756
+ const [showVolumeControl, setShowVolumeControl] = (0, import_react6.useState)(false);
2757
+ const [showSpeedMenu, setShowSpeedMenu] = (0, import_react6.useState)(false);
2758
+ const [playbackRate, setPlaybackRate] = (0, import_react6.useState)(1);
2759
+ const audioRef = (0, import_react6.useRef)(null);
2760
+ const volumeControlRef = (0, import_react6.useRef)(null);
2761
+ const speedMenuRef = (0, import_react6.useRef)(null);
2762
+ const formatTime = (time) => {
2763
+ const minutes = Math.floor(time / 60);
2764
+ const seconds = Math.floor(time % 60);
2765
+ return `${minutes}:${seconds.toString().padStart(2, "0")}`;
2766
+ };
2767
+ const handlePlayPause = () => {
2768
+ if (isPlaying) {
2769
+ audioRef.current?.pause();
2770
+ setIsPlaying(false);
2771
+ onPause?.();
2772
+ } else {
2773
+ audioRef.current?.play();
2774
+ setIsPlaying(true);
2775
+ onPlay?.();
2776
+ }
2777
+ };
2778
+ const handleTimeUpdate = () => {
2779
+ const current = audioRef.current?.currentTime ?? 0;
2780
+ const total = audioRef.current?.duration ?? 0;
2781
+ setCurrentTime(current);
2782
+ setDuration(total);
2783
+ onAudioTimeUpdate?.(current, total);
2784
+ };
2785
+ const handleLoadedMetadata = () => {
2786
+ setDuration(audioRef.current?.duration ?? 0);
2787
+ };
2788
+ const handleEnded = () => {
2789
+ setIsPlaying(false);
2790
+ setCurrentTime(0);
2791
+ onEnded?.();
2792
+ };
2793
+ const handleProgressClick = (e) => {
2794
+ const rect = e.currentTarget.getBoundingClientRect();
2795
+ const clickX = e.clientX - rect.left;
2796
+ const width = rect.width;
2797
+ const percentage = clickX / width;
2798
+ const newTime = percentage * duration;
2799
+ if (audioRef.current) {
2800
+ audioRef.current.currentTime = newTime;
2801
+ }
2802
+ setCurrentTime(newTime);
2803
+ };
2804
+ const handleVolumeChange = (e) => {
2805
+ const newVolume = parseFloat(e.target.value);
2806
+ setVolume(newVolume);
2807
+ if (audioRef.current) {
2808
+ audioRef.current.volume = newVolume;
2809
+ }
2810
+ };
2811
+ const toggleVolumeControl = () => {
2812
+ setShowVolumeControl(!showVolumeControl);
2813
+ setShowSpeedMenu(false);
2814
+ };
2815
+ const toggleSpeedMenu = () => {
2816
+ setShowSpeedMenu(!showSpeedMenu);
2817
+ setShowVolumeControl(false);
2818
+ };
2819
+ const handleSpeedChange = (speed) => {
2820
+ setPlaybackRate(speed);
2821
+ if (audioRef.current) {
2822
+ audioRef.current.playbackRate = speed;
2823
+ }
2824
+ setShowSpeedMenu(false);
2825
+ };
2826
+ const getVolumeIcon = () => {
2827
+ if (volume === 0) {
2828
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.SpeakerSimpleX, { size: 24 });
2829
+ }
2830
+ if (volume < 0.5) {
2831
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.SpeakerLow, { size: 24 });
2832
+ }
2833
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.SpeakerHigh, { size: 24 });
2834
+ };
2835
+ (0, import_react6.useEffect)(() => {
2836
+ const handleClickOutside = (event) => {
2837
+ if (volumeControlRef.current && !volumeControlRef.current.contains(event.target)) {
2838
+ setShowVolumeControl(false);
2839
+ }
2840
+ if (speedMenuRef.current && !speedMenuRef.current.contains(event.target)) {
2841
+ setShowSpeedMenu(false);
2842
+ }
2843
+ };
2844
+ document.addEventListener("mousedown", handleClickOutside);
2845
+ return () => {
2846
+ document.removeEventListener("mousedown", handleClickOutside);
2847
+ };
2848
+ }, []);
2849
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2850
+ CardBase,
2851
+ {
2852
+ ref,
2853
+ layout: "horizontal",
2854
+ padding: "medium",
2855
+ minHeight: "none",
2856
+ className: cn(
2857
+ "flex flex-row w-auto h-14 items-center gap-2",
2858
+ className
2859
+ ),
2860
+ ...props,
2861
+ children: [
2862
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2863
+ "audio",
2864
+ {
2865
+ ref: audioRef,
2866
+ src,
2867
+ loop,
2868
+ preload,
2869
+ onTimeUpdate: handleTimeUpdate,
2870
+ onLoadedMetadata: handleLoadedMetadata,
2871
+ onEnded: handleEnded,
2872
+ "data-testid": "audio-element",
2873
+ "aria-label": title,
2874
+ children: tracks ? tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2875
+ "track",
2876
+ {
2877
+ kind: track.kind,
2878
+ src: track.src,
2879
+ srcLang: track.srcLang,
2880
+ label: track.label,
2881
+ default: track.default
2882
+ },
2883
+ track.src
2884
+ )) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2885
+ "track",
2886
+ {
2887
+ kind: "captions",
2888
+ src: "data:text/vtt;base64,",
2889
+ srcLang: "pt",
2890
+ label: "Sem legendas dispon\xEDveis"
2891
+ }
2892
+ )
2893
+ }
2894
+ ),
2895
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2896
+ "button",
2897
+ {
2898
+ type: "button",
2899
+ onClick: handlePlayPause,
2900
+ disabled: !src,
2901
+ className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
2902
+ "aria-label": isPlaying ? "Pausar" : "Reproduzir",
2903
+ children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex gap-0.5", children: [
2904
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" }),
2905
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" })
2906
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.Play, { size: 24 })
2907
+ }
2908
+ ),
2909
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
2910
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2911
+ "button",
2912
+ {
2913
+ type: "button",
2914
+ className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
2915
+ onClick: handleProgressClick,
2916
+ onKeyDown: (e) => {
2917
+ if (e.key === "Enter" || e.key === " ") {
2918
+ e.preventDefault();
2919
+ handleProgressClick(
2920
+ e
2921
+ );
2922
+ }
2923
+ },
2924
+ "aria-label": "Barra de progresso do \xE1udio",
2925
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2926
+ "div",
2927
+ {
2928
+ className: "h-full bg-primary-600 rounded-full transition-all duration-100",
2929
+ style: {
2930
+ width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
2931
+ }
2932
+ }
2933
+ )
2934
+ }
2935
+ ) }),
2936
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(duration) }),
2937
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative h-6", ref: volumeControlRef, children: [
2938
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2939
+ "button",
2940
+ {
2941
+ type: "button",
2942
+ onClick: toggleVolumeControl,
2943
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
2944
+ "aria-label": "Controle de volume",
2945
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
2946
+ }
2947
+ ),
2948
+ showVolumeControl && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2949
+ "button",
2950
+ {
2951
+ type: "button",
2952
+ className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
2953
+ onKeyDown: (e) => {
2954
+ if (e.key === "Escape") {
2955
+ setShowVolumeControl(false);
2956
+ }
2957
+ },
2958
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2959
+ "input",
2960
+ {
2961
+ type: "range",
2962
+ min: "0",
2963
+ max: "1",
2964
+ step: "0.1",
2965
+ value: volume,
2966
+ onChange: handleVolumeChange,
2967
+ onKeyDown: (e) => {
2968
+ if (e.key === "ArrowUp" || e.key === "ArrowRight") {
2969
+ e.preventDefault();
2970
+ const newVolume = Math.min(
2971
+ 1,
2972
+ Math.round((volume + 0.1) * 10) / 10
2973
+ );
2974
+ setVolume(newVolume);
2975
+ if (audioRef.current) audioRef.current.volume = newVolume;
2976
+ } else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
2977
+ e.preventDefault();
2978
+ const newVolume = Math.max(
2979
+ 0,
2980
+ Math.round((volume - 0.1) * 10) / 10
2981
+ );
2982
+ setVolume(newVolume);
2983
+ if (audioRef.current) audioRef.current.volume = newVolume;
2984
+ }
2985
+ },
2986
+ className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
2987
+ style: {
2988
+ background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
2989
+ },
2990
+ "aria-label": "Volume",
2991
+ "aria-valuenow": Math.round(volume * 100),
2992
+ "aria-valuemin": 0,
2993
+ "aria-valuemax": 100
2994
+ }
2995
+ )
2996
+ }
2997
+ )
2998
+ ] }),
2999
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "relative h-6", ref: speedMenuRef, children: [
3000
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3001
+ "button",
3002
+ {
3003
+ type: "button",
3004
+ onClick: toggleSpeedMenu,
3005
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
3006
+ "aria-label": "Op\xE7\xF5es de velocidade",
3007
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.DotsThreeVertical, { size: 24 })
3008
+ }
3009
+ ),
3010
+ showSpeedMenu && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg min-w-24 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col gap-1", children: [
3011
+ { speed: 1, label: "1x" },
3012
+ { speed: 1.5, label: "1.5x" },
3013
+ { speed: 2, label: "2x" }
3014
+ ].map(({ speed, label }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3015
+ "button",
3016
+ {
3017
+ type: "button",
3018
+ onClick: () => handleSpeedChange(speed),
3019
+ className: cn(
3020
+ "px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
3021
+ playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
3022
+ ),
3023
+ children: label
3024
+ },
3025
+ speed
3026
+ )) }) })
3027
+ ] })
3028
+ ]
3029
+ }
3030
+ );
3031
+ }
3032
+ );
3033
+ var SIMULADO_BACKGROUND_CLASSES = {
3034
+ enem: "bg-exam-1",
3035
+ prova: "bg-exam-2",
3036
+ simuladao: "bg-exam-3",
3037
+ vestibular: "bg-exam-4"
3038
+ };
3039
+ var CardSimulado = (0, import_react6.forwardRef)(
3040
+ ({ title, duration, info, backgroundColor, className, ...props }, ref) => {
3041
+ const backgroundClass = SIMULADO_BACKGROUND_CLASSES[backgroundColor];
3042
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3043
+ CardBase,
3044
+ {
3045
+ ref,
3046
+ layout: "horizontal",
3047
+ padding: "medium",
3048
+ minHeight: "none",
3049
+ cursor: "pointer",
3050
+ className: cn(
3051
+ `${backgroundClass} hover:shadow-soft-shadow-2 transition-shadow duration-200`,
3052
+ className
3053
+ ),
3054
+ ...props,
3055
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex justify-between items-center w-full gap-4", children: [
3056
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
3057
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { size: "lg", weight: "bold", className: "text-text-950 truncate", children: title }),
3058
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-4 text-text-700", children: [
3059
+ duration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
3060
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.Clock, { size: 16, className: "flex-shrink-0" }),
3061
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { size: "sm", children: duration })
3062
+ ] }),
3063
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { size: "sm", className: "truncate", children: info })
3064
+ ] })
3065
+ ] }),
3066
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3067
+ import_phosphor_react4.CaretRight,
3068
+ {
3069
+ size: 24,
3070
+ className: "text-text-800 flex-shrink-0",
3071
+ "data-testid": "caret-icon"
3072
+ }
3073
+ )
3074
+ ] })
3075
+ }
3076
+ );
3077
+ }
3078
+ );
3079
+ var CardTest = (0, import_react6.forwardRef)(
3080
+ ({
3081
+ title,
3082
+ duration,
3083
+ questionsCount,
3084
+ additionalInfo,
3085
+ selected = false,
3086
+ onSelect,
3087
+ className = "",
3088
+ ...props
3089
+ }, ref) => {
3090
+ const handleClick = () => {
3091
+ if (onSelect) {
3092
+ onSelect(!selected);
3093
+ }
3094
+ };
3095
+ const handleKeyDown = (event) => {
3096
+ if ((event.key === "Enter" || event.key === " ") && onSelect) {
3097
+ event.preventDefault();
3098
+ onSelect(!selected);
3099
+ }
3100
+ };
3101
+ const isSelectable = !!onSelect;
3102
+ const getQuestionsText = (count) => {
3103
+ const singular = count === 1 ? "quest\xE3o" : "quest\xF5es";
3104
+ return `${count} ${singular}`;
3105
+ };
3106
+ const displayInfo = questionsCount ? getQuestionsText(questionsCount) : additionalInfo || "";
3107
+ const baseClasses = "flex flex-row items-center p-4 gap-2 w-full max-w-full bg-background shadow-soft-shadow-1 rounded-xl isolate border-0 text-left";
3108
+ const interactiveClasses = isSelectable ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-950 focus:ring-offset-2" : "";
3109
+ const selectedClasses = selected ? "ring-2 ring-primary-950 ring-offset-2" : "";
3110
+ if (isSelectable) {
3111
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3112
+ "button",
3113
+ {
3114
+ ref,
3115
+ type: "button",
3116
+ className: cn(
3117
+ `${baseClasses} ${interactiveClasses} ${selectedClasses} ${className}`.trim()
3118
+ ),
3119
+ onClick: handleClick,
3120
+ onKeyDown: handleKeyDown,
3121
+ "aria-pressed": selected,
3122
+ ...props,
3123
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
3124
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3125
+ Text_default,
3126
+ {
3127
+ size: "md",
3128
+ weight: "bold",
3129
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
3130
+ children: title
3131
+ }
3132
+ ),
3133
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
3134
+ duration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
3135
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.Clock, { size: 16, className: "text-text-700" }),
3136
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3137
+ Text_default,
3138
+ {
3139
+ size: "sm",
3140
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
3141
+ children: duration
3142
+ }
3143
+ )
3144
+ ] }),
3145
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3146
+ Text_default,
3147
+ {
3148
+ size: "sm",
3149
+ className: "text-text-700 leading-[21px] flex-grow truncate",
3150
+ children: displayInfo
3151
+ }
3152
+ )
3153
+ ] })
3154
+ ] })
3155
+ }
3156
+ );
3157
+ }
3158
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3159
+ "div",
3160
+ {
3161
+ ref,
3162
+ className: cn(`${baseClasses} ${className}`.trim()),
3163
+ ...props,
3164
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
3165
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3166
+ Text_default,
3167
+ {
3168
+ size: "md",
3169
+ weight: "bold",
3170
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
3171
+ children: title
3172
+ }
3173
+ ),
3174
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
3175
+ duration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
3176
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_phosphor_react4.Clock, { size: 16, className: "text-text-700" }),
3177
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3178
+ Text_default,
3179
+ {
3180
+ size: "sm",
3181
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
3182
+ children: duration
3183
+ }
3184
+ )
3185
+ ] }),
3186
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3187
+ Text_default,
3188
+ {
3189
+ size: "sm",
3190
+ className: "text-text-700 leading-[21px] flex-grow truncate min-w-0",
3191
+ children: displayInfo
3192
+ }
3193
+ )
3194
+ ] })
3195
+ ] })
3196
+ }
3197
+ );
3198
+ }
3199
+ );
3200
+ var SIMULATION_TYPE_STYLES = {
3201
+ enem: {
3202
+ background: "bg-exam-1",
3203
+ badge: "exam1",
3204
+ text: "Enem"
3205
+ },
3206
+ prova: {
3207
+ background: "bg-exam-2",
3208
+ badge: "exam2",
3209
+ text: "Prova"
3210
+ },
3211
+ simulado: {
3212
+ background: "bg-exam-3",
3213
+ badge: "exam3",
3214
+ text: "Simulad\xE3o"
3215
+ },
3216
+ vestibular: {
3217
+ background: "bg-exam-4",
3218
+ badge: "exam4",
3219
+ text: "Vestibular"
3220
+ }
3221
+ };
3222
+ var CardSimulationHistory = (0, import_react6.forwardRef)(({ data, onSimulationClick, className, ...props }, ref) => {
3223
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3224
+ "div",
3225
+ {
3226
+ ref,
3227
+ className: cn("w-full max-w-[992px] h-auto", className),
3228
+ ...props,
3229
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-0", children: [
3230
+ data.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3231
+ "div",
3232
+ {
3233
+ className: cn(
3234
+ "flex flex-row justify-center items-start px-4 py-6 gap-2 w-full bg-background",
3235
+ sectionIndex === 0 ? "rounded-t-3xl" : ""
3236
+ ),
3237
+ children: [
3238
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3239
+ Text_default,
3240
+ {
3241
+ size: "xs",
3242
+ weight: "bold",
3243
+ className: "text-text-800 w-11 flex-shrink-0",
3244
+ children: section.date
3245
+ }
3246
+ ),
3247
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col gap-2 flex-1", children: section.simulations.map((simulation) => {
3248
+ const typeStyles = SIMULATION_TYPE_STYLES[simulation.type];
3249
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3250
+ CardBase,
3251
+ {
3252
+ layout: "horizontal",
3253
+ padding: "medium",
3254
+ minHeight: "none",
3255
+ cursor: "pointer",
3256
+ className: cn(
3257
+ `${typeStyles.background} rounded-xl hover:shadow-soft-shadow-2
3258
+ transition-shadow duration-200 h-auto min-h-[61px]`
3259
+ ),
3260
+ onClick: () => onSimulationClick?.(simulation),
3261
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex justify-between items-center w-full gap-2", children: [
3262
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap flex-col justify-between sm:flex-row gap-2 flex-1 min-w-0", children: [
3263
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3264
+ Text_default,
3265
+ {
3266
+ size: "lg",
3267
+ weight: "bold",
3268
+ className: "text-text-950 truncate",
3269
+ children: simulation.title
3270
+ }
3271
+ ),
3272
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
3273
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3274
+ Badge_default,
3275
+ {
3276
+ variant: "examsOutlined",
3277
+ action: typeStyles.badge,
3278
+ size: "medium",
3279
+ children: typeStyles.text
3280
+ }
3281
+ ),
3282
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { size: "sm", className: "text-text-800 truncate", children: simulation.info })
3283
+ ] })
3284
+ ] }),
3285
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3286
+ import_phosphor_react4.CaretRight,
3287
+ {
3288
+ size: 24,
3289
+ className: "text-text-800 flex-shrink-0",
3290
+ "data-testid": "caret-icon"
3291
+ }
3292
+ )
3293
+ ] })
3294
+ },
3295
+ simulation.id
3296
+ );
3297
+ }) })
3298
+ ]
3299
+ }
3300
+ ) }, section.date)),
3301
+ data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-full h-6 bg-background rounded-b-3xl" })
3302
+ ] })
3303
+ }
3304
+ );
3305
+ });
3306
+
3307
+ // src/components/Accordation/Accordation.tsx
3308
+ var import_phosphor_react5 = require("phosphor-react");
3309
+ var import_jsx_runtime15 = require("react/jsx-runtime");
3310
+ var CardAccordation = (0, import_react7.forwardRef)(
3311
+ ({
3312
+ trigger,
3313
+ children,
3314
+ className,
3315
+ defaultExpanded = false,
3316
+ expanded: controlledExpanded,
3317
+ onToggleExpanded,
3318
+ value,
3319
+ disabled = false,
3320
+ triggerClassName,
3321
+ contentClassName,
3322
+ ...props
3323
+ }, ref) => {
3324
+ const [internalExpanded, setInternalExpanded] = (0, import_react7.useState)(defaultExpanded);
3325
+ const generatedId = (0, import_react7.useId)();
3326
+ const contentId = value ? `accordion-content-${value}` : generatedId;
3327
+ const headerId = value ? `accordion-header-${value}` : `${generatedId}-header`;
3328
+ const isControlled = controlledExpanded !== void 0;
3329
+ const isExpanded = isControlled ? controlledExpanded : internalExpanded;
3330
+ (0, import_react7.useEffect)(() => {
3331
+ if (isControlled) {
3332
+ setInternalExpanded(controlledExpanded);
3333
+ }
3334
+ }, [isControlled, controlledExpanded]);
3335
+ const handleToggle = () => {
3336
+ if (disabled) return;
3337
+ const newExpanded = !isExpanded;
3338
+ if (!isControlled) {
3339
+ setInternalExpanded(newExpanded);
3340
+ }
3341
+ onToggleExpanded?.(newExpanded);
3342
+ };
3343
+ const handleKeyDown = (event) => {
3344
+ if (disabled) return;
3345
+ if (event.key === "Enter" || event.key === " ") {
3346
+ event.preventDefault();
3347
+ handleToggle();
3348
+ }
3349
+ };
3350
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3351
+ CardBase,
3352
+ {
3353
+ ref,
3354
+ layout: "vertical",
3355
+ padding: "none",
3356
+ minHeight: "none",
3357
+ className: cn("overflow-hidden", className),
3358
+ ...props,
3359
+ children: [
3360
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3361
+ "button",
3362
+ {
3363
+ id: headerId,
3364
+ type: "button",
3365
+ onClick: handleToggle,
3366
+ onKeyDown: handleKeyDown,
3367
+ disabled,
3368
+ className: cn(
3369
+ "w-full cursor-pointer not-aria-expanded:rounded-xl aria-expanded:rounded-t-xl flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:border-2 focus:border-primary-950 focus:ring-inset px-2",
3370
+ disabled && "cursor-not-allowed text-text-400",
3371
+ triggerClassName
3372
+ ),
3373
+ "aria-expanded": isExpanded,
3374
+ "aria-controls": contentId,
3375
+ "aria-disabled": disabled,
3376
+ "data-value": value,
3377
+ children: [
3378
+ trigger,
3379
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3380
+ import_phosphor_react5.CaretRight,
3381
+ {
3382
+ size: 20,
3383
+ className: cn(
3384
+ "transition-transform duration-200 flex-shrink-0",
3385
+ disabled ? "text-gray-400" : "text-text-700",
3386
+ isExpanded ? "rotate-90" : "rotate-0"
3387
+ ),
3388
+ "data-testid": "accordion-caret"
3389
+ }
3390
+ )
3391
+ ]
3392
+ }
3393
+ ),
3394
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3395
+ "section",
3396
+ {
3397
+ id: contentId,
3398
+ "aria-labelledby": headerId,
3399
+ "aria-hidden": !isExpanded,
3400
+ className: cn(
3401
+ "transition-all duration-300 ease-in-out overflow-hidden",
3402
+ isExpanded ? "max-h-screen opacity-100" : "max-h-0 opacity-0"
3403
+ ),
3404
+ "data-testid": "accordion-content",
3405
+ "data-value": value,
3406
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn("p-4 pt-0", contentClassName), children })
3407
+ }
3408
+ )
3409
+ ]
3410
+ }
3411
+ );
3412
+ }
3413
+ );
3414
+ CardAccordation.displayName = "CardAccordation";
3415
+
3416
+ // src/types/questionTypes.ts
3417
+ var questionTypeLabels = {
3418
+ ["ALTERNATIVA" /* ALTERNATIVA */]: "Alternativa",
3419
+ ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: "Verdadeiro ou Falso",
3420
+ ["DISSERTATIVA" /* DISSERTATIVA */]: "Discursiva",
3421
+ ["IMAGEM" /* IMAGEM */]: "Imagem",
3422
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: "M\xFAltipla Escolha",
3423
+ ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: "Ligar Pontos",
3424
+ ["PREENCHER" /* PREENCHER */]: "Preencher Lacunas"
3425
+ };
3426
+
3427
+ // src/components/MultipleChoice/MultipleChoice.tsx
3428
+ var import_react8 = require("react");
3429
+ var import_phosphor_react6 = require("phosphor-react");
3430
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3431
+ var MultipleChoiceList = ({
3432
+ disabled = false,
3433
+ className = "",
3434
+ choices,
3435
+ name,
3436
+ selectedValues,
3437
+ onHandleSelectedValues,
3438
+ mode = "interactive"
3439
+ }) => {
3440
+ const [actualValue, setActualValue] = (0, import_react8.useState)(selectedValues);
3441
+ (0, import_react8.useEffect)(() => {
3442
+ setActualValue(selectedValues);
3443
+ }, [selectedValues]);
3444
+ const getStatusBadge = (status) => {
3445
+ switch (status) {
3446
+ case "correct":
3447
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react6.CheckCircle, {}), children: "Resposta correta" });
3448
+ case "incorrect":
3449
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react6.XCircle, {}), children: "Resposta incorreta" });
3450
+ default:
3451
+ return null;
3452
+ }
3453
+ };
3454
+ const getStatusStyles = (status) => {
3455
+ switch (status) {
3456
+ case "correct":
3457
+ return "bg-success-background border-success-300";
3458
+ case "incorrect":
3459
+ return "bg-error-background border-error-300";
3460
+ default:
3461
+ return `bg-background border-border-100`;
3462
+ }
3463
+ };
3464
+ const renderVisualCheckbox = (isSelected, isDisabled) => {
3465
+ const checkboxClasses = cn(
3466
+ "w-5 h-5 rounded border-2 cursor-default transition-all duration-200 flex items-center justify-center",
3467
+ isSelected ? "border-primary-950 bg-primary-950 text-text" : "border-border-400 bg-background",
3468
+ isDisabled && "opacity-40 cursor-not-allowed"
3469
+ );
3470
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: checkboxClasses, children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react6.Check, { size: 16, weight: "bold" }) });
3471
+ };
3472
+ if (mode === "readonly") {
3473
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cn("flex flex-col gap-2", className), children: choices.map((choice, i) => {
3474
+ const isSelected = actualValue?.includes(choice.value) || false;
3475
+ const statusStyles = getStatusStyles(choice.status);
3476
+ const statusBadge = getStatusBadge(choice.status);
3477
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3478
+ "div",
3479
+ {
3480
+ className: cn(
3481
+ "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
3482
+ statusStyles,
3483
+ choice.disabled ? "opacity-50 cursor-not-allowed" : ""
3484
+ ),
3485
+ children: [
3486
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
3487
+ renderVisualCheckbox(isSelected, choice.disabled || disabled),
3488
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3489
+ "span",
3490
+ {
3491
+ className: cn(
3492
+ "flex-1",
3493
+ isSelected || choice.status && choice.status != "neutral" ? "text-text-950" : "text-text-600",
3494
+ choice.disabled || disabled ? "cursor-not-allowed" : "cursor-default"
3495
+ ),
3496
+ children: choice.label
3497
+ }
3498
+ )
3499
+ ] }),
3500
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
3501
+ ]
3502
+ },
3503
+ `readonly-${choice.value}-${i}`
3504
+ );
3505
+ }) });
3506
+ }
3507
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3508
+ "div",
3509
+ {
3510
+ className: cn(
3511
+ "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
3512
+ disabled ? "opacity-50 cursor-not-allowed" : "",
3513
+ className
3514
+ ),
3515
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3516
+ CheckboxList_default,
3517
+ {
3518
+ name,
3519
+ values: actualValue,
3520
+ onValuesChange: (v) => {
3521
+ setActualValue(v);
3522
+ onHandleSelectedValues?.(v);
3523
+ },
3524
+ disabled,
3525
+ children: choices.map((choice, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3526
+ "div",
3527
+ {
3528
+ className: "flex flex-row gap-2 items-center",
3529
+ children: [
3530
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3531
+ CheckboxListItem,
3532
+ {
3533
+ value: choice.value,
3534
+ id: `interactive-${choice.value}-${i}`,
3535
+ disabled: choice.disabled || disabled
3536
+ }
3537
+ ),
3538
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3539
+ "label",
3540
+ {
3541
+ htmlFor: `interactive-${choice.value}-${i}`,
3542
+ className: cn(
3543
+ "flex-1",
3544
+ actualValue?.includes(choice.value) ? "text-text-950" : "text-text-600",
3545
+ choice.disabled || disabled ? "cursor-not-allowed" : "cursor-pointer"
3546
+ ),
3547
+ children: choice.label
3548
+ }
3549
+ )
3550
+ ]
3551
+ },
3552
+ `interactive-${choice.value}-${i}`
3553
+ ))
3554
+ }
3555
+ )
3556
+ }
3557
+ );
3558
+ };
3559
+
3560
+ // src/utils/questionRenderer.ts
3561
+ var renderFromMap = (renderers, questionType) => {
3562
+ if (!questionType) return null;
3563
+ const renderer = renderers[questionType];
3564
+ return renderer ? renderer() : null;
3565
+ };
3566
+
3567
+ // src/components/ActivityCardQuestionPreview/ActivityCardQuestionPreview.tsx
3568
+ var import_react9 = require("react");
3569
+ var import_phosphor_react7 = require("phosphor-react");
3570
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3571
+ var QuestionHeader = ({
3572
+ badgeColor,
3573
+ iconName,
3574
+ subjectName,
3575
+ resolvedQuestionTypeLabel,
3576
+ position
3577
+ }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-row gap-2 text-text-650", children: [
3578
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "py-1 px-2 flex flex-row items-center gap-1", children: [
3579
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3580
+ "span",
3581
+ {
3582
+ className: "size-4 rounded-sm flex items-center justify-center shrink-0 text-text-950",
3583
+ style: {
3584
+ backgroundColor: badgeColor
3585
+ },
3586
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3587
+ IconRender_default,
3588
+ {
3589
+ iconName: iconName ?? "Book",
3590
+ size: 14,
3591
+ color: "currentColor"
3592
+ }
3593
+ )
3594
+ }
3595
+ ),
3596
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { size: "sm", children: subjectName ?? "Assunto n\xE3o informado" })
3597
+ ] }),
3598
+ typeof position === "number" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "py-1 px-2 flex flex-row items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { size: "sm", className: "text-text-700", children: [
3599
+ "#",
3600
+ position
3601
+ ] }) }),
3602
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "py-1 px-2 flex flex-row items-center gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { size: "sm", className: "", children: resolvedQuestionTypeLabel ?? "Tipo de quest\xE3o" }) })
3603
+ ] });
3604
+ var ActivityCardQuestionPreview = ({
3605
+ subjectName = "Assunto n\xE3o informado",
3606
+ subjectColor = "#000000",
3607
+ iconName = "Book",
3608
+ isDark = false,
3609
+ questionType,
3610
+ questionTypeLabel,
3611
+ enunciado = "Enunciado n\xE3o informado",
3612
+ question,
3613
+ defaultExpanded = false,
3614
+ value,
3615
+ className,
3616
+ children,
3617
+ position
3618
+ }) => {
3619
+ const badgeColor = getSubjectColorWithOpacity(subjectColor, isDark) ?? subjectColor;
3620
+ const [isExpanded, setIsExpanded] = (0, import_react9.useState)(defaultExpanded);
3621
+ const correctOptionIds = question?.correctOptionIds || [];
3622
+ const resolvedQuestionTypeLabel = questionType && questionTypeLabels[questionType] ? questionTypeLabels[questionType] : questionTypeLabel || "Tipo de quest\xE3o";
3623
+ const safeSubjectName = subjectName ?? "Assunto n\xE3o informado";
3624
+ const safeIconName = iconName ?? "Book";
3625
+ const safeResolvedLabel = resolvedQuestionTypeLabel ?? "Tipo de quest\xE3o";
3626
+ const alternatives = (0, import_react9.useMemo)(() => {
3627
+ if (!question?.options || questionType !== "ALTERNATIVA" /* ALTERNATIVA */)
3628
+ return [];
3629
+ return question.options.map((option) => {
3630
+ const isCorrect = correctOptionIds.includes(option.id);
3631
+ return {
3632
+ value: option.id,
3633
+ label: option.option,
3634
+ status: isCorrect ? "correct" : void 0,
3635
+ disabled: !isCorrect
3636
+ };
3637
+ });
3638
+ }, [question, questionType, correctOptionIds]);
3639
+ const multipleChoices = (0, import_react9.useMemo)(() => {
3640
+ if (!question?.options || questionType !== "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */)
3641
+ return [];
3642
+ return question.options.map((option) => {
3643
+ const isCorrect = correctOptionIds.includes(option.id);
3644
+ return {
3645
+ value: option.id,
3646
+ label: option.option,
3647
+ status: isCorrect ? "correct" : void 0,
3648
+ disabled: !isCorrect
3649
+ };
3650
+ });
3651
+ }, [question, questionType, correctOptionIds]);
3652
+ const renderAlternative = () => {
3653
+ if (alternatives.length === 0) return null;
3654
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3655
+ AlternativesList,
3656
+ {
3657
+ alternatives,
3658
+ mode: "readonly",
3659
+ layout: "compact",
3660
+ selectedValue: correctOptionIds[0],
3661
+ name: `preview-alternatives-${value ?? subjectName}`
3662
+ }
3663
+ ) });
3664
+ };
3665
+ const renderMultipleChoice = () => {
3666
+ if (multipleChoices.length === 0) return null;
3667
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3668
+ MultipleChoiceList,
3669
+ {
3670
+ choices: multipleChoices,
3671
+ mode: "readonly",
3672
+ selectedValues: correctOptionIds,
3673
+ name: `preview-multiple-${value ?? subjectName}`
3674
+ }
3675
+ ) });
3676
+ };
3677
+ const renderTrueOrFalse = () => {
3678
+ if (!question?.options || question.options.length === 0) return null;
3679
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-col gap-3.5", children: question.options.map((option, index) => {
3680
+ const isCorrect = correctOptionIds.includes(option.id);
3681
+ const correctAnswer = isCorrect ? "Verdadeiro" : "Falso";
3682
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("section", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3683
+ "div",
3684
+ {
3685
+ className: cn(
3686
+ "flex flex-row justify-between items-center gap-2 p-2 rounded-md border",
3687
+ isCorrect ? "bg-success-background border-success-300" : "bg-error-background border-error-300"
3688
+ ),
3689
+ children: [
3690
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { size: "sm", className: "text-text-900", children: String.fromCodePoint(97 + index).concat(") ").concat(option.option) }),
3691
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-row items-center gap-2 flex-shrink-0", children: [
3692
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { size: "sm", className: "text-text-700", children: [
3693
+ "Resposta correta: ",
3694
+ correctAnswer
3695
+ ] }),
3696
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3697
+ Badge_default,
3698
+ {
3699
+ variant: "solid",
3700
+ action: isCorrect ? "success" : "error",
3701
+ iconLeft: isCorrect ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_phosphor_react7.CheckCircle, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_phosphor_react7.XCircle, {}),
3702
+ children: isCorrect ? "Resposta correta" : "Resposta incorreta"
3703
+ }
3704
+ )
3705
+ ] })
3706
+ ]
3707
+ }
3708
+ ) }, option.id);
3709
+ }) }) });
3710
+ };
3711
+ const renderDissertative = () => {
3712
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mt-4 px-2 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { size: "sm", className: "text-text-600 italic", children: "Resposta do aluno" }) });
3713
+ };
3714
+ const renderConnectDots = () => null;
3715
+ const renderFill = () => null;
3716
+ const renderImage = () => null;
3717
+ const questionRenderers = {
3718
+ ["ALTERNATIVA" /* ALTERNATIVA */]: renderAlternative,
3719
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: renderMultipleChoice,
3720
+ ["DISSERTATIVA" /* DISSERTATIVA */]: renderDissertative,
3721
+ ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: renderTrueOrFalse,
3722
+ ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: renderConnectDots,
3723
+ ["PREENCHER" /* PREENCHER */]: renderFill,
3724
+ ["IMAGEM" /* IMAGEM */]: renderImage
3725
+ };
3726
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3727
+ "div",
3728
+ {
3729
+ className: "w-full",
3730
+ "data-position": position,
3731
+ role: "button",
3732
+ tabIndex: 0,
3733
+ "aria-expanded": isExpanded,
3734
+ onClick: () => {
3735
+ if (isExpanded) {
3736
+ setIsExpanded(false);
3737
+ }
3738
+ },
3739
+ onMouseDown: (event) => {
3740
+ const draggableAncestor = event.target.closest(
3741
+ '[data-draggable="true"]'
3742
+ );
3743
+ if (!draggableAncestor) {
3744
+ event.preventDefault();
3745
+ }
3746
+ },
3747
+ onKeyDown: (event) => {
3748
+ if (event.key === "Enter" || event.key === " ") {
3749
+ event.preventDefault();
3750
+ if (isExpanded) {
3751
+ setIsExpanded(false);
3752
+ }
3753
+ }
3754
+ },
3755
+ children: [
3756
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3757
+ "div",
3758
+ {
3759
+ "data-drag-preview": "true",
3760
+ className: "fixed -left-[9999px] -top-[9999px] pointer-events-none z-[9999] w-[440px]",
3761
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w-full rounded-lg border border-border-200 bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w-full min-w-0 flex flex-col gap-2 py-2", children: [
3762
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3763
+ QuestionHeader,
3764
+ {
3765
+ badgeColor,
3766
+ iconName: safeIconName,
3767
+ subjectName: safeSubjectName,
3768
+ resolvedQuestionTypeLabel: safeResolvedLabel,
3769
+ position
3770
+ }
3771
+ ),
3772
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3773
+ Text_default,
3774
+ {
3775
+ size: "md",
3776
+ weight: "medium",
3777
+ className: "text-text-950 truncate px-3",
3778
+ children: enunciado
3779
+ }
3780
+ )
3781
+ ] }) })
3782
+ }
3783
+ ),
3784
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3785
+ CardAccordation,
3786
+ {
3787
+ className: cn(
3788
+ "w-full rounded-lg border border-border-200 bg-background",
3789
+ className
3790
+ ),
3791
+ expanded: isExpanded,
3792
+ onToggleExpanded: setIsExpanded,
3793
+ defaultExpanded,
3794
+ value,
3795
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "w-full min-w-0 flex flex-col gap-2 py-2", children: [
3796
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3797
+ QuestionHeader,
3798
+ {
3799
+ badgeColor,
3800
+ iconName: safeIconName,
3801
+ subjectName: safeSubjectName,
3802
+ resolvedQuestionTypeLabel: safeResolvedLabel,
3803
+ position
3804
+ }
3805
+ ),
3806
+ !isExpanded && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3807
+ Text_default,
3808
+ {
3809
+ size: "md",
3810
+ weight: "medium",
3811
+ className: "text-text-950 truncate px-3",
3812
+ children: enunciado
3813
+ }
3814
+ )
3815
+ ] }),
3816
+ children: [
3817
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3818
+ Text_default,
3819
+ {
3820
+ size: "md",
3821
+ weight: "medium",
3822
+ className: "text-text-950 break-words whitespace-pre-wrap",
3823
+ children: enunciado
3824
+ }
3825
+ ),
3826
+ renderFromMap(questionRenderers, questionType),
3827
+ children
3828
+ ]
3829
+ }
3830
+ )
3831
+ ]
3832
+ }
3833
+ );
3834
+ };
3835
+
3836
+ // src/components/QuestionsPdfGenerator/QuestionsPdfGenerator.tsx
3837
+ var import_react10 = require("react");
3838
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3839
+ var QuestionsPdfContent = (0, import_react10.forwardRef)(({ questions }, ref) => {
3840
+ const getLetterByIndex = (index) => {
3841
+ return String.fromCodePoint(97 + index);
3842
+ };
3843
+ const renderAlternative = (question) => {
3844
+ if (!question.question?.options || question.question.options.length === 0) {
3845
+ return null;
3846
+ }
3847
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3848
+ "ol",
3849
+ {
3850
+ type: "a",
3851
+ style: {
3852
+ marginTop: "12px",
3853
+ marginBottom: "12px",
3854
+ paddingLeft: "24px"
3855
+ },
3856
+ children: question.question.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3857
+ "li",
3858
+ {
3859
+ style: {
3860
+ marginBottom: "8px",
3861
+ lineHeight: "1.6"
3862
+ },
3863
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LatexRenderer_default, { content: option.option })
3864
+ },
3865
+ option.id
3866
+ ))
3867
+ }
3868
+ );
3869
+ };
3870
+ const renderMultipleChoice = (question) => {
3871
+ if (!question.question?.options || question.question.options.length === 0) {
3872
+ return null;
3873
+ }
3874
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3875
+ "div",
3876
+ {
3877
+ style: {
3878
+ marginTop: "12px",
3879
+ marginBottom: "12px"
3880
+ },
3881
+ children: question.question.options.map((option, index) => {
3882
+ const letter = getLetterByIndex(index);
3883
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3884
+ "div",
3885
+ {
3886
+ style: {
3887
+ marginBottom: "12px",
3888
+ display: "flex",
3889
+ alignItems: "flex-start",
3890
+ gap: "8px",
3891
+ lineHeight: "1.6"
3892
+ },
3893
+ children: [
3894
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3895
+ "span",
3896
+ {
3897
+ style: {
3898
+ marginTop: "2px",
3899
+ minWidth: "20px",
3900
+ fontSize: "16px"
3901
+ },
3902
+ children: "\u2610"
3903
+ }
3904
+ ),
3905
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3906
+ "span",
3907
+ {
3908
+ style: {
3909
+ fontWeight: "bold",
3910
+ marginRight: "4px"
3911
+ },
3912
+ children: [
3913
+ letter,
3914
+ ")"
3915
+ ]
3916
+ }
3917
+ ),
3918
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LatexRenderer_default, { content: option.option }) })
3919
+ ]
3920
+ },
3921
+ option.id
3922
+ );
3923
+ })
3924
+ }
3925
+ );
3926
+ };
3927
+ const renderDissertative = () => {
3928
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3929
+ "div",
3930
+ {
3931
+ style: {
3932
+ marginTop: "12px",
3933
+ marginBottom: "12px"
3934
+ },
3935
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3936
+ "div",
3937
+ {
3938
+ style: {
3939
+ display: "flex",
3940
+ alignItems: "flex-start",
3941
+ gap: "8px"
3942
+ },
3943
+ children: [
3944
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3945
+ "span",
3946
+ {
3947
+ style: {
3948
+ fontWeight: "bold",
3949
+ marginTop: "2px"
3950
+ },
3951
+ children: "R:"
3952
+ }
3953
+ ),
3954
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3955
+ "div",
3956
+ {
3957
+ style: {
3958
+ minHeight: "150px",
3959
+ flex: 1
3960
+ }
3961
+ }
3962
+ )
3963
+ ]
3964
+ }
3965
+ )
3966
+ }
3967
+ );
3968
+ };
3969
+ const renderTrueOrFalse = (question) => {
3970
+ if (!question.question?.options || question.question.options.length === 0) {
3971
+ return null;
3972
+ }
3973
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { marginTop: "12px", marginBottom: "12px" }, children: question.question.options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3974
+ "div",
3975
+ {
3976
+ style: {
3977
+ marginBottom: "16px",
3978
+ display: "flex",
3979
+ alignItems: "flex-start",
3980
+ gap: "12px"
3981
+ },
3982
+ children: [
3983
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3984
+ "span",
3985
+ {
3986
+ style: {
3987
+ fontWeight: "bold",
3988
+ minWidth: "20px"
3989
+ },
3990
+ children: [
3991
+ getLetterByIndex(index),
3992
+ ")"
3993
+ ]
3994
+ }
3995
+ ),
3996
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LatexRenderer_default, { content: option.option }) }),
3997
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3998
+ "span",
3999
+ {
4000
+ style: {
4001
+ marginLeft: "8px",
4002
+ whiteSpace: "nowrap",
4003
+ fontSize: "14px"
4004
+ },
4005
+ children: "( ) V ( ) F"
4006
+ }
4007
+ )
4008
+ ]
4009
+ },
4010
+ option.id
4011
+ )) });
4012
+ };
4013
+ const renderQuestionTypeContent = (question) => {
4014
+ const renderMap = {
4015
+ ["ALTERNATIVA" /* ALTERNATIVA */]: renderAlternative,
4016
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: renderMultipleChoice,
4017
+ ["DISSERTATIVA" /* DISSERTATIVA */]: () => renderDissertative(),
4018
+ ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: renderTrueOrFalse,
4019
+ ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: () => null,
4020
+ ["PREENCHER" /* PREENCHER */]: () => null,
4021
+ ["IMAGEM" /* IMAGEM */]: () => null
4022
+ };
4023
+ if (!question.questionType) {
4024
+ return null;
4025
+ }
4026
+ const renderFunction = renderMap[question.questionType];
4027
+ return renderFunction ? renderFunction(question) : null;
4028
+ };
4029
+ const renderQuestionContent = (question, index) => {
4030
+ const questionNumber = index + 1;
4031
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4032
+ "div",
4033
+ {
4034
+ style: {
4035
+ marginBottom: "32px",
4036
+ pageBreakInside: "avoid"
4037
+ },
4038
+ children: [
4039
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4040
+ "h3",
4041
+ {
4042
+ style: {
4043
+ fontSize: "16px",
4044
+ fontWeight: "bold",
4045
+ marginBottom: "12px",
4046
+ color: "#000"
4047
+ },
4048
+ children: [
4049
+ "Quest\xE3o ",
4050
+ questionNumber
4051
+ ]
4052
+ }
4053
+ ),
4054
+ question.enunciado && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4055
+ "div",
4056
+ {
4057
+ style: {
4058
+ marginBottom: "12px",
4059
+ lineHeight: "1.6",
4060
+ color: "#000"
4061
+ },
4062
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LatexRenderer_default, { content: question.enunciado })
4063
+ }
4064
+ ),
4065
+ renderQuestionTypeContent(question)
4066
+ ]
4067
+ },
4068
+ question.id
4069
+ );
4070
+ };
4071
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4072
+ "div",
4073
+ {
4074
+ ref,
4075
+ className: "questions-pdf-container",
4076
+ style: {
4077
+ position: "fixed",
4078
+ left: 0,
4079
+ top: 0,
4080
+ width: "210mm",
4081
+ minHeight: "297mm",
4082
+ visibility: "hidden",
4083
+ pointerEvents: "none",
4084
+ zIndex: -1
4085
+ },
4086
+ children: [
4087
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("style", { children: `
4088
+ @media print {
4089
+ @page {
4090
+ margin: 20mm;
4091
+ size: A4;
4092
+ }
4093
+
4094
+ body {
4095
+ margin: 0;
4096
+ padding: 0;
4097
+ }
4098
+
4099
+ .questions-pdf-container {
4100
+ position: static !important;
4101
+ left: auto !important;
4102
+ top: auto !important;
4103
+ visibility: visible !important;
4104
+ pointer-events: auto !important;
4105
+ z-index: auto !important;
4106
+ padding: 0;
4107
+ margin: 0;
4108
+ font-family: Arial, sans-serif;
4109
+ font-size: 14px;
4110
+ line-height: 1.6;
4111
+ color: #000;
4112
+ width: auto;
4113
+ min-height: auto;
4114
+ }
4115
+
4116
+ .questions-pdf-container h3 {
4117
+ page-break-after: avoid;
4118
+ }
4119
+
4120
+ .questions-pdf-container > div {
4121
+ page-break-inside: avoid;
4122
+ }
4123
+ }
4124
+ ` }),
4125
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { padding: "20px" }, children: questions.map(
4126
+ (question, index) => renderQuestionContent(question, index)
4127
+ ) })
4128
+ ]
4129
+ }
4130
+ );
4131
+ });
4132
+ QuestionsPdfContent.displayName = "QuestionsPdfContent";
4133
+ var collectRelevantStyles = () => {
4134
+ const styles = [];
4135
+ const styleSheets = Array.from(document.styleSheets);
4136
+ styleSheets.forEach((styleSheet) => {
4137
+ try {
4138
+ const cssRules = styleSheet.cssRules || [];
4139
+ Array.from(cssRules).forEach((rule) => {
4140
+ const ruleText = rule.cssText;
4141
+ if (ruleText.includes("katex") || ruleText.includes("questions-pdf")) {
4142
+ styles.push(ruleText);
4143
+ }
4144
+ });
4145
+ } catch (error) {
4146
+ if (typeof console !== "undefined" && console.debug) {
4147
+ console.debug("Could not access stylesheet (likely CORS):", error);
4148
+ }
4149
+ }
4150
+ });
4151
+ return styles;
4152
+ };
4153
+ var generatePrintHTML = (contentHTML, styles) => {
4154
+ return `
4155
+ <!DOCTYPE html>
4156
+ <html>
4157
+ <head>
4158
+ <title>Quest\xF5es</title>
4159
+ <meta charset="utf-8">
4160
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.27/dist/katex.min.css">
4161
+ <style>
4162
+ @page {
4163
+ margin: 20mm;
4164
+ size: A4;
4165
+ }
4166
+
4167
+ * {
4168
+ box-sizing: border-box;
4169
+ }
4170
+
4171
+ body {
4172
+ margin: 0;
4173
+ padding: 0;
4174
+ font-family: Arial, sans-serif;
4175
+ font-size: 14px;
4176
+ line-height: 1.6;
4177
+ color: #000;
4178
+ }
4179
+
4180
+ .questions-pdf-container {
4181
+ position: static !important;
4182
+ visibility: visible !important;
4183
+ pointer-events: auto !important;
4184
+ z-index: auto !important;
4185
+ left: auto !important;
4186
+ top: auto !important;
4187
+ width: auto !important;
4188
+ min-height: auto !important;
4189
+ padding: 0;
4190
+ margin: 0;
4191
+ }
4192
+
4193
+ .questions-pdf-container h3 {
4194
+ page-break-after: avoid;
4195
+ font-size: 16px;
4196
+ font-weight: bold;
4197
+ margin-bottom: 12px;
4198
+ color: #000;
4199
+ }
4200
+
4201
+ .questions-pdf-container > div {
4202
+ page-break-inside: avoid;
4203
+ }
4204
+
4205
+ ol {
4206
+ margin-top: 12px;
4207
+ margin-bottom: 12px;
4208
+ padding-left: 24px;
4209
+ }
4210
+
4211
+ li {
4212
+ margin-bottom: 8px;
4213
+ line-height: 1.6;
4214
+ }
4215
+
4216
+ ${styles.join("\n")}
4217
+ </style>
4218
+ </head>
4219
+ <body>
4220
+ <div class="questions-pdf-container">
4221
+ ${contentHTML}
4222
+ </div>
4223
+ </body>
4224
+ </html>
4225
+ `;
4226
+ };
4227
+ var setupPrintWindowHandler = (printWindow) => {
4228
+ printWindow.onload = () => {
4229
+ const printAndCleanup = () => {
4230
+ try {
4231
+ printWindow.print();
4232
+ } finally {
4233
+ setTimeout(() => {
4234
+ if (printWindow && !printWindow.closed) {
4235
+ printWindow.close();
4236
+ }
4237
+ }, 1e3);
4238
+ }
4239
+ };
4240
+ const fonts = printWindow.document.fonts;
4241
+ if (fonts && "ready" in fonts) {
4242
+ fonts.ready.then(() => {
4243
+ setTimeout(printAndCleanup, 100);
4244
+ }).catch(() => {
4245
+ setTimeout(printAndCleanup, 500);
4246
+ });
4247
+ } else {
4248
+ setTimeout(printAndCleanup, 500);
4249
+ }
4250
+ };
4251
+ };
4252
+ var useQuestionsPdfPrint = (questions, onPrint, onPrintError) => {
4253
+ const contentRef = (0, import_react10.useRef)(null);
4254
+ const handlePrint = (0, import_react10.useCallback)(() => {
4255
+ try {
4256
+ onPrint?.();
4257
+ if (!contentRef.current) {
4258
+ throw new Error("Elemento de PDF n\xE3o encontrado no DOM");
4259
+ }
4260
+ const printWindow = window.open("", "_blank");
4261
+ if (!printWindow) {
4262
+ throw new Error(
4263
+ "N\xE3o foi poss\xEDvel abrir a janela de impress\xE3o. Verifique se os pop-ups est\xE3o bloqueados."
4264
+ );
4265
+ }
4266
+ printWindow.opener = null;
4267
+ const contentHTML = contentRef.current.innerHTML;
4268
+ const styles = collectRelevantStyles();
4269
+ const htmlContent = generatePrintHTML(contentHTML, styles);
4270
+ const doc = printWindow.document;
4271
+ doc.open();
4272
+ doc.write(htmlContent);
4273
+ doc.close();
4274
+ setupPrintWindowHandler(printWindow);
4275
+ } catch (error) {
4276
+ const errorObj = error instanceof Error ? error : new Error(String(error));
4277
+ onPrintError?.(errorObj);
4278
+ console.error("Erro ao gerar PDF:", errorObj);
4279
+ }
4280
+ }, [onPrint, onPrintError]);
4281
+ return {
4282
+ contentRef,
4283
+ handlePrint
4284
+ };
4285
+ };
4286
+
4287
+ // src/components/ActivityPreview/ActivityPreview.tsx
4288
+ var import_jsx_runtime19 = require("react/jsx-runtime");
4289
+ var ActivityPreview = ({
4290
+ title = "Pr\xE9via da atividade",
4291
+ questions = [],
4292
+ onDownloadPdf,
4293
+ onRemoveAll,
4294
+ className,
4295
+ onReorder,
4296
+ onPositionsChange,
4297
+ isDark = false
4298
+ }) => {
4299
+ const onPositionsChangeRef = (0, import_react11.useRef)(onPositionsChange);
4300
+ onPositionsChangeRef.current = onPositionsChange;
4301
+ const normalizeWithPositions = (0, import_react11.useMemo)(
4302
+ () => (items) => items.map((item, index) => ({
4303
+ ...item,
4304
+ position: index + 1
4305
+ })),
4306
+ []
4307
+ );
4308
+ const [orderedQuestions, setOrderedQuestions] = (0, import_react11.useState)(
4309
+ () => normalizeWithPositions(questions)
4310
+ );
4311
+ (0, import_react11.useEffect)(() => {
4312
+ const normalized = normalizeWithPositions(questions);
4313
+ setOrderedQuestions(normalized);
4314
+ onPositionsChangeRef.current?.(normalized);
4315
+ }, [questions, normalizeWithPositions]);
4316
+ const total = orderedQuestions.length;
4317
+ const totalLabel = total === 1 ? "1 quest\xE3o adicionada" : `${total} quest\xF5es adicionadas`;
4318
+ const { contentRef, handlePrint } = useQuestionsPdfPrint(
4319
+ orderedQuestions,
4320
+ onDownloadPdf
4321
+ );
4322
+ const handleDownloadPdf = () => {
4323
+ onDownloadPdf?.();
4324
+ setTimeout(() => {
4325
+ if (!contentRef.current) {
4326
+ console.error("Elemento de PDF n\xE3o encontrado no DOM");
4327
+ return;
4328
+ }
4329
+ if (typeof handlePrint === "function") {
4330
+ handlePrint();
4331
+ } else {
4332
+ console.error("handlePrint n\xE3o \xE9 uma fun\xE7\xE3o:", handlePrint);
4333
+ }
4334
+ }, 100);
4335
+ };
4336
+ const handleReorder = (fromId, toId) => {
4337
+ if (fromId === toId) return;
4338
+ const current = [...orderedQuestions];
4339
+ const fromIndex = current.findIndex((q) => q.id === fromId);
4340
+ const toIndex = current.findIndex((q) => q.id === toId);
4341
+ if (fromIndex === -1 || toIndex === -1) return;
4342
+ const [moved] = current.splice(fromIndex, 1);
4343
+ current.splice(toIndex, 0, moved);
4344
+ const normalized = normalizeWithPositions(current);
4345
+ setOrderedQuestions(normalized);
4346
+ onReorder?.(normalized);
4347
+ onPositionsChange?.(normalized);
4348
+ };
4349
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
4350
+ "div",
4351
+ {
4352
+ className: cn(
4353
+ "w-[470px] flex-shrink-0 p-4 rounded-lg bg-background flex flex-col gap-4",
4354
+ className
4355
+ ),
4356
+ children: [
4357
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: "flex flex-row items-center gap-2 text-text-950", children: [
4358
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_phosphor_react8.File, { size: 24 }),
4359
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { size: "lg", weight: "bold", children: title })
4360
+ ] }),
4361
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: "flex flex-row justify-between items-center", children: [
4362
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text_default, { size: "sm", className: "text-text-800", children: totalLabel }),
4363
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4364
+ Button_default,
4365
+ {
4366
+ size: "small",
4367
+ variant: "outline",
4368
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_phosphor_react8.DownloadSimple, {}),
4369
+ onClick: handleDownloadPdf,
4370
+ children: "Baixar pdf"
4371
+ }
4372
+ )
4373
+ ] }),
4374
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("section", { className: "flex flex-col gap-3", children: orderedQuestions.map(
4375
+ ({
4376
+ id,
4377
+ subjectName = "Assunto n\xE3o informado",
4378
+ subjectColor = "#000000",
4379
+ iconName = "BookOpen",
4380
+ questionType,
4381
+ questionTypeLabel,
4382
+ enunciado,
4383
+ question,
4384
+ position
4385
+ }, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4386
+ "div",
4387
+ {
4388
+ draggable: true,
4389
+ "data-draggable": "true",
4390
+ role: "button",
4391
+ tabIndex: 0,
4392
+ "aria-label": `Mover quest\xE3o ${enunciado ?? id}`,
4393
+ onDragStart: (e) => {
4394
+ e.dataTransfer.setData("text/plain", id);
4395
+ if (e.currentTarget instanceof HTMLElement) {
4396
+ const preview = e.currentTarget.querySelector(
4397
+ '[data-drag-preview="true"]'
4398
+ );
4399
+ if (preview) {
4400
+ e.dataTransfer.setDragImage(preview, 8, 8);
4401
+ } else {
4402
+ e.dataTransfer.setDragImage(e.currentTarget, 8, 8);
4403
+ }
4404
+ }
4405
+ },
4406
+ onDragOver: (e) => {
4407
+ e.preventDefault();
4408
+ },
4409
+ onDrop: (e) => {
4410
+ e.preventDefault();
4411
+ const fromId = e.dataTransfer.getData("text/plain");
4412
+ handleReorder(fromId, id);
4413
+ },
4414
+ onKeyDown: (e) => {
4415
+ if (e.key === "ArrowUp" && index > 0) {
4416
+ e.preventDefault();
4417
+ const targetId = orderedQuestions[index - 1].id;
4418
+ handleReorder(id, targetId);
4419
+ } else if (e.key === "ArrowDown" && index < orderedQuestions.length - 1) {
4420
+ e.preventDefault();
4421
+ const targetId = orderedQuestions[index + 1].id;
4422
+ handleReorder(id, targetId);
4423
+ } else if (e.key === "Enter" || e.key === " ") {
4424
+ e.preventDefault();
4425
+ }
4426
+ },
4427
+ className: "rounded-lg border border-border-200 bg-background",
4428
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4429
+ ActivityCardQuestionPreview,
4430
+ {
4431
+ subjectName,
4432
+ subjectColor,
4433
+ iconName,
4434
+ isDark,
4435
+ questionType,
4436
+ questionTypeLabel,
4437
+ enunciado,
4438
+ defaultExpanded: false,
4439
+ question,
4440
+ value: id,
4441
+ position
4442
+ }
4443
+ )
4444
+ },
4445
+ id
4446
+ )
4447
+ ) }),
4448
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button_default, { variant: "outline", onClick: onRemoveAll, children: "Remover tudo" }),
4449
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(QuestionsPdfContent, { ref: contentRef, questions: orderedQuestions })
4450
+ ]
4451
+ }
4452
+ );
4453
+ };
4454
+ // Annotate the CommonJS export names for ESM import in node:
4455
+ 0 && (module.exports = {
4456
+ ActivityPreview
4457
+ });
4458
+ //# sourceMappingURL=index.js.map