import * as e from "react";
//#region src/react/primitives/error-boundary.tsx
var t = class extends e.Component {
	constructor(e) {
		super(e), this.state = {
			hasError: !1,
			error: null
		};
	}
	static getDerivedStateFromError(e) {
		return {
			hasError: !0,
			error: e
		};
	}
	componentDidCatch(e, t) {
		this.props.onError?.(e, t);
	}
	render() {
		if (this.state.hasError && this.state.error !== null) {
			let { fallback: e } = this.props;
			return typeof e == "function" ? e(this.state.error) : e;
		}
		return this.props.children;
	}
};
//#endregion
export { t as ErrorBoundary };

//# sourceMappingURL=error-boundary.js.map