import { Button } from "../../../../components/ui/button.js";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../../components/ui/select.js";
import HeaderSection_default from "./HeaderSection.js";
import { c } from "react/compiler-runtime";
import { jsx, jsxs } from "react/jsx-runtime";
import { Loader2, Play } from "lucide-react";
var SelectionView_default = (p) => {
	let m = c(46), { title: h, pipelineTypes: g, formData: _, errors: v, isLoading: y, onInputChange: b, onNext: x } = p, S;
	if (m[0] !== _.blockName || m[1] !== g) {
		let e;
		m[3] === _.blockName ? e = m[4] : (e = (e) => e.blockName === _.blockName, m[3] = _.blockName, m[4] = e), S = g.find(e), m[0] = _.blockName, m[1] = g, m[2] = S;
	} else S = m[2];
	let C = S, w;
	m[5] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ jsx(Play, { className: "h-5 w-5" }), m[5] = w) : w = m[5];
	let T;
	m[6] === h ? T = m[7] : (T = /* @__PURE__ */ jsx(HeaderSection_default, {
		icon: w,
		title: h,
		description: "Choose an automation type to get started"
	}), m[6] = h, m[7] = T);
	let E;
	m[8] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ jsx("label", {
		htmlFor: "automation",
		className: "text-foreground block text-sm font-medium",
		children: "Automation Type"
	}), m[8] = E) : E = m[8];
	let D = _.blockName, O;
	m[9] === b ? O = m[10] : (O = (e) => b("blockName", e), m[9] = b, m[10] = O);
	let k = `flex-1 ${v.blockName ? "border-red-500 focus:ring-red-500" : ""}`, A;
	m[11] === Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select an automation..." }), m[11] = A) : A = m[11];
	let j;
	m[12] === k ? j = m[13] : (j = /* @__PURE__ */ jsx(SelectTrigger, {
		id: "automation",
		className: k,
		children: A
	}), m[12] = k, m[13] = j);
	let M;
	m[14] === g ? M = m[15] : (M = g.map(_temp), m[14] = g, m[15] = M);
	let N;
	m[16] === M ? N = m[17] : (N = /* @__PURE__ */ jsx(SelectContent, { children: M }), m[16] = M, m[17] = N);
	let P;
	m[18] !== _.blockName || m[19] !== y || m[20] !== N || m[21] !== O || m[22] !== j ? (P = /* @__PURE__ */ jsxs(Select, {
		value: D,
		onValueChange: O,
		disabled: y,
		children: [j, N]
	}), m[18] = _.blockName, m[19] = y, m[20] = N, m[21] = O, m[22] = j, m[23] = P) : P = m[23];
	let F = y || !_.blockName, I;
	m[24] === y ? I = m[25] : (I = y ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Play, { className: "h-4 w-4" }), m[24] = y, m[25] = I);
	let L;
	m[26] !== x || m[27] !== F || m[28] !== I ? (L = /* @__PURE__ */ jsx(Button, {
		variant: "default",
		disabled: F,
		onClick: x,
		className: "px-4",
		children: I
	}), m[26] = x, m[27] = F, m[28] = I, m[29] = L) : L = m[29];
	let R;
	m[30] !== P || m[31] !== L ? (R = /* @__PURE__ */ jsxs("div", {
		className: "flex gap-2",
		children: [P, L]
	}), m[30] = P, m[31] = L, m[32] = R) : R = m[32];
	let z;
	m[33] === v.blockName ? z = m[34] : (z = v.blockName && /* @__PURE__ */ jsx("p", {
		className: "mt-1 flex items-center gap-1 text-sm text-red-500",
		children: v.blockName
	}), m[33] = v.blockName, m[34] = z);
	let B;
	m[35] !== R || m[36] !== z ? (B = /* @__PURE__ */ jsxs("div", {
		className: "space-y-2",
		children: [
			E,
			R,
			z
		]
	}), m[35] = R, m[36] = z, m[37] = B) : B = m[37];
	let V;
	m[38] === C ? V = m[39] : (V = C && /* @__PURE__ */ jsxs("div", {
		className: "bg-muted/50 border-border mt-4 rounded-lg border p-4",
		children: [/* @__PURE__ */ jsx("h3", {
			className: "text-foreground mb-1 text-sm font-medium",
			children: C.title || C.blockName
		}), C.description && /* @__PURE__ */ jsx("p", {
			className: "text-muted-foreground text-sm leading-relaxed",
			children: C.description
		})]
	}), m[38] = C, m[39] = V);
	let H;
	m[40] !== B || m[41] !== V ? (H = /* @__PURE__ */ jsxs("div", {
		className: "mb-6 px-1",
		children: [B, V]
	}), m[40] = B, m[41] = V, m[42] = H) : H = m[42];
	let U;
	return m[43] !== H || m[44] !== T ? (U = /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col",
		children: [T, H]
	}), m[43] = H, m[44] = T, m[45] = U) : U = m[45], U;
};
function _temp(e) {
	return /* @__PURE__ */ jsx(SelectItem, {
		value: e.blockName,
		children: e.title ?? e.blockName
	}, e.blockName);
}
export { SelectionView_default as default };
