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/ticketBooking/index.tsx
var ticketBooking_exports = {};
__export(ticketBooking_exports, {
  _formatBookingDetail: () => _formatBookingDetail,
  default: () => ticketBooking_default
});
module.exports = __toCommonJS(ticketBooking_exports);
var import_react = __toESM(require("react"));
var import_utils = require("@pisell/utils");
var import_antd = require("antd");
var import_materials = require("@pisell/materials");
var import_serve = require("../../serve");
var apis = __toESM(require("../../serve"));
var import_dayjs = __toESM(require("dayjs"));
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
var import_miniRedux = require("../../miniRedux");
var import_info = __toESM(require("../../../../components/booking/info"));
var import_utils2 = require("../../utils");
var import_addServiceVariant = __toESM(require("../addServiceVariant"));
var import_timeBar = __toESM(require("../timeBar"));
var import_utils3 = require("../../../booking/info/service2/utils");
var import_amount = require("../../../booking/components/footer/amount");
var import_formatProductMessage = __toESM(require("../../utils/formatProductMessage"));
var import_pisellFloatingPanel = __toESM(require("../bookingDataPanel/pisellFloatingPanel"));
var import_floatButtons = __toESM(require("../floatButtons"));
var import_useTicketBookingSecondaryScreen = require("./useTicketBookingSecondaryScreen");
var import_useScanGlobal = __toESM(require("../../hooks/pisellos/useScanGlobal"));
var import_useScanGlobalHandle = __toESM(require("../../hooks/pisellos/useScanGlobalHandle"));
var import_bookingTicket = require("../../hooks/pisellos/bookingTicket");
var import_index = require("./index.less");
var import_utils4 = require("../bookingDataPanel/bookingList/utils");
var import_pisellos = require("../../hooks/pisellos");
var import_ahooks = require("ahooks");
var import_useScanManager = __toESM(require("../../hooks/pisellos/useScanManager"));
var import_ahooks2 = require("ahooks");
var import_context = require("../../context");
var import_IsActiveContext = require("../../context/IsActiveContext");
var import_useShopDiscountModule = require("../../hooks/pisellos/useShopDiscountModule");
var import_utils5 = require("../../../booking/utils");
var import_useLogger = __toESM(require("../../../../hooks/useLogger"));
var import_responsive = require("../../../../responsive");
var _formatBookingDetail = (data, modalState) => {
  var _a, _b, _c, _d, _e;
  let {
    customer_id,
    holder,
    customer_name,
    email,
    phone,
    country_calling_code,
    bookings,
    customer,
    note,
    payment_status,
    is_other_entrance_edited,
    shop_discount,
    relation_details = []
  } = data;
  if (!bookings) {
    bookings = {
      list: []
    };
  }
  const clientValue = {
    name: ((customer == null ? void 0 : customer.display_name) || "").trim() || ((customer == null ? void 0 : customer.nickname) || "").trim() || customer_name || "",
    display_name: customer_name || "",
    id: customer_id || (customer == null ? void 0 : customer.id) || (customer == null ? void 0 : customer.customer_id) || 1,
    email: customer == null ? void 0 : customer.email,
    phone: (customer == null ? void 0 : customer.phone) || "",
    country_calling_code: (customer == null ? void 0 : customer.country_calling_code) || "",
    cover: (customer == null ? void 0 : customer.cover) || ""
  };
  const start_date = (_b = (_a = bookings == null ? void 0 : bookings.list) == null ? void 0 : _a[0]) == null ? void 0 : _b.start_date;
  const dateValue = (0, import_dayjs.default)(
    start_date ? start_date + " " + ((_d = (_c = bookings == null ? void 0 : bookings.list) == null ? void 0 : _c[0]) == null ? void 0 : _d.start_time) : /* @__PURE__ */ new Date()
  );
  const petsValue = holder;
  const getCapacity = (resetD) => {
    var _a2;
    return (_a2 = resetD.metadata) == null ? void 0 : _a2.capacity;
  };
  const getResource = (resetD) => {
    var _a2;
    if (!bookings.relation_type) {
      try {
        if ((resetD == null ? void 0 : resetD.event_resources) && ((_a2 = resetD == null ? void 0 : resetD.event_resources) == null ? void 0 : _a2.length)) {
          return resetD.event_resources.reduce((pre, cur) => {
            if (pre[cur.form_id]) {
              pre[cur.form_id].push(cur);
            } else {
              pre[cur.form_id] = [cur];
            }
            return pre;
          }, {});
        }
      } catch (err) {
        console.error(err);
      }
    }
    return resetD.relation_id;
  };
  let serviceValue = (_e = bookings == null ? void 0 : bookings.list) == null ? void 0 : _e.map((d) => {
    var _a2;
    let { detail, product, ...resetD } = d;
    let _detail = detail || mockProduct;
    let start_date2 = (0, import_dayjs.default)(resetD.start_date + " " + resetD.start_time);
    let end_date = (0, import_dayjs.default)(resetD.end_date + " " + resetD.end_time);
    return {
      _id: (Math.random() + "").replace(/\D/g, "").substring(0, 11),
      ..._detail,
      duration: (_detail == null ? void 0 : _detail.duration) || (product == null ? void 0 : product.duration),
      "schedule.ids": (_detail == null ? void 0 : _detail["schedule.ids"]) || (product == null ? void 0 : product["schedule.ids"]),
      booking_id: resetD.id,
      isEditBooking: true,
      id: _detail.product_id,
      title: _detail.product_title,
      quantity: Number(_detail.product_quantity),
      cover: _detail.product_cover,
      // 商品本身的价格
      price: Number(_detail.source_product_price),
      relation_form_name: resetD.relation_form_name,
      product_resource: product == null ? void 0 : product.product_resource,
      capacity: product == null ? void 0 : product.capacity,
      _extend: {
        ...resetD,
        quantity: Number(_detail.product_quantity),
        startDate: start_date2,
        start_date: start_date2,
        endDate: end_date,
        end_date,
        holder_id: (0, import_utils2.formatHolder)(resetD),
        note: _detail.note,
        // 商品本身的价格
        price: Number(_detail.source_product_price),
        product_name: _detail.product_title,
        discount_reason: _detail.product_discount_reason,
        // resource: resetD.relation_id,
        order_detail_id: _detail.order_detail_id,
        // 总价: 商品本身价格 + 套餐价格 + 单规格价格   包含折扣
        total: Number(_detail.selling_price),
        // 原总价: 商品本身价格 + 套餐价格 + 单规格价格 不包含折扣
        origin_total: Number(_detail.original_price),
        payment_price: Number(_detail.payment_price),
        other: (0, import_utils2.restoreProductOtherData)(d),
        // 是否编辑了套餐 默认为0  如果编辑之后为1
        bundle_edit: 0,
        discount_per: _detail.discount_per,
        discount_type: _detail.discount_type,
        discountway: _detail.discountway,
        capacity: getCapacity(resetD),
        resource: getResource(resetD),
        main_product_selling_price: (_a2 = _detail.metadata) == null ? void 0 : _a2.main_product_selling_price
      }
    };
  });
  serviceValue = [...serviceValue || [], ...formatProductValues(relation_details || [])];
  let disabledEdit = (0, import_utils2.getDisabledEdit)(data);
  let channelDisabledEdit = !!is_other_entrance_edited;
  return {
    ...modalState,
    client: {
      ...modalState.client,
      value: clientValue,
      edit: false,
      showModal: false
    },
    date: {
      ...modalState.date,
      value: dateValue,
      edit: false,
      showModal: false
    },
    pet: {
      ...modalState.pet,
      showModal: false,
      edit: false
    },
    service: {
      ...modalState.service,
      value: serviceValue,
      addModal: false,
      editModal: false,
      edit: false
    },
    notes: {
      ...modalState.notes,
      orderNote: note,
      edit: false
    },
    disabledEdit,
    channelDisabledEdit,
    appointment_status: bookings == null ? void 0 : bookings.appointment_status
  };
};
var formatProductValues = (data) => {
  return data.map((d) => {
    var _a;
    return {
      ...d,
      _id: (Math.random() + "").replace(/\D/g, "").substring(0, 11),
      id: d.product_id,
      title: d.product_title,
      quantity: d.product_quantity,
      cover: d.product_cover,
      price: Number(d.source_product_price),
      isEditBooking: true,
      _extend: {
        discount_reason: d.product_discount_reason,
        order_detail_id: d.order_detail_id,
        discount_per: d.discount_per,
        discount_type: d.discount_type,
        discountway: d.discountway,
        product_name: d.product_title,
        total: Number(d.selling_price),
        origin_total: Number(d.original_price),
        payment_price: Number(d.payment_price),
        price: Number(d.source_product_price),
        quantity: d.product_quantity,
        bundle_edit: 0,
        other: (0, import_utils2.restoreProductOtherData)(d),
        startDate: (0, import_dayjs.default)(),
        endDate: (0, import_dayjs.default)(),
        note: d.note,
        main_product_selling_price: (_a = d.metadata) == null ? void 0 : _a.main_product_selling_price
      },
      payment_price: Number(d.payment_price)
    };
  });
};
var TicketBooking = (props) => {
  var _a, _b, _c, _d, _e, _f, _g, _h;
  const {
    onPrerenderComplete,
    productDisplayConfig,
    isShowTimeBar = true,
    isShowFloatButtons = true,
    secondaryScreenDisplay,
    bodyTopSlot,
    variant
  } = props;
  const [state, setState] = (0, import_miniRedux.useStore)();
  const getProductsRef = (0, import_react.useRef)(null);
  const handleGetProductsReady = (0, import_ahooks.useMemoizedFn)((getProducts) => {
    getProductsRef.current = getProducts;
  });
  const engineContext = (0, import_useEngineContext.default)();
  const logger = (0, import_useLogger.default)();
  const { props: engineProps } = engineContext.engine;
  const {
    action,
    isTerminal,
    lowcodeRef,
    interaction,
    store,
    storage,
    getSymbolic,
    translation,
    pisellosAllModule,
    getData,
    getApp
  } = (_a = engineContext.appHelper) == null ? void 0 : _a.utils;
  const { ScheduleModule } = pisellosAllModule;
  const Toast = (0, import_materials.useToast)();
  const _persistentRef = (0, import_react.useRef)(false);
  const _initStateRef = (0, import_react.useRef)({});
  const _listTimerRef = (0, import_react.useRef)();
  const _timerRef = (0, import_react.useRef)();
  const _callbackFnRef = (0, import_react.useRef)();
  const _isFirstLoadBoardConfigRef = (0, import_react.useRef)(true);
  const [activeBookingId, setActiveBookingId] = (0, import_react.useState)(0);
  const [showTerminalUpgradeModal, setShowTerminalUpgradeModal] = (0, import_react.useState)(false);
  const [timeBarDrawerOpen, setTimeBarDrawerOpen] = (0, import_react.useState)(false);
  const pisellFloatingPanelRef = (0, import_react.useRef)(null);
  const closeRef = (0, import_react.useRef)(null);
  const shopDiscount = (0, import_useShopDiscountModule.useShopDiscountModule)();
  const isActive = (0, import_IsActiveContext.useIsActive)();
  const osKey = (0, import_context.useOsKey)();
  const bookingTicket = (0, import_bookingTicket.useBookingTicket)();
  const { openScan, closeScan } = (0, import_useScanGlobal.default)();
  const handleScan = (0, import_useScanGlobalHandle.default)();
  const { enableAllScanListeners } = (0, import_useScanManager.default)();
  const changeCustomerToGlobalState = (0, import_ahooks.useMemoizedFn)(() => {
  });
  const app = getApp == null ? void 0 : getApp();
  const { runtime } = ((_d = (_c = (_b = app == null ? void 0 : app.getPlugin) == null ? void 0 : _b.call(app, "unifiedCommunication")) == null ? void 0 : _c.useRuntime) == null ? void 0 : _d.call(_c)) || {};
  const {
    isSecondaryScreen,
    secondaryProductsPerRow,
    bookingInfoModules,
    mainContentWrapperProps,
    secondaryScreenSettingsModal
  } = (0, import_useTicketBookingSecondaryScreen.useTicketBookingSecondaryScreen)(runtime, secondaryScreenDisplay);
  const { selectCustomer } = (0, import_pisellos.useCustomer)({
    changeCustomerToGlobalState
  });
  const checkTerminalVersion = (0, import_ahooks.useMemoizedFn)(() => {
    if (isTerminal()) {
      const userAgent = navigator.userAgent;
      if (userAgent.includes("terminal")) {
        const terminalVersionMatch = userAgent.match(
          /terminal\/[\d.]+\((\d+)\)/i
        );
        if (terminalVersionMatch && terminalVersionMatch[1]) {
          const buildNumberStr = terminalVersionMatch[1];
          const buildNumber = parseInt(buildNumberStr, 10);
          if (userAgent.includes("com.funtovia.pos")) {
            if (!isNaN(buildNumber) && buildNumber > 0 && buildNumber < 7) {
              setShowTerminalUpgradeModal(true);
            }
            return;
          }
          if (userAgent.includes("com.bbpet.pos")) {
            if (!isNaN(buildNumber) && buildNumber > 0 && buildNumber < 6) {
              setShowTerminalUpgradeModal(true);
            }
            return;
          }
          if (!isNaN(buildNumber) && buildNumber > 0 && buildNumber < 766) {
            setShowTerminalUpgradeModal(true);
          }
        }
      }
    }
  });
  const businessCode = (0, import_context.useBusinessCode)();
  (0, import_react.useEffect)(() => {
    console.log("isActive>>>>>", isActive);
    if (isActive) {
      openScan((data) => {
        handleScan(data);
      });
    }
    return () => {
      closeScan();
    };
  }, [isActive]);
  const { run: clearAllCart } = (0, import_ahooks2.useDebounceFn)(
    (type, orderId) => {
      var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
      try {
        _initFn(() => {
        });
        setState({
          createCount: state.createCount + 1
        });
        (0, import_utils.sendWarningLog)({
          title: "清空购物车",
          content: [
            {
              key: "店铺id",
              value: (_d2 = (_c2 = (_b2 = (_a2 = store == null ? void 0 : store.getState) == null ? void 0 : _a2.call(store)) == null ? void 0 : _b2.global) == null ? void 0 : _c2.globalConfig) == null ? void 0 : _d2.id
            },
            { key: "订单id", value: orderId },
            { key: "类型", value: type }
          ]
        });
      } catch (err) {
        (0, import_utils.sendWarningLog)({
          title: "清空购物车失败",
          content: [
            {
              key: "店铺id",
              value: (_h2 = (_g2 = (_f2 = (_e2 = store == null ? void 0 : store.getState) == null ? void 0 : _e2.call(store)) == null ? void 0 : _f2.global) == null ? void 0 : _g2.globalConfig) == null ? void 0 : _h2.id
            },
            { key: "订单id", value: orderId },
            { key: "类型", value: type },
            { key: "error", value: err == null ? void 0 : err.message }
          ]
        });
      }
    },
    {
      wait: 500,
      leading: true,
      trailing: false
    }
  );
  (0, import_react.useEffect)(() => {
    var _a2, _b2, _c2, _d2;
    localStorage.removeItem("bookingResourceList");
    _persistentRef.current = storage.get(`drawer-booking`) === "true" ? true : isTerminal();
    if (lowcodeRef) {
      lowcodeRef.onReady(void 0);
    }
    if (action) {
      action({
        type: "pisell1.registerPlugin",
        data: {
          pluginList: ["ProductDetailPlugin", "BookingPlugin3"]
        }
      });
    }
    const off = _addVisibilityListener(() => {
      setState({
        verticalAddServiceKey: state.verticalAddServiceKey + 1
      });
    });
    let _dataFromHost = {};
    try {
      const is_price_include_tax = getData("is_price_include_tax");
      const tax_rate = getData("tax_rate") || "10";
      const tax_title = getData("tax_title") || "GST";
      const surcharge_list = getData("surcharge_list");
      const schedule_list = getData("schedule_list");
      let scheduleById = {};
      if (Array.isArray(schedule_list)) {
        for (let item of schedule_list) {
          scheduleById[item.id] = item;
        }
      }
      _dataFromHost = {
        is_price_include_tax,
        tax_rate,
        tax_title,
        surcharge_list,
        schedule_list,
        scheduleById
      };
    } catch (error) {
    }
    setState(
      {
        amountSymbol: (getData == null ? void 0 : getData("shop_symbol")) || ((_c2 = (_b2 = (_a2 = store == null ? void 0 : store.getState) == null ? void 0 : _a2.call(store)) == null ? void 0 : _b2.global) == null ? void 0 : _c2.symbol) || "$"
      },
      () => {
        _initStateRef.current = JSON.parse(JSON.stringify(state));
        _getBoardConfig();
      }
    );
    _setShopOpeningHours();
    _setIntervalTime(true);
    checkTerminalVersion();
    (_d2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _d2.mountFunction(
      "booking",
      "voidBooking",
      (orderId) => {
        (0, import_serve.voidAppointment)(orderId);
      }
    );
    return () => {
      off == null ? void 0 : off();
      if (_listTimerRef.current) clearInterval(_listTimerRef.current);
    };
  }, []);
  (0, import_react.useEffect)(() => {
    var _a2;
    if (isActive) {
      (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.mountFunction(
        "bookingTicket",
        "clearAllCart",
        (type, orderId) => {
          var _a3, _b2;
          console.log("bookingTicket.clearAllCart");
          _initFn(() => {
          });
          _setIntervalTime(true);
          setTimeout(() => {
            var _a4, _b3;
            if (!(0, import_utils5.isWalkIn)((_b3 = (_a4 = state.client) == null ? void 0 : _a4.value) == null ? void 0 : _b3.id)) {
              selectCustomer(null, { reset: true });
            }
          }, 200);
          enableAllScanListeners();
          (_a3 = shopDiscount == null ? void 0 : shopDiscount.clear) == null ? void 0 : _a3.call(shopDiscount);
          (_b2 = logger == null ? void 0 : logger.addLog) == null ? void 0 : _b2.call(logger, {
            type: "info",
            metadata: {
              type,
              orderId
            },
            title: `清空购物车 bookingTicket.clearAllCart`
          });
        }
      );
    }
  }, [isActive]);
  const _getProducts = (date) => {
    var _a2, _b2, _c2, _d2;
    const currentDate2 = date.format("YYYY-MM-DD");
    const currentDatetime = date.format("YYYY-MM-DD HH:mm:ss");
    const customerId = (_c2 = (_b2 = (_a2 = state.modalState) == null ? void 0 : _a2.client) == null ? void 0 : _b2.value) == null ? void 0 : _c2.id;
    const menuList = (0, import_utils2.getEffectiveMenuListIds)(state);
    (_d2 = getProductsRef == null ? void 0 : getProductsRef.current) == null ? void 0 : _d2.call(getProductsRef, {
      schedule_date: currentDate2,
      customer_id: customerId,
      menu_list_ids: menuList,
      schedule_datetime: currentDatetime
    });
  };
  const _onDateChange = (date, dateString) => {
    _setIntervalTime(false);
    setState({
      isDateChange: true
    });
    _setDataChange(date, dateString);
    if (getProductsRef.current) {
      _getProducts(date);
    }
  };
  const _setIntervalTime = (isInterval) => {
    clearInterval(_timerRef.current);
    if (isInterval) {
      setState({
        isTimeChange: false,
        isDateChange: false
      });
      if (state.bookingId) {
        _openModal({});
      }
      _setDataChange((0, import_dayjs.default)());
      if (!isSecondaryScreen) {
        _timerRef.current = setInterval(() => {
          _setDataChange((0, import_dayjs.default)());
        }, 1e3 * 60);
      }
    }
    setState({
      intervalSetTime: isInterval
    });
  };
  const getDataFromHost = () => {
    try {
      const is_price_include_tax = getData("is_price_include_tax");
      const tax_rate = getData("tax_rate") || "10";
      const tax_title = getData("tax_title") || "GST";
      const surcharge_list = getData("surcharge_list");
      const schedule_list = getData("schedule_list");
      let scheduleById = {};
      if (Array.isArray(schedule_list)) {
        for (let item of schedule_list) {
          scheduleById[item.id] = item;
        }
      }
      return {
        is_price_include_tax,
        tax_rate,
        tax_title,
        surcharge_list,
        schedule_list,
        scheduleById
      };
    } catch (error) {
      console.error(error);
      return {};
    }
  };
  (0, import_react.useEffect)(() => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i, _j, _k;
    const cartItems = (_b2 = (_a2 = state == null ? void 0 : state.modalState) == null ? void 0 : _a2.service) == null ? void 0 : _b2.value;
    if (!Array.isArray(cartItems) || cartItems.length === 0) {
      (_d2 = (_c2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c2.postMessageToApp) == null ? void 0 : _d2.call(_c2, {
        module: "cds",
        key: "cartUpdate",
        data: {
          currency_symbol: getSymbolic(),
          total: "0",
          // 小计
          products: [],
          fees: []
        }
      });
    }
    const total = (0, import_amount.getSumTotal)(state.modalState, {
      isEdit: true,
      ScheduleModule,
      ...getDataFromHost()
    });
    let formatedProducts = [];
    try {
      formatedProducts = (0, import_utils3.formatProducts)(
        cartItems,
        state.modalState,
        false,
        true,
        true
      );
    } catch (error) {
      console.error(error);
    }
    console.log("formatedProducts", total, formatedProducts);
    let fees = [];
    let products = [];
    for (const item of formatedProducts) {
      const { id, name, image, origin_total, total: total2, num, note, _origin } = item;
      (_e2 = _origin == null ? void 0 : _origin.discount_list) == null ? void 0 : _e2.forEach((dl) => {
        fees.push({
          isReduce: dl.type === "good_pass",
          title: translation(dl == null ? void 0 : dl.discount.title),
          price: dl.amount,
          type: dl.type
        });
      });
      let msg = "";
      try {
        msg = (0, import_formatProductMessage.default)(
          {
            ...item,
            currency_symbol: getSymbolic()
          },
          (_f2 = engineContext.appHelper) == null ? void 0 : _f2.utils
        );
      } catch (error) {
        console.error(error);
      }
      let _item = {
        productID: id,
        title: name,
        cover: image,
        //  封面图
        price: total2,
        // 售价
        buyCount: num,
        // 购买数量
        productFormatMessage: msg,
        note,
        isWeightProduct: !!((_h2 = (_g2 = item._origin) == null ? void 0 : _g2._extend) == null ? void 0 : _h2.weighing) ? 1 : 0
      };
      if (origin_total !== total2) _item.modifyPrice = origin_total;
      products.push(_item);
    }
    console.log(
      "formatedProducts",
      products
    );
    if (products.length > 0) {
      fees.unshift({
        title: import_utils.locales.getText("pisell2.product.card.subtotal"),
        price: total.productAmount,
        type: "subtotal",
        message: (_i = import_utils.locales.getText("pisell2.product.card.cart-items")) == null ? void 0 : _i(
          products.length
        )
      });
    }
    console.log("start post message, config:", {
      module: "cds",
      key: "cartUpdate",
      data: {
        currency_symbol: getSymbolic(),
        total: total.productAmount,
        // 小计
        products,
        fees
      }
    });
    (_k = (_j = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _j.postMessageToApp) == null ? void 0 : _k.call(_j, {
      module: "cds",
      key: "cartUpdate",
      data: {
        currency_symbol: getSymbolic(),
        total: total.expectAmount,
        // 小计
        products,
        fees
      }
    });
  }, [(_f = (_e = state == null ? void 0 : state.modalState) == null ? void 0 : _e.service) == null ? void 0 : _f.value]);
  const _setModalState = (props2, key) => {
    var _a2, _b2;
    console.log("同步state到外层", props2);
    let newVal = { ...props2 };
    if (newVal.service) {
      newVal.service.value = ((_a2 = newVal == null ? void 0 : newVal.service) == null ? void 0 : _a2.value) || [];
    }
    console.log((_b2 = newVal == null ? void 0 : newVal.service) == null ? void 0 : _b2.value, "newVal.service.value");
    setState({
      modalState: {
        ...state.modalState,
        ...newVal
      }
    }, () => {
    }, key);
  };
  const _setDataChange = (date, dateString, isTimeChange) => {
    if (state.modalState.disabledEdit) return;
    _setListState({
      params: {
        ...state.list.params,
        booking_time_start_between: (0, import_utils2.formatDateToStr)([
          date.startOf(isTimeChange ? "minute" : "day"),
          date.endOf(isTimeChange ? "minute" : "day")
        ])
      }
    });
    _setModalState({
      date: {
        ...state.modalState.date,
        value: date,
        edit: true
      }
    }, "date");
    if (isTimeChange && getProductsRef.current) {
      _getProducts(date);
    }
    setTimeout(() => {
    }, 100);
  };
  const _setShopOpeningHours = () => {
    var _a2, _b2, _c2, _d2, _e2, _f2;
    let time = ((_a2 = getData == null ? void 0 : getData("operating_day_boundary")) == null ? void 0 : _a2.time) || ((_f2 = (_e2 = (_d2 = (_c2 = (_b2 = store == null ? void 0 : store.getState) == null ? void 0 : _b2.call(store)) == null ? void 0 : _c2.global) == null ? void 0 : _d2.shopDetail) == null ? void 0 : _e2.operating_day_boundary) == null ? void 0 : _f2.time);
    if (time) {
      localStorage.setItem("shopOpeningHours", time);
    }
  };
  const _getAddTimeProducts = async () => {
    const data = await (0, import_serve.getServices)({
      skip: 1,
      num: 500,
      extension_type: ["product_add_time"]
    });
    setState({
      addTimeProducts: (data == null ? void 0 : data.list) || []
    });
  };
  const _getBoardConfig = async () => {
    var _a2, _b2, _c2;
    const { bookingConfigParams } = state;
    let isHasCache = false;
    if (_isFirstLoadBoardConfigRef.current && osKey) {
      const cachedBoardConfig = (0, import_utils2.getBoardConfigCache)(osKey);
      if (cachedBoardConfig) {
        isHasCache = true;
        setState({
          bookingConfig: cachedBoardConfig
        });
        console.log("[BoardConfigCache] 使用缓存数据展示");
        if ((_c2 = (_b2 = (_a2 = cachedBoardConfig == null ? void 0 : cachedBoardConfig.config) == null ? void 0 : _a2.information_tab) == null ? void 0 : _b2.appointment_card) == null ? void 0 : _c2.quick_time) {
          _getAddTimeProducts();
        }
      }
      _isFirstLoadBoardConfigRef.current = false;
    }
    try {
      const data = await (0, import_serve.getBookingConfig)({
        ...bookingConfigParams
      });
      if (!isHasCache) {
        setState({
          bookingConfig: data
        });
      }
      if (osKey && data) {
        (0, import_utils2.setBoardConfigCache)(osKey, data);
        console.log("[BoardConfigCache] 已更新缓存");
      }
    } catch (error) {
      console.error("[BoardConfigCache] 获取配置失败:", error);
    }
  };
  const _addVisibilityListener = (callback) => {
    const handleVisibilityChange = () => {
      if (!document.hidden) {
        callback();
      }
    };
    document.addEventListener("visibilitychange", handleVisibilityChange);
    return () => {
      document.removeEventListener("visibilitychange", handleVisibilityChange);
    };
  };
  const _setListState = (data, cb) => {
    setState(
      {
        list: {
          ...state.list,
          ...data
        }
      },
      () => {
        cb == null ? void 0 : cb();
      }
    );
  };
  const _getInitState = (resetProps = {}) => {
    var _a2;
    const { modalState } = state;
    let initState = JSON.parse(JSON.stringify(_initStateRef.current || {}));
    let _state = {
      ...initState,
      ...resetProps
    };
    let _modalState = { ...modalState };
    for (let key in _modalState) {
      if (key === "notes") {
        _modalState[key].orderNote = initState.modalState[key].orderNote;
        _modalState[key].internalNotes = initState.modalState[key].internalNotes;
      } else {
        if (typeof _modalState[key] === "object") {
          if (key !== "date") {
            _modalState[key].value = (_a2 = initState.modalState[key]) == null ? void 0 : _a2.value;
          }
        }
      }
      if (typeof _modalState[key] === "object") {
        if (_modalState[key].showModal) {
          _modalState[key].showModal = initState.modalState[key].showModal;
        }
        if (_modalState[key].addModal) {
          _modalState[key].addModal = initState.modalState[key].addModal;
        }
        if (_modalState[key].editModal) {
          _modalState[key].editModal = initState.modalState[key].editModal;
        }
        if (_modalState[key].edit) {
          _modalState[key].edit = false;
        }
        if (_modalState[key].load) {
          _modalState[key].load = initState.modalState[key].load;
        }
      }
    }
    _modalState.service.value = [];
    _modalState.service.cacheItem = null;
    _modalState.service.addTimeModal = false;
    _modalState.service.changeService = false;
    _modalState.disabledEdit = initState.modalState.disabledEdit;
    _modalState.channelDisabledEdit = initState.modalState.channelDisabledEdit;
    _modalState.appointment_status = initState.modalState.appointment_status;
    _state.modalState = _modalState;
    return _state;
  };
  const _getBookingType = (record) => {
    const { type } = state;
    if (record.parent_id > 0 && record.item_type !== "recurring_booking" && !type) {
      return "pisell2";
    }
    return "pisell1";
  };
  const _scrollToBooking = (bookingId) => {
    var _a2;
    if (bookingId || state.bookingId) {
      const dom = document.getElementById(bookingId || state.bookingId);
      (_a2 = dom == null ? void 0 : dom.scrollIntoView) == null ? void 0 : _a2.call(dom, { block: "center", behavior: "smooth" });
    }
  };
  const _initBookingData = (type, data) => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
    let initState = _getInitState({
      bookingDetail: null,
      bookingConfig: state.bookingConfig,
      renderType: state.renderType,
      isShowDeposit: state.isShowDeposit,
      openRebook: state.openRebook,
      disableEventBookingEdit: state.disableEventBookingEdit,
      isShowInfo: state.isShowInfo,
      persistent: state.persistent,
      list: state.list,
      intervalSetTime: state.intervalSetTime,
      createCount: state.createCount,
      bookingFunctions: state.bookingFunctions,
      isParallelResourcesBooking: state.isParallelResourcesBooking,
      isEditTicketMode: state.isEditTicketMode,
      paymentPaid: state.paymentPaid
    });
    if (type === "edit") {
      initState.bookingDetail = data;
      initState.modalState = _formatBookingDetail(data, state.modalState);
    }
    if (type === "create") {
      if ((_a2 = data == null ? void 0 : data.serviceParams) == null ? void 0 : _a2.start_date) {
        initState.modalState.date.value = (0, import_dayjs.default)(
          (_b2 = data == null ? void 0 : data.serviceParams) == null ? void 0 : _b2.start_date
        );
        sessionStorage.setItem(
          "pisell2.booking.serviceParams",
          JSON.stringify(data)
        );
      } else {
        let timezone = (_f2 = (_e2 = (_d2 = (_c2 = store == null ? void 0 : store.getState) == null ? void 0 : _c2.call(store)) == null ? void 0 : _d2.global) == null ? void 0 : _e2.globalConfig) == null ? void 0 : _f2.timezone;
        initState.modalState.date.value = import_dayjs.default.tz(/* @__PURE__ */ new Date(), timezone);
        sessionStorage.removeItem("pisell2.booking.serviceParams");
      }
      if ((_g2 = data == null ? void 0 : data.params) == null ? void 0 : _g2.customer) {
        initState.modalState.client.value = data == null ? void 0 : data.params.customer;
      }
      if (data == null ? void 0 : data.eventBookingServiceParams) {
      }
    }
    console.log(initState, "initState");
    setState({
      ...initState,
      [state.renderType === "eventBooking" ? "eventOpen" : "open"]: true,
      bookingId: state.bookingId
    });
  };
  const _rebook = (0, import_ahooks.useMemoizedFn)(() => {
    var _a2, _b2, _c2;
    let date = (0, import_utils2.getNextTimeSlice)(
      ((_c2 = (_b2 = (_a2 = state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.service_time.value) || 10
    );
    setState({
      rebookState: {
        ...state.rebookState,
        open: true,
        date
      }
    });
  });
  const _getBookingDetail = async (bookingId) => {
    const { renderType, openRebook } = state;
    setState({ loading: true });
    const getDetail = renderType === "eventBooking" ? import_serve.getEventBookingDetail : import_serve.getBookingDetail;
    let data = await getDetail(bookingId || state.bookingId, {});
    if (renderType === "eventBooking") {
      data = {
        ...data,
        bookings: {
          ...data.bookings,
          list: [data.bookings]
        }
      };
    }
    console.log("getBookingDetail", data);
    _initBookingData("edit", data);
    if (openRebook) {
      setTimeout(() => {
        _rebook();
      });
    }
  };
  const _openModal = (props2) => {
    const {
      bookingId,
      serviceParams,
      params,
      eventBookingServiceParams,
      renderType = "booking",
      openRebook,
      isParallelResourcesBooking = true
    } = props2 || {};
    setState({
      isShowInfo: false
    });
    const _isTerminal = isTerminal();
    const defaultInit = () => {
      if (renderType === "eventBooking") {
        _getBoardConfig();
      }
      if (bookingId) {
        _getBookingDetail(bookingId);
      } else {
        _initBookingData("create", {
          serviceParams,
          params,
          eventBookingServiceParams
        });
      }
    };
    const isOpen = state.open;
    setState(
      {
        [renderType === "eventBooking" ? "eventOpen" : "open"]: true,
        bookingId: bookingId || 0,
        renderType,
        openRebook,
        isParallelResourcesBooking,
        isEditTicketMode: state.isEditTicketMode,
        paymentPaid: state.paymentPaid,
        disableEventBookingEdit: eventBookingServiceParams == null ? void 0 : eventBookingServiceParams.disableEventBookingEdit,
        modalState: {
          ...state.modalState,
          eventOtherParams: eventBookingServiceParams
        },
        isShowInfo: !_isTerminal,
        persistent: storage.get(`drawer-booking`) === "true" ? true : _isTerminal
      },
      () => {
        console.log(isOpen, "isOpen");
        if (isOpen) {
          setTimeout(() => {
            setState({
              isShowInfo: true
            });
          });
        }
        defaultInit();
      }
    );
  };
  const _scanBookingDetailResult = async (detail) => {
    var _a2, _b2, _c2;
    (_a2 = Toast == null ? void 0 : Toast.loading) == null ? void 0 : _a2.call(Toast, import_utils.locales.getText("pisell2.ticket-booking.loading"), 6e4);
    let result = {};
    try {
      result = JSON.parse(detail) || {};
    } catch (err) {
    }
    if (!(result == null ? void 0 : result.value)) {
      (_b2 = import_antd.message) == null ? void 0 : _b2.error(
        import_utils.locales.getText("pisell2.ticket-booking.appointment-not-found")
      );
      Toast == null ? void 0 : Toast.hide();
      return;
    }
    const objDetail = await (0, import_serve.getOrderInfoByCode)({ code: result.value });
    Toast == null ? void 0 : Toast.hide();
    if (!(objDetail == null ? void 0 : objDetail.order_id) || (objDetail == null ? void 0 : objDetail.event_id) === 0) {
      (_c2 = import_antd.message) == null ? void 0 : _c2.error(
        import_utils.locales.getText("pisell2.ticket-booking.appointment-not-found")
      );
      return;
    }
    if (_getBookingType(objDetail) === "pisell1") {
      setState({
        confirmOpen: true
      });
      return;
    }
    _scrollToBooking(objDetail.order_id);
    _openModal({
      bookingId: objDetail.order_id,
      id: objDetail.event_id
    });
  };
  const _onAction = (0, import_ahooks.useMemoizedFn)((props2) => {
    if (props2 === "init") {
      _getBookingDetail(state.bookingId);
      return;
    }
    action == null ? void 0 : action(props2);
  });
  const _setActiveTab = (key) => {
  };
  const _initFn = (callback, open) => {
    setState(
      {
        ..._getInitState({
          bookingDetail: null,
          bookingConfig: state.bookingConfig,
          renderType: state.renderType,
          isShowDeposit: state.isShowDeposit,
          disableEventBookingEdit: state.disableEventBookingEdit,
          list: state.list,
          createCount: state.createCount,
          bookingFunctions: state.bookingFunctions,
          isParallelResourcesBooking: state.isParallelResourcesBooking
        }),
        associated_menu_list_ids: state.associated_menu_list_ids,
        shop_discount: "0",
        loading: false,
        open: open ?? false,
        eventOpen: false,
        isShowInfo: false,
        bookingId: 0,
        paymentPaid: {
          value: {}
        }
      },
      () => {
        callback == null ? void 0 : callback();
      }
    );
  };
  const _callback = (0, import_ahooks.useMemoizedFn)((data, type) => {
    var _a2, _b2, _c2;
    if (isTerminal() && type === "checkout") {
      return;
    }
    (_a2 = shopDiscount == null ? void 0 : shopDiscount.clear) == null ? void 0 : _a2.call(shopDiscount);
    if (data == null ? void 0 : data.afterCloseUpdate) {
      return _callbackFnRef.current = () => {
        lowcodeRef == null ? void 0 : lowcodeRef.onChange({ type: "refresh", ...data });
      };
    }
    const { bookingId, renderType } = state;
    let cb;
    if (bookingId && renderType !== "eventBooking") {
      cb = () => {
        _openModal({
          bookingId
        });
      };
    }
    if (!bookingId && !state.isEditTicketMode) {
      _setIntervalTime(true);
    }
    if ((_b2 = pisellFloatingPanelRef.current) == null ? void 0 : _b2.getIsOpen()) {
      (_c2 = pisellFloatingPanelRef.current) == null ? void 0 : _c2.refresh();
    }
    if (state.dialogCallback) {
      state.dialogCallback({ type: type || "save", data });
    }
    _initFn(cb);
  });
  const _refreshData = (0, import_ahooks.useMemoizedFn)(() => {
    if (lowcodeRef) {
      lowcodeRef.onChange({ type: "refresh" });
    }
  });
  const _clearAllValue = (0, import_ahooks.useMemoizedFn)(() => {
    setState({
      modalState: _getInitState().modalState
    });
  });
  const currentDate = (0, import_react.useMemo)(() => {
    var _a2, _b2, _c2;
    return (_c2 = (_b2 = (_a2 = state.modalState) == null ? void 0 : _a2.date) == null ? void 0 : _b2.value) == null ? void 0 : _c2.format("YYYY-MM-DD");
  }, [(_h = (_g = state.modalState) == null ? void 0 : _g.date) == null ? void 0 : _h.value]);
  const floatButtons = (0, import_react.useMemo)(() => {
    const items = [
      {
        icon: /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-person" }),
        key: "dashboard",
        onClick: () => {
          var _a2, _b2, _c2;
          (_b2 = (_a2 = window == null ? void 0 : window.shopApi) == null ? void 0 : _a2.bookingTicket) == null ? void 0 : _b2.clearAllCart();
          (_c2 = pisellFloatingPanelRef.current) == null ? void 0 : _c2.open();
        }
      }
    ];
    if (variant === "phone" && isShowTimeBar) {
      items.push({
        icon: /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-clock" }),
        key: "time-bar",
        onClick: () => {
          setTimeBarDrawerOpen(true);
        }
      });
    }
    return items;
  }, [isShowTimeBar, variant]);
  const addServiceGlobalState = (0, import_react.useMemo)(() => {
    return {
      ...state.modalState,
      amountSymbol: state.amountSymbol,
      associated_menu_list_ids: state.associated_menu_list_ids,
      bookingConfig: state.bookingConfig,
      bookingDetail: state.bookingDetail,
      bookingId: state.bookingId,
      bookingStatus: state.bookingStatus,
      apis,
      action: _onAction,
      callback: _callback,
      locale: engineProps.locale,
      modalOpen: state.open,
      onRebook: _rebook,
      refreshData: _refreshData,
      setActiveTab: _setActiveTab,
      addTimeProducts: state.addTimeProducts,
      isBookingCreatePage: true,
      closeAutoOpenService: true,
      productExtensionType: state.productExtensionType,
      isBookingTicket2: true,
      isEditTicketMode: state.isEditTicketMode,
      paymentPaid: state.paymentPaid,
      order_type: state.order_type
    };
  }, [
    state.modalState,
    state.amountSymbol,
    state.associated_menu_list_ids,
    state.bookingConfig,
    state.bookingDetail,
    state.bookingId,
    state.bookingStatus,
    state.open,
    state.addTimeProducts,
    state.productExtensionType,
    state.isEditTicketMode,
    state.paymentPaid,
    state.order_type,
    engineProps.locale
  ]);
  const onMaskClick = (0, import_ahooks.useMemoizedFn)(() => {
    setActiveBookingId(0);
  });
  const handleCreateClick = (0, import_ahooks.useMemoizedFn)(() => {
    var _a2;
    onMaskClick();
    (_a2 = pisellFloatingPanelRef.current) == null ? void 0 : _a2.close();
  });
  const handleBookingClick = (0, import_ahooks.useMemoizedFn)((booking) => {
    var _a2, _b2, _c2;
    if (activeBookingId) {
      onMaskClick();
      (_a2 = closeRef.current) == null ? void 0 : _a2.call(closeRef, "pisell2");
    } else {
      setTimeout(() => {
        setActiveBookingId(booking.order.id);
      });
      action({
        type: "pisell1.handleOpenSaleDetail",
        data: {
          osProps: {
            orderId: booking.order.id,
            osKey: "ticket-booking-item-detail"
          }
        },
        callback: () => {
          setActiveBookingId(0);
        }
      });
      return;
      const time = /* @__PURE__ */ new Date();
      const close = action({
        type: "pisell1.bookingDetail",
        data: {
          component_type: (0, import_utils4.getBookingType)(booking),
          booking_id: booking.order.id,
          type: booking.parent_id === 0 ? "list" : "detail",
          id: booking.id,
          isParallelResourcesBooking: (0, import_utils2.getIsParallelResourcesBooking)(booking),
          preliminaryBookingDetail: {
            customer: (_b2 = booking == null ? void 0 : booking.order) == null ? void 0 : _b2.customer,
            id: booking.order.id,
            order_sales_channel: (_c2 = booking == null ? void 0 : booking.order) == null ? void 0 : _c2.order_sales_channel,
            bookings: {
              booking_id: booking == null ? void 0 : booking.booking_id,
              appointment_status: booking == null ? void 0 : booking.appointment_status,
              list: [
                {
                  start_date: booking == null ? void 0 : booking.start_date,
                  start_time: booking == null ? void 0 : booking.start_time
                }
              ]
            }
          }
        },
        callback: (params) => {
          var _a3;
          const calllbackTime = /* @__PURE__ */ new Date();
          if (calllbackTime.getTime() - time.getTime() < 500) return;
          if (params.type === "close") {
            _clearAllValue();
            onMaskClick();
          }
          if (params.type === "refresh") {
            (_a3 = pisellFloatingPanelRef.current) == null ? void 0 : _a3.refresh();
          }
        }
      });
      closeRef.current = close;
    }
  });
  const memoGlobalState = (0, import_react.useMemo)(() => {
    return {
      ...state.modalState,
      hideCreateText: true,
      amountSymbol: state.amountSymbol,
      bookingConfig: state.bookingConfig,
      bookingDetail: state.bookingDetail,
      bookingId: state.bookingId,
      bookingStatus: state.bookingStatus,
      apis,
      modalOpen: state.open,
      onRebook: _rebook,
      addTimeProducts: state.addTimeProducts,
      isBookingCreatePage: true,
      closeAutoOpenService: true,
      renderType: "booking",
      action: _onAction,
      callback: _callback,
      locale: engineProps.locale,
      refreshData: _refreshData,
      setActiveTab: _setActiveTab,
      clearAllValue: _clearAllValue,
      drawerMask: true,
      isBookingTicket2: true,
      isParallelResourcesBooking: state.isParallelResourcesBooking,
      isEditTicketMode: state.isEditTicketMode,
      paymentPaid: state.paymentPaid,
      setIntervalTime: _setIntervalTime,
      onQrCodeClick: () => {
        console.log("onQrCodeClick");
        bookingTicket == null ? void 0 : bookingTicket.activateCamera();
      },
      businessCode,
      dialogCallback: state.dialogCallback,
      /** 仅副屏用于购物车多列；主屏不传，避免污染 BookingInfo 状态 */
      secondaryScreenCartProductsPerRow: isSecondaryScreen ? secondaryProductsPerRow : void 0,
      order_type: state.order_type
    };
  }, [
    state.modalState,
    state.amountSymbol,
    state.bookingConfig,
    state.bookingDetail,
    state.bookingId,
    apis,
    state.open,
    state.bookingStatus,
    state.addTimeProducts,
    state.isParallelResourcesBooking,
    state.isEditTicketMode,
    state.paymentPaid,
    state.dialogCallback,
    state.order_type,
    engineProps.locale,
    isSecondaryScreen,
    secondaryProductsPerRow
  ]);
  const leftPanelNode = (0, import_react.useMemo)(() => {
    if (isSecondaryScreen) return null;
    return /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `ticket-booking-left-panel${variant === "phone" ? " ticket-booking-left-panel-mobile" : ""}`,
        style: { height: variant === "phone" ? "100%" : "unset" }
      },
      /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          className: "ticket-booking-left-panel-content",
          style: { height: variant === "phone" ? "100%" : "unset" }
        },
        /* @__PURE__ */ import_react.default.createElement(
          import_addServiceVariant.default,
          {
            onPrerenderComplete,
            globalState: addServiceGlobalState,
            setGlobalState: _setModalState,
            onGetProductsReady: handleGetProductsReady,
            productDisplayConfig
          }
        ),
        isShowFloatButtons && /* @__PURE__ */ import_react.default.createElement(import_floatButtons.default, { items: floatButtons })
      ),
      isShowTimeBar && /* @__PURE__ */ import_react.default.createElement(
        import_timeBar.default,
        {
          setNowTime: _getProducts,
          onCreateClick: handleCreateClick,
          setGlobalState: setState,
          globalState: state,
          onDateChange: (...args) => {
            _onDateChange(...args);
          },
          onDateTimeChange: (...args) => {
            _setDataChange(...args, true);
          },
          setIntervalTime: _setIntervalTime,
          locale: engineProps.locale,
          mobileDrawerOpen: timeBarDrawerOpen,
          onMobileDrawerClose: () => setTimeBarDrawerOpen(false)
        }
      )
    );
  }, [
    isSecondaryScreen,
    onPrerenderComplete,
    addServiceGlobalState,
    _setModalState,
    handleGetProductsReady,
    productDisplayConfig,
    variant,
    isShowFloatButtons,
    floatButtons,
    isShowTimeBar,
    timeBarDrawerOpen,
    _getProducts,
    handleCreateClick,
    setState,
    state,
    _onDateChange,
    _setDataChange,
    _setIntervalTime,
    engineProps.locale
  ]);
  const mainContentProps = (0, import_react.useMemo)(() => {
    if (variant !== "phone" || isSecondaryScreen) {
      return mainContentWrapperProps;
    }
    return {
      ...mainContentWrapperProps,
      style: {
        ...mainContentWrapperProps.style,
        position: "fixed",
        right: 0,
        bottom: 0,
        left: 0,
        zIndex: 100,
        width: "100%"
      }
    };
  }, [mainContentWrapperProps, variant, isSecondaryScreen]);
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, !isSecondaryScreen && leftPanelNode, /* @__PURE__ */ import_react.default.createElement("div", { ...mainContentProps }, /* @__PURE__ */ import_react.default.createElement(
    import_info.default,
    {
      key: state.createCount,
      globalState: memoGlobalState,
      setGlobalState: _setModalState,
      setState,
      modules: bookingInfoModules,
      bodyTopSlot
    }
  )), !isSecondaryScreen && isShowFloatButtons && /* @__PURE__ */ import_react.default.createElement(
    import_pisellFloatingPanel.default,
    {
      bookingId: activeBookingId,
      ref: pisellFloatingPanelRef,
      currentDate,
      onBookingClick: handleBookingClick
    }
  ), secondaryScreenSettingsModal, /* @__PURE__ */ import_react.default.createElement(
    import_materials.PisellModal.Information,
    {
      open: showTerminalUpgradeModal,
      title: import_utils.locales.getText("pisell2.ticket-booking.terminal-upgrade-title"),
      describe: import_utils.locales.getText(
        "pisell2.ticket-booking.terminal-upgrade-description"
      ),
      okText: import_utils.locales.getText("pisell2.ticket-booking.terminal-upgrade-ok"),
      cancelText: import_utils.locales.getText(
        "pisell2.ticket-booking.terminal-upgrade-cancel"
      ),
      closable: true,
      onOk: () => setShowTerminalUpgradeModal(false),
      onCancel: () => setShowTerminalUpgradeModal(false)
    }
  ));
};
TicketBooking.displayName = "TicketBooking";
var ticketBooking_default = (0, import_responsive.withResponsive)(TicketBooking);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  _formatBookingDetail
});
