"use client";
"use client";
import { cn as e } from "../../../lib/utils.js";
import { t } from "../../../button-BNOmhdpM.js";
import { Card as n, CardContent as r } from "../atoms/card.js";
import { t as i } from "../../../checkbox-CfF6tabe.js";
import { n as a, r as o, t as s } from "../../../collapsible-Dt__KKUJ.js";
import { createPropsComparator as c } from "../utils/memo.js";
import { useIsTruncated as l } from "../../../hooks/use-is-truncated.js";
import * as u from "react";
import { jsx as d, jsxs as f } from "react/jsx-runtime";
import { Wrench as p } from "lucide-react";
//#region lib/components/ui/molecules/tool-card.tsx
function m({ fully_qualified_name: c, name: m, toolkitName: h, description: g, Icon: _ = (e) => /* @__PURE__ */ d(p, { ...e }), isSelected: v = !1, onSelect: y, hideCheckbox: b = !1, ...x }) {
	let S = u.useCallback(() => y?.(!v), [v, y]), [C, w] = u.useState(!1), { ref: T, isTruncated: E } = l(!C), D = (e) => {
		let t = e.key === "Enter" || e.code === "Enter", n = e.key === " " || e.key === "Spacebar" || e.code === "Space";
		(t || n) && (e.preventDefault(), S());
	}, O = u.useCallback((e) => y?.(!!e), [y]), k = u.useCallback((e) => {
		e.stopPropagation();
	}, []), A = u.useCallback((e) => {
		let t = e.key === "Enter" || e.code === "Enter", n = e.key === " " || e.key === "Spacebar" || e.code === "Space";
		(t || n) && e.stopPropagation();
	}, []);
	return /* @__PURE__ */ d(n, {
		...x,
		className: e("group relative cursor-pointer overflow-hidden rounded-lg border py-3 transition-all duration-200", "bg-white/50 hover:bg-white/70 dark:bg-neutral-900/50 dark:hover:bg-neutral-900/70", "hover:-translate-y-0.5 hover:shadow-lg", v && "border-2 border-emerald-600 dark:border-emerald-400", !v && "border-neutral-200 hover:border-neutral-300 dark:border-neutral-800 dark:hover:border-neutral-700"),
		onClick: (e) => {
			e.target.closest("[data-slot=\"checkbox-wrapper\"]") || S();
		},
		onKeyDown: D,
		tabIndex: 0,
		children: /* @__PURE__ */ d(r, {
			className: "px-3",
			children: /* @__PURE__ */ f("div", {
				className: e("grid items-start gap-2", "grid-cols-[20px_1fr_auto]", b && "grid-cols-[1fr_auto]"),
				children: [
					!b && /* @__PURE__ */ d("div", {
						className: "flex items-center justify-center pt-1.5",
						"data-slot": "checkbox-wrapper",
						children: /* @__PURE__ */ d(i, {
							"aria-label": `Select ${c}`,
							checked: v,
							onCheckedChange: O,
							tabIndex: -1
						})
					}),
					/* @__PURE__ */ f("div", {
						className: "min-w-0 space-y-2",
						children: [/* @__PURE__ */ f("div", {
							className: "flex min-w-0 items-start gap-3",
							children: [/* @__PURE__ */ d("div", {
								className: "flex size-9 items-center justify-center rounded bg-gradient-to-b from-neutral-200 to-neutral-100 ring-1 ring-black/5 dark:from-neutral-800 dark:to-neutral-900 dark:ring-white/5",
								children: /* @__PURE__ */ d(_, { className: "size-6 text-neutral-700 dark:text-neutral-200" })
							}), /* @__PURE__ */ f("div", {
								className: "flex h-9 min-w-0 flex-col justify-center space-y-0.5",
								children: [/* @__PURE__ */ d("h3", {
									className: "truncate font-semibold text-base text-neutral-900 leading-tight dark:text-neutral-100",
									children: m ?? c
								}), h && /* @__PURE__ */ d("span", {
									className: "font-medium text-neutral-500 text-xs leading-tight dark:text-neutral-400",
									children: h
								})]
							})]
						}), g && /* @__PURE__ */ f(s, {
							onOpenChange: w,
							open: C,
							children: [/* @__PURE__ */ f("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ d("p", {
									className: e("text-neutral-600 text-sm dark:text-neutral-400", !C && "line-clamp-3"),
									ref: T,
									children: g
								}), E && /* @__PURE__ */ d(o, {
									render: /* @__PURE__ */ d(t, {
										className: "h-auto px-0",
										onClick: k,
										onKeyDown: A,
										size: "sm",
										variant: "link"
									}),
									children: /* @__PURE__ */ d("span", { children: C ? "Show less" : "Show more" })
								})]
							}), /* @__PURE__ */ d(a, {})]
						})]
					}),
					/* @__PURE__ */ d("div", { className: "w-8" })
				]
			})
		})
	});
}
var h = c([
	"fully_qualified_name",
	"name",
	"toolkitName",
	"description",
	"isSelected",
	"Icon",
	"hideCheckbox"
]), g = u.memo(m, h);
//#endregion
export { g as ToolCard };
