import { n as e } from "./popover-xJJqy1v6.js";
import { Text as t } from "../text/index.js";
import { n } from "./flex-CPO6xlPR.js";
import { PolymorphicComponent as r } from "../polymorphic/index.js";
import { Suspense as i, forwardRef as a, useCallback as o, useEffect as s, useRef as c, useState as l, useSyncExternalStore as u } from "react";
import { cn as d } from "@ryuzaki13/react-foundation-lib/utils";
import { CheckCheckIcon as f, ChevronLeftIcon as p, ChevronRightIcon as m, CircleAlertIcon as h, CircleCheckIcon as g, CircleXIcon as _, CopyIcon as v, InfoIcon as y } from "lucide-react";
import { jsx as b, jsxs as x } from "react/jsx-runtime";
import { useCopyElementTextWithFeedback as S } from "@ryuzaki13/react-foundation-lib/copy";
import { useLazyComponent as C } from "@ryuzaki13/react-foundation-lib/hooks";
//#region src/misc/AnimatedLogo.tsx
function w() {
	return /* @__PURE__ */ b("div", {
		className: "logoAnimated",
		children: /* @__PURE__ */ x("svg", {
			xmlns: "http://www.w3.org/2000/svg",
			width: "588",
			height: "696",
			viewBox: "0 0 588 696",
			role: "img",
			"aria-label": "Загрузка",
			children: [
				/* @__PURE__ */ b("path", {
					className: "logoSegment logoOutline logoS1",
					d: "M15,15v225.37l136.14-.23c44.13-.07,79.86-35.87,79.86-80V15H15Z"
				}),
				/* @__PURE__ */ b("path", {
					className: "logoSegment logoOutline logoS2",
					d: "M15,285v396s216,0,216,0v-316c0-44.18-35.82-80-80-80H15Z"
				}),
				/* @__PURE__ */ b("path", {
					className: "logoSegment logoOutline logoS3",
					d: "M276,15h297s0,225,0,225h-217c-44.18,0-80-35.82-80-80V15Z"
				}),
				/* @__PURE__ */ b("path", {
					className: "logoSegment logoFill logoS4",
					d: "M573,285v108h-169c-11.05,0-20,8.95-20,20v268h-108v-316c0-44.18,35.82-80,80-80h217Z"
				})
			]
		})
	});
}
//#endregion
//#region src/misc/CopyTextWrapper.tsx
var T = ({ children: t, position: n = "top", showOnHover: r = !0, className: i }) => {
	let { containerRef: a, copyElementText: o, isCopied: s } = S();
	return /* @__PURE__ */ x("span", {
		ref: a,
		className: i,
		children: [t, /* @__PURE__ */ b(e, {
			openOnHover: r,
			placement: n,
			content: s ? "Скопировано!" : "Копировать текст",
			children: /* @__PURE__ */ b("button", {
				onClick: o,
				"aria-label": s ? "Скопировано!" : "Копировать текст",
				children: s ? /* @__PURE__ */ b(f, { className: "block statusSuccess" }) : /* @__PURE__ */ b(v, { className: "block statusInfo" })
			})
		})]
	});
}, E = { wrapper: "_0wk7Sq" };
//#endregion
//#region src/misc/IconWrapper.tsx
function D({ className: e, children: t }) {
	return /* @__PURE__ */ b("div", {
		className: d(E.wrapper, e),
		children: t
	});
}
var O = { componentLoader: "qgIKVo" }, k = ({ className: e, children: r, color: i = "muted", minHeight: a, uppercase: o = !0 }) => /* @__PURE__ */ b(n, {
	className: d("paddingMd textCenter", e),
	minHeight: a,
	children: /* @__PURE__ */ b(t, {
		as: "div",
		weight: "bold",
		color: i,
		uppercase: o,
		children: r
	})
});
//#endregion
//#region src/misc/LoadingMessage.tsx
function A({ className: e, text: t, withLogo: n }) {
	return /* @__PURE__ */ x(k, {
		className: d(O.componentLoader, n ? "" : "skeletonLine", e),
		children: [n && /* @__PURE__ */ b(w, {}), t || "Загрузка..."]
	});
}
//#endregion
//#region src/misc/LazyDynamicComponent.tsx
var j = (e) => (e(), () => void 0), M = () => !0, N = () => !1;
function P({ fallback: e, importFunc: t, componentName: n, clientOnly: r = !1, cacheKey: a, props: o }) {
	let s = C(t, n, a), c = u(j, M, N), l = e ?? /* @__PURE__ */ b(A, { text: "Ожидание компонента..." });
	return r && !c ? l : /* @__PURE__ */ b(i, {
		fallback: l,
		children: /* @__PURE__ */ b(s, { ...o ?? {} })
	});
}
//#endregion
//#region src/misc/SkeletonLine.tsx
var F = ({ as: e, className: t, ...n }) => /* @__PURE__ */ b(r, {
	as: e || "div",
	className: d("skeletonLine colorTransparent radiusSm", t),
	...n
});
//#endregion
//#region src/misc/LazyValue.tsx
function I({ value: e, isLoading: t }) {
	return t ? /* @__PURE__ */ b(F, { children: "Загрузка..." }) : e ?? "-";
}
//#endregion
//#region src/misc/NoData.tsx
var L = ({ className: e, text: t, minHeight: n = "5em" }) => /* @__PURE__ */ b(k, {
	className: e,
	color: "muted",
	minHeight: n,
	children: t || "Нет данных"
}), R = ({ className: e, isError: t, children: n }) => /* @__PURE__ */ b(k, {
	className: e,
	color: t ? "error" : "secondary",
	children: n
}), z = {
	oneStepScroller: "_7xUQBN",
	ossViewport: "AonLqg",
	ossScroller: "j-5yFn",
	ossButton: "pOIq63"
}, B = 1;
function V(e) {
	return Math.max(0, e.scrollWidth - e.clientWidth);
}
var H = ({ children: e, className: t, itemSelector: n, scrollPadding: r = 6, smooth: i = !0 }) => {
	let a = c(null), u = c(null), [f, h] = l(!1), [g, _] = l(!1), v = o(() => {
		let e = a.current;
		return e ? n ? Array.from(e.querySelectorAll(n)) : Array.from(e.children).filter((e) => e instanceof HTMLElement) : [];
	}, [n]), y = o((e) => {
		let t = a.current;
		if (!t) return null;
		if (n) {
			let r = e.closest(n);
			return r && t.contains(r) ? r : null;
		}
		let r = e;
		for (; r && r.parentElement && r.parentElement !== t;) r = r.parentElement;
		return r && r.parentElement === t ? r : null;
	}, [n]), S = o(() => {
		let e = a.current;
		if (!e) {
			h(!1), _(!1);
			return;
		}
		let t = Math.max(0, e.scrollWidth - e.clientWidth), n = Math.max(0, Math.min(e.scrollLeft, t)), r = n > B, i = n < t - B;
		h((e) => e === r ? e : r), _((e) => e === i ? e : i);
	}, []), C = o(() => {
		u.current === null && (u.current = requestAnimationFrame(() => {
			u.current = null, S();
		}));
	}, [S]), w = o((e) => {
		let t = a.current;
		if (!t) return;
		let n = v()[0];
		if (!n) return;
		let r = n.getBoundingClientRect().width;
		if (!r) return;
		let o = Math.round(e * r), s = Math.max(0, t.scrollWidth - t.clientWidth), c = Math.max(0, Math.min(t.scrollLeft + o, s));
		t.scrollTo({
			left: c,
			behavior: i ? "smooth" : "auto"
		});
	}, [v, i]), T = o((e) => {
		let t = a.current;
		if (!t) return;
		let n = t.getBoundingClientRect(), o = e.getBoundingClientRect(), s = o.left - n.left + t.scrollLeft, c = s + o.width, l = t.scrollLeft, u = t.scrollLeft + t.clientWidth;
		if (s >= l + B && c <= u - B) return;
		let d = t.scrollLeft;
		s < l ? d = Math.max(0, s - r) : c > u && (d = Math.min(V(t), c - t.clientWidth + r)), t.scrollTo({
			left: Math.round(d),
			behavior: i ? "smooth" : "auto"
		});
	}, [r, i]);
	s(() => {
		let e = a.current;
		if (!e) return;
		let t = (e) => {
			let t = e.target;
			if (!(t instanceof HTMLElement)) return;
			let n = y(t);
			n && T(n);
		};
		return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
	}, [T, y]), s(() => {
		let e = a.current;
		if (!e) return;
		let t = () => C();
		e.addEventListener("scroll", t, { passive: !0 });
		let n = null;
		typeof ResizeObserver < "u" && (n = new ResizeObserver(C), n.observe(e));
		let r = null;
		return typeof MutationObserver < "u" && (r = new MutationObserver(C), r.observe(e, {
			childList: !0,
			subtree: !1
		})), C(), () => {
			e.removeEventListener("scroll", t), n?.disconnect(), r?.disconnect(), u.current !== null && (cancelAnimationFrame(u.current), u.current = null);
		};
	}, [C]), s(() => {
		C();
	}, [e, C]);
	let E = () => w(-1), D = () => w(1), O = (e) => {
		e.key === "ArrowLeft" ? (e.preventDefault(), E()) : e.key === "ArrowRight" && (e.preventDefault(), D());
	}, k = f || g;
	return /* @__PURE__ */ x("div", {
		className: d(z.oneStepScroller, t),
		style: { position: "relative" },
		children: [
			k && /* @__PURE__ */ b("button", {
				type: "button",
				"aria-label": "Прокрутить шаг влево",
				className: z.ossButton,
				onClick: E,
				disabled: !f,
				children: /* @__PURE__ */ b(p, {})
			}),
			/* @__PURE__ */ b("div", {
				className: z.ossViewport,
				onKeyDown: O,
				role: "group",
				"aria-label": "Элементы прокрутки",
				children: /* @__PURE__ */ b("div", {
					className: z.ossScroller,
					ref: a,
					"aria-live": "polite",
					children: e
				})
			}),
			k && /* @__PURE__ */ b("button", {
				type: "button",
				"aria-label": "Прокрутить шаг вправо",
				className: z.ossButton,
				onClick: D,
				disabled: !g,
				children: /* @__PURE__ */ b(m, {})
			})
		]
	});
}, U = a(({ children: e, height: t, stable: n, overscroll: r, className: i }, a) => /* @__PURE__ */ b("div", {
	ref: a,
	className: d("scrollable", n && "stable", r && "overscroll", i),
	style: { height: t },
	children: e
}));
a(({ blockClassName: e, ...t }, n) => /* @__PURE__ */ b("div", {
	className: d(e, "overflowHidden w100 h100"),
	children: /* @__PURE__ */ b(U, {
		ref: n,
		...t
	})
}));
var W = {
	stateWrapper: "UMTbLD",
	status: "cz57Fx",
	information: "oPzAxu",
	success: "MBu26r",
	warning: "_03z-1l",
	error: "_0RqsqJ",
	state: "mXkUoM"
}, G = ({ state: e = "none", text: t, className: n }) => /* @__PURE__ */ x("div", {
	className: d("flexCenter gapSm", n),
	children: [(() => {
		switch (e) {
			case "error": return /* @__PURE__ */ b(q, {});
			case "warning": return /* @__PURE__ */ b(J, {});
			case "success": return /* @__PURE__ */ b(Y, {});
			case "information": return /* @__PURE__ */ b(X, {});
			default: return null;
		}
	})(), t]
}), K = ({ state: e }) => {
	switch (e) {
		case "error": return /* @__PURE__ */ b(q, {});
		case "warning": return /* @__PURE__ */ b(J, {});
		case "success": return /* @__PURE__ */ b(Y, {});
		case "information": return /* @__PURE__ */ b(X, {});
		default: return null;
	}
}, q = () => /* @__PURE__ */ b(_, { className: d(W.state, W.error) }), J = () => /* @__PURE__ */ b(h, { className: d(W.state, W.warning) }), Y = () => /* @__PURE__ */ b(g, { className: d(W.state, W.success) }), X = () => /* @__PURE__ */ b(y, { className: d(W.state, W.information) });
//#endregion
//#region src/misc/StateWrapper.tsx
function Z({ as: e, state: t, className: n, ...i }) {
	let a = t?.toLowerCase() ?? "none", o = W[a], s = a && a !== "none";
	return /* @__PURE__ */ b(r, {
		as: e || "div",
		className: d(W.stateWrapper, s && W.status, o, n),
		...i
	});
}
//#endregion
export { D as _, G as a, U as c, L as d, I as f, k as g, A as h, K as i, H as l, P as m, q as n, Y as o, F as p, X as r, J as s, Z as t, R as u, T as v, w as y };

//# sourceMappingURL=misc-1PxS8OWD.js.map