UNPKG

analytica-frontend-lib

Version:

Repositório público dos componentes utilizados nas plataformas da Analytica Ensino

7,516 lines 293 kB
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/ActivityDetails/ActivityDetails.tsx
var ActivityDetails_exports = {};
__export(ActivityDetails_exports, {
  ActivityDetails: () => ActivityDetails,
  default: () => ActivityDetails_default
});
module.exports = __toCommonJS(ActivityDetails_exports);
var import_react22 = require("react");
var import_phosphor_react16 = require("phosphor-react");

// src/utils/utils.ts
var import_clsx = require("clsx");
var import_tailwind_merge = require("tailwind-merge");

// src/types/activityDetails.ts
var STUDENT_ACTIVITY_STATUS = {
  CONCLUIDO: "CONCLUIDO",
  AGUARDANDO_CORRECAO: "AGUARDANDO_CORRECAO",
  AGUARDANDO_RESPOSTA: "AGUARDANDO_RESPOSTA",
  NAO_ENTREGUE: "NAO_ENTREGUE"
};

// src/utils/activityDetailsUtils.ts
var getStatusBadgeConfig = (status) => {
  const configs = {
    [STUDENT_ACTIVITY_STATUS.CONCLUIDO]: {
      label: "Conclu\xEDdo",
      bgColor: "bg-green-50",
      textColor: "text-green-800"
    },
    [STUDENT_ACTIVITY_STATUS.AGUARDANDO_CORRECAO]: {
      label: "Aguardando Corre\xE7\xE3o",
      bgColor: "bg-yellow-50",
      textColor: "text-yellow-800"
    },
    [STUDENT_ACTIVITY_STATUS.AGUARDANDO_RESPOSTA]: {
      label: "Aguardando Resposta",
      bgColor: "bg-blue-50",
      textColor: "text-blue-800"
    },
    [STUDENT_ACTIVITY_STATUS.NAO_ENTREGUE]: {
      label: "N\xE3o Entregue",
      bgColor: "bg-red-50",
      textColor: "text-red-800"
    },
    default: {
      label: "Desconhecido",
      bgColor: "bg-gray-50",
      textColor: "text-gray-800"
    }
  };
  return configs[status] ?? configs.default;
};
var formatTimeSpent = (seconds) => {
  const hours = Math.floor(seconds / 3600);
  const minutes = Math.floor(seconds % 3600 / 60);
  const secs = seconds % 60;
  return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
};
var formatQuestionNumbers = (numbers) => {
  if (numbers.length === 0) return "-";
  return numbers.map((n) => String(n + 1).padStart(2, "0")).join(", ");
};
var formatDateToBrazilian = (dateString) => {
  const date = new Date(dateString);
  const day = String(date.getUTCDate()).padStart(2, "0");
  const month = String(date.getUTCMonth() + 1).padStart(2, "0");
  const year = date.getUTCFullYear();
  return `${day}/${month}/${year}`;
};

// src/utils/utils.ts
function cn(...inputs) {
  return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
}

// src/components/Text/Text.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var Text = ({
  children,
  size = "md",
  weight = "normal",
  color = "text-text-950",
  as,
  className = "",
  ...props
}) => {
  let sizeClasses = "";
  let weightClasses = "";
  const sizeClassMap = {
    "2xs": "text-2xs",
    xs: "text-xs",
    sm: "text-sm",
    md: "text-md",
    lg: "text-lg",
    xl: "text-xl",
    "2xl": "text-2xl",
    "3xl": "text-3xl",
    "4xl": "text-4xl",
    "5xl": "text-5xl",
    "6xl": "text-6xl"
  };
  sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
  const weightClassMap = {
    hairline: "font-hairline",
    light: "font-light",
    normal: "font-normal",
    medium: "font-medium",
    semibold: "font-semibold",
    bold: "font-bold",
    extrabold: "font-extrabold",
    black: "font-black"
  };
  weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
  const baseClasses = "font-primary";
  const Component = as ?? "p";
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    Component,
    {
      className: cn(baseClasses, sizeClasses, weightClasses, color, className),
      ...props,
      children
    }
  );
};
var Text_default = Text;

// src/components/Button/Button.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
var VARIANT_ACTION_CLASSES = {
  solid: {
    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",
    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",
    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"
  },
  outline: {
    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",
    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",
    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"
  },
  link: {
    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",
    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",
    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"
  }
};
var SIZE_CLASSES = {
  "extra-small": "text-xs px-3.5 py-2",
  small: "text-sm px-4 py-2.5",
  medium: "text-md px-5 py-2.5",
  large: "text-lg px-6 py-3",
  "extra-large": "text-lg px-7 py-3.5"
};
var Button = ({
  children,
  iconLeft,
  iconRight,
  size = "medium",
  variant = "solid",
  action = "primary",
  className = "",
  disabled,
  type = "button",
  ...props
}) => {
  const sizeClasses = SIZE_CLASSES[size];
  const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
  const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
    "button",
    {
      className: cn(baseClasses, variantClasses, sizeClasses, className),
      disabled,
      type,
      ...props,
      children: [
        iconLeft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-2 flex items-center", children: iconLeft }),
        children,
        iconRight && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ml-2 flex items-center", children: iconRight })
      ]
    }
  );
};
var Button_default = Button;

// src/components/Badge/Badge.tsx
var import_phosphor_react = require("phosphor-react");
var import_jsx_runtime3 = require("react/jsx-runtime");
var VARIANT_ACTION_CLASSES2 = {
  solid: {
    error: "bg-error-background text-error-700 focus-visible:outline-none",
    warning: "bg-warning text-warning-800 focus-visible:outline-none",
    success: "bg-success text-success-800 focus-visible:outline-none",
    info: "bg-info text-info-800 focus-visible:outline-none",
    muted: "bg-background-muted text-background-800 focus-visible:outline-none"
  },
  outlined: {
    error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
    warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
    success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
    info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
    muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
  },
  exams: {
    exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
    exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
    exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
    exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
  },
  examsOutlined: {
    exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
    exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
    exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
    exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
  },
  resultStatus: {
    negative: "bg-error text-error-800 focus-visible:outline-none",
    positive: "bg-success text-success-800 focus-visible:outline-none"
  },
  notification: "text-primary"
};
var SIZE_CLASSES2 = {
  small: "text-2xs px-2 py-1",
  medium: "text-xs px-2 py-1",
  large: "text-sm px-2 py-1"
};
var SIZE_CLASSES_ICON = {
  small: "size-3",
  medium: "size-3.5",
  large: "size-4"
};
var Badge = ({
  children,
  iconLeft,
  iconRight,
  size = "medium",
  variant = "solid",
  action = "error",
  className = "",
  notificationActive = false,
  ...props
}) => {
  const sizeClasses = SIZE_CLASSES2[size];
  const sizeClassesIcon = SIZE_CLASSES_ICON[size];
  const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
  const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
  const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
  const baseClassesIcon = "flex items-center";
  if (variant === "notification") {
    return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
      "div",
      {
        className: cn(baseClasses, variantClasses, sizeClasses, className),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
          notificationActive && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
            "span",
            {
              "data-testid": "notification-dot",
              className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
            }
          )
        ]
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
    "div",
    {
      className: cn(baseClasses, variantClasses, sizeClasses, className),
      ...props,
      children: [
        iconLeft && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
        children,
        iconRight && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
      ]
    }
  );
};
var Badge_default = Badge;

// src/components/EmptyState/EmptyState.tsx
var import_jsx_runtime4 = require("react/jsx-runtime");
var EmptyState = ({
  image,
  title,
  description,
  buttonText,
  buttonIcon,
  onButtonClick,
  buttonVariant = "solid",
  buttonAction = "primary"
}) => {
  const displayTitle = title || "Nenhum dado dispon\xEDvel";
  const displayDescription = description || "N\xE3o h\xE1 dados para exibir no momento.";
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col justify-center items-center gap-6 w-full min-h-[705px] bg-background rounded-xl p-6", children: [
    image && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: image, alt: displayTitle, className: "w-[170px] h-[150px]" }),
    /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col items-center gap-4 w-full max-w-[600px] px-6", children: [
      /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
        Text_default,
        {
          as: "h2",
          className: "text-text-950 font-semibold text-3xl leading-[35px] text-center",
          children: displayTitle
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text_default, { className: "text-text-600 font-normal text-[18px] leading-[27px] text-center", children: displayDescription })
    ] }),
    buttonText && onButtonClick && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
      Button_default,
      {
        variant: buttonVariant,
        action: buttonAction,
        size: "large",
        onClick: onButtonClick,
        iconLeft: buttonIcon,
        className: "rounded-full px-5 py-2.5",
        children: buttonText
      }
    )
  ] });
};
var EmptyState_default = EmptyState;

// src/components/Skeleton/Skeleton.tsx
var import_react = require("react");
var import_jsx_runtime5 = require("react/jsx-runtime");
var SKELETON_ANIMATION_CLASSES = {
  pulse: "animate-pulse",
  none: ""
};
var SKELETON_VARIANT_CLASSES = {
  text: "h-4 bg-background-200 rounded",
  circular: "bg-background-200 rounded-full",
  rectangular: "bg-background-200",
  rounded: "bg-background-200 rounded-lg"
};
var SPACING_CLASSES = {
  none: "",
  small: "space-y-1",
  medium: "space-y-2",
  large: "space-y-3"
};
var Skeleton = (0, import_react.forwardRef)(
  ({
    variant = "text",
    width,
    height,
    animation = "pulse",
    lines = 1,
    spacing = "none",
    className = "",
    children,
    ...props
  }, ref) => {
    const animationClass = SKELETON_ANIMATION_CLASSES[animation];
    const variantClass = SKELETON_VARIANT_CLASSES[variant];
    const spacingClass = SPACING_CLASSES[spacing];
    const style = {
      width: typeof width === "number" ? `${width}px` : width,
      height: typeof height === "number" ? `${height}px` : height
    };
    if (variant === "text" && lines > 1) {
      return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
        "div",
        {
          ref,
          className: cn("flex flex-col", spacingClass, className),
          ...props,
          children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
            "div",
            {
              className: cn(variantClass, animationClass),
              style: index === lines - 1 ? { width: "60%" } : void 0
            },
            index
          ))
        }
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
      "div",
      {
        ref,
        className: cn(variantClass, animationClass, className),
        style,
        ...props,
        children
      }
    );
  }
);
var SkeletonText = (0, import_react.forwardRef)(
  (props, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Skeleton, { ref, variant: "text", ...props })
);
var SkeletonCircle = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Skeleton, { ref, variant: "circular", ...props }));
var SkeletonRectangle = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
var SkeletonRounded = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
var SkeletonCard = (0, import_react.forwardRef)(
  ({
    showAvatar = true,
    showTitle = true,
    showDescription = true,
    showActions = true,
    lines = 2,
    className = "",
    ...props
  }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
      "div",
      {
        ref,
        className: cn(
          "w-full p-4 bg-background border border-border-200 rounded-lg",
          className
        ),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-start space-x-3", children: [
            showAvatar && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonCircle, { width: 40, height: 40 }),
            /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 space-y-2", children: [
              showTitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonText, { width: "60%", height: 20 }),
              showDescription && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonText, { lines, spacing: "small" })
            ] })
          ] }),
          showActions && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
            /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
            /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonRectangle, { width: 80, height: 32 })
          ] })
        ]
      }
    );
  }
);
var SkeletonList = (0, import_react.forwardRef)(
  ({
    items = 3,
    showAvatar = true,
    showTitle = true,
    showDescription = true,
    lines = 1,
    className = "",
    ...props
  }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-start space-x-3 p-3", children: [
      showAvatar && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonCircle, { width: 32, height: 32 }),
      /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 space-y-2", children: [
        showTitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonText, { width: "40%", height: 16 }),
        showDescription && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonText, { lines, spacing: "small" })
      ] })
    ] }, index)) });
  }
);
var SkeletonTable = (0, import_react.forwardRef)(
  ({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
      showHeader && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
        SkeletonText,
        {
          width: `${100 / columns}%`,
          height: 20
        },
        index
      )) }),
      /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
        SkeletonText,
        {
          width: `${100 / columns}%`,
          height: 16
        },
        colIndex
      )) }, rowIndex)) })
    ] });
  }
);

// src/components/TableProvider/TableProvider.tsx
var import_react21 = require("react");

// src/components/Table/Table.tsx
var import_react2 = require("react");
var import_phosphor_react3 = require("phosphor-react");

// src/components/NoSearchResult/NoSearchResult.tsx
var import_jsx_runtime6 = require("react/jsx-runtime");
var NoSearchResult = ({ image, title, description }) => {
  const displayTitle = title || "Nenhum resultado encontrado";
  const displayDescription = description || "N\xE3o encontramos nenhum resultado com esse nome. Tente revisar a busca ou usar outra palavra-chave.";
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-row justify-center items-center gap-8 w-full max-w-4xl min-h-96", children: [
    /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-72 h-72 flex-shrink-0 relative", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
      "img",
      {
        src: image,
        alt: "No search results",
        className: "w-full h-full object-contain"
      }
    ) }),
    /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col items-start w-full max-w-md", children: [
      /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-row justify-between items-end px-6 pt-6 pb-4 w-full rounded-t-xl", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
        Text_default,
        {
          as: "h2",
          className: "text-text-950 font-semibold text-3xl leading-tight w-full flex items-center",
          children: displayTitle
        }
      ) }),
      /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-row justify-center items-center px-6 gap-2 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { className: "text-text-600 font-normal text-lg leading-relaxed w-full text-justify", children: displayDescription }) })
    ] })
  ] });
};
var NoSearchResult_default = NoSearchResult;

// src/components/Table/TablePagination.tsx
var import_phosphor_react2 = require("phosphor-react");
var import_jsx_runtime7 = require("react/jsx-runtime");
var TablePagination = ({
  totalItems,
  currentPage,
  totalPages,
  itemsPerPage,
  itemsPerPageOptions = [10, 20, 50, 100],
  onPageChange,
  onItemsPerPageChange,
  itemLabel = "itens",
  className,
  ...props
}) => {
  const startItem = (currentPage - 1) * itemsPerPage + 1;
  const handlePrevious = () => {
    if (currentPage > 1) {
      onPageChange(currentPage - 1);
    }
  };
  const handleNext = () => {
    if (currentPage < totalPages) {
      onPageChange(currentPage + 1);
    }
  };
  const handleItemsPerPageChange = (e) => {
    if (onItemsPerPageChange) {
      onItemsPerPageChange(Number(e.target.value));
    }
  };
  const isFirstPage = currentPage === 1;
  const isLastPage = currentPage === totalPages;
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
    "div",
    {
      className: cn(
        "flex flex-col sm:flex-row items-center gap-3 sm:gap-4 w-full bg-background-50 rounded-xl p-4",
        "sm:justify-between",
        className
      ),
      ...props,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "font-normal text-xs leading-[14px] text-text-800", children: [
          startItem,
          " de ",
          totalItems,
          " ",
          itemLabel
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-wrap sm:flex-nowrap items-center gap-2 sm:gap-4 justify-center sm:justify-start", children: [
          onItemsPerPageChange && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
            /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
              "select",
              {
                value: itemsPerPage,
                onChange: handleItemsPerPageChange,
                className: "w-24 h-9 py-0 px-3 pr-8 bg-background border border-border-300 rounded appearance-none cursor-pointer font-normal text-sm leading-[21px] text-text-900",
                "aria-label": "Items por p\xE1gina",
                children: itemsPerPageOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("option", { value: option, children: [
                  option,
                  " itens"
                ] }, option))
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
              import_phosphor_react2.CaretDown,
              {
                size: 14,
                weight: "regular",
                className: "absolute right-3 top-1/2 -translate-y-1/2 text-background-600 pointer-events-none"
              }
            )
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "font-normal text-xs leading-[14px] text-text-950", children: [
            "P\xE1gina ",
            currentPage,
            " de ",
            totalPages
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
            "button",
            {
              onClick: handlePrevious,
              disabled: isFirstPage,
              className: cn(
                "flex flex-row justify-center items-center py-2 px-4 gap-2 rounded-3xl transition-all",
                isFirstPage ? "opacity-50 cursor-not-allowed" : "hover:bg-primary-950/10 cursor-pointer"
              ),
              "aria-label": "P\xE1gina anterior",
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react2.CaretLeft, { size: 12, weight: "bold", className: "text-primary-950" }),
                /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Anterior" })
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
            "button",
            {
              onClick: handleNext,
              disabled: isLastPage,
              className: cn(
                "flex flex-row justify-center items-center py-2 px-4 gap-2 rounded-3xl transition-all",
                isLastPage ? "opacity-50 cursor-not-allowed" : "hover:bg-primary-950/10 cursor-pointer"
              ),
              "aria-label": "Pr\xF3xima p\xE1gina",
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Pr\xF3xima" }),
                /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react2.CaretRight, { size: 12, weight: "bold", className: "text-primary-950" })
              ]
            }
          )
        ] })
      ]
    }
  );
};
TablePagination.displayName = "TablePagination";
var TablePagination_default = TablePagination;

// src/components/Table/Table.tsx
var import_jsx_runtime8 = require("react/jsx-runtime");
function useTableSort(data, options = {}) {
  const { syncWithUrl = false } = options;
  const getInitialState = () => {
    if (!syncWithUrl || globalThis.window === void 0) {
      return { column: null, direction: null };
    }
    const params = new URLSearchParams(globalThis.location.search);
    const sortBy = params.get("sortBy");
    const sort = params.get("sort");
    if (sortBy && sort && (sort === "ASC" || sort === "DESC")) {
      return {
        column: sortBy,
        direction: sort.toLowerCase()
      };
    }
    return { column: null, direction: null };
  };
  const initialState = getInitialState();
  const [sortColumn, setSortColumn] = (0, import_react2.useState)(
    initialState.column
  );
  const [sortDirection, setSortDirection] = (0, import_react2.useState)(
    initialState.direction
  );
  (0, import_react2.useEffect)(() => {
    if (!syncWithUrl || globalThis.window === void 0) return;
    const url = new URL(globalThis.location.href);
    const params = url.searchParams;
    if (sortColumn && sortDirection) {
      params.set("sortBy", sortColumn);
      params.set("sort", sortDirection.toUpperCase());
    } else {
      params.delete("sortBy");
      params.delete("sort");
    }
    globalThis.history.replaceState({}, "", url.toString());
  }, [sortColumn, sortDirection, syncWithUrl]);
  const handleSort = (column) => {
    if (sortColumn === column) {
      if (sortDirection === "asc") {
        setSortDirection("desc");
      } else if (sortDirection === "desc") {
        setSortColumn(null);
        setSortDirection(null);
      }
    } else {
      setSortColumn(column);
      setSortDirection("asc");
    }
  };
  const sortedData = (0, import_react2.useMemo)(() => {
    if (!sortColumn || !sortDirection) {
      return data;
    }
    return [...data].sort((a, b) => {
      const aValue = a[sortColumn];
      const bValue = b[sortColumn];
      if (typeof aValue === "string" && typeof bValue === "string") {
        const comparison = aValue.localeCompare(bValue);
        return sortDirection === "asc" ? comparison : -comparison;
      }
      if (typeof aValue === "number" && typeof bValue === "number") {
        return sortDirection === "asc" ? aValue - bValue : bValue - aValue;
      }
      return 0;
    });
  }, [data, sortColumn, sortDirection]);
  return { sortedData, sortColumn, sortDirection, handleSort };
}
var renderHeaderElements = (children) => {
  return import_react2.Children.map(children, (child) => {
    if ((0, import_react2.isValidElement)(child) && (child.type === TableCaption || child.type === TableHeader)) {
      return child;
    }
    return null;
  });
};
var getNoSearchResultContent = (config, defaultTitle, defaultDescription) => {
  if (config.component) {
    return config.component;
  }
  if (config.image) {
    return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
      NoSearchResult_default,
      {
        image: config.image,
        title: config.title || defaultTitle,
        description: config.description || defaultDescription
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "text-center", children: [
    /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-text-600 text-lg font-semibold mb-2", children: config.title || defaultTitle }),
    /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-text-500 text-sm", children: config.description || defaultDescription })
  ] });
};
var getEmptyStateContent = (config, defaultTitle, defaultDescription) => {
  if (config?.component) {
    return config.component;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
    EmptyState_default,
    {
      image: config?.image,
      title: config?.title || defaultTitle,
      description: config?.description || defaultDescription,
      buttonText: config?.buttonText,
      buttonIcon: config?.buttonIcon,
      onButtonClick: config?.onButtonClick,
      buttonVariant: config?.buttonVariant,
      buttonAction: config?.buttonAction
    }
  );
};
var renderTableWrapper = (variant, tableRef, className, children, stateContent, tableProps) => {
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
    "div",
    {
      className: cn(
        "relative w-full overflow-x-auto",
        variant === "default" && "border border-border-200 rounded-xl"
      ),
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
          "table",
          {
            ref: tableRef,
            className: cn(
              "analytica-table w-full caption-bottom text-sm border-separate border-spacing-0",
              className
            ),
            ...tableProps,
            children: renderHeaderElements(children)
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "py-8 flex justify-center", children: stateContent })
      ]
    }
  );
};
var Table = (0, import_react2.forwardRef)(
  ({
    variant = "default",
    className,
    children,
    showLoading = false,
    loadingState,
    showNoSearchResult = false,
    noSearchResultState,
    showEmpty = false,
    emptyState,
    ...props
  }, ref) => {
    const defaultNoSearchResultState = {
      title: "Nenhum resultado encontrado",
      description: "N\xE3o encontramos nenhum resultado com esse nome. Tente revisar a busca ou usar outra palavra-chave."
    };
    const defaultEmptyState = {
      title: "Nenhum dado dispon\xEDvel",
      description: "N\xE3o h\xE1 dados para exibir no momento."
    };
    const finalNoSearchResultState = noSearchResultState || defaultNoSearchResultState;
    const finalEmptyState = emptyState || defaultEmptyState;
    if (showLoading) {
      const loadingContent = loadingState?.component || /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SkeletonTable, { rows: 5, columns: 4, showHeader: false });
      return renderTableWrapper(
        variant,
        ref,
        className,
        children,
        loadingContent,
        props
      );
    }
    if (showNoSearchResult) {
      const noSearchContent = getNoSearchResultContent(
        finalNoSearchResultState,
        defaultNoSearchResultState.title || "",
        defaultNoSearchResultState.description || ""
      );
      return renderTableWrapper(
        variant,
        ref,
        className,
        children,
        noSearchContent,
        props
      );
    }
    if (showEmpty) {
      const emptyContent = getEmptyStateContent(
        finalEmptyState,
        defaultEmptyState.title || "Nenhum dado dispon\xEDvel",
        defaultEmptyState.description || "N\xE3o h\xE1 dados para exibir no momento."
      );
      return renderTableWrapper(
        variant,
        ref,
        className,
        children,
        emptyContent,
        props
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
      "div",
      {
        className: cn(
          "relative w-full overflow-x-auto",
          variant === "default" && "border border-border-200 rounded-xl"
        ),
        children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
          "table",
          {
            ref,
            className: cn(
              variant === "default" && "analytica-table",
              variant === "default" && "border-separate border-spacing-0",
              "w-full caption-bottom text-sm",
              className
            ),
            ...props,
            children: [
              !import_react2.Children.toArray(children).some(
                (child) => (0, import_react2.isValidElement)(child) && child.type === TableCaption
              ) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("caption", { className: "sr-only", children: "My Table" }),
              children
            ]
          }
        )
      }
    );
  }
);
Table.displayName = "Table";
var TableHeader = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
  "thead",
  {
    ref,
    className: cn("[&_tr:first-child]:border-0", className),
    ...props
  }
));
TableHeader.displayName = "TableHeader";
var TableBody = (0, import_react2.forwardRef)(
  ({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
    "tbody",
    {
      ref,
      className: cn(
        "[&_tr:last-child]:border-border-200",
        variant === "default" && "border-t border-border-200",
        className
      ),
      ...props
    }
  )
);
TableBody.displayName = "TableBody";
var TableFooter = (0, import_react2.forwardRef)(
  ({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
    "tfoot",
    {
      ref,
      className: cn(
        "bg-background-50 font-medium [&>tr]:last:border-b-0 px-6 py-3.5",
        variant === "default" && "border-t border-border-200",
        className
      ),
      ...props
    }
  )
);
TableFooter.displayName = "TableFooter";
var VARIANT_STATES_ROW = {
  default: {
    default: "border border-border-200",
    defaultBorderless: "border-b border-border-200",
    borderless: ""
  },
  selected: {
    default: "border-b-2 border-indicator-primary",
    defaultBorderless: "border-b border-indicator-primary",
    borderless: "bg-indicator-primary/10"
  },
  invalid: {
    default: "border-b-2 border-indicator-error",
    defaultBorderless: "border-b border-indicator-error",
    borderless: "bg-indicator-error/10"
  },
  disabled: {
    default: "border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed",
    defaultBorderless: "border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed",
    borderless: "bg-background-50 opacity-50 cursor-not-allowed"
  }
};
var TableRow = (0, import_react2.forwardRef)(
  ({
    variant = "default",
    state = "default",
    clickable = false,
    className,
    ...props
  }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
      "tr",
      {
        ref,
        className: cn(
          "transition-colors",
          state === "disabled" ? "" : "hover:bg-muted/50",
          state === "disabled" || !clickable ? "" : "cursor-pointer",
          VARIANT_STATES_ROW[state][variant],
          className
        ),
        "aria-disabled": state === "disabled",
        ...props
      }
    );
  }
);
TableRow.displayName = "TableRow";
var TableHead = (0, import_react2.forwardRef)(
  ({
    className,
    sortable = true,
    sortDirection = null,
    onSort,
    children,
    ...props
  }, ref) => {
    const handleClick = () => {
      if (sortable && onSort) {
        onSort();
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
      "th",
      {
        ref,
        className: cn(
          "h-10 px-6 py-3.5 text-left align-middle font-bold text-base text-text-800 tracking-[0.2px] leading-none [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] whitespace-nowrap",
          sortable && "cursor-pointer select-none hover:bg-muted/30",
          className
        ),
        onClick: handleClick,
        ...props,
        children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2", children: [
          children,
          sortable && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col", children: [
            sortDirection === "asc" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_phosphor_react3.CaretUp, { size: 16, weight: "fill", className: "text-text-800" }),
            sortDirection === "desc" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_phosphor_react3.CaretDown, { size: 16, weight: "fill", className: "text-text-800" })
          ] })
        ] })
      }
    );
  }
);
TableHead.displayName = "TableHead";
var TableCell = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
  "td",
  {
    ref,
    className: cn(
      "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-base font-normal text-text-800 leading-[150%] tracking-normal px-6 py-3.5 whitespace-nowrap",
      className
    ),
    ...props
  }
));
TableCell.displayName = "TableCell";
var TableCaption = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
  "caption",
  {
    ref,
    className: cn(
      "border-t border-border-200 text-sm text-text-800 px-6 py-3.5",
      className
    ),
    ...props
  }
));
TableCaption.displayName = "TableCaption";
var Table_default = Table;

