import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
import { genericComponent } from "../../utils";
import { Divider } from "../divider";
import { ListGroup } from "./list-group";
import { ListItem } from "./list-item";
import { ListSubheader } from "./list-subheader";
import { provideList } from "./composables/list";
const ListChildren = genericComponent()({
  name: "VeListChildren",
  props: {
    items: Array
  },
  setup(props, {
    slots
  }) {
    provideList();
    return () => slots.default?.() ?? props.items?.map(({
      children,
      props: itemProps,
      type
    }, index) => {
      switch (type) {
        case "divider":
          return _createVNode(Divider, itemProps, null);
        case "subheader":
          return _createVNode(ListSubheader, itemProps, slots);
        default:
          return children ? _createVNode(ListGroup, {
            "value": itemProps?.value
          }, {
            default: () => _createVNode(ListChildren, {
              "items": children
            }, slots),
            activator: ({
              props: activatorProps
            }) => slots.header?.({
              item: itemProps,
              index,
              props: activatorProps
            }) ?? _createVNode(ListItem, _mergeProps(itemProps, activatorProps), null)
          }) : slots.item?.({
            item: itemProps,
            index
          }) ?? _createVNode(ListItem, itemProps, slots);
      }
    });
  }
});
export {
  ListChildren
};
//# sourceMappingURL=list-children.mjs.map
