"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setScale = exports.setMargin = exports.setLayout = exports.setChartSize = exports.chartLayoutReducer = void 0;
var _toolkit = require("@reduxjs/toolkit");
var initialState = {
  layoutType: 'horizontal',
  width: 0,
  height: 0,
  margin: {
    top: 5,
    right: 5,
    bottom: 5,
    left: 5
  },
  scale: 1
};
var chartLayoutSlice = (0, _toolkit.createSlice)({
  name: 'chartLayout',
  initialState,
  reducers: {
    setLayout(state, action) {
      state.layoutType = action.payload;
    },
    setChartSize(state, action) {
      state.width = action.payload.width;
      state.height = action.payload.height;
    },
    setMargin(state, action) {
      var _action$payload$top, _action$payload$right, _action$payload$botto, _action$payload$left;
      state.margin.top = (_action$payload$top = action.payload.top) !== null && _action$payload$top !== void 0 ? _action$payload$top : 0;
      state.margin.right = (_action$payload$right = action.payload.right) !== null && _action$payload$right !== void 0 ? _action$payload$right : 0;
      state.margin.bottom = (_action$payload$botto = action.payload.bottom) !== null && _action$payload$botto !== void 0 ? _action$payload$botto : 0;
      state.margin.left = (_action$payload$left = action.payload.left) !== null && _action$payload$left !== void 0 ? _action$payload$left : 0;
    },
    setScale(state, action) {
      state.scale = action.payload;
    }
  }
});
var {
  setMargin,
  setLayout,
  setChartSize,
  setScale
} = chartLayoutSlice.actions;
exports.setScale = setScale;
exports.setChartSize = setChartSize;
exports.setLayout = setLayout;
exports.setMargin = setMargin;
var chartLayoutReducer = exports.chartLayoutReducer = chartLayoutSlice.reducer;