import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import React from "react";
import classNames from "classnames";
//#region src/components/pisellTimeNavigator/components/CursorLayer.tsx
/**
* 横向：指针容器宽度，与 SVG viewBox 宽一致（几何居中于 offsetPx）。
* 竖向：横线高度的一半，用于 top 对齐。
*/
const CURSOR_ANCHOR_WIDTH_H = 22;
const CURSOR_LINE_HEIGHT_V = 2;
/**
* 时间指示器层：横向为「顶三角 + 竖长方条」SVG，竖向为横线 + 时间气泡
* 对齐基准为几何中心。Realtime 态 #FF692E，浏览态 #344054
*/
function CursorLayer({ orientation, value, timeFormat, formatTimeLabel, locale, isRealtime, offsetPx, fixedCenter, style, className, dragInteractive, isDragging, onDragPointerDown, onDragPointerMove, onDragPointerUp, onDragPointerCancel }) {
	if (value == null) return null;
	const label = formatTimeLabel ? formatTimeLabel(value) : locale ? value.locale(locale).format(timeFormat) : value.format(timeFormat);
	const isHorizontal = orientation === "horizontal";
	/** 以指针水平/垂直中心为 offsetPx，故定位到 offsetPx - 锚宽(高)的一半 */
	const lineOffset = offsetPx - (isHorizontal ? CURSOR_ANCHOR_WIDTH_H / 2 : CURSOR_LINE_HEIGHT_V / 2);
	const positionStyle = fixedCenter ? style !== null && style !== void 0 ? style : {} : dragInteractive && isHorizontal ? _objectSpread2(_objectSpread2({}, style), {}, {
		left: offsetPx,
		transform: "translateX(-50%)",
		width: 36
	}) : dragInteractive && !isHorizontal ? _objectSpread2(_objectSpread2({}, style), {}, {
		top: offsetPx,
		transform: "translateX(-50%) translateY(-50%)",
		height: 40
	}) : _objectSpread2(_objectSpread2({}, style), {}, { [isHorizontal ? "left" : "top"]: lineOffset });
	return /* @__PURE__ */ React.createElement("div", {
		className: classNames("pisell-time-navigator-cursor", `pisell-time-navigator-cursor--${orientation}`, { "pisell-time-navigator-cursor--realtime": isRealtime }, { "pisell-time-navigator-cursor--fixed": fixedCenter }, { "pisell-time-navigator-cursor--draggable": dragInteractive }, { "pisell-time-navigator-cursor--dragging": isDragging }, className),
		style: positionStyle,
		"aria-hidden": true,
		onPointerDown: dragInteractive ? onDragPointerDown : void 0,
		onPointerMove: dragInteractive ? onDragPointerMove : void 0,
		onPointerUp: dragInteractive ? onDragPointerUp : void 0,
		onPointerCancel: dragInteractive ? onDragPointerCancel : void 0
	}, isHorizontal ? /* @__PURE__ */ React.createElement("svg", {
		className: "pisell-time-navigator-cursor-line pisell-time-navigator-cursor-line--token",
		viewBox: "0 0 22 100",
		preserveAspectRatio: "none",
		focusable: "false",
		"aria-hidden": true
	}, /* @__PURE__ */ React.createElement("path", {
		fill: "currentColor",
		d: "M 11 0 L 18 11 L 18 100 L 4 100 L 4 11 Z"
	})) : /* @__PURE__ */ React.createElement("span", { className: "pisell-time-navigator-cursor-line" }), /* @__PURE__ */ React.createElement("span", { className: "pisell-time-navigator-cursor-bubble" }, label));
}
//#endregion
export { CursorLayer };
