"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _linkExtractors = require("@atlaskit/link-extractors");
var _constants = require("../../constants");
var extractLinkTitle = function extractLinkTitle(status, propUrl, response, onClick) {
  var _ref;
  var responseUrl = (0, _linkExtractors.extractSmartLinkUrl)(response);
  var url = status === _constants.SmartLinkStatus.Resolved ? responseUrl !== null && responseUrl !== void 0 ? responseUrl : propUrl : propUrl;
  var name = (0, _linkExtractors.extractSmartLinkTitle)(response);
  var text = status === _constants.SmartLinkStatus.Resolved ? (_ref = name !== null && name !== void 0 ? name : responseUrl) !== null && _ref !== void 0 ? _ref : propUrl : propUrl;
  return {
    onClick: onClick,
    text: text,
    url: url
  };
};
var _default = exports.default = extractLinkTitle;