Liferay.Loader.define("dynamic-data-mapping-form-field-type@5.0.83/Select/Select.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/drop-down', '@frontend-taglib-clay$clayui/form', 'frontend-js-react-web$classnames', 'frontend-js-react-web$react', '../FieldBase/ReactFieldBase.es', '../hooks/useSyncValue.es', './HiddenSelectInput.es', './VisibleSelectInput.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _dropDown = _interopRequireDefault(require("@frontend-taglib-clay$clayui/drop-down"));

    var _form = require("@frontend-taglib-clay$clayui/form");

    var _classnames = _interopRequireDefault(require("frontend-js-react-web$classnames"));

    var _react = _interopRequireWildcard(require("frontend-js-react-web$react"));

    var _ReactFieldBase = require("../FieldBase/ReactFieldBase.es");

    var _useSyncValue3 = require("../hooks/useSyncValue.es");

    var _HiddenSelectInput = _interopRequireDefault(require("./HiddenSelectInput.es"));

    var _VisibleSelectInput = _interopRequireDefault(require("./VisibleSelectInput.es"));

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    function _slicedToArray(arr, i) {
      return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
    }

    function _nonIterableRest() {
      throw new TypeError("Invalid attempt to destructure non-iterable instance");
    }

    function _iterableToArrayLimit(arr, i) {
      if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
        return;
      }var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
        for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
          _arr.push(_s.value);if (i && _arr.length === i) break;
        }
      } catch (err) {
        _d = true;_e = err;
      } finally {
        try {
          if (!_n && _i["return"] != null) _i["return"]();
        } finally {
          if (_d) throw _e;
        }
      }return _arr;
    }

    function _arrayWithHoles(arr) {
      if (Array.isArray(arr)) return arr;
    }

    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 _objectWithoutProperties(source, excluded) {
      if (source == null) return {};var target = _objectWithoutPropertiesLoose(source, excluded);var key, i;if (Object.getOwnPropertySymbols) {
        var sourceSymbolKeys = Object.getOwnPropertySymbols(source);for (i = 0; i < sourceSymbolKeys.length; i++) {
          key = sourceSymbolKeys[i];if (excluded.indexOf(key) >= 0) continue;if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;target[key] = source[key];
        }
      }return target;
    }

    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;
    }

    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) {
            _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 _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    function _toConsumableArray(arr) {
      return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
    }

    function _nonIterableSpread() {
      throw new TypeError("Invalid attempt to spread non-iterable instance");
    }

    function _iterableToArray(iter) {
      if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
    }

    function _arrayWithoutHoles(arr) {
      if (Array.isArray(arr)) {
        for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
          arr2[i] = arr[i];
        }return arr2;
      }
    }

    /**
     * Mapping to be used to match keyCodes
     * returned from keydown events.
     */
    var KEYCODES = {
      ARROW_DOWN: 40,
      ARROW_UP: 38,
      ENTER: 13,
      ESCAPE: 27,
      SHIFT: 16,
      SPACE: 32,
      TAB: 9
    };
    /**
     * Appends a new value on the current value state
     * @param options {Object}
     * @param options.value {Array|String}
     * @param options.valueToBeAppended {Array|String}
     * @returns {Array}
     */

    function appendValue(_ref) {
      var value = _ref.value,
          valueToBeAppended = _ref.valueToBeAppended;
      var currentValue = toArray(value);

      var newValue = _toConsumableArray(currentValue);

      if (value) {
        newValue.push(valueToBeAppended);
      }

      return newValue;
    }
    /**
     * Removes a value from the value array.
     * @param options {Object}
     * @param options.value {Array|String}
     * @param options.valueToBeRemoved {Array|String}
     * @returns {Array}
     */

    function removeValue(_ref2) {
      var value = _ref2.value,
          valueToBeRemoved = _ref2.valueToBeRemoved;
      var currentValue = toArray(value);
      return currentValue.filter(function (v) {
        return v !== valueToBeRemoved;
      });
    }
    /**
     * Wraps the given argument into an array.
     * @param value {Array|String}
     */

    function toArray() {
      var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
      var newValue = value;

      if (!Array.isArray(newValue)) {
        newValue = [newValue];
      }

      return newValue;
    }

    function normalizeValue(_ref3) {
      var localizedValueEdited = _ref3.localizedValueEdited,
          multiple = _ref3.multiple,
          normalizedOptions = _ref3.normalizedOptions,
          predefinedValueArray = _ref3.predefinedValueArray,
          valueArray = _ref3.valueArray;
      var assertValue = valueArray.length || valueArray.length === 0 && localizedValueEdited ? valueArray : predefinedValueArray;
      var valueWithoutMultiple = assertValue.filter(function (_, index) {
        return multiple ? true : index === 0;
      });
      return valueWithoutMultiple.filter(function (value) {
        return normalizedOptions.some(function (option) {
          return value === option.value;
        });
      });
    }
    /**
     * Some parameters on each option
     * needs to be prepared in case of
     * multiple selected values(when the value state is an array).
     */

    function assertOptionParameters(_ref4) {
      var multiple = _ref4.multiple,
          option = _ref4.option,
          valueArray = _ref4.valueArray;
      var included = valueArray.includes(option.value);
      return _objectSpread(_objectSpread({}, option), {}, {
        active: !multiple && included,
        checked: multiple && included,
        type: multiple ? 'checkbox' : 'item'
      });
    }

    function normalizeOptions(_ref5) {
      var fixedOptions = _ref5.fixedOptions,
          multiple = _ref5.multiple,
          options = _ref5.options,
          showEmptyOption = _ref5.showEmptyOption,
          valueArray = _ref5.valueArray;
      var newOptions = [].concat(_toConsumableArray(options.map(function (option, index) {
        return _objectSpread(_objectSpread({}, assertOptionParameters({
          multiple: multiple,
          option: option,
          valueArray: valueArray
        })), {}, {
          separator: Array.isArray(fixedOptions) && fixedOptions.length > 0 && index === options.length - 1
        });
      })), _toConsumableArray(fixedOptions.map(function (option) {
        return assertOptionParameters({
          multiple: multiple,
          option: option,
          valueArray: valueArray
        });
      }))).filter(function (_ref6) {
        var value = _ref6.value;
        return value !== '';
      });

      if (!multiple && showEmptyOption) {
        var emptyOption = {
          label: Liferay.Language.get('choose-an-option'),
          value: null
        };
        return [emptyOption].concat(_toConsumableArray(newOptions));
      }

      return newOptions;
    }

    function handleDropdownItemClick(_ref7) {
      var currentValue = _ref7.currentValue,
          multiple = _ref7.multiple,
          option = _ref7.option;
      var itemValue = option.value;
      var newValue;

      if (multiple) {
        if (currentValue.includes(itemValue)) {
          newValue = removeValue({
            value: currentValue,
            valueToBeRemoved: itemValue
          });
        } else {
          newValue = appendValue({
            value: currentValue,
            valueToBeAppended: itemValue
          });
        }
      } else if (itemValue === null) {
        newValue = [];
      } else {
        newValue = [itemValue];
      }

      return newValue;
    }

    var DropdownItem = function DropdownItem(_ref8) {
      var currentValue = _ref8.currentValue,
          expand = _ref8.expand,
          index = _ref8.index,
          multiple = _ref8.multiple,
          onSelect = _ref8.onSelect,
          option = _ref8.option,
          options = _ref8.options;
      return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_dropDown.default.Item, {
          "aria-label": option.label,
          "aria-selected": expand && currentValue.includes(option.value),
          "data-testid": "dropdownItem-".concat(index),
          label: option.label,
          onClick: function onClick(event) {
            event.preventDefault();
            event.stopPropagation();
            onSelect({
              currentValue: currentValue,
              event: event,
              multiple: multiple,
              option: option
            });
          },
          role: "option",
          value: options.value
        }, multiple ? /*#__PURE__*/_react.default.createElement(_form.ClayCheckbox, {
          "aria-checked": currentValue.includes(option.value),
          "aria-label": option.label,
          checked: currentValue.includes(option.value),
          "data-testid": "labelItem-".concat(option.value),
          label: option.label,
          onChange: function onChange(event) {
            onSelect({
              currentValue: currentValue,
              event: event,
              multiple: multiple,
              option: option
            });
          }
        }) : option.label), option && option.separator && /*#__PURE__*/_react.default.createElement(_dropDown.default.Divider, null))
      );
    };

    var Trigger = /*#__PURE__*/(0, _react.forwardRef)(function (_ref9, ref) {
      var ariaControls = _ref9.ariaControls,
          ariaRequired = _ref9.ariaRequired,
          onCloseButtonClicked = _ref9.onCloseButtonClicked,
          onTriggerClicked = _ref9.onTriggerClicked,
          onTriggerKeyDown = _ref9.onTriggerKeyDown,
          readOnly = _ref9.readOnly,
          value = _ref9.value,
          otherProps = _objectWithoutProperties(_ref9, ["ariaControls", "ariaRequired", "onCloseButtonClicked", "onTriggerClicked", "onTriggerKeyDown", "readOnly", "value"]);

      return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !readOnly && /*#__PURE__*/_react.default.createElement(_HiddenSelectInput.default, _extends({
          value: value
        }, otherProps)), /*#__PURE__*/_react.default.createElement(_VisibleSelectInput.default, _extends({
          ariaControls: ariaControls,
          ariaRequired: ariaRequired,
          onClick: onTriggerClicked,
          onCloseButtonClicked: onCloseButtonClicked,
          onKeyDown: onTriggerKeyDown,
          readOnly: readOnly,
          ref: ref,
          value: value
        }, otherProps)))
      );
    });

    var Select = function Select(_ref10) {
      var multiple = _ref10.multiple,
          _onCloseButtonClicked = _ref10.onCloseButtonClicked,
          onDropdownItemClicked = _ref10.onDropdownItemClicked,
          onExpand = _ref10.onExpand,
          options = _ref10.options,
          predefinedValue = _ref10.predefinedValue,
          readOnly = _ref10.readOnly,
          value = _ref10.value,
          otherProps = _objectWithoutProperties(_ref10, ["multiple", "onCloseButtonClicked", "onDropdownItemClicked", "onExpand", "options", "predefinedValue", "readOnly", "value"]);

      var menuElementRef = (0, _react.useRef)(null);
      var triggerElementRef = (0, _react.useRef)(null);
      var timeoutIdRef = (0, _react.useRef)();
      var stringRef = (0, _react.useRef)('');
      var prevIndexRef = (0, _react.useRef)(-1);
      var matchIndexRef = (0, _react.useRef)(null);

      var _useSyncValue = (0, _useSyncValue3.useSyncValue)(value, false),
          _useSyncValue2 = _slicedToArray(_useSyncValue, 2),
          currentValue = _useSyncValue2[0],
          setCurrentValue = _useSyncValue2[1];

      var _useState = (0, _react.useState)(false),
          _useState2 = _slicedToArray(_useState, 2),
          expand = _useState2[0],
          setExpand = _useState2[1];

      (0, _react.useEffect)(function () {
        if (expand) {
          var _menuElementRef$curre;

          var element = (_menuElementRef$curre = menuElementRef.current.querySelector('[aria-selected=true]')) !== null && _menuElementRef$curre !== void 0 ? _menuElementRef$curre : menuElementRef.current.querySelector('button');
          element === null || element === void 0 ? void 0 : element.focus();
        } // eslint-disable-next-line react-hooks/exhaustive-deps
      }, [expand]);
      (0, _react.useEffect)(function () {
        var onClose = function onClose(event) {
          if (expand && menuElementRef.current && !menuElementRef.current.contains(event.target) && !triggerElementRef.current.contains(event.target)) {
            setExpand(false);
            onExpand({
              event: event,
              expand: false
            });
            triggerElementRef.current.firstChild.focus();
          }
        };

        document.addEventListener('click', onClose, true);
        return function () {
          return document.removeEventListener('click', onClose, true);
        }; // eslint-disable-next-line react-hooks/exhaustive-deps
      }, [expand]);

      var handleFocus = function handleFocus(event, direction) {
        var target = event.target;
        var focusabledElements = event.currentTarget.querySelectorAll('button');

        var targetIndex = _toConsumableArray(focusabledElements).findIndex(function (current) {
          return current === target;
        });

        var nextElement;

        if (direction) {
          nextElement = focusabledElements[targetIndex - 1];
        } else {
          nextElement = focusabledElements[targetIndex + 1];
        }

        if (nextElement) {
          event.preventDefault();
          event.stopPropagation();
          nextElement.focus();
        } else if (targetIndex === 0 && direction) {
          event.preventDefault();
          event.stopPropagation();
          menuElementRef.current.focus();
        }
      };

      var handleSelect = function handleSelect(_ref11) {
        var currentValue = _ref11.currentValue,
            event = _ref11.event,
            multiple = _ref11.multiple,
            option = _ref11.option;
        var newValue = handleDropdownItemClick({
          currentValue: currentValue,
          multiple: multiple,
          option: option
        });
        setCurrentValue(newValue);
        onDropdownItemClicked({
          event: event,
          value: newValue
        });

        if (!multiple) {
          setExpand(false);
          onExpand({
            event: event,
            expand: false
          });
          triggerElementRef.current.firstChild.focus();
        }
      };

      return (/*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Trigger, _extends({
          ariaControls: "ddm-select-dropdown".concat(otherProps.name),
          ariaRequired: otherProps.required,
          expand: expand,
          multiple: multiple,
          onCloseButtonClicked: function onCloseButtonClicked(_ref12) {
            var event = _ref12.event,
                value = _ref12.value;
            var newValue = removeValue({
              value: currentValue,
              valueToBeRemoved: value
            });
            setCurrentValue(newValue);

            _onCloseButtonClicked({
              event: event,
              value: newValue
            });
          },
          onTriggerClicked: function onTriggerClicked(event) {
            if (readOnly) {
              return;
            }

            setExpand(!expand);
            onExpand({
              event: event,
              expand: !expand
            });

            if (expand) {
              triggerElementRef.current.firstChild.focus();
            }
          },
          onTriggerKeyDown: function onTriggerKeyDown(event) {
            if ((event.keyCode === KEYCODES.TAB || event.keyCode === KEYCODES.ARROW_DOWN) && !event.shiftKey && expand) {
              event.preventDefault();
              event.stopPropagation();
              var firstElement = menuElementRef.current.querySelector('button');
              firstElement.focus();
            }

            if (event.keyCode === KEYCODES.ENTER || event.keyCode === KEYCODES.SPACE && !event.shiftKey) {
              event.preventDefault();
              event.stopPropagation();
              setExpand(!expand);
              onExpand({
                event: event,
                expand: !expand
              });

              if (expand) {
                triggerElementRef.current.firstChild.focus();
              }
            }
          },
          options: options,
          predefinedValue: predefinedValue,
          readOnly: readOnly,
          ref: triggerElementRef,
          setExpand: setExpand,
          value: currentValue
        }, otherProps)), /*#__PURE__*/_react.default.createElement("div", {
          className: (0, _classnames.default)('dropdown-menu dropdown-menu-indicator-start dropdown-menu-select ddm-btn-full ddm-select-dropdown', {
            show: expand
          }),
          onKeyDown: function onKeyDown(event) {
            switch (event.keyCode) {
              case KEYCODES.ARROW_DOWN:
                handleFocus(event, false);
                break;

              case KEYCODES.ARROW_UP:
                handleFocus(event, true);
                break;

              case KEYCODES.TAB:
                handleFocus(event, event.shiftKey);
                break;

              case KEYCODES.ESCAPE:
                setExpand(false);
                triggerElementRef.current.firstChild.focus();
                break;

              default:
                {
                  var target = event.target;

                  if (target.tagName === 'INPUT' || event.key === KEYCODES.TAB) {
                    return;
                  }

                  if (event.currentTarget && !event.currentTarget.contains(target)) {
                    return;
                  }

                  if (stringRef.current.length > 0 && stringRef.current[0] !== KEYCODES.SPACE) {
                    if (event.key === KEYCODES.SPACE) {
                      event.preventDefault();
                      event.stopPropagation();
                    }
                  }

                  if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey) {
                    return;
                  }

                  event.stopPropagation();
                  var items = Array.from(menuElementRef.current.querySelectorAll('button'));

                  if (stringRef.current === event.key) {
                    stringRef.current = '';
                    prevIndexRef.current = matchIndexRef.current;
                  }

                  stringRef.current += event.key;
                  clearTimeout(timeoutIdRef.current);
                  timeoutIdRef.current = setTimeout(function () {
                    stringRef.current = '';
                    prevIndexRef.current = matchIndexRef.current;
                  }, 1000);
                  var prevIndex = prevIndexRef.current;
                  var orderedList = [].concat(_toConsumableArray(items.slice((prevIndex !== null && prevIndex !== void 0 ? prevIndex : 0) + 1)), _toConsumableArray(items.slice(0, (prevIndex !== null && prevIndex !== void 0 ? prevIndex : 0) + 1)));
                  var item = orderedList.find(function (item) {
                    var _item$innerText;

                    var value = (_item$innerText = item.innerText) !== null && _item$innerText !== void 0 ? _item$innerText : item.textContent;
                    return (value === null || value === void 0 ? void 0 : value.toLowerCase().indexOf(stringRef.current.toLocaleLowerCase())) === 0;
                  });

                  if (item) {
                    event.preventDefault();
                    matchIndexRef.current = items.indexOf(item);
                    item.focus();
                  }

                  break;
                }
            }
          },
          ref: menuElementRef,
          role: "presentation"
        }, /*#__PURE__*/_react.default.createElement(_dropDown.default.ItemList, {
          "aria-label": Liferay.Language.get('choose-an-option'),
          id: "ddm-select-dropdown".concat(otherProps.name),
          role: "listbox"
        }, options.map(function (option, index) {
          return (/*#__PURE__*/_react.default.createElement(DropdownItem, {
              currentValue: currentValue,
              expand: expand,
              index: index,
              key: "".concat(option.value, "-").concat(index),
              multiple: multiple,
              onSelect: handleSelect,
              option: option,
              options: options,
              role: "option"
            })
          );
        }))))
      );
    };

    var Main = function Main(_ref13) {
      var _ref13$fixedOptions = _ref13.fixedOptions,
          fixedOptions = _ref13$fixedOptions === void 0 ? [] : _ref13$fixedOptions,
          label = _ref13.label,
          _ref13$localizedValue = _ref13.localizedValue,
          localizedValue = _ref13$localizedValue === void 0 ? {} : _ref13$localizedValue,
          localizedValueEdited = _ref13.localizedValueEdited,
          multiple = _ref13.multiple,
          name = _ref13.name,
          _ref13$onBlur = _ref13.onBlur,
          onBlur = _ref13$onBlur === void 0 ? function () {} : _ref13$onBlur,
          onChange = _ref13.onChange,
          _ref13$onFocus = _ref13.onFocus,
          onFocus = _ref13$onFocus === void 0 ? function () {} : _ref13$onFocus,
          _ref13$options = _ref13.options,
          options = _ref13$options === void 0 ? [] : _ref13$options,
          _ref13$predefinedValu = _ref13.predefinedValue,
          predefinedValue = _ref13$predefinedValu === void 0 ? [] : _ref13$predefinedValu,
          _ref13$readOnly = _ref13.readOnly,
          readOnly = _ref13$readOnly === void 0 ? false : _ref13$readOnly,
          _ref13$showEmptyOptio = _ref13.showEmptyOption,
          showEmptyOption = _ref13$showEmptyOptio === void 0 ? true : _ref13$showEmptyOptio,
          _ref13$value = _ref13.value,
          value = _ref13$value === void 0 ? [] : _ref13$value,
          otherProps = _objectWithoutProperties(_ref13, ["fixedOptions", "label", "localizedValue", "localizedValueEdited", "multiple", "name", "onBlur", "onChange", "onFocus", "options", "predefinedValue", "readOnly", "showEmptyOption", "value"]);

      var predefinedValueArray = toArray(predefinedValue);
      var valueArray = toArray(value);
      var normalizedOptions = (0, _react.useMemo)(function () {
        return normalizeOptions({
          fixedOptions: fixedOptions,
          multiple: multiple,
          options: options,
          showEmptyOption: showEmptyOption,
          valueArray: valueArray
        });
      }, [fixedOptions, multiple, options, showEmptyOption, valueArray]);
      value = (0, _react.useMemo)(function () {
        return normalizeValue({
          localizedValueEdited: localizedValueEdited,
          multiple: multiple,
          normalizedOptions: normalizedOptions,
          predefinedValueArray: predefinedValueArray,
          valueArray: valueArray
        });
      }, [localizedValueEdited, multiple, normalizedOptions, predefinedValueArray, valueArray]);
      return (/*#__PURE__*/_react.default.createElement(_ReactFieldBase.FieldBase, _extends({}, otherProps, {
          label: label,
          localizedValue: localizedValue,
          name: name,
          readOnly: readOnly,
          style: null
        }), /*#__PURE__*/_react.default.createElement(Select, _extends({
          multiple: multiple,
          name: name,
          onCloseButtonClicked: function onCloseButtonClicked(_ref14) {
            var event = _ref14.event,
                value = _ref14.value;
            return onChange(event, value);
          },
          onDropdownItemClicked: function onDropdownItemClicked(_ref15) {
            var event = _ref15.event,
                value = _ref15.value;
            return onChange(event, value);
          },
          onExpand: function onExpand(_ref16) {
            var event = _ref16.event,
                expand = _ref16.expand;

            if (expand) {
              onFocus(event);
            } else {
              onBlur(event);
            }
          },
          options: normalizedOptions,
          predefinedValue: predefinedValueArray,
          readOnly: readOnly,
          showEmptyOption: showEmptyOption,
          value: value
        }, otherProps)))
      );
    };

    Main.displayName = 'Select';
    var _default = Main;
    exports.default = _default;
    //# sourceMappingURL=Select.es.js.map
  }
});
//# sourceMappingURL=Select.es.js.map