text: define(["exports", "../../lit-element/lit-element.js", "../simple-icon/simple-icon.js", "../simple-icon/lib/simple-icons.js", "../hax-iconset/lib/simple-hax-iconset.js"], function (_exports, _litElement, _simpleIcon, _simpleIcons, _simpleHaxIconset) {
    "use strict";
  
    Object.defineProperty(_exports, "__esModule", {
      value: true
    });
    _exports.SocialShareLink = void 0;
  
    function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
  
    function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  
    function _templateObject2_0adf43f099b011eb851ed31c596cbbd8() {
      var data = babelHelpers.taggedTemplateLiteral(["\n        :host {\n          display: inline;\n        }\n\n        :host([hidden]) {\n          display: none;\n        }\n\n        :host a {\n          display: inline-flex;\n          align-items: center;\n          color: var(--social-share-link-color, inherit);\n          transition: all 0.5s;\n          margin: 5px;\n          padding: var(--social-share-button-padding, 0px);\n          border-radius: var(--social-share-button-border-radius, 0px);\n        }\n\n        :host a:visited {\n          color: var(--social-share-visited-link-color, inherit);\n        }\n\n        :host a:focus,\n        :host a:hover {\n          color: var(--social-share-link-hover-color, inherit);\n        }\n\n        :host([disabled]) a,\n        :host([disabled]) a:focus,\n        :host([disabled]) a:hover,\n        :host([disabled]) a:visited {\n          color: var(--social-share-disabled-link-color, #ddd);\n        }\n\n        :host([button-style]) a {\n          padding: var(--social-share-button-padding, 5px 10px);\n          border-radius: var(--social-share-button-border-radius, 3px);\n          color: var(--social-share-button-color, white);\n          background-color: var(--social-share-button-bg, #0066ff);\n          text-decoration: none;\n          transition: all 0.5s;\n        }\n\n        :host([button-style]) a:visited {\n          color: var(--social-share-visited-button-color, white);\n        }\n\n        :host([button-style]) a:focus,\n        :host([button-style]) a:hover {\n          color: var(--social-share-button-hover-color, white);\n          background-color: var(--social-share-button-hover-bg, #0044ee);\n        }\n\n        :host([button-style][disabled]) a,\n        :host([button-style][disabled]) a:focus,\n        :host([button-style][disabled]) a:hover,\n        :host([button-style][disabled]) a:visited {\n          color: var(--social-share-disabled-button-color, #ddd);\n          background-color: var(--social-share-disabled-button-bg, #666);\n        }\n\n        :host simple-icon {\n          margin-right: 5px;\n        }\n\n        :host a.text-only simple-icon {\n          display: none;\n        }\n\n        :host a.icon-only .linktext {\n          position: absolute;\n          left: -999999px;\n          top: 0;\n          height: 0;\n          width: 0;\n          overflow: hidden;\n        }\n\n        :host a.icon-only simple-icon {\n          margin-right: 0;\n        }\n      "]);
  
      _templateObject2_0adf43f099b011eb851ed31c596cbbd8 = function _templateObject2_0adf43f099b011eb851ed31c596cbbd8() {
        return data;
      };
  
      return data;
    }
  
    function _templateObject_0adf43f099b011eb851ed31c596cbbd8() {
      var data = babelHelpers.taggedTemplateLiteral([" <a\n      href=\"", "\"\n      ?disabled=\"", "\"\n      class=\"", "\"\n      rel=\"noopener noreferrer\"\n      target=\"_blank\"\n    >\n      <simple-icon\n        dark\n        contrast=\"4\"\n        aria-hidden=\"true\"\n        icon=\"", "\"\n        ?hidden=\"", "\"\n      ></simple-icon>\n      <span class=\"linktext\">", "</span>\n    </a>"]);
  
      _templateObject_0adf43f099b011eb851ed31c596cbbd8 = function _templateObject_0adf43f099b011eb851ed31c596cbbd8() {
        return data;
      };
  
      return data;
    }
  
    function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; }
  
    function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  
    /**
     * `social-share-link`
     * `a link to share content on social`
     * @demo demo/index.html
     * @element social-share-link
     */
    var SocialShareLink = /*#__PURE__*/function (_LitElement) {
      babelHelpers.inherits(SocialShareLink, _LitElement);
  
      var _super = _createSuper(SocialShareLink);
  
      babelHelpers.createClass(SocialShareLink, [{
        key: "render",
        // render function
        value: function render() {
          return (0, _litElement.html)(_templateObject_0adf43f099b011eb851ed31c596cbbd8(), this.__href, !this.__href, this.mode, this.__icon, !this.__showIcon, this.__linkText);
        } // properties available to the custom element for data binding
  
      }], [{
        key: "styles",
        //styles function
        get: function get() {
          return [(0, _litElement.css)(_templateObject2_0adf43f099b011eb851ed31c596cbbd8())];
        }
      }, {
        key: "properties",
        get: function get() {
          return _objectSpread(_objectSpread({}, babelHelpers.get(babelHelpers.getPrototypeOf(SocialShareLink), "properties", this)), {}, {
            /**
             * display link as a button
             */
            buttonStyle: {
              type: Boolean,
              reflect: true,
              attribute: "button-style"
            },
  
            /**
             * optional image to attach to the share
             * (Pinterest only)
             */
            image: {
              type: String
            },
  
            /**
             * the message to attach to the social share
             * (not used in Facebook)
             */
            message: {
              type: String
            },
  
            /**
             * optional display mode for the link,"text-only" or "icon-only";
             * default is to dislay both an icon and text
             */
            mode: {
              type: String
            },
  
            /**
             * the link text; if null, the text will be "Share on (type of social)"
             */
            text: {
              type: String
            },
  
            /**
             * the type of social; currently supports
             * Facebook, LinkedIn, Pinterest, and Twitter (default)
             */
            type: {
              type: String
            },
  
            /**
             * the url to share
             */
            url: {
              type: String
            },
  
            /**
             * the href for the link
             */
            __href: {
              type: String
            },
  
            /**
             * the icon name for the link
             */
            __icon: {
              type: String
            },
  
            /**
             * the link text specified, or the default link text
             */
            __linkText: {
              type: String
            },
            __showIcon: {
              type: Boolean
            }
          });
        }
        /**
         * Store the tag name to make it easier to obtain directly.
         * @notice function name must be here for tooling to operate correctly
         */
  
      }, {
        key: "tag",
        get: function get() {
          return "social-share-link";
        }
      }]);
  
      function SocialShareLink() {
        var _this;
  
        babelHelpers.classCallCheck(this, SocialShareLink);
        _this = _super.call(this);
        _this.buttonStyle = false;
        _this.image = "";
        _this.message = "";
        _this.mode = null;
        _this.text = null;
        _this.type = "Twitter";
        _this.url = null;
        return _this;
      }
  
      babelHelpers.createClass(SocialShareLink, [{
        key: "updated",
        value: function updated(changedProperties) {
          var _this2 = this;
  
          changedProperties.forEach(function (oldValue, propName) {
            if (propName == "type") {
              _this2.__icon = _this2._getIcon(_this2.type);
            }
  
            if (["text", "type"].includes(propName)) {
              _this2.__linkText = _this2._getLinkText(_this2.text, _this2.type);
            }
  
            if (["image", "message", "type", "url"].includes(propName)) {
              _this2.__href = _this2._getHref(_this2.image, _this2.message, _this2.type, _this2.url);
            }
  
            if (propName == "mode") {
              _this2.__showIcon = _this2.mode == "icon-only" ? true : false;
            }
          });
        }
        /**
         * returns the href
         *
         * @param {string} optional image url (Pinterest only)
         * @param {string} the message (not for Facebook)
         * @param {string} the type of link (Twitter by default)
         * @param {string} the url
         * @returns {string} the link
         */
  
      }, {
        key: "_getHref",
        value: function _getHref(image, message, type, url) {
          var link;
  
          switch (type) {
            case "Facebook":
              link = url !== null ? "https://www.facebook.com/sharer/sharer.php?u=" + url : false;
              break;
  
            case "LinkedIn":
              link = url !== null ? "&url=" + url : "";
              link = link !== null ? "https://www.linkedin.com/shareArticle?mini=true" + link : false;
              break;
  
            case "Pinterest":
              link = (url !== null ? "&url=" + url : "") + (message !== null ? "&description=" + message : "") + (image !== null ? "&media=" + image : "");
              link = link !== null ? "http://pinterest.com/pin/create/button/?" + link.substring(1) : false;
              break;
  
            case "Twitter":
              link = message !== null ? "text=" + message + " " + url : url;
              link = link !== null ? "http://twitter.com/intent/tweet?" + link : false;
              break;
          }
  
          return encodeURI(link);
        }
        /**
         * gets the link text or a default
         *
         * @param {string} the link text
         * @param {string} the link type
         * @returns {string} the link text or a default "Share via (type)"
         */
  
      }, {
        key: "_getLinkText",
        value: function _getLinkText(text, type) {
          return text !== null ? text : "Share via " + type;
        }
        /**
         * returns the icon name
         *
         * @param {string} the link type
         * @returns {string} the icon name
         */
  
      }, {
        key: "_getIcon",
        value: function _getIcon(type) {
          return "mdi-social:" + type.toLowerCase();
        }
      }]);
      return SocialShareLink;
    }(_litElement.LitElement);
  
    _exports.SocialShareLink = SocialShareLink;
    window.customElements.define(SocialShareLink.tag, SocialShareLink);
  });