var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/modules/Cart/utils/cartAccount.ts
var cartAccount_exports = {};
__export(cartAccount_exports, {
  deleteHolderFromCartItem: () => deleteHolderFromCartItem,
  formatAccountToCartItem: () => formatAccountToCartItem,
  formatAccountToCartItemOrigin: () => formatAccountToCartItemOrigin
});
module.exports = __toCommonJS(cartAccount_exports);
var formatAccountToCartItem = (params) => {
  const { cartItem, account } = params;
  if (account) {
    cartItem.holder_id = account.id;
    cartItem.holder_title = account.username;
  }
  const oringin = formatAccountToCartItemOrigin(params);
  cartItem._origin = oringin;
  return cartItem;
};
var formatAccountToCartItemOrigin = (params) => {
  const { cartItem, account } = params;
  let origin = cartItem._origin;
  if (account) {
    if ((account == null ? void 0 : account.type) === "holder") {
      const { customer_id, form_id, form_record_id } = (account == null ? void 0 : account._origin) || {};
      origin.holder = {
        customer_id,
        form_id,
        form_record: form_record_id ? [form_record_id] : null
      };
    } else {
      origin.metadata.account = account;
    }
  }
  return origin;
};
var deleteHolderFromCartItem = (cartItem) => {
  cartItem.holder_id = void 0;
  cartItem.holder_title = void 0;
  cartItem._origin.holder = null;
  return cartItem;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  deleteHolderFromCartItem,
  formatAccountToCartItem,
  formatAccountToCartItemOrigin
});
