analytica-frontend-lib 1.0.82 → 1.0.84

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 (40) hide show
  1. package/dist/Accordation/index.js +2 -2
  2. package/dist/Accordation/index.js.map +1 -1
  3. package/dist/Accordation/index.mjs +2 -2
  4. package/dist/Accordation/index.mjs.map +1 -1
  5. package/dist/AlertDialog/index.js +1 -1
  6. package/dist/AlertDialog/index.js.map +1 -1
  7. package/dist/AlertDialog/index.mjs +1 -1
  8. package/dist/AlertDialog/index.mjs.map +1 -1
  9. package/dist/Card/index.js +2 -2
  10. package/dist/Card/index.js.map +1 -1
  11. package/dist/Card/index.mjs +2 -2
  12. package/dist/Card/index.mjs.map +1 -1
  13. package/dist/Modal/index.js +1 -1
  14. package/dist/Modal/index.js.map +1 -1
  15. package/dist/Modal/index.mjs +1 -1
  16. package/dist/Modal/index.mjs.map +1 -1
  17. package/dist/Quiz/index.d.mts +52 -0
  18. package/dist/Quiz/index.d.ts +52 -0
  19. package/dist/Quiz/index.js +4185 -0
  20. package/dist/Quiz/index.js.map +1 -0
  21. package/dist/Quiz/index.mjs +4191 -0
  22. package/dist/Quiz/index.mjs.map +1 -0
  23. package/dist/Quiz/useQuizStore/index.d.mts +140 -0
  24. package/dist/Quiz/useQuizStore/index.d.ts +140 -0
  25. package/dist/Quiz/useQuizStore/index.js +395 -0
  26. package/dist/Quiz/useQuizStore/index.js.map +1 -0
  27. package/dist/Quiz/useQuizStore/index.mjs +367 -0
  28. package/dist/Quiz/useQuizStore/index.mjs.map +1 -0
  29. package/dist/index.css +59 -0
  30. package/dist/index.css.map +1 -1
  31. package/dist/index.d.mts +2 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +1008 -4
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +1003 -4
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/simulated-result-QN5HCUY5.png +0 -0
  38. package/dist/styles.css +59 -0
  39. package/dist/styles.css.map +1 -1
  40. package/package.json +2 -1
