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");
let _pisell_materials = require("@pisell/materials");
require("./index.less");
//#region src/components/scanOrder/components/ManualPickupRefModal/index.tsx
/**
* ManualPickupRefModal
*
* 当 scanOrder.checkManualPickupRef() 返回 enabled=true 时，弹出让用户输入
* 昵称/buzzer 的弹窗。确认时回调 onConfirm(value)，由外部负责 setPickupRef 与下单。
*/
function ManualPickupRefModal({ open, confirmLoading = false, onCancel, onConfirm }) {
	const [value, setValue] = (0, react.useState)("");
	(0, react.useEffect)(() => {
		if (open) setValue("");
	}, [open]);
	const title = (0, react.useMemo)(() => String(_pisell_utils.locales.getText("pisell2.scan.order.pickup.ref.title")), []);
	const heading = (0, react.useMemo)(() => String(_pisell_utils.locales.getText("pisell2.scan.order.pickup.ref.heading")), []);
	const description = (0, react.useMemo)(() => String(_pisell_utils.locales.getText("pisell2.scan.order.pickup.ref.description")), []);
	const placeholder = (0, react.useMemo)(() => String(_pisell_utils.locales.getText("pisell2.scan.order.pickup.ref.placeholder")), []);
	const confirmText = (0, react.useMemo)(() => String(_pisell_utils.locales.getText("pisell2.event.confirm") || "Confirm"), []);
	const trimmed = value.trim();
	const canConfirm = !!trimmed && !confirmLoading;
	const handleConfirm = () => {
		if (!canConfirm) return;
		onConfirm(trimmed);
	};
	return /* @__PURE__ */ react.default.createElement(antd.Modal, {
		open,
		title,
		footer: null,
		onCancel,
		maskClosable: false,
		destroyOnClose: true,
		centered: true,
		className: "pisell-scan-order-pickup-ref-modal"
	}, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-scan-order-pickup-ref-body" }, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-scan-order-pickup-ref-heading" }, heading), /* @__PURE__ */ react.default.createElement("div", { className: "pisell-scan-order-pickup-ref-desc" }, description), /* @__PURE__ */ react.default.createElement(antd.Input, {
		size: "large",
		placeholder,
		value,
		onChange: (event) => {
			var _event$target;
			return setValue((event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value) || "");
		},
		onPressEnter: handleConfirm,
		className: "pisell-scan-order-pickup-ref-input",
		maxLength: 32,
		allowClear: true
	}), /* @__PURE__ */ react.default.createElement(_pisell_materials.Button, {
		type: "primary",
		block: true,
		size: "large",
		disabled: !canConfirm,
		loading: confirmLoading,
		onClick: handleConfirm
	}, confirmText)));
}
//#endregion
exports.default = ManualPickupRefModal;
