"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var re_reselect_1 = __importDefault(require("re-reselect"));
var __1 = require("../../..");
var constants_1 = require("../../../../specs/constants");
var utils_1 = require("../../../../state/utils");
var hierarchy_of_arrays_1 = require("../../layout/viewmodel/hierarchy_of_arrays");
var getSpecs = function (state) { return state.specs; };
exports.getTree = re_reselect_1.default([getSpecs], function (specs) {
    var pieSpecs = utils_1.getSpecsFromStore(specs, __1.ChartTypes.Partition, constants_1.SpecTypes.Series);
    if (pieSpecs.length !== 1) {
        return [];
    }
    var _a = pieSpecs[0], data = _a.data, valueAccessor = _a.valueAccessor, layers = _a.layers;
    return hierarchy_of_arrays_1.getHierarchyOfArrays(data, valueAccessor, __spread([function () { return null; }], layers.map(function (_a) {
        var groupByRollup = _a.groupByRollup;
        return groupByRollup;
    })));
})(function (state) { return state.chartId; });
//# sourceMappingURL=tree.js.map