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/ticketBooking/components/addServiceVariant/addService.tsx
var addService_exports = {};
__export(addService_exports, {
  default: () => addService_default
});
module.exports = __toCommonJS(addService_exports);
var import_utils = require("@pisell/utils");
var import_react = __toESM(require("react"));
var import_ahooks = require("ahooks");
var import_materials = require("@pisell/materials");
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
var import_utils2 = require("../../../booking/utils");
var import_utils3 = require("../../../booking/info2/service/addService/utils");
var import_utils4 = require("../../../booking/info/service2/utils");
var import_utils5 = require("../../../booking/info/utils");
var import_serviceManager = require("../../../booking/info/service/serviceManager");
var import_ProductDisplayAdapter = __toESM(require("../ProductDisplayAdapter"));
var import_index = require("./index.less");
var import_utils6 = require("../../utils");
var import_notAvailable = __toESM(require("../notAvailable"));
var import_dayjs = __toESM(require("dayjs"));
var import_pisellos = require("../../hooks/pisellos");
var import_utils7 = require("./utils");
var import_materials2 = require("@pisell/materials");
var import_IsActiveContext = require("../../context/IsActiveContext");
var import_utils8 = require("../../../booking/info/service2/Group/utils");
var import_MultiDayTimeSelectModal = __toESM(require("./MultiDayTimeSelectModal"));
var import_selectHolderModal = require("../../../booking/utils/selectHolderModal");
var import_openNormalService = require("../../../booking/info2/service/openNormalService");
var import_useCartChangeEffect = __toESM(require("../../hooks/pisellos/useCartChangeEffect"));
var import_utils9 = require("../../../../pro/skuDetailModal/utils");
var import_responsive = require("../../../../responsive");
var productListResponsiveConfigMap = {
  phone: {
    productSelect: {
      layout: { grid: false, config: "12" },
      productListSetting: {
        imgWidth: "80px",
        imgHeight: "80px",
        coverTextFontSize: 24,
        skuCardPaddingX: 8,
        skuCardPaddingY: 8,
        gap: 10,
        rightStyle: {
          alignItems: "initial",
          minHeight: "80px",
          justifyContent: "space-between"
        }
      }
    },
    skuList: {
      listConfig: {
        columns: 1,
        columnGap: 8,
        rowGap: 8,
        skeletonConfig: {
          imageWidth: 80,
          imageHeight: 80,
          direction: "row",
          gap: 10,
          padding: 8,
          rows: 2
        }
      },
      skuCardAllConfig: {
        skuCardConfig: {
          layoutDirection: "row",
          paddingX: 8,
          paddingY: 8
        },
        skuImageConfig: {
          width: "80px",
          height: "80px",
          textFontSize: 24
        },
        skuTextConfig: {
          skuNameConfig: {
            fontWeight: 600,
            ellipsisCount: 2
          },
          skuSubtitleConfig: {
            ellipsisCount: 1
          },
          skuPriceConfig: {
            priceFontWeight: 600
          }
        },
        style: {
          gap: 10,
          alignItems: "center"
        },
        rightStyle: {
          alignItems: "initial",
          minHeight: "80px",
          justifyContent: "space-between"
        }
      }
    }
  },
  smallTablet: {
    productSelect: {
      layout: { grid: true, config: "12:12" },
      productListSetting: {
        imgWidth: "88px",
        imgHeight: "88px",
        coverTextFontSize: 24,
        skuCardPaddingX: 10,
        skuCardPaddingY: 10,
        gap: 12,
        rightStyle: {
          alignItems: "initial",
          minHeight: "88px",
          justifyContent: "space-between"
        }
      }
    },
    skuList: {
      listConfig: {
        columns: 2,
        columnGap: 10,
        rowGap: 10,
        skeletonConfig: {
          imageWidth: 88,
          imageHeight: 88,
          direction: "row",
          gap: 12,
          padding: 10,
          rows: 2
        }
      },
      skuCardAllConfig: {
        skuCardConfig: {
          layoutDirection: "row",
          paddingX: 10,
          paddingY: 10
        },
        skuImageConfig: {
          width: "88px",
          height: "88px",
          textFontSize: 24
        },
        skuTextConfig: {
          skuNameConfig: {
            fontWeight: 600,
            ellipsisCount: 2
          },
          skuSubtitleConfig: {
            ellipsisCount: 1
          },
          skuPriceConfig: {
            priceFontWeight: 600
          }
        },
        style: {
          gap: 12,
          alignItems: "center"
        },
        rightStyle: {
          alignItems: "initial",
          minHeight: "88px",
          justifyContent: "space-between"
        }
      }
    }
  },
  tablet: {
    productSelect: {
      layout: { grid: true, config: "12:12" },
      productListSetting: {
        imgWidth: "96px",
        imgHeight: "88px",
        coverTextFontSize: 28,
        skuCardPaddingX: 10,
        skuCardPaddingY: 10,
        gap: 12,
        rightStyle: {
          alignItems: "initial",
          minHeight: "88px",
          justifyContent: "space-between"
        }
      }
    },
    skuList: {
      listConfig: {
        columns: 3,
        columnGap: 12,
        rowGap: 12,
        skeletonConfig: {
          imageWidth: "100%",
          imageHeight: 104,
          direction: "column",
          gap: 10,
          padding: 10,
          rows: 2
        }
      },
      skuCardAllConfig: {
        skuCardConfig: {
          layoutDirection: "column",
          paddingX: 10,
          paddingY: 10
        },
        skuImageConfig: {
          width: "100%",
          height: "104px",
          textFontSize: 30
        },
        skuTextConfig: {
          skuNameConfig: {
            fontWeight: 600,
            ellipsisCount: 2
          },
          skuSubtitleConfig: {
            ellipsisCount: 1
          },
          skuPriceConfig: {
            priceFontWeight: 600
          }
        }
      }
    }
  },
  pos: {
    productSelect: {
      layout: { grid: true, config: "12:12" }
    }
  },
  desktop: {
    productSelect: {
      layout: { grid: true, config: "8:8:8" },
      productListSetting: {
        imgWidth: "120px",
        imgHeight: "96px",
        coverTextFontSize: 36,
        skuCardPaddingX: 12,
        skuCardPaddingY: 12,
        gap: 12,
        rightStyle: {
          alignItems: "initial",
          minHeight: "96px",
          justifyContent: "space-between"
        }
      }
    },
    skuList: {
      listConfig: {
        columns: 5,
        columnGap: 12,
        rowGap: 12,
        skeletonConfig: {
          imageWidth: "100%",
          imageHeight: 112,
          direction: "column",
          gap: 12,
          padding: 12,
          rows: 2
        }
      },
      skuCardAllConfig: {
        skuCardConfig: {
          layoutDirection: "column",
          paddingX: 12,
          paddingY: 12
        },
        skuImageConfig: {
          width: "100%",
          height: "112px",
          textFontSize: 32
        },
        skuTextConfig: {
          skuNameConfig: {
            fontWeight: 600,
            ellipsisCount: 2
          },
          skuSubtitleConfig: {
            ellipsisCount: 1
          },
          skuPriceConfig: {
            priceFontWeight: 600
          }
        }
      }
    }
  }
};
var getProductListResponsiveConfig = (variant) => {
  if (!variant) return void 0;
  return productListResponsiveConfigMap[variant];
};
var getProductDisplayResponsiveMode = (config) => {
  if (config === "sku-list-a2") return "skuListA2";
  if (config === "sku-list-a5") return "skuListA5";
  return void 0;
};
var getColumnsFromProductSelectLayout = (layout) => {
  const layoutConfig = layout == null ? void 0 : layout.config;
  if (!layoutConfig) return void 0;
  return layoutConfig.split(":").filter(Boolean).length || void 0;
};
var omitUndefined = (obj) => {
  return Object.entries(obj).reduce((acc, [key, value]) => {
    if (value !== void 0) {
      acc[key] = value;
    }
    return acc;
  }, {});
};
var getSkuListA2ResponsiveConfig = (config) => {
  if (!config) return void 0;
  const setting = config.productListSetting || {};
  const columns = getColumnsFromProductSelectLayout(config.layout);
  const imageWidth = setting.imgWidth;
  const imageHeight = setting.imgHeight;
  const paddingX = setting.skuCardPaddingX;
  const paddingY = setting.skuCardPaddingY;
  const gap = setting.gap;
  return {
    listConfig: omitUndefined({
      columns,
      columnGap: gap,
      rowGap: gap,
      skeletonConfig: imageWidth && imageHeight ? omitUndefined({
        imageWidth,
        imageHeight,
        direction: "row",
        gap,
        padding: paddingY ?? paddingX,
        rows: 2
      }) : void 0
    }),
    skuCardAllConfig: {
      skuCardConfig: omitUndefined({
        layoutDirection: "row",
        paddingX,
        paddingY
      }),
      skuImageConfig: omitUndefined({
        width: imageWidth,
        height: imageHeight,
        textFontSize: setting.coverTextFontSize
      }),
      style: omitUndefined({
        gap,
        alignItems: "center"
      }),
      rightStyle: setting.rightStyle
    }
  };
};
var mergeSkuTextConfig = (base = {}, override = {}) => ({
  ...base,
  ...override,
  infoConfig: {
    ...base.infoConfig,
    ...override.infoConfig
  },
  skuNameConfig: {
    ...base.skuNameConfig,
    ...override.skuNameConfig
  },
  skuSubtitleConfig: {
    ...base.skuSubtitleConfig,
    ...override.skuSubtitleConfig
  },
  skuPriceConfig: {
    ...base.skuPriceConfig,
    ...override.skuPriceConfig
  },
  skuStockConfig: {
    ...base.skuStockConfig,
    ...override.skuStockConfig
  }
});
var mergeSkuCardAllConfig = (base = {}, override = {}) => ({
  ...base,
  ...override,
  skuCardConfig: {
    ...base.skuCardConfig,
    ...override.skuCardConfig
  },
  skuImageConfig: {
    ...base.skuImageConfig,
    ...override.skuImageConfig
  },
  skuTextConfig: mergeSkuTextConfig(base.skuTextConfig, override.skuTextConfig),
  skuActionConfig: {
    ...base.skuActionConfig,
    ...override.skuActionConfig
  },
  skuExtraConfig: {
    ...base.skuExtraConfig,
    ...override.skuExtraConfig
  },
  style: {
    ...base.style,
    ...override.style
  },
  rightStyle: {
    ...base.rightStyle,
    ...override.rightStyle
  }
});
var AddSerivce = (props) => {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
  const {
    onEdit,
    state,
    dispatch,
    renderMode = "current",
    onPrerenderComplete,
    onGetProductsReady,
    productDisplayConfig,
    variant
  } = props;
  console.log("AddSerivce props", props);
  const context = (0, import_useEngineContext.default)();
  const platform = (0, import_useEngineContext.usePlatform)();
  const {
    getData
  } = (_a = context.appHelper) == null ? void 0 : _a.utils;
  const notAvailableRef = (0, import_react.useRef)(null);
  import_utils2.request.setRequest(context.appHelper.utils.request);
  const isActive = (0, import_IsActiveContext.useIsActive)();
  const pisellos = (0, import_useEngineContext.usePisellOS)();
  const { onCartChange } = (0, import_useCartChangeEffect.default)();
  const Toast = (0, import_materials2.useToast)();
  const { createBookingData, createBooking } = (0, import_serviceManager.useService)({
    renderMode,
    onEdit,
    state,
    dispatch
  });
  const isBooking4 = (0, import_utils5.isBooking4Shop)(
    ((_d = (_c = (_b = context.appHelper) == null ? void 0 : _b.utils) == null ? void 0 : _c.getData) == null ? void 0 : _d.call(_c, "shop_id")) || ((_i = (_h = (_g = (_f = (_e = context.appHelper.utils.store) == null ? void 0 : _e.getState) == null ? void 0 : _f.call(_e)) == null ? void 0 : _g.global) == null ? void 0 : _h.globalConfig) == null ? void 0 : _i.id),
    state == null ? void 0 : state.renderType,
    (_j = context.appHelper.utils) == null ? void 0 : _j.businessUtils
  );
  const [currentProduct, setCurrentProduct] = (0, import_react.useState)(null);
  const [firstLoading, setFirstLoading] = (0, import_react.useState)(true);
  const [multiDayModalOpen, setMultiDayModalOpen] = (0, import_react.useState)(false);
  const [multiDayModalLoading, setMultiDayModalLoading] = (0, import_react.useState)(false);
  const [pendingMultiDayData, setPendingMultiDayData] = (0, import_react.useState)(null);
  const [directStockAlertOpen, setDirectStockAlertOpen] = (0, import_react.useState)(false);
  const [directStockAlertDontShowAgainChecked, setDirectStockAlertDontShowAgainChecked] = (0, import_react.useState)(false);
  const directStockPendingRef = (0, import_react.useRef)(null);
  const directStockProductIdRef = (0, import_react.useRef)(0);
  const stateRef = (0, import_react.useRef)(state);
  stateRef.current = state;
  const prerenderCompletedRef = (0, import_react.useRef)(false);
  const latestServiceValueRef = (0, import_react.useRef)(((_k = state == null ? void 0 : state.service) == null ? void 0 : _k.value) || []);
  const lastOperationTimeRef = (0, import_react.useRef)(0);
  const productDisplayAdapterRef = (0, import_react.useRef)(null);
  const isInFastClickMode = () => {
    const now = Date.now();
    return now - lastOperationTimeRef.current < 2e3;
  };
  const getCurrentServiceValue = () => {
    var _a2, _b2, _c2;
    if (isInFastClickMode()) {
      return latestServiceValueRef.current || ((_b2 = (_a2 = stateRef.current) == null ? void 0 : _a2.service) == null ? void 0 : _b2.value) || [];
    } else {
      const stateValue = ((_c2 = state == null ? void 0 : state.service) == null ? void 0 : _c2.value) || [];
      latestServiceValueRef.current = null;
      return stateValue;
    }
  };
  const { getProducts, products, loading, getScheduleTimePoints } = (0, import_pisellos.useProducts)(notAvailableRef);
  (0, import_react.useEffect)(() => {
    if (onGetProductsReady && getProducts) {
      onGetProductsReady(getProducts);
    }
  }, []);
  (0, import_react.useEffect)(() => {
    const timer = setTimeout(() => {
      setFirstLoading(false);
    }, 300);
    return () => {
      clearTimeout(timer);
    };
  }, []);
  (0, import_react.useEffect)(() => {
    return () => {
      Object.values(debounceTimersRef.current).forEach((timer) => {
        if (timer) clearTimeout(timer);
      });
      debounceTimersRef.current = {};
    };
  }, []);
  (0, import_react.useEffect)(() => {
    if (!loading && !prerenderCompletedRef.current) {
      onPrerenderComplete == null ? void 0 : onPrerenderComplete();
      prerenderCompletedRef.current = true;
    }
  }, [loading]);
  (0, import_react.useEffect)(() => {
    const handler = (event) => {
      var _a2, _b2, _c2, _d2;
      const cacheItem = (_a2 = event == null ? void 0 : event.detail) == null ? void 0 : _a2.cacheItem;
      console.log("Modal closed with result:", event.detail.cacheItem);
      if (!(cacheItem == null ? void 0 : cacheItem.id)) return;
      (0, import_utils6.addServiceScroll)(String(cacheItem.id), cacheItem);
      (_d2 = (_c2 = (_b2 = productDisplayAdapterRef.current) == null ? void 0 : _b2.getTabbarRef()) == null ? void 0 : _c2.closeSearchMode) == null ? void 0 : _d2.call(_c2);
    };
    window.addEventListener("onAddNewService", handler);
    return () => {
      window.removeEventListener("onAddNewService", handler);
    };
  }, []);
  const pendingCacheValuesRef = (0, import_react.useRef)({});
  const clickCountRef = (0, import_react.useRef)({});
  const debounceTimersRef = (0, import_react.useRef)({});
  const menuList = (0, import_react.useMemo)(
    () => (0, import_utils6.getEffectiveMenuListIds)(state),
    [state == null ? void 0 : state.associated_menu_list_ids, (_l = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _l.config]
  );
  const customerId = (0, import_react.useMemo)(() => {
    var _a2, _b2;
    return ((_b2 = (_a2 = state.client) == null ? void 0 : _a2.value) == null ? void 0 : _b2.id) || void 0;
  }, [(_n = (_m = state.client) == null ? void 0 : _m.value) == null ? void 0 : _n.id]);
  const scanAddService = (0, import_ahooks.useMemoizedFn)((list, code) => {
    let newService = [...stateRef.current.service.value || []];
    list.forEach((item) => {
      if ((0, import_utils7.isBundle)(item) || (0, import_utils7.isOption)(item)) {
        handleSelectProduct(item);
        return;
      }
      const matchedVariantItems = ((item == null ? void 0 : item.variant) || []).filter(
        (variantItem) => (variantItem == null ? void 0 : variantItem.code) === code || (variantItem == null ? void 0 : variantItem.barcode) === code
      );
      if (matchedVariantItems.length >= 2) {
        handleSelectProduct(item);
        return;
      }
      const values = (0, import_utils7.genValues)(item, code);
      let cacheItem = (0, import_utils7.createCacheItem)(item, values, stateRef.current);
      cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
      cacheItem._holderKey = (0, import_utils6.genHolderKey)(cacheItem);
      cacheItem.autoClose = false;
      let { list: _list, quantity } = (0, import_utils6.addService)(
        [...newService],
        cacheItem,
        stateRef.current
      );
      handleAddToast(cacheItem.title, quantity);
      newService = _list;
    });
    stateRef.current = {
      ...stateRef.current,
      service: {
        ...stateRef.current.service,
        value: newService
      }
    };
    dispatch({
      type: "setService",
      payload: {
        value: newService,
        edit: true
      }
    });
  });
  (0, import_react.useMemo)(() => {
    if (isActive) {
      (0, import_utils7.setHandleSetService)(scanAddService);
      (0, import_utils7.setHandleAddService)((productData, callbackPromotion) => {
        openProductModal(productData, "select", callbackPromotion);
      });
    }
  }, [isActive]);
  const handleAddToast = (title, quantity) => {
    var _a2;
    (_a2 = Toast == null ? void 0 : Toast.success) == null ? void 0 : _a2.call(
      Toast,
      /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-title" }, title), /* @__PURE__ */ import_react.default.createElement("div", { className: "add-toast-quantity" }, import_utils.locales.getText("pisell2.ticket-booking.in-cart")(quantity || 1)))
    );
  };
  const executeCacheValues = (0, import_ahooks.useMemoizedFn)(
    (productId, originalCacheValues, item, originalCallback) => {
      const clickCount = clickCountRef.current[productId] || 1;
      const finalCacheValues = {
        ...originalCacheValues,
        quantity: clickCount
      };
      delete pendingCacheValuesRef.current[productId];
      delete clickCountRef.current[productId];
      delete debounceTimersRef.current[productId];
      originalCallback(finalCacheValues, "", item, true);
      lastOperationTimeRef.current = Date.now();
    }
  );
  const debouncedExecuteCacheValues = (0, import_ahooks.useMemoizedFn)(
    (productId, cacheValues, item, callback) => {
      if (debounceTimersRef.current[productId]) {
        clearTimeout(debounceTimersRef.current[productId]);
      }
      const debounceTime = Number(localStorage.getItem("pisell_service_add_debounce_time")) || 0;
      debounceTimersRef.current[productId] = setTimeout(() => {
        executeCacheValues(productId, cacheValues, item, callback);
      }, debounceTime);
    }
  );
  const checkResourceAvailability = (0, import_ahooks.useMemoizedFn)((item) => {
    var _a2;
    if (!(0, import_utils4.isNormalProductByDurationSchedule)(item)) {
      if (!Array.isArray((_a2 = state.service) == null ? void 0 : _a2.resourcesOrigin) || !state.service.resourcesOrigin.length) {
        dispatch({
          type: "setService",
          payload: {
            ...stateRef.current.service,
            reloadResourceModal: true
          }
        });
        return false;
      }
    }
    return true;
  });
  const createCacheItemFromParams = (0, import_ahooks.useMemoizedFn)((item, params, detail, options) => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
    const _detail = detail || item;
    const other = JSON.parse(JSON.stringify(params));
    other.session = params.session;
    let cacheItem = {
      ..._detail,
      product_id: item.id,
      _id: (0, import_utils.getUniqueId)(),
      is_price_include_tax: getData("is_price_include_tax"),
      _key: params.key,
      _extend: {
        start_date: (options == null ? void 0 : options.startDate) || state.date.value,
        quantity: (params == null ? void 0 : params.quantity) || 1,
        product_name: item.title,
        other,
        end_date: options == null ? void 0 : options.endDate,
        isFormSubject: ((_d2 = (_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.appointment_subject) == null ? void 0 : _d2.type) === "form",
        isNormalProduct: (0, import_utils4.isNormalProductByDurationSchedule)(item),
        note: (_e2 = _detail == null ? void 0 : _detail._extend) == null ? void 0 : _e2.note,
        priceOverride: (_f2 = _detail == null ? void 0 : _detail._extend) == null ? void 0 : _f2.priceOverride,
        origin_total: (_g2 = _detail == null ? void 0 : _detail._extend) == null ? void 0 : _g2.origin_total,
        // 用于在购物车里唤醒 sku 弹窗时，复原商品的选择数据
        // 因为packages/private-materials/src/components/booking/info2/service/editNormalService/index.tsx
        // 可能会去修改option 之类的 price 字段，所以这里必须先 cloneDeep 一次，再次打开 SKU 弹窗时，应该使用没有修改的价格才对
        _skuValue: (_h2 = _detail == null ? void 0 : _detail._extend) == null ? void 0 : _h2.skuValue,
        price: (_i2 = _detail == null ? void 0 : _detail._extend) == null ? void 0 : _i2.price,
        weighing: (_j2 = _detail == null ? void 0 : _detail._extend) == null ? void 0 : _j2.weighing
      },
      new: 1
    };
    cacheItem._extend.price = (0, import_utils2.getMainPrice)(cacheItem, ((_k2 = _detail == null ? void 0 : _detail._extend) == null ? void 0 : _k2.price) ?? _detail.price);
    let _total = (0, import_utils2.getProductTotalPrice)(cacheItem);
    cacheItem._extend.total = _total;
    if (!((_l2 = cacheItem._extend) == null ? void 0 : _l2.origin_total) && ((_m2 = cacheItem._extend) == null ? void 0 : _m2.origin_total) !== 0) {
      cacheItem._extend.origin_total = _total;
    }
    const _isEdit = !!state.service.cacheItem;
    if (_isEdit) {
      cacheItem._id = (_n2 = state.service.cacheItem) == null ? void 0 : _n2._id;
      cacheItem.new = 0;
    }
    if (renderMode === "current") {
      cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
    }
    const isNormalProduct = (0, import_utils4.isNormalProductByDurationSchedule)(item);
    cacheItem = isNormalProduct ? { ...cacheItem, autoClose: true } : (0, import_utils3.getProductExtend)({
      cacheItem,
      state,
      isDisabledTime: true
    });
    if (state.renderType === "eventBooking") {
      cacheItem.autoClose = false;
    }
    return cacheItem;
  });
  const getProductKey = (0, import_ahooks.useMemoizedFn)((item, cacheItem) => {
    return cacheItem._serviceKey || `${item.id}_${cacheItem._key}`;
  });
  const getServiceQuantity = (0, import_ahooks.useMemoizedFn)((cacheItem) => {
    var _a2, _b2;
    const existingService = (_a2 = stateRef.current.service.value) == null ? void 0 : _a2.find(
      (val) => (0, import_utils6.isSameProduct)(val, cacheItem)
    );
    return ((_b2 = existingService == null ? void 0 : existingService._extend) == null ? void 0 : _b2.quantity) || 0;
  });
  const getMultiDayCacheItem = async (cacheItem, isConcatBookings) => {
    cacheItem = await (0, import_utils3.getMultiDay)({
      start_date: cacheItem._extend.start_date,
      end_date: cacheItem._extend.end_date,
      state: stateRef.current,
      cacheItem
    });
    cacheItem = (0, import_utils8.createBookingItemsByGroup)(cacheItem);
    if (isConcatBookings) {
      cacheItem = (0, import_utils8.concatBookings)(cacheItem);
    }
    return cacheItem;
  };
  const processAutoCloseService = (0, import_ahooks.useMemoizedFn)(async (cacheItem, item, detail, notShowToast, callbackPromotion) => {
    var _a2;
    console.time("processAutoCloseService2");
    cacheItem.autoClose = false;
    cacheItem._serviceKey = (0, import_utils6.genServiceKey)(cacheItem);
    const isMultiDay = (0, import_utils3.isMultiDayProduct)(cacheItem);
    if (isMultiDay) {
      cacheItem = await getMultiDayCacheItem(cacheItem);
    }
    if (callbackPromotion) {
      callbackPromotion(cacheItem);
      return;
    }
    const productKey = getProductKey(item, cacheItem);
    const addCount = ((_a2 = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a2.quantity) || 1;
    if (pendingCacheValuesRef.current[productKey]) {
      clickCountRef.current[productKey] = (clickCountRef.current[productKey] || 1) + addCount;
    } else {
      pendingCacheValuesRef.current[productKey] = { cacheItem, item, detail, notShowToast };
      clickCountRef.current[productKey] = addCount;
    }
    if (!notShowToast) {
      const originalQuantity = getServiceQuantity(cacheItem);
      const currentClickCount = clickCountRef.current[productKey] || 1;
      const totalQuantity = originalQuantity + currentClickCount;
      handleAddToast(cacheItem.title, totalQuantity);
    }
    if (debounceTimersRef.current[productKey]) {
      clearTimeout(debounceTimersRef.current[productKey]);
    }
    const debounceTime = Number(localStorage.getItem("pisell_service_add_debounce_time")) || 0;
    debounceTimersRef.current[productKey] = setTimeout(() => {
      executeServiceDispatch(productKey, isMultiDay);
    }, debounceTime);
    console.timeEnd("processAutoCloseService2");
  });
  const executeServiceDispatch = (0, import_ahooks.useMemoizedFn)((productKey, isMultiDay) => {
    var _a2;
    console.time("executeServiceDispatch");
    console.time("executeServiceDispatch1");
    const pendingData = pendingCacheValuesRef.current[productKey];
    if (!pendingData) return;
    const { cacheItem, item, detail } = pendingData;
    const clickCount = clickCountRef.current[productKey] || ((_a2 = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a2.quantity) || 1;
    const finalCacheItem = isMultiDay ? cacheItem : {
      ...cacheItem,
      _extend: {
        ...cacheItem._extend,
        quantity: clickCount
      }
    };
    console.timeEnd("executeServiceDispatch1");
    console.time("executeServiceDispatch addService");
    let { list: _list, quantity } = (0, import_utils6.addService)(
      [...stateRef.current.service.value || []],
      finalCacheItem,
      stateRef.current,
      isMultiDay
    );
    console.timeEnd("executeServiceDispatch addService");
    console.time("executeServiceDispatch2");
    window.dispatchEvent(
      new CustomEvent("onAddNewService", {
        detail: {
          cacheItem: finalCacheItem
        }
      })
    );
    console.timeEnd("executeServiceDispatch2");
    console.time("executeServiceDispatch3");
    logServiceForSpecificShop(item, detail, _list);
    stateRef.current = {
      ...stateRef.current,
      service: {
        ...stateRef.current.service,
        value: _list
      }
    };
    onCartChange("add", _list);
    dispatch({
      type: "setService",
      payload: {
        addModal: false,
        value: _list,
        edit: true,
        changeService: false
      }
    });
    console.timeEnd("executeServiceDispatch3");
    console.timeEnd("executeServiceDispatch");
    delete pendingCacheValuesRef.current[productKey];
    delete clickCountRef.current[productKey];
    delete debounceTimersRef.current[productKey];
  });
  const processManualEditService = (0, import_ahooks.useMemoizedFn)(async (cacheItem, callbackPromotion) => {
    var _a2;
    (_a2 = window.openBookingEditModal) == null ? void 0 : _a2.call(window);
    const isMultiDay = (0, import_utils3.isMultiDayProduct)(cacheItem);
    if (isMultiDay) {
      cacheItem = await getMultiDayCacheItem(cacheItem, true);
    }
    dispatch({
      type: "setService",
      payload: {
        editModal: true,
        cacheItem,
        addModal: !cacheItem.autoClose,
        changeService: false,
        callbackPromotion
      }
    });
    onEdit == null ? void 0 : onEdit(cacheItem);
  });
  const logServiceForSpecificShop = (0, import_ahooks.useMemoizedFn)((item, detail, _list) => {
    var _a2, _b2, _c2, _d2, _e2;
    try {
      if (((_e2 = (_d2 = (_c2 = (_b2 = (_a2 = context.appHelper.utils.store) == null ? void 0 : _a2.getState) == null ? void 0 : _b2.call(_a2)) == null ? void 0 : _c2.global) == null ? void 0 : _d2.globalConfig) == null ? void 0 : _e2.id) === 2155) {
        const val = _list == null ? void 0 : _list.map((s) => {
          return {
            product_id: s == null ? void 0 : s.product_id,
            detailId: s == null ? void 0 : s.id,
            detailProductId: s == null ? void 0 : s.product_id,
            product_name: s == null ? void 0 : s.title,
            price: s == null ? void 0 : s.price,
            _id: s == null ? void 0 : s._id,
            _key: s == null ? void 0 : s._key,
            _serviceKey: s == null ? void 0 : s._serviceKey
          };
        });
        const sendData = {
          product_id: item == null ? void 0 : item.id,
          detailId: detail == null ? void 0 : detail.id,
          detailProductId: detail == null ? void 0 : detail.product_id,
          product_name: item == null ? void 0 : item.title,
          price: detail == null ? void 0 : detail.price,
          serviceVal: val
        };
        (0, import_utils.sendWarningLog)({
          title: "addService",
          content: [
            { key: "添加数据", value: JSON.stringify(sendData) },
            {
              key: "日期",
              value: (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss")
            }
          ]
        });
      }
    } catch (error) {
    }
  });
  const handleBookingCreation = (0, import_ahooks.useMemoizedFn)(async (item, params, detail) => {
    const data = await createBookingData({
      product: { ...detail || item, _params: params }
    });
    createBooking({ booking: data });
  });
  const handleMultiDayConfirm = (0, import_ahooks.useMemoizedFn)(async (startDate, endDate, duration) => {
    if (!pendingMultiDayData) return;
    setMultiDayModalLoading(true);
    try {
      const { item, detail, e, notShowToast } = pendingMultiDayData;
      await handleBooking4Service(item, e, detail, notShowToast, {
        startDate,
        endDate
      });
      setPendingMultiDayData(null);
      setMultiDayModalOpen(false);
    } catch (error) {
      console.error("添加跨日商品失败:", error);
    } finally {
      setMultiDayModalLoading(false);
    }
  });
  const handleMultiDayCancel = (0, import_ahooks.useMemoizedFn)(() => {
    setMultiDayModalOpen(false);
    setPendingMultiDayData(null);
  });
  const handleAddHolder = (0, import_ahooks.useMemoizedFn)(async (cacheItem) => {
    var _a2, _b2, _c2;
    const holderConfig = ((_b2 = (_a2 = stateRef.current) == null ? void 0 : _a2.bookingConfig) == null ? void 0 : _b2.holder) || {};
    const currentMaxSelectedCount = (holderConfig == null ? void 0 : holderConfig.maxSelectedCount) || ((_c2 = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _c2.quantity) || 1;
    const result = await (0, import_selectHolderModal.selectHolderModal)({
      state: stateRef.current,
      dispatch,
      maxSelectedCount: currentMaxSelectedCount
    });
    return result;
  });
  const handleBooking4Service = (0, import_ahooks.useMemoizedFn)(async (item, params, detail, notShowToast, options) => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2;
    let cacheItem = createCacheItemFromParams(item, params, detail, options);
    const callbackPromotion = options == null ? void 0 : options.callbackPromotion;
    if (!(0, import_utils4.isNormalProductByDurationSchedule)(cacheItem) && (!cacheItem._extend.holder_id || !cacheItem._extend.holder_id.length) && !(0, import_utils2.isWalkIn)((_b2 = (_a2 = state.client) == null ? void 0 : _a2.value) == null ? void 0 : _b2.id) && ((_f2 = (_e2 = (_d2 = (_c2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _c2.config) == null ? void 0 : _d2.basic) == null ? void 0 : _e2.appointment_subject) == null ? void 0 : _f2.type) === "form" && ((_j2 = (_i2 = (_h2 = (_g2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _g2.config) == null ? void 0 : _h2.basic) == null ? void 0 : _i2.appointment_subject) == null ? void 0 : _j2.show_hold_on_add_cart) !== 0 && !callbackPromotion) {
      const res = await handleAddHolder(cacheItem);
      if (res && res.length > 0) {
        cacheItem._extend.holder_id = res;
      } else {
        if (((_m2 = (_l2 = (_k2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _k2.config) == null ? void 0 : _l2.basic) == null ? void 0 : _m2.subject_require) === "require") {
          return;
        }
      }
    }
    if (cacheItem.autoClose) {
      await processAutoCloseService(cacheItem, item, detail, notShowToast, callbackPromotion);
    } else {
      await processManualEditService(cacheItem, callbackPromotion);
    }
  });
  const proceedDirectAddService = (0, import_ahooks.useMemoizedFn)(async (params) => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2;
    const { cacheItem, item, detail } = params;
    if (!(0, import_utils4.isNormalProductByDurationSchedule)(cacheItem) && (!cacheItem._extend.holder_id || !cacheItem._extend.holder_id.length) && !(0, import_utils2.isWalkIn)((_b2 = (_a2 = state.client) == null ? void 0 : _a2.value) == null ? void 0 : _b2.id) && ((_f2 = (_e2 = (_d2 = (_c2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _c2.config) == null ? void 0 : _d2.basic) == null ? void 0 : _e2.appointment_subject) == null ? void 0 : _f2.type) === "form" && ((_j2 = (_i2 = (_h2 = (_g2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _g2.config) == null ? void 0 : _h2.basic) == null ? void 0 : _i2.appointment_subject) == null ? void 0 : _j2.show_hold_on_add_cart) !== 0) {
      const res = await handleAddHolder(cacheItem);
      if (res && res.length > 0) {
        cacheItem._extend.holder_id = res;
      } else {
        if (((_m2 = (_l2 = (_k2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _k2.config) == null ? void 0 : _l2.basic) == null ? void 0 : _m2.subject_require) === "require") {
          return;
        }
      }
    }
    if (cacheItem.autoClose) {
      await processAutoCloseService(cacheItem, item, detail || item, false);
    } else {
      await processManualEditService(cacheItem);
    }
  });
  const handleDirectStockAlertCancel = (0, import_ahooks.useMemoizedFn)(() => {
    directStockPendingRef.current = null;
    directStockProductIdRef.current = 0;
    setDirectStockAlertOpen(false);
    setDirectStockAlertDontShowAgainChecked(false);
  });
  const handleDirectStockAlertContinue = (0, import_ahooks.useMemoizedFn)(async () => {
    var _a2, _b2, _c2, _d2;
    const pendingData = directStockPendingRef.current;
    if (!pendingData) {
      setDirectStockAlertOpen(false);
      return;
    }
    if (Number(
      ((_d2 = (_c2 = (_b2 = (_a2 = stateRef.current) == null ? void 0 : _a2.bookingConfig) == null ? void 0 : _b2.config) == null ? void 0 : _c2.stock_setting) == null ? void 0 : _d2.do_not_show_again_today) ?? 0
    ) === 1 && directStockAlertDontShowAgainChecked) {
      (0, import_utils9.setHiddenStockAlertForToday)({
        productId: directStockProductIdRef.current
      });
    }
    await proceedDirectAddService(pendingData);
    directStockPendingRef.current = null;
    directStockProductIdRef.current = 0;
    setDirectStockAlertOpen(false);
    setDirectStockAlertDontShowAgainChecked(false);
  });
  const handleDirectAddService = (0, import_ahooks.useMemoizedFn)(async (item) => {
    var _a2;
    if (!isBooking4) {
      await handleBookingCreation(item, item.cartDetailValue);
      return;
    }
    const cacheItem = createCacheItemFromParams(item, item.cartDetailValue);
    const stockResult = (0, import_utils9.getStockValidationResult)({
      value: item == null ? void 0 : item.cartDetailValue,
      data: item,
      bookingConfig: (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config
    });
    if (stockResult.shouldBlock) {
      Toast == null ? void 0 : Toast.fail(
        import_utils.locales.getText("pisell2.skuOptionsSelection.variantItemCard.soldOut")
      );
      return;
    }
    if (stockResult.shouldShowAlert) {
      directStockPendingRef.current = {
        cacheItem,
        item,
        detail: item
      };
      directStockProductIdRef.current = stockResult.productId;
      setDirectStockAlertDontShowAgainChecked(false);
      setDirectStockAlertOpen(true);
      return;
    }
    await proceedDirectAddService({
      cacheItem,
      item,
      detail: item
    });
  });
  const createProductModalCallback = (0, import_ahooks.useMemoizedFn)((item, callbackPromotion) => {
    return async (e, extension_type, detail, notShowToast) => {
      setCurrentProduct(null);
      if (!isBooking4) {
        await handleBookingCreation(item, e, detail);
        return;
      }
      const isMultiDay = (0, import_utils3.isMultiDayProduct)(detail || item);
      if (isMultiDay) {
        setPendingMultiDayData({
          item,
          detail,
          e,
          notShowToast
        });
        setMultiDayModalOpen(true);
        return;
      }
      await handleBooking4Service(item, e, detail, notShowToast, {
        startDate: state.date.value,
        callbackPromotion
      });
    };
  });
  const openProductModal = (0, import_ahooks.useMemoizedFn)((item, type = "select", callbackPromotion) => {
    const isSession = (0, import_utils2.isSessionProduct)(item);
    const isOnlySession = (0, import_utils2.getIsOnlySession)(item);
    const isEject = (0, import_utils2.getIsEject)(item, type);
    if ((0, import_utils4.isNormalProductByDurationSchedule)(item)) {
      const openNormalService = (0, import_openNormalService.getOpenNormalServiceHandler)();
      if (openNormalService) {
        openNormalService({
          mode: "create",
          productId: item.id,
          productData: item,
          date: state.date.value.format("YYYY-MM-DD"),
          isEject: isEject ? 1 : 0,
          skuDetailConfig: item.skuDetailConfig || {},
          onClose: () => {
            setCurrentProduct(null);
          },
          callback: createProductModalCallback(item, callbackPromotion)
        });
      }
    } else {
      state.action({
        type: "pisell1.handleOpenProductModal",
        data: {
          id: item.id,
          date: state.date.value.format("YYYY-MM-DD"),
          productDetail: item,
          showConfig: {
            option: true,
            session: isSession,
            variant: true,
            package: true,
            number: (0, import_utils6.getIsShowNumber)(item, state)
          },
          value: item == null ? void 0 : item.initValue,
          isOnlySession,
          is_eject: isEject ? 1 : 0,
          customer_id: customerId,
          isOS: isSession
        },
        onCancel: () => {
          setCurrentProduct(null);
        },
        callback: createProductModalCallback(item, callbackPromotion)
      });
    }
  });
  const handleSelectProduct = (0, import_ahooks.useMemoizedFn)(
    async (item, type = "select") => {
      console.time("handleSelectProduct2");
      console.log(item, "handleSelectProduct");
      console.time("checkResourceAvailability");
      if (!checkResourceAvailability(item)) {
        return;
      }
      console.timeEnd("checkResourceAvailability");
      if (item.open_sold_weight) {
        openProductModal(item, type);
        return;
      }
      if (!item.isOpenDetailModal && item.cartDetailValue) {
        await handleDirectAddService(item);
        return;
      }
      openProductModal(item, type);
    }
  );
  const renderList = (0, import_react.useMemo)(() => {
    let _list = products || [];
    return _list;
  }, [products, state == null ? void 0 : state.activeCartId]);
  const currentDate = (0, import_react.useMemo)(() => {
    return state.date.value.format("YYYY-MM-DD");
  }, [state.date.value]);
  const currentDatetime = (0, import_react.useMemo)(() => {
    return state.date.value.format("YYYY-MM-DD HH:mm:ss");
  }, [state.date.value]);
  (0, import_react.useEffect)(() => {
    if (renderMode === "current" && state.bookingConfig && platform !== "shop") {
      getProducts({
        schedule_date: currentDate,
        customer_id: customerId,
        menu_list_ids: menuList,
        schedule_datetime: currentDatetime
      });
      getScheduleTimePoints({
        menu_list_ids: menuList
      });
    }
  }, [renderMode, customerId, menuList]);
  (0, import_react.useEffect)(() => {
    if (renderMode === "current" && state.bookingConfig && platform === "shop") {
      getProducts({
        schedule_date: currentDate,
        customer_id: customerId,
        menu_list_ids: menuList,
        schedule_datetime: currentDatetime
      });
    }
  }, [renderMode, currentDate, customerId, menuList, currentDatetime]);
  const finalDisplayConfig = (0, import_react.useMemo)(() => {
    const resolvedConfig = (0, import_ProductDisplayAdapter.resolveProductDisplayConfig)(productDisplayConfig);
    const responsiveConfig = getProductListResponsiveConfig(variant);
    const responsiveMode = getProductDisplayResponsiveMode(productDisplayConfig);
    if (responsiveMode === "skuListA2") {
      const skuListConfig = resolvedConfig.skuListConfig || {};
      const skuListA2ResponsiveConfig = getSkuListA2ResponsiveConfig(
        responsiveConfig == null ? void 0 : responsiveConfig.productSelect
      );
      if (!skuListA2ResponsiveConfig) {
        return resolvedConfig;
      }
      return {
        ...resolvedConfig,
        skuListConfig: {
          ...skuListConfig,
          listConfig: {
            ...skuListConfig.listConfig,
            ...skuListA2ResponsiveConfig.listConfig
          },
          skuCardAllConfig: mergeSkuCardAllConfig(
            skuListConfig.skuCardAllConfig,
            skuListA2ResponsiveConfig.skuCardAllConfig
          )
        }
      };
    }
    if (responsiveMode === "skuListA5" && (responsiveConfig == null ? void 0 : responsiveConfig.skuList)) {
      const skuListConfig = resolvedConfig.skuListConfig || {};
      const skuListResponsiveConfig = responsiveConfig.skuList;
      return {
        ...resolvedConfig,
        skuListConfig: {
          ...skuListConfig,
          listConfig: {
            ...skuListConfig.listConfig,
            ...skuListResponsiveConfig.listConfig
          },
          skuCardAllConfig: mergeSkuCardAllConfig(
            skuListConfig.skuCardAllConfig,
            skuListResponsiveConfig.skuCardAllConfig
          )
        }
      };
    }
    return resolvedConfig;
  }, [productDisplayConfig, variant]);
  return (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2, _d2;
    if (renderMode === "current") {
      return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
        import_ProductDisplayAdapter.default,
        {
          ref: productDisplayAdapterRef,
          config: finalDisplayConfig,
          dataSource: renderList,
          loading: !renderList.length && loading || firstLoading,
          currentProductId: currentProduct == null ? void 0 : currentProduct.id,
          onSelectProduct: handleSelectProduct
        }
      ), /* @__PURE__ */ import_react.default.createElement(import_notAvailable.default, { ref: notAvailableRef }), /* @__PURE__ */ import_react.default.createElement(
        import_MultiDayTimeSelectModal.default,
        {
          open: multiDayModalOpen,
          productName: (_a2 = pendingMultiDayData == null ? void 0 : pendingMultiDayData.item) == null ? void 0 : _a2.title,
          locale: state == null ? void 0 : state.locale,
          defaultStartDate: state.date.value,
          loading: multiDayModalLoading,
          onConfirm: handleMultiDayConfirm,
          onCancel: handleMultiDayCancel
        }
      ), /* @__PURE__ */ import_react.default.createElement(import_selectHolderModal.SelectHolderModal, null), /* @__PURE__ */ import_react.default.createElement(
        import_materials.PisellModal,
        {
          platform: "pc",
          open: directStockAlertOpen,
          title: import_utils.locales.getText(
            "pisell2.text.sku.detail.modal.stock.alert.title"
          ),
          headerDivider: false,
          footer: /* @__PURE__ */ import_react.default.createElement(
            "div",
            {
              style: {
                width: "100%",
                display: "flex",
                justifyContent: "flex-end",
                gap: 12
              }
            },
            /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { size: "large", onClick: handleDirectStockAlertCancel }, import_utils.locales.getText(
              "pisell2.text.sku.detail.modal.stock.alert.btn.cancel"
            )),
            /* @__PURE__ */ import_react.default.createElement(
              import_materials.Button,
              {
                type: "primary",
                size: "large",
                onClick: handleDirectStockAlertContinue
              },
              import_utils.locales.getText(
                "pisell2.text.sku.detail.modal.stock.alert.btn.continue"
              )
            )
          ),
          width: 520,
          centered: true,
          destroyOnClose: true,
          maskClosable: false,
          zIndex: 2e3,
          onCancel: handleDirectStockAlertCancel
        },
        /* @__PURE__ */ import_react.default.createElement("div", { style: { padding: "40px 0 0 0" } }, /* @__PURE__ */ import_react.default.createElement("div", { style: { color: "#344054", fontSize: 14, lineHeight: "22px" } }, import_utils.locales.getText("pisell2.text.sku.detail.modal.stock.alert.desc")), Number(
          ((_d2 = (_c2 = (_b2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _b2.config) == null ? void 0 : _c2.stock_setting) == null ? void 0 : _d2.do_not_show_again_today) ?? 0
        ) === 1 && /* @__PURE__ */ import_react.default.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ import_react.default.createElement(
          import_materials.Checkbox,
          {
            checked: directStockAlertDontShowAgainChecked,
            onChange: (e) => {
              var _a3;
              setDirectStockAlertDontShowAgainChecked(!!((_a3 = e == null ? void 0 : e.target) == null ? void 0 : _a3.checked));
            }
          },
          import_utils.locales.getText(
            "pisell2.text.sku.detail.modal.stock.alert.checkbox"
          )
        )))
      ));
    }
    return null;
  }, [
    firstLoading,
    state.service.addModal,
    import_utils.locales,
    renderList,
    state.amountSymbol,
    state.renderType,
    state == null ? void 0 : state.activeCartId,
    (0, import_utils4.holderId)(state),
    loading,
    currentProduct,
    isBooking4,
    finalDisplayConfig,
    multiDayModalOpen,
    pendingMultiDayData,
    multiDayModalLoading,
    directStockAlertOpen,
    directStockAlertDontShowAgainChecked,
    (_q = (_p = (_o = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _o.config) == null ? void 0 : _p.stock_setting) == null ? void 0 : _q.do_not_show_again_today
  ]);
};
AddSerivce.displayName = "AddSerivce";
var addService_default = (0, import_responsive.withResponsive)(AddSerivce);