// src/components/Filter/useTableFilter.ts
var import_react3 = require("react");
var useTableFilter = (initialConfigs, options = {}) => {
  const { syncWithUrl = false } = options;
  const getInitialState = (0, import_react3.useCallback)(() => {
    if (!syncWithUrl || globalThis.window === void 0) {
      return initialConfigs;
    }
    const params = new URLSearchParams(globalThis.window.location.search);
    const configsWithUrlState = initialConfigs.map((config) => ({
      ...config,
      categories: config.categories.map((category) => {
        const urlValue = params.get(`filter_${category.key}`);
        const selectedIds = urlValue ? urlValue.split(",").filter(Boolean) : [];
        return {
          ...category,
          selectedIds
        };
      })
    }));
    return configsWithUrlState;
  }, [initialConfigs, syncWithUrl]);
  const [filterConfigs, setFilterConfigs] = (0, import_react3.useState)(getInitialState);
  const activeFilters = (0, import_react3.useMemo)(() => {
    const filters = {};
    for (const config of filterConfigs) {
      for (const category of config.categories) {
        if (category.selectedIds && category.selectedIds.length > 0) {
          filters[category.key] = category.selectedIds;
        }
      }
    }
    return filters;
  }, [filterConfigs]);
  const hasActiveFilters = Object.keys(activeFilters).length > 0;
  const updateFilters = (0, import_react3.useCallback)((configs) => {
    setFilterConfigs(configs);
  }, []);
  const applyFilters = (0, import_react3.useCallback)(() => {
    if (!syncWithUrl || globalThis.window === void 0) {
      return;
    }
    const url = new URL(globalThis.window.location.href);
    const params = url.searchParams;
    for (const config of filterConfigs) {
      for (const category of config.categories) {
        const paramKey = `filter_${category.key}`;
        if (category.selectedIds && category.selectedIds.length > 0) {
          params.set(paramKey, category.selectedIds.join(","));
        } else {
          params.delete(paramKey);
        }
      }
    }
    globalThis.window.history.replaceState({}, "", url.toString());
  }, [filterConfigs, syncWithUrl]);
  const clearFilters = (0, import_react3.useCallback)(() => {
    const clearedConfigs = filterConfigs.map((config) => ({
      ...config,
      categories: config.categories.map((category) => ({
        ...category,
        selectedIds: []
      }))
    }));
    setFilterConfigs(clearedConfigs);
    if (syncWithUrl && globalThis.window !== void 0) {
      const url = new URL(globalThis.window.location.href);
      const params = url.searchParams;
      for (const config of filterConfigs) {
        for (const category of config.categories) {
          params.delete(`filter_${category.key}`);
        }
      }
      globalThis.window.history.replaceState({}, "", url.toString());
    }
  }, [filterConfigs, syncWithUrl]);
  (0, import_react3.useEffect)(() => {
    if (!syncWithUrl || globalThis.window === void 0) {
      return;
    }
    const handlePopState = () => {
      setFilterConfigs(getInitialState());
    };
    globalThis.window.addEventListener("popstate", handlePopState);
    return () => globalThis.window.removeEventListener("popstate", handlePopState);
  }, [syncWithUrl, getInitialState]);
  return {
    filterConfigs,
    activeFilters,
    hasActiveFilters,
    updateFilters,
    applyFilters,
    clearFilters
  };
};

// src/components/Search/Search.tsx
var import_phosphor_react7 = require("phosphor-react");
var import_react9 = require("react");

// src/components/DropdownMenu/DropdownMenu.tsx
var import_phosphor_react6 = require("phosphor-react");
var import_react8 = require("react");
var import_react_dom = require("react-dom");
var import_zustand2 = require("zustand");

// src/components/Modal/Modal.tsx
var import_react4 = require("react");
var import_phosphor_react4 = require("phosphor-react");

// src/components/Modal/utils/videoUtils.ts
var isYouTubeUrl = (url) => {
  const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
  return youtubeRegex.test(url);
};
var isValidYouTubeHost = (host) => {
  if (host === "youtu.be") return "youtu.be";
  const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
  if (isValidYouTubeCom) return "youtube";
  const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
  if (isValidNoCookie) return "nocookie";
  return null;
};
var extractYoutuBeId = (pathname) => {
  const firstSeg = pathname.split("/").filter(Boolean)[0];
  return firstSeg || null;
};
var extractYouTubeId = (pathname, searchParams) => {
  const parts = pathname.split("/").filter(Boolean);
  const [first, second] = parts;
  if (first === "embed" && second) return second;
  if (first === "shorts" && second) return second;
  if (first === "live" && second) return second;
  const v = searchParams.get("v");
  if (v) return v;
  return null;
};
var getYouTubeVideoId = (url) => {
  try {
    const u = new URL(url);
    const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
    if (!hostType) return null;
    if (hostType === "youtu.be") {
      return extractYoutuBeId(u.pathname);
    }
    return extractYouTubeId(u.pathname, u.searchParams);
  } catch {
    return null;
  }
};
var getYouTubeEmbedUrl = (videoId) => {
  return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
};

// src/components/Modal/Modal.tsx
var import_jsx_runtime9 = require("react/jsx-runtime");
var SIZE_CLASSES3 = {
  xs: "max-w-[360px]",
  sm: "max-w-[420px]",
  md: "max-w-[510px]",
  lg: "max-w-[640px]",
  xl: "max-w-[970px]"
};
var Modal = ({
  isOpen,
  onClose,
  title,
  children,
  size = "md",
  className = "",
  closeOnEscape = true,
  footer,
  hideCloseButton = false,
  variant = "default",
  description,
  image,
  imageAlt,
  actionLink,
  actionLabel,
  contentClassName = ""
}) => {
  const titleId = (0, import_react4.useId)();
  (0, import_react4.useEffect)(() => {
    if (!isOpen || !closeOnEscape) return;
    const handleEscape = (event) => {
      if (event.key === "Escape") {
        onClose();
      }
    };
    document.addEventListener("keydown", handleEscape);
    return () => document.removeEventListener("keydown", handleEscape);
  }, [isOpen, closeOnEscape, onClose]);
  (0, import_react4.useEffect)(() => {
    if (!isOpen) return;
    const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
    const originalOverflow = document.body.style.overflow;
    const originalPaddingRight = document.body.style.paddingRight;
    document.body.style.overflow = "hidden";
    if (scrollbarWidth > 0) {
      document.body.style.paddingRight = `${scrollbarWidth}px`;
      const overlay = document.createElement("div");
      overlay.id = "modal-scrollbar-overlay";
      overlay.style.cssText = `
        position: fixed;
        top: 0;
        right: 0;
        width: ${scrollbarWidth}px;
        height: 100vh;
        background-color: rgb(0 0 0 / 0.6);
        z-index: 40;
        pointer-events: none;
      `;
      document.body.appendChild(overlay);
    }
    return () => {
      document.body.style.overflow = originalOverflow;
      document.body.style.paddingRight = originalPaddingRight;
      const overlay = document.getElementById("modal-scrollbar-overlay");
      if (overlay) {
        overlay.remove();
      }
    };
  }, [isOpen]);
  if (!isOpen) return null;
  const sizeClasses = SIZE_CLASSES3[size];
  const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
  const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
  const modalClasses = cn(
    baseClasses,
    sizeClasses,
    dialogResetClasses,
    className
  );
  const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
  const handleActionClick = () => {
    if (actionLink) {
      window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
    }
  };
  if (variant === "activity") {
    return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
      "dialog",
      {
        className: modalClasses,
        "aria-labelledby": titleId,
        "aria-modal": "true",
        open: true,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
            "button",
            {
              onClick: onClose,
              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",
              "aria-label": "Fechar modal",
              children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.X, { size: 18 })
            }
          ) }),
          /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
            image && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
              "img",
              {
                src: image,
                alt: imageAlt ?? "",
                className: "w-[122px] h-[122px] object-contain"
              }
            ) }),
            /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
              "h2",
              {
                id: titleId,
                className: "text-lg font-semibold text-text-950 text-center",
                children: title
              }
            ),
            description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
            actionLink && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w-full", children: [
              (() => {
                const normalized = normalizeUrl(actionLink);
                const isYT = isYouTubeUrl(normalized);
                if (!isYT) return null;
                const id = getYouTubeVideoId(normalized);
                if (!id) {
                  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
                    Button_default,
                    {
                      variant: "solid",
                      action: "primary",
                      size: "large",
                      className: "w-full",
                      onClick: handleActionClick,
                      children: actionLabel || "Iniciar Atividade"
                    }
                  );
                }
                return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
                  "iframe",
                  {
                    src: getYouTubeEmbedUrl(id),
                    className: "w-full aspect-video rounded-lg",
                    allowFullScreen: true,
                    allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
                    title: "V\xEDdeo YouTube"
                  }
                );
              })(),
              !isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
                Button_default,
                {
                  variant: "solid",
                  action: "primary",
                  size: "large",
                  className: "w-full",
                  onClick: handleActionClick,
                  children: actionLabel || "Iniciar Atividade"
                }
              )
            ] })
          ] })
        ]
      }
    ) });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
    "dialog",
    {
      className: modalClasses,
      "aria-labelledby": titleId,
      "aria-modal": "true",
      open: true,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between px-6 py-6", children: [
          /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
          !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
            "button",
            {
              onClick: onClose,
              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",
              "aria-label": "Fechar modal",
              children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.X, { size: 18 })
            }
          )
        ] }),
        children && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("px-6 pb-6", contentClassName), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
        footer && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
      ]
    }
  ) });
};
var Modal_default = Modal;

// src/components/ThemeToggle/ThemeToggle.tsx
var import_phosphor_react5 = require("phosphor-react");
var import_react7 = require("react");

// src/components/SelectionButton/SelectionButton.tsx
var import_react5 = require("react");
var import_jsx_runtime10 = require("react/jsx-runtime");
var SelectionButton = (0, import_react5.forwardRef)(
  ({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
    const baseClasses = [
      "inline-flex",
      "items-center",
      "justify-start",
      "gap-2",
      "p-4",
      "rounded-xl",
      "cursor-pointer",
      "border",
      "border-border-50",
      "bg-background",
      "text-sm",
      "text-text-700",
      "font-bold",
      "shadow-soft-shadow-1",
      "hover:bg-background-100",
      "focus-visible:outline-none",
      "focus-visible:ring-2",
      "focus-visible:ring-indicator-info",
      "focus-visible:ring-offset-0",
      "focus-visible:shadow-none",
      "active:ring-2",
      "active:ring-primary-950",
      "active:ring-offset-0",
      "active:shadow-none",
      "disabled:opacity-50",
      "disabled:cursor-not-allowed"
    ];
    const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
    const allClasses = [...baseClasses, ...stateClasses].join(" ");
    return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
      "button",
      {
        ref,
        type: "button",
        className: cn(allClasses, className),
        disabled,
        "aria-pressed": selected,
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
          /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: label })
        ]
      }
    );
  }
);
SelectionButton.displayName = "SelectionButton";
var SelectionButton_default = SelectionButton;

// src/hooks/useTheme.ts
var import_react6 = require("react");

// src/store/themeStore.ts
var import_zustand = require("zustand");
var import_middleware = require("zustand/middleware");
var applyThemeToDOM = (mode) => {
  const htmlElement = document.documentElement;
  const originalTheme = htmlElement.getAttribute("data-original-theme");
  if (mode === "dark") {
    htmlElement.setAttribute("data-theme", "dark");
    return true;
  } else if (mode === "light") {
    if (originalTheme) {
      htmlElement.setAttribute("data-theme", originalTheme);
    }
    return false;
  } else if (mode === "system") {
    const isSystemDark = window.matchMedia(
      "(prefers-color-scheme: dark)"
    ).matches;
    if (isSystemDark) {
      htmlElement.setAttribute("data-theme", "dark");
      return true;
    } else if (originalTheme) {
      htmlElement.setAttribute("data-theme", originalTheme);
      return false;
    }
  }
  return false;
};
var saveOriginalTheme = () => {
  const htmlElement = document.documentElement;
  const currentTheme = htmlElement.getAttribute("data-theme");
  if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
    htmlElement.setAttribute("data-original-theme", currentTheme);
  }
};
var useThemeStore = (0, import_zustand.create)()(
  (0, import_middleware.devtools)(
    (0, import_middleware.persist)(
      (set, get) => ({
        // Initial state
        themeMode: "system",
        isDark: false,
        // Actions
        applyTheme: (mode) => {
          const isDark = applyThemeToDOM(mode);
          set({ isDark });
        },
        toggleTheme: () => {
          const { themeMode, applyTheme } = get();
          let newMode;
          if (themeMode === "light") {
            newMode = "dark";
          } else if (themeMode === "dark") {
            newMode = "light";
          } else {
            newMode = "dark";
          }
          set({ themeMode: newMode });
          applyTheme(newMode);
        },
        setTheme: (mode) => {
          const { applyTheme } = get();
          set({ themeMode: mode });
          applyTheme(mode);
        },
        initializeTheme: () => {
          const { themeMode, applyTheme } = get();
          saveOriginalTheme();
          applyTheme(themeMode);
        },
        handleSystemThemeChange: () => {
          const { themeMode, applyTheme } = get();
          if (themeMode === "system") {
            applyTheme("system");
          }
        }
      }),
      {
        name: "theme-store",
        // Nome da chave no localStorage
        partialize: (state) => ({
          themeMode: state.themeMode
        })
        // Só persiste o themeMode, não o isDark
      }
    ),
    {
      name: "theme-store"
    }
  )
);

// src/hooks/useTheme.ts
var useTheme = () => {
  const {
    themeMode,
    isDark,
    toggleTheme,
    setTheme,
    initializeTheme,
    handleSystemThemeChange
  } = useThemeStore();
  (0, import_react6.useEffect)(() => {
    initializeTheme();
    const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
    mediaQuery.addEventListener("change", handleSystemThemeChange);
    return () => {
      mediaQuery.removeEventListener("change", handleSystemThemeChange);
    };
  }, [initializeTheme, handleSystemThemeChange]);
  return {
    themeMode,
    isDark,
    toggleTheme,
    setTheme
  };
};

// src/components/ThemeToggle/ThemeToggle.tsx
var import_jsx_runtime11 = require("react/jsx-runtime");
var ThemeToggle = ({
  variant = "default",
  onToggle
}) => {
  const { themeMode, setTheme } = useTheme();
  const [tempTheme, setTempTheme] = (0, import_react7.useState)(themeMode);
  (0, import_react7.useEffect)(() => {
    setTempTheme(themeMode);
  }, [themeMode]);
  const problemTypes = [
    {
      id: "light",
      title: "Claro",
      icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.Sun, { size: 24 })
    },
    {
      id: "dark",
      title: "Escuro",
      icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_phosphor_react5.Moon, { size: 24 })
    },
    {
      id: "system",
      title: "Sistema",
      icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
        "svg",
        {
          width: "25",
          height: "25",
          viewBox: "0 0 25 25",
          fill: "none",
          xmlns: "http://www.w3.org/2000/svg",
          children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
            "path",
            {
              d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
              fill: "#525252"
            }
          )
        }
      )
    }
  ];
  const handleThemeSelect = (selectedTheme) => {
    if (variant === "with-save") {
      setTempTheme(selectedTheme);
    } else {
      setTheme(selectedTheme);
    }
    if (onToggle) {
      onToggle(selectedTheme);
    }
  };
  const currentTheme = variant === "with-save" ? tempTheme : themeMode;
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-row gap-2 sm:gap-4 py-2", children: problemTypes.map((type) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
    SelectionButton_default,
    {
      icon: type.icon,
      label: type.title,
      selected: currentTheme === type.id,
      onClick: () => handleThemeSelect(type.id),
      className: "w-full p-2 sm:p-4"
    },
    type.id
  )) });
};

// src/components/DropdownMenu/DropdownMenu.tsx
var import_jsx_runtime12 = require("react/jsx-runtime");
function createDropdownStore() {
  return (0, import_zustand2.create)((set) => ({
    open: false,
    setOpen: (open) => set({ open })
  }));
}
var useDropdownStore = (externalStore) => {
  if (!externalStore) {
    throw new Error(
      "Component must be used within a DropdownMenu (store is missing)"
    );
  }
  return externalStore;
};
var injectStore = (children, store) => {
  return import_react8.Children.map(children, (child) => {
    if ((0, import_react8.isValidElement)(child)) {
      const typedChild = child;
      const displayName = typedChild.type.displayName;
      const allowed = [
        "DropdownMenuTrigger",
        "DropdownContent",
        "DropdownMenuContent",
        "DropdownMenuSeparator",
        "DropdownMenuItem",
        "MenuLabel",
        "ProfileMenuTrigger",
        "ProfileMenuHeader",
        "ProfileMenuFooter",
        "ProfileToggleTheme"
      ];
      let newProps = {};
      if (allowed.includes(displayName)) {
        newProps.store = store;
      }
      if (typedChild.props.children) {
        newProps.children = injectStore(typedChild.props.children, store);
      }
      return (0, import_react8.cloneElement)(typedChild, newProps);
    }
    return child;
  });
};
var DropdownMenu = ({
  children,
  open: propOpen,
  onOpenChange
}) => {
  const storeRef = (0, import_react8.useRef)(null);
  storeRef.current ??= createDropdownStore();
  const store = storeRef.current;
  const { open, setOpen: storeSetOpen } = (0, import_zustand2.useStore)(store, (s) => s);
  const setOpen = (newOpen) => {
    storeSetOpen(newOpen);
  };
  const menuRef = (0, import_react8.useRef)(null);
  const handleArrowDownOrArrowUp = (event) => {
    const menuContent = menuRef.current?.querySelector('[role="menu"]');
    if (menuContent) {
      event.preventDefault();
      const items = Array.from(
        menuContent.querySelectorAll(
          '[role="menuitem"]:not([aria-disabled="true"])'
        )
      ).filter((el) => el instanceof HTMLElement);
      if (items.length === 0) return;
      const focusedItem = document.activeElement;
      const currentIndex = items.indexOf(focusedItem);
      let nextIndex;
      if (event.key === "ArrowDown") {
        nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
      } else {
        nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
      }
      items[nextIndex]?.focus();
    }
  };
  const handleDownkey = (event) => {
    if (event.key === "Escape") {
      setOpen(false);
    } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
      handleArrowDownOrArrowUp(event);
    }
  };
  const handleClickOutside = (event) => {
    const target = event.target;
    if (menuRef.current?.contains(target)) {
      return;
    }
    if (target instanceof Element && target.closest('[data-dropdown-content="true"]')) {
      return;
    }
    setOpen(false);
  };
  (0, import_react8.useEffect)(() => {
    if (open) {
      document.addEventListener("pointerdown", handleClickOutside);
      document.addEventListener("keydown", handleDownkey);
    }
    return () => {
      document.removeEventListener("pointerdown", handleClickOutside);
      document.removeEventListener("keydown", handleDownkey);
    };
  }, [open]);
  (0, import_react8.useEffect)(() => {
    onOpenChange?.(open);
  }, [open, onOpenChange]);
  (0, import_react8.useEffect)(() => {
    if (propOpen !== void 0) {
      setOpen(propOpen);
    }
  }, [propOpen]);
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
};
var DropdownMenuTrigger = (0, import_react8.forwardRef)(({ className, children, onClick, store: externalStore, ...props }, ref) => {
  const store = useDropdownStore(externalStore);
  const open = (0, import_zustand2.useStore)(store, (s) => s.open);
  const toggleOpen = () => store.setState({ open: !open });
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
    "button",
    {
      ref,
      type: "button",
      onClick: (e) => {
        e.stopPropagation();
        toggleOpen();
        onClick?.(e);
      },
      "aria-expanded": open,
      className: cn(
        "appearance-none bg-transparent border-none p-0",
        className
      ),
      ...props,
      children
    }
  );
});
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
var ITEM_SIZE_CLASSES = {
  small: "text-sm",
  medium: "text-md"
};
var SIDE_CLASSES = {
  top: "bottom-full",
  right: "top-full",
  bottom: "top-full",
  left: "top-full"
};
var ALIGN_CLASSES = {
  start: "left-0",
  center: "left-1/2 -translate-x-1/2",
  end: "right-0"
};
var MENUCONTENT_VARIANT_CLASSES = {
  menu: "p-1",
  profile: "p-6"
};
var MenuLabel = (0, import_react8.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
    "div",
    {
      ref,
      className: cn("text-sm w-full", inset ? "pl-8" : "", className),
      ...props
    }
  );
});
MenuLabel.displayName = "MenuLabel";
var DropdownMenuContent = (0, import_react8.forwardRef)(
  ({
    className,
    align = "start",
    side = "bottom",
    variant = "menu",
    sideOffset = 4,
    children,
    store: externalStore,
    portal = false,
    triggerRef,
    ...props
  }, ref) => {
    const store = useDropdownStore(externalStore);
    const open = (0, import_zustand2.useStore)(store, (s) => s.open);
    const [isVisible, setIsVisible] = (0, import_react8.useState)(open);
    const [portalPosition, setPortalPosition] = (0, import_react8.useState)({ top: 0, left: 0 });
    const contentRef = (0, import_react8.useRef)(null);
    (0, import_react8.useEffect)(() => {
      if (open) {
        setIsVisible(true);
      } else {
        const timer = setTimeout(() => setIsVisible(false), 200);
        return () => clearTimeout(timer);
      }
    }, [open]);
    (0, import_react8.useLayoutEffect)(() => {
      if (portal && open && triggerRef?.current) {
        const rect = triggerRef.current.getBoundingClientRect();
        let top = rect.bottom + sideOffset;
        let left = rect.left;
        if (side === "left") {
          left = rect.left - sideOffset;
          top = rect.top;
        } else if (side === "right") {
          left = rect.right + sideOffset;
          top = rect.top;
        } else {
          if (align === "end") {
            left = rect.right;
          } else if (align === "center") {
            left = rect.left + rect.width / 2;
          }
          if (side === "top") {
            top = rect.top - sideOffset;
          }
        }
        setPortalPosition({ top, left });
      }
    }, [portal, open, triggerRef, align, side, sideOffset]);
    if (!isVisible) return null;
    const getPositionClasses = () => {
      if (portal) {
        return "fixed";
      }
      const vertical = SIDE_CLASSES[side];
      const horizontal = ALIGN_CLASSES[align];
      return `absolute ${vertical} ${horizontal}`;
    };
    const getPortalAlignStyle = () => {
      if (!portal) return {};
      const baseStyle = {
        top: portalPosition.top
      };
      if (align === "end") {
        baseStyle.right = window.innerWidth - portalPosition.left;
      } else if (align === "center") {
        baseStyle.left = portalPosition.left;
        baseStyle.transform = "translateX(-50%)";
      } else {
        baseStyle.left = portalPosition.left;
      }
      return baseStyle;
    };
    const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
    const content = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
      "div",
      {
        ref: portal ? contentRef : ref,
        role: "menu",
        "data-dropdown-content": "true",
        className: `
        bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md border-border-100
        ${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
        ${getPositionClasses()}
        ${variantClasses}
        ${className}
      `,
        style: {
          ...portal ? getPortalAlignStyle() : {
            marginTop: side === "bottom" ? sideOffset : void 0,
            marginBottom: side === "top" ? sideOffset : void 0,
            marginLeft: side === "right" ? sideOffset : void 0,
            marginRight: side === "left" ? sideOffset : void 0
          }
        },
        ...props,
        children
      }
    );
    if (portal && typeof document !== "undefined") {
      return (0, import_react_dom.createPortal)(content, document.body);
    }
    return content;
  }
);
DropdownMenuContent.displayName = "DropdownMenuContent";
var DropdownMenuItem = (0, import_react8.forwardRef)(
  ({
    className,
    size = "small",
    children,
    iconRight,
    iconLeft,
    disabled = false,
    onClick,
    variant = "menu",
    store: externalStore,
    preventClose = false,
    ...props
  }, ref) => {
    const store = useDropdownStore(externalStore);
    const setOpen = (0, import_zustand2.useStore)(store, (s) => s.setOpen);
    const sizeClasses = ITEM_SIZE_CLASSES[size];
    const handleClick = (e) => {
      if (disabled) {
        e.preventDefault();
        e.stopPropagation();
        return;
      }
      if (e.type === "click") {
        onClick?.(e);
      } else if (e.type === "keydown") {
        if (e.key === "Enter" || e.key === " ") {
          onClick?.(e);
        }
        props.onKeyDown?.(e);
      }
      if (!preventClose) {
        setOpen(false);
      }
    };
    const getVariantClasses = () => {
      if (variant === "profile") {
        return "relative flex flex-row justify-between select-none items-center gap-2 rounded-sm p-4 text-sm outline-none transition-colors [&>svg]:size-6 [&>svg]:shrink-0";
      }
      return "relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0";
    };
    const getVariantProps = () => {
      return variant === "profile" ? { "data-variant": "profile" } : {};
    };
    return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
      "div",
      {
        ref,
        role: "menuitem",
        ...getVariantProps(),
        "aria-disabled": disabled,
        className: `
          focus-visible:bg-background-50
           ${getVariantClasses()}
          ${sizeClasses}
          ${className}
          ${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
        `,
        onClick: handleClick,
        onKeyDown: (e) => {
          if (e.key === "Enter" || e.key === " ") {
            e.preventDefault();
            e.stopPropagation();
            handleClick(e);
          }
        },
        tabIndex: disabled ? -1 : 0,
        ...props,
        children: [
          iconLeft,
          /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "w-full", children }),
          iconRight
        ]
      }
    );
  }
);
DropdownMenuItem.displayName = "DropdownMenuItem";
var DropdownMenuSeparator = (0, import_react8.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
  "div",
  {
    ref,
    className: cn("my-1 h-px bg-border-200", className),
    ...props
  }
));
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
var ProfileMenuTrigger = (0, import_react8.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
  const store = useDropdownStore(externalStore);
  const open = (0, import_zustand2.useStore)(store, (s) => s.open);
  const toggleOpen = () => store.setState({ open: !open });
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
    "button",
    {
      ref,
      className: cn(
        "rounded-lg size-10 bg-primary-50 flex items-center justify-center cursor-pointer",
        className
      ),
      onClick: (e) => {
        e.stopPropagation();
        toggleOpen();
        onClick?.(e);
      },
      "aria-expanded": open,
      ...props,
      children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react6.User, { className: "text-primary-950", size: 18 }) })
    }
  );
});
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
var ProfileMenuHeader = (0, import_react8.forwardRef)(({ className, name, email, photoUrl, store: _store, ...props }, ref) => {
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
    "div",
    {
      ref,
      "data-component": "ProfileMenuHeader",
      className: cn(
        "flex flex-row gap-4 items-center min-w-[280px]",
        className
      ),
      ...props,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16 h-16 bg-primary-100 rounded-full flex items-center justify-center overflow-hidden flex-shrink-0", children: photoUrl ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
          "img",
          {
            src: photoUrl,
            alt: "Foto de perfil",
            className: "w-full h-full object-cover"
          }
        ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react6.User, { size: 34, className: "text-primary-800" }) }),
        /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col min-w-0", children: [
          /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
            Text_default,
            {
              size: "xl",
              weight: "bold",
              color: "text-text-950",
              className: "truncate",
              children: name
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { size: "md", color: "text-text-600", className: "truncate", children: email })
        ] })
      ]
    }
  );
});
ProfileMenuHeader.displayName = "ProfileMenuHeader";
var ProfileMenuInfo = (0, import_react8.forwardRef)(
  ({
    className,
    schoolName,
    classYearName,
    schoolYearName,
    store: _store,
    ...props
  }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
      "div",
      {
        ref,
        "data-component": "ProfileMenuInfo",
        className: cn("flex flex-row gap-4 items-center", className),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "w-16 h-16" }),
          /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col ", children: [
            /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { size: "md", color: "text-text-600", children: schoolName }),
            /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "flex flex-row items-center gap-2", children: [
              /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { size: "md", color: "text-text-600", children: classYearName }),
              /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-text-600 text-xs align-middle", children: "\u25CF" }),
              /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { size: "md", color: "text-text-600", children: schoolYearName })
            ] })
          ] })
        ]
      }
    );
  }
);
ProfileMenuInfo.displayName = "ProfileMenuInfo";
var ProfileToggleTheme = ({
  store: externalStore,
  ...props
}) => {
  const { themeMode, setTheme } = useTheme();
  const [modalThemeToggle, setModalThemeToggle] = (0, import_react8.useState)(false);
  const [selectedTheme, setSelectedTheme] = (0, import_react8.useState)(themeMode);
  const internalStoreRef = (0, import_react8.useRef)(null);
  internalStoreRef.current ??= createDropdownStore();
  const store = externalStore ?? internalStoreRef.current;
  const setOpen = (0, import_zustand2.useStore)(store, (s) => s.setOpen);
  const handleClick = (e) => {
    e.preventDefault();
    e.stopPropagation();
    setModalThemeToggle(true);
  };
  const handleSave = () => {
    setTheme(selectedTheme);
    setModalThemeToggle(false);
    setOpen(false);
  };
  const handleCancel = () => {
    setSelectedTheme(themeMode);
    setModalThemeToggle(false);
    setOpen(false);
  };
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
      DropdownMenuItem,
      {
        variant: "profile",
        preventClose: true,
        store,
        iconLeft: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
          "svg",
          {
            width: "24",
            height: "24",
            viewBox: "0 0 25 25",
            fill: "none",
            xmlns: "http://www.w3.org/2000/svg",
            children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
              "path",
              {
                d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
                fill: "currentColor"
              }
            )
          }
        ),
        iconRight: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react6.CaretRight, {}),
        onClick: handleClick,
        onKeyDown: (e) => {
          if (e.key === "Enter" || e.key === " ") {
            e.preventDefault();
            e.stopPropagation();
            setModalThemeToggle(true);
          }
        },
        ...props,
        children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { size: "md", color: "text-text-700", children: "Apar\xEAncia" })
      }
    ),
    /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
      Modal_default,
      {
        isOpen: modalThemeToggle,
        onClose: handleCancel,
        title: "Apar\xEAncia",
        size: "md",
        footer: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex gap-3", children: [
          /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button_default, { variant: "outline", onClick: handleCancel, children: "Cancelar" }),
          /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button_default, { variant: "solid", onClick: handleSave, children: "Salvar" })
        ] }),
        children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col", children: [
          /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-text-500", children: "Escolha o tema:" }),
          /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ThemeToggle, { variant: "with-save", onToggle: setSelectedTheme })
        ] })
      }
    )
  ] });
};
ProfileToggleTheme.displayName = "ProfileToggleTheme";
var ProfileMenuSection = (0, import_react8.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
});
ProfileMenuSection.displayName = "ProfileMenuSection";
var ProfileMenuFooter = ({
  className,
  disabled = false,
  onClick,
  store: externalStore,
  ...props
}) => {
  const store = useDropdownStore(externalStore);
  const setOpen = (0, import_zustand2.useStore)(store, (s) => s.setOpen);
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
    Button_default,
    {
      variant: "outline",
      className: cn("w-full", className),
      disabled,
      onClick: (e) => {
        setOpen(false);
        onClick?.(e);
      },
      ...props,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_phosphor_react6.SignOut, { className: "text-inherit" }) }),
        /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { color: "inherit", children: "Sair" })
      ]
    }
  );
};
ProfileMenuFooter.displayName = "ProfileMenuFooter";
var DropdownMenu_default = DropdownMenu;

