// src/presentation/features/atoms/FeatureIcon/FeatureIcon.tsx
import * as React from "react";
import {
  FileText,
  Boxes,
  Settings,
  Globe,
  Shield,
  Database,
  MessageSquare,
  Layout,
  Workflow
} from "lucide-react";
import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
import { jsx } from "react/jsx-runtime";
"use client";
var domainIconMap = {
  platform: Settings,
  documentation: FileText,
  docs: FileText,
  integration: Workflow,
  api: Globe,
  security: Shield,
  data: Database,
  messaging: MessageSquare,
  ui: Layout,
  presentation: Layout
};
var tagIconMap = {
  documentation: FileText,
  guides: FileText,
  "api-reference": Globe,
  presentations: Layout,
  ui: Layout,
  rendering: Layout,
  mcp: Workflow,
  integration: Workflow,
  security: Shield,
  auth: Shield,
  data: Database,
  storage: Database
};
var stabilityToneMap = {
  stable: "success",
  beta: "warning",
  experimental: "info",
  deprecated: "danger"
};
var sizeClasses = {
  sm: "h-4 w-4",
  md: "h-5 w-5",
  lg: "h-6 w-6"
};
function FeatureIcon({
  domain,
  tags = [],
  stability,
  icon: IconOverride,
  size = "md",
  className
}) {
  const Icon = React.useMemo(() => {
    if (IconOverride)
      return IconOverride;
    if (domain) {
      const domainIcon = domainIconMap[domain.toLowerCase()];
      if (domainIcon)
        return domainIcon;
    }
    for (const tag of tags) {
      const tagIcon = tagIconMap[tag.toLowerCase()];
      if (tagIcon)
        return tagIcon;
    }
    return Boxes;
  }, [domain, tags, IconOverride]);
  const tone = stability ? stabilityToneMap[stability] || "primary" : "primary";
  const toneClasses = {
    success: "text-emerald-600 dark:text-emerald-400",
    warning: "text-amber-600 dark:text-amber-400",
    info: "text-blue-600 dark:text-blue-400",
    danger: "text-red-600 dark:text-red-400",
    primary: "text-primary"
  };
  return /* @__PURE__ */ jsx(Icon, {
    className: cn(sizeClasses[size], toneClasses[tone], className)
  });
}
function getFeatureIconTone(stability) {
  if (!stability)
    return "primary";
  return stabilityToneMap[stability] || "primary";
}
// src/presentation/features/molecules/FeatureHoverPreview/FeatureHoverPreview.tsx
import { StatusChip } from "@contractspec/lib.design-system";
import { HStack } from "@contractspec/lib.ui-kit-web/ui/stack";
import {
  ArrowRight,
  Layout as Layout2,
  Radio,
  Shield as Shield2,
  Tag,
  Users,
  Zap
} from "lucide-react";
import { jsx as jsx2, jsxs, Fragment } from "react/jsx-runtime";
"use client";
function FeatureHoverPreview({ feature }) {
  const { meta, operations, events, presentations, capabilities } = feature;
  const hasCapabilities = capabilities?.provides?.length || capabilities?.requires?.length;
  return /* @__PURE__ */ jsxs(Fragment, {
    children: [
      meta.description && /* @__PURE__ */ jsx2("p", {
        className: "text-muted-foreground text-sm leading-relaxed",
        children: meta.description
      }),
      /* @__PURE__ */ jsxs(HStack, {
        gap: "md",
        className: "py-2",
        children: [
          operations?.length ? /* @__PURE__ */ jsxs("div", {
            className: "flex items-center gap-1.5 text-sm",
            children: [
              /* @__PURE__ */ jsx2(Zap, {
                className: "h-4 w-4 text-amber-500"
              }),
              /* @__PURE__ */ jsx2("span", {
                className: "font-medium",
                children: operations.length
              }),
              /* @__PURE__ */ jsx2("span", {
                className: "text-muted-foreground",
                children: "ops"
              })
            ]
          }) : null,
          events?.length ? /* @__PURE__ */ jsxs("div", {
            className: "flex items-center gap-1.5 text-sm",
            children: [
              /* @__PURE__ */ jsx2(Radio, {
                className: "h-4 w-4 text-blue-500"
              }),
              /* @__PURE__ */ jsx2("span", {
                className: "font-medium",
                children: events.length
              }),
              /* @__PURE__ */ jsx2("span", {
                className: "text-muted-foreground",
                children: "events"
              })
            ]
          }) : null,
          presentations?.length ? /* @__PURE__ */ jsxs("div", {
            className: "flex items-center gap-1.5 text-sm",
            children: [
              /* @__PURE__ */ jsx2(Layout2, {
                className: "h-4 w-4 text-purple-500"
              }),
              /* @__PURE__ */ jsx2("span", {
                className: "font-medium",
                children: presentations.length
              }),
              /* @__PURE__ */ jsx2("span", {
                className: "text-muted-foreground",
                children: "views"
              })
            ]
          }) : null
        ]
      }),
      hasCapabilities && /* @__PURE__ */ jsxs("div", {
        className: "border-border/50 space-y-1.5 border-t pt-1",
        children: [
          capabilities?.provides?.length ? /* @__PURE__ */ jsxs(HStack, {
            gap: "xs",
            wrap: "wrap",
            className: "items-start",
            children: [
              /* @__PURE__ */ jsx2(Shield2, {
                className: "mt-0.5 h-3.5 w-3.5 text-emerald-500"
              }),
              /* @__PURE__ */ jsx2("span", {
                className: "text-muted-foreground text-xs",
                children: "Provides:"
              }),
              capabilities.provides.slice(0, 2).map((cap) => /* @__PURE__ */ jsx2(StatusChip, {
                tone: "success",
                label: cap.key,
                size: "sm"
              }, cap.key)),
              capabilities.provides.length > 2 && /* @__PURE__ */ jsxs("span", {
                className: "text-muted-foreground text-xs",
                children: [
                  "+",
                  capabilities.provides.length - 2
                ]
              })
            ]
          }) : null,
          capabilities?.requires?.length ? /* @__PURE__ */ jsxs(HStack, {
            gap: "xs",
            wrap: "wrap",
            className: "items-start",
            children: [
              /* @__PURE__ */ jsx2(ArrowRight, {
                className: "mt-0.5 h-3.5 w-3.5 text-blue-500"
              }),
              /* @__PURE__ */ jsx2("span", {
                className: "text-muted-foreground text-xs",
                children: "Requires:"
              }),
              capabilities.requires.slice(0, 2).map((req) => /* @__PURE__ */ jsx2(StatusChip, {
                tone: "info",
                label: req.key,
                size: "sm"
              }, req.key)),
              capabilities.requires.length > 2 && /* @__PURE__ */ jsxs("span", {
                className: "text-muted-foreground text-xs",
                children: [
                  "+",
                  capabilities.requires.length - 2
                ]
              })
            ]
          }) : null
        ]
      }),
      meta.tags?.length ? /* @__PURE__ */ jsxs(HStack, {
        gap: "xs",
        wrap: "wrap",
        className: "border-border/50 items-center border-t pt-1",
        children: [
          /* @__PURE__ */ jsx2(Tag, {
            className: "text-muted-foreground h-3.5 w-3.5"
          }),
          meta.tags.slice(0, 4).map((tag) => /* @__PURE__ */ jsxs("span", {
            className: "bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-xs",
            children: [
              "#",
              tag
            ]
          }, tag)),
          meta.tags.length > 4 && /* @__PURE__ */ jsxs("span", {
            className: "text-muted-foreground text-xs",
            children: [
              "+",
              meta.tags.length - 4
            ]
          })
        ]
      }) : null,
      meta.owners?.length ? /* @__PURE__ */ jsxs(HStack, {
        gap: "xs",
        className: "text-muted-foreground items-center text-xs",
        children: [
          /* @__PURE__ */ jsx2(Users, {
            className: "h-3.5 w-3.5"
          }),
          /* @__PURE__ */ jsx2("span", {
            children: meta.owners.join(", ")
          })
        ]
      }) : null
    ]
  });
}
// src/presentation/features/molecules/FeatureCard/FeatureCard.tsx
import { EntityCard, StatusChip as StatusChip2 } from "@contractspec/lib.design-system";
import { HStack as HStack2 } from "@contractspec/lib.ui-kit-web/ui/stack";
import { Zap as Zap2, Radio as Radio2, Layout as Layout3, Shield as Shield3 } from "lucide-react";
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
"use client";
var stabilityTone = {
  stable: "success",
  beta: "warning",
  experimental: "info",
  deprecated: "danger"
};
function FeatureCard({
  feature,
  onSelect,
  className
}) {
  const { meta, operations, events, presentations, capabilities } = feature;
  const tone = stabilityTone[meta.stability] ?? "neutral";
  const iconTone = getFeatureIconTone(meta.stability);
  const emphasis = meta.stability === "stable" ? "strong" : "default";
  const handleClick = onSelect ? () => onSelect(feature) : undefined;
  const hasCapabilities = capabilities?.provides?.length || capabilities?.requires?.length;
  return /* @__PURE__ */ jsx3(EntityCard, {
    cardTitle: meta.title,
    cardSubtitle: meta.key,
    className,
    onClick: handleClick,
    emphasis,
    icon: /* @__PURE__ */ jsx3(FeatureIcon, {
      domain: meta.domain,
      tags: meta.tags,
      stability: meta.stability,
      size: "md"
    }),
    iconTone,
    chips: /* @__PURE__ */ jsx3(StatusChip2, {
      tone,
      label: meta.stability ?? "unknown",
      size: "sm"
    }),
    meta: meta.description ? /* @__PURE__ */ jsx3("span", {
      className: "text-muted-foreground line-clamp-2 text-sm",
      children: meta.description
    }) : undefined,
    preview: /* @__PURE__ */ jsx3(FeatureHoverPreview, {
      feature
    }),
    footer: /* @__PURE__ */ jsxs2(HStack2, {
      gap: "md",
      className: "text-muted-foreground w-full justify-between text-xs",
      children: [
        /* @__PURE__ */ jsxs2(HStack2, {
          gap: "sm",
          children: [
            operations?.length ? /* @__PURE__ */ jsxs2("span", {
              className: "flex items-center gap-1",
              children: [
                /* @__PURE__ */ jsx3(Zap2, {
                  className: "h-3 w-3 text-amber-500"
                }),
                operations.length
              ]
            }) : null,
            events?.length ? /* @__PURE__ */ jsxs2("span", {
              className: "flex items-center gap-1",
              children: [
                /* @__PURE__ */ jsx3(Radio2, {
                  className: "h-3 w-3 text-blue-500"
                }),
                events.length
              ]
            }) : null,
            presentations?.length ? /* @__PURE__ */ jsxs2("span", {
              className: "flex items-center gap-1",
              children: [
                /* @__PURE__ */ jsx3(Layout3, {
                  className: "h-3 w-3 text-purple-500"
                }),
                presentations.length
              ]
            }) : null
          ]
        }),
        hasCapabilities && /* @__PURE__ */ jsxs2("span", {
          className: "flex items-center gap-1",
          children: [
            /* @__PURE__ */ jsx3(Shield3, {
              className: "h-3 w-3 text-emerald-500"
            }),
            (capabilities?.provides?.length ?? 0) + (capabilities?.requires?.length ?? 0)
          ]
        })
      ]
    })
  });
}
// src/presentation/features/molecules/FeatureFilters/FeatureFilters.tsx
import { Button, Input } from "@contractspec/lib.design-system";
import { VStack, HStack as HStack3 } from "@contractspec/lib.ui-kit-web/ui/stack";
import { cn as cn2 } from "@contractspec/lib.ui-kit-web/ui/utils";
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
"use client";
function FeatureFiltersBar({
  uniqueTags,
  uniqueStabilities,
  filters,
  setSearch,
  toggleTag,
  toggleStability,
  clearFilters,
  hasActiveFilters,
  className
}) {
  return /* @__PURE__ */ jsxs3(VStack, {
    gap: "md",
    className: cn2("w-full", className),
    children: [
      /* @__PURE__ */ jsxs3(HStack3, {
        gap: "md",
        justify: "between",
        className: "w-full",
        children: [
          /* @__PURE__ */ jsx4(Input, {
            placeholder: "Search features...",
            value: filters.search,
            onChange: (e) => setSearch(e.target.value),
            className: "max-w-md",
            "aria-label": "Search features"
          }),
          hasActiveFilters && /* @__PURE__ */ jsx4(Button, {
            variant: "ghost",
            size: "sm",
            onClick: clearFilters,
            children: "Clear filters"
          })
        ]
      }),
      uniqueStabilities.length > 0 && /* @__PURE__ */ jsxs3(HStack3, {
        gap: "xs",
        wrap: "wrap",
        children: [
          /* @__PURE__ */ jsx4("span", {
            className: "text-muted-foreground text-sm",
            children: "Stability:"
          }),
          uniqueStabilities.map((stability) => /* @__PURE__ */ jsx4(Button, {
            variant: filters.stability.includes(stability) ? "default" : "outline",
            size: "sm",
            onClick: () => toggleStability(stability),
            "aria-pressed": filters.stability.includes(stability),
            children: stability
          }, stability))
        ]
      }),
      uniqueTags.length > 0 && /* @__PURE__ */ jsxs3(HStack3, {
        gap: "xs",
        wrap: "wrap",
        children: [
          /* @__PURE__ */ jsx4("span", {
            className: "text-muted-foreground text-sm",
            children: "Tags:"
          }),
          uniqueTags.slice(0, 10).map((tag) => /* @__PURE__ */ jsxs3(Button, {
            variant: filters.tags.includes(tag) ? "default" : "outline",
            size: "sm",
            onClick: () => toggleTag(tag),
            "aria-pressed": filters.tags.includes(tag),
            children: [
              "#",
              tag
            ]
          }, tag)),
          uniqueTags.length > 10 && /* @__PURE__ */ jsxs3("span", {
            className: "text-muted-foreground text-sm",
            children: [
              "+",
              uniqueTags.length - 10,
              " more"
            ]
          })
        ]
      })
    ]
  });
}
// src/presentation/features/molecules/FeatureCategoryHeader/FeatureCategoryHeader.tsx
import { cn as cn3 } from "@contractspec/lib.ui-kit-web/ui/utils";
import { ChevronDown, Boxes as Boxes2 } from "lucide-react";
import { HStack as HStack4 } from "@contractspec/lib.ui-kit-web/ui/stack";
import { StatusChip as StatusChip3 } from "@contractspec/lib.design-system";
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
"use client";
function FeatureCategoryHeader({
  title,
  count,
  icon,
  isCollapsed = false,
  onToggle,
  className
}) {
  return /* @__PURE__ */ jsxs4("button", {
    type: "button",
    onClick: onToggle,
    className: cn3("flex w-full items-center justify-between rounded-lg px-4 py-3", "bg-muted/30 hover:bg-muted/50 transition-colors", "group cursor-pointer", className),
    children: [
      /* @__PURE__ */ jsxs4(HStack4, {
        gap: "sm",
        className: "items-center",
        children: [
          /* @__PURE__ */ jsx5("div", {
            className: "text-muted-foreground group-hover:text-foreground transition-colors",
            children: icon || /* @__PURE__ */ jsx5(Boxes2, {
              className: "h-5 w-5"
            })
          }),
          /* @__PURE__ */ jsx5("span", {
            className: "group-hover:text-primary text-lg font-semibold capitalize transition-colors",
            children: title
          }),
          /* @__PURE__ */ jsx5(StatusChip3, {
            tone: "neutral",
            label: `${count} ${count === 1 ? "feature" : "features"}`,
            size: "sm"
          })
        ]
      }),
      /* @__PURE__ */ jsx5(ChevronDown, {
        className: cn3("text-muted-foreground h-5 w-5 transition-transform duration-200", isCollapsed && "-rotate-90")
      })
    ]
  });
}
export {
  FeatureHoverPreview,
  FeatureFiltersBar,
  FeatureCategoryHeader,
  FeatureCard
};
