/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

require("../../_virtual/_rolldown/runtime.js");
const require_uuidv4 = require("../../global/js/utils/uuidv4.js");
const require_stateReducer = require("./Datagrid/addons/stateReducer.js");
const require_useSkeletonRows = require("./useSkeletonRows.js");
const require_useDefaultStringRenderer = require("./useDefaultStringRenderer.js");
const require_useRowRenderer = require("./useRowRenderer.js");
const require_useRowSize = require("./useRowSize.js");
const require_DatagridHeaderRow = require("./Datagrid/DatagridHeaderRow.js");
const require_useFlexResize = require("./useFlexResize.js");
const require_useFloatingScroll = require("./useFloatingScroll.js");
let react = require("react");
let react_table = require("react-table");
//#region src/components/Datagrid/useDatagrid.ts
/**
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const useDatagrid = (params, ...plugins) => {
	const defaultPlugins = [
		react_table.useFlexLayout,
		require_DatagridHeaderRow.default,
		require_useSkeletonRows.default,
		react_table.useResizeColumns,
		require_useRowRenderer.default,
		require_useDefaultStringRenderer.default,
		require_useRowSize.default,
		react_table.useFilters,
		react_table.useGlobalFilter,
		react_table.useSortBy,
		react_table.useExpanded
	];
	if (params.disableResizing) {
		const resizeIndex = defaultPlugins.findIndex((p) => p?.["pluginName"] === "useResizeColumns");
		defaultPlugins.splice(resizeIndex, 1);
	}
	const defaultEndPlugins = [
		react_table.usePagination,
		react_table.useRowSelect,
		require_useFlexResize.default,
		require_useFloatingScroll.default
	];
	const clientEndPlugins = params.endPlugins || [];
	const defaultColumn = { minWidth: 50 };
	return (0, react_table.useTable)({
		tableId: (0, react.useMemo)(() => require_uuidv4.default("datagrid-table-id"), []),
		...params,
		stateReducer: require_stateReducer.stateReducer,
		defaultColumn
	}, ...defaultPlugins, ...plugins, ...defaultEndPlugins, ...clientEndPlugins);
};
//#endregion
exports.default = useDatagrid;
