"use client";
import { cn as e } from "../../lib/utils.js";
import { Collapsible as t, CollapsibleContent as n, CollapsibleTrigger as r } from "../ui/collapsible.js";
import { Tooltip as i, TooltipContent as a, TooltipTrigger as o } from "../ui/tooltip.js";
import { CodeBlock as s } from "../ai-elements/code-block.js";
import { isValidElement as c } from "react";
import { jsx as l, jsxs as u } from "react/jsx-runtime";
import { CheckCircleIcon as d, ChevronDownIcon as f, CircleIcon as p, ClockIcon as m, XCircleIcon as h } from "lucide-react";
//#region src/components/loopstack-elements/tool.tsx
var g = ({ className: n, ...r }) => /* @__PURE__ */ l(t, {
	className: e("not-prose mt-3 w-full", n),
	...r
}), _ = {
	"input-streaming": {
		label: "Pending",
		icon: /* @__PURE__ */ l(p, { className: "size-4" })
	},
	"input-available": {
		label: "Running",
		icon: /* @__PURE__ */ l(m, { className: "size-4 animate-pulse" })
	},
	"approval-requested": {
		label: "Awaiting Approval",
		icon: /* @__PURE__ */ l(m, { className: "size-4 text-yellow-600" })
	},
	"approval-responded": {
		label: "Responded",
		icon: /* @__PURE__ */ l(d, { className: "size-4 text-blue-600" })
	},
	"output-available": {
		label: "Completed",
		icon: /* @__PURE__ */ l(d, { className: "size-4 text-green-600" })
	},
	"output-error": {
		label: "Error",
		icon: /* @__PURE__ */ l(h, { className: "size-4 text-red-600" })
	},
	"output-denied": {
		label: "Denied",
		icon: /* @__PURE__ */ l(h, { className: "size-4 text-orange-600" })
	}
}, v = ({ className: t, title: n, type: s, state: c, ...d }) => /* @__PURE__ */ u(r, {
	className: e("flex w-full items-center justify-between gap-3 py-1", t),
	...d,
	children: [/* @__PURE__ */ u("div", {
		className: "flex items-center gap-1.5",
		children: [/* @__PURE__ */ u(i, { children: [/* @__PURE__ */ l(o, {
			asChild: !0,
			children: /* @__PURE__ */ l("span", {
				className: "text-muted-foreground flex shrink-0 items-center",
				children: _[c].icon
			})
		}), /* @__PURE__ */ l(a, {
			side: "top",
			children: _[c].label
		})] }), /* @__PURE__ */ l("span", {
			className: "text-muted-foreground text-sm",
			children: n ?? s.split("-").slice(1).join("-")
		})]
	}), /* @__PURE__ */ l(f, { className: "text-muted-foreground size-4 transition-transform group-data-[state=open]:rotate-180" })]
}), y = ({ className: t, ...r }) => /* @__PURE__ */ l(n, {
	className: e("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground data-[state=closed]:animate-out data-[state=open]:animate-in outline-none", t),
	...r
}), b = ({ className: t, input: n, ...r }) => /* @__PURE__ */ u("div", {
	className: e("space-y-2 overflow-hidden py-2", t),
	...r,
	children: [/* @__PURE__ */ l("h4", {
		className: "text-muted-foreground text-xs font-medium tracking-wide uppercase",
		children: "Parameters"
	}), /* @__PURE__ */ l("div", {
		className: "bg-muted/50 rounded-md",
		children: /* @__PURE__ */ l(s, {
			code: JSON.stringify(n, null, 2),
			language: "json"
		})
	})]
}), x = ({ className: t, output: n, errorText: r, ...i }) => {
	if (!(n || r)) return null;
	let a = /* @__PURE__ */ l("div", { children: n });
	return typeof n == "object" && !c(n) ? a = /* @__PURE__ */ l(s, {
		code: JSON.stringify(n, null, 2),
		language: "json"
	}) : typeof n == "string" && (a = /* @__PURE__ */ l(s, {
		code: n,
		language: "json"
	})), /* @__PURE__ */ u("div", {
		className: e("space-y-2 py-2", t),
		...i,
		children: [/* @__PURE__ */ l("h4", {
			className: "text-muted-foreground text-xs font-medium tracking-wide uppercase",
			children: r ? "Error" : "Result"
		}), /* @__PURE__ */ u("div", {
			className: e("overflow-x-auto rounded-md text-xs [&_table]:w-full", r ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"),
			children: [r && /* @__PURE__ */ l("div", { children: r }), a]
		})]
	});
};
//#endregion
export { g as Tool, y as ToolContent, v as ToolHeader, b as ToolInput, x as ToolOutput };