@@ -0,0 +1,4185 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Quiz/Quiz.tsx
21
+ var Quiz_exports = {};
22
+ __export(Quiz_exports, {
23
+ Quiz: () => Quiz,
24
+ QuizAlternative: () => QuizAlternative,
25
+ QuizContent: () => QuizContent,
26
+ QuizFooter: () => QuizFooter,
27
+ QuizHeader: () => QuizHeader,
28
+ QuizHeaderResult: () => QuizHeaderResult,
29
+ QuizListResult: () => QuizListResult,
30
+ QuizListResultByMateria: () => QuizListResultByMateria,
31
+ QuizQuestionList: () => QuizQuestionList,
32
+ QuizResultHeaderTitle: () => QuizResultHeaderTitle,
33
+ QuizResultPerformance: () => QuizResultPerformance,
34
+ QuizResultTitle: () => QuizResultTitle,
35
+ QuizTitle: () => QuizTitle
36
+ });
37
+ module.exports = __toCommonJS(Quiz_exports);
38
+ var import_phosphor_react6 = require("phosphor-react");
39
+
40
+ // src/components/Badge/Badge.tsx
41
+ var import_phosphor_react = require("phosphor-react");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var VARIANT_ACTION_CLASSES = {
44
+ solid: {
45
+ error: "bg-error-background text-error-700 focus-visible:outline-none",
46
+ warning: "bg-warning text-warning-800 focus-visible:outline-none",
47
+ success: "bg-success text-success-800 focus-visible:outline-none",
48
+ info: "bg-info text-info-800 focus-visible:outline-none",
49
+ muted: "bg-background-muted text-background-800 focus-visible:outline-none"
50
+ },
51
+ outlined: {
52
+ error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
53
+ warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
54
+ success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
55
+ info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
56
+ muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
57
+ },
58
+ exams: {
59
+ exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
60
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
61
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
62
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
63
+ },
64
+ examsOutlined: {
65
+ exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
66
+ exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
67
+ exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
68
+ exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
69
+ },
70
+ resultStatus: {
71
+ negative: "bg-error text-error-800 focus-visible:outline-none",
72
+ positive: "bg-success text-success-800 focus-visible:outline-none"
73
+ },
74
+ notification: "text-primary"
75
+ };
76
+ var SIZE_CLASSES = {
77
+ small: "text-2xs px-2 py-1",
78
+ medium: "text-xs px-2 py-1",
79
+ large: "text-sm px-2 py-1"
80
+ };
81
+ var SIZE_CLASSES_ICON = {
82
+ small: "size-3",
83
+ medium: "size-3.5",
84
+ large: "size-4"
85
+ };
86
+ var Badge = ({
87
+ children,
88
+ iconLeft,
89
+ iconRight,
90
+ size = "medium",
91
+ variant = "solid",
92
+ action = "error",
93
+ className = "",
94
+ notificationActive = false,
95
+ ...props
96
+ }) => {
97
+ const sizeClasses = SIZE_CLASSES[size];
98
+ const sizeClassesIcon = SIZE_CLASSES_ICON[size];
99
+ const variantActionMap = VARIANT_ACTION_CLASSES[variant] || {};
100
+ const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
101
+ const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
102
+ const baseClassesIcon = "flex items-center";
103
+ if (variant === "notification") {
104
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
105
+ "div",
106
+ {
107
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
108
+ ...props,
109
+ children: [
110
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_phosphor_react.Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
111
+ notificationActive && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
112
+ "span",
113
+ {
114
+ "data-testid": "notification-dot",
115
+ className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
116
+ }
117
+ )
118
+ ]
119
+ }
120
+ );
121
+ }
122
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
123
+ "div",
124
+ {
125
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
126
+ ...props,
127
+ children: [
128
+ iconLeft && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconLeft }),
129
+ children,
130
+ iconRight && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconRight })
131
+ ]
132
+ }
133
+ );
134
+ };
135
+ var Badge_default = Badge;
136
+
137
+ // src/components/Alternative/Alternative.tsx
138
+ var import_phosphor_react2 = require("phosphor-react");
139
+
140
+ // src/components/Radio/Radio.tsx
141
+ var import_react = require("react");
142
+ var import_zustand = require("zustand");
143
+
144
+ // src/components/Text/Text.tsx
145
+ var import_jsx_runtime2 = require("react/jsx-runtime");
146
+ var Text = ({
147
+ children,
148
+ size = "md",
149
+ weight = "normal",
150
+ color = "text-text-950",
151
+ as,
152
+ className = "",
153
+ ...props
154
+ }) => {
155
+ let sizeClasses = "";
156
+ let weightClasses = "";
157
+ const sizeClassMap = {
158
+ "2xs": "text-2xs",
159
+ xs: "text-xs",
160
+ sm: "text-sm",
161
+ md: "text-md",
162
+ lg: "text-lg",
163
+ xl: "text-xl",
164
+ "2xl": "text-2xl",
165
+ "3xl": "text-3xl",
166
+ "4xl": "text-4xl",
167
+ "5xl": "text-5xl",
168
+ "6xl": "text-6xl"
169
+ };
170
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
171
+ const weightClassMap = {
172
+ hairline: "font-hairline",
173
+ light: "font-light",
174
+ normal: "font-normal",
175
+ medium: "font-medium",
176
+ semibold: "font-semibold",
177
+ bold: "font-bold",
178
+ extrabold: "font-extrabold",
179
+ black: "font-black"
180
+ };
181
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
182
+ const baseClasses = "font-primary";
183
+ const Component = as ?? "p";
184
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
185
+ Component,
186
+ {
187
+ className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
188
+ ...props,
189
+ children
190
+ }
191
+ );
192
+ };
193
+ var Text_default = Text;
194
+
195
+ // src/components/Radio/Radio.tsx
196
+ var import_jsx_runtime3 = require("react/jsx-runtime");
197
+ var SIZE_CLASSES2 = {
198
+ small: {
199
+ radio: "w-5 h-5",
200
+ textSize: "sm",
201
+ spacing: "gap-1.5",
202
+ borderWidth: "border-2",
203
+ dotSize: "w-2.5 h-2.5",
204
+ labelHeight: "h-5"
205
+ },
206
+ medium: {
207
+ radio: "w-6 h-6",
208
+ textSize: "md",
209
+ spacing: "gap-2",
210
+ borderWidth: "border-2",
211
+ dotSize: "w-3 h-3",
212
+ labelHeight: "h-6"
213
+ },
214
+ large: {
215
+ radio: "w-7 h-7",
216
+ textSize: "lg",
217
+ spacing: "gap-2",
218
+ borderWidth: "border-2",
219
+ dotSize: "w-3.5 h-3.5",
220
+ labelHeight: "h-7"
221
+ },
222
+ extraLarge: {
223
+ radio: "w-8 h-8",
224
+ textSize: "xl",
225
+ spacing: "gap-3",
226
+ borderWidth: "border-2",
227
+ dotSize: "w-4 h-4",
228
+ labelHeight: "h-8"
229
+ }
230
+ };
231
+ var BASE_RADIO_CLASSES = "rounded-full border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
232
+ var STATE_CLASSES = {
233
+ default: {
234
+ unchecked: "border-border-400 bg-background hover:border-border-500",
235
+ checked: "border-primary-950 bg-background hover:border-primary-800"
236
+ },
237
+ hovered: {
238
+ unchecked: "border-border-500 bg-background",
239
+ checked: "border-info-700 bg-background"
240
+ },
241
+ focused: {
242
+ unchecked: "border-border-400 bg-background",
243
+ checked: "border-primary-950 bg-background"
244
+ },
245
+ invalid: {
246
+ unchecked: "border-border-400 bg-background",
247
+ checked: "border-primary-950 bg-background"
248
+ },
249
+ disabled: {
250
+ unchecked: "border-border-400 bg-background cursor-not-allowed",
251
+ checked: "border-primary-950 bg-background cursor-not-allowed"
252
+ }
253
+ };
254
+ var DOT_CLASSES = {
255
+ default: "bg-primary-950",
256
+ hovered: "bg-info-700",
257
+ focused: "bg-primary-950",
258
+ invalid: "bg-primary-950",
259
+ disabled: "bg-primary-950"
260
+ };
261
+ var Radio = (0, import_react.forwardRef)(
262
+ ({
263
+ label,
264
+ size = "medium",
265
+ state = "default",
266
+ errorMessage,
267
+ helperText,
268
+ className = "",
269
+ labelClassName = "",
270
+ checked: checkedProp,
271
+ defaultChecked = false,
272
+ disabled,
273
+ id,
274
+ name,
275
+ value,
276
+ onChange,
277
+ ...props
278
+ }, ref) => {
279
+ const generatedId = (0, import_react.useId)();
280
+ const inputId = id ?? `radio-${generatedId}`;
281
+ const inputRef = (0, import_react.useRef)(null);
282
+ const [internalChecked, setInternalChecked] = (0, import_react.useState)(defaultChecked);
283
+ const isControlled = checkedProp !== void 0;
284
+ const checked = isControlled ? checkedProp : internalChecked;
285
+ const handleChange = (event) => {
286
+ const newChecked = event.target.checked;
287
+ if (!isControlled) {
288
+ setInternalChecked(newChecked);
289
+ }
290
+ if (event.target) {
291
+ event.target.blur();
292
+ }
293
+ onChange?.(event);
294
+ };
295
+ const currentState = disabled ? "disabled" : state;
296
+ const sizeClasses = SIZE_CLASSES2[size];
297
+ const actualRadioSize = sizeClasses.radio;
298
+ const actualDotSize = sizeClasses.dotSize;
299
+ const radioVariant = checked ? "checked" : "unchecked";
300
+ const stylingClasses = STATE_CLASSES[currentState][radioVariant];
301
+ const getBorderWidth = () => {
302
+ if (currentState === "focused") {
303
+ return "border-2";
304
+ }
305
+ return sizeClasses.borderWidth;
306
+ };
307
+ const borderWidthClass = getBorderWidth();
308
+ const radioClasses = `${BASE_RADIO_CLASSES} ${actualRadioSize} ${borderWidthClass} ${stylingClasses} ${className}`;
309
+ const dotClasses = `${actualDotSize} rounded-full ${DOT_CLASSES[currentState]} transition-all duration-200`;
310
+ const isWrapperNeeded = currentState === "focused" || currentState === "invalid";
311
+ const wrapperBorderColor = currentState === "focused" ? "border-indicator-info" : "border-indicator-error";
312
+ const getTextColor = () => {
313
+ if (currentState === "disabled") {
314
+ return checked ? "text-text-900" : "text-text-600";
315
+ }
316
+ if (currentState === "focused") {
317
+ return "text-text-900";
318
+ }
319
+ return checked ? "text-text-900" : "text-text-600";
320
+ };
321
+ const getCursorClass = () => {
322
+ return currentState === "disabled" ? "cursor-not-allowed" : "cursor-pointer";
323
+ };
324
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col", children: [
325
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
326
+ "div",
327
+ {
328
+ className: `flex flex-row items-center ${isWrapperNeeded ? `p-1 border-2 ${wrapperBorderColor} rounded-lg gap-1.5` : sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
329
+ children: [
330
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
331
+ "input",
332
+ {
333
+ ref: (node) => {
334
+ inputRef.current = node;
335
+ if (typeof ref === "function") ref(node);
336
+ else if (ref) ref.current = node;
337
+ },
338
+ type: "radio",
339
+ id: inputId,
340
+ checked,
341
+ disabled,
342
+ name,
343
+ value,
344
+ onChange: handleChange,
345
+ className: "sr-only",
346
+ style: {
347
+ position: "absolute",
348
+ left: "-9999px",
349
+ visibility: "hidden"
350
+ },
351
+ ...props
352
+ }
353
+ ),
354
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
355
+ "button",
356
+ {
357
+ type: "button",
358
+ className: radioClasses,
359
+ disabled,
360
+ "aria-pressed": checked,
361
+ onClick: (e) => {
362
+ e.preventDefault();
363
+ if (!disabled) {
364
+ if (inputRef.current) {
365
+ inputRef.current.click();
366
+ inputRef.current.blur();
367
+ }
368
+ }
369
+ },
370
+ onKeyDown: (e) => {
371
+ if ((e.key === "Enter" || e.key === " ") && !disabled) {
372
+ e.preventDefault();
373
+ if (inputRef.current) {
374
+ inputRef.current.click();
375
+ inputRef.current.blur();
376
+ }
377
+ }
378
+ },
379
+ children: checked && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: dotClasses })
380
+ }
381
+ ),
382
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
383
+ "div",
384
+ {
385
+ className: `flex flex-row items-center ${sizeClasses.labelHeight} flex-1 min-w-0`,
386
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
387
+ Text_default,
388
+ {
389
+ as: "label",
390
+ htmlFor: inputId,
391
+ size: sizeClasses.textSize,
392
+ weight: "normal",
393
+ className: `${getCursorClass()} select-none leading-normal flex items-center font-roboto truncate ${labelClassName}`,
394
+ color: getTextColor(),
395
+ children: label
396
+ }
397
+ )
398
+ }
399
+ )
400
+ ]
401
+ }
402
+ ),
403
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
404
+ Text_default,
405
+ {
406
+ size: "sm",
407
+ weight: "normal",
408
+ className: "mt-1.5 truncate",
409
+ color: "text-error-600",
410
+ children: errorMessage
411
+ }
412
+ ),
413
+ helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
414
+ Text_default,
415
+ {
416
+ size: "sm",
417
+ weight: "normal",
418
+ className: "mt-1.5 truncate",
419
+ color: "text-text-500",
420
+ children: helperText
421
+ }
422
+ )
423
+ ] });
424
+ }
425
+ );
426
+ Radio.displayName = "Radio";
427
+ var createRadioGroupStore = (name, defaultValue, disabled, onValueChange) => (0, import_zustand.create)((set, get) => ({
428
+ value: defaultValue,
429
+ setValue: (value) => {
430
+ if (!get().disabled) {
431
+ set({ value });
432
+ get().onValueChange?.(value);
433
+ }
434
+ },
435
+ onValueChange,
436
+ disabled,
437
+ name
438
+ }));
439
+ var useRadioGroupStore = (externalStore) => {
440
+ if (!externalStore) {
441
+ throw new Error("RadioGroupItem must be used within a RadioGroup");
442
+ }
443
+ return externalStore;
444
+ };
445
+ var injectStore = (children, store) => import_react.Children.map(children, (child) => {
446
+ if (!(0, import_react.isValidElement)(child)) return child;
447
+ const typedChild = child;
448
+ const shouldInject = typedChild.type === RadioGroupItem;
449
+ return (0, import_react.cloneElement)(typedChild, {
450
+ ...shouldInject ? { store } : {},
451
+ ...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
452
+ });
453
+ });
454
+ var RadioGroup = (0, import_react.forwardRef)(
455
+ ({
456
+ value: propValue,
457
+ defaultValue = "",
458
+ onValueChange,
459
+ name: propName,
460
+ disabled = false,
461
+ className = "",
462
+ children,
463
+ ...props
464
+ }, ref) => {
465
+ const generatedId = (0, import_react.useId)();
466
+ const name = propName || `radio-group-${generatedId}`;
467
+ const storeRef = (0, import_react.useRef)(null);
468
+ storeRef.current ??= createRadioGroupStore(
469
+ name,
470
+ defaultValue,
471
+ disabled,
472
+ onValueChange
473
+ );
474
+ const store = storeRef.current;
475
+ const { setValue } = (0, import_zustand.useStore)(store, (s) => s);
476
+ (0, import_react.useEffect)(() => {
477
+ const currentValue = store.getState().value;
478
+ if (currentValue && onValueChange) {
479
+ onValueChange(currentValue);
480
+ }
481
+ }, []);
482
+ (0, import_react.useEffect)(() => {
483
+ if (propValue !== void 0) {
484
+ setValue(propValue);
485
+ }
486
+ }, [propValue, setValue]);
487
+ (0, import_react.useEffect)(() => {
488
+ store.setState({ disabled });
489
+ }, [disabled, store]);
490
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
491
+ "div",
492
+ {
493
+ ref,
494
+ className,
495
+ role: "radiogroup",
496
+ "aria-label": name,
497
+ ...props,
498
+ children: injectStore(children, store)
499
+ }
500
+ );
501
+ }
502
+ );
503
+ RadioGroup.displayName = "RadioGroup";
504
+ var RadioGroupItem = (0, import_react.forwardRef)(
505
+ ({
506
+ value,
507
+ store: externalStore,
508
+ disabled: itemDisabled,
509
+ size = "medium",
510
+ state = "default",
511
+ className = "",
512
+ id,
513
+ ...props
514
+ }, ref) => {
515
+ const store = useRadioGroupStore(externalStore);
516
+ const {
517
+ value: groupValue,
518
+ setValue,
519
+ disabled: groupDisabled,
520
+ name
521
+ } = (0, import_zustand.useStore)(store);
522
+ const generatedId = (0, import_react.useId)();
523
+ const inputId = id ?? `radio-item-${generatedId}`;
524
+ const isChecked = groupValue === value;
525
+ const isDisabled = groupDisabled || itemDisabled;
526
+ const currentState = isDisabled ? "disabled" : state;
527
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
528
+ Radio,
529
+ {
530
+ ref,
531
+ id: inputId,
532
+ name,
533
+ value,
534
+ checked: isChecked,
535
+ disabled: isDisabled,
536
+ size,
537
+ state: currentState,
538
+ className,
539
+ onChange: (e) => {
540
+ if (e.target.checked && !isDisabled) {
541
+ setValue(value);
542
+ }
543
+ },
544
+ ...props
545
+ }
546
+ );
547
+ }
548
+ );
549
+ RadioGroupItem.displayName = "RadioGroupItem";
550
+
551
+ // src/components/Alternative/Alternative.tsx
552
+ var import_react2 = require("react");
553
+ var import_jsx_runtime4 = require("react/jsx-runtime");
554
+ var AlternativesList = ({
555
+ alternatives,
556
+ name,
557
+ defaultValue,
558
+ value,
559
+ onValueChange,
560
+ disabled = false,
561
+ layout = "default",
562
+ className = "",
563
+ mode = "interactive",
564
+ selectedValue
565
+ }) => {
566
+ const uniqueId = (0, import_react2.useId)();
567
+ const groupName = name || `alternatives-${uniqueId}`;
568
+ const [actualValue, setActualValue] = (0, import_react2.useState)(value);
569
+ const isReadonly = mode === "readonly";
570
+ const getStatusStyles = (status, isReadonly2) => {
571
+ const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
572
+ switch (status) {
573
+ case "correct":
574
+ return "bg-success-background border-success-300";
575
+ case "incorrect":
576
+ return "bg-error-background border-error-300";
577
+ default:
578
+ return `bg-background border-border-100 ${hoverClass}`;
579
+ }
580
+ };
581
+ const getStatusBadge = (status) => {
582
+ switch (status) {
583
+ case "correct":
584
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_phosphor_react2.CheckCircle, {}), children: "Resposta correta" });
585
+ case "incorrect":
586
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_phosphor_react2.XCircle, {}), children: "Resposta incorreta" });
587
+ default:
588
+ return null;
589
+ }
590
+ };
591
+ const getLayoutClasses = () => {
592
+ switch (layout) {
593
+ case "compact":
594
+ return "gap-2";
595
+ case "detailed":
596
+ return "gap-4";
597
+ default:
598
+ return "gap-3.5";
599
+ }
600
+ };
601
+ const renderReadonlyAlternative = (alternative) => {
602
+ const alternativeId = alternative.value;
603
+ const isUserSelected = selectedValue === alternative.value;
604
+ const isCorrectAnswer = alternative.status === "correct";
605
+ let displayStatus = void 0;
606
+ if (isUserSelected && !isCorrectAnswer) {
607
+ displayStatus = "incorrect";
608
+ } else if (isCorrectAnswer) {
609
+ displayStatus = "correct";
610
+ }
611
+ const statusStyles = getStatusStyles(displayStatus, true);
612
+ const statusBadge = getStatusBadge(displayStatus);
613
+ const renderRadio = () => {
614
+ 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"}`;
615
+ const dotClasses = "w-3 h-3 rounded-full bg-primary-950 transition-all duration-200";
616
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: radioClasses, children: isUserSelected && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: dotClasses }) });
617
+ };
618
+ if (layout === "detailed") {
619
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
620
+ "div",
621
+ {
622
+ className: `border-2 rounded-lg p-4 w-full ${statusStyles} ${alternative.disabled ? "opacity-50" : ""}`,
623
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
624
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
625
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-1", children: renderRadio() }),
626
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex-1", children: [
627
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
628
+ "p",
629
+ {
630
+ className: `block font-medium ${selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"}`,
631
+ children: alternative.label
632
+ }
633
+ ),
634
+ alternative.description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
635
+ ] })
636
+ ] }),
637
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
638
+ ] })
639
+ },
640
+ alternativeId
641
+ );
642
+ }
643
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
644
+ "div",
645
+ {
646
+ className: `flex flex-row justify-between items-start gap-2 p-2 rounded-lg w-full ${statusStyles} ${alternative.disabled ? "opacity-50" : ""}`,
647
+ children: [
648
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
649
+ renderRadio(),
650
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
651
+ "span",
652
+ {
653
+ className: `flex-1 ${selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"}`,
654
+ children: alternative.label
655
+ }
656
+ )
657
+ ] }),
658
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
659
+ ]
660
+ },
661
+ alternativeId
662
+ );
663
+ };
664
+ if (isReadonly) {
665
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
666
+ "div",
667
+ {
668
+ className: `flex flex-col ${getLayoutClasses()} w-full ${className}`,
669
+ children: alternatives.map(
670
+ (alternative) => renderReadonlyAlternative(alternative)
671
+ )
672
+ }
673
+ );
674
+ }
675
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
676
+ RadioGroup,
677
+ {
678
+ name: groupName,
679
+ defaultValue,
680
+ value,
681
+ onValueChange: (value2) => {
682
+ setActualValue(value2);
683
+ onValueChange?.(value2);
684
+ },
685
+ disabled,
686
+ className: `flex flex-col ${getLayoutClasses()} ${className}`,
687
+ children: alternatives.map((alternative, index) => {
688
+ const alternativeId = alternative.value || `alt-${index}`;
689
+ const statusStyles = getStatusStyles(alternative.status, false);
690
+ const statusBadge = getStatusBadge(alternative.status);
691
+ if (layout === "detailed") {
692
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
693
+ "div",
694
+ {
695
+ className: `border-2 rounded-lg p-4 transition-all ${statusStyles} ${alternative.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
696
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
697
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
698
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
699
+ RadioGroupItem,
700
+ {
701
+ value: alternative.value,
702
+ id: alternativeId,
703
+ disabled: alternative.disabled,
704
+ className: "mt-1"
705
+ }
706
+ ),
707
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex-1", children: [
708
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
709
+ "label",
710
+ {
711
+ htmlFor: alternativeId,
712
+ className: `block font-medium
713
+ ${actualValue === alternative.value ? "text-text-950" : "text-text-600"}
714
+ ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
715
+ children: alternative.label
716
+ }
717
+ ),
718
+ alternative.description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
719
+ ] })
720
+ ] }),
721
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
722
+ ] })
723
+ },
724
+ alternativeId
725
+ );
726
+ }
727
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
728
+ "div",
729
+ {
730
+ className: `flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all ${statusStyles} ${alternative.disabled ? "opacity-50 cursor-not-allowed" : ""}`,
731
+ children: [
732
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
733
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
734
+ RadioGroupItem,
735
+ {
736
+ value: alternative.value,
737
+ id: alternativeId,
738
+ disabled: alternative.disabled
739
+ }
740
+ ),
741
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
742
+ "label",
743
+ {
744
+ htmlFor: alternativeId,
745
+ className: `flex-1
746
+ ${actualValue === alternative.value ? "text-text-950" : "text-text-600"}
747
+ ${alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"}`,
748
+ children: alternative.label
749
+ }
750
+ )
751
+ ] }),
752
+ statusBadge && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
753
+ ]
754
+ },
755
+ alternativeId
756
+ );
757
+ })
758
+ }
759
+ );
760
+ };
761
+ var HeaderAlternative = (0, import_react2.forwardRef)(
762
+ ({ className, title, subTitle, content, ...props }, ref) => {
763
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
764
+ "div",
765
+ {
766
+ ref,
767
+ className: `bg-background p-4 flex flex-col gap-4 rounded-xl ${className}`,
768
+ ...props,
769
+ children: [
770
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "flex flex-col", children: [
771
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-text-950 font-bold text-lg", children: title }),
772
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-text-700 text-sm ", children: subTitle })
773
+ ] }),
774
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-text-950 text-md", children: content })
775
+ ]
776
+ }
777
+ );
778
+ }
779
+ );
780
+
781
+ // src/components/Button/Button.tsx
782
+ var import_jsx_runtime5 = require("react/jsx-runtime");
783
+ var VARIANT_ACTION_CLASSES2 = {
784
+ solid: {
785
+ 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",
786
+ 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",
787
+ 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"
788
+ },
789
+ outline: {
790
+ 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",
791
+ 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",
792
+ 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"
793
+ },
794
+ link: {
795
+ 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",
796
+ 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",
797
+ 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"
798
+ }
799
+ };
800
+ var SIZE_CLASSES3 = {
801
+ "extra-small": "text-xs px-3.5 py-2",
802
+ small: "text-sm px-4 py-2.5",
803
+ medium: "text-md px-5 py-2.5",
804
+ large: "text-lg px-6 py-3",
805
+ "extra-large": "text-lg px-7 py-3.5"
806
+ };
807
+ var Button = ({
808
+ children,
809
+ iconLeft,
810
+ iconRight,
811
+ size = "medium",
812
+ variant = "solid",
813
+ action = "primary",
814
+ className = "",
815
+ disabled,
816
+ type = "button",
817
+ ...props
818
+ }) => {
819
+ const sizeClasses = SIZE_CLASSES3[size];
820
+ const variantClasses = VARIANT_ACTION_CLASSES2[variant][action];
821
+ const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
822
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
823
+ "button",
824
+ {
825
+ className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
826
+ disabled,
827
+ type,
828
+ ...props,
829
+ children: [
830
+ iconLeft && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mr-2 flex items-center", children: iconLeft }),
831
+ children,
832
+ iconRight && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ml-2 flex items-center", children: iconRight })
833
+ ]
834
+ }
835
+ );
836
+ };
837
+ var Button_default = Button;
838
+
839
+ // src/components/IconButton/IconButton.tsx
840
+ var import_react3 = require("react");
841
+ var import_jsx_runtime6 = require("react/jsx-runtime");
842
+ var IconButton = (0, import_react3.forwardRef)(
843
+ ({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
844
+ const baseClasses = [
845
+ "inline-flex",
846
+ "items-center",
847
+ "justify-center",
848
+ "rounded-lg",
849
+ "font-medium",
850
+ "bg-transparent",
851
+ "text-text-950",
852
+ "cursor-pointer",
853
+ "hover:bg-primary-600",
854
+ "hover:text-text",
855
+ "focus-visible:outline-none",
856
+ "focus-visible:ring-2",
857
+ "focus-visible:ring-offset-0",
858
+ "focus-visible:ring-indicator-info",
859
+ "disabled:opacity-50",
860
+ "disabled:cursor-not-allowed",
861
+ "disabled:pointer-events-none"
862
+ ];
863
+ const sizeClasses = {
864
+ sm: ["w-6", "h-6", "text-sm"],
865
+ md: ["w-10", "h-10", "text-base"]
866
+ };
867
+ const activeClasses = active ? ["!bg-primary-50", "!text-primary-950", "hover:!bg-primary-100"] : [];
868
+ const allClasses = [
869
+ ...baseClasses,
870
+ ...sizeClasses[size],
871
+ ...activeClasses
872
+ ].join(" ");
873
+ const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
874
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
875
+ "button",
876
+ {
877
+ ref,
878
+ type: "button",
879
+ className: `${allClasses} ${className}`,
880
+ disabled,
881
+ "aria-pressed": active,
882
+ "aria-label": ariaLabel,
883
+ ...props,
884
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "flex items-center justify-center", children: icon })
885
+ }
886
+ );
887
+ }
888
+ );
889
+ IconButton.displayName = "IconButton";
890
+ var IconButton_default = IconButton;
891
+
892
+ // src/components/Quiz/Quiz.tsx
893
+ var import_react8 = require("react");
894
+
895
+ // src/components/Quiz/useQuizStore.ts
896
+ var import_zustand2 = require("zustand");
897
+ var import_middleware = require("zustand/middleware");
898
+ var useQuizStore = (0, import_zustand2.create)()(
899
+ (0, import_middleware.devtools)(
900
+ (set, get) => {
901
+ let timerInterval = null;
902
+ const startTimer = () => {
903
+ if (get().isFinished) {
904
+ return;
905
+ }
906
+ if (timerInterval) {
907
+ clearInterval(timerInterval);
908
+ }
909
+ timerInterval = setInterval(() => {
910
+ const { timeElapsed } = get();
911
+ set({ timeElapsed: timeElapsed + 1 });
912
+ }, 1e3);
913
+ };
914
+ const stopTimer = () => {
915
+ if (timerInterval) {
916
+ clearInterval(timerInterval);
917
+ timerInterval = null;
918
+ }
919
+ };
920
+ return {
921
+ // Initial State
922
+ currentQuestionIndex: 0,
923
+ selectedAnswers: {},
924
+ userAnswers: [],
925
+ timeElapsed: 0,
926
+ isStarted: false,
927
+ isFinished: false,
928
+ userId: "",
929
+ // Setters
930
+ setBySimulated: (simulado) => set({ bySimulated: simulado }),
931
+ setByActivity: (atividade) => set({ byActivity: atividade }),
932
+ setByQuestionary: (aula) => set({ byQuestionary: aula }),
933
+ setUserId: (userId) => set({ userId }),
934
+ getUserId: () => get().userId,
935
+ // Navigation
936
+ goToNextQuestion: () => {
937
+ const { currentQuestionIndex, getTotalQuestions } = get();
938
+ const totalQuestions = getTotalQuestions();
939
+ if (currentQuestionIndex < totalQuestions - 1) {
940
+ set({ currentQuestionIndex: currentQuestionIndex + 1 });
941
+ }
942
+ },
943
+ goToPreviousQuestion: () => {
944
+ const { currentQuestionIndex } = get();
945
+ if (currentQuestionIndex > 0) {
946
+ set({ currentQuestionIndex: currentQuestionIndex - 1 });
947
+ }
948
+ },
949
+ goToQuestion: (index) => {
950
+ const { getTotalQuestions } = get();
951
+ const totalQuestions = getTotalQuestions();
952
+ if (index >= 0 && index < totalQuestions) {
953
+ set({ currentQuestionIndex: index });
954
+ }
955
+ },
956
+ getActiveQuiz: () => {
957
+ const { bySimulated, byActivity, byQuestionary } = get();
958
+ if (bySimulated)
959
+ return { quiz: bySimulated, type: "bySimulated" };
960
+ if (byActivity)
961
+ return { quiz: byActivity, type: "byActivity" };
962
+ if (byQuestionary)
963
+ return { quiz: byQuestionary, type: "byQuestionary" };
964
+ return null;
965
+ },
966
+ selectAnswer: (questionId, answerId) => {
967
+ const { getActiveQuiz, userAnswers } = get();
968
+ const activeQuiz = getActiveQuiz();
969
+ if (!activeQuiz) return;
970
+ const updatedQuestions = activeQuiz.quiz.questions.map(
971
+ (question) => question.id === questionId ? { ...question, answerKey: answerId } : question
972
+ );
973
+ const updatedQuiz = {
974
+ ...activeQuiz.quiz,
975
+ questions: updatedQuestions
976
+ };
977
+ const activityId = activeQuiz.quiz.id;
978
+ const userId = get().getUserId();
979
+ if (!userId) {
980
+ console.warn("selectAnswer called before userId is set");
981
+ return;
982
+ }
983
+ const existingAnswerIndex = userAnswers.findIndex(
984
+ (answer) => answer.questionId === questionId
985
+ );
986
+ const newUserAnswer = {
987
+ questionId,
988
+ activityId,
989
+ userId,
990
+ answer: answerId,
991
+ optionId: answerId
992
+ };
993
+ let updatedUserAnswers;
994
+ if (existingAnswerIndex !== -1) {
995
+ updatedUserAnswers = [...userAnswers];
996
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
997
+ } else {
998
+ updatedUserAnswers = [...userAnswers, newUserAnswer];
999
+ }
1000
+ set({
1001
+ [activeQuiz.type]: updatedQuiz,
1002
+ userAnswers: updatedUserAnswers
1003
+ });
1004
+ },
1005
+ skipQuestion: () => {
1006
+ const { getCurrentQuestion, userAnswers, getActiveQuiz } = get();
1007
+ const currentQuestion = getCurrentQuestion();
1008
+ const activeQuiz = getActiveQuiz();
1009
+ if (!activeQuiz) return;
1010
+ if (currentQuestion) {
1011
+ const activityId = activeQuiz.quiz.id;
1012
+ const userId = get().getUserId();
1013
+ const existingAnswerIndex = userAnswers.findIndex(
1014
+ (answer) => answer.questionId === currentQuestion.id
1015
+ );
1016
+ const newUserAnswer = {
1017
+ questionId: currentQuestion.id,
1018
+ activityId,
1019
+ userId,
1020
+ answer: null,
1021
+ optionId: null
1022
+ };
1023
+ let updatedUserAnswers;
1024
+ if (existingAnswerIndex !== -1) {
1025
+ updatedUserAnswers = [...userAnswers];
1026
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
1027
+ } else {
1028
+ updatedUserAnswers = [...userAnswers, newUserAnswer];
1029
+ }
1030
+ set({
1031
+ userAnswers: updatedUserAnswers
1032
+ });
1033
+ }
1034
+ },
1035
+ addUserAnswer: (questionId, answerId) => {
1036
+ const { getActiveQuiz, userAnswers } = get();
1037
+ const activeQuiz = getActiveQuiz();
1038
+ if (!activeQuiz) return;
1039
+ const activityId = activeQuiz.quiz.id;
1040
+ const userId = get().getUserId();
1041
+ const existingAnswerIndex = userAnswers.findIndex(
1042
+ (answer) => answer.questionId === questionId
1043
+ );
1044
+ const newUserAnswer = {
1045
+ questionId,
1046
+ activityId,
1047
+ userId,
1048
+ answer: answerId || null,
1049
+ optionId: answerId || null
1050
+ };
1051
+ if (existingAnswerIndex !== -1) {
1052
+ const updatedUserAnswers = [...userAnswers];
1053
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
1054
+ set({ userAnswers: updatedUserAnswers });
1055
+ } else {
1056
+ set({ userAnswers: [...userAnswers, newUserAnswer] });
1057
+ }
1058
+ },
1059
+ startQuiz: () => {
1060
+ set({ isStarted: true, timeElapsed: 0 });
1061
+ startTimer();
1062
+ },
1063
+ finishQuiz: () => {
1064
+ set({ isFinished: true });
1065
+ stopTimer();
1066
+ },
1067
+ resetQuiz: () => {
1068
+ stopTimer();
1069
+ set({
1070
+ currentQuestionIndex: 0,
1071
+ selectedAnswers: {},
1072
+ userAnswers: [],
1073
+ timeElapsed: 0,
1074
+ isStarted: false,
1075
+ isFinished: false,
1076
+ userId: ""
1077
+ });
1078
+ },
1079
+ // Timer
1080
+ updateTime: (time) => set({ timeElapsed: time }),
1081
+ startTimer,
1082
+ stopTimer,
1083
+ // Getters
1084
+ getCurrentQuestion: () => {
1085
+ const { currentQuestionIndex, getActiveQuiz } = get();
1086
+ const activeQuiz = getActiveQuiz();
1087
+ if (!activeQuiz) {
1088
+ return null;
1089
+ }
1090
+ return activeQuiz.quiz.questions[currentQuestionIndex];
1091
+ },
1092
+ getTotalQuestions: () => {
1093
+ const { getActiveQuiz } = get();
1094
+ const activeQuiz = getActiveQuiz();
1095
+ return activeQuiz?.quiz?.questions?.length || 0;
1096
+ },
1097
+ getAnsweredQuestions: () => {
1098
+ const { userAnswers } = get();
1099
+ return userAnswers.filter((answer) => answer.answer !== null).length;
1100
+ },
1101
+ getUnansweredQuestions: () => {
1102
+ const { getActiveQuiz, userAnswers } = get();
1103
+ const activeQuiz = getActiveQuiz();
1104
+ if (!activeQuiz) return [];
1105
+ const unansweredQuestions = [];
1106
+ activeQuiz.quiz.questions.forEach((question, index) => {
1107
+ const userAnswer = userAnswers.find(
1108
+ (answer) => answer.questionId === question.id
1109
+ );
1110
+ const isAnswered = userAnswer && userAnswer.answer !== null;
1111
+ const isSkipped = userAnswer && userAnswer.answer === null;
1112
+ if (!isAnswered && !isSkipped) {
1113
+ unansweredQuestions.push(index + 1);
1114
+ }
1115
+ });
1116
+ return unansweredQuestions;
1117
+ },
1118
+ getSkippedQuestions: () => {
1119
+ const { userAnswers } = get();
1120
+ return userAnswers.filter((answer) => answer.answer === null).length;
1121
+ },
1122
+ getProgress: () => {
1123
+ const { getTotalQuestions, getAnsweredQuestions } = get();
1124
+ const total = getTotalQuestions();
1125
+ const answered = getAnsweredQuestions();
1126
+ return total > 0 ? answered / total * 100 : 0;
1127
+ },
1128
+ isQuestionAnswered: (questionId) => {
1129
+ const { userAnswers } = get();
1130
+ const userAnswer = userAnswers.find(
1131
+ (answer) => answer.questionId === questionId
1132
+ );
1133
+ return userAnswer ? userAnswer.answer !== null : false;
1134
+ },
1135
+ isQuestionSkipped: (questionId) => {
1136
+ const { userAnswers } = get();
1137
+ const userAnswer = userAnswers.find(
1138
+ (answer) => answer.questionId === questionId
1139
+ );
1140
+ return userAnswer ? userAnswer.answer === null : false;
1141
+ },
1142
+ getCurrentAnswer: () => {
1143
+ const { getCurrentQuestion, userAnswers } = get();
1144
+ const currentQuestion = getCurrentQuestion();
1145
+ if (!currentQuestion) return void 0;
1146
+ const userAnswer = userAnswers.find(
1147
+ (answer) => answer.questionId === currentQuestion.id
1148
+ );
1149
+ return userAnswer?.answer;
1150
+ },
1151
+ getQuizTitle: () => {
1152
+ const { getActiveQuiz } = get();
1153
+ const activeQuiz = getActiveQuiz();
1154
+ return activeQuiz?.quiz?.title || "Quiz";
1155
+ },
1156
+ formatTime: (seconds) => {
1157
+ const minutes = Math.floor(seconds / 60);
1158
+ const remainingSeconds = seconds % 60;
1159
+ return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
1160
+ },
1161
+ getUserAnswers: () => {
1162
+ const { getActiveQuiz, userAnswers } = get();
1163
+ const activeQuiz = getActiveQuiz();
1164
+ if (!activeQuiz) return [];
1165
+ return activeQuiz.quiz.questions.map((question) => {
1166
+ const userAnswer = userAnswers.find(
1167
+ (answer) => answer.questionId === question.id
1168
+ );
1169
+ return {
1170
+ ...question,
1171
+ isSkipped: userAnswer ? userAnswer.answer === null : false
1172
+ };
1173
+ });
1174
+ },
1175
+ getUnansweredQuestionsFromUserAnswers: () => {
1176
+ const { getActiveQuiz, userAnswers } = get();
1177
+ const activeQuiz = getActiveQuiz();
1178
+ if (!activeQuiz) return [];
1179
+ const unansweredQuestions = [];
1180
+ activeQuiz.quiz.questions.forEach((question, index) => {
1181
+ const userAnswer = userAnswers.find(
1182
+ (answer) => answer.questionId === question.id
1183
+ );
1184
+ const hasAnswer = userAnswer && userAnswer.answer !== null;
1185
+ const isSkipped = userAnswer && userAnswer.answer === null;
1186
+ if (!hasAnswer || isSkipped) {
1187
+ unansweredQuestions.push(index + 1);
1188
+ }
1189
+ });
1190
+ return unansweredQuestions;
1191
+ },
1192
+ getQuestionsGroupedBySubject: () => {
1193
+ const { getActiveQuiz } = get();
1194
+ const activeQuiz = getActiveQuiz();
1195
+ if (!activeQuiz) return {};
1196
+ const groupedQuestions = {};
1197
+ activeQuiz.quiz.questions.forEach((question) => {
1198
+ const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
1199
+ if (!groupedQuestions[subjectId]) {
1200
+ groupedQuestions[subjectId] = [];
1201
+ }
1202
+ groupedQuestions[subjectId].push(question);
1203
+ });
1204
+ return groupedQuestions;
1205
+ },
1206
+ // New methods for userAnswers
1207
+ getUserAnswerByQuestionId: (questionId) => {
1208
+ const { userAnswers } = get();
1209
+ return userAnswers.find((answer) => answer.questionId === questionId) || null;
1210
+ },
1211
+ isQuestionAnsweredByUserAnswers: (questionId) => {
1212
+ const { userAnswers } = get();
1213
+ const answer = userAnswers.find(
1214
+ (answer2) => answer2.questionId === questionId
1215
+ );
1216
+ return answer ? answer.answer !== null : false;
1217
+ },
1218
+ getQuestionStatusFromUserAnswers: (questionId) => {
1219
+ const { userAnswers } = get();
1220
+ const answer = userAnswers.find(
1221
+ (answer2) => answer2.questionId === questionId
1222
+ );
1223
+ if (!answer) return "unanswered";
1224
+ if (answer.answer === null) return "skipped";
1225
+ return "answered";
1226
+ },
1227
+ getUserAnswersForActivity: () => {
1228
+ const { userAnswers } = get();
1229
+ return userAnswers;
1230
+ }
1231
+ };
1232
+ },
1233
+ {
1234
+ name: "quiz-store"
1235
+ }
1236
+ )
1237
+ );
1238
+
1239
+ // src/components/AlertDialog/AlertDialog.tsx
1240
+ var import_react4 = require("react");
1241
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1242
+ var SIZE_CLASSES4 = {
1243
+ "extra-small": "w-screen max-w-[324px]",
1244
+ small: "w-screen max-w-[378px]",
1245
+ medium: "w-screen max-w-[459px]",
1246
+ large: "w-screen max-w-[578px]",
1247
+ "extra-large": "w-screen max-w-[912px]"
1248
+ };
1249
+ var AlertDialog = (0, import_react4.forwardRef)(
1250
+ ({
1251
+ description,
1252
+ cancelButtonLabel = "Cancelar",
1253
+ submitButtonLabel = "Deletar",
1254
+ title,
1255
+ isOpen,
1256
+ closeOnBackdropClick = true,
1257
+ closeOnEscape = true,
1258
+ className = "",
1259
+ onSubmit,
1260
+ onChangeOpen,
1261
+ submitValue,
1262
+ onCancel,
1263
+ cancelValue,
1264
+ size = "medium",
1265
+ ...props
1266
+ }, ref) => {
1267
+ (0, import_react4.useEffect)(() => {
1268
+ if (!isOpen || !closeOnEscape) return;
1269
+ const handleEscape = (event) => {
1270
+ if (event.key === "Escape") {
1271
+ onChangeOpen(false);
1272
+ }
1273
+ };
1274
+ document.addEventListener("keydown", handleEscape);
1275
+ return () => document.removeEventListener("keydown", handleEscape);
1276
+ }, [isOpen, closeOnEscape]);
1277
+ (0, import_react4.useEffect)(() => {
1278
+ if (isOpen) {
1279
+ document.body.style.overflow = "hidden";
1280
+ } else {
1281
+ document.body.style.overflow = "unset";
1282
+ }
1283
+ return () => {
1284
+ document.body.style.overflow = "unset";
1285
+ };
1286
+ }, [isOpen]);
1287
+ const handleBackdropClick = (event) => {
1288
+ if (event.target === event.currentTarget && closeOnBackdropClick) {
1289
+ onChangeOpen(false);
1290
+ }
1291
+ };
1292
+ const handleBackdropKeyDown = (event) => {
1293
+ if (event.key === "Escape" && closeOnEscape) {
1294
+ onChangeOpen(false);
1295
+ }
1296
+ };
1297
+ const handleSubmit = () => {
1298
+ onChangeOpen(false);
1299
+ onSubmit?.(submitValue);
1300
+ };
1301
+ const handleCancel = () => {
1302
+ onChangeOpen(false);
1303
+ onCancel?.(cancelValue);
1304
+ };
1305
+ const sizeClasses = SIZE_CLASSES4[size];
1306
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1307
+ "div",
1308
+ {
1309
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",
1310
+ onClick: handleBackdropClick,
1311
+ onKeyDown: handleBackdropKeyDown,
1312
+ "data-testid": "alert-dialog-overlay",
1313
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1314
+ "div",
1315
+ {
1316
+ ref,
1317
+ className: `bg-background border border-border-100 rounded-lg shadow-lg p-6 m-3 ${sizeClasses} ${className}`,
1318
+ ...props,
1319
+ children: [
1320
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1321
+ "h2",
1322
+ {
1323
+ id: "alert-dialog-title",
1324
+ className: "pb-3 text-xl font-semibold text-text-950",
1325
+ children: title
1326
+ }
1327
+ ),
1328
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1329
+ "p",
1330
+ {
1331
+ id: "alert-dialog-description",
1332
+ className: "text-text-700 text-sm",
1333
+ children: description
1334
+ }
1335
+ ),
1336
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-row items-center justify-end pt-4 gap-3", children: [
1337
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button_default, { variant: "outline", size: "small", onClick: handleCancel, children: cancelButtonLabel }),
1338
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1339
+ Button_default,
1340
+ {
1341
+ variant: "solid",
1342
+ size: "small",
1343
+ action: "negative",
1344
+ onClick: handleSubmit,
1345
+ children: submitButtonLabel
1346
+ }
1347
+ )
1348
+ ] })
1349
+ ]
1350
+ }
1351
+ )
1352
+ }
1353
+ ) });
1354
+ }
1355
+ );
1356
+ AlertDialog.displayName = "AlertDialog";
1357
+
1358
+ // src/components/Modal/Modal.tsx
1359
+ var import_react5 = require("react");
1360
+ var import_phosphor_react3 = require("phosphor-react");
1361
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1362
+ var SIZE_CLASSES5 = {
1363
+ xs: "max-w-[360px]",
1364
+ sm: "max-w-[420px]",
1365
+ md: "max-w-[510px]",
1366
+ lg: "max-w-[640px]",
1367
+ xl: "max-w-[970px]"
1368
+ };
1369
+ var Modal = ({
1370
+ isOpen,
1371
+ onClose,
1372
+ title,
1373
+ children,
1374
+ size = "md",
1375
+ className = "",
1376
+ closeOnBackdropClick = true,
1377
+ closeOnEscape = true,
1378
+ footer,
1379
+ hideCloseButton = false
1380
+ }) => {
1381
+ (0, import_react5.useEffect)(() => {
1382
+ if (!isOpen || !closeOnEscape) return;
1383
+ const handleEscape = (event) => {
1384
+ if (event.key === "Escape") {
1385
+ onClose();
1386
+ }
1387
+ };
1388
+ document.addEventListener("keydown", handleEscape);
1389
+ return () => document.removeEventListener("keydown", handleEscape);
1390
+ }, [isOpen, closeOnEscape, onClose]);
1391
+ (0, import_react5.useEffect)(() => {
1392
+ const originalOverflow = document.body.style.overflow;
1393
+ if (isOpen) {
1394
+ document.body.style.overflow = "hidden";
1395
+ } else {
1396
+ document.body.style.overflow = originalOverflow;
1397
+ }
1398
+ return () => {
1399
+ document.body.style.overflow = originalOverflow;
1400
+ };
1401
+ }, [isOpen]);
1402
+ const handleBackdropClick = (event) => {
1403
+ if (closeOnBackdropClick && event.target === event.currentTarget) {
1404
+ onClose();
1405
+ }
1406
+ };
1407
+ const handleBackdropKeyDown = (event) => {
1408
+ if (closeOnBackdropClick && (event.key === "Enter" || event.key === " ")) {
1409
+ onClose();
1410
+ }
1411
+ };
1412
+ if (!isOpen) return null;
1413
+ const sizeClasses = SIZE_CLASSES5[size];
1414
+ const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
1415
+ const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
1416
+ const modalClasses = `${baseClasses} ${sizeClasses} ${dialogResetClasses} ${className}`;
1417
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1418
+ "div",
1419
+ {
1420
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs",
1421
+ onClick: handleBackdropClick,
1422
+ onKeyDown: handleBackdropKeyDown,
1423
+ role: "button",
1424
+ tabIndex: closeOnBackdropClick ? 0 : -1,
1425
+ "aria-label": "Fechar modal clicando no fundo",
1426
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("dialog", { className: modalClasses, "aria-labelledby": "modal-title", open: true, children: [
1427
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between px-6 py-6", children: [
1428
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h2", { id: "modal-title", className: "text-lg font-semibold text-text-950", children: title }),
1429
+ !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1430
+ "button",
1431
+ {
1432
+ onClick: onClose,
1433
+ className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
1434
+ "aria-label": "Fechar modal",
1435
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_phosphor_react3.X, { size: 18 })
1436
+ }
1437
+ )
1438
+ ] }),
1439
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
1440
+ footer && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
1441
+ ] })
1442
+ }
1443
+ );
1444
+ };
1445
+ var Modal_default = Modal;
1446
+
1447
+ // src/assets/img/simulated-result.png
1448
+ var simulated_result_default = "../simulated-result-QN5HCUY5.png";
1449
+
1450
+ // src/components/Select/Select.tsx
1451
+ var import_zustand3 = require("zustand");
1452
+ var import_react6 = require("react");
1453
+ var import_phosphor_react4 = require("phosphor-react");
1454
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1455
+ var VARIANT_CLASSES = {
1456
+ outlined: "border rounded-lg focus:border-primary-950",
1457
+ underlined: "border-b focus:border-primary-950",
1458
+ rounded: "border rounded-full focus:border-primary-950"
1459
+ };
1460
+ var SIZE_CLASSES6 = {
1461
+ small: "text-sm",
1462
+ medium: "text-md",
1463
+ large: "text-lg",
1464
+ "extra-large": "text-lg"
1465
+ };
1466
+ var HEIGHT_CLASSES = {
1467
+ small: "h-8",
1468
+ medium: "h-9",
1469
+ large: "h-10",
1470
+ "extra-large": "h-12"
1471
+ };
1472
+ var PADDING_CLASSES = {
1473
+ small: "px-2 py-1",
1474
+ medium: "px-3 py-2",
1475
+ large: "px-4 py-3",
1476
+ "extra-large": "px-5 py-4"
1477
+ };
1478
+ var SIDE_CLASSES = {
1479
+ top: "bottom-full -translate-y-1",
1480
+ right: "top-full translate-y-1",
1481
+ bottom: "top-full translate-y-1",
1482
+ left: "top-full translate-y-1"
1483
+ };
1484
+ var ALIGN_CLASSES = {
1485
+ start: "left-0",
1486
+ center: "left-1/2 -translate-x-1/2",
1487
+ end: "right-0"
1488
+ };
1489
+ function createSelectStore(onValueChange) {
1490
+ return (0, import_zustand3.create)((set) => ({
1491
+ open: false,
1492
+ setOpen: (open) => set({ open }),
1493
+ value: "",
1494
+ setValue: (value) => set({ value }),
1495
+ selectedLabel: "",
1496
+ setSelectedLabel: (label) => set({ selectedLabel: label }),
1497
+ onValueChange
1498
+ }));
1499
+ }
1500
+ var useSelectStore = (externalStore) => {
1501
+ if (!externalStore) {
1502
+ throw new Error(
1503
+ "Component must be used within a Select (store is missing)"
1504
+ );
1505
+ }
1506
+ return externalStore;
1507
+ };
1508
+ function getLabelAsNode(children) {
1509
+ if (typeof children === "string" || typeof children === "number") {
1510
+ return children;
1511
+ }
1512
+ const flattened = import_react6.Children.toArray(children);
1513
+ if (flattened.length === 1) return flattened[0];
1514
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: flattened });
1515
+ }
1516
+ var injectStore2 = (children, store, size, selectId) => {
1517
+ return import_react6.Children.map(children, (child) => {
1518
+ if ((0, import_react6.isValidElement)(child)) {
1519
+ const typedChild = child;
1520
+ const newProps = {
1521
+ store
1522
+ };
1523
+ if (typedChild.type === SelectTrigger) {
1524
+ newProps.size = size;
1525
+ newProps.selectId = selectId;
1526
+ }
1527
+ if (typedChild.props.children) {
1528
+ newProps.children = injectStore2(
1529
+ typedChild.props.children,
1530
+ store,
1531
+ size,
1532
+ selectId
1533
+ );
1534
+ }
1535
+ return (0, import_react6.cloneElement)(typedChild, newProps);
1536
+ }
1537
+ return child;
1538
+ });
1539
+ };
1540
+ var Select = ({
1541
+ children,
1542
+ defaultValue = "",
1543
+ value: propValue,
1544
+ onValueChange,
1545
+ size = "small",
1546
+ label,
1547
+ helperText,
1548
+ errorMessage,
1549
+ id
1550
+ }) => {
1551
+ const storeRef = (0, import_react6.useRef)(null);
1552
+ storeRef.current ??= createSelectStore(onValueChange);
1553
+ const store = storeRef.current;
1554
+ const selectRef = (0, import_react6.useRef)(null);
1555
+ const { open, setOpen, setValue, selectedLabel } = (0, import_zustand3.useStore)(store, (s) => s);
1556
+ const generatedId = (0, import_react6.useId)();
1557
+ const selectId = id ?? `select-${generatedId}`;
1558
+ const findLabelForValue = (children2, targetValue) => {
1559
+ let found = null;
1560
+ const search = (nodes) => {
1561
+ import_react6.Children.forEach(nodes, (child) => {
1562
+ if (!(0, import_react6.isValidElement)(child)) return;
1563
+ const typedChild = child;
1564
+ if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
1565
+ if (typeof typedChild.props.children === "string")
1566
+ found = typedChild.props.children;
1567
+ }
1568
+ if (typedChild.props.children && !found)
1569
+ search(typedChild.props.children);
1570
+ });
1571
+ };
1572
+ search(children2);
1573
+ return found;
1574
+ };
1575
+ (0, import_react6.useEffect)(() => {
1576
+ if (!selectedLabel && defaultValue) {
1577
+ const label2 = findLabelForValue(children, defaultValue);
1578
+ if (label2) store.setState({ selectedLabel: label2 });
1579
+ }
1580
+ }, [children, defaultValue, selectedLabel]);
1581
+ (0, import_react6.useEffect)(() => {
1582
+ const handleClickOutside = (event) => {
1583
+ if (selectRef.current && !selectRef.current.contains(event.target)) {
1584
+ setOpen(false);
1585
+ }
1586
+ };
1587
+ const handleArrowKeys = (event) => {
1588
+ const selectContent = selectRef.current?.querySelector('[role="menu"]');
1589
+ if (selectContent) {
1590
+ event.preventDefault();
1591
+ const items = Array.from(
1592
+ selectContent.querySelectorAll(
1593
+ '[role="menuitem"]:not([aria-disabled="true"])'
1594
+ )
1595
+ ).filter((el) => el instanceof HTMLElement);
1596
+ const focused = document.activeElement;
1597
+ const currentIndex = items.findIndex((item) => item === focused);
1598
+ let nextIndex = 0;
1599
+ if (event.key === "ArrowDown") {
1600
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
1601
+ } else {
1602
+ nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
1603
+ }
1604
+ items[nextIndex]?.focus();
1605
+ }
1606
+ };
1607
+ if (open) {
1608
+ document.addEventListener("mousedown", handleClickOutside);
1609
+ document.addEventListener("keydown", handleArrowKeys);
1610
+ }
1611
+ return () => {
1612
+ document.removeEventListener("mousedown", handleClickOutside);
1613
+ document.removeEventListener("keydown", handleArrowKeys);
1614
+ };
1615
+ }, [open]);
1616
+ (0, import_react6.useEffect)(() => {
1617
+ if (propValue) {
1618
+ setValue(propValue);
1619
+ const label2 = findLabelForValue(children, propValue);
1620
+ if (label2) store.setState({ selectedLabel: label2 });
1621
+ }
1622
+ }, [propValue]);
1623
+ const sizeClasses = SIZE_CLASSES6[size];
1624
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w-full", children: [
1625
+ label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1626
+ "label",
1627
+ {
1628
+ htmlFor: selectId,
1629
+ className: `block font-bold text-text-900 mb-1.5 ${sizeClasses}`,
1630
+ children: label
1631
+ }
1632
+ ),
1633
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `relative ${sizeClasses}`, ref: selectRef, children: injectStore2(children, store, size, selectId) }),
1634
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mt-1.5 gap-1.5", children: [
1635
+ helperText && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm text-text-500", children: helperText }),
1636
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
1637
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.WarningCircle, { size: 16 }),
1638
+ " ",
1639
+ errorMessage
1640
+ ] })
1641
+ ] })
1642
+ ] });
1643
+ };
1644
+ var SelectValue = ({
1645
+ placeholder,
1646
+ store: externalStore
1647
+ }) => {
1648
+ const store = useSelectStore(externalStore);
1649
+ const selectedLabel = (0, import_zustand3.useStore)(store, (s) => s.selectedLabel);
1650
+ const value = (0, import_zustand3.useStore)(store, (s) => s.value);
1651
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
1652
+ };
1653
+ var SelectTrigger = (0, import_react6.forwardRef)(
1654
+ ({
1655
+ className,
1656
+ invalid = false,
1657
+ variant = "outlined",
1658
+ store: externalStore,
1659
+ disabled,
1660
+ size = "medium",
1661
+ selectId,
1662
+ ...props
1663
+ }, ref) => {
1664
+ const store = useSelectStore(externalStore);
1665
+ const open = (0, import_zustand3.useStore)(store, (s) => s.open);
1666
+ const toggleOpen = () => store.setState({ open: !open });
1667
+ const variantClasses = VARIANT_CLASSES[variant];
1668
+ const heightClasses = HEIGHT_CLASSES[size];
1669
+ const paddingClasses = PADDING_CLASSES[size];
1670
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1671
+ "button",
1672
+ {
1673
+ ref,
1674
+ id: selectId,
1675
+ className: `
1676
+ flex min-w-[220px] w-full items-center justify-between border-border-300
1677
+ ${heightClasses} ${paddingClasses}
1678
+ ${invalid && `${variant == "underlined" ? "border-b-2" : "border-2"} border-indicator-error text-text-600`}
1679
+ ${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
1680
+ ${!invalid && !disabled ? "text-text-700" : ""}
1681
+ ${variantClasses}
1682
+ ${className}
1683
+ `,
1684
+ onClick: toggleOpen,
1685
+ "aria-expanded": open,
1686
+ "aria-haspopup": "listbox",
1687
+ "aria-controls": open ? "select-content" : void 0,
1688
+ ...props,
1689
+ children: [
1690
+ props.children,
1691
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1692
+ import_phosphor_react4.CaretDown,
1693
+ {
1694
+ className: `h-[1em] w-[1em] opacity-50 transition-transform ${open ? "rotate-180" : ""}`
1695
+ }
1696
+ )
1697
+ ]
1698
+ }
1699
+ );
1700
+ }
1701
+ );
1702
+ SelectTrigger.displayName = "SelectTrigger";
1703
+ var SelectContent = (0, import_react6.forwardRef)(
1704
+ ({
1705
+ children,
1706
+ className,
1707
+ align = "start",
1708
+ side = "bottom",
1709
+ store: externalStore,
1710
+ ...props
1711
+ }, ref) => {
1712
+ const store = useSelectStore(externalStore);
1713
+ const open = (0, import_zustand3.useStore)(store, (s) => s.open);
1714
+ if (!open) return null;
1715
+ const getPositionClasses = () => `w-full min-w-full absolute ${SIDE_CLASSES[side]} ${ALIGN_CLASSES[align]}`;
1716
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1717
+ "div",
1718
+ {
1719
+ role: "menu",
1720
+ ref,
1721
+ className: `bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border-100 ${getPositionClasses()} ${className}`,
1722
+ ...props,
1723
+ children
1724
+ }
1725
+ );
1726
+ }
1727
+ );
1728
+ SelectContent.displayName = "SelectContent";
1729
+ var SelectItem = (0, import_react6.forwardRef)(
1730
+ ({
1731
+ className,
1732
+ children,
1733
+ value,
1734
+ disabled = false,
1735
+ store: externalStore,
1736
+ ...props
1737
+ }, ref) => {
1738
+ const store = useSelectStore(externalStore);
1739
+ const {
1740
+ value: selectedValue,
1741
+ setValue,
1742
+ setOpen,
1743
+ setSelectedLabel,
1744
+ onValueChange
1745
+ } = (0, import_zustand3.useStore)(store, (s) => s);
1746
+ const handleClick = (e) => {
1747
+ const labelNode = getLabelAsNode(children);
1748
+ if (!disabled) {
1749
+ setValue(value);
1750
+ setSelectedLabel(labelNode);
1751
+ setOpen(false);
1752
+ onValueChange?.(value);
1753
+ }
1754
+ props.onClick?.(e);
1755
+ };
1756
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1757
+ "div",
1758
+ {
1759
+ role: "menuitem",
1760
+ "aria-disabled": disabled,
1761
+ ref,
1762
+ className: `
1763
+ focus-visible:bg-background-50
1764
+ relative flex select-none items-center gap-2 rounded-sm p-3 outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
1765
+ ${className}
1766
+ ${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
1767
+ ${selectedValue === value && "bg-background-50"}
1768
+ `,
1769
+ onClick: handleClick,
1770
+ onKeyDown: (e) => {
1771
+ if (e.key === "Enter" || e.key === " ") handleClick(e);
1772
+ },
1773
+ tabIndex: disabled ? -1 : 0,
1774
+ ...props,
1775
+ children: [
1776
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.Check, { className: "" }) }),
1777
+ children
1778
+ ]
1779
+ }
1780
+ );
1781
+ }
1782
+ );
1783
+ SelectItem.displayName = "SelectItem";
1784
+ var Select_default = Select;
1785
+
1786
+ // src/components/Card/Card.tsx
1787
+ var import_react7 = require("react");
1788
+
1789
+ // src/components/ProgressBar/ProgressBar.tsx
1790
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1791
+ var SIZE_CLASSES7 = {
1792
+ small: {
1793
+ container: "h-1",
1794
+ // 4px height (h-1 = 4px in Tailwind)
1795
+ bar: "h-1",
1796
+ // 4px height for the fill bar
1797
+ spacing: "gap-2",
1798
+ // 8px gap between label and progress bar
1799
+ layout: "flex-col",
1800
+ // vertical layout for small
1801
+ borderRadius: "rounded-full"
1802
+ // 9999px border radius
1803
+ },
1804
+ medium: {
1805
+ container: "h-2",
1806
+ // 8px height (h-2 = 8px in Tailwind)
1807
+ bar: "h-2",
1808
+ // 8px height for the fill bar
1809
+ spacing: "gap-2",
1810
+ // 8px gap between progress bar and label
1811
+ layout: "flex-row items-center",
1812
+ // horizontal layout for medium
1813
+ borderRadius: "rounded-lg"
1814
+ // 8px border radius
1815
+ }
1816
+ };
1817
+ var VARIANT_CLASSES2 = {
1818
+ blue: {
1819
+ background: "bg-background-300",
1820
+ // Background track color (#D5D4D4)
1821
+ fill: "bg-primary-700"
1822
+ // Blue for activity progress (#2271C4)
1823
+ },
1824
+ green: {
1825
+ background: "bg-background-300",
1826
+ // Background track color (#D5D4D4)
1827
+ fill: "bg-success-200"
1828
+ // Green for performance (#84D3A2)
1829
+ }
1830
+ };
1831
+ var calculateProgressValues = (value, max) => {
1832
+ const safeValue = isNaN(value) ? 0 : value;
1833
+ const clampedValue = Math.max(0, Math.min(safeValue, max));
1834
+ const percentage = max === 0 ? 0 : clampedValue / max * 100;
1835
+ return { clampedValue, percentage };
1836
+ };
1837
+ var shouldShowHeader = (label, showPercentage, showHitCount) => {
1838
+ return !!(label || showPercentage || showHitCount);
1839
+ };
1840
+ var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
1841
+ if (showHitCount) {
1842
+ return {
1843
+ type: "hitCount",
1844
+ content: `${Math.round(clampedValue)} de ${max}`,
1845
+ hasMetrics: true
1846
+ };
1847
+ }
1848
+ if (showPercentage) {
1849
+ return {
1850
+ type: "percentage",
1851
+ content: `${Math.round(percentage)}%`,
1852
+ hasMetrics: true
1853
+ };
1854
+ }
1855
+ return {
1856
+ type: "label",
1857
+ content: label,
1858
+ hasMetrics: false
1859
+ };
1860
+ };
1861
+ var getCompactLayoutConfig = ({
1862
+ showPercentage,
1863
+ showHitCount,
1864
+ percentage,
1865
+ clampedValue,
1866
+ max,
1867
+ label,
1868
+ percentageClassName,
1869
+ labelClassName
1870
+ }) => {
1871
+ const displayPriority = getDisplayPriority(
1872
+ showHitCount,
1873
+ showPercentage,
1874
+ label,
1875
+ clampedValue,
1876
+ max,
1877
+ percentage
1878
+ );
1879
+ return {
1880
+ color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
1881
+ className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
1882
+ content: displayPriority.content
1883
+ };
1884
+ };
1885
+ var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
1886
+ showHeader: size === "small" && !!(label || showPercentage),
1887
+ showPercentage: size === "medium" && showPercentage,
1888
+ showLabel: size === "medium" && !!label && !showPercentage
1889
+ // Only show label when percentage is not shown
1890
+ });
1891
+ var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
1892
+ if (!showHitCount && !showPercentage) return null;
1893
+ const displayPriority = getDisplayPriority(
1894
+ showHitCount,
1895
+ showPercentage,
1896
+ null,
1897
+ // label is not relevant for stacked layout metrics display
1898
+ clampedValue,
1899
+ max,
1900
+ percentage
1901
+ );
1902
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1903
+ "div",
1904
+ {
1905
+ className: `text-xs font-medium leading-[14px] text-right ${percentageClassName}`,
1906
+ children: displayPriority.type === "hitCount" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1907
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-success-200", children: Math.round(clampedValue) }),
1908
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-text-600", children: [
1909
+ " de ",
1910
+ max
1911
+ ] })
1912
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
1913
+ Math.round(percentage),
1914
+ "%"
1915
+ ] })
1916
+ }
1917
+ );
1918
+ };
1919
+ var ProgressBarBase = ({
1920
+ clampedValue,
1921
+ max,
1922
+ percentage,
1923
+ label,
1924
+ variantClasses,
1925
+ containerClassName,
1926
+ fillClassName
1927
+ }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1928
+ "div",
1929
+ {
1930
+ className: `${containerClassName} ${variantClasses.background} overflow-hidden relative`,
1931
+ children: [
1932
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1933
+ "progress",
1934
+ {
1935
+ value: clampedValue,
1936
+ max,
1937
+ "aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
1938
+ className: "absolute inset-0 w-full h-full opacity-0"
1939
+ }
1940
+ ),
1941
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1942
+ "div",
1943
+ {
1944
+ className: `${fillClassName} ${variantClasses.fill} transition-all duration-300 ease-out`,
1945
+ style: { width: `${percentage}%` }
1946
+ }
1947
+ )
1948
+ ]
1949
+ }
1950
+ );
1951
+ var StackedLayout = ({
1952
+ className,
1953
+ label,
1954
+ showPercentage,
1955
+ showHitCount,
1956
+ labelClassName,
1957
+ percentageClassName,
1958
+ clampedValue,
1959
+ max,
1960
+ percentage,
1961
+ variantClasses,
1962
+ dimensions
1963
+ }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1964
+ "div",
1965
+ {
1966
+ className: `flex flex-col items-start gap-2 ${dimensions.width} ${dimensions.height} ${className}`,
1967
+ children: [
1968
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
1969
+ label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1970
+ Text_default,
1971
+ {
1972
+ as: "div",
1973
+ size: "md",
1974
+ weight: "medium",
1975
+ className: `text-text-600 leading-[19px] ${labelClassName}`,
1976
+ children: label
1977
+ }
1978
+ ),
1979
+ renderStackedHitCountDisplay(
1980
+ showHitCount,
1981
+ showPercentage,
1982
+ clampedValue,
1983
+ max,
1984
+ percentage,
1985
+ percentageClassName
1986
+ )
1987
+ ] }),
1988
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1989
+ ProgressBarBase,
1990
+ {
1991
+ clampedValue,
1992
+ max,
1993
+ percentage,
1994
+ label,
1995
+ variantClasses,
1996
+ containerClassName: "w-full h-2 rounded-lg",
1997
+ fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
1998
+ }
1999
+ )
2000
+ ]
2001
+ }
2002
+ );
2003
+ var CompactLayout = ({
2004
+ className,
2005
+ label,
2006
+ showPercentage,
2007
+ showHitCount,
2008
+ labelClassName,
2009
+ percentageClassName,
2010
+ clampedValue,
2011
+ max,
2012
+ percentage,
2013
+ variantClasses,
2014
+ dimensions
2015
+ }) => {
2016
+ const {
2017
+ color,
2018
+ className: compactClassName,
2019
+ content
2020
+ } = getCompactLayoutConfig({
2021
+ showPercentage,
2022
+ showHitCount,
2023
+ percentage,
2024
+ clampedValue,
2025
+ max,
2026
+ label,
2027
+ percentageClassName,
2028
+ labelClassName
2029
+ });
2030
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2031
+ "div",
2032
+ {
2033
+ className: `flex flex-col items-start gap-1 ${dimensions.width} ${dimensions.height} ${className}`,
2034
+ children: [
2035
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2036
+ Text_default,
2037
+ {
2038
+ as: "div",
2039
+ size: "sm",
2040
+ weight: "medium",
2041
+ color,
2042
+ className: `leading-4 w-full ${compactClassName}`,
2043
+ children: content
2044
+ }
2045
+ ),
2046
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2047
+ ProgressBarBase,
2048
+ {
2049
+ clampedValue,
2050
+ max,
2051
+ percentage,
2052
+ label,
2053
+ variantClasses,
2054
+ containerClassName: "w-full h-1 rounded-full",
2055
+ fillClassName: "h-1 rounded-full"
2056
+ }
2057
+ )
2058
+ ]
2059
+ }
2060
+ );
2061
+ };
2062
+ var DefaultLayout = ({
2063
+ className,
2064
+ size,
2065
+ sizeClasses,
2066
+ variantClasses,
2067
+ label,
2068
+ showPercentage,
2069
+ labelClassName,
2070
+ percentageClassName,
2071
+ clampedValue,
2072
+ max,
2073
+ percentage
2074
+ }) => {
2075
+ const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
2076
+ const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
2077
+ const displayConfig = getDefaultLayoutDisplayConfig(
2078
+ size,
2079
+ label,
2080
+ showPercentage
2081
+ );
2082
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `flex ${sizeClasses.layout} ${gapClass} ${className}`, children: [
2083
+ displayConfig.showHeader && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
2084
+ label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2085
+ Text_default,
2086
+ {
2087
+ as: "div",
2088
+ size: "xs",
2089
+ weight: "medium",
2090
+ className: `text-text-950 leading-none tracking-normal text-center ${labelClassName}`,
2091
+ children: label
2092
+ }
2093
+ ),
2094
+ showPercentage && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2095
+ Text_default,
2096
+ {
2097
+ size: "xs",
2098
+ weight: "medium",
2099
+ className: `text-text-950 leading-none tracking-normal text-center ${percentageClassName}`,
2100
+ children: [
2101
+ Math.round(percentage),
2102
+ "%"
2103
+ ]
2104
+ }
2105
+ )
2106
+ ] }),
2107
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2108
+ ProgressBarBase,
2109
+ {
2110
+ clampedValue,
2111
+ max,
2112
+ percentage,
2113
+ label,
2114
+ variantClasses,
2115
+ containerClassName: `${progressBarClass} ${sizeClasses.container} ${sizeClasses.borderRadius}`,
2116
+ fillClassName: `${sizeClasses.bar} ${sizeClasses.borderRadius} shadow-hard-shadow-3`
2117
+ }
2118
+ ),
2119
+ displayConfig.showPercentage && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2120
+ Text_default,
2121
+ {
2122
+ size: "xs",
2123
+ weight: "medium",
2124
+ className: `text-text-950 leading-none tracking-normal text-center flex-none ${percentageClassName}`,
2125
+ children: [
2126
+ Math.round(percentage),
2127
+ "%"
2128
+ ]
2129
+ }
2130
+ ),
2131
+ displayConfig.showLabel && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2132
+ Text_default,
2133
+ {
2134
+ as: "div",
2135
+ size: "xs",
2136
+ weight: "medium",
2137
+ className: `text-text-950 leading-none tracking-normal text-center flex-none ${labelClassName}`,
2138
+ children: label
2139
+ }
2140
+ )
2141
+ ] });
2142
+ };
2143
+ var ProgressBar = ({
2144
+ value,
2145
+ max = 100,
2146
+ size = "medium",
2147
+ variant = "blue",
2148
+ layout = "default",
2149
+ label,
2150
+ showPercentage = false,
2151
+ showHitCount = false,
2152
+ className = "",
2153
+ labelClassName = "",
2154
+ percentageClassName = "",
2155
+ stackedWidth,
2156
+ stackedHeight,
2157
+ compactWidth,
2158
+ compactHeight
2159
+ }) => {
2160
+ const { clampedValue, percentage } = calculateProgressValues(value, max);
2161
+ const sizeClasses = SIZE_CLASSES7[size];
2162
+ const variantClasses = VARIANT_CLASSES2[variant];
2163
+ if (layout === "stacked") {
2164
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2165
+ StackedLayout,
2166
+ {
2167
+ className,
2168
+ label,
2169
+ showPercentage,
2170
+ showHitCount,
2171
+ labelClassName,
2172
+ percentageClassName,
2173
+ clampedValue,
2174
+ max,
2175
+ percentage,
2176
+ variantClasses,
2177
+ dimensions: {
2178
+ width: stackedWidth ?? "w-[380px]",
2179
+ height: stackedHeight ?? "h-[35px]"
2180
+ }
2181
+ }
2182
+ );
2183
+ }
2184
+ if (layout === "compact") {
2185
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2186
+ CompactLayout,
2187
+ {
2188
+ className,
2189
+ label,
2190
+ showPercentage,
2191
+ showHitCount,
2192
+ labelClassName,
2193
+ percentageClassName,
2194
+ clampedValue,
2195
+ max,
2196
+ percentage,
2197
+ variantClasses,
2198
+ dimensions: {
2199
+ width: compactWidth ?? "w-[131px]",
2200
+ height: compactHeight ?? "h-[24px]"
2201
+ }
2202
+ }
2203
+ );
2204
+ }
2205
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2206
+ DefaultLayout,
2207
+ {
2208
+ className,
2209
+ size,
2210
+ sizeClasses,
2211
+ variantClasses,
2212
+ label,
2213
+ showPercentage,
2214
+ labelClassName,
2215
+ percentageClassName,
2216
+ clampedValue,
2217
+ max,
2218
+ percentage
2219
+ }
2220
+ );
2221
+ };
2222
+ var ProgressBar_default = ProgressBar;
2223
+
2224
+ // src/components/Card/Card.tsx
2225
+ var import_phosphor_react5 = require("phosphor-react");
2226
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2227
+ var CARD_BASE_CLASSES = {
2228
+ default: "w-full bg-background border border-border-50 rounded-xl",
2229
+ compact: "w-full bg-background border border-border-50 rounded-lg",
2230
+ minimal: "w-full bg-background border border-border-100 rounded-md"
2231
+ };
2232
+ var CARD_PADDING_CLASSES = {
2233
+ none: "",
2234
+ small: "p-2",
2235
+ medium: "p-4",
2236
+ large: "p-6"
2237
+ };
2238
+ var CARD_MIN_HEIGHT_CLASSES = {
2239
+ none: "",
2240
+ small: "min-h-16",
2241
+ medium: "min-h-20",
2242
+ large: "min-h-24"
2243
+ };
2244
+ var CARD_LAYOUT_CLASSES = {
2245
+ horizontal: "flex flex-row",
2246
+ vertical: "flex flex-col"
2247
+ };
2248
+ var CARD_CURSOR_CLASSES = {
2249
+ default: "",
2250
+ pointer: "cursor-pointer"
2251
+ };
2252
+ var CardBase = (0, import_react7.forwardRef)(
2253
+ ({
2254
+ children,
2255
+ variant = "default",
2256
+ layout = "horizontal",
2257
+ padding = "medium",
2258
+ minHeight = "medium",
2259
+ cursor = "default",
2260
+ className = "",
2261
+ ...props
2262
+ }, ref) => {
2263
+ const baseClasses = CARD_BASE_CLASSES[variant];
2264
+ const paddingClasses = CARD_PADDING_CLASSES[padding];
2265
+ const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
2266
+ const layoutClasses = CARD_LAYOUT_CLASSES[layout];
2267
+ const cursorClasses = CARD_CURSOR_CLASSES[cursor];
2268
+ const combinedClasses = [
2269
+ baseClasses,
2270
+ paddingClasses,
2271
+ minHeightClasses,
2272
+ layoutClasses,
2273
+ cursorClasses,
2274
+ className
2275
+ ].filter(Boolean).join(" ");
2276
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, className: combinedClasses, ...props, children });
2277
+ }
2278
+ );
2279
+ var ACTION_CARD_CLASSES = {
2280
+ warning: "bg-warning-background",
2281
+ success: "bg-success-300",
2282
+ error: "bg-error-100",
2283
+ info: "bg-info-background"
2284
+ };
2285
+ var ACTION_ICON_CLASSES = {
2286
+ warning: "bg-warning-300 text-text",
2287
+ success: "bg-yellow-300 text-text-950",
2288
+ error: "bg-error-500 text-text",
2289
+ info: "bg-info-500 text-text"
2290
+ };
2291
+ var ACTION_SUBTITLE_CLASSES = {
2292
+ warning: "text-warning-600",
2293
+ success: "text-success-700",
2294
+ error: "text-error-700",
2295
+ info: "text-info-700"
2296
+ };
2297
+ var ACTION_HEADER_CLASSES = {
2298
+ warning: "text-warning-300",
2299
+ success: "text-success-300",
2300
+ error: "text-error-300",
2301
+ info: "text-info-300"
2302
+ };
2303
+ var CardActivitiesResults = (0, import_react7.forwardRef)(
2304
+ ({
2305
+ icon,
2306
+ title,
2307
+ subTitle,
2308
+ header,
2309
+ extended = false,
2310
+ action = "success",
2311
+ description,
2312
+ className,
2313
+ ...props
2314
+ }, ref) => {
2315
+ const actionCardClasses = ACTION_CARD_CLASSES[action];
2316
+ const actionIconClasses = ACTION_ICON_CLASSES[action];
2317
+ const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
2318
+ const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
2319
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2320
+ "div",
2321
+ {
2322
+ ref,
2323
+ className: `w-full flex flex-col border border-border-50 bg-background rounded-xl ${className}`,
2324
+ ...props,
2325
+ children: [
2326
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2327
+ "div",
2328
+ {
2329
+ className: `
2330
+ flex flex-col gap-1 items-center justify-center p-4
2331
+ ${actionCardClasses}
2332
+ ${extended ? "rounded-t-xl" : "rounded-xl"}`,
2333
+ children: [
2334
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2335
+ "span",
2336
+ {
2337
+ className: `size-7.5 rounded-full flex items-center justify-center ${actionIconClasses}`,
2338
+ children: icon
2339
+ }
2340
+ ),
2341
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2342
+ Text_default,
2343
+ {
2344
+ size: "2xs",
2345
+ weight: "medium",
2346
+ className: "text-text-800 uppercase truncate",
2347
+ children: title
2348
+ }
2349
+ ),
2350
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: `text-lg font-bold truncate ${actionSubTitleClasses}`, children: subTitle })
2351
+ ]
2352
+ }
2353
+ ),
2354
+ extended && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
2355
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2356
+ "p",
2357
+ {
2358
+ className: `text-2xs font-medium uppercase truncate ${actionHeaderClasses}`,
2359
+ children: header
2360
+ }
2361
+ ),
2362
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Badge_default, { size: "large", action: "info", children: description })
2363
+ ] })
2364
+ ]
2365
+ }
2366
+ );
2367
+ }
2368
+ );
2369
+ var CardQuestions = (0, import_react7.forwardRef)(
2370
+ ({
2371
+ header,
2372
+ state = "undone",
2373
+ className,
2374
+ onClickButton,
2375
+ valueButton,
2376
+ ...props
2377
+ }, ref) => {
2378
+ const isDone = state === "done";
2379
+ const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
2380
+ const buttonLabel = isDone ? "Ver Quest\xE3o" : "Responder";
2381
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2382
+ CardBase,
2383
+ {
2384
+ ref,
2385
+ layout: "horizontal",
2386
+ padding: "medium",
2387
+ minHeight: "medium",
2388
+ className: `justify-between gap-4 ${className}`,
2389
+ ...props,
2390
+ children: [
2391
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
2392
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "font-bold text-xs text-text-950 truncate", children: header }),
2393
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row gap-6 items-center", children: [
2394
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2395
+ Badge_default,
2396
+ {
2397
+ size: "medium",
2398
+ variant: "solid",
2399
+ action: isDone ? "success" : "error",
2400
+ children: stateLabel
2401
+ }
2402
+ ),
2403
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex flex-row items-center gap-1 text-text-700 text-xs", children: [
2404
+ isDone ? "Nota" : "Sem nota",
2405
+ isDone && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Badge_default, { size: "medium", action: "success", children: "00" })
2406
+ ] })
2407
+ ] })
2408
+ ] }),
2409
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2410
+ Button_default,
2411
+ {
2412
+ size: "extra-small",
2413
+ onClick: () => onClickButton?.(valueButton),
2414
+ className: "min-w-fit",
2415
+ children: buttonLabel
2416
+ }
2417
+ ) })
2418
+ ]
2419
+ }
2420
+ );
2421
+ }
2422
+ );
2423
+ var CardProgress = (0, import_react7.forwardRef)(
2424
+ ({
2425
+ header,
2426
+ subhead,
2427
+ initialDate,
2428
+ endDate,
2429
+ progress = 0,
2430
+ direction = "horizontal",
2431
+ icon,
2432
+ color = "#B7DFFF",
2433
+ progressVariant = "blue",
2434
+ showDates = true,
2435
+ className,
2436
+ ...props
2437
+ }, ref) => {
2438
+ const isHorizontal = direction === "horizontal";
2439
+ const contentComponent = {
2440
+ horizontal: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
2441
+ showDates && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row gap-6 items-center", children: [
2442
+ initialDate && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
2443
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
2444
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-text-600", children: initialDate })
2445
+ ] }),
2446
+ endDate && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
2447
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-text-800 font-semibold", children: "Fim" }),
2448
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-text-600", children: endDate })
2449
+ ] })
2450
+ ] }),
2451
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
2452
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2453
+ ProgressBar_default,
2454
+ {
2455
+ size: "small",
2456
+ value: progress,
2457
+ variant: progressVariant,
2458
+ "data-testid": "progress-bar"
2459
+ }
2460
+ ),
2461
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2462
+ Text_default,
2463
+ {
2464
+ size: "xs",
2465
+ weight: "medium",
2466
+ className: `text-text-950 leading-none tracking-normal text-center flex-none`,
2467
+ children: [
2468
+ Math.round(progress),
2469
+ "%"
2470
+ ]
2471
+ }
2472
+ )
2473
+ ] })
2474
+ ] }),
2475
+ vertical: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm text-text-800", children: subhead })
2476
+ };
2477
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2478
+ CardBase,
2479
+ {
2480
+ ref,
2481
+ layout: isHorizontal ? "horizontal" : "vertical",
2482
+ padding: "none",
2483
+ minHeight: "medium",
2484
+ cursor: "pointer",
2485
+ className: `${isHorizontal ? "h-20" : ""} ${className}`,
2486
+ ...props,
2487
+ children: [
2488
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2489
+ "div",
2490
+ {
2491
+ className: `
2492
+ flex justify-center items-center [&>svg]:size-6 text-text-950
2493
+ ${isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl"}
2494
+ ${!color.startsWith("#") ? `bg-${color}` : ""}
2495
+ `,
2496
+ style: color.startsWith("#") ? { backgroundColor: color } : void 0,
2497
+ "data-testid": "icon-container",
2498
+ children: icon
2499
+ }
2500
+ ),
2501
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2502
+ "div",
2503
+ {
2504
+ className: `
2505
+ p-4 flex flex-col justify-between w-full h-full
2506
+ ${!isHorizontal && "gap-4"}
2507
+ `,
2508
+ children: [
2509
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
2510
+ contentComponent[direction]
2511
+ ]
2512
+ }
2513
+ )
2514
+ ]
2515
+ }
2516
+ );
2517
+ }
2518
+ );
2519
+ var CardTopic = (0, import_react7.forwardRef)(
2520
+ ({
2521
+ header,
2522
+ subHead,
2523
+ progress,
2524
+ showPercentage = false,
2525
+ progressVariant = "blue",
2526
+ className = "",
2527
+ ...props
2528
+ }, ref) => {
2529
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2530
+ CardBase,
2531
+ {
2532
+ ref,
2533
+ layout: "vertical",
2534
+ padding: "small",
2535
+ minHeight: "medium",
2536
+ cursor: "pointer",
2537
+ className: `justify-center gap-2 py-2 px-4 ${className}`,
2538
+ ...props,
2539
+ children: [
2540
+ subHead && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react7.Fragment, { children: [
2541
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: text }),
2542
+ index < subHead.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: "\u2022" })
2543
+ ] }, `${text} - ${index}`)) }),
2544
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
2545
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
2546
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2547
+ ProgressBar_default,
2548
+ {
2549
+ size: "small",
2550
+ value: progress,
2551
+ variant: progressVariant,
2552
+ "data-testid": "progress-bar"
2553
+ }
2554
+ ),
2555
+ showPercentage && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2556
+ Text_default,
2557
+ {
2558
+ size: "xs",
2559
+ weight: "medium",
2560
+ className: `text-text-950 leading-none tracking-normal text-center flex-none`,
2561
+ children: [
2562
+ Math.round(progress),
2563
+ "%"
2564
+ ]
2565
+ }
2566
+ )
2567
+ ] })
2568
+ ]
2569
+ }
2570
+ );
2571
+ }
2572
+ );
2573
+ var CardPerformance = (0, import_react7.forwardRef)(
2574
+ ({
2575
+ header,
2576
+ progress,
2577
+ description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
2578
+ actionVariant = "button",
2579
+ progressVariant = "blue",
2580
+ labelProgress = "",
2581
+ className = "",
2582
+ onClickButton,
2583
+ valueButton,
2584
+ ...props
2585
+ }, ref) => {
2586
+ const hasProgress = progress !== void 0;
2587
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2588
+ CardBase,
2589
+ {
2590
+ ref,
2591
+ layout: "horizontal",
2592
+ padding: "medium",
2593
+ minHeight: "none",
2594
+ className: `justify-between gap-2 ${actionVariant == "caret" ? "cursor-pointer" : ""} ${className}`,
2595
+ onClick: () => actionVariant == "caret" && onClickButton?.(valueButton),
2596
+ ...props,
2597
+ children: [
2598
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w-full flex flex-col justify-between gap-2", children: [
2599
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row justify-between items-center gap-2", children: [
2600
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-lg font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
2601
+ actionVariant === "button" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2602
+ Button_default,
2603
+ {
2604
+ variant: "outline",
2605
+ size: "extra-small",
2606
+ onClick: () => onClickButton?.(valueButton),
2607
+ className: "min-w-fit flex-shrink-0",
2608
+ children: "Ver Aula"
2609
+ }
2610
+ )
2611
+ ] }),
2612
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2613
+ ProgressBar_default,
2614
+ {
2615
+ value: progress,
2616
+ label: `${progress}% ${labelProgress}`,
2617
+ variant: progressVariant
2618
+ }
2619
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-xs text-text-600 truncate", children: description }) })
2620
+ ] }),
2621
+ actionVariant == "caret" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2622
+ import_phosphor_react5.CaretRight,
2623
+ {
2624
+ className: "size-4.5 text-text-800 cursor-pointer",
2625
+ "data-testid": "caret-icon"
2626
+ }
2627
+ )
2628
+ ]
2629
+ }
2630
+ );
2631
+ }
2632
+ );
2633
+ var CardResults = (0, import_react7.forwardRef)(
2634
+ ({
2635
+ header,
2636
+ correct_answers,
2637
+ incorrect_answers,
2638
+ icon,
2639
+ direction = "col",
2640
+ color = "#B7DFFF",
2641
+ className,
2642
+ ...props
2643
+ }, ref) => {
2644
+ const isRow = direction == "row";
2645
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2646
+ CardBase,
2647
+ {
2648
+ ref,
2649
+ layout: "horizontal",
2650
+ padding: "none",
2651
+ minHeight: "medium",
2652
+ className: `items-center cursor-pointer pr-4 ${className}`,
2653
+ ...props,
2654
+ children: [
2655
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2656
+ "div",
2657
+ {
2658
+ className: `
2659
+ flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-20 h-full rounded-l-xl
2660
+ `,
2661
+ style: {
2662
+ backgroundColor: color
2663
+ },
2664
+ children: icon
2665
+ }
2666
+ ),
2667
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2668
+ "div",
2669
+ {
2670
+ className: `
2671
+ p-4 flex justify-between w-full h-full
2672
+ ${isRow ? "flex-row items-center gap-2" : "flex-col"}
2673
+ `,
2674
+ children: [
2675
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
2676
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex flex-row gap-1 items-center", children: [
2677
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2678
+ Badge_default,
2679
+ {
2680
+ action: "success",
2681
+ variant: "solid",
2682
+ size: "large",
2683
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.CheckCircle, {}),
2684
+ children: [
2685
+ correct_answers,
2686
+ " Corretas"
2687
+ ]
2688
+ }
2689
+ ),
2690
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2691
+ Badge_default,
2692
+ {
2693
+ action: "error",
2694
+ variant: "solid",
2695
+ size: "large",
2696
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.XCircle, {}),
2697
+ children: [
2698
+ incorrect_answers,
2699
+ " Incorretas"
2700
+ ]
2701
+ }
2702
+ )
2703
+ ] })
2704
+ ]
2705
+ }
2706
+ ),
2707
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
2708
+ ]
2709
+ }
2710
+ );
2711
+ }
2712
+ );
2713
+ var CardStatus = (0, import_react7.forwardRef)(
2714
+ ({ header, className, status, label, ...props }, ref) => {
2715
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2716
+ CardBase,
2717
+ {
2718
+ ref,
2719
+ layout: "horizontal",
2720
+ padding: "medium",
2721
+ minHeight: "medium",
2722
+ className: `items-center cursor-pointer ${className}`,
2723
+ ...props,
2724
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
2725
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
2726
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
2727
+ status && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2728
+ Badge_default,
2729
+ {
2730
+ action: status == "correct" ? "success" : "error",
2731
+ variant: "solid",
2732
+ size: "medium",
2733
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.CheckCircle, {}),
2734
+ children: status == "correct" ? "Correta" : "Incorreta"
2735
+ }
2736
+ ),
2737
+ label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm text-text-800", children: label })
2738
+ ] }),
2739
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
2740
+ ] })
2741
+ }
2742
+ );
2743
+ }
2744
+ );
2745
+ var CardSettings = (0, import_react7.forwardRef)(
2746
+ ({ header, className, icon, ...props }, ref) => {
2747
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2748
+ CardBase,
2749
+ {
2750
+ ref,
2751
+ layout: "horizontal",
2752
+ padding: "small",
2753
+ minHeight: "none",
2754
+ className: `border-none items-center gap-2 text-text-700 ${className}`,
2755
+ ...props,
2756
+ children: [
2757
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "[&>svg]:size-6", children: icon }),
2758
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "w-full text-sm truncate", children: header }),
2759
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.CaretRight, { size: 24, className: "cursor-pointer" })
2760
+ ]
2761
+ }
2762
+ );
2763
+ }
2764
+ );
2765
+ var CardSupport = (0, import_react7.forwardRef)(
2766
+ ({ header, className, direction = "col", children, ...props }, ref) => {
2767
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2768
+ CardBase,
2769
+ {
2770
+ ref,
2771
+ layout: "horizontal",
2772
+ padding: "medium",
2773
+ minHeight: "none",
2774
+ className: `border-none items-center gap-2 text-text-700 ${className}`,
2775
+ ...props,
2776
+ children: [
2777
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2778
+ "div",
2779
+ {
2780
+ className: `
2781
+ w-full flex ${direction == "col" ? "flex-col" : "flex-row items-center"} gap-2
2782
+ `,
2783
+ children: [
2784
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
2785
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex flex-row gap-1", children })
2786
+ ]
2787
+ }
2788
+ ),
2789
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
2790
+ ]
2791
+ }
2792
+ );
2793
+ }
2794
+ );
2795
+ var CardForum = (0, import_react7.forwardRef)(
2796
+ ({
2797
+ title,
2798
+ content,
2799
+ comments,
2800
+ onClickComments,
2801
+ valueComments,
2802
+ onClickProfile,
2803
+ valueProfile,
2804
+ className = "",
2805
+ date,
2806
+ hour,
2807
+ ...props
2808
+ }, ref) => {
2809
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2810
+ CardBase,
2811
+ {
2812
+ ref,
2813
+ layout: "horizontal",
2814
+ padding: "medium",
2815
+ minHeight: "none",
2816
+ variant: "minimal",
2817
+ className: `w-auto h-auto gap-3 ${className}`,
2818
+ ...props,
2819
+ children: [
2820
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2821
+ "button",
2822
+ {
2823
+ type: "button",
2824
+ "aria-label": "Ver perfil",
2825
+ onClick: () => onClickProfile?.(valueProfile),
2826
+ className: "min-w-8 h-8 rounded-full bg-background-950"
2827
+ }
2828
+ ),
2829
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
2830
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
2831
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
2832
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "text-xs text-text-600", children: [
2833
+ "\u2022 ",
2834
+ date,
2835
+ " \u2022 ",
2836
+ hour
2837
+ ] })
2838
+ ] }),
2839
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
2840
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2841
+ "button",
2842
+ {
2843
+ type: "button",
2844
+ "aria-label": "Ver coment\xE1rios",
2845
+ onClick: () => onClickComments?.(valueComments),
2846
+ className: "text-text-600 flex flex-row gap-2 items-center",
2847
+ children: [
2848
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.ChatCircleText, { "aria-hidden": "true", size: 16 }),
2849
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "text-xs", children: [
2850
+ comments,
2851
+ " respostas"
2852
+ ] })
2853
+ ]
2854
+ }
2855
+ )
2856
+ ] })
2857
+ ]
2858
+ }
2859
+ );
2860
+ }
2861
+ );
2862
+ var CardAudio = (0, import_react7.forwardRef)(
2863
+ ({
2864
+ src,
2865
+ title,
2866
+ onPlay,
2867
+ onPause,
2868
+ onEnded,
2869
+ onAudioTimeUpdate,
2870
+ loop = false,
2871
+ preload = "metadata",
2872
+ tracks,
2873
+ className,
2874
+ ...props
2875
+ }, ref) => {
2876
+ const [isPlaying, setIsPlaying] = (0, import_react7.useState)(false);
2877
+ const [currentTime, setCurrentTime] = (0, import_react7.useState)(0);
2878
+ const [duration, setDuration] = (0, import_react7.useState)(0);
2879
+ const [volume, setVolume] = (0, import_react7.useState)(1);
2880
+ const [showVolumeControl, setShowVolumeControl] = (0, import_react7.useState)(false);
2881
+ const audioRef = (0, import_react7.useRef)(null);
2882
+ const formatTime = (time) => {
2883
+ const minutes = Math.floor(time / 60);
2884
+ const seconds = Math.floor(time % 60);
2885
+ return `${minutes}:${seconds.toString().padStart(2, "0")}`;
2886
+ };
2887
+ const handlePlayPause = () => {
2888
+ if (isPlaying) {
2889
+ audioRef.current?.pause();
2890
+ setIsPlaying(false);
2891
+ onPause?.();
2892
+ } else {
2893
+ audioRef.current?.play();
2894
+ setIsPlaying(true);
2895
+ onPlay?.();
2896
+ }
2897
+ };
2898
+ const handleTimeUpdate = () => {
2899
+ const current = audioRef.current?.currentTime ?? 0;
2900
+ const total = audioRef.current?.duration ?? 0;
2901
+ setCurrentTime(current);
2902
+ setDuration(total);
2903
+ onAudioTimeUpdate?.(current, total);
2904
+ };
2905
+ const handleLoadedMetadata = () => {
2906
+ setDuration(audioRef.current?.duration ?? 0);
2907
+ };
2908
+ const handleEnded = () => {
2909
+ setIsPlaying(false);
2910
+ setCurrentTime(0);
2911
+ onEnded?.();
2912
+ };
2913
+ const handleProgressClick = (e) => {
2914
+ const rect = e.currentTarget.getBoundingClientRect();
2915
+ const clickX = e.clientX - rect.left;
2916
+ const width = rect.width;
2917
+ const percentage = clickX / width;
2918
+ const newTime = percentage * duration;
2919
+ if (audioRef.current) {
2920
+ audioRef.current.currentTime = newTime;
2921
+ }
2922
+ setCurrentTime(newTime);
2923
+ };
2924
+ const handleVolumeChange = (e) => {
2925
+ const newVolume = parseFloat(e.target.value);
2926
+ setVolume(newVolume);
2927
+ if (audioRef.current) {
2928
+ audioRef.current.volume = newVolume;
2929
+ }
2930
+ };
2931
+ const toggleVolumeControl = () => {
2932
+ setShowVolumeControl(!showVolumeControl);
2933
+ };
2934
+ const getVolumeIcon = () => {
2935
+ if (volume === 0) {
2936
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.SpeakerSimpleX, {});
2937
+ }
2938
+ if (volume < 0.5) {
2939
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.SpeakerLow, {});
2940
+ }
2941
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.SpeakerHigh, {});
2942
+ };
2943
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2944
+ CardBase,
2945
+ {
2946
+ ref,
2947
+ layout: "horizontal",
2948
+ padding: "medium",
2949
+ minHeight: "none",
2950
+ className: `w-auto h-14 items-center gap-2 ${className}`,
2951
+ ...props,
2952
+ children: [
2953
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2954
+ "audio",
2955
+ {
2956
+ ref: audioRef,
2957
+ src,
2958
+ loop,
2959
+ preload,
2960
+ onTimeUpdate: handleTimeUpdate,
2961
+ onLoadedMetadata: handleLoadedMetadata,
2962
+ onEnded: handleEnded,
2963
+ "data-testid": "audio-element",
2964
+ "aria-label": title,
2965
+ children: tracks ? tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2966
+ "track",
2967
+ {
2968
+ kind: track.kind,
2969
+ src: track.src,
2970
+ srcLang: track.srcLang,
2971
+ label: track.label,
2972
+ default: track.default
2973
+ },
2974
+ track.src
2975
+ )) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2976
+ "track",
2977
+ {
2978
+ kind: "captions",
2979
+ src: "data:text/vtt;base64,",
2980
+ srcLang: "pt",
2981
+ label: "Sem legendas dispon\xEDveis"
2982
+ }
2983
+ )
2984
+ }
2985
+ ),
2986
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2987
+ "button",
2988
+ {
2989
+ type: "button",
2990
+ onClick: handlePlayPause,
2991
+ disabled: !src,
2992
+ className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
2993
+ "aria-label": isPlaying ? "Pausar" : "Reproduzir",
2994
+ children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-0.5", children: [
2995
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" }),
2996
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" })
2997
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.Play, { size: 24 })
2998
+ }
2999
+ ),
3000
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
3001
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3002
+ "button",
3003
+ {
3004
+ type: "button",
3005
+ className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
3006
+ onClick: handleProgressClick,
3007
+ onKeyDown: (e) => {
3008
+ if (e.key === "Enter" || e.key === " ") {
3009
+ e.preventDefault();
3010
+ handleProgressClick(
3011
+ e
3012
+ );
3013
+ }
3014
+ },
3015
+ "aria-label": "Barra de progresso do \xE1udio",
3016
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3017
+ "div",
3018
+ {
3019
+ className: "h-full bg-primary-600 rounded-full transition-all duration-100",
3020
+ style: {
3021
+ width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
3022
+ }
3023
+ }
3024
+ )
3025
+ }
3026
+ ) }),
3027
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-text-800 text-sm font-medium min-w-[2.5rem]", children: formatTime(duration) }),
3028
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative", children: [
3029
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3030
+ "button",
3031
+ {
3032
+ type: "button",
3033
+ onClick: toggleVolumeControl,
3034
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
3035
+ "aria-label": "Controle de volume",
3036
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
3037
+ }
3038
+ ),
3039
+ showVolumeControl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3040
+ "button",
3041
+ {
3042
+ type: "button",
3043
+ 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",
3044
+ onKeyDown: (e) => {
3045
+ if (e.key === "Escape") {
3046
+ setShowVolumeControl(false);
3047
+ }
3048
+ },
3049
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3050
+ "input",
3051
+ {
3052
+ type: "range",
3053
+ min: "0",
3054
+ max: "1",
3055
+ step: "0.1",
3056
+ value: volume,
3057
+ onChange: handleVolumeChange,
3058
+ onKeyDown: (e) => {
3059
+ if (e.key === "ArrowUp" || e.key === "ArrowRight") {
3060
+ e.preventDefault();
3061
+ const newVolume = Math.min(
3062
+ 1,
3063
+ Math.round((volume + 0.1) * 10) / 10
3064
+ );
3065
+ setVolume(newVolume);
3066
+ if (audioRef.current) audioRef.current.volume = newVolume;
3067
+ } else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
3068
+ e.preventDefault();
3069
+ const newVolume = Math.max(
3070
+ 0,
3071
+ Math.round((volume - 0.1) * 10) / 10
3072
+ );
3073
+ setVolume(newVolume);
3074
+ if (audioRef.current) audioRef.current.volume = newVolume;
3075
+ }
3076
+ },
3077
+ className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
3078
+ style: {
3079
+ background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
3080
+ },
3081
+ "aria-label": "Volume",
3082
+ "aria-valuenow": Math.round(volume * 100),
3083
+ "aria-valuemin": 0,
3084
+ "aria-valuemax": 100
3085
+ }
3086
+ )
3087
+ }
3088
+ )
3089
+ ] }),
3090
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3091
+ import_phosphor_react5.DotsThreeVertical,
3092
+ {
3093
+ size: 24,
3094
+ className: "text-text-950 cursor-pointer hover:text-primary-600"
3095
+ }
3096
+ )
3097
+ ]
3098
+ }
3099
+ );
3100
+ }
3101
+ );
3102
+ var SIMULADO_BACKGROUND_CLASSES = {
3103
+ enem: "bg-exam-1",
3104
+ prova: "bg-exam-2",
3105
+ simuladao: "bg-exam-3",
3106
+ vestibular: "bg-exam-4"
3107
+ };
3108
+ var CardSimulado = (0, import_react7.forwardRef)(
3109
+ ({ title, duration, info, backgroundColor, className, ...props }, ref) => {
3110
+ const backgroundClass = SIMULADO_BACKGROUND_CLASSES[backgroundColor];
3111
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3112
+ CardBase,
3113
+ {
3114
+ ref,
3115
+ layout: "horizontal",
3116
+ padding: "medium",
3117
+ minHeight: "none",
3118
+ cursor: "pointer",
3119
+ className: `${backgroundClass} hover:shadow-soft-shadow-2 transition-shadow duration-200 ${className}`,
3120
+ ...props,
3121
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex justify-between items-center w-full gap-4", children: [
3122
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
3123
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "lg", weight: "bold", className: "text-text-950 truncate", children: title }),
3124
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-4 text-text-700", children: [
3125
+ duration && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1", children: [
3126
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.Clock, { size: 16, className: "flex-shrink-0" }),
3127
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "sm", children: duration })
3128
+ ] }),
3129
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "sm", className: "truncate", children: info })
3130
+ ] })
3131
+ ] }),
3132
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3133
+ import_phosphor_react5.CaretRight,
3134
+ {
3135
+ size: 24,
3136
+ className: "text-text-800 flex-shrink-0",
3137
+ "data-testid": "caret-icon"
3138
+ }
3139
+ )
3140
+ ] })
3141
+ }
3142
+ );
3143
+ }
3144
+ );
3145
+ var CardTest = (0, import_react7.forwardRef)(
3146
+ ({
3147
+ title,
3148
+ duration,
3149
+ questionsCount,
3150
+ additionalInfo,
3151
+ selected = false,
3152
+ onSelect,
3153
+ className = "",
3154
+ ...props
3155
+ }, ref) => {
3156
+ const handleClick = () => {
3157
+ if (onSelect) {
3158
+ onSelect(!selected);
3159
+ }
3160
+ };
3161
+ const handleKeyDown = (event) => {
3162
+ if ((event.key === "Enter" || event.key === " ") && onSelect) {
3163
+ event.preventDefault();
3164
+ onSelect(!selected);
3165
+ }
3166
+ };
3167
+ const isSelectable = !!onSelect;
3168
+ const getQuestionsText = (count) => {
3169
+ const singular = count === 1 ? "quest\xE3o" : "quest\xF5es";
3170
+ return `${count} ${singular}`;
3171
+ };
3172
+ const displayInfo = questionsCount ? getQuestionsText(questionsCount) : additionalInfo || "";
3173
+ 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";
3174
+ const interactiveClasses = isSelectable ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-950 focus:ring-offset-2" : "";
3175
+ const selectedClasses = selected ? "ring-2 ring-primary-950 ring-offset-2" : "";
3176
+ if (isSelectable) {
3177
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3178
+ "button",
3179
+ {
3180
+ ref,
3181
+ type: "button",
3182
+ className: `${baseClasses} ${interactiveClasses} ${selectedClasses} ${className}`.trim(),
3183
+ onClick: handleClick,
3184
+ onKeyDown: handleKeyDown,
3185
+ "aria-pressed": selected,
3186
+ ...props,
3187
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
3188
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3189
+ Text_default,
3190
+ {
3191
+ size: "md",
3192
+ weight: "bold",
3193
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
3194
+ children: title
3195
+ }
3196
+ ),
3197
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
3198
+ duration && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
3199
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.Clock, { size: 16, className: "text-text-700" }),
3200
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3201
+ Text_default,
3202
+ {
3203
+ size: "sm",
3204
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
3205
+ children: duration
3206
+ }
3207
+ )
3208
+ ] }),
3209
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3210
+ Text_default,
3211
+ {
3212
+ size: "sm",
3213
+ className: "text-text-700 leading-[21px] flex-grow truncate",
3214
+ children: displayInfo
3215
+ }
3216
+ )
3217
+ ] })
3218
+ ] })
3219
+ }
3220
+ );
3221
+ }
3222
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3223
+ "div",
3224
+ {
3225
+ ref,
3226
+ className: `${baseClasses} ${className}`.trim(),
3227
+ ...props,
3228
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
3229
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3230
+ Text_default,
3231
+ {
3232
+ size: "md",
3233
+ weight: "bold",
3234
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
3235
+ children: title
3236
+ }
3237
+ ),
3238
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
3239
+ duration && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
3240
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.Clock, { size: 16, className: "text-text-700" }),
3241
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3242
+ Text_default,
3243
+ {
3244
+ size: "sm",
3245
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
3246
+ children: duration
3247
+ }
3248
+ )
3249
+ ] }),
3250
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3251
+ Text_default,
3252
+ {
3253
+ size: "sm",
3254
+ className: "text-text-700 leading-[21px] flex-grow truncate min-w-0",
3255
+ children: displayInfo
3256
+ }
3257
+ )
3258
+ ] })
3259
+ ] })
3260
+ }
3261
+ );
3262
+ }
3263
+ );
3264
+ var SIMULATION_TYPE_STYLES = {
3265
+ enem: {
3266
+ background: "bg-exam-1",
3267
+ badge: "exam1",
3268
+ text: "Enem"
3269
+ },
3270
+ prova: {
3271
+ background: "bg-exam-2",
3272
+ badge: "exam2",
3273
+ text: "Prova"
3274
+ },
3275
+ simulado: {
3276
+ background: "bg-exam-3",
3277
+ badge: "exam3",
3278
+ text: "Simulado"
3279
+ },
3280
+ vestibular: {
3281
+ background: "bg-exam-4",
3282
+ badge: "exam4",
3283
+ text: "Vestibular"
3284
+ }
3285
+ };
3286
+ var CardSimulationHistory = (0, import_react7.forwardRef)(({ data, onSimulationClick, className, ...props }, ref) => {
3287
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3288
+ "div",
3289
+ {
3290
+ ref,
3291
+ className: `w-full max-w-[992px] h-auto ${className}`,
3292
+ ...props,
3293
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-0", children: [
3294
+ data.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3295
+ "div",
3296
+ {
3297
+ className: `
3298
+ flex flex-row justify-center items-start px-4 py-6 gap-2 w-full bg-white
3299
+ ${sectionIndex === 0 ? "rounded-t-3xl" : ""}
3300
+ `,
3301
+ children: [
3302
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3303
+ Text_default,
3304
+ {
3305
+ size: "xs",
3306
+ weight: "bold",
3307
+ className: "text-text-800 w-11 flex-shrink-0",
3308
+ children: section.date
3309
+ }
3310
+ ),
3311
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-col gap-2 flex-1", children: section.simulations.map((simulation) => {
3312
+ const typeStyles = SIMULATION_TYPE_STYLES[simulation.type];
3313
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3314
+ CardBase,
3315
+ {
3316
+ layout: "horizontal",
3317
+ padding: "medium",
3318
+ minHeight: "none",
3319
+ cursor: "pointer",
3320
+ className: `
3321
+ ${typeStyles.background} rounded-xl hover:shadow-soft-shadow-2
3322
+ transition-shadow duration-200 h-auto min-h-[61px]
3323
+ `,
3324
+ onClick: () => onSimulationClick?.(simulation),
3325
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex justify-between items-center w-full gap-2", children: [
3326
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
3327
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3328
+ Text_default,
3329
+ {
3330
+ size: "lg",
3331
+ weight: "bold",
3332
+ className: "text-text-950 truncate",
3333
+ children: simulation.title
3334
+ }
3335
+ ),
3336
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
3337
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3338
+ Badge_default,
3339
+ {
3340
+ variant: "examsOutlined",
3341
+ action: typeStyles.badge,
3342
+ size: "medium",
3343
+ children: typeStyles.text
3344
+ }
3345
+ ),
3346
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text_default, { size: "sm", className: "text-text-800 truncate", children: simulation.info })
3347
+ ] })
3348
+ ] }),
3349
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3350
+ import_phosphor_react5.CaretRight,
3351
+ {
3352
+ size: 24,
3353
+ className: "text-text-800 flex-shrink-0",
3354
+ "data-testid": "caret-icon"
3355
+ }
3356
+ )
3357
+ ] })
3358
+ },
3359
+ simulation.id
3360
+ );
3361
+ }) })
3362
+ ]
3363
+ }
3364
+ ) }, section.date)),
3365
+ data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-full h-6 bg-white rounded-b-3xl" })
3366
+ ] })
3367
+ }
3368
+ );
3369
+ });
3370
+
3371
+ // src/components/ProgressCircle/ProgressCircle.tsx
3372
+ var import_jsx_runtime12 = require("react/jsx-runtime");
3373
+ var SIZE_CLASSES8 = {
3374
+ small: {
3375
+ container: "w-[90px] h-[90px]",
3376
+ // 90px circle from design specs
3377
+ strokeWidth: 4,
3378
+ // 4px stroke width - matches ProgressBar small (h-1)
3379
+ textSize: "2xl",
3380
+ // 24px for percentage (font-size: 24px)
3381
+ textWeight: "medium",
3382
+ // font-weight: 500
3383
+ labelSize: "2xs",
3384
+ // Will be overridden with custom 8px in className
3385
+ labelWeight: "bold",
3386
+ // font-weight: 700
3387
+ spacing: "gap-0",
3388
+ // Reduced gap between percentage and label for better spacing
3389
+ contentWidth: "max-w-[50px]"
3390
+ // Reduced width to fit text inside circle
3391
+ },
3392
+ medium: {
3393
+ container: "w-[152px] h-[152px]",
3394
+ // 151.67px ≈ 152px circle from design specs
3395
+ strokeWidth: 8,
3396
+ // 8px stroke width - matches ProgressBar medium (h-2)
3397
+ textSize: "2xl",
3398
+ // 24px for percentage (font-size: 24px)
3399
+ textWeight: "medium",
3400
+ // font-weight: 500
3401
+ labelSize: "xs",
3402
+ // 12px for status label (font-size: 12px)
3403
+ labelWeight: "medium",
3404
+ // font-weight: 500 (changed from bold)
3405
+ spacing: "gap-1",
3406
+ // 4px gap between percentage and label
3407
+ contentWidth: "max-w-[90px]"
3408
+ // Reduced width to fit text inside circle
3409
+ }
3410
+ };
3411
+ var VARIANT_CLASSES3 = {
3412
+ blue: {
3413
+ background: "stroke-primary-100",
3414
+ // Light blue background (#BBDCF7)
3415
+ fill: "stroke-primary-700",
3416
+ // Blue for activity progress (#2271C4)
3417
+ textColor: "text-primary-700",
3418
+ // Blue text color (#2271C4)
3419
+ labelColor: "text-text-700"
3420
+ // Gray text for label (#525252)
3421
+ },
3422
+ green: {
3423
+ background: "stroke-background-300",
3424
+ // Gray background (#D5D4D4 - matches design)
3425
+ fill: "stroke-success-200",
3426
+ // Green for performance (#84D3A2 - matches design)
3427
+ textColor: "text-text-800",
3428
+ // Dark gray text (#404040 - matches design)
3429
+ labelColor: "text-text-600"
3430
+ // Medium gray text for label (#737373 - matches design)
3431
+ }
3432
+ };
3433
+ var ProgressCircle = ({
3434
+ value,
3435
+ max = 100,
3436
+ size = "small",
3437
+ variant = "blue",
3438
+ label,
3439
+ showPercentage = true,
3440
+ className = "",
3441
+ labelClassName = "",
3442
+ percentageClassName = ""
3443
+ }) => {
3444
+ const safeValue = isNaN(value) ? 0 : value;
3445
+ const clampedValue = Math.max(0, Math.min(safeValue, max));
3446
+ const percentage = max === 0 ? 0 : clampedValue / max * 100;
3447
+ const sizeClasses = SIZE_CLASSES8[size];
3448
+ const variantClasses = VARIANT_CLASSES3[variant];
3449
+ const radius = size === "small" ? 37 : 64;
3450
+ const circumference = 2 * Math.PI * radius;
3451
+ const strokeDashoffset = circumference - percentage / 100 * circumference;
3452
+ const center = size === "small" ? 45 : 76;
3453
+ const svgSize = size === "small" ? 90 : 152;
3454
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3455
+ "div",
3456
+ {
3457
+ className: `relative flex flex-col items-center justify-center ${sizeClasses.container} rounded-lg ${className}`,
3458
+ children: [
3459
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3460
+ "svg",
3461
+ {
3462
+ className: "absolute inset-0 transform -rotate-90",
3463
+ width: svgSize,
3464
+ height: svgSize,
3465
+ viewBox: `0 0 ${svgSize} ${svgSize}`,
3466
+ "aria-hidden": "true",
3467
+ children: [
3468
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3469
+ "circle",
3470
+ {
3471
+ cx: center,
3472
+ cy: center,
3473
+ r: radius,
3474
+ fill: "none",
3475
+ strokeWidth: sizeClasses.strokeWidth,
3476
+ className: `${variantClasses.background} rounded-lg`
3477
+ }
3478
+ ),
3479
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3480
+ "circle",
3481
+ {
3482
+ cx: center,
3483
+ cy: center,
3484
+ r: radius,
3485
+ fill: "none",
3486
+ strokeWidth: sizeClasses.strokeWidth,
3487
+ strokeLinecap: "round",
3488
+ strokeDasharray: circumference,
3489
+ strokeDashoffset,
3490
+ className: `${variantClasses.fill} transition-all duration-500 ease-out shadow-soft-shadow-3 rounded-lg`
3491
+ }
3492
+ )
3493
+ ]
3494
+ }
3495
+ ),
3496
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3497
+ "progress",
3498
+ {
3499
+ value: clampedValue,
3500
+ max,
3501
+ "aria-label": typeof label === "string" ? label : "Progress",
3502
+ className: "absolute opacity-0 w-0 h-0"
3503
+ }
3504
+ ),
3505
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3506
+ "div",
3507
+ {
3508
+ className: `relative z-10 flex flex-col items-center justify-center ${sizeClasses.spacing} ${sizeClasses.contentWidth}`,
3509
+ children: [
3510
+ showPercentage && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3511
+ Text_default,
3512
+ {
3513
+ size: sizeClasses.textSize,
3514
+ weight: sizeClasses.textWeight,
3515
+ className: `text-center w-full ${variantClasses.textColor} ${percentageClassName}`,
3516
+ children: [
3517
+ Math.round(percentage),
3518
+ "%"
3519
+ ]
3520
+ }
3521
+ ),
3522
+ label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3523
+ Text_default,
3524
+ {
3525
+ as: "span",
3526
+ size: sizeClasses.labelSize,
3527
+ weight: sizeClasses.labelWeight,
3528
+ className: `${variantClasses.labelColor} text-center uppercase tracking-wide truncate w-full ${size === "small" ? "text-[8px] leading-[9px]" : ""} ${labelClassName}`,
3529
+ children: label
3530
+ }
3531
+ )
3532
+ ]
3533
+ }
3534
+ )
3535
+ ]
3536
+ }
3537
+ );
3538
+ };
3539
+ var ProgressCircle_default = ProgressCircle;
3540
+
3541
+ // src/components/Quiz/Quiz.tsx
3542
+ var import_jsx_runtime13 = require("react/jsx-runtime");
3543
+ var Quiz = (0, import_react8.forwardRef)(({ children, className, ...props }, ref) => {
3544
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3545
+ "div",
3546
+ {
3547
+ ref,
3548
+ className: `w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6 ${className}`,
3549
+ ...props,
3550
+ children
3551
+ }
3552
+ );
3553
+ });
3554
+ var QuizHeaderResult = (0, import_react8.forwardRef)(
3555
+ ({ className, ...props }, ref) => {
3556
+ const { getCurrentQuestion, getCurrentAnswer } = useQuizStore();
3557
+ const currentQuestion = getCurrentQuestion();
3558
+ const userAnswer = getCurrentAnswer();
3559
+ const isCorrect = userAnswer === currentQuestion?.correctOptionId;
3560
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3561
+ "div",
3562
+ {
3563
+ ref,
3564
+ className: `flex flex-row items-center gap-10 p-3.5 rounded-xl ${isCorrect ? "bg-success-background" : "bg-error-background"} ${className}`,
3565
+ ...props,
3566
+ children: [
3567
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
3568
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-700 text-md", children: isCorrect ? "\u{1F389} Parab\xE9ns!!" : "N\xE3o foi dessa vez..." })
3569
+ ]
3570
+ }
3571
+ );
3572
+ }
3573
+ );
3574
+ var QuizTitle = (0, import_react8.forwardRef)(
3575
+ ({ className, ...props }, ref) => {
3576
+ const {
3577
+ currentQuestionIndex,
3578
+ getTotalQuestions,
3579
+ getQuizTitle,
3580
+ timeElapsed,
3581
+ formatTime,
3582
+ isStarted
3583
+ } = useQuizStore();
3584
+ const totalQuestions = getTotalQuestions();
3585
+ const quizTitle = getQuizTitle();
3586
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3587
+ "div",
3588
+ {
3589
+ ref,
3590
+ className: `flex flex-row justify-center items-center relative p-2 ${className}`,
3591
+ ...props,
3592
+ children: [
3593
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
3594
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
3595
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
3596
+ ] }),
3597
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "absolute right-2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.Clock, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
3598
+ ]
3599
+ }
3600
+ );
3601
+ }
3602
+ );
3603
+ var QuizHeader = () => {
3604
+ const { getCurrentQuestion } = useQuizStore();
3605
+ const currentQuestion = getCurrentQuestion();
3606
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3607
+ HeaderAlternative,
3608
+ {
3609
+ title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
3610
+ subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topicId ?? "",
3611
+ content: currentQuestion?.questionText ?? ""
3612
+ }
3613
+ );
3614
+ };
3615
+ var QuizContent = (0, import_react8.forwardRef)(({ type = "Alternativas", children, className, ...props }, ref) => {
3616
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3617
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "font-bold text-lg text-text-950", children: type }) }),
3618
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3619
+ "div",
3620
+ {
3621
+ ref,
3622
+ className: `rounded-t-xl px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
3623
+ ...props,
3624
+ children
3625
+ }
3626
+ )
3627
+ ] });
3628
+ });
3629
+ var QuizAlternative = ({ variant = "default" }) => {
3630
+ const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
3631
+ const currentQuestion = getCurrentQuestion();
3632
+ const currentAnswer = getCurrentAnswer();
3633
+ const alternatives = currentQuestion?.options?.map((option) => {
3634
+ let status = "neutral" /* NEUTRAL */;
3635
+ if (variant === "result") {
3636
+ if (option.id === currentQuestion.correctOptionId) {
3637
+ status = "correct" /* CORRECT */;
3638
+ } else if (currentAnswer === option.id && option.id !== currentQuestion.correctOptionId) {
3639
+ status = "incorrect" /* INCORRECT */;
3640
+ }
3641
+ }
3642
+ return {
3643
+ label: option.option,
3644
+ value: option.id,
3645
+ status
3646
+ };
3647
+ });
3648
+ if (!alternatives)
3649
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: "N\xE3o h\xE1 Alternativas" }) });
3650
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3651
+ AlternativesList,
3652
+ {
3653
+ mode: variant === "default" ? "interactive" : "readonly",
3654
+ name: `question-${currentQuestion?.id || "1"}`,
3655
+ layout: "compact",
3656
+ alternatives,
3657
+ value: currentAnswer,
3658
+ selectedValue: currentAnswer,
3659
+ onValueChange: (value) => {
3660
+ if (currentQuestion) {
3661
+ selectAnswer(currentQuestion.id, value);
3662
+ }
3663
+ }
3664
+ },
3665
+ `question-${currentQuestion?.id || "1"}`
3666
+ ) });
3667
+ };
3668
+ var QuizQuestionList = ({
3669
+ filterType = "all",
3670
+ onQuestionClick
3671
+ } = {}) => {
3672
+ const {
3673
+ getQuestionsGroupedBySubject,
3674
+ goToQuestion,
3675
+ getQuestionStatusFromUserAnswers
3676
+ } = useQuizStore();
3677
+ const groupedQuestions = getQuestionsGroupedBySubject();
3678
+ const getQuestionStatus = (questionId) => {
3679
+ return getQuestionStatusFromUserAnswers(questionId);
3680
+ };
3681
+ const filteredGroupedQuestions = Object.entries(groupedQuestions).reduce(
3682
+ (acc, [subjectId, questions]) => {
3683
+ const filteredQuestions = questions.filter((question) => {
3684
+ const status = getQuestionStatus(question.id);
3685
+ switch (filterType) {
3686
+ case "answered":
3687
+ return status === "answered";
3688
+ case "unanswered":
3689
+ return status === "unanswered";
3690
+ default:
3691
+ return true;
3692
+ }
3693
+ });
3694
+ if (filteredQuestions.length > 0) {
3695
+ acc[subjectId] = filteredQuestions;
3696
+ }
3697
+ return acc;
3698
+ },
3699
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3700
+ {}
3701
+ );
3702
+ const getQuestionIndex = (questionId) => {
3703
+ const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
3704
+ const quiz = bySimulated ?? byActivity ?? byQuestionary;
3705
+ if (!quiz) return 0;
3706
+ const index = quiz.questions.findIndex((q) => q.id === questionId);
3707
+ return index + 1;
3708
+ };
3709
+ const getStatusLabel = (status) => {
3710
+ switch (status) {
3711
+ case "answered":
3712
+ return "Respondida";
3713
+ case "skipped":
3714
+ return "N\xE3o respondida";
3715
+ default:
3716
+ return "Em branco";
3717
+ }
3718
+ };
3719
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
3720
+ ([subjectId, questions]) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "flex flex-col gap-2", children: [
3721
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
3722
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.BookOpen, { size: 17, className: "text-white" }) }),
3723
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
3724
+ ] }),
3725
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
3726
+ const status = getQuestionStatus(question.id);
3727
+ const questionNumber = getQuestionIndex(question.id);
3728
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3729
+ CardStatus,
3730
+ {
3731
+ header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
3732
+ label: getStatusLabel(status),
3733
+ onClick: () => {
3734
+ goToQuestion(questionNumber - 1);
3735
+ onQuestionClick?.();
3736
+ }
3737
+ },
3738
+ question.id
3739
+ );
3740
+ }) })
3741
+ ] }, subjectId)
3742
+ ) });
3743
+ };
3744
+ var QuizFooter = (0, import_react8.forwardRef)(({ className, onGoToSimulated, onDetailResult, ...props }, ref) => {
3745
+ const {
3746
+ currentQuestionIndex,
3747
+ getUserAnswers,
3748
+ getTotalQuestions,
3749
+ goToNextQuestion,
3750
+ goToPreviousQuestion,
3751
+ getUnansweredQuestionsFromUserAnswers,
3752
+ getCurrentAnswer,
3753
+ skipQuestion,
3754
+ getCurrentQuestion,
3755
+ getQuestionStatusFromUserAnswers
3756
+ } = useQuizStore();
3757
+ const totalQuestions = getTotalQuestions();
3758
+ const isFirstQuestion = currentQuestionIndex === 0;
3759
+ const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
3760
+ const currentAnswer = getCurrentAnswer();
3761
+ const currentQuestion = getCurrentQuestion();
3762
+ const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
3763
+ const [alertDialogOpen, setAlertDialogOpen] = (0, import_react8.useState)(false);
3764
+ const [modalResultOpen, setModalResultOpen] = (0, import_react8.useState)(false);
3765
+ const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react8.useState)(false);
3766
+ const [filterType, setFilterType] = (0, import_react8.useState)("all");
3767
+ const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
3768
+ const userAnswers = getUserAnswers();
3769
+ const allQuestions = getTotalQuestions();
3770
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3771
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3772
+ "footer",
3773
+ {
3774
+ ref,
3775
+ className: `w-full px-2 bg-background lg:max-w-[1000px] not-lg:max-w-[calc(100vw-32px)] border-t border-border-50 fixed bottom-0 min-h-[80px] flex flex-row justify-between items-center ${className}`,
3776
+ ...props,
3777
+ children: [
3778
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
3779
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3780
+ IconButton_default,
3781
+ {
3782
+ icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.SquaresFour, { size: 24, className: "text-text-950" }),
3783
+ size: "md",
3784
+ onClick: () => setModalNavigateOpen(true)
3785
+ }
3786
+ ),
3787
+ isFirstQuestion ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3788
+ Button_default,
3789
+ {
3790
+ variant: "outline",
3791
+ size: "small",
3792
+ onClick: () => {
3793
+ skipQuestion();
3794
+ goToNextQuestion();
3795
+ },
3796
+ children: "Pular"
3797
+ }
3798
+ ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3799
+ Button_default,
3800
+ {
3801
+ size: "medium",
3802
+ variant: "link",
3803
+ action: "primary",
3804
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.CaretLeft, { size: 18 }),
3805
+ onClick: () => {
3806
+ goToPreviousQuestion();
3807
+ },
3808
+ children: "Voltar"
3809
+ }
3810
+ )
3811
+ ] }),
3812
+ !isFirstQuestion && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3813
+ Button_default,
3814
+ {
3815
+ size: "small",
3816
+ variant: "outline",
3817
+ action: "primary",
3818
+ onClick: () => {
3819
+ skipQuestion();
3820
+ goToNextQuestion();
3821
+ },
3822
+ children: "Pular"
3823
+ }
3824
+ ),
3825
+ isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3826
+ Button_default,
3827
+ {
3828
+ size: "medium",
3829
+ variant: "solid",
3830
+ action: "primary",
3831
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
3832
+ onClick: () => {
3833
+ if (unansweredQuestions.length > 0) {
3834
+ setAlertDialogOpen(true);
3835
+ } else {
3836
+ setModalResultOpen(true);
3837
+ }
3838
+ },
3839
+ children: "Finalizar"
3840
+ }
3841
+ ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3842
+ Button_default,
3843
+ {
3844
+ size: "medium",
3845
+ variant: "link",
3846
+ action: "primary",
3847
+ iconRight: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.CaretRight, { size: 18 }),
3848
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
3849
+ onClick: () => {
3850
+ goToNextQuestion();
3851
+ },
3852
+ children: "Avan\xE7ar"
3853
+ }
3854
+ )
3855
+ ]
3856
+ }
3857
+ ),
3858
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3859
+ AlertDialog,
3860
+ {
3861
+ isOpen: alertDialogOpen,
3862
+ onChangeOpen: setAlertDialogOpen,
3863
+ title: "Finalizar simulado?",
3864
+ description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : "Tem certeza que deseja finalizar o simulado?",
3865
+ cancelButtonLabel: "Voltar e revisar",
3866
+ submitButtonLabel: "Finalizar Mesmo Assim",
3867
+ onSubmit: () => {
3868
+ setModalResultOpen(true);
3869
+ }
3870
+ }
3871
+ ),
3872
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3873
+ Modal_default,
3874
+ {
3875
+ isOpen: modalResultOpen,
3876
+ onClose: () => setModalResultOpen(false),
3877
+ title: "",
3878
+ closeOnBackdropClick: false,
3879
+ closeOnEscape: false,
3880
+ hideCloseButton: true,
3881
+ size: "md",
3882
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
3883
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3884
+ "img",
3885
+ {
3886
+ src: simulated_result_default,
3887
+ alt: "Simulated Result",
3888
+ className: "w-[282px] h-auto object-cover"
3889
+ }
3890
+ ),
3891
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
3892
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
3893
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "text-text-500 font-sm", children: [
3894
+ "Voc\xEA acertou",
3895
+ " ",
3896
+ userAnswers.filter(
3897
+ (answer) => answer.answerKey === answer.correctOptionId
3898
+ ).length,
3899
+ " ",
3900
+ "de ",
3901
+ allQuestions,
3902
+ " quest\xF5es."
3903
+ ] })
3904
+ ] }),
3905
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
3906
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3907
+ Button_default,
3908
+ {
3909
+ variant: "outline",
3910
+ className: "w-full",
3911
+ size: "small",
3912
+ onClick: onGoToSimulated,
3913
+ children: "Ir para simulados"
3914
+ }
3915
+ ),
3916
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
3917
+ ] })
3918
+ ] })
3919
+ }
3920
+ ),
3921
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3922
+ Modal_default,
3923
+ {
3924
+ isOpen: modalNavigateOpen,
3925
+ onClose: () => setModalNavigateOpen(false),
3926
+ title: "Quest\xF5es",
3927
+ size: "lg",
3928
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col w-full h-full", children: [
3929
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
3930
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
3931
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Select_default, { value: filterType, onValueChange: setFilterType, children: [
3932
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
3933
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(SelectContent, { children: [
3934
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectItem, { value: "all", children: "Todas" }),
3935
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectItem, { value: "unanswered", children: "Em branco" }),
3936
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectItem, { value: "answered", children: "Respondidas" })
3937
+ ] })
3938
+ ] }) })
3939
+ ] }),
3940
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3941
+ QuizQuestionList,
3942
+ {
3943
+ filterType,
3944
+ onQuestionClick: () => setModalNavigateOpen(false)
3945
+ }
3946
+ ) })
3947
+ ] })
3948
+ }
3949
+ )
3950
+ ] });
3951
+ });
3952
+ var QuizResultHeaderTitle = (0, import_react8.forwardRef)(({ className, ...props }, ref) => {
3953
+ const { bySimulated } = useQuizStore();
3954
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3955
+ "div",
3956
+ {
3957
+ ref,
3958
+ className: `flex flex-row pt-4 justify-between ${className}`,
3959
+ ...props,
3960
+ children: [
3961
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
3962
+ bySimulated && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
3963
+ ]
3964
+ }
3965
+ );
3966
+ });
3967
+ var QuizResultTitle = (0, import_react8.forwardRef)(({ className, ...props }, ref) => {
3968
+ const { getQuizTitle } = useQuizStore();
3969
+ const quizTitle = getQuizTitle();
3970
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3971
+ "p",
3972
+ {
3973
+ className: `pt-6 pb-4 text-text-950 font-bold text-lg ${className}`,
3974
+ ref,
3975
+ ...props,
3976
+ children: quizTitle
3977
+ }
3978
+ );
3979
+ });
3980
+ var QuizResultPerformance = (0, import_react8.forwardRef)(
3981
+ ({ ...props }, ref) => {
3982
+ const {
3983
+ getTotalQuestions,
3984
+ timeElapsed,
3985
+ formatTime,
3986
+ bySimulated,
3987
+ byActivity,
3988
+ byQuestionary
3989
+ } = useQuizStore();
3990
+ const totalQuestions = getTotalQuestions();
3991
+ const quiz = bySimulated || byActivity || byQuestionary;
3992
+ let correctAnswers = 0;
3993
+ let correctEasyAnswers = 0;
3994
+ let correctMediumAnswers = 0;
3995
+ let correctDifficultAnswers = 0;
3996
+ let totalEasyQuestions = 0;
3997
+ let totalMediumQuestions = 0;
3998
+ let totalDifficultQuestions = 0;
3999
+ if (quiz) {
4000
+ quiz.questions.forEach((question) => {
4001
+ const userAnswer = question.answerKey;
4002
+ const isCorrect = userAnswer && userAnswer === question.correctOptionId;
4003
+ if (isCorrect) {
4004
+ correctAnswers++;
4005
+ }
4006
+ if (question.difficulty === "FACIL" /* FACIL */) {
4007
+ totalEasyQuestions++;
4008
+ if (isCorrect) {
4009
+ correctEasyAnswers++;
4010
+ }
4011
+ } else if (question.difficulty === "MEDIO" /* MEDIO */) {
4012
+ totalMediumQuestions++;
4013
+ if (isCorrect) {
4014
+ correctMediumAnswers++;
4015
+ }
4016
+ } else if (question.difficulty === "DIFICIL" /* DIFICIL */) {
4017
+ totalDifficultQuestions++;
4018
+ if (isCorrect) {
4019
+ correctDifficultAnswers++;
4020
+ }
4021
+ }
4022
+ });
4023
+ }
4024
+ const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
4025
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4026
+ "div",
4027
+ {
4028
+ className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
4029
+ ref,
4030
+ ...props,
4031
+ children: [
4032
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative", children: [
4033
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4034
+ ProgressCircle_default,
4035
+ {
4036
+ size: "medium",
4037
+ variant: "green",
4038
+ value: percentage,
4039
+ showPercentage: false,
4040
+ label: ""
4041
+ }
4042
+ ),
4043
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
4044
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
4045
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
4046
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime(timeElapsed) })
4047
+ ] }),
4048
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
4049
+ correctAnswers,
4050
+ " de ",
4051
+ totalQuestions
4052
+ ] }),
4053
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
4054
+ ] })
4055
+ ] }),
4056
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
4057
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4058
+ ProgressBar_default,
4059
+ {
4060
+ className: "w-full",
4061
+ layout: "stacked",
4062
+ variant: "green",
4063
+ value: correctEasyAnswers,
4064
+ max: totalEasyQuestions,
4065
+ label: "F\xE1ceis",
4066
+ showHitCount: true,
4067
+ labelClassName: "text-base font-medium text-text-800 leading-none",
4068
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
4069
+ }
4070
+ ),
4071
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4072
+ ProgressBar_default,
4073
+ {
4074
+ className: "w-full",
4075
+ layout: "stacked",
4076
+ variant: "green",
4077
+ value: correctMediumAnswers,
4078
+ max: totalMediumQuestions,
4079
+ label: "M\xE9dias",
4080
+ showHitCount: true,
4081
+ labelClassName: "text-base font-medium text-text-800 leading-none",
4082
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
4083
+ }
4084
+ ),
4085
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4086
+ ProgressBar_default,
4087
+ {
4088
+ className: "w-full",
4089
+ layout: "stacked",
4090
+ variant: "green",
4091
+ value: correctDifficultAnswers,
4092
+ max: totalDifficultQuestions,
4093
+ label: "Dif\xEDceis",
4094
+ showHitCount: true,
4095
+ labelClassName: "text-base font-medium text-text-800 leading-none",
4096
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
4097
+ }
4098
+ )
4099
+ ] })
4100
+ ]
4101
+ }
4102
+ );
4103
+ }
4104
+ );
4105
+ var QuizListResult = (0, import_react8.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
4106
+ const { getQuestionsGroupedBySubject, isQuestionAnswered } = useQuizStore();
4107
+ const groupedQuestions = getQuestionsGroupedBySubject();
4108
+ const subjectsStats = Object.entries(groupedQuestions).map(
4109
+ ([subjectId, questions]) => {
4110
+ let correct = 0;
4111
+ let incorrect = 0;
4112
+ questions.forEach((question) => {
4113
+ if (isQuestionAnswered(question.id)) {
4114
+ const userAnswer = question.answerKey;
4115
+ if (userAnswer === question.correctOptionId) {
4116
+ correct++;
4117
+ } else {
4118
+ incorrect++;
4119
+ }
4120
+ }
4121
+ });
4122
+ return {
4123
+ subject: subjectId,
4124
+ correct,
4125
+ incorrect,
4126
+ total: questions.length
4127
+ };
4128
+ }
4129
+ );
4130
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { ref, className, ...props, children: [
4131
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
4132
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4133
+ CardResults,
4134
+ {
4135
+ onClick: () => onSubjectClick?.(subject.subject),
4136
+ className: "max-w-full",
4137
+ header: subject.subject,
4138
+ correct_answers: subject.correct,
4139
+ incorrect_answers: subject.incorrect,
4140
+ icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react6.Book, { size: 20 }),
4141
+ direction: "row"
4142
+ }
4143
+ ) }, subject.subject)) })
4144
+ ] });
4145
+ });
4146
+ var QuizListResultByMateria = ({
4147
+ subject,
4148
+ onQuestionClick
4149
+ }) => {
4150
+ const { getQuestionsGroupedBySubject } = useQuizStore();
4151
+ const groupedQuestions = getQuestionsGroupedBySubject();
4152
+ const answeredQuestions = groupedQuestions[subject] || [];
4153
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
4154
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
4155
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "flex flex-col ", children: [
4156
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
4157
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4158
+ CardStatus,
4159
+ {
4160
+ className: "max-w-full",
4161
+ header: `Quest\xE3o ${question.id}`,
4162
+ status: question.answerKey === question.correctOptionId ? "correct" : "incorrect",
4163
+ onClick: () => onQuestionClick?.(question)
4164
+ }
4165
+ ) }, question.id)) })
4166
+ ] })
4167
+ ] });
4168
+ };
4169
+ // Annotate the CommonJS export names for ESM import in node:
4170
+ 0 && (module.exports = {
4171
+ Quiz,
4172
+ QuizAlternative,
4173
+ QuizContent,
4174
+ QuizFooter,
4175
+ QuizHeader,
4176
+ QuizHeaderResult,
4177
+ QuizListResult,
4178
+ QuizListResultByMateria,
4179
+ QuizQuestionList,
4180
+ QuizResultHeaderTitle,
4181
+ QuizResultPerformance,
4182
+ QuizResultTitle,
4183
+ QuizTitle
4184
+ });
4185
+ //# sourceMappingURL=index.js.map