@powerhousedao/workflow 6.2.3 → 6.3.0-dev.2

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 (536) hide show
  1. package/README.md +3 -1
  2. package/dist/{node/BlockSelector-C3XYZfPY.mjs → browser/BlockSelector-CEdYUqjx.js} +2006 -1692
  3. package/dist/browser/BlockSelector-CEdYUqjx.js.map +1 -0
  4. package/dist/browser/PieceMarkdown-DSdZd-Jc.js +92 -0
  5. package/dist/browser/PieceMarkdown-DSdZd-Jc.js.map +1 -0
  6. package/dist/browser/connection-form-Biksq2jW.js +1524 -0
  7. package/dist/browser/connection-form-Biksq2jW.js.map +1 -0
  8. package/dist/browser/{connection-BUum0hJI.js → connection-ilYFCRUK.js} +2 -2
  9. package/dist/browser/{connection-BUum0hJI.js.map → connection-ilYFCRUK.js.map} +1 -1
  10. package/dist/browser/data-tree-Cq-s6bJp.js +76 -0
  11. package/dist/browser/data-tree-Cq-s6bJp.js.map +1 -0
  12. package/dist/browser/document-models/connection/index.js +3 -3
  13. package/dist/browser/document-models/index.js +3 -3
  14. package/dist/browser/document-models/workflow/index.js +3 -3
  15. package/dist/browser/document-models-C2SAP1SX.js +164 -0
  16. package/dist/browser/{document-models-C1ZgIZyV.js.map → document-models-C2SAP1SX.js.map} +1 -1
  17. package/dist/browser/editor-CIqKi7XK.js +3219 -0
  18. package/dist/browser/editor-CIqKi7XK.js.map +1 -0
  19. package/dist/browser/editor-DYjoPfta.js +4669 -0
  20. package/dist/browser/editor-DYjoPfta.js.map +1 -0
  21. package/dist/browser/{editor-BCH8vdej.js → editor-GeRXGdie.js} +174 -48
  22. package/dist/browser/editor-GeRXGdie.js.map +1 -0
  23. package/dist/browser/editors/connection-editor/module.js +1 -1
  24. package/dist/browser/editors/connection-editor/module.js.map +1 -1
  25. package/dist/browser/editors/runtime/index.js +2 -0
  26. package/dist/browser/editors/workflow-editor/module.js +1 -1
  27. package/dist/browser/editors/workflow-editor/module.js.map +1 -1
  28. package/dist/browser/editors/workflow-studio/module.js +1 -1
  29. package/dist/browser/index.js +164 -88
  30. package/dist/browser/index.js.map +1 -1
  31. package/dist/browser/{module-jDZ4pq3W.js → module-DJz6oTX0.js} +237 -30
  32. package/dist/browser/module-DJz6oTX0.js.map +1 -0
  33. package/dist/browser/{module-DU2vb3FH.js → module-mFCt9WHJ.js} +267 -89
  34. package/dist/browser/module-mFCt9WHJ.js.map +1 -0
  35. package/dist/{node/piece-auth-BS5CtQOG.mjs → browser/piece-auth-63iuNFTs.js} +11 -3
  36. package/dist/browser/piece-auth-63iuNFTs.js.map +1 -0
  37. package/dist/browser/reactor/index.js +2 -2
  38. package/dist/browser/rolldown-runtime-D7D4PA-g.js +13 -0
  39. package/dist/browser/runtime-queries-FmEzElOY.js +993 -0
  40. package/dist/browser/runtime-queries-FmEzElOY.js.map +1 -0
  41. package/dist/browser/trigger-text-DH6HIeoa.js +3210 -0
  42. package/dist/browser/trigger-text-DH6HIeoa.js.map +1 -0
  43. package/dist/browser/upgrade-manifests-C2Qa6myy.js +8 -0
  44. package/dist/browser/{upgrade-manifests-BpakVE9l.js.map → upgrade-manifests-C2Qa6myy.js.map} +1 -1
  45. package/dist/{node/workflow-CGzYGZnr.mjs → browser/workflow-2gR2JXUS.js} +4 -3
  46. package/dist/browser/workflow-2gR2JXUS.js.map +1 -0
  47. package/dist/node/document-models/connection/index.mjs +67 -3
  48. package/dist/node/document-models/connection/index.mjs.map +1 -0
  49. package/dist/node/document-models/index.mjs +3 -3
  50. package/dist/node/document-models/workflow/index.mjs +86 -3
  51. package/dist/node/document-models/workflow/index.mjs.map +1 -0
  52. package/dist/node/editors/index.mjs +6 -4
  53. package/dist/node/editors/index.mjs.map +1 -0
  54. package/dist/node/index.mjs +69 -381
  55. package/dist/node/index.mjs.map +1 -1
  56. package/dist/node/{module-Dhe5E-VA.mjs → module-BXKUB58R.mjs} +273 -90
  57. package/dist/node/module-BXKUB58R.mjs.map +1 -0
  58. package/dist/node/{module-BMwJQh65.mjs → module-CaBtkQmd.mjs} +226 -19
  59. package/dist/node/module-CaBtkQmd.mjs.map +1 -0
  60. package/dist/node/pieces/ai/descriptor.json +857 -0
  61. package/dist/node/pieces/ai/index.mjs +624 -0
  62. package/dist/node/pieces/ai/package.json +9 -0
  63. package/dist/node/pieces/index.mjs +3 -0
  64. package/dist/node/pieces/index.mjs.map +1 -1
  65. package/dist/node/pieces/reactor/descriptor.json +104 -18
  66. package/dist/node/pieces/reactor/index.mjs +48 -17670
  67. package/dist/node/pieces/reactor/package.json +2 -2
  68. package/dist/node/rolldown-runtime-D7D4PA-g.mjs +13 -0
  69. package/dist/node/upgrade-manifests-BCCpSD1J.mjs +8 -0
  70. package/dist/node/{upgrade-manifests-CmNd742Y.mjs.map → upgrade-manifests-BCCpSD1J.mjs.map} +1 -1
  71. package/dist/powerhouse.manifest.json +72 -6
  72. package/dist/style.css +3 -2520
  73. package/dist/types/ai/runtime.d.ts +13 -0
  74. package/dist/types/ai/runtime.d.ts.map +1 -0
  75. package/dist/types/ai/tools.d.ts +10 -6
  76. package/dist/types/ai/tools.d.ts.map +1 -1
  77. package/dist/types/ai/workflow-tools.d.ts.map +1 -1
  78. package/dist/types/document-models/connection/v1/actions.d.ts +3 -0
  79. package/dist/types/document-models/connection/v1/actions.d.ts.map +1 -1
  80. package/dist/types/document-models/connection/v1/gen/config/actions.d.ts +10 -2
  81. package/dist/types/document-models/connection/v1/gen/config/actions.d.ts.map +1 -1
  82. package/dist/types/document-models/connection/v1/gen/config/creators.d.ts +4 -2
  83. package/dist/types/document-models/connection/v1/gen/config/creators.d.ts.map +1 -1
  84. package/dist/types/document-models/connection/v1/gen/config/error.d.ts +29 -1
  85. package/dist/types/document-models/connection/v1/gen/config/error.d.ts.map +1 -1
  86. package/dist/types/document-models/connection/v1/gen/config/operations.d.ts +3 -1
  87. package/dist/types/document-models/connection/v1/gen/config/operations.d.ts.map +1 -1
  88. package/dist/types/document-models/connection/v1/gen/connection/error.d.ts +13 -1
  89. package/dist/types/document-models/connection/v1/gen/connection/error.d.ts.map +1 -1
  90. package/dist/types/document-models/connection/v1/gen/document-model.d.ts.map +1 -1
  91. package/dist/types/document-models/connection/v1/gen/reducer.d.ts.map +1 -1
  92. package/dist/types/document-models/connection/v1/gen/schema/types.d.ts +18 -2
  93. package/dist/types/document-models/connection/v1/gen/schema/types.d.ts.map +1 -1
  94. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts +5 -1
  95. package/dist/types/document-models/connection/v1/gen/schema/zod.d.ts.map +1 -1
  96. package/dist/types/document-models/connection/v1/module.d.ts +3 -0
  97. package/dist/types/document-models/connection/v1/module.d.ts.map +1 -1
  98. package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts +17 -0
  99. package/dist/types/document-models/connection/v1/src/reactor-connection.d.ts.map +1 -0
  100. package/dist/types/document-models/connection/v1/src/reducers/config.d.ts.map +1 -1
  101. package/dist/types/document-models/connection/v1/src/reducers/connection.d.ts.map +1 -1
  102. package/dist/types/document-models/connection/v1/src/utils.d.ts +1 -1
  103. package/dist/types/document-models/connection/v1/src/utils.d.ts.map +1 -1
  104. package/dist/types/document-models/connection/v1/tests/config-values.test.d.ts +2 -0
  105. package/dist/types/document-models/connection/v1/tests/config-values.test.d.ts.map +1 -0
  106. package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts +2 -0
  107. package/dist/types/document-models/connection/v1/tests/reactor-connection.test.d.ts.map +1 -0
  108. package/dist/types/document-models/document-models.d.ts +8 -0
  109. package/dist/types/document-models/document-models.d.ts.map +1 -1
  110. package/dist/types/document-models/workflow/v1/actions.d.ts +5 -0
  111. package/dist/types/document-models/workflow/v1/actions.d.ts.map +1 -1
  112. package/dist/types/document-models/workflow/v1/gen/document-model.d.ts.map +1 -1
  113. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts +3 -0
  114. package/dist/types/document-models/workflow/v1/gen/document-schema.d.ts.map +1 -1
  115. package/dist/types/document-models/workflow/v1/gen/ph-factories.d.ts.map +1 -1
  116. package/dist/types/document-models/workflow/v1/gen/reducer.d.ts.map +1 -1
  117. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts +52 -6
  118. package/dist/types/document-models/workflow/v1/gen/schema/types.d.ts.map +1 -1
  119. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts +7 -1
  120. package/dist/types/document-models/workflow/v1/gen/schema/zod.d.ts.map +1 -1
  121. package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts +14 -2
  122. package/dist/types/document-models/workflow/v1/gen/trigger/actions.d.ts.map +1 -1
  123. package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts +5 -2
  124. package/dist/types/document-models/workflow/v1/gen/trigger/creators.d.ts.map +1 -1
  125. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts +32 -1
  126. package/dist/types/document-models/workflow/v1/gen/trigger/error.d.ts.map +1 -1
  127. package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts +4 -1
  128. package/dist/types/document-models/workflow/v1/gen/trigger/operations.d.ts.map +1 -1
  129. package/dist/types/document-models/workflow/v1/gen/utils.d.ts.map +1 -1
  130. package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts +6 -2
  131. package/dist/types/document-models/workflow/v1/gen/workflow/actions.d.ts.map +1 -1
  132. package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts +3 -2
  133. package/dist/types/document-models/workflow/v1/gen/workflow/creators.d.ts.map +1 -1
  134. package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts +2 -1
  135. package/dist/types/document-models/workflow/v1/gen/workflow/operations.d.ts.map +1 -1
  136. package/dist/types/document-models/workflow/v1/module.d.ts +5 -0
  137. package/dist/types/document-models/workflow/v1/module.d.ts.map +1 -1
  138. package/dist/types/document-models/workflow/v1/src/reducers/steps.d.ts.map +1 -1
  139. package/dist/types/document-models/workflow/v1/src/reducers/trigger.d.ts.map +1 -1
  140. package/dist/types/document-models/workflow/v1/src/reducers/workflow.d.ts.map +1 -1
  141. package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts +2 -0
  142. package/dist/types/document-models/workflow/v1/tests/managed-by.test.d.ts.map +1 -0
  143. package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts +2 -0
  144. package/dist/types/document-models/workflow/v1/tests/reactor-connection.test.d.ts.map +1 -0
  145. package/dist/types/document-models/workflow/v1/tests/trigger-fields.test.d.ts +2 -0
  146. package/dist/types/document-models/workflow/v1/tests/trigger-fields.test.d.ts.map +1 -0
  147. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts +1 -1
  148. package/dist/types/editors/connection-editor/ConnectionToolbar.d.ts.map +1 -1
  149. package/dist/types/editors/connection-editor/ReactorBindings.d.ts +6 -0
  150. package/dist/types/editors/connection-editor/ReactorBindings.d.ts.map +1 -0
  151. package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts +7 -0
  152. package/dist/types/editors/connection-editor/ReactorConnectionSettings.d.ts.map +1 -0
  153. package/dist/types/editors/connection-editor/UsedBy.d.ts.map +1 -1
  154. package/dist/types/editors/connection-editor/connection-callbacks.d.ts.map +1 -1
  155. package/dist/types/editors/connection-editor/connection-form.d.ts +4 -1
  156. package/dist/types/editors/connection-editor/connection-form.d.ts.map +1 -1
  157. package/dist/types/editors/connection-editor/connection-usage.d.ts +13 -3
  158. package/dist/types/editors/connection-editor/connection-usage.d.ts.map +1 -1
  159. package/dist/types/editors/connection-editor/editor.d.ts +3 -1
  160. package/dist/types/editors/connection-editor/editor.d.ts.map +1 -1
  161. package/dist/types/editors/connection-editor/module.d.ts +2 -1
  162. package/dist/types/editors/connection-editor/module.d.ts.map +1 -1
  163. package/dist/types/editors/connection-editor/piece-auth.d.ts +6 -1
  164. package/dist/types/editors/connection-editor/piece-auth.d.ts.map +1 -1
  165. package/dist/types/editors/connection-editor/status.d.ts.map +1 -1
  166. package/dist/types/editors/runtime/index.d.ts +21 -0
  167. package/dist/types/editors/runtime/index.d.ts.map +1 -0
  168. package/dist/types/editors/runtime/runtime-export.test.d.ts +2 -0
  169. package/dist/types/editors/runtime/runtime-export.test.d.ts.map +1 -0
  170. package/dist/types/editors/shared/DocumentErrorBoundary.d.ts.map +1 -1
  171. package/dist/types/editors/shared/controls.d.ts +1 -0
  172. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  173. package/dist/types/editors/shared/data-tree.d.ts.map +1 -1
  174. package/dist/types/editors/shared/data-viewer.d.ts.map +1 -1
  175. package/dist/types/editors/shared/document-ref.d.ts +5 -0
  176. package/dist/types/editors/shared/document-ref.d.ts.map +1 -0
  177. package/dist/types/editors/shared/editor-chrome.d.ts +6 -1
  178. package/dist/types/editors/shared/editor-chrome.d.ts.map +1 -1
  179. package/dist/types/editors/shared/editor-chrome.test.d.ts +2 -0
  180. package/dist/types/editors/shared/editor-chrome.test.d.ts.map +1 -0
  181. package/dist/types/editors/shared/icons.d.ts +5 -0
  182. package/dist/types/editors/shared/icons.d.ts.map +1 -1
  183. package/dist/types/editors/shared/pending-echo.d.ts +9 -0
  184. package/dist/types/editors/shared/pending-echo.d.ts.map +1 -0
  185. package/dist/types/editors/shared/undo-plan.d.ts +12 -5
  186. package/dist/types/editors/shared/undo-plan.d.ts.map +1 -1
  187. package/dist/types/editors/shared/url-param.d.ts +14 -0
  188. package/dist/types/editors/shared/url-param.d.ts.map +1 -0
  189. package/dist/types/editors/shared/url-param.test.d.ts +2 -0
  190. package/dist/types/editors/shared/url-param.test.d.ts.map +1 -0
  191. package/dist/types/editors/workflow-editor/document/useWorkflowModel.d.ts.map +1 -1
  192. package/dist/types/editors/workflow-editor/editor.d.ts +3 -1
  193. package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
  194. package/dist/types/editors/workflow-editor/module.d.ts +2 -1
  195. package/dist/types/editors/workflow-editor/module.d.ts.map +1 -1
  196. package/dist/types/editors/workflow-editor/reactor-hooks.d.ts +25 -0
  197. package/dist/types/editors/workflow-editor/reactor-hooks.d.ts.map +1 -0
  198. package/dist/types/editors/workflow-editor/runtime-api.d.ts +13 -11
  199. package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
  200. package/dist/types/editors/workflow-editor/runtime-client.d.ts +96 -9
  201. package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
  202. package/dist/types/editors/workflow-editor/runtime-context.d.ts +12 -3
  203. package/dist/types/editors/workflow-editor/runtime-context.d.ts.map +1 -1
  204. package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts +2 -0
  205. package/dist/types/editors/workflow-editor/runtime-contract.test.d.ts.map +1 -0
  206. package/dist/types/editors/workflow-editor/runtime-persist.d.ts +1 -1
  207. package/dist/types/editors/workflow-editor/runtime-queries.d.ts +21 -1
  208. package/dist/types/editors/workflow-editor/runtime-queries.d.ts.map +1 -1
  209. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts +15 -2
  210. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  211. package/dist/types/editors/workflow-editor/ui/CanvasContextMenu.d.ts.map +1 -1
  212. package/dist/types/editors/workflow-editor/ui/ConnectionField.d.ts.map +1 -1
  213. package/dist/types/editors/workflow-editor/ui/ConnectionName.d.ts +8 -0
  214. package/dist/types/editors/workflow-editor/ui/ConnectionName.d.ts.map +1 -0
  215. package/dist/types/editors/workflow-editor/ui/CreateConnectionModal.d.ts.map +1 -1
  216. package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts +12 -0
  217. package/dist/types/editors/workflow-editor/ui/PanelResizer.d.ts.map +1 -0
  218. package/dist/types/editors/workflow-editor/ui/PickerPopover.d.ts +12 -0
  219. package/dist/types/editors/workflow-editor/ui/PickerPopover.d.ts.map +1 -0
  220. package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts +2 -1
  221. package/dist/types/editors/workflow-editor/ui/PieceMarkdown.d.ts.map +1 -1
  222. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +9 -0
  223. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  224. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts +17 -0
  225. package/dist/types/editors/workflow-editor/ui/PublishControls.d.ts.map +1 -1
  226. package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts +9 -0
  227. package/dist/types/editors/workflow-editor/ui/ReactorConnectionField.d.ts.map +1 -0
  228. package/dist/types/editors/workflow-editor/ui/ScheduleBuilder.d.ts.map +1 -1
  229. package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts +6 -0
  230. package/dist/types/editors/workflow-editor/ui/SignInPrompt.d.ts.map +1 -0
  231. package/dist/types/editors/workflow-editor/ui/StepError.d.ts +4 -0
  232. package/dist/types/editors/workflow-editor/ui/StepError.d.ts.map +1 -0
  233. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts +1 -0
  234. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  235. package/dist/types/editors/workflow-editor/ui/StepTest.d.ts.map +1 -1
  236. package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts +2 -0
  237. package/dist/types/editors/workflow-editor/ui/SwitchboardGrants.d.ts.map +1 -0
  238. package/dist/types/editors/workflow-editor/ui/VirtualList.d.ts +14 -0
  239. package/dist/types/editors/workflow-editor/ui/VirtualList.d.ts.map +1 -0
  240. package/dist/types/editors/workflow-editor/ui/WorkflowEditorApp.d.ts.map +1 -1
  241. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts +1 -0
  242. package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
  243. package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
  244. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +4 -0
  245. package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
  246. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +3 -0
  247. package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
  248. package/dist/types/editors/workflow-editor/ui/block-picker-layout.test.d.ts +2 -0
  249. package/dist/types/editors/workflow-editor/ui/block-picker-layout.test.d.ts.map +1 -0
  250. package/dist/types/editors/workflow-editor/ui/blocks.d.ts +12 -0
  251. package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
  252. package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -1
  253. package/dist/types/editors/workflow-editor/ui/design-time.d.ts +1 -0
  254. package/dist/types/editors/workflow-editor/ui/design-time.d.ts.map +1 -1
  255. package/dist/types/editors/workflow-editor/ui/document-options.d.ts +24 -0
  256. package/dist/types/editors/workflow-editor/ui/document-options.d.ts.map +1 -0
  257. package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts +2 -0
  258. package/dist/types/editors/workflow-editor/ui/document-options.test.d.ts.map +1 -0
  259. package/dist/types/editors/workflow-editor/ui/document-shape.d.ts +8 -0
  260. package/dist/types/editors/workflow-editor/ui/document-shape.d.ts.map +1 -0
  261. package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts +2 -0
  262. package/dist/types/editors/workflow-editor/ui/document-shape.test.d.ts.map +1 -0
  263. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts +2 -0
  264. package/dist/types/editors/workflow-editor/ui/expression-scope.d.ts.map +1 -1
  265. package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts +2 -0
  266. package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts.map +1 -0
  267. package/dist/types/editors/workflow-editor/ui/forms.d.ts +11 -2
  268. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  269. package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts +2 -0
  270. package/dist/types/editors/workflow-editor/ui/item-summary.test.d.ts.map +1 -0
  271. package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts +7 -0
  272. package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts.map +1 -0
  273. package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts +2 -0
  274. package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts.map +1 -0
  275. package/dist/types/editors/workflow-editor/ui/model.d.ts +31 -0
  276. package/dist/types/editors/workflow-editor/ui/model.d.ts.map +1 -1
  277. package/dist/types/editors/workflow-editor/ui/picker-placement.d.ts +19 -0
  278. package/dist/types/editors/workflow-editor/ui/picker-placement.d.ts.map +1 -0
  279. package/dist/types/editors/workflow-editor/ui/picker-recent.d.ts +4 -0
  280. package/dist/types/editors/workflow-editor/ui/picker-recent.d.ts.map +1 -0
  281. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +23 -3
  282. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
  283. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +1 -0
  284. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -1
  285. package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts +2 -0
  286. package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts.map +1 -0
  287. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts +16 -4
  288. package/dist/types/editors/workflow-editor/ui/query-keys.d.ts.map +1 -1
  289. package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts +43 -0
  290. package/dist/types/editors/workflow-editor/ui/reactor-access.d.ts.map +1 -0
  291. package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts +2 -0
  292. package/dist/types/editors/workflow-editor/ui/reactor-access.test.d.ts.map +1 -0
  293. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts +2 -0
  294. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.d.ts.map +1 -0
  295. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts +2 -0
  296. package/dist/types/editors/workflow-editor/ui/reactor-connection-create.test.d.ts.map +1 -0
  297. package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts +25 -0
  298. package/dist/types/editors/workflow-editor/ui/reactor-view.d.ts.map +1 -0
  299. package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts +2 -0
  300. package/dist/types/editors/workflow-editor/ui/reactor-view.test.d.ts.map +1 -0
  301. package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts +8 -0
  302. package/dist/types/editors/workflow-editor/ui/retry-policy.d.ts.map +1 -0
  303. package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts +2 -0
  304. package/dist/types/editors/workflow-editor/ui/retry-policy.test.d.ts.map +1 -0
  305. package/dist/types/editors/workflow-editor/ui/step-test.d.ts +2 -0
  306. package/dist/types/editors/workflow-editor/ui/step-test.d.ts.map +1 -1
  307. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts +2 -0
  308. package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
  309. package/dist/types/editors/workflow-editor/ui/use-selected-block.d.ts +4 -0
  310. package/dist/types/editors/workflow-editor/ui/use-selected-block.d.ts.map +1 -0
  311. package/dist/types/editors/workflow-editor/ui/use-selected-block.test.d.ts +2 -0
  312. package/dist/types/editors/workflow-editor/ui/use-selected-block.test.d.ts.map +1 -0
  313. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts +1 -0
  314. package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -1
  315. package/dist/types/editors/workflow-editor/ui/validation.d.ts +7 -2
  316. package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
  317. package/dist/types/editors/workflow-editor/use-workflow-runtime.d.ts +13 -0
  318. package/dist/types/editors/workflow-editor/use-workflow-runtime.d.ts.map +1 -0
  319. package/dist/types/editors/workflow-editor/use-workflow-runtime.test.d.ts +2 -0
  320. package/dist/types/editors/workflow-editor/use-workflow-runtime.test.d.ts.map +1 -0
  321. package/dist/types/editors/workflow-studio/components/RunDialog.d.ts +7 -0
  322. package/dist/types/editors/workflow-studio/components/RunDialog.d.ts.map +1 -0
  323. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +11 -1
  324. package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
  325. package/dist/types/editors/workflow-studio/components/RunsView.d.ts +3 -1
  326. package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
  327. package/dist/types/editors/workflow-studio/components/ScrollFade.d.ts +7 -0
  328. package/dist/types/editors/workflow-studio/components/ScrollFade.d.ts.map +1 -0
  329. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts +4 -0
  330. package/dist/types/editors/workflow-studio/components/Sidebar.d.ts.map +1 -1
  331. package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts +57 -0
  332. package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts.map +1 -0
  333. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts +4 -0
  334. package/dist/types/editors/workflow-studio/components/WorkflowBoard.d.ts.map +1 -1
  335. package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts +41 -0
  336. package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts.map +1 -0
  337. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts +2 -0
  338. package/dist/types/editors/workflow-studio/components/WorkflowMenu.d.ts.map +1 -1
  339. package/dist/types/editors/workflow-studio/components/WorkflowSteps.d.ts.map +1 -1
  340. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
  341. package/dist/types/editors/workflow-studio/components/chain.d.ts +6 -0
  342. package/dist/types/editors/workflow-studio/components/chain.d.ts.map +1 -1
  343. package/dist/types/editors/workflow-studio/components/fit-geometry.test.d.ts +2 -0
  344. package/dist/types/editors/workflow-studio/components/fit-geometry.test.d.ts.map +1 -0
  345. package/dist/types/editors/workflow-studio/components/graph-layout.d.ts +30 -0
  346. package/dist/types/editors/workflow-studio/components/graph-layout.d.ts.map +1 -0
  347. package/dist/types/editors/workflow-studio/components/graph-layout.test.d.ts +2 -0
  348. package/dist/types/editors/workflow-studio/components/graph-layout.test.d.ts.map +1 -0
  349. package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts +2 -0
  350. package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts.map +1 -0
  351. package/dist/types/editors/workflow-studio/components/run-format.d.ts +6 -1
  352. package/dist/types/editors/workflow-studio/components/run-format.d.ts.map +1 -1
  353. package/dist/types/editors/workflow-studio/components/tips.d.ts +23 -0
  354. package/dist/types/editors/workflow-studio/components/tips.d.ts.map +1 -0
  355. package/dist/types/editors/workflow-studio/components/use-collapsed.d.ts +5 -0
  356. package/dist/types/editors/workflow-studio/components/use-collapsed.d.ts.map +1 -0
  357. package/dist/types/editors/workflow-studio/components/use-item-selection.d.ts +10 -0
  358. package/dist/types/editors/workflow-studio/components/use-item-selection.d.ts.map +1 -0
  359. package/dist/types/editors/workflow-studio/components/use-item-selection.test.d.ts +2 -0
  360. package/dist/types/editors/workflow-studio/components/use-item-selection.test.d.ts.map +1 -0
  361. package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts +2 -0
  362. package/dist/types/editors/workflow-studio/components/waitpoints-view.test.d.ts.map +1 -0
  363. package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts +2 -0
  364. package/dist/types/editors/workflow-studio/components/waitpoints.test.d.ts.map +1 -0
  365. package/dist/types/editors/workflow-studio/components/workflow-order.d.ts +19 -0
  366. package/dist/types/editors/workflow-studio/components/workflow-order.d.ts.map +1 -0
  367. package/dist/types/editors/workflow-studio/components/workflow-order.test.d.ts +2 -0
  368. package/dist/types/editors/workflow-studio/components/workflow-order.test.d.ts.map +1 -0
  369. package/dist/types/pieces/ai/ai-actions.test.d.ts +2 -0
  370. package/dist/types/pieces/ai/ai-actions.test.d.ts.map +1 -0
  371. package/dist/types/pieces/ai/ai-documents.test.d.ts +2 -0
  372. package/dist/types/pieces/ai/ai-documents.test.d.ts.map +1 -0
  373. package/dist/types/pieces/ai/ai.test.d.ts +2 -0
  374. package/dist/types/pieces/ai/ai.test.d.ts.map +1 -0
  375. package/dist/types/pieces/ai/index.d.ts +7 -0
  376. package/dist/types/pieces/ai/index.d.ts.map +1 -0
  377. package/dist/types/pieces/ai/lib/action-schema.d.ts +11 -0
  378. package/dist/types/pieces/ai/lib/action-schema.d.ts.map +1 -0
  379. package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts +38 -0
  380. package/dist/types/pieces/ai/lib/actions/ask-ai.d.ts.map +1 -0
  381. package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts +45 -0
  382. package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts.map +1 -0
  383. package/dist/types/pieces/ai/lib/actions/decide.d.ts +39 -0
  384. package/dist/types/pieces/ai/lib/actions/decide.d.ts.map +1 -0
  385. package/dist/types/pieces/ai/lib/actions/extract.d.ts +41 -0
  386. package/dist/types/pieces/ai/lib/actions/extract.d.ts.map +1 -0
  387. package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts +55 -0
  388. package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts.map +1 -0
  389. package/dist/types/pieces/ai/lib/actions/summarize.d.ts +38 -0
  390. package/dist/types/pieces/ai/lib/actions/summarize.d.ts.map +1 -0
  391. package/dist/types/pieces/ai/lib/auth.d.ts +16 -0
  392. package/dist/types/pieces/ai/lib/auth.d.ts.map +1 -0
  393. package/dist/types/pieces/ai/lib/decision-model.d.ts +17 -0
  394. package/dist/types/pieces/ai/lib/decision-model.d.ts.map +1 -0
  395. package/dist/types/pieces/ai/lib/documents.d.ts +11 -0
  396. package/dist/types/pieces/ai/lib/documents.d.ts.map +1 -0
  397. package/dist/types/pieces/ai/lib/model-list.d.ts +8 -0
  398. package/dist/types/pieces/ai/lib/model-list.d.ts.map +1 -0
  399. package/dist/types/pieces/ai/lib/models.d.ts +19 -0
  400. package/dist/types/pieces/ai/lib/models.d.ts.map +1 -0
  401. package/dist/types/pieces/ai/lib/props.d.ts +16 -0
  402. package/dist/types/pieces/ai/lib/props.d.ts.map +1 -0
  403. package/dist/types/pieces/ai/lib/providers.d.ts +9 -0
  404. package/dist/types/pieces/ai/lib/providers.d.ts.map +1 -0
  405. package/dist/types/pieces/ai/lib/questions.d.ts +7 -0
  406. package/dist/types/pieces/ai/lib/questions.d.ts.map +1 -0
  407. package/dist/types/pieces/index.d.ts.map +1 -1
  408. package/dist/types/pieces/reactor/index.d.ts.map +1 -1
  409. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +5 -2
  410. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  411. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +3 -1
  412. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  413. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts +4 -1
  414. package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
  415. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts +3 -1
  416. package/dist/types/pieces/reactor/lib/actions/document-get.d.ts.map +1 -1
  417. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts +3 -1
  418. package/dist/types/pieces/reactor/lib/actions/document-schema.d.ts.map +1 -1
  419. package/dist/types/pieces/reactor/lib/actions/document-types.d.ts +3 -1
  420. package/dist/types/pieces/reactor/lib/actions/document-types.d.ts.map +1 -1
  421. package/dist/types/pieces/reactor/lib/actions/index-query.d.ts +14 -0
  422. package/dist/types/pieces/reactor/lib/actions/index-query.d.ts.map +1 -0
  423. package/dist/types/pieces/reactor/lib/documents.d.ts +33 -0
  424. package/dist/types/pieces/reactor/lib/documents.d.ts.map +1 -0
  425. package/dist/types/pieces/reactor/lib/documents.test.d.ts +2 -0
  426. package/dist/types/pieces/reactor/lib/documents.test.d.ts.map +1 -0
  427. package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -1
  428. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -1
  429. package/dist/types/pieces/reactor/lib/parse.d.ts.map +1 -1
  430. package/dist/types/pieces/reactor/lib/reactor.d.ts +27 -4
  431. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  432. package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts +6 -6
  433. package/dist/types/pieces/reactor/lib/triggers/document-event.d.ts.map +1 -1
  434. package/dist/types/pieces/reactor/lib/writes.d.ts +7 -0
  435. package/dist/types/pieces/reactor/lib/writes.d.ts.map +1 -0
  436. package/dist/types/pieces/reactor/reactor.test.d.ts +2 -0
  437. package/dist/types/pieces/reactor/reactor.test.d.ts.map +1 -0
  438. package/dist/types/pieces/reactor/test-signer.d.ts +3 -0
  439. package/dist/types/pieces/reactor/test-signer.d.ts.map +1 -0
  440. package/dist/types/scripts/ui-stack.d.ts +21 -6
  441. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  442. package/dist/types/test/graphql-server.d.ts +9 -0
  443. package/dist/types/test/graphql-server.d.ts.map +1 -0
  444. package/dist/types/test/runtime-schema.d.ts +17 -0
  445. package/dist/types/test/runtime-schema.d.ts.map +1 -0
  446. package/dist/types/test/switchboards.d.ts +20 -0
  447. package/dist/types/test/switchboards.d.ts.map +1 -0
  448. package/dist/types/test/ui/flow-control.spec.d.ts +2 -0
  449. package/dist/types/test/ui/flow-control.spec.d.ts.map +1 -0
  450. package/dist/types/test/ui/harness/property-form-echo.d.ts +12 -0
  451. package/dist/types/test/ui/harness/property-form-echo.d.ts.map +1 -0
  452. package/dist/types/test/ui/harness/schedule-builder.d.ts +8 -0
  453. package/dist/types/test/ui/harness/schedule-builder.d.ts.map +1 -0
  454. package/dist/types/test/ui/manual-inputs.spec.d.ts +2 -0
  455. package/dist/types/test/ui/manual-inputs.spec.d.ts.map +1 -0
  456. package/dist/types/test/ui/property-form-echo.spec.d.ts +2 -0
  457. package/dist/types/test/ui/property-form-echo.spec.d.ts.map +1 -0
  458. package/dist/types/test/ui/reactor-connection.spec.d.ts +2 -0
  459. package/dist/types/test/ui/reactor-connection.spec.d.ts.map +1 -0
  460. package/dist/types/test/ui/schedule-builder.spec.d.ts +2 -0
  461. package/dist/types/test/ui/schedule-builder.spec.d.ts.map +1 -0
  462. package/dist/types/test/waitpoint-record.d.ts +3 -0
  463. package/dist/types/test/waitpoint-record.d.ts.map +1 -0
  464. package/dist/workflow.css +68 -0
  465. package/package.json +40 -11
  466. package/dist/browser/BlockSelector-BQDqIbRZ.js +0 -3053
  467. package/dist/browser/BlockSelector-BQDqIbRZ.js.map +0 -1
  468. package/dist/browser/PieceMarkdown-B8EEaQgT.js +0 -21435
  469. package/dist/browser/PieceMarkdown-B8EEaQgT.js.map +0 -1
  470. package/dist/browser/assets/entry-D62sYiFV.js +0 -318
  471. package/dist/browser/assets/projection-entry-BGcu_9-p.js +0 -446
  472. package/dist/browser/connection-form-BCxGD8Zk.js +0 -831
  473. package/dist/browser/connection-form-BCxGD8Zk.js.map +0 -1
  474. package/dist/browser/data-tree-CZZkfzSH.js +0 -1896
  475. package/dist/browser/data-tree-CZZkfzSH.js.map +0 -1
  476. package/dist/browser/document-models-C1ZgIZyV.js +0 -103
  477. package/dist/browser/editor-BCH8vdej.js.map +0 -1
  478. package/dist/browser/editor-Bd2Cu8Mx.js +0 -1793
  479. package/dist/browser/editor-Bd2Cu8Mx.js.map +0 -1
  480. package/dist/browser/editor-Bl1Xp7N8.js +0 -17234
  481. package/dist/browser/editor-Bl1Xp7N8.js.map +0 -1
  482. package/dist/browser/module-DU2vb3FH.js.map +0 -1
  483. package/dist/browser/module-jDZ4pq3W.js.map +0 -1
  484. package/dist/browser/piece-auth-BS5CtQOG.js +0 -146
  485. package/dist/browser/piece-auth-BS5CtQOG.js.map +0 -1
  486. package/dist/browser/rolldown-runtime-DC62tzP2.js +0 -33
  487. package/dist/browser/runtime-queries-Ds2kk-Ow.js +0 -2535
  488. package/dist/browser/runtime-queries-Ds2kk-Ow.js.map +0 -1
  489. package/dist/browser/trigger-text-Ld2uv0Cf.js +0 -5569
  490. package/dist/browser/trigger-text-Ld2uv0Cf.js.map +0 -1
  491. package/dist/browser/upgrade-manifests-BpakVE9l.js +0 -8
  492. package/dist/browser/workflow-BxShRhVy.js +0 -108
  493. package/dist/browser/workflow-BxShRhVy.js.map +0 -1
  494. package/dist/node/BlockSelector-C3XYZfPY.mjs.map +0 -1
  495. package/dist/node/PieceMarkdown-BMhBGa4t.mjs +0 -23281
  496. package/dist/node/PieceMarkdown-BMhBGa4t.mjs.map +0 -1
  497. package/dist/node/connection-D544oqVW.mjs +0 -90
  498. package/dist/node/connection-D544oqVW.mjs.map +0 -1
  499. package/dist/node/connection-form-CjUay_qz.mjs +0 -831
  500. package/dist/node/connection-form-CjUay_qz.mjs.map +0 -1
  501. package/dist/node/data-tree-CGfeCLr7.mjs +0 -1903
  502. package/dist/node/data-tree-CGfeCLr7.mjs.map +0 -1
  503. package/dist/node/editor-BXtXOryt.mjs +0 -247
  504. package/dist/node/editor-BXtXOryt.mjs.map +0 -1
  505. package/dist/node/editor-CXGHkwd9.mjs +0 -1793
  506. package/dist/node/editor-CXGHkwd9.mjs.map +0 -1
  507. package/dist/node/editor-D0FCvyPb.mjs +0 -17365
  508. package/dist/node/editor-D0FCvyPb.mjs.map +0 -1
  509. package/dist/node/editors/connection-editor/module.mjs +0 -15
  510. package/dist/node/editors/connection-editor/module.mjs.map +0 -1
  511. package/dist/node/editors/workflow-editor/module.mjs +0 -15
  512. package/dist/node/editors/workflow-editor/module.mjs.map +0 -1
  513. package/dist/node/editors/workflow-studio/module.mjs +0 -15
  514. package/dist/node/editors/workflow-studio/module.mjs.map +0 -1
  515. package/dist/node/module-BMwJQh65.mjs.map +0 -1
  516. package/dist/node/module-Dhe5E-VA.mjs.map +0 -1
  517. package/dist/node/piece-auth-BS5CtQOG.mjs.map +0 -1
  518. package/dist/node/pieces/reactor/index.mjs.map +0 -1
  519. package/dist/node/rolldown-runtime-BMI-E3GI.mjs +0 -44
  520. package/dist/node/runtime-queries-D5EGaCrH.mjs +0 -2544
  521. package/dist/node/runtime-queries-D5EGaCrH.mjs.map +0 -1
  522. package/dist/node/style.css +0 -667
  523. package/dist/node/trigger-text-CMWxL7t_.mjs +0 -6765
  524. package/dist/node/trigger-text-CMWxL7t_.mjs.map +0 -1
  525. package/dist/node/upgrade-manifests-CmNd742Y.mjs +0 -8
  526. package/dist/node/workflow-CGzYGZnr.mjs.map +0 -1
  527. package/dist/types/ai/runtime-url.d.ts +0 -2
  528. package/dist/types/ai/runtime-url.d.ts.map +0 -1
  529. package/dist/types/ai/runtime-url.test.d.ts +0 -2
  530. package/dist/types/ai/runtime-url.test.d.ts.map +0 -1
  531. package/dist/types/editors/workflow-editor/use-runtime-url.d.ts +0 -2
  532. package/dist/types/editors/workflow-editor/use-runtime-url.d.ts.map +0 -1
  533. package/dist/types/editors/workflow-studio/components/use-hash-selection.d.ts +0 -5
  534. package/dist/types/editors/workflow-studio/components/use-hash-selection.d.ts.map +0 -1
  535. package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts +0 -2
  536. package/dist/types/pieces/reactor/lib/actions/dispatch-outcome.test.d.ts.map +0 -1
