const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_utils = require("@pisell/utils");
require("./index.less");
//#region src/components/ruleSetting/ruleBorder/index.tsx
const RuleBorder = (props) => {
	const { startDomClassName, endDomClassName, value, onChange } = props;
	const [typePosition, setTypePosition] = (0, react.useState)({
		top: "0px",
		bottom: "0px"
	});
	const includeOption = [{
		label: _pisell_utils.locales.getText("pisell2.text.and"),
		value: "and"
	}, {
		label: _pisell_utils.locales.getText("pisell2.text.or"),
		value: "or"
	}];
	const getTypePosition = (startDomClassName, endDomClassName) => {
		let startDom = document.querySelector(`.${startDomClassName}`);
		let endDom = document.querySelector(`.${endDomClassName}`);
		let startDomRect = startDom === null || startDom === void 0 ? void 0 : startDom.getBoundingClientRect();
		let endDomRect = endDom === null || endDom === void 0 ? void 0 : endDom.getBoundingClientRect();
		if (startDomRect && endDomRect) {
			let startDomHeight = startDomRect.height;
			let endDomHeight = endDomRect.height;
			return {
				top: startDomHeight / 2 + "px",
				bottom: endDomHeight / 2 + "px"
			};
		}
		return {
			top: "0px",
			bottom: "0px"
		};
	};
	(0, react.useEffect)(() => {
		setTypePosition(getTypePosition(startDomClassName, endDomClassName));
	}, [startDomClassName, endDomClassName]);
	return /* @__PURE__ */ react.default.createElement("div", { className: "rule-setting-type" }, /* @__PURE__ */ react.default.createElement("div", {
		className: "border",
		style: typePosition
	}, /* @__PURE__ */ react.default.createElement(antd.Select, {
		className: "rule-setting-type-select",
		options: includeOption,
		size: "large",
		value,
		onChange: (type) => {
			onChange(type);
		}
	})));
};
//#endregion
exports.default = RuleBorder;