// src/components/Search/Search.tsx
var import_jsx_runtime13 = require("react/jsx-runtime");
var filterOptions = (options, query) => {
  if (!query || query.length < 1) return [];
  return options.filter(
    (option) => option.toLowerCase().includes(query.toLowerCase())
  );
};
var updateInputValue = (value, ref, onChange) => {
  if (!onChange) return;
  if (ref && "current" in ref && ref.current) {
    ref.current.value = value;
    const event = new Event("input", { bubbles: true });
    Object.defineProperty(event, "target", {
      writable: false,
      value: ref.current
    });
    onChange(event);
  } else {
    const event = {
      target: { value },
      currentTarget: { value }
    };
    onChange(event);
  }
};
var Search = (0, import_react9.forwardRef)(
  ({
    options = [],
    onSelect,
    onSearch,
    showDropdown: controlledShowDropdown,
    onDropdownChange,
    dropdownMaxHeight = 240,
    noResultsText = "Nenhum resultado encontrado",
    className = "",
    containerClassName = "",
    disabled,
    readOnly,
    id,
    onClear,
    value,
    onChange,
    placeholder = "Buscar...",
    onKeyDown: userOnKeyDown,
    ...props
  }, ref) => {
    const [dropdownOpen, setDropdownOpen] = (0, import_react9.useState)(false);
    const [forceClose, setForceClose] = (0, import_react9.useState)(false);
    const justSelectedRef = (0, import_react9.useRef)(false);
    const dropdownStore = (0, import_react9.useRef)(createDropdownStore()).current;
    const dropdownRef = (0, import_react9.useRef)(null);
    const inputElRef = (0, import_react9.useRef)(null);
    const filteredOptions = (0, import_react9.useMemo)(() => {
      if (!options.length) {
        return [];
      }
      const filtered = filterOptions(options, value || "");
      return filtered;
    }, [options, value]);
    const showDropdown = !forceClose && (controlledShowDropdown ?? (dropdownOpen && value && String(value).length > 0));
    const setOpenAndNotify = (open) => {
      setDropdownOpen(open);
      dropdownStore.setState({ open });
      onDropdownChange?.(open);
    };
    (0, import_react9.useEffect)(() => {
      if (justSelectedRef.current) {
        justSelectedRef.current = false;
        return;
      }
      if (forceClose) {
        setOpenAndNotify(false);
        return;
      }
      const shouldShow = Boolean(value && String(value).length > 0);
      setOpenAndNotify(shouldShow);
    }, [value, forceClose, onDropdownChange, dropdownStore]);
    const handleSelectOption = (option) => {
      justSelectedRef.current = true;
      setForceClose(true);
      onSelect?.(option);
      setOpenAndNotify(false);
      updateInputValue(option, ref, onChange);
    };
    (0, import_react9.useEffect)(() => {
      const handleClickOutside = (event) => {
        if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
          setOpenAndNotify(false);
        }
      };
      if (showDropdown) {
        document.addEventListener("mousedown", handleClickOutside);
      }
      return () => {
        document.removeEventListener("mousedown", handleClickOutside);
      };
    }, [showDropdown, dropdownStore, onDropdownChange]);
    const generatedId = (0, import_react9.useId)();
    const inputId = id ?? `search-${generatedId}`;
    const dropdownId = `${inputId}-dropdown`;
    const handleClear = () => {
      if (onClear) {
        onClear();
      } else {
        updateInputValue("", ref, onChange);
      }
    };
    const handleClearClick = (e) => {
      e.preventDefault();
      e.stopPropagation();
      handleClear();
    };
    const handleSearchIconClick = (e) => {
      e.preventDefault();
      e.stopPropagation();
      setTimeout(() => {
        inputElRef.current?.focus();
      }, 0);
    };
    const handleInputChange = (e) => {
      setForceClose(false);
      onChange?.(e);
      onSearch?.(e.target.value);
    };
    const handleKeyDown = (e) => {
      userOnKeyDown?.(e);
      if (e.defaultPrevented) return;
      if (e.key === "Enter") {
        e.preventDefault();
        if (showDropdown && filteredOptions.length > 0) {
          handleSelectOption(filteredOptions[0]);
        } else if (value) {
          onSearch?.(String(value));
          setForceClose(true);
          setOpenAndNotify(false);
        }
      }
    };
    const getInputStateClasses = (disabled2, readOnly2) => {
      if (disabled2) return "cursor-not-allowed opacity-40";
      if (readOnly2) return "cursor-default focus:outline-none !text-text-900";
      return "hover:border-border-400";
    };
    const hasValue = String(value ?? "").length > 0;
    const showClearButton = hasValue && !disabled && !readOnly;
    const showSearchIcon = !hasValue && !disabled && !readOnly;
    return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
      "div",
      {
        ref: dropdownRef,
        className: `w-full max-w-lg md:w-[488px] ${containerClassName}`,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative flex items-center", children: [
            /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
              "input",
              {
                ref: (node) => {
                  if (ref) {
                    if (typeof ref === "function") ref(node);
                    else
                      ref.current = node;
                  }
                  inputElRef.current = node;
                },
                id: inputId,
                type: "text",
                className: `w-full py-0 px-4 pr-10 font-normal text-text-900 focus:outline-primary-950 border rounded-full bg-background focus:bg-primary-50 border-border-300 focus:border-2 focus:border-primary-950 h-10 placeholder:text-text-600 ${getInputStateClasses(disabled, readOnly)} ${className}`,
                value,
                onChange: handleInputChange,
                onKeyDown: handleKeyDown,
                disabled,
                readOnly,
                placeholder,
                "aria-expanded": showDropdown ? "true" : void 0,
                "aria-haspopup": options.length > 0 ? "listbox" : void 0,
                "aria-controls": showDropdown ? dropdownId : void 0,
                "aria-autocomplete": "list",
                role: options.length > 0 ? "combobox" : void 0,
                ...props
              }
            ),
            showClearButton && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
              "button",
              {
                type: "button",
                className: "p-0 border-0 bg-transparent cursor-pointer",
                onMouseDown: handleClearClick,
                "aria-label": "Limpar busca",
                children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-6 h-6 text-text-800 flex items-center justify-center hover:text-text-600 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react7.X, {}) })
              }
            ) }),
            showSearchIcon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
              "button",
              {
                type: "button",
                className: "p-0 border-0 bg-transparent cursor-pointer",
                onMouseDown: handleSearchIconClick,
                "aria-label": "Buscar",
                children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "w-6 h-6 text-text-800 flex items-center justify-center hover:text-text-600 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react7.MagnifyingGlass, {}) })
              }
            ) })
          ] }),
          showDropdown && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenu_default, { open: showDropdown, onOpenChange: setDropdownOpen, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
            DropdownMenuContent,
            {
              id: dropdownId,
              className: "w-full mt-1",
              style: { maxHeight: dropdownMaxHeight },
              align: "start",
              children: filteredOptions.length > 0 ? filteredOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
                DropdownMenuItem,
                {
                  onClick: () => handleSelectOption(option),
                  className: "text-text-700 text-base leading-6 cursor-pointer",
                  children: option
                },
                option
              )) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "px-3 py-3 text-text-700 text-base", children: noResultsText })
            }
          ) })
        ]
      }
    );
  }
);
Search.displayName = "Search";
var Search_default = Search;

// src/components/CheckBoxGroup/CheckBoxGroup.tsx
var import_react20 = require("react");

// src/components/CheckBox/CheckBox.tsx
var import_react10 = require("react");
var import_phosphor_react8 = require("phosphor-react");
var import_jsx_runtime14 = require("react/jsx-runtime");
var SIZE_CLASSES4 = {
  small: {
    checkbox: "w-4 h-4",
    // 16px x 16px
    textSize: "sm",
    spacing: "gap-1.5",
    // 6px
    borderWidth: "border-2",
    iconSize: 14,
    // pixels for Phosphor icons
    labelHeight: "h-[21px]"
  },
  medium: {
    checkbox: "w-5 h-5",
    // 20px x 20px
    textSize: "md",
    spacing: "gap-2",
    // 8px
    borderWidth: "border-2",
    iconSize: 16,
    // pixels for Phosphor icons
    labelHeight: "h-6"
  },
  large: {
    checkbox: "w-6 h-6",
    // 24px x 24px
    textSize: "lg",
    spacing: "gap-2",
    // 8px
    borderWidth: "border-[3px]",
    // 3px border
    iconSize: 20,
    // pixels for Phosphor icons
    labelHeight: "h-[27px]"
  }
};
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
var STATE_CLASSES = {
  default: {
    unchecked: "border-border-400 bg-background hover:border-border-500",
    checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
  },
  hovered: {
    unchecked: "border-border-500 bg-background",
    checked: "border-primary-800 bg-primary-800 text-text"
  },
  focused: {
    unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
    checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
  },
  invalid: {
    unchecked: "border-error-700 bg-background hover:border-error-600",
    checked: "border-error-700 bg-primary-950 text-text"
  },
  disabled: {
    unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
    checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
  }
};
var CheckBox = (0, import_react10.forwardRef)(
  ({
    label,
    size = "medium",
    state = "default",
    indeterminate = false,
    errorMessage,
    helperText,
    className = "",
    labelClassName = "",
    checked: checkedProp,
    disabled,
    id,
    onChange,
    ...props
  }, ref) => {
    const generatedId = (0, import_react10.useId)();
    const inputId = id ?? `checkbox-${generatedId}`;
    const [internalChecked, setInternalChecked] = (0, import_react10.useState)(false);
    const isControlled = checkedProp !== void 0;
    const checked = isControlled ? checkedProp : internalChecked;
    const handleChange = (event) => {
      if (!isControlled) {
        setInternalChecked(event.target.checked);
      }
      onChange?.(event);
    };
    const currentState = disabled ? "disabled" : state;
    const sizeClasses = SIZE_CLASSES4[size];
    const checkVariant = checked || indeterminate ? "checked" : "unchecked";
    const stylingClasses = STATE_CLASSES[currentState][checkVariant];
    const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
    const checkboxClasses = cn(
      BASE_CHECKBOX_CLASSES,
      sizeClasses.checkbox,
      borderWidthClass,
      stylingClasses,
      className
    );
    const renderIcon = () => {
      if (indeterminate) {
        return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
          import_phosphor_react8.Minus,
          {
            size: sizeClasses.iconSize,
            weight: "bold",
            color: "currentColor"
          }
        );
      }
      if (checked) {
        return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
          import_phosphor_react8.Check,
          {
            size: sizeClasses.iconSize,
            weight: "bold",
            color: "currentColor"
          }
        );
      }
      return null;
    };
    return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col", children: [
      /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
        "div",
        {
          className: cn(
            "flex flex-row items-center",
            sizeClasses.spacing,
            disabled ? "opacity-40" : ""
          ),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
              "input",
              {
                ref,
                type: "checkbox",
                id: inputId,
                checked,
                disabled,
                onChange: handleChange,
                className: "sr-only",
                ...props
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
            label && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
              "div",
              {
                className: cn(
                  "flex flex-row items-center",
                  sizeClasses.labelHeight
                ),
                children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
                  Text_default,
                  {
                    as: "label",
                    htmlFor: inputId,
                    size: sizeClasses.textSize,
                    weight: "normal",
                    className: cn(
                      "cursor-pointer select-none leading-[150%] flex items-center font-roboto",
                      labelClassName
                    ),
                    children: label
                  }
                )
              }
            )
          ]
        }
      ),
      errorMessage && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
        Text_default,
        {
          size: "sm",
          weight: "normal",
          className: "mt-1.5",
          color: "text-error-600",
          children: errorMessage
        }
      ),
      helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
        Text_default,
        {
          size: "sm",
          weight: "normal",
          className: "mt-1.5",
          color: "text-text-500",
          children: helperText
        }
      )
    ] });
  }
);
CheckBox.displayName = "CheckBox";
var CheckBox_default = CheckBox;

// src/components/Divider/Divider.tsx
var import_jsx_runtime15 = require("react/jsx-runtime");
var Divider = ({
  orientation = "horizontal",
  className = "",
  ...props
}) => {
  const baseClasses = "bg-border-200 border-0";
  const orientationClasses = {
    horizontal: "w-full h-px",
    vertical: "h-full w-px"
  };
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
    "hr",
    {
      className: cn(baseClasses, orientationClasses[orientation], className),
      "aria-orientation": orientation,
      ...props
    }
  );
};
var Divider_default = Divider;

// src/components/Radio/Radio.tsx
var import_react11 = require("react");
var import_zustand3 = require("zustand");
var import_jsx_runtime16 = require("react/jsx-runtime");
var SIZE_CLASSES5 = {
  small: {
    radio: "w-5 h-5",
    textSize: "sm",
    spacing: "gap-1.5",
    borderWidth: "border-2",
    dotSize: "w-2.5 h-2.5",
    labelHeight: "h-5"
  },
  medium: {
    radio: "w-6 h-6",
    textSize: "md",
    spacing: "gap-2",
    borderWidth: "border-2",
    dotSize: "w-3 h-3",
    labelHeight: "h-6"
  },
  large: {
    radio: "w-7 h-7",
    textSize: "lg",
    spacing: "gap-2",
    borderWidth: "border-2",
    dotSize: "w-3.5 h-3.5",
    labelHeight: "h-7"
  },
  extraLarge: {
    radio: "w-8 h-8",
    textSize: "xl",
    spacing: "gap-3",
    borderWidth: "border-2",
    dotSize: "w-4 h-4",
    labelHeight: "h-8"
  }
};
var BASE_RADIO_CLASSES = "rounded-full border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
var STATE_CLASSES2 = {
  default: {
    unchecked: "border-border-400 bg-background hover:border-border-500",
    checked: "border-primary-950 bg-background hover:border-primary-800"
  },
  hovered: {
    unchecked: "border-border-500 bg-background",
    checked: "border-info-700 bg-background"
  },
  focused: {
    unchecked: "border-border-400 bg-background",
    checked: "border-primary-950 bg-background"
  },
  invalid: {
    unchecked: "border-border-400 bg-background",
    checked: "border-primary-950 bg-background"
  },
  disabled: {
    unchecked: "border-border-400 bg-background cursor-not-allowed",
    checked: "border-primary-950 bg-background cursor-not-allowed"
  }
};
var DOT_CLASSES = {
  default: "bg-primary-950",
  hovered: "bg-info-700",
  focused: "bg-primary-950",
  invalid: "bg-primary-950",
  disabled: "bg-primary-950"
};
var Radio = (0, import_react11.forwardRef)(
  ({
    label,
    size = "medium",
    state = "default",
    errorMessage,
    helperText,
    className = "",
    labelClassName = "",
    checked: checkedProp,
    defaultChecked = false,
    disabled,
    id,
    name,
    value,
    onChange,
    ...props
  }, ref) => {
    const generatedId = (0, import_react11.useId)();
    const inputId = id ?? `radio-${generatedId}`;
    const inputRef = (0, import_react11.useRef)(null);
    const [internalChecked, setInternalChecked] = (0, import_react11.useState)(defaultChecked);
    const isControlled = checkedProp !== void 0;
    const checked = isControlled ? checkedProp : internalChecked;
    const handleChange = (event) => {
      const newChecked = event.target.checked;
      if (!isControlled) {
        setInternalChecked(newChecked);
      }
      if (event.target) {
        event.target.blur();
      }
      onChange?.(event);
    };
    const currentState = disabled ? "disabled" : state;
    const sizeClasses = SIZE_CLASSES5[size];
    const actualRadioSize = sizeClasses.radio;
    const actualDotSize = sizeClasses.dotSize;
    const radioVariant = checked ? "checked" : "unchecked";
    const stylingClasses = STATE_CLASSES2[currentState][radioVariant];
    const getBorderWidth = () => {
      if (currentState === "focused") {
        return "border-2";
      }
      return sizeClasses.borderWidth;
    };
    const borderWidthClass = getBorderWidth();
    const radioClasses = cn(
      BASE_RADIO_CLASSES,
      actualRadioSize,
      borderWidthClass,
      stylingClasses,
      className
    );
    const dotClasses = cn(
      actualDotSize,
      "rounded-full",
      DOT_CLASSES[currentState],
      "transition-all duration-200"
    );
    const isWrapperNeeded = currentState === "focused" || currentState === "invalid";
    const wrapperBorderColor = currentState === "focused" ? "border-indicator-info" : "border-indicator-error";
    const getTextColor = () => {
      if (currentState === "disabled") {
        return checked ? "text-text-900" : "text-text-600";
      }
      if (currentState === "focused") {
        return "text-text-900";
      }
      return checked ? "text-text-900" : "text-text-600";
    };
    const getCursorClass = () => {
      return currentState === "disabled" ? "cursor-not-allowed" : "cursor-pointer";
    };
    return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col", children: [
      /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
        "div",
        {
          className: cn(
            "flex flex-row items-center",
            isWrapperNeeded ? cn("p-1 border-2", wrapperBorderColor, "rounded-lg gap-1.5") : sizeClasses.spacing,
            disabled ? "opacity-40" : ""
          ),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
              "input",
              {
                ref: (node) => {
                  inputRef.current = node;
                  if (typeof ref === "function") ref(node);
                  else if (ref) ref.current = node;
                },
                type: "radio",
                id: inputId,
                checked,
                disabled,
                name,
                value,
                onChange: handleChange,
                className: "sr-only",
                style: {
                  position: "absolute",
                  left: "-9999px",
                  visibility: "hidden"
                },
                ...props
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
              "button",
              {
                type: "button",
                className: radioClasses,
                disabled,
                "aria-pressed": checked,
                onClick: (e) => {
                  e.preventDefault();
                  if (!disabled) {
                    if (inputRef.current) {
                      inputRef.current.click();
                      inputRef.current.blur();
                    }
                  }
                },
                onKeyDown: (e) => {
                  if ((e.key === "Enter" || e.key === " ") && !disabled) {
                    e.preventDefault();
                    if (inputRef.current) {
                      inputRef.current.click();
                      inputRef.current.blur();
                    }
                  }
                },
                children: checked && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: dotClasses })
              }
            ),
            label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
              "div",
              {
                className: cn(
                  "flex flex-row items-center",
                  sizeClasses.labelHeight,
                  "flex-1 min-w-0"
                ),
                children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
                  Text_default,
                  {
                    as: "label",
                    htmlFor: inputId,
                    size: sizeClasses.textSize,
                    weight: "normal",
                    className: cn(
                      getCursorClass(),
                      "select-none leading-normal flex items-center font-roboto truncate",
                      labelClassName
                    ),
                    color: getTextColor(),
                    children: label
                  }
                )
              }
            )
          ]
        }
      ),
      errorMessage && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
        Text_default,
        {
          size: "sm",
          weight: "normal",
          className: "mt-1.5 truncate",
          color: "text-error-600",
          children: errorMessage
        }
      ),
      helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
        Text_default,
        {
          size: "sm",
          weight: "normal",
          className: "mt-1.5 truncate",
          color: "text-text-500",
          children: helperText
        }
      )
    ] });
  }
);
Radio.displayName = "Radio";
var createRadioGroupStore = (name, defaultValue, disabled, onValueChange) => (0, import_zustand3.create)((set, get) => ({
  value: defaultValue,
  setValue: (value) => {
    if (!get().disabled) {
      set({ value });
      get().onValueChange?.(value);
    }
  },
  onValueChange,
  disabled,
  name
}));
var useRadioGroupStore = (externalStore) => {
  if (!externalStore) {
    throw new Error("RadioGroupItem must be used within a RadioGroup");
  }
  return externalStore;
};
var injectStore2 = (children, store) => import_react11.Children.map(children, (child) => {
  if (!(0, import_react11.isValidElement)(child)) return child;
  const typedChild = child;
  const shouldInject = typedChild.type === RadioGroupItem;
  return (0, import_react11.cloneElement)(typedChild, {
    ...shouldInject ? { store } : {},
    ...typedChild.props.children ? { children: injectStore2(typedChild.props.children, store) } : {}
  });
});
var RadioGroup = (0, import_react11.forwardRef)(
  ({
    value: propValue,
    defaultValue = "",
    onValueChange,
    name: propName,
    disabled = false,
    className = "",
    children,
    ...props
  }, ref) => {
    const generatedId = (0, import_react11.useId)();
    const name = propName || `radio-group-${generatedId}`;
    const storeRef = (0, import_react11.useRef)(null);
    storeRef.current ??= createRadioGroupStore(
      name,
      defaultValue,
      disabled,
      onValueChange
    );
    const store = storeRef.current;
    const { setValue } = (0, import_zustand3.useStore)(store, (s) => s);
    (0, import_react11.useEffect)(() => {
      const currentValue = store.getState().value;
      if (currentValue && onValueChange) {
        onValueChange(currentValue);
      }
    }, []);
    (0, import_react11.useEffect)(() => {
      if (propValue !== void 0) {
        setValue(propValue);
      }
    }, [propValue, setValue]);
    (0, import_react11.useEffect)(() => {
      store.setState({ disabled });
    }, [disabled, store]);
    return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
      "div",
      {
        ref,
        className,
        role: "radiogroup",
        "aria-label": name,
        ...props,
        children: injectStore2(children, store)
      }
    );
  }
);
RadioGroup.displayName = "RadioGroup";
var RadioGroupItem = (0, import_react11.forwardRef)(
  ({
    value,
    store: externalStore,
    disabled: itemDisabled,
    size = "medium",
    state = "default",
    className = "",
    id,
    ...props
  }, ref) => {
    const store = useRadioGroupStore(externalStore);
    const {
      value: groupValue,
      setValue,
      disabled: groupDisabled,
      name
    } = (0, import_zustand3.useStore)(store);
    const generatedId = (0, import_react11.useId)();
    const inputId = id ?? `radio-item-${generatedId}`;
    const isChecked = groupValue === value;
    const isDisabled = groupDisabled || itemDisabled;
    const currentState = isDisabled ? "disabled" : state;
    return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
      Radio,
      {
        ref,
        id: inputId,
        name,
        value,
        checked: isChecked,
        disabled: isDisabled,
        size,
        state: currentState,
        className,
        onChange: (e) => {
          if (e.target.checked && !isDisabled) {
            setValue(value);
          }
        },
        ...props
      }
    );
  }
);
RadioGroupItem.displayName = "RadioGroupItem";