@@ -1,802 +1,11 @@
1
- import { $ as pinBlock, A as keepPreviousData, B as Subscribable, C as infiniteQueryBehavior, D as focusManager, E as pendingThenable, F as resolveStaleTime, G as BRANCH_BLOCK, H as createRuntimeClient, I as shallowEqualObjects, J as SCHEDULE_TRIGGER, L as shouldThrowError, M as replaceData, N as replaceEqualDeep, O as isServer, P as resolveEnabled, Q as isCoreBlock, R as timeUntilStale, S as hasPreviousPage, T as notifyManager, U as isSyncingError, W as ASSERT_BLOCK, Z as WEBHOOK_TRIGGER, _ as runtimeKeys, a as pieceActionsQuery, b as QueryClient, c as runQuery, d as secretStatQuery, dt as scheduleConfigIssue, g as queryKind, h as blockRefKey, j as noop, k as isValidTimeout, m as SHARED_STALE_MS, n as catalogQuery, o as pieceTriggersQuery, p as RESOLVER_STALE_MS, q as MANUAL_TRIGGER, r as createRuntimeQueryClient, s as runPagesQuery, st as checkTriggerStrategy, tt as stepBlock, u as runsQuery, w as fetchState, x as hasNextPage, z as timeoutManager } from "./runtime-queries-D5EGaCrH.mjs";
2
- import { Rt as blockKey, zt as compareVersions } from "./module-Dhe5E-VA.mjs";
3
- import * as React$1 from "react";
4
- import { Component, Fragment, createContext, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
1
+ import { A as BRANCH_BLOCK, B as SCHEDULE_TRIGGER, D as workflowRuntimeUrl, E as isSyncingError, F as LOOP_BLOCK, G as WAIT_FOR_WEBHOOK_BLOCK, H as STOP_BLOCK, I as MANUAL_TRIGGER, J as pinBlock, K as WEBHOOK_TRIGGER, M as CALL_FLOW_BLOCK, O as APPROVAL_BLOCK, P as DELAY_BLOCK, R as RETURN_RESPONSE_BLOCK, S as createRuntimeClient, X as stepBlock, _ as queryKind, a as pieceActionsQuery, c as runQuery, d as secretStatQuery, g as blockRefKey, h as SHARED_STALE_MS, j as CALLABLE_FLOW_TRIGGER$1, k as ASSERT_BLOCK, m as RESOLVER_STALE_MS, n as catalogQuery, o as pieceTriggersQuery, p as waitingRunsQuery, q as isCoreBlock, r as createRuntimeQueryClient, s as runPagesQuery, u as runsQuery, v as runtimeKeys, z as ROUTER_BLOCK } from "./runtime-queries-FmEzElOY.js";
2
+ import { resolveSwitchboard, useSearchParams, useSelectedDriveSafe, useSetSearchParams, useSwitchboards } from "@powerhousedao/reactor-browser";
3
+ import { blockKey, compareVersions } from "@powerhousedao/pieces-framework/block-type";
4
+ import { CORE_PIECE_NAME, checkTriggerStrategy, scheduleConfigIssue, stepPorts } from "@powerhousedao/pieces-framework/workflow";
5
+ import { QueryClient, keepPreviousData, useInfiniteQuery, useQueries, useQuery } from "@tanstack/react-query";
6
+ import { Component, Fragment, createContext, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
5
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
- import { DEFAULT_SWITCHBOARD_URL, parseDriveUrl, subgraphUrlFromGraphqlUrl, useDefaultDrivesUrl, useSelectedDriveSafe, useSyncList } from "@powerhousedao/reactor-browser";
7
- import { DOCUMENT_SCOPE_ACTION_TYPES } from "@powerhousedao/shared/document-model";
8
8
  import { createPortal } from "react-dom";
9
- //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queryObserver.js
10
- var QueryObserver = class extends Subscribable {
11
- constructor(client, options) {
12
- super();
13
- this.options = options;
14
- this.#client = client;
15
- this.#selectError = null;
16
- this.#currentThenable = pendingThenable();
17
- this.bindMethods();
18
- this.setOptions(options);
19
- }
20
- #client;
21
- #currentQuery = void 0;
22
- #currentQueryInitialState = void 0;
23
- #currentResult = void 0;
24
- #currentResultState;
25
- #currentResultOptions;
26
- #currentThenable;
27
- #selectError;
28
- #selectFn;
29
- #selectResult;
30
- #lastQueryWithDefinedData;
31
- #staleTimeoutId;
32
- #refetchIntervalId;
33
- #currentRefetchInterval;
34
- #trackedProps = /* @__PURE__ */ new Set();
35
- bindMethods() {
36
- this.refetch = this.refetch.bind(this);
37
- }
38
- onSubscribe() {
39
- if (this.listeners.size === 1) {
40
- this.#currentQuery.addObserver(this);
41
- if (shouldFetchOnMount(this.#currentQuery, this.options)) this.#executeFetch();
42
- else this.updateResult();
43
- this.#updateTimers();
44
- }
45
- }
46
- onUnsubscribe() {
47
- if (!this.hasListeners()) this.destroy();
48
- }
49
- shouldFetchOnReconnect() {
50
- return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnReconnect);
51
- }
52
- shouldFetchOnWindowFocus() {
53
- return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnWindowFocus);
54
- }
55
- destroy() {
56
- this.listeners = /* @__PURE__ */ new Set();
57
- this.#clearStaleTimeout();
58
- this.#clearRefetchInterval();
59
- this.#currentQuery.removeObserver(this);
60
- }
61
- setOptions(options) {
62
- const prevOptions = this.options;
63
- const prevQuery = this.#currentQuery;
64
- this.options = this.#client.defaultQueryOptions(options);
65
- if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== "boolean") throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");
66
- this.#updateQuery();
67
- this.#currentQuery.setOptions(this.options);
68
- if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) this.#client.getQueryCache().notify({
69
- type: "observerOptionsUpdated",
70
- query: this.#currentQuery,
71
- observer: this
72
- });
73
- const mounted = this.hasListeners();
74
- if (mounted && shouldFetchOptionally(this.#currentQuery, prevQuery, this.options, prevOptions)) this.#executeFetch();
75
- this.updateResult();
76
- if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) this.#updateStaleTimeout();
77
- const nextRefetchInterval = this.#computeRefetchInterval();
78
- if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) this.#updateRefetchInterval(nextRefetchInterval);
79
- }
80
- getOptimisticResult(options) {
81
- const query = this.#client.getQueryCache().build(this.#client, options);
82
- const result = this.createResult(query, options);
83
- if (shouldAssignObserverCurrentProperties(this, result)) {
84
- this.#currentResult = result;
85
- this.#currentResultOptions = this.options;
86
- this.#currentResultState = this.#currentQuery.state;
87
- }
88
- return result;
89
- }
90
- getCurrentResult() {
91
- return this.#currentResult;
92
- }
93
- trackResult(result, onPropTracked) {
94
- return new Proxy(result, { get: (target, key) => {
95
- this.trackProp(key);
96
- onPropTracked?.(key);
97
- if (key === "promise") {
98
- this.trackProp("data");
99
- if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") this.#currentThenable.reject(/* @__PURE__ */ new Error("experimental_prefetchInRender feature flag is not enabled"));
100
- }
101
- return Reflect.get(target, key);
102
- } });
103
- }
104
- trackProp(key) {
105
- this.#trackedProps.add(key);
106
- }
107
- getCurrentQuery() {
108
- return this.#currentQuery;
109
- }
110
- refetch({ ...options } = {}) {
111
- return this.fetch({ ...options });
112
- }
113
- fetchOptimistic(options) {
114
- const defaultedOptions = this.#client.defaultQueryOptions(options);
115
- const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
116
- return query.fetch().then(() => this.createResult(query, defaultedOptions));
117
- }
118
- fetch(fetchOptions) {
119
- return this.#executeFetch({
120
- ...fetchOptions,
121
- cancelRefetch: fetchOptions.cancelRefetch ?? true
122
- }).then(() => {
123
- this.updateResult();
124
- return this.#currentResult;
125
- });
126
- }
127
- #executeFetch(fetchOptions) {
128
- this.#updateQuery();
129
- let promise = this.#currentQuery.fetch(this.options, fetchOptions);
130
- if (!fetchOptions?.throwOnError) promise = promise.catch(noop);
131
- return promise;
132
- }
133
- #updateStaleTimeout() {
134
- this.#clearStaleTimeout();
135
- const staleTime = resolveStaleTime(this.options.staleTime, this.#currentQuery);
136
- if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) return;
137
- const timeout = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime) + 1;
138
- this.#staleTimeoutId = timeoutManager.setTimeout(() => {
139
- if (!this.#currentResult.isStale) this.updateResult();
140
- }, timeout);
141
- }
142
- #computeRefetchInterval() {
143
- return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
144
- }
145
- #updateRefetchInterval(nextInterval) {
146
- this.#clearRefetchInterval();
147
- this.#currentRefetchInterval = nextInterval;
148
- if (isServer || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) return;
149
- this.#refetchIntervalId = timeoutManager.setInterval(() => {
150
- if (this.options.refetchIntervalInBackground || focusManager.isFocused()) this.#executeFetch();
151
- }, this.#currentRefetchInterval);
152
- }
153
- #updateTimers() {
154
- this.#updateStaleTimeout();
155
- this.#updateRefetchInterval(this.#computeRefetchInterval());
156
- }
157
- #clearStaleTimeout() {
158
- if (this.#staleTimeoutId) {
159
- timeoutManager.clearTimeout(this.#staleTimeoutId);
160
- this.#staleTimeoutId = void 0;
161
- }
162
- }
163
- #clearRefetchInterval() {
164
- if (this.#refetchIntervalId) {
165
- timeoutManager.clearInterval(this.#refetchIntervalId);
166
- this.#refetchIntervalId = void 0;
167
- }
168
- }
169
- createResult(query, options) {
170
- const prevQuery = this.#currentQuery;
171
- const prevOptions = this.options;
172
- const prevResult = this.#currentResult;
173
- const prevResultState = this.#currentResultState;
174
- const prevResultOptions = this.#currentResultOptions;
175
- const queryInitialState = query !== prevQuery ? query.state : this.#currentQueryInitialState;
176
- const { state } = query;
177
- let newState = { ...state };
178
- let isPlaceholderData = false;
179
- let data;
180
- if (options._optimisticResults) {
181
- const mounted = this.hasListeners();
182
- const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
183
- const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
184
- if (fetchOnMount || fetchOptionally) newState = {
185
- ...newState,
186
- ...fetchState(state.data, query.options)
187
- };
188
- if (options._optimisticResults === "isRestoring") newState.fetchStatus = "idle";
189
- }
190
- let { error, errorUpdatedAt, status } = newState;
191
- data = newState.data;
192
- let skipSelect = false;
193
- if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
194
- let placeholderData;
195
- if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
196
- placeholderData = prevResult.data;
197
- skipSelect = true;
198
- } else placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(this.#lastQueryWithDefinedData?.state.data, this.#lastQueryWithDefinedData) : options.placeholderData;
199
- if (placeholderData !== void 0) {
200
- status = "success";
201
- data = replaceData(prevResult?.data, placeholderData, options);
202
- isPlaceholderData = true;
203
- }
204
- }
205
- if (options.select && data !== void 0 && !skipSelect) {
206
- if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) data = this.#selectResult;
207
- else try {
208
- this.#selectFn = options.select;
209
- data = options.select(data);
210
- data = replaceData(prevResult?.data, data, options);
211
- this.#selectResult = data;
212
- this.#selectError = null;
213
- } catch (selectError) {
214
- this.#selectError = selectError;
215
- }
216
- }
217
- if (this.#selectError) {
218
- error = this.#selectError;
219
- data = this.#selectResult;
220
- errorUpdatedAt = Date.now();
221
- status = "error";
222
- }
223
- const isFetching = newState.fetchStatus === "fetching";
224
- const isPending = status === "pending";
225
- const isError = status === "error";
226
- const isLoading = isPending && isFetching;
227
- const hasData = data !== void 0;
228
- const nextResult = {
229
- status,
230
- fetchStatus: newState.fetchStatus,
231
- isPending,
232
- isSuccess: status === "success",
233
- isError,
234
- isInitialLoading: isLoading,
235
- isLoading,
236
- data,
237
- dataUpdatedAt: newState.dataUpdatedAt,
238
- error,
239
- errorUpdatedAt,
240
- failureCount: newState.fetchFailureCount,
241
- failureReason: newState.fetchFailureReason,
242
- errorUpdateCount: newState.errorUpdateCount,
243
- isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
244
- isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
245
- isFetching,
246
- isRefetching: isFetching && !isPending,
247
- isLoadingError: isError && !hasData,
248
- isPaused: newState.fetchStatus === "paused",
249
- isPlaceholderData,
250
- isRefetchError: isError && hasData,
251
- isStale: isStale(query, options),
252
- refetch: this.refetch,
253
- promise: this.#currentThenable,
254
- isEnabled: resolveEnabled(options.enabled, query) !== false
255
- };
256
- if (this.options.experimental_prefetchInRender) {
257
- const hasResultData = nextResult.data !== void 0;
258
- const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
259
- const finalizeThenableIfPossible = (thenable) => {
260
- if (isErrorWithoutData) thenable.reject(nextResult.error);
261
- else if (hasResultData) thenable.resolve(nextResult.data);
262
- };
263
- const recreateThenable = () => {
264
- const pending = this.#currentThenable = nextResult.promise = pendingThenable();
265
- finalizeThenableIfPossible(pending);
266
- };
267
- const prevThenable = this.#currentThenable;
268
- switch (prevThenable.status) {
269
- case "pending":
270
- if (query.queryHash === prevQuery.queryHash) finalizeThenableIfPossible(prevThenable);
271
- break;
272
- case "fulfilled":
273
- if (isErrorWithoutData || nextResult.data !== prevThenable.value) recreateThenable();
274
- break;
275
- case "rejected": if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) recreateThenable();
276
- }
277
- }
278
- return nextResult;
279
- }
280
- updateResult() {
281
- const prevResult = this.#currentResult;
282
- const nextResult = this.createResult(this.#currentQuery, this.options);
283
- this.#currentResultState = this.#currentQuery.state;
284
- this.#currentResultOptions = this.options;
285
- if (this.#currentResultState.data !== void 0) this.#lastQueryWithDefinedData = this.#currentQuery;
286
- if (shallowEqualObjects(nextResult, prevResult)) return;
287
- this.#currentResult = nextResult;
288
- const shouldNotifyListeners = () => {
289
- if (!prevResult) return true;
290
- const { notifyOnChangeProps } = this.options;
291
- const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
292
- if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) return true;
293
- const includedProps = new Set(notifyOnChangePropsValue ?? this.#trackedProps);
294
- if (this.options.throwOnError) includedProps.add("error");
295
- return Object.keys(this.#currentResult).some((key) => {
296
- const typedKey = key;
297
- return this.#currentResult[typedKey] !== prevResult[typedKey] && includedProps.has(typedKey);
298
- });
299
- };
300
- this.#notify({ listeners: shouldNotifyListeners() });
301
- }
302
- #updateQuery() {
303
- const query = this.#client.getQueryCache().build(this.#client, this.options);
304
- if (query === this.#currentQuery) return;
305
- const prevQuery = this.#currentQuery;
306
- this.#currentQuery = query;
307
- this.#currentQueryInitialState = query.state;
308
- if (this.hasListeners()) {
309
- prevQuery?.removeObserver(this);
310
- query.addObserver(this);
311
- }
312
- }
313
- onQueryUpdate() {
314
- this.updateResult();
315
- if (this.hasListeners()) this.#updateTimers();
316
- }
317
- #notify(notifyOptions) {
318
- notifyManager.batch(() => {
319
- if (notifyOptions.listeners) this.listeners.forEach((listener) => {
320
- listener(this.#currentResult);
321
- });
322
- this.#client.getQueryCache().notify({
323
- query: this.#currentQuery,
324
- type: "observerResultsUpdated"
325
- });
326
- });
327
- }
328
- };
329
- function shouldLoadOnMount(query, options) {
330
- return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
331
- }
332
- function shouldFetchOnMount(query, options) {
333
- return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
334
- }
335
- function shouldFetchOn(query, options, field) {
336
- if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
337
- const value = typeof field === "function" ? field(query) : field;
338
- return value === "always" || value !== false && isStale(query, options);
339
- }
340
- return false;
341
- }
342
- function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
343
- return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
344
- }
345
- function isStale(query, options) {
346
- return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
347
- }
348
- function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
349
- if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) return true;
350
- return false;
351
- }
352
- //#endregion
353
- //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js
354
- var InfiniteQueryObserver = class extends QueryObserver {
355
- constructor(client, options) {
356
- super(client, options);
357
- }
358
- bindMethods() {
359
- super.bindMethods();
360
- this.fetchNextPage = this.fetchNextPage.bind(this);
361
- this.fetchPreviousPage = this.fetchPreviousPage.bind(this);
362
- }
363
- setOptions(options) {
364
- super.setOptions({
365
- ...options,
366
- behavior: infiniteQueryBehavior()
367
- });
368
- }
369
- getOptimisticResult(options) {
370
- options.behavior = infiniteQueryBehavior();
371
- return super.getOptimisticResult(options);
372
- }
373
- fetchNextPage(options) {
374
- return this.fetch({
375
- ...options,
376
- meta: { fetchMore: { direction: "forward" } }
377
- });
378
- }
379
- fetchPreviousPage(options) {
380
- return this.fetch({
381
- ...options,
382
- meta: { fetchMore: { direction: "backward" } }
383
- });
384
- }
385
- createResult(query, options) {
386
- const { state } = query;
387
- const parentResult = super.createResult(query, options);
388
- const { isFetching, isRefetching, isError, isRefetchError } = parentResult;
389
- const fetchDirection = state.fetchMeta?.fetchMore?.direction;
390
- const isFetchNextPageError = isError && fetchDirection === "forward";
391
- const isFetchingNextPage = isFetching && fetchDirection === "forward";
392
- const isFetchPreviousPageError = isError && fetchDirection === "backward";
393
- const isFetchingPreviousPage = isFetching && fetchDirection === "backward";
394
- return {
395
- ...parentResult,
396
- fetchNextPage: this.fetchNextPage,
397
- fetchPreviousPage: this.fetchPreviousPage,
398
- hasNextPage: hasNextPage(options, state.data),
399
- hasPreviousPage: hasPreviousPage(options, state.data),
400
- isFetchNextPageError,
401
- isFetchingNextPage,
402
- isFetchPreviousPageError,
403
- isFetchingPreviousPage,
404
- isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,
405
- isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage
406
- };
407
- }
408
- };
409
- //#endregion
410
- //#region ../../node_modules/.pnpm/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queriesObserver.js
411
- function difference(array1, array2) {
412
- const excludeSet = new Set(array2);
413
- return array1.filter((x) => !excludeSet.has(x));
414
- }
415
- function replaceAt(array, index, value) {
416
- const copy = array.slice(0);
417
- copy[index] = value;
418
- return copy;
419
- }
420
- var QueriesObserver = class extends Subscribable {
421
- #client;
422
- #result;
423
- #queries;
424
- #options;
425
- #observers;
426
- #combinedResult;
427
- #lastCombine;
428
- #lastResult;
429
- #lastQueryHashes;
430
- #observerMatches = [];
431
- constructor(client, queries, options) {
432
- super();
433
- this.#client = client;
434
- this.#options = options;
435
- this.#queries = [];
436
- this.#observers = [];
437
- this.#result = [];
438
- this.setQueries(queries);
439
- }
440
- onSubscribe() {
441
- if (this.listeners.size === 1) this.#observers.forEach((observer) => {
442
- observer.subscribe((result) => {
443
- this.#onUpdate(observer, result);
444
- });
445
- });
446
- }
447
- onUnsubscribe() {
448
- if (!this.listeners.size) this.destroy();
449
- }
450
- destroy() {
451
- this.listeners = /* @__PURE__ */ new Set();
452
- this.#observers.forEach((observer) => {
453
- observer.destroy();
454
- });
455
- }
456
- setQueries(queries, options) {
457
- this.#queries = queries;
458
- this.#options = options;
459
- if (process.env.NODE_ENV !== "production") {
460
- const queryHashes = queries.map((query) => this.#client.defaultQueryOptions(query).queryHash);
461
- if (new Set(queryHashes).size !== queryHashes.length) console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.");
462
- }
463
- notifyManager.batch(() => {
464
- const prevObservers = this.#observers;
465
- const newObserverMatches = this.#findMatchingObservers(this.#queries);
466
- newObserverMatches.forEach((match) => match.observer.setOptions(match.defaultedQueryOptions));
467
- const newObservers = newObserverMatches.map((match) => match.observer);
468
- const newResult = newObservers.map((observer) => observer.getCurrentResult());
469
- const hasLengthChange = prevObservers.length !== newObservers.length;
470
- const hasIndexChange = newObservers.some((observer, index) => observer !== prevObservers[index]);
471
- const hasStructuralChange = hasLengthChange || hasIndexChange;
472
- const hasResultChange = hasStructuralChange ? true : newResult.some((result, index) => {
473
- const prev = this.#result[index];
474
- return !prev || !shallowEqualObjects(result, prev);
475
- });
476
- if (!hasStructuralChange && !hasResultChange) return;
477
- if (hasStructuralChange) {
478
- this.#observerMatches = newObserverMatches;
479
- this.#observers = newObservers;
480
- }
481
- this.#result = newResult;
482
- if (!this.hasListeners()) return;
483
- if (hasStructuralChange) {
484
- difference(prevObservers, newObservers).forEach((observer) => {
485
- observer.destroy();
486
- });
487
- difference(newObservers, prevObservers).forEach((observer) => {
488
- observer.subscribe((result) => {
489
- this.#onUpdate(observer, result);
490
- });
491
- });
492
- }
493
- this.#notify();
494
- });
495
- }
496
- getCurrentResult() {
497
- return this.#result;
498
- }
499
- getQueries() {
500
- return this.#observers.map((observer) => observer.getCurrentQuery());
501
- }
502
- getObservers() {
503
- return this.#observers;
504
- }
505
- getOptimisticResult(queries, combine) {
506
- const matches = this.#findMatchingObservers(queries);
507
- const result = matches.map((match) => match.observer.getOptimisticResult(match.defaultedQueryOptions));
508
- const queryHashes = matches.map((match) => match.defaultedQueryOptions.queryHash);
509
- return [
510
- result,
511
- (r) => {
512
- return this.#combineResult(r ?? result, combine, queryHashes);
513
- },
514
- () => {
515
- return this.#trackResult(result, matches);
516
- }
517
- ];
518
- }
519
- #trackResult(result, matches) {
520
- return matches.map((match, index) => {
521
- const observerResult = result[index];
522
- return !match.defaultedQueryOptions.notifyOnChangeProps ? match.observer.trackResult(observerResult, (accessedProp) => {
523
- matches.forEach((m) => {
524
- m.observer.trackProp(accessedProp);
525
- });
526
- }) : observerResult;
527
- });
528
- }
529
- #combineResult(input, combine, queryHashes) {
530
- if (combine) {
531
- const lastHashes = this.#lastQueryHashes;
532
- const queryHashesChanged = queryHashes !== void 0 && lastHashes !== void 0 && (lastHashes.length !== queryHashes.length || queryHashes.some((hash, i) => hash !== lastHashes[i]));
533
- if (!this.#combinedResult || this.#result !== this.#lastResult || queryHashesChanged || combine !== this.#lastCombine) {
534
- this.#lastCombine = combine;
535
- this.#lastResult = this.#result;
536
- if (queryHashes !== void 0) this.#lastQueryHashes = queryHashes;
537
- this.#combinedResult = replaceEqualDeep(this.#combinedResult, combine(input));
538
- }
539
- return this.#combinedResult;
540
- }
541
- return input;
542
- }
543
- #findMatchingObservers(queries) {
544
- const prevObserversMap = /* @__PURE__ */ new Map();
545
- this.#observers.forEach((observer) => {
546
- const key = observer.options.queryHash;
547
- if (!key) return;
548
- const previousObservers = prevObserversMap.get(key);
549
- if (previousObservers) previousObservers.push(observer);
550
- else prevObserversMap.set(key, [observer]);
551
- });
552
- const observers = [];
553
- queries.forEach((options) => {
554
- const defaultedOptions = this.#client.defaultQueryOptions(options);
555
- const observer = prevObserversMap.get(defaultedOptions.queryHash)?.shift() ?? new QueryObserver(this.#client, defaultedOptions);
556
- observers.push({
557
- defaultedQueryOptions: defaultedOptions,
558
- observer
559
- });
560
- });
561
- return observers;
562
- }
563
- #onUpdate(observer, result) {
564
- const index = this.#observers.indexOf(observer);
565
- if (index !== -1) {
566
- this.#result = replaceAt(this.#result, index, result);
567
- this.#notify();
568
- }
569
- }
570
- #notify() {
571
- if (this.hasListeners()) {
572
- const previousResult = this.#combinedResult;
573
- const newTracked = this.#trackResult(this.#result, this.#observerMatches);
574
- if (previousResult !== this.#combineResult(newTracked, this.#options?.combine)) notifyManager.batch(() => {
575
- this.listeners.forEach((listener) => {
576
- listener(this.#result);
577
- });
578
- });
579
- }
580
- }
581
- };
582
- //#endregion
583
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
584
- var QueryClientContext = React$1.createContext(void 0);
585
- var useQueryClient = (queryClient) => {
586
- const client = React$1.useContext(QueryClientContext);
587
- if (queryClient) return queryClient;
588
- if (!client) throw new Error("No QueryClient set, use QueryClientProvider to set one");
589
- return client;
590
- };
591
- //#endregion
592
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
593
- var IsRestoringContext = React$1.createContext(false);
594
- var useIsRestoring = () => React$1.useContext(IsRestoringContext);
595
- IsRestoringContext.Provider;
596
- //#endregion
597
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
598
- function createValue() {
599
- let isReset = false;
600
- return {
601
- clearReset: () => {
602
- isReset = false;
603
- },
604
- reset: () => {
605
- isReset = true;
606
- },
607
- isReset: () => {
608
- return isReset;
609
- }
610
- };
611
- }
612
- var QueryErrorResetBoundaryContext = React$1.createContext(createValue());
613
- var useQueryErrorResetBoundary = () => React$1.useContext(QueryErrorResetBoundaryContext);
614
- //#endregion
615
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
616
- var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
617
- const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
618
- if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
619
- if (!errorResetBoundary.isReset()) options.retryOnMount = false;
620
- }
621
- };
622
- var useClearResetErrorBoundary = (errorResetBoundary) => {
623
- React$1.useEffect(() => {
624
- errorResetBoundary.clearReset();
625
- }, [errorResetBoundary]);
626
- };
627
- var getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {
628
- return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
629
- };
630
- //#endregion
631
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/suspense.js
632
- var ensureSuspenseTimers = (defaultedOptions) => {
633
- if (defaultedOptions.suspense) {
634
- const MIN_SUSPENSE_TIME_MS = 1e3;
635
- const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
636
- const originalStaleTime = defaultedOptions.staleTime;
637
- defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
638
- if (typeof defaultedOptions.gcTime === "number") defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, MIN_SUSPENSE_TIME_MS);
639
- }
640
- };
641
- var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
642
- var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
643
- var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
644
- errorResetBoundary.clearReset();
645
- });
646
- //#endregion
647
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useQueries.js
648
- function useQueries({ queries, ...options }, queryClient) {
649
- const client = useQueryClient(queryClient);
650
- const isRestoring = useIsRestoring();
651
- const errorResetBoundary = useQueryErrorResetBoundary();
652
- const defaultedQueries = React$1.useMemo(() => queries.map((opts) => {
653
- const defaultedOptions = client.defaultQueryOptions(opts);
654
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
655
- return defaultedOptions;
656
- }), [
657
- queries,
658
- client,
659
- isRestoring
660
- ]);
661
- defaultedQueries.forEach((queryOptions) => {
662
- ensureSuspenseTimers(queryOptions);
663
- const query = client.getQueryCache().get(queryOptions.queryHash);
664
- ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query);
665
- });
666
- useClearResetErrorBoundary(errorResetBoundary);
667
- const [observer] = React$1.useState(() => new QueriesObserver(client, defaultedQueries, options));
668
- const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(defaultedQueries, options.combine);
669
- const shouldSubscribe = !isRestoring && options.subscribed !== false;
670
- React$1.useSyncExternalStore(React$1.useCallback((onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
671
- React$1.useEffect(() => {
672
- observer.setQueries(defaultedQueries, options);
673
- }, [
674
- defaultedQueries,
675
- options,
676
- observer
677
- ]);
678
- const suspensePromises = optimisticResult.some((result, index) => shouldSuspend(defaultedQueries[index], result)) ? optimisticResult.flatMap((result, index) => {
679
- const opts = defaultedQueries[index];
680
- if (opts && shouldSuspend(opts, result)) return fetchOptimistic(opts, new QueryObserver(client, opts), errorResetBoundary);
681
- return [];
682
- }) : [];
683
- if (suspensePromises.length > 0) throw Promise.all(suspensePromises);
684
- const firstSingleResultWhichShouldThrow = optimisticResult.find((result, index) => {
685
- const query = defaultedQueries[index];
686
- return query && getHasError({
687
- result,
688
- errorResetBoundary,
689
- throwOnError: query.throwOnError,
690
- query: client.getQueryCache().get(query.queryHash),
691
- suspense: query.suspense
692
- });
693
- });
694
- if (firstSingleResultWhichShouldThrow?.error) throw firstSingleResultWhichShouldThrow.error;
695
- return getCombinedResult(trackResult());
696
- }
697
- //#endregion
698
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
699
- function useBaseQuery(options, Observer, queryClient) {
700
- if (process.env.NODE_ENV !== "production") {
701
- if (typeof options !== "object" || Array.isArray(options)) throw new Error("Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object");
702
- }
703
- const isRestoring = useIsRestoring();
704
- const errorResetBoundary = useQueryErrorResetBoundary();
705
- const client = useQueryClient(queryClient);
706
- const defaultedOptions = client.defaultQueryOptions(options);
707
- client.getDefaultOptions().queries?._experimental_beforeQuery?.(defaultedOptions);
708
- const query = client.getQueryCache().get(defaultedOptions.queryHash);
709
- if (process.env.NODE_ENV !== "production") {
710
- if (!defaultedOptions.queryFn) console.error(`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`);
711
- }
712
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
713
- ensureSuspenseTimers(defaultedOptions);
714
- ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
715
- useClearResetErrorBoundary(errorResetBoundary);
716
- const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
717
- const [observer] = React$1.useState(() => new Observer(client, defaultedOptions));
718
- const result = observer.getOptimisticResult(defaultedOptions);
719
- const shouldSubscribe = !isRestoring && options.subscribed !== false;
720
- React$1.useSyncExternalStore(React$1.useCallback((onStoreChange) => {
721
- const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
722
- observer.updateResult();
723
- return unsubscribe;
724
- }, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
725
- React$1.useEffect(() => {
726
- observer.setOptions(defaultedOptions);
727
- }, [defaultedOptions, observer]);
728
- if (shouldSuspend(defaultedOptions, result)) throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
729
- if (getHasError({
730
- result,
731
- errorResetBoundary,
732
- throwOnError: defaultedOptions.throwOnError,
733
- query,
734
- suspense: defaultedOptions.suspense
735
- })) throw result.error;
736
- client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions, result);
737
- if (defaultedOptions.experimental_prefetchInRender && !isServer && willFetch(result, isRestoring)) (isNewCacheEntry ? fetchOptimistic(defaultedOptions, observer, errorResetBoundary) : query?.promise)?.catch(noop).finally(() => {
738
- observer.updateResult();
739
- });
740
- return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
741
- }
742
- //#endregion
743
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useQuery.js
744
- function useQuery(options, queryClient) {
745
- return useBaseQuery(options, QueryObserver, queryClient);
746
- }
747
- //#endregion
748
- //#region ../../node_modules/.pnpm/@tanstack+react-query@5.90.21_react@19.2.6/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js
749
- function useInfiniteQuery(options, queryClient) {
750
- return useBaseQuery(options, InfiniteQueryObserver, queryClient);
751
- }
752
- //#endregion
753
- //#region ../reactor/dist/forwarding-logger-BkwlvD9W.js
754
- const DRIVE_COLLECTION_PREFIX = "drive.";
755
- /**
756
- * Identifies the collection a remote synchronizes. Collections are drive-level
757
- * abstractions (document-drive and reactor-drive), so a collection id is the
758
- * drive document id plus the branch it scopes to rather than an opaque string.
759
- *
760
- * The canonical string form (`drive.${branch}.${driveId}`) is produced only by
761
- * `key` and parsed only by `fromKey`; that string is the wire and storage
762
- * representation and is byte-for-byte identical to the legacy
763
- * `driveCollectionId(branch, driveId)` output, so existing `document_collections`
764
- * rows and persisted remotes remain valid without migration.
765
- */
766
- var DriveCollectionId = class DriveCollectionId {
767
- driveId;
768
- branch;
769
- constructor(driveId, branch) {
770
- this.driveId = driveId;
771
- this.branch = branch;
772
- }
773
- static forDrive(driveId, branch = "main") {
774
- return new DriveCollectionId(driveId, branch);
775
- }
776
- /**
777
- * The single deserializer for the wire/storage form. `branch` may contain
778
- * dots, while `driveId` is a dot-free document id, so the drive id is the
779
- * final dot-delimited segment.
780
- */
781
- static fromKey(key) {
782
- if (!key.startsWith(DRIVE_COLLECTION_PREFIX)) throw new Error(`Unsupported collection id: ${key}`);
783
- const rest = key.slice(6);
784
- const lastDot = rest.lastIndexOf(".");
785
- if (lastDot === -1 || lastDot === rest.length - 1) throw new Error(`Malformed drive collection id: ${key}`);
786
- return new DriveCollectionId(rest.slice(lastDot + 1), rest.slice(0, lastDot));
787
- }
788
- get key() {
789
- return `${DRIVE_COLLECTION_PREFIX}${this.branch}.${this.driveId}`;
790
- }
791
- toString() {
792
- return this.key;
793
- }
794
- equals(other) {
795
- return this.driveId === other.driveId && this.branch === other.branch;
796
- }
797
- };
798
- new Set([...DOCUMENT_SCOPE_ACTION_TYPES].filter((type) => type !== "CREATE_DOCUMENT"));
799
- //#endregion
800
9
  //#region editors/shared/DocumentErrorBoundary.tsx
801
10
  /** Best-effort message for anything thrown, without stringifying an object. */
802
11
  function errorMessage(error) {
@@ -883,6 +92,7 @@ const ICON_PATHS = {
883
92
  minus: "M5 12h14",
884
93
  list: "M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01",
885
94
  play: "M7 5v14l12-7z",
95
+ stop: "M7 7h10v10H7z",
886
96
  chevron: "M9 6l6 6-6 6",
887
97
  chevronDown: "M6 9l6 6 6-6",
888
98
  retry: "M4 12a8 8 0 1 0 2.3-5.7M4 4v4h4",
@@ -903,9 +113,13 @@ const ICON_PATHS = {
903
113
  clock: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2",
904
114
  bolt: "M13 3L5 13h6l-1 8 8-10h-6l1-8z",
905
115
  branch: "M6 4v10M6 14a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM18 4a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM18 10c0 4-6 3-11 6",
116
+ route: "M12 21v-7M12 14L5 5M12 14l7-9M12 14V3",
117
+ loop: "M17 2l3 3-3 3M4 11V9a4 4 0 0 1 4-4h12M7 22l-3-3 3-3M20 13v2a4 4 0 0 1-4 4H4",
906
118
  lock: "M6 11h12v9H6zM8.5 11V8a3.5 3.5 0 0 1 7 0v3M12 15v2",
907
119
  more: "M5 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2zM12 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2zM19 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2z",
908
- archive: "M4 5h16v4H4zM6 9v10h12V9M10 13h4"
120
+ archive: "M4 5h16v4H4zM6 9v10h12V9M10 13h4",
121
+ subflow: "M4 4h8v6H4zM12 14h8v6h-8zM8 10v7h4",
122
+ reply: "M10 7l-5 5 5 5M5 12h9a5 5 0 0 1 5 5v2"
909
123
  };
910
124
  function isIconName(name) {
911
125
  return typeof name === "string" && name in ICON_PATHS;
@@ -937,7 +151,7 @@ const BUTTON_VARIANT = {
937
151
  secondary: "border border-solid border-foreground/15 bg-card text-foreground hover:bg-accent",
938
152
  ghost: "text-muted-foreground hover:bg-accent hover:text-foreground",
939
153
  danger: "text-wf-fail hover:bg-wf-fail/10",
940
- destructive: "bg-wf-fail text-white hover:opacity-90"
154
+ destructive: "bg-wf-fail text-background hover:opacity-90"
941
155
  };
942
156
  function Button(props) {
943
157
  const { variant = "secondary", size = "md", className = "", ...rest } = props;
@@ -1079,7 +293,7 @@ function Tooltip(props) {
1079
293
  })]
1080
294
  });
1081
295
  }
1082
- function Tabs(props) {
296
+ function Tabs$1(props) {
1083
297
  return /* @__PURE__ */ jsx("div", {
1084
298
  role: "tablist",
1085
299
  className: "flex gap-4",
@@ -1155,7 +369,8 @@ function Select(props) {
1155
369
  width: rect.width,
1156
370
  top: flip ? void 0 : rect.bottom + 4,
1157
371
  bottom: flip ? window.innerHeight - rect.top + 4 : void 0,
1158
- maxHeight: Math.min(320, flip ? above : below)
372
+ maxHeight: Math.min(320, flip ? above : below),
373
+ container: triggerRef.current?.closest("[role=\"dialog\"]") ?? document.body
1159
374
  });
1160
375
  };
1161
376
  const openList = () => {
@@ -1257,7 +472,7 @@ function Select(props) {
1257
472
  selectedIcon,
1258
473
  /* @__PURE__ */ jsx("span", {
1259
474
  className: `min-w-0 flex-1 truncate ${shown.length ? "" : "text-muted-foreground/70"}`,
1260
- children: shown.length > 0 ? shown.join(", ") : props.loading ? "Loading…" : props.placeholder ?? "Choose…"
475
+ children: labels.length === 0 && unknown.length > 0 && props.valueLabel !== void 0 ? props.valueLabel : shown.length > 0 ? shown.join(", ") : props.loading ? "Loading…" : props.placeholder ?? "Choose…"
1261
476
  }),
1262
477
  props.multiple && shown.length > 1 ? /* @__PURE__ */ jsx("span", {
1263
478
  className: "shrink-0 rounded bg-muted px-1.5 text-[11px] tabular-nums text-muted-foreground",
@@ -1388,7 +603,49 @@ function Select(props) {
1388
603
  })
1389
604
  }) : null
1390
605
  ]
1391
- }), document.body) : null] });
606
+ }), position.container) : null] });
607
+ }
608
+ //#endregion
609
+ //#region editors/shared/url-param.ts
610
+ /** The studio's sidebar selection. */
611
+ const ITEM_PARAM = "item";
612
+ /** A query param read as one of `allowed`, else `fallback`; the fallback is
613
+ * kept out of the URL. `also` updates other params in the same entry. */
614
+ function useSearchParam(key, fallback, allowed) {
615
+ const params = useSearchParams();
616
+ const setParams = useSetSearchParams();
617
+ const raw = params[key];
618
+ const value = raw !== void 0 && (!allowed || allowed.includes(raw)) ? raw : fallback;
619
+ return [value, useCallback((next, options) => {
620
+ if (next === value && !options?.also) return;
621
+ setParams({
622
+ ...options?.also,
623
+ [key]: next === fallback ? void 0 : next
624
+ }, { replace: options?.replace });
625
+ }, [
626
+ key,
627
+ fallback,
628
+ value,
629
+ setParams
630
+ ])];
631
+ }
632
+ /** A text param with a local draft, so typing never waits on a navigation;
633
+ * the draft follows other URL changes, e.g. back and forward. */
634
+ function useSearchParamDraft(key) {
635
+ const [param, setParam] = useSearchParam(key, "");
636
+ const [draft, setDraft] = useState(param);
637
+ const written = useRef([]);
638
+ useEffect(() => {
639
+ const index = written.current.indexOf(param);
640
+ written.current = index === -1 ? [] : written.current.slice(index + 1);
641
+ if (index === -1) setDraft(param);
642
+ }, [param]);
643
+ return [draft, useCallback((value) => {
644
+ setDraft(value);
645
+ if (value === param) return;
646
+ written.current.push(value);
647
+ setParam(value, { replace: true });
648
+ }, [param, setParam])];
1392
649
  }
