function getElementsVisibilityRecursive(elements) {

  var result = {};

  forEach(elements, function(element) {
    result[element.id] = element.hidden;

    if (element.children) {
      result = assign({}, result, getElementsVisibilityRecursive(element.children));
    }
  });

  return result;
}
Return a map { elementId -> hiddenState}.

@param {Shape[]} elements

@return {Object}