"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateManagementViewPanel = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const join_1 = tslib_1.__importDefault(require("../../components/utils/join"));
const GeneralConstants = tslib_1.__importStar(require("../../Utilities/Constants/GeneralConstants"));
const LoadButton_1 = require("./components/LoadButton");
const ClearButton_1 = require("./components/ClearButton");
const ExportDropdown_1 = require("./components/ExportDropdown");
const Flex_1 = require("../../components/Flex");
const StateManagementViewPanel = (props) => {
    const isToolbar = props.viewType === 'Toolbar';
    const elementType = isToolbar ? 'DashboardToolbar' : 'ToolPanel';
    return (React.createElement(Flex_1.Flex, { flexDirection: isToolbar ? 'row' : 'column', className: (0, join_1.default)(props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__StateManagement__wrap twa:min-h-input`) },
        React.createElement(Flex_1.Flex, { flexDirection: "row" },
            React.createElement(LoadButton_1.LoadButton, { tooltip: "Load Initial Adaptable State", variant: "text", icon: "upload", onLoad: (json) => props.api.stateApi.reloadInitialState(json), accessLevel: props.accessLevel }, !isToolbar && 'Load'),
            React.createElement(ClearButton_1.ClearButton, { icon: "delete", tooltip: "Clear User State", variant: "text", onClick: () => props.api.stateApi.reloadInitialState(), accessLevel: props.accessLevel }, !isToolbar && 'Clear')),
        React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "adaptableState" }, "All State"),
        React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "initialState" }, "Initial Adaptable State")));
};
exports.StateManagementViewPanel = StateManagementViewPanel;
