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/info2/service/editService/index.tsx
var editService_exports = {};
__export(editService_exports, {
  default: () => editService_default
});
module.exports = __toCommonJS(editService_exports);
var import_Delete_wght300_24px = __toESM(require("@pisell/icon/es/Delete_wght300_24px"));
var import_utils = require("@pisell/utils");
var import_react = __toESM(require("react"));
var import_drawer = __toESM(require("../../../components/drawer"));
var import_model = require("../../../info/model");
var import_duration = __toESM(require("../../../materiels/duration"));
var import_Capacity = __toESM(require("./Capacity"));
var import_Resources = __toESM(require("./Resources"));
var import_Holder = __toESM(require("./Holder"));
var import_antd = require("antd");
var import_index = require("./index.less");
var import_collapsibleList = __toESM(require("../../../components/collapsibleList"));
var import_utils2 = require("../../../components/collapsibleList/utils");
var import_index2 = require("./index.less");
var import_ahooks = require("ahooks");
var import_materials = require("@pisell/materials");
var import_utils3 = require("../../../../ticketBooking/utils");
var import_utils4 = require("../../../info/service2/utils");
var import_utils5 = require("../../../info/utils");
var import_utils6 = require("../../../utils");
var import_utilsByBooking = require("../../utilsByBooking");
var import_utils7 = require("../addService/utils");
var import_utils8 = require("./utils");
var import_noteModal = __toESM(require("../../../../../plus/noteModal"));
var import_priceKeyboard = require("../../../../../pro/priceKeyboard");
var import_EditTabs = __toESM(require("../../../info/service/editService/EditTabs"));
var import_BookingList = __toESM(require("../../../info/service/editService/BookingList"));
var import_dayjs = __toESM(require("dayjs"));
var import_utils9 = require("../../../info/service2/Group/utils");
var import_useShopDiscountModule = require("../../../../ticketBooking/hooks/pisellos/useShopDiscountModule");
var import_DiscountChangeModal = __toESM(require("./DiscountChangeModal"));
var import_decimal = __toESM(require("decimal.js"));
var submitLock = false;
var isSameBookingServiceItem = (listItem, editItem) => {
  var _a, _b;
  const bookingId = editItem == null ? void 0 : editItem.booking_id;
  const orderDetailId = (_a = editItem == null ? void 0 : editItem._extend) == null ? void 0 : _a.order_detail_id;
  if (!bookingId || !orderDetailId) {
    return false;
  }
  return (listItem == null ? void 0 : listItem.booking_id) === bookingId && ((_b = listItem == null ? void 0 : listItem._extend) == null ? void 0 : _b.order_detail_id) === orderDetailId;
};
var Info = (_, ref) => {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K;
  const [form] = import_antd.Form.useForm();
  const useTotal = import_antd.Form.useWatch("total", form);
  const useResource = import_antd.Form.useWatch("resource", form);
  const useStartTime = import_antd.Form.useWatch("start_time", form);
  const useDuration = import_antd.Form.useWatch("duration", form);
  const useHolder = import_antd.Form.useWatch("holder", form);
  const useHolderId = import_antd.Form.useWatch("holder_id", form);
  const useNote = import_antd.Form.useWatch("note", form);
  const useStartDate = import_antd.Form.useWatch("start_date", form);
  const useEndDate = import_antd.Form.useWatch("end_date", form);
  const shopDiscount = (0, import_useShopDiscountModule.useShopDiscountModule)();
  const [discountChangeModalOpen, setDiscountChangeModalOpen] = (0, import_react.useState)(false);
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
  const resourcesRef = (0, import_react.useRef)(null);
  const isChangeTotal = (0, import_react.useRef)(false);
  const [noteModalOpen, setNoteModalOpen] = (0, import_react.useState)(false);
  const [open, setOpen] = (0, import_react.useState)(false);
  const [currentTab, setCurrentTab] = (0, import_react.useState)("batch_edit");
  const valuesRef = (0, import_react.useRef)({});
  const noInOriginalDiscountIdsRef = (0, import_react.useRef)([]);
  const isEditedRef = (0, import_react.useRef)(false);
  (0, import_react.useEffect)(() => {
    window.openBookingEditModal = () => {
      setOpen(true);
    };
    window.closeBookingEditModal = () => {
      setOpen(false);
    };
  }, []);
  const isNormalProduct = (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2;
    if (!((_a2 = state == null ? void 0 : state.service) == null ? void 0 : _a2.cacheItem)) {
      return true;
    }
    return ((_b2 = state == null ? void 0 : state.service) == null ? void 0 : _b2.cacheItem) && (0, import_utils4.isNormalProductByDurationSchedule)((_c2 = state == null ? void 0 : state.service) == null ? void 0 : _c2.cacheItem);
  }, [(_a = state == null ? void 0 : state.service) == null ? void 0 : _a.cacheItem]);
  const getCurrentCacheItem = (0, import_ahooks.useMemoizedFn)((_cacheItem) => {
    let values = form.getFieldsValue();
    let _item = _cacheItem || state.service.cacheItem;
    return {
      ..._item,
      _extend: {
        ..._item == null ? void 0 : _item._extend,
        ...values
      }
    };
  });
  const currentResource = (0, import_react.useMemo)(() => {
    return null;
  }, []);
  const durationProps = (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2;
    let _cacheItem = getCurrentCacheItem();
    const val2 = (0, import_utils7.getDurationProps)({
      cacheItem: _cacheItem,
      useStartTime,
      // currentResource,
      slice: (_c2 = (_b2 = (_a2 = state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.service_time
    });
    return val2;
  }, [
    // currentResource,
    state.service.cacheItem,
    useStartTime,
    useResource,
    (_d = (_c = (_b = state.bookingConfig) == null ? void 0 : _b.config) == null ? void 0 : _c.basic) == null ? void 0 : _d.service_time
  ]);
  const flexibleOption = (0, import_react.useMemo)(() => {
    const op = (0, import_utils7.getFlexibleOption)({
      durationProps
    });
    return op;
  }, [durationProps, import_utils.locales.locale]);
  const timeObj = (0, import_react.useMemo)(() => {
    const val2 = (0, import_utils7.getTimeObj)({
      cacheItem: getCurrentCacheItem(),
      durationProps,
      useStartTime,
      currentResource,
      state,
      useDuration
    });
    return val2;
  }, [
    durationProps,
    useStartTime,
    currentResource,
    (_g = (_f = (_e = state.bookingConfig) == null ? void 0 : _e.config) == null ? void 0 : _f.basic) == null ? void 0 : _g.service_time,
    useDuration
  ]);
  (0, import_react.useEffect)(() => {
    console.log("执行次数:于灵活时长的结束时间随");
    try {
      if (useDuration.indexOf("flexible_") == 0) {
        if (flexibleOption) {
          form.setFieldsValue({
            duration: flexibleOption.value
          });
        }
      }
    } catch (err) {
    }
  }, [useDuration, flexibleOption]);
  const handleDeleteProduct = (0, import_ahooks.useMemoizedFn)(() => {
    var _a2, _b2;
    if (state.channelDisabledEdit) {
      return;
    }
    let _list = [...state.service.value];
    let _id = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._id;
    _list = _list.filter((d) => d._id !== _id);
    (_b2 = window.closeBookingEditModal) == null ? void 0 : _b2.call(window);
    dispatch({
      type: "setService",
      payload: {
        editModal: false,
        value: _list,
        edit: true,
        cacheItem: null
      }
    });
  });
  const getDiscount = () => {
    var _a2;
    let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
    let cPrice = Number(useTotal || 0);
    let discount = "";
    if (cPrice === oPrice) {
      discount = import_utils.locales.getText("pisell2.text.status.no-discount");
    } else {
      discount = `${import_utils.locales.getText("pisell2.text.status.manual")} `;
      if (cPrice < oPrice) {
        discount += (0, import_utils.formatAmount)(cPrice - oPrice, 2, state.amountSymbol) + "";
      } else {
        discount += "+" + (0, import_utils.formatAmount)(cPrice - oPrice, 2, state.amountSymbol);
      }
    }
    form.setFieldsValue({ discount });
  };
  const onFinishBefore = (values) => {
    if (!isEditedRef.current) {
      onFinish(values);
      return;
    }
    valuesRef.current = values;
    const originalDiscountList = shopDiscount.getDiscountList();
    const productAllDiscountList = (0, import_utils8.getProductAllDiscountList)(state.service.cacheItem);
    const noInOriginalDiscountList = productAllDiscountList.filter((item) => {
      return !originalDiscountList.some((d) => {
        var _a2;
        return !d.isEditMode && d.id === ((_a2 = item == null ? void 0 : item.discount) == null ? void 0 : _a2.resource_id);
      });
    });
    const isSomeDiscountNotInOriginalDiscountList = noInOriginalDiscountList.length > 0;
    if (isSomeDiscountNotInOriginalDiscountList) {
      noInOriginalDiscountIdsRef.current = noInOriginalDiscountList.map((item) => {
        var _a2;
        return (_a2 = item == null ? void 0 : item.discount) == null ? void 0 : _a2.resource_id;
      });
      setDiscountChangeModalOpen(true);
    } else {
      let cacheItem = { ...state.service.cacheItem };
      cacheItem = deleteDiscountList(cacheItem);
      onFinish(values, cacheItem);
      if (!!(productAllDiscountList == null ? void 0 : productAllDiscountList.length)) {
        import_antd.message.success(import_utils.locales.getText("pisell2.text.edit-service-success"));
      }
    }
  };
  const onFinish = (values, cacheItem) => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
    let isSuccess = (_a2 = resourcesRef.current) == null ? void 0 : _a2.check();
    if (isShowTimeAndResource && !isSuccess) {
      return;
    }
    if (submitLock) {
      return;
    }
    submitLock = true;
    setTimeout(() => {
      submitLock = false;
    }, 1500);
    let _list = [...state.service.value];
    let _item = {
      ...cacheItem ?? state.service.cacheItem,
      autoClose: false
    };
    let _extend = {
      ..._item._extend,
      other: {
        ...((_b2 = _item._extend) == null ? void 0 : _b2.other) || {},
        quantity: values.quantity
      },
      ...values
    };
    if (isEditGroup) {
      _extend.quantity = 1;
      _extend.startDate = _extend == null ? void 0 : _extend.start_date;
      _extend.endDate = _extend == null ? void 0 : _extend.end_date;
    } else {
      const { startDate, endDate } = (0, import_utils6.getServiceTimes)({ _extend });
      _extend.startDate = startDate;
      _extend.endDate = endDate;
    }
    if (isChangeTotal.current) {
      const discountRatio = new import_decimal.default(values.total).div(_item._extend.origin_total);
      const bundles2 = ((_c2 = _extend == null ? void 0 : _extend.other) == null ? void 0 : _c2.bundle) || [];
      let childProductsTotal = new import_decimal.default(0);
      if (bundles2.length > 0) {
        bundles2.forEach((bundle) => {
          const discountedPrice = new import_decimal.default(bundle.original_price).mul(discountRatio).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP);
          bundle.bundle_selling_price = discountedPrice.toNumber();
          childProductsTotal = childProductsTotal.add(
            discountedPrice.mul(bundle.quantity)
          );
        });
      }
      const mainProductTotal = new import_decimal.default(values.total).sub(childProductsTotal);
      const mainProductQuantity = ((_d2 = _extend.other) == null ? void 0 : _d2.quantity) || _extend.quantity || 1;
      _extend.main_product_selling_price = mainProductTotal.div(mainProductQuantity).toNumber();
    }
    if (_extend.bundle_edit !== void 0 || (cacheItem == null ? void 0 : cacheItem.edit)) {
      _extend.bundle_edit = 1;
    }
    _item._extend = _extend;
    _item._time = (/* @__PURE__ */ new Date()).getTime();
    _item._serviceKey = (0, import_utils3.genServiceKey)(_item);
    _item._holderKey = (0, import_utils3.genHolderKey)(_item);
    if (((_f2 = (_e2 = _item._extend) == null ? void 0 : _e2.holder_id) == null ? void 0 : _f2.length) > 1 || ((_g2 = _item._extend) == null ? void 0 : _g2.quantity) > 1 && ((_i2 = (_h2 = _item._extend) == null ? void 0 : _h2.holder_id) == null ? void 0 : _i2.length) >= 1) {
      let holder_ids = _item._extend.holder_id;
      _item._extend.holder_id = holder_ids[0];
      holder_ids = holder_ids.slice(1);
      _item._holderKey = (0, import_utils3.genHolderKey)(_item);
      holder_ids.forEach((holder_id) => {
        const newItem = { ..._item, _id: (0, import_utils.getUniqueId)(), _extend: { ..._item._extend, holder_id: [holder_id], quantity: 1 } };
        newItem._holderKey = (0, import_utils3.genHolderKey)(newItem);
        _list.unshift(newItem);
        _item._extend.quantity -= 1;
      });
      if (_item._extend.quantity > 1) {
        const newItem = { ..._item, _id: (0, import_utils.getUniqueId)(), _extend: { ..._item._extend, holder_id: void 0, quantity: _item._extend.quantity - 1 } };
        newItem._holderKey = (0, import_utils3.genHolderKey)(newItem);
        _list.unshift(newItem);
        _item._extend.quantity = 1;
      }
    }
    let _id = _item == null ? void 0 : _item._id;
    let groupId = (_j2 = _item == null ? void 0 : _item._extend) == null ? void 0 : _j2.groupId;
    const origin_total = (_n2 = (_m2 = (_l2 = (_k2 = _item._extend) == null ? void 0 : _k2.items) == null ? void 0 : _l2[0]) == null ? void 0 : _m2._extend) == null ? void 0 : _n2.origin_total;
    if (groupId) {
      if (isChangeTotal.current) {
        _item = deleteDiscountList(_item);
      }
      _list = _list.filter((d) => {
        var _a3;
        return ((_a3 = d._extend) == null ? void 0 : _a3.groupId) !== groupId;
      });
      _list = _list.concat((0, import_utils9.createBookingItemsByGroup)(_item, true));
    } else {
      _item = (0, import_utils8.setProductPrice)(_item, {
        newTotal: values.total,
        origin_total: origin_total ?? ((_o2 = _item._extend) == null ? void 0 : _o2.origin_total)
      });
      const matchById = _list.some((d) => d._id === _id);
      const matchByBooking = !matchById && _list.some((d) => isSameBookingServiceItem(d, _item));
      if (matchById || matchByBooking) {
        if (isChangeTotal.current) {
          _item = deleteDiscountList(_item);
        }
        if (matchById) {
          _list = _list.map((d) => d._id === _id ? { ..._item, new: 0 } : d);
        } else {
          let replaced = false;
          _list = _list.reduce((acc, d) => {
            if (isSameBookingServiceItem(d, _item)) {
              if (!replaced) {
                acc.push({ ..._item, new: 0, _id: d._id });
                replaced = true;
              }
            } else {
              acc.push(d);
            }
            return acc;
          }, []);
        }
      } else {
        const detail = (0, import_utils3.addService)(_list, _item, state);
        _list = detail.list;
      }
    }
    (0, import_utils6.deleteCacheParams)();
    console.log("_onFinish", _list);
    form.resetFields();
    if (!!((_p2 = state.service.cacheItem) == null ? void 0 : _p2.new)) {
      window.dispatchEvent(
        new CustomEvent("onAddNewService", {
          detail: {
            cacheItem: { ...state.service.cacheItem }
          }
        })
      );
    }
    (_q2 = window.closeBookingEditModal) == null ? void 0 : _q2.call(window);
    _list.sort((a, b) => {
      var _a3, _b3;
      const aHasHolderId = ((_a3 = a._extend) == null ? void 0 : _a3.holder_id) && (Array.isArray(a._extend.holder_id) ? a._extend.holder_id.length > 0 : true);
      const bHasHolderId = ((_b3 = b._extend) == null ? void 0 : _b3.holder_id) && (Array.isArray(b._extend.holder_id) ? b._extend.holder_id.length > 0 : true);
      if (!aHasHolderId && bHasHolderId) return -1;
      if (aHasHolderId && !bHasHolderId) return 1;
      return 0;
    });
    dispatch({
      type: "setService",
      payload: {
        editModal: false,
        addModal: false,
        value: _list,
        edit: true,
        cacheItem: null,
        changeService: false
      }
    });
  };
  const { run: setEditDataRun } = (0, import_ahooks.useDebounceFn)(
    (...params) => {
      setEditData(...params);
    },
    {
      wait: 50,
      leading: true,
      trailing: false
    }
  );
  const setEditData = (0, import_ahooks.useMemoizedFn)(
    (_cacheItem, open2, openProductDetail) => {
      console.timeEnd("handleChange");
      console.log("setEditDatasetEditData", _cacheItem, open2);
      setCurrentTab("batch_edit");
      isChangeTotal.current = false;
      isEditedRef.current = false;
      let cacheItem = _cacheItem || state.service.cacheItem;
      let values = cacheItem._extend;
      const startTime2 = performance.now();
      console.log(startTime2, "startTime");
      form.resetFields();
      form.setFieldsValue({
        capacity: values.capacity,
        discount_reason: values.discount_reason,
        duration: values.duration,
        endDate: values.endDate,
        end_date: values.end_date,
        origin_total: values.origin_total,
        price: values.price,
        product_name: values.product_name,
        quantity: values.quantity,
        resource: values.resource,
        startDate: values.startDate,
        start_time: values.start_time,
        start_date: values.start_date,
        total: values.total,
        holder_id: values.holder_id,
        note: values.note
      });
      const endTime2 = performance.now();
      console.log(endTime2 - window.pp1, "打开商品5");
      console.log("执行时间", endTime2 - startTime2, values);
      setTimeout(() => {
      }, 20);
      if (openProductDetail) {
        setTimeout(() => {
          handleEdit({});
        }, 100);
      }
    }
  );
  const isReason = (0, import_react.useMemo)(() => {
    var _a2;
    let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
    let cPrice = Number(useTotal || 0);
    return cPrice !== oPrice;
  }, [useTotal, (_i = (_h = state.service.cacheItem) == null ? void 0 : _h._extend) == null ? void 0 : _i.origin_total]);
  const getResources = () => {
    var _a2, _b2;
    let res = (0, import_utils7.formatResources)({
      cacheItem: getCurrentCacheItem(),
      resourcesOrigin: (_b2 = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._data) == null ? void 0 : _b2.resourcesOrigin
    });
    dispatch({
      type: "setService",
      payload: {
        cacheItem: {
          ...state.service.cacheItem,
          _data: {
            ...state.service.cacheItem._data,
            resources: res.list,
            resourceMaps: res.maps
          }
        }
      }
    });
    updateResourceErrors(res.maps);
  };
  const updateResourceErrors = (resourceMaps) => {
    let { resource: resource2 } = form.getFieldsValue();
    if (resource2) {
      let _resource = { ...resource2 };
      for (let form_id in _resource) {
        _resource[form_id] = _resource[form_id].map((d) => {
          var _a2, _b2;
          return {
            ...d,
            errors: (0, import_utilsByBooking.getErrorList)(
              (_b2 = (_a2 = resourceMaps == null ? void 0 : resourceMaps[form_id]) == null ? void 0 : _a2.renderListMaps) == null ? void 0 : _b2[d == null ? void 0 : d.relation_id],
              getCurrentCacheItem()
            )
          };
        });
      }
      form.setFieldsValue({
        resource: _resource
      });
      return _resource;
    }
  };
  (0, import_ahooks.useUpdateEffect)(() => {
    if (!state.service.cacheItem) {
      return;
    }
    if (useStartTime && useDuration && state.renderType !== "eventBooking") {
      getResources();
    }
  }, [
    useStartTime,
    useDuration,
    state.renderType,
    state.service.resourcesOrigin
  ]);
  (0, import_react.useEffect)(() => {
    if (state.isBookingCreatePage && state.service.editModal) {
      setEditDataRun(null);
    }
  }, [state.service.editModal, state.isBookingCreatePage]);
  (0, import_react.useEffect)(() => {
    getDiscount();
  }, [useTotal, (_k = (_j = state.service.cacheItem) == null ? void 0 : _j._extend) == null ? void 0 : _k.origin_total]);
  const bundles = (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2, _d2;
    return ((_d2 = (_c2 = (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._extend) == null ? void 0 : _c2.other) == null ? void 0 : _d2.bundle) || [];
  }, [(_o = (_n = (_m = (_l = state.service) == null ? void 0 : _l.cacheItem) == null ? void 0 : _m._extend) == null ? void 0 : _n.other) == null ? void 0 : _o.bundle]);
  const handleEdit = (0, import_ahooks.useMemoizedFn)((e) => {
    var _a2, _b2, _c2, _d2, _e2;
    const item = state.service.cacheItem;
    let values = form.getFieldsValue();
    const isSession = (0, import_utils6.isSessionProduct)(item);
    const sessionValue = {};
    if (isSession) {
      sessionValue.startEndTime = {
        startDate: (_a2 = item == null ? void 0 : item._extend) == null ? void 0 : _a2.start_date,
        endDate: (_b2 = item == null ? void 0 : item._extend) == null ? void 0 : _b2.end_date,
        duration: (_c2 = item == null ? void 0 : item._extend) == null ? void 0 : _c2.duration
      };
    }
    state.action({
      type: "pisell1.handleOpenProductModal",
      data: {
        id: item.id,
        date: state.date.value.format("YYYY-MM-DD"),
        showConfig: {
          option: true,
          session: isSession,
          variant: true,
          package: true,
          number: (0, import_utils3.getIsShowNumber)(item, state)
        },
        isOS: isSession,
        customer_id: (_e2 = (_d2 = state.client) == null ? void 0 : _d2.value) == null ? void 0 : _e2.id,
        value: {
          ...item._extend.other,
          ...sessionValue,
          quantity: values.quantity || item._extend.quantity
        }
      },
      callback: (e2, extension_type, detail) => {
        var _a3, _b3, _c3, _d3, _e3, _f2, _g2;
        isEditedRef.current = true;
        const _detail = detail || item;
        let other = JSON.parse(JSON.stringify(e2));
        if (item.discount_amount) {
          other = (0, import_utils8.mergeBundleWithOriginalPrice)(other, ((_a3 = item._extend) == null ? void 0 : _a3.other) || {});
        }
        other.session = e2.session;
        let cacheItem = {
          ...item,
          ..._detail,
          product_id: item.id,
          _id: item == null ? void 0 : item._id,
          _key: e2.key,
          _extend: {
            ...item._extend,
            // 将当前表单的值覆盖进去
            ...values,
            quantity: (e2 == null ? void 0 : e2.quantity) || (values == null ? void 0 : values.quantity) || 1,
            // 覆盖选择的规格和套餐
            other
          },
          new: 0
        };
        if (cacheItem.discount_amount && ((_b3 = cacheItem == null ? void 0 : cacheItem.metadata) == null ? void 0 : _b3.main_product_selling_price)) {
          cacheItem._extend.price = (_c3 = cacheItem == null ? void 0 : cacheItem.metadata) == null ? void 0 : _c3.main_product_selling_price;
        }
        let _total = (0, import_utils6.getProductTotalPrice)(cacheItem);
        cacheItem._extend.total = _total;
        try {
          cacheItem._extend.capacity = (0, import_utils7.setDefaultCapacitys)({
            capacitys: cacheItem._data.capacitys,
            cacheItem
          });
        } catch (err) {
        }
        const sessionDetail = (0, import_utils5.editSessionProduct)(cacheItem, e2.session);
        if (sessionDetail) {
          setTimeout(() => {
            form.setFieldsValue({
              start_time: sessionDetail.start_time,
              duration: sessionDetail.duration
            });
          }, 200);
        }
        let origin_total = _total;
        if (item.discount_amount) {
          origin_total = (0, import_utils6.getProductOriginTotalPrice)(cacheItem);
          const previousOriginTotal = Number(((_d3 = item == null ? void 0 : item._extend) == null ? void 0 : _d3.origin_total) || 0);
          const previousTotal = Number(((_e3 = item == null ? void 0 : item._extend) == null ? void 0 : _e3.total) || 0);
          const productAllDiscountList = (0, import_utils8.getProductAllDiscountList)(item);
          const hasNonManualDiscount = productAllDiscountList.some(
            (discountItem) => (discountItem == null ? void 0 : discountItem.type) !== "product"
          );
          if (previousOriginTotal > 0 && Number.isFinite(previousOriginTotal) && Number.isFinite(previousTotal) && !hasNonManualDiscount) {
            const sellingRatio = new import_decimal.default(previousTotal).div(previousOriginTotal);
            _total = new import_decimal.default(origin_total).mul(sellingRatio).toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP).toNumber();
            cacheItem._extend.total = _total;
          }
        }
        cacheItem._extend.origin_total = origin_total;
        (((_f2 = cacheItem._extend) == null ? void 0 : _f2.items) || []).forEach((item2) => item2._extend.origin_total = origin_total);
        dispatch({
          type: "setService",
          payload: {
            cacheItem
          }
        });
        form.setFieldsValue({
          total: _total,
          capacity: (_g2 = cacheItem._extend) == null ? void 0 : _g2.capacity,
          quantity: (e2 == null ? void 0 : e2.quantity) || (values == null ? void 0 : values.quantity) || 1
        });
      }
    });
  });
  const handleChange = (0, import_ahooks.useMemoizedFn)((e) => {
    var _a2;
    if (state.channelDisabledEdit) {
      return;
    }
    form.resetFields();
    (_a2 = window.closeBookingEditModal) == null ? void 0 : _a2.call(window);
    dispatch({
      type: "setService",
      payload: {
        addModal: true,
        editModal: false
        //用于控制 添加商品 和 编辑服务弹窗的上下层级
        // changeService: true,
      }
    });
  });
  (0, import_react.useImperativeHandle)(ref, () => {
    return {
      init: setEditDataRun
    };
  });
  const handleTotalChange = (number) => {
    isChangeTotal.current = true;
  };
  const isShowTimeAndResource = (0, import_react.useMemo)(() => {
    if (state.renderType !== "eventBooking" && !isNormalProduct) {
      return true;
    }
    return false;
  }, [state.renderType, isNormalProduct]);
  const SelectTime = (_p = window.BaseMaterials) == null ? void 0 : _p.SelectTime;
  const isNoSpecAndPackage = (0, import_utilsByBooking.getIsNoSpecAndPackage)(state.service.cacheItem);
  const items = (0, import_react.useMemo)(() => {
    var _a2, _b2;
    return ((_b2 = (_a2 = getCurrentCacheItem()) == null ? void 0 : _a2._extend) == null ? void 0 : _b2.items) || [];
  }, [
    getCurrentCacheItem(),
    state.service.cacheItem,
    currentResource,
    useTotal
  ]);
  const isEditGroup = (0, import_react.useMemo)(() => {
    return items.length;
  }, [items]);
  const handleNoteConfirm = (noteValue) => {
    form.setFieldsValue({ note: noteValue });
    setNoteModalOpen(false);
  };
  const handleNoteDelete = () => {
    form.setFieldsValue({ note: "" });
    setNoteModalOpen(false);
  };
  const handleNoteCancel = () => {
    setNoteModalOpen(false);
  };
  console.log(isShowTimeAndResource, "isShowTimeAndResource");
  const productName = (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2;
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "product_name" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name" }, ((_c2 = (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._extend) == null ? void 0 : _c2.product_name) || "-"), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleEdit }, import_utils.locales.getText("pisell2.text.edit")), !state.isBookingCreatePage && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleChange }, import_utils.locales.getText("pisell2.text.change"))), /* @__PURE__ */ import_react.default.createElement(
      import_collapsibleList.default,
      {
        style: { marginTop: bundles.length ? "8px" : 0 },
        list: bundles,
        renderItem: (item) => (0, import_utils2.renderBundles)(item, state.amountSymbol)
      }
    ))));
  }, [
    (_s = (_r = (_q = state.service) == null ? void 0 : _q.cacheItem) == null ? void 0 : _r._extend) == null ? void 0 : _s.product_name,
    bundles,
    state.amountSymbol,
    state.isBookingCreatePage
  ]);
  const price = (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Form.Item,
      {
        label: import_utils.locales.getText("pisell2.text.price"),
        name: "total",
        rules: [{ required: true }],
        extra: useTotal !== ((_b2 = (_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend) == null ? void 0 : _b2.origin_total) && import_utils.locales.getText("page.booking.text.price-extra")(
          (0, import_utils.formatAmount)(
            (_d2 = (_c2 = state.service.cacheItem) == null ? void 0 : _c2._extend) == null ? void 0 : _d2.origin_total,
            2,
            state.amountSymbol
          ),
          (0, import_utils.formatAmount)(useTotal, 2, state.amountSymbol)
        )
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_priceKeyboard.DiscountKeyboard.InputNumber,
        {
          style: { width: "100%" },
          min: 0,
          precision: 2,
          prefix: state.amountSymbol,
          onChange: handleTotalChange,
          disabled: state.channelDisabledEdit,
          originalValue: ((_f2 = (_e2 = state.service.cacheItem) == null ? void 0 : _e2._extend) == null ? void 0 : _f2.origin_total) || 0,
          placeholder: ((_h2 = (_g2 = state.service.cacheItem) == null ? void 0 : _g2._extend) == null ? void 0 : _h2.origin_total) || "0",
          size: "large",
          keyboardProps: {
            containerProps: {
              renderType: "modal"
            },
            selectType: "dark"
          }
        }
      )
    ));
  }, [
    useTotal,
    (_u = (_t = state.service.cacheItem) == null ? void 0 : _t._extend) == null ? void 0 : _u.origin_total,
    state.amountSymbol,
    state.channelDisabledEdit
  ]);
  const reason = (0, import_react.useMemo)(() => {
    return isReason ? /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Form.Item,
      {
        label: import_utils.locales.getText("pisell2.text.discount-reason"),
        name: "discount_reason"
      },
      /* @__PURE__ */ import_react.default.createElement(import_antd.Input.TextArea, { size: "large" })
    )) : null;
  }, [isReason]);
  const DateCom = (position) => {
    return /* @__PURE__ */ import_react.default.createElement(
      import_antd.DatePicker,
      {
        className: "pisell-lowcode__booking-service-select-date",
        disabledDate: (current) => (0, import_utils4.disabledDate)(current, position, state.date.value),
        size: "large",
        style: { width: "100%" },
        format: state.locale === "en" ? "DD/MM/YYYY" : "YYYY-MM-DD"
      }
    );
  };
  const startTime = (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2, _d2;
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Form.Item,
      {
        label: import_utils.locales.getText(isEditGroup ? "pisell2.text.start_date" : "pisell2.text.start_time"),
        name: isEditGroup ? "start_date" : "start_time",
        rules: [{ required: true }]
      },
      isEditGroup ? DateCom("start") : SelectTime ? /* @__PURE__ */ import_react.default.createElement(
        SelectTime,
        {
          slice: (_d2 = (_c2 = (_b2 = (_a2 = state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.service_time) == null ? void 0 : _d2.value,
          timePickerProps: {
            style: { width: "100%" }
          },
          timeProps: {
            style: { zoom: 0.8 }
          }
        }
      ) : null
    ));
  }, [SelectTime, (_y = (_x = (_w = (_v = state.bookingConfig) == null ? void 0 : _v.config) == null ? void 0 : _w.basic) == null ? void 0 : _x.service_time) == null ? void 0 : _y.value, isEditGroup]);
  const endTime = (0, import_react.useMemo)(() => {
    if (!isEditGroup) {
      return null;
    }
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Form.Item,
      {
        label: import_utils.locales.getText("pisell2.text.end_date"),
        name: "end_date"
      },
      DateCom("end")
    ));
  }, [isEditGroup]);
  const duration = (0, import_react.useMemo)(() => {
    console.log("render form duration");
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: isEditGroup ? 24 : 12 }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Form.Item,
      {
        label: import_utils.locales.getText("pisell2.text.duration"),
        name: "duration",
        rules: [{ required: true }]
      },
      /* @__PURE__ */ import_react.default.createElement(import_duration.default, { ...durationProps, timeObj })
    ));
  }, [durationProps, timeObj, isEditGroup]);
  const resource = (0, import_react.useMemo)(() => {
    console.log("render form resource");
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { noStyle: true, name: "resource" }, /* @__PURE__ */ import_react.default.createElement(
      import_Resources.default,
      {
        ref: resourcesRef,
        state,
        cacheItem: state.service.cacheItem,
        getCurrentCacheItem
      }
    ));
  }, [
    state.renderType,
    (_A = (_z = state.service.cacheItem) == null ? void 0 : _z._data) == null ? void 0 : _A.resources,
    (_C = (_B = state.service.cacheItem) == null ? void 0 : _B._data) == null ? void 0 : _C.resourceMaps
  ]);
  const holder = (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
    const showExtra = ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.subject_require) === "require" && (!useHolderId || (useHolderId == null ? void 0 : useHolderId.length) < ((_e2 = (_d2 = state.service.cacheItem) == null ? void 0 : _d2._extend) == null ? void 0 : _e2.quantity));
    return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Form.Item,
      {
        name: "holder_id",
        style: { width: "100%" },
        rules: [
          {
            required: ((_h2 = (_g2 = (_f2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _f2.config) == null ? void 0 : _g2.basic) == null ? void 0 : _h2.subject_require) === "require",
            validator: (rule, value, callback) => {
              if (showExtra) {
                callback(import_utils.locales.getText("page.booking.text.holder.length-error"));
              } else {
                callback();
              }
            }
          }
        ]
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_Holder.default,
        {
          state,
          cacheItem: state.service.cacheItem,
          dispatch
        }
      )
    ));
  }, [state.pet, state.client, state.service.cacheItem, useHolderId]);
  const capacity = (0, import_react.useMemo)(() => {
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { noStyle: true, name: "capacity" }, /* @__PURE__ */ import_react.default.createElement(import_Capacity.default, { state, cacheItem: state.service.cacheItem }));
  }, [
    state.locale,
    state.isTerminal,
    (_F = (_E = (_D = state.service) == null ? void 0 : _D.cacheItem) == null ? void 0 : _E._data) == null ? void 0 : _F.capacitys
  ]);
  const hiddenQuantity = (0, import_react.useMemo)(() => {
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { hidden: true, name: "quantity" }, /* @__PURE__ */ import_react.default.createElement(import_antd.InputNumber, null));
  }, []);
  const quantity = (0, import_react.useMemo)(() => {
    return /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Form.Item,
      {
        label: import_utils.locales.getText("pisell2.text.quantity"),
        name: "quantity",
        rules: [{ required: true }]
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_antd.InputNumber,
        {
          size: "large",
          style: { width: "100%" },
          min: 1,
          max: 999999,
          formatter: (value) => {
            if (value !== void 0) {
              return Math.floor(value);
            }
            return value;
          }
        }
      )
    ));
  }, []);
  const footer = (0, import_react.useMemo)(() => {
    var _a2;
    return /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "pisell-lowcode__booking-service-body-edit-footer",
        style: (state == null ? void 0 : state.isBookingTicket2) ? { justifyContent: "space-between" } : {}
      },
      /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-body-edit-footer-left" }, /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: "pisell-lowcode__booking-service-delete-wrap",
          onClick: handleDeleteProduct
        },
        /* @__PURE__ */ import_react.default.createElement(import_Delete_wght300_24px.default, { className: "pisell-lowcode__booking-service-delete-icon" })
      ), (state == null ? void 0 : state.isBookingTicket2) && /* @__PURE__ */ import_react.default.createElement(
        import_materials.ConfigProvider,
        {
          theme: {
            token: {
              colorPrimary: "#0d7fa9"
            }
          }
        },
        /* @__PURE__ */ import_react.default.createElement(
          import_antd.Button,
          {
            className: "pisell-lowcode__booking-service-buttons-item note-button",
            type: "primary",
            size: "large",
            onClick: () => setNoteModalOpen(true),
            style: { height: "48px", width: "140px" }
          },
          import_utils.locales.getText("pisell2.ticket-booking.note"),
          useNote && /* @__PURE__ */ import_react.default.createElement("span", { className: "note-indicator" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-info-circle2" }))
        )
      )),
      /* @__PURE__ */ import_react.default.createElement(
        import_antd.Button,
        {
          type: "primary",
          className: "pisell-lowcode__booking-service-body-edit-footer-apple",
          disabled: !isNormalProduct && !((_a2 = state.service.resourcesOrigin) == null ? void 0 : _a2.length),
          onClick: () => {
            form.submit();
          }
        },
        import_utils.locales.getText("pisell2.text.apply")
      )
    );
  }, [(_G = state.service.resourcesOrigin) == null ? void 0 : _G.length, isNormalProduct]);
  console.log("render edit");
  console.log(
    state.service.editModal && !((_H = state.service.cacheItem) == null ? void 0 : _H.autoClose),
    performance.now() - window.pp1,
    "打开商品1"
  );
  const [val, setVal] = (0, import_react.useState)(false);
  (0, import_react.useEffect)(() => {
    if (isShowTimeAndResource) {
      setTimeout(() => {
        setVal(true);
      }, 200);
    } else {
      setVal(false);
    }
  }, [isShowTimeAndResource]);
  const groupDom = (0, import_react.useMemo)(() => {
    return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, !!isEditGroup && /* @__PURE__ */ import_react.default.createElement(
      import_EditTabs.default,
      {
        value: currentTab,
        onChange: (e) => {
          console.log(e);
          setCurrentTab(e);
        }
      }
    ), /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: "",
        style: {
          display: currentTab === "booking_list" ? "block" : "none"
        }
      },
      /* @__PURE__ */ import_react.default.createElement(import_BookingList.default, { items })
    ));
  }, [isEditGroup, currentTab, items]);
  const updateMultiDay = async ({ start_date, end_date, duration: duration2 }) => {
    const cacheItem = await (0, import_utils7.getMultiDay)({
      start_date,
      end_date,
      state,
      cacheItem: getCurrentCacheItem()
    });
    if (duration2 !== void 0) {
      cacheItem._extend.duration = duration2;
    }
    cacheItem._extend.items = (0, import_utils9.createBookingItemsByGroup)(cacheItem);
    cacheItem._extend = {
      ...cacheItem._extend,
      ...(0, import_utils9.getGroupTotalPrice)(cacheItem._extend.items)
    };
    dispatch({
      type: "setService",
      payload: {
        cacheItem
      }
    });
    let fieldsValues = {
      total: cacheItem._extend.total
    };
    form.setFieldsValue(fieldsValues);
  };
  const onValuesChange = (changedValues) => {
    if (isEditGroup) {
      if (changedValues == null ? void 0 : changedValues.duration) {
        const end_date = (0, import_dayjs.default)(useStartDate).add(
          changedValues == null ? void 0 : changedValues.duration,
          "day"
        );
        form.setFieldsValue({
          end_date
        });
        return updateMultiDay({
          start_date: useStartDate,
          end_date,
          duration: changedValues == null ? void 0 : changedValues.duration
        });
      }
      if (changedValues == null ? void 0 : changedValues.start_date) {
        const startDate = (0, import_dayjs.default)(changedValues == null ? void 0 : changedValues.start_date);
        const endDate = (0, import_dayjs.default)(useEndDate);
        if (startDate.isAfter(endDate)) {
          return form.setFieldsValue({
            duration: void 0,
            end_date: void 0
          });
        }
      }
      if ((changedValues == null ? void 0 : changedValues.start_date) || (changedValues == null ? void 0 : changedValues.end_date)) {
        const cacheItem = getCurrentCacheItem();
        const duration2 = (0, import_utils6.getDays)(cacheItem, "days");
        const start_date = (changedValues == null ? void 0 : changedValues.start_date) || useStartDate;
        const end_date = (changedValues == null ? void 0 : changedValues.end_date) || useEndDate;
        updateMultiDay({ start_date, end_date, duration: duration2 });
        return form.setFieldsValue({
          duration: duration2
        });
      }
    }
  };
  const deleteDiscountList = (cacheItem) => {
    var _a2, _b2, _c2;
    delete cacheItem.discount_list;
    (_c2 = (_b2 = (_a2 = cacheItem._extend.other) == null ? void 0 : _a2.bundle) == null ? void 0 : _b2.forEach) == null ? void 0 : _c2.call(_b2, (bundle) => {
      var _a3;
      const restoredPrice = getBundleOriginalSellingPrice(bundle);
      if (restoredPrice !== void 0) {
        bundle.price = restoredPrice;
        bundle.original_price = restoredPrice;
        bundle.original_total = restoredPrice;
      }
      (_a3 = bundle == null ? void 0 : bundle.metadata) == null ? true : delete _a3.custom_product_bundle_map_id;
      bundle == null ? true : delete bundle.discount_list;
      bundle == null ? true : delete bundle.booking_id;
      bundle == null ? true : delete bundle.bundle_selling_price;
      bundle == null ? true : delete bundle.bundle_payment_price;
    });
    return cacheItem;
  };
  const getBundleOriginalSellingPrice = (bundle) => {
    const priceSource = (bundle == null ? void 0 : bundle.bundle_sum_price) ?? (bundle == null ? void 0 : bundle.original_total) ?? (bundle == null ? void 0 : bundle.original_price) ?? (bundle == null ? void 0 : bundle.product_price) ?? (bundle == null ? void 0 : bundle.price);
    const price2 = Number(priceSource);
    if (!Number.isFinite(price2)) {
      return void 0;
    }
    if ((bundle == null ? void 0 : bundle.bundle_sum_type) === "markdown") {
      return -Math.abs(price2);
    }
    return price2;
  };
  const handleKeepOriginal = () => {
    setDiscountChangeModalOpen(false);
  };
  const handleContinue = async () => {
    let cacheItem = { ...state.service.cacheItem };
    cacheItem = deleteDiscountList(cacheItem);
    await shopDiscount.batchSearchByProductIds(noInOriginalDiscountIdsRef.current);
    onFinish(valuesRef.current, cacheItem);
    setDiscountChangeModalOpen(false);
  };
  const handleRemove = () => {
    setDiscountChangeModalOpen(false);
    const cacheItem = deleteDiscountList({ ...state.service.cacheItem });
    onFinish(valuesRef.current, cacheItem);
  };
  const handleCancel = () => {
    setDiscountChangeModalOpen(false);
  };
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
    import_drawer.default,
    {
      titleNoWrap: true,
      zIndex: state.service.changeService ? 999 : 1e3,
      forceRender: true,
      mask: state.drawerMask,
      open: !isNoSpecAndPackage && state.service.editModal && !((_I = state.service.cacheItem) == null ? void 0 : _I.autoClose),
      title: import_utils.locales.getText("pisell2.text.edit-service"),
      onClose: () => {
        var _a2;
        (_a2 = window.closeBookingEditModal) == null ? void 0 : _a2.call(window);
        dispatch({
          type: "setService",
          payload: {
            editModal: false,
            cacheItem: null,
            changeService: false
          }
        });
      }
    },
    /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-body-edit" }, groupDom, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Form,
      {
        layout: "vertical",
        form,
        onFinish: onFinishBefore,
        onValuesChange,
        style: {
          display: currentTab === "batch_edit" ? "block" : "none"
        }
      },
      /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { style: { width: "100%" }, gutter: [16, 0] }, productName, price, reason, val && isShowTimeAndResource && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, startTime, endTime, duration, resource, capacity, hiddenQuantity), isNormalProduct && quantity, !(0, import_utils4.isNormalProductByDurationSchedule)(state.service.cacheItem) && !(0, import_utils6.isWalkIn)((_K = (_J = state.client) == null ? void 0 : _J.value) == null ? void 0 : _K.id) && holder),
      /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { noStyle: true, name: "note" }, noteModalOpen && /* @__PURE__ */ import_react.default.createElement(
        import_noteModal.default,
        {
          open: noteModalOpen,
          value: form.getFieldValue("note"),
          onConfirm: handleNoteConfirm,
          onDelete: handleNoteDelete,
          onCancel: handleNoteCancel
        }
      ))
    ), footer)
  ), /* @__PURE__ */ import_react.default.createElement(
    import_DiscountChangeModal.default,
    {
      open: discountChangeModalOpen,
      onKeepOriginal: handleKeepOriginal,
      onContinue: handleContinue,
      onRemove: handleRemove,
      onCancel: handleCancel
    }
  ));
};
var editService_default = (0, import_react.forwardRef)(Info);
