const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
//#region src/plus/salesSdk/utils/applyExplicitAddQuantityToCacheItem.ts
/**
* 将本次加车的明确数量写入 cacheItem（防抖合并、options.quantity 透传）。
* OS `buildCacheItemFromCartDetail` 已优先 ctx.quantity，此处再保证 enrich 前后一致。
*/
function applyExplicitAddQuantityToCacheItem(cacheItem, quantity) {
	const qty = Math.max(1, Math.floor(Number(quantity)) || 1);
	const extend = (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {};
	const other = (extend === null || extend === void 0 ? void 0 : extend.other) || {};
	return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, cacheItem), {}, { _extend: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, extend), {}, {
		quantity: qty,
		other: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, other), {}, { quantity: qty })
	}) });
}
//#endregion
exports.applyExplicitAddQuantityToCacheItem = applyExplicitAddQuantityToCacheItem;
