function applyChanges(backend, changes) {
  const state = backendState(backend)
  const patch = state.applyChanges(changes)
  backend.frozen = true
  return [{state, heads: state.heads}, patch]
}
Applies a list of `changes` from remote nodes to the node state `backend`.
Returns a two-element array `[state, patch]` where `state` is the updated
node state, and `patch` describes the modifications that need to be made
to the document objects to reflect these changes.