@almadar/std 16.173.0 → 16.175.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/behaviors/lolo/infra/atoms/std-cross-reference.lolo +2 -4
  2. package/behaviors/lolo/ui/core/atoms/std-board.lolo +5 -9
  3. package/behaviors/lolo/ui/core/atoms/std-browse.lolo +8 -1
  4. package/behaviors/lolo/ui/core/atoms/std-esign-flow.lolo +2 -2
  5. package/behaviors/lolo/ui/core/atoms/std-event-log.lolo +3 -7
  6. package/behaviors/lolo/ui/core/atoms/std-form-advanced.lolo +1 -1
  7. package/behaviors/lolo/ui/core/atoms/std-image-upload-multi.lolo +1 -1
  8. package/behaviors/lolo/ui/core/atoms/std-list.lolo +3 -3
  9. package/behaviors/lolo/ui/core/atoms/std-modal.lolo +2 -2
  10. package/behaviors/lolo/ui/core/atoms/std-multi-party-flow.lolo +2 -4
  11. package/behaviors/lolo/ui/core/atoms/std-rating-review.lolo +5 -13
  12. package/behaviors/lolo/ui/core/atoms/std-recurrence.lolo +3 -7
  13. package/behaviors/lolo/ui/core/atoms/std-saved-search.lolo +1 -1
  14. package/behaviors/lolo/ui/core/atoms/std-signature-capture.lolo +2 -2
  15. package/behaviors/lolo/ui/core/atoms/std-step-flow.lolo +2 -4
  16. package/behaviors/lolo/ui/core/atoms/std-tag-taxonomy.lolo +1 -1
  17. package/behaviors/lolo/ui/core/atoms/std-thread.lolo +2 -2
  18. package/behaviors/lolo/ui/core/atoms/std-vote.lolo +2 -2
  19. package/behaviors/lolo/ui/core/atoms/std-wizard.lolo +3 -7
  20. package/behaviors/lolo/ui/core/atoms/ui-atlas-image.lolo +1 -1
  21. package/behaviors/lolo/ui/core/atoms/ui-atlas-panel.lolo +1 -1
  22. package/behaviors/lolo/ui/core/atoms/ui-center.lolo +1 -1
  23. package/behaviors/lolo/ui/core/atoms/ui-hstack.lolo +1 -1
  24. package/behaviors/lolo/ui/core/atoms/ui-icon.lolo +1 -1
  25. package/behaviors/lolo/ui/core/atoms/ui-stack.lolo +1 -1
  26. package/behaviors/lolo/ui/core/atoms/ui-typography.lolo +1 -1
  27. package/behaviors/lolo/ui/core/atoms/ui-vstack.lolo +1 -1
  28. package/behaviors/lolo/ui/core/molecules/ui-content-renderer.lolo +1 -1
  29. package/behaviors/lolo/ui/core/molecules/ui-form-layout.lolo +1 -1
  30. package/behaviors/lolo/ui/core/molecules/ui-grid.lolo +1 -1
  31. package/behaviors/lolo/ui/core/molecules/ui-table-view.lolo +4 -9
  32. package/behaviors/lolo/ui/core/organisms/ui-chat-bar.lolo +1 -1
  33. package/behaviors/lolo/ui/core/organisms/ui-dashboard-grid.lolo +1 -1
  34. package/behaviors/lolo/ui/core/organisms/ui-detail-panel.lolo +1 -1
  35. package/behaviors/lolo/ui/core/organisms/ui-entity-cards.lolo +1 -1
  36. package/behaviors/lolo/ui/core/organisms/ui-entity-list.lolo +1 -1
  37. package/behaviors/lolo/ui/core/organisms/ui-entity-table.lolo +1 -1
  38. package/behaviors/lolo/ui/core/organisms/ui-form-section.lolo +9 -3
  39. package/behaviors/lolo/ui/core/organisms/ui-form.lolo +9 -3
  40. package/behaviors/lolo/ui/core/organisms/ui-master-detail.lolo +1 -1
  41. package/behaviors/lolo/ui/core/organisms/ui-media-gallery.lolo +1 -1
  42. package/behaviors/lolo/ui/core/organisms/ui-segment-renderer.lolo +7 -1
  43. package/behaviors/lolo/ui/core/organisms/ui-stat-card.lolo +1 -1
  44. package/behaviors/lolo/ui/core/organisms/ui-subagent-trace-panel.lolo +1 -1
  45. package/behaviors/lolo/ui/game/atoms/ui-action-tile.lolo +1 -1
  46. package/behaviors/lolo/ui/game/atoms/ui-draw-shape-layer.lolo +41 -9
  47. package/behaviors/lolo/ui/game/atoms/ui-draw-shape.lolo +40 -8
  48. package/behaviors/lolo/ui/game/atoms/ui-draw-sprite-layer.lolo +13 -3
  49. package/behaviors/lolo/ui/game/atoms/ui-draw-sprite.lolo +12 -2
  50. package/behaviors/lolo/ui/game/atoms/ui-draw-text-layer.lolo +3 -3
  51. package/behaviors/lolo/ui/game/atoms/ui-draw-text.lolo +2 -2
  52. package/behaviors/lolo/ui/game/organisms/std-tactics-board-3d.lolo +32 -2
  53. package/behaviors/lolo/ui/learning/atoms/std-learn-classify.lolo +133 -23
  54. package/behaviors/lolo/ui/learning/atoms/std-learn-compare.lolo +397 -0
  55. package/behaviors/lolo/ui/learning/atoms/std-learn-coupled-sim.lolo +537 -0
  56. package/behaviors/lolo/ui/learning/atoms/std-learn-derivation.lolo +428 -0
  57. package/behaviors/lolo/ui/learning/atoms/std-learn-doser.lolo +520 -0
  58. package/behaviors/lolo/ui/learning/atoms/std-learn-estimate.lolo +419 -0
  59. package/behaviors/lolo/ui/learning/atoms/std-learn-goal-seek.lolo +591 -0
  60. package/behaviors/lolo/ui/learning/atoms/std-learn-grid-sim.lolo +425 -0
  61. package/behaviors/lolo/ui/learning/atoms/std-learn-hotspot.lolo +398 -0
  62. package/behaviors/lolo/ui/learning/atoms/std-learn-measure.lolo +325 -0
  63. package/behaviors/lolo/ui/learning/atoms/std-learn-perturb.lolo +494 -0
  64. package/behaviors/lolo/ui/learning/atoms/std-learn-predict.lolo +408 -0
  65. package/behaviors/lolo/ui/learning/atoms/std-learn-scatter-fit.lolo +805 -0
  66. package/behaviors/lolo/ui/learning/atoms/std-learn-scenario.lolo +307 -0
  67. package/behaviors/lolo/ui/learning/atoms/std-learn-sim-3d.lolo +318 -0
  68. package/behaviors/lolo/ui/learning/atoms/std-learn-speed-drill.lolo +336 -0
  69. package/behaviors/lolo/ui/learning/atoms/std-learn-tour-3d.lolo +409 -0
  70. package/behaviors/lolo/ui/learning/atoms/std-learn-transport.lolo +186 -0
  71. package/behaviors/lolo/ui/learning/atoms/std-learn-tree.lolo +522 -0
  72. package/behaviors/lolo/ui/learning/atoms/ui-algo-graph-canvas.lolo +192 -0
  73. package/behaviors/lolo/ui/learning/atoms/ui-algorithm-canvas.lolo +111 -2
  74. package/behaviors/lolo/ui/learning/atoms/ui-biology-canvas.lolo +193 -5
  75. package/behaviors/lolo/ui/learning/atoms/ui-chemistry-canvas.lolo +173 -5
  76. package/behaviors/lolo/ui/learning/atoms/ui-learning-canvas.lolo +48 -1
  77. package/behaviors/lolo/ui/learning/atoms/ui-math-canvas.lolo +141 -1
  78. package/behaviors/lolo/ui/learning/atoms/ui-physics-canvas.lolo +242 -5
  79. package/behaviors/lolo/ui/marketing/organisms/ui-book-viewer.lolo +1 -1
  80. package/behaviors/lolo/ui/marketing/organisms/ui-case-study-organism.lolo +1 -1
  81. package/behaviors/lolo/ui/marketing/organisms/ui-feature-grid-organism.lolo +1 -1
  82. package/behaviors/lolo/ui/marketing/organisms/ui-hero-organism.lolo +1 -1
  83. package/behaviors/lolo/ui/marketing/organisms/ui-pricing-organism.lolo +1 -1
  84. package/behaviors/lolo/ui/marketing/organisms/ui-showcase-organism.lolo +1 -1
  85. package/behaviors/lolo/ui/marketing/organisms/ui-stats-organism.lolo +1 -1
  86. package/behaviors/lolo/ui/marketing/organisms/ui-step-flow-organism.lolo +1 -1
  87. package/behaviors/lolo/ui/marketing/organisms/ui-team-organism.lolo +1 -1
  88. package/behaviors/registry/agent/atoms/std-agent-session.orb +22 -1
  89. package/behaviors/registry/agent/atoms/std-agent-tool-call.orb +38 -2
  90. package/behaviors/registry/agent/atoms/std-agent-tool-loop.orb +38 -2
  91. package/behaviors/registry/agent/organisms/std-agent-rabit.orb +23 -1
  92. package/behaviors/registry/infra/atoms/std-approval-gate.orb +8 -16
  93. package/behaviors/registry/infra/atoms/std-cache-aside.orb +31 -62
  94. package/behaviors/registry/infra/atoms/std-circuit-breaker.orb +16 -32
  95. package/behaviors/registry/infra/atoms/std-cross-reference.orb +32 -4
  96. package/behaviors/registry/infra/atoms/std-data-erasure.orb +8 -16
  97. package/behaviors/registry/infra/atoms/std-mod-queue.orb +8 -16
  98. package/behaviors/registry/infra/atoms/std-rate-limiter.orb +14 -28
  99. package/behaviors/registry/infra/atoms/std-row-access-control.orb +30 -2
  100. package/behaviors/registry/ui/core/atoms/std-billable-hour.orb +1 -2
  101. package/behaviors/registry/ui/core/atoms/std-board.orb +19 -5
  102. package/behaviors/registry/ui/core/atoms/std-browse.orb +29 -7
  103. package/behaviors/registry/ui/core/atoms/std-dashboard-grid-embedded.orb +1 -2
  104. package/behaviors/registry/ui/core/atoms/std-esign-flow.orb +3 -5
  105. package/behaviors/registry/ui/core/atoms/std-esign-request.orb +3 -6
  106. package/behaviors/registry/ui/core/atoms/std-event-log.orb +17 -3
  107. package/behaviors/registry/ui/core/atoms/std-export.orb +2 -4
  108. package/behaviors/registry/ui/core/atoms/std-form-advanced.orb +1 -1
  109. package/behaviors/registry/ui/core/atoms/std-gallery.orb +9 -18
  110. package/behaviors/registry/ui/core/atoms/std-graphs.orb +15 -1
  111. package/behaviors/registry/ui/core/atoms/std-import.orb +2 -4
  112. package/behaviors/registry/ui/core/atoms/std-list.orb +4 -6
  113. package/behaviors/registry/ui/core/atoms/std-modal.orb +2 -2
  114. package/behaviors/registry/ui/core/atoms/std-multi-party-flow.orb +16 -2
  115. package/behaviors/registry/ui/core/atoms/std-pagination.orb +15 -1
  116. package/behaviors/registry/ui/core/atoms/std-rating-review.orb +19 -5
  117. package/behaviors/registry/ui/core/atoms/std-recurrence.orb +17 -3
  118. package/behaviors/registry/ui/core/atoms/std-rich-editor.orb +15 -1
  119. package/behaviors/registry/ui/core/atoms/std-scatter.orb +15 -1
  120. package/behaviors/registry/ui/core/atoms/std-signature-capture.orb +2 -2
  121. package/behaviors/registry/ui/core/atoms/std-stats.orb +15 -1
  122. package/behaviors/registry/ui/core/atoms/std-step-flow.orb +16 -2
  123. package/behaviors/registry/ui/core/atoms/std-thread.orb +2 -2
  124. package/behaviors/registry/ui/core/atoms/std-vote.orb +2 -2
  125. package/behaviors/registry/ui/core/atoms/std-wizard.orb +17 -3
  126. package/behaviors/registry/ui/core/atoms/ui-atlas-image.orb +4 -1
  127. package/behaviors/registry/ui/core/atoms/ui-atlas-panel.orb +4 -1
  128. package/behaviors/registry/ui/core/atoms/ui-center.orb +4 -1
  129. package/behaviors/registry/ui/core/atoms/ui-hstack.orb +4 -1
  130. package/behaviors/registry/ui/core/atoms/ui-icon.orb +4 -1
  131. package/behaviors/registry/ui/core/atoms/ui-stack.orb +4 -1
  132. package/behaviors/registry/ui/core/atoms/ui-typography.orb +4 -1
  133. package/behaviors/registry/ui/core/atoms/ui-vstack.orb +4 -1
  134. package/behaviors/registry/ui/core/molecules/ui-accordion.orb +3 -3
  135. package/behaviors/registry/ui/core/molecules/ui-content-renderer.orb +4 -1
  136. package/behaviors/registry/ui/core/molecules/ui-form-layout.orb +4 -1
  137. package/behaviors/registry/ui/core/molecules/ui-grid.orb +4 -1
  138. package/behaviors/registry/ui/core/molecules/ui-table-view.orb +4 -39
  139. package/behaviors/registry/ui/core/molecules/ui-tabs.orb +2 -2
  140. package/behaviors/registry/ui/core/molecules/ui-wizard-container.orb +1 -1
  141. package/behaviors/registry/ui/core/organisms/ui-chat-bar.orb +4 -1
  142. package/behaviors/registry/ui/core/organisms/ui-dashboard-grid.orb +5 -2
  143. package/behaviors/registry/ui/core/organisms/ui-detail-panel.orb +5 -2
  144. package/behaviors/registry/ui/core/organisms/ui-entity-cards.orb +4 -1
  145. package/behaviors/registry/ui/core/organisms/ui-entity-list.orb +4 -1
  146. package/behaviors/registry/ui/core/organisms/ui-entity-table.orb +4 -1
  147. package/behaviors/registry/ui/core/organisms/ui-form-section.orb +34 -2
  148. package/behaviors/registry/ui/core/organisms/ui-form.orb +34 -2
  149. package/behaviors/registry/ui/core/organisms/ui-master-detail.orb +4 -1
  150. package/behaviors/registry/ui/core/organisms/ui-media-gallery.orb +4 -1
  151. package/behaviors/registry/ui/core/organisms/ui-segment-renderer.orb +24 -2
  152. package/behaviors/registry/ui/core/organisms/ui-stat-card.orb +4 -1
  153. package/behaviors/registry/ui/core/organisms/ui-subagent-trace-panel.orb +4 -1
  154. package/behaviors/registry/ui/core/organisms/ui-tabbed-container.orb +1 -1
  155. package/behaviors/registry/ui/core/organisms/ui-ui-slot-renderer.orb +1 -1
  156. package/behaviors/registry/ui/game/atoms/std-fx-particles.orb +35 -1
  157. package/behaviors/registry/ui/game/atoms/ui-action-tile.orb +4 -1
  158. package/behaviors/registry/ui/game/atoms/ui-draw-shape-layer.orb +183 -13
  159. package/behaviors/registry/ui/game/atoms/ui-draw-shape.orb +104 -9
  160. package/behaviors/registry/ui/game/atoms/ui-draw-sprite-layer.orb +56 -2
  161. package/behaviors/registry/ui/game/atoms/ui-draw-sprite.orb +36 -4
  162. package/behaviors/registry/ui/game/atoms/ui-draw-text-layer.orb +21 -2
  163. package/behaviors/registry/ui/game/atoms/ui-draw-text.orb +19 -4
  164. package/behaviors/registry/ui/game/organisms/std-tactics-board-3d.orb +173 -2
  165. package/behaviors/registry/ui/learning/atoms/std-learn-classify.orb +1288 -197
  166. package/behaviors/registry/ui/learning/atoms/std-learn-compare.orb +2814 -0
  167. package/behaviors/registry/ui/learning/atoms/std-learn-coupled-sim.orb +3183 -0
  168. package/behaviors/registry/ui/learning/atoms/std-learn-derivation.orb +2512 -0
  169. package/behaviors/registry/ui/learning/atoms/std-learn-doser.orb +3678 -0
  170. package/behaviors/registry/ui/learning/atoms/std-learn-estimate.orb +2394 -0
  171. package/behaviors/registry/ui/learning/atoms/std-learn-goal-seek.orb +3951 -0
  172. package/behaviors/registry/ui/learning/atoms/std-learn-grid-sim.orb +3458 -0
  173. package/behaviors/registry/ui/learning/atoms/std-learn-hotspot.orb +2646 -0
  174. package/behaviors/registry/ui/learning/atoms/std-learn-measure.orb +1979 -0
  175. package/behaviors/registry/ui/learning/atoms/std-learn-perturb.orb +2994 -0
  176. package/behaviors/registry/ui/learning/atoms/std-learn-predict.orb +2682 -0
  177. package/behaviors/registry/ui/learning/atoms/std-learn-scatter-fit.orb +6539 -0
  178. package/behaviors/registry/ui/learning/atoms/std-learn-scenario.orb +1842 -0
  179. package/behaviors/registry/ui/learning/atoms/std-learn-sim-3d.orb +1648 -0
  180. package/behaviors/registry/ui/learning/atoms/std-learn-speed-drill.orb +2307 -0
  181. package/behaviors/registry/ui/learning/atoms/std-learn-tour-3d.orb +3118 -0
  182. package/behaviors/registry/ui/learning/atoms/std-learn-transport.orb +986 -0
  183. package/behaviors/registry/ui/learning/atoms/std-learn-tree.orb +3333 -0
  184. package/behaviors/registry/ui/learning/atoms/ui-algo-graph-canvas.orb +716 -0
  185. package/behaviors/registry/ui/learning/atoms/ui-algorithm-canvas.orb +679 -5
  186. package/behaviors/registry/ui/learning/atoms/ui-biology-canvas.orb +962 -18
  187. package/behaviors/registry/ui/learning/atoms/ui-chemistry-canvas.orb +919 -30
  188. package/behaviors/registry/ui/learning/atoms/ui-learning-canvas.orb +372 -1
  189. package/behaviors/registry/ui/learning/atoms/ui-math-canvas.orb +936 -16
  190. package/behaviors/registry/ui/learning/atoms/ui-physics-canvas.orb +1328 -43
  191. package/behaviors/registry/ui/marketing/atoms/std-marketing-article.orb +1 -2
  192. package/behaviors/registry/ui/marketing/atoms/std-marketing-footer.orb +1 -2
  193. package/behaviors/registry/ui/marketing/atoms/std-marketing-split.orb +1 -2
  194. package/behaviors/registry/ui/marketing/atoms/std-marketing-stats.orb +1 -2
  195. package/behaviors/registry/ui/marketing/atoms/std-marketing-steps.orb +1 -2
  196. package/behaviors/registry/ui/marketing/atoms/std-marketing-team.orb +1 -2
  197. package/behaviors/registry/ui/marketing/organisms/ui-book-viewer.orb +4 -1
  198. package/behaviors/registry/ui/marketing/organisms/ui-case-study-organism.orb +4 -1
  199. package/behaviors/registry/ui/marketing/organisms/ui-feature-grid-organism.orb +4 -1
  200. package/behaviors/registry/ui/marketing/organisms/ui-hero-organism.orb +4 -1
  201. package/behaviors/registry/ui/marketing/organisms/ui-pricing-organism.orb +4 -1
  202. package/behaviors/registry/ui/marketing/organisms/ui-showcase-organism.orb +4 -1
  203. package/behaviors/registry/ui/marketing/organisms/ui-stats-organism.orb +4 -1
  204. package/behaviors/registry/ui/marketing/organisms/ui-step-flow-organism.orb +4 -1
  205. package/behaviors/registry/ui/marketing/organisms/ui-team-organism.orb +4 -1
  206. package/dist/behaviors/exports-reader.js +3704 -2189
  207. package/dist/behaviors/functions/index.d.ts +2638 -254
  208. package/dist/behaviors/functions/index.js +3648 -2190
  209. package/dist/behaviors/index.d.ts +1 -1
  210. package/dist/behaviors/index.js +3705 -2190
  211. package/dist/behaviors/query.js +3704 -2189
  212. package/dist/behaviors-embeddings.hash.json +3 -3
  213. package/dist/behaviors-embeddings.json +289 -213
  214. package/dist/behaviors-registry.json +7900 -587
  215. package/dist/index.d.ts +1 -1
  216. package/dist/index.js +3705 -2190
  217. package/dist/knob-embeddings.hash.json +3 -3
  218. package/dist/knob-embeddings.json +1 -1
  219. package/dist/registry/factory-signatures.json +1 -1
  220. package/package.json +2 -2