// src/components/ProgressBar/ProgressBar.tsx
var import_jsx_runtime17 = require("react/jsx-runtime");
var SIZE_CLASSES6 = {
  small: {
    container: "h-1",
    // 4px height (h-1 = 4px in Tailwind)
    bar: "h-1",
    // 4px height for the fill bar
    spacing: "gap-2",
    // 8px gap between label and progress bar
    layout: "flex-col",
    // vertical layout for small
    borderRadius: "rounded-full"
    // 9999px border radius
  },
  medium: {
    container: "h-2",
    // 8px height (h-2 = 8px in Tailwind)
    bar: "h-2",
    // 8px height for the fill bar
    spacing: "gap-2",
    // 8px gap between progress bar and label
    layout: "flex-row items-center",
    // horizontal layout for medium
    borderRadius: "rounded-lg"
    // 8px border radius
  }
};
var VARIANT_CLASSES = {
  blue: {
    background: "bg-background-300",
    // Background track color (#D5D4D4)
    fill: "bg-primary-700"
    // Blue for activity progress (#2271C4)
  },
  green: {
    background: "bg-background-300",
    // Background track color (#D5D4D4)
    fill: "bg-success-200"
    // Green for performance (#84D3A2)
  }
};
var calculateProgressValues = (value, max) => {
  const safeValue = isNaN(value) ? 0 : value;
  const clampedValue = Math.max(0, Math.min(safeValue, max));
  const percentage = max === 0 ? 0 : clampedValue / max * 100;
  return { clampedValue, percentage };
};
var shouldShowHeader = (label, showPercentage, showHitCount) => {
  return !!(label || showPercentage || showHitCount);
};
var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
  if (showHitCount) {
    return {
      type: "hitCount",
      content: `${Math.round(clampedValue)} de ${max}`,
      hasMetrics: true
    };
  }
  if (showPercentage) {
    return {
      type: "percentage",
      content: `${Math.round(percentage)}%`,
      hasMetrics: true
    };
  }
  return {
    type: "label",
    content: label,
    hasMetrics: false
  };
};
var getCompactLayoutConfig = ({
  showPercentage,
  showHitCount,
  percentage,
  clampedValue,
  max,
  label,
  percentageClassName,
  labelClassName
}) => {
  const displayPriority = getDisplayPriority(
    showHitCount,
    showPercentage,
    label,
    clampedValue,
    max,
    percentage
  );
  return {
    color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
    className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
    content: displayPriority.content
  };
};
var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
  showHeader: size === "small" && !!(label || showPercentage),
  showPercentage: size === "medium" && showPercentage,
  showLabel: size === "medium" && !!label && !showPercentage
  // Only show label when percentage is not shown
});
var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
  if (!showHitCount && !showPercentage) return null;
  const displayPriority = getDisplayPriority(
    showHitCount,
    showPercentage,
    null,
    // label is not relevant for stacked layout metrics display
    clampedValue,
    max,
    percentage
  );
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
    "div",
    {
      className: cn(
        "text-xs font-medium leading-[14px] text-right",
        percentageClassName
      ),
      children: displayPriority.type === "hitCount" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
        /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-success-200", children: Math.round(clampedValue) }),
        /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-text-600", children: [
          " de ",
          max
        ] })
      ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
        Math.round(percentage),
        "%"
      ] })
    }
  );
};
var ProgressBarBase = ({
  clampedValue,
  max,
  percentage,
  label,
  variantClasses,
  containerClassName,
  fillClassName
}) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
  "div",
  {
    className: cn(
      containerClassName,
      variantClasses.background,
      "overflow-hidden relative"
    ),
    children: [
      /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
        "progress",
        {
          value: clampedValue,
          max,
          "aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
          className: "absolute inset-0 w-full h-full opacity-0"
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
        "div",
        {
          className: cn(
            fillClassName,
            variantClasses.fill,
            "transition-all duration-300 ease-out"
          ),
          style: { width: `${percentage}%` }
        }
      )
    ]
  }
);
var StackedLayout = ({
  className,
  label,
  showPercentage,
  showHitCount,
  labelClassName,
  percentageClassName,
  clampedValue,
  max,
  percentage,
  variantClasses,
  dimensions
}) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
  "div",
  {
    className: cn(
      "flex flex-col items-start gap-2",
      dimensions.width,
      dimensions.height,
      className
    ),
    children: [
      shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
        label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
          Text_default,
          {
            as: "div",
            size: "md",
            weight: "medium",
            className: cn("text-text-600 leading-[19px]", labelClassName),
            children: label
          }
        ),
        renderStackedHitCountDisplay(
          showHitCount,
          showPercentage,
          clampedValue,
          max,
          percentage,
          percentageClassName
        )
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
        ProgressBarBase,
        {
          clampedValue,
          max,
          percentage,
          label,
          variantClasses,
          containerClassName: "w-full h-2 rounded-lg",
          fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
        }
      )
    ]
  }
);
var CompactLayout = ({
  className,
  label,
  showPercentage,
  showHitCount,
  labelClassName,
  percentageClassName,
  clampedValue,
  max,
  percentage,
  variantClasses,
  dimensions
}) => {
  const {
    color,
    className: compactClassName,
    content
  } = getCompactLayoutConfig({
    showPercentage,
    showHitCount,
    percentage,
    clampedValue,
    max,
    label,
    percentageClassName,
    labelClassName
  });
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
    "div",
    {
      className: cn(
        "flex flex-col items-start gap-1",
        dimensions.width,
        dimensions.height,
        className
      ),
      children: [
        shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
          Text_default,
          {
            as: "div",
            size: "sm",
            weight: "medium",
            color,
            className: cn("leading-4 w-full", compactClassName),
            children: content
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
          ProgressBarBase,
          {
            clampedValue,
            max,
            percentage,
            label,
            variantClasses,
            containerClassName: "w-full h-1 rounded-full",
            fillClassName: "h-1 rounded-full"
          }
        )
      ]
    }
  );
};
var DefaultLayout = ({
  className,
  size,
  sizeClasses,
  variantClasses,
  label,
  showPercentage,
  labelClassName,
  percentageClassName,
  clampedValue,
  max,
  percentage
}) => {
  const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
  const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
  const displayConfig = getDefaultLayoutDisplayConfig(
    size,
    label,
    showPercentage
  );
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("flex", sizeClasses.layout, gapClass, className), children: [
    displayConfig.showHeader && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
      label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
        Text_default,
        {
          as: "div",
          size: "xs",
          weight: "medium",
          className: cn(
            "text-text-950 leading-none tracking-normal text-center",
            labelClassName
          ),
          children: label
        }
      ),
      showPercentage && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
        Text_default,
        {
          size: "xs",
          weight: "medium",
          className: cn(
            "text-text-950 leading-none tracking-normal text-center",
            percentageClassName
          ),
          children: [
            Math.round(percentage),
            "%"
          ]
        }
      )
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
      ProgressBarBase,
      {
        clampedValue,
        max,
        percentage,
        label,
        variantClasses,
        containerClassName: cn(
          progressBarClass,
          sizeClasses.container,
          sizeClasses.borderRadius
        ),
        fillClassName: cn(
          sizeClasses.bar,
          sizeClasses.borderRadius,
          "shadow-hard-shadow-3"
        )
      }
    ),
    displayConfig.showPercentage && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
      Text_default,
      {
        size: "xs",
        weight: "medium",
        className: cn(
          "text-text-950 leading-none tracking-normal text-center flex-none",
          percentageClassName
        ),
        children: [
          Math.round(percentage),
          "%"
        ]
      }
    ),
    displayConfig.showLabel && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
      Text_default,
      {
        as: "div",
        size: "xs",
        weight: "medium",
        className: cn(
          "text-text-950 leading-none tracking-normal text-center flex-none",
          labelClassName
        ),
        children: label
      }
    )
  ] });
};
var ProgressBar = ({
  value,
  max = 100,
  size = "medium",
  variant = "blue",
  layout = "default",
  label,
  showPercentage = false,
  showHitCount = false,
  className = "",
  labelClassName = "",
  percentageClassName = "",
  stackedWidth,
  stackedHeight,
  compactWidth,
  compactHeight
}) => {
  const { clampedValue, percentage } = calculateProgressValues(value, max);
  const sizeClasses = SIZE_CLASSES6[size];
  const variantClasses = VARIANT_CLASSES[variant];
  if (layout === "stacked") {
    return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
      StackedLayout,
      {
        className,
        label,
        showPercentage,
        showHitCount,
        labelClassName,
        percentageClassName,
        clampedValue,
        max,
        percentage,
        variantClasses,
        dimensions: {
          width: stackedWidth ?? "w-[380px]",
          height: stackedHeight ?? "h-[35px]"
        }
      }
    );
  }
  if (layout === "compact") {
    return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
      CompactLayout,
      {
        className,
        label,
        showPercentage,
        showHitCount,
        labelClassName,
        percentageClassName,
        clampedValue,
        max,
        percentage,
        variantClasses,
        dimensions: {
          width: compactWidth ?? "w-[131px]",
          height: compactHeight ?? "h-[24px]"
        }
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
    DefaultLayout,
    {
      className,
      size,
      sizeClasses,
      variantClasses,
      label,
      showPercentage,
      labelClassName,
      percentageClassName,
      clampedValue,
      max,
      percentage
    }
  );
};
var ProgressBar_default = ProgressBar;

// src/components/CorrectActivityModal/CorrectActivityModal.tsx
var import_react18 = require("react");
var import_phosphor_react13 = require("phosphor-react");

// src/components/Alternative/Alternative.tsx
var import_phosphor_react9 = require("phosphor-react");
var import_react12 = require("react");
var import_jsx_runtime18 = require("react/jsx-runtime");
var AlternativesList = ({
  alternatives,
  name,
  defaultValue,
  value,
  onValueChange,
  disabled = false,
  layout = "default",
  className = "",
  mode = "interactive",
  selectedValue
}) => {
  const uniqueId = (0, import_react12.useId)();
  const groupName = name || `alternatives-${uniqueId}`;
  const [actualValue, setActualValue] = (0, import_react12.useState)(value);
  const isReadonly = mode === "readonly";
  const getStatusStyles = (status, isReadonly2) => {
    const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
    switch (status) {
      case "correct":
        return "bg-success-background border-success-300";
      case "incorrect":
        return "bg-error-background border-error-300";
      default:
        return `bg-background border-border-100 ${hoverClass}`;
    }
  };
  const getStatusBadge = (status) => {
    switch (status) {
      case "correct":
        return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react9.CheckCircle, {}), children: "Resposta correta" });
      case "incorrect":
        return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react9.XCircle, {}), children: "Resposta incorreta" });
      default:
        return null;
    }
  };
  const getLayoutClasses = () => {
    switch (layout) {
      case "compact":
        return "gap-2";
      case "detailed":
        return "gap-4";
      default:
        return "gap-3.5";
    }
  };
  const renderReadonlyAlternative = (alternative) => {
    const alternativeId = alternative.value;
    const isUserSelected = selectedValue === alternative.value;
    const isCorrectAnswer = alternative.status === "correct";
    let displayStatus = void 0;
    if (isUserSelected && !isCorrectAnswer) {
      displayStatus = "incorrect";
    } else if (isCorrectAnswer) {
      displayStatus = "correct";
    }
    const statusStyles = getStatusStyles(displayStatus, true);
    const statusBadge = getStatusBadge(displayStatus);
    const renderRadio = () => {
      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"}`;
      const dotClasses = "w-3 h-3 rounded-full bg-primary-950 transition-all duration-200";
      return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: radioClasses, children: isUserSelected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: dotClasses }) });
    };
    if (layout === "detailed") {
      return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
        "div",
        {
          className: cn(
            "border-2 rounded-lg p-4 w-full",
            statusStyles,
            alternative.disabled ? "opacity-50" : ""
          ),
          children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
            /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
              /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mt-1", children: renderRadio() }),
              /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1", children: [
                /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
                  "p",
                  {
                    className: cn(
                      "block font-medium",
                      selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"
                    ),
                    children: alternative.label
                  }
                ),
                alternative.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
              ] })
            ] }),
            statusBadge && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
          ] })
        },
        alternativeId
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
      "div",
      {
        className: cn(
          "flex flex-row justify-between items-start gap-2 p-2 rounded-lg w-full",
          statusStyles,
          alternative.disabled ? "opacity-50" : ""
        ),
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
            renderRadio(),
            /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
              "span",
              {
                className: cn(
                  "flex-1",
                  selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"
                ),
                children: alternative.label
              }
            )
          ] }),
          statusBadge && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
        ]
      },
      alternativeId
    );
  };
  if (isReadonly) {
    return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
      "div",
      {
        className: cn("flex flex-col", getLayoutClasses(), "w-full", className),
        children: alternatives.map(
          (alternative) => renderReadonlyAlternative(alternative)
        )
      }
    );
  }
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
    RadioGroup,
    {
      name: groupName,
      defaultValue,
      value,
      onValueChange: (value2) => {
        setActualValue(value2);
        onValueChange?.(value2);
      },
      disabled,
      className: cn("flex flex-col", getLayoutClasses(), className),
      children: alternatives.map((alternative, index) => {
        const alternativeId = alternative.value || `alt-${index}`;
        const statusStyles = getStatusStyles(alternative.status, false);
        const statusBadge = getStatusBadge(alternative.status);
        if (layout === "detailed") {
          return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
            "div",
            {
              className: cn(
                "border-2 rounded-lg p-4 transition-all",
                statusStyles,
                alternative.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
              ),
              children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
                /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3 flex-1", children: [
                  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
                    RadioGroupItem,
                    {
                      value: alternative.value,
                      id: alternativeId,
                      disabled: alternative.disabled,
                      className: "mt-1"
                    }
                  ),
                  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1", children: [
                    /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
                      "label",
                      {
                        htmlFor: alternativeId,
                        className: cn(
                          "block font-medium",
                          actualValue === alternative.value ? "text-text-950" : "text-text-600",
                          alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"
                        ),
                        children: alternative.label
                      }
                    ),
                    alternative.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
                  ] })
                ] }),
                statusBadge && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
              ] })
            },
            alternativeId
          );
        }
        return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
          "div",
          {
            className: cn(
              "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
              statusStyles,
              alternative.disabled ? "opacity-50 cursor-not-allowed" : ""
            ),
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2 flex-1", children: [
                /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
                  RadioGroupItem,
                  {
                    value: alternative.value,
                    id: alternativeId,
                    disabled: alternative.disabled
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
                  "label",
                  {
                    htmlFor: alternativeId,
                    className: cn(
                      "flex-1",
                      actualValue === alternative.value ? "text-text-950" : "text-text-600",
                      alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"
                    ),
                    children: alternative.label
                  }
                )
              ] }),
              statusBadge && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-shrink-0", children: statusBadge })
            ]
          },
          alternativeId
        );
      })
    }
  );
};
var HeaderAlternative = (0, import_react12.forwardRef)(
  ({ className, title, subTitle, content, ...props }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
      "div",
      {
        ref,
        className: cn(
          "bg-background p-4 flex flex-col gap-4 rounded-xl",
          className
        ),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex flex-col", children: [
            /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-950 font-bold text-lg", children: title }),
            /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-700 text-sm ", children: subTitle })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-text-950 text-md", children: content })
        ]
      }
    );
  }
);

// src/components/Accordation/Accordation.tsx
var import_react15 = require("react");

// src/components/Card/Card.tsx
var import_react14 = require("react");
var import_phosphor_react10 = require("phosphor-react");

// src/components/IconRender/IconRender.tsx
var import_react13 = require("react");
var PhosphorIcons = __toESM(require("phosphor-react"));

// src/assets/icons/subjects/ChatPT.tsx
var import_jsx_runtime19 = require("react/jsx-runtime");
var ChatPT = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
  "svg",
  {
    width: size,
    height: size,
    viewBox: "0 0 32 32",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    children: [
      /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
        "path",
        {
          d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
          fill: color
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
        "path",
        {
          d: "M21.1758 12V20.5312H19.7168V12H21.1758ZM23.8535 12V13.1719H17.0625V12H23.8535Z",
          fill: color
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
        "path",
        {
          d: "M13.2402 17.3496H11.0195V16.1836H13.2402C13.627 16.1836 13.9395 16.1211 14.1777 15.9961C14.416 15.8711 14.5898 15.6992 14.6992 15.4805C14.8125 15.2578 14.8691 15.0039 14.8691 14.7188C14.8691 14.4492 14.8125 14.1973 14.6992 13.9629C14.5898 13.7246 14.416 13.5332 14.1777 13.3887C13.9395 13.2441 13.627 13.1719 13.2402 13.1719H11.4707V20.5312H10V12H13.2402C13.9004 12 14.4609 12.1172 14.9219 12.3516C15.3867 12.582 15.7402 12.9023 15.9824 13.3125C16.2246 13.7188 16.3457 14.1836 16.3457 14.707C16.3457 15.2578 16.2246 15.7305 15.9824 16.125C15.7402 16.5195 15.3867 16.8223 14.9219 17.0332C14.4609 17.2441 13.9004 17.3496 13.2402 17.3496Z",
          fill: color
        }
      )
    ]
  }
);

// src/assets/icons/subjects/ChatEN.tsx
var import_jsx_runtime20 = require("react/jsx-runtime");
var ChatEN = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
  "svg",
  {
    width: size,
    height: size,
    viewBox: "0 0 32 32",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    children: [
      /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
        "path",
        {
          d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
          fill: color
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
        "path",
        {
          d: "M22.5488 12V20.5312H21.0781L17.252 14.4199V20.5312H15.7812V12H17.252L21.0898 18.123V12H22.5488Z",
          fill: color
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
        "path",
        {
          d: "M14.584 19.3652V20.5312H10.0547V19.3652H14.584ZM10.4707 12V20.5312H9V12H10.4707ZM13.9922 15.5625V16.7109H10.0547V15.5625H13.9922ZM14.5547 12V13.1719H10.0547V12H14.5547Z",
          fill: color
        }
      )
    ]
  }
);

// src/assets/icons/subjects/ChatES.tsx
var import_jsx_runtime21 = require("react/jsx-runtime");
var ChatES = ({ size, color }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
  "svg",
  {
    width: size,
    height: size,
    viewBox: "0 0 32 32",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    children: [
      /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
        "path",
        {
          d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
          fill: color
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
        "path",
        {
          d: "M21.1426 17.8027C21.1426 17.627 21.1152 17.4707 21.0605 17.334C21.0098 17.1973 20.918 17.0723 20.7852 16.959C20.6523 16.8457 20.4648 16.7363 20.2227 16.6309C19.9844 16.5215 19.6797 16.4102 19.3086 16.2969C18.9023 16.1719 18.5273 16.0332 18.1836 15.8809C17.8438 15.7246 17.5469 15.5449 17.293 15.3418C17.0391 15.1348 16.8418 14.8984 16.7012 14.6328C16.5605 14.3633 16.4902 14.0527 16.4902 13.7012C16.4902 13.3535 16.5625 13.0371 16.707 12.752C16.8555 12.4668 17.0645 12.2207 17.334 12.0137C17.6074 11.8027 17.9297 11.6406 18.3008 11.5273C18.6719 11.4102 19.082 11.3516 19.5312 11.3516C20.1641 11.3516 20.709 11.4688 21.166 11.7031C21.627 11.9375 21.9805 12.252 22.2266 12.6465C22.4766 13.041 22.6016 13.4766 22.6016 13.9531H21.1426C21.1426 13.6719 21.082 13.4238 20.9609 13.209C20.8438 12.9902 20.6641 12.8184 20.4219 12.6934C20.1836 12.5684 19.8809 12.5059 19.5137 12.5059C19.166 12.5059 18.877 12.5586 18.6465 12.6641C18.416 12.7695 18.2441 12.9121 18.1309 13.0918C18.0176 13.2715 17.9609 13.4746 17.9609 13.7012C17.9609 13.8613 17.998 14.0078 18.0723 14.1406C18.1465 14.2695 18.2598 14.3906 18.4121 14.5039C18.5645 14.6133 18.7559 14.7168 18.9863 14.8145C19.2168 14.9121 19.4883 15.0059 19.8008 15.0957C20.2734 15.2363 20.6855 15.3926 21.0371 15.5645C21.3887 15.7324 21.6816 15.9238 21.916 16.1387C22.1504 16.3535 22.3262 16.5977 22.4434 16.8711C22.5605 17.1406 22.6191 17.4473 22.6191 17.791C22.6191 18.1504 22.5469 18.4746 22.4023 18.7637C22.2578 19.0488 22.0508 19.293 21.7812 19.4961C21.5156 19.6953 21.1953 19.8496 20.8203 19.959C20.4492 20.0645 20.0352 20.1172 19.5781 20.1172C19.168 20.1172 18.7637 20.0625 18.3652 19.9531C17.9707 19.8438 17.6113 19.6777 17.2871 19.4551C16.9629 19.2285 16.7051 18.9473 16.5137 18.6113C16.3223 18.2715 16.2266 17.875 16.2266 17.4219H17.6973C17.6973 17.6992 17.7441 17.9355 17.8379 18.1309C17.9355 18.3262 18.0703 18.4863 18.2422 18.6113C18.4141 18.7324 18.6133 18.8223 18.8398 18.8809C19.0703 18.9395 19.3164 18.9688 19.5781 18.9688C19.9219 18.9688 20.209 18.9199 20.4395 18.8223C20.6738 18.7246 20.8496 18.5879 20.9668 18.4121C21.084 18.2363 21.1426 18.0332 21.1426 17.8027Z",
          fill: color
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
        "path",
        {
          d: "M15.4512 18.834V20H10.9219V18.834H15.4512ZM11.3379 11.4688V20H9.86719V11.4688H11.3379ZM14.8594 15.0312V16.1797H10.9219V15.0312H14.8594ZM15.4219 11.4688V12.6406H10.9219V11.4688H15.4219Z",
          fill: color
        }
      )
    ]
  }
);

// src/components/IconRender/IconRender.tsx
var import_jsx_runtime22 = require("react/jsx-runtime");
var IconRender = ({
  iconName,
  color = "#000000",
  size = 24,
  weight = "regular"
}) => {
  if (typeof iconName === "string") {
    switch (iconName) {
      case "Chat_PT":
        return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChatPT, { size, color });
      case "Chat_EN":
        return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChatEN, { size, color });
      case "Chat_ES":
        return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChatES, { size, color });
      default: {
        const IconComponent = PhosphorIcons[iconName] || PhosphorIcons.Question;
        return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IconComponent, { size, color, weight });
      }
    }
  } else {
    return (0, import_react13.cloneElement)(iconName, {
      size,
      color: "currentColor"
    });
  }
};
var IconRender_default = IconRender;

