import api from "../api/index.mjs";
import "../../../../node_modules/element-plus/es/index.mjs";
/* empty css                                                          */
/* empty css                                                              */
/* empty css                                                                */
import { ElMessage } from "../../../../node_modules/element-plus/es/components/message/index.mjs";
async function getJsonAsyncUtil($http, id, type, initOption) {
  let option = {};
  const busMode = "base-server";
  let data = await api.findByTemplateKey($http, {
    templateKey: id,
    type,
    moduleType: busMode,
    timestamp: Date.now(),
    templateVersion: "v5"
  });
  if (data) {
    option = JSON.parse(data);
  }
  if (initOption) {
    option = Object.assign(option, initOption);
  }
  if ("{}" == JSON.stringify(option)) {
    let errorMsg = "未找到 [ " + id + " ] 表单模板或表单模板未配置";
    ElMessage.error(errorMsg);
    throw new Error(errorMsg);
  }
  return option;
}
export {
  getJsonAsyncUtil as default
};
