var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/booking/info/hooks/useGetHolderList.ts
var useGetHolderList_exports = {};
__export(useGetHolderList_exports, {
  default: () => useGetHolderList_default
});
module.exports = __toCommonJS(useGetHolderList_exports);
var import_ahooks = require("ahooks");
var import_useHolderConfig = __toESM(require("./useHolderConfig"));
var useGetHolderList = (state, dispatch) => {
  const { holder, appointment_subject } = (0, import_useHolderConfig.default)(state);
  const getHolders = (0, import_ahooks.useMemoizedFn)(async () => {
    var _a, _b, _c, _d, _e;
    if (holder.data_range === "customer" && !((_b = (_a = state.client) == null ? void 0 : _a.value) == null ? void 0 : _b.id)) {
      return;
    }
    const params = {
      form_id: appointment_subject.form_id,
      source_shop_customer: (_c = holder == null ? void 0 : holder.form) == null ? void 0 : _c.is_franchisor,
      customer_id: holder.data_range === "customer" ? (_e = (_d = state.client) == null ? void 0 : _d.value) == null ? void 0 : _e.id : void 0,
      skip: 1,
      num: 100
    };
    const data = await state.apis.getPetsData(params);
    dispatch({
      type: "setPet",
      payload: {
        holders: data.list
      }
    });
  });
  return getHolders;
};
var useGetHolderList_default = useGetHolderList;
