import { useStudio } from "../providers/StudioProvider.js";
import { useWorkspace } from "../hooks/useWorkspaces.js";
import MainLayout_default from "../components/layout/MainLayout.js";
import ErrorSnackbar_default from "../components/snackbars/ErrorSnackbar.js";
import ExecutionTimeline_default from "../features/workspaces/components/ExecutionTimeline.js";
import { c } from "react/compiler-runtime";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import { useParams } from "react-router-dom";
import { Home, Loader2 } from "lucide-react";
var WorkspacePage_default = () => {
	let p = c(31), { router: m } = useStudio(), { workspaceId: h } = useParams(), g = useWorkspace(h), _;
	p[0] === m ? _ = p[1] : (_ = m.getDashboard(), p[0] = m, p[1] = _);
	let v;
	p[2] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ jsx(Home, { className: "h-4 w-4" }), p[2] = v) : v = p[2];
	let y;
	p[3] === _ ? y = p[4] : (y = {
		label: "Dashboard",
		href: _,
		icon: v
	}, p[3] = _, p[4] = y);
	let b;
	p[5] === m ? b = p[6] : (b = m.getWorkspaces(), p[5] = m, p[6] = b);
	let x;
	p[7] === b ? x = p[8] : (x = {
		label: "Workspaces",
		href: b
	}, p[7] = b, p[8] = x);
	let S = g.data?.title ?? "", C;
	p[9] === S ? C = p[10] : (C = {
		label: S,
		current: !0
	}, p[9] = S, p[10] = C);
	let w;
	p[11] !== y || p[12] !== x || p[13] !== C ? (w = [
		y,
		x,
		C
	], p[11] = y, p[12] = x, p[13] = C, p[14] = w) : w = p[14];
	let T = w, E = g.data?.title ?? "", D;
	p[15] === E ? D = p[16] : (D = /* @__PURE__ */ jsx("h1", {
		className: "mb-4 text-3xl font-bold tracking-tight",
		children: E
	}), p[15] = E, p[16] = D);
	let O;
	p[17] === g.isLoading ? O = p[18] : (O = g.isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin" }) : "", p[17] = g.isLoading, p[18] = O);
	let k;
	p[19] === g.error ? k = p[20] : (k = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: g.error }), p[19] = g.error, p[20] = k);
	let A;
	p[21] === g.data ? A = p[22] : (A = g.data ? /* @__PURE__ */ jsx(ExecutionTimeline_default, { workspace: g.data }) : "", p[21] = g.data, p[22] = A);
	let j;
	p[23] !== O || p[24] !== k || p[25] !== A || p[26] !== D ? (j = /* @__PURE__ */ jsxs(Fragment, { children: [
		D,
		O,
		k,
		A
	] }), p[23] = O, p[24] = k, p[25] = A, p[26] = D, p[27] = j) : j = p[27];
	let M;
	return p[28] !== T || p[29] !== j ? (M = /* @__PURE__ */ jsx(MainLayout_default, {
		breadcrumbsData: T,
		children: j
	}), p[28] = T, p[29] = j, p[30] = M) : M = p[30], M;
};
export { WorkspacePage_default as default };
