const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../../locales/index.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_index$1 = require("../../../icon/index.js");
const require_index$2 = require("../../../input/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let antd = require("antd");
//#region src/components/pisellInput/components/Copy/index.tsx
const Copy = (props) => {
	var _props$disabled;
	const { buttonProps } = props;
	const inputRef = (0, react.useRef)(null);
	const handleCopyClick = function() {
		var _ref = require_asyncToGenerator._asyncToGenerator(function* (e) {
			var _buttonProps$onClick, _inputRef$current;
			buttonProps === null || buttonProps === void 0 || (_buttonProps$onClick = buttonProps.onClick) === null || _buttonProps$onClick === void 0 || _buttonProps$onClick.call(buttonProps, e);
			yield (0, _pisell_utils.copyToClipboard)(((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || (_inputRef$current = _inputRef$current.input) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) || "");
			antd.message.success(require_index.getText("pisell-input-copy-success"));
		});
		return function handleCopyClick(_x) {
			return _ref.apply(this, arguments);
		};
	}();
	return /* @__PURE__ */ react.default.createElement(antd.Space.Compact, { block: true }, /* @__PURE__ */ react.default.createElement(require_index$2.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props), {}, {
		ref: inputRef,
		disabled: (_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : true,
		size: "large"
	})), /* @__PURE__ */ react.default.createElement(antd.Button, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
		size: "large",
		icon: /* @__PURE__ */ react.default.createElement(require_index$1.default, { type: "pisell2-copy-03" })
	}, buttonProps), {}, {
		onClick: handleCopyClick,
		children: (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.children) || require_index.getText("pisell-input-copy")
	})));
};
//#endregion
exports.default = Copy;
