import { jsx as s } from "react/jsx-runtime";
import { useState as n, useEffect as T, Suspense as I, lazy as L } from "react";
import { execute as m } from "@/common/services/QueryBuilder";
import { Box as o, CircularProgress as c } from "@mui/material";
const _ = L(() => import("./TableList-DYwotUDO.js")), v = async () => (await m({
  code: "retrieve_synced_tables"
})).data, w = async () => (await m({
  code: "retrieve_all_tables_and_columns"
})).data;
function E() {
  const [a, u] = n([]), [f, d] = n([]), [b, p] = n([]), [h, y] = n([]), [i, g] = n(!1), [x, r] = n(!0);
  return T(() => {
    (async () => {
      r(!0);
      const t = await v();
      u(t == null ? void 0 : t.result.map((l) => l.tableName)), t != null && t.result && d(t.result);
      const e = await w();
      p(e == null ? void 0 : e.result.map((l) => l.tableName)), e != null && e.result && y(e.result), r(!1);
    })();
  }, [i]), /* @__PURE__ */ s(
    o,
    {
      sx: {
        width: "100%",
        minHeight: "85vh"
      },
      children: /* @__PURE__ */ s(
        I,
        {
          fallback: /* @__PURE__ */ s(o, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "60vh" }, children: /* @__PURE__ */ s(c, {}) }),
          children: x ? /* @__PURE__ */ s(o, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "60vh" }, children: /* @__PURE__ */ s(c, {}) }) : /* @__PURE__ */ s(
            _,
            {
              tableList: a,
              tablesInfo: f,
              allTableList: b,
              allTablesInfo: h,
              formSubmitted: i,
              reloadComponents: g
            }
          )
        }
      )
    }
  );
}
export {
  E as default
};
//# sourceMappingURL=EntityManagement-DQKXnEzz.js.map
