Implement createFSM({ initial, transitions }) where:
initial — starting state name (string).transitions — { [state]: { [event]: nextState } }. - state — current state.
- send(event) — transition; throw if invalid transition.
- can(event) — boolean, whether the event is valid now.
solve(config, events) drives the FSM and returns state history.
Sample tests