import { cloneElement as e, isValidElement as t, useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
import { jsx as o, jsxs as s } from "react/jsx-runtime";
//#region src/theme/tools.ts
function c(e) {
	let t = [];
	for (let n of e) n != null && t.push(n);
	return t;
}
function l(e) {
	if (e == null) return null;
	if (typeof e == "string") return e;
	let t = Object.entries(e).filter(([, e]) => e).map(([e]) => e);
	return t.length === 0 ? null : t.join(" ");
}
function u(...e) {
	return c(e.map(l)).join(" ");
}
//#endregion
//#region src/icons/markdown/MarkdownCopySuccessSvg.tsx
var d = (e) => /* @__PURE__ */ s("svg", {
	"aria-hidden": "true",
	height: "16",
	viewBox: "0 0 16 16",
	width: "16",
	...e,
	children: [
		/* @__PURE__ */ o("rect", {
			fill: "none",
			height: "9.5",
			rx: "1.25",
			stroke: "currentColor",
			strokeWidth: "1.25",
			width: "8.5",
			x: "5.25",
			y: "3.25"
		}),
		/* @__PURE__ */ o("path", {
			d: "M3.5 5.75v6.75a1 1 0 0 0 1 1h5.5",
			fill: "none",
			stroke: "currentColor",
			strokeLinecap: "round",
			strokeLinejoin: "round",
			strokeWidth: "1.25"
		}),
		/* @__PURE__ */ o("path", {
			d: "M7.25 7.75l1.75 1.75 3-3",
			fill: "none",
			stroke: "currentColor",
			strokeLinecap: "round",
			strokeLinejoin: "round",
			strokeWidth: "1.25"
		})
	]
}), f = (e) => /* @__PURE__ */ s("svg", {
	"aria-hidden": "true",
	height: "16",
	viewBox: "0 0 16 16",
	width: "16",
	...e,
	children: [/* @__PURE__ */ o("rect", {
		fill: "none",
		height: "9.5",
		rx: "1.25",
		stroke: "currentColor",
		strokeWidth: "1.25",
		width: "8.5",
		x: "5.25",
		y: "3.25"
	}), /* @__PURE__ */ o("path", {
		d: "M3.5 5.75v6.75a1 1 0 0 0 1 1h5.5",
		fill: "none",
		stroke: "currentColor",
		strokeLinecap: "round",
		strokeLinejoin: "round",
		strokeWidth: "1.25"
	})]
}), p = "hyax591 hyax590 txvbqbnvy txvbqboj7 txvbqbp67 txvbqblxy txvbqbcp txvbqbv5t txvbqb1qy txvbqb1py txvbqb12g txvbqbvbd txvbqbv txvbqb9jg txvbqbany txvbqb78 txvbqb6x txvbqb7m", m = "hyax592 txvbqb8p txvbqbamg", h = "hyax593 txvbqbc67 txvbqbtx7", g = ({ code: e }) => {
	let [t, c] = a(!1), l = i(null);
	r(() => () => {
		l.current != null && window.clearTimeout(l.current);
	}, []);
	let u = n(async () => {
		try {
			let t;
			if (typeof navigator < "u" && (t = navigator.clipboard), t != null && typeof t.writeText == "function") await t.writeText(e);
			else {
				let t = document.createElement("textarea");
				t.value = e, t.setAttribute("readonly", ""), t.style.position = "absolute", t.style.left = "-9999px", document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t);
			}
			c(!0), l.current != null && window.clearTimeout(l.current), l.current = window.setTimeout(() => {
				c(!1), l.current = null;
			}, 2e3);
		} catch {}
	}, [e]), g = "Copier le code";
	t && (g = "Copié !");
	let _ = /* @__PURE__ */ o(f, { className: h });
	t && (_ = /* @__PURE__ */ o(d, { className: h }));
	let v = "Copier";
	return t && (v = "Copié"), /* @__PURE__ */ s("button", {
		className: p,
		onClick: () => {
			u().catch(() => {});
		},
		title: g,
		type: "button",
		children: [_, /* @__PURE__ */ o("span", {
			className: m,
			children: v
		})]
	});
}, _ = "_14wey9t0 txvbqbg0y txvbqbv5t txvbqb1cp txvbqb1qg txvbqbsp txvbqb1rp txvbqbvbd txvbqbjep txvbqbk5y txvbqbl7g txvbqbptg txvbqbu7g", v = "_14wey9t1 txvbqbcp txvbqb9ip txvbqbdpp txvbqbnw7 txvbqbojg txvbqbp6p txvbqblyg txvbqbv3t txvbqbao7", y = "_14wey9t2 txvbqbnvy txvbqboj7 txvbqbprp txvbqbmjg txvbqbv3t txvbqb1t7 txvbqbvaz txvbqb8p txvbqbamg txvbqb66", b = "_14wey9t3 txvbqbnw7 txvbqbojg txvbqbp6p txvbqblyg txvbqbivg txvbqbjep txvbqbk5y txvbqbl9g txvbqbu7g", x = "_14wey9t4 ", S = "_14wey9t5 txvbqbfcp", C = "_14wey9t6 txvbqbvbd txvbqbal7 txvbqb8y txvbqbf5y txvbqbfcp txvbqbuxy", w = "_14wey9t7 txvbqbva1 txvbqb8y txvbqb1o", T = (n) => {
	if (!t(n) || typeof n.type != "string" || n.type !== "pre") return n;
	let r = n.props.className;
	return e(n, { className: u(S, r) });
}, E = ({ badgeLabel: e, copyCode: t, highlighted: n, fallbackCodeText: r, placeholderText: i }) => {
	let a;
	a = i == null ? n == null ? /* @__PURE__ */ o("pre", {
		className: C,
		children: r ?? ""
	}) : typeof n == "string" ? /* @__PURE__ */ o("pre", {
		className: C,
		dangerouslySetInnerHTML: { __html: n }
	}) : /* @__PURE__ */ o("div", {
		className: x,
		children: T(n)
	}) : /* @__PURE__ */ o("span", {
		className: w,
		children: i
	});
	let c = null;
	return typeof t == "string" && t !== "" && (c = /* @__PURE__ */ o(g, { code: t })), /* @__PURE__ */ s("div", {
		className: _,
		children: [/* @__PURE__ */ s("div", {
			className: v,
			children: [/* @__PURE__ */ o("span", {
				className: y,
				children: e
			}), c]
		}), /* @__PURE__ */ o("div", {
			className: b,
			children: a
		})]
	});
};
//#endregion
export { u as n, c as r, E as t };

//# sourceMappingURL=HighlightCode-KpWSo7Zx.js.map