// src/components/Card/Card.tsx
var import_jsx_runtime23 = require("react/jsx-runtime");
var CARD_BASE_CLASSES = {
  default: "w-full bg-background border border-border-50 rounded-xl",
  compact: "w-full bg-background border border-border-50 rounded-lg",
  minimal: "w-full bg-background border border-border-100 rounded-md"
};
var CARD_PADDING_CLASSES = {
  none: "",
  small: "p-2",
  medium: "p-4",
  large: "p-6"
};
var CARD_MIN_HEIGHT_CLASSES = {
  none: "",
  small: "min-h-16",
  medium: "min-h-20",
  large: "min-h-24"
};
var CARD_LAYOUT_CLASSES = {
  horizontal: "flex flex-row",
  vertical: "flex flex-col"
};
var CARD_CURSOR_CLASSES = {
  default: "",
  pointer: "cursor-pointer"
};
var CardBase = (0, import_react14.forwardRef)(
  ({
    children,
    variant = "default",
    layout = "horizontal",
    padding = "medium",
    minHeight = "medium",
    cursor = "default",
    className = "",
    ...props
  }, ref) => {
    const baseClasses = CARD_BASE_CLASSES[variant];
    const paddingClasses = CARD_PADDING_CLASSES[padding];
    const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
    const layoutClasses = CARD_LAYOUT_CLASSES[layout];
    const cursorClasses = CARD_CURSOR_CLASSES[cursor];
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
      "div",
      {
        ref,
        className: cn(
          baseClasses,
          paddingClasses,
          minHeightClasses,
          layoutClasses,
          cursorClasses,
          className
        ),
        ...props,
        children
      }
    );
  }
);
var ACTION_CARD_CLASSES = {
  warning: "bg-warning-background",
  success: "bg-success-200",
  error: "bg-error-100",
  info: "bg-info-background"
};
var ACTION_ICON_CLASSES = {
  warning: "bg-warning-300 text-text",
  success: "bg-indicator-positive text-text-950",
  error: "bg-indicator-negative text-text",
  info: "bg-info-500 text-text"
};
var ACTION_SUBTITLE_CLASSES = {
  warning: "text-warning-600",
  success: "text-success-700",
  error: "text-error-700",
  info: "text-info-700"
};
var ACTION_HEADER_CLASSES = {
  warning: "text-warning-300",
  success: "text-success-300",
  error: "text-error-300",
  info: "text-info-300"
};
var CardActivitiesResults = (0, import_react14.forwardRef)(
  ({
    icon,
    title,
    subTitle,
    header,
    extended = false,
    action = "success",
    description,
    className,
    ...props
  }, ref) => {
    const actionCardClasses = ACTION_CARD_CLASSES[action];
    const actionIconClasses = ACTION_ICON_CLASSES[action];
    const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
    const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      "div",
      {
        ref,
        className: cn(
          "w-full flex flex-col border border-border-50  bg-background rounded-xl",
          className
        ),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
            "div",
            {
              className: cn(
                "flex flex-col gap-1 items-center justify-center p-4",
                actionCardClasses,
                extended ? "rounded-t-xl" : "rounded-xl"
              ),
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                  "span",
                  {
                    className: cn(
                      "size-7.5 rounded-full flex items-center justify-center",
                      actionIconClasses
                    ),
                    children: icon
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                  Text_default,
                  {
                    size: "2xs",
                    weight: "medium",
                    className: "text-text-800 uppercase truncate",
                    children: title
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                  "p",
                  {
                    className: cn("text-lg font-bold truncate", actionSubTitleClasses),
                    children: subTitle
                  }
                )
              ]
            }
          ),
          extended && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              "p",
              {
                className: cn(
                  "text-2xs font-medium uppercase truncate",
                  actionHeaderClasses
                ),
                children: header
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Badge_default, { size: "large", action: "info", children: description })
          ] })
        ]
      }
    );
  }
);
var CardQuestions = (0, import_react14.forwardRef)(
  ({
    header,
    state = "undone",
    className,
    onClickButton,
    valueButton,
    ...props
  }, ref) => {
    const isDone = state === "done";
    const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
    const buttonLabel = isDone ? "Ver Resultado" : "Responder";
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "medium",
        minHeight: "medium",
        className: cn("justify-between gap-4", className),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("section", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "font-bold text-xs text-text-950 truncate", children: header }),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-row gap-6 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              Badge_default,
              {
                size: "medium",
                variant: "solid",
                action: isDone ? "success" : "error",
                children: stateLabel
              }
            ) })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            Button_default,
            {
              size: "extra-small",
              onClick: () => onClickButton?.(valueButton),
              className: "min-w-fit",
              children: buttonLabel
            }
          ) })
        ]
      }
    );
  }
);
var CardProgress = (0, import_react14.forwardRef)(
  ({
    header,
    subhead,
    initialDate,
    endDate,
    progress = 0,
    direction = "horizontal",
    icon,
    color = "#B7DFFF",
    progressVariant = "blue",
    showDates = true,
    className,
    ...props
  }, ref) => {
    const isHorizontal = direction === "horizontal";
    const contentComponent = {
      horizontal: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
        showDates && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row gap-6 items-center", children: [
          initialDate && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-600", children: initialDate })
          ] }),
          endDate && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-800 font-semibold", children: "Fim" }),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-600", children: endDate })
          ] })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            ProgressBar_default,
            {
              size: "small",
              value: progress,
              variant: progressVariant,
              "data-testid": "progress-bar"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
            Text_default,
            {
              size: "xs",
              weight: "medium",
              className: cn(
                "text-text-950 leading-none tracking-normal text-center flex-none"
              ),
              children: [
                Math.round(progress),
                "%"
              ]
            }
          )
        ] })
      ] }),
      vertical: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-text-800", children: subhead })
    };
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: isHorizontal ? "horizontal" : "vertical",
        padding: "none",
        minHeight: "medium",
        cursor: "pointer",
        className: cn(isHorizontal ? "h-20" : "", className),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            "div",
            {
              className: cn(
                "flex justify-center items-center [&>svg]:size-6 text-text-950",
                isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl",
                !color.startsWith("#") ? `${color}` : ""
              ),
              style: color.startsWith("#") ? { backgroundColor: color } : void 0,
              "data-testid": "icon-container",
              children: icon
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
            "div",
            {
              className: cn(
                "p-4 flex flex-col justify-between w-full h-full",
                !isHorizontal && "gap-4"
              ),
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
                contentComponent[direction]
              ]
            }
          )
        ]
      }
    );
  }
);
var CardTopic = (0, import_react14.forwardRef)(
  ({
    header,
    subHead,
    progress,
    showPercentage = false,
    progressVariant = "blue",
    className = "",
    ...props
  }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: "vertical",
        padding: "small",
        minHeight: "medium",
        cursor: "pointer",
        className: cn("justify-center gap-2  py-2 px-4", className),
        ...props,
        children: [
          subHead && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react14.Fragment, { children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: text }),
            index < subHead.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { children: "\u2022" })
          ] }, `${text} - ${index}`)) }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              ProgressBar_default,
              {
                size: "small",
                value: progress,
                variant: progressVariant,
                "data-testid": "progress-bar"
              }
            ),
            showPercentage && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
              Text_default,
              {
                size: "xs",
                weight: "medium",
                className: cn(
                  "text-text-950 leading-none tracking-normal text-center flex-none"
                ),
                children: [
                  Math.round(progress),
                  "%"
                ]
              }
            )
          ] })
        ]
      }
    );
  }
);
var CardPerformance = (0, import_react14.forwardRef)(
  ({
    header,
    progress,
    description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
    actionVariant = "button",
    progressVariant = "blue",
    labelProgress = "",
    className = "",
    onClickButton,
    valueButton,
    ...props
  }, ref) => {
    const hasProgress = progress !== void 0;
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "medium",
        minHeight: "none",
        className: cn(
          actionVariant == "caret" ? "cursor-pointer" : "",
          className
        ),
        onClick: () => actionVariant == "caret" && onClickButton?.(valueButton),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full flex flex-col justify-between gap-2", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row justify-between items-center gap-2", children: [
              /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-lg font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
              actionVariant === "button" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                Button_default,
                {
                  variant: "outline",
                  size: "extra-small",
                  onClick: () => onClickButton?.(valueButton),
                  className: "min-w-fit flex-shrink-0",
                  children: "Ver Aula"
                }
              )
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              ProgressBar_default,
              {
                value: progress,
                label: `${progress}% ${labelProgress}`,
                variant: progressVariant
              }
            ) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-text-600 truncate", children: description }) })
          ] }),
          actionVariant == "caret" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            import_phosphor_react10.CaretRight,
            {
              className: "size-4.5 text-text-800 cursor-pointer",
              "data-testid": "caret-icon"
            }
          )
        ]
      }
    );
  }
);
var CardResults = (0, import_react14.forwardRef)(
  ({
    header,
    correct_answers,
    incorrect_answers,
    icon,
    direction = "col",
    color = "#B7DFFF",
    className,
    ...props
  }, ref) => {
    const isRow = direction == "row";
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "none",
        minHeight: "medium",
        className: cn("items-stretch cursor-pointer pr-4", className),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            "div",
            {
              className: cn(
                "flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-full rounded-l-xl"
              ),
              style: {
                backgroundColor: color
              },
              children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IconRender_default, { iconName: icon, color: "currentColor", size: 20 })
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full flex flex-row justify-between items-center", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
              "div",
              {
                className: cn(
                  "p-4 flex flex-wrap justify-between w-full h-full",
                  isRow ? "flex-row items-center gap-2" : "flex-col"
                ),
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-bold text-text-950 flex-1", children: header }),
                  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-wrap flex-row gap-1 items-center", children: [
                    /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
                      Badge_default,
                      {
                        action: "success",
                        variant: "solid",
                        size: "large",
                        iconLeft: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CheckCircle, {}),
                        children: [
                          correct_answers,
                          " Corretas"
                        ]
                      }
                    ),
                    /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
                      Badge_default,
                      {
                        action: "error",
                        variant: "solid",
                        size: "large",
                        iconLeft: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.XCircle, {}),
                        children: [
                          incorrect_answers,
                          " Incorretas"
                        ]
                      }
                    )
                  ] })
                ]
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
          ] })
        ]
      }
    );
  }
);
var CardStatus = (0, import_react14.forwardRef)(
  ({ header, className, status, label, ...props }, ref) => {
    const getLabelBadge = (status2) => {
      switch (status2) {
        case "correct":
          return "Correta";
        case "incorrect":
          return "Incorreta";
        case "unanswered":
          return "Em branco";
        case "pending":
          return "Avalia\xE7\xE3o pendente";
        default:
          return "Em branco";
      }
    };
    const getIconBadge = (status2) => {
      switch (status2) {
        case "correct":
          return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CheckCircle, {});
        case "incorrect":
          return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.XCircle, {});
        case "pending":
          return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Clock, {});
        default:
          return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.XCircle, {});
      }
    };
    const getActionBadge = (status2) => {
      switch (status2) {
        case "correct":
          return "success";
        case "incorrect":
          return "error";
        case "pending":
          return "info";
        default:
          return "info";
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "medium",
        minHeight: "medium",
        className: cn("items-center cursor-pointer", className),
        ...props,
        children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
            status && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              Badge_default,
              {
                action: getActionBadge(status),
                variant: "solid",
                size: "medium",
                iconLeft: getIconBadge(status),
                children: getLabelBadge(status)
              }
            ),
            label && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-text-800", children: label })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
        ] })
      }
    );
  }
);
var CardSettings = (0, import_react14.forwardRef)(
  ({ header, className, icon, ...props }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "small",
        minHeight: "none",
        className: cn(
          "border-none items-center gap-2 text-text-700",
          className
        ),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "[&>svg]:size-6", children: icon }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "w-full text-sm truncate", children: header }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CaretRight, { size: 24, className: "cursor-pointer" })
        ]
      }
    );
  }
);
var CardSupport = (0, import_react14.forwardRef)(
  ({ header, className, direction = "col", children, ...props }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "medium",
        minHeight: "none",
        className: cn(
          "border-none items-center gap-2 text-text-700",
          className
        ),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
            "div",
            {
              className: cn(
                "w-full flex",
                direction == "col" ? "flex-col" : "flex-row items-center"
              ),
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex flex-row gap-1", children })
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
        ]
      }
    );
  }
);
var CardForum = (0, import_react14.forwardRef)(
  ({
    title,
    content,
    comments,
    onClickComments,
    valueComments,
    onClickProfile,
    valueProfile,
    className = "",
    date,
    hour,
    ...props
  }, ref) => {
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "medium",
        minHeight: "none",
        variant: "minimal",
        className: cn("w-auto h-auto gap-3", className),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            "button",
            {
              type: "button",
              "aria-label": "Ver perfil",
              onClick: () => onClickProfile?.(valueProfile),
              className: "min-w-8 h-8 rounded-full bg-background-950"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
              /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
              /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "text-xs text-text-600", children: [
                "\u2022 ",
                date,
                " \u2022 ",
                hour
              ] })
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
              "button",
              {
                type: "button",
                "aria-label": "Ver coment\xE1rios",
                onClick: () => onClickComments?.(valueComments),
                className: "text-text-600 flex flex-row gap-2 items-center",
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.ChatCircleText, { "aria-hidden": "true", size: 16 }),
                  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("p", { className: "text-xs", children: [
                    comments,
                    " respostas"
                  ] })
                ]
              }
            )
          ] })
        ]
      }
    );
  }
);
var CardAudio = (0, import_react14.forwardRef)(
  ({
    src,
    title,
    onPlay,
    onPause,
    onEnded,
    onAudioTimeUpdate,
    loop = false,
    preload = "metadata",
    tracks,
    className,
    ...props
  }, ref) => {
    const [isPlaying, setIsPlaying] = (0, import_react14.useState)(false);
    const [currentTime, setCurrentTime] = (0, import_react14.useState)(0);
    const [duration, setDuration] = (0, import_react14.useState)(0);
    const [volume, setVolume] = (0, import_react14.useState)(1);
    const [showVolumeControl, setShowVolumeControl] = (0, import_react14.useState)(false);
    const [showSpeedMenu, setShowSpeedMenu] = (0, import_react14.useState)(false);
    const [playbackRate, setPlaybackRate] = (0, import_react14.useState)(1);
    const audioRef = (0, import_react14.useRef)(null);
    const volumeControlRef = (0, import_react14.useRef)(null);
    const speedMenuRef = (0, import_react14.useRef)(null);
    const formatTime = (time) => {
      const minutes = Math.floor(time / 60);
      const seconds = Math.floor(time % 60);
      return `${minutes}:${seconds.toString().padStart(2, "0")}`;
    };
    const handlePlayPause = () => {
      if (isPlaying) {
        audioRef.current?.pause();
        setIsPlaying(false);
        onPause?.();
      } else {
        audioRef.current?.play();
        setIsPlaying(true);
        onPlay?.();
      }
    };
    const handleTimeUpdate = () => {
      const current = audioRef.current?.currentTime ?? 0;
      const total = audioRef.current?.duration ?? 0;
      setCurrentTime(current);
      setDuration(total);
      onAudioTimeUpdate?.(current, total);
    };
    const handleLoadedMetadata = () => {
      setDuration(audioRef.current?.duration ?? 0);
    };
    const handleEnded = () => {
      setIsPlaying(false);
      setCurrentTime(0);
      onEnded?.();
    };
    const handleProgressClick = (e) => {
      const rect = e.currentTarget.getBoundingClientRect();
      const clickX = e.clientX - rect.left;
      const width = rect.width;
      const percentage = clickX / width;
      const newTime = percentage * duration;
      if (audioRef.current) {
        audioRef.current.currentTime = newTime;
      }
      setCurrentTime(newTime);
    };
    const handleVolumeChange = (e) => {
      const newVolume = parseFloat(e.target.value);
      setVolume(newVolume);
      if (audioRef.current) {
        audioRef.current.volume = newVolume;
      }
    };
    const toggleVolumeControl = () => {
      setShowVolumeControl(!showVolumeControl);
      setShowSpeedMenu(false);
    };
    const toggleSpeedMenu = () => {
      setShowSpeedMenu(!showSpeedMenu);
      setShowVolumeControl(false);
    };
    const handleSpeedChange = (speed) => {
      setPlaybackRate(speed);
      if (audioRef.current) {
        audioRef.current.playbackRate = speed;
      }
      setShowSpeedMenu(false);
    };
    const getVolumeIcon = () => {
      if (volume === 0) {
        return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.SpeakerSimpleX, { size: 24 });
      }
      if (volume < 0.5) {
        return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.SpeakerLow, { size: 24 });
      }
      return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.SpeakerHigh, { size: 24 });
    };
    (0, import_react14.useEffect)(() => {
      const handleClickOutside = (event) => {
        if (volumeControlRef.current && !volumeControlRef.current.contains(event.target)) {
          setShowVolumeControl(false);
        }
        if (speedMenuRef.current && !speedMenuRef.current.contains(event.target)) {
          setShowSpeedMenu(false);
        }
      };
      document.addEventListener("mousedown", handleClickOutside);
      return () => {
        document.removeEventListener("mousedown", handleClickOutside);
      };
    }, []);
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "medium",
        minHeight: "none",
        className: cn(
          "flex flex-row w-auto h-14 items-center gap-2",
          className
        ),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            "audio",
            {
              ref: audioRef,
              src,
              loop,
              preload,
              onTimeUpdate: handleTimeUpdate,
              onLoadedMetadata: handleLoadedMetadata,
              onEnded: handleEnded,
              "data-testid": "audio-element",
              "aria-label": title,
              children: tracks ? tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                "track",
                {
                  kind: track.kind,
                  src: track.src,
                  srcLang: track.srcLang,
                  label: track.label,
                  default: track.default
                },
                track.src
              )) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                "track",
                {
                  kind: "captions",
                  src: "data:text/vtt;base64,",
                  srcLang: "pt",
                  label: "Sem legendas dispon\xEDveis"
                }
              )
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            "button",
            {
              type: "button",
              onClick: handlePlayPause,
              disabled: !src,
              className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
              "aria-label": isPlaying ? "Pausar" : "Reproduzir",
              children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-0.5", children: [
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" }),
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-1 h-4 bg-current rounded-sm" })
              ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Play, { size: 24 })
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            "button",
            {
              type: "button",
              className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
              onClick: handleProgressClick,
              onKeyDown: (e) => {
                if (e.key === "Enter" || e.key === " ") {
                  e.preventDefault();
                  handleProgressClick(
                    e
                  );
                }
              },
              "aria-label": "Barra de progresso do \xE1udio",
              children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                "div",
                {
                  className: "h-full bg-primary-600 rounded-full transition-all duration-100",
                  style: {
                    width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
                  }
                }
              )
            }
          ) }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(duration) }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative h-6", ref: volumeControlRef, children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              "button",
              {
                type: "button",
                onClick: toggleVolumeControl,
                className: "cursor-pointer text-text-950 hover:text-primary-600",
                "aria-label": "Controle de volume",
                children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
              }
            ),
            showVolumeControl && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              "button",
              {
                type: "button",
                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",
                onKeyDown: (e) => {
                  if (e.key === "Escape") {
                    setShowVolumeControl(false);
                  }
                },
                children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                  "input",
                  {
                    type: "range",
                    min: "0",
                    max: "1",
                    step: "0.1",
                    value: volume,
                    onChange: handleVolumeChange,
                    onKeyDown: (e) => {
                      if (e.key === "ArrowUp" || e.key === "ArrowRight") {
                        e.preventDefault();
                        const newVolume = Math.min(
                          1,
                          Math.round((volume + 0.1) * 10) / 10
                        );
                        setVolume(newVolume);
                        if (audioRef.current) audioRef.current.volume = newVolume;
                      } else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
                        e.preventDefault();
                        const newVolume = Math.max(
                          0,
                          Math.round((volume - 0.1) * 10) / 10
                        );
                        setVolume(newVolume);
                        if (audioRef.current) audioRef.current.volume = newVolume;
                      }
                    },
                    className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
                    style: {
                      background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
                    },
                    "aria-label": "Volume",
                    "aria-valuenow": Math.round(volume * 100),
                    "aria-valuemin": 0,
                    "aria-valuemax": 100
                  }
                )
              }
            )
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative h-6", ref: speedMenuRef, children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              "button",
              {
                type: "button",
                onClick: toggleSpeedMenu,
                className: "cursor-pointer text-text-950 hover:text-primary-600",
                "aria-label": "Op\xE7\xF5es de velocidade",
                children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.DotsThreeVertical, { size: 24 })
              }
            ),
            showSpeedMenu && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg min-w-24 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col gap-1", children: [
              { speed: 1, label: "1x" },
              { speed: 1.5, label: "1.5x" },
              { speed: 2, label: "2x" }
            ].map(({ speed, label }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              "button",
              {
                type: "button",
                onClick: () => handleSpeedChange(speed),
                className: cn(
                  "px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
                  playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
                ),
                children: label
              },
              speed
            )) }) })
          ] })
        ]
      }
    );
  }
);
var SIMULADO_BACKGROUND_CLASSES = {
  enem: "bg-exam-1",
  prova: "bg-exam-2",
  simuladao: "bg-exam-3",
  vestibular: "bg-exam-4"
};
var CardSimulado = (0, import_react14.forwardRef)(
  ({ title, duration, info, backgroundColor, className, ...props }, ref) => {
    const backgroundClass = SIMULADO_BACKGROUND_CLASSES[backgroundColor];
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
      CardBase,
      {
        ref,
        layout: "horizontal",
        padding: "medium",
        minHeight: "none",
        cursor: "pointer",
        className: cn(
          `${backgroundClass} hover:shadow-soft-shadow-2 transition-shadow duration-200`,
          className
        ),
        ...props,
        children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between items-center w-full gap-4", children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "lg", weight: "bold", className: "text-text-950 truncate", children: title }),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-4 text-text-700", children: [
              duration && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Clock, { size: 16, className: "flex-shrink-0" }),
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "sm", children: duration })
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "sm", className: "truncate", children: info })
            ] })
          ] }),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            import_phosphor_react10.CaretRight,
            {
              size: 24,
              className: "text-text-800 flex-shrink-0",
              "data-testid": "caret-icon"
            }
          )
        ] })
      }
    );
  }
);
var CardTest = (0, import_react14.forwardRef)(
  ({
    title,
    duration,
    questionsCount,
    additionalInfo,
    selected = false,
    onSelect,
    className = "",
    ...props
  }, ref) => {
    const handleClick = () => {
      if (onSelect) {
        onSelect(!selected);
      }
    };
    const handleKeyDown = (event) => {
      if ((event.key === "Enter" || event.key === " ") && onSelect) {
        event.preventDefault();
        onSelect(!selected);
      }
    };
    const isSelectable = !!onSelect;
    const getQuestionsText = (count) => {
      const singular = count === 1 ? "quest\xE3o" : "quest\xF5es";
      return `${count} ${singular}`;
    };
    const displayInfo = questionsCount ? getQuestionsText(questionsCount) : additionalInfo || "";
    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";
    const interactiveClasses = isSelectable ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-950 focus:ring-offset-2" : "";
    const selectedClasses = selected ? "ring-2 ring-primary-950 ring-offset-2" : "";
    if (isSelectable) {
      return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
        "button",
        {
          ref,
          type: "button",
          className: cn(
            `${baseClasses} ${interactiveClasses} ${selectedClasses} ${className}`.trim()
          ),
          onClick: handleClick,
          onKeyDown: handleKeyDown,
          "aria-pressed": selected,
          ...props,
          children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              Text_default,
              {
                size: "md",
                weight: "bold",
                className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
                children: title
              }
            ),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
              duration && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Clock, { size: 16, className: "text-text-700" }),
                /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                  Text_default,
                  {
                    size: "sm",
                    className: "text-text-700 leading-[21px] whitespace-nowrap",
                    children: duration
                  }
                )
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                Text_default,
                {
                  size: "sm",
                  className: "text-text-700 leading-[21px] flex-grow truncate",
                  children: displayInfo
                }
              )
            ] })
          ] })
        }
      );
    }
    return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
      "div",
      {
        ref,
        className: cn(`${baseClasses} ${className}`.trim()),
        ...props,
        children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
            Text_default,
            {
              size: "md",
              weight: "bold",
              className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
              children: title
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
            duration && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
              /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react10.Clock, { size: 16, className: "text-text-700" }),
              /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                Text_default,
                {
                  size: "sm",
                  className: "text-text-700 leading-[21px] whitespace-nowrap",
                  children: duration
                }
              )
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
              Text_default,
              {
                size: "sm",
                className: "text-text-700 leading-[21px] flex-grow truncate min-w-0",
                children: displayInfo
              }
            )
          ] })
        ] })
      }
    );
  }
);
var SIMULATION_TYPE_STYLES = {
  enem: {
    background: "bg-exam-1",
    badge: "exam1",
    text: "Enem"
  },
  prova: {
    background: "bg-exam-2",
    badge: "exam2",
    text: "Prova"
  },
  simulado: {
    background: "bg-exam-3",
    badge: "exam3",
    text: "Simulad\xE3o"
  },
  vestibular: {
    background: "bg-exam-4",
    badge: "exam4",
    text: "Vestibular"
  }
};
var CardSimulationHistory = (0, import_react14.forwardRef)(({ data, onSimulationClick, className, ...props }, ref) => {
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
    "div",
    {
      ref,
      className: cn("w-full max-w-[992px] h-auto", className),
      ...props,
      children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-0", children: [
        data.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
          "div",
          {
            className: cn(
              "flex flex-row justify-center items-start px-4 py-6 gap-2 w-full bg-background",
              sectionIndex === 0 ? "rounded-t-3xl" : ""
            ),
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                Text_default,
                {
                  size: "xs",
                  weight: "bold",
                  className: "text-text-800 w-11 flex-shrink-0",
                  children: section.date
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col gap-2 flex-1", children: section.simulations.map((simulation) => {
                const typeStyles = SIMULATION_TYPE_STYLES[simulation.type];
                return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                  CardBase,
                  {
                    layout: "horizontal",
                    padding: "medium",
                    minHeight: "none",
                    cursor: "pointer",
                    className: cn(
                      `${typeStyles.background} rounded-xl hover:shadow-soft-shadow-2 
                          transition-shadow duration-200 h-auto min-h-[61px]`
                    ),
                    onClick: () => onSimulationClick?.(simulation),
                    children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between items-center w-full gap-2", children: [
                      /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap flex-col justify-between sm:flex-row gap-2 flex-1 min-w-0", children: [
                        /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                          Text_default,
                          {
                            size: "lg",
                            weight: "bold",
                            className: "text-text-950 truncate",
                            children: simulation.title
                          }
                        ),
                        /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
                          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                            Badge_default,
                            {
                              variant: "examsOutlined",
                              action: typeStyles.badge,
                              size: "medium",
                              children: typeStyles.text
                            }
                          ),
                          /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text_default, { size: "sm", className: "text-text-800 truncate", children: simulation.info })
                        ] })
                      ] }),
                      /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
                        import_phosphor_react10.CaretRight,
                        {
                          size: 24,
                          className: "text-text-800 flex-shrink-0",
                          "data-testid": "caret-icon"
                        }
                      )
                    ] })
                  },
                  simulation.id
                );
              }) })
            ]
          }
        ) }, section.date)),
        data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full h-6 bg-background rounded-b-3xl" })
      ] })
    }
  );
});

// src/components/Accordation/Accordation.tsx
var import_phosphor_react11 = require("phosphor-react");
var import_jsx_runtime24 = require("react/jsx-runtime");
var CardAccordation = (0, import_react15.forwardRef)(
  ({
    trigger,
    children,
    className,
    defaultExpanded = false,
    expanded: controlledExpanded,
    onToggleExpanded,
    value,
    disabled = false,
    triggerClassName,
    contentClassName,
    ...props
  }, ref) => {
    const [internalExpanded, setInternalExpanded] = (0, import_react15.useState)(defaultExpanded);
    const generatedId = (0, import_react15.useId)();
    const contentId = value ? `accordion-content-${value}` : generatedId;
    const headerId = value ? `accordion-header-${value}` : `${generatedId}-header`;
    const isControlled = controlledExpanded !== void 0;
    const isExpanded = isControlled ? controlledExpanded : internalExpanded;
    (0, import_react15.useEffect)(() => {
      if (isControlled) {
        setInternalExpanded(controlledExpanded);
      }
    }, [isControlled, controlledExpanded]);
    const handleToggle = () => {
      if (disabled) return;
      const newExpanded = !isExpanded;
      if (!isControlled) {
        setInternalExpanded(newExpanded);
      }
      onToggleExpanded?.(newExpanded);
    };
    const handleKeyDown = (event) => {
      if (disabled) return;
      if (event.key === "Enter" || event.key === " ") {
        event.preventDefault();
        handleToggle();
      }
    };
    return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
      CardBase,
      {
        ref,
        layout: "vertical",
        padding: "none",
        minHeight: "none",
        className: cn("overflow-hidden", className),
        ...props,
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
            "button",
            {
              id: headerId,
              type: "button",
              onClick: handleToggle,
              onKeyDown: handleKeyDown,
              disabled,
              className: cn(
                "w-full cursor-pointer not-aria-expanded:rounded-xl aria-expanded:rounded-t-xl flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:border-2 focus:border-primary-950 focus:ring-inset px-2",
                disabled && "cursor-not-allowed text-text-400",
                triggerClassName
              ),
              "aria-expanded": isExpanded,
              "aria-controls": contentId,
              "aria-disabled": disabled,
              "data-value": value,
              children: [
                trigger,
                /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
                  import_phosphor_react11.CaretRight,
                  {
                    size: 20,
                    className: cn(
                      "transition-transform duration-200 flex-shrink-0",
                      disabled ? "text-gray-400" : "text-text-700",
                      isExpanded ? "rotate-90" : "rotate-0"
                    ),
                    "data-testid": "accordion-caret"
                  }
                )
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
            "section",
            {
              id: contentId,
              "aria-labelledby": headerId,
              "aria-hidden": !isExpanded,
              className: cn(
                "transition-all duration-300 ease-in-out overflow-hidden",
                isExpanded ? "max-h-screen opacity-100" : "max-h-0 opacity-0"
              ),
              "data-testid": "accordion-content",
              "data-value": value,
              children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("p-4 pt-0", contentClassName), children })
            }
          )
        ]
      }
    );
  }
);
CardAccordation.displayName = "CardAccordation";

