import React, { useEffect, useState } from "react";
import "./VenueWallMarquee.less";
//#region src/components/pisellRecordBoard/shellFrame/ResourceWall/NoteTicker.tsx
function usePrefersReducedMotion() {
	const [reduced, setReduced] = useState(false);
	useEffect(() => {
		if (typeof window === "undefined" || !window.matchMedia) return;
		const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
		setReduced(mq.matches);
		const onChange = () => setReduced(mq.matches);
		mq.addEventListener("change", onChange);
		return () => mq.removeEventListener("change", onChange);
	}, []);
	return reduced;
}
const MARQUEE_COPY_COUNT = 3;
/**
* 底部说明条：短文案省略静态展示，长文案无缝跑马灯（多段 copy 与 `VenueWallMarquee.less` 中 -33.333% 动画配套）。
* 系统「减少动态效果」时强制静态展示；跑马灯区对读屏 `aria-hidden` 避免重复朗读。
*/
const NoteTicker = React.memo(function NoteTicker({ text, color, duration = 24, shouldMarquee }) {
	const reducedMotion = usePrefersReducedMotion();
	if (!(shouldMarquee && !reducedMotion)) return /* @__PURE__ */ React.createElement("div", {
		className: "pisell-resource-wall-note-marquee-static",
		style: { color },
		title: text
	}, text);
	return /* @__PURE__ */ React.createElement("div", {
		className: "pisell-resource-wall-note-marquee-wrap",
		"aria-hidden": true
	}, /* @__PURE__ */ React.createElement("div", {
		className: "pisell-resource-wall-note-marquee-track",
		style: {
			animationDuration: `${duration}s`,
			color
		}
	}, Array.from({ length: MARQUEE_COPY_COUNT }, (_, i) => /* @__PURE__ */ React.createElement("div", {
		key: i,
		className: "pisell-resource-wall-note-marquee-copy"
	}, text))));
});
//#endregion
export { NoteTicker };
