{"ast":null,"code":"import { createSelector } from '../../../utils/createSelector';\nimport { gridVisibleSortedRowEntriesSelector, gridVisibleSortedRowIdsSelector, gridVisibleSortedTopLevelRowEntriesSelector } from '../filter/gridFilterSelector';\nimport { gridRowTreeDepthSelector, gridRowTreeSelector } from '../rows/gridRowsSelector';\n/**\n * @category Pagination\n * @ignore - do not document.\n */\n\nexport const gridPaginationSelector = state => state.pagination;\n/**\n * Get the index of the page to render if the pagination is enabled\n * @category Pagination\n */\n\nexport const gridPageSelector = createSelector(gridPaginationSelector, pagination => pagination.page);\n/**\n * Get the maximum amount of rows to display on a single page if the pagination is enabled\n * @category Pagination\n */\n\nexport const gridPageSizeSelector = createSelector(gridPaginationSelector, pagination => pagination.pageSize);\n/**\n * Get the amount of pages needed to display all the rows if the pagination is enabled\n * @category Pagination\n */\n\nexport const gridPageCountSelector = createSelector(gridPaginationSelector, pagination => pagination.pageCount);\n/**\n * Get the index of the first and the last row to include in the current page if the pagination is enabled.\n * @category Pagination\n */\n\nexport const gridPaginationRowRangeSelector = createSelector(gridPaginationSelector, gridRowTreeSelector, gridRowTreeDepthSelector, gridVisibleSortedRowEntriesSelector, gridVisibleSortedTopLevelRowEntriesSelector, (pagination, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {\n const visibleTopLevelRowCount = visibleSortedTopLevelRowEntries.length;\n const topLevelFirstRowIndex = Math.min(pagination.pageSize * pagination.page, visibleTopLevelRowCount - 1);\n const topLevelLastRowIndex = Math.min(topLevelFirstRowIndex + pagination.pageSize - 1, visibleTopLevelRowCount - 1); // The range contains no element\n\n if (topLevelFirstRowIndex === -1 || topLevelLastRowIndex === -1) {\n return null;\n } // The tree is flat, there is no need to look for children\n\n if (rowTreeDepth < 2) {\n return {\n firstRowIndex: topLevelFirstRowIndex,\n lastRowIndex: topLevelLastRowIndex\n };\n }\n const topLevelFirstRow = visibleSortedTopLevelRowEntries[topLevelFirstRowIndex];\n const topLevelRowsInCurrentPageCount = topLevelLastRowIndex - topLevelFirstRowIndex + 1;\n const firstRowIndex = visibleSortedRowEntries.findIndex(row => row.id === topLevelFirstRow.id);\n let lastRowIndex = firstRowIndex;\n let topLevelRowAdded = 0;\n while (lastRowIndex < visibleSortedRowEntries.length && topLevelRowAdded <= topLevelRowsInCurrentPageCount) {\n const row = visibleSortedRowEntries[lastRowIndex];\n const depth = rowTree[row.id].depth;\n if (topLevelRowAdded < topLevelRowsInCurrentPageCount || depth > 0) {\n lastRowIndex += 1;\n }\n if (depth === 0) {\n topLevelRowAdded += 1;\n }\n }\n return {\n firstRowIndex,\n lastRowIndex: lastRowIndex - 1\n };\n});\n/**\n * Get the id and the model of each row to include in the current page if the pagination is enabled.\n * @category Pagination\n */\n\nexport const gridPaginatedVisibleSortedGridRowEntriesSelector = createSelector(gridVisibleSortedRowEntriesSelector, gridPaginationRowRangeSelector, (visibleSortedRowEntries, paginationRange) => {\n if (!paginationRange) {\n return [];\n }\n return visibleSortedRowEntries.slice(paginationRange.firstRowIndex, paginationRange.lastRowIndex + 1);\n});\n/**\n * Get the id of each row to include in the current page if the pagination is enabled.\n * @category Pagination\n */\n\nexport const gridPaginatedVisibleSortedGridRowIdsSelector = createSelector(gridVisibleSortedRowIdsSelector, gridPaginationRowRangeSelector, (visibleSortedRowIds, paginationRange) => {\n if (!paginationRange) {\n return [];\n }\n return visibleSortedRowIds.slice(paginationRange.firstRowIndex, paginationRange.lastRowIndex + 1);\n});","map":{"version":3,"names":["createSelector","gridVisibleSortedRowEntriesSelector","gridVisibleSortedRowIdsSelector","gridVisibleSortedTopLevelRowEntriesSelector","gridRowTreeDepthSelector","gridRowTreeSelector","gridPaginationSelector","state","pagination","gridPageSelector","page","gridPageSizeSelector","pageSize","gridPageCountSelector","pageCount","gridPaginationRowRangeSelector","rowTree","rowTreeDepth","visibleSortedRowEntries","visibleSortedTopLevelRowEntries","visibleTopLevelRowCount","length","topLevelFirstRowIndex","Math","min","topLevelLastRowIndex","firstRowIndex","lastRowIndex","topLevelFirstRow","topLevelRowsInCurrentPageCount","findIndex","row","id","topLevelRowAdded","depth","gridPaginatedVisibleSortedGridRowEntriesSelector","paginationRange","slice","gridPaginatedVisibleSortedGridRowIdsSelector","visibleSortedRowIds"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/x-data-grid/hooks/features/pagination/gridPaginationSelector.js"],"sourcesContent":["import { createSelector } from '../../../utils/createSelector';\nimport { gridVisibleSortedRowEntriesSelector, gridVisibleSortedRowIdsSelector, gridVisibleSortedTopLevelRowEntriesSelector } from '../filter/gridFilterSelector';\nimport { gridRowTreeDepthSelector, gridRowTreeSelector } from '../rows/gridRowsSelector';\n/**\n * @category Pagination\n * @ignore - do not document.\n */\n\nexport const gridPaginationSelector = state => state.pagination;\n/**\n * Get the index of the page to render if the pagination is enabled\n * @category Pagination\n */\n\nexport const gridPageSelector = createSelector(gridPaginationSelector, pagination => pagination.page);\n/**\n * Get the maximum amount of rows to display on a single page if the pagination is enabled\n * @category Pagination\n */\n\nexport const gridPageSizeSelector = createSelector(gridPaginationSelector, pagination => pagination.pageSize);\n/**\n * Get the amount of pages needed to display all the rows if the pagination is enabled\n * @category Pagination\n */\n\nexport const gridPageCountSelector = createSelector(gridPaginationSelector, pagination => pagination.pageCount);\n/**\n * Get the index of the first and the last row to include in the current page if the pagination is enabled.\n * @category Pagination\n */\n\nexport const gridPaginationRowRangeSelector = createSelector(gridPaginationSelector, gridRowTreeSelector, gridRowTreeDepthSelector, gridVisibleSortedRowEntriesSelector, gridVisibleSortedTopLevelRowEntriesSelector, (pagination, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {\n const visibleTopLevelRowCount = visibleSortedTopLevelRowEntries.length;\n const topLevelFirstRowIndex = Math.min(pagination.pageSize * pagination.page, visibleTopLevelRowCount - 1);\n const topLevelLastRowIndex = Math.min(topLevelFirstRowIndex + pagination.pageSize - 1, visibleTopLevelRowCount - 1); // The range contains no element\n\n if (topLevelFirstRowIndex === -1 || topLevelLastRowIndex === -1) {\n return null;\n } // The tree is flat, there is no need to look for children\n\n\n if (rowTreeDepth < 2) {\n return {\n firstRowIndex: topLevelFirstRowIndex,\n lastRowIndex: topLevelLastRowIndex\n };\n }\n\n const topLevelFirstRow = visibleSortedTopLevelRowEntries[topLevelFirstRowIndex];\n const topLevelRowsInCurrentPageCount = topLevelLastRowIndex - topLevelFirstRowIndex + 1;\n const firstRowIndex = visibleSortedRowEntries.findIndex(row => row.id === topLevelFirstRow.id);\n let lastRowIndex = firstRowIndex;\n let topLevelRowAdded = 0;\n\n while (lastRowIndex < visibleSortedRowEntries.length && topLevelRowAdded <= topLevelRowsInCurrentPageCount) {\n const row = visibleSortedRowEntries[lastRowIndex];\n const depth = rowTree[row.id].depth;\n\n if (topLevelRowAdded < topLevelRowsInCurrentPageCount || depth > 0) {\n lastRowIndex += 1;\n }\n\n if (depth === 0) {\n topLevelRowAdded += 1;\n }\n }\n\n return {\n firstRowIndex,\n lastRowIndex: lastRowIndex - 1\n };\n});\n/**\n * Get the id and the model of each row to include in the current page if the pagination is enabled.\n * @category Pagination\n */\n\nexport const gridPaginatedVisibleSortedGridRowEntriesSelector = createSelector(gridVisibleSortedRowEntriesSelector, gridPaginationRowRangeSelector, (visibleSortedRowEntries, paginationRange) => {\n if (!paginationRange) {\n return [];\n }\n\n return visibleSortedRowEntries.slice(paginationRange.firstRowIndex, paginationRange.lastRowIndex + 1);\n});\n/**\n * Get the id of each row to include in the current page if the pagination is enabled.\n * @category Pagination\n */\n\nexport const gridPaginatedVisibleSortedGridRowIdsSelector = createSelector(gridVisibleSortedRowIdsSelector, gridPaginationRowRangeSelector, (visibleSortedRowIds, paginationRange) => {\n if (!paginationRange) {\n return [];\n }\n\n return visibleSortedRowIds.slice(paginationRange.firstRowIndex, paginationRange.lastRowIndex + 1);\n});"],"mappings":"AAAA,SAASA,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,mCAAmC,EAAEC,+BAA+B,EAAEC,2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