import { jsxs, jsx, Fragment } from "react/jsx-runtime";
import { forwardRef, useState, useRef, useEffect, useCallback, useMemo } from "react";
import { useSensors, useSensor, MouseSensor, TouchSensor, DndContext, closestCenter } from "@dnd-kit/core";
import { SortableContext, arrayMove, useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import default_1$1 from "../../node_modules/@mui/icons-material/KeyboardArrowDown.js";
import default_1$3 from "../../node_modules/@mui/icons-material/KeyboardArrowRight.js";
import default_1 from "../../node_modules/@mui/icons-material/KeyboardArrowUp.js";
import default_1$2 from "../../node_modules/@mui/icons-material/Search.js";
import { getAssetUrl } from "../../utils/assetBase.js";
import { debounce } from "../../utils/debounce.js";
import { isViewNameUnique } from "../../utils/helper.js";
import { Badge } from "../Badge/index.js";
import { Button } from "../Button/index.js";
import { Checkbox } from "../Checkbox/index.js";
import { Input } from "../Input/index.js";
import { Modal } from "../Modal/index.js";
import { Prompt } from "../Prompt/index.js";
import { RadioButtonGroup } from "../RadioButtonGroup/index.js";
import { Select } from "../Select/index.js";
import IconButton from "../../node_modules/@mui/material/IconButton/IconButton.js";
import DragIndicator from "../../node_modules/@mui/icons-material/esm/DragIndicator.js";
const saveViewIcon = getAssetUrl("icons/saveViewIcon.svg");
const saveViewEditIcon = getAssetUrl("icons/saveViewEditIcon.svg");
const saveViewDeleteIcon = getAssetUrl("icons/deleteIcon.svg");
const defaultViewIcon = getAssetUrl("icons/defaultViewIcon.svg");
const defaultViewActiveIcon = getAssetUrl("icons/defaultViewIconActive.svg");
const onColMenuFreezeClick = (params) => {
  const { pinned } = params.column;
  if (pinned) {
    freezeColumn(params, false);
  } else {
    freezeColumn(params, true);
  }
};
const freezeColumn = (params, isPinned) => {
  const { colId } = params.column;
  params.api.applyColumnState({
    state: [{ colId, pinned: isPinned ? "left" : null }]
  });
};
const onColMenuAutoAdjustClick = (params) => {
  const colDefExtra = { ...params.column.colDef.extra };
  params.column.colDef.extra = colDefExtra;
  params.api.autoSizeColumn(params.column);
};
const sortFunc = (columnData, sortBy, api) => {
  api.api.applyColumnState({
    state: [{ colId: columnData.colId, sort: sortBy }],
    defaultState: { sort: null }
  });
};
const getMainMenuItems = (params) => {
  var _a, _b, _c;
  const { onFontSizeChange, onNumberFormatChange } = params;
  const { colDef, pinned, sort, actualWidth } = params.column;
  const columnMenuItems = [];
  columnMenuItems.push(
    {
      name: "Column Settings",
      cssClasses: ["settings-main-container"]
    },
    "separator"
  );
  columnMenuItems.push({
    name: "Sort",
    subMenu: [
      {
        name: "Sort A to Z",
        action: () => {
          sortFunc(params.column, "asc", params);
        },
        checked: sort === "asc"
      },
      {
        name: "Sort Z to A",
        checked: sort === "desc",
        action: () => {
          sortFunc(params.column, "desc", params);
        }
      },
      {
        name: "Reset",
        action: () => {
          sortFunc(params.column, null, params);
        }
      }
    ],
    disabled: !(colDef == null ? void 0 : colDef.sortable)
  });
  columnMenuItems.push({
    name: pinned ? "Unfreeze Column" : "Freeze Column",
    action: () => {
      onColMenuFreezeClick(params);
    }
  });
  columnMenuItems.push({
    name: "Column width",
    subMenu: [
      {
        name: "Auto Adjust",
        action: () => {
          onColMenuAutoAdjustClick(params);
        },
        // if extra.width property is not present- column is auto adjusted
        checked: actualWidth !== ((_a = colDef == null ? void 0 : colDef.extra) == null ? void 0 : _a.width)
      },
      {
        name: "Custom width",
        action: () => {
          var _a2;
          params.api.setColumnWidth(params.column.colDef, (_a2 = colDef == null ? void 0 : colDef.extra) == null ? void 0 : _a2.width);
        },
        // if extra.width property is present- column has custom width
        checked: ((_b = colDef == null ? void 0 : colDef.extra) == null ? void 0 : _b.width) === actualWidth,
        disabled: !((_c = colDef == null ? void 0 : colDef.extra) == null ? void 0 : _c.width)
      }
    ]
  });
  columnMenuItems.push({
    name: "Wrap Text",
    disabled: true
  });
  columnMenuItems.push(
    {
      name: "Format",
      cssClasses: ["format-main-container"]
    },
    "separator"
  );
  columnMenuItems.push({
    name: "Numeric Values",
    subMenu: [
      {
        name: "Full Number",
        action: () => onNumberFormatChange("full")
      },
      {
        name: "In K",
        action: () => onNumberFormatChange("thousand")
      },
      {
        name: "In Mn",
        action: () => onNumberFormatChange("million")
      },
      {
        name: "In Bn",
        action: () => onNumberFormatChange("billion")
      }
    ],
    disabled: !onFontSizeChange
  });
  columnMenuItems.push({
    name: "Font Size",
    subMenu: [
      {
        name: "Small Font",
        action: () => onFontSizeChange("small")
      },
      {
        name: "Medium Font",
        action: () => onFontSizeChange("medium")
      },
      {
        name: "Large Font",
        action: () => onFontSizeChange("large")
      }
    ],
    disabled: !onNumberFormatChange
  });
  return columnMenuItems;
};
const SortableColumnItem = ({ column, level, renderFn, dragIconClass, onToggle, ...props }) => {
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
    id: column.colId
  });
  const style = {
    transform: CSS.Transform.toString(transform),
    transition,
    opacity: isDragging ? 0.5 : 1,
    // background: isDragging ? '#f0f0f0' : undefined,
    zIndex: isDragging ? 100 : void 0
  };
  return /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, children: renderFn({
    column,
    level,
    dragProps: { ...attributes, ...listeners },
    dragIconClass,
    onToggle
  }) });
};
const Columns = forwardRef((props, ref) => {
  var _a, _b, _c, _d, _e, _f;
  const [searchText, setSearchText] = useState("");
  const [collapsedScrollable, setCollapsedScrollable] = useState(false);
  const [collapsedColumn, setCollapsedcolumn] = useState(false);
  const [frozenColumn, setFrozenColumn] = useState([]);
  const [scrollableColumn, setScrollableColumn] = useState([]);
  const [filteredFrozenColumns, setFilteredFrozenColumns] = useState([]);
  const [filteredScrollableColumns, setFilteredScrollableColumns] = useState([]);
  const [allColumnVisibility, setAllColumnvisisbility] = useState(true);
  const [mainChecked, setMainChecked] = useState(true);
  const [collapsedScrollColumns, setCollapsedScrollColumns] = useState({});
  const [collapsedFrozenColumns, setCollapsedFrozenColumns] = useState({});
  const [openSaveViewModal, setOpenSaveViewModal] = useState(false);
  const [isDefaultView, setIsDefaultView] = useState(false);
  const [selectedViewType, setSelectedViewType] = useState(
    (_a = props.saveViewCustomFilter) == null ? void 0 : _a.selectedOption
  );
  const [savedViewsOptions, setSavedViewsOptions] = useState(props.savedViewsOptions || []);
  const [filteredSavedViewsOptions, setFilteredSavedViewsOptions] = useState(
    props.savedViewsOptions || []
  );
  const [currentSaveViewOptions, setCurrentSaveViewOptions] = useState([]);
  const [selectedSavedView, setSelectedSavedView] = useState(null);
  const [inputValue, setInputValue] = useState("");
  const [isOpen, setIsOpen] = useState(false);
  const [openSaveViewMenu, setOpenSaveViewMenu] = useState(false);
  const [selectedBadge, setSelectedBadge] = useState("All");
  const [isEditView, setIsEditView] = useState(false);
  const [editedView, setEditedView] = useState(null);
  const [saveViewSearchText, setSaveViewSearchText] = useState("");
  const [openDeletePrompt, setOpenDeletePrompt] = useState(false);
  const [deleteView, setDeleteView] = useState(null);
  const [selectedView, setSelectedView] = useState(null);
  const isColumnPinnedRef = useRef(false);
  useEffect(() => {
    var _a2;
    if (((_a2 = props.savedViewsOptions) == null ? void 0 : _a2.length) > 0) {
      const options = props.savedViewsOptions.map((view) => ({
        label: view.viewName,
        value: view.viewName,
        disabled: view == null ? void 0 : view.isDisabled
      }));
      setCurrentSaveViewOptions(options);
      setSavedViewsOptions(props.savedViewsOptions);
      setFilteredSavedViewsOptions(props.savedViewsOptions);
      setSelectedView(props.savedViewsOptions.filter((view) => view.isActive));
    }
  }, [props.savedViewsOptions]);
  const getColumnDefs = useCallback((columns) => {
    return columns.map((column) => {
      if (column.children) {
        const updatedChildren = getColumnDefs(column.children);
        const allChildrenHidden = updatedChildren.every((child) => child.hide === true);
        return {
          ...column,
          children: updatedChildren,
          hide: allChildrenHidden
        };
      }
      return column;
    });
  }, []);
  const updateColumnState = useCallback(() => {
    var _a2, _b2;
    const getColumnState = (columns) => {
      return columns.map((column) => {
        var _a3;
        const columnState2 = {
          colId: column.colId || column.field || column.headerName,
          headerName: column.headerName || column.field || "N/A",
          isVisible: !(column == null ? void 0 : column.hide),
          isPinned: column.pinned ? true : false,
          children: ((_a3 = column == null ? void 0 : column.children) == null ? void 0 : _a3.length) > 0 ? getColumnState(column.children) : null,
          // Recursively handle child columns
          disabled: column == null ? void 0 : column.disableColumnCheckboxInSettings
        };
        return columnState2;
      });
    };
    const columnDefs = getColumnDefs(((_b2 = (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.api) == null ? void 0 : _b2.getColumnDefs()) || props.column);
    const columnState = getColumnState(columnDefs);
    const { frozColumn, scrollColumn } = (columnState || []).reduce(
      (acc, column) => {
        if (column.isPinned) {
          acc.frozColumn.push(column);
        } else {
          acc.scrollColumn.push(column);
        }
        return acc;
      },
      { frozColumn: [], scrollColumn: [] }
    );
    setFrozenColumn(frozColumn);
    setFilteredFrozenColumns(frozColumn);
    setScrollableColumn(scrollColumn);
    setFilteredScrollableColumns(scrollColumn);
  }, [getColumnDefs, ref, props.column]);
  const debouncedUpdateColumnState = useMemo(
    () => debounce(updateColumnState, 100),
    [updateColumnState]
  );
  useEffect(() => {
    var _a2, _b2, _c2, _d2, _e2, _f2;
    if (props.showMenu || isColumnPinnedRef.current) {
      isColumnPinnedRef.current = false;
      updateColumnState();
      const onColumnPinned = () => {
        isColumnPinnedRef.current = true;
        debouncedUpdateColumnState();
      };
      if (ref == null ? void 0 : ref.current) {
        (_b2 = (_a2 = ref.current) == null ? void 0 : _a2.api) == null ? void 0 : _b2.addEventListener("columnPinned", onColumnPinned);
        (_d2 = (_c2 = ref.current) == null ? void 0 : _c2.api) == null ? void 0 : _d2.addEventListener("columnMoved", onColumnPinned);
        (_f2 = (_e2 = ref.current) == null ? void 0 : _e2.api) == null ? void 0 : _f2.addEventListener("columnVisible", onColumnPinned);
      }
      return () => {
        var _a3, _b3, _c3, _d3, _e3, _f3;
        if (ref == null ? void 0 : ref.current) {
          (_b3 = (_a3 = ref.current) == null ? void 0 : _a3.api) == null ? void 0 : _b3.removeEventListener("columnPinned", onColumnPinned);
          (_d3 = (_c3 = ref.current) == null ? void 0 : _c3.api) == null ? void 0 : _d3.removeEventListener("columnMoved", onColumnPinned);
          (_f3 = (_e3 = ref.current) == null ? void 0 : _e3.api) == null ? void 0 : _f3.removeEventListener("columnVisible", onColumnPinned);
        }
      };
    }
  }, [props.showMenu]);
  const [frozenColumnOrder, setFrozenColumnOrder] = useState([]);
  const [scrollableColumnOrder, setScrollableColumnOrder] = useState([]);
  const sensors = useSensors(useSensor(MouseSensor), useSensor(TouchSensor));
  const getAllColumnIds = (columns) => {
    let ids = [];
    columns.forEach((col) => {
      ids.push(col.colId);
      if (col.children && col.children.length > 0) {
        ids = ids.concat(getAllColumnIds(col.children));
      }
    });
    return ids;
  };
  useEffect(() => {
    setFrozenColumnOrder(getAllColumnIds(filteredFrozenColumns));
    setScrollableColumnOrder(getAllColumnIds(filteredScrollableColumns));
  }, [filteredFrozenColumns, filteredScrollableColumns]);
  const handleSearchChange = (e) => {
    const searchText2 = e.target.value.toLowerCase();
    const filterColumns = (columns, searchText3) => {
      return columns.map((column) => {
        const matches = column.headerName.toLowerCase().includes(searchText3);
        const filteredChildren = column.children ? filterColumns(column.children, searchText3) : null;
        if (matches || (filteredChildren == null ? void 0 : filteredChildren.length) > 0) {
          return {
            ...column,
            children: filteredChildren,
            isVisible: column.isVisible
          };
        }
        return null;
      }).filter(Boolean);
    };
    const filteredFrozenColumns2 = filterColumns(frozenColumn, searchText2);
    const filteredScrollableColumns2 = filterColumns(scrollableColumn, searchText2);
    setSearchText(searchText2);
    setFilteredFrozenColumns(filteredFrozenColumns2);
    setFilteredScrollableColumns(filteredScrollableColumns2);
  };
  useEffect(() => {
    const isAnyScrollableColumnVisible = filteredScrollableColumns.some((column) => {
      if (column.children) {
        return column.children.some((child) => child.isVisible);
      }
      return column.isVisible;
    });
    const isAnyFrozenColumnVisible = filteredFrozenColumns.some((column) => {
      if (column.children) {
        return column.children.some((child) => child.isVisible);
      }
      return column.isVisible;
    });
    setMainChecked(isAnyScrollableColumnVisible);
    setAllColumnvisisbility(isAnyFrozenColumnVisible || isAnyScrollableColumnVisible);
  }, [filteredFrozenColumns, filteredScrollableColumns]);
  const toggleColumnVisibilityFrozen = (colId) => {
    const updateChildrenVisibility = (columns, parentVisibility = null) => columns.map((column) => {
      var _a2;
      const updatedChildren = column.children ? updateChildrenVisibility(column.children, parentVisibility) : null;
      (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.api.setColumnVisible(column.colId, parentVisibility);
      return {
        ...column,
        isVisible: parentVisibility,
        children: updatedChildren
      };
    });
    const updateVisibility = (columns, parentVisibility = null) => columns.map((column) => {
      var _a2, _b2;
      if (column.colId === colId) {
        const newVisibility = parentVisibility !== null ? parentVisibility : !column.isVisible;
        const updatedChildren = column.children ? updateChildrenVisibility(column.children, newVisibility) : null;
        (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.api.setColumnVisible(column.colId, newVisibility);
        return {
          ...column,
          isVisible: newVisibility,
          children: updatedChildren
        };
      }
      if (column.children) {
        const updatedChildren = updateVisibility(column.children);
        const isAnyChildVisible = updatedChildren.some((child) => child.isVisible);
        (_b2 = ref == null ? void 0 : ref.current) == null ? void 0 : _b2.api.setColumnVisible(column.colId, isAnyChildVisible);
        return {
          ...column,
          isVisible: isAnyChildVisible,
          children: updatedChildren
        };
      }
      return column;
    });
    const updatedColumns = updateVisibility(filteredFrozenColumns);
    setFilteredFrozenColumns(updatedColumns);
    setFrozenColumn((prev) => {
      const updatedMap = Object.fromEntries(updatedColumns.map((col) => [col.colId, col]));
      const merged = prev.map((col) => updatedMap[col.colId] ? updatedMap[col.colId] : col);
      const prevColIds = new Set(prev.map((col) => col.colId));
      const newCols = updatedColumns.filter((col) => !prevColIds.has(col.colId));
      return [...merged, ...newCols];
    });
  };
  const toggleColumnVisibilityScroll = (colId) => {
    const updateChildrenVisibility = (columns, parentVisibility = null) => columns.map((column) => {
      var _a2;
      const updatedChildren = column.children ? updateChildrenVisibility(column.children, parentVisibility) : null;
      (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.api.setColumnVisible(column.colId, parentVisibility);
      return {
        ...column,
        isVisible: parentVisibility,
        children: updatedChildren
      };
    });
    const updateVisibility = (columns, parentVisibility = null) => columns.map((column) => {
      var _a2, _b2;
      if (column.colId === colId) {
        const newVisibility = parentVisibility !== null ? parentVisibility : !column.isVisible;
        const updatedChildren = column.children ? updateChildrenVisibility(column.children, newVisibility) : null;
        (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.api.setColumnVisible(column.colId, newVisibility);
        return {
          ...column,
          isVisible: newVisibility,
          children: updatedChildren
        };
      }
      if (column.children) {
        const updatedChildren = updateVisibility(column.children);
        const isAnyChildVisible = updatedChildren.some((child) => child.isVisible);
        (_b2 = ref == null ? void 0 : ref.current) == null ? void 0 : _b2.api.setColumnVisible(column.colId, isAnyChildVisible);
        return {
          ...column,
          isVisible: isAnyChildVisible,
          children: updatedChildren
        };
      }
      return column;
    });
    const updatedColumns = updateVisibility(filteredScrollableColumns);
    setFilteredScrollableColumns(updatedColumns);
    setScrollableColumn((prev) => {
      const updatedMap = Object.fromEntries(updatedColumns.map((col) => [col.colId, col]));
      const merged = prev.map((col) => updatedMap[col.colId] ? updatedMap[col.colId] : col);
      const prevColIds = new Set(prev.map((col) => col.colId));
      const newCols = updatedColumns.filter((col) => !prevColIds.has(col.colId));
      return [...merged, ...newCols];
    });
  };
  const toggleScrollableCollapse = (e) => {
    e.stopPropagation();
    setCollapsedScrollable(!collapsedScrollable);
  };
  const toggleColumnCollapse = (e) => {
    e.stopPropagation();
    setCollapsedcolumn(!collapsedColumn);
  };
  const onMainCheckboxChange = () => {
    setMainChecked((prev) => !prev);
    const updateVisibility = (columns, visibility) => {
      return columns.map((column) => {
        var _a2, _b2;
        (_b2 = (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.api) == null ? void 0 : _b2.setColumnVisible(column.colId, visibility);
        if (column.children) {
          updateVisibility(column.children, visibility);
        }
        return {
          ...column,
          isVisible: visibility,
          children: column.children ? updateVisibility(column.children, visibility) : null
        };
      });
    };
    const updatedColumns = updateVisibility(filteredScrollableColumns, !mainChecked);
    setFilteredScrollableColumns(updatedColumns);
    setScrollableColumn((prev) => {
      const updatedMap = Object.fromEntries(updatedColumns.map((col) => [col.colId, col]));
      const merged = prev.map((col) => updatedMap[col.colId] ? updatedMap[col.colId] : col);
      const prevColIds = new Set(prev.map((col) => col.colId));
      const newCols = updatedColumns.filter((col) => !prevColIds.has(col.colId));
      return [...merged, ...newCols];
    });
  };
  const onAllColumnCheckBoxChange = () => {
    setAllColumnvisisbility((prev) => !prev);
    setMainChecked(!allColumnVisibility);
    const updateColumnVisibility = (columns, visibility) => {
      return columns.map((column) => {
        var _a2, _b2;
        (_b2 = (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.api) == null ? void 0 : _b2.setColumnVisible(column.colId, visibility);
        if (column.children) {
          updateColumnVisibility(column.children, visibility);
        }
        return {
          ...column,
          isVisible: visibility,
          children: column.children ? updateColumnVisibility(column.children, visibility) : null
        };
      });
    };
    const updatedFrozenColumns = updateColumnVisibility(
      filteredFrozenColumns,
      !allColumnVisibility
    );
    const updatedScrollableColumns = updateColumnVisibility(
      filteredScrollableColumns,
      !allColumnVisibility
    );
    setFilteredFrozenColumns(updatedFrozenColumns);
    setFilteredScrollableColumns(updatedScrollableColumns);
    setFrozenColumn((prev) => {
      const updatedMap = Object.fromEntries(updatedFrozenColumns.map((col) => [col.colId, col]));
      const merged = prev.map((col) => updatedMap[col.colId] ? updatedMap[col.colId] : col);
      const prevColIds = new Set(prev.map((col) => col.colId));
      const newCols = updatedFrozenColumns.filter((col) => !prevColIds.has(col.colId));
      return [...merged, ...newCols];
    });
    setScrollableColumn((prev) => {
      const updatedMap = Object.fromEntries(
        updatedScrollableColumns.map((col) => [col.colId, col])
      );
      const merged = prev.map((col) => updatedMap[col.colId] ? updatedMap[col.colId] : col);
      const prevColIds = new Set(prev.map((col) => col.colId));
      const newCols = updatedScrollableColumns.filter((col) => !prevColIds.has(col.colId));
      return [...merged, ...newCols];
    });
  };
  const toggleScrollColumnCollapse = (colId) => {
    setCollapsedScrollColumns((prev) => ({
      ...prev,
      [colId]: !prev[colId]
      // Toggle collapse state for the specific column
    }));
  };
  const toggleFrozenColumnCollapse = (colId) => {
    setCollapsedFrozenColumns((prev) => ({
      ...prev,
      [colId]: !prev[colId]
      // Toggle collapse state for the specific frozen column
    }));
  };
  const reorderColDefsByColId = (colDefs, newOrder, type = "scrollable") => {
    const reorder = (columns) => {
      let filteredCols = [];
      if (type === "frozen") {
        filteredCols = columns.filter((col) => col.pinned === "left");
      } else {
        filteredCols = columns.filter((col) => col.pinned !== "left");
      }
      const sorted = [...filteredCols].filter((col) => newOrder.includes(col.colId || col.field || col.headerName)).sort(
        (a, b) => newOrder.indexOf(a.colId || a.field || a.headerName) - newOrder.indexOf(b.colId || b.field || b.headerName)
      ).map((col) => {
        if (col.children && col.children.length > 0) {
          return {
            ...col,
            children: reorder(col.children)
          };
        }
        return col;
      });
      return sorted;
    };
    let otherCols = [];
    if (type === "frozen") {
      otherCols = colDefs.filter((col) => col.pinned !== "left");
    } else {
      otherCols = colDefs.filter((col) => col.pinned === "left");
    }
    return [...otherCols, ...reorder(colDefs)];
  };
  const updateColumnDefs = (order, type, movedId, pinDirection) => {
    var _a2, _b2, _c2, _d2;
    const colDefs = (_b2 = (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.api) == null ? void 0 : _b2.getColumnDefs();
    if (!colDefs) return;
    const newColDefs = reorderColDefsByColId(colDefs, order, type);
    if (movedId) {
      const colDefToUpdate = newColDefs.find((c) => c.colId === movedId);
      if (colDefToUpdate) {
        colDefToUpdate.pinned = pinDirection;
      }
    }
    (_d2 = (_c2 = ref == null ? void 0 : ref.current) == null ? void 0 : _c2.api) == null ? void 0 : _d2.setGridOption("columnDefs", newColDefs);
  };
  const handleDragEnd = (event) => {
    const { active, over } = event;
    if (!over) return;
    const activeId = active.id;
    const overId = over.id;
    const isFrozenSource = frozenColumnOrder.includes(activeId);
    const isFrozenTarget = frozenColumnOrder.includes(overId);
    if (isFrozenSource && isFrozenTarget) {
      const oldIndex = frozenColumnOrder.indexOf(activeId);
      const newIndex = frozenColumnOrder.indexOf(overId);
      const newOrder = arrayMove(frozenColumnOrder, oldIndex, newIndex);
      setFrozenColumnOrder(newOrder);
      const reordered = newOrder.map((id) => {
        frozenColumn.find((c) => c.colId === id);
      }).filter(Boolean);
      setFrozenColumn(reordered);
      setFilteredFrozenColumns(reordered);
      updateColumnDefs(newOrder, "frozen");
    } else if (!isFrozenSource && !isFrozenTarget) {
      const oldIndex = scrollableColumnOrder.indexOf(activeId);
      const newIndex = scrollableColumnOrder.indexOf(overId);
      const newOrder = arrayMove(scrollableColumnOrder, oldIndex, newIndex);
      setScrollableColumnOrder(newOrder);
      const reordered = newOrder.map((id) => {
        filteredScrollableColumns.find((c) => c.colId === id);
      }).filter(Boolean);
      setScrollableColumn(reordered);
      setFilteredScrollableColumns(reordered);
      updateColumnDefs(newOrder, "scrollable");
    } else {
      if (isFrozenSource) {
        const updatedFrozenOrder = frozenColumnOrder.filter((id) => id !== activeId);
        const updatedFrozenCols = updatedFrozenOrder.map((id) => {
          frozenColumn.find((c) => c.colId === id);
        }).filter(Boolean);
        setFrozenColumnOrder(updatedFrozenOrder);
        setFrozenColumn(updatedFrozenCols);
        setFilteredFrozenColumns(updatedFrozenCols);
        const overIndex = scrollableColumnOrder.findIndex((id) => id === overId);
        const insertAt = overIndex === -1 ? scrollableColumnOrder.length : overIndex;
        const newScrollableOrder = [...scrollableColumnOrder];
        newScrollableOrder.splice(insertAt, 0, activeId);
        const allColumns = [...filteredFrozenColumns, ...filteredScrollableColumns];
        const updatedScrollableCols = newScrollableOrder.map((id) => {
          allColumns.find((c) => c.colId === id);
        }).filter(Boolean);
        setScrollableColumnOrder(newScrollableOrder);
        setScrollableColumn(updatedScrollableCols);
        setFilteredScrollableColumns(updatedScrollableCols);
        updateColumnDefs(newScrollableOrder, "scrollable", activeId, null);
      } else {
        const newScrollable = scrollableColumnOrder.filter((id) => id !== activeId);
        const updatedScrollable = newScrollable.map((id) => {
          scrollableColumn.find((c) => c.colId === id);
        }).filter(Boolean);
        setScrollableColumnOrder(newScrollable);
        setScrollableColumn(updatedScrollable);
        setFilteredScrollableColumns(updatedScrollable);
        const overIndex = frozenColumnOrder.findIndex((id) => id === overId);
        const insertAt = overIndex === -1 ? frozenColumnOrder.length : overIndex;
        const newFrozen = [...frozenColumnOrder];
        newFrozen.splice(insertAt, 0, activeId);
        const newFrozenCols = newFrozen.map((id) => {
          [...filteredFrozenColumns, ...filteredScrollableColumns].find((c) => c.colId === id);
        }).filter(Boolean);
        setFrozenColumnOrder(newFrozen);
        setFrozenColumn(newFrozenCols);
        setFilteredFrozenColumns(newFrozenCols);
        updateColumnDefs(newFrozen, "frozen", activeId, "left");
      }
    }
  };
  const renderScrollColumn = (column, level = 0) => {
    const isCollapsed = collapsedScrollColumns[column.colId] || false;
    return /* @__PURE__ */ jsx(
      SortableColumnItem,
      {
        column,
        dragIconClass: "table-setting-scroll-columns-list-drag-icon",
        level,
        renderFn: ({ column: column2, level: level2, dragProps, dragIconClass, onToggle }) => /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsxs(
            "div",
            {
              className: "table-setting-scroll-inner-column",
              style: { marginLeft: `${level2 * 20}px` },
              children: [
                Array.isArray(column2.children) && column2.children.length > 0 && /* @__PURE__ */ jsx(
                  IconButton,
                  {
                    style: { padding: "0px" },
                    onClick: (e) => {
                      e.stopPropagation();
                      toggleScrollColumnCollapse(column2.colId);
                    },
                    children: isCollapsed ? /* @__PURE__ */ jsx(default_1$3, {}) : /* @__PURE__ */ jsx(default_1, {})
                  }
                ),
                /* @__PURE__ */ jsx(
                  Checkbox,
                  {
                    checked: column2.isVisible,
                    disabled: column2.disabled,
                    onChange: () => {
                      toggleColumnVisibilityScroll(column2.colId);
                    }
                  }
                ),
                /* @__PURE__ */ jsx("span", { ...dragProps, style: { cursor: "grab", display: "inline-flex" }, children: /* @__PURE__ */ jsx(DragIndicator, { className: "table-setting-scroll-columns-list-drag-icon" }) }),
                column2.headerName.charAt(0).toUpperCase() + column2.headerName.slice(1)
              ]
            }
          ),
          Array.isArray(column2.children) && column2.children.length > 0 && !isCollapsed && /* @__PURE__ */ jsx(
            "div",
            {
              style: {
                marginLeft: "20px",
                display: "flex",
                flexDirection: "column",
                gap: "4px",
                marginTop: "4px"
              },
              children: column2.children.map((child) => /* @__PURE__ */ jsx("div", { children: renderScrollColumn(child, level2 + 1) }, child.colId))
            }
          )
        ] }),
        onToggle: toggleScrollColumnCollapse
      },
      column.colId
    );
  };
  const renderFrozencolumn = (column, level = 0) => {
    const isCollapsed = collapsedFrozenColumns[column.colId] || false;
    return /* @__PURE__ */ jsx(
      SortableColumnItem,
      {
        column,
        dragIconClass: "table-setting-frozen-columns-list-drag-icon",
        level,
        renderFn: ({ column: column2, level: level2, dragProps, dragIconClass, onToggle }) => /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsxs(
            "div",
            {
              className: "table-setting-frozen-columns-list-item",
              style: { marginLeft: `${level2 * 20}px` },
              children: [
                Array.isArray(column2.children) && column2.children.length > 0 && /* @__PURE__ */ jsx(
                  IconButton,
                  {
                    style: { padding: "0px" },
                    onClick: (e) => {
                      e.stopPropagation();
                      toggleFrozenColumnCollapse(column2.colId);
                    },
                    children: isCollapsed ? /* @__PURE__ */ jsx(default_1$3, {}) : /* @__PURE__ */ jsx(default_1, {})
                  }
                ),
                /* @__PURE__ */ jsx(
                  Checkbox,
                  {
                    checked: column2.isVisible,
                    disabled: column2 == null ? void 0 : column2.disabled,
                    onChange: () => {
                      toggleColumnVisibilityFrozen(column2.colId);
                    }
                  }
                ),
                /* @__PURE__ */ jsx("span", { ...dragProps, style: { cursor: "grab", display: "inline-flex" }, children: /* @__PURE__ */ jsx(DragIndicator, { className: "table-setting-frozen-columns-list-drag-icon" }) }),
                column2.headerName.charAt(0).toUpperCase() + column2.headerName.slice(1)
              ]
            }
          ),
          Array.isArray(column2.children) && column2.children.length > 0 && !isCollapsed && /* @__PURE__ */ jsx(
            "div",
            {
              style: {
                marginLeft: "20px",
                display: "flex",
                flexDirection: "column",
                gap: "4px",
                marginTop: "4px"
              },
              children: column2.children.map((child) => /* @__PURE__ */ jsx("div", { children: renderFrozencolumn(child, level2 + 1) }, child.colId))
            }
          )
        ] }),
        onToggle: toggleFrozenColumnCollapse
      },
      column.colId
    );
  };
  const handleSaveAndApply = () => {
    var _a2, _b2;
    if (isEditView) {
      const newView2 = {
        ...editedView,
        viewName: inputValue,
        viewType: selectedViewType,
        isDefaultView,
        isActive: false
      };
      props.handleEditSaveView(newView2, editedView);
      if (!props.isSavingViewLoading) {
        setIsEditView(false);
        setEditedView(null);
        setOpenSaveViewModal(false);
        setInputValue("");
        setSelectedViewType((_a2 = props.saveViewCustomFilter) == null ? void 0 : _a2.selectedOption);
        setIsDefaultView(false);
      }
      return;
    }
    const newView = {
      viewName: inputValue,
      viewType: selectedViewType,
      isDefaultView,
      isActive: true
    };
    setSavedViewsOptions((prev) => [
      ...prev.map((view) => ({ ...view, isActive: false })),
      newView
    ]);
    setFilteredSavedViewsOptions((prev) => [
      ...prev.map((view) => ({ ...view, isActive: false })),
      newView
    ]);
    (_b2 = props.handleSaveAndApply) == null ? void 0 : _b2.call(props, newView, selectedSavedView == null ? void 0 : selectedSavedView.value);
  };
  useEffect(() => {
    var _a2;
    if (!props.isSavingViewLoading) {
      setOpenSaveViewModal(false);
      setSelectedSavedView(null);
      setInputValue("");
      setSelectedViewType((_a2 = props.saveViewCustomFilter) == null ? void 0 : _a2.selectedOption);
      setIsDefaultView(false);
      setOpenDeletePrompt(false);
      setDeleteView(null);
      setEditedView(null);
    }
  }, [props.isSavingViewLoading]);
  const handleEditView = (view, e) => {
    e.stopPropagation();
    e.preventDefault();
    setIsEditView(true);
    setOpenSaveViewModal(true);
    setInputValue(view.viewName);
    setSelectedViewType(view.viewType);
    setIsDefaultView(view.isDefaultView);
    setEditedView(view);
  };
  const handleCloseSaveViewModal = () => {
    var _a2;
    setOpenSaveViewModal(false);
    setSelectedSavedView(null);
    setInputValue("");
    setSelectedViewType((_a2 = props.saveViewCustomFilter) == null ? void 0 : _a2.selectedOption);
    setIsDefaultView(false);
    setIsEditView(false);
  };
  const handleSaveViewSearchChange = (e) => {
    setSaveViewSearchText(e.target.value);
    const filteredViews = savedViewsOptions.filter(
      (view) => view.viewName.toLowerCase().includes(e.target.value.toLowerCase())
    );
    setFilteredSavedViewsOptions(filteredViews);
  };
  const handleDeleteView = (view, e) => {
    e.stopPropagation();
    e.preventDefault();
    setOpenDeletePrompt(true);
    setDeleteView(view);
  };
  useEffect(() => {
    if (!props.isDeleteViewLoading) {
      setOpenDeletePrompt(false);
    }
  }, [props.isDeleteViewLoading]);
  useEffect(() => {
    if (selectedBadge === "All") {
      setFilteredSavedViewsOptions([...savedViewsOptions]);
    } else {
      setFilteredSavedViewsOptions(
        savedViewsOptions.filter((view) => view.viewType === selectedBadge)
      );
    }
  }, [selectedBadge, savedViewsOptions]);
  return /* @__PURE__ */ jsxs("div", { className: "table-setting-columns-settings", children: [
    props.isSaveViewEnabled && /* @__PURE__ */ jsxs("div", { className: "table-setting-save-view-container", children: [
      savedViewsOptions.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "save-view-icon-title", children: [
        /* @__PURE__ */ jsx("img", { alt: "save-view-icon", src: saveViewIcon }),
        /* @__PURE__ */ jsx("span", { className: "save-view-title", children: "No views saved yet" })
      ] }) : /* @__PURE__ */ jsxs("div", { className: "save-view-container-active-view", children: [
        /* @__PURE__ */ jsx(
          Badge,
          {
            color: "success",
            label: `${((_b = savedViewsOptions.find((view) => view.isActive)) == null ? void 0 : _b.viewName) || "Not Applicable"}`,
            variant: "stroke"
          }
        ),
        /* @__PURE__ */ jsx(
          Button,
          {
            icon: openSaveViewMenu ? /* @__PURE__ */ jsx(default_1, {}) : /* @__PURE__ */ jsx(default_1$1, {}),
            size: "small",
            variant: "tertiary",
            onClick: () => {
              setOpenSaveViewMenu(!openSaveViewMenu);
              setFilteredSavedViewsOptions([...savedViewsOptions]);
            }
          }
        )
      ] }),
      /* @__PURE__ */ jsx(
        Button,
        {
          size: "small",
          variant: "tertiary",
          onClick: () => {
            setOpenSaveViewModal(true);
          },
          children: "Save View"
        }
      )
    ] }),
    openSaveViewMenu && /* @__PURE__ */ jsxs("div", { className: "save-view-menu", children: [
      /* @__PURE__ */ jsxs("div", { className: "save-view-menu-title", children: [
        /* @__PURE__ */ jsx("span", { children: "Saved views" }),
        /* @__PURE__ */ jsxs("div", { className: "save-view-menu-default-view", children: [
          /* @__PURE__ */ jsx("img", { alt: "default-view-icon", src: defaultViewActiveIcon }),
          /* @__PURE__ */ jsx("span", { className: "save-view-menu-default-view-text", children: "Default" })
        ] })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "save-view-menu-view-type", children: [
        /* @__PURE__ */ jsx(
          Badge,
          {
            color: selectedBadge === "All" ? "info" : "default",
            label: "All",
            size: "small",
            variant: "stroke",
            onClick: () => {
              setSelectedBadge("All");
              setFilteredSavedViewsOptions([...savedViewsOptions]);
            }
          }
        ),
        (_d = (_c = props.saveViewCustomFilter) == null ? void 0 : _c.options) == null ? void 0 : _d.map((option) => /* @__PURE__ */ jsx(
          Badge,
          {
            color: selectedBadge === option.value ? "info" : "default",
            label: option.label,
            size: "small",
            variant: "stroke",
            onClick: () => {
              setSelectedBadge(option.value);
              setFilteredSavedViewsOptions(
                savedViewsOptions.filter((view) => view.viewType === option.value)
              );
            }
          }
        ))
      ] }),
      /* @__PURE__ */ jsx("div", { className: "save-view-menu-search-container", children: /* @__PURE__ */ jsx(
        Input,
        {
          leftIcon: /* @__PURE__ */ jsx(default_1$2, {}),
          placeholder: "Search here...",
          value: saveViewSearchText,
          onChange: handleSaveViewSearchChange
        }
      ) }),
      /* @__PURE__ */ jsx("div", { className: "save-view-menu-view-list-container", children: props.customRenderSaveViewContent ? props.customRenderSaveViewContent : filteredSavedViewsOptions.length > 0 && filteredSavedViewsOptions.map((view, idx) => /* @__PURE__ */ jsxs(
        "div",
        {
          className: `save-view-menu-view-list-item ${view.isActive ? "active" : ""}`,
          onClick: () => {
            setFilteredSavedViewsOptions(
              (prev) => prev.map((item) => {
                if (item.viewName === view.viewName) {
                  return {
                    ...item,
                    isActive: true
                  };
                }
                return {
                  ...item,
                  isActive: false
                };
              })
            );
            setSelectedView(view);
          },
          children: [
            /* @__PURE__ */ jsx("span", { className: "save-view-menu-view-list-item-name", children: view.viewName }),
            /* @__PURE__ */ jsxs("div", { className: "save-view-menu-view-list-item-actions", children: [
              (view == null ? void 0 : view.isEditable) && /* @__PURE__ */ jsx(
                "img",
                {
                  alt: "save-view-edit-icon",
                  src: saveViewEditIcon,
                  onClick: (e) => {
                    handleEditView(view, e);
                  }
                }
              ),
              (view == null ? void 0 : view.isDeletable) && /* @__PURE__ */ jsx(
                "img",
                {
                  alt: "save-view-delete-icon",
                  src: saveViewDeleteIcon,
                  onClick: (e) => {
                    handleDeleteView(view, e);
                  }
                }
              ),
              !(view == null ? void 0 : view.notReqDefaultView) && ((view == null ? void 0 : view.isDefaultView) ? /* @__PURE__ */ jsx(
                "img",
                {
                  alt: "default-view-icon",
                  className: "default-view-active-icon",
                  src: defaultViewActiveIcon,
                  onClick: (e) => {
                    e.stopPropagation();
                    e.preventDefault();
                    props.handleSetDefaultView(view);
                  }
                }
              ) : /* @__PURE__ */ jsx(
                "img",
                {
                  alt: "default-view-icon",
                  src: defaultViewIcon,
                  onClick: (e) => {
                    e.stopPropagation();
                    e.preventDefault();
                    props.handleSetDefaultView(view);
                  }
                }
              ))
            ] })
          ]
        },
        view.viewName + idx
      )) }),
      /* @__PURE__ */ jsx("hr", { className: "save-view-menu-view-list-item-divider" }),
      /* @__PURE__ */ jsxs("div", { className: "save-view-menu-footer", children: [
        /* @__PURE__ */ jsx(
          Button,
          {
            size: "medium",
            variant: "tertiary",
            onClick: () => {
              setOpenSaveViewMenu(false);
              setFilteredSavedViewsOptions([...savedViewsOptions]);
            },
            children: "Cancel"
          }
        ),
        /* @__PURE__ */ jsx(
          Button,
          {
            disabled: props.customRenderSaveViewContent,
            size: "medium",
            variant: "primary",
            onClick: () => {
              var _a2;
              (_a2 = props.handleSavedViewClick) == null ? void 0 : _a2.call(props, selectedView);
              updateColumnState();
              setOpenSaveViewMenu(false);
            },
            children: "Apply"
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsx(
      Modal,
      {
        className: "save-view-modal",
        height: "542px",
        open: openSaveViewModal,
        primaryButtonLabel: props.isSavingViewLoading ? "Saving..." : "Save",
        primaryButtonProps: {
          disabled: (inputValue === "" || savedViewsOptions.length >= props.maxSavedViews) && selectedSavedView === null || !isViewNameUnique(inputValue, selectedViewType, isDefaultView, savedViewsOptions) || props.isSavingViewLoading,
          loading: props.isSavingViewLoading,
          iconPlacement: "right"
        },
        secondaryButtonLabel: "Cancel",
        title: isEditView ? "Edit view" : "Save view",
        width: "422px",
        onClose: handleCloseSaveViewModal,
        onPrimaryButtonClick: handleSaveAndApply,
        onSecondaryButtonClick: handleCloseSaveViewModal,
        children: /* @__PURE__ */ jsxs("div", { className: "save-view-modal-children", children: [
          /* @__PURE__ */ jsx("div", { className: "save-view-modal-children-header", children: /* @__PURE__ */ jsx("span", { className: "save-view-modal-children-header-text", children: `${props.maxSavedViews - savedViewsOptions.length}/${props.maxSavedViews} views remaining` }) }),
          /* @__PURE__ */ jsxs("div", { className: "save-view-modal-children-body", children: [
            /* @__PURE__ */ jsx("div", { className: "save-view-modal-children-body-input", children: /* @__PURE__ */ jsx(
              Input,
              {
                label: "New view name",
                placeholder: "Enter here",
                value: inputValue,
                onChange: (e) => {
                  setInputValue(e.target.value);
                  setSelectedSavedView(null);
                }
              }
            ) }),
            /* @__PURE__ */ jsxs("div", { className: "save-view-modal-children-body-radio-group", children: [
              /* @__PURE__ */ jsx("span", { className: "save-view-modal-children-body-radio-group-text", children: "View type" }),
              /* @__PURE__ */ jsx(
                RadioButtonGroup,
                {
                  options: (_f = (_e = props.saveViewCustomFilter) == null ? void 0 : _e.options) == null ? void 0 : _f.filter(
                    (option) => !(option == null ? void 0 : option.notReqInSaveView)
                  ),
                  orientation: "row",
                  selectedOption: selectedViewType,
                  onChange: (event) => {
                    setSelectedViewType(event.target.value);
                  }
                }
              )
            ] }),
            /* @__PURE__ */ jsx("div", { className: "save-view-modal-children-body-checkbox", children: /* @__PURE__ */ jsx(
              Checkbox,
              {
                checked: isDefaultView,
                label: "Make it default view",
                onChange: () => {
                  setIsDefaultView(!isDefaultView);
                }
              }
            ) }),
            /* @__PURE__ */ jsx("div", { className: "save-view-modal-children-body-replace-view", children: /* @__PURE__ */ jsx("span", { children: "Or replace with saved view" }) }),
            /* @__PURE__ */ jsx("div", { className: "save-view-modal-children-body-replace-view-select", children: /* @__PURE__ */ jsx(
              Select,
              {
                withPortal: true,
                currentOptions: currentSaveViewOptions,
                initialOptions: currentSaveViewOptions,
                isDisabled: savedViewsOptions.length === 0 || inputValue !== "" || isEditView,
                isOpen,
                label: "Replace with",
                minWidth: "100%",
                selectedOptions: selectedSavedView,
                setCurrentOptions: setCurrentSaveViewOptions,
                setIsOpen,
                setSelectedOptions: setSelectedSavedView
              }
            ) })
          ] })
        ] })
      }
    ),
    /* @__PURE__ */ jsx(
      Prompt,
      {
        handleClose: (e) => {
          e.stopPropagation();
          setOpenDeletePrompt(false);
        },
        isOpen: openDeletePrompt,
        primaryButtonLabel: "Yes,Delete",
        primaryButtonProps: {
          loading: props.isDeleteViewLoading,
          iconPlacement: "right"
        },
        secondaryButtonLabel: "Cancel",
        title: "Delete, Are you sure?",
        variant: "error",
        onPrimaryButtonClick: (e) => {
          var _a2;
          e.stopPropagation();
          (_a2 = props.handleDeleteViewClick) == null ? void 0 : _a2.call(props, deleteView);
        },
        onSecondaryButtonClick: (e) => {
          e.stopPropagation();
          setOpenDeletePrompt(false);
        },
        children: props.deleteViewPromptText
      }
    ),
    /* @__PURE__ */ jsxs("div", { className: "table-setting-column-search-container", children: [
      /* @__PURE__ */ jsx(IconButton, { style: { padding: "5px" }, onClick: toggleColumnCollapse, children: collapsedColumn ? /* @__PURE__ */ jsx(default_1$3, {}) : /* @__PURE__ */ jsx(default_1, {}) }),
      /* @__PURE__ */ jsx(Checkbox, { checked: allColumnVisibility, onChange: onAllColumnCheckBoxChange }),
      /* @__PURE__ */ jsx(
        Input,
        {
          placeholder: "Search",
          rightIcon: /* @__PURE__ */ jsx(default_1$2, {}),
          value: searchText,
          onChange: handleSearchChange
        }
      )
    ] }),
    !collapsedColumn && /* @__PURE__ */ jsx(
      "div",
      {
        className: `table-setting-column-collapse-container ${props.isSaveViewEnabled ? "save-view-enabled" : ""}`,
        children: /* @__PURE__ */ jsx(
          DndContext,
          {
            collisionDetection: closestCenter,
            sensors,
            onDragEnd: handleDragEnd,
            children: /* @__PURE__ */ jsxs(SortableContext, { items: [...scrollableColumnOrder, ...frozenColumnOrder], children: [
              frozenColumn.length > 0 && !(frozenColumn.length === 1 && frozenColumn[0].headerName === "N/A") && /* @__PURE__ */ jsxs("div", { className: "table-setting-collapse-columns-container", children: [
                /* @__PURE__ */ jsx("h3", { children: "Frozen columns" }),
                /* @__PURE__ */ jsx("div", { className: "table-setting-frozen-columns-list", children: filteredFrozenColumns.map(
                  (column) => column.headerName !== "N/A" && renderFrozencolumn(column)
                ) })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "table-setting-scroll-columns-container", children: [
                /* @__PURE__ */ jsx("h3", { children: "Scrollable Columns" }),
                /* @__PURE__ */ jsxs("div", { className: "table-setting-scroll-main-column-list", children: [
                  /* @__PURE__ */ jsxs("div", { className: "table-setting-scroll-main-column", children: [
                    /* @__PURE__ */ jsx(IconButton, { style: { padding: "0px" }, onClick: toggleScrollableCollapse, children: collapsedScrollable ? /* @__PURE__ */ jsx(default_1$3, {}) : /* @__PURE__ */ jsx(default_1, {}) }),
                    /* @__PURE__ */ jsx(Checkbox, { checked: mainChecked, onChange: onMainCheckboxChange }),
                    "Main Column"
                  ] }),
                  /* @__PURE__ */ jsx("div", { className: "table-setting-scroll-inner-column-list", children: !collapsedScrollable && filteredScrollableColumns.map(
                    (column) => column.headerName !== "N/A" && renderScrollColumn(column)
                  ) })
                ] })
              ] })
            ] })
          }
        )
      }
    )
  ] });
});
const updateFontSizeOnToolPanel = (fontSizeType) => {
  let fontSize;
  switch (fontSizeType) {
    case "small":
      fontSize = "12px";
      break;
    case "medium":
      fontSize = "14px";
      break;
    case "large":
      fontSize = "16px";
      break;
    default:
      fontSize = "14px";
  }
  return fontSize;
};
export {
  Columns,
  freezeColumn,
  getMainMenuItems,
  onColMenuAutoAdjustClick,
  onColMenuFreezeClick,
  sortFunc,
  updateFontSizeOnToolPanel
};
