///|
/// A copy with `expanded` replaced.
pub fn State::with_expanded(self : State, expanded : Bool) -> State {
  { ..self, expanded, }
}

///|
/// A copy with `label` replaced.
pub fn Transition::with_label(self : Transition, label : String) -> Transition {
  { ..self, label, }
}

///|
/// A copy with `text` replaced.
pub fn Note::with_text(self : Note, text : String) -> Note {
  { ..self, text, }
}

///|
/// A copy with `transitions` replaced.
pub fn StateDiagram::with_transitions(
  self : StateDiagram,
  transitions : ArrayView[Transition],
) -> StateDiagram {
  { ..self, transitions: ReadOnlyArray::from_array(transitions), }
}

///|
/// A copy with `notes` replaced.
pub fn StateDiagram::with_notes(
  self : StateDiagram,
  notes : ArrayView[Note],
) -> StateDiagram {
  { ..self, notes: ReadOnlyArray::from_array(notes), }
}