"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SYSTEM_CHARTING_SET_CURRENT_CHART_MODELS = exports.SYSTEM_DATA_SET_SELECT = exports.DASHBOARD_REFRESH = exports.SYSTEM_LAYOUT_SHOW_NOT_ASSOCIATED_OBJECTS = exports.SYSTEM_DISABLE_DELETE_CONFIRMATION = exports.SYSTEM_FILTER_FORM_HIDE = exports.SYSTEM_QUICK_FILTER_BAR_HIDE = exports.SYSTEM_QUICK_FILTER_BAR_SHOW = exports.SYSTEM_SETTINGS_PANEL_SET = exports.SYSTEM_DATA_CHANGE_HISTORY_RESUME = exports.SYSTEM_DATA_CHANGE_HISTORY_SUSPEND = exports.SYSTEM_DATA_CHANGE_HISTORY_DISABLE = exports.SYSTEM_DATA_CHANGE_HISTORY_ENABLE = exports.SYSTEM_DATA_CHANGE_HISTORY_CLEAR_ROW = exports.SYSTEM_DATA_CHANGE_HISTORY_UNDO = exports.SYSTEM_DATA_CHANGE_HISTORY_ADD = exports.SYSTEM_LICENSE_DISABLE_PERSISTENCE = exports.SYSTEM_LICENSE_SHOW_WATERMARK = exports.SYSTEM_PROGRESS_INDICATOR_HIDE = exports.SYSTEM_PROGRESS_INDICATOR_SHOW = exports.SYSTEM_CELL_SUMMARY_CHANGE_OPERATION = exports.SYSTEM_CACHED_QUERY_ADD = exports.SYSTEM_SET_LAST_APPLIED_SHORTCUT = exports.SYSTEM_SET_NEW_COLUMN_LIST_ORDER = exports.SYSTEM_HIGHLIGHT_ROW_DELETE_ALL = exports.SYSTEM_HIGHLIGHT_ROWS_DELETE = exports.SYSTEM_HIGHLIGHT_ROW_DELETE = exports.SYSTEM_HIGHLIGHT_ROWS_ADD = exports.SYSTEM_HIGHLIGHT_ROW_ADD = exports.SYSTEM_HIGHLIGHT_CELL_DELETE_ALL = exports.SYSTEM_HIGHLIGHT_CELL_DELETE = exports.SYSTEM_HIGHLIGHT_CELL_ADD = exports.SYSTEM_BULK_UPDATE_CHANGE_VALUE = exports.SYSTEM_BULK_UPDATE_SET_PREVIEW = exports.SYSTEM_BULK_UPDATE_SET_VALID_SELECTION = exports.SYSTEM_BULK_UPDATE_CHECK_CELL_SELECTION = exports.SYSTEM_SMART_EDIT_CHANGE_OPERATION = exports.SYSTEM_SMART_EDIT_CHANGE_VALUE = exports.SYSTEM_SMARTEDIT_SET_PREVIEW = exports.SYSTEM_SMARTEDIT_SET_VALID_SELECTION = exports.SYSTEM_SMARTEDIT_FETCH_PREVIEW = exports.SYSTEM_SMARTEDIT_CHECK_CELL_SELECTION = exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL = exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE = exports.SYSTEM_STATUS_MESSAGE_INFO_ADD = exports.SYSTEM_ALERT_REMOVE_ROW_HIGHLIGHT = exports.SYSTEM_ALERT_REMOVE_CELL_HIGHLIGHT = exports.SYSTEM_ALERT_DELETE_ALL = exports.SYSTEM_ALERT_DELETE = exports.SYSTEM_ALERT_ADD = void 0;
exports.SystemSettingsPanelSet = exports.SystemDataChangeHistoryResume = exports.SystemDataChangeHistorySuspend = exports.SystemDataChangeHistoryDisable = exports.SystemDataChangeHistoryEnable = exports.SystemDataChangeHistoryClearRow = exports.SystemDataChangeHistoryUndo = exports.SystemDataChangeHistoryAdd = exports.SystemLicenseDisablePersistence = exports.SystemLicenseShowWatermark = exports.SystemProgressIndicatorHide = exports.SystemProgressIndicatorShow = exports.SystemCellSummaryChangeOperation = exports.SystemCachedQueryAdd = exports.SetLastAppliedShortcut = exports.SetNewColumnListOrder = exports.BulkUpdateChangeValue = exports.BulkUpdateSetPreview = exports.BulkUpdateSetValidSelection = exports.BulkUpdateCheckCellSelection = exports.SmartEditSetPreview = exports.SmartEditSetValidSelection = exports.SmartEditCheckCellSelection = exports.SmartEditChangeOperation = exports.SmartEditChangeValue = exports.SystemStatusMessageInfoDeleteAll = exports.SystemStatusMessageInfoDelete = exports.SystemStatusMessageInfoAdd = exports.SystemAlertRemoveRowHighlight = exports.SystemAlertRemoveCellHighlight = exports.SystemAlertDeleteAll = exports.SystemAlertDelete = exports.SystemAlertAdd = exports.SystemHighlightRowDeleteAll = exports.SystemHighlightRowsDelete = exports.SystemHighlightRowDelete = exports.SystemHighlightRowsAdd = exports.SystemHighlightRowAdd = exports.SystemHighlightCellDeleteAll = exports.SystemHighlightCellDelete = exports.SystemHighlightCellAdd = exports.DATA_IMPORT_COMPLETED = exports.SYSTEM_SUMMARY_ROW_SET = exports.SYSTEM_CELL_POPUP_EDIT_FOCUSED_ENTITY = exports.SYSTEM_CELL_POPUP_HIDE = exports.SYSTEM_CELL_POPUP_SHOW = exports.SYSTEM_VISUAL_EXPORT_END = exports.SYSTEM_VISUAL_EXPORT_BEGIN = exports.SYSTEM_SET_QUICK_SEARCH_FLOATING_VISIBILITY = exports.SYSTEM_SET_PREVIOUS_GROUPED_COLUMN_INDEX = void 0;
exports.SystemReducer = exports.DataImportCompleted = exports.SystemCommentsAndNotesFocusedEntitySelector = exports.SystemCommentsAndNotesEditModeSelector = exports.SystemCommentsAndNotesSelector = exports.SystemQuickSearchFloatingVisibilitySelector = exports.SystemPreviousGroupedColumnsSelector = exports.SystemDisableDeleteConfirmationSelector = exports.SystemCellPopupHide = exports.SystemRowSummarySet = exports.SystemCellPopupEditFocusedEntity = exports.SystemCellPopupShow = exports.SystemQuickSearchFloatingVisibility = exports.SystemVisualExportEnd = exports.SystemVisualExportBegin = exports.SystemDisableDeleteConfirmation = exports.SystemSetPreviousGroupedColumnsIndex = exports.SystemChartingCurrentChartModelsSelector = exports.SystemChartingSetCurrentChartModels = exports.SystemDataSetSelect = exports.SystemDashboardRefresh = exports.SystemLayoutShowNotAssociatedObjects = exports.SystemFilterFormHide = exports.SystemQuickFilterBarHide = exports.SystemQuickFilterBarShow = void 0;
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
const Enums_1 = require("../../PredefinedConfig/Common/Enums");
const Helper_1 = require("../../Utilities/Helpers/Helper");
const CellPopupService_1 = require("../../Utilities/Services/CellPopupService");
/*
Bit of a mixed bag of actions but essentially its those that are related to Strategies but where we DONT want to persist state
This allows us to keep the other reducers pure in terms of everything persists
Not sure if its a good idea or not and perhaps we need 2 stores but I think its better than it was...
*/
// Alerts
exports.SYSTEM_ALERT_ADD = 'SYSTEM_ALERT_ADD';
exports.SYSTEM_ALERT_DELETE = 'SYSTEM_ALERT_DELETE';
exports.SYSTEM_ALERT_DELETE_ALL = 'SYSTEM_ALERT_DELETE_ALL';
exports.SYSTEM_ALERT_REMOVE_CELL_HIGHLIGHT = 'SYSTEM_ALERT_REMOVE_CELL_HIGHLIGHT';
exports.SYSTEM_ALERT_REMOVE_ROW_HIGHLIGHT = 'SYSTEM_ALERT_REMOVE_ROW_HIGHLIGHT';
// Status Message
exports.SYSTEM_STATUS_MESSAGE_INFO_ADD = 'SYSTEM_STATUS_MESSAGE_INFO_ADD';
exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE = 'SYSTEM_STATUS_MESSAGE_INFO_DELETE';
exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL = 'SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL';
// Smart Edit
exports.SYSTEM_SMARTEDIT_CHECK_CELL_SELECTION = 'SYSTEM_SMARTEDIT_CHECK_CELL_SELECTION';
exports.SYSTEM_SMARTEDIT_FETCH_PREVIEW = 'SYSTEM_SMARTEDIT_FETCH_PREVIEW';
exports.SYSTEM_SMARTEDIT_SET_VALID_SELECTION = 'SYSTEM_SMARTEDIT_SET_VALID_SELECTION';
exports.SYSTEM_SMARTEDIT_SET_PREVIEW = 'SYSTEM_SMARTEDIT_SET_PREVIEW';
exports.SYSTEM_SMART_EDIT_CHANGE_VALUE = 'SYSTEM_SMART_EDIT_CHANGE_VALUE';
exports.SYSTEM_SMART_EDIT_CHANGE_OPERATION = 'SYSTEM_SMART_EDIT_CHANGE_OPERATION';
// Bulk Update
exports.SYSTEM_BULK_UPDATE_CHECK_CELL_SELECTION = 'SYSTEM_BULK_UPDATE_CHECK_CELL_SELECTION';
exports.SYSTEM_BULK_UPDATE_SET_VALID_SELECTION = 'SYSTEM_BULK_UPDATE_SET_VALID_SELECTION';
exports.SYSTEM_BULK_UPDATE_SET_PREVIEW = 'SYSTEM_BULK_UPDATE_SET_PREVIEW';
exports.SYSTEM_BULK_UPDATE_CHANGE_VALUE = 'SYSTEM_BULK_UPDATE_CHANGE_VALUE';
// Cell Highlight
exports.SYSTEM_HIGHLIGHT_CELL_ADD = 'SYSTEM_HIGHLIGHT_CELL_ADD';
exports.SYSTEM_HIGHLIGHT_CELL_DELETE = 'SYSTEM_HIGHLIGHT_CELL_DELETE';
exports.SYSTEM_HIGHLIGHT_CELL_DELETE_ALL = 'SYSTEM_HIGHLIGHT_CELL_DELETE_ALL';
// Rows Highlight
exports.SYSTEM_HIGHLIGHT_ROW_ADD = 'SYSTEM_HIGHLIGHT_ROW_ADD';
exports.SYSTEM_HIGHLIGHT_ROWS_ADD = 'SYSTEM_HIGHLIGHT_ROWS_ADD';
exports.SYSTEM_HIGHLIGHT_ROW_DELETE = 'SYSTEM_HIGHLIGHT_ROW_DELETE';
exports.SYSTEM_HIGHLIGHT_ROWS_DELETE = 'SYSTEM_HIGHLIGHT_ROWS_DELETE';
exports.SYSTEM_HIGHLIGHT_ROW_DELETE_ALL = 'SYSTEM_HIGHLIGHT_ROW_DELETE_ALL';
// Columns
exports.SYSTEM_SET_NEW_COLUMN_LIST_ORDER = 'SYSTEM_SET_NEW_COLUMN_LIST_ORDER';
// Shortcut
exports.SYSTEM_SET_LAST_APPLIED_SHORTCUT = 'SYSTEM_SET_LAST_APPLIED_SHORTCUT';
// Cached Queries
exports.SYSTEM_CACHED_QUERY_ADD = 'SYSTEM_CACHED_QUERY_ADD';
// Cell Summary
exports.SYSTEM_CELL_SUMMARY_CHANGE_OPERATION = 'SYSTEM_CELL_SUMMARY_CHANGE_OPERATION';
// Progress Indicator
exports.SYSTEM_PROGRESS_INDICATOR_SHOW = 'SYSTEM_PROGRESS_INDICATOR_SHOW';
exports.SYSTEM_PROGRESS_INDICATOR_HIDE = 'SYSTEM_PROGRESS_INDICATOR_HIDE';
exports.SYSTEM_LICENSE_SHOW_WATERMARK = 'SYSTEM_LICENSE_SHOW_WATERMARK';
exports.SYSTEM_LICENSE_DISABLE_PERSISTENCE = 'SYSTEM_LICENSE_DISABLE_PERSISTENCE';
// Change History
exports.SYSTEM_DATA_CHANGE_HISTORY_ADD = 'SYSTEM_DATA_CHANGE_HISTORY_ADD';
exports.SYSTEM_DATA_CHANGE_HISTORY_UNDO = 'SYSTEM_DATA_CHANGE_HISTORY_UNDO';
exports.SYSTEM_DATA_CHANGE_HISTORY_CLEAR_ROW = 'SYSTEM_DATA_CHANGE_HISTORY_CLEAR_ROW';
exports.SYSTEM_DATA_CHANGE_HISTORY_ENABLE = 'SYSTEM_DATA_CHANGE_HISTORY_ENABLE';
exports.SYSTEM_DATA_CHANGE_HISTORY_DISABLE = 'SYSTEM_DATA_CHANGE_HISTORY_DISABLE';
exports.SYSTEM_DATA_CHANGE_HISTORY_SUSPEND = 'SYSTEM_DATA_CHANGE_HISTORY_SUSPEND';
exports.SYSTEM_DATA_CHANGE_HISTORY_RESUME = 'SYSTEM_DATA_CHANGE_HISTORY_RESUME';
// Settings panel
exports.SYSTEM_SETTINGS_PANEL_SET = 'SYSTEM_SETTINGS_PANEL_SET';
// Quick Filter
exports.SYSTEM_QUICK_FILTER_BAR_SHOW = 'SYSTEM_QUICK_FILTER_BAR_SHOW';
exports.SYSTEM_QUICK_FILTER_BAR_HIDE = 'SYSTEM_QUICK_FILTER_BAR_HIDE';
exports.SYSTEM_FILTER_FORM_HIDE = 'SYSTEM_FILTER_FORM_HIDE';
// Delete warning
exports.SYSTEM_DISABLE_DELETE_CONFIRMATION = 'SYSTEM_DISABLE_DELETE_CONFIRMATION';
// Layout
exports.SYSTEM_LAYOUT_SHOW_NOT_ASSOCIATED_OBJECTS = 'SYSTEM_LAYOUT_SHOW_NOT_ASSOCIATED_OBJECTS';
exports.DASHBOARD_REFRESH = 'DASHBOARD_REFRESH';
// DataSet
exports.SYSTEM_DATA_SET_SELECT = 'SYSTEM_DATA_SET_SELECT';
// Charting
exports.SYSTEM_CHARTING_SET_CURRENT_CHART_MODELS = 'SYSTEM_CHARTING_SET_CURRENT_CHART_MODELS';
// Layout
exports.SYSTEM_SET_PREVIOUS_GROUPED_COLUMN_INDEX = 'SYSTEM_SET_PREVIOUS_GROUPED_COLUMN_INDEX';
// Quick Search
exports.SYSTEM_SET_QUICK_SEARCH_FLOATING_VISIBILITY = 'SYSTEM_SET_QUICK_SEARCH_FLOATING_VISIBILITY';
// Data Export (Report)
exports.SYSTEM_VISUAL_EXPORT_BEGIN = 'SYSTEM_VISUAL_EXPORT_BEGIN';
exports.SYSTEM_VISUAL_EXPORT_END = 'SYSTEM_VISUAL_EXPORT_END';
// Notes and Comments
exports.SYSTEM_CELL_POPUP_SHOW = 'SYSTEM_CELL_POPUP_SHOW';
exports.SYSTEM_CELL_POPUP_HIDE = 'SYSTEM_CELL_POPUP_HIDE';
exports.SYSTEM_CELL_POPUP_EDIT_FOCUSED_ENTITY = 'SYSTEM_CELL_POPUP_EDIT_FOCUSED_ENTITY';
// Row Summaries
exports.SYSTEM_SUMMARY_ROW_SET = 'SYSTEM_SUMMARY_ROW_SET';
// Data Import
exports.DATA_IMPORT_COMPLETED = 'DATA_IMPORT_COMPLETED';
const SystemHighlightCellAdd = (cellHighlightInfo) => ({
    type: exports.SYSTEM_HIGHLIGHT_CELL_ADD,
    cellHighlightInfo: cellHighlightInfo,
});
exports.SystemHighlightCellAdd = SystemHighlightCellAdd;
const SystemHighlightCellDelete = (primaryKeyValue, columnId) => ({
    type: exports.SYSTEM_HIGHLIGHT_CELL_DELETE,
    primaryKeyValue,
    columnId,
});
exports.SystemHighlightCellDelete = SystemHighlightCellDelete;
const SystemHighlightCellDeleteAll = () => ({
    type: exports.SYSTEM_HIGHLIGHT_CELL_DELETE_ALL,
});
exports.SystemHighlightCellDeleteAll = SystemHighlightCellDeleteAll;
const SystemHighlightRowAdd = (rowHighlightInfo) => ({
    type: exports.SYSTEM_HIGHLIGHT_ROW_ADD,
    rowHighlightInfo: rowHighlightInfo,
});
exports.SystemHighlightRowAdd = SystemHighlightRowAdd;
const SystemHighlightRowsAdd = (rowsHighlightInfo) => ({
    type: exports.SYSTEM_HIGHLIGHT_ROWS_ADD,
    rowsHighlightInfo: rowsHighlightInfo,
});
exports.SystemHighlightRowsAdd = SystemHighlightRowsAdd;
const SystemHighlightRowDelete = (primaryKeyValue) => ({
    type: exports.SYSTEM_HIGHLIGHT_ROW_DELETE,
    primaryKeyValue: primaryKeyValue,
});
exports.SystemHighlightRowDelete = SystemHighlightRowDelete;
const SystemHighlightRowsDelete = (primaryKeyValues) => ({
    type: exports.SYSTEM_HIGHLIGHT_ROWS_DELETE,
    primaryKeyValues: primaryKeyValues,
});
exports.SystemHighlightRowsDelete = SystemHighlightRowsDelete;
const SystemHighlightRowDeleteAll = () => ({
    type: exports.SYSTEM_HIGHLIGHT_ROW_DELETE_ALL,
});
exports.SystemHighlightRowDeleteAll = SystemHighlightRowDeleteAll;
const SystemAlertAdd = (alert, maxAlerts) => ({
    type: exports.SYSTEM_ALERT_ADD,
    alert: alert,
    maxAlerts: maxAlerts,
});
exports.SystemAlertAdd = SystemAlertAdd;
const SystemAlertDelete = (alert) => ({
    type: exports.SYSTEM_ALERT_DELETE,
    alert: alert,
});
exports.SystemAlertDelete = SystemAlertDelete;
const SystemAlertDeleteAll = (alerts) => ({
    type: exports.SYSTEM_ALERT_DELETE_ALL,
    alerts: alerts,
});
exports.SystemAlertDeleteAll = SystemAlertDeleteAll;
const SystemAlertRemoveCellHighlight = (alert) => ({
    type: exports.SYSTEM_ALERT_REMOVE_CELL_HIGHLIGHT,
    alert: alert,
});
exports.SystemAlertRemoveCellHighlight = SystemAlertRemoveCellHighlight;
const SystemAlertRemoveRowHighlight = (alert) => ({
    type: exports.SYSTEM_ALERT_REMOVE_ROW_HIGHLIGHT,
    alert: alert,
});
exports.SystemAlertRemoveRowHighlight = SystemAlertRemoveRowHighlight;
const SystemStatusMessageInfoAdd = (SystemStatusMessageInfo, MaxSystemStatusMessagesInStore) => ({
    type: exports.SYSTEM_STATUS_MESSAGE_INFO_ADD,
    systemStatusMessageInfo: SystemStatusMessageInfo,
    maxSystemStatusMessagesInStore: MaxSystemStatusMessagesInStore,
});
exports.SystemStatusMessageInfoAdd = SystemStatusMessageInfoAdd;
const SystemStatusMessageInfoDelete = (SystemStatusMessageInfo) => ({
    type: exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE,
    systemStatusMessageInfo: SystemStatusMessageInfo,
});
exports.SystemStatusMessageInfoDelete = SystemStatusMessageInfoDelete;
const SystemStatusMessageInfoDeleteAll = () => ({
    type: exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL,
});
exports.SystemStatusMessageInfoDeleteAll = SystemStatusMessageInfoDeleteAll;
const SmartEditChangeValue = (value) => ({
    type: exports.SYSTEM_SMART_EDIT_CHANGE_VALUE,
    value,
});
exports.SmartEditChangeValue = SmartEditChangeValue;
const SmartEditChangeOperation = (smartEditOperation) => ({
    type: exports.SYSTEM_SMART_EDIT_CHANGE_OPERATION,
    smartEditOperation,
});
exports.SmartEditChangeOperation = SmartEditChangeOperation;
const SmartEditCheckCellSelection = () => ({
    type: exports.SYSTEM_SMARTEDIT_CHECK_CELL_SELECTION,
});
exports.SmartEditCheckCellSelection = SmartEditCheckCellSelection;
const SmartEditSetValidSelection = (IsValidSmartEditSelection) => ({
    type: exports.SYSTEM_SMARTEDIT_SET_VALID_SELECTION,
    isValidSmartEditSelection: IsValidSmartEditSelection,
});
exports.SmartEditSetValidSelection = SmartEditSetValidSelection;
const SmartEditSetPreview = (SmartEditPreviewInfo) => ({
    type: exports.SYSTEM_SMARTEDIT_SET_PREVIEW,
    smartEditPreviewInfo: SmartEditPreviewInfo,
});
exports.SmartEditSetPreview = SmartEditSetPreview;
const BulkUpdateCheckCellSelection = () => ({
    type: exports.SYSTEM_BULK_UPDATE_CHECK_CELL_SELECTION,
});
exports.BulkUpdateCheckCellSelection = BulkUpdateCheckCellSelection;
const BulkUpdateSetValidSelection = (bulkUpdateValidationResult) => ({
    type: exports.SYSTEM_BULK_UPDATE_SET_VALID_SELECTION,
    bulkUpdateValidationResult,
});
exports.BulkUpdateSetValidSelection = BulkUpdateSetValidSelection;
const BulkUpdateSetPreview = (BulkUpdatePreviewInfo) => ({
    type: exports.SYSTEM_BULK_UPDATE_SET_PREVIEW,
    bulkUpdatePreviewInfo: BulkUpdatePreviewInfo,
});
exports.BulkUpdateSetPreview = BulkUpdateSetPreview;
const BulkUpdateChangeValue = (bulkUpdateValue) => ({
    type: exports.SYSTEM_BULK_UPDATE_CHANGE_VALUE,
    bulkUpdateValue,
});
exports.BulkUpdateChangeValue = BulkUpdateChangeValue;
const SetNewColumnListOrder = (VisibleColumnList) => ({
    type: exports.SYSTEM_SET_NEW_COLUMN_LIST_ORDER,
    visibleColumnList: VisibleColumnList,
});
exports.SetNewColumnListOrder = SetNewColumnListOrder;
const SetLastAppliedShortcut = (gridCell) => ({
    type: exports.SYSTEM_SET_LAST_APPLIED_SHORTCUT,
    gridCell,
});
exports.SetLastAppliedShortcut = SetLastAppliedShortcut;
const SystemCachedQueryAdd = (cachedQuery) => ({
    type: exports.SYSTEM_CACHED_QUERY_ADD,
    cachedQuery,
});
exports.SystemCachedQueryAdd = SystemCachedQueryAdd;
const SystemCellSummaryChangeOperation = (cellSummaryOperation) => ({
    type: exports.SYSTEM_CELL_SUMMARY_CHANGE_OPERATION,
    cellSummaryOperation: cellSummaryOperation,
});
exports.SystemCellSummaryChangeOperation = SystemCellSummaryChangeOperation;
const SystemProgressIndicatorShow = (progressIndicatorConfig) => ({
    type: exports.SYSTEM_PROGRESS_INDICATOR_SHOW,
    progressIndicatorConfig: progressIndicatorConfig,
});
exports.SystemProgressIndicatorShow = SystemProgressIndicatorShow;
const SystemProgressIndicatorHide = () => ({
    type: exports.SYSTEM_PROGRESS_INDICATOR_HIDE,
});
exports.SystemProgressIndicatorHide = SystemProgressIndicatorHide;
const SystemLicenseShowWatermark = (text) => ({
    type: exports.SYSTEM_LICENSE_SHOW_WATERMARK,
    text,
});
exports.SystemLicenseShowWatermark = SystemLicenseShowWatermark;
const SystemLicenseDisablePersistence = () => ({
    type: exports.SYSTEM_LICENSE_DISABLE_PERSISTENCE,
});
exports.SystemLicenseDisablePersistence = SystemLicenseDisablePersistence;
const SystemDataChangeHistoryAdd = (changeInfo, uniqueKey) => ({
    type: exports.SYSTEM_DATA_CHANGE_HISTORY_ADD,
    changeInfo,
    uniqueKey,
});
exports.SystemDataChangeHistoryAdd = SystemDataChangeHistoryAdd;
const SystemDataChangeHistoryUndo = (changeInfo, uniqueKey) => ({
    type: exports.SYSTEM_DATA_CHANGE_HISTORY_UNDO,
    changeInfo,
    uniqueKey,
});
exports.SystemDataChangeHistoryUndo = SystemDataChangeHistoryUndo;
const SystemDataChangeHistoryClearRow = (changeInfo, uniqueKey) => ({
    type: exports.SYSTEM_DATA_CHANGE_HISTORY_CLEAR_ROW,
    changeInfo,
    uniqueKey,
});
exports.SystemDataChangeHistoryClearRow = SystemDataChangeHistoryClearRow;
const SystemDataChangeHistoryEnable = () => ({
    type: exports.SYSTEM_DATA_CHANGE_HISTORY_ENABLE,
});
exports.SystemDataChangeHistoryEnable = SystemDataChangeHistoryEnable;
const SystemDataChangeHistoryDisable = () => ({
    type: exports.SYSTEM_DATA_CHANGE_HISTORY_DISABLE,
});
exports.SystemDataChangeHistoryDisable = SystemDataChangeHistoryDisable;
const SystemDataChangeHistorySuspend = () => ({
    type: exports.SYSTEM_DATA_CHANGE_HISTORY_SUSPEND,
});
exports.SystemDataChangeHistorySuspend = SystemDataChangeHistorySuspend;
const SystemDataChangeHistoryResume = () => ({
    type: exports.SYSTEM_DATA_CHANGE_HISTORY_RESUME,
});
exports.SystemDataChangeHistoryResume = SystemDataChangeHistoryResume;
const SystemSettingsPanelSet = (name, settings) => ({
    type: exports.SYSTEM_SETTINGS_PANEL_SET,
    name,
    settings,
});
exports.SystemSettingsPanelSet = SystemSettingsPanelSet;
const SystemQuickFilterBarShow = () => ({
    type: exports.SYSTEM_QUICK_FILTER_BAR_SHOW,
});
exports.SystemQuickFilterBarShow = SystemQuickFilterBarShow;
const SystemQuickFilterBarHide = () => ({
    type: exports.SYSTEM_QUICK_FILTER_BAR_HIDE,
});
exports.SystemQuickFilterBarHide = SystemQuickFilterBarHide;
const SystemFilterFormHide = () => ({
    type: exports.SYSTEM_FILTER_FORM_HIDE,
});
exports.SystemFilterFormHide = SystemFilterFormHide;
const SystemLayoutShowNotAssociatedObjects = (showNotAssociatedObjects) => ({
    type: exports.SYSTEM_LAYOUT_SHOW_NOT_ASSOCIATED_OBJECTS,
    showNotAssociatedObjects,
});
exports.SystemLayoutShowNotAssociatedObjects = SystemLayoutShowNotAssociatedObjects;
const SystemDashboardRefresh = () => ({
    type: exports.DASHBOARD_REFRESH,
});
exports.SystemDashboardRefresh = SystemDashboardRefresh;
const SystemDataSetSelect = (dataSet) => ({
    type: exports.SYSTEM_DATA_SET_SELECT,
    dataSet: dataSet,
});
exports.SystemDataSetSelect = SystemDataSetSelect;
const SystemChartingSetCurrentChartModels = (chartModels) => ({
    type: exports.SYSTEM_CHARTING_SET_CURRENT_CHART_MODELS,
    chartModels,
});
exports.SystemChartingSetCurrentChartModels = SystemChartingSetCurrentChartModels;
const SystemChartingCurrentChartModelsSelector = (state) => {
    return state.Charting.currentChartModels;
};
exports.SystemChartingCurrentChartModelsSelector = SystemChartingCurrentChartModelsSelector;
const SystemSetPreviousGroupedColumnsIndex = (layoutId, columnId, columnIndex) => ({
    type: exports.SYSTEM_SET_PREVIOUS_GROUPED_COLUMN_INDEX,
    layoutId,
    columnId,
    columnIndex,
});
exports.SystemSetPreviousGroupedColumnsIndex = SystemSetPreviousGroupedColumnsIndex;
const SystemDisableDeleteConfirmation = () => ({
    type: exports.SYSTEM_DISABLE_DELETE_CONFIRMATION,
});
exports.SystemDisableDeleteConfirmation = SystemDisableDeleteConfirmation;
const SystemVisualExportBegin = () => ({
    type: exports.SYSTEM_VISUAL_EXPORT_BEGIN,
});
exports.SystemVisualExportBegin = SystemVisualExportBegin;
const SystemVisualExportEnd = () => ({
    type: exports.SYSTEM_VISUAL_EXPORT_END,
});
exports.SystemVisualExportEnd = SystemVisualExportEnd;
const SystemQuickSearchFloatingVisibility = (visible) => ({
    type: exports.SYSTEM_SET_QUICK_SEARCH_FLOATING_VISIBILITY,
    visible,
});
exports.SystemQuickSearchFloatingVisibility = SystemQuickSearchFloatingVisibility;
const SystemCellPopupShow = (cellPosition, editMode) => ({
    type: exports.SYSTEM_CELL_POPUP_SHOW,
    editMode,
    cellPosition,
});
exports.SystemCellPopupShow = SystemCellPopupShow;
const SystemCellPopupEditFocusedEntity = (focusedEntity) => ({
    type: exports.SYSTEM_CELL_POPUP_EDIT_FOCUSED_ENTITY,
    focusedEntity,
});
exports.SystemCellPopupEditFocusedEntity = SystemCellPopupEditFocusedEntity;
const SystemRowSummarySet = (systemRowSummaries) => ({
    type: exports.SYSTEM_SUMMARY_ROW_SET,
    rowSummaries: systemRowSummaries,
});
exports.SystemRowSummarySet = SystemRowSummarySet;
const SystemCellPopupHide = () => ({
    type: exports.SYSTEM_CELL_POPUP_HIDE,
});
exports.SystemCellPopupHide = SystemCellPopupHide;
const SystemDisableDeleteConfirmationSelector = (state) => {
    return state.DisableDeleteConfirmation;
};
exports.SystemDisableDeleteConfirmationSelector = SystemDisableDeleteConfirmationSelector;
const SystemPreviousGroupedColumnsSelector = (state) => {
    return state.Layout.previousGroupedColumns;
};
exports.SystemPreviousGroupedColumnsSelector = SystemPreviousGroupedColumnsSelector;
const SystemQuickSearchFloatingVisibilitySelector = (state) => {
    var _a;
    return (_a = state === null || state === void 0 ? void 0 : state.QuickSearch) === null || _a === void 0 ? void 0 : _a.floatingVisible;
};
exports.SystemQuickSearchFloatingVisibilitySelector = SystemQuickSearchFloatingVisibilitySelector;
const SystemCommentsAndNotesSelector = (state) => {
    var _a;
    return (_a = state === null || state === void 0 ? void 0 : state.NotesAndComments) === null || _a === void 0 ? void 0 : _a.popupPosition;
};
exports.SystemCommentsAndNotesSelector = SystemCommentsAndNotesSelector;
const SystemCommentsAndNotesEditModeSelector = (state) => {
    var _a;
    return (_a = state === null || state === void 0 ? void 0 : state.NotesAndComments) === null || _a === void 0 ? void 0 : _a.editMode;
};
exports.SystemCommentsAndNotesEditModeSelector = SystemCommentsAndNotesEditModeSelector;
const SystemCommentsAndNotesFocusedEntitySelector = (state) => {
    var _a;
    return (_a = state === null || state === void 0 ? void 0 : state.NotesAndComments) === null || _a === void 0 ? void 0 : _a.focusedEntity;
};
exports.SystemCommentsAndNotesFocusedEntitySelector = SystemCommentsAndNotesFocusedEntitySelector;
const DataImportCompleted = (dataImportedInfo) => ({
    type: exports.DATA_IMPORT_COMPLETED,
    dataImportedInfo: dataImportedInfo,
});
exports.DataImportCompleted = DataImportCompleted;
const initialState = {
    AdaptableAlerts: GeneralConstants_1.EMPTY_ARRAY,
    SystemStatusMessages: GeneralConstants_1.EMPTY_ARRAY,
    HighlightedCells: GeneralConstants_1.EMPTY_ARRAY,
    HighlightedRows: GeneralConstants_1.EMPTY_ARRAY,
    IsValidSmartEditSelection: false,
    SmartEditPreviewInfo: null,
    BulkUpdateValidationResult: { IsValid: false, Column: null },
    BulkUpdatePreviewInfo: null,
    CalculatedColumnErrorMessage: GeneralConstants_1.EMPTY_STRING,
    ReportErrorMessage: GeneralConstants_1.EMPTY_STRING,
    LastAppliedShortCut: null,
    CachedQueries: GeneralConstants_1.EMPTY_ARRAY,
    BulkUpdateValue: GeneralConstants_1.EMPTY_STRING,
    SmartEditValue: 1,
    SmartEditOperation: Enums_1.MathOperation.Multiply,
    CellSummaryOperation: GeneralConstants_1.CELL_SUMMARY_DEFAULT_OPERATION,
    ProgressIndicator: { active: false, text: '' },
    License: {
        watermark: { show: false, text: null },
        disablePersistence: false,
    },
    DataChangeHistory: {
        logs: {},
        currentMode: 'INACTIVE',
        enableTime: null,
        suspendTime: null,
    },
    SettingsPanel: {},
    ShowLayoutNotAssociatedObjects: false,
    DashboardRevision: 1,
    IsQuickFilterVisible: true,
    CurrentDataSet: GeneralConstants_1.EMPTY_STRING,
    Charting: {
        currentChartModels: [],
        externalChartingDefinitions: [],
    },
    Layout: {
        previousGroupedColumns: {},
    },
    DisableDeleteConfirmation: false,
    Export: {
        visualDataExportInProgress: false,
    },
};
const SystemReducer = (state = initialState, action) => {
    var _a;
    let alerts;
    let systemStatusMessages;
    switch (action.type) {
        case exports.SYSTEM_ALERT_ADD: {
            const actionTypedAdd = action;
            alerts = [].concat(state.AdaptableAlerts);
            if (alerts.length == actionTypedAdd.maxAlerts) {
                // we have hit the maximum so remove first item (oldest)
                alerts.splice(0, 1);
            }
            alerts.push(actionTypedAdd.alert);
            return Object.assign({}, state, { AdaptableAlerts: alerts });
        }
        case exports.SYSTEM_ALERT_DELETE: {
            const adaptableAlert = action.alert;
            return Object.assign(Object.assign({}, state), { AdaptableAlerts: state.AdaptableAlerts.filter((abObject) => abObject.Uuid !== adaptableAlert.Uuid) });
        }
        case exports.SYSTEM_ALERT_DELETE_ALL: {
            return Object.assign({}, state, { AdaptableAlerts: [] });
        }
        case exports.SYSTEM_ALERT_REMOVE_CELL_HIGHLIGHT: {
            const adaptableAlert = action.alert;
            return Object.assign(Object.assign({}, state), { AdaptableAlerts: state.AdaptableAlerts.map((abObject) => {
                    if (abObject.Uuid === adaptableAlert.Uuid) {
                        // AdaptableAlerts are still linked to the live AlertDefinitions, so we have to decouple them
                        const newAbObject = Object.assign({}, abObject);
                        newAbObject.alertDefinition = (0, Helper_1.cloneObject)(abObject.alertDefinition);
                        delete newAbObject.alertDefinition.AlertProperties.HighlightCell;
                        return newAbObject;
                    }
                    return abObject;
                }) });
        }
        case exports.SYSTEM_ALERT_REMOVE_ROW_HIGHLIGHT: {
            const adaptableAlert = action.alert;
            return Object.assign(Object.assign({}, state), { AdaptableAlerts: state.AdaptableAlerts.map((abObject) => {
                    if (abObject.Uuid === adaptableAlert.Uuid) {
                        // AdaptableAlerts are still linked to the live AlertDefinitions, so we have to decouple them
                        const newAbObject = Object.assign({}, abObject);
                        newAbObject.alertDefinition = (0, Helper_1.cloneObject)(abObject.alertDefinition);
                        delete newAbObject.alertDefinition.AlertProperties.HighlightRow;
                        return newAbObject;
                    }
                    return abObject;
                }) });
        }
        case exports.SYSTEM_HIGHLIGHT_CELL_ADD: {
            const actionTypedAdd = action;
            return Object.assign({}, state, {
                HighlightedCells: [...state.HighlightedCells, actionTypedAdd.cellHighlightInfo],
            });
        }
        case exports.SYSTEM_HIGHLIGHT_CELL_DELETE: {
            const actionTypedDelete = action;
            const actionId = `${actionTypedDelete.columnId}-${actionTypedDelete.primaryKeyValue}`;
            return Object.assign({}, state, {
                HighlightedCells: state.HighlightedCells.filter((celHighlightInfo) => {
                    const id = `${celHighlightInfo.columnId}-${celHighlightInfo.primaryKeyValue}`;
                    return id !== actionId;
                }),
            });
        }
        case exports.SYSTEM_HIGHLIGHT_CELL_DELETE_ALL: {
            return Object.assign({}, state, {
                HighlightedCells: [],
            });
        }
        case exports.SYSTEM_HIGHLIGHT_ROW_ADD: {
            const actionTypedAdd = action;
            return Object.assign({}, state, {
                HighlightedRows: [...state.HighlightedRows, actionTypedAdd.rowHighlightInfo],
            });
        }
        case exports.SYSTEM_HIGHLIGHT_ROWS_ADD: {
            const actionTypedAdd = action;
            const rowHighlightInfos = actionTypedAdd.rowsHighlightInfo.primaryKeyValues.map((primaryKeyValue) => {
                return {
                    primaryKeyValue,
                    highlightStyle: actionTypedAdd.rowsHighlightInfo.highlightStyle,
                    timeout: actionTypedAdd.rowsHighlightInfo.timeout,
                };
            });
            return Object.assign({}, state, {
                HighlightedRows: [...state.HighlightedRows, ...rowHighlightInfos],
            });
        }
        case exports.SYSTEM_HIGHLIGHT_ROW_DELETE: {
            const actionTypedDelete = action;
            const actionId = actionTypedDelete.primaryKeyValue;
            return Object.assign({}, state, {
                HighlightedRows: state.HighlightedRows.filter((rowHighlightInfo) => {
                    return rowHighlightInfo.primaryKeyValue !== actionId;
                }),
            });
        }
        case exports.SYSTEM_HIGHLIGHT_ROWS_DELETE: {
            const actionTypedDelete = action;
            return Object.assign({}, state, {
                HighlightedRows: state.HighlightedRows.filter((rowHighlightInfo) => {
                    return !actionTypedDelete.primaryKeyValues.includes(rowHighlightInfo.primaryKeyValue);
                }),
            });
        }
        case exports.SYSTEM_HIGHLIGHT_ROW_DELETE_ALL: {
            return Object.assign({}, state, {
                HighlightedRows: [],
            });
        }
        case exports.SYSTEM_STATUS_MESSAGE_INFO_ADD: {
            const actionTypedAdd = action;
            systemStatusMessages = [].concat(state.SystemStatusMessages);
            if (systemStatusMessages.length == actionTypedAdd.maxSystemStatusMessagesInStore) {
                // we have hit the maximum so remove first item (oldest)
                systemStatusMessages.splice(0, 1);
            }
            systemStatusMessages.push(actionTypedAdd.systemStatusMessageInfo);
            return Object.assign({}, state, {
                SystemStatusMessages: systemStatusMessages,
            });
        }
        case exports.SYSTEM_STATUS_MESSAGE_INFO_DELETE_ALL: {
            return Object.assign({}, state, { SystemStatusMessages: [] });
        }
        case exports.SYSTEM_SMART_EDIT_CHANGE_VALUE:
            return Object.assign({}, state, {
                SmartEditValue: action.value,
            });
        case exports.SYSTEM_SMART_EDIT_CHANGE_OPERATION:
            return Object.assign({}, state, {
                SmartEditOperation: action.smartEditOperation,
            });
        case exports.SYSTEM_SMARTEDIT_SET_VALID_SELECTION:
            return Object.assign({}, state, {
                IsValidSmartEditSelection: action
                    .isValidSmartEditSelection,
            });
        case exports.SYSTEM_SMARTEDIT_SET_PREVIEW:
            return Object.assign({}, state, {
                SmartEditPreviewInfo: action.smartEditPreviewInfo,
            });
        case exports.SYSTEM_BULK_UPDATE_SET_VALID_SELECTION:
            return Object.assign({}, state, {
                BulkUpdateValidationResult: action
                    .bulkUpdateValidationResult,
            });
        case exports.SYSTEM_BULK_UPDATE_SET_PREVIEW:
            return Object.assign({}, state, {
                BulkUpdatePreviewInfo: action.bulkUpdatePreviewInfo,
            });
        case exports.SYSTEM_BULK_UPDATE_CHANGE_VALUE:
            return Object.assign({}, state, {
                BulkUpdateValue: action.bulkUpdateValue,
            });
        case exports.SYSTEM_SET_LAST_APPLIED_SHORTCUT: {
            return Object.assign({}, state, {
                LastAppliedShortCut: action.gridCell,
            });
        }
        case exports.SYSTEM_CACHED_QUERY_ADD: {
            const actionTypedAdd = action;
            let cachedQueries = [].concat(state.CachedQueries);
            let queryToAdd = actionTypedAdd.cachedQuery;
            if (queryToAdd) {
                if (cachedQueries.length == 5) {
                    // we have hit the maximum so remove first item (oldest)
                    cachedQueries.splice(0, 1);
                }
                cachedQueries.push(actionTypedAdd.cachedQuery);
            }
            return Object.assign({}, state, { CachedQueries: cachedQueries });
        }
        case exports.SYSTEM_CELL_SUMMARY_CHANGE_OPERATION:
            return Object.assign({}, state, {
                CellSummaryOperation: action
                    .cellSummaryOperation,
            });
        case exports.SYSTEM_PROGRESS_INDICATOR_SHOW: {
            const actionTypedAdd = action;
            const updatedState = {
                ProgressIndicator: {
                    active: true,
                    text: actionTypedAdd.progressIndicatorConfig.text,
                    render: actionTypedAdd.progressIndicatorConfig.render,
                    frameworkComponent: actionTypedAdd.progressIndicatorConfig.frameworkComponent,
                },
            };
            return Object.assign({}, state, updatedState);
        }
        case exports.SYSTEM_PROGRESS_INDICATOR_HIDE: {
            const updatedState = {
                ProgressIndicator: {
                    active: false,
                },
            };
            return Object.assign({}, state, updatedState);
        }
        case exports.SYSTEM_LICENSE_SHOW_WATERMARK: {
            return Object.assign(Object.assign({}, state), { License: Object.assign(Object.assign({}, state.License), { watermark: {
                        show: true,
                        text: action.text,
                    } }) });
        }
        case exports.SYSTEM_LICENSE_DISABLE_PERSISTENCE: {
            return Object.assign(Object.assign({}, state), { License: Object.assign(Object.assign({}, state.License), { disablePersistence: true }) });
        }
        case exports.SYSTEM_DATA_CHANGE_HISTORY_ADD: {
            const actionTypedAdd = action;
            const cellDataChangedInfo = actionTypedAdd.changeInfo;
            const uniqueKey = actionTypedAdd.uniqueKey;
            const updatedDataChangeHistoryLogs = Object.assign({}, state.DataChangeHistory.logs);
            updatedDataChangeHistoryLogs[uniqueKey] = cellDataChangedInfo;
            return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { logs: updatedDataChangeHistoryLogs }) });
        }
        case exports.SYSTEM_DATA_CHANGE_HISTORY_UNDO: {
            const actionTypedUndo = action;
            const cellDataChangedInfo = actionTypedUndo.changeInfo;
            const uniqueKey = actionTypedUndo.uniqueKey;
            const updatedDataChangeHistoryLogs = Object.assign({}, state.DataChangeHistory.logs);
            delete updatedDataChangeHistoryLogs[uniqueKey];
            return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { logs: updatedDataChangeHistoryLogs }) });
        }
        case exports.SYSTEM_DATA_CHANGE_HISTORY_CLEAR_ROW: {
            const actionTypedClearRow = action;
            const cellDataChangedInfo = actionTypedClearRow.changeInfo;
            const uniqueKey = actionTypedClearRow.uniqueKey;
            const updatedDataChangeHistoryLogs = Object.assign({}, state.DataChangeHistory.logs);
            delete updatedDataChangeHistoryLogs[uniqueKey];
            return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { logs: updatedDataChangeHistoryLogs }) });
        }
        case exports.SYSTEM_DATA_CHANGE_HISTORY_ENABLE: {
            return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { currentMode: 'ACTIVE', enableTime: new Date(), suspendTime: null }) });
        }
        case exports.SYSTEM_DATA_CHANGE_HISTORY_DISABLE: {
            return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { logs: {}, currentMode: 'INACTIVE', enableTime: null, suspendTime: null }) });
        }
        case exports.SYSTEM_DATA_CHANGE_HISTORY_SUSPEND: {
            return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { currentMode: 'SUSPENDED', suspendTime: new Date() }) });
        }
        case exports.SYSTEM_DATA_CHANGE_HISTORY_RESUME: {
            return Object.assign(Object.assign({}, state), { DataChangeHistory: Object.assign(Object.assign({}, state.DataChangeHistory), { currentMode: 'ACTIVE', suspendTime: null }) });
        }
        case exports.SYSTEM_SETTINGS_PANEL_SET: {
            const setSettingsAction = action;
            return Object.assign(Object.assign({}, state), { SettingsPanel: Object.assign(Object.assign({}, state === null || state === void 0 ? void 0 : state.SettingsPanel), { [setSettingsAction.name]: setSettingsAction.settings }) });
        }
        case exports.SYSTEM_QUICK_FILTER_BAR_SHOW:
            return Object.assign({}, state, { IsQuickFilterVisible: true });
        case exports.SYSTEM_QUICK_FILTER_BAR_HIDE:
            return Object.assign({}, state, { IsQuickFilterVisible: false });
        case exports.SYSTEM_LAYOUT_SHOW_NOT_ASSOCIATED_OBJECTS: {
            const typedAction = action;
            return Object.assign(Object.assign({}, state), { ShowLayoutNotAssociatedObjects: typedAction.showNotAssociatedObjects });
        }
        case exports.SYSTEM_DATA_SET_SELECT:
            return Object.assign({}, state, {
                CurrentDataSet: action.dataSet.name,
            });
        case exports.DASHBOARD_REFRESH: {
            return Object.assign(Object.assign({}, state), { DashboardRevision: state.DashboardRevision + 1 });
        }
        case exports.SYSTEM_CHARTING_SET_CURRENT_CHART_MODELS: {
            const typedAction = action;
            return Object.assign(Object.assign({}, state), { Charting: Object.assign(Object.assign({}, state.Charting), { currentChartModels: typedAction.chartModels }) });
        }
        case exports.SYSTEM_SET_PREVIOUS_GROUPED_COLUMN_INDEX: {
            const typedAction = action;
            const newLayoutMap = Object.assign({}, state.Layout.previousGroupedColumns[typedAction.layoutId]);
            if (typedAction.columnIndex !== null) {
                newLayoutMap[typedAction.columnId] = typedAction.columnIndex;
            }
            else if (newLayoutMap[typedAction.columnId] !== undefined) {
                newLayoutMap === null || newLayoutMap === void 0 ? true : delete newLayoutMap[typedAction.columnId];
            }
            const previousGroupedColumns = {
                [typedAction.layoutId]: newLayoutMap,
            };
            return Object.assign(Object.assign({}, state), { Layout: Object.assign(Object.assign({}, state.Layout), { previousGroupedColumns }) });
        }
        case exports.SYSTEM_DISABLE_DELETE_CONFIRMATION: {
            return Object.assign(Object.assign({}, state), { DisableDeleteConfirmation: true });
        }
        case exports.SYSTEM_VISUAL_EXPORT_BEGIN: {
            return Object.assign(Object.assign({}, state), { Export: {
                    visualDataExportInProgress: true,
                } });
        }
        case exports.SYSTEM_VISUAL_EXPORT_END: {
            return Object.assign(Object.assign({}, state), { Export: {
                    visualDataExportInProgress: false,
                } });
        }
        case exports.SYSTEM_SET_QUICK_SEARCH_FLOATING_VISIBILITY: {
            const typedAction = action;
            return Object.assign(Object.assign({}, state), { QuickSearch: Object.assign(Object.assign({}, state.QuickSearch), { floatingVisible: typedAction.visible }) });
        }
        case exports.SYSTEM_CELL_POPUP_SHOW: {
            const typedAction = action;
            // reuse address refrence if we are editing the same cell
            let newAddress = typedAction === null || typedAction === void 0 ? void 0 : typedAction.cellPosition;
            const oldAddress = (_a = state === null || state === void 0 ? void 0 : state.NotesAndComments) === null || _a === void 0 ? void 0 : _a.popupPosition;
            if (CellPopupService_1.CellPopupService.isSameAddress(oldAddress, typedAction.cellPosition)) {
                newAddress = oldAddress;
                // if edit mode is the same, just exist
                if (typedAction.editMode === state.NotesAndComments.editMode) {
                    return state;
                }
            }
            return Object.assign(Object.assign({}, state), { NotesAndComments: Object.assign(Object.assign({}, state.NotesAndComments), { editMode: typedAction.editMode, popupPosition: newAddress }) });
        }
        case exports.SYSTEM_CELL_POPUP_EDIT_FOCUSED_ENTITY: {
            const typedAction = action;
            return Object.assign(Object.assign({}, state), { NotesAndComments: Object.assign(Object.assign({}, state.NotesAndComments), { focusedEntity: typedAction.focusedEntity }) });
        }
        case exports.SYSTEM_CELL_POPUP_HIDE: {
            return Object.assign(Object.assign({}, state), { NotesAndComments: {
                    editMode: false,
                    popupPosition: null,
                } });
        }
        case exports.SYSTEM_SUMMARY_ROW_SET: {
            const typedAction = action;
            return Object.assign(Object.assign({}, state), { RowSummary: {
                    rowSummaries: typedAction.rowSummaries,
                } });
        }
        default:
            return state;
    }
};
exports.SystemReducer = SystemReducer;
