<script setup>
import { useSlots } from "vue";
const model = defineModel();
const slots = useSlots().default();
const DragDropContainer = resolveComponent("l-drag-drop-container");
const group_name = /* @__PURE__ */ Symbol();
defineExpose({
  updateModel: (name, value) => {
    model.value[name] = value;
  },
  getModelByName: (name) => {
    return model.value[name];
  },
  getGroupName: () => {
    return group_name;
  },
  findAllItems: () => {
    const containers = getContainers(slots);
    const items = getItems(containers);
    return items;
  }
});
function getContainers(nodes) {
  const containers = [];
  for (const node of nodes) {
    if (node.type === DragDropContainer) {
      containers.push(node);
      continue;
    }
    if (node.children) {
      if (node.children.default) {
        containers.push(...getContainers(node.children.default()));
      }
    }
  }
  return containers;
}
function getItems(containers) {
  const items = [];
  for (const container of containers) {
    items.push(...container.children.default());
  }
  return items;
}
</script>

<template>
    <slot></slot>
</template>
