const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_index = require("../icon/index.js");
const require_index$1 = require("./BaseVirtualInput/index.js");
const require_useThemeTokens = require("../../hooks/useThemeTokens.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("../../../../../../materials/src/components/virtualInput/index.less");
//#region ../materials/src/components/virtualInput/index.tsx
const _excluded = [
	"topContent",
	"bottomContent",
	"wrapperStyle",
	"wrapperClassName",
	"allowClear",
	"onClear",
	"value",
	"clearButtonStyle",
	"theme"
];
const VirtualInput = (0, react.forwardRef)((_ref, ref) => {
	let { topContent, bottomContent, wrapperStyle, wrapperClassName, allowClear = false, onClear, value, clearButtonStyle = {}, theme } = _ref, virtualInputProps = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
	const baseInputRef = (0, react.useRef)(null);
	const { colorPrimary } = require_useThemeTokens.default(theme);
	const handleClear = () => {
		onClear === null || onClear === void 0 || onClear();
	};
	(0, react.useImperativeHandle)(ref, () => ({
		focus: () => {
			var _baseInputRef$current;
			return (_baseInputRef$current = baseInputRef.current) === null || _baseInputRef$current === void 0 ? void 0 : _baseInputRef$current.focus();
		},
		blur: () => {
			var _baseInputRef$current2;
			return (_baseInputRef$current2 = baseInputRef.current) === null || _baseInputRef$current2 === void 0 ? void 0 : _baseInputRef$current2.blur();
		}
	}));
	return /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)("pisell-virtual-input-wrapper", wrapperClassName),
		style: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, wrapperStyle || {}), {}, { ["--color-primary"]: colorPrimary })
	}, topContent, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-virtual-input-container" }, allowClear && /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-virtual-input-clear-button",
		style: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, clearButtonStyle), {}, { visibility: "hidden" })
	}, /* @__PURE__ */ react.default.createElement(require_index.default, { type: "pisell2-delete" })), /* @__PURE__ */ react.default.createElement(require_index$1.default, require_objectSpread2._objectSpread2({
		ref: baseInputRef,
		value
	}, virtualInputProps)), allowClear && /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-virtual-input-clear-button",
		onClick: handleClear,
		style: clearButtonStyle
	}, /* @__PURE__ */ react.default.createElement(require_index.default, { type: "pisell2-delete" }))), bottomContent);
});
VirtualInput.displayName = "VirtualInput";
//#endregion
exports.default = VirtualInput;
