import { __name } from './chunk-N2XQF2OL.mjs';
import { cn } from '@djangocfg/ui-core/lib';
import { jsx, jsxs } from 'react/jsx-runtime';
import { AlertCircle } from 'lucide-react';

function TreeSkeleton({ rows = 6, className }) {
  return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1 p-2", className), "aria-hidden": true, children: Array.from({ length: rows }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", style: { paddingLeft: i % 3 * 16 }, children: [
    /* @__PURE__ */ jsx("span", { className: "size-4 shrink-0 animate-pulse rounded bg-muted" }),
    /* @__PURE__ */ jsx("span", { className: "size-4 shrink-0 animate-pulse rounded bg-muted" }),
    /* @__PURE__ */ jsx("span", { className: "h-3 flex-1 animate-pulse rounded bg-muted" })
  ] }, i)) });
}
__name(TreeSkeleton, "TreeSkeleton");
function TreeError({ children, className }) {
  return /* @__PURE__ */ jsxs(
    "div",
    {
      className: cn(
        "flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",
        className
      ),
      role: "alert",
      children: [
        /* @__PURE__ */ jsx(AlertCircle, { "aria-hidden": true, className: "mt-0.5 size-4 shrink-0" }),
        /* @__PURE__ */ jsx("span", { children })
      ]
    }
  );
}
__name(TreeError, "TreeError");

// src/tools/Tree/data/createDemoTree.ts
function createDemoTree({
  depth = 3,
  breadth = 4,
  rootPrefix = "node"
} = {}) {
  const make = /* @__PURE__ */ __name((id, name, level) => {
    if (level >= depth) {
      return { id, data: { name } };
    }
    const children = [];
    for (let i = 0; i < breadth; i++) {
      const childId = `${id}/${i}`;
      children.push(make(childId, `${name}-${i}`, level + 1));
    }
    return { id, data: { name }, children };
  }, "make");
  const roots = [];
  for (let i = 0; i < breadth; i++) {
    roots.push(make(`${rootPrefix}-${i}`, `${rootPrefix} ${i}`, 1));
  }
  return roots;
}
__name(createDemoTree, "createDemoTree");

export { TreeError, TreeSkeleton, createDemoTree };
//# sourceMappingURL=chunk-B6IR5KSC.mjs.map
//# sourceMappingURL=chunk-B6IR5KSC.mjs.map