You can now import an existing machine (or multiple machines!) from JavaScript, TypeScript or JSON using the code panel in the editor’s right tool menu or the Machines list in the left drawer. Import from code was one of our most-requested features from users who had already created machines using XState or our Stately Viz.

Read more in our blog post about import from code.
Check out the docs for import from code.