var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/table/serve.ts
var serve_exports = {};
__export(serve_exports, {
  batchImport: () => batchImport,
  exportData: () => exportData,
  getExportFile: () => getExportFile,
  getImportLog: () => getImportLog,
  importTemplate: () => importTemplate
});
module.exports = __toCommonJS(serve_exports);
var import_utils = require("./utils");
var defaultUrl = {
  export: "/shop/form/data/export",
  import: "/shop/form/data/import",
  export_file: "/shop/form/data/task?type=export",
  import_log: "/shop/form/data/task?type=import",
  template: "/shop/form/data/download-template"
};
var formatApiParams = (params, type) => {
  if (params instanceof FormData) {
    let url = params.get("url");
    params.delete("url");
    return {
      url: url || (defaultUrl == null ? void 0 : defaultUrl[type]),
      params
    };
  }
  const _url = (params == null ? void 0 : params.url) || (defaultUrl == null ? void 0 : defaultUrl[type]);
  let _params = { ...params };
  delete _params.url;
  if (type !== "export") {
    _params == null ? true : delete _params.shipping_status;
    _params == null ? true : delete _params.payment_status;
    _params == null ? true : delete _params.status;
  }
  return {
    url: _url,
    params: { ..._params }
  };
};
var exportData = (params) => {
  const _params = formatApiParams(params, "export");
  return import_utils.request.getRequest().post(_params == null ? void 0 : _params.url, _params == null ? void 0 : _params.params);
};
var batchImport = (params) => {
  const _params = formatApiParams(params, "import");
  return import_utils.request.getRequest().post(_params == null ? void 0 : _params.url, params);
};
var importTemplate = (params) => {
  const _params = formatApiParams(params, "template");
  return import_utils.request.getRequest().post(_params == null ? void 0 : _params.url, _params == null ? void 0 : _params.params);
};
var getExportFile = async (params) => {
  const _params = formatApiParams(params, "export_file");
  return await import_utils.request.getRequest().get(_params == null ? void 0 : _params.url, _params == null ? void 0 : _params.params);
};
var getImportLog = async (params) => {
  const _params = formatApiParams(params, "import_log");
  return await import_utils.request.getRequest().get(_params == null ? void 0 : _params.url, _params == null ? void 0 : _params.params);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  batchImport,
  exportData,
  getExportFile,
  getImportLog,
  importTemplate
});
