"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ErrorBoundaryWarning;
var _i18n = require("@wordpress/i18n");
var _components = require("@wordpress/components");
var _blockEditor = require("@wordpress/block-editor");
var _compose = require("@wordpress/compose");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

function CopyButton({
  text,
  children
}) {
  const ref = (0, _compose.useCopyToClipboard)(text);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
    __next40pxDefaultSize: true,
    variant: "secondary",
    ref: ref,
    children: children
  });
}
function ErrorBoundaryWarning({
  message,
  error
}) {
  const actions = [/*#__PURE__*/(0, _jsxRuntime.jsx)(CopyButton, {
    text: error.stack,
    children: (0, _i18n.__)('Copy Error')
  }, "copy-error")];
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.Warning, {
    className: "editor-error-boundary",
    actions: actions,
    children: message
  });
}
//# sourceMappingURL=warning.js.map