var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __spreadArrays = (this && this.__spreadArrays) || function () {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
};
import { createSelector } from 'reselect';
import PaginationSelectors from './PaginationSelectors';
var getListingState = function (state) { return state.listing; };
var getVisibleItemIds = createSelector([
    getListingState,
], function (state) { return state.visibleItemIds; });
var hasItems = createSelector([
    getVisibleItemIds,
], function (items) { return Boolean(items && items.length); });
var getItemCache = createSelector([
    getListingState,
], function (state) { return state.itemCache; });
var getVisibleItems = createSelector([
    getItemCache,
    getVisibleItemIds,
], function (itemCache, visibleItemIds) { return visibleItemIds.map(function (id) { return (__assign({ id: id }, itemCache[id])); }); });
var getIsLoading = createSelector([
    getListingState,
], function (state) { return state.isLoading; });
var getBaseQueries = createSelector([
    getListingState,
], function (state) { return state.baseQueries; });
var getQueries = createSelector([
    getBaseQueries,
    PaginationSelectors.getFilterKeyValuePairs,
    PaginationSelectors.getSkipAndTakeKeyValuePairs,
    PaginationSelectors.getSortKeyValuePairs,
], function (baseQueries, filterKeyValuePairs, skipAndTakeKeyValuePairs, sortKeyValuePairs) { return __spreadArrays(baseQueries, filterKeyValuePairs, skipAndTakeKeyValuePairs, sortKeyValuePairs); });
export default {
    hasItems: hasItems,
    getQueries: getQueries,
    getBaseQueries: getBaseQueries,
    getVisibleItems: getVisibleItems,
    getVisibleItemIds: getVisibleItemIds,
    getIsLoading: getIsLoading,
};
//# sourceMappingURL=ListingSelectors.js.map