import { E as compilerRuntimeExports, r as reactExports, j as jsxRuntimeExports } from "./vendor-react-DYNCg6N5.js";
import { b as useActions, c$ as useGetDefaultUsersActionsFiltersQuery, I as IFiltersEnumType, h as filtersLabelsKeys, cr as setToEndOFDate, c as useAppSelector, bm as listSizes, d0 as useLazyGetUsersActionsReportQuery, d1 as useGetUsersActionsListQuery, z as transformConditionals, y as SearchIcon, bo as useGetUsersActionsFilterQuery, c_ as initialStatisticFilter, m as universalNotification } from "./index-DfebxkL9.js";
import { u as useTranslation } from "./vendor-i18n-wisIXUFi.js";
import { a as formatDateTime } from "./date-bOIw2uwV.js";
import { c as createStyles, al as Anchor, b as Box, F as Flex, T as Text, K as Divider, B as Button, a8 as Pagination, V as LoadingOverlay } from "./vendor-mantine-h0WlM2Mj.js";
import { O as OverflowTip } from "./index-C-CFogWu.js";
import { u as useDebounce } from "./useDebounce-DTubzIUC.js";
import { S as Search } from "./index-CcqTjOWY.js";
import { F as FilterList } from "./index-CPnWygUh.js";
import { T as TableHeader, P as PaginatedTable } from "./index-DXVFB9sp.js";
import { u as useStyles$2 } from "./styles-BS0QIA50.js";
import { N as NoDataText } from "./index-C_Fw_IUU.js";
import "./vendor-icons-xWhXK_Ui.js";
import "./index-_NgMYV3i.js";
import "./index-C6QQOvbB.js";
import "./index.es-BTZFX8B-.js";
import "./styles-BC5VOxAU.js";
import "./index-Zaude47i.js";
import "./index-lR9_AURi.js";
const useHandleUsersActions = (t0) => {
  const $ = compilerRuntimeExports.c(17);
  const {
    scrollRef,
    search,
    rowData,
    usersActionsFilters
  } = t0;
  const {
    setUsersActionsFilters
  } = useActions();
  let t1;
  if ($[0] !== scrollRef || $[1] !== search || $[2] !== setUsersActionsFilters || $[3] !== usersActionsFilters) {
    t1 = () => {
      var _a, _b;
      if (search) {
        (_b = (_a = scrollRef == null ? void 0 : scrollRef.current) == null ? void 0 : _a.el) == null ? void 0 : _b.scrollTo(0, 0);
      }
      setUsersActionsFilters({
        ...usersActionsFilters,
        Query: search,
        Offset: 0
      });
    };
    $[0] = scrollRef;
    $[1] = search;
    $[2] = setUsersActionsFilters;
    $[3] = usersActionsFilters;
    $[4] = t1;
  } else {
    t1 = $[4];
  }
  let t2;
  if ($[5] !== search) {
    t2 = [search];
    $[5] = search;
    $[6] = t2;
  } else {
    t2 = $[6];
  }
  reactExports.useEffect(t1, t2);
  let t3;
  if ($[7] !== (rowData == null ? void 0 : rowData.length) || $[8] !== setUsersActionsFilters || $[9] !== usersActionsFilters) {
    t3 = () => {
      if (rowData == null ? void 0 : rowData.length) {
        setUsersActionsFilters({
          ...usersActionsFilters
        });
      }
    };
    $[7] = rowData == null ? void 0 : rowData.length;
    $[8] = setUsersActionsFilters;
    $[9] = usersActionsFilters;
    $[10] = t3;
  } else {
    t3 = $[10];
  }
  let t4;
  if ($[11] !== rowData) {
    t4 = [rowData];
    $[11] = rowData;
    $[12] = t4;
  } else {
    t4 = $[12];
  }
  reactExports.useEffect(t3, t4);
  let t5;
  if ($[13] !== scrollRef) {
    t5 = () => {
      var _a, _b;
      (_b = (_a = scrollRef == null ? void 0 : scrollRef.current) == null ? void 0 : _a.el) == null ? void 0 : _b.scrollTo(0, 0);
    };
    $[13] = scrollRef;
    $[14] = t5;
  } else {
    t5 = $[14];
  }
  let t6;
  if ($[15] !== usersActionsFilters) {
    t6 = [usersActionsFilters];
    $[15] = usersActionsFilters;
    $[16] = t6;
  } else {
    t6 = $[16];
  }
  reactExports.useEffect(t5, t6);
};
const useGetUsersActionsFilters = () => {
  const $ = compilerRuntimeExports.c(10);
  const {
    t
  } = useTranslation();
  const {
    data: defaultFiltersData,
    isSuccess: defaultFiltersSuccess
  } = useGetDefaultUsersActionsFiltersQuery(20);
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t0 = [];
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  const [filtersMenuList, setFiltersMenuList] = reactExports.useState(t0);
  let t1;
  if ($[1] !== defaultFiltersData || $[2] !== defaultFiltersSuccess || $[3] !== t) {
    t1 = () => {
      if (!(defaultFiltersData && defaultFiltersSuccess)) {
        return;
      }
      const convertDefaultFilters = defaultFiltersData.map((item) => {
        var _a;
        return {
          ...item,
          label: item.Type === IFiltersEnumType.DateOfCreateFilter ? t("statistics.date_action") : item.Type in IFiltersEnumType ? t(`filters.${filtersLabelsKeys[item.Type]}`) : t("filters.title"),
          Items: (_a = item.Items) == null ? void 0 : _a.map(_temp$1),
          hideSearch: false
        };
      }).sort(_temp2$1);
      setFiltersMenuList(convertDefaultFilters);
    };
    $[1] = defaultFiltersData;
    $[2] = defaultFiltersSuccess;
    $[3] = t;
    $[4] = t1;
  } else {
    t1 = $[4];
  }
  let t2;
  if ($[5] !== defaultFiltersData || $[6] !== defaultFiltersSuccess) {
    t2 = [defaultFiltersData, defaultFiltersSuccess];
    $[5] = defaultFiltersData;
    $[6] = defaultFiltersSuccess;
    $[7] = t2;
  } else {
    t2 = $[7];
  }
  reactExports.useEffect(t1, t2);
  let t3;
  if ($[8] !== filtersMenuList) {
    t3 = {
      filtersMenuList
    };
    $[8] = filtersMenuList;
    $[9] = t3;
  } else {
    t3 = $[9];
  }
  return t3;
};
function _temp$1(filterItem) {
  return {
    ...filterItem,
    Count: void 0,
    checked: false
  };
}
function _temp2$1(a, b) {
  return a.Type - b.Type;
}
const useStyles$1 = createStyles(() => ({
  listGroup: {
    display: "inline",
    width: "100%",
    columnGap: "4px",
    flexWrap: "wrap",
    backgroundColor: "transparent"
  }
}));
const createLink = (title, url, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(Anchor, { href: url, target: "_blank", rel: "noreferrer", style: {
  maxWidth: "200px",
  overflow: "hidden",
  display: "inline-flex"
}, children: /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTip, { "data-text": title, children: title }) }, `${url}-${index}`);
const replaceTitleInPart = (part, title, url) => {
  const splitParts = part.split(title);
  return splitParts.flatMap((splitPart, index) => index < splitParts.length - 1 ? [splitPart, createLink(title, url, index)] : [splitPart]);
};
const replaceTitlesWithLinks = ({
  DescriptionTitle,
  Titles
}) => {
  let parts = [DescriptionTitle || ""];
  Titles == null ? void 0 : Titles.forEach(({
    Title,
    Url
  }) => {
    parts = parts.flatMap((part) => typeof part === "string" && Title && Url ? replaceTitleInPart(part, Title, Url) : [part]);
  });
  return parts;
};
const useReplaceTitlesWithLinks = ({
  DescriptionTitle,
  Titles
}) => {
  return replaceTitlesWithLinks({
    DescriptionTitle,
    Titles
  });
};
const Description = (t0) => {
  const $ = compilerRuntimeExports.c(10);
  const {
    DescriptionTitle,
    Titles
  } = t0;
  const {
    classes
  } = useStyles$1();
  const {
    t
  } = useTranslation();
  let t1;
  if ($[0] !== DescriptionTitle || $[1] !== Titles) {
    t1 = {
      DescriptionTitle,
      Titles
    };
    $[0] = DescriptionTitle;
    $[1] = Titles;
    $[2] = t1;
  } else {
    t1 = $[2];
  }
  const descriptionParts = useReplaceTitlesWithLinks(t1);
  let t2;
  if ($[3] !== (DescriptionTitle == null ? void 0 : DescriptionTitle.length) || $[4] !== descriptionParts || $[5] !== t) {
    t2 = (DescriptionTitle == null ? void 0 : DescriptionTitle.length) ? descriptionParts : t("noData");
    $[3] = DescriptionTitle == null ? void 0 : DescriptionTitle.length;
    $[4] = descriptionParts;
    $[5] = t;
    $[6] = t2;
  } else {
    t2 = $[6];
  }
  let t3;
  if ($[7] !== classes.listGroup || $[8] !== t2) {
    t3 = /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: classes.listGroup, children: t2 });
    $[7] = classes.listGroup;
    $[8] = t2;
    $[9] = t3;
  } else {
    t3 = $[9];
  }
  return t3;
};
const User = (t0) => {
  const $ = compilerRuntimeExports.c(3);
  const {
    UserName,
    UserId
  } = t0;
  const t1 = `/profile/${UserId}`;
  let t2;
  if ($[0] !== UserName || $[1] !== t1) {
    t2 = /* @__PURE__ */ jsxRuntimeExports.jsx(Anchor, { fz: 14, underline: "never", target: "_blank", href: t1, children: UserName });
    $[0] = UserName;
    $[1] = t1;
    $[2] = t2;
  } else {
    t2 = $[2];
  }
  return t2;
};
const useGetValue = (value) => {
  const $ = compilerRuntimeExports.c(12);
  const {
    t
  } = useTranslation();
  if (!value || Object.keys(value).length === 0) {
    let t02;
    if ($[0] !== t) {
      t02 = t("noData");
      $[0] = t;
      $[1] = t02;
    } else {
      t02 = $[1];
    }
    return t02;
  }
  let t0;
  if ($[2] !== value) {
    t0 = Object.keys(value);
    $[2] = value;
    $[3] = t0;
  } else {
    t0 = $[3];
  }
  const t1 = t0;
  let t2;
  if ($[4] !== t || $[5] !== t1 || $[6] !== value) {
    t2 = t1.map((key) => {
      const data = value[key];
      if (!Array.isArray(data)) {
        return false;
      }
      const v = data.filter(Boolean);
      if (v.length > 0) {
        return `${t(`statistics.valuesActions.${key}`)}: ${v.join(", ")}`;
      }
      return false;
    });
    $[4] = t;
    $[5] = t1;
    $[6] = value;
    $[7] = t2;
  } else {
    t2 = $[7];
  }
  const values = t2;
  if (values.length === 0) {
    let t32;
    if ($[8] !== t) {
      t32 = t("noData");
      $[8] = t;
      $[9] = t32;
    } else {
      t32 = $[9];
    }
    return t32;
  }
  let t3;
  if ($[10] !== values) {
    t3 = values.filter(Boolean);
    $[10] = values;
    $[11] = t3;
  } else {
    t3 = $[11];
  }
  return t3.join(", ");
};
const OldValuesCell = (props) => {
  const $ = compilerRuntimeExports.c(2);
  const {
    OldValues,
    OldValue
  } = props;
  const vs = useGetValue(OldValues);
  const values = OldValue ? OldValue : vs;
  const t0 = values || "-";
  let t1;
  if ($[0] !== t0) {
    t1 = /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { maw: 300, children: /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTip, { component: "p", children: t0 }) });
    $[0] = t0;
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  return t1;
};
const NewValuesCell = (props) => {
  const $ = compilerRuntimeExports.c(2);
  const {
    NewValues,
    NewValue
  } = props;
  const vs = useGetValue(NewValues);
  const values = NewValue ? NewValue : vs;
  const t0 = values || "-";
  let t1;
  if ($[0] !== t0) {
    t1 = /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { maw: 300, children: /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTip, { component: "p", children: t0 }) });
    $[0] = t0;
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  return t1;
};
const useGetColumns = (columnVisibility) => {
  const $ = compilerRuntimeExports.c(48);
  const {
    t
  } = useTranslation();
  let t0;
  if ($[0] !== t) {
    t0 = t("statistics.user");
    $[0] = t;
    $[1] = t0;
  } else {
    t0 = $[1];
  }
  let t1;
  if ($[2] !== columnVisibility.UserName || $[3] !== t0) {
    t1 = {
      width: "auto",
      dataIndex: "Name",
      title: t0,
      hideColumn: columnVisibility.UserName,
      render: _temp
    };
    $[2] = columnVisibility.UserName;
    $[3] = t0;
    $[4] = t1;
  } else {
    t1 = $[4];
  }
  let t2;
  if ($[5] !== t) {
    t2 = t("statistics.date_time");
    $[5] = t;
    $[6] = t2;
  } else {
    t2 = $[6];
  }
  let t3;
  if ($[7] !== columnVisibility.Date || $[8] !== t2) {
    t3 = {
      width: "auto",
      dataIndex: "Date",
      title: t2,
      hideColumn: columnVisibility.Date,
      render: _temp2
    };
    $[7] = columnVisibility.Date;
    $[8] = t2;
    $[9] = t3;
  } else {
    t3 = $[9];
  }
  let t4;
  if ($[10] !== t) {
    t4 = t("statistics.action");
    $[10] = t;
    $[11] = t4;
  } else {
    t4 = $[11];
  }
  let t5;
  if ($[12] !== columnVisibility.ActionType || $[13] !== t4) {
    t5 = {
      width: "auto",
      dataIndex: "ActionType",
      title: t4,
      hideColumn: columnVisibility.ActionType,
      render: _temp3
    };
    $[12] = columnVisibility.ActionType;
    $[13] = t4;
    $[14] = t5;
  } else {
    t5 = $[14];
  }
  let t6;
  if ($[15] !== t) {
    t6 = t("statistics.description");
    $[15] = t;
    $[16] = t6;
  } else {
    t6 = $[16];
  }
  let t7;
  if ($[17] !== columnVisibility.Description || $[18] !== t6) {
    t7 = {
      width: "auto",
      dataIndex: "Description",
      title: t6,
      hideColumn: columnVisibility.Description,
      render: _temp4
    };
    $[17] = columnVisibility.Description;
    $[18] = t6;
    $[19] = t7;
  } else {
    t7 = $[19];
  }
  let t8;
  if ($[20] !== t) {
    t8 = t("statistics.ip");
    $[20] = t;
    $[21] = t8;
  } else {
    t8 = $[21];
  }
  let t9;
  if ($[22] !== t) {
    t9 = (item_3) => (item_3 == null ? void 0 : item_3.Ip) ? item_3 == null ? void 0 : item_3.Ip : t("noData");
    $[22] = t;
    $[23] = t9;
  } else {
    t9 = $[23];
  }
  let t10;
  if ($[24] !== columnVisibility.Ip || $[25] !== t8 || $[26] !== t9) {
    t10 = {
      width: "auto",
      dataIndex: "Ip",
      title: t8,
      hideColumn: columnVisibility.Ip,
      render: t9
    };
    $[24] = columnVisibility.Ip;
    $[25] = t8;
    $[26] = t9;
    $[27] = t10;
  } else {
    t10 = $[27];
  }
  let t11;
  if ($[28] !== t) {
    t11 = t("statistics.newValue");
    $[28] = t;
    $[29] = t11;
  } else {
    t11 = $[29];
  }
  let t12;
  if ($[30] !== columnVisibility.OldValue || $[31] !== t11) {
    t12 = {
      width: "auto",
      dataIndex: "OldValue",
      title: t11,
      hideColumn: columnVisibility.OldValue,
      render: NewValuesCell
    };
    $[30] = columnVisibility.OldValue;
    $[31] = t11;
    $[32] = t12;
  } else {
    t12 = $[32];
  }
  let t13;
  if ($[33] !== t) {
    t13 = t("statistics.oldValues");
    $[33] = t;
    $[34] = t13;
  } else {
    t13 = $[34];
  }
  let t14;
  if ($[35] !== columnVisibility.OldValue || $[36] !== t13) {
    t14 = {
      width: "auto",
      dataIndex: "OldValues",
      title: t13,
      hideColumn: columnVisibility.OldValue,
      render: OldValuesCell
    };
    $[35] = columnVisibility.OldValue;
    $[36] = t13;
    $[37] = t14;
  } else {
    t14 = $[37];
  }
  let t15;
  if ($[38] !== t1 || $[39] !== t10 || $[40] !== t12 || $[41] !== t14 || $[42] !== t3 || $[43] !== t5 || $[44] !== t7) {
    t15 = [t1, t3, t5, t7, t10, t12, t14];
    $[38] = t1;
    $[39] = t10;
    $[40] = t12;
    $[41] = t14;
    $[42] = t3;
    $[43] = t5;
    $[44] = t7;
    $[45] = t15;
  } else {
    t15 = $[45];
  }
  const columnsData = t15;
  const [columns, setColumns] = reactExports.useState(columnsData);
  let t16;
  if ($[46] !== columns) {
    t16 = {
      columns,
      setColumns
    };
    $[46] = columns;
    $[47] = t16;
  } else {
    t16 = $[47];
  }
  return t16;
};
function _temp(item) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(User, { UserName: item == null ? void 0 : item.UserName, UserId: item == null ? void 0 : item.UserId });
}
function _temp2(item_0) {
  return formatDateTime(item_0 == null ? void 0 : item_0.Date);
}
function _temp3(item_1) {
  return (item_1 == null ? void 0 : item_1.TypeName) || "-";
}
function _temp4(item_2) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Description, { DescriptionTitle: item_2 == null ? void 0 : item_2.Description, Titles: item_2 == null ? void 0 : item_2.Titles });
}
const convertToFilterConditions = (activeFilters) => {
  const filterObjects = [];
  for (const [key, value] of Object.entries(activeFilters)) {
    const filterType = +key;
    const filterObject = {
      Type: filterType
    };
    if (filterType === IFiltersEnumType.DateOfCreateFilter) {
      const [from, to] = value;
      filterObject.DateRange = {
        From: from == null ? void 0 : from.toISOString(),
        To: setToEndOFDate(new Date(to))
      };
    } else {
      filterObject.NumValues = value;
    }
    filterObjects.push(filterObject);
  }
  return filterObjects;
};
const useStyles = createStyles((theme, _, utils) => ({
  paginateWrapper: {
    overflow: "auto"
  },
  wrapper: {
    flexGrow: 1,
    overflow: "auto",
    marginBottom: theme.spacing.md,
    [utils.smallerThan("md")]: {
      marginRight: "0"
    }
  },
  container: {
    position: "relative",
    backgroundColor: theme.white,
    borderRadius: "8px",
    overflowX: "hidden",
    [utils.smallerThan("md")]: {
      padding: "10px",
      marginTop: "10px"
    }
  },
  searchContainer: {
    backgroundColor: theme.colors.backgroundGray[0],
    ".mantine-Input-wrapper": {
      width: "100%"
    }
  },
  search: {
    width: "60%",
    "& input": {
      backgroundColor: theme.colors.backgroundGray[6],
      paddingLeft: "56px",
      height: "56px",
      fontSize: "16px"
    },
    "& .mantine-Input-section": {
      marginLeft: "15px"
    }
  },
  contentContainer: {
    backgroundColor: theme.white,
    borderRadius: "8px",
    // overflow: 'auto',
    [utils.smallerThan("md")]: {
      padding: "0!important"
    }
  },
  divider: {
    borderColor: theme.colors.backgroundGray[2]
  },
  listWrapper: {
    display: "flex",
    justifyContent: "space-between",
    width: "100%",
    overflowX: "auto",
    msOverflowStyle: "none",
    scrollbarWidth: "none",
    backgroundColor: "white"
  }
}));
const pageSizeOptions = listSizes.map((page) => ({
  value: page.toString(),
  label: page.toString()
}));
const Audit = () => {
  const {
    t
  } = useTranslation();
  const {
    classes: commonClasses
  } = useStyles$2();
  const {
    classes
  } = useStyles();
  const {
    selected: selectedUsers
  } = useAppSelector((state) => state.users);
  const {
    TotalCount,
    filters: actionsFilters,
    Items: actionsList,
    columnVisibility
  } = useAppSelector((state_0) => state_0.statistics.usersActionsList);
  const [search, setSearch] = reactExports.useState(actionsFilters.Query || "");
  const [activeFilters, setActiveFilters] = reactExports.useState({});
  const [rowData, setRowData] = reactExports.useState(actionsList);
  const {
    columns,
    setColumns
  } = useGetColumns(columnVisibility);
  const [pageSize, setPageSize] = reactExports.useState(actionsFilters.Count || listSizes[0]);
  const [activePage, setActivePage] = reactExports.useState(1);
  const scrollRef = reactExports.useRef(null);
  const {
    setUsersActionsFilters,
    setUsersActionsList,
    setUsersActionsColumnVisibility
  } = useActions();
  const {
    filtersMenuList
  } = useGetUsersActionsFilters();
  const [getUsersActionsReport, {
    isFetching: reportIsLoading,
    error: reportError
  }] = useLazyGetUsersActionsReportQuery();
  const {
    data,
    error,
    isLoading,
    isSuccess
  } = useGetUsersActionsListQuery({
    FilterConditions: actionsFilters.FilterConditions,
    Query: actionsFilters.Query,
    Count: pageSize,
    Offset: actionsFilters.Offset
  });
  const generateReportLink = async () => {
    var _a, _b, _c;
    const res = await getUsersActionsReport({
      FilterConditions: actionsFilters.FilterConditions,
      Query: actionsFilters.Query,
      Count: pageSize,
      Offset: actionsFilters.Offset
    });
    if ("error" in res) {
      universalNotification({
        error: reportError,
        isError: true,
        isSuccess: false
      });
    }
    if ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.Url) == null ? void 0 : _b.length) {
      window.open((_c = res == null ? void 0 : res.data) == null ? void 0 : _c.Url, "_blank", "noopener,noreferrer");
    }
  };
  const handleResetFilters = () => {
    setPageSize(listSizes[0]);
    setActivePage(1);
    setUsersActionsFilters(initialStatisticFilter);
  };
  reactExports.useEffect(() => {
    const initialActiveFilters = actionsFilters.FilterConditions ? transformConditionals(actionsFilters.FilterConditions) : {};
    setActiveFilters(initialActiveFilters);
  }, []);
  reactExports.useEffect(() => {
    if (data) {
      setUsersActionsList(data);
    }
  }, [data]);
  reactExports.useEffect(() => {
    setRowData(actionsList);
  }, [actionsList]);
  reactExports.useEffect(() => {
    setUsersActionsFilters({
      ...actionsFilters,
      FilterConditions: convertToFilterConditions(activeFilters),
      Offset: 0
    });
    setActivePage(1);
  }, [activeFilters]);
  reactExports.useEffect(() => {
    return () => {
      handleResetFilters();
    };
  }, []);
  const handleFilterChange = (updatedFilters) => {
    var _a, _b;
    setActiveFilters(updatedFilters);
    (_b = (_a = scrollRef == null ? void 0 : scrollRef.current) == null ? void 0 : _a.el) == null ? void 0 : _b.scrollTo(0, 0);
  };
  const handleChangePageSize = (value) => {
    setPageSize(value);
    setActivePage(1);
    setUsersActionsFilters({
      ...actionsFilters,
      Offset: 0,
      Count: value
    });
  };
  const handleChangeActivePage = (value_0) => {
    setActivePage(value_0);
    setUsersActionsFilters({
      ...actionsFilters,
      Offset: (value_0 >= 1 ? value_0 - 1 : 0) * pageSize
    });
  };
  const debounced = useDebounce(search, 500);
  useHandleUsersActions({
    scrollRef,
    search: debounced,
    usersActionsFilters: actionsFilters
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { className: classes.wrapper, mr: "md", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { direction: "column", align: "stretch", className: classes.container, mt: "md", mb: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: classes.searchContainer, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Search, { "data-cy": "auditSearch", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, {}), setSearch, className: classes.search, fullSize: true, value: search, placeholder: t("statistics.search_by_name") }) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { direction: "column", align: "stretch", className: classes.container, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { direction: "column", className: classes.contentContainer, px: "md", py: "md", mt: "sm", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { c: "#101828", fw: "600", children: t("statistics.audit") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: classes.listWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FilterList, { filtersMenuList, activeFilters, onFilterChange: handleFilterChange, onFilterReset: setActiveFilters, onLoadData: useGetUsersActionsFilterQuery }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { className: classes.divider, mx: "-md", mb: "sm" }),
      rowData && rowData.length && TotalCount ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(TableHeader, { handleChangePageSize, pageSize, pageSizeOptions, isLoading, startOffset: actionsFilters.Offset + 1, endOffset: Math.min(actionsFilters.Offset + pageSize, TotalCount), totalCount: TotalCount, showButton: true, buttonComponent: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: () => generateReportLink(), loading: reportIsLoading, children: reportIsLoading ? t("statistics.load_csv") : t("statistics.downloadAndOpenReport") }), setColumnsData: setColumns, list: columns, setColumnVisibility: setUsersActionsColumnVisibility }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { mt: "lg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PaginatedTable, { allDataLength: TotalCount, rowData, columns, search, height: "100%", width: "100%", selection: selectedUsers, error, scrollRef, isLoading }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: classes.paginateWrapper, children: TotalCount > pageSize && /* @__PURE__ */ jsxRuntimeExports.jsx(Pagination, { classNames: {
          root: commonClasses.paginateRoot,
          control: commonClasses.paginateControl
        }, value: activePage, onChange: handleChangeActivePage, total: Math.ceil(TotalCount / pageSize), withControls: false, withEdges: true, size: "sm" }) })
      ] }) : (isSuccess || error) && !isLoading && !TotalCount && /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { align: "center", justify: "center", h: "350px", children: /* @__PURE__ */ jsxRuntimeExports.jsx(NoDataText, {}) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingOverlay, { visible: isLoading }),
      " "
    ] }) })
  ] });
};
export {
  Audit as default
};
//# sourceMappingURL=index-D1z3qsw1.js.map
