import store from "../../store/index.mjs";
import cloneDeep$1 from "../../../../node_modules/lodash-es/cloneDeep.mjs";
function cloneDeep(data) {
  return cloneDeep$1(data);
}
function setEditConfigData(data) {
  store.commit("set_edit_config_data", data);
}
function getEditConfigData() {
  return store.getters.editConfigData;
}
function setSelectedItem(item) {
  store.commit("set_selected_item", item);
}
function setHoverItem(item) {
  store.commit("set_hover_item", item);
}
function isHoverItem(item) {
  var _a;
  return ((_a = store.getters.hoverItem) == null ? void 0 : _a.id) == (item == null ? void 0 : item.id);
}
function isSelectedItem(item) {
  var _a;
  return ((_a = store.getters.selectedItem) == null ? void 0 : _a.id) == (item == null ? void 0 : item.id);
}
function getCurrentItem() {
  return store.getters.selectedItem;
}
function getCurrentClass(item) {
  return {
    "is-hover": isHoverItem(item),
    "is-select": isSelectedItem(item)
  };
}
function setEditConfigDataSources(dataSources) {
  const editConfigData = store.getters.editConfigData;
  editConfigData.dataSources = dataSources;
  store.commit("set_edit_config_data", editConfigData);
}
function getEditConfigDialogs() {
  return store.getters.editConfigData.dialogs || [];
}
function setEditConfigDialogs(dialogs) {
  const editConfigData = store.getters.editConfigData;
  editConfigData.dialogs = dialogs;
  store.commit("set_edit_config_data", editConfigData);
}
function getEditConfigDataSources() {
  return store.getters.editConfigData.dataSources;
}
function getEditConfigDataFields() {
  const editingType = store.getters.editingType;
  const fieldsData = store.getters.editConfigData.fieldsData;
  switch (editingType) {
    case "table":
      return fieldsData;
    case "form":
      return fieldsData.map((item) => item.component);
  }
  return fieldsData;
}
function getEditingType() {
  return store.getters.editingType;
}
export {
  cloneDeep,
  getCurrentClass,
  getCurrentItem,
  getEditConfigData,
  getEditConfigDataFields,
  getEditConfigDataSources,
  getEditConfigDialogs,
  getEditingType,
  isHoverItem,
  isSelectedItem,
  setEditConfigData,
  setEditConfigDataSources,
  setEditConfigDialogs,
  setHoverItem,
  setSelectedItem
};
