// Path: lib/src/io/github/alechenninger/monarch/DynamicNode.java
// final class RenderedNode {
//   private final DynamicNode node;
//   private final String path;
//   private final Set<Assignment> usedAssignments;
//   private final int hash;
// 
//   public RenderedNode(String path, Set<Assignment> usedAssignments, DynamicNode node) {
//     this.path = Objects.requireNonNull(path, "path");
//     this.usedAssignments = Objects.requireNonNull(usedAssignments, "usedAssignments");
//     this.node = Objects.requireNonNull(node, "node");
// 
//     hash = Objects.hash(node, path, usedAssignments);
//   }
// 
//   public String path() {
//     return path;
//   }
// 
//   public Set<Assignment> usedAssignments() {
//     return usedAssignments;
//   }
// 
//   public DynamicNode node() {
//     return node;
//   }
// 
//   @Override
//   public String toString() {
//     return "RenderedNode{" +
//         "node=" + node +
//         ", path='" + path + '\'' +
//         ", usedAssignments=" + usedAssignments +
//         '}';
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) return true;
//     if (o == null || getClass() != o.getClass()) return false;
//     RenderedNode that = (RenderedNode) o;
//     return Objects.equals(node, that.node) &&
//         Objects.equals(path, that.path) &&
//         Objects.equals(usedAssignments, that.usedAssignments);
//   }
// 
//   @Override
//   public int hashCode() {
//     return hash;
//   }
// }


import io.github.alechenninger.monarch.DynamicNode.RenderedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
          // TODO: error
          break;
        }
      }
    }

    if (target == null) {
      cachedSources.put(assignments, null);
      return Optional.empty();
    }

    cachedSources.put(assignments, target);
    return Optional.of(target);
  }

  @Override
  public List<Source> allSources() {
    if (cachedAll != null) {
      return cachedAll;
    }

    if (nodes.isEmpty()) {
      return cachedAll = Collections.emptyList();
    }

    List<Source> descendants = new ArrayList<>();

    for (int i = 0; i < nodes.size(); i++) {
      DynamicNode dynamicNode = nodes.get(i);

// Path: lib/src/io/github/alechenninger/monarch/DynamicNode.java
// final class RenderedNode {
//   private final DynamicNode node;
//   private final String path;
//   private final Set<Assignment> usedAssignments;
//   private final int hash;
// 
//   public RenderedNode(String path, Set<Assignment> usedAssignments, DynamicNode node) {
//     this.path = Objects.requireNonNull(path, "path");
//     this.usedAssignments = Objects.requireNonNull(usedAssignments, "usedAssignments");
//     this.node = Objects.requireNonNull(node, "node");
// 
//     hash = Objects.hash(node, path, usedAssignments);
//   }
// 
//   public String path() {
//     return path;
//   }
// 
//   public Set<Assignment> usedAssignments() {
//     return usedAssignments;
//   }
// 
//   public DynamicNode node() {
//     return node;
//   }
// 
//   @Override
//   public String toString() {
//     return "RenderedNode{" +
//         "node=" + node +
//         ", path='" + path + '\'' +
//         ", usedAssignments=" + usedAssignments +
//         '}';
//   }
// 
//   @Override
//   public boolean equals(Object o) {
//     if (this == o) return true;
//     if (o == null || getClass() != o.getClass()) return false;
//     RenderedNode that = (RenderedNode) o;
//     return Objects.equals(node, that.node) &&
//         Objects.equals(path, that.path) &&
//         Objects.equals(usedAssignments, that.usedAssignments);
//   }
// 
//   @Override
//   public int hashCode() {
//     return hash;
//   }
// }


// Path: lib/src/io/github/alechenninger/monarch/DynamicHierarchy.java
import io.github.alechenninger.monarch.DynamicNode.RenderedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

          // TODO: error
          break;
        }
      }
    }

    if (target == null) {
      cachedSources.put(assignments, null);
      return Optional.empty();
    }

    cachedSources.put(assignments, target);
    return Optional.of(target);
  }

  @Override
  public List<Source> allSources() {
    if (cachedAll != null) {
      return cachedAll;
    }

    if (nodes.isEmpty()) {
      return cachedAll = Collections.emptyList();
    }

    List<Source> descendants = new ArrayList<>();

    for (int i = 0; i < nodes.size(); i++) {
      DynamicNode dynamicNode = nodes.get(i);

      for (RenderedNode rendered : dynamicNode.render(Assignments.none(inventory))) {