text: define(["exports", "../../../lit/index.js", "./simple-fields-field.js", "./simple-fields-combo.js", "./simple-fields-url-combo-item.js"], function (_exports, _index, _simpleFieldsField, _simpleFieldsCombo, _simpleFieldsUrlComboItem) {
    "use strict";
  
    Object.defineProperty(_exports, "__esModule", {
      value: true
    });
    _exports.SimpleFieldsUrlCombo = void 0;
  
    var _templateObject_6c924250942811ecb1937969798b231a, _templateObject2_6c924250942811ecb1937969798b231a, _templateObject3_6c924250942811ecb1937969798b231a;
  
    function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  
    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 { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  
    /**
     *`simple-fields-url-combo`
     * input tags and validate an array of input
     * can return as a string or object based on
     * requirements of the implementing element
     *
     * @customElement
     * @group simple-fields
     * @class SimpleFieldsUrlCombo
     * @extends {SimpleFieldsFieldBehaviors(LitElement)}
     * @demo ./demo/index.html Demo
     */
    var SimpleFieldsUrlCombo = /*#__PURE__*/function (_SimpleFieldsCombo) {
      babelHelpers.inherits(SimpleFieldsUrlCombo, _SimpleFieldsCombo);
  
      var _super = _createSuper(SimpleFieldsUrlCombo);
  
      function SimpleFieldsUrlCombo() {
        var _this;
  
        babelHelpers.classCallCheck(this, SimpleFieldsUrlCombo);
        _this = _super.call(this);
        _this.grid = false;
        return _this;
      }
      /**
       * overrides hiding listbox in grid mode
       *
       * @readonly
       * @memberof SimpleFieldsUrlCombo
       */
  
  
      babelHelpers.createClass(SimpleFieldsUrlCombo, [{
        key: "isListboxHidden",
        get: function get() {
          return !(this.alwaysExpanded || this.expanded) || this.hidden || this.filteredOptions.length < 1;
        }
      }, {
        key: "listboxTemplate",
        get: function get() {
          return (0, _index.html)(_templateObject_6c924250942811ecb1937969798b231a || (_templateObject_6c924250942811ecb1937969798b231a = babelHelpers.taggedTemplateLiteral(["\n      <div class=\"border-bottom input-bottom blur\"></div>\n      <div class=\"border-bottom input-bottom focus\"></div>\n      ", "\n    "])), babelHelpers.get(babelHelpers.getPrototypeOf(SimpleFieldsUrlCombo.prototype), "listboxTemplate", this));
        }
        /**
         * overrides default combo list item display
         *
         * @param {*} option
         * @returns
         * @memberof SimpleFieldsUrlCombo
         */
  
      }, {
        key: "getListItemInner",
        value: function getListItemInner(option) {
          return (0, _index.html)(_templateObject2_6c924250942811ecb1937969798b231a || (_templateObject2_6c924250942811ecb1937969798b231a = babelHelpers.taggedTemplateLiteral(["<simple-fields-url-combo-item\n      icon=\"", "\"\n      name=\"", "\"\n      preview=\"", "\"\n      type=\"", "\"\n      value=\"", "\"\n    >\n    </simple-fields-url-combo-item>"])), option.icon, option.name, option.preview, option.type, option.value);
        }
        /**
         * allows for more option data, such as icon, preview, and type
         *
         * @param {*} option
         * @returns
         * @memberof SimpleFieldsUrlCombo
         */
  
      }, {
        key: "getOptionData",
        value: function getOptionData(option, id) {
          return {
            value: babelHelpers.typeof(option) === "object" ? option.value : option,
            name: babelHelpers.typeof(option) === "object" ? option.name : undefined,
            icon: babelHelpers.typeof(option) === "object" ? option.icon : undefined,
            preview: babelHelpers.typeof(option) === "object" ? option.preview : undefined,
            type: babelHelpers.typeof(option) === "object" ? option.type : undefined,
            id: id
          };
        }
        /**
         * gets a sorted list of option
         *
         * @readonly
         * @memberof SimpleFieldsField
         */
  
      }, {
        key: "sortedOptions",
        get: function get() {
          var _this2 = this;
  
          var sorted = (this.itemsList || []).map(function (item, i) {
            return babelHelpers.typeof(item) === "object" ? item : _this2.getOptionData(item, i);
          });
          Object.keys(this.options || {}).sort(function (a, b) {
            return a > b ? 1 : -1;
          }).forEach(function (key) {
            return sorted.push(_this2.getOptionData(_this2.options[key], sorted.length));
          });
          return sorted;
        }
        /**
         * is text an email address?
         *
         * @param {string} text
         * @returns {boolean}
         * @memberof SimpleFieldsUrlCombo
         */
  
      }, {
        key: "possibleEmail",
        value: function possibleEmail(text) {
          return text.match(/^\S+@\S+.\S+$/);
        }
        /**
         * is text a telephone number?
         *
         * @param {string} text
         * @returns {boolean}
         * @memberof SimpleFieldsUrlCombo
         */
  
      }, {
        key: "possiblePhone",
        value: function possiblePhone(text) {
          return text.match(/^(\+\d{1,3}\s?)?((\(\d{3}\)\s?)|(\d{3})(\s|-?))(\d{3}(\s|-?))(\d{4})(\s?(([E|e][X|x][T|t][\:|\.|]?)|x|X)(\s?\d+))?$/);
        }
        /**
         * updates options list
         *
         * @param {event} event
         * @memberof SimpleFieldsCombo
         */
  
      }, {
        key: "filterOptions",
        value: function filterOptions(filter, currentOption) {
          babelHelpers.get(babelHelpers.getPrototypeOf(SimpleFieldsUrlCombo.prototype), "filterOptions", this).call(this, filter, currentOption);
  
          if (this.possibleEmail(filter)) {
            this.filteredOptions = [{
              value: "mailto:".concat(filter),
              id: "mailto"
            }].concat(babelHelpers.toConsumableArray(this.filteredOptions));
            this.open();
          } else if (this.possiblePhone(filter)) {
            this.filteredOptions = [{
              value: "tel:".concat(filter.replace(/[\(\)\-\s\:\.]/g, "").replace(/[a-zA-Z]+/, "p")),
              id: "tel"
            }].concat(babelHelpers.toConsumableArray(this.filteredOptions));
            this.open();
          }
        }
      }], [{
        key: "tag",
        get: function get() {
          return "simple-fields-url-combo";
        }
      }, {
        key: "styles",
        get: function get() {
          return [].concat(babelHelpers.toConsumableArray(babelHelpers.get(babelHelpers.getPrototypeOf(SimpleFieldsUrlCombo), "styles", this)), [(0, _index.css)(_templateObject3_6c924250942811ecb1937969798b231a || (_templateObject3_6c924250942811ecb1937969798b231a = babelHelpers.taggedTemplateLiteral(["\n        :host([display-as=\"grid\"]) {\n          --simple-fields-url-combo-preview-size: var(\n            --simple-fields-url-combo-grid-preview-size,\n            100px\n          );\n        }\n        ul[role=\"listbox\"] li[role=\"option\"]:not(:last-child) {\n          border-bottom: 1px solid var(--simple-fields-border-color-light, #ccc);\n        }\n        :host([display-as=\"columns\"]) ul[role=\"listbox\"] li[role=\"option\"],\n        :host([display-as=\"grid\"]) ul[role=\"listbox\"] li[role=\"option\"] {\n          border-radius: var(--simple-fields-border-radius, 2px);\n          border: 1px solid var(--simple-fields-border-color-light, #ccc);\n        }\n        :host([always-expanded]) #field-main-inner {\n          flex-wrap: wrap;\n          --simple-fields-combo-max-height: var(\n            --simple-fields-url-combox-expanded-max-height,\n            unset\n          );\n        }\n        .input-bottom,\n        :host([always-expanded]) .border-bottom:not(.input-bottom),\n        :host([always-expanded]) [part=\"option-icon\"],\n        :host([has-suggestions=\"false\"]) [part=\"option-icon\"] {\n          display: none;\n        }\n        :host([always-expanded]) .input-bottom {\n          display: block;\n        }\n        :host([always-expanded]) ul[role=\"listbox\"] {\n          border: none;\n          position: static;\n          opacity: 1;\n          flex: 1 0 100%;\n          margin: var(--simple-fields-margin-small, 8px) 0;\n        }\n        :host([display-as=\"columns\"]) ul[role=\"listbox\"] {\n          grid-gap: var(--simple-fields-button-padding, 2px);\n        }\n        :host([display-as=\"grid\"]) ul[role=\"listbox\"] {\n          grid-gap: var(--simple-fields-margin-small, 8px);\n        }\n        :host([display-as=\"columns\"]) ul[role=\"listbox\"],\n        :host([display-as=\"grid\"]) ul[role=\"listbox\"] {\n          display: grid;\n          grid-template-columns: repeat(\n            auto-fill,\n            minmax(\n              calc(\n                var(--simple-fields-url-combo-preview-size) + 2 *\n                  var(--simple-fields-button-padding, 2px)\n              ),\n              1fr\n            )\n          );\n        }\n        :host([display-as=\"grid\"]) simple-fields-url-combo-item,\n        :host([display-as=\"grid\"]) ::slotted(simple-fields-url-combo-item) {\n          flex-direction: column;\n          align-items: center;\n          text-align: center;\n          justify-content: space-between;\n          padding: var(--simple-fields-margin-small, 8px);\n        }\n        :host([display-as=\"grid\"]) simple-fields-url-combo-item::part(preview),\n        :host([display-as=\"grid\"])\n          ::slotted(simple-fields-url-combo-item::part(preview)) {\n          display: block;\n          margin-right: 0;\n        }\n      "])))]);
        }
      }, {
        key: "properties",
        get: function get() {
          return _objectSpread(_objectSpread({}, babelHelpers.get(babelHelpers.getPrototypeOf(SimpleFieldsUrlCombo), "properties", this)), {}, {
            displayAs: {
              type: String,
              attribute: "display-as",
              reflect: true
            },
            alwaysExpanded: {
              type: Boolean,
              attribute: "always-expanded",
              reflect: true
            }
          });
        }
      }]);
      return SimpleFieldsUrlCombo;
    }(_simpleFieldsCombo.SimpleFieldsCombo);
  
    _exports.SimpleFieldsUrlCombo = SimpleFieldsUrlCombo;
    window.customElements.define(SimpleFieldsUrlCombo.tag, SimpleFieldsUrlCombo);
  });