<scxml initial="History" name="success" version="1.0" xmlns="http://www.w3.org/2005/07/scxml"><!--   node-size-and-position x=0 y=0 w=837.03 h=1390  -->
 <datamodel >
  <data expr="{a:1, b:2}" id="user"></data>
  <data expr="this.sm.storage" id="storage"></data>
  <data expr="this.sm.xmpp" id="xmpp"></data>
  <data id="model" expr="{}"/>
 </datamodel>
 <transition event="error" target="Error"></transition>
 <history id="History" type="deep"><!--   node-size-and-position x=381.01 y=168 w=75 h=75  -->
  <transition target="Root"></transition>
 </history>
 <state id="Root" initial="Load_Data"><!--   node-size-and-position x=20 y=293 w=797.03 h=1077  -->
  <state id="Load_Data"><!--   node-size-and-position x=369.75 y=43 w=75 h=75  -->
   <onentry>
    <promise >storage.load()</promise>
   </onentry>
   <transition cond="_event.data &amp;&amp;_event.data.a" event="success" target="Connect"><!--   edge-path [Connect]  x=441.25 y=205.5 x=471.25 y=330.5  --></transition>
   <transition cond="!_event.data || !_event.data.a" event="success" target="PromoScene"><!--   edge-path [PromoScene]  x=407.18 y=145.52  --></transition>
   <transition event="failure" target="PromoScene"><!--   edge-path [PromoScene]  x=387.82 y=140.48  --></transition>
  </state>
  <state id="Connect"><!--   node-size-and-position x=436.75 y=418 w=75 h=75  -->
   <onentry>
    <promise>xmpp.login(_event.data.a)</promise>
   </onentry>
   <transition event="failure" target="PromoScene"><!--   edge-path [PromoScene]  x=441.25 y=330.5  --></transition>
   <transition event="success" target="StoreResult"></transition>
  </state>
  <state id="StoreResult">
   <onentry>
    <script>console.log('event data:', _event.data)</script>
    <assign location="model" expr="_event.data"/>
   </onentry>
   <transition target="Load_Profile"/>
  </state>
  <state id="PromoScene"><!--   node-size-and-position x=335.75 y=168 w=75 h=75  -->
   <onentry>
    <assign expr="_event.data" location="user.c"></assign>
   </onentry>
   <transition event="success" target="Register"></transition>
  </state>
  <state id="Register"><!--   node-size-and-position x=335.75 y=293 w=75 h=75  -->
   <transition event="success" target="Connect"></transition>
  </state>
  <state id="Load_Profile"><!--   node-size-and-position x=535.25 y=543 w=80 h=75  -->
   <transition event="failure" target="PromoScene"><!--   edge-path [PromoScene]  x=336.25 y=455.5 x=306.25 y=330.5  --></transition>
   <transition cond="!_event.data.handle" event="success" target="SignUpScene"><!--   edge-path [SignUpScene]  pointx=0 pointy=0 offsetx=14 offsety=0  --></transition>
   <transition cond="_event.data.handle" event="success" target="LoggedScene"></transition>
  </state>
  <state id="SignUpScene"><!--   node-size-and-position x=652.75 y=762.5 w=75 h=75  -->
   <transition event="success" target="Register_Profile"><!--   edge-path [Register_Profile]  x=697 y=910  --></transition>
  </state>
  <state id="Register_Profile"><!--   node-size-and-position x=640.25 y=982 w=100 h=75  -->
   <transition event="failure" target="SignUpScene"><!--   edge-path [SignUpScene]  x=677 y=910  --></transition>
   <transition event="success" target="Load_Profile"><!--   edge-path [Load_Profile]  x=757.25 y=800 pointx=0 pointy=0 offsetx=10 offsety=0  --></transition>
  </state>
  <state id="LoggedScene"><!--   node-size-and-position x=20 y=668 w=602.5 h=264  -->
   <state id="DrawerTabs"><!--  node-size-and-position x=20 y=43 w=548.5 h=201  -->
    <transition event="jump" target="HomeScene"></transition>
    <transition event="jump" target="FriendsScene"><!--   edge-path [FriendsScene]  pointx=0 pointy=0 offsetx=-8 offsety=0  --></transition>
    <transition  event="pop"><!--   edge-path [DrawerTabs]  pointx=0 pointy=0 offsetx=-18 offsety=0  --></transition>
    <state id="HomeScene"/><!--   node-size-and-position x=20 y=43 w=75 h=75  -->
    <state id="FriendsScene">
      <transition event="push" target="SearchFriends" ></transition>
      <transition event="push" target="AddFriendByUsername"><!--   edge-path [AddFriendByUsername]  pointx=0 pointy=0 offsetx=-14 offsety=0  --></transition>
      <transition event="pop" ></transition>
      <state id="SearchFriends"><!--   node-size-and-position x=232 y=43 w=90 h=75  --></state>
      <state id="AddFriendByUsername"><!--   node-size-and-position x=50 y=43 w=120 h=75  --></state>
    </state>
   </state>
  </state>
 </state>
 <state id="Error"><!--   node-size-and-position x=381.01 y=43 w=75 h=75  -->
  <transition event="handled" target="History"></transition>
 </state>
</scxml>