import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { Component } from "@contember/react-binding";
import { AddNewBlockButton } from "./AddNewBlockButton.js";
import { SortableBlock } from "./SortableBlock.js";
import { useNormalizedBlocks } from "../../blocks/useNormalizedBlocks.js";
import { Repeater } from "../Repeater/Repeater.js";
import { DiscriminatedBlocks } from "../../blocks/DiscriminatedBlocks.js";
const BlockRepeater = Component(
  ({ discriminationField, ...props }) => {
    const normalizedBlocks = useNormalizedBlocks(props.children);
    const extraProps = {
      normalizedBlocks,
      discriminationField
    };
    return /* @__PURE__ */ jsxDEV(
      Repeater,
      {
        ...props,
        addButtonComponent: AddNewBlockButton,
        addButtonComponentExtraProps: extraProps,
        itemComponent: SortableBlock,
        itemComponentExtraProps: extraProps,
        children: /* @__PURE__ */ jsxDEV(Fragment, {}, void 0, false, {
          fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx",
          lineNumber: 39,
          columnNumber: 5
        }, void 0)
      },
      void 0,
      false,
      {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx",
        lineNumber: 32,
        columnNumber: 4
      },
      void 0
    );
  },
  (props) => /* @__PURE__ */ jsxDEV(Repeater, { ...props, initialEntityCount: 0, children: [
    typeof props.discriminationField === "string" && /* @__PURE__ */ jsxDEV(DiscriminatedBlocks, { field: props.discriminationField, label: props.label, children: props.children }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx",
      lineNumber: 46,
      columnNumber: 5
    }, void 0),
    typeof props.discriminationField === "string" || /* @__PURE__ */ jsxDEV(DiscriminatedBlocks, { ...props.discriminationField, label: props.label, children: props.children }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx",
      lineNumber: 51,
      columnNumber: 5
    }, void 0)
  ] }, void 0, true, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/BlockRepeater.tsx",
    lineNumber: 44,
    columnNumber: 3
  }, void 0),
  "SortableBlockRepeater"
);
export {
  BlockRepeater
};
//# sourceMappingURL=BlockRepeater.js.map
