"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.LinkControlSearchCreate = void 0;
var _i18n = require("@wordpress/i18n");
var _components = require("@wordpress/components");
var _element = require("@wordpress/element");
var _icons = require("@wordpress/icons");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

const LinkControlSearchCreate = ({
  searchTerm,
  onClick,
  itemProps,
  buttonText
}) => {
  if (!searchTerm) {
    return null;
  }
  let text;
  if (buttonText) {
    text = typeof buttonText === 'function' ? buttonText(searchTerm) : buttonText;
  } else {
    text = (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: %s: search term. */
    (0, _i18n.__)('Create: <mark>%s</mark>'), searchTerm), {
      mark: /*#__PURE__*/(0, _jsxRuntime.jsx)("mark", {})
    });
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
    ...itemProps,
    iconPosition: "left",
    icon: _icons.plus,
    className: "block-editor-link-control__search-item",
    onClick: onClick,
    children: text
  });
};
exports.LinkControlSearchCreate = LinkControlSearchCreate;
var _default = exports.default = LinkControlSearchCreate;
//# sourceMappingURL=search-create-button.js.map