"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const reactBinding = require("@contember/react-binding");
const react = require("react");
const getDiscriminatedBlock = require("../../blocks/getDiscriminatedBlock.cjs");
const RepeaterItem = require("../Repeater/RepeaterItem.cjs");
const SortableBlock = react.memo(({
  discriminationField,
  normalizedBlocks,
  ...props
}) => {
  const field = reactBinding.useField(discriminationField);
  const selectedBlock = getDiscriminatedBlock.getDiscriminatedBlock(normalizedBlocks, field);
  if (!selectedBlock) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntime.jsx(RepeaterItem.RepeaterItem, { ...props, label: selectedBlock.datum.label, children: selectedBlock.datum.children });
});
SortableBlock.displayName = "SortableBlock";
exports.SortableBlock = SortableBlock;
//# sourceMappingURL=SortableBlock.cjs.map
