"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { match, P } from "ts-pattern";
import { Card, CardContent } from "@open-mercato/ui/primitives/card";
import { ErrorMessage } from "@open-mercato/ui/backend/detail";
import { Spinner } from "@open-mercato/ui/primitives/spinner";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { Truck } from "lucide-react";
const ProviderStep = (props) => {
  const { providers, onSelect } = props;
  const t = useT();
  return match(props).with({ isLoading: true }, () => /* @__PURE__ */ jsx("div", { className: "flex justify-center py-8", children: /* @__PURE__ */ jsx(Spinner, {}) })).with({ error: P.string }, ({ error }) => /* @__PURE__ */ jsx(ErrorMessage, { label: error })).with({ providers: [] }, () => /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "py-8 text-center text-sm text-muted-foreground", children: t("shipping_carriers.create.noProviders", "No shipping providers are configured. Enable a carrier integration first.") }) })).otherwise(() => /* @__PURE__ */ jsx("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: providers.map((provider) => /* @__PURE__ */ jsxs(
    "button",
    {
      type: "button",
      className: "flex cursor-pointer items-center gap-3 rounded-lg border bg-card p-4 text-left transition-colors hover:border-primary hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
      onClick: () => onSelect(provider.providerKey),
      children: [
        /* @__PURE__ */ jsx(Truck, { className: "h-6 w-6 shrink-0 text-muted-foreground" }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "font-medium capitalize", children: provider.providerKey.replace(/_/g, " ") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: provider.providerKey })
        ] })
      ]
    },
    provider.providerKey
  )) }));
};
export {
  ProviderStep
};
//# sourceMappingURL=ProviderStep.js.map
