//#region src/plus/productSelect/components/TabsStructure/utils.ts
function debounce(func, wait) {
	let timeout = null;
	return (...args) => {
		if (timeout) clearTimeout(timeout);
		timeout = setTimeout(() => {
			func(...args);
		}, wait);
	};
}
/**
* 安全的滚动函数，包含错误处理和边界检查
* @param element - 要滚动的元素
* @param options - 滚动选项
*/
function safeScrollTo(element, options) {
	try {
		if (!element || !element.scrollTo) return false;
		const { left = 0, behavior = "smooth" } = options;
		const maxScrollLeft = Math.max(0, element.scrollWidth - element.clientWidth);
		const safeLeft = Math.max(0, Math.min(left, maxScrollLeft));
		element.scrollTo({
			left: safeLeft,
			behavior
		});
		return true;
	} catch (error) {
		console.warn("Failed to scroll element:", error);
		return false;
	}
}
//#endregion
exports.debounce = debounce;
exports.safeScrollTo = safeScrollTo;
