import { getPisellComponentsThemeConfig } from "../../theme/pisell-components.js";
import ReadOnlyView from "./components/ReadOnlyView.js";
import EditView from "./components/EditView.js";
import DisabledView from "./components/DisabledView.js";
import React from "react";
import { getDisplayState } from "@pisell/utils";
import { ConfigProvider } from "antd";
import "./PisellEmail.less";
//#region src/components/pisellEmail/PisellEmail.tsx
/**
* PisellEmail 邮箱地址组件
* 
* 邮箱地址输入/展示组件，支持只读、编辑、禁用三种状态。
* 基于 Ant Design AutoComplete 和 Input 组件开发，提供邮箱格式校验、域名智能补全、
* mailto 邮件发送和域名隐藏功能。
* 
* @param props 组件 Props
* 
* @example
* // 编辑态（邮箱输入）
* <PisellEmail 
*   placeholder="请输入邮箱地址"
*   required
* />
* 
* @example
* // 只读态（可发邮件）
* <PisellEmail 
*   mode="read"
*   value="user@example.com"
*   enableMailto
* />
* 
* @example
* // 域名补全
* <PisellEmail 
*   enableAutoComplete
*   autoCompleteDomains={['gmail.com', 'company.com']}
* />
*/
const PisellEmail = (props) => {
	const { mode = "edit", disabled = false } = props;
	const displayState = getDisplayState(mode, disabled);
	const render = () => {
		switch (displayState) {
			case "read": return /* @__PURE__ */ React.createElement(ReadOnlyView, props);
			case "edit": return /* @__PURE__ */ React.createElement(EditView, props);
			case "disabled": return /* @__PURE__ */ React.createElement(DisabledView, props);
			default: return null;
		}
	};
	const theme = getPisellComponentsThemeConfig();
	return /* @__PURE__ */ React.createElement(ConfigProvider, { theme }, render());
};
var PisellEmail_default = React.memo(PisellEmail, (prevProps, nextProps) => {
	return prevProps.value === nextProps.value && prevProps.mode === nextProps.mode && prevProps.disabled === nextProps.disabled && prevProps.enableAutoComplete === nextProps.enableAutoComplete;
});
//#endregion
export { PisellEmail_default as default };
