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/plus/salesSdk/utils/identity.ts
var identity_exports = {};
__export(identity_exports, {
  pickIdentity: () => pickIdentity
});
module.exports = __toCommonJS(identity_exports);
var import_productSkuOptions = require("./productSkuOptions");
function pickIdentity(line) {
  var _a;
  const uid = ((_a = line.metadata) == null ? void 0 : _a.unique_identification_number) ?? line.unique_identification_number ?? line.identity_key;
  const identity = {
    product_id: line.product_id,
    product_variant_id: line.product_variant_id
  };
  if (uid !== void 0 && uid !== null && uid !== "") {
    identity.unique_identification_number = String(uid);
  }
  if (line.identity_key !== void 0) {
    identity.identity_key = line.identity_key;
  }
  const lineOptions = (0, import_productSkuOptions.getLineProductOptions)(line);
  if (lineOptions.length > 0 || line.product_sku) {
    identity.product_sku = (0, import_productSkuOptions.buildProductSkuPatch)(line, lineOptions);
  }
  if (Array.isArray(line.product_option_item) && line.product_option_item.length > 0) {
    identity.product_option_item = line.product_option_item;
  }
  if (Array.isArray(line.product_bundle)) {
    identity.product_bundle = line.product_bundle;
  }
  return identity;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  pickIdentity
});
