@ApiStatus.Internal
  public void clearDocumentReferences(@NotNull Document document) {
    ThreadingAssertions.assertEventDispatchThread();
    for (ClientState state : getAllClientStates()) {
      state.myUndoStacksHolder.clearDocumentReferences(document);
      state.myRedoStacksHolder.clearDocumentReferences(document);
      state.myMerger.clearDocumentReferences(document);
    }
    mySharedUndoStacksHolder.clearDocumentReferences(document);
    mySharedRedoStacksHolder.clearDocumentReferences(document);
  }
@ApiStatus.Internal
  public void clearDocumentReferences(@NotNull Document document)