import { extractSmartLinkTitle, extractSmartLinkUrl } from '@atlaskit/link-extractors';
import { SmartLinkStatus } from '../../constants';
const extractLinkTitle = (status, propUrl, response, onClick, onAuxClick, onContextMenu) => {
  var _ref;
  const responseUrl = extractSmartLinkUrl(response);
  const url = status === SmartLinkStatus.Resolved ? responseUrl !== null && responseUrl !== void 0 ? responseUrl : propUrl : propUrl;
  const name = extractSmartLinkTitle(response);
  const text = status === SmartLinkStatus.Resolved ? (_ref = name !== null && name !== void 0 ? name : responseUrl) !== null && _ref !== void 0 ? _ref : propUrl : propUrl;
  return {
    onClick,
    onAuxClick,
    onContextMenu,
    text,
    url
  };
};
export default extractLinkTitle;