import _defineProperty from "@babel/runtime/helpers/defineProperty";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import { buildAction } from './manifest-helpers';
export function buildMenuItem(manifest, extensionModule) {
  var title = extensionModule.title || manifest.title;
  var key = "".concat(manifest.key, ":").concat(extensionModule.key);
  var node = buildAction(extensionModule.action, manifest);
  if (!node) {
    throw new Error("Couldn't find any action for ".concat(title, " (").concat(key, ")"));
  }
  return _objectSpread(_objectSpread({
    key: key,
    title: title,
    extensionType: manifest.type,
    extensionKey: manifest.key,
    keywords: extensionModule.keywords || manifest.keywords || [],
    featured: extensionModule.featured || false,
    categories: extensionModule.categories || manifest.categories || [],
    description: extensionModule.description || manifest.description,
    summary: manifest.summary,
    documentationUrl: manifest.documentationUrl,
    priority: extensionModule.priority
  }, extensionModule.lozenge != null && {
    lozenge: extensionModule.lozenge
  }), {}, {
    icon: extensionModule.icon || manifest.icons['48'],
    node: node
  });
}