@@ -0,0 +1,3333 @@
1
+ {
2
+ "description": "Generic ordered-tree builder instrument — inserts values one by one from a config-declared sequence, each value descends left/right by comparison against the current node and attaches as a leaf; the tree renders on algo-graph-canvas (layout: tree, auto-positioned from the parent/child edges), settled nodes green, the descent cursor red, the comparison trail amber. Traverse sweeps the tree to the chosen order (inorder/preorder/levelorder) one node per press or on auto-run, narrating the visit order so far. Vocabulary, sample values, colors, and labels are entirely config-declared, so the same mechanism serves any ordered-tree domain. Standalone by default; behind a lab router set matchMode and it renders only when MODE_SELECTED matches.",
3
+ "ledger": {
4
+ "entries": {
5
+ "ent_01M0CG89EHGC5QQ3DC9B55829P": {
6
+ "bakedName": "LearnTreeScene",
7
+ "curName": "LearnTreeScene",
8
+ "id": "ent_01M0CG89EHGC5QQ3DC9B55829P",
9
+ "kind": "entity",
10
+ "owner": "workspace",
11
+ "renames": []
12
+ },
13
+ "evt_01M0CG89EH11YN23CNFJ9XT40B": {
14
+ "bakedName": "INIT",
15
+ "curName": "INIT",
16
+ "id": "evt_01M0CG89EH11YN23CNFJ9XT40B",
17
+ "kind": "event",
18
+ "owner": "workspace",
19
+ "parent": "trt_01M0CG89EHQS7X90DRZY23WCFC",
20
+ "renames": []
21
+ },
22
+ "evt_01M0CG89EJ07EX792Y5KXECNYT": {
23
+ "bakedName": "RUN_TRAVERSAL",
24
+ "curName": "RUN_TRAVERSAL",
25
+ "id": "evt_01M0CG89EJ07EX792Y5KXECNYT",
26
+ "kind": "event",
27
+ "owner": "workspace",
28
+ "parent": "trt_01M0CG89EHQS7X90DRZY23WCFC",
29
+ "renames": []
30
+ },
31
+ "evt_01M0CG89EJ61ZX62ZHT1AD0XJC": {
32
+ "bakedName": "MODE_SELECTED",
33
+ "curName": "MODE_SELECTED",
34
+ "id": "evt_01M0CG89EJ61ZX62ZHT1AD0XJC",
35
+ "kind": "event",
36
+ "owner": "workspace",
37
+ "parent": "trt_01M0CG89EHQS7X90DRZY23WCFC",
38
+ "renames": []
39
+ },
40
+ "evt_01M0CG89EJ7K1E8SZDFQ82DVNR": {
41
+ "bakedName": "DELETE_VALUE",
42
+ "curName": "DELETE_VALUE",
43
+ "id": "evt_01M0CG89EJ7K1E8SZDFQ82DVNR",
44
+ "kind": "event",
45
+ "owner": "workspace",
46
+ "parent": "trt_01M0CG89EHQS7X90DRZY23WCFC",
47
+ "renames": []
48
+ },
49
+ "evt_01M0CG89EJ8JM60CBEG6EGKE9T": {
50
+ "bakedName": "TOGGLE_RUN",
51
+ "curName": "TOGGLE_RUN",
52
+ "id": "evt_01M0CG89EJ8JM60CBEG6EGKE9T",
53
+ "kind": "event",
54
+ "owner": "workspace",
55
+ "parent": "trt_01M0CG89EHQS7X90DRZY23WCFC",
56
+ "renames": []
57
+ },
58
+ "evt_01M0CG89EJFCW46TEMK50BZ8BT": {
59
+ "bakedName": "RESET",
60
+ "curName": "RESET",
61
+ "id": "evt_01M0CG89EJFCW46TEMK50BZ8BT",
62
+ "kind": "event",
63
+ "owner": "workspace",
64
+ "parent": "trt_01M0CG89EHQS7X90DRZY23WCFC",
65
+ "renames": []
66
+ },
67
+ "evt_01M0CG89EJHJA09VKDPZYYKAMF": {
68
+ "bakedName": "TREE_UPDATED",
69
+ "curName": "TREE_UPDATED",
70
+ "id": "evt_01M0CG89EJHJA09VKDPZYYKAMF",
71
+ "kind": "event",
72
+ "owner": "workspace",
73
+ "parent": "trt_01M0CG89EHQS7X90DRZY23WCFC",
74
+ "renames": []
75
+ },
76
+ "evt_01M0CG89EJN30MPAE3P0TV5WJZ": {
77
+ "bakedName": "INSERT_VALUE",
78
+ "curName": "INSERT_VALUE",
79
+ "id": "evt_01M0CG89EJN30MPAE3P0TV5WJZ",
80
+ "kind": "event",
81
+ "owner": "workspace",
82
+ "parent": "trt_01M0CG89EHQS7X90DRZY23WCFC",
83
+ "renames": []
84
+ },
85
+ "orb_01M0CG89EHJ7FAMVAKBY8C3CRT": {
86
+ "bakedName": "LearnTreeOrbital",
87
+ "curName": "LearnTreeOrbital",
88
+ "id": "orb_01M0CG89EHJ7FAMVAKBY8C3CRT",
89
+ "kind": "orbital",
90
+ "owner": "workspace",
91
+ "renames": []
92
+ },
93
+ "pag_01M0CG89EK0FC9Y6NE2R1B8FZF": {
94
+ "bakedName": "LearnTreePage",
95
+ "curName": "LearnTreePage",
96
+ "id": "pag_01M0CG89EK0FC9Y6NE2R1B8FZF",
97
+ "kind": "page",
98
+ "owner": "workspace",
99
+ "renames": []
100
+ },
101
+ "trt_01M0CG89EHQS7X90DRZY23WCFC": {
102
+ "bakedName": "LearnTreeSim",
103
+ "curName": "LearnTreeSim",
104
+ "id": "trt_01M0CG89EHQS7X90DRZY23WCFC",
105
+ "kind": "trait",
106
+ "owner": "workspace",
107
+ "renames": []
108
+ }
109
+ },
110
+ "schemaVersion": 1
111
+ },
112
+ "name": "std-learn-tree",
113
+ "orbitals": [
114
+ {
115
+ "entity": {
116
+ "fields": [
117
+ {
118
+ "name": "id",
119
+ "required": true,
120
+ "type": "string"
121
+ },
122
+ {
123
+ "default": false,
124
+ "name": "active",
125
+ "type": "boolean"
126
+ },
127
+ {
128
+ "name": "title",
129
+ "type": "string"
130
+ },
131
+ {
132
+ "items": {
133
+ "properties": {
134
+ "id": {
135
+ "name": "id",
136
+ "required": true,
137
+ "type": "string"
138
+ },
139
+ "label": {
140
+ "name": "label",
141
+ "required": false,
142
+ "type": "string"
143
+ },
144
+ "state": {
145
+ "name": "state",
146
+ "required": false,
147
+ "type": "string",
148
+ "values": [
149
+ "unvisited",
150
+ "frontier",
151
+ "current",
152
+ "visited",
153
+ "goal",
154
+ "path"
155
+ ]
156
+ }
157
+ },
158
+ "type": "object"
159
+ },
160
+ "name": "nodes",
161
+ "type": "array"
162
+ },
163
+ {
164
+ "items": {
165
+ "properties": {
166
+ "directed": {
167
+ "name": "directed",
168
+ "required": false,
169
+ "type": "boolean"
170
+ },
171
+ "from": {
172
+ "name": "from",
173
+ "required": true,
174
+ "type": "string"
175
+ },
176
+ "label": {
177
+ "name": "label",
178
+ "required": false,
179
+ "type": "string"
180
+ },
181
+ "state": {
182
+ "name": "state",
183
+ "required": false,
184
+ "type": "string",
185
+ "values": [
186
+ "default",
187
+ "tree",
188
+ "relaxed",
189
+ "candidate",
190
+ "path"
191
+ ]
192
+ },
193
+ "to": {
194
+ "name": "to",
195
+ "required": true,
196
+ "type": "string"
197
+ }
198
+ },
199
+ "type": "object"
200
+ },
201
+ "name": "edges",
202
+ "type": "array"
203
+ },
204
+ {
205
+ "items": {
206
+ "properties": {
207
+ "id": {
208
+ "name": "id",
209
+ "required": true,
210
+ "type": "string"
211
+ },
212
+ "levelKey": {
213
+ "name": "levelKey",
214
+ "required": false,
215
+ "type": "number"
216
+ },
217
+ "path": {
218
+ "name": "path",
219
+ "required": false,
220
+ "type": "string"
221
+ },
222
+ "rank": {
223
+ "name": "rank",
224
+ "required": true,
225
+ "type": "number"
226
+ },
227
+ "value": {
228
+ "name": "value",
229
+ "required": true,
230
+ "type": "number"
231
+ }
232
+ },
233
+ "type": "object"
234
+ },
235
+ "name": "entries",
236
+ "type": "array"
237
+ },
238
+ {
239
+ "default": 0.0,
240
+ "name": "cursor",
241
+ "type": "number"
242
+ },
243
+ {
244
+ "default": 0.0,
245
+ "name": "pending",
246
+ "type": "number"
247
+ },
248
+ {
249
+ "default": false,
250
+ "name": "descending",
251
+ "type": "boolean"
252
+ },
253
+ {
254
+ "items": {
255
+ "type": "string"
256
+ },
257
+ "name": "trail",
258
+ "type": "array"
259
+ },
260
+ {
261
+ "default": "",
262
+ "name": "curId",
263
+ "type": "string"
264
+ },
265
+ {
266
+ "default": 0.0,
267
+ "name": "curVal",
268
+ "type": "number"
269
+ },
270
+ {
271
+ "default": 0.0,
272
+ "name": "curRank",
273
+ "type": "number"
274
+ },
275
+ {
276
+ "default": 0.0,
277
+ "name": "curRankOffset",
278
+ "type": "number"
279
+ },
280
+ {
281
+ "default": 0.0,
282
+ "name": "depth",
283
+ "type": "number"
284
+ },
285
+ {
286
+ "default": 0.0,
287
+ "name": "maxDepth",
288
+ "type": "number"
289
+ },
290
+ {
291
+ "default": 0.0,
292
+ "name": "count",
293
+ "type": "number"
294
+ },
295
+ {
296
+ "default": false,
297
+ "name": "traversing",
298
+ "type": "boolean"
299
+ },
300
+ {
301
+ "items": {
302
+ "type": "string"
303
+ },
304
+ "name": "traversalOrder",
305
+ "type": "array"
306
+ },
307
+ {
308
+ "items": {
309
+ "type": "string"
310
+ },
311
+ "name": "sweptIds",
312
+ "type": "array"
313
+ },
314
+ {
315
+ "default": false,
316
+ "name": "done",
317
+ "type": "boolean"
318
+ },
319
+ {
320
+ "default": false,
321
+ "name": "running",
322
+ "type": "boolean"
323
+ },
324
+ {
325
+ "name": "narration",
326
+ "type": "string"
327
+ }
328
+ ],
329
+ "id": "ent_01M0CG89EHGC5QQ3DC9B55829P",
330
+ "name": "LearnTreeScene",
331
+ "persistence": "runtime"
332
+ },
333
+ "id": "orb_01M0CG89EHJ7FAMVAKBY8C3CRT",
334
+ "name": "LearnTreeOrbital",
335
+ "pages": [
336
+ {
337
+ "id": "pag_01M0CG89EK0FC9Y6NE2R1B8FZF",
338
+ "name": "LearnTreePage",
339
+ "path": "/learn-tree",
340
+ "traits": [
341
+ {
342
+ "ref": "LearnTreeSim",
343
+ "refId": "trt_01M0CG89EHQS7X90DRZY23WCFC"
344
+ }
345
+ ]
346
+ }
347
+ ],
348
+ "traits": [
349
+ {
350
+ "category": "interaction",
351
+ "config": {
352
+ "autoRun": {
353
+ "default": false,
354
+ "description": "When true, the tick auto-steps the traversal sweep started by Traverse; toggle live with the Run/Pause button. Has no effect on Insert/Delete, which stay manual.",
355
+ "label": "Auto Run",
356
+ "synonyms": "auto run, auto step, auto play",
357
+ "tier": "domain",
358
+ "type": "boolean"
359
+ },
360
+ "backgroundColor": {
361
+ "default": "#f8fafc",
362
+ "description": "Canvas background color.",
363
+ "label": "Background Color",
364
+ "tier": "presentation",
365
+ "type": "string"
366
+ },
367
+ "balanced": {
368
+ "default": false,
369
+ "description": "When true, each insert's narration reports the tree's current height against its node count so the learner can judge balance; no auto-rotation is performed.",
370
+ "label": "Balance Readout",
371
+ "synonyms": "balance, height, balance readout",
372
+ "tier": "domain",
373
+ "type": "boolean"
374
+ },
375
+ "height": {
376
+ "default": 400.0,
377
+ "description": "Canvas height in pixels.",
378
+ "label": "Height",
379
+ "tier": "presentation",
380
+ "type": "number"
381
+ },
382
+ "matchMode": {
383
+ "default": "",
384
+ "description": "When composed behind a lab router, the MODE_SELECTED mode value this instrument responds to. Empty string means standalone — render immediately on INIT.",
385
+ "label": "Match Mode",
386
+ "tier": "presentation",
387
+ "type": "string"
388
+ },
389
+ "showComparisons": {
390
+ "default": true,
391
+ "description": "Include each left/right comparison in the narration while a value descends; turn off for a terse attach-only narration.",
392
+ "label": "Show Comparisons",
393
+ "synonyms": "comparisons, narration detail",
394
+ "tier": "presentation",
395
+ "type": "boolean"
396
+ },
397
+ "title": {
398
+ "default": "Ordered Tree",
399
+ "description": "Title shown above the canvas.",
400
+ "label": "Title",
401
+ "tier": "presentation",
402
+ "type": "string"
403
+ },
404
+ "traversalKind": {
405
+ "default": "inorder",
406
+ "description": "Which sweep Traverse replays — inorder (sorted order, left to right), preorder (root before children), or levelorder (breadth first, top to bottom).",
407
+ "label": "Traversal Kind",
408
+ "synonyms": "traversal, in-order, pre-order, level-order, sweep",
409
+ "tier": "domain",
410
+ "type": "string"
411
+ },
412
+ "values": {
413
+ "default": [
414
+ 50.0,
415
+ 30.0,
416
+ 70.0,
417
+ 20.0,
418
+ 40.0,
419
+ 60.0,
420
+ 80.0
421
+ ],
422
+ "description": "The values Insert feeds into the tree, one per descent, in order.",
423
+ "items": {
424
+ "type": "number"
425
+ },
426
+ "label": "Values",
427
+ "synonyms": "keys, values to insert, dataset, sequence",
428
+ "tier": "domain",
429
+ "type": "[number]"
430
+ },
431
+ "width": {
432
+ "default": 600.0,
433
+ "description": "Canvas width in pixels.",
434
+ "label": "Width",
435
+ "tier": "presentation",
436
+ "type": "number"
437
+ }
438
+ },
439
+ "emits": [
440
+ {
441
+ "description": "The tree after each insert/delete/traversal step — a composed listener (readout, grader) can subscribe; a harmless no-op when the atom runs standalone.",
442
+ "event": "TREE_UPDATED",
443
+ "eventId": "evt_01M0CG89EJHJA09VKDPZYYKAMF",
444
+ "payloadSchema": [
445
+ {
446
+ "name": "nodes",
447
+ "type": "[LearnTreeNode]"
448
+ },
449
+ {
450
+ "name": "edges",
451
+ "type": "[LearnTreeEdge]"
452
+ },
453
+ {
454
+ "name": "count",
455
+ "type": "number"
456
+ },
457
+ {
458
+ "name": "narration",
459
+ "type": "string"
460
+ }
461
+ ],
462
+ "scope": "external",
463
+ "synonyms": "tree update, insert result, traversal result, node count",
464
+ "tier": "domain"
465
+ }
466
+ ],
467
+ "entityContract": {
468
+ "provides": [
469
+ "active",
470
+ "count",
471
+ "curId",
472
+ "curRank",
473
+ "curRankOffset",
474
+ "curVal",
475
+ "cursor",
476
+ "depth",
477
+ "descending",
478
+ "done",
479
+ "edges",
480
+ "entries",
481
+ "maxDepth",
482
+ "narration",
483
+ "nodes",
484
+ "pending",
485
+ "running",
486
+ "sweptIds",
487
+ "title",
488
+ "trail",
489
+ "traversalOrder",
490
+ "traversing"
491
+ ],
492
+ "requires": []
493
+ },
494
+ "entityRebindable": true,
495
+ "entityRefIds": {
496
+ "LearnTreeScene": "ent_01M0CG89EHGC5QQ3DC9B55829P"
497
+ },
498
+ "id": "trt_01M0CG89EHQS7X90DRZY23WCFC",
499
+ "linkedEntity": "LearnTreeScene",
500
+ "linkedEntityId": "ent_01M0CG89EHGC5QQ3DC9B55829P",
501
+ "name": "LearnTreeSim",
502
+ "scope": "instance",
503
+ "stateMachine": {
504
+ "events": [
505
+ {
506
+ "id": "evt_01M0CG89EH11YN23CNFJ9XT40B",
507
+ "key": "INIT",
508
+ "name": "Initialize"
509
+ },
510
+ {
511
+ "description": "Lab router broadcast naming the active mode; this instrument renders when the mode equals matchMode, otherwise renders null.",
512
+ "id": "evt_01M0CG89EJ61ZX62ZHT1AD0XJC",
513
+ "key": "MODE_SELECTED",
514
+ "name": "Mode Selected",
515
+ "payloadSchema": [
516
+ {
517
+ "name": "mode",
518
+ "type": "string"
519
+ }
520
+ ],
521
+ "tier": "domain"
522
+ },
523
+ {
524
+ "description": "Insert the next config-declared value: descends one comparison step per press from the root, coloring the descent cursor and comparison trail, until it attaches as a leaf. Pressing again while a descent is in flight continues that same descent.",
525
+ "id": "evt_01M0CG89EJN30MPAE3P0TV5WJZ",
526
+ "key": "INSERT_VALUE",
527
+ "name": "Insert Value",
528
+ "synonyms": "insert, add, next value, descend, attach",
529
+ "tier": "domain"
530
+ },
531
+ {
532
+ "description": "Undo the most recently inserted value — removes its node/edge/entry and rewinds the insert cursor by one so the same value can be re-inserted.",
533
+ "id": "evt_01M0CG89EJ7K1E8SZDFQ82DVNR",
534
+ "key": "DELETE_VALUE",
535
+ "name": "Delete Value",
536
+ "synonyms": "delete, remove, undo, rewind",
537
+ "tier": "domain"
538
+ },
539
+ {
540
+ "description": "Advance the traversal sweep one node at a time in the configured order (inorder/preorder/levelorder); pressing after the sweep completes starts a fresh sweep.",
541
+ "id": "evt_01M0CG89EJ07EX792Y5KXECNYT",
542
+ "key": "RUN_TRAVERSAL",
543
+ "name": "Run Traversal",
544
+ "synonyms": "traverse, sweep, visit, walk, in-order, pre-order, level-order",
545
+ "tier": "domain"
546
+ },
547
+ {
548
+ "description": "Toggle auto-stepping: while running, the tick sweeps the traversal one node forward every step. Has no effect on Insert/Delete, which stay manual.",
549
+ "id": "evt_01M0CG89EJ8JM60CBEG6EGKE9T",
550
+ "key": "TOGGLE_RUN",
551
+ "name": "Toggle Run",
552
+ "synonyms": "run, pause, auto, auto-step",
553
+ "tier": "domain"
554
+ },
555
+ {
556
+ "description": "Clear the tree back to empty and restore the insert cursor and running flag from config, ready to insert from the first value again.",
557
+ "id": "evt_01M0CG89EJFCW46TEMK50BZ8BT",
558
+ "key": "RESET",
559
+ "name": "Reset",
560
+ "synonyms": "reset, clear, restart, start over",
561
+ "tier": "domain"
562
+ },
563
+ {
564
+ "description": "The tree after each insert/delete/traversal step — a composed listener (readout, grader) can subscribe; a harmless no-op when the atom runs standalone.",
565
+ "id": "evt_01M0CG89EJHJA09VKDPZYYKAMF",
566
+ "key": "TREE_UPDATED",
567
+ "name": "Tree Updated",
568
+ "payloadSchema": [
569
+ {
570
+ "name": "nodes",
571
+ "type": "[LearnTreeNode]"
572
+ },
573
+ {
574
+ "name": "edges",
575
+ "type": "[LearnTreeEdge]"
576
+ },
577
+ {
578
+ "name": "count",
579
+ "type": "number"
580
+ },
581
+ {
582
+ "name": "narration",
583
+ "type": "string"
584
+ }
585
+ ],
586
+ "synonyms": "tree update, insert result, traversal result, node count",
587
+ "tier": "domain"
588
+ }
589
+ ],
590
+ "states": [
591
+ {
592
+ "isInitial": true,
593
+ "name": "idle"
594
+ }
595
+ ],
596
+ "transitions": [
597
+ {
598
+ "effects": [
599
+ [
600
+ "set",
601
+ "@entity.active",
602
+ true
603
+ ],
604
+ [
605
+ "set",
606
+ "@entity.title",
607
+ "@config.title"
608
+ ],
609
+ [
610
+ "set",
611
+ "@entity.nodes",
612
+ []
613
+ ],
614
+ [
615
+ "set",
616
+ "@entity.edges",
617
+ []
618
+ ],
619
+ [
620
+ "set",
621
+ "@entity.entries",
622
+ []
623
+ ],
624
+ [
625
+ "set",
626
+ "@entity.cursor",
627
+ 0.0
628
+ ],
629
+ [
630
+ "set",
631
+ "@entity.descending",
632
+ false
633
+ ],
634
+ [
635
+ "set",
636
+ "@entity.trail",
637
+ []
638
+ ],
639
+ [
640
+ "set",
641
+ "@entity.depth",
642
+ 0.0
643
+ ],
644
+ [
645
+ "set",
646
+ "@entity.maxDepth",
647
+ 0.0
648
+ ],
649
+ [
650
+ "set",
651
+ "@entity.count",
652
+ 0.0
653
+ ],
654
+ [
655
+ "set",
656
+ "@entity.traversing",
657
+ false
658
+ ],
659
+ [
660
+ "set",
661
+ "@entity.traversalOrder",
662
+ []
663
+ ],
664
+ [
665
+ "set",
666
+ "@entity.sweptIds",
667
+ []
668
+ ],
669
+ [
670
+ "set",
671
+ "@entity.done",
672
+ false
673
+ ],
674
+ [
675
+ "set",
676
+ "@entity.running",
677
+ "@config.autoRun"
678
+ ],
679
+ [
680
+ "set",
681
+ "@entity.narration",
682
+ "Press Insert to add the next value; keep pressing to watch it descend."
683
+ ],
684
+ [
685
+ "render-ui",
686
+ "main",
687
+ {
688
+ "children": [
689
+ {
690
+ "children": [
691
+ {
692
+ "content": "@entity.title",
693
+ "type": "typography",
694
+ "variant": "h4"
695
+ },
696
+ {
697
+ "children": [
698
+ {
699
+ "action": "INSERT_VALUE",
700
+ "label": "Insert",
701
+ "type": "button",
702
+ "variant": "primary"
703
+ },
704
+ {
705
+ "action": "DELETE_VALUE",
706
+ "label": "Delete",
707
+ "type": "button",
708
+ "variant": "secondary"
709
+ },
710
+ {
711
+ "action": "RUN_TRAVERSAL",
712
+ "label": "Traverse",
713
+ "type": "button",
714
+ "variant": "secondary"
715
+ },
716
+ {
717
+ "action": "TOGGLE_RUN",
718
+ "label": [
719
+ "if",
720
+ "@entity.running",
721
+ "Pause",
722
+ "Run"
723
+ ],
724
+ "type": "button",
725
+ "variant": "secondary"
726
+ },
727
+ {
728
+ "action": "RESET",
729
+ "label": "Reset",
730
+ "type": "button",
731
+ "variant": "ghost"
732
+ }
733
+ ],
734
+ "direction": "horizontal",
735
+ "gap": "sm",
736
+ "type": "stack"
737
+ },
738
+ {
739
+ "backgroundColor": "@config.backgroundColor",
740
+ "edges": "@entity.edges",
741
+ "height": "@config.height",
742
+ "layout": "tree",
743
+ "nodes": "@entity.nodes",
744
+ "root": "n0",
745
+ "type": "algo-graph-canvas",
746
+ "width": "@config.width"
747
+ },
748
+ {
749
+ "content": "@entity.narration",
750
+ "type": "typography",
751
+ "variant": "body"
752
+ }
753
+ ],
754
+ "direction": "vertical",
755
+ "gap": "md",
756
+ "type": "stack"
757
+ }
758
+ ],
759
+ "padding": "md",
760
+ "type": "box"
761
+ }
762
+ ],
763
+ [
764
+ "emit",
765
+ "TREE_UPDATED",
766
+ {
767
+ "count": "@entity.count",
768
+ "edges": "@entity.edges",
769
+ "narration": "@entity.narration",
770
+ "nodes": "@entity.nodes"
771
+ }
772
+ ]
773
+ ],
774
+ "event": "INIT",
775
+ "eventId": "evt_01M0CG89EH11YN23CNFJ9XT40B",
776
+ "from": "idle",
777
+ "guard": [
778
+ "==",
779
+ "@config.matchMode",
780
+ ""
781
+ ],
782
+ "to": "idle"
783
+ },
784
+ {
785
+ "effects": [
786
+ [
787
+ "set",
788
+ "@entity.active",
789
+ true
790
+ ],
791
+ [
792
+ "set",
793
+ "@entity.title",
794
+ "@config.title"
795
+ ],
796
+ [
797
+ "set",
798
+ "@entity.nodes",
799
+ []
800
+ ],
801
+ [
802
+ "set",
803
+ "@entity.edges",
804
+ []
805
+ ],
806
+ [
807
+ "set",
808
+ "@entity.entries",
809
+ []
810
+ ],
811
+ [
812
+ "set",
813
+ "@entity.cursor",
814
+ 0.0
815
+ ],
816
+ [
817
+ "set",
818
+ "@entity.descending",
819
+ false
820
+ ],
821
+ [
822
+ "set",
823
+ "@entity.trail",
824
+ []
825
+ ],
826
+ [
827
+ "set",
828
+ "@entity.depth",
829
+ 0.0
830
+ ],
831
+ [
832
+ "set",
833
+ "@entity.maxDepth",
834
+ 0.0
835
+ ],
836
+ [
837
+ "set",
838
+ "@entity.count",
839
+ 0.0
840
+ ],
841
+ [
842
+ "set",
843
+ "@entity.traversing",
844
+ false
845
+ ],
846
+ [
847
+ "set",
848
+ "@entity.traversalOrder",
849
+ []
850
+ ],
851
+ [
852
+ "set",
853
+ "@entity.sweptIds",
854
+ []
855
+ ],
856
+ [
857
+ "set",
858
+ "@entity.done",
859
+ false
860
+ ],
861
+ [
862
+ "set",
863
+ "@entity.running",
864
+ "@config.autoRun"
865
+ ],
866
+ [
867
+ "set",
868
+ "@entity.narration",
869
+ "Press Insert to add the next value; keep pressing to watch it descend."
870
+ ],
871
+ [
872
+ "render-ui",
873
+ "main",
874
+ {
875
+ "children": [
876
+ {
877
+ "children": [
878
+ {
879
+ "content": "@entity.title",
880
+ "type": "typography",
881
+ "variant": "h4"
882
+ },
883
+ {
884
+ "children": [
885
+ {
886
+ "action": "INSERT_VALUE",
887
+ "label": "Insert",
888
+ "type": "button",
889
+ "variant": "primary"
890
+ },
891
+ {
892
+ "action": "DELETE_VALUE",
893
+ "label": "Delete",
894
+ "type": "button",
895
+ "variant": "secondary"
896
+ },
897
+ {
898
+ "action": "RUN_TRAVERSAL",
899
+ "label": "Traverse",
900
+ "type": "button",
901
+ "variant": "secondary"
902
+ },
903
+ {
904
+ "action": "TOGGLE_RUN",
905
+ "label": [
906
+ "if",
907
+ "@entity.running",
908
+ "Pause",
909
+ "Run"
910
+ ],
911
+ "type": "button",
912
+ "variant": "secondary"
913
+ },
914
+ {
915
+ "action": "RESET",
916
+ "label": "Reset",
917
+ "type": "button",
918
+ "variant": "ghost"
919
+ }
920
+ ],
921
+ "direction": "horizontal",
922
+ "gap": "sm",
923
+ "type": "stack"
924
+ },
925
+ {
926
+ "backgroundColor": "@config.backgroundColor",
927
+ "edges": "@entity.edges",
928
+ "height": "@config.height",
929
+ "layout": "tree",
930
+ "nodes": "@entity.nodes",
931
+ "root": "n0",
932
+ "type": "algo-graph-canvas",
933
+ "width": "@config.width"
934
+ },
935
+ {
936
+ "content": "@entity.narration",
937
+ "type": "typography",
938
+ "variant": "body"
939
+ }
940
+ ],
941
+ "direction": "vertical",
942
+ "gap": "md",
943
+ "type": "stack"
944
+ }
945
+ ],
946
+ "padding": "md",
947
+ "type": "box"
948
+ }
949
+ ],
950
+ [
951
+ "emit",
952
+ "TREE_UPDATED",
953
+ {
954
+ "count": "@entity.count",
955
+ "edges": "@entity.edges",
956
+ "narration": "@entity.narration",
957
+ "nodes": "@entity.nodes"
958
+ }
959
+ ]
960
+ ],
961
+ "event": "MODE_SELECTED",
962
+ "eventId": "evt_01M0CG89EJ61ZX62ZHT1AD0XJC",
963
+ "from": "idle",
964
+ "guard": [
965
+ "==",
966
+ "@payload.mode",
967
+ "@config.matchMode"
968
+ ],
969
+ "to": "idle"
970
+ },
971
+ {
972
+ "effects": [
973
+ [
974
+ "set",
975
+ "@entity.traversing",
976
+ false
977
+ ],
978
+ [
979
+ "set",
980
+ "@entity.traversalOrder",
981
+ []
982
+ ],
983
+ [
984
+ "set",
985
+ "@entity.sweptIds",
986
+ []
987
+ ],
988
+ [
989
+ "set",
990
+ "@entity.done",
991
+ false
992
+ ],
993
+ [
994
+ "if",
995
+ [
996
+ "not",
997
+ "@entity.descending"
998
+ ],
999
+ [
1000
+ "let",
1001
+ [
1002
+ [
1003
+ "v",
1004
+ [
1005
+ "array/nth",
1006
+ "@config.values",
1007
+ "@entity.cursor"
1008
+ ]
1009
+ ]
1010
+ ],
1011
+ [
1012
+ "if",
1013
+ [
1014
+ "==",
1015
+ "@entity.count",
1016
+ 0.0
1017
+ ],
1018
+ [
1019
+ "do",
1020
+ [
1021
+ "set",
1022
+ "@entity.pending",
1023
+ "@v"
1024
+ ],
1025
+ [
1026
+ "set",
1027
+ "@entity.nodes",
1028
+ [
1029
+ "array/append",
1030
+ "@entity.nodes",
1031
+ {
1032
+ "id": "n0",
1033
+ "label": [
1034
+ "str/concat",
1035
+ "",
1036
+ "@v"
1037
+ ],
1038
+ "state": "visited"
1039
+ }
1040
+ ]
1041
+ ],
1042
+ [
1043
+ "set",
1044
+ "@entity.entries",
1045
+ [
1046
+ "array/append",
1047
+ "@entity.entries",
1048
+ {
1049
+ "id": "n0",
1050
+ "levelKey": 300.0,
1051
+ "path": "",
1052
+ "rank": 300.0,
1053
+ "value": "@v"
1054
+ }
1055
+ ]
1056
+ ],
1057
+ [
1058
+ "set",
1059
+ "@entity.count",
1060
+ 1.0
1061
+ ],
1062
+ [
1063
+ "set",
1064
+ "@entity.cursor",
1065
+ 1.0
1066
+ ],
1067
+ [
1068
+ "set",
1069
+ "@entity.narration",
1070
+ [
1071
+ "str/concat",
1072
+ "insert ",
1073
+ [
1074
+ "str/concat",
1075
+ "",
1076
+ "@v"
1077
+ ],
1078
+ " — tree empty, becomes root",
1079
+ [
1080
+ "if",
1081
+ "@config.balanced",
1082
+ " · height 1 for 1 node",
1083
+ ""
1084
+ ]
1085
+ ]
1086
+ ]
1087
+ ],
1088
+ [
1089
+ "do",
1090
+ [
1091
+ "set",
1092
+ "@entity.pending",
1093
+ "@v"
1094
+ ],
1095
+ [
1096
+ "set",
1097
+ "@entity.descending",
1098
+ true
1099
+ ],
1100
+ [
1101
+ "set",
1102
+ "@entity.trail",
1103
+ []
1104
+ ],
1105
+ [
1106
+ "set",
1107
+ "@entity.curId",
1108
+ [
1109
+ "object/get",
1110
+ [
1111
+ "array/first",
1112
+ "@entity.entries"
1113
+ ],
1114
+ "id"
1115
+ ]
1116
+ ],
1117
+ [
1118
+ "set",
1119
+ "@entity.curVal",
1120
+ [
1121
+ "object/get",
1122
+ [
1123
+ "array/first",
1124
+ "@entity.entries"
1125
+ ],
1126
+ "value"
1127
+ ]
1128
+ ],
1129
+ [
1130
+ "set",
1131
+ "@entity.curRank",
1132
+ [
1133
+ "object/get",
1134
+ [
1135
+ "array/first",
1136
+ "@entity.entries"
1137
+ ],
1138
+ "rank"
1139
+ ]
1140
+ ],
1141
+ [
1142
+ "set",
1143
+ "@entity.curRankOffset",
1144
+ 150.0
1145
+ ],
1146
+ [
1147
+ "set",
1148
+ "@entity.depth",
1149
+ 0.0
1150
+ ],
1151
+ [
1152
+ "set",
1153
+ "@entity.cursor",
1154
+ [
1155
+ "+",
1156
+ "@entity.cursor",
1157
+ 1.0
1158
+ ]
1159
+ ],
1160
+ [
1161
+ "set",
1162
+ "@entity.narration",
1163
+ [
1164
+ "str/concat",
1165
+ "insert ",
1166
+ [
1167
+ "str/concat",
1168
+ "",
1169
+ "@v"
1170
+ ],
1171
+ [
1172
+ "if",
1173
+ "@config.showComparisons",
1174
+ " — compare at the root",
1175
+ ""
1176
+ ]
1177
+ ]
1178
+ ]
1179
+ ]
1180
+ ]
1181
+ ],
1182
+ [
1183
+ "let",
1184
+ [
1185
+ [
1186
+ "side",
1187
+ [
1188
+ "if",
1189
+ [
1190
+ "<",
1191
+ "@entity.pending",
1192
+ "@entity.curVal"
1193
+ ],
1194
+ "L",
1195
+ "R"
1196
+ ]
1197
+ ],
1198
+ [
1199
+ "child",
1200
+ [
1201
+ "array/find",
1202
+ "@entity.edges",
1203
+ [
1204
+ "fn",
1205
+ "e",
1206
+ [
1207
+ "and",
1208
+ [
1209
+ "==",
1210
+ [
1211
+ "object/get",
1212
+ "@e",
1213
+ "from"
1214
+ ],
1215
+ "@entity.curId"
1216
+ ],
1217
+ [
1218
+ "==",
1219
+ [
1220
+ "object/get",
1221
+ "@e",
1222
+ "label"
1223
+ ],
1224
+ "@side"
1225
+ ]
1226
+ ]
1227
+ ]
1228
+ ]
1229
+ ],
1230
+ [
1231
+ "newRank",
1232
+ [
1233
+ "if",
1234
+ [
1235
+ "==",
1236
+ "@side",
1237
+ "L"
1238
+ ],
1239
+ [
1240
+ "-",
1241
+ "@entity.curRank",
1242
+ "@entity.curRankOffset"
1243
+ ],
1244
+ [
1245
+ "+",
1246
+ "@entity.curRank",
1247
+ "@entity.curRankOffset"
1248
+ ]
1249
+ ]
1250
+ ],
1251
+ [
1252
+ "newId",
1253
+ [
1254
+ "str/concat",
1255
+ "n",
1256
+ [
1257
+ "str/concat",
1258
+ "",
1259
+ "@entity.count"
1260
+ ]
1261
+ ]
1262
+ ],
1263
+ [
1264
+ "newDepth",
1265
+ [
1266
+ "+",
1267
+ "@entity.depth",
1268
+ 1.0
1269
+ ]
1270
+ ],
1271
+ [
1272
+ "newCount",
1273
+ [
1274
+ "+",
1275
+ "@entity.count",
1276
+ 1.0
1277
+ ]
1278
+ ],
1279
+ [
1280
+ "newMax",
1281
+ [
1282
+ "math/max",
1283
+ "@entity.maxDepth",
1284
+ "@newDepth"
1285
+ ]
1286
+ ],
1287
+ [
1288
+ "cmpText",
1289
+ [
1290
+ "str/concat",
1291
+ [
1292
+ "str/concat",
1293
+ "",
1294
+ "@entity.pending"
1295
+ ],
1296
+ [
1297
+ "if",
1298
+ [
1299
+ "==",
1300
+ "@side",
1301
+ "L"
1302
+ ],
1303
+ " < ",
1304
+ " >= "
1305
+ ],
1306
+ [
1307
+ "str/concat",
1308
+ "",
1309
+ "@entity.curVal"
1310
+ ]
1311
+ ]
1312
+ ]
1313
+ ],
1314
+ [
1315
+ "if",
1316
+ [
1317
+ "==",
1318
+ "@child",
1319
+ null
1320
+ ],
1321
+ [
1322
+ "do",
1323
+ [
1324
+ "set",
1325
+ "@entity.narration",
1326
+ [
1327
+ "str/concat",
1328
+ [
1329
+ "if",
1330
+ "@config.showComparisons",
1331
+ [
1332
+ "str/concat",
1333
+ "@cmpText",
1334
+ " — "
1335
+ ],
1336
+ ""
1337
+ ],
1338
+ "attach ",
1339
+ [
1340
+ "str/concat",
1341
+ "",
1342
+ "@entity.pending"
1343
+ ],
1344
+ " as a leaf",
1345
+ [
1346
+ "if",
1347
+ "@config.balanced",
1348
+ [
1349
+ "str/concat",
1350
+ " · height ",
1351
+ [
1352
+ "str/concat",
1353
+ "",
1354
+ [
1355
+ "+",
1356
+ "@newMax",
1357
+ 1.0
1358
+ ]
1359
+ ],
1360
+ " for ",
1361
+ [
1362
+ "str/concat",
1363
+ "",
1364
+ "@newCount"
1365
+ ],
1366
+ " nodes"
1367
+ ],
1368
+ ""
1369
+ ]
1370
+ ]
1371
+ ],
1372
+ [
1373
+ "set",
1374
+ "@entity.nodes",
1375
+ [
1376
+ "array/append",
1377
+ "@entity.nodes",
1378
+ {
1379
+ "id": "@newId",
1380
+ "label": [
1381
+ "str/concat",
1382
+ "",
1383
+ "@entity.pending"
1384
+ ],
1385
+ "state": "visited"
1386
+ }
1387
+ ]
1388
+ ],
1389
+ [
1390
+ "set",
1391
+ "@entity.edges",
1392
+ [
1393
+ "array/append",
1394
+ "@entity.edges",
1395
+ {
1396
+ "directed": true,
1397
+ "from": "@entity.curId",
1398
+ "label": "@side",
1399
+ "state": "tree",
1400
+ "to": "@newId"
1401
+ }
1402
+ ]
1403
+ ],
1404
+ [
1405
+ "set",
1406
+ "@entity.entries",
1407
+ [
1408
+ "array/append",
1409
+ "@entity.entries",
1410
+ {
1411
+ "id": "@newId",
1412
+ "levelKey": [
1413
+ "+",
1414
+ [
1415
+ "*",
1416
+ "@newDepth",
1417
+ 10000.0
1418
+ ],
1419
+ "@newRank"
1420
+ ],
1421
+ "path": [
1422
+ "str/concat",
1423
+ [
1424
+ "object/get",
1425
+ [
1426
+ "array/find",
1427
+ "@entity.entries",
1428
+ [
1429
+ "fn",
1430
+ "t",
1431
+ [
1432
+ "==",
1433
+ [
1434
+ "object/get",
1435
+ "@t",
1436
+ "id"
1437
+ ],
1438
+ "@entity.curId"
1439
+ ]
1440
+ ]
1441
+ ],
1442
+ "path"
1443
+ ],
1444
+ "@side"
1445
+ ],
1446
+ "rank": "@newRank",
1447
+ "value": "@entity.pending"
1448
+ }
1449
+ ]
1450
+ ],
1451
+ [
1452
+ "set",
1453
+ "@entity.count",
1454
+ "@newCount"
1455
+ ],
1456
+ [
1457
+ "set",
1458
+ "@entity.maxDepth",
1459
+ "@newMax"
1460
+ ],
1461
+ [
1462
+ "set",
1463
+ "@entity.descending",
1464
+ false
1465
+ ],
1466
+ [
1467
+ "set",
1468
+ "@entity.trail",
1469
+ []
1470
+ ]
1471
+ ],
1472
+ [
1473
+ "do",
1474
+ [
1475
+ "set",
1476
+ "@entity.narration",
1477
+ [
1478
+ "str/concat",
1479
+ [
1480
+ "if",
1481
+ "@config.showComparisons",
1482
+ [
1483
+ "str/concat",
1484
+ "@cmpText",
1485
+ " — "
1486
+ ],
1487
+ ""
1488
+ ],
1489
+ "descend ",
1490
+ [
1491
+ "if",
1492
+ [
1493
+ "==",
1494
+ "@side",
1495
+ "L"
1496
+ ],
1497
+ "left",
1498
+ "right"
1499
+ ]
1500
+ ]
1501
+ ],
1502
+ [
1503
+ "set",
1504
+ "@entity.trail",
1505
+ [
1506
+ "array/append",
1507
+ "@entity.trail",
1508
+ "@entity.curId"
1509
+ ]
1510
+ ],
1511
+ [
1512
+ "set",
1513
+ "@entity.curId",
1514
+ [
1515
+ "object/get",
1516
+ "@child",
1517
+ "to"
1518
+ ]
1519
+ ],
1520
+ [
1521
+ "set",
1522
+ "@entity.curVal",
1523
+ [
1524
+ "object/get",
1525
+ [
1526
+ "array/find",
1527
+ "@entity.entries",
1528
+ [
1529
+ "fn",
1530
+ "t",
1531
+ [
1532
+ "==",
1533
+ [
1534
+ "object/get",
1535
+ "@t",
1536
+ "id"
1537
+ ],
1538
+ [
1539
+ "object/get",
1540
+ "@child",
1541
+ "to"
1542
+ ]
1543
+ ]
1544
+ ]
1545
+ ],
1546
+ "value"
1547
+ ]
1548
+ ],
1549
+ [
1550
+ "set",
1551
+ "@entity.curRank",
1552
+ [
1553
+ "object/get",
1554
+ [
1555
+ "array/find",
1556
+ "@entity.entries",
1557
+ [
1558
+ "fn",
1559
+ "t",
1560
+ [
1561
+ "==",
1562
+ [
1563
+ "object/get",
1564
+ "@t",
1565
+ "id"
1566
+ ],
1567
+ [
1568
+ "object/get",
1569
+ "@child",
1570
+ "to"
1571
+ ]
1572
+ ]
1573
+ ]
1574
+ ],
1575
+ "rank"
1576
+ ]
1577
+ ],
1578
+ [
1579
+ "set",
1580
+ "@entity.curRankOffset",
1581
+ [
1582
+ "/",
1583
+ "@entity.curRankOffset",
1584
+ 2.0
1585
+ ]
1586
+ ],
1587
+ [
1588
+ "set",
1589
+ "@entity.depth",
1590
+ "@newDepth"
1591
+ ]
1592
+ ]
1593
+ ]
1594
+ ]
1595
+ ],
1596
+ [
1597
+ "set",
1598
+ "@entity.nodes",
1599
+ [
1600
+ "array/map",
1601
+ "@entity.nodes",
1602
+ [
1603
+ "fn",
1604
+ "n",
1605
+ [
1606
+ "object/merge",
1607
+ "@n",
1608
+ {
1609
+ "state": [
1610
+ "if",
1611
+ [
1612
+ "and",
1613
+ [
1614
+ "==",
1615
+ "@entity.descending",
1616
+ true
1617
+ ],
1618
+ [
1619
+ "==",
1620
+ [
1621
+ "object/get",
1622
+ "@n",
1623
+ "id"
1624
+ ],
1625
+ "@entity.curId"
1626
+ ]
1627
+ ],
1628
+ "current",
1629
+ [
1630
+ "if",
1631
+ [
1632
+ "and",
1633
+ [
1634
+ "==",
1635
+ "@entity.descending",
1636
+ true
1637
+ ],
1638
+ [
1639
+ "array/includes",
1640
+ "@entity.trail",
1641
+ [
1642
+ "object/get",
1643
+ "@n",
1644
+ "id"
1645
+ ]
1646
+ ]
1647
+ ],
1648
+ "frontier",
1649
+ "visited"
1650
+ ]
1651
+ ]
1652
+ }
1653
+ ]
1654
+ ]
1655
+ ]
1656
+ ],
1657
+ [
1658
+ "set",
1659
+ "@entity.edges",
1660
+ [
1661
+ "array/map",
1662
+ "@entity.edges",
1663
+ [
1664
+ "fn",
1665
+ "e",
1666
+ [
1667
+ "object/merge",
1668
+ "@e",
1669
+ {
1670
+ "state": [
1671
+ "if",
1672
+ [
1673
+ "and",
1674
+ [
1675
+ "==",
1676
+ "@entity.descending",
1677
+ true
1678
+ ],
1679
+ [
1680
+ "==",
1681
+ [
1682
+ "object/get",
1683
+ "@e",
1684
+ "from"
1685
+ ],
1686
+ "@entity.curId"
1687
+ ]
1688
+ ],
1689
+ "candidate",
1690
+ "tree"
1691
+ ]
1692
+ }
1693
+ ]
1694
+ ]
1695
+ ]
1696
+ ],
1697
+ [
1698
+ "render-ui",
1699
+ "main",
1700
+ {
1701
+ "children": [
1702
+ {
1703
+ "children": [
1704
+ {
1705
+ "content": "@entity.title",
1706
+ "type": "typography",
1707
+ "variant": "h4"
1708
+ },
1709
+ {
1710
+ "children": [
1711
+ {
1712
+ "action": "INSERT_VALUE",
1713
+ "label": "Insert",
1714
+ "type": "button",
1715
+ "variant": "primary"
1716
+ },
1717
+ {
1718
+ "action": "DELETE_VALUE",
1719
+ "label": "Delete",
1720
+ "type": "button",
1721
+ "variant": "secondary"
1722
+ },
1723
+ {
1724
+ "action": "RUN_TRAVERSAL",
1725
+ "label": "Traverse",
1726
+ "type": "button",
1727
+ "variant": "secondary"
1728
+ },
1729
+ {
1730
+ "action": "TOGGLE_RUN",
1731
+ "label": [
1732
+ "if",
1733
+ "@entity.running",
1734
+ "Pause",
1735
+ "Run"
1736
+ ],
1737
+ "type": "button",
1738
+ "variant": "secondary"
1739
+ },
1740
+ {
1741
+ "action": "RESET",
1742
+ "label": "Reset",
1743
+ "type": "button",
1744
+ "variant": "ghost"
1745
+ }
1746
+ ],
1747
+ "direction": "horizontal",
1748
+ "gap": "sm",
1749
+ "type": "stack"
1750
+ },
1751
+ {
1752
+ "backgroundColor": "@config.backgroundColor",
1753
+ "edges": "@entity.edges",
1754
+ "height": "@config.height",
1755
+ "layout": "tree",
1756
+ "nodes": "@entity.nodes",
1757
+ "root": "n0",
1758
+ "type": "algo-graph-canvas",
1759
+ "width": "@config.width"
1760
+ },
1761
+ {
1762
+ "content": "@entity.narration",
1763
+ "type": "typography",
1764
+ "variant": "body"
1765
+ }
1766
+ ],
1767
+ "direction": "vertical",
1768
+ "gap": "md",
1769
+ "type": "stack"
1770
+ }
1771
+ ],
1772
+ "padding": "md",
1773
+ "type": "box"
1774
+ }
1775
+ ],
1776
+ [
1777
+ "emit",
1778
+ "TREE_UPDATED",
1779
+ {
1780
+ "count": "@entity.count",
1781
+ "edges": "@entity.edges",
1782
+ "narration": "@entity.narration",
1783
+ "nodes": "@entity.nodes"
1784
+ }
1785
+ ]
1786
+ ],
1787
+ "event": "INSERT_VALUE",
1788
+ "eventId": "evt_01M0CG89EJN30MPAE3P0TV5WJZ",
1789
+ "from": "idle",
1790
+ "guard": [
1791
+ "and",
1792
+ [
1793
+ "==",
1794
+ "@entity.active",
1795
+ true
1796
+ ],
1797
+ [
1798
+ "or",
1799
+ "@entity.descending",
1800
+ [
1801
+ "<",
1802
+ "@entity.cursor",
1803
+ [
1804
+ "array/len",
1805
+ "@config.values"
1806
+ ]
1807
+ ]
1808
+ ]
1809
+ ],
1810
+ "to": "idle"
1811
+ },
1812
+ {
1813
+ "effects": [
1814
+ [
1815
+ "let",
1816
+ [
1817
+ [
1818
+ "lastId",
1819
+ [
1820
+ "object/get",
1821
+ [
1822
+ "array/last",
1823
+ "@entity.entries"
1824
+ ],
1825
+ "id"
1826
+ ]
1827
+ ],
1828
+ [
1829
+ "lastVal",
1830
+ [
1831
+ "object/get",
1832
+ [
1833
+ "array/last",
1834
+ "@entity.entries"
1835
+ ],
1836
+ "value"
1837
+ ]
1838
+ ]
1839
+ ],
1840
+ [
1841
+ "do",
1842
+ [
1843
+ "set",
1844
+ "@entity.nodes",
1845
+ [
1846
+ "array/filter",
1847
+ "@entity.nodes",
1848
+ [
1849
+ "fn",
1850
+ "n",
1851
+ [
1852
+ "!=",
1853
+ [
1854
+ "object/get",
1855
+ "@n",
1856
+ "id"
1857
+ ],
1858
+ "@lastId"
1859
+ ]
1860
+ ]
1861
+ ]
1862
+ ],
1863
+ [
1864
+ "set",
1865
+ "@entity.edges",
1866
+ [
1867
+ "array/filter",
1868
+ "@entity.edges",
1869
+ [
1870
+ "fn",
1871
+ "e",
1872
+ [
1873
+ "and",
1874
+ [
1875
+ "!=",
1876
+ [
1877
+ "object/get",
1878
+ "@e",
1879
+ "to"
1880
+ ],
1881
+ "@lastId"
1882
+ ],
1883
+ [
1884
+ "!=",
1885
+ [
1886
+ "object/get",
1887
+ "@e",
1888
+ "from"
1889
+ ],
1890
+ "@lastId"
1891
+ ]
1892
+ ]
1893
+ ]
1894
+ ]
1895
+ ],
1896
+ [
1897
+ "set",
1898
+ "@entity.entries",
1899
+ [
1900
+ "array/filter",
1901
+ "@entity.entries",
1902
+ [
1903
+ "fn",
1904
+ "t",
1905
+ [
1906
+ "!=",
1907
+ [
1908
+ "object/get",
1909
+ "@t",
1910
+ "id"
1911
+ ],
1912
+ "@lastId"
1913
+ ]
1914
+ ]
1915
+ ]
1916
+ ],
1917
+ [
1918
+ "set",
1919
+ "@entity.count",
1920
+ [
1921
+ "-",
1922
+ "@entity.count",
1923
+ 1.0
1924
+ ]
1925
+ ],
1926
+ [
1927
+ "set",
1928
+ "@entity.cursor",
1929
+ [
1930
+ "math/max",
1931
+ [
1932
+ "-",
1933
+ "@entity.cursor",
1934
+ 1.0
1935
+ ],
1936
+ 0.0
1937
+ ]
1938
+ ],
1939
+ [
1940
+ "set",
1941
+ "@entity.descending",
1942
+ false
1943
+ ],
1944
+ [
1945
+ "set",
1946
+ "@entity.trail",
1947
+ []
1948
+ ],
1949
+ [
1950
+ "set",
1951
+ "@entity.traversing",
1952
+ false
1953
+ ],
1954
+ [
1955
+ "set",
1956
+ "@entity.traversalOrder",
1957
+ []
1958
+ ],
1959
+ [
1960
+ "set",
1961
+ "@entity.sweptIds",
1962
+ []
1963
+ ],
1964
+ [
1965
+ "set",
1966
+ "@entity.done",
1967
+ false
1968
+ ],
1969
+ [
1970
+ "set",
1971
+ "@entity.narration",
1972
+ [
1973
+ "str/concat",
1974
+ "remove ",
1975
+ [
1976
+ "str/concat",
1977
+ "",
1978
+ "@lastVal"
1979
+ ],
1980
+ " — the most recently inserted value (undo); press Insert to re-insert"
1981
+ ]
1982
+ ]
1983
+ ]
1984
+ ],
1985
+ [
1986
+ "set",
1987
+ "@entity.nodes",
1988
+ [
1989
+ "array/map",
1990
+ "@entity.nodes",
1991
+ [
1992
+ "fn",
1993
+ "n",
1994
+ [
1995
+ "object/merge",
1996
+ "@n",
1997
+ {
1998
+ "state": "visited"
1999
+ }
2000
+ ]
2001
+ ]
2002
+ ]
2003
+ ],
2004
+ [
2005
+ "set",
2006
+ "@entity.edges",
2007
+ [
2008
+ "array/map",
2009
+ "@entity.edges",
2010
+ [
2011
+ "fn",
2012
+ "e",
2013
+ [
2014
+ "object/merge",
2015
+ "@e",
2016
+ {
2017
+ "state": "tree"
2018
+ }
2019
+ ]
2020
+ ]
2021
+ ]
2022
+ ],
2023
+ [
2024
+ "render-ui",
2025
+ "main",
2026
+ {
2027
+ "children": [
2028
+ {
2029
+ "children": [
2030
+ {
2031
+ "content": "@entity.title",
2032
+ "type": "typography",
2033
+ "variant": "h4"
2034
+ },
2035
+ {
2036
+ "children": [
2037
+ {
2038
+ "action": "INSERT_VALUE",
2039
+ "label": "Insert",
2040
+ "type": "button",
2041
+ "variant": "primary"
2042
+ },
2043
+ {
2044
+ "action": "DELETE_VALUE",
2045
+ "label": "Delete",
2046
+ "type": "button",
2047
+ "variant": "secondary"
2048
+ },
2049
+ {
2050
+ "action": "RUN_TRAVERSAL",
2051
+ "label": "Traverse",
2052
+ "type": "button",
2053
+ "variant": "secondary"
2054
+ },
2055
+ {
2056
+ "action": "TOGGLE_RUN",
2057
+ "label": [
2058
+ "if",
2059
+ "@entity.running",
2060
+ "Pause",
2061
+ "Run"
2062
+ ],
2063
+ "type": "button",
2064
+ "variant": "secondary"
2065
+ },
2066
+ {
2067
+ "action": "RESET",
2068
+ "label": "Reset",
2069
+ "type": "button",
2070
+ "variant": "ghost"
2071
+ }
2072
+ ],
2073
+ "direction": "horizontal",
2074
+ "gap": "sm",
2075
+ "type": "stack"
2076
+ },
2077
+ {
2078
+ "backgroundColor": "@config.backgroundColor",
2079
+ "edges": "@entity.edges",
2080
+ "height": "@config.height",
2081
+ "layout": "tree",
2082
+ "nodes": "@entity.nodes",
2083
+ "root": "n0",
2084
+ "type": "algo-graph-canvas",
2085
+ "width": "@config.width"
2086
+ },
2087
+ {
2088
+ "content": "@entity.narration",
2089
+ "type": "typography",
2090
+ "variant": "body"
2091
+ }
2092
+ ],
2093
+ "direction": "vertical",
2094
+ "gap": "md",
2095
+ "type": "stack"
2096
+ }
2097
+ ],
2098
+ "padding": "md",
2099
+ "type": "box"
2100
+ }
2101
+ ],
2102
+ [
2103
+ "emit",
2104
+ "TREE_UPDATED",
2105
+ {
2106
+ "count": "@entity.count",
2107
+ "edges": "@entity.edges",
2108
+ "narration": "@entity.narration",
2109
+ "nodes": "@entity.nodes"
2110
+ }
2111
+ ]
2112
+ ],
2113
+ "event": "DELETE_VALUE",
2114
+ "eventId": "evt_01M0CG89EJ7K1E8SZDFQ82DVNR",
2115
+ "from": "idle",
2116
+ "guard": [
2117
+ "and",
2118
+ [
2119
+ "==",
2120
+ "@entity.active",
2121
+ true
2122
+ ],
2123
+ [
2124
+ ">",
2125
+ "@entity.count",
2126
+ 0.0
2127
+ ]
2128
+ ],
2129
+ "to": "idle"
2130
+ },
2131
+ {
2132
+ "effects": [
2133
+ [
2134
+ "if",
2135
+ [
2136
+ "or",
2137
+ [
2138
+ "==",
2139
+ "@entity.traversing",
2140
+ false
2141
+ ],
2142
+ [
2143
+ "==",
2144
+ "@entity.done",
2145
+ true
2146
+ ]
2147
+ ],
2148
+ [
2149
+ "let",
2150
+ [
2151
+ [
2152
+ "order",
2153
+ [
2154
+ "if",
2155
+ [
2156
+ "==",
2157
+ "@config.traversalKind",
2158
+ "preorder"
2159
+ ],
2160
+ [
2161
+ "array/map",
2162
+ [
2163
+ "array/sort",
2164
+ "@entity.entries",
2165
+ "path",
2166
+ "asc"
2167
+ ],
2168
+ [
2169
+ "fn",
2170
+ "t",
2171
+ [
2172
+ "object/get",
2173
+ "@t",
2174
+ "id"
2175
+ ]
2176
+ ]
2177
+ ],
2178
+ [
2179
+ "if",
2180
+ [
2181
+ "==",
2182
+ "@config.traversalKind",
2183
+ "levelorder"
2184
+ ],
2185
+ [
2186
+ "array/map",
2187
+ [
2188
+ "array/sort",
2189
+ "@entity.entries",
2190
+ "levelKey",
2191
+ "asc"
2192
+ ],
2193
+ [
2194
+ "fn",
2195
+ "t",
2196
+ [
2197
+ "object/get",
2198
+ "@t",
2199
+ "id"
2200
+ ]
2201
+ ]
2202
+ ],
2203
+ [
2204
+ "array/map",
2205
+ [
2206
+ "array/sort",
2207
+ "@entity.entries",
2208
+ "value",
2209
+ "asc"
2210
+ ],
2211
+ [
2212
+ "fn",
2213
+ "t",
2214
+ [
2215
+ "object/get",
2216
+ "@t",
2217
+ "id"
2218
+ ]
2219
+ ]
2220
+ ]
2221
+ ]
2222
+ ]
2223
+ ],
2224
+ [
2225
+ "firstId",
2226
+ [
2227
+ "array/first",
2228
+ "@order"
2229
+ ]
2230
+ ]
2231
+ ],
2232
+ [
2233
+ "let",
2234
+ [
2235
+ [
2236
+ "firstVal",
2237
+ [
2238
+ "object/get",
2239
+ [
2240
+ "array/find",
2241
+ "@entity.entries",
2242
+ [
2243
+ "fn",
2244
+ "t",
2245
+ [
2246
+ "==",
2247
+ [
2248
+ "object/get",
2249
+ "@t",
2250
+ "id"
2251
+ ],
2252
+ "@firstId"
2253
+ ]
2254
+ ]
2255
+ ],
2256
+ "value"
2257
+ ]
2258
+ ]
2259
+ ],
2260
+ [
2261
+ "do",
2262
+ [
2263
+ "set",
2264
+ "@entity.traversalOrder",
2265
+ "@order"
2266
+ ],
2267
+ [
2268
+ "set",
2269
+ "@entity.sweptIds",
2270
+ [
2271
+ "@firstId"
2272
+ ]
2273
+ ],
2274
+ [
2275
+ "set",
2276
+ "@entity.traversing",
2277
+ true
2278
+ ],
2279
+ [
2280
+ "set",
2281
+ "@entity.done",
2282
+ [
2283
+ "==",
2284
+ [
2285
+ "array/len",
2286
+ "@order"
2287
+ ],
2288
+ 1.0
2289
+ ]
2290
+ ],
2291
+ [
2292
+ "set",
2293
+ "@entity.narration",
2294
+ [
2295
+ "str/concat",
2296
+ "@config.traversalKind",
2297
+ " traversal — visiting order so far: ",
2298
+ [
2299
+ "str/concat",
2300
+ "",
2301
+ "@firstVal"
2302
+ ]
2303
+ ]
2304
+ ]
2305
+ ]
2306
+ ]
2307
+ ],
2308
+ [
2309
+ "let",
2310
+ [
2311
+ [
2312
+ "nextId",
2313
+ [
2314
+ "array/nth",
2315
+ "@entity.traversalOrder",
2316
+ [
2317
+ "array/len",
2318
+ "@entity.sweptIds"
2319
+ ]
2320
+ ]
2321
+ ]
2322
+ ],
2323
+ [
2324
+ "let",
2325
+ [
2326
+ [
2327
+ "newSwept",
2328
+ [
2329
+ "array/append",
2330
+ "@entity.sweptIds",
2331
+ "@nextId"
2332
+ ]
2333
+ ]
2334
+ ],
2335
+ [
2336
+ "do",
2337
+ [
2338
+ "set",
2339
+ "@entity.sweptIds",
2340
+ "@newSwept"
2341
+ ],
2342
+ [
2343
+ "set",
2344
+ "@entity.done",
2345
+ [
2346
+ ">=",
2347
+ [
2348
+ "array/len",
2349
+ "@newSwept"
2350
+ ],
2351
+ [
2352
+ "array/len",
2353
+ "@entity.traversalOrder"
2354
+ ]
2355
+ ]
2356
+ ],
2357
+ [
2358
+ "set",
2359
+ "@entity.narration",
2360
+ [
2361
+ "str/concat",
2362
+ "@config.traversalKind",
2363
+ " traversal — visiting order so far: ",
2364
+ [
2365
+ "str/join",
2366
+ [
2367
+ "array/map",
2368
+ "@newSwept",
2369
+ [
2370
+ "fn",
2371
+ "sid",
2372
+ [
2373
+ "str/concat",
2374
+ "",
2375
+ [
2376
+ "object/get",
2377
+ [
2378
+ "array/find",
2379
+ "@entity.entries",
2380
+ [
2381
+ "fn",
2382
+ "t",
2383
+ [
2384
+ "==",
2385
+ [
2386
+ "object/get",
2387
+ "@t",
2388
+ "id"
2389
+ ],
2390
+ "@sid"
2391
+ ]
2392
+ ]
2393
+ ],
2394
+ "value"
2395
+ ]
2396
+ ]
2397
+ ]
2398
+ ],
2399
+ ", "
2400
+ ]
2401
+ ]
2402
+ ]
2403
+ ]
2404
+ ]
2405
+ ]
2406
+ ],
2407
+ [
2408
+ "set",
2409
+ "@entity.nodes",
2410
+ [
2411
+ "array/map",
2412
+ "@entity.nodes",
2413
+ [
2414
+ "fn",
2415
+ "n",
2416
+ [
2417
+ "object/merge",
2418
+ "@n",
2419
+ {
2420
+ "state": [
2421
+ "if",
2422
+ [
2423
+ "and",
2424
+ [
2425
+ "==",
2426
+ "@entity.traversing",
2427
+ true
2428
+ ],
2429
+ [
2430
+ "array/includes",
2431
+ "@entity.sweptIds",
2432
+ [
2433
+ "object/get",
2434
+ "@n",
2435
+ "id"
2436
+ ]
2437
+ ]
2438
+ ],
2439
+ "path",
2440
+ "visited"
2441
+ ]
2442
+ }
2443
+ ]
2444
+ ]
2445
+ ]
2446
+ ],
2447
+ [
2448
+ "set",
2449
+ "@entity.edges",
2450
+ [
2451
+ "array/map",
2452
+ "@entity.edges",
2453
+ [
2454
+ "fn",
2455
+ "e",
2456
+ [
2457
+ "object/merge",
2458
+ "@e",
2459
+ {
2460
+ "state": "tree"
2461
+ }
2462
+ ]
2463
+ ]
2464
+ ]
2465
+ ],
2466
+ [
2467
+ "render-ui",
2468
+ "main",
2469
+ {
2470
+ "children": [
2471
+ {
2472
+ "children": [
2473
+ {
2474
+ "content": "@entity.title",
2475
+ "type": "typography",
2476
+ "variant": "h4"
2477
+ },
2478
+ {
2479
+ "children": [
2480
+ {
2481
+ "action": "INSERT_VALUE",
2482
+ "label": "Insert",
2483
+ "type": "button",
2484
+ "variant": "primary"
2485
+ },
2486
+ {
2487
+ "action": "DELETE_VALUE",
2488
+ "label": "Delete",
2489
+ "type": "button",
2490
+ "variant": "secondary"
2491
+ },
2492
+ {
2493
+ "action": "RUN_TRAVERSAL",
2494
+ "label": "Traverse",
2495
+ "type": "button",
2496
+ "variant": "secondary"
2497
+ },
2498
+ {
2499
+ "action": "TOGGLE_RUN",
2500
+ "label": [
2501
+ "if",
2502
+ "@entity.running",
2503
+ "Pause",
2504
+ "Run"
2505
+ ],
2506
+ "type": "button",
2507
+ "variant": "secondary"
2508
+ },
2509
+ {
2510
+ "action": "RESET",
2511
+ "label": "Reset",
2512
+ "type": "button",
2513
+ "variant": "ghost"
2514
+ }
2515
+ ],
2516
+ "direction": "horizontal",
2517
+ "gap": "sm",
2518
+ "type": "stack"
2519
+ },
2520
+ {
2521
+ "backgroundColor": "@config.backgroundColor",
2522
+ "edges": "@entity.edges",
2523
+ "height": "@config.height",
2524
+ "layout": "tree",
2525
+ "nodes": "@entity.nodes",
2526
+ "root": "n0",
2527
+ "type": "algo-graph-canvas",
2528
+ "width": "@config.width"
2529
+ },
2530
+ {
2531
+ "content": "@entity.narration",
2532
+ "type": "typography",
2533
+ "variant": "body"
2534
+ }
2535
+ ],
2536
+ "direction": "vertical",
2537
+ "gap": "md",
2538
+ "type": "stack"
2539
+ }
2540
+ ],
2541
+ "padding": "md",
2542
+ "type": "box"
2543
+ }
2544
+ ],
2545
+ [
2546
+ "emit",
2547
+ "TREE_UPDATED",
2548
+ {
2549
+ "count": "@entity.count",
2550
+ "edges": "@entity.edges",
2551
+ "narration": "@entity.narration",
2552
+ "nodes": "@entity.nodes"
2553
+ }
2554
+ ]
2555
+ ],
2556
+ "event": "RUN_TRAVERSAL",
2557
+ "eventId": "evt_01M0CG89EJ07EX792Y5KXECNYT",
2558
+ "from": "idle",
2559
+ "guard": [
2560
+ "and",
2561
+ [
2562
+ "==",
2563
+ "@entity.active",
2564
+ true
2565
+ ],
2566
+ [
2567
+ ">",
2568
+ "@entity.count",
2569
+ 0.0
2570
+ ]
2571
+ ],
2572
+ "to": "idle"
2573
+ },
2574
+ {
2575
+ "effects": [
2576
+ [
2577
+ "set",
2578
+ "@entity.running",
2579
+ [
2580
+ "not",
2581
+ "@entity.running"
2582
+ ]
2583
+ ],
2584
+ [
2585
+ "set",
2586
+ "@entity.narration",
2587
+ [
2588
+ "if",
2589
+ "@entity.running",
2590
+ "Auto-stepping the traversal — tick sweeps one node at a time.",
2591
+ "Paused — step the traversal manually with Traverse."
2592
+ ]
2593
+ ],
2594
+ [
2595
+ "render-ui",
2596
+ "main",
2597
+ {
2598
+ "children": [
2599
+ {
2600
+ "children": [
2601
+ {
2602
+ "content": "@entity.title",
2603
+ "type": "typography",
2604
+ "variant": "h4"
2605
+ },
2606
+ {
2607
+ "children": [
2608
+ {
2609
+ "action": "INSERT_VALUE",
2610
+ "label": "Insert",
2611
+ "type": "button",
2612
+ "variant": "primary"
2613
+ },
2614
+ {
2615
+ "action": "DELETE_VALUE",
2616
+ "label": "Delete",
2617
+ "type": "button",
2618
+ "variant": "secondary"
2619
+ },
2620
+ {
2621
+ "action": "RUN_TRAVERSAL",
2622
+ "label": "Traverse",
2623
+ "type": "button",
2624
+ "variant": "secondary"
2625
+ },
2626
+ {
2627
+ "action": "TOGGLE_RUN",
2628
+ "label": [
2629
+ "if",
2630
+ "@entity.running",
2631
+ "Pause",
2632
+ "Run"
2633
+ ],
2634
+ "type": "button",
2635
+ "variant": "secondary"
2636
+ },
2637
+ {
2638
+ "action": "RESET",
2639
+ "label": "Reset",
2640
+ "type": "button",
2641
+ "variant": "ghost"
2642
+ }
2643
+ ],
2644
+ "direction": "horizontal",
2645
+ "gap": "sm",
2646
+ "type": "stack"
2647
+ },
2648
+ {
2649
+ "backgroundColor": "@config.backgroundColor",
2650
+ "edges": "@entity.edges",
2651
+ "height": "@config.height",
2652
+ "layout": "tree",
2653
+ "nodes": "@entity.nodes",
2654
+ "root": "n0",
2655
+ "type": "algo-graph-canvas",
2656
+ "width": "@config.width"
2657
+ },
2658
+ {
2659
+ "content": "@entity.narration",
2660
+ "type": "typography",
2661
+ "variant": "body"
2662
+ }
2663
+ ],
2664
+ "direction": "vertical",
2665
+ "gap": "md",
2666
+ "type": "stack"
2667
+ }
2668
+ ],
2669
+ "padding": "md",
2670
+ "type": "box"
2671
+ }
2672
+ ],
2673
+ [
2674
+ "emit",
2675
+ "TREE_UPDATED",
2676
+ {
2677
+ "count": "@entity.count",
2678
+ "edges": "@entity.edges",
2679
+ "narration": "@entity.narration",
2680
+ "nodes": "@entity.nodes"
2681
+ }
2682
+ ]
2683
+ ],
2684
+ "event": "TOGGLE_RUN",
2685
+ "eventId": "evt_01M0CG89EJ8JM60CBEG6EGKE9T",
2686
+ "from": "idle",
2687
+ "guard": [
2688
+ "==",
2689
+ "@entity.active",
2690
+ true
2691
+ ],
2692
+ "to": "idle"
2693
+ },
2694
+ {
2695
+ "effects": [
2696
+ [
2697
+ "set",
2698
+ "@entity.nodes",
2699
+ []
2700
+ ],
2701
+ [
2702
+ "set",
2703
+ "@entity.edges",
2704
+ []
2705
+ ],
2706
+ [
2707
+ "set",
2708
+ "@entity.entries",
2709
+ []
2710
+ ],
2711
+ [
2712
+ "set",
2713
+ "@entity.cursor",
2714
+ 0.0
2715
+ ],
2716
+ [
2717
+ "set",
2718
+ "@entity.descending",
2719
+ false
2720
+ ],
2721
+ [
2722
+ "set",
2723
+ "@entity.trail",
2724
+ []
2725
+ ],
2726
+ [
2727
+ "set",
2728
+ "@entity.depth",
2729
+ 0.0
2730
+ ],
2731
+ [
2732
+ "set",
2733
+ "@entity.maxDepth",
2734
+ 0.0
2735
+ ],
2736
+ [
2737
+ "set",
2738
+ "@entity.count",
2739
+ 0.0
2740
+ ],
2741
+ [
2742
+ "set",
2743
+ "@entity.traversing",
2744
+ false
2745
+ ],
2746
+ [
2747
+ "set",
2748
+ "@entity.traversalOrder",
2749
+ []
2750
+ ],
2751
+ [
2752
+ "set",
2753
+ "@entity.sweptIds",
2754
+ []
2755
+ ],
2756
+ [
2757
+ "set",
2758
+ "@entity.done",
2759
+ false
2760
+ ],
2761
+ [
2762
+ "set",
2763
+ "@entity.running",
2764
+ "@config.autoRun"
2765
+ ],
2766
+ [
2767
+ "set",
2768
+ "@entity.narration",
2769
+ "Press Insert to add the next value; keep pressing to watch it descend."
2770
+ ],
2771
+ [
2772
+ "render-ui",
2773
+ "main",
2774
+ {
2775
+ "children": [
2776
+ {
2777
+ "children": [
2778
+ {
2779
+ "content": "@entity.title",
2780
+ "type": "typography",
2781
+ "variant": "h4"
2782
+ },
2783
+ {
2784
+ "children": [
2785
+ {
2786
+ "action": "INSERT_VALUE",
2787
+ "label": "Insert",
2788
+ "type": "button",
2789
+ "variant": "primary"
2790
+ },
2791
+ {
2792
+ "action": "DELETE_VALUE",
2793
+ "label": "Delete",
2794
+ "type": "button",
2795
+ "variant": "secondary"
2796
+ },
2797
+ {
2798
+ "action": "RUN_TRAVERSAL",
2799
+ "label": "Traverse",
2800
+ "type": "button",
2801
+ "variant": "secondary"
2802
+ },
2803
+ {
2804
+ "action": "TOGGLE_RUN",
2805
+ "label": [
2806
+ "if",
2807
+ "@entity.running",
2808
+ "Pause",
2809
+ "Run"
2810
+ ],
2811
+ "type": "button",
2812
+ "variant": "secondary"
2813
+ },
2814
+ {
2815
+ "action": "RESET",
2816
+ "label": "Reset",
2817
+ "type": "button",
2818
+ "variant": "ghost"
2819
+ }
2820
+ ],
2821
+ "direction": "horizontal",
2822
+ "gap": "sm",
2823
+ "type": "stack"
2824
+ },
2825
+ {
2826
+ "backgroundColor": "@config.backgroundColor",
2827
+ "edges": "@entity.edges",
2828
+ "height": "@config.height",
2829
+ "layout": "tree",
2830
+ "nodes": "@entity.nodes",
2831
+ "root": "n0",
2832
+ "type": "algo-graph-canvas",
2833
+ "width": "@config.width"
2834
+ },
2835
+ {
2836
+ "content": "@entity.narration",
2837
+ "type": "typography",
2838
+ "variant": "body"
2839
+ }
2840
+ ],
2841
+ "direction": "vertical",
2842
+ "gap": "md",
2843
+ "type": "stack"
2844
+ }
2845
+ ],
2846
+ "padding": "md",
2847
+ "type": "box"
2848
+ }
2849
+ ],
2850
+ [
2851
+ "emit",
2852
+ "TREE_UPDATED",
2853
+ {
2854
+ "count": "@entity.count",
2855
+ "edges": "@entity.edges",
2856
+ "narration": "@entity.narration",
2857
+ "nodes": "@entity.nodes"
2858
+ }
2859
+ ]
2860
+ ],
2861
+ "event": "RESET",
2862
+ "eventId": "evt_01M0CG89EJFCW46TEMK50BZ8BT",
2863
+ "from": "idle",
2864
+ "guard": [
2865
+ "==",
2866
+ "@entity.active",
2867
+ true
2868
+ ],
2869
+ "to": "idle"
2870
+ }
2871
+ ]
2872
+ },
2873
+ "ticks": [
2874
+ {
2875
+ "effects": [
2876
+ [
2877
+ "if",
2878
+ [
2879
+ "or",
2880
+ [
2881
+ "==",
2882
+ "@entity.traversing",
2883
+ false
2884
+ ],
2885
+ [
2886
+ "==",
2887
+ "@entity.done",
2888
+ true
2889
+ ]
2890
+ ],
2891
+ [
2892
+ "let",
2893
+ [
2894
+ [
2895
+ "order",
2896
+ [
2897
+ "if",
2898
+ [
2899
+ "==",
2900
+ "@config.traversalKind",
2901
+ "preorder"
2902
+ ],
2903
+ [
2904
+ "array/map",
2905
+ [
2906
+ "array/sort",
2907
+ "@entity.entries",
2908
+ "path",
2909
+ "asc"
2910
+ ],
2911
+ [
2912
+ "fn",
2913
+ "t",
2914
+ [
2915
+ "object/get",
2916
+ "@t",
2917
+ "id"
2918
+ ]
2919
+ ]
2920
+ ],
2921
+ [
2922
+ "if",
2923
+ [
2924
+ "==",
2925
+ "@config.traversalKind",
2926
+ "levelorder"
2927
+ ],
2928
+ [
2929
+ "array/map",
2930
+ [
2931
+ "array/sort",
2932
+ "@entity.entries",
2933
+ "levelKey",
2934
+ "asc"
2935
+ ],
2936
+ [
2937
+ "fn",
2938
+ "t",
2939
+ [
2940
+ "object/get",
2941
+ "@t",
2942
+ "id"
2943
+ ]
2944
+ ]
2945
+ ],
2946
+ [
2947
+ "array/map",
2948
+ [
2949
+ "array/sort",
2950
+ "@entity.entries",
2951
+ "value",
2952
+ "asc"
2953
+ ],
2954
+ [
2955
+ "fn",
2956
+ "t",
2957
+ [
2958
+ "object/get",
2959
+ "@t",
2960
+ "id"
2961
+ ]
2962
+ ]
2963
+ ]
2964
+ ]
2965
+ ]
2966
+ ],
2967
+ [
2968
+ "firstId",
2969
+ [
2970
+ "array/first",
2971
+ "@order"
2972
+ ]
2973
+ ]
2974
+ ],
2975
+ [
2976
+ "let",
2977
+ [
2978
+ [
2979
+ "firstVal",
2980
+ [
2981
+ "object/get",
2982
+ [
2983
+ "array/find",
2984
+ "@entity.entries",
2985
+ [
2986
+ "fn",
2987
+ "t",
2988
+ [
2989
+ "==",
2990
+ [
2991
+ "object/get",
2992
+ "@t",
2993
+ "id"
2994
+ ],
2995
+ "@firstId"
2996
+ ]
2997
+ ]
2998
+ ],
2999
+ "value"
3000
+ ]
3001
+ ]
3002
+ ],
3003
+ [
3004
+ "do",
3005
+ [
3006
+ "set",
3007
+ "@entity.traversalOrder",
3008
+ "@order"
3009
+ ],
3010
+ [
3011
+ "set",
3012
+ "@entity.sweptIds",
3013
+ [
3014
+ "@firstId"
3015
+ ]
3016
+ ],
3017
+ [
3018
+ "set",
3019
+ "@entity.traversing",
3020
+ true
3021
+ ],
3022
+ [
3023
+ "set",
3024
+ "@entity.done",
3025
+ [
3026
+ "==",
3027
+ [
3028
+ "array/len",
3029
+ "@order"
3030
+ ],
3031
+ 1.0
3032
+ ]
3033
+ ],
3034
+ [
3035
+ "set",
3036
+ "@entity.narration",
3037
+ [
3038
+ "str/concat",
3039
+ "@config.traversalKind",
3040
+ " traversal — visiting order so far: ",
3041
+ [
3042
+ "str/concat",
3043
+ "",
3044
+ "@firstVal"
3045
+ ]
3046
+ ]
3047
+ ]
3048
+ ]
3049
+ ]
3050
+ ],
3051
+ [
3052
+ "let",
3053
+ [
3054
+ [
3055
+ "nextId",
3056
+ [
3057
+ "array/nth",
3058
+ "@entity.traversalOrder",
3059
+ [
3060
+ "array/len",
3061
+ "@entity.sweptIds"
3062
+ ]
3063
+ ]
3064
+ ]
3065
+ ],
3066
+ [
3067
+ "let",
3068
+ [
3069
+ [
3070
+ "newSwept",
3071
+ [
3072
+ "array/append",
3073
+ "@entity.sweptIds",
3074
+ "@nextId"
3075
+ ]
3076
+ ]
3077
+ ],
3078
+ [
3079
+ "do",
3080
+ [
3081
+ "set",
3082
+ "@entity.sweptIds",
3083
+ "@newSwept"
3084
+ ],
3085
+ [
3086
+ "set",
3087
+ "@entity.done",
3088
+ [
3089
+ ">=",
3090
+ [
3091
+ "array/len",
3092
+ "@newSwept"
3093
+ ],
3094
+ [
3095
+ "array/len",
3096
+ "@entity.traversalOrder"
3097
+ ]
3098
+ ]
3099
+ ],
3100
+ [
3101
+ "set",
3102
+ "@entity.narration",
3103
+ [
3104
+ "str/concat",
3105
+ "@config.traversalKind",
3106
+ " traversal — visiting order so far: ",
3107
+ [
3108
+ "str/join",
3109
+ [
3110
+ "array/map",
3111
+ "@newSwept",
3112
+ [
3113
+ "fn",
3114
+ "sid",
3115
+ [
3116
+ "str/concat",
3117
+ "",
3118
+ [
3119
+ "object/get",
3120
+ [
3121
+ "array/find",
3122
+ "@entity.entries",
3123
+ [
3124
+ "fn",
3125
+ "t",
3126
+ [
3127
+ "==",
3128
+ [
3129
+ "object/get",
3130
+ "@t",
3131
+ "id"
3132
+ ],
3133
+ "@sid"
3134
+ ]
3135
+ ]
3136
+ ],
3137
+ "value"
3138
+ ]
3139
+ ]
3140
+ ]
3141
+ ],
3142
+ ", "
3143
+ ]
3144
+ ]
3145
+ ]
3146
+ ]
3147
+ ]
3148
+ ]
3149
+ ],
3150
+ [
3151
+ "set",
3152
+ "@entity.nodes",
3153
+ [
3154
+ "array/map",
3155
+ "@entity.nodes",
3156
+ [
3157
+ "fn",
3158
+ "n",
3159
+ [
3160
+ "object/merge",
3161
+ "@n",
3162
+ {
3163
+ "state": [
3164
+ "if",
3165
+ [
3166
+ "and",
3167
+ [
3168
+ "==",
3169
+ "@entity.traversing",
3170
+ true
3171
+ ],
3172
+ [
3173
+ "array/includes",
3174
+ "@entity.sweptIds",
3175
+ [
3176
+ "object/get",
3177
+ "@n",
3178
+ "id"
3179
+ ]
3180
+ ]
3181
+ ],
3182
+ "path",
3183
+ "visited"
3184
+ ]
3185
+ }
3186
+ ]
3187
+ ]
3188
+ ]
3189
+ ],
3190
+ [
3191
+ "set",
3192
+ "@entity.edges",
3193
+ [
3194
+ "array/map",
3195
+ "@entity.edges",
3196
+ [
3197
+ "fn",
3198
+ "e",
3199
+ [
3200
+ "object/merge",
3201
+ "@e",
3202
+ {
3203
+ "state": "tree"
3204
+ }
3205
+ ]
3206
+ ]
3207
+ ]
3208
+ ],
3209
+ [
3210
+ "render-ui",
3211
+ "main",
3212
+ {
3213
+ "children": [
3214
+ {
3215
+ "children": [
3216
+ {
3217
+ "content": "@entity.title",
3218
+ "type": "typography",
3219
+ "variant": "h4"
3220
+ },
3221
+ {
3222
+ "children": [
3223
+ {
3224
+ "action": "INSERT_VALUE",
3225
+ "label": "Insert",
3226
+ "type": "button",
3227
+ "variant": "primary"
3228
+ },
3229
+ {
3230
+ "action": "DELETE_VALUE",
3231
+ "label": "Delete",
3232
+ "type": "button",
3233
+ "variant": "secondary"
3234
+ },
3235
+ {
3236
+ "action": "RUN_TRAVERSAL",
3237
+ "label": "Traverse",
3238
+ "type": "button",
3239
+ "variant": "secondary"
3240
+ },
3241
+ {
3242
+ "action": "TOGGLE_RUN",
3243
+ "label": [
3244
+ "if",
3245
+ "@entity.running",
3246
+ "Pause",
3247
+ "Run"
3248
+ ],
3249
+ "type": "button",
3250
+ "variant": "secondary"
3251
+ },
3252
+ {
3253
+ "action": "RESET",
3254
+ "label": "Reset",
3255
+ "type": "button",
3256
+ "variant": "ghost"
3257
+ }
3258
+ ],
3259
+ "direction": "horizontal",
3260
+ "gap": "sm",
3261
+ "type": "stack"
3262
+ },
3263
+ {
3264
+ "backgroundColor": "@config.backgroundColor",
3265
+ "edges": "@entity.edges",
3266
+ "height": "@config.height",
3267
+ "layout": "tree",
3268
+ "nodes": "@entity.nodes",
3269
+ "root": "n0",
3270
+ "type": "algo-graph-canvas",
3271
+ "width": "@config.width"
3272
+ },
3273
+ {
3274
+ "content": "@entity.narration",
3275
+ "type": "typography",
3276
+ "variant": "body"
3277
+ }
3278
+ ],
3279
+ "direction": "vertical",
3280
+ "gap": "md",
3281
+ "type": "stack"
3282
+ }
3283
+ ],
3284
+ "padding": "md",
3285
+ "type": "box"
3286
+ }
3287
+ ],
3288
+ [
3289
+ "emit",
3290
+ "TREE_UPDATED",
3291
+ {
3292
+ "count": "@entity.count",
3293
+ "edges": "@entity.edges",
3294
+ "narration": "@entity.narration",
3295
+ "nodes": "@entity.nodes"
3296
+ }
3297
+ ]
3298
+ ],
3299
+ "guard": [
3300
+ "and",
3301
+ [
3302
+ "==",
3303
+ "@entity.active",
3304
+ true
3305
+ ],
3306
+ [
3307
+ "and",
3308
+ [
3309
+ "==",
3310
+ "@entity.running",
3311
+ true
3312
+ ],
3313
+ [
3314
+ "not",
3315
+ [
3316
+ "==",
3317
+ "@entity.done",
3318
+ true
3319
+ ]
3320
+ ]
3321
+ ]
3322
+ ],
3323
+ "interval": 500.0,
3324
+ "name": "treeTick"
3325
+ }
3326
+ ]
3327
+ }
3328
+ ]
3329
+ }
3330
+ ],
3331
+ "schemaVersion": 1,
3332
+ "version": "1.0.0"
3333
+ }