import { Button as e } from "../ui/button.js";
import { Alert as t, AlertDescription as n, AlertTitle as r } from "../ui/alert.js";
import { Component as i } from "react";
import { jsx as a, jsxs as o } from "react/jsx-runtime";
import { AlertCircle as s } from "lucide-react";
//#region src/components/feedback/ErrorBoundary.tsx
var c = class extends i {
	state = {
		hasError: !1,
		error: null
	};
	static getDerivedStateFromError(e) {
		return {
			hasError: !0,
			error: e
		};
	}
	componentDidCatch(e, t) {}
	handleRetry = () => {
		this.props.onRetry ? this.props.onRetry() : this.setState({
			hasError: !1,
			error: null
		});
	};
	render() {
		return this.state.hasError && this.state.error ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ o("div", {
			className: "flex min-h-[200px] flex-col items-center justify-center gap-4 p-6",
			children: [/* @__PURE__ */ o(t, {
				variant: "destructive",
				className: "max-w-lg",
				children: [
					/* @__PURE__ */ a(s, { className: "h-4 w-4" }),
					/* @__PURE__ */ a(r, { children: "Something went wrong" }),
					/* @__PURE__ */ o(n, { children: [this.state.error.message, !1] })
				]
			}), /* @__PURE__ */ a(e, {
				onClick: this.handleRetry,
				variant: "outline",
				children: "Try again"
			})]
		}) : this.props.children;
	}
};
//#endregion
export { c as ErrorBoundary };
