const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_useEngineContext = require("../../hooks/useEngineContext.js");
const require_locales = require("./locales.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let _pisell_materials = require("@pisell/materials");
require("./index.less");
//#region src/plus/noteModal/AddTempModal.tsx
const AddTempModal = ({ open, onCancel, onConfirm }) => {
	var _context$engine;
	const context = require_useEngineContext.default();
	_pisell_utils.locales.init(require_locales.default, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || "en");
	const [inputValue, setInputValue] = (0, react.useState)("");
	const inputRef = (0, react.useRef)(null);
	(0, react.useEffect)(() => {
		if (open) setTimeout(() => {
			var _inputRef$current;
			(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
		}, 100);
	}, [open]);
	const handleAddTemplate = () => {
		onConfirm(inputValue);
	};
	return /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellModal, {
		open,
		headerDivider: false,
		title: _pisell_utils.locales.getText("pisell2.text.note.modal.add.template.title"),
		onCancel,
		footer: null,
		width: 680,
		centered: true,
		destroyOnClose: true,
		wrapClassName: "pisell-add-temp-modal"
	}, /* @__PURE__ */ react.default.createElement("div", { className: "template-modal-content" }, /* @__PURE__ */ react.default.createElement("div", { className: "template-input-section" }, /* @__PURE__ */ react.default.createElement(_pisell_materials.Input, {
		value: inputValue,
		onChange: (e) => setInputValue(e.target.value),
		className: "template-input",
		ref: inputRef
	}), /* @__PURE__ */ react.default.createElement(_pisell_materials.Button, {
		type: "primary",
		onClick: handleAddTemplate,
		className: "template-confirm-btn",
		disabled: !inputValue
	}, _pisell_utils.locales.getText("pisell2.text.note.modal.btn.confirm")))));
};
//#endregion
exports.default = AddTempModal;
