"use client";

// src/lib/data-list-view.ts
var DATA_LIST_VIEW_TILES = [
  { value: "table", icon: "fa-table", label: "Table view" },
  { value: "list", icon: "fa-list", label: "List view" },
  { value: "board", icon: "fa-table-columns", label: "Board view" },
  { value: "dashboard", icon: "fa-chart-mixed", label: "Dashboard view" },
  { value: "calendar", icon: "fa-calendar-days", label: "Calendar view" },
  { value: "folder", icon: "fa-grid-2", label: "Folder view" },
  { value: "panel", icon: "fa-sidebar", label: "List & details" },
  { value: "tree-panel", icon: "fa-sitemap", label: "Tree & details" }
];
function dataListViewLabel(view) {
  return DATA_LIST_VIEW_TILES.find((t) => t.value === view)?.label ?? view;
}

// src/lib/data-list-view-surface.ts
function getDataListViewRenderKind(view) {
  switch (view) {
    case "table":
      return "data-table";
    case "list":
      return "list-with-toolbar";
    case "board":
      return "board-with-toolbar";
    case "dashboard":
      return "dashboard-with-toolbar";
    case "calendar":
      return "calendar-with-toolbar";
    case "folder":
      return "folder-with-toolbar";
    case "panel":
      return "panel-with-toolbar";
    case "tree-panel":
      return "tree-panel-with-toolbar";
    default: {
      const _x = view;
      return _x;
    }
  }
}

// src/lib/data-list-view-registry.ts
var DEFINITIONS = DATA_LIST_VIEW_TILES.map((tile) => {
  const renderKind = getDataListViewRenderKind(tile.value);
  const hubMetricsStrip = renderKind !== "calendar-with-toolbar" && renderKind !== "dashboard-with-toolbar";
  return {
    value: tile.value,
    label: tile.label,
    icon: tile.icon,
    renderKind,
    hubMetricsStrip
  };
});
var BY_VALUE = new Map(
  DEFINITIONS.map((d) => [d.value, d])
);
var DATA_LIST_VIEW_REGISTRY = DEFINITIONS;
var ALL_DATA_LIST_VIEW_TYPES = DATA_LIST_VIEW_REGISTRY.map((d) => d.value);
function dataListViewDefinition(view) {
  const def = BY_VALUE.get(view);
  if (!def) {
    throw new Error(`Unknown DataListViewType: ${view}`);
  }
  return def;
}
var DATA_LIST_SURFACE_VIEW_TYPES = new Set(
  DATA_LIST_VIEW_REGISTRY.map((d) => d.value)
);

// src/components/data-views/list-page-connected-view-body.tsx
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
function resolveRenderer(node) {
  if (node == null) return null;
  return typeof node === "function" ? node() : node;
}
function ListPageViewNotConfigured({
  view,
  hubLabel = "This hub"
}) {
  const label = dataListViewLabel(view);
  return /* @__PURE__ */ jsxs(
    "output",
    {
      className: "flex flex-1 items-center justify-center px-4 py-12 text-center text-sm text-muted-foreground",
      children: [
        hubLabel,
        " does not implement ",
        label,
        ". Add a renderer for",
        " ",
        /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: dataListViewDefinition(view).renderKind }),
        " ",
        "in this hub's table component, or remove the view from",
        " ",
        /* @__PURE__ */ jsx("code", { className: "rounded bg-muted px-1 py-0.5 text-xs", children: "supportedViewTypes" }),
        "."
      ]
    }
  );
}
function ListPageConnectedViewBody({
  view,
  hubLabel,
  renderers
}) {
  const kind = getDataListViewRenderKind(view);
  const body = resolveRenderer(renderers[kind]);
  if (body == null) {
    return /* @__PURE__ */ jsx(ListPageViewNotConfigured, { view, hubLabel });
  }
  return /* @__PURE__ */ jsx(Fragment, { children: body });
}
export {
  ListPageConnectedViewBody,
  ListPageViewNotConfigured
};
//# sourceMappingURL=list-page-connected-view-body.js.map