const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
//#region src/components/pisellTimeNavigator/components/ScaleLayer.tsx
/**
* 刻度层：渲染时间刻度与标签
* - 横向：整点数字 + 小圆点；当 range 起止不在 step 网格上时，首尾两个格按时间比例**变窄**
*   （宽度 = `widthMinutes / step × cellSize`），中间格保持整步宽并落在整点 / 半点等对齐位置上。
* - 竖向：整点数字 + 分割线。
*
* 标签仅在「整点」（`tick.minute() === 0` 且秒为 0）时显示数字；非整点格只渲染圆点 / 分割线，
* 配合变窄的 head/tail 让起止时刻在视觉上自然衔接到第一个 / 最后一个整点。
*/
function ScaleLayer({ orientation, ticks, stepMinutes, majorStepMinutes, timeFormat, locale, style, className, horizontalCellSizePx, cellWidthsPx, leadingPaddingPx, trailingPaddingPx }) {
	const isHorizontal = orientation === "horizontal";
	return /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)("pisell-time-navigator-scale", `pisell-time-navigator-scale--${orientation}`, className),
		style
	}, isHorizontal && leadingPaddingPx != null && leadingPaddingPx > 0 && /* @__PURE__ */ react.default.createElement("div", {
		"aria-hidden": true,
		style: {
			width: leadingPaddingPx,
			minWidth: leadingPaddingPx,
			maxWidth: leadingPaddingPx,
			flex: "0 0 auto"
		}
	}), ticks.map((tick, i) => {
		const isMajor = tick.minute() === 0 && tick.second() === 0;
		/**
		* 横向整点只展示小时（如 `16`）；竖向 / 非整点（理论不会进 isMajor 分支）走 timeFormat。
		*/
		const label = isHorizontal && isMajor ? locale ? tick.locale(locale).format("H") : tick.format("H") : locale ? tick.locale(locale).format(timeFormat) : tick.format(timeFormat);
		if (isHorizontal) {
			const baseCw = horizontalCellSizePx != null && horizontalCellSizePx > 0 ? horizontalCellSizePx : void 0;
			/**
			* 优先用调用方传入的 `cellWidthsPx[i]`（首尾 partial 格宽 < 整步），
			* 退化为 baseCw（CSS 默认 54）以兼容旧调用路径。
			*/
			const cw = cellWidthsPx != null && cellWidthsPx[i] != null ? cellWidthsPx[i] : baseCw;
			const compactPad = cw != null ? cw < 36 ? 2 : cw < 52 ? 6 : 10 : void 0;
			return /* @__PURE__ */ react.default.createElement("div", {
				key: i,
				className: (0, classnames.default)("pisell-time-navigator-scale-cell", "pisell-time-navigator-scale-cell--h", { "pisell-time-navigator-scale-cell--major": isMajor }),
				style: cw != null ? require_objectSpread2._objectSpread2({
					width: cw,
					minWidth: cw,
					maxWidth: cw,
					flex: "0 0 auto",
					boxSizing: "border-box"
				}, compactPad != null ? { padding: compactPad } : {}) : void 0
			}, isMajor && /* @__PURE__ */ react.default.createElement("span", {
				className: "pisell-time-navigator-scale-label",
				style: cw != null && cw < 48 ? {
					fontSize: Math.max(10, Math.round(cw * .32)),
					lineHeight: 1.15
				} : void 0
			}, label), !isMajor && /* @__PURE__ */ react.default.createElement("span", {
				className: "pisell-time-navigator-scale-dot",
				"aria-hidden": true
			}));
		}
		return /* @__PURE__ */ react.default.createElement("div", {
			key: i,
			className: (0, classnames.default)("pisell-time-navigator-scale-cell", "pisell-time-navigator-scale-cell--v", { "pisell-time-navigator-scale-cell--major": isMajor })
		}, /* @__PURE__ */ react.default.createElement("span", {
			className: "pisell-time-navigator-scale-divider",
			"aria-hidden": true
		}), isMajor && /* @__PURE__ */ react.default.createElement("span", { className: "pisell-time-navigator-scale-label" }, label));
	}), isHorizontal && trailingPaddingPx != null && trailingPaddingPx > 0 && /* @__PURE__ */ react.default.createElement("div", {
		"aria-hidden": true,
		style: {
			width: trailingPaddingPx,
			minWidth: trailingPaddingPx,
			maxWidth: trailingPaddingPx,
			flex: "0 0 auto"
		}
	}));
}
//#endregion
exports.ScaleLayer = ScaleLayer;
