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_usePisellConfig = require("../pisell-config-provider/hooks/usePisellConfig.js");
const require_index = require("./Keyboard/index.js");
const require_index$1 = require("./VirtualKeyInput/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/virtual-keyboard/index.tsx
const _excluded = [
	"virtualKeyInputProps",
	"style",
	"className",
	"keyboardProps",
	"onChange",
	"value",
	"rightPanel",
	"selectType"
];
const items = [
	{
		value: 1,
		label: "1",
		disabled: false,
		type: "text"
	},
	{
		value: 2,
		label: "2",
		disabled: false,
		type: "text"
	},
	{
		value: 3,
		label: "3",
		disabled: false,
		type: "text"
	},
	{
		value: 4,
		label: "4",
		disabled: false,
		type: "text"
	},
	{
		value: 5,
		label: "5",
		disabled: false,
		type: "text"
	},
	{
		value: 6,
		label: "6",
		disabled: false,
		type: "text"
	},
	{
		value: 7,
		label: "7",
		disabled: false,
		type: "text"
	},
	{
		value: 8,
		label: "8",
		disabled: false,
		type: "text"
	},
	{
		value: 9,
		label: "9",
		disabled: false,
		type: "text"
	},
	{
		value: "0",
		label: "0",
		disabled: false,
		type: "text"
	},
	{
		value: "ok",
		label: "OK",
		disabled: false,
		type: "primary"
	}
];
const virtualKeyboardThemeConfig = {
	dark: {
		backgroundColor: "rgba(0, 0, 0, 0.70)",
		containerBackgroundColor: "rgba(0, 0, 0, 0.40)",
		buttonBackgroundColor: "#ffffff",
		textColor: "#000000",
		keyboardBackgroundColor: "rgba(0, 0, 0, 0.40)",
		keyboardButtonBackgroundColor: "#ffffff",
		keyboardButtonTextColor: "#000000",
		keyboardButtonHoverColor: "#f5f5f5",
		primaryButtonBackgroundColor: "#4ca30d",
		primaryButtonTextColor: "#ffffff"
	},
	light: {
		backgroundColor: "#ffffff",
		containerBackgroundColor: "#d0d5dd",
		buttonBackgroundColor: "#ffffff",
		textColor: "#000000",
		keyboardBackgroundColor: "#f9f9f9",
		keyboardButtonBackgroundColor: "#ffffff",
		keyboardButtonTextColor: "#000000",
		keyboardButtonHoverColor: "#f5f5f5",
		primaryButtonBackgroundColor: "#4ca30d",
		primaryButtonTextColor: "#ffffff"
	}
};
const VirtualKeyboard = (props) => {
	const { virtualKeyInputProps, style, className, keyboardProps, onChange, value, rightPanel, selectType = "light" } = props;
	require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	require_usePisellConfig.default();
	(0, react.useEffect)(() => {
		document.body.id = "body";
	}, []);
	/**
	* 配置颜色
	* 根据 props 和 selectType 生成最终的配置颜色
	*/
	const configColor = (0, react.useMemo)(() => {
		const currentConfig = virtualKeyboardThemeConfig[selectType];
		const validProps = Object.entries(props).reduce((acc, [key, value]) => {
			if (value !== void 0 && key in currentConfig) acc[key] = value;
			return acc;
		}, {});
		return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, currentConfig), validProps);
	}, [selectType, props]);
	(0, react.useEffect)(() => {
		(0, _pisell_utils.setTheme)({
			"--virtual-keyboard-background-color": configColor.backgroundColor,
			"--virtual-keyboard-container-background-color": configColor.containerBackgroundColor,
			"--virtual-keyboard-button-background-color": configColor.buttonBackgroundColor,
			"--virtual-keyboard-text-color": configColor.textColor,
			"--virtual-keyboard-keyboard-background-color": configColor.keyboardBackgroundColor,
			"--virtual-keyboard-keyboard-button-background-color": configColor.keyboardButtonBackgroundColor,
			"--virtual-keyboard-keyboard-button-text-color": configColor.keyboardButtonTextColor,
			"--virtual-keyboard-keyboard-button-hover-color": configColor.keyboardButtonHoverColor,
			"--virtual-keyboard-primary-button-background-color": configColor.primaryButtonBackgroundColor,
			"--virtual-keyboard-primary-button-text-color": configColor.primaryButtonTextColor
		});
	}, [configColor]);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)("virtual-keyboard-component", className, {
			"virtual-keyboard-component-dark": selectType === "dark",
			"virtual-keyboard-component-light": selectType === "light"
		}),
		style
	}, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("virtual-keyboard-component-left") }, /* @__PURE__ */ react.default.createElement(require_index$1.default, virtualKeyInputProps), /* @__PURE__ */ react.default.createElement(require_index.default, require_objectSpread2._objectSpread2({ items }, keyboardProps))), rightPanel ? /* @__PURE__ */ react.default.createElement("div", { className: "virtual-keyboard-component-right" }, rightPanel) : null);
};
//#endregion
exports.default = VirtualKeyboard;