// src/components/Accordation/AccordionGroup.tsx
var import_react16 = require("react");
var import_zustand4 = require("zustand");
var import_jsx_runtime25 = require("react/jsx-runtime");
function createAccordionGroupStore(type, initialValue, collapsible) {
  return (0, import_zustand4.create)((set, get) => ({
    type,
    value: initialValue,
    collapsible,
    setValue: (value) => set({ value }),
    isItemExpanded: (itemValue) => {
      const state = get();
      if (state.type === "single") {
        return state.value === itemValue;
      } else {
        return Array.isArray(state.value) && state.value.includes(itemValue);
      }
    }
  }));
}
var injectStore3 = (children, store, indexRef, onItemToggle) => {
  return import_react16.Children.map(children, (child) => {
    if (!(0, import_react16.isValidElement)(child)) {
      return child;
    }
    const typedChild = child;
    const displayName = typedChild.type?.displayName;
    let newProps = {};
    if (displayName === "CardAccordation") {
      const itemValue = typedChild.props.value || `accordion-item-${indexRef.current++}`;
      const storeState = store.getState();
      const expanded = storeState.isItemExpanded(itemValue);
      newProps.value = itemValue;
      newProps.expanded = expanded;
      newProps.onToggleExpanded = (isExpanded) => {
        onItemToggle(itemValue, isExpanded);
        typedChild.props.onToggleExpanded?.(isExpanded);
      };
    }
    if (typedChild.props.children) {
      const processedChildren = injectStore3(
        typedChild.props.children,
        store,
        indexRef,
        onItemToggle
      );
      if (displayName === "CardAccordation") {
        newProps.children = processedChildren;
      } else if (processedChildren !== typedChild.props.children) {
        return (0, import_react16.cloneElement)(typedChild, { children: processedChildren });
      }
    }
    if (Object.keys(newProps).length > 0) {
      return (0, import_react16.cloneElement)(typedChild, newProps);
    }
    return child;
  });
};
var AccordionGroup = (0, import_react16.forwardRef)(
  ({
    type = "single",
    defaultValue,
    value: controlledValue,
    onValueChange,
    collapsible = true,
    children,
    className,
    ...props
  }, ref) => {
    const [internalValue, setInternalValue] = (0, import_react16.useState)(
      defaultValue || (type === "single" ? "" : [])
    );
    const isControlled = controlledValue !== void 0;
    const currentValue = isControlled ? controlledValue : internalValue;
    const storeRef = (0, import_react16.useRef)(null);
    if (storeRef.current) {
      storeRef.current.setState((prev) => {
        const nextState = {};
        if (prev.type !== type) {
          nextState.type = type;
        }
        if (prev.collapsible !== collapsible) {
          nextState.collapsible = collapsible;
        }
        return nextState;
      });
    } else {
      storeRef.current = createAccordionGroupStore(
        type,
        currentValue,
        collapsible
      );
    }
    const store = storeRef.current;
    (0, import_react16.useEffect)(() => {
      store.setState({ value: currentValue });
    }, [currentValue, store]);
    (0, import_react16.useEffect)(() => {
      if (!isControlled) {
        setInternalValue((prev) => {
          if (type === "single") {
            if (Array.isArray(prev)) {
              return prev[0] ?? "";
            }
            return typeof prev === "string" ? prev : "";
          }
          if (Array.isArray(prev)) {
            return prev;
          }
          return prev ? [prev] : [];
        });
      }
    }, [isControlled, type]);
    const handleItemToggle = (itemValue, isExpanded) => {
      const storeState = store.getState();
      let newValue;
      if (type === "single") {
        if (isExpanded) {
          newValue = itemValue;
        } else {
          newValue = collapsible ? "" : storeState.value;
        }
      } else {
        const currentArray = Array.isArray(storeState.value) ? storeState.value : [];
        if (isExpanded) {
          newValue = [...currentArray, itemValue];
        } else {
          newValue = currentArray.filter((v) => v !== itemValue);
        }
      }
      if (!isControlled) {
        setInternalValue(newValue);
      }
      store.setState({ value: newValue });
      onValueChange?.(newValue);
    };
    const indexRef = { current: 0 };
    const enhancedChildren = injectStore3(
      children,
      store,
      indexRef,
      handleItemToggle
    );
    return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref, className, ...props, children: enhancedChildren });
  }
);
AccordionGroup.displayName = "AccordionGroup";

// src/components/FileAttachment/FileAttachment.tsx
var import_react17 = require("react");
var import_phosphor_react12 = require("phosphor-react");
var import_jsx_runtime26 = require("react/jsx-runtime");
var generateFileId = () => {
  return crypto.randomUUID();
};

// src/types/studentActivityCorrection.ts
var QUESTION_STATUS = {
  CORRETA: "CORRETA",
  INCORRETA: "INCORRETA",
  EM_BRANCO: "EM_BRANCO"
};
var getQuestionStatusBadgeConfig = (status) => {
  const configs = {
    [QUESTION_STATUS.CORRETA]: {
      label: "Correta",
      bgColor: "bg-success-background",
      textColor: "text-success-800"
    },
    [QUESTION_STATUS.INCORRETA]: {
      label: "Incorreta",
      bgColor: "bg-error-background",
      textColor: "text-error-800"
    },
    [QUESTION_STATUS.EM_BRANCO]: {
      label: "Em branco",
      bgColor: "bg-gray-100",
      textColor: "text-gray-600"
    }
  };
  return configs[status];
};

// src/components/CorrectActivityModal/CorrectActivityModal.tsx
var import_jsx_runtime27 = require("react/jsx-runtime");
var variantConfig = {
  score: {
    bg: "bg-warning-background",
    text: "text-warning-600",
    iconBg: "bg-warning-300",
    iconColor: "text-white",
    IconComponent: import_phosphor_react13.Star
  },
  correct: {
    bg: "bg-success-200",
    text: "text-success-700",
    iconBg: "bg-indicator-positive",
    iconColor: "text-text-950",
    IconComponent: import_phosphor_react13.Medal
  },
  incorrect: {
    bg: "bg-error-100",
    text: "text-error-700",
    iconBg: "bg-indicator-negative",
    iconColor: "text-white",
    IconComponent: import_phosphor_react13.WarningCircle
  }
};
var StatCard = ({ label, value, variant }) => {
  const config = variantConfig[variant];
  const IconComponent = config.IconComponent;
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
    "div",
    {
      className: cn(
        "border border-border-50 rounded-xl py-4 px-3 flex flex-col items-center justify-center gap-1",
        config.bg
      ),
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
          "div",
          {
            className: cn(
              "w-[30px] h-[30px] rounded-2xl flex items-center justify-center",
              config.iconBg
            ),
            children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
              IconComponent,
              {
                size: 16,
                className: config.iconColor,
                weight: "regular"
              }
            )
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
          Text_default,
          {
            className: cn("text-2xs font-bold uppercase text-center", config.text),
            children: label
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: cn("text-xl font-bold", config.text), children: value })
      ]
    }
  );
};
var CorrectActivityModal = ({
  isOpen,
  onClose,
  data,
  isViewOnly = false,
  onObservationSubmit
}) => {
  const [observation, setObservation] = (0, import_react18.useState)("");
  const [isObservationExpanded, setIsObservationExpanded] = (0, import_react18.useState)(false);
  const [isObservationSaved, setIsObservationSaved] = (0, import_react18.useState)(false);
  const [savedObservation, setSavedObservation] = (0, import_react18.useState)("");
  const [attachedFiles, setAttachedFiles] = (0, import_react18.useState)([]);
  const [savedFiles, setSavedFiles] = (0, import_react18.useState)([]);
  const fileInputRef = (0, import_react18.useRef)(null);
  (0, import_react18.useEffect)(() => {
    if (isOpen) {
      setObservation("");
      setIsObservationExpanded(false);
      setIsObservationSaved(false);
      setSavedObservation("");
      setAttachedFiles([]);
      setSavedFiles([]);
    }
  }, [isOpen, data?.studentId]);
  const handleOpenObservation = () => {
    setIsObservationExpanded(true);
  };
  const handleFilesAdd = (files) => {
    const newFile = files[0];
    if (newFile) {
      setAttachedFiles([{ file: newFile, id: generateFileId() }]);
    }
  };
  const handleFileRemove = (id) => {
    setAttachedFiles((prev) => prev.filter((f) => f.id !== id));
  };
  const handleSaveObservation = () => {
    if (observation.trim() || attachedFiles.length > 0) {
      setSavedObservation(observation);
      setSavedFiles([...attachedFiles]);
      setIsObservationSaved(true);
      setIsObservationExpanded(false);
      onObservationSubmit?.(
        observation,
        attachedFiles.map((f) => f.file)
      );
    }
  };
  const handleEditObservation = () => {
    setObservation(savedObservation);
    setAttachedFiles([...savedFiles]);
    setIsObservationSaved(false);
    setIsObservationExpanded(true);
  };
  if (!data) return null;
  const title = isViewOnly ? "Detalhes da atividade" : "Corrigir atividade";
  const formattedScore = data.score === null ? "-" : data.score.toFixed(1);
  const renderObservationSection = () => {
    if (isViewOnly) return null;
    if (isObservationSaved) {
      return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "bg-background border border-border-100 rounded-lg p-4 space-y-2", children: [
        /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3", children: [
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-sm font-bold text-text-950", children: "Observa\xE7\xE3o" }),
          /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-3", children: [
            savedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px]", children: [
              /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
                import_phosphor_react13.Paperclip,
                {
                  size: 18,
                  className: "text-text-800 flex-shrink-0"
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: savedFiles[0].file.name })
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
              Button_default,
              {
                type: "button",
                variant: "outline",
                size: "small",
                onClick: handleEditObservation,
                className: "flex items-center gap-2 flex-shrink-0",
                children: [
                  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_phosphor_react13.PencilSimple, { size: 16 }),
                  "Editar"
                ]
              }
            )
          ] })
        ] }),
        savedObservation && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-3 bg-background-50 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-sm text-text-700", children: savedObservation }) })
      ] });
    }
    if (isObservationExpanded) {
      return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "bg-background border border-border-100 rounded-lg p-4 space-y-3", children: [
        /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-sm font-bold text-text-950", children: "Observa\xE7\xE3o" }),
        /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
          "textarea",
          {
            value: observation,
            onChange: (e) => setObservation(e.target.value),
            placeholder: "Escreva uma observa\xE7\xE3o para o estudante",
            className: "w-full min-h-[80px] p-3 border border-border-100 rounded-lg text-sm text-text-700 placeholder:text-text-400 resize-none focus:outline-none focus:ring-2 focus:ring-primary-500"
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
          "input",
          {
            type: "file",
            ref: fileInputRef,
            className: "hidden",
            onChange: (e) => {
              const selectedFiles = e.target.files;
              if (selectedFiles && selectedFiles.length > 0) {
                handleFilesAdd(Array.from(selectedFiles));
              }
              if (fileInputRef.current) {
                fileInputRef.current.value = "";
              }
            },
            "aria-label": "Selecionar arquivo"
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col-reverse sm:flex-row gap-3 sm:justify-between", children: [
          attachedFiles.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px]", children: [
            /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_phosphor_react13.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
            /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
            /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
              "button",
              {
                type: "button",
                onClick: () => handleFileRemove(attachedFiles[0].id),
                className: "text-text-700 hover:text-text-800 flex-shrink-0",
                "aria-label": `Remover ${attachedFiles[0].file.name}`,
                children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_phosphor_react13.X, { size: 18 })
              }
            )
          ] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
            Button_default,
            {
              type: "button",
              variant: "outline",
              size: "small",
              onClick: () => fileInputRef.current?.click(),
              className: "flex items-center gap-2",
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_phosphor_react13.Paperclip, { size: 18 }),
                "Anexar"
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
            Button_default,
            {
              type: "button",
              size: "small",
              onClick: handleSaveObservation,
              disabled: !observation.trim() && attachedFiles.length === 0,
              children: "Salvar"
            }
          )
        ] }),
        data.observation && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-3 bg-background-50 rounded-lg", children: [
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-xs text-text-500", children: "Observa\xE7\xE3o anterior:" }),
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-sm text-text-700", children: data.observation })
        ] })
      ] });
    }
    return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "bg-background border border-border-100 rounded-lg p-4 flex flex-col sm:flex-row gap-3 sm:items-center sm:justify-between", children: [
      /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-sm font-bold text-text-950", children: "Observa\xE7\xE3o" }),
      /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button_default, { type: "button", size: "small", onClick: handleOpenObservation, children: "Incluir" })
    ] });
  };
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
    Modal_default,
    {
      isOpen,
      onClose,
      title,
      size: "lg",
      contentClassName: "max-h-[80vh] overflow-y-auto",
      children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-6", children: [
        /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-3", children: [
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName.charAt(0).toUpperCase() }) }),
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(StatCard, { label: "Nota", value: formattedScore, variant: "score" }),
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
            StatCard,
            {
              label: "N\xB0 de quest\xF5es corretas",
              value: data.correctCount,
              variant: "correct"
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
            StatCard,
            {
              label: "N\xB0 de quest\xF5es incorretas",
              value: data.incorrectCount,
              variant: "incorrect"
            }
          )
        ] }),
        renderObservationSection(),
        /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-2", children: [
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-sm font-bold text-text-950", children: "Respostas" }),
          /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions.map((question) => {
            const badgeConfig = getQuestionStatusBadgeConfig(question.status);
            return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
              CardAccordation,
              {
                value: `question-${question.questionNumber}`,
                className: "bg-background rounded-xl",
                trigger: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between w-full py-3 pr-2", children: [
                  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Text_default, { className: "text-base font-bold text-text-950", children: [
                    "Quest\xE3o ",
                    question.questionNumber
                  ] }),
                  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
                    Badge_default,
                    {
                      className: cn(
                        "text-xs px-2 py-1",
                        badgeConfig.bgColor,
                        badgeConfig.textColor
                      ),
                      children: badgeConfig.label
                    }
                  )
                ] }),
                children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-4 pt-2", children: [
                  question.questionText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-sm text-text-700", children: question.questionText }),
                  question.alternatives && question.alternatives.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
                    CardAccordation,
                    {
                      value: `alternatives-${question.questionNumber}`,
                      className: "border border-border-100 rounded-lg",
                      trigger: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "py-3 pr-2 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-sm font-bold text-text-950", children: "Alternativas" }) }),
                      children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
                        AlternativesList,
                        {
                          mode: "readonly",
                          selectedValue: question.studentAnswer,
                          alternatives: question.alternatives.map(
                            (alt) => ({
                              value: alt.value,
                              label: alt.label,
                              status: alt.isCorrect ? "correct" : void 0
                            })
                          )
                        }
                      ) })
                    }
                  ),
                  (!question.alternatives || question.alternatives.length === 0) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
                    /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2", children: [
                      /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-xs text-text-500", children: "Resposta do aluno:" }),
                      /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-xs text-text-700", children: question.studentAnswer || "N\xE3o respondeu" })
                    ] }),
                    /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2", children: [
                      /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-xs text-text-500", children: "Resposta correta:" }),
                      /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { className: "text-xs text-success-700", children: question.correctAnswer || "-" })
                    ] })
                  ] })
                ] })
              },
              question.questionNumber
            );
          }) })
        ] })
      ] })
    }
  );
};
var CorrectActivityModal_default = CorrectActivityModal;

// src/hooks/useMobile.ts
var import_react19 = require("react");
var MOBILE_WIDTH = 500;
var TABLET_WIDTH = 931;
var SMALL_MOBILE_WIDTH = 425;
var EXTRA_SMALL_MOBILE_WIDTH = 375;
var ULTRA_SMALL_MOBILE_WIDTH = 375;
var TINY_MOBILE_WIDTH = 320;
var DEFAULT_WIDTH = 1200;
var getWindowWidth = () => {
  if (typeof window === "undefined") {
    return DEFAULT_WIDTH;
  }
  return window.innerWidth;
};
var getDeviceType = () => {
  const width = getWindowWidth();
  return width < TABLET_WIDTH ? "responsive" : "desktop";
};
var useMobile = () => {
  const [isMobile, setIsMobile] = (0, import_react19.useState)(false);
  const [isTablet, setIsTablet] = (0, import_react19.useState)(false);
  const [isSmallMobile, setIsSmallMobile] = (0, import_react19.useState)(false);
  const [isExtraSmallMobile, setIsExtraSmallMobile] = (0, import_react19.useState)(false);
  const [isUltraSmallMobile, setIsUltraSmallMobile] = (0, import_react19.useState)(false);
  const [isTinyMobile, setIsTinyMobile] = (0, import_react19.useState)(false);
  (0, import_react19.useEffect)(() => {
    const checkScreenSize = () => {
      const width = getWindowWidth();
      setIsMobile(width < MOBILE_WIDTH);
      setIsTablet(width < TABLET_WIDTH);
      setIsSmallMobile(width < SMALL_MOBILE_WIDTH);
      setIsExtraSmallMobile(width < EXTRA_SMALL_MOBILE_WIDTH);
      setIsUltraSmallMobile(width < ULTRA_SMALL_MOBILE_WIDTH);
      setIsTinyMobile(width < TINY_MOBILE_WIDTH);
    };
    checkScreenSize();
    window.addEventListener("resize", checkScreenSize);
    return () => window.removeEventListener("resize", checkScreenSize);
  }, []);
  const getFormContainerClasses = () => {
    if (isMobile) {
      return "w-full px-4";
    }
    if (isTablet) {
      return "w-full px-6";
    }
    return "w-full max-w-[992px] mx-auto px-0";
  };
  const getMobileHeaderClasses = () => {
    return "flex flex-col items-start gap-4 mb-6";
  };
  const getDesktopHeaderClasses = () => {
    return "flex flex-row justify-between items-center gap-6 mb-8";
  };
  const getHeaderClasses = () => {
    return isMobile ? getMobileHeaderClasses() : getDesktopHeaderClasses();
  };
  const getVideoContainerClasses = () => {
    if (isTinyMobile) return "aspect-square";
    if (isExtraSmallMobile) return "aspect-[4/3]";
    if (isSmallMobile) return "aspect-[16/12]";
    return "aspect-video";
  };
  return {
    isMobile,
    isTablet,
    isSmallMobile,
    isExtraSmallMobile,
    isUltraSmallMobile,
    isTinyMobile,
    getFormContainerClasses,
    getHeaderClasses,
    getMobileHeaderClasses,
    getDesktopHeaderClasses,
    getVideoContainerClasses,
    getDeviceType
  };
};

// src/assets/icons/subjects/BookOpenText.tsx
var import_jsx_runtime28 = require("react/jsx-runtime");
var BookOpenText = ({
  size,
  color
}) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
  "svg",
  {
    width: size,
    height: size,
    viewBox: "0 0 32 32",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
      "path",
      {
        d: "M29 6H20C19.2238 6 18.4582 6.18073 17.7639 6.52786C17.0697 6.875 16.4657 7.37902 16 8C15.5343 7.37902 14.9303 6.875 14.2361 6.52786C13.5418 6.18073 12.7762 6 12 6H3C2.73478 6 2.48043 6.10536 2.29289 6.29289C2.10536 6.48043 2 6.73478 2 7V25C2 25.2652 2.10536 25.5196 2.29289 25.7071C2.48043 25.8946 2.73478 26 3 26H12C12.7956 26 13.5587 26.3161 14.1213 26.8787C14.6839 27.4413 15 28.2044 15 29C15 29.2652 15.1054 29.5196 15.2929 29.7071C15.4804 29.8946 15.7348 30 16 30C16.2652 30 16.5196 29.8946 16.7071 29.7071C16.8946 29.5196 17 29.2652 17 29C17 28.2044 17.3161 27.4413 17.8787 26.8787C18.4413 26.3161 19.2044 26 20 26H29C29.2652 26 29.5196 25.8946 29.7071 25.7071C29.8946 25.5196 30 25.2652 30 25V7C30 6.73478 29.8946 6.48043 29.7071 6.29289C29.5196 6.10536 29.2652 6 29 6ZM12 24H4V8H12C12.7956 8 13.5587 8.31607 14.1213 8.87868C14.6839 9.44129 15 10.2044 15 11V25C14.1353 24.3493 13.0821 23.9983 12 24ZM28 24H20C18.9179 23.9983 17.8647 24.3493 17 25V11C17 10.2044 17.3161 9.44129 17.8787 8.87868C18.4413 8.31607 19.2044 8 20 8H28V24ZM20 11H25C25.2652 11 25.5196 11.1054 25.7071 11.2929C25.8946 11.4804 26 11.7348 26 12C26 12.2652 25.8946 12.5196 25.7071 12.7071C25.5196 12.8946 25.2652 13 25 13H20C19.7348 13 19.4804 12.8946 19.2929 12.7071C19.1054 12.5196 19 12.2652 19 12C19 11.7348 19.1054 11.4804 19.2929 11.2929C19.4804 11.1054 19.7348 11 20 11ZM26 16C26 16.2652 25.8946 16.5196 25.7071 16.7071C25.5196 16.8946 25.2652 17 25 17H20C19.7348 17 19.4804 16.8946 19.2929 16.7071C19.1054 16.5196 19 16.2652 19 16C19 15.7348 19.1054 15.4804 19.2929 15.2929C19.4804 15.1054 19.7348 15 20 15H25C25.2652 15 25.5196 15.1054 25.7071 15.2929C25.8946 15.4804 26 15.7348 26 16ZM26 20C26 20.2652 25.8946 20.5196 25.7071 20.7071C25.5196 20.8946 25.2652 21 25 21H20C19.7348 21 19.4804 20.8946 19.2929 20.7071C19.1054 20.5196 19 20.2652 19 20C19 19.7348 19.1054 19.4804 19.2929 19.2929C19.4804 19.1054 19.7348 19 20 19H25C25.2652 19 25.5196 19.1054 25.7071 19.2929C25.8946 19.4804 26 19.7348 26 20Z",
        fill: color
      }
    )
  }
);

// src/assets/icons/subjects/HeadCircuit.tsx
var import_jsx_runtime29 = require("react/jsx-runtime");
var HeadCircuit = ({
  size,
  color
}) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
  "svg",
  {
    width: size,
    height: size,
    viewBox: "0 0 32 32",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
      "path",
      {
        d: "M24.0625 21.4338C25.327 20.3715 26.3372 19.0392 27.0187 17.5348C27.7001 16.0304 28.0354 14.3924 28 12.7413C27.875 7.02751 23.2987 2.31626 17.595 2.01626C16.1233 1.93616 14.6506 2.15261 13.2642 2.65277C11.8778 3.15293 10.6061 3.92659 9.52453 4.92781C8.44297 5.92903 7.57365 7.13739 6.96819 8.48112C6.36272 9.82485 6.03347 11.2766 5.99997 12.75L3.19372 18.1475C3.18247 18.17 3.17122 18.1925 3.16122 18.215C2.96003 18.6839 2.94569 19.212 3.12114 19.6912C3.29659 20.1704 3.64855 20.5644 4.10497 20.7925L4.13622 20.8063L6.99997 22.1175V26C6.99997 26.5304 7.21068 27.0392 7.58576 27.4142C7.96083 27.7893 8.46954 28 8.99997 28H15C15.2652 28 15.5195 27.8947 15.7071 27.7071C15.8946 27.5196 16 27.2652 16 27C16 26.7348 15.8946 26.4804 15.7071 26.2929C15.5195 26.1054 15.2652 26 15 26H8.99997V21.4763C9.00011 21.2846 8.94517 21.0969 8.84168 20.9356C8.73818 20.7742 8.5905 20.646 8.41622 20.5663L4.99997 19L7.88372 13.4575C7.95889 13.3166 7.99878 13.1597 7.99997 13C7.99968 10.9604 8.69216 8.98124 9.96395 7.38674C11.2357 5.79224 13.0114 4.677 15 4.22376V6.17251C14.3328 6.4084 13.7704 6.87258 13.4123 7.48299C13.0543 8.0934 12.9235 8.81075 13.0432 9.50824C13.1628 10.2057 13.5252 10.8385 14.0663 11.2946C14.6074 11.7508 15.2923 12.0009 16 12.0009C16.7077 12.0009 17.3926 11.7508 17.9336 11.2946C18.4747 10.8385 18.8371 10.2057 18.9568 9.50824C19.0764 8.81075 18.9457 8.0934 18.5876 7.48299C18.2295 6.87258 17.6672 6.4084 17 6.17251V4.00001C17.1625 4.00001 17.325 4.00001 17.4875 4.01251C19.2608 4.11409 20.9649 4.73627 22.3864 5.80124C23.808 6.86621 24.8841 8.32669 25.48 10H23C22.8533 9.99995 22.7084 10.0322 22.5755 10.0944C22.4426 10.1566 22.3251 10.2473 22.2312 10.36L19.0425 14.1875C18.3774 13.9397 17.6462 13.9351 16.9781 14.1744C16.3099 14.4138 15.748 14.8817 15.3916 15.4954C15.0352 16.1092 14.9073 16.8292 15.0306 17.5281C15.1538 18.227 15.5203 18.8598 16.0652 19.3146C16.61 19.7694 17.2981 20.0168 18.0078 20.0132C18.7175 20.0095 19.4031 19.755 19.9432 19.2947C20.4834 18.8343 20.8433 18.1977 20.9594 17.4976C21.0754 16.7974 20.9402 16.0788 20.5775 15.4688L23.4687 12H25.9425C25.9725 12.26 25.9908 12.5225 25.9975 12.7875C26.0286 14.2198 25.7187 15.639 25.0931 16.9278C24.4676 18.2167 23.5445 19.3383 22.4 20.2C22.2589 20.3057 22.1484 20.4469 22.0794 20.6091C22.0105 20.7713 21.9857 20.9489 22.0075 21.1238L23.0075 29.1238C23.0379 29.3653 23.1554 29.5874 23.3379 29.7485C23.5203 29.9095 23.7553 29.9985 23.9987 29.9988C24.0405 29.9988 24.0822 29.9962 24.1237 29.9913C24.2541 29.975 24.3799 29.9333 24.4942 29.8684C24.6084 29.8035 24.7087 29.7168 24.7893 29.6131C24.87 29.5094 24.9295 29.3909 24.9643 29.2643C24.9992 29.1376 25.0087 29.0054 24.9925 28.875L24.0625 21.4338ZM16 10C15.8022 10 15.6088 9.94136 15.4444 9.83148C15.28 9.7216 15.1518 9.56542 15.0761 9.38269C15.0004 9.19997 14.9806 8.9989 15.0192 8.80492C15.0578 8.61094 15.153 8.43275 15.2929 8.2929C15.4327 8.15305 15.6109 8.05781 15.8049 8.01922C15.9989 7.98064 16.1999 8.00044 16.3827 8.07613C16.5654 8.15182 16.7216 8.27999 16.8314 8.44444C16.9413 8.60889 17 8.80223 17 9.00001C17 9.26523 16.8946 9.51958 16.7071 9.70712C16.5195 9.89465 16.2652 10 16 10ZM18 18C17.8022 18 17.6088 17.9414 17.4444 17.8315C17.28 17.7216 17.1518 17.5654 17.0761 17.3827C17.0004 17.2 16.9806 16.9989 17.0192 16.8049C17.0578 16.6109 17.153 16.4328 17.2929 16.2929C17.4327 16.153 17.6109 16.0578 17.8049 16.0192C17.9989 15.9806 18.1999 16.0004 18.3827 16.0761C18.5654 16.1518 18.7216 16.28 18.8314 16.4444C18.9413 16.6089 19 16.8022 19 17C19 17.2652 18.8946 17.5196 18.7071 17.7071C18.5195 17.8947 18.2652 18 18 18Z",
        fill: color
      }
    )
  }
);

