const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_index = require("../../../input/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let ahooks = require("ahooks");
let src_components_pisellInput_components_SecurityCode_card_png = require("./card.png");
src_components_pisellInput_components_SecurityCode_card_png = require_runtime.__toESM(src_components_pisellInput_components_SecurityCode_card_png);
require("./index.less");
//#region src/components/pisellInput/components/SecurityCode/index.tsx
const SecurityCode = (props) => {
	const { maxLength, showCVCIcon = true } = props;
	const [state, setState] = (0, ahooks.useControllableValue)(props, { defaultValue: "" });
	const handleChange = (e) => {
		const { value } = e.target;
		let numberValue = value.replace(/\D/g, "");
		if (maxLength) numberValue = numberValue.slice(0, maxLength);
		setState === null || setState === void 0 || setState(numberValue);
	};
	return /* @__PURE__ */ react.default.createElement(require_index.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props), {}, {
		value: state,
		onChange: handleChange,
		maxLength,
		size: "large",
		placeholder: "CVC",
		type: "number",
		suffix: showCVCIcon && /* @__PURE__ */ react.default.createElement("img", {
			className: "pisell-security-code-suffix",
			src: src_components_pisellInput_components_SecurityCode_card_png.default,
			alt: "security code img"
		})
	}));
};
//#endregion
exports.default = SecurityCode;
