text: import _pt from "prop-types";
  
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
  
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
  
  import React from 'react';
  import Link from './Link';
  export default function Hashtag(_ref) {
    var children = _ref.children,
        _ref$encodeHashtag = _ref.encodeHashtag,
        encodeHashtag = _ref$encodeHashtag === void 0 ? false : _ref$encodeHashtag,
        hashtag = _ref.hashtag,
        _ref$hashtagUrl = _ref.hashtagUrl,
        hashtagUrl = _ref$hashtagUrl === void 0 ? '{{hashtag}}' : _ref$hashtagUrl,
        _ref$preserveHash = _ref.preserveHash,
        preserveHash = _ref$preserveHash === void 0 ? false : _ref$preserveHash,
        props = _objectWithoutPropertiesLoose(_ref, ["children", "encodeHashtag", "hashtag", "hashtagUrl", "preserveHash"]);
  
    var tag = hashtag;
  
    if (!preserveHash && tag.charAt(0) === '#') {
      tag = tag.slice(1);
    }
  
    if (encodeHashtag) {
      tag = encodeURIComponent(tag);
    }
  
    var url = hashtagUrl || '{{hashtag}}';
  
    if (typeof url === 'function') {
      url = url(tag);
    } else {
      url = url.replace('{{hashtag}}', tag);
    }
  
    return React.createElement(Link, _extends({}, props, {
      href: url
    }), children);
  }
  Hashtag.propTypes = {
    children: _pt.any.isRequired,
    encodeHashtag: _pt.bool,
    hashtag: _pt.string.isRequired,
    hashtagUrl: _pt.oneOfType([_pt.string, _pt.func]),
    preserveHash: _pt.bool
  };