function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useMemo, useState, useEffect } from 'react';
import { Button } from 'antd';
import Decimal from 'decimal.js';
import { Trash01, Calculator, PlusCircle, Sale03 } from '@pisell/icon';
import { locales } from '@pisell/utils';
import { useToast } from '@pisell/materials';
import dayjs from 'dayjs';
import ClearCartModal from "../clearCartModal";
import CustomiseItemModal from "../customiseItemModal";
import VoucherModal from "../voucherModal";
import { getSumTotal } from "../footer/amount";
import "./index.less";
import { useCustomer } from "../../../ticketBooking/hooks/pisellos/useCustomer";
import { useMemoizedFn } from 'ahooks';
import useEngineContext, { usePisellOS } from "../../../../hooks/useEngineContext";
import useScanManager from "../../../ticketBooking/hooks/pisellos/useScanManager";
import { DiscountKeyboard } from "../../../../pro/priceKeyboard";
import { useActiveExecute, useBookingTicket } from "../../../ticketBooking/hooks/pisellos";
import { useShopDiscountModule } from "../../../ticketBooking/hooks/pisellos/useShopDiscountModule";
// Toast 内容包装器，统一设置行高
var createToastContent = function createToastContent(text) {
  return /*#__PURE__*/React.createElement("div", {
    className: "action-buttons-toast-content"
  }, text);
};
var ActionButtons = function ActionButtons(_ref) {
  var _context$appHelper, _state$service3, _state$addons2, _state$service5, _state$service7, _context$appHelper3, _state$service9, _state$addons4, _context$appHelper4, _context$appHelper4$g;
  var state = _ref.state,
    dispatch = _ref.dispatch,
    _ref$disabled = _ref.disabled,
    disabled = _ref$disabled === void 0 ? false : _ref$disabled,
    source = _ref.source;
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    showClearModal = _useState2[0],
    setShowClearModal = _useState2[1];
  var _useState3 = useState(false),
    _useState4 = _slicedToArray(_useState3, 2),
    showPriceAdjustModal = _useState4[0],
    setShowPriceAdjustModal = _useState4[1];
  var _useState5 = useState(false),
    _useState6 = _slicedToArray(_useState5, 2),
    showCustomiseModal = _useState6[0],
    setShowCustomiseModal = _useState6[1];
  var _useState7 = useState(false),
    _useState8 = _slicedToArray(_useState7, 2),
    showVoucherModal = _useState8[0],
    setShowVoucherModal = _useState8[1];
  var _useActiveExecute = useActiveExecute(),
    executeIfActive = _useActiveExecute.executeIfActive;
  var context = useEngineContext();
  var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
    getData = _context$appHelper$ut.getData,
    pisellosAllModule = _context$appHelper$ut.pisellosAllModule;
  var Toast = useToast();
  var pisellOS = usePisellOS();
  var bookingTicket = useBookingTicket();
  var ScheduleModule = pisellosAllModule.ScheduleModule;
  var shopDiscount = useShopDiscountModule();

  // 将选中的客户数据传递给状态管理
  var changeCustomerToGlobalState = useMemoizedFn(function (value) {
    var _state$client, _state$service;
    var beforeValue = state === null || state === void 0 || (_state$client = state.client) === null || _state$client === void 0 ? void 0 : _state$client.value;
    dispatch({
      type: 'setClient',
      payload: {
        value: value,
        edit: true
      }
    });
    if ((beforeValue === null || beforeValue === void 0 ? void 0 : beforeValue.id) === (value === null || value === void 0 ? void 0 : value.id)) return;
    if (state !== null && state !== void 0 && (_state$service = state.service) !== null && _state$service !== void 0 && (_state$service = _state$service.value) !== null && _state$service !== void 0 && _state$service.length) {
      // 还需要清空商品内的 holder 信息
      dispatch({
        type: 'setService',
        payload: {
          value: state.service.value.map(function (item) {
            return _objectSpread(_objectSpread({}, item), {}, {
              _extend: _objectSpread(_objectSpread({}, item._extend), {}, {
                holder_id: []
              })
            });
          })
        }
      });
    }
  });
  var _useCustomer = useCustomer({
      changeCustomerToGlobalState: changeCustomerToGlobalState
    }),
    selectCustomer = _useCustomer.selectCustomer;
  var _useScanManager = useScanManager(),
    clearAllScanListenersTaskQueue = _useScanManager.clearAllScanListenersTaskQueue;

  // 监听客户选择变化，清空手动折扣
  useEffect(function () {
    if (!bookingTicket) return;
    var handleCustomerSelected = function handleCustomerSelected() {
      // 当客户选择改变时，清空 shop_discount
      dispatch({
        type: 'setState',
        payload: {
          shop_discount: '0'
        }
      });
    };
    var wrappedHandleCustomerSelected = executeIfActive(handleCustomerSelected);

    // 监听客户选择事件
    bookingTicket.effectsOn('onCustomerSelected', wrappedHandleCustomerSelected);

    // 清理函数
    return function () {
      bookingTicket.effectsOff('onCustomerSelected', wrappedHandleCustomerSelected);
    };
  }, [dispatch, bookingTicket]);

  // 同步获取金额计算所需配置
  var getDataFromHost = function getDataFromHost() {
    try {
      var is_price_include_tax = getData('is_price_include_tax');
      var tax_rate = getData('tax_rate') || '10';
      var tax_title = getData('tax_title') || 'GST';
      var surcharge_list = getData('surcharge_list');
      var schedule_list = getData('schedule_list');
      var scheduleById = {};
      // 提前转换，节省附加费计算时的遍历时间
      if (Array.isArray(schedule_list)) {
        var _iterator = _createForOfIteratorHelper(schedule_list),
          _step;
        try {
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
            var item = _step.value;
            scheduleById[item.id] = item;
          }
        } catch (err) {
          _iterator.e(err);
        } finally {
          _iterator.f();
        }
      }
      return {
        is_price_include_tax: is_price_include_tax,
        tax_rate: tax_rate,
        tax_title: tax_title,
        surcharge_list: surcharge_list,
        schedule_list: schedule_list,
        scheduleById: scheduleById
      };
    } catch (error) {
      console.error(error);
      return {};
    }
  };

  // 检查是否有购物车内容
  var hasCartItems = useMemo(function () {
    var _state$service2, _state$addons;
    return ((state === null || state === void 0 || (_state$service2 = state.service) === null || _state$service2 === void 0 || (_state$service2 = _state$service2.value) === null || _state$service2 === void 0 ? void 0 : _state$service2.length) || 0) + ((state === null || state === void 0 || (_state$addons = state.addons) === null || _state$addons === void 0 || (_state$addons = _state$addons.value) === null || _state$addons === void 0 ? void 0 : _state$addons.length) || 0) > 0;
  }, [state === null || state === void 0 || (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.value, state === null || state === void 0 || (_state$addons2 = state.addons) === null || _state$addons2 === void 0 ? void 0 : _state$addons2.value]);

  // 检查是否禁用编辑
  var isDisabledEdit = useMemo(function () {
    return disabled || (state === null || state === void 0 ? void 0 : state.disabledEdit) || (state === null || state === void 0 ? void 0 : state.channelDisabledEdit);
  }, [disabled, state === null || state === void 0 ? void 0 : state.disabledEdit, state === null || state === void 0 ? void 0 : state.channelDisabledEdit]);

  // 计算当前订单总价(不包含税费那些，所以应该是产品总价)
  var currentTotalPrice = useMemo(function () {
    if (!hasCartItems) return 0;
    try {
      var _getSumTotal = getSumTotal(state, _objectSpread({
          isEdit: true,
          ScheduleModule: ScheduleModule
        }, getDataFromHost())),
        productAmount = _getSumTotal.productAmount;
      return productAmount;
    } catch (error) {
      console.error('计算总价失败:', error);
      return 0;
    }
  }, [state, hasCartItems]);

  // 手动折扣后订单总价
  var currentTotalPriceAfterDiscount = useMemo(function () {
    return new Decimal(currentTotalPrice).minus(state.shop_discount || 0).toNumber();
  }, [state.shop_discount, currentTotalPrice]);

  // 折扣券列表状态
  var _useState9 = useState([]),
    _useState10 = _slicedToArray(_useState9, 2),
    discountList = _useState10[0],
    setDiscountList = _useState10[1];

  // 计算已使用的券数量
  var usedVouchersCount = useMemo(function () {
    try {
      var _state$service4;
      if (!((_state$service4 = state.service) !== null && _state$service4 !== void 0 && (_state$service4 = _state$service4.value) !== null && _state$service4 !== void 0 && _state$service4.length)) {
        return 0;
      }
      // 直接从全局折扣券列表中计算被选中的数量，避免重复计数
      return discountList.filter(function (discount) {
        return discount.isSelected;
      }).length;
    } catch (error) {
      console.error('计算已使用券数量失败:', error);
      return 0;
    }
  }, [discountList, (_state$service5 = state.service) === null || _state$service5 === void 0 ? void 0 : _state$service5.value]);

  // 判断是否有券可用但手动取消使用（显示红色感叹号）
  var shouldShowWarning = useMemo(function () {
    try {
      var _state$service6;
      // 条件：购物车不为空 && discountList 长度大于 0，且没有 isSelected 的优惠券，且有 isManualSelect 的优惠券
      return ((_state$service6 = state.service) === null || _state$service6 === void 0 || (_state$service6 = _state$service6.value) === null || _state$service6 === void 0 ? void 0 : _state$service6.length) > 0 && discountList.length > 0 && !discountList.some(function (discount) {
        return discount.isSelected;
      }) && discountList.some(function (discount) {
        return discount.isManualSelect;
      });
    } catch (error) {
      console.error('判断警告状态失败:', error);
      return false;
    }
  }, [discountList, (_state$service7 = state.service) === null || _state$service7 === void 0 ? void 0 : _state$service7.value]);

  // 监听折扣券列表变化
  useEffect(function () {
    var _context$appHelper2;
    var _ref2 = ((_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {},
      pisellos = _ref2.pisellos;
    if (!pisellos || !shopDiscount) return;
    var onDiscountListChange = function onDiscountListChange(discount) {
      setDiscountList(discount);
    };
    var wrappedHandler = executeIfActive(onDiscountListChange);
    shopDiscount.effectsOn('onDiscountListChange', wrappedHandler);
    return function () {
      shopDiscount.effectsOff('onDiscountListChange', wrappedHandler);
    };
  }, [(_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 ? void 0 : _context$appHelper3.utils]);

  // 清空购物车按钮点击
  var handleClear = function handleClear() {
    setShowClearModal(true);
  };

  // 仅清空商品
  var handleClearItemsOnly = function handleClearItemsOnly() {
    clearAllScanListenersTaskQueue();
    if (!hasCartItems) {
      // 购物车为空时显示Toast提示
      Toast === null || Toast === void 0 || Toast.info(createToastContent(locales.getText('pisell2.clear-cart-modal.empty-cart-tip')));
      return;
    }
    // 清空服务项目
    dispatch({
      type: 'setService',
      payload: {
        value: []
      }
    });

    // 清空附加服务
    dispatch({
      type: 'setAddons',
      payload: {
        value: []
      }
    });

    // 清空 shop_discount 手动折扣
    dispatch({
      type: 'setState',
      payload: {
        shop_discount: '0'
      }
    });

    // 清空部分支付
    dispatch({
      type: 'setPaymentPaid',
      payload: {
        value: {}
      }
    });
    setShowClearModal(false);
    Toast === null || Toast === void 0 || Toast.success(createToastContent(locales.getText('pisell2.action-buttons.clear-success')));
  };

  // 清空所有内容并重置购物车
  var handleClearAllAndReset = function handleClearAllAndReset() {
    var _window;
    (_window = window) === null || _window === void 0 || (_window = _window.shopApi) === null || _window === void 0 || (_window = _window.bookingTicket) === null || _window === void 0 || _window.clearAllCart();
    clearAllScanListenersTaskQueue();
    // 清空服务项目
    dispatch({
      type: 'setService',
      payload: {
        value: []
      }
    });

    // 清空附加服务
    dispatch({
      type: 'setAddons',
      payload: {
        value: []
      }
    });

    // // 重置客户信息（与 clientCard 的 onRemoveClient 保持一致）
    // dispatch({
    //   type: 'setClient',
    //   payload: {
    //     value: null, // 传递 null 而不是 walkInData
    //     edit: true,  // 添加 edit: true 标识
    //   },
    // });
    selectCustomer(null);

    // 重置时间为当前时间（使用dayjs默认值）
    dispatch({
      type: 'setDate',
      payload: {
        value: dayjs(),
        // 当前时间
        end_date: dayjs().add(1, 'days') // 明天
      }
    });

    // 重置表单数据
    dispatch({
      type: 'setPet',
      payload: {
        holders: [],
        value: {}
      }
    });

    // 重置备注
    dispatch({
      type: 'setNotes',
      payload: {
        value: '',
        orderNote: ''
      }
    });

    // 清空部分支付
    dispatch({
      type: 'setPaymentPaid',
      payload: {
        value: {}
      }
    });

    // TODO: 如果需要重置更多信息，可以在这里添加
    // 比如重置优惠券、表单数据、宠物信息等

    setShowClearModal(false);
    Toast === null || Toast === void 0 || Toast.success(createToastContent(locales.getText('pisell2.action-buttons.clear-success')));
  };

  // 手动订单 - 价格调整
  var handleManuelOrder = function handleManuelOrder() {
    if (!hasCartItems) {
      Toast === null || Toast === void 0 || Toast.info(createToastContent(locales.getText('pisell2.action-buttons.no-items-to-adjust')));
      return;
    }
    setShowPriceAdjustModal(true);
  };

  // 商品清空后，重置折扣信息
  useEffect(function () {
    var _state$service8, _state$addons3;
    if (((_state$service8 = state.service) === null || _state$service8 === void 0 || (_state$service8 = _state$service8.value) === null || _state$service8 === void 0 ? void 0 : _state$service8.length) === 0 && ((_state$addons3 = state.addons) === null || _state$addons3 === void 0 || (_state$addons3 = _state$addons3.value) === null || _state$addons3 === void 0 ? void 0 : _state$addons3.length) === 0) {
      dispatch({
        type: 'setState',
        payload: {
          shop_discount: 0
        }
      });
    }
  }, [(_state$service9 = state.service) === null || _state$service9 === void 0 ? void 0 : _state$service9.value, (_state$addons4 = state.addons) === null || _state$addons4 === void 0 ? void 0 : _state$addons4.value]);

  // 处理价格调整完成
  var handlePriceAdjustConfirm = function handlePriceAdjustConfirm(discountAmount) {
    var normalizedDiscountAmount = new Decimal(discountAmount || 0).toDecimalPlaces(2, Decimal.ROUND_DOWN).toString();
    // 更新 shop_discount 到 state 根级别（存储为字符串）
    dispatch({
      type: 'setState',
      payload: {
        shop_discount: normalizedDiscountAmount
      }
    });
    setShowPriceAdjustModal(false);

    // 显示成功提示
    Toast === null || Toast === void 0 || Toast.success(createToastContent(locales.getText('pisell2.action-buttons.price-adjusted-success')));
  };

  // 自定义商品
  var handleCustomiseItem = function handleCustomiseItem() {
    setShowCustomiseModal(true);
  };

  // GoodPass 券码管理
  var handleGoodPassClick = function handleGoodPassClick() {
    setShowVoucherModal(true);
  };

  // 处理自定义商品保存
  var handleCustomiseItemSave = function handleCustomiseItemSave(data) {
    var _state$service10;
    console.log('保存自定义商品:', data);

    // 创建自定义商品项，按照标准商品结构
    var customItem = {
      // 基础商品信息（按照 service2/utils.ts 693-730 行格式，但简化）
      id: "custom_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9)),
      // 前端使用 UUID，避免 React diff key 重复
      _id: "custom_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9)),
      // 生成唯一ID
      title: data.productName,
      name: data.productName,
      price: parseFloat(data.priceValue) * (data.priceType === 'deduction' ? -1 : 1),
      total: parseFloat(data.priceValue) * (data.priceType === 'deduction' ? -1 : 1),
      num: data.quantity,
      is_bundle: 0,
      // 自定义商品特殊标识
      isCustomItem: true,
      vouchersApplicable: data.vouchersApplicable,
      // 是否适用优惠券/折扣

      // 后端需要的完整格式存储在 _extend 中
      _extend: {
        num: data.quantity,
        price: parseFloat(data.priceValue) * (data.priceType === 'deduction' ? -1 : 1),
        product_id: 0,
        discount_amount: 0,
        product_discount_reason: '',
        name: data.productName,
        note: '',
        discountway: 'num',
        discount_type: data.priceType === 'deduction' ? 'discount' : 'normal',
        order_detail_id: 0,
        startDate: dayjs(),
        endDate: dayjs(),
        // 保留一些必要的购物车字段
        quantity: data.quantity,
        total: parseFloat(data.priceValue) * (data.priceType === 'deduction' ? -1 : 1),
        origin_total: parseFloat(data.priceValue) * (data.priceType === 'deduction' ? -1 : 1)
      },
      new: 1
    };

    // 添加到购物车（使用 service 来存储自定义商品）
    var currentServices = (state === null || state === void 0 || (_state$service10 = state.service) === null || _state$service10 === void 0 ? void 0 : _state$service10.value) || [];

    // 直接添加自定义商品，不检查重复
    var updatedServices = [customItem].concat(_toConsumableArray(currentServices));

    // 更新状态，参考 addService.tsx 的 331-339 行
    dispatch({
      type: 'setService',
      payload: {
        value: updatedServices,
        changeService: false
      }
    });
    setShowCustomiseModal(false);
    Toast === null || Toast === void 0 || Toast.success(createToastContent(locales.getText('pisell2.customise-item.save-success')));
  };
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
    className: "pisell-lowcode__action-buttons"
  }, /*#__PURE__*/React.createElement(Button, {
    className: "action-button clear-button",
    icon: /*#__PURE__*/React.createElement(Trash01, {
      size: 22
    }),
    onClick: handleClear,
    type: "text",
    disabled: isDisabledEdit
  }), /*#__PURE__*/React.createElement(Button, {
    className: "action-button customise-button",
    icon: /*#__PURE__*/React.createElement(PlusCircle, {
      size: 22
    }),
    onClick: handleCustomiseItem,
    type: "text",
    disabled: isDisabledEdit
  }, locales.getText('pisell2.action-buttons.customise-item')), /*#__PURE__*/React.createElement(Button, {
    className: "action-button manuel-button",
    icon: /*#__PURE__*/React.createElement(Calculator, {
      size: 22
    }),
    onClick: handleManuelOrder,
    type: "text",
    disabled: isDisabledEdit
  }, locales.getText('pisell2.action-buttons.manuel-order')), /*#__PURE__*/React.createElement("div", {
    className: "action-button-wrapper"
  }, /*#__PURE__*/React.createElement(Button, {
    className: "action-button goodpass-button",
    icon: /*#__PURE__*/React.createElement(Sale03, {
      size: 22
    }),
    onClick: handleGoodPassClick,
    type: "text"
  }, locales.getText('pisell2.text.goodpass')), usedVouchersCount > 0 && /*#__PURE__*/React.createElement("div", {
    className: "voucher-badge"
  }, usedVouchersCount), shouldShowWarning && /*#__PURE__*/React.createElement("div", {
    className: "voucher-warning-icon"
  }, "!"))), /*#__PURE__*/React.createElement(ClearCartModal, {
    visible: showClearModal,
    onCancel: function onCancel() {
      return setShowClearModal(false);
    },
    onClearItemsOnly: handleClearItemsOnly,
    onClearAllAndReset: handleClearAllAndReset
  }), /*#__PURE__*/React.createElement(DiscountKeyboard, {
    containerProps: {
      renderType: 'modal',
      open: showPriceAdjustModal,
      onCancel: function onCancel() {
        return setShowPriceAdjustModal(false);
      }
    },
    selectType: "dark",
    originalValue: currentTotalPrice,
    defaultValue: currentTotalPriceAfterDiscount,
    onEnter: handlePriceAdjustConfirm
  }), /*#__PURE__*/React.createElement(CustomiseItemModal, {
    visible: showCustomiseModal,
    onClose: function onClose() {
      return setShowCustomiseModal(false);
    },
    onSave: handleCustomiseItemSave,
    currencySymbol: ((_context$appHelper4 = context.appHelper) === null || _context$appHelper4 === void 0 || (_context$appHelper4 = _context$appHelper4.utils) === null || _context$appHelper4 === void 0 || (_context$appHelper4$g = _context$appHelper4.getSymbolic) === null || _context$appHelper4$g === void 0 ? void 0 : _context$appHelper4$g.call(_context$appHelper4)) || '$',
    disabled: isDisabledEdit
  }), /*#__PURE__*/React.createElement(VoucherModal, {
    visible: showVoucherModal,
    onClose: function onClose() {
      return setShowVoucherModal(false);
    },
    state: state,
    dispatch: dispatch,
    source: source
  }));
};
export default ActionButtons;