import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';

// src/lib/utils.ts
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
var COLUMN_CLASS = {
  three: "sm:grid-cols-2 lg:grid-cols-3",
  four: "sm:grid-cols-2 lg:grid-cols-4"
};
function CategoryCardBody({ category }) {
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx("div", { className: "aspect-[4/3] overflow-hidden rounded-xl bg-muted [&_img]:size-full [&_img]:object-cover [&_img]:transition-transform [&_img]:duration-200 [&_img]:ease-out group-hover:[&_img]:scale-105", children: category.image }),
    /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-foreground", children: category.name }),
      category.productCount !== void 0 ? /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: category.productCount }) : null
    ] })
  ] });
}
function CommerceCategory({
  categories,
  title,
  columns = "three",
  className
}) {
  return /* @__PURE__ */ jsx("section", { className: cn("bg-background py-16 sm:py-20", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-7xl px-6 lg:px-8", children: [
    title ? /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold tracking-tight text-foreground", children: title }) : null,
    /* @__PURE__ */ jsx(
      "div",
      {
        className: cn(
          "grid grid-cols-1 gap-x-6 gap-y-10",
          COLUMN_CLASS[columns],
          title && "mt-8"
        ),
        children: categories.map(
          (category, index) => category.href ? /* @__PURE__ */ jsx(
            "a",
            {
              href: category.href,
              className: "group flex flex-col gap-3 rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
              children: /* @__PURE__ */ jsx(CategoryCardBody, { category })
            },
            index
          ) : /* @__PURE__ */ jsx("div", { className: "group flex flex-col gap-3", children: /* @__PURE__ */ jsx(CategoryCardBody, { category }) }, index)
        )
      }
    )
  ] }) });
}

export { CommerceCategory };
//# sourceMappingURL=commerce-category.js.map
//# sourceMappingURL=commerce-category.js.map