// src/assets/icons/subjects/Microscope.tsx
var import_jsx_runtime30 = require("react/jsx-runtime");
var Microscope = ({
  size,
  color
}) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
  "svg",
  {
    width: size,
    height: size,
    viewBox: "0 0 32 32",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
      "path",
      {
        d: "M28 26H25.4925C26.7637 24.4552 27.5898 22.5932 27.882 20.6142C28.1743 18.6351 27.9216 16.6138 27.1511 14.7676C26.3806 12.9213 25.1215 11.32 23.5092 10.1358C21.8968 8.95153 19.9922 8.22913 18 8.04625V4C18 3.46957 17.7893 2.96086 17.4142 2.58579C17.0391 2.21071 16.5304 2 16 2H10C9.46957 2 8.96086 2.21071 8.58579 2.58579C8.21071 2.96086 8 3.46957 8 4V17C8 17.5304 8.21071 18.0391 8.58579 18.4142C8.96086 18.7893 9.46957 19 10 19H16C16.5304 19 17.0391 18.7893 17.4142 18.4142C17.7893 18.0391 18 17.5304 18 17V10.0575C19.7643 10.2552 21.4306 10.9703 22.7895 12.1128C24.1483 13.2553 25.1389 14.7742 25.6366 16.4783C26.1343 18.1824 26.1169 19.9957 25.5866 21.69C25.0563 23.3842 24.0368 24.8838 22.6562 26H4C3.73478 26 3.48043 26.1054 3.29289 26.2929C3.10536 26.4804 3 26.7348 3 27C3 27.2652 3.10536 27.5196 3.29289 27.7071C3.48043 27.8946 3.73478 28 4 28H28C28.2652 28 28.5196 27.8946 28.7071 27.7071C28.8946 27.5196 29 27.2652 29 27C29 26.7348 28.8946 26.4804 28.7071 26.2929C28.5196 26.1054 28.2652 26 28 26ZM16 17H10V4H16V17ZM9 23C8.73478 23 8.48043 22.8946 8.29289 22.7071C8.10536 22.5196 8 22.2652 8 22C8 21.7348 8.10536 21.4804 8.29289 21.2929C8.48043 21.1054 8.73478 21 9 21H17C17.2652 21 17.5196 21.1054 17.7071 21.2929C17.8946 21.4804 18 21.7348 18 22C18 22.2652 17.8946 22.5196 17.7071 22.7071C17.5196 22.8946 17.2652 23 17 23H9Z",
        fill: color
      }
    )
  }
);

// src/components/SubjectInfo/SubjectInfo.tsx
var import_phosphor_react14 = require("phosphor-react");
var import_jsx_runtime31 = require("react/jsx-runtime");
var SubjectInfo = {
  ["F\xEDsica" /* FISICA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.Atom, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-1",
    name: "F\xEDsica" /* FISICA */
  },
  ["Hist\xF3ria" /* HISTORIA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.Scroll, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-2",
    name: "Hist\xF3ria" /* HISTORIA */
  },
  ["Literatura" /* LITERATURA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BookOpenText, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-3",
    name: "Literatura" /* LITERATURA */
  },
  ["Geografia" /* GEOGRAFIA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.GlobeHemisphereWest, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-4",
    name: "Geografia" /* GEOGRAFIA */
  },
  ["Biologia" /* BIOLOGIA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Microscope, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-5",
    name: "Biologia" /* BIOLOGIA */
  },
  ["Portugu\xEAs" /* PORTUGUES */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChatPT, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-6",
    name: "Portugu\xEAs" /* PORTUGUES */
  },
  ["Qu\xEDmica" /* QUIMICA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.Flask, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-7",
    name: "Qu\xEDmica" /* QUIMICA */
  },
  ["Artes" /* ARTES */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.Palette, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-8",
    name: "Artes" /* ARTES */
  },
  ["Matem\xE1tica" /* MATEMATICA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.MathOperations, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-9",
    name: "Matem\xE1tica" /* MATEMATICA */
  },
  ["Filosofia" /* FILOSOFIA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(HeadCircuit, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-10",
    name: "Filosofia" /* FILOSOFIA */
  },
  ["Espanhol" /* ESPANHOL */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChatES, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-11",
    name: "Espanhol" /* ESPANHOL */
  },
  ["Reda\xE7\xE3o" /* REDACAO */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.ArticleNyTimes, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-12",
    name: "Reda\xE7\xE3o" /* REDACAO */
  },
  ["Sociologia" /* SOCIOLOGIA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.Person, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-13",
    name: "Sociologia" /* SOCIOLOGIA */
  },
  ["Ingl\xEAs" /* INGLES */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChatEN, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-14",
    name: "Ingl\xEAs" /* INGLES */
  },
  ["Ed. F\xEDsica" /* EDUCACAO_FISICA */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.DribbbleLogo, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-15",
    name: "Ed. F\xEDsica" /* EDUCACAO_FISICA */
  },
  ["Trilhas" /* TRILHAS */]: {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.BookBookmark, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-16",
    name: "Trilhas" /* TRILHAS */
  }
};
var getSubjectInfo = (subject) => {
  return SubjectInfo[subject] || {
    icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_phosphor_react14.Book, { size: 17, color: "currentColor" }),
    colorClass: "bg-subject-16",
    name: subject
  };
};

// src/components/CheckBoxGroup/CheckBoxGroup.helpers.ts
var areSelectedIdsEqual = (ids1, ids2) => {
  if (ids1 === ids2) return true;
  if (!ids1 || !ids2) return ids1 === ids2;
  if (ids1.length !== ids2.length) return false;
  for (let i = 0; i < ids1.length; i++) {
    if (ids1[i] !== ids2[i]) return false;
  }
  return true;
};
var isCategoryEnabled = (category, allCategories) => {
  if (!category.dependsOn || category.dependsOn.length === 0) {
    return true;
  }
  return category.dependsOn.every((depKey) => {
    const depCat = allCategories.find((c) => c.key === depKey);
    return depCat?.selectedIds && depCat.selectedIds.length > 0;
  });
};
var isItemMatchingFilter = (item, filter, allCategories) => {
  const parentCat = allCategories.find((c) => c.key === filter.key);
  const parentSelectedIds = parentCat?.selectedIds || [];
  const itemFieldValue = item[filter.internalField];
  return parentSelectedIds.includes(String(itemFieldValue));
};
var getBadgeText = (category, formattedItems) => {
  const visibleIds = formattedItems.flatMap((group) => group.itens || []).map((i) => i.id);
  const selectedVisibleCount = visibleIds.filter(
    (id) => category.selectedIds?.includes(id)
  ).length;
  const totalVisible = visibleIds.length;
  return `${selectedVisibleCount} de ${totalVisible} ${selectedVisibleCount === 1 ? "selecionado" : "selecionados"}`;
};
var handleAccordionValueChange = (value, categories, isCategoryEnabledFn) => {
  if (typeof value !== "string") {
    if (!value) {
      return "";
    }
    return null;
  }
  if (!value) {
    return "";
  }
  const category = categories.find((c) => c.key === value);
  if (!category) {
    return null;
  }
  const isEnabled = isCategoryEnabledFn(category);
  if (!isEnabled) {
    return null;
  }
  return value;
};
var calculateFormattedItemsForAutoSelection = (category, allCategories) => {
  if (!category?.dependsOn || category.dependsOn.length === 0) {
    return category?.itens || [];
  }
  const isEnabled = isCategoryEnabled(category, allCategories);
  if (!isEnabled) {
    return [];
  }
  const filters = category.filteredBy || [];
  if (filters.length === 0) {
    return category?.itens || [];
  }
  const selectedIdsArr = filters.map((f) => {
    const parentCat = allCategories.find((c) => c.key === f.key);
    if (!parentCat?.selectedIds?.length) {
      return [];
    }
    return parentCat.selectedIds;
  });
  if (selectedIdsArr.some((arr) => arr.length === 0)) {
    return [];
  }
  const filteredItems = (category.itens || []).filter(
    (item) => filters.every((filter) => isItemMatchingFilter(item, filter, allCategories))
  );
  return filteredItems;
};

// src/components/CheckBoxGroup/CheckBoxGroup.tsx
var import_jsx_runtime32 = require("react/jsx-runtime");
var CheckboxGroup = ({
  categories,
  onCategoriesChange,
  compactSingleItem = true,
  showDivider = true,
  showSingleItem = false
}) => {
  const [openAccordion, setOpenAccordion] = (0, import_react20.useState)("");
  const autoSelectionAppliedRef = (0, import_react20.useRef)(false);
  const onCategoriesChangeRef = (0, import_react20.useRef)(onCategoriesChange);
  const previousCategoriesRef = (0, import_react20.useRef)(categories);
  (0, import_react20.useEffect)(() => {
    onCategoriesChangeRef.current = onCategoriesChange;
  }, [onCategoriesChange]);
  const categoriesWithAutoSelection = (0, import_react20.useMemo)(() => {
    return categories.map((category) => {
      const filteredItems = calculateFormattedItemsForAutoSelection(
        category,
        categories
      );
      if (filteredItems.length === 1 && (!category.selectedIds || category.selectedIds.length === 0)) {
        return {
          ...category,
          selectedIds: [filteredItems[0].id]
        };
      }
      return category;
    });
  }, [categories]);
  (0, import_react20.useEffect)(() => {
    const categoriesChanged = categories !== previousCategoriesRef.current;
    if (!categoriesChanged && autoSelectionAppliedRef.current) {
      return;
    }
    previousCategoriesRef.current = categories;
    const hasAutoSelectionChanges = categoriesWithAutoSelection.some(
      (cat, index) => {
        const originalCat = categories[index];
        return !areSelectedIdsEqual(cat.selectedIds, originalCat.selectedIds);
      }
    );
    if (hasAutoSelectionChanges) {
      autoSelectionAppliedRef.current = true;
      onCategoriesChangeRef.current(categoriesWithAutoSelection);
    } else if (categoriesChanged) {
      autoSelectionAppliedRef.current = false;
    }
  }, [categoriesWithAutoSelection, categories]);
  const isCheckBoxIsSelected = (categoryKey, itemId) => {
    const category = categories.find((c) => c.key === categoryKey);
    if (!category) return false;
    return category.selectedIds?.includes(itemId) || false;
  };
  const isMinimalOneCheckBoxIsSelected = (categoryKey) => {
    const category = categories.find((c) => c.key === categoryKey);
    if (!category) return false;
    const formattedItems = getFormattedItems(categoryKey);
    const filteredItems = formattedItems.flatMap((group) => group.itens || []);
    const filteredItemIds = filteredItems.map((item) => item.id);
    return filteredItemIds.some(
      (itemId) => category.selectedIds?.includes(itemId)
    );
  };
  const createCombinations = (acc, currentArray) => {
    const combinations = [];
    for (const existingCombo of acc) {
      for (const item of currentArray) {
        combinations.push([...existingCombo, item]);
      }
    }
    return combinations;
  };
  const cartesian = (arr) => {
    return arr.reduce(createCombinations, [[]]);
  };
  const getSelectedIdsForFilters = (filters) => {
    return filters.map((f) => {
      const parentCat = categories.find((c) => c.key === f.key);
      if (!parentCat?.selectedIds?.length) {
        return [];
      }
      return parentCat.selectedIds;
    });
  };
  const generateSingleFilterLabel = (filter, comboId) => {
    const cat = categories.find((c) => c.key === filter.key);
    return cat?.itens?.find((i) => i.id === comboId)?.name || comboId;
  };
  const generateMultipleFiltersLabel = (filters, comboIds) => {
    const firstCat = categories.find((c) => c.key === filters[0].key);
    const firstVal = firstCat?.itens?.find((i) => i.id === comboIds[0])?.name || comboIds[0];
    const labelParts = [firstVal];
    for (let idx = 1; idx < filters.length; idx++) {
      const f = filters[idx];
      const cat = categories.find((c) => c.key === f.key);
      const val = cat?.itens?.find((i) => i.id === comboIds[idx])?.name || comboIds[idx];
      labelParts.push(`(${val})`);
    }
    return labelParts.join(" ");
  };
  const processCombination = (comboIds, filters, category, groupedMap) => {
    const filteredItems = (category?.itens || []).filter(
      (item) => filters.every((f, idx) => item[f.internalField] === comboIds[idx])
    );
    if (filteredItems.length === 0) return;
    let groupLabel = void 0;
    if (filters.length === 1) {
      groupLabel = generateSingleFilterLabel(filters[0], comboIds[0]);
    } else if (filters.length > 1) {
      groupLabel = generateMultipleFiltersLabel(filters, comboIds);
    }
    const key = groupLabel || "";
    if (!groupedMap[key]) {
      groupedMap[key] = groupLabel ? { groupLabel, itens: [] } : { itens: [] };
    }
    groupedMap[key].itens.push(...filteredItems);
  };
  const calculateFormattedItems = (categoryKey) => {
    const category = categories.find((c) => c.key === categoryKey);
    if (!category?.dependsOn || category.dependsOn.length === 0) {
      return [{ itens: category?.itens || [] }];
    }
    const isEnabled = category.dependsOn.every((depKey) => {
      const depCat = categories.find((c) => c.key === depKey);
      return depCat?.selectedIds && depCat.selectedIds.length > 0;
    });
    if (!isEnabled) {
      return [{ itens: [] }];
    }
    const filters = category.filteredBy || [];
    if (filters.length === 0) {
      return [{ itens: category?.itens || [] }];
    }
    const selectedIdsArr = getSelectedIdsForFilters(filters);
    if (selectedIdsArr.some((arr) => arr.length === 0)) {
      return [{ itens: [] }];
    }
    const combinations = cartesian(selectedIdsArr);
    const groupedMap = {};
    for (const comboIds of combinations) {
      processCombination(comboIds, filters, category, groupedMap);
    }
    const groupedItems = Object.values(groupedMap).filter(
      (g) => g.itens.length
    );
    return groupedItems.length ? groupedItems : [{ itens: [] }];
  };
  const formattedItemsMap = (0, import_react20.useMemo)(() => {
    const formattedItemsMap2 = {};
    for (const category of categories) {
      const formattedItems = calculateFormattedItems(category.key);
      formattedItemsMap2[category.key] = formattedItems;
    }
    return formattedItemsMap2;
  }, [categories]);
  const getFormattedItems = (categoryKey) => {
    return formattedItemsMap[categoryKey] || [{ itens: [] }];
  };
  const getBadgeText2 = (category) => {
    const formattedItems = getFormattedItems(category.key);
    return getBadgeText(category, formattedItems);
  };
  const isCategoryEnabled2 = (category) => {
    return isCategoryEnabled(category, categories);
  };
  const handleAccordionValueChange2 = (value) => {
    const newValue = handleAccordionValueChange(
      value,
      categories,
      isCategoryEnabled2
    );
    if (newValue !== null) {
      setOpenAccordion(newValue);
    }
  };
  const getDependentCategories = (categoryKey) => {
    return categories.filter((cat) => cat.dependsOn?.includes(categoryKey)).map((cat) => cat.key);
  };
  const findItemsToRemove = (depCategory, relevantFilter, deselectedItemId) => {
    return depCategory.itens?.filter(
      (item) => item[relevantFilter.internalField] === deselectedItemId
    ).map((item) => item.id) || [];
  };
  const processDependentCategory = (depCategoryKey, categoryKey, deselectedItemId, itemsToDeselect) => {
    const depCategory = categories.find((c) => c.key === depCategoryKey);
    if (!depCategory?.filteredBy) return;
    const relevantFilter = depCategory.filteredBy.find(
      (f) => f.key === categoryKey
    );
    if (!relevantFilter) return;
    const itemsToRemove = findItemsToRemove(
      depCategory,
      relevantFilter,
      deselectedItemId
    );
    if (itemsToRemove.length > 0) {
      itemsToDeselect[depCategoryKey] = itemsToRemove;
    }
  };
  const getItemsToDeselect = (categoryKey, deselectedItemId) => {
    const deselectedItem = categories.find((c) => c.key === categoryKey)?.itens?.find((item) => item.id === deselectedItemId);
    if (!deselectedItem) return {};
    const itemsToDeselect = {};
    const dependentCategories = getDependentCategories(categoryKey);
    for (const depCategoryKey of dependentCategories) {
      processDependentCategory(
        depCategoryKey,
        categoryKey,
        deselectedItemId,
        itemsToDeselect
      );
    }
    return itemsToDeselect;
  };
  const updateCategorySelectedIds = (updatedCategories, depCategoryIndex, depCategory, itemIds) => {
    const newSelectedIds = depCategory.selectedIds?.filter((id) => !itemIds.includes(id)) || [];
    updatedCategories[depCategoryIndex] = {
      ...depCategory,
      selectedIds: newSelectedIds
    };
    return updatedCategories;
  };
  const applyRecursiveCascade = (depCategoryKey, itemIds, updatedCategories) => {
    let result = updatedCategories;
    for (const itemId of itemIds) {
      result = applyCascadeDeselection(depCategoryKey, itemId, result);
    }
    return result;
  };
  const applyCascadeDeselection = (categoryKey, deselectedItemId, currentCategories) => {
    const itemsToDeselect = getItemsToDeselect(categoryKey, deselectedItemId);
    let updatedCategories = [...currentCategories];
    for (const [depCategoryKey, itemIds] of Object.entries(itemsToDeselect)) {
      const depCategoryIndex = updatedCategories.findIndex(
        (c) => c.key === depCategoryKey
      );
      if (depCategoryIndex !== -1) {
        const depCategory = updatedCategories[depCategoryIndex];
        updatedCategories = updateCategorySelectedIds(
          updatedCategories,
          depCategoryIndex,
          depCategory,
          itemIds
        );
        updatedCategories = applyRecursiveCascade(
          depCategoryKey,
          itemIds,
          updatedCategories
        );
      }
    }
    return updatedCategories;
  };
  const toggleAllInCategory = (categoryKey) => {
    const category = categories.find((c) => c.key === categoryKey);
    if (!category) return;
    const formattedItems = getFormattedItems(categoryKey);
    const filteredItems = formattedItems.flatMap((group) => group.itens || []);
    const filteredItemIds = filteredItems.map((item) => item.id);
    const selectedFilteredCount = filteredItemIds.filter(
      (itemId) => category.selectedIds?.includes(itemId)
    ).length;
    const allFilteredSelected = selectedFilteredCount === filteredItemIds.length;
    const newSelection = allFilteredSelected ? category.selectedIds?.filter((id) => !filteredItemIds.includes(id)) || [] : [
      ...category.selectedIds || [],
      ...filteredItemIds.filter(
        (id) => !category.selectedIds?.includes(id)
      )
    ];
    let updatedCategories = categories.map(
      (c) => c.key === categoryKey ? { ...c, selectedIds: newSelection } : c
    );
    if (allFilteredSelected) {
      for (const itemId of filteredItemIds) {
        updatedCategories = applyCascadeDeselection(
          categoryKey,
          itemId,
          updatedCategories
        );
      }
    }
    onCategoriesChange(updatedCategories);
  };
  const toggleItem = (categoryKey, itemId) => {
    const category = categories.find((c) => c.key === categoryKey);
    if (!category) return;
    const isCurrentlySelected = category.selectedIds?.includes(itemId);
    const newSelection = isCurrentlySelected ? category.selectedIds?.filter((id) => id !== itemId) : [...category.selectedIds || [], itemId];
    let updatedCategories = categories.map(
      (c) => c.key === categoryKey ? { ...c, selectedIds: newSelection } : c
    );
    if (isCurrentlySelected) {
      updatedCategories = applyCascadeDeselection(
        categoryKey,
        itemId,
        updatedCategories
      );
    }
    onCategoriesChange(updatedCategories);
  };
  const renderCheckboxItem = (item, categoryKey) => {
    const uniqueId = `${categoryKey}-${item.id}`;
    return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
      "div",
      {
        className: "flex items-center gap-3 px-2",
        role: "presentation",
        onClick: (e) => e.stopPropagation(),
        onMouseDown: (e) => e.stopPropagation(),
        onMouseUp: (e) => e.stopPropagation(),
        onKeyDown: (e) => e.stopPropagation(),
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
            CheckBox_default,
            {
              id: uniqueId,
              checked: isCheckBoxIsSelected(categoryKey, item.id),
              onChange: () => toggleItem(categoryKey, item.id)
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
            "label",
            {
              htmlFor: uniqueId,
              className: "text-sm text-text-950 cursor-pointer select-none",
              children: item.name
            }
          )
        ]
      },
      item.id
    );
  };
  const renderFormattedGroup = (formattedGroup, idx, categoryKey) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
    "div",
    {
      className: "flex flex-col gap-3",
      children: [
        "groupLabel" in formattedGroup && formattedGroup.groupLabel && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text_default, { size: "sm", className: "mt-2", weight: "semibold", children: formattedGroup.groupLabel }),
        formattedGroup.itens?.map(
          (item) => renderCheckboxItem(item, categoryKey)
        )
      ]
    },
    formattedGroup.groupLabel || `group-${idx}`
  );
  const renderAccordionTrigger = (category, isEnabled) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between w-full p-2", children: [
    /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-3", children: [
      /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
        CheckBox_default,
        {
          checked: isMinimalOneCheckBoxIsSelected(category.key),
          disabled: !isEnabled,
          indeterminate: isMinimalOneCheckBoxIsSelected(category.key),
          onChange: () => toggleAllInCategory(category.key)
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
        Text_default,
        {
          size: "sm",
          weight: "medium",
          className: cn("text-text-800", !isEnabled && "opacity-40"),
          children: category.label
        }
      )
    ] }),
    (openAccordion === category.key || isEnabled) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Badge_default, { variant: "solid", action: "info", children: getBadgeText2(category) })
  ] });
  const renderCompactSingleItem = (category) => {
    const formattedItems = getFormattedItems(category.key);
    const allItems = formattedItems.flatMap((group) => group.itens || []);
    if (allItems.length !== 1) {
      return null;
    }
    const singleItem = allItems[0];
    return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
      "div",
      {
        className: "flex items-center justify-between w-full px-3 py-2",
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-800", children: category.label }),
          /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text_default, { size: "sm", className: "text-text-950", children: singleItem.name })
        ]
      },
      category.key
    );
  };
  const renderCategoryAccordion = (category) => {
    const isEnabled = isCategoryEnabled2(category);
    const hasOnlyOneItem = category.itens?.length === 1;
    if (hasOnlyOneItem && !compactSingleItem && !showSingleItem) {
      return null;
    }
    const formattedItems = getFormattedItems(category.key);
    const allItems = formattedItems.flatMap((group) => group.itens || []);
    const hasOnlyOneAvailableItem = allItems.length === 1;
    if (compactSingleItem && hasOnlyOneAvailableItem && isEnabled) {
      return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
        renderCompactSingleItem(category),
        showDivider && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider_default, {})
      ] }, category.key);
    }
    const hasNoItems = formattedItems.every(
      (group) => !group.itens || group.itens.length === 0
    );
    return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
      /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
        CardAccordation,
        {
          value: category.key,
          disabled: !isEnabled,
          className: cn(
            "bg-transparent border-0",
            openAccordion === category.key && "bg-background-50 border-none"
          ),
          trigger: renderAccordionTrigger(category, isEnabled),
          children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex flex-col gap-3 pt-2", children: hasNoItems && isEnabled ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "px-2 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text_default, { size: "sm", className: "text-text-500 text-center", children: "Sem dados" }) }) : formattedItems.map(
            (formattedGroup, idx) => renderFormattedGroup(formattedGroup, idx, category.key)
          ) })
        }
      ),
      openAccordion !== category.key && showDivider && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider_default, {})
    ] }, category.key);
  };
  (0, import_react20.useEffect)(() => {
    if (!openAccordion) return;
    const category = categories.find((c) => c.key === openAccordion);
    if (!category) return;
    const isEnabled = isCategoryEnabled2(category);
    if (!isEnabled) {
      setTimeout(() => {
        setOpenAccordion("");
      }, 0);
    }
  }, [categories, openAccordion]);
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
    AccordionGroup,
    {
      type: "single",
      collapsible: true,
      value: openAccordion,
      onValueChange: handleAccordionValueChange2,
      children: categories.map(renderCategoryAccordion)
    }
  );
};

