const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_urlHelper = require("../utils/urlHelper.js");
const require_urlFormatter = require("../utils/urlFormatter.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _ant_design_icons = require("@ant-design/icons");
//#region src/components/pisellUrl/components/ReadOnlyView.tsx
/**
* PisellUrl 只读态视图组件
* 
* 职责：
* - 渲染只读态 URL 链接展示
* - 支持点击新窗口打开链接（安全性保障）
* - 支持协议/路径隐藏
* - 支持链接图标
* 
* @param props 组件 Props
*/
const ReadOnlyView = (props) => {
	const { value = "", enableLinkClick = true, openInNewWindow = true, showLinkIcon = true, showProtocol = false, showWww = false, showPathname = true, displayFormat = "full", customFormat, defaultProtocol = "https://", fontSize = 16, fontWeight = 500, color = "#101828", linkColor = "#7F56DA", onLinkClick } = props;
	const displayUrl = require_urlFormatter.formatUrlDisplay(value, {
		showProtocol,
		showWww,
		showPathname,
		displayFormat,
		customFormat
	});
	const handleClick = () => {
		if (enableLinkClick && value) {
			onLinkClick === null || onLinkClick === void 0 || onLinkClick(value);
			require_urlHelper.handleUrlClick(value, openInNewWindow, defaultProtocol);
		}
	};
	const canClick = enableLinkClick && !!value;
	return /* @__PURE__ */ react.default.createElement("div", { className: "pisell-url-read" }, /* @__PURE__ */ react.default.createElement(antd.Space, { size: "small" }, showLinkIcon && /* @__PURE__ */ react.default.createElement(_ant_design_icons.LinkOutlined, { style: { color: linkColor } }), canClick ? /* @__PURE__ */ react.default.createElement(antd.Typography.Link, {
		onClick: handleClick,
		style: {
			fontSize,
			fontWeight,
			color: linkColor
		},
		"aria-label": props["aria-label"],
		"aria-describedby": props["aria-describedby"]
	}, displayUrl) : /* @__PURE__ */ react.default.createElement(antd.Typography.Text, {
		style: {
			fontSize,
			fontWeight,
			color
		},
		"aria-label": props["aria-label"],
		"aria-describedby": props["aria-describedby"]
	}, displayUrl)));
};
//#endregion
exports.default = ReadOnlyView;
