"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _linkExtractors = require("@atlaskit/link-extractors");
var _constants = require("../../constants");
var _constants2 = require("../constants");
var extractProvider = function extractProvider(response) {
  var provider = (0, _linkExtractors.extractSmartLinkProvider)(response);
  if (!provider) {
    return;
  }
  var providerName = provider.text;
  if (provider.id === _constants2.CONFLUENCE_GENERATOR_ID) {
    return {
      icon: _constants.IconType.Confluence,
      label: providerName || 'Confluence'
    };
  }
  if (provider.id === _constants2.JIRA_GENERATOR_ID) {
    return {
      icon: _constants.IconType.Jira,
      label: providerName || 'Jira'
    };
  }
  if (providerName) {
    return {
      label: providerName,
      url: typeof provider.icon === 'string' ? provider.icon : undefined
    };
  }
};
var _default = exports.default = extractProvider;