1393
650
  function shouldPersistQuery(queryKey) {
1394
651
  if (typeof queryKey[0] !== "string") return false;
@@ -1396,7 +653,7 @@ function shouldPersistQuery(queryKey) {
1396
653
  if (kind === "catalog") return queryKey.length === 2;
1397
654
  if (kind === "form") {
1398
655
  const block = queryKey[2];
1399
- return Array.isArray(block) && block[0] !== "@powerhousedao/piece-core";
656
+ return Array.isArray(block) && block[0] !== CORE_PIECE_NAME;
1400
657
  }
1401
658
  return false;
1402
659
  }
@@ -1418,7 +675,7 @@ function persistRuntimeQueries(queryClient, url, store, now = Date.now) {
1418
675
  queryKey,
1419
676
  data: state.data,
1420
677
  updatedAt: state.dataUpdatedAt,
1421
- version: 1
678
+ version: 2
1422
679
  }).catch(() => void 0);
1423
680
  })
1424
681
  };
@@ -1431,7 +688,7 @@ async function hydrate(queryClient, url, store, at) {
1431
688
  return;
1432
689
  }
1433
690
  for (const entry of entries) {
1434
- if (entry.version !== 1 || at - entry.updatedAt > 6048e5 || !shouldPersistQuery(entry.queryKey)) {
691
+ if (entry.version !== 2 || at - entry.updatedAt > 6048e5 || !shouldPersistQuery(entry.queryKey)) {
1435
692
  store.remove(entry.id).catch(() => void 0);
1436
693
  continue;
1437
694
  }
@@ -1488,43 +745,40 @@ function usePieceSource() {
1488
745
  return useContext(PieceSourceContext);
1489
746
  }
1490
747
  //#endregion
1491
- //#region editors/workflow-editor/use-runtime-url.ts
1492
- const SUBGRAPH_NAME = "workflow-runtime";
1493
- function baseFromChannelUrl(channelUrl) {
1494
- try {
1495
- const url = new URL(channelUrl);
1496
- url.search = "";
1497
- url.hash = "";
1498
- url.pathname = url.pathname.replace(/\/r\/?$/, "");
1499
- return url.toString();
1500
- } catch {
1501
- return;
1502
- }
1503
- }
1504
- function useWorkflowRuntimeUrl() {
748
+ //#region editors/workflow-editor/use-workflow-runtime.ts
749
+ function useWorkflowRuntime() {
750
+ const switchboards = useSwitchboards();
1505
751
  const [drive] = useSelectedDriveSafe();
1506
- const remotes = useSyncList();
1507
- const defaultDrivesUrl = useDefaultDrivesUrl();
1508
752
  const driveId = drive?.header.id;
1509
- return useMemo(() => {
1510
- let base;
1511
- if (driveId) {
1512
- const channelUrl = (remotes.find((entry) => entry.meta.collectionId.equals(DriveCollectionId.forDrive(driveId)))?.channel)?.config.url;
1513
- if (typeof channelUrl === "string") base = baseFromChannelUrl(channelUrl);
1514
- }
1515
- if (!base && defaultDrivesUrl) try {
1516
- base = parseDriveUrl(defaultDrivesUrl).graphqlEndpoint.replace(/\/r$/, "");
1517
- } catch {}
1518
- return subgraphUrlFromGraphqlUrl(base ?? DEFAULT_SWITCHBOARD_URL, SUBGRAPH_NAME);
1519
- }, [
1520
- driveId,
1521
- remotes,
1522
- defaultDrivesUrl
1523
- ]);
753
+ const [state, setState] = useState({ status: "resolving" });
754
+ useEffect(() => {
755
+ const controller = new AbortController();
756
+ resolveSwitchboard(switchboards, {
757
+ documentId: driveId,
758
+ need: "workflows",
759
+ signal: controller.signal
760
+ }).then((switchboard) => {
761
+ if (controller.signal.aborted) return;
762
+ setState({
763
+ status: "ready",
764
+ url: workflowRuntimeUrl(switchboard),
765
+ switchboard
766
+ });
767
+ }, (error) => {
768
+ if (controller.signal.aborted) return;
769
+ setState({
770
+ status: "unavailable",
771
+ error: error instanceof Error ? error : new Error(String(error))
772
+ });
773
+ });
774
+ return () => controller.abort();
775
+ }, [switchboards, driveId]);
776
+ return state;
1524
777
  }
1525
778
  //#endregion
1526
779
  //#region editors/workflow-editor/runtime-context.tsx
1527
780
  const RuntimeContext = createContext(null);
781
+ const SEARCH_STALE_MS = 3e5;
1528
782
  function runtimePieceSource(client, queryClient) {
1529
783
  return {
1530
784
  loadCatalog: () => queryClient.fetchQuery(catalogQuery(client)),
@@ -1534,7 +788,16 @@ function runtimePieceSource(client, queryClient) {
1534
788
  }),
1535
789
  loadActions: (packageName) => queryClient.fetchQuery(pieceActionsQuery(client, packageName)),
1536
790
  loadTriggers: (packageName) => queryClient.fetchQuery(pieceTriggersQuery(client, packageName)),
1537
- searchBlocks: (query, limit) => client.searchBlocks(query, limit)
791
+ searchPieces: async (query, filter) => {
792
+ const key = runtimeKeys.searchPieces(client.url, query, filter);
793
+ const result = await queryClient.fetchQuery({
794
+ queryKey: key,
795
+ queryFn: () => client.searchPieces(query, filter),
796
+ staleTime: SEARCH_STALE_MS
797
+ });
798
+ if (result.status !== "ready") queryClient.removeQueries({ queryKey: key });
799
+ return result;
800
+ }
1538
801
  };
1539
802
  }
1540
803
  function RuntimeProvider(props) {
@@ -1561,9 +824,15 @@ function RuntimeProvider(props) {
1561
824
  });
1562
825
  }
1563
826
  function WorkflowRuntimeProvider(props) {
1564
- const url = useWorkflowRuntimeUrl();
827
+ const runtime = useWorkflowRuntime();
828
+ if (runtime.status === "resolving") return null;
829
+ if (runtime.status === "unavailable") return /* @__PURE__ */ jsxs("p", {
830
+ role: "alert",
831
+ className: "p-4 text-sm text-wf-fail",
832
+ children: ["The workflow runtime is unavailable: ", runtime.error.message]
833
+ });
1565
834
  return /* @__PURE__ */ jsx(RuntimeProvider, {
1566
- url,
835
+ url: runtime.url,
1567
836
  children: props.children
1568
837
  });
1569
838
  }
@@ -1592,11 +861,24 @@ function useRunPagesQuery(scope, options = {}) {
1592
861
  refetchInterval: options.pollMs ?? false
1593
862
  }, queryClient);
1594
863
  }
864
+ const WAITING_RUN_POLL_MS = 3e4;
1595
865
  function useRunQuery(runId, options = {}) {
1596
866
  const { client, queryClient } = useRuntime();
1597
867
  return useQuery({
1598
868
  ...runQuery(client, runId),
1599
- refetchInterval: (query) => options.pollMs && query.state.data?.endedAt == null ? options.pollMs : false
869
+ refetchInterval: (query) => {
870
+ const data = query.state.data;
871
+ if (!options.pollMs || data?.endedAt != null) return false;
872
+ return data?.status === "WAITING" ? Math.max(options.pollMs, WAITING_RUN_POLL_MS) : options.pollMs;
873
+ }
874
+ }, queryClient);
875
+ }
876
+ function useWaitingRunsQuery(scope, options = {}) {
877
+ const { client, queryClient } = useRuntime();
878
+ return useQuery({
879
+ ...waitingRunsQuery(client, scope),
880
+ enabled: options.active ?? true,
881
+ refetchInterval: options.pollMs ?? false
1600
882
  }, queryClient);
1601
883
  }
