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/eventBooking/components/bookingDetailModal/components/BookingOptions.tsx
var BookingOptions_exports = {};
__export(BookingOptions_exports, {
  default: () => BookingOptions_default
});
module.exports = __toCommonJS(BookingOptions_exports);
var import_react = __toESM(require("react"));
var import_OpenCard = __toESM(require("../../OpenCard"));
var import_materials = require("@pisell/materials");
var import_utils = require("@pisell/utils");
var import_Sales = require("../../../../Sales");
var import_decimal = __toESM(require("decimal.js"));
var import_pisellPriceText = __toESM(require("../../../../productSelect/components/pisellPriceText"));
var BookingOptions = (props) => {
  var _a, _b;
  const { detail, currentBookingOption, selectEventDetailBookingOptions } = (0, import_Sales.useEventDetail)();
  const onChange = (value, item) => {
    var _a2;
    selectEventDetailBookingOptions(value);
    (_a2 = props == null ? void 0 : props.onChangeBookingOption) == null ? void 0 : _a2.call(props, item);
  };
  return /* @__PURE__ */ import_react.default.createElement(
    import_OpenCard.default,
    {
      title: import_utils.locales.getText("pisell2.event.booking.options"),
      showBorder: true,
      showArrow: false,
      isClick: false,
      className: "detail-option-wrap"
    },
    /* @__PURE__ */ import_react.default.createElement(
      import_materials.PisellCheckboxGroup,
      {
        mode: "single",
        iconPosition: ((_a = detail == null ? void 0 : detail.bookingOptions) == null ? void 0 : _a.length) > 1 ? "right" : "hide",
        options: (detail == null ? void 0 : detail.bookingOptions) || [],
        optionClassName: `option-item ${((_b = detail == null ? void 0 : detail.bookingOptions) == null ? void 0 : _b.length) > 1 ? "option-item-pointer" : ""}`,
        value: currentBookingOption,
        renderOption: (option) => {
          const { price, is_bundle, minimum_markup_price } = option._originData || {};
          if (!option._originData || !is_bundle) {
            return /* @__PURE__ */ import_react.default.createElement("div", { className: "item" }, /* @__PURE__ */ import_react.default.createElement("span", null, option.label), /* @__PURE__ */ import_react.default.createElement(
              import_materials.PisellText.Amount,
              {
                value: option.price,
                showCurrencySymbol: true,
                className: "price"
              }
            ));
          }
          let _price = price;
          if (is_bundle) {
            _price = new import_decimal.default(price).plus(new import_decimal.default(minimum_markup_price)).toFixed(2);
          }
          return /* @__PURE__ */ import_react.default.createElement("div", { className: "item" }, /* @__PURE__ */ import_react.default.createElement("span", null, option.label), /* @__PURE__ */ import_react.default.createElement(import_pisellPriceText.default, { className: "price", value: _price, isMini: true }));
        },
        onChange
      }
    )
  );
};
var BookingOptions_default = BookingOptions;
