"use strict";

exports.__esModule = true;
exports.substituteAllForNull = exports.getValueWithAll = exports.extractDropboxOptionsMemo = exports.extractDropboxOptions = void 0;
var _constants = require("../constants");
var _index = require("./index");
var _localizationHelper = require("./localizationHelper");
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var getValueWithAll = exports.getValueWithAll = function getValueWithAll(value) {
  if (!value) return _constants.allValue;
  return value;
};
var substituteAllForNull = exports.substituteAllForNull = function substituteAllForNull(value) {
  return value === _constants.allValue ? null : value;
};
var extractDropboxOptionsMemo = exports.extractDropboxOptionsMemo = function extractDropboxOptionsMemo(data, config) {
  var _config;
  if (config === void 0) {
    config = undefined;
  }
  var _ref = (_config = config) != null ? _config : {},
    _ref$activeKey = _ref.activeKey,
    activeKey = _ref$activeKey === void 0 ? "isActive" : _ref$activeKey,
    _ref$valueKey = _ref.valueKey,
    valueKey = _ref$valueKey === void 0 ? "value" : _ref$valueKey,
    _ref$labelKey = _ref.labelKey,
    labelKey = _ref$labelKey === void 0 ? "displayName" : _ref$labelKey,
    _ref$fallbackLabelKey = _ref.fallbackLabelKey,
    fallbackLabelKey = _ref$fallbackLabelKey === void 0 ? undefined : _ref$fallbackLabelKey,
    _ref$sortOrderKey = _ref.sortOrderKey,
    sortOrderKey = _ref$sortOrderKey === void 0 ? "sortOrder" : _ref$sortOrderKey;
  var items = Array.isArray(data) ? data : data.valueSeq();
  var options = [];
  items.forEach(function (v) {
    if (!activeKey || v.get(activeKey)) {
      var value = v.get(valueKey);
      options.push({
        value: value,
        label: v.get(labelKey) || fallbackLabelKey && v.get(fallbackLabelKey) || (0, _localizationHelper.getNotLocalizedString)(value),
        sortOrder: v.get(sortOrderKey)
      });
    }
  });
  return options;
};
var extractDropboxOptions = exports.extractDropboxOptions = (0, _index.memoize)(extractDropboxOptionsMemo);
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(getValueWithAll, "getValueWithAll", "/home/vsts/work/1/s/src/utils/filterHelper.js");
  reactHotLoader.register(substituteAllForNull, "substituteAllForNull", "/home/vsts/work/1/s/src/utils/filterHelper.js");
  reactHotLoader.register(extractDropboxOptionsMemo, "extractDropboxOptionsMemo", "/home/vsts/work/1/s/src/utils/filterHelper.js");
  reactHotLoader.register(extractDropboxOptions, "extractDropboxOptions", "/home/vsts/work/1/s/src/utils/filterHelper.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(getValueWithAll, "getValueWithAll", "/home/vsts/work/1/s/src/utils/filterHelper.js");
  reactHotLoader.register(substituteAllForNull, "substituteAllForNull", "/home/vsts/work/1/s/src/utils/filterHelper.js");
  reactHotLoader.register(extractDropboxOptionsMemo, "extractDropboxOptionsMemo", "/home/vsts/work/1/s/src/utils/filterHelper.js");
  reactHotLoader.register(extractDropboxOptions, "extractDropboxOptions", "/home/vsts/work/1/s/src/utils/filterHelper.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();