"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxDevRuntime = require("react/jsx-dev-runtime");
const reactBinding = require("@contember/react-binding");
const ui = require("@contember/ui");
const react = require("react");
const AddNewBlockButtonInner = react.memo((props) => {
  const desugaredDiscriminationField = reactBinding.useDesugaredRelativeSingleField(props.discriminationField);
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(ui.ButtonGroup, { direction: "vertical", children: Array.from(props.normalizedBlocks.values(), ({ discriminateBy, datum: blockProps }, i) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(
    ui.Button,
    {
      disabled: props.isMutating,
      display: "block",
      distinction: "seamless",
      onClick: () => {
        props.requestClose();
        const targetValue = discriminateBy;
        props.createNewEntity((getNewlyAdded) => {
          const discriminationField = getNewlyAdded().getRelativeSingleField(desugaredDiscriminationField);
          discriminationField.updateValue(targetValue);
        });
      },
      padding: "padding",
      children: [
        !!blockProps.description && /* @__PURE__ */ jsxDevRuntime.jsxDEV("span", { children: [
          blockProps.label,
          /* @__PURE__ */ jsxDevRuntime.jsxDEV("br", {}, void 0, false, {
            fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx",
            lineNumber: 40,
            columnNumber: 8
          }, void 0),
          /* @__PURE__ */ jsxDevRuntime.jsxDEV("small", { children: blockProps.description }, void 0, false, {
            fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx",
            lineNumber: 41,
            columnNumber: 8
          }, void 0)
        ] }, void 0, true, {
          fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx",
          lineNumber: 38,
          columnNumber: 7
        }, void 0),
        !blockProps.description && blockProps.label
      ]
    },
    i,
    true,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx",
      lineNumber: 21,
      columnNumber: 5
    },
    void 0
  )) }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButtonInner.tsx",
    lineNumber: 19,
    columnNumber: 3
  }, void 0);
});
AddNewBlockButtonInner.displayName = "AddNewBlockButtonInner";
exports.AddNewBlockButtonInner = AddNewBlockButtonInner;
//# sourceMappingURL=AddNewBlockButtonInner.cjs.map
