@Nullable Component flushClaims(final Component component) { // return: a substitute to provide children
      Component ret = null;
      if (this.componentClaim != null) {
        this.componentClaim.emit(this);
        ret = this.componentClaim.substitute();
        this.componentClaim = null;
      } else if (component instanceof TextComponent) {
        this.text(((TextComponent) component).content());
      } else {
        // todo: best choice?
        throw new IllegalStateException("Unclaimed component " + component);
      }
      this.claimedStyleElements.clear();
      return ret;
    }
mark tag boundaries within the stack, without needing to mess with typing too much.
text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/MiniMessageSerializer.java