"use strict";

exports.__esModule = true;
exports.localizedAppSelector = exports.localizedAppOptionSelector = void 0;
var _reselect = require("reselect");
var _locale = require("./locale");
var _utils = require("../utils");
(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 appData = function appData(state) {
  return state.get("applications");
};
var appList = (0, _reselect.createSelector)(appData, function (data) {
  return data.get("list");
});
var visibleApps = (0, _reselect.createSelector)(appList, function (apps) {
  return apps.filter(function (app) {
    return app.get("isVisible");
  });
});
var localizedAppSelector = exports.localizedAppSelector = (0, _reselect.createSelector)(visibleApps, _locale.currentLocaleOrDefault, function (apps, locale) {
  return apps.map(function (app) {
    return (0, _utils.setTranslation)(locale, app, ["displayName"]);
  });
});
var localizedAppOptionSelector = exports.localizedAppOptionSelector = (0, _reselect.createSelector)(localizedAppSelector, function (apps) {
  return apps.map(function (app) {
    return {
      value: app.get("id"),
      label: app.get("displayName")
    };
  }).toArray();
});
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(appData, "appData", "/home/vsts/work/1/s/src/selectors/applications.js");
  reactHotLoader.register(appList, "appList", "/home/vsts/work/1/s/src/selectors/applications.js");
  reactHotLoader.register(visibleApps, "visibleApps", "/home/vsts/work/1/s/src/selectors/applications.js");
  reactHotLoader.register(localizedAppSelector, "localizedAppSelector", "/home/vsts/work/1/s/src/selectors/applications.js");
  reactHotLoader.register(localizedAppOptionSelector, "localizedAppOptionSelector", "/home/vsts/work/1/s/src/selectors/applications.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(appData, "appData", "/home/vsts/work/1/s/src/selectors/applications.js");
  reactHotLoader.register(appList, "appList", "/home/vsts/work/1/s/src/selectors/applications.js");
  reactHotLoader.register(visibleApps, "visibleApps", "/home/vsts/work/1/s/src/selectors/applications.js");
  reactHotLoader.register(localizedAppSelector, "localizedAppSelector", "/home/vsts/work/1/s/src/selectors/applications.js");
  reactHotLoader.register(localizedAppOptionSelector, "localizedAppOptionSelector", "/home/vsts/work/1/s/src/selectors/applications.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();