import { useWorkspace as e } from "../../hooks/useWorkspaces.js";
import t from "../../components/page/PageBreadcrumbs.js";
import n from "./WorkflowList.js";
import { RemoteFileExplorerProvider as r } from "./providers/RemoteFileExplorerProvider.js";
import { WorkbenchLayoutProvider as i, useWorkbenchLayout as a } from "./providers/WorkbenchLayoutProvider.js";
import { WorkbenchFilesPanel as o } from "./components/WorkbenchFilesPanel.js";
import { WorkbenchFloatingPanel as s } from "./components/WorkbenchFloatingPanel.js";
import { WorkbenchFlowPanel as c } from "./components/WorkbenchFlowPanel.js";
import { WorkbenchIconSidebar as l } from "./components/WorkbenchIconSidebar.js";
import { WorkbenchPreviewPanel as u } from "./components/WorkbenchPreviewPanel.js";
import { ScrollProvider as d } from "./providers/ScrollProvider.js";
import { jsx as f, jsxs as p } from "react/jsx-runtime";
//#region src/features/workbench/Workbench.tsx
function m({ workflow: e, breadcrumbData: r }) {
	return /* @__PURE__ */ f("div", {
		className: "flex h-full flex-col",
		children: /* @__PURE__ */ f("div", {
			className: "flex flex-1 gap-4 overflow-hidden md:flex-row flex-col",
			children: /* @__PURE__ */ p("div", {
				className: "flex flex-1 flex-col overflow-hidden",
				children: [/* @__PURE__ */ f("div", {
					className: "border-b flex h-12 shrink-0 items-center",
					children: r ? /* @__PURE__ */ f(t, { breadcrumbData: r }) : /* @__PURE__ */ f("span", {
						className: "px-3 text-sm font-medium",
						children: "Workflows"
					})
				}), /* @__PURE__ */ f(d, { children: /* @__PURE__ */ f("div", {
					className: "flex-1 overflow-auto",
					children: /* @__PURE__ */ f(n, { workflow: e })
				}) })]
			})
		})
	});
}
function h({ workflow: e, breadcrumbData: t }) {
	let { activeSidePanel: n } = a();
	return /* @__PURE__ */ p("div", {
		className: "flex h-full w-full",
		children: [/* @__PURE__ */ p("div", {
			className: "relative flex flex-1 overflow-hidden",
			children: [
				/* @__PURE__ */ f("div", {
					className: n ? "w-1/2 overflow-hidden" : "w-full overflow-hidden",
					children: /* @__PURE__ */ f(m, {
						workflow: e,
						breadcrumbData: t
					})
				}),
				n === "preview" && /* @__PURE__ */ f(u, {}),
				n === "flow" && /* @__PURE__ */ f(c, {}),
				n === "files" && /* @__PURE__ */ f(o, {}),
				/* @__PURE__ */ f(s, {})
			]
		}), /* @__PURE__ */ f(l, {})]
	});
}
function g({ workflow: t, breadcrumbData: n, previewPanelOpen: a, onPreviewPanelOpenChange: o, isDeveloperMode: s, getPreviewUrl: c, getEnvironmentPreviewUrl: l, environments: u }) {
	let d = t?.workspaceId, p = e(d), m = p.data?.features?.fileExplorer?.enabled && p.data?.features?.fileExplorer?.environments?.includes(u?.[0]?.slotId ?? "");
	return /* @__PURE__ */ f(i, {
		workflow: t,
		isDeveloperMode: s,
		workspaceConfig: p.data ? {
			volumes: p.data.volumes,
			features: p.data.features
		} : void 0,
		getPreviewUrl: c,
		getEnvironmentPreviewUrl: l,
		environments: u ?? p.data?.environments,
		previewPanelOpen: a,
		onPreviewPanelOpenChange: o,
		children: m ? /* @__PURE__ */ f(r, { children: /* @__PURE__ */ f(h, {
			workflow: t,
			breadcrumbData: n
		}) }) : /* @__PURE__ */ f(h, {
			workflow: t,
			breadcrumbData: n
		})
	});
}
//#endregion
export { g as default };