// src/components/Filter/FilterModal.tsx
var import_jsx_runtime33 = require("react/jsx-runtime");
var FilterModal = ({
  isOpen,
  onClose,
  filterConfigs,
  onFiltersChange,
  onApply,
  onClear,
  title = "Filtros",
  size = "md",
  applyLabel = "Aplicar",
  clearLabel = "Limpar filtros"
}) => {
  const handleCategoryChange = (configIndex, updatedCategories) => {
    const newConfigs = [...filterConfigs];
    newConfigs[configIndex] = {
      ...newConfigs[configIndex],
      categories: updatedCategories
    };
    onFiltersChange(newConfigs);
  };
  const handleApply = () => {
    onApply();
    onClose();
  };
  const handleClear = () => {
    onClear();
  };
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
    Modal_default,
    {
      isOpen,
      onClose,
      title,
      size,
      footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-3 justify-end w-full", children: [
        /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button_default, { variant: "outline", onClick: handleClear, children: clearLabel }),
        /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button_default, { onClick: handleApply, children: applyLabel })
      ] }),
      children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-col gap-6", children: filterConfigs.map((config, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-2 text-text-400 text-sm font-medium uppercase", children: [
          config.key === "academic" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
            "svg",
            {
              width: "16",
              height: "16",
              viewBox: "0 0 16 16",
              fill: "none",
              xmlns: "http://www.w3.org/2000/svg",
              className: "text-text-400",
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
                  "path",
                  {
                    d: "M8 2L2 5.33333L8 8.66667L14 5.33333L8 2Z",
                    stroke: "currentColor",
                    strokeWidth: "1.5",
                    strokeLinecap: "round",
                    strokeLinejoin: "round"
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
                  "path",
                  {
                    d: "M2 10.6667L8 14L14 10.6667",
                    stroke: "currentColor",
                    strokeWidth: "1.5",
                    strokeLinecap: "round",
                    strokeLinejoin: "round"
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
                  "path",
                  {
                    d: "M2 8L8 11.3333L14 8",
                    stroke: "currentColor",
                    strokeWidth: "1.5",
                    strokeLinecap: "round",
                    strokeLinejoin: "round"
                  }
                )
              ]
            }
          ),
          config.key === "content" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
            "svg",
            {
              width: "16",
              height: "16",
              viewBox: "0 0 16 16",
              fill: "none",
              xmlns: "http://www.w3.org/2000/svg",
              className: "text-text-400",
              children: [
                /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
                  "path",
                  {
                    d: "M3.33333 2H12.6667C13.403 2 14 2.59695 14 3.33333V12.6667C14 13.403 13.403 14 12.6667 14H3.33333C2.59695 14 2 13.403 2 12.6667V3.33333C2 2.59695 2.59695 2 3.33333 2Z",
                    stroke: "currentColor",
                    strokeWidth: "1.5",
                    strokeLinecap: "round",
                    strokeLinejoin: "round"
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
                  "path",
                  {
                    d: "M2 6H14",
                    stroke: "currentColor",
                    strokeWidth: "1.5",
                    strokeLinecap: "round",
                    strokeLinejoin: "round"
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
                  "path",
                  {
                    d: "M6 2V14",
                    stroke: "currentColor",
                    strokeWidth: "1.5",
                    strokeLinecap: "round",
                    strokeLinejoin: "round"
                  }
                )
              ]
            }
          ),
          /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children: config.label })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
          CheckboxGroup,
          {
            categories: config.categories,
            onCategoriesChange: (updatedCategories) => handleCategoryChange(index, updatedCategories)
          }
        )
      ] }, config.key)) })
    }
  );
};

// src/components/TableProvider/TableProvider.tsx
var import_phosphor_react15 = require("phosphor-react");
var import_jsx_runtime34 = require("react/jsx-runtime");
function TableProvider({
  data,
  headers,
  loading = false,
  variant = "default",
  enableSearch = false,
  enableFilters = false,
  enableTableSort = false,
  enablePagination = false,
  enableRowClick = false,
  initialFilters = [],
  paginationConfig = {},
  searchPlaceholder = "Buscar...",
  emptyState,
  loadingState,
  noSearchResultState,
  rowKey,
  onParamsChange,
  onRowClick,
  children
}) {
  const [searchQuery, setSearchQuery] = (0, import_react21.useState)("");
  const sortResultRaw = useTableSort(data, { syncWithUrl: true });
  const sortResult = enableTableSort ? sortResultRaw : {
    sortedData: data,
    sortColumn: null,
    sortDirection: null,
    handleSort: () => {
    }
  };
  const { sortedData, sortColumn, sortDirection, handleSort } = sortResult;
  const filterResultRaw = useTableFilter(initialFilters, { syncWithUrl: true });
  const disabledFilterResult = (0, import_react21.useMemo)(
    () => ({
      filterConfigs: [],
      activeFilters: {},
      hasActiveFilters: false,
      updateFilters: () => {
      },
      applyFilters: () => {
      },
      clearFilters: () => {
      }
    }),
    []
  );
  const filterResult = enableFilters ? filterResultRaw : disabledFilterResult;
  const {
    filterConfigs,
    activeFilters,
    hasActiveFilters,
    updateFilters,
    applyFilters,
    clearFilters
  } = filterResult;
  const {
    defaultItemsPerPage = 10,
    itemsPerPageOptions = [10, 20, 50, 100],
    itemLabel = "itens",
    totalItems,
    totalPages
  } = paginationConfig;
  const [currentPage, setCurrentPage] = (0, import_react21.useState)(1);
  const [itemsPerPage, setItemsPerPage] = (0, import_react21.useState)(defaultItemsPerPage);
  const [isFilterModalOpen, setIsFilterModalOpen] = (0, import_react21.useState)(false);
  const combinedParams = (0, import_react21.useMemo)(() => {
    const params = {
      page: currentPage,
      limit: itemsPerPage
    };
    if (enableSearch && searchQuery) {
      params.search = searchQuery;
    }
    if (enableFilters) {
      Object.assign(params, activeFilters);
    }
    if (enableTableSort && sortColumn && sortDirection) {
      params.sortBy = sortColumn;
      params.sortOrder = sortDirection;
    }
    return params;
  }, [
    currentPage,
    itemsPerPage,
    searchQuery,
    activeFilters,
    sortColumn,
    sortDirection,
    enableSearch,
    enableFilters,
    enableTableSort
  ]);
  (0, import_react21.useEffect)(() => {
    onParamsChange?.(combinedParams);
  }, [combinedParams]);
  const handleSearchChange = (0, import_react21.useCallback)((value) => {
    setSearchQuery(value);
    setCurrentPage(1);
  }, []);
  const handleFilterApply = (0, import_react21.useCallback)(() => {
    applyFilters();
    setIsFilterModalOpen(false);
    setCurrentPage(1);
  }, [applyFilters]);
  const handlePageChange = (0, import_react21.useCallback)((page) => {
    setCurrentPage(page);
  }, []);
  const handleItemsPerPageChange = (0, import_react21.useCallback)((items) => {
    setItemsPerPage(items);
    setCurrentPage(1);
  }, []);
  const handleRowClickInternal = (0, import_react21.useCallback)(
    (row, index) => {
      if (enableRowClick && onRowClick) {
        onRowClick(row, index);
      }
    },
    [enableRowClick, onRowClick]
  );
  const useInternalPagination = (0, import_react21.useMemo)(
    () => enablePagination && !onParamsChange && totalItems === void 0 && totalPages === void 0,
    [enablePagination, onParamsChange, totalItems, totalPages]
  );
  const calculatedTotalPages = totalPages ?? Math.ceil(
    (totalItems ?? (useInternalPagination ? sortedData.length : data.length)) / itemsPerPage
  );
  const calculatedTotalItems = totalItems ?? (useInternalPagination ? sortedData.length : data.length);
  const displayData = (0, import_react21.useMemo)(() => {
    if (!useInternalPagination) {
      return sortedData;
    }
    const start = (currentPage - 1) * itemsPerPage;
    return sortedData.slice(start, start + itemsPerPage);
  }, [useInternalPagination, sortedData, currentPage, itemsPerPage]);
  const isEmpty = data.length === 0;
  const showLoading = loading;
  const showNoSearchResult = !loading && data.length === 0 && searchQuery.trim() !== "";
  const showEmpty = !loading && data.length === 0 && searchQuery.trim() === "";
  const controls = (enableSearch || enableFilters) && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-4", children: [
    enableFilters && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
      Button_default,
      {
        variant: "outline",
        size: "medium",
        onClick: () => setIsFilterModalOpen(true),
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_phosphor_react15.Funnel, { size: 20 }),
          "Filtros",
          hasActiveFilters && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "ml-2 rounded-full bg-primary-500 px-2 py-0.5 text-xs text-white", children: Object.keys(activeFilters).length })
        ]
      }
    ),
    enableSearch && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
      Search_default,
      {
        value: searchQuery,
        onSearch: handleSearchChange,
        onClear: () => handleSearchChange(""),
        options: [],
        placeholder: searchPlaceholder
      }
    ) })
  ] });
  const table = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-full overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
    Table_default,
    {
      variant,
      showLoading,
      loadingState,
      showNoSearchResult,
      noSearchResultState,
      showEmpty,
      emptyState,
      children: [
        /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
          TableRow,
          {
            variant: variant === "borderless" ? "defaultBorderless" : "default",
            children: headers.map((header, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
              TableHead,
              {
                sortable: enableTableSort && header.sortable,
                sortDirection: enableTableSort && sortColumn === header.key ? sortDirection : null,
                onSort: () => enableTableSort && header.sortable && handleSort(header.key),
                className: header.className,
                style: header.width ? { width: header.width } : void 0,
                children: header.label
              },
              `header-${header.key}-${index}`
            ))
          }
        ) }),
        /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TableCell, { colSpan: headers.length, className: "text-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-text-400 text-sm", children: "Carregando..." }) }) }) : displayData.map((row, rowIndex) => {
          const effectiveIndex = useInternalPagination ? (currentPage - 1) * itemsPerPage + rowIndex : rowIndex;
          const rowKeyValue = rowKey ? (() => {
            const keyValue = row[rowKey];
            if (keyValue === null || keyValue === void 0) {
              return `row-${effectiveIndex}`;
            }
            if (typeof keyValue === "object") {
              return JSON.stringify(keyValue);
            }
            return String(keyValue);
          })() : `row-${effectiveIndex}`;
          return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
            TableRow,
            {
              variant: variant === "borderless" ? "defaultBorderless" : "default",
              clickable: enableRowClick,
              onClick: () => handleRowClickInternal(row, effectiveIndex),
              children: headers.map((header, cellIndex) => {
                const value = row[header.key];
                let defaultContent = "";
                if (value !== null && value !== void 0) {
                  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
                    defaultContent = String(value);
                  } else if (typeof value === "object") {
                    defaultContent = JSON.stringify(value);
                  } else if (typeof value === "function") {
                    defaultContent = "[Function]";
                  } else if (typeof value === "symbol") {
                    defaultContent = String(value);
                  }
                }
                const content = header.render ? header.render(value, row, effectiveIndex) : defaultContent;
                return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
                  TableCell,
                  {
                    className: header.className,
                    style: {
                      textAlign: header.align
                    },
                    children: content
                  },
                  `cell-${effectiveIndex}-${cellIndex}`
                );
              })
            },
            rowKeyValue
          );
        }) })
      ]
    }
  ) });
  const pagination = enablePagination && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
    TablePagination_default,
    {
      currentPage,
      totalPages: calculatedTotalPages,
      totalItems: calculatedTotalItems,
      itemsPerPage,
      itemsPerPageOptions,
      onPageChange: handlePageChange,
      onItemsPerPageChange: handleItemsPerPageChange,
      itemLabel
    }
  ) });
  if (children) {
    return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
      children({ controls, table, pagination }),
      enableFilters && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
        FilterModal,
        {
          isOpen: isFilterModalOpen,
          onClose: () => setIsFilterModalOpen(false),
          filterConfigs,
          onFiltersChange: updateFilters,
          onApply: handleFilterApply,
          onClear: clearFilters
        }
      )
    ] });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "w-full space-y-4", children: [
    controls,
    table,
    pagination,
    enableFilters && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
      FilterModal,
      {
        isOpen: isFilterModalOpen,
        onClose: () => setIsFilterModalOpen(false),
        filterConfigs,
        onFiltersChange: updateFilters,
        onApply: handleFilterApply,
        onClear: clearFilters
      }
    )
  ] });
}

// src/components/ActivityDetails/ActivityDetails.tsx
var import_jsx_runtime35 = require("react/jsx-runtime");
var createTableColumns = (onCorrectActivity) => [
  {
    key: "studentName",
    label: "Aluno",
    sortable: true,
    render: (value) => {
      const name = typeof value === "string" ? value : "";
      return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-6 h-6 bg-blue-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-xs font-semibold text-primary-700", children: name.charAt(0).toUpperCase() }) }),
        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm font-normal text-text-950", children: name })
      ] });
    }
  },
  {
    key: "status",
    label: "Status",
    sortable: false,
    render: (value) => {
      const config = getStatusBadgeConfig(value);
      return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
        Badge_default,
        {
          className: `${config.bgColor} ${config.textColor} text-xs px-2 py-1`,
          children: config.label
        }
      );
    }
  },
  {
    key: "answeredAt",
    label: "Respondido em",
    sortable: true,
    render: (value) => {
      if (!value || typeof value !== "string") {
        return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-400", children: "-" });
      }
      return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-700", children: formatDateToBrazilian(value) });
    }
  },
  {
    key: "timeSpent",
    label: "Dura\xE7\xE3o",
    sortable: false,
    render: (value) => Number(value) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-700", children: formatTimeSpent(Number(value)) }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-400", children: "-" })
  },
  {
    key: "score",
    label: "Nota",
    sortable: true,
    render: (value) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-400", children: "-" }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm font-semibold text-text-950", children: Number(value).toFixed(1) })
  },
  {
    key: "actions",
    label: "Resultado",
    sortable: false,
    render: (_value, row) => {
      if (row.status === STUDENT_ACTIVITY_STATUS.AGUARDANDO_CORRECAO) {
        return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
          Button_default,
          {
            variant: "outline",
            size: "small",
            onClick: () => onCorrectActivity(row.studentId),
            className: "text-xs",
            children: "Corrigir atividade"
          }
        );
      }
      if (row.status === STUDENT_ACTIVITY_STATUS.CONCLUIDO || row.status === STUDENT_ACTIVITY_STATUS.NAO_ENTREGUE) {
        return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
          Button_default,
          {
            variant: "link",
            size: "small",
            onClick: () => onCorrectActivity(row.studentId),
            className: "text-xs",
            children: "Ver detalhes"
          }
        );
      }
      return null;
    }
  }
];
var ActivityDetails = ({
  activityId,
  fetchActivityDetails,
  fetchStudentCorrection,
  submitObservation,
  onBack,
  onViewActivity,
  emptyStateImage,
  mapSubjectNameToEnum
}) => {
  const { isMobile } = useMobile();
  const [page, setPage] = (0, import_react22.useState)(1);
  const [limit, setLimit] = (0, import_react22.useState)(10);
  const [sortBy, setSortBy] = (0, import_react22.useState)(void 0);
  const [sortOrder, setSortOrder] = (0, import_react22.useState)(
    void 0
  );
  const [data, setData] = (0, import_react22.useState)(null);
  const [correctionData, setCorrectionData] = (0, import_react22.useState)(null);
  const [loading, setLoading] = (0, import_react22.useState)(true);
  const [error, setError] = (0, import_react22.useState)(null);
  const [isModalOpen, setIsModalOpen] = (0, import_react22.useState)(false);
  const [isViewOnlyModal, setIsViewOnlyModal] = (0, import_react22.useState)(false);
  const [correctionError, setCorrectionError] = (0, import_react22.useState)(null);
  (0, import_react22.useEffect)(() => {
    const loadData = async () => {
      if (!activityId) return;
      setLoading(true);
      setError(null);
      try {
        const result = await fetchActivityDetails(activityId, {
          page,
          limit,
          sortBy,
          sortOrder
        });
        setData(result);
      } catch (err) {
        setError(
          err instanceof Error ? err.message : "Erro ao carregar detalhes"
        );
      } finally {
        setLoading(false);
      }
    };
    loadData();
  }, [activityId, page, limit, sortBy, sortOrder, fetchActivityDetails]);
  const handleCorrectActivity = (0, import_react22.useCallback)(
    async (studentId) => {
      const student = data?.students.find((s) => s.studentId === studentId);
      if (!student || !activityId) return;
      const isViewOnly = student.status !== STUDENT_ACTIVITY_STATUS.AGUARDANDO_CORRECAO;
      setIsViewOnlyModal(isViewOnly);
      setCorrectionError(null);
      try {
        const correction = await fetchStudentCorrection(activityId, studentId);
        setCorrectionData(correction);
        setIsModalOpen(true);
      } catch (err) {
        console.error("Failed to fetch student correction:", err);
        setCorrectionError(
          err instanceof Error ? err.message : "Erro ao carregar dados de corre\xE7\xE3o"
        );
      }
    },
    [data?.students, activityId, fetchStudentCorrection]
  );
  const handleCloseModal = (0, import_react22.useCallback)(() => {
    setIsModalOpen(false);
  }, []);
  const handleObservationSubmit = (0, import_react22.useCallback)(
    async (observation, files) => {
      if (!activityId || !correctionData?.studentId) return;
      try {
        await submitObservation(
          activityId,
          correctionData.studentId,
          observation,
          files
        );
        setIsModalOpen(false);
      } catch (err) {
        console.error("Failed to submit observation:", err);
      }
    },
    [activityId, correctionData?.studentId, submitObservation]
  );
  const tableData = (0, import_react22.useMemo)(() => {
    if (!data?.students) return [];
    return data.students.map((student) => ({
      id: student.studentId,
      studentId: student.studentId,
      studentName: student.studentName,
      status: student.status,
      answeredAt: student.answeredAt,
      timeSpent: student.timeSpent,
      score: student.score
    }));
  }, [data?.students]);
  const columns = (0, import_react22.useMemo)(
    () => createTableColumns(handleCorrectActivity),
    [handleCorrectActivity]
  );
  const handleTableParamsChange = (params) => {
    if (params.page) setPage(params.page);
    if (params.limit) setLimit(params.limit);
    if (params.sortBy !== void 0) {
      const sortByMap = {
        studentName: "name",
        answeredAt: "answeredAt",
        score: "score"
      };
      setSortBy(params.sortBy ? sortByMap[params.sortBy] : void 0);
    }
    if (params.sortOrder !== void 0) {
      setSortOrder(params.sortOrder);
    }
  };
  const handleViewActivity = () => {
    if (onViewActivity) {
      onViewActivity();
    }
  };
  const handleBack = () => {
    if (onBack) {
      onBack();
    }
  };
  const subjectEnum = data?.activity?.subjectName && mapSubjectNameToEnum ? mapSubjectNameToEnum(data.activity.subjectName) : null;
  const subjectInfo = subjectEnum ? getSubjectInfo(subjectEnum) : null;
  if (loading && !data) {
    return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col w-full h-full max-w-[1150px] mx-auto z-10 lg:px-0 px-4 pt-4 gap-4", children: [
      /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex items-center gap-2 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SkeletonText, { width: 100, height: 14 }) }),
      /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SkeletonRounded, { className: "w-full h-[120px]" }),
      /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
        "div",
        {
          className: cn(
            "grid gap-5",
            isMobile ? "grid-cols-2" : "grid-cols-5"
          ),
          children: [
            "total-students",
            "completed",
            "pending",
            "avg-score",
            "avg-time"
          ].map((id) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SkeletonRounded, { className: "w-full h-[150px]" }, id))
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-full bg-background rounded-xl p-6", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SkeletonTable, { rows: 5, columns: 6, showHeader: true }) })
    ] }) });
  }
  if (error || !data) {
    return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-col w-full h-auto relative justify-center items-center mb-5", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-col w-full h-full max-w-[1150px] mx-auto z-10 lg:px-0 px-4 pt-4", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
      EmptyState_default,
      {
        image: emptyStateImage,
        title: "Erro ao carregar detalhes",
        description: error || "N\xE3o foi poss\xEDvel carregar os detalhes da atividade"
      }
    ) }) });
  }
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden", children: [
    /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col w-full h-full max-w-[1150px] mx-auto z-10 lg:px-0 px-4 pt-4 gap-4", children: [
      /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2 py-4", children: [
        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
          "button",
          {
            onClick: handleBack,
            className: "text-text-500 hover:text-text-700 text-sm font-bold underline",
            children: "Atividades"
          }
        ),
        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_phosphor_react16.CaretRight, { size: 16, className: "text-text-500" }),
        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-text-950 text-sm font-bold", children: data.activity?.title || "Atividade" })
      ] }),
      data.activity && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "bg-background rounded-xl p-4 flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex justify-between items-start", children: [
        /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-2", children: [
          /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-2xl font-bold text-text-950", children: data.activity.title }),
          /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2 flex-wrap", children: [
            /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text_default, { className: "text-sm text-text-500", children: [
              "In\xEDcio",
              " ",
              data.activity.startDate ? formatDateToBrazilian(data.activity.startDate) : "00/00/0000"
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-1 h-1 rounded-full bg-text-500" }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text_default, { className: "text-sm text-text-500", children: [
              "Prazo final",
              " ",
              data.activity.finalDate ? formatDateToBrazilian(data.activity.finalDate) : "00/00/0000"
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-1 h-1 rounded-full bg-text-500" }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-500", children: data.activity.schoolName }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-1 h-1 rounded-full bg-text-500" }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-500", children: data.activity.year }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-1 h-1 rounded-full bg-text-500" }),
            subjectInfo ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
                "span",
                {
                  className: cn(
                    "w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
                    subjectInfo.colorClass
                  ),
                  children: subjectInfo.icon
                }
              ),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-500", children: data.activity.subjectName })
            ] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-500", children: data.activity.subjectName }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "w-1 h-1 rounded-full bg-text-500" }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-sm text-text-500", children: data.activity.className })
          ] })
        ] }),
        /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
          Button_default,
          {
            size: "small",
            onClick: handleViewActivity,
            className: "bg-primary-950 text-text gap-2",
            children: [
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_phosphor_react16.File, { size: 16 }),
              "Ver atividade"
            ]
          }
        )
      ] }) }),
      /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
        "div",
        {
          className: cn("grid gap-5", isMobile ? "grid-cols-2" : "grid-cols-5"),
          children: [
            /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "border border-border-50 rounded-xl py-4 px-0 flex flex-col items-center justify-center gap-2 bg-primary-50", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative w-[90px] h-[90px]", children: [
              /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("svg", { className: "w-full h-full transform -rotate-90", children: [
                /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
                  "circle",
                  {
                    cx: "45",
                    cy: "45",
                    r: "40",
                    stroke: "var(--color-primary-100)",
                    strokeWidth: "8",
                    fill: "none"
                  }
                ),
                /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
                  "circle",
                  {
                    cx: "45",
                    cy: "45",
                    r: "40",
                    stroke: "var(--color-primary-700)",
                    strokeWidth: "8",
                    fill: "none",
                    strokeDasharray: `${data.generalStats.completionPercentage / 100 * 251.2} 251.2`,
                    strokeLinecap: "round"
                  }
                )
              ] }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
                /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text_default, { className: "text-xl font-medium text-primary-600", children: [
                  Math.round(data.generalStats.completionPercentage),
                  "%"
                ] }),
                /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-2xs font-bold text-text-600 uppercase", children: "Conclu\xEDdo" })
              ] })
            ] }) }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "border border-border-50 rounded-xl py-4 px-3 flex flex-col items-center justify-center gap-1 bg-warning-background", children: [
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[30px] h-[30px] rounded-2xl flex items-center justify-center bg-warning-300", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_phosphor_react16.Star, { size: 16, className: "text-white", weight: "regular" }) }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-2xs font-bold uppercase text-center text-warning-600", children: "M\xE9dia da Turma" }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-xl font-bold text-warning-600", children: data.generalStats.averageScore.toFixed(1) })
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "border border-border-50 rounded-xl py-2 px-3 flex flex-col items-center justify-center gap-1 bg-success-200", children: [
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[30px] h-[30px] rounded-2xl flex items-center justify-center bg-indicator-positive", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_phosphor_react16.Medal, { size: 16, className: "text-text-950", weight: "regular" }) }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-2xs font-bold uppercase text-center text-success-700", children: "Quest\xF5es com mais acertos" }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-xl font-bold text-success-700", children: formatQuestionNumbers(data.questionStats.mostCorrect) })
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "border border-border-50 rounded-xl py-2 px-3 flex flex-col items-center justify-center gap-1 bg-error-100", children: [
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[30px] h-[30px] rounded-2xl flex items-center justify-center bg-indicator-negative", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
                import_phosphor_react16.WarningCircle,
                {
                  size: 16,
                  className: "text-white",
                  weight: "regular"
                }
              ) }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-2xs font-bold uppercase text-center text-error-700", children: "Quest\xF5es com mais erros" }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-xl font-bold text-error-700", children: formatQuestionNumbers(data.questionStats.mostIncorrect) })
            ] }),
            /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "border border-border-50 rounded-xl py-2 px-3 flex flex-col items-center justify-center gap-1 bg-info-background", children: [
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[30px] h-[30px] rounded-2xl flex items-center justify-center bg-info-500", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
                import_phosphor_react16.WarningCircle,
                {
                  size: 16,
                  className: "text-white",
                  weight: "regular"
                }
              ) }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-2xs font-bold uppercase text-center text-info-700", children: "Quest\xF5es n\xE3o respondidas" }),
              /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-xl font-bold text-info-700", children: formatQuestionNumbers(data.questionStats.notAnswered) })
            ] })
          ]
        }
      ),
      correctionError && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "w-full bg-error-50 border border-error-200 rounded-xl p-4 flex items-center gap-3", children: [
        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_phosphor_react16.WarningCircle, { size: 20, className: "text-error-600", weight: "fill" }),
        /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text_default, { className: "text-error-700 text-sm", children: correctionError })
      ] }),
      /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-full bg-background rounded-xl p-6 space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
        TableProvider,
        {
          data: tableData,
          headers: columns,
          loading: false,
          variant: "borderless",
          enableTableSort: true,
          enablePagination: true,
          paginationConfig: {
            itemLabel: "alunos",
            itemsPerPageOptions: [10, 20, 50],
            defaultItemsPerPage: 10,
            totalItems: data.pagination.total,
            totalPages: data.pagination.totalPages
          },
          emptyState: {
            component: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
              EmptyState_default,
              {
                image: emptyStateImage,
                title: "Nenhum aluno encontrado",
                description: "N\xE3o h\xE1 alunos matriculados nesta atividade"
              }
            )
          },
          onParamsChange: handleTableParamsChange,
          children: ({ table, pagination }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
            table,
            pagination
          ] })
        }
      ) })
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
      CorrectActivityModal_default,
      {
        isOpen: isModalOpen,
        onClose: handleCloseModal,
        data: correctionData,
        isViewOnly: isViewOnlyModal,
        onObservationSubmit: handleObservationSubmit
      }
    )
  ] });
};
var ActivityDetails_default = ActivityDetails;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ActivityDetails
});
//# sourceMappingURL=index.js.map