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/schedules/products/serve.ts
var serve_exports = {};
__export(serve_exports, {
  editProductDetail: () => editProductDetail,
  getProductDetail: () => getProductDetail,
  getProductList: () => getProductList,
  getResourcesByProductId: () => getResourcesByProductId,
  getScheduleListByProductId: () => getScheduleListByProductId,
  getSchedules: () => getSchedules
});
module.exports = __toCommonJS(serve_exports);
var import_utils = require("../utils");
var import_serve = require("../schedules/serve");
var getProductList = async (params) => {
  let { data } = await import_utils.request.getRequest().post("/shop/product/query", params, { abort: true });
  return (data == null ? void 0 : data.list) || [];
};
var getProductDetail = async (params) => await import_utils.request.getRequest().get("/shop/schedule/item/relation", params);
var editProductDetail = async (params) => await import_utils.request.getRequest().post("/shop/schedule/item/relation", params);
var getScheduleListByProductId = async (params) => {
  if (params.ids.length) {
    let { data } = await (0, import_serve.getScheduleList)(params);
    const list = params.ids.map(
      (id) => data == null ? void 0 : data.list.find((item) => item.id === id)
    );
    return list.filter(Boolean) || [];
  }
  return [];
};
var getSchedules = async (params) => {
  let { data } = await (0, import_serve.getScheduleList)(params);
  return data.list || [];
};
var getResourcesByProductId = async (params) => {
  let { data } = await import_utils.request.getRequest().get(`/shop/form/resources/${params.id}`);
  return data || [];
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  editProductDetail,
  getProductDetail,
  getProductList,
  getResourcesByProductId,
  getScheduleListByProductId,
  getSchedules
});
