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/components/bigSale/hooks/useResolvedSaleDetailModuleConfig.ts
var useResolvedSaleDetailModuleConfig_exports = {};
__export(useResolvedSaleDetailModuleConfig_exports, {
  useResolvedSaleDetailModuleConfig: () => useResolvedSaleDetailModuleConfig
});
module.exports = __toCommonJS(useResolvedSaleDetailModuleConfig_exports);
var import_react = require("react");
var SECONDARY_SCREEN_HIDDEN_SALE_DETAIL_MODULES = [
  "cartActions",
  "orderActions"
];
function getCartItemsLayoutConfig(cartProductsPerRow) {
  if (cartProductsPerRow === void 0) return void 0;
  return {
    columns: cartProductsPerRow
  };
}
function getSaleDetailModuleConfig({
  template,
  cartProductsPerRow,
  showClient
}) {
  if (template !== "secondaryScreen") return void 0;
  const hidden = [...SECONDARY_SCREEN_HIDDEN_SALE_DETAIL_MODULES];
  if (showClient === false) {
    hidden.push("customer");
  }
  const config = {
    hidden,
    amountDetails: {
      defaultExpanded: true
    }
  };
  if (cartProductsPerRow !== void 0) {
    config.cartItems = {
      layout: getCartItemsLayoutConfig(cartProductsPerRow)
    };
  }
  return config;
}
function mergeSaleDetailModuleConfig(base, override) {
  var _a, _b;
  if (!base && !override) return void 0;
  const merged = {
    ...base,
    ...override,
    hidden: [
      .../* @__PURE__ */ new Set([...(base == null ? void 0 : base.hidden) ?? [], ...(override == null ? void 0 : override.hidden) ?? []])
    ],
    amountDetails: {
      ...base == null ? void 0 : base.amountDetails,
      ...override == null ? void 0 : override.amountDetails
    }
  };
  if ((base == null ? void 0 : base.cartItems) || (override == null ? void 0 : override.cartItems)) {
    merged.cartItems = {
      ...base == null ? void 0 : base.cartItems,
      ...override == null ? void 0 : override.cartItems,
      layout: {
        ...(_a = base == null ? void 0 : base.cartItems) == null ? void 0 : _a.layout,
        ...(_b = override == null ? void 0 : override.cartItems) == null ? void 0 : _b.layout
      }
    };
  }
  return merged;
}
function useResolvedSaleDetailModuleConfig({
  template,
  saleDetailModuleConfig,
  cartProductsPerRow,
  showClient
}) {
  return (0, import_react.useMemo)(
    () => mergeSaleDetailModuleConfig(
      getSaleDetailModuleConfig({
        template,
        cartProductsPerRow,
        showClient
      }),
      saleDetailModuleConfig
    ),
    [template, cartProductsPerRow, showClient, saleDetailModuleConfig]
  );
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  useResolvedSaleDetailModuleConfig
});
