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/plus/salesSdk/bookingEditService/buildEditProductDetailPayload.ts
var buildEditProductDetailPayload_exports = {};
__export(buildEditProductDetailPayload_exports, {
  buildEditProductDetailPayload: () => buildEditProductDetailPayload
});
module.exports = __toCommonJS(buildEditProductDetailPayload_exports);
var import_dayjs = __toESM(require("dayjs"));
var import_utils = require("../../../components/booking/utils");
var import_utils2 = require("../../../components/ticketBooking/utils");
function buildEditProductDetailPayload(options) {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
  const { cacheItem, bookingState, formValues } = options;
  const isSession = (0, import_utils.isSessionProduct)(cacheItem);
  const date = ((_c = (_b = (_a = bookingState.date) == null ? void 0 : _a.value) == null ? void 0 : _b.format) == null ? void 0 : _c.call(_b, "YYYY-MM-DD")) ?? (0, import_dayjs.default)().format("YYYY-MM-DD");
  const sessionValue = {};
  if (isSession) {
    sessionValue.startEndTime = {
      startDate: (_d = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _d.start_date,
      endDate: (_e = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _e.end_date,
      duration: (_f = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _f.duration
    };
  }
  return {
    item: cacheItem,
    productData: {
      ...cacheItem,
      initValue: {
        ...(_g = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _g.other,
        ...sessionValue,
        quantity: formValues.quantity ?? ((_h = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _h.quantity)
      }
    },
    showConfig: {
      option: true,
      session: isSession,
      variant: true,
      package: true,
      number: (0, import_utils2.getIsShowNumber)(cacheItem, bookingState)
    },
    isOnlySession: (0, import_utils.getIsOnlySession)(cacheItem),
    isEject: (0, import_utils.getIsEject)(cacheItem, "detail") ? 1 : 0,
    customerId: options.customerId ?? ((_j = (_i = bookingState.client) == null ? void 0 : _i.value) == null ? void 0 : _j.id),
    date
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  buildEditProductDetailPayload
});
