import { jsx as e } from "react/jsx-runtime";
import m from "react";
import { CircularProgress as p } from "@mui/material";
function d(r, n = "default", s = !0) {
  class a extends m.Component {
    constructor(t) {
      super(t), this.state = {
        Component: null,
        error: null
      };
    }
    componentDidMount() {
      r().then((t) => this.setState({ Component: t[n] })).catch((t) => this.setState({ error: `Failed to load async component: ${t.message}` }));
    }
    render() {
      const { Component: t, error: o } = this.state;
      return o || (t ? /* @__PURE__ */ e(t, { ...this.props }) : s ? /* @__PURE__ */ e(p, { color: "primary" }) : null);
    }
  }
  return a;
}
export {
  d as default
};