1602
884
  function useSecretStat(ref, enabled) {
@@ -1654,7 +936,15 @@ function useRuntimeActions() {
1654
936
  return {
1655
937
  fireWorkflow: (workflowId, payload) => client.fireWorkflow(workflowId, payload).finally(runsChanged),
1656
938
  rerunRun: (runId) => client.rerunRun(runId).finally(runsChanged),
1657
- createSecret: (value, label) => client.createSecret(value, label).then(secretSaved),
939
+ resolveWaitpoint: (waitpoint, approved, reason) => client.resolveWaitpoint(waitpoint.id, approved, reason).finally(() => {
940
+ runsChanged();
941
+ invalidate(runtimeKeys.run(client.url, waitpoint.runId));
942
+ }),
943
+ cancelRun: (runId) => client.cancelRun(runId).finally(() => {
944
+ runsChanged();
945
+ invalidate(runtimeKeys.run(client.url, runId));
946
+ }),
947
+ createSecret: (documentId, value, label) => client.createSecret(documentId, value, label).then(secretSaved),
1658
948
  rotateSecret: (ref, value) => client.rotateSecret(ref, value).then(secretSaved),
1659
949
  checkConnection: (connectionId) => client.checkConnection(connectionId).finally(() => invalidate(runtimeKeys.connections(client.url))),
1660
950
  connectionsChanged: () => invalidate(runtimeKeys.connections(client.url)),
@@ -1663,465 +953,168 @@ function useRuntimeActions() {
1663
953
  }, [client, queryClient]);
1664
954
  }
1665
955
  //#endregion
1666
- //#region editors/workflow-studio/components/run-format.ts
1667
- const RUN_STATUSES = [
1668
- "RUNNING",
1669
- "SUCCEEDED",
1670
- "FAILED"
1671
- ];
1672
- const TONE_TEXT = {
1673
- ok: "text-wf-ok",
1674
- fail: "text-wf-fail",
1675
- warn: "text-wf-warn",
1676
- run: "text-wf-run",
1677
- idle: "text-muted-foreground"
1678
- };
1679
- const TONE_DOT = {
1680
- ok: "bg-wf-ok",
1681
- fail: "bg-wf-fail",
1682
- warn: "bg-wf-warn",
1683
- run: "bg-wf-run",
1684
- idle: "bg-muted-foreground/40"
1685
- };
1686
- const RUN_TONE = {
1687
- SUCCEEDED: "ok",
1688
- FAILED: "fail",
1689
- RUNNING: "run",
1690
- WAITING: "run",
1691
- PENDING: "idle",
1692
- PARKED: "warn",
1693
- CANCELLED: "idle"
1694
- };
1695
- const STEP_TONE = {
1696
- ...RUN_TONE,
1697
- SKIPPED: "idle",
1698
- REPLAYED: "run"
1699
- };
1700
- function runTone(run) {
1701
- if (run.status === "SUCCEEDED" && (run.warningNotes?.length ?? 0) > 0) return "warn";
1702
- return toneOf(RUN_TONE, run.status);
956
+ //#region editors/workflow-editor/ui/validation.ts
957
+ function isEmptyValue(value) {
958
+ if (value === void 0 || value === null) return true;
959
+ if (typeof value === "string") return value.trim() === "";
960
+ if (Array.isArray(value)) return value.length === 0;
961
+ return false;
1703
962
  }
1704
- function runStatusLabel(run) {
1705
- const count = run.warningNotes?.length ?? 0;
1706
- const label = statusLabel(run.status);
1707
- if (run.status !== "SUCCEEDED" || count === 0) return label;
1708
- return `${label}, ${count} ${count === 1 ? "warning" : "warnings"}`;
963
+ function isPropVisible(prop, config) {
964
+ const rule = prop.showWhen;
965
+ if (!rule) return true;
966
+ return rule.oneOf.includes(config[rule.prop] ?? void 0);
1709
967
  }
1710
- function workflowHealth(status, lastRunStatus, published) {
1711
- if (!published) return {
1712
- tone: "idle",
1713
- hollow: true,
1714
- label: "Not published yet"
1715
- };
1716
- const label = (status === "ENABLED" ? "" : `${statusLabel(status ?? "DISABLED")}, `) + (lastRunStatus ? `last run ${statusLabel(lastRunStatus).toLowerCase()}` : "not run yet");
1717
- return {
1718
- tone: toneOf(RUN_TONE, lastRunStatus),
1719
- hollow: false,
1720
- label: label.charAt(0).toUpperCase() + label.slice(1)
1721
- };
968
+ function asRecord(config) {
969
+ return config !== null && typeof config === "object" && !Array.isArray(config) ? config : {};
1722
970
  }
1723
- const CONNECTION_TONE = {
1724
- OK: "ok",
1725
- ERROR: "fail",
1726
- REVOKED: "fail",
1727
- UNCONFIGURED: "warn"
1728
- };
1729
- function toneOf(map, status) {
1730
- return (status ? map[status] : void 0) ?? "idle";
971
+ function missingRequired(props, config) {
972
+ const record = asRecord(config);
973
+ return props.filter((prop) => prop.required && prop.type !== "MARKDOWN" && isPropVisible(prop, record) && isEmptyValue(record[prop.name])).map((prop) => prop.displayName);
1731
974
  }
1732
- function statusLabel(status) {
1733
- return status.charAt(0) + status.slice(1).toLowerCase();
975
+ function resolverInputFor(block, prop, config, connectionId, reactorConnectionId) {
976
+ const refreshers = (prop.refreshers ?? []).filter((name) => name !== "auth");
977
+ return {
978
+ block,
979
+ propName: prop.name,
980
+ refreshers: refreshers.map((name) => config[name] ?? null),
981
+ connectionId: connectionId ?? null,
982
+ ...reactorConnectionId ? { reactorConnectionId } : {}
983
+ };
1734
984
  }
1735
- function formatDuration(startedAt, endedAt) {
1736
- if (!endedAt) return "…";
1737
- return formatMs(new Date(endedAt).getTime() - new Date(startedAt).getTime());
985
+ function settingFor(settings, prop) {
986
+ return settings?.find((setting) => setting.prop === prop);
1738
987
  }
1739
- function runTimeline(run) {
1740
- const start = new Date(run.startedAt).getTime();
1741
- const ends = run.steps.map((step) => step.endedAt ? new Date(step.endedAt).getTime() : 0).concat(run.endedAt ? new Date(run.endedAt).getTime() : 0);
1742
- const total = Math.max(...ends) - start;
1743
- const spans = /* @__PURE__ */ new Map();
1744
- if (total <= 0) return spans;
1745
- for (const step of run.steps) {
1746
- if (!step.startedAt || !step.endedAt) continue;
1747
- const from = new Date(step.startedAt).getTime() - start;
1748
- const ms = new Date(step.endedAt).getTime() - new Date(step.startedAt).getTime();
1749
- spans.set(step.stepId, {
1750
- offset: Math.min(Math.max(from / total, 0), 1),
1751
- width: Math.min(Math.max(ms / total, 0), 1),
1752
- ms
1753
- });
1754
- }
1755
- return spans;
988
+ function parsePropList(result) {
989
+ if (!Array.isArray(result)) throw new Error("Unexpected properties result");
990
+ return result.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.name === "string");
1756
991
  }
1757
- function formatMs(ms) {
1758
- if (ms < 1e3) return `${ms}ms`;
1759
- const tenths = Math.round(ms / 100);
1760
- if (tenths < 600) return `${(tenths / 10).toFixed(1)}s`;
1761
- const seconds = Math.round(ms / 1e3);
1762
- return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
992
+ function storedSchema(settings, prop) {
993
+ const schema = settingFor(settings, prop)?.schema;
994
+ if (!Array.isArray(schema)) return void 0;
995
+ return schema.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.name === "string");
1763
996
  }
1764
- function durationMs(startedAt, endedAt) {
1765
- if (!endedAt) return null;
1766
- return new Date(endedAt).getTime() - new Date(startedAt).getTime();
997
+ function stripOptions(props) {
998
+ return props.map((prop) => {
999
+ const { staticOptions: _options, properties, ...rest } = prop;
1000
+ return properties ? {
1001
+ ...rest,
1002
+ properties: stripOptions(properties)
1003
+ } : rest;
1004
+ });
1767
1005
  }
1768
- function formatWhen(startedAt) {
1769
- const diff = Date.now() - new Date(startedAt).getTime();
1770
- if (diff < 6e4) return "just now";
1771
- if (diff < 36e5) return `${Math.floor(diff / 6e4)}m ago`;
1772
- if (diff < 864e5) return `${Math.floor(diff / 36e5)}h ago`;
1773
- return new Date(startedAt).toLocaleDateString();
1006
+ function withSetting(settings, prop, patch) {
1007
+ const list = [...settings ?? []];
1008
+ const index = list.findIndex((setting) => setting.prop === prop);
1009
+ const current = index >= 0 ? list[index] : {
1010
+ prop,
1011
+ mode: "MANUAL"
1012
+ };
1013
+ const next = {
1014
+ prop,
1015
+ mode: patch.mode ?? current.mode,
1016
+ schema: "schema" in patch ? patch.schema ?? null : current.schema ?? null
1017
+ };
1018
+ if (index >= 0) list[index] = next;
1019
+ else list.push(next);
1020
+ return list;
1774
1021
  }
1775
- function formatAbsolute(iso) {
1776
- return new Date(iso).toLocaleString();
1022
+ const REACTOR_CONNECTION_LABEL = "Reactor connection";
1023
+ function blockMissing(input) {
1024
+ if (input.skip) return [];
1025
+ const { form } = input;
1026
+ if (!form || form === "loading") return null;
1027
+ const record = asRecord(input.config);
1028
+ const missing = [];
1029
+ let unknown = false;
1030
+ if (form.auth === "required" && !input.connectionId) missing.push("Connection");
1031
+ if (form.requireReactor && !input.reactorConnectionId) missing.push(REACTOR_CONNECTION_LABEL);
1032
+ for (const prop of form.props) {
1033
+ if (prop.type === "MARKDOWN" || !isPropVisible(prop, record)) continue;
1034
+ const value = record[prop.name];
1035
+ const bound = settingFor(input.propertySettings, prop.name)?.mode === "EXPRESSION";
1036
+ if (prop.type !== "DYNAMIC" || bound) {
1037
+ if (prop.required && isEmptyValue(value)) missing.push(prop.displayName);
1038
+ continue;
1039
+ }
1040
+ const children = input.resolveDynamic?.(resolverInputFor(input.block, prop, record, input.connectionId, input.reactorConnectionId)) ?? storedSchema(input.propertySettings, prop.name);
1041
+ if (children === void 0) {
1042
+ unknown = true;
1043
+ continue;
1044
+ }
1045
+ missing.push(...missingRequired(children, value));
1046
+ }
1047
+ if (missing.length > 0) return missing;
1048
+ if (form.display === "schedule") {
1049
+ const issue = scheduleConfigIssue(input.config);
1050
+ if (issue) return [issue.replace(/^Schedule: /, "")];
1051
+ }
1052
+ return unknown ? null : [];
1777
1053
  }
1778
- function formatTrigger(kind) {
1779
- return kind.replace(/[-_]/g, " ").toLowerCase();
1054
+ function undeclaredPortIssues(form, outgoingPorts, step) {
1055
+ const formPorts = form && form !== "loading" ? form.ports : void 0;
1056
+ const ports = step ? stepPorts(step.block, step.config, () => formPorts, outgoingPorts) : formPorts;
1057
+ if (!ports || !outgoingPorts) return [];
1058
+ return [...new Set(outgoingPorts)].filter((port) => !ports.includes(port)).map((port) => `An edge leaves on "${port}", which this block never takes`);
1780
1059
  }
1781
- function runStats(runs) {
1782
- const succeeded = runs.filter((run) => run.status === "SUCCEEDED").length;
1783
- const failed = runs.filter((run) => run.status === "FAILED").length;
1784
- const finished = succeeded + failed;
1060
+ function workflowReadiness(blocks, hasTrigger) {
1061
+ const firstIncomplete = blocks.find((block) => block.missing && block.missing.length > 0)?.id ?? null;
1062
+ const checking = blocks.some((block) => block.missing === null);
1785
1063
  return {
1786
- total: runs.length,
1787
- succeeded,
1788
- failed,
1789
- running: runs.filter((run) => run.status === "RUNNING").length,
1790
- lastRun: runs[0],
1791
- successRate: finished === 0 ? null : Math.round(succeeded / finished * 100)
1064
+ ready: hasTrigger && !checking && firstIncomplete === null,
1065
+ hasTrigger,
1066
+ firstIncomplete,
1067
+ checking
1792
1068
  };
1793
1069
  }
1794
1070
  //#endregion
1795
- //#region editors/workflow-editor/ui/block-meta.ts
1796
- const CORE_META = {
1797
- [blockKey(MANUAL_TRIGGER)]: {
1798
- displayName: "Manual",
1799
- subtitle: "Trigger",
1800
- glyph: "▶"
1801
- },
1802
- [blockKey(SCHEDULE_TRIGGER)]: {
1803
- displayName: "Schedule",
1804
- subtitle: "Trigger",
1805
- glyph: "◷"
1806
- },
1807
- [blockKey(WEBHOOK_TRIGGER)]: {
1808
- displayName: "Webhook",
1809
- subtitle: "Trigger",
1810
- glyph: "⇲"
1811
- },
1812
- [blockKey(BRANCH_BLOCK)]: {
1813
- displayName: "Branch",
1814
- subtitle: "Core",
1815
- glyph: "⑂"
1816
- },
1817
- [blockKey(ASSERT_BLOCK)]: {
1818
- displayName: "Assert",
1819
- subtitle: "Core",
1820
- glyph: "!"
1821
- }
1822
- };
1823
- function shortPieceName(packageName) {
1824
- return packageName.split("/").pop()?.replace(/^piece-/, "") ?? "";
1071
+ //#region editors/workflow-editor/ui/design-time.tsx
1072
+ const DesignTimeContext = createContext(null);
1073
+ function DesignTimeProvider(props) {
1074
+ const { service, queryClient, scope } = props;
1075
+ const value = useMemo(() => ({
1076
+ service,
1077
+ queryClient,
1078
+ scope
1079
+ }), [
1080
+ service,
1081
+ queryClient,
1082
+ scope
1083
+ ]);
1084
+ return /* @__PURE__ */ jsx(DesignTimeContext.Provider, {
1085
+ value,
1086
+ children: props.children
1087
+ });
1825
1088
  }
1826
- const pieceLogos = /* @__PURE__ */ new Map();
1827
- const pieceNames = /* @__PURE__ */ new Map();
1828
- const listeners = /* @__PURE__ */ new Set();
1829
- let logoRevision = 0;
1830
- function registerPieceLogos(entries) {
1831
- let changed = false;
1832
- for (const entry of entries) {
1833
- if (!entry.name) continue;
1834
- if (entry.displayName && pieceNames.get(entry.name) !== entry.displayName) {
1835
- pieceNames.set(entry.name, entry.displayName);
1836
- changed = true;
1837
- }
1838
- if (!entry.logoUrl || pieceLogos.get(entry.name) === entry.logoUrl) continue;
1839
- pieceLogos.set(entry.name, entry.logoUrl);
1840
- changed = true;
1841
- }
1842
- if (!changed) return;
1843
- logoRevision += 1;
1844
- for (const listener of listeners) listener();
1089
+ function useDesignTime() {
1090
+ return useContext(DesignTimeContext)?.service;
1845
1091
  }
1846
- function pieceLogo(packageName) {
1847
- return pieceLogos.get(packageName);
1092
+ function useDesignTimeScope() {
1093
+ const context = useContext(DesignTimeContext);
1094
+ const [detached] = useState(() => context ? null : {
1095
+ queryClient: new QueryClient(),
1096
+ scope: ""
1097
+ });
1098
+ return context ?? detached;
1848
1099
  }
1849
- function pieceDisplayName(packageName) {
1850
- return pieceNames.get(packageName);
1100
+ function messageOf(error) {
1101
+ return error instanceof Error ? error.message : String(error);
1851
1102
  }
1852
- const blockNames = /* @__PURE__ */ new Map();
1853
- const namesRequested = /* @__PURE__ */ new Set();
1854
- const namesPending = /* @__PURE__ */ new Set();
1855
- function registerBlockNames(entries) {
1856
- let changed = false;
1857
- for (const entry of entries) {
1858
- const key = blockKey(entry);
1859
- if (!entry.displayName || blockNames.get(key) === entry.displayName) continue;
1860
- blockNames.set(key, entry.displayName);
1861
- changed = true;
1862
- }
1863
- if (!changed) return;
1864
- logoRevision += 1;
1865
- for (const listener of listeners) listener();
1866
- }
1867
- function requestBlockNames(packageName) {
1868
- if (!namesRequested.has(packageName)) namesPending.add(packageName);
1869
- }
1870
- function loadPendingBlockNames(source) {
1871
- for (const packageName of namesPending) loadBlockNames(source, packageName);
1872
- namesPending.clear();
1873
- }
1874
- function loadBlockNames(source, packageName) {
1875
- if (namesRequested.has(packageName)) return;
1876
- namesRequested.add(packageName);
1877
- Promise.all([source.loadActions(packageName), source.loadTriggers(packageName)]).then(([actions, triggers]) => registerBlockNames([...actions.map((entry) => ({
1878
- ...entry,
1879
- kind: "action"
1880
- })), ...triggers.map((entry) => ({
1881
- ...entry,
1882
- kind: "trigger"
1883
- }))])).catch(() => namesRequested.delete(packageName));
1884
- }
1885
- function subscribePieceLogos(listener) {
1886
- listeners.add(listener);
1887
- return () => listeners.delete(listener);
1888
- }
1889
- function pieceLogoRevision() {
1890
- return logoRevision;
1891
- }
1892
- const logoMisses = /* @__PURE__ */ new Set();
1893
- let catalogLoads = /* @__PURE__ */ new WeakMap();
1894
- const retryTimers = /* @__PURE__ */ new Set();
1895
- const CATALOG_RETRY_MS = 2e3;
1896
- function notify() {
1897
- logoRevision += 1;
1898
- for (const listener of listeners) listener();
1899
- }
1900
- function scheduleRetry(state) {
1901
- if (state.attempts >= 5) return;
1902
- const timer = setTimeout(() => {
1903
- retryTimers.delete(timer);
1904
- state.load = void 0;
1905
- notify();
1906
- }, CATALOG_RETRY_MS * 2 ** (state.attempts - 1));
1907
- retryTimers.add(timer);
1908
- }
1909
- function ensurePieceLogos(source) {
1910
- if (!source) return Promise.resolve();
1911
- let state = catalogLoads.get(source);
1912
- if (!state) {
1913
- state = { attempts: 0 };
1914
- catalogLoads.set(source, state);
1915
- }
1916
- if (state.load) return state.load;
1917
- const current = state;
1918
- const request = current.attempts > 0 && source.reloadCatalog ? source.reloadCatalog() : source.loadCatalog();
1919
- current.attempts += 1;
1920
- current.load = request.then((pieces) => {
1921
- registerPieceLogos(pieces);
1922
- const listed = new Set(pieces.map((piece) => piece.name));
1923
- if ([...logoMisses].some((name) => !listed.has(name) && !pieceLogos.has(name))) scheduleRetry(current);
1924
- }, () => scheduleRetry(current));
1925
- return current.load;
1926
- }
1927
- function blockMeta(block) {
1928
- const key = blockKey(block);
1929
- const core = CORE_META[key];
1930
- if (core) return core;
1931
- if (isCoreBlock(block)) return {
1932
- displayName: titleCase(block.name),
1933
- subtitle: "Core",
1934
- glyph: "?"
1935
- };
1936
- const packageName = block.pieceName;
1937
- const short = shortPieceName(packageName);
1938
- const pieceLabel = pieceNames.get(packageName) ?? titleCase(short);
1939
- const known = blockNames.get(key);
1940
- if (!known) requestBlockNames(packageName);
1941
- const logoUrl = pieceLogo(packageName);
1942
- if (!logoUrl) logoMisses.add(packageName);
1943
- return {
1944
- displayName: known ?? titleCase(block.name),
1945
- subtitle: block.kind === "trigger" ? `${pieceLabel} · Trigger` : pieceLabel,
1946
- logoUrl,
1947
- glyph: short.slice(0, 1).toUpperCase() || "?"
1948
- };
1949
- }
1950
- function titleCase(value) {
1951
- return value.replaceAll(/[-_]/g, " ").replace(/^\w/, (char) => char.toUpperCase());
1952
- }
1953
- function usePieceLogos() {
1954
- const source = usePieceSource();
1955
- const revision = useSyncExternalStore(subscribePieceLogos, pieceLogoRevision, pieceLogoRevision);
1956
- useEffect(() => {
1957
- ensurePieceLogos(source);
1958
- if (source && namesPending.size > 0) loadPendingBlockNames(source);
1959
- });
1960
- return revision;
1961
- }
1962
- function useBlockMeta(block) {
1963
- usePieceLogos();
1964
- return blockMeta(block);
1965
- }
1966
- //#endregion
1967
- //#region editors/workflow-editor/ui/validation.ts
1968
- function isEmptyValue(value) {
1969
- if (value === void 0 || value === null) return true;
1970
- if (typeof value === "string") return value.trim() === "";
1971
- if (Array.isArray(value)) return value.length === 0;
1972
- return false;
1973
- }
1974
- function isPropVisible(prop, config) {
1975
- const rule = prop.showWhen;
1976
- if (!rule) return true;
1977
- return rule.oneOf.includes(config[rule.prop] ?? void 0);
1978
- }
1979
- function asRecord(config) {
1980
- return config !== null && typeof config === "object" && !Array.isArray(config) ? config : {};
1981
- }
1982
- function missingRequired(props, config) {
1983
- const record = asRecord(config);
1984
- return props.filter((prop) => prop.required && prop.type !== "MARKDOWN" && isPropVisible(prop, record) && isEmptyValue(record[prop.name])).map((prop) => prop.displayName);
1985
- }
1986
- function resolverInputFor(block, prop, config, connectionId) {
1987
- const refreshers = (prop.refreshers ?? []).filter((name) => name !== "auth");
1988
- return {
1989
- block,
1990
- propName: prop.name,
1991
- refreshers: refreshers.map((name) => config[name] ?? null),
1992
- connectionId: connectionId ?? null
1993
- };
1994
- }
1995
- function settingFor(settings, prop) {
1996
- return settings?.find((setting) => setting.prop === prop);
1997
- }
1998
- function parsePropList(result) {
1999
- if (!Array.isArray(result)) throw new Error("Unexpected properties result");
2000
- return result.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.name === "string");
2001
- }
2002
- function storedSchema(settings, prop) {
2003
- const schema = settingFor(settings, prop)?.schema;
2004
- if (!Array.isArray(schema)) return void 0;
2005
- return schema.filter((entry) => entry !== null && typeof entry === "object" && typeof entry.name === "string");
2006
- }
2007
- function stripOptions(props) {
2008
- return props.map((prop) => {
2009
- const { staticOptions: _options, properties, ...rest } = prop;
2010
- return properties ? {
2011
- ...rest,
2012
- properties: stripOptions(properties)
2013
- } : rest;
2014
- });
2015
- }
2016
- function withSetting(settings, prop, patch) {
2017
- const list = [...settings ?? []];
2018
- const index = list.findIndex((setting) => setting.prop === prop);
2019
- const current = index >= 0 ? list[index] : {
2020
- prop,
2021
- mode: "MANUAL"
2022
- };
2023
- const next = {
2024
- prop,
2025
- mode: patch.mode ?? current.mode,
2026
- schema: "schema" in patch ? patch.schema ?? null : current.schema ?? null
2027
- };
2028
- if (index >= 0) list[index] = next;
2029
- else list.push(next);
2030
- return list;
2031
- }
2032
- function blockMissing(input) {
2033
- if (input.skip) return [];
2034
- const { form } = input;
2035
- if (!form || form === "loading") return null;
2036
- const record = asRecord(input.config);
2037
- const missing = [];
2038
- let unknown = false;
2039
- if (form.auth === "required" && !input.connectionId) missing.push("Connection");
2040
- for (const prop of form.props) {
2041
- if (prop.type === "MARKDOWN" || !isPropVisible(prop, record)) continue;
2042
- const value = record[prop.name];
2043
- const bound = settingFor(input.propertySettings, prop.name)?.mode === "EXPRESSION";
2044
- if (prop.type !== "DYNAMIC" || bound) {
2045
- if (prop.required && isEmptyValue(value)) missing.push(prop.displayName);
2046
- continue;
2047
- }
2048
- const children = input.resolveDynamic?.(resolverInputFor(input.block, prop, record, input.connectionId)) ?? storedSchema(input.propertySettings, prop.name);
2049
- if (children === void 0) {
2050
- unknown = true;
2051
- continue;
2052
- }
2053
- missing.push(...missingRequired(children, value));
2054
- }
2055
- if (missing.length > 0) return missing;
2056
- if (form.display === "schedule") {
2057
- const issue = scheduleConfigIssue(input.config);
2058
- if (issue) return [issue.replace(/^Schedule: /, "")];
2059
- }
2060
- return unknown ? null : [];
2061
- }
2062
- function undeclaredPortIssues(form, outgoingPorts) {
2063
- const ports = form && form !== "loading" ? form.ports : void 0;
2064
- if (!ports || !outgoingPorts) return [];
2065
- return [...new Set(outgoingPorts)].filter((port) => !ports.includes(port)).map((port) => `An edge leaves on "${port}", which this block never takes`);
2066
- }
2067
- function workflowReadiness(blocks, hasTrigger) {
2068
- const firstIncomplete = blocks.find((block) => block.missing && block.missing.length > 0)?.id ?? null;
2069
- const checking = blocks.some((block) => block.missing === null);
2070
- return {
2071
- ready: hasTrigger && !checking && firstIncomplete === null,
2072
- hasTrigger,
2073
- firstIncomplete,
2074
- checking
2075
- };
2076
- }
2077
- //#endregion
2078
- //#region editors/workflow-editor/ui/design-time.tsx
2079
- const DesignTimeContext = createContext(null);
2080
- function DesignTimeProvider(props) {
2081
- const { service, queryClient, scope } = props;
2082
- const value = useMemo(() => ({
2083
- service,
2084
- queryClient,
2085
- scope
2086
- }), [
2087
- service,
2088
- queryClient,
2089
- scope
2090
- ]);
2091
- return /* @__PURE__ */ jsx(DesignTimeContext.Provider, {
2092
- value,
2093
- children: props.children
2094
- });
2095
- }
2096
- function useDesignTime() {
2097
- return useContext(DesignTimeContext)?.service;
2098
- }
2099
- function useDesignTimeScope() {
2100
- const context = useContext(DesignTimeContext);
2101
- const [detached] = useState(() => context ? null : {
2102
- queryClient: new QueryClient(),
2103
- scope: ""
2104
- });
2105
- return context ?? detached;
2106
- }
2107
- function messageOf(error) {
2108
- return error instanceof Error ? error.message : String(error);
2109
- }
2110
- function useBlockForm(block) {
2111
- const { service, queryClient, scope } = useDesignTimeScope();
2112
- const query = useQuery({
2113
- queryKey: runtimeKeys.form(scope, block),
2114
- queryFn: () => service.getBlockForm(block),
2115
- enabled: Boolean(service),
2116
- staleTime: SHARED_STALE_MS
2117
- }, queryClient);
2118
- if (!service) return { form: null };
2119
- if (query.data !== void 0) return { form: query.data };
2120
- if (query.status === "error") return {
2121
- form: null,
2122
- error: messageOf(query.error)
2123
- };
2124
- return { form: "loading" };
1103
+ function useBlockForm(block) {
1104
+ const { service, queryClient, scope } = useDesignTimeScope();
1105
+ const query = useQuery({
1106
+ queryKey: runtimeKeys.form(scope, block),
1107
+ queryFn: () => service.getBlockForm(block),
1108
+ enabled: Boolean(service),
1109
+ staleTime: SHARED_STALE_MS
1110
+ }, queryClient);
1111
+ if (!service) return { form: null };
1112
+ if (query.data !== void 0) return { form: query.data };
1113
+ if (query.status === "error") return {
1114
+ form: null,
1115
+ error: messageOf(query.error)
1116
+ };
1117
+ return { form: "loading" };
2125
1118
  }
2126
1119
  function formQuery(service, scope, block) {
2127
1120
  return {
@@ -2190,8 +1183,17 @@ function keyHash(value) {
2190
1183
  return String(value);
2191
1184
  }
2192
1185
  }
2193
- function useSettled(value, ms) {
2194
- const hash = keyHash(value);
1186
+ const SYNC_REFUSAL = /forbidden|document\b.*not found|was not found/i;
1187
+ const SYNC_RETRIES_MAX = 4;
1188
+ function retryWhileSyncing(input) {
1189
+ if (!input.reactorConnectionId) return {};
1190
+ return {
1191
+ retry: (failures, error) => failures < SYNC_RETRIES_MAX && SYNC_REFUSAL.test(messageOf(error)),
1192
+ retryDelay: 1e3
1193
+ };
1194
+ }
1195
+ function useSettled(value, ms) {
1196
+ const hash = keyHash(value);
2195
1197
  const latest = useRef(value);
2196
1198
  useEffect(() => {
2197
1199
  latest.current = value;
@@ -2230,34 +1232,41 @@ function useResolvedProp(options) {
2230
1232
  return current.parse(await current.load());
2231
1233
  },
2232
1234
  enabled,
2233
- staleTime: RESOLVER_STALE_MS
1235
+ staleTime: RESOLVER_STALE_MS,
1236
+ ...retryWhileSyncing(input)
2234
1237
  }, queryClient);
2235
1238
  const reload = () => void query.refetch();
1239
+ const syncing = query.isFetching && query.failureCount > 0;
2236
1240
  if (!enabled) return {
2237
1241
  state: { kind: "idle" },
2238
- reload
1242
+ reload,
1243
+ syncing: false
2239
1244
  };
2240
1245
  if (query.isFetching) return {
2241
1246
  state: { kind: "loading" },
2242
- reload
1247
+ reload,
1248
+ syncing
2243
1249
  };
2244
1250
  if (query.status === "error") return {
2245
1251
  state: {
2246
1252
  kind: "error",
2247
1253
  message: messageOf(query.error)
2248
1254
  },
2249
- reload
1255
+ reload,
1256
+ syncing
2250
1257
  };
2251
1258
  if (query.status === "success") return {
2252
1259
  state: {
2253
1260
  kind: "ready",
2254
1261
  result: query.data
2255
1262
  },
2256
- reload
1263
+ reload,
1264
+ syncing
2257
1265
  };
2258
1266
  return {
2259
1267
  state: { kind: "loading" },
2260
- reload
1268
+ reload,
1269
+ syncing
2261
1270
  };
2262
1271
  }
2263
1272
  function useOptionSearch(options) {
@@ -2280,167 +1289,538 @@ function useOptionSearch(options) {
2280
1289
  },
2281
1290
  enabled: Boolean(options.load) && settled !== "" && typed !== "",
2282
1291
  staleTime: RESOLVER_STALE_MS,
1292
+ ...retryWhileSyncing(options.input),
2283
1293
  placeholderData: keepPreviousData
2284
1294
  }, queryClient);
2285
1295
  return typed === "" ? null : query.data ?? null;
2286
1296
  }
2287
- function getResolvedDynamicProps(queryClient, scope, input) {
2288
- return queryClient.getQueryData(runtimeKeys.dynamic(scope, input));
1297
+ function getResolvedDynamicProps(queryClient, scope, input) {
1298
+ return queryClient.getQueryData(runtimeKeys.dynamic(scope, input));
1299
+ }
1300
+ function useDynamicPrefetch() {
1301
+ const { service, queryClient, scope } = useDesignTimeScope();
1302
+ return useMemo(() => (input, config) => {
1303
+ if (!service) return;
1304
+ queryClient.prefetchQuery({
1305
+ queryKey: runtimeKeys.dynamic(scope, input),
1306
+ queryFn: () => service.loadOptions(input.block, input.propName, config, input.connectionId ?? void 0, void 0, input.reactorConnectionId ?? void 0).then(parsePropList),
1307
+ staleTime: RESOLVER_STALE_MS,
1308
+ ...retryWhileSyncing(input)
1309
+ });
1310
+ }, [
1311
+ service,
1312
+ queryClient,
1313
+ scope
1314
+ ]);
1315
+ }
1316
+ function useDynamicCache() {
1317
+ const { queryClient, scope } = useDesignTimeScope();
1318
+ return useMemo(() => (input) => getResolvedDynamicProps(queryClient, scope, input), [queryClient, scope]);
1319
+ }
1320
+ function useDynamicLookup() {
1321
+ const { queryClient, scope } = useDesignTimeScope();
1322
+ const [version, setVersion] = useState(0);
1323
+ useEffect(() => queryClient.getQueryCache().subscribe((event) => {
1324
+ if (event.type !== "updated") return;
1325
+ const key = event.query.queryKey;
1326
+ if (key[0] === scope && key[1] === "dynamic") setVersion((v) => v + 1);
1327
+ }), [queryClient, scope]);
1328
+ return useMemo(() => (input) => version >= 0 ? getResolvedDynamicProps(queryClient, scope, input) : void 0, [
1329
+ queryClient,
1330
+ scope,
1331
+ version
1332
+ ]);
1333
+ }
1334
+ function useRunById(runId) {
1335
+ const { service, queryClient, scope } = useDesignTimeScope();
1336
+ const fetchRun = service?.fetchRun;
1337
+ const query = useQuery({
1338
+ queryKey: runtimeKeys.run(scope, runId ?? ""),
1339
+ queryFn: () => fetchRun(runId),
1340
+ enabled: Boolean(fetchRun && runId),
1341
+ staleTime: Infinity
1342
+ }, queryClient);
1343
+ if (!runId) return null;
1344
+ return query.data;
1345
+ }
1346
+ function useLatestRun(enabled = true) {
1347
+ const { service, queryClient, scope } = useDesignTimeScope();
1348
+ const active = enabled && Boolean(service?.latestRun);
1349
+ const query = useQuery({
1350
+ queryKey: runtimeKeys.latestRun(scope, service?.workflowId ?? ""),
1351
+ queryFn: () => service.latestRun(),
1352
+ enabled: active,
1353
+ staleTime: 0
1354
+ }, queryClient);
1355
+ if (!active) return null;
1356
+ if (query.status === "pending") return { kind: "loading" };
1357
+ return {
1358
+ kind: "ready",
1359
+ run: query.data ?? null
1360
+ };
1361
+ }
1362
+ const SYNC_RETRIES = 5;
1363
+ const SYNC_RETRY_MS = 2e3;
1364
+ function useWebhookEndpoint(enabled) {
1365
+ const { service, queryClient, scope } = useDesignTimeScope();
1366
+ const active = enabled && Boolean(service?.webhookEndpoint);
1367
+ const query = useQuery({
1368
+ queryKey: runtimeKeys.webhook(scope, service?.workflowId ?? ""),
1369
+ queryFn: () => service.webhookEndpoint(),
1370
+ enabled: active,
1371
+ staleTime: 0,
1372
+ gcTime: 0,
1373
+ retry: (failures, error) => isSyncingError(error) && failures < SYNC_RETRIES,
1374
+ retryDelay: SYNC_RETRY_MS
1375
+ }, queryClient);
1376
+ if (query.status === "pending" && isSyncingError(query.failureReason)) return { kind: "syncing" };
1377
+ if (query.status === "error") return {
1378
+ kind: "error",
1379
+ message: messageOf(query.error)
1380
+ };
1381
+ if (query.status === "pending") return { kind: "loading" };
1382
+ return query.data ? {
1383
+ kind: "ready",
1384
+ endpoint: query.data
1385
+ } : { kind: "empty" };
1386
+ }
1387
+ function useConnectionList() {
1388
+ const { service, queryClient, scope } = useDesignTimeScope();
1389
+ const list = service?.listConnections;
1390
+ const options = {
1391
+ queryKey: runtimeKeys.connections(scope, service?.connectionScope ?? null),
1392
+ queryFn: () => list(),
1393
+ staleTime: 0,
1394
+ gcTime: 0
1395
+ };
1396
+ const query = useQuery({
1397
+ ...options,
1398
+ enabled: Boolean(list)
1399
+ }, queryClient);
1400
+ return {
1401
+ connections: query.data ?? [],
1402
+ refetch: () => {
1403
+ if (list) query.refetch();
1404
+ },
1405
+ invalidate: () => void queryClient.invalidateQueries({ queryKey: runtimeKeys.connections(scope) }),
1406
+ fetchNow: () => list ? queryClient.fetchQuery({
1407
+ ...options,
1408
+ staleTime: 0
1409
+ }) : Promise.resolve([])
1410
+ };
1411
+ }
1412
+ function useTestStepRunner() {
1413
+ const { service, queryClient, scope } = useDesignTimeScope();
1414
+ const test = service?.testStep;
1415
+ if (!test) return void 0;
1416
+ return (stepId) => test(stepId).finally(() => {
1417
+ for (const queryKey of [
1418
+ runtimeKeys.allRuns(scope),
1419
+ [scope, "latestRun"],
1420
+ runtimeKeys.outputTrees(scope)
1421
+ ]) queryClient.invalidateQueries({ queryKey });
1422
+ });
1423
+ }
1424
+ function useTestTrigger() {
1425
+ const { service, queryClient, scope } = useDesignTimeScope();
1426
+ const test = service?.testTrigger;
1427
+ if (!test) return void 0;
1428
+ return () => test().finally(() => void queryClient.invalidateQueries({ queryKey: runtimeKeys.outputTrees(scope) }));
1429
+ }
1430
+ var DraftNotSynced = class extends Error {};
1431
+ const DRAFT_SYNC_RETRIES = 10;
1432
+ /**
1433
+ * The piece version each draft block runs, trigger first; `blocks` is the
1434
+ * draft in that order. Empty outside a runtime, or until the runtime answers.
1435
+ */
1436
+ function useBlockResolutions(workflowId, blocks) {
1437
+ const { service, queryClient, scope } = useDesignTimeScope();
1438
+ const fetchResolutions = service?.blockResolutions;
1439
+ const expected = blocks.map((entry) => `${entry.id}=${blockRefKey(entry.block)}`);
1440
+ return useQuery({
1441
+ queryKey: runtimeKeys.blockResolutions(scope, workflowId, blocks.map((entry) => entry.block)),
1442
+ queryFn: async () => {
1443
+ const resolutions = await fetchResolutions();
1444
+ if (keyHash(resolutions.map((resolution) => `${resolution.stepId}=${blockRefKey(resolution)}`)) !== keyHash(expected)) throw new DraftNotSynced();
1445
+ return resolutions;
1446
+ },
1447
+ enabled: Boolean(fetchResolutions && workflowId),
1448
+ retry: (count, error) => error instanceof DraftNotSynced && count < DRAFT_SYNC_RETRIES,
1449
+ retryDelay: 300,
1450
+ placeholderData: keepPreviousData,
1451
+ staleTime: 0
1452
+ }, queryClient).data ?? EMPTY_RESOLUTIONS;
1453
+ }
1454
+ const EMPTY_RESOLUTIONS = [];
1455
+ //#endregion
1456
+ //#region editors/workflow-studio/components/run-format.ts
1457
+ const RUN_STATUSES = [
1458
+ "RUNNING",
1459
+ "WAITING",
1460
+ "SUCCEEDED",
1461
+ "FAILED"
1462
+ ];
1463
+ const TONE_TEXT = {
1464
+ ok: "text-wf-ok",
1465
+ fail: "text-wf-fail",
1466
+ warn: "text-wf-warn",
1467
+ run: "text-wf-run",
1468
+ idle: "text-muted-foreground"
1469
+ };
1470
+ const TONE_DOT = {
1471
+ ok: "bg-wf-ok",
1472
+ fail: "bg-wf-fail",
1473
+ warn: "bg-wf-warn",
1474
+ run: "bg-wf-run",
1475
+ idle: "bg-muted-foreground/40"
1476
+ };
1477
+ const RUN_TONE = {
1478
+ SUCCEEDED: "ok",
1479
+ FAILED: "fail",
1480
+ RUNNING: "run",
1481
+ WAITING: "warn",
1482
+ PENDING: "idle",
1483
+ PARKED: "warn",
1484
+ CANCELLED: "idle"
1485
+ };
1486
+ const STEP_TONE = {
1487
+ ...RUN_TONE,
1488
+ SKIPPED: "idle",
1489
+ REPLAYED: "run",
1490
+ INDETERMINATE: "warn"
1491
+ };
1492
+ function runTone(run) {
1493
+ if (run.status === "SUCCEEDED" && (run.warningNotes?.length ?? 0) > 0) return "warn";
1494
+ return toneOf(RUN_TONE, run.status);
1495
+ }
1496
+ function runStatusLabel(run) {
1497
+ const count = run.warningNotes?.length ?? 0;
1498
+ const label = statusLabel(run.status);
1499
+ if (run.status !== "SUCCEEDED" || count === 0) return label;
1500
+ return `${label}, ${count} ${count === 1 ? "warning" : "warnings"}`;
1501
+ }
1502
+ function workflowHealth(status, lastRunStatus, published) {
1503
+ if (!published) return {
1504
+ tone: "idle",
1505
+ hollow: true,
1506
+ label: "Not published yet"
1507
+ };
1508
+ const label = (status === "ENABLED" ? "" : `${statusLabel(status ?? "DISABLED")}, `) + (lastRunStatus ? `last run ${statusLabel(lastRunStatus).toLowerCase()}` : "not run yet");
1509
+ return {
1510
+ tone: toneOf(RUN_TONE, lastRunStatus),
1511
+ hollow: false,
1512
+ label: label.charAt(0).toUpperCase() + label.slice(1)
1513
+ };
1514
+ }
1515
+ const CONNECTION_TONE = {
1516
+ OK: "ok",
1517
+ ERROR: "fail",
1518
+ REVOKED: "fail",
1519
+ UNCONFIGURED: "warn"
1520
+ };
1521
+ function toneOf(map, status) {
1522
+ return (status ? map[status] : void 0) ?? "idle";
1523
+ }
1524
+ function statusLabel(status) {
1525
+ return status.charAt(0) + status.slice(1).toLowerCase();
1526
+ }
1527
+ function formatDuration(startedAt, endedAt) {
1528
+ if (!endedAt) return "…";
1529
+ return formatMs(new Date(endedAt).getTime() - new Date(startedAt).getTime());
1530
+ }
1531
+ function runTimeline(run) {
1532
+ const start = new Date(run.startedAt).getTime();
1533
+ const ends = run.steps.map((step) => step.endedAt ? new Date(step.endedAt).getTime() : 0).concat(run.endedAt ? new Date(run.endedAt).getTime() : 0);
1534
+ const total = Math.max(...ends) - start;
1535
+ const spans = /* @__PURE__ */ new Map();
1536
+ if (total <= 0) return spans;
1537
+ for (const step of run.steps) {
1538
+ if (!step.startedAt || !step.endedAt) continue;
1539
+ const from = new Date(step.startedAt).getTime() - start;
1540
+ const ms = new Date(step.endedAt).getTime() - new Date(step.startedAt).getTime();
1541
+ spans.set(step.stepId, {
1542
+ offset: Math.min(Math.max(from / total, 0), 1),
1543
+ width: Math.min(Math.max(ms / total, 0), 1),
1544
+ ms
1545
+ });
1546
+ }
1547
+ return spans;
1548
+ }
1549
+ function formatMs(ms) {
1550
+ if (ms < 1e3) return `${ms}ms`;
1551
+ const tenths = Math.round(ms / 100);
1552
+ if (tenths < 600) return `${(tenths / 10).toFixed(1)}s`;
1553
+ const seconds = Math.round(ms / 1e3);
1554
+ return `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
1555
+ }
1556
+ function durationMs(startedAt, endedAt) {
1557
+ if (!endedAt) return null;
1558
+ return new Date(endedAt).getTime() - new Date(startedAt).getTime();
1559
+ }
1560
+ function formatWhen(startedAt) {
1561
+ const diff = Date.now() - new Date(startedAt).getTime();
1562
+ if (diff < 6e4) return "just now";
1563
+ if (diff < 36e5) return `${Math.floor(diff / 6e4)}m ago`;
1564
+ if (diff < 864e5) return `${Math.floor(diff / 36e5)}h ago`;
1565
+ return new Date(startedAt).toLocaleDateString();
1566
+ }
1567
+ function formatUntil(iso) {
1568
+ const diff = new Date(iso).getTime() - Date.now();
1569
+ if (diff <= 0) return null;
1570
+ if (diff < 6e4) return "in under a minute";
1571
+ if (diff < 36e5) return `in ${Math.floor(diff / 6e4)}m`;
1572
+ if (diff < 864e5) return `in ${Math.floor(diff / 36e5)}h`;
1573
+ if (diff < 6048e5) return `in ${Math.floor(diff / 864e5)}d`;
1574
+ return `on ${new Date(iso).toLocaleDateString()}`;
1575
+ }
1576
+ function formatAbsolute(iso) {
1577
+ return new Date(iso).toLocaleString();
1578
+ }
1579
+ function formatTrigger(kind) {
1580
+ return kind.replace(/[-_]/g, " ").toLowerCase();
1581
+ }
1582
+ function runStats(runs) {
1583
+ const succeeded = runs.filter((run) => run.status === "SUCCEEDED").length;
1584
+ const failed = runs.filter((run) => run.status === "FAILED").length;
1585
+ const finished = succeeded + failed;
1586
+ return {
1587
+ total: runs.length,
1588
+ succeeded,
1589
+ failed,
1590
+ running: runs.filter((run) => run.status === "RUNNING").length,
1591
+ lastRun: runs[0],
1592
+ successRate: finished === 0 ? null : Math.round(succeeded / finished * 100)
1593
+ };
1594
+ }
1595
+ const RUN_DEADLINE_ERROR_NAME = "RunDeadlineExceeded";
1596
+ function canRerun(run) {
1597
+ return run.status === "FAILED" || run.status === "CANCELLED" && run.errorName === RUN_DEADLINE_ERROR_NAME;
1598
+ }
1599
+ //#endregion
1600
+ //#region editors/workflow-editor/ui/block-meta.ts
1601
+ const CORE_META = {
1602
+ [blockKey(MANUAL_TRIGGER)]: {
1603
+ displayName: "Manual",
1604
+ subtitle: "Trigger",
1605
+ glyph: "▶"
1606
+ },
1607
+ [blockKey(SCHEDULE_TRIGGER)]: {
1608
+ displayName: "Schedule",
1609
+ subtitle: "Trigger",
1610
+ glyph: "◷"
1611
+ },
1612
+ [blockKey(WEBHOOK_TRIGGER)]: {
1613
+ displayName: "Webhook",
1614
+ subtitle: "Trigger",
1615
+ glyph: "⇲"
1616
+ },
1617
+ [blockKey(BRANCH_BLOCK)]: {
1618
+ displayName: "Branch",
1619
+ subtitle: "Core",
1620
+ glyph: "⑂"
1621
+ },
1622
+ [blockKey(ROUTER_BLOCK)]: {
1623
+ displayName: "Router",
1624
+ subtitle: "Core",
1625
+ glyph: "⑃"
1626
+ },
1627
+ [blockKey(LOOP_BLOCK)]: {
1628
+ displayName: "Loop on items",
1629
+ subtitle: "Core",
1630
+ glyph: "↻"
1631
+ },
1632
+ [blockKey(ASSERT_BLOCK)]: {
1633
+ displayName: "Assert",
1634
+ subtitle: "Core",
1635
+ glyph: "!"
1636
+ },
1637
+ [blockKey(DELAY_BLOCK)]: {
1638
+ displayName: "Delay",
1639
+ subtitle: "Core",
1640
+ glyph: "⧗"
1641
+ },
1642
+ [blockKey(APPROVAL_BLOCK)]: {
1643
+ displayName: "Request approval",
1644
+ subtitle: "Core",
1645
+ glyph: "✓"
1646
+ },
1647
+ [blockKey(STOP_BLOCK)]: {
1648
+ displayName: "Stop run",
1649
+ subtitle: "Core",
1650
+ glyph: "■"
1651
+ },
1652
+ [blockKey(WAIT_FOR_WEBHOOK_BLOCK)]: {
1653
+ displayName: "Respond and wait for webhook",
1654
+ subtitle: "Core",
1655
+ glyph: "⇄"
1656
+ },
1657
+ [blockKey(CALLABLE_FLOW_TRIGGER$1)]: {
1658
+ displayName: "Callable workflow",
1659
+ subtitle: "Trigger",
1660
+ glyph: "↳"
1661
+ },
1662
+ [blockKey(CALL_FLOW_BLOCK)]: {
1663
+ displayName: "Call workflow",
1664
+ subtitle: "Core",
1665
+ glyph: "↳"
1666
+ },
1667
+ [blockKey(RETURN_RESPONSE_BLOCK)]: {
1668
+ displayName: "Return response",
1669
+ subtitle: "Core",
1670
+ glyph: "↩"
1671
+ }
1672
+ };
1673
+ function shortPieceName(packageName) {
1674
+ return packageName.split("/").pop()?.replace(/^piece-/, "") ?? "";
1675
+ }
1676
+ const pieceLogos = /* @__PURE__ */ new Map();
1677
+ const pieceNames = /* @__PURE__ */ new Map();
1678
+ const listeners = /* @__PURE__ */ new Set();
1679
+ let logoRevision = 0;
1680
+ function registerPieceLogos(entries) {
1681
+ let changed = false;
1682
+ for (const entry of entries) {
1683
+ if (!entry.name) continue;
1684
+ if (entry.displayName && pieceNames.get(entry.name) !== entry.displayName) {
1685
+ pieceNames.set(entry.name, entry.displayName);
1686
+ changed = true;
1687
+ }
1688
+ if (!entry.logoUrl || pieceLogos.get(entry.name) === entry.logoUrl) continue;
1689
+ pieceLogos.set(entry.name, entry.logoUrl);
1690
+ changed = true;
1691
+ }
1692
+ if (!changed) return;
1693
+ logoRevision += 1;
1694
+ for (const listener of listeners) listener();
1695
+ }
1696
+ function pieceLogo(packageName) {
1697
+ return pieceLogos.get(packageName);
1698
+ }
1699
+ function pieceDisplayName(packageName) {
1700
+ return pieceNames.get(packageName);
1701
+ }
1702
+ const blockNames = /* @__PURE__ */ new Map();
1703
+ const namesRequested = /* @__PURE__ */ new Set();
1704
+ const namesPending = /* @__PURE__ */ new Set();
1705
+ function registerBlockNames(entries) {
1706
+ let changed = false;
1707
+ for (const entry of entries) {
1708
+ const key = blockKey(entry);
1709
+ if (!entry.displayName || blockNames.get(key) === entry.displayName) continue;
1710
+ blockNames.set(key, entry.displayName);
1711
+ changed = true;
1712
+ }
1713
+ if (!changed) return;
1714
+ logoRevision += 1;
1715
+ for (const listener of listeners) listener();
1716
+ }
1717
+ function requestBlockNames(packageName) {
1718
+ if (!namesRequested.has(packageName)) namesPending.add(packageName);
1719
+ }
1720
+ function loadPendingBlockNames(source) {
1721
+ for (const packageName of namesPending) loadBlockNames(source, packageName);
1722
+ namesPending.clear();
1723
+ }
1724
+ function loadBlockNames(source, packageName) {
1725
+ if (namesRequested.has(packageName)) return;
1726
+ namesRequested.add(packageName);
1727
+ Promise.all([source.loadActions(packageName), source.loadTriggers(packageName)]).then(([actions, triggers]) => registerBlockNames([...actions.map((entry) => ({
1728
+ ...entry,
1729
+ kind: "action"
1730
+ })), ...triggers.map((entry) => ({
1731
+ ...entry,
1732
+ kind: "trigger"
1733
+ }))])).catch(() => namesRequested.delete(packageName));
2289
1734
  }
2290
- function useDynamicPrefetch() {
2291
- const { service, queryClient, scope } = useDesignTimeScope();
2292
- return useMemo(() => (input, config) => {
2293
- if (!service) return;
2294
- queryClient.prefetchQuery({
2295
- queryKey: runtimeKeys.dynamic(scope, input),
2296
- queryFn: () => service.loadOptions(input.block, input.propName, config, input.connectionId ?? void 0).then(parsePropList),
2297
- staleTime: RESOLVER_STALE_MS
2298
- });
2299
- }, [
2300
- service,
2301
- queryClient,
2302
- scope
2303
- ]);
1735
+ function subscribePieceLogos(listener) {
1736
+ listeners.add(listener);
1737
+ return () => listeners.delete(listener);
2304
1738
  }
2305
- function useDynamicCache() {
2306
- const { queryClient, scope } = useDesignTimeScope();
2307
- return useMemo(() => (input) => getResolvedDynamicProps(queryClient, scope, input), [queryClient, scope]);
1739
+ function pieceLogoRevision() {
1740
+ return logoRevision;
2308
1741
  }
2309
- function useDynamicLookup() {
2310
- const { queryClient, scope } = useDesignTimeScope();
2311
- const [version, setVersion] = useState(0);
2312
- useEffect(() => queryClient.getQueryCache().subscribe((event) => {
2313
- if (event.type !== "updated") return;
2314
- const key = event.query.queryKey;
2315
- if (key[0] === scope && key[1] === "dynamic") setVersion((v) => v + 1);
2316
- }), [queryClient, scope]);
2317
- return useMemo(() => (input) => version >= 0 ? getResolvedDynamicProps(queryClient, scope, input) : void 0, [
2318
- queryClient,
2319
- scope,
2320
- version
2321
- ]);
1742
+ const logoMisses = /* @__PURE__ */ new Set();
1743
+ let catalogLoads = /* @__PURE__ */ new WeakMap();
1744
+ const retryTimers = /* @__PURE__ */ new Set();
1745
+ const CATALOG_RETRY_MS = 2e3;
1746
+ function notify() {
1747
+ logoRevision += 1;
1748
+ for (const listener of listeners) listener();
2322
1749
  }
2323
- function useRunById(runId) {
2324
- const { service, queryClient, scope } = useDesignTimeScope();
2325
- const fetchRun = service?.fetchRun;
2326
- const query = useQuery({
2327
- queryKey: runtimeKeys.run(scope, runId ?? ""),
2328
- queryFn: () => fetchRun(runId),
2329
- enabled: Boolean(fetchRun && runId),
2330
- staleTime: Infinity
2331
- }, queryClient);
2332
- if (!runId) return null;
2333
- return query.data;
1750
+ function scheduleRetry(state) {
1751
+ if (state.attempts >= 5) return;
1752
+ const timer = setTimeout(() => {
1753
+ retryTimers.delete(timer);
1754
+ state.load = void 0;
1755
+ notify();
1756
+ }, CATALOG_RETRY_MS * 2 ** (state.attempts - 1));
1757
+ retryTimers.add(timer);
2334
1758
  }
2335
- function useLatestRun(enabled = true) {
2336
- const { service, queryClient, scope } = useDesignTimeScope();
2337
- const active = enabled && Boolean(service?.latestRun);
2338
- const query = useQuery({
2339
- queryKey: runtimeKeys.latestRun(scope, service?.workflowId ?? ""),
2340
- queryFn: () => service.latestRun(),
2341
- enabled: active,
2342
- staleTime: 0
2343
- }, queryClient);
2344
- if (!active) return null;
2345
- if (query.status === "pending") return { kind: "loading" };
2346
- return {
2347
- kind: "ready",
2348
- run: query.data ?? null
2349
- };
1759
+ function ensurePieceLogos(source) {
1760
+ if (!source) return Promise.resolve();
1761
+ let state = catalogLoads.get(source);
1762
+ if (!state) {
1763
+ state = { attempts: 0 };
1764
+ catalogLoads.set(source, state);
1765
+ }
1766
+ if (state.load) return state.load;
1767
+ const current = state;
1768
+ const request = current.attempts > 0 && source.reloadCatalog ? source.reloadCatalog() : source.loadCatalog();
1769
+ current.attempts += 1;
1770
+ current.load = request.then((pieces) => {
1771
+ registerPieceLogos(pieces);
1772
+ const listed = new Set(pieces.map((piece) => piece.name));
1773
+ if ([...logoMisses].some((name) => !listed.has(name) && !pieceLogos.has(name))) scheduleRetry(current);
1774
+ }, () => scheduleRetry(current));
1775
+ return current.load;
2350
1776
  }
2351
- const SYNC_RETRIES = 5;
2352
- const SYNC_RETRY_MS = 2e3;
2353
- function useWebhookEndpoint(enabled) {
2354
- const { service, queryClient, scope } = useDesignTimeScope();
2355
- const active = enabled && Boolean(service?.webhookEndpoint);
2356
- const query = useQuery({
2357
- queryKey: runtimeKeys.webhook(scope, service?.workflowId ?? ""),
2358
- queryFn: () => service.webhookEndpoint(),
2359
- enabled: active,
2360
- staleTime: 0,
2361
- gcTime: 0,
2362
- retry: (failures, error) => isSyncingError(error) && failures < SYNC_RETRIES,
2363
- retryDelay: SYNC_RETRY_MS
2364
- }, queryClient);
2365
- if (query.status === "pending" && isSyncingError(query.failureReason)) return { kind: "syncing" };
2366
- if (query.status === "error") return {
2367
- kind: "error",
2368
- message: messageOf(query.error)
2369
- };
2370
- if (query.status === "pending") return { kind: "loading" };
2371
- return query.data ? {
2372
- kind: "ready",
2373
- endpoint: query.data
2374
- } : { kind: "empty" };
1777
+ function namedByCoreTab(block) {
1778
+ return !isCoreBlock(block) && blockKey(block) in CORE_META;
2375
1779
  }
2376
- function useConnectionList() {
2377
- const { service, queryClient, scope } = useDesignTimeScope();
2378
- const list = service?.listConnections;
2379
- const options = {
2380
- queryKey: runtimeKeys.connections(scope, service?.connectionScope ?? null),
2381
- queryFn: () => list(),
2382
- staleTime: 0,
2383
- gcTime: 0
1780
+ function blockMeta(block) {
1781
+ const key = blockKey(block);
1782
+ const core = CORE_META[key];
1783
+ if (core) return core;
1784
+ if (isCoreBlock(block)) return {
1785
+ displayName: titleCase(block.name),
1786
+ subtitle: "Core",
1787
+ glyph: "?"
2384
1788
  };
2385
- const query = useQuery({
2386
- ...options,
2387
- enabled: Boolean(list)
2388
- }, queryClient);
1789
+ const packageName = block.pieceName;
1790
+ const short = shortPieceName(packageName);
1791
+ const pieceLabel = pieceNames.get(packageName) ?? titleCase(short);
1792
+ const known = blockNames.get(key);
1793
+ if (!known) requestBlockNames(packageName);
1794
+ const logoUrl = pieceLogo(packageName);
1795
+ if (!logoUrl) logoMisses.add(packageName);
2389
1796
  return {
2390
- connections: query.data ?? [],
2391
- refetch: () => {
2392
- if (list) query.refetch();
2393
- },
2394
- invalidate: () => void queryClient.invalidateQueries({ queryKey: runtimeKeys.connections(scope) }),
2395
- fetchNow: () => list ? queryClient.fetchQuery({
2396
- ...options,
2397
- staleTime: 0
2398
- }) : Promise.resolve([])
1797
+ displayName: known ?? titleCase(block.name),
1798
+ subtitle: block.kind === "trigger" ? `${pieceLabel} · Trigger` : pieceLabel,
1799
+ logoUrl,
1800
+ glyph: short.slice(0, 1).toUpperCase() || "?"
2399
1801
  };
2400
1802
  }
2401
- function useTestStepRunner() {
2402
- const { service, queryClient, scope } = useDesignTimeScope();
2403
- const test = service?.testStep;
2404
- if (!test) return void 0;
2405
- return (stepId) => test(stepId).finally(() => {
2406
- for (const queryKey of [
2407
- runtimeKeys.allRuns(scope),
2408
- [scope, "latestRun"],
2409
- runtimeKeys.outputTrees(scope)
2410
- ]) queryClient.invalidateQueries({ queryKey });
2411
- });
1803
+ function stepSubtitle(meta, maxChars = 26) {
1804
+ if (meta.subtitle === "Core") return meta.displayName;
1805
+ const both = `${meta.subtitle} · ${meta.displayName}`;
1806
+ return both.length <= maxChars ? both : meta.displayName;
2412
1807
  }
2413
- function useTestTrigger() {
2414
- const { service, queryClient, scope } = useDesignTimeScope();
2415
- const test = service?.testTrigger;
2416
- if (!test) return void 0;
2417
- return () => test().finally(() => void queryClient.invalidateQueries({ queryKey: runtimeKeys.outputTrees(scope) }));
1808
+ function titleCase(value) {
1809
+ return value.replaceAll(/[-_]/g, " ").replace(/^\w/, (char) => char.toUpperCase());
2418
1810
  }
2419
- var DraftNotSynced = class extends Error {};
2420
- const DRAFT_SYNC_RETRIES = 10;
2421
- /**
2422
- * The piece version each draft block runs, trigger first; `blocks` is the
2423
- * draft in that order. Empty outside a runtime, or until the runtime answers.
2424
- */
2425
- function useBlockResolutions(workflowId, blocks) {
2426
- const { service, queryClient, scope } = useDesignTimeScope();
2427
- const fetchResolutions = service?.blockResolutions;
2428
- const expected = blocks.map((entry) => `${entry.id}=${blockRefKey(entry.block)}`);
2429
- return useQuery({
2430
- queryKey: runtimeKeys.blockResolutions(scope, workflowId, blocks.map((entry) => entry.block)),
2431
- queryFn: async () => {
2432
- const resolutions = await fetchResolutions();
2433
- if (keyHash(resolutions.map((resolution) => `${resolution.stepId}=${blockRefKey(resolution)}`)) !== keyHash(expected)) throw new DraftNotSynced();
2434
- return resolutions;
2435
- },
2436
- enabled: Boolean(fetchResolutions && workflowId),
2437
- retry: (count, error) => error instanceof DraftNotSynced && count < DRAFT_SYNC_RETRIES,
2438
- retryDelay: 300,
2439
- placeholderData: keepPreviousData,
2440
- staleTime: 0
2441
- }, queryClient).data ?? EMPTY_RESOLUTIONS;
1811
+ function usePieceLogos() {
1812
+ const source = usePieceSource();
1813
+ const revision = useSyncExternalStore(subscribePieceLogos, pieceLogoRevision, pieceLogoRevision);
1814
+ useEffect(() => {
1815
+ ensurePieceLogos(source);
1816
+ if (source && namesPending.size > 0) loadPendingBlockNames(source);
1817
+ });
1818
+ return revision;
1819
+ }
1820
+ function useBlockMeta(block) {
1821
+ usePieceLogos();
1822
+ return blockMeta(block);
2442
1823
  }
2443
- const EMPTY_RESOLUTIONS = [];
2444
1824
  //#endregion
2445
1825
  //#region editors/workflow-editor/ui/version-badge.tsx
2446
1826
  function resolutionText(resolution) {
@@ -2514,16 +1894,207 @@ function versionSummary(resolutions) {
2514
1894
  firstStepId: (missing.length > 0 ? missing : differing)[0].stepId
2515
1895
  };
2516
1896
  }
2517
- function VersionSummary(props) {
2518
- const summary = versionSummary(props.resolutions);
2519
- if (!summary) return null;
2520
- return /* @__PURE__ */ jsx("button", {
2521
- type: "button",
2522
- "data-tone": summary.tone,
2523
- className: `truncate text-xs underline-offset-2 hover:underline ${SUMMARY_TONE[summary.tone]}`,
2524
- title: summary.title,
2525
- onClick: () => props.onSelect(summary.firstStepId),
2526
- children: summary.text
1897
+ function VersionSummary(props) {
1898
+ const summary = versionSummary(props.resolutions);
1899
+ if (!summary) return null;
1900
+ return /* @__PURE__ */ jsx("button", {
1901
+ type: "button",
1902
+ "data-tone": summary.tone,
1903
+ className: `truncate text-xs underline-offset-2 hover:underline ${SUMMARY_TONE[summary.tone]}`,
1904
+ title: summary.title,
1905
+ onClick: () => props.onSelect(summary.firstStepId),
1906
+ children: summary.text
1907
+ });
1908
+ }
1909
+ //#endregion
1910
+ //#region editors/workflow-editor/ui/picker-placement.ts
1911
+ const MARGIN = 8;
1912
+ const GAP = 6;
1913
+ const MIN_HEIGHT = 240;
1914
+ function pickerPlacement(anchor, size, viewport) {
1915
+ const width = Math.min(size.width, viewport.width - 16);
1916
+ const below = viewport.height - anchor.bottom - GAP - MARGIN;
1917
+ const above = anchor.top - GAP - MARGIN;
1918
+ const downward = below >= Math.min(size.height, MIN_HEIGHT) || below >= above;
1919
+ const height = Math.max(Math.min(size.height, downward ? below : above), Math.min(size.height, MIN_HEIGHT));
1920
+ const centre = (anchor.left + anchor.right) / 2;
1921
+ const left = Math.min(Math.max(centre - width / 2, MARGIN), viewport.width - width - MARGIN);
1922
+ const top = downward ? Math.min(anchor.bottom + GAP, viewport.height - height - MARGIN) : Math.max(anchor.top - GAP - height, MARGIN);
1923
+ return {
1924
+ left,
1925
+ top: Math.max(top, MARGIN),
1926
+ width,
1927
+ height,
1928
+ above: !downward
1929
+ };
1930
+ }
1931
+ //#endregion
1932
+ //#region editors/workflow-editor/ui/PickerPopover.tsx
1933
+ const PICKER_SIZE = {
1934
+ width: 640,
1935
+ height: 480
1936
+ };
1937
+ function PickerPopover(props) {
1938
+ const [placement, setPlacement] = useState(null);
1939
+ const { anchor, onClose } = props;
1940
+ useLayoutEffect(() => {
1941
+ const place = () => {
1942
+ const rect = anchor.current?.getBoundingClientRect();
1943
+ if (!rect) return;
1944
+ setPlacement(pickerPlacement(rect, PICKER_SIZE, {
1945
+ width: window.innerWidth,
1946
+ height: window.innerHeight
1947
+ }));
1948
+ };
1949
+ place();
1950
+ const onWheel = (event) => {
1951
+ const target = event.target;
1952
+ if (!(target instanceof Element && target.closest("[data-selector-open]"))) onClose();
1953
+ };
1954
+ window.addEventListener("resize", onClose);
1955
+ window.addEventListener("wheel", onWheel, {
1956
+ capture: true,
1957
+ passive: true
1958
+ });
1959
+ return () => {
1960
+ window.removeEventListener("resize", onClose);
1961
+ window.removeEventListener("wheel", onWheel, { capture: true });
1962
+ };
1963
+ }, [anchor, onClose]);
1964
+ const host = anchor.current?.closest(".react-flow")?.parentElement ?? document.body;
1965
+ if (!placement) return null;
1966
+ return createPortal(/* @__PURE__ */ jsx("div", {
1967
+ "data-selector-open": "true",
1968
+ className: "nodrag nopan nowheel fixed z-50 motion-safe:animate-[wf-picker-in_120ms_ease-out]",
1969
+ style: placement.above ? {
1970
+ left: placement.left,
1971
+ bottom: window.innerHeight - placement.top - placement.height,
1972
+ transformOrigin: "bottom center"
1973
+ } : {
1974
+ left: placement.left,
1975
+ top: placement.top,
1976
+ transformOrigin: "top center"
1977
+ },
1978
+ children: props.children(placement)
1979
+ }), host);
1980
+ }
1981
+ //#endregion
1982
+ //#region editors/workflow-editor/ui/picker-recent.ts
1983
+ const STORAGE_KEY = "ph-workflow-picker-recent:v1";
1984
+ const MAX_RECENT = 6;
1985
+ function isStoredPick(value) {
1986
+ const entry = value;
1987
+ const block = entry?.block;
1988
+ return typeof entry?.label === "string" && typeof block?.pieceName === "string" && typeof block.name === "string" && (block.kind === "action" || block.kind === "trigger");
1989
+ }
1990
+ function readAll() {
1991
+ try {
1992
+ const raw = window.localStorage.getItem(STORAGE_KEY);
1993
+ const parsed = raw ? JSON.parse(raw) : [];
1994
+ return Array.isArray(parsed) ? parsed.filter(isStoredPick) : [];
1995
+ } catch {
1996
+ return [];
1997
+ }
1998
+ }
1999
+ function recentPicks(kind) {
2000
+ return readAll().filter((entry) => entry.block.kind === kind).map((entry) => ({
2001
+ label: entry.label,
2002
+ description: entry.description ?? "",
2003
+ block: entry.block,
2004
+ defaultConfig: {}
2005
+ }));
2006
+ }
2007
+ function rememberPick(preset) {
2008
+ const { pieceName, kind, name } = preset.block;
2009
+ const entry = {
2010
+ label: preset.label,
2011
+ description: preset.description,
2012
+ block: {
2013
+ pieceName,
2014
+ kind,
2015
+ name
2016
+ }
2017
+ };
2018
+ const same = (other) => other.block.pieceName === pieceName && other.block.kind === kind && other.block.name === name;
2019
+ const all = readAll();
2020
+ const ofKind = all.filter((other) => other.block.kind === kind);
2021
+ const others = all.filter((other) => other.block.kind !== kind);
2022
+ const next = [entry, ...ofKind.filter((other) => !same(other))].slice(0, MAX_RECENT);
2023
+ try {
2024
+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify([...next, ...others]));
2025
+ } catch {}
2026
+ }
2027
+ //#endregion
2028
+ //#region editors/workflow-editor/ui/VirtualList.tsx
2029
+ const OVERSCAN = 6;
2030
+ function rowOffsets(heights) {
2031
+ const offsets = [0];
2032
+ for (const height of heights) offsets.push(offsets.at(-1) + height);
2033
+ return offsets;
2034
+ }
2035
+ function visibleRange(offsets, scrollTop, height, overscan = OVERSCAN) {
2036
+ const count = offsets.length - 1;
2037
+ let start = 0;
2038
+ while (start < count && offsets[start + 1] <= scrollTop) start++;
2039
+ let end = start;
2040
+ while (end < count && offsets[end] < scrollTop + height) end++;
2041
+ return [Math.max(0, start - overscan), Math.min(count, end + overscan)];
2042
+ }
2043
+ function VirtualList(props) {
2044
+ const ref = useRef(null);
2045
+ const [scrollTop, setScrollTop] = useState(0);
2046
+ const [height, setHeight] = useState(400);
2047
+ const offsets = useMemo(() => rowOffsets(props.items.map(props.heightOf)), [props.items, props.heightOf]);
2048
+ useLayoutEffect(() => {
2049
+ const element = ref.current;
2050
+ if (!element) return;
2051
+ const observer = new ResizeObserver(() => setHeight(element.clientHeight));
2052
+ observer.observe(element);
2053
+ setHeight(element.clientHeight);
2054
+ return () => observer.disconnect();
2055
+ }, []);
2056
+ useEffect(() => {
2057
+ if (ref.current) ref.current.scrollTop = 0;
2058
+ }, [props.resetKey]);
2059
+ useEffect(() => {
2060
+ const element = ref.current;
2061
+ const index = props.activeIndex;
2062
+ if (!element || index === void 0 || index < 0) return;
2063
+ const top = offsets.at(index);
2064
+ const bottom = offsets.at(index + 1);
2065
+ if (top === void 0 || bottom === void 0) return;
2066
+ if (top < element.scrollTop) element.scrollTop = top;
2067
+ else if (bottom > element.scrollTop + element.clientHeight) element.scrollTop = bottom - element.clientHeight;
2068
+ }, [props.activeIndex, offsets]);
2069
+ const [start, end] = visibleRange(offsets, scrollTop, height);
2070
+ return /* @__PURE__ */ jsx("div", {
2071
+ ref,
2072
+ id: props.id,
2073
+ role: "listbox",
2074
+ "aria-label": props.label,
2075
+ className: `min-h-0 overflow-y-auto ${props.className ?? ""}`,
2076
+ onScroll: (event) => setScrollTop(event.currentTarget.scrollTop),
2077
+ children: /* @__PURE__ */ jsx("div", {
2078
+ role: "presentation",
2079
+ style: {
2080
+ height: offsets.at(-1),
2081
+ position: "relative"
2082
+ },
2083
+ children: props.items.slice(start, end).map((item, i) => {
2084
+ const index = start + i;
2085
+ return /* @__PURE__ */ jsx("div", {
2086
+ role: "presentation",
2087
+ style: {
2088
+ position: "absolute",
2089
+ top: offsets[index],
2090
+ left: 0,
2091
+ right: 0,
2092
+ height: offsets[index + 1] - offsets[index]
2093
+ },
2094
+ children: props.render(item, index)
2095
+ }, props.keyOf(item, index));
2096
+ })
2097
+ })
2527
2098
  });
2528
2099
  }
2529
2100
  //#endregion
@@ -2546,9 +2117,45 @@ const CORE_TILE = {
2546
2117
  icon: "branch",
2547
2118
  color: "#d97706"
2548
2119
  },
2120
+ [blockKey(ROUTER_BLOCK)]: {
2121
+ icon: "route",
2122
+ color: "#ea580c"
2123
+ },
2124
+ [blockKey(LOOP_BLOCK)]: {
2125
+ icon: "loop",
2126
+ color: "#7c3aed"
2127
+ },
2549
2128
  [blockKey(ASSERT_BLOCK)]: {
2550
2129
  icon: "alert",
2551
2130
  color: "#dc2626"
2131
+ },
2132
+ [blockKey(DELAY_BLOCK)]: {
2133
+ icon: "clock",
2134
+ color: "#0d9488"
2135
+ },
2136
+ [blockKey(APPROVAL_BLOCK)]: {
2137
+ icon: "check",
2138
+ color: "#16a34a"
2139
+ },
2140
+ [blockKey(STOP_BLOCK)]: {
2141
+ icon: "stop",
2142
+ color: "#475569"
2143
+ },
2144
+ [blockKey(WAIT_FOR_WEBHOOK_BLOCK)]: {
2145
+ icon: "link",
2146
+ color: "#0891b2"
2147
+ },
2148
+ [blockKey(CALLABLE_FLOW_TRIGGER$1)]: {
2149
+ icon: "subflow",
2150
+ color: "#4f46e5"
2151
+ },
2152
+ [blockKey(CALL_FLOW_BLOCK)]: {
2153
+ icon: "subflow",
2154
+ color: "#4f46e5"
2155
+ },
2156
+ [blockKey(RETURN_RESPONSE_BLOCK)]: {
2157
+ icon: "reply",
2158
+ color: "#4f46e5"
2552
2159
  }
2553
2160
  };
2554
2161
  function CoreTile(props) {
@@ -2631,33 +2238,55 @@ function LogoFrame(props) {
2631
2238
  });
2632
2239
  }
2633
2240
  function Row(props) {
2634
- return /* @__PURE__ */ jsxs("button", {
2635
- type: "button",
2636
- className: `group flex w-full items-center gap-2 px-3 py-1.5 text-left ${props.disabled ? "cursor-not-allowed opacity-50" : "hover:bg-muted/50"}`,
2637
- disabled: props.disabled,
2638
- onClick: props.onClick,
2241
+ return /* @__PURE__ */ jsxs("div", {
2242
+ ...optionAttributes(props.option),
2243
+ role: "option",
2244
+ "aria-selected": (props.active ?? false) || (props.selected ?? false),
2245
+ "aria-disabled": props.disabled,
2246
+ className: `group mx-1.5 my-px flex h-[calc(100%-2px)] cursor-pointer items-center gap-2.5 rounded-md px-2 text-left ${rowTone(props.active, props.selected)} ${props.disabled ? "cursor-not-allowed opacity-50" : ""}`,
2247
+ title: props.title,
2248
+ onClick: props.disabled ? void 0 : props.onClick,
2249
+ onMouseDown: (event) => event.preventDefault(),
2639
2250
  onMouseEnter: props.onHover,
2640
- onFocus: props.onHover,
2641
2251
  children: [
2642
- props.logo,
2252
+ /* @__PURE__ */ jsx("span", {
2253
+ "aria-hidden": "true",
2254
+ className: "contents",
2255
+ children: props.logo
2256
+ }),
2643
2257
  /* @__PURE__ */ jsxs("span", {
2644
2258
  className: "min-w-0",
2645
2259
  children: [/* @__PURE__ */ jsx("span", {
2646
- className: "block truncate text-xs font-medium text-foreground",
2260
+ className: "block truncate text-[13px] font-medium leading-[18px] text-foreground",
2647
2261
  children: props.label
2648
2262
  }), /* @__PURE__ */ jsx("span", {
2649
- className: "block truncate text-[11px] text-muted-foreground/80",
2263
+ className: `text-xs leading-4 text-muted-foreground ${props.tall ? "line-clamp-2" : "block truncate"}`,
2650
2264
  children: props.description
2651
2265
  })]
2652
2266
  }),
2653
2267
  props.version ? /* @__PURE__ */ jsxs("span", {
2654
- className: `ml-auto shrink-0 pl-2 text-[10px] tabular-nums text-muted-foreground/70 ${props.versionNote ? "" : "hidden group-hover:inline group-focus-visible:inline"}`,
2268
+ className: `ml-auto shrink-0 pl-2 text-[11px] tabular-nums text-muted-foreground ${props.versionNote ? "" : props.active ? "" : "hidden group-hover:inline"}`,
2655
2269
  title: props.versionNote ?? `Pinned to version ${props.version}`,
2656
2270
  children: ["v", props.version]
2657
2271
  }) : null
2658
2272
  ]
2659
2273
  });
2660
2274
  }
2275
+ function rowTone(active, selected) {
2276
+ if (active) return "bg-wf-run/10 ring-1 ring-inset ring-wf-run/25";
2277
+ if (selected) return "bg-card shadow-sm ring-1 ring-foreground/10";
2278
+ return "hover:bg-foreground/[0.05]";
2279
+ }
2280
+ function optionId(list, index) {
2281
+ return `${list}-${index}`;
2282
+ }
2283
+ function optionAttributes(place) {
2284
+ return place ? {
2285
+ id: optionId(place.list, place.index),
2286
+ "aria-posinset": place.index + 1,
2287
+ "aria-setsize": place.size
2288
+ } : {};
2289
+ }
2661
2290
  function shownVersion(pieceName, version) {
2662
2291
  return isCoreBlock({ pieceName }) ? void 0 : version;
2663
2292
  }
@@ -2667,16 +2296,11 @@ function useVersionNote(catalog) {
2667
2296
  if (!piece || !version) return void 0;
2668
2297
  const others = [...new Set(draft.filter((block) => block.pieceName === piece && block.pieceVersion !== version).map((block) => `v${block.pieceVersion}`))];
2669
2298
  if (others.length > 0) return `Other steps of this workflow use ${others.join(", ")}`;
2299
+ if (piece === "@powerhousedao/piece-reactor") return void 0;
2670
2300
  const published = catalog?.find((entry) => entry.name === piece)?.publishedVersion;
2671
2301
  return published && published !== version ? `A local build; v${published} is published` : void 0;
2672
2302
  };
2673
2303
  }
2674
- function SectionLabel(props) {
2675
- return /* @__PURE__ */ jsx("div", {
2676
- className: "px-3 pb-0.5 pt-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",
2677
- children: props.children
2678
- });
2679
- }
2680
2304
  const CATEGORY_LABELS = {
2681
2305
  ARTIFICIAL_INTELLIGENCE: "AI",
2682
2306
  UNIVERSAL_AI: "AI",
@@ -2696,8 +2320,6 @@ const CATEGORY_LABELS = {
2696
2320
  PAYMENT_PROCESSING: "Payments",
2697
2321
  HUMAN_RESOURCES: "HR"
2698
2322
  };
2699
- const CORE_CHIP = "Core";
2700
- const POWERHOUSE_CHIP = "Powerhouse";
2701
2323
  const AI_CHIP = "AI";
2702
2324
  function categoryLabel(id) {
2703
2325
  return CATEGORY_LABELS[id] ?? id.toLowerCase().replaceAll("_", " ").replace(/^\w/, (char) => char.toUpperCase());
@@ -2705,111 +2327,84 @@ function categoryLabel(id) {
2705
2327
  function chipsOf(piece) {
2706
2328
  return new Set(piece.categories.map(categoryLabel));
2707
2329
  }
2330
+ function categoriesOfChip(chip, pieces) {
2331
+ return [...new Set(pieces.flatMap((piece) => piece.categories))].filter((id) => categoryLabel(id) === chip);
2332
+ }
2708
2333
  function orderChips(pieces) {
2709
2334
  const counts = /* @__PURE__ */ new Map();
2710
2335
  for (const piece of pieces) for (const chip of chipsOf(piece)) counts.set(chip, (counts.get(chip) ?? 0) + 1);
2711
2336
  const rest = [...counts.entries()].filter(([chip]) => chip !== AI_CHIP).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([chip]) => chip);
2712
- return [
2713
- CORE_CHIP,
2714
- POWERHOUSE_CHIP,
2715
- ...counts.has(AI_CHIP) ? [AI_CHIP] : [],
2716
- ...rest
2717
- ];
2337
+ return [...counts.has(AI_CHIP) ? [AI_CHIP] : [], ...rest];
2718
2338
  }
2719
- function PieceEntries(props) {
2720
- const [entries, setEntries] = useState(null);
2721
- const [error, setError] = useState(null);
2722
- const pieceSource = usePieceSource();
2723
- useEffect(() => {
2724
- let cancelled = false;
2725
- (props.mode === "triggers" ? pieceSource?.loadTriggers(props.piece.name) : pieceSource?.loadActions(props.piece.name))?.then((result) => {
2726
- if (!cancelled) setEntries(result);
2727
- }).catch((loadError) => {
2728
- if (!cancelled) setError(loadError instanceof Error ? loadError.message : String(loadError));
2729
- });
2730
- return () => {
2731
- cancelled = true;
2732
- };
2733
- }, [
2734
- props.piece.name,
2735
- props.mode,
2736
- pieceSource
2737
- ]);
2738
- return /* @__PURE__ */ jsxs("div", {
2739
- className: "max-h-80 overflow-y-auto py-1",
2740
- children: [/* @__PURE__ */ jsxs("button", {
2741
- type: "button",
2742
- className: "flex w-full items-center gap-1 px-3 py-1 text-[11px] text-muted-foreground/80 hover:text-muted-foreground",
2743
- onClick: props.onBack,
2744
- children: ["← ", props.piece.displayName]
2745
- }), error ? /* @__PURE__ */ jsx("div", {
2746
- className: "px-3 py-2 text-xs text-wf-fail",
2747
- children: error
2748
- }) : entries === null ? /* @__PURE__ */ jsx("div", {
2749
- className: "px-3 py-2 text-xs text-muted-foreground/80",
2750
- children: "Loading…"
2751
- }) : entries.map((entry) => {
2752
- const kind = props.mode === "triggers" ? "trigger" : "action";
2753
- const unavailable = blockUnavailable({
2754
- ...entry,
2755
- kind
2756
- });
2757
- const block = {
2758
- pieceName: entry.pieceName,
2759
- pieceVersion: entry.pieceVersion,
2760
- kind,
2761
- name: entry.name
2762
- };
2763
- return /* @__PURE__ */ jsx(Row, {
2764
- logo: /* @__PURE__ */ jsx(LogoFrame, {
2765
- src: props.piece.logoUrl,
2766
- alt: props.piece.displayName,
2767
- size: ROW_LOGO
2768
- }),
2769
- label: entry.displayName,
2770
- description: unavailable ?? entry.description,
2771
- disabled: unavailable !== void 0,
2772
- version: shownVersion(entry.pieceName, entry.pieceVersion),
2773
- versionNote: props.versionNote(props.piece.name, entry.pieceVersion),
2774
- onHover: unavailable === void 0 ? () => props.onHover(block) : void 0,
2775
- onClick: () => props.onPick({
2776
- label: entry.displayName,
2777
- block,
2778
- description: entry.description,
2779
- defaultConfig: {}
2780
- })
2781
- }, entry.name);
2782
- })]
2783
- });
2339
+ const TAB_LABELS = {
2340
+ all: "All",
2341
+ core: "Core",
2342
+ powerhouse: "Powerhouse",
2343
+ activepieces: "Integrations"
2344
+ };
2345
+ const TAB_SOURCES = {
2346
+ all: void 0,
2347
+ core: [],
2348
+ powerhouse: ["local", "registry"],
2349
+ activepieces: ["activepieces"]
2350
+ };
2351
+ function inTab(tab, piece) {
2352
+ const sources = TAB_SOURCES[tab];
2353
+ return sources === void 0 || sources.includes(piece.source ?? "activepieces");
2354
+ }
2355
+ function folded(text) {
2356
+ return text.normalize("NFKD").replace(/\p{M}/gu, "").toLowerCase();
2357
+ }
2358
+ function queryTokens(query) {
2359
+ return folded(query).split(/[^\p{L}\p{N}]+/u).filter(Boolean);
2360
+ }
2361
+ function matchesQuery(text, tokens) {
2362
+ const lowered = folded(text);
2363
+ return tokens.every((token) => lowered.includes(token));
2364
+ }
2365
+ function escapeRegExp(text) {
2366
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2367
+ }
2368
+ function Highlight(props) {
2369
+ if (props.tokens.length === 0) return /* @__PURE__ */ jsx(Fragment$1, { children: props.text });
2370
+ const pattern = new RegExp(`(?<![\\p{L}\\p{N}])(${props.tokens.map(escapeRegExp).join("|")})`, "giu");
2371
+ const parts = props.text.split(pattern);
2372
+ return /* @__PURE__ */ jsx(Fragment$1, { children: parts.map((part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("mark", {
2373
+ className: "bg-transparent font-semibold text-inherit",
2374
+ children: part
2375
+ }, i) : part) });
2784
2376
  }
2785
2377
  const SEARCH_MIN_CHARS = 2;
2786
2378
  const SEARCH_DEBOUNCE_MS = 250;
2787
2379
  const INDEXING_RETRY_MS = 2e3;
2788
- function useBlockSearch(query, enabled) {
2380
+ function usePieceSearch(query, filter) {
2789
2381
  const [state, setState] = useState({ kind: "idle" });
2790
2382
  const [attempt, setAttempt] = useState(0);
2791
2383
  const trimmed = query.trim();
2792
- const active = enabled && trimmed.length >= SEARCH_MIN_CHARS;
2793
- const search = usePieceSource()?.searchBlocks;
2384
+ const search = usePieceSource()?.searchPieces;
2385
+ const active = filter !== null && search !== void 0 && trimmed.length >= SEARCH_MIN_CHARS;
2386
+ const filterKey = JSON.stringify(filter);
2387
+ const key = `${trimmed}\n${filterKey}`;
2794
2388
  useEffect(() => {
2795
- if (!active || !search) {
2389
+ if (!active) {
2796
2390
  setState({ kind: "idle" });
2797
2391
  return;
2798
2392
  }
2799
2393
  let alive = true;
2800
2394
  let retry;
2801
2395
  const timer = setTimeout(() => {
2802
- setState((previous) => previous.kind === "done" ? previous : { kind: "loading" });
2803
- search(trimmed).then((result) => {
2396
+ search(trimmed, JSON.parse(filterKey)).then((result) => {
2804
2397
  if (!alive) return;
2805
2398
  setState({
2806
2399
  kind: "done",
2400
+ key,
2807
2401
  result
2808
2402
  });
2809
2403
  if (result.status === "indexing") retry = setTimeout(() => setAttempt((value) => value + 1), INDEXING_RETRY_MS);
2810
2404
  }, (error) => {
2811
2405
  if (alive) setState({
2812
2406
  kind: "error",
2407
+ key,
2813
2408
  message: error instanceof Error ? error.message : String(error)
2814
2409
  });
2815
2410
  });
@@ -2822,32 +2417,431 @@ function useBlockSearch(query, enabled) {
2822
2417
  }, [
2823
2418
  active,
2824
2419
  trimmed,
2420
+ filterKey,
2421
+ key,
2825
2422
  attempt,
2826
2423
  search
2827
2424
  ]);
2828
- return active ? state : { kind: "idle" };
2425
+ if (!active) return { kind: "idle" };
2426
+ if (state.kind === "idle") return { kind: "loading" };
2427
+ if (state.kind === "error") return state.key === key ? {
2428
+ kind: "error",
2429
+ message: state.message
2430
+ } : { kind: "loading" };
2431
+ return {
2432
+ kind: "done",
2433
+ result: state.result,
2434
+ stale: state.key !== key
2435
+ };
2436
+ }
2437
+ function rovingFocus(event) {
2438
+ const delta = event.key === "ArrowRight" ? 1 : event.key === "ArrowLeft" ? -1 : 0;
2439
+ if (delta === 0) return;
2440
+ event.preventDefault();
2441
+ const buttons = [...event.currentTarget.querySelectorAll("button")];
2442
+ const at = buttons.indexOf(document.activeElement);
2443
+ buttons.at((at + delta) % buttons.length)?.focus();
2829
2444
  }
2830
2445
  function Chip(props) {
2831
2446
  return /* @__PURE__ */ jsx("button", {
2832
2447
  type: "button",
2833
- className: `rounded-full border px-2 py-0.5 text-[10px] font-medium ${props.active ? "border-primary bg-primary text-primary-foreground" : "border-foreground/10 text-muted-foreground hover:border-foreground/25"}`,
2834
- onClick: props.onClick,
2448
+ "aria-pressed": props.active,
2449
+ tabIndex: props.tabStop ? 0 : -1,
2450
+ className: `shrink-0 rounded-full border px-2.5 py-0.5 text-[11px] font-medium focus-visible:outline-2 focus-visible:outline-wf-run ${props.active ? "border-wf-run/40 bg-wf-run/10 text-wf-run" : "border-foreground/10 text-muted-foreground hover:border-foreground/25 hover:text-foreground"}`,
2451
+ onClick: (event) => props.onClick(event.detail === 0),
2835
2452
  children: props.label
2836
2453
  });
2837
2454
  }
2455
+ function ChipBar(props) {
2456
+ const ref = useRef(null);
2457
+ const [more, setMore] = useState({
2458
+ left: false,
2459
+ right: false
2460
+ });
2461
+ const measure = () => {
2462
+ const element = ref.current;
2463
+ if (!element) return;
2464
+ const left = element.scrollLeft > 1;
2465
+ const right = element.scrollLeft + element.clientWidth < element.scrollWidth - 1;
2466
+ setMore((previous) => previous.left === left && previous.right === right ? previous : {
2467
+ left,
2468
+ right
2469
+ });
2470
+ };
2471
+ useLayoutEffect(() => {
2472
+ const element = ref.current;
2473
+ if (!element) return;
2474
+ const observer = new ResizeObserver(measure);
2475
+ observer.observe(element);
2476
+ return () => observer.disconnect();
2477
+ }, []);
2478
+ const fade = (side) => /* @__PURE__ */ jsx("span", {
2479
+ "aria-hidden": "true",
2480
+ className: "pointer-events-none absolute inset-y-0 w-14",
2481
+ style: {
2482
+ [side]: 0,
2483
+ background: `linear-gradient(to ${side === "left" ? "right" : "left"}, var(--card), transparent)`
2484
+ }
2485
+ });
2486
+ return /* @__PURE__ */ jsxs("div", {
2487
+ className: "relative shrink-0 border-b border-foreground/10",
2488
+ children: [
2489
+ /* @__PURE__ */ jsx("div", {
2490
+ ref,
2491
+ role: "toolbar",
2492
+ "aria-label": "Categories",
2493
+ className: "flex gap-1.5 overflow-x-auto whitespace-nowrap px-3 py-2 [scrollbar-width:none]",
2494
+ onKeyDown: rovingFocus,
2495
+ onScroll: measure,
2496
+ children: props.children
2497
+ }),
2498
+ more.left ? fade("left") : null,
2499
+ more.right ? fade("right") : null
2500
+ ]
2501
+ });
2502
+ }
2503
+ function Tabs(props) {
2504
+ return /* @__PURE__ */ jsx("div", {
2505
+ role: "tablist",
2506
+ "aria-label": "Piece sources",
2507
+ className: "inline-flex gap-0.5 rounded-md bg-foreground/[0.05] p-0.5",
2508
+ onKeyDown: (event) => {
2509
+ rovingFocus(event);
2510
+ const tab = document.activeElement?.dataset.tab;
2511
+ if (tab && tab !== props.active) props.onSelect(tab, true);
2512
+ },
2513
+ children: props.tabs.map((tab) => /* @__PURE__ */ jsx("button", {
2514
+ type: "button",
2515
+ role: "tab",
2516
+ "data-tab": tab,
2517
+ "aria-selected": props.active === tab,
2518
+ tabIndex: props.active === tab ? 0 : -1,
2519
+ className: `rounded px-2.5 py-1 text-xs font-medium focus-visible:outline-2 focus-visible:outline-wf-run ${props.active === tab ? "bg-card text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
2520
+ onClick: (event) => props.onSelect(tab, event.detail === 0),
2521
+ children: TAB_LABELS[tab]
2522
+ }, tab))
2523
+ });
2524
+ }
2525
+ function Status(props) {
2526
+ return /* @__PURE__ */ jsx("div", {
2527
+ role: "status",
2528
+ className: `px-4 py-2.5 text-xs ${props.error ? "text-wf-fail" : "text-muted-foreground"}`,
2529
+ children: props.children
2530
+ });
2531
+ }
2532
+ const ROW_HEIGHT = 46;
2533
+ const BLOCK_HEIGHT = 60;
2534
+ const HEADER_LOGO = 36;
2535
+ const HEADER_HEIGHT = 38;
2536
+ const MORE_HEIGHT = 28;
2537
+ const GROUP_BLOCKS = 4;
2538
+ const HOVER_PREVIEW_MS = 120;
2539
+ const searchRowHeight = (row) => row.type === "entry" ? BLOCK_HEIGHT : row.type === "more" ? MORE_HEIGHT : HEADER_HEIGHT;
2540
+ const sourceHeight = () => ROW_HEIGHT;
2541
+ const entryHeight = () => BLOCK_HEIGHT;
2542
+ function listTile(icon, color) {
2543
+ return (size) => /* @__PURE__ */ jsx(CoreTile, {
2544
+ tile: {
2545
+ icon,
2546
+ color
2547
+ },
2548
+ size
2549
+ });
2550
+ }
2551
+ function EntryRow(props) {
2552
+ const { entry } = props;
2553
+ return /* @__PURE__ */ jsx(Row, {
2554
+ logo: props.indent ? /* @__PURE__ */ jsx("span", {
2555
+ className: "shrink-0",
2556
+ style: { width: ROW_LOGO }
2557
+ }) : entry.logo,
2558
+ label: /* @__PURE__ */ jsx(Highlight, {
2559
+ text: entry.label,
2560
+ tokens: props.tokens
2561
+ }),
2562
+ title: entry.description || entry.label,
2563
+ description: entry.unavailable ?? /* @__PURE__ */ jsx(Highlight, {
2564
+ text: entry.description,
2565
+ tokens: props.tokens
2566
+ }),
2567
+ disabled: entry.unavailable !== void 0,
2568
+ active: props.active,
2569
+ tall: true,
2570
+ option: props.option,
2571
+ version: entry.version,
2572
+ versionNote: entry.versionNote,
2573
+ onHover: () => {
2574
+ props.onActivate();
2575
+ if (entry.unavailable === void 0) entry.warm?.();
2576
+ },
2577
+ onClick: entry.pick
2578
+ });
2579
+ }
2580
+ function SourceRow(props) {
2581
+ const { source } = props;
2582
+ if (source.kind === "list") return /* @__PURE__ */ jsx(Row, {
2583
+ logo: source.logo(ROW_LOGO),
2584
+ label: source.title,
2585
+ description: source.subtitle,
2586
+ active: props.active,
2587
+ selected: props.selected,
2588
+ option: props.option,
2589
+ onHover: props.onActivate,
2590
+ onClick: props.onOpen
2591
+ });
2592
+ const { piece } = source;
2593
+ const count = props.mode === "triggers" ? piece.triggerCount : piece.actionCount;
2594
+ const noun = props.mode === "triggers" ? "trigger" : "action";
2595
+ return /* @__PURE__ */ jsx(Row, {
2596
+ logo: /* @__PURE__ */ jsx(LogoFrame, {
2597
+ src: piece.logoUrl,
2598
+ alt: piece.displayName,
2599
+ size: ROW_LOGO
2600
+ }),
2601
+ label: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Highlight, {
2602
+ text: piece.displayName,
2603
+ tokens: props.tokens
2604
+ }), piece.deprecated ? " (deprecated)" : ""] }),
2605
+ title: piece.description || piece.displayName,
2606
+ description: piece.unsupported ?? `${count} ${noun}${count === 1 ? "" : "s"}`,
2607
+ active: props.active,
2608
+ selected: props.selected,
2609
+ option: props.option,
2610
+ onHover: props.onActivate,
2611
+ onClick: props.onOpen
2612
+ });
2613
+ }
2614
+ function usePieceEntries(piece, mode) {
2615
+ const pieceSource = usePieceSource();
2616
+ const [state, setState] = useState(null);
2617
+ const name = piece?.name;
2618
+ useEffect(() => {
2619
+ if (!name || !pieceSource) return;
2620
+ let cancelled = false;
2621
+ (mode === "triggers" ? pieceSource.loadTriggers(name) : pieceSource.loadActions(name)).then((entries) => {
2622
+ if (!cancelled) setState({
2623
+ name,
2624
+ entries,
2625
+ error: null
2626
+ });
2627
+ }, (error) => {
2628
+ if (!cancelled) setState({
2629
+ name,
2630
+ entries: null,
2631
+ error: error instanceof Error ? error.message : String(error)
2632
+ });
2633
+ });
2634
+ return () => {
2635
+ cancelled = true;
2636
+ };
2637
+ }, [
2638
+ name,
2639
+ mode,
2640
+ pieceSource
2641
+ ]);
2642
+ return state && state.name === name ? {
2643
+ entries: state.entries,
2644
+ error: state.error
2645
+ } : {
2646
+ entries: null,
2647
+ error: null
2648
+ };
2649
+ }
2650
+ function EntriesPane(props) {
2651
+ const { source } = props;
2652
+ const entries = source?.kind === "list" ? source.entries : props.pieceEntries;
2653
+ const kind = props.mode === "triggers" ? "trigger" : "action";
2654
+ const title = source?.kind === "list" ? source.title : source?.piece.displayName;
2655
+ const about = source?.kind === "list" ? source.subtitle : source?.piece.description;
2656
+ return /* @__PURE__ */ jsxs("div", {
2657
+ className: "flex min-h-0 min-w-0 flex-1 flex-col",
2658
+ children: [source && props.showHeader ? /* @__PURE__ */ jsxs("div", {
2659
+ className: "flex shrink-0 items-start gap-3 border-b border-foreground/10 px-4 py-3",
2660
+ children: [/* @__PURE__ */ jsx("span", {
2661
+ "aria-hidden": "true",
2662
+ className: "contents",
2663
+ children: source.kind === "list" ? source.logo(HEADER_LOGO) : /* @__PURE__ */ jsx(LogoFrame, {
2664
+ src: source.piece.logoUrl,
2665
+ alt: "",
2666
+ size: HEADER_LOGO
2667
+ })
2668
+ }), /* @__PURE__ */ jsxs("div", {
2669
+ className: "min-w-0",
2670
+ children: [/* @__PURE__ */ jsx("div", {
2671
+ className: "truncate text-sm font-semibold leading-5 text-foreground",
2672
+ children: title
2673
+ }), about ? /* @__PURE__ */ jsx("div", {
2674
+ className: "line-clamp-2 text-xs leading-4 text-muted-foreground",
2675
+ title: about,
2676
+ children: about
2677
+ }) : null]
2678
+ })]
2679
+ }) : null, !source ? /* @__PURE__ */ jsxs(Status, { children: [
2680
+ "Pick a piece to see its ",
2681
+ kind,
2682
+ "s"
2683
+ ] }) : props.pieceError ? /* @__PURE__ */ jsx(Status, {
2684
+ error: true,
2685
+ children: props.pieceError
2686
+ }) : entries === null ? /* @__PURE__ */ jsx(Status, { children: "Loading…" }) : entries.length === 0 ? /* @__PURE__ */ jsxs(Status, { children: [
2687
+ "No ",
2688
+ kind,
2689
+ "s"
2690
+ ] }) : /* @__PURE__ */ jsx(VirtualList, {
2691
+ id: props.listId,
2692
+ resetKey: source.id,
2693
+ label: `${title ?? ""} ${kind}s`,
2694
+ className: "flex-1 py-1",
2695
+ items: entries,
2696
+ heightOf: entryHeight,
2697
+ keyOf: (entry) => entry.key,
2698
+ activeIndex: props.activeIndex,
2699
+ render: (entry, index) => /* @__PURE__ */ jsx(EntryRow, {
2700
+ entry,
2701
+ tokens: props.tokens,
2702
+ active: index === props.activeIndex,
2703
+ option: {
2704
+ list: props.listId,
2705
+ index,
2706
+ size: entries.length
2707
+ },
2708
+ onActivate: () => props.onActivate(index)
2709
+ })
2710
+ })]
2711
+ });
2712
+ }
2713
+ function SearchList(props) {
2714
+ const size = props.rows.length;
2715
+ return /* @__PURE__ */ jsxs("div", {
2716
+ className: "flex min-h-0 flex-1 flex-col",
2717
+ children: [props.status, /* @__PURE__ */ jsx(VirtualList, {
2718
+ id: props.listId,
2719
+ label: "Search results",
2720
+ resetKey: props.resetKey,
2721
+ className: `flex-1 py-1 ${props.stale ? "opacity-60" : ""}`,
2722
+ items: props.rows,
2723
+ heightOf: searchRowHeight,
2724
+ keyOf: (row, index) => row.type === "entry" ? `e:${row.entry.key}` : row.type === "piece" ? `p:${row.match.pieceName}` : row.type === "list" ? `l:${row.source.id}` : `m:${row.pieceName}:${index}`,
2725
+ activeIndex: props.activeIndex,
2726
+ render: (row, index) => {
2727
+ const active = index === props.activeIndex;
2728
+ const activate = () => props.onActivate(index);
2729
+ const option = {
2730
+ list: props.listId,
2731
+ index,
2732
+ size
2733
+ };
2734
+ if (row.type === "entry") return /* @__PURE__ */ jsx(EntryRow, {
2735
+ entry: row.entry,
2736
+ tokens: props.tokens,
2737
+ active,
2738
+ option,
2739
+ indent: true,
2740
+ onActivate: activate
2741
+ });
2742
+ if (row.type === "more") return /* @__PURE__ */ jsxs("div", {
2743
+ ...optionAttributes(option),
2744
+ role: "option",
2745
+ "aria-selected": active,
2746
+ className: `mx-1.5 my-px flex h-[calc(100%-2px)] cursor-pointer items-center rounded-md pl-[42px] text-xs text-muted-foreground hover:text-foreground ${rowTone(active)}`,
2747
+ onMouseDown: (event) => event.preventDefault(),
2748
+ onMouseEnter: activate,
2749
+ onClick: () => props.onExpand(row.pieceName),
2750
+ children: [row.hidden, " more…"]
2751
+ });
2752
+ const header = row.type === "piece" ? {
2753
+ logo: /* @__PURE__ */ jsx(LogoFrame, {
2754
+ src: row.match.logoUrl,
2755
+ alt: row.match.displayName,
2756
+ size: 20
2757
+ }),
2758
+ label: row.match.displayName,
2759
+ note: row.match.deprecated ? "Deprecated" : row.match.unsupported ?? void 0,
2760
+ kind: props.kind,
2761
+ open: () => props.onOpenPiece(row.match.pieceName)
2762
+ } : {
2763
+ logo: row.source.logo(20),
2764
+ label: row.source.title,
2765
+ note: void 0,
2766
+ kind: props.kind,
2767
+ open: () => props.onOpenList(row.source.id)
2768
+ };
2769
+ return /* @__PURE__ */ jsxs("div", {
2770
+ ...optionAttributes(option),
2771
+ role: "option",
2772
+ "aria-selected": active,
2773
+ title: `Open ${header.label}`,
2774
+ className: `group mx-1.5 mt-1 flex h-[calc(100%-4px)] cursor-pointer items-center gap-2.5 rounded-md px-2 text-left ${rowTone(active)}`,
2775
+ onMouseDown: (event) => event.preventDefault(),
2776
+ onMouseEnter: activate,
2777
+ onClick: header.open,
2778
+ children: [
2779
+ /* @__PURE__ */ jsx("span", {
2780
+ "aria-hidden": "true",
2781
+ className: "contents",
2782
+ children: header.logo
2783
+ }),
2784
+ /* @__PURE__ */ jsx("span", {
2785
+ className: "truncate text-[13px] font-semibold text-foreground",
2786
+ children: /* @__PURE__ */ jsx(Highlight, {
2787
+ text: header.label,
2788
+ tokens: props.tokens
2789
+ })
2790
+ }),
2791
+ header.note ? /* @__PURE__ */ jsx("span", {
2792
+ className: "truncate text-[11px] text-muted-foreground",
2793
+ children: header.note
2794
+ }) : null,
2795
+ /* @__PURE__ */ jsxs("span", {
2796
+ className: `ml-auto flex shrink-0 items-center gap-0.5 text-[11px] text-muted-foreground ${active ? "" : "opacity-0 group-hover:opacity-100"}`,
2797
+ children: [
2798
+ "All ",
2799
+ header.kind,
2800
+ "s",
2801
+ /* @__PURE__ */ jsx(Icon, {
2802
+ name: "chevron",
2803
+ size: 12
2804
+ })
2805
+ ]
2806
+ })
2807
+ ]
2808
+ });
2809
+ }
2810
+ })]
2811
+ });
2812
+ }
2838
2813
  function BlockSelector(props) {
2839
2814
  const [query, setQuery] = useState("");
2815
+ const [tab, setTab] = useState("all");
2840
2816
  const [chip, setChip] = useState(null);
2841
2817
  const [catalog, setCatalog] = useState(null);
2842
- const [piece, setPiece] = useState(null);
2818
+ const [selectedId, setSelectedId] = useState(null);
2819
+ const [paneState, setPane] = useState("sources");
2820
+ const [entryIndex, setEntryIndex] = useState(-1);
2821
+ const [rowIndex, setRowIndex] = useState(-1);
2822
+ const [expanded, setExpanded] = useState(/* @__PURE__ */ new Set());
2843
2823
  const containerRef = useRef(null);
2824
+ const inputRef = useRef(null);
2825
+ const baseId = useId();
2826
+ const listIds = {
2827
+ sources: `${baseId}-sources`,
2828
+ entries: `${baseId}-entries`,
2829
+ results: `${baseId}-results`
2830
+ };
2831
+ const pointerMoved = useRef(false);
2832
+ const hoverTimer = useRef(void 0);
2833
+ const { anchor, onClose } = props;
2844
2834
  useEffect(() => {
2845
2835
  const handler = (event) => {
2846
- if (!containerRef.current?.contains(event.target)) props.onClose();
2836
+ const target = event.target;
2837
+ if (containerRef.current?.contains(target)) return;
2838
+ if (anchor?.current?.contains(target)) return;
2839
+ onClose();
2847
2840
  };
2848
- window.addEventListener("mousedown", handler);
2849
- return () => window.removeEventListener("mousedown", handler);
2850
- }, [props]);
2841
+ window.addEventListener("pointerdown", handler, true);
2842
+ return () => window.removeEventListener("pointerdown", handler, true);
2843
+ }, [anchor, onClose]);
2844
+ useEffect(() => () => clearTimeout(hoverTimer.current), []);
2851
2845
  const anySource = usePieceSource();
2852
2846
  const pieceSource = props.showPieces ? anySource : void 0;
2853
2847
  const [catalogRound, setCatalogRound] = useState(0);
@@ -2882,176 +2876,496 @@ function BlockSelector(props) {
2882
2876
  const pinned = (preset) => pinBlock(preset.block, installed);
2883
2877
  const pick = (preset) => {
2884
2878
  const block = pinned(preset);
2885
- if (block) props.onPick({
2879
+ if (!block) return;
2880
+ rememberPick(preset);
2881
+ props.onPick({
2886
2882
  ...preset,
2887
2883
  block
2888
2884
  });
2889
2885
  };
2890
2886
  const prefetch = useBlockFormPrefetch();
2891
2887
  const mode = props.pieceMode ?? "actions";
2892
- const lowered = query.toLowerCase();
2893
- const modePieces = useMemo(() => (catalog?.pieces ?? []).filter((entry) => (mode === "triggers" ? entry.triggerCount : entry.actionCount) > 0), [catalog, mode]);
2894
- const chips = useMemo(() => orderChips(modePieces), [modePieces]);
2895
- const chipsByPiece = useMemo(() => new Map(modePieces.map((entry) => [entry.name, chipsOf(entry)])), [modePieces]);
2896
- const inChip = (pieceName) => chip === null || chip === "Core" ? true : chipsByPiece.get(pieceName)?.has(chip) ?? false;
2897
- const showCatalog = pieceSource !== void 0 && !(chip === "Core" || chip === "Powerhouse");
2898
- const matching = props.presets.filter((preset) => `${preset.label} ${preset.block.pieceName} ${preset.block.name}`.toLowerCase().includes(lowered));
2899
- const corePresets = chip === null || chip === "Core" ? matching.filter((preset) => preset.group !== "powerhouse") : [];
2900
- const powerhousePresets = chip === null || chip === "Powerhouse" ? matching.filter((preset) => preset.group === "powerhouse") : [];
2901
- const filteredAttach = (props.onAttach ? props.attachSteps ?? [] : []).filter((step) => `${step.name} ${step.key} ${step.pieceName} ${step.actionName}`.toLowerCase().includes(lowered));
2902
- const filteredPieces = showCatalog ? modePieces.filter((entry) => inChip(entry.name) && `${entry.displayName} ${entry.name} ${entry.description}`.toLowerCase().includes(lowered)) : [];
2903
- const search = useBlockSearch(query, showCatalog && !piece);
2904
- const presetRow = (preset) => {
2888
+ const kind = mode === "triggers" ? "trigger" : "action";
2889
+ const tokens = queryTokens(query);
2890
+ const searching = query.trim().length >= SEARCH_MIN_CHARS;
2891
+ const showCatalog = pieceSource !== void 0 && tab !== "core";
2892
+ const tabs = pieceSource ? [
2893
+ "all",
2894
+ "core",
2895
+ "powerhouse",
2896
+ "activepieces"
2897
+ ] : [
2898
+ "all",
2899
+ "core",
2900
+ "powerhouse"
2901
+ ];
2902
+ const modePieces = useMemo(() => {
2903
+ const presetCounts = /* @__PURE__ */ new Map();
2904
+ for (const preset of props.presets) {
2905
+ const name = preset.block.pieceName;
2906
+ presetCounts.set(name, (presetCounts.get(name) ?? 0) + 1);
2907
+ }
2908
+ return (catalog?.pieces ?? []).filter((entry) => {
2909
+ return (mode === "triggers" ? entry.triggerCount : entry.actionCount) > (presetCounts.get(entry.name) ?? 0);
2910
+ });
2911
+ }, [
2912
+ catalog,
2913
+ mode,
2914
+ props.presets
2915
+ ]);
2916
+ const tabPieces = useMemo(() => modePieces.filter((entry) => inTab(tab, entry)), [modePieces, tab]);
2917
+ const chips = useMemo(() => orderChips(tabPieces), [tabPieces]);
2918
+ const showChips = showCatalog && (tab === "activepieces" || tab === "powerhouse") && chips.length > 1;
2919
+ const activeChip = showChips && chip !== null && chips.includes(chip) ? chip : null;
2920
+ const searchFilter = useMemo(() => showCatalog ? {
2921
+ kind,
2922
+ ...TAB_SOURCES[tab] ? { sources: TAB_SOURCES[tab] } : {},
2923
+ ...activeChip ? { categories: categoriesOfChip(activeChip, tabPieces) } : {}
2924
+ } : null, [
2925
+ showCatalog,
2926
+ kind,
2927
+ tab,
2928
+ activeChip,
2929
+ tabPieces
2930
+ ]);
2931
+ const search = usePieceSearch(query, searchFilter);
2932
+ const presetEntry = (preset) => {
2905
2933
  const block = pinned(preset);
2906
- return /* @__PURE__ */ jsx(Row, {
2934
+ return {
2935
+ key: `${blockKey(preset.block)} ${preset.label}`,
2907
2936
  logo: /* @__PURE__ */ jsx(BlockLogo, {
2908
2937
  block: preset.block,
2909
2938
  size: ROW_LOGO
2910
2939
  }),
2911
2940
  label: preset.label,
2912
- description: block ? preset.description : catalog === null ? "Loading…" : "Not installed on this runtime",
2913
- disabled: !block,
2941
+ description: preset.description,
2942
+ unavailable: block ? void 0 : catalog === null ? "Loading…" : "Not installed on this runtime",
2914
2943
  version: shownVersion(preset.block.pieceName, block?.pieceVersion),
2915
2944
  versionNote: versionNote(preset.block.pieceName, block?.pieceVersion),
2916
- onHover: block ? () => prefetch(block) : void 0,
2917
- onClick: () => pick(preset)
2918
- }, blockKey(preset.block) + preset.label);
2945
+ pick: () => pick(preset),
2946
+ warm: block ? () => prefetch(block) : void 0
2947
+ };
2948
+ };
2949
+ const blockEntry = (entry, logo) => {
2950
+ const block = {
2951
+ pieceName: entry.pieceName,
2952
+ pieceVersion: entry.pieceVersion,
2953
+ kind,
2954
+ name: entry.name
2955
+ };
2956
+ return {
2957
+ key: blockKey(block),
2958
+ logo,
2959
+ label: entry.displayName,
2960
+ description: entry.description,
2961
+ unavailable: blockUnavailable({
2962
+ ...entry,
2963
+ kind
2964
+ }),
2965
+ version: shownVersion(entry.pieceName, entry.pieceVersion),
2966
+ versionNote: versionNote(entry.pieceName, entry.pieceVersion),
2967
+ pick: () => pick({
2968
+ label: entry.displayName,
2969
+ block,
2970
+ description: entry.description,
2971
+ defaultConfig: {}
2972
+ }),
2973
+ warm: () => prefetch(block)
2974
+ };
2975
+ };
2976
+ const lists = (() => {
2977
+ if (activeChip !== null) return [];
2978
+ const result = [];
2979
+ const add = (id, title, subtitle, logo, entries) => {
2980
+ if (entries.length > 0) result.push({
2981
+ kind: "list",
2982
+ id,
2983
+ title,
2984
+ subtitle,
2985
+ logo,
2986
+ entries
2987
+ });
2988
+ };
2989
+ if (tab === "all") {
2990
+ if (props.onAttach) add("attach", "Detached steps", "Re-attach a step at this point", listTile("branch", "#64748b"), (props.attachSteps ?? []).map((step) => ({
2991
+ key: `attach ${step.id}`,
2992
+ logo: /* @__PURE__ */ jsx(BlockLogo, {
2993
+ block: stepBlock(step),
2994
+ size: ROW_LOGO
2995
+ }),
2996
+ label: step.name,
2997
+ description: `{{steps.${step.key}}} · detached`,
2998
+ pick: () => props.onAttach?.(step.id)
2999
+ })));
3000
+ }
3001
+ if (tab === "all" || tab === "core") add("core", "Core", "Built into the workflow engine", listTile("bolt", "#2563eb"), props.presets.filter((preset) => preset.group !== "powerhouse").map(presetEntry));
3002
+ if (tab === "all" || tab === "powerhouse") {
3003
+ const reactorPreset = props.presets.find((preset) => preset.group === "powerhouse");
3004
+ add("powerhouse", "Documents", "Read and change documents on this reactor", (size) => reactorPreset ? /* @__PURE__ */ jsx(BlockLogo, {
3005
+ block: reactorPreset.block,
3006
+ size
3007
+ }) : null, props.presets.filter((preset) => preset.group === "powerhouse").map(presetEntry));
3008
+ }
3009
+ if (tab === "all") {
3010
+ const recent = recentPicks(kind).filter((preset) => isCoreBlock(preset.block) || installed(preset.block.pieceName));
3011
+ add("recent", "Recently used", `Your last ${kind}s`, listTile("clock", "#64748b"), recent.map((preset) => {
3012
+ const entry = presetEntry(preset);
3013
+ const reason = catalog?.pieces.find((piece) => piece.name === preset.block.pieceName)?.unsupported;
3014
+ return reason ? {
3015
+ ...entry,
3016
+ unavailable: reason
3017
+ } : entry;
3018
+ }));
3019
+ }
3020
+ return result;
3021
+ })();
3022
+ const sources = (() => {
3023
+ const listSources = lists.map((list) => ({
3024
+ ...list,
3025
+ entries: list.entries.filter((entry) => matchesQuery(`${entry.label} ${entry.description}`, tokens))
3026
+ })).filter((list) => list.entries.length > 0);
3027
+ const pieceSources = showCatalog ? tabPieces.filter((entry) => (activeChip === null || chipsOf(entry).has(activeChip)) && matchesQuery(`${entry.displayName} ${entry.name} ${entry.description}`, tokens)).map((piece) => ({
3028
+ kind: "piece",
3029
+ id: piece.name,
3030
+ piece
3031
+ })) : [];
3032
+ return [...listSources, ...pieceSources];
3033
+ })();
3034
+ const selected = sources.find((source) => source.id === selectedId) ?? sources.at(0);
3035
+ const sourceIndex = selected ? sources.indexOf(selected) : -1;
3036
+ const selectedPiece = selected?.kind === "piece" ? selected.piece : void 0;
3037
+ const loaded = usePieceEntries(selectedPiece, mode);
3038
+ const pieceEntries = selectedPiece && loaded.entries ? loaded.entries.map((entry) => blockEntry(entry, /* @__PURE__ */ jsx(LogoFrame, {
3039
+ src: selectedPiece.logoUrl,
3040
+ alt: selectedPiece.displayName,
3041
+ size: ROW_LOGO
3042
+ }))) : null;
3043
+ const entries = selected?.kind === "list" ? selected.entries : pieceEntries ?? [];
3044
+ const entryAt = entries.length === 0 ? -1 : Math.min(entryIndex, entries.length - 1);
3045
+ const presetKeys = new Set(props.presets.map((preset) => `${preset.block.pieceName} ${preset.block.name}`));
3046
+ const rows = [];
3047
+ if (searching) {
3048
+ for (const source of sources) {
3049
+ if (source.kind !== "list" || source.id === "recent") continue;
3050
+ rows.push({
3051
+ type: "list",
3052
+ source
3053
+ });
3054
+ for (const entry of source.entries) rows.push({
3055
+ type: "entry",
3056
+ entry
3057
+ });
3058
+ }
3059
+ const groups = search.kind === "done" ? search.result.pieces.map((match) => ({
3060
+ ...match,
3061
+ blocks: match.blocks.filter((hit) => !presetKeys.has(`${hit.pieceName} ${hit.name}`))
3062
+ })).filter((match) => match.blocks.length > 0) : [];
3063
+ for (const match of groups) {
3064
+ rows.push({
3065
+ type: "piece",
3066
+ match
3067
+ });
3068
+ const shown = groups.length <= 2 || expanded.has(match.pieceName) ? match.blocks : match.blocks.slice(0, GROUP_BLOCKS);
3069
+ const logo = /* @__PURE__ */ jsx(LogoFrame, {
3070
+ src: match.logoUrl,
3071
+ alt: match.displayName,
3072
+ size: ROW_LOGO
3073
+ });
3074
+ for (const hit of shown) rows.push({
3075
+ type: "entry",
3076
+ entry: blockEntry(hit, logo)
3077
+ });
3078
+ if (shown.length < match.blocks.length) rows.push({
3079
+ type: "more",
3080
+ pieceName: match.pieceName,
3081
+ hidden: match.blocks.length - shown.length
3082
+ });
3083
+ }
3084
+ const partial = !pieceSource?.searchPieces || search.kind === "done" && search.result.status !== "ready";
3085
+ if (showCatalog && partial) {
3086
+ const grouped = new Set(groups.map((match) => match.pieceName));
3087
+ const named = (source) => source.kind === "piece" && matchesQuery(source.piece.displayName, tokens) ? 0 : 1;
3088
+ for (const source of [...sources].sort((a, b) => named(a) - named(b))) {
3089
+ if (source.kind !== "piece" || grouped.has(source.id)) continue;
3090
+ rows.push({
3091
+ type: "piece",
3092
+ match: {
3093
+ pieceName: source.piece.name,
3094
+ pieceVersion: source.piece.version ?? "",
3095
+ displayName: source.piece.displayName,
3096
+ description: source.piece.description,
3097
+ logoUrl: source.piece.logoUrl,
3098
+ categories: source.piece.categories,
3099
+ source: source.piece.source ?? "activepieces",
3100
+ namedPiece: true,
3101
+ blocks: []
3102
+ }
3103
+ });
3104
+ }
3105
+ }
3106
+ }
3107
+ const activeRow = rowIndex < 0 ? rows.findIndex((row) => row.type === "entry") : Math.min(rowIndex, rows.length - 1);
3108
+ const twoPane = showCatalog || sources.length > 1;
3109
+ const pane = twoPane ? paneState : "entries";
3110
+ const selectSource = (id) => {
3111
+ setSelectedId(id);
3112
+ setPane("sources");
3113
+ setEntryIndex(-1);
3114
+ };
3115
+ const openSource = (id) => {
3116
+ setSelectedId(id);
3117
+ setPane("entries");
3118
+ setEntryIndex(0);
3119
+ };
3120
+ const openPiece = (pieceName) => {
3121
+ if (!modePieces.some((piece) => piece.name === pieceName)) {
3122
+ setExpanded(/* @__PURE__ */ new Set([...expanded, pieceName]));
3123
+ return;
3124
+ }
3125
+ setQuery("");
3126
+ setChip(null);
3127
+ if (tab !== "all") setTab("all");
3128
+ openSource(pieceName);
3129
+ inputRef.current?.focus();
3130
+ };
3131
+ const hoverSource = (id) => {
3132
+ if (!pointerMoved.current) return;
3133
+ clearTimeout(hoverTimer.current);
3134
+ hoverTimer.current = setTimeout(() => selectSource(id), HOVER_PREVIEW_MS);
3135
+ };
3136
+ const step = (index, delta, count) => count === 0 ? index : Math.min(Math.max(index + delta, 0), count - 1);
3137
+ const onKeyDown = (event) => {
3138
+ const key = event.key;
3139
+ if (key !== "Escape" && event.target !== inputRef.current) return;
3140
+ if (key === "Escape") {
3141
+ event.stopPropagation();
3142
+ if (query !== "") setQuery("");
3143
+ else if (twoPane && pane === "entries" && !searching) setPane("sources");
3144
+ else onClose();
3145
+ return;
3146
+ }
3147
+ const delta = key === "ArrowDown" ? 1 : key === "ArrowUp" ? -1 : 0;
3148
+ if (searching) {
3149
+ if (delta !== 0) {
3150
+ event.preventDefault();
3151
+ setRowIndex(Math.max(step(activeRow, delta, rows.length), 0));
3152
+ return;
3153
+ }
3154
+ if (key === "Enter") {
3155
+ event.preventDefault();
3156
+ if (search.kind === "done" && search.stale) return;
3157
+ const row = rows.at(activeRow);
3158
+ if (!row) return;
3159
+ if (row.type === "entry") {
3160
+ if (row.entry.unavailable === void 0) row.entry.pick();
3161
+ } else if (row.type === "piece") openPiece(row.match.pieceName);
3162
+ else if (row.type === "list") openSource(row.source.id);
3163
+ else setExpanded(/* @__PURE__ */ new Set([...expanded, row.pieceName]));
3164
+ }
3165
+ return;
3166
+ }
3167
+ const sideways = query === "";
3168
+ if (pane === "sources") {
3169
+ if (delta !== 0) {
3170
+ event.preventDefault();
3171
+ const next = sources.at(step(sourceIndex, delta, sources.length));
3172
+ if (next) selectSource(next.id);
3173
+ } else if (key === "Enter" || sideways && key === "ArrowRight") {
3174
+ event.preventDefault();
3175
+ if (selected) openSource(selected.id);
3176
+ }
3177
+ return;
3178
+ }
3179
+ if (delta !== 0) {
3180
+ event.preventDefault();
3181
+ setEntryIndex(step(entryIndex, delta, entries.length));
3182
+ } else if (sideways && key === "ArrowLeft") {
3183
+ event.preventDefault();
3184
+ setPane("sources");
3185
+ } else if (key === "Enter") {
3186
+ event.preventDefault();
3187
+ const entry = entryAt < 0 ? void 0 : entries.at(entryAt);
3188
+ if (entry && entry.unavailable === void 0) entry.pick();
3189
+ }
2919
3190
  };
2920
- const labelPresets = showCatalog || filteredAttach.length > 0 || corePresets.length > 0 && powerhousePresets.length > 0;
2921
- const wantedKind = mode === "triggers" ? "trigger" : "action";
2922
- const hits = search.kind === "done" ? search.result.hits.filter((hit) => hit.kind === wantedKind && inChip(hit.pieceName)) : [];
2923
- const searchActive = search.kind !== "idle";
3191
+ const width = props.width ?? (pieceSource ? PICKER_SIZE.width : 360);
3192
+ const activeList = searching ? listIds.results : pane === "entries" ? listIds.entries : listIds.sources;
3193
+ const activeIndex = searching ? activeRow : pane === "entries" ? entryAt : sourceIndex;
3194
+ const activeOption = activeIndex >= 0 ? optionId(activeList, activeIndex) : void 0;
3195
+ const searchStatus = search.kind === "loading" || search.kind === "done" && search.stale ? /* @__PURE__ */ jsx(Status, { children: "Searching…" }) : search.kind === "error" ? /* @__PURE__ */ jsx(Status, {
3196
+ error: true,
3197
+ children: search.message
3198
+ }) : search.kind === "done" && search.result.status === "indexing" ? /* @__PURE__ */ jsx(Status, { children: "Still indexing the catalog: pieces are matched by name until it is ready." }) : search.kind === "done" && search.result.status === "error" ? /* @__PURE__ */ jsxs(Status, {
3199
+ error: true,
3200
+ children: [search.result.error ?? "Search failed", "; pieces are matched by name."]
3201
+ }) : rows.length === 0 ? /* @__PURE__ */ jsxs(Status, { children: [
3202
+ "No matching ",
3203
+ kind,
3204
+ "s"
3205
+ ] }) : null;
3206
+ const compact = !twoPane && !searching;
3207
+ const height = props.height ?? PICKER_SIZE.height;
2924
3208
  return /* @__PURE__ */ jsxs("div", {
2925
3209
  ref: containerRef,
2926
- className: "nodrag nopan nowheel w-80 rounded-md border border-solid border-foreground/10 bg-card shadow-lg",
3210
+ className: "nodrag nopan nowheel flex flex-col overflow-hidden rounded-lg border border-solid border-foreground/10 bg-card shadow-xl",
3211
+ style: compact ? {
3212
+ width,
3213
+ maxHeight: height
3214
+ } : {
3215
+ width,
3216
+ height
3217
+ },
2927
3218
  onClick: (event) => event.stopPropagation(),
2928
- children: [/* @__PURE__ */ jsxs("div", {
2929
- className: "border-b border-foreground/10 p-2",
2930
- children: [/* @__PURE__ */ jsx("div", {
2931
- className: "mb-1 px-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground/80",
2932
- children: props.title
2933
- }), piece ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("input", {
2934
- autoFocus: true,
2935
- className: "w-full rounded border border-foreground/10 px-2 py-1 text-xs",
2936
- placeholder: pieceSource ? "Search pieces, actions, triggers…" : "Search…",
2937
- value: query,
2938
- onChange: (event) => setQuery(event.target.value)
2939
- }), pieceSource && catalog && !catalog.error ? /* @__PURE__ */ jsx("div", {
2940
- className: "mt-1.5 flex flex-wrap gap-1 px-0.5",
2941
- children: chips.map((label) => /* @__PURE__ */ jsx(Chip, {
2942
- label,
2943
- active: chip === label,
2944
- onClick: () => setChip(chip === label ? null : label)
2945
- }, label))
2946
- }) : null] })]
2947
- }), piece ? /* @__PURE__ */ jsx(PieceEntries, {
2948
- piece,
2949
- mode,
2950
- onPick: pick,
2951
- onHover: prefetch,
2952
- onBack: () => setPiece(null),
2953
- versionNote
2954
- }) : /* @__PURE__ */ jsxs("div", {
2955
- className: "max-h-80 overflow-y-auto py-1",
2956
- children: [
2957
- filteredAttach.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SectionLabel, { children: "Attach existing step" }), filteredAttach.map((step) => /* @__PURE__ */ jsx(Row, {
2958
- logo: /* @__PURE__ */ jsx(BlockLogo, {
2959
- block: stepBlock(step),
2960
- size: ROW_LOGO
2961
- }),
2962
- label: step.name,
2963
- description: `{{steps.${step.key}}} · detached`,
2964
- onClick: () => props.onAttach?.(step.id)
2965
- }, step.id))] }) : null,
2966
- corePresets.length > 0 && labelPresets ? /* @__PURE__ */ jsx(SectionLabel, { children: "Core" }) : null,
2967
- corePresets.map(presetRow),
2968
- powerhousePresets.length > 0 && labelPresets ? /* @__PURE__ */ jsx(SectionLabel, { children: "Powerhouse" }) : null,
2969
- powerhousePresets.map(presetRow),
2970
- searchActive ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SectionLabel, { children: mode === "triggers" ? "Triggers" : "Actions & triggers" }), search.kind === "loading" ? /* @__PURE__ */ jsx("div", {
2971
- className: "px-3 py-1 text-xs text-muted-foreground/80",
2972
- children: "Searching…"
2973
- }) : search.kind === "error" ? /* @__PURE__ */ jsx("div", {
2974
- className: "px-3 py-1 text-xs text-wf-fail",
2975
- children: search.message
2976
- }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [hits.map((hit) => {
2977
- const unavailable = blockUnavailable(hit);
2978
- const block = {
2979
- pieceName: hit.pieceName,
2980
- pieceVersion: hit.pieceVersion,
2981
- kind: hit.kind,
2982
- name: hit.name
2983
- };
2984
- return /* @__PURE__ */ jsx(Row, {
2985
- logo: /* @__PURE__ */ jsx(LogoFrame, {
2986
- src: hit.logoUrl,
2987
- alt: hit.pieceDisplayName,
2988
- size: ROW_LOGO
3219
+ onKeyDown,
3220
+ onMouseMove: () => {
3221
+ pointerMoved.current = true;
3222
+ },
3223
+ children: [
3224
+ /* @__PURE__ */ jsxs("div", {
3225
+ className: "shrink-0 border-b border-foreground/10",
3226
+ children: [/* @__PURE__ */ jsxs("div", {
3227
+ className: "flex items-center gap-2 px-3.5 pt-3 text-muted-foreground",
3228
+ children: [
3229
+ /* @__PURE__ */ jsx(Icon, {
3230
+ name: "search",
3231
+ size: 15
2989
3232
  }),
2990
- label: `${hit.displayName} · ${hit.pieceDisplayName}`,
2991
- description: unavailable ?? (hit.description || hit.pieceDisplayName),
2992
- disabled: unavailable !== void 0,
2993
- version: shownVersion(hit.pieceName, hit.pieceVersion),
2994
- versionNote: versionNote(hit.pieceName, hit.pieceVersion),
2995
- onHover: unavailable === void 0 ? () => prefetch(block) : void 0,
2996
- onClick: () => pick({
2997
- label: hit.displayName,
2998
- block,
2999
- description: hit.description,
3000
- defaultConfig: {}
3233
+ /* @__PURE__ */ jsx("input", {
3234
+ ref: inputRef,
3235
+ autoFocus: true,
3236
+ role: "combobox",
3237
+ "aria-expanded": true,
3238
+ "aria-autocomplete": "list",
3239
+ "aria-label": `Search ${props.title.toLowerCase()}`,
3240
+ "aria-controls": activeList,
3241
+ "aria-activedescendant": activeOption,
3242
+ className: "min-w-0 flex-1 bg-transparent py-1 text-sm text-foreground outline-none placeholder:text-muted-foreground",
3243
+ placeholder: pieceSource ? `Search pieces and ${kind}s…` : "Search…",
3244
+ value: query,
3245
+ onChange: (event) => {
3246
+ setQuery(event.target.value);
3247
+ setRowIndex(-1);
3248
+ setExpanded(/* @__PURE__ */ new Set());
3249
+ }
3250
+ }),
3251
+ /* @__PURE__ */ jsx("span", {
3252
+ className: "shrink-0 truncate text-xs",
3253
+ children: props.title
3001
3254
  })
3002
- }, blockKey(block));
3003
- }), search.result.status === "indexing" ? /* @__PURE__ */ jsx("div", {
3004
- className: "px-3 py-1 text-xs text-muted-foreground/80",
3005
- children: "Indexing the catalog… more results appear shortly."
3006
- }) : search.result.status === "error" ? /* @__PURE__ */ jsx("div", {
3007
- className: "px-3 py-1 text-xs text-wf-fail",
3008
- children: search.result.error ?? "Search failed"
3009
- }) : hits.length === 0 ? /* @__PURE__ */ jsxs("div", {
3010
- className: "px-3 py-1 text-xs text-muted-foreground/80",
3255
+ ]
3256
+ }), /* @__PURE__ */ jsx("div", {
3257
+ className: "px-3 pb-2.5 pt-2",
3258
+ children: /* @__PURE__ */ jsx(Tabs, {
3259
+ tabs,
3260
+ active: tab,
3261
+ onSelect: (next, fromKeyboard) => {
3262
+ setTab(next);
3263
+ setChip(null);
3264
+ setSelectedId(null);
3265
+ setPane("sources");
3266
+ if (!fromKeyboard) inputRef.current?.focus();
3267
+ }
3268
+ })
3269
+ })]
3270
+ }),
3271
+ showChips && catalog && !catalog.error ? /* @__PURE__ */ jsx(ChipBar, { children: chips.map((label, index) => /* @__PURE__ */ jsx(Chip, {
3272
+ label,
3273
+ active: activeChip === label,
3274
+ tabStop: activeChip === null ? index === 0 : activeChip === label,
3275
+ onClick: (fromKeyboard) => {
3276
+ setChip(activeChip === label ? null : label);
3277
+ setSelectedId(null);
3278
+ if (!fromKeyboard) inputRef.current?.focus();
3279
+ }
3280
+ }, label)) }) : null,
3281
+ searching ? /* @__PURE__ */ jsx(SearchList, {
3282
+ rows,
3283
+ tokens,
3284
+ activeIndex: activeRow,
3285
+ onActivate: (index) => {
3286
+ if (pointerMoved.current) setRowIndex(index);
3287
+ },
3288
+ onOpenPiece: openPiece,
3289
+ onOpenList: (id) => {
3290
+ setQuery("");
3291
+ openSource(id);
3292
+ },
3293
+ onExpand: (name) => setExpanded(/* @__PURE__ */ new Set([...expanded, name])),
3294
+ status: searchStatus,
3295
+ kind,
3296
+ listId: listIds.results,
3297
+ resetKey: `${query} ${JSON.stringify(searchFilter)}`,
3298
+ stale: search.kind === "done" && search.stale
3299
+ }) : /* @__PURE__ */ jsxs("div", {
3300
+ className: "flex min-h-0 flex-1",
3301
+ children: [twoPane ? /* @__PURE__ */ jsxs("div", {
3302
+ className: "flex w-56 shrink-0 flex-col border-r border-foreground/10 bg-foreground/[0.025]",
3011
3303
  children: [
3012
- "No matching ",
3013
- wantedKind,
3014
- "s"
3304
+ catalog?.error ? /* @__PURE__ */ jsxs("div", {
3305
+ className: "flex items-center gap-2 px-3 py-2 text-xs text-wf-fail",
3306
+ children: [/* @__PURE__ */ jsx("span", {
3307
+ className: "min-w-0 flex-1",
3308
+ children: catalog.error
3309
+ }), /* @__PURE__ */ jsx("button", {
3310
+ type: "button",
3311
+ className: "shrink-0 cursor-pointer rounded border border-solid border-foreground/15 bg-card px-1.5 py-0.5 text-foreground hover:border-foreground/25",
3312
+ onClick: () => {
3313
+ setCatalog(null);
3314
+ setCatalogRound((round) => round + 1);
3315
+ },
3316
+ children: "Retry"
3317
+ })]
3318
+ }) : null,
3319
+ /* @__PURE__ */ jsx(VirtualList, {
3320
+ id: listIds.sources,
3321
+ label: "Pieces",
3322
+ resetKey: `${tab} ${activeChip ?? ""} ${query}`,
3323
+ className: "flex-1 py-1",
3324
+ items: sources,
3325
+ heightOf: sourceHeight,
3326
+ keyOf: (source) => `${source.kind}:${source.id}`,
3327
+ activeIndex: sourceIndex,
3328
+ render: (source, index) => /* @__PURE__ */ jsx(SourceRow, {
3329
+ source,
3330
+ tokens,
3331
+ mode,
3332
+ active: pane === "sources" && index === sourceIndex,
3333
+ selected: index === sourceIndex,
3334
+ option: {
3335
+ list: listIds.sources,
3336
+ index,
3337
+ size: sources.length
3338
+ },
3339
+ onActivate: () => hoverSource(source.id),
3340
+ onOpen: () => {
3341
+ clearTimeout(hoverTimer.current);
3342
+ openSource(source.id);
3343
+ inputRef.current?.focus();
3344
+ }
3345
+ })
3346
+ }),
3347
+ showCatalog && catalog === null ? /* @__PURE__ */ jsx(Status, { children: "Loading catalog…" }) : sources.length === 0 ? /* @__PURE__ */ jsx(Status, { children: tab === "powerhouse" && tokens.length === 0 ? "No registry pieces on this runtime" : "No matching pieces" }) : null
3015
3348
  ]
3016
- }) : null] })] }) : null,
3017
- showCatalog ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SectionLabel, { children: "Pieces" }), catalog === null ? /* @__PURE__ */ jsx("div", {
3018
- className: "px-3 py-2 text-xs text-muted-foreground/80",
3019
- children: "Loading catalog…"
3020
- }) : catalog.error ? /* @__PURE__ */ jsxs("div", {
3021
- className: "flex items-center gap-2 px-3 py-2 text-xs text-wf-fail",
3022
- children: [/* @__PURE__ */ jsx("span", {
3023
- className: "min-w-0 flex-1",
3024
- children: catalog.error
3025
- }), /* @__PURE__ */ jsx("button", {
3026
- type: "button",
3027
- className: "shrink-0 cursor-pointer rounded border border-solid border-foreground/15 bg-card px-1.5 py-0.5 text-foreground hover:border-foreground/25",
3028
- onClick: () => {
3029
- setCatalog(null);
3030
- setCatalogRound((round) => round + 1);
3031
- },
3032
- children: "Retry"
3033
- })]
3034
- }) : filteredPieces.map((entry) => /* @__PURE__ */ jsx(Row, {
3035
- logo: /* @__PURE__ */ jsx(LogoFrame, {
3036
- src: entry.logoUrl,
3037
- alt: entry.displayName,
3038
- size: ROW_LOGO
3039
- }),
3040
- label: entry.deprecated ? `${entry.displayName} (deprecated)` : entry.displayName,
3041
- description: entry.unsupported ?? (mode === "triggers" ? `${entry.triggerCount} trigger${entry.triggerCount === 1 ? "" : "s"} · ${entry.description}` : `${entry.actionCount} action${entry.actionCount === 1 ? "" : "s"} · ${entry.description}`),
3042
- version: shownVersion(entry.name, entry.version),
3043
- versionNote: versionNote(entry.name, entry.version),
3044
- onClick: () => setPiece(entry)
3045
- }, entry.name))] }) : null,
3046
- corePresets.length + powerhousePresets.length === 0 && filteredPieces.length === 0 && filteredAttach.length === 0 && !searchActive ? /* @__PURE__ */ jsx("div", {
3047
- className: "px-3 py-2 text-xs text-muted-foreground/80",
3048
- children: "No matches"
3049
- }) : null
3050
- ]
3051
- })]
3349
+ }) : null, /* @__PURE__ */ jsx(EntriesPane, {
3350
+ source: selected,
3351
+ mode,
3352
+ pieceEntries,
3353
+ pieceError: selected?.kind === "piece" ? loaded.error : null,
3354
+ tokens,
3355
+ activeIndex: pane === "entries" ? entryAt : -1,
3356
+ listId: listIds.entries,
3357
+ showHeader: twoPane,
3358
+ onActivate: (index) => {
3359
+ if (!pointerMoved.current) return;
3360
+ setPane("entries");
3361
+ setEntryIndex(index);
3362
+ }
3363
+ })]
3364
+ })
3365
+ ]
3052
3366
  });
