hunk.code_window:   function findAdjacencies(state: State<TContext, TEvent>) {
       const stateKey = serializeState(state);
       if (adjacency[stateKey]) {
  
hunk.labels: keep add keep keep keep
hunk.after_edit:     const { nextEvents } = state;
  
hunk.file_path: src/graph.ts
hunk.type: add
file: import { matchesState, keys } from './utils';
  
  export function mapState(
    stateMap: { [stateId: string]: any },
    stateId: string
  ) {
    let foundStateId;
  
    keys(stateMap).forEach(mappedStateId => {
      if (
        matchesState(mappedStateId, stateId) &&
        (!foundStateId || stateId.length > foundStateId.length)
      ) {
        foundStateId = mappedStateId;
      }
    });
  
    return stateMap[foundStateId];
  }
  