"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = BlockStylesPreviewPanel;
var _blocks = require("@wordpress/blocks");
var _element = require("@wordpress/element");
var _previewPanel = _interopRequireDefault(require("../inserter/preview-panel"));
var _utils = require("./utils");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

function BlockStylesPreviewPanel({
  genericPreviewBlock,
  style,
  className,
  activeStyle
}) {
  const example = (0, _blocks.getBlockType)(genericPreviewBlock.name)?.example;
  const styleClassName = (0, _utils.replaceActiveStyle)(className, activeStyle, style);
  const previewBlocks = (0, _element.useMemo)(() => {
    return {
      ...genericPreviewBlock,
      title: style.label || style.name,
      description: style.description,
      initialAttributes: {
        ...genericPreviewBlock.attributes,
        className: styleClassName + ' block-editor-block-styles__block-preview-container'
      },
      example
    };
  }, [genericPreviewBlock, styleClassName]);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_previewPanel.default, {
    item: previewBlocks
  });
}
//# sourceMappingURL=preview-panel.js.map