"use strict";

exports.__esModule = true;
exports.compareObjectPropertyDescending = exports.compareObjectProperty = void 0;
exports.getPropertyOrDefault = getPropertyOrDefault;
exports.getPropertyOrDefaultFromMap = getPropertyOrDefaultFromMap;
exports.isObjectContainsPropertyWithValue = exports.isObjectContainsPropertyWithAnyValue = void 0;
(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 _require = require("immutable"),
  Map = _require.Map;
var caseInsensitiveCompare = function caseInsensitiveCompare(prop, property) {
  return prop.toLowerCase() === property.toLowerCase();
};
var caseInsensitiveStartWithCompare = function caseInsensitiveStartWithCompare(prop, property) {
  return prop.toLowerCase().startsWith(property.toLowerCase());
};
function getPropertyOrDefaultFromMap(map, property, defaultValue, ignoreCase, startWith) {
  if (ignoreCase === false && startWith === false) return map.get(property) || defaultValue;
  var compareFunction = startWith ? caseInsensitiveStartWithCompare : caseInsensitiveCompare;
  return map.find(function (value, key) {
    return compareFunction(key, property);
  }) || defaultValue;
}
function getPropertyOrDefault(obj, property, defaultValue, ignoreCase, startWith) {
  if (ignoreCase === void 0) {
    ignoreCase = false;
  }
  if (startWith === void 0) {
    startWith = false;
  }
  if (!obj) {
    return defaultValue;
  }
  if (Map.isMap(obj)) {
    return getPropertyOrDefaultFromMap(obj, property, defaultValue, ignoreCase, startWith);
  }
  if (ignoreCase === false && startWith === false) {
    return Object.prototype.hasOwnProperty.call(obj, property) ? obj[property] : defaultValue;
  }
  var compareFunction = startWith ? caseInsensitiveStartWithCompare : caseInsensitiveCompare;
  for (var prop in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, prop) && compareFunction(prop, property)) {
      return obj[prop];
    }
  }
  return defaultValue;
}
var _isObjectContainsPropertyWithValue = exports.isObjectContainsPropertyWithValue = function isObjectContainsPropertyWithValue(obj, propertyName, value) {
  if (obj === null || obj === undefined) return false;
  if (Object.prototype.hasOwnProperty.call(obj, propertyName) && obj[propertyName] === value) {
    return true;
  }
  for (var prop in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, prop) && typeof obj[prop] === "object") {
      if (_isObjectContainsPropertyWithValue(obj[prop], propertyName, value)) return true;
    }
  }
  return false;
};
var _isObjectContainsPropertyWithAnyValue = exports.isObjectContainsPropertyWithAnyValue = function isObjectContainsPropertyWithAnyValue(obj, propertyName) {
  if (!obj) return false;
  if (Object.prototype.hasOwnProperty.call(obj, propertyName) && obj[propertyName]) {
    return true;
  }
  for (var prop in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, prop) && typeof obj[prop] === "object") {
      if (_isObjectContainsPropertyWithAnyValue(obj[prop], propertyName)) return true;
    }
  }
  return false;
};
var compareObjectProperty = exports.compareObjectProperty = function compareObjectProperty(obj1, obj2, propertyName) {
  if (propertyName == null || propertyName === "") {
    return 0;
  }
  var val1 = obj1 == null ? void 0 : obj1[propertyName];
  var val2 = obj2 == null ? void 0 : obj2[propertyName];
  if (val1 === val2) {
    return 0;
  }
  if (val1 < val2) {
    return -1;
  }
  return 1;
};
var compareObjectPropertyDescending = exports.compareObjectPropertyDescending = function compareObjectPropertyDescending(obj1, obj2, propertyName) {
  if (propertyName == null || propertyName === "") {
    return 0;
  }
  var val1 = obj1 == null ? void 0 : obj1[propertyName];
  var val2 = obj2 == null ? void 0 : obj2[propertyName];
  if (val1 === val2) {
    return 0;
  }
  if (val1 > val2) {
    return -1;
  }
  return 1;
};
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(caseInsensitiveCompare, "caseInsensitiveCompare", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(caseInsensitiveStartWithCompare, "caseInsensitiveStartWithCompare", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(getPropertyOrDefaultFromMap, "getPropertyOrDefaultFromMap", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(getPropertyOrDefault, "getPropertyOrDefault", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(_isObjectContainsPropertyWithValue, "isObjectContainsPropertyWithValue", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(_isObjectContainsPropertyWithAnyValue, "isObjectContainsPropertyWithAnyValue", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(compareObjectProperty, "compareObjectProperty", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(compareObjectPropertyDescending, "compareObjectPropertyDescending", "/home/vsts/work/1/s/src/utils/propertyHelper.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(caseInsensitiveCompare, "caseInsensitiveCompare", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(caseInsensitiveStartWithCompare, "caseInsensitiveStartWithCompare", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(getPropertyOrDefaultFromMap, "getPropertyOrDefaultFromMap", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(getPropertyOrDefault, "getPropertyOrDefault", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(_isObjectContainsPropertyWithValue, "isObjectContainsPropertyWithValue", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(_isObjectContainsPropertyWithAnyValue, "isObjectContainsPropertyWithAnyValue", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(compareObjectProperty, "compareObjectProperty", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
  reactHotLoader.register(compareObjectPropertyDescending, "compareObjectPropertyDescending", "/home/vsts/work/1/s/src/utils/propertyHelper.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();