"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MultipleUsageWarning = MultipleUsageWarning;
var _blocks = require("@wordpress/blocks");
var _components = require("@wordpress/components");
var _data = require("@wordpress/data");
var _i18n = require("@wordpress/i18n");
var _store = require("../../store");
var _warning = _interopRequireDefault(require("../warning"));
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

function MultipleUsageWarning({
  originalBlockClientId,
  name,
  onReplace
}) {
  const {
    selectBlock
  } = (0, _data.useDispatch)(_store.store);
  const blockType = (0, _blocks.getBlockType)(name);
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_warning.default, {
    actions: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
      variant: "secondary",
      onClick: () => selectBlock(originalBlockClientId),
      children: (0, _i18n.__)('Find original')
    }, "find-original"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
      variant: "secondary",
      onClick: () => onReplace([]),
      children: (0, _i18n.__)('Remove')
    }, "remove")],
    children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("strong", {
      children: [blockType?.title, ": "]
    }), (0, _i18n.__)('This block can only be used once.')]
  });
}
//# sourceMappingURL=multiple-usage-warning.js.map