3053
3367
  }
3054
3368
  //#endregion
3055
- export { formatDuration as $, isEmptyValue as A, Tooltip as At, blockMeta as B, useOptionSearch as C, Hint as Ct, useTestTrigger as D, Switch as Dt, useTestStepRunner as E, Select as Et, storedSchema as F, isIconName as Ft, CONNECTION_TONE as G, pieceLogo as H, stripOptions as I, DocumentErrorBoundary as It, STEP_TONE as J, RUN_STATUSES as K, undeclaredPortIssues as L, DocumentLoadError as Lt, parsePropList as M, textAreaClass as Mt, resolverInputFor as N, textInputClass as Nt, useWebhookEndpoint as O, Tabs as Ot, settingFor as P, Icon as Pt, formatAbsolute as Q, withSetting as R, errorMessage as Rt, useLatestRun as S, FieldLabel as St, useRunById as T, Segmented as Tt, useBlockMeta as U, pieceDisplayName as V, usePieceLogos as W, TONE_TEXT as X, TONE_DOT as Y, durationMs as Z, useConnectionList as _, useRuntime as _t, resolutionText as a, runTimeline as at, useDynamicLookup as b, Button as bt, useResolution as c, toneOf as ct, useBlockForm as d, useOAuthAttempt as dt, formatMs as et, useBlockFormLoader as f, useOAuthRedirectUri as ft, useCachedBlockForm as g, useRunsQuery as gt, useBlockResolutions as h, useRunQuery as ht, VersionSummary as i, runStatusLabel as it, isPropVisible as j, invalidClass as jt, blockMissing as k, Toggle as kt, versionBadge as l, workflowHealth as lt, useBlockPorts as m, useRunPagesQuery as mt, BlockSelector as n, formatWhen as nt, runsDifferentVersion as o, runTone as ot, useBlockForms as p, usePieceCatalog as pt, RUN_TONE as q, BlockResolutionsProvider as r, runStats as rt, updateVersion as s, statusLabel as st, BlockLogo as t, formatTrigger as tt, DesignTimeProvider as u, WorkflowRuntimeProvider as ut, useDesignTime as v, useRuntimeActions as vt, useResolvedProp as w, IconButton as wt, useDynamicPrefetch as x, FieldError as xt, useDynamicCache as y, useSecretStat as yt, workflowReadiness as z };
3369
+ export { useOptionSearch as $, formatTrigger as A, Button as At, DesignTimeProvider as B, Tooltip as Bt, TONE_DOT as C, useRuntime as Ct, formatAbsolute as D, ITEM_PARAM as Dt, durationMs as E, useWaitingRunsQuery as Et, runTimeline as F, Segmented as Ft, useBlockResolutions as G, isIconName as Gt, useBlockFormLoader as H, textAreaClass as Ht, runTone as I, Select as It, useDesignTime as J, errorMessage as Jt, useCachedBlockForm as K, DocumentErrorBoundary as Kt, statusLabel as L, Switch as Lt, formatWhen as M, FieldLabel as Mt, runStats as N, Hint as Nt, formatDuration as O, useSearchParam as Ot, runStatusLabel as P, IconButton as Pt, useLatestRun as Q, toneOf as R, Tabs$1 as Rt, STEP_TONE as S, useRunsQuery as St, canRerun as T, useSecretStat as Tt, useBlockForms as U, textInputClass as Ut, useBlockForm as V, invalidClass as Vt, useBlockPorts as W, Icon as Wt, useDynamicLookup as X, useDynamicCache as Y, useDynamicPrefetch as Z, useBlockMeta as _, useOAuthAttempt as _t, BlockResolutionsProvider as a, blockMissing as at, RUN_STATUSES as b, useRunPagesQuery as bt, runsDifferentVersion as c, parsePropList as ct, versionBadge as d, storedSchema as dt, useResolvedProp as et, blockMeta as f, stripOptions as ft, stepSubtitle as g, WorkflowRuntimeProvider as gt, pieceLogo as h, workflowReadiness as ht, PickerPopover as i, useWebhookEndpoint as it, formatUntil as j, FieldError as jt, formatMs as k, useSearchParamDraft as kt, updateVersion as l, resolverInputFor as lt, pieceDisplayName as m, withSetting as mt, BlockSelector as n, useTestStepRunner as nt, VersionSummary as o, isEmptyValue as ot, namedByCoreTab as p, undeclaredPortIssues as pt, useConnectionList as q, DocumentLoadError as qt, PICKER_SIZE as r, useTestTrigger as rt, resolutionText as s, isPropVisible as st, BlockLogo as t, useRunById as tt, useResolution as u, settingFor as ut, usePieceLogos as v, useOAuthRedirectUri as vt, TONE_TEXT as w, useRuntimeActions as wt, RUN_TONE as x, useRunQuery as xt, CONNECTION_TONE as y, usePieceCatalog as yt, workflowHealth as z, Toggle as zt };
3056
3370
 
3057
- //# sourceMappingURL=BlockSelector-C3XYZfPY.mjs.map
3371
+ //# sourceMappingURL=BlockSelector-CEdYUqjx.js.map