@protobase/ui 0.119.5 → 0.119.6

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 (299) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/activity-chart/messages.d.ts +2 -2
  3. package/dist/app/change-confirm/messages.d.ts +2 -2
  4. package/dist/app/charts/messages.d.ts +2 -2
  5. package/dist/app/confirm-sign-in-messages.d.ts +2 -2
  6. package/dist/app/conversation/message-composer.d.ts +11 -2
  7. package/dist/app/conversation/message-composer.js +10 -5
  8. package/dist/app/conversation/messages.d.ts +2 -2
  9. package/dist/app/conversation/thread-items.d.ts +2 -0
  10. package/dist/app/conversation/thread-items.js +2 -1
  11. package/dist/app/conversation-page/conversation-header.d.ts +15 -0
  12. package/dist/app/conversation-page/conversation-header.js +47 -0
  13. package/dist/app/conversation-page/conversation-message.d.ts +19 -0
  14. package/dist/app/conversation-page/conversation-message.js +35 -0
  15. package/dist/app/conversation-page/conversation-messages.d.ts +22 -0
  16. package/dist/app/conversation-page/conversation-messages.js +85 -0
  17. package/dist/app/conversation-page/conversation-page.d.ts +14 -0
  18. package/dist/app/conversation-page/conversation-page.js +69 -0
  19. package/dist/app/conversation-page/conversation-reads.d.ts +19 -0
  20. package/dist/app/conversation-page/conversation-reads.js +23 -0
  21. package/dist/app/conversation-page/conversation-rows.d.ts +43 -0
  22. package/dist/app/conversation-page/conversation-rows.js +53 -0
  23. package/dist/app/conversation-page/member-search.d.ts +11 -0
  24. package/dist/app/conversation-page/member-search.js +16 -0
  25. package/dist/app/conversation-page/members-title.d.ts +11 -0
  26. package/dist/app/conversation-page/members-title.js +34 -0
  27. package/dist/app/conversation-page/messages.d.ts +7 -0
  28. package/dist/app/conversation-page/messages.js +5 -0
  29. package/dist/app/conversation-page/use-new-line.d.ts +8 -0
  30. package/dist/app/conversation-page/use-new-line.js +18 -0
  31. package/dist/app/conversation-page/use-read-position.d.ts +26 -0
  32. package/dist/app/conversation-page/use-read-position.js +96 -0
  33. package/dist/app/create/messages.d.ts +2 -2
  34. package/dist/app/custom-section.d.ts +1 -1
  35. package/dist/app/delete/messages.d.ts +2 -2
  36. package/dist/app/displays/list-cards.d.ts +1 -1
  37. package/dist/app/displays/messages.d.ts +2 -2
  38. package/dist/app/embedded-list/messages.d.ts +2 -2
  39. package/dist/app/export/messages.d.ts +2 -2
  40. package/dist/app/field-messages.d.ts +2 -2
  41. package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
  42. package/dist/app/field-types/json/messages.d.ts +2 -2
  43. package/dist/app/field-types/runner-install/messages.d.ts +2 -2
  44. package/dist/app/field-types/widget-part.d.ts +1 -1
  45. package/dist/app/field-types/workflow/definition.d.ts +1 -1
  46. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  47. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  48. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  49. package/dist/app/file-viewers/messages.d.ts +2 -2
  50. package/dist/app/focus/messages.d.ts +2 -2
  51. package/dist/app/focus/record-focus-page.d.ts +3 -1
  52. package/dist/app/full-area-record.d.ts +8 -1
  53. package/dist/app/full-area-record.js +5 -1
  54. package/dist/app/gallery/messages.d.ts +2 -2
  55. package/dist/app/hand-order/messages.d.ts +2 -2
  56. package/dist/app/import/messages.d.ts +2 -2
  57. package/dist/app/list-edit/messages.d.ts +2 -2
  58. package/dist/app/list-messages.d.ts +2 -2
  59. package/dist/app/messages.d.ts +2 -2
  60. package/dist/app/meta-gate-messages.d.ts +2 -2
  61. package/dist/app/new-version/messages.d.ts +2 -2
  62. package/dist/app/pages/custom-boundary.d.ts +1 -1
  63. package/dist/app/pages/custom-chosen.d.ts +1 -1
  64. package/dist/app/pages/messages.d.ts +2 -2
  65. package/dist/app/pages/use-layout-data.d.ts +1 -1
  66. package/dist/app/record-chart/messages.d.ts +2 -2
  67. package/dist/app/record-messages.d.ts +2 -2
  68. package/dist/app/record-page.js +12 -1
  69. package/dist/app/record-row/messages.d.ts +2 -2
  70. package/dist/app/related-cards/messages.d.ts +2 -2
  71. package/dist/app/runtime/messages.d.ts +2 -2
  72. package/dist/app/saved/messages.d.ts +2 -2
  73. package/dist/app/saved/saved-list.d.ts +1 -1
  74. package/dist/app/searches/messages.d.ts +2 -2
  75. package/dist/app/titles/member-names.d.ts +10 -0
  76. package/dist/app/titles/member-names.js +14 -0
  77. package/dist/app/titles/record-title-of.d.ts +2 -1
  78. package/dist/app/titles/record-title-of.js +5 -2
  79. package/dist/app-shell/messages.d.ts +2 -2
  80. package/dist/assistant-dock/messages.d.ts +2 -2
  81. package/dist/auth/messages.d.ts +2 -2
  82. package/dist/calls/messages.d.ts +2 -2
  83. package/dist/chat/messages.d.ts +2 -2
  84. package/dist/data-grid/column-spec.d.ts +1 -1
  85. package/dist/data-grid/messages.d.ts +2 -2
  86. package/dist/filter-panel/messages.d.ts +2 -2
  87. package/dist/format/messages.d.ts +2 -2
  88. package/dist/forms/messages.d.ts +2 -2
  89. package/dist/index.d.ts +2 -2
  90. package/dist/invitations/messages.d.ts +2 -2
  91. package/dist/live/messages.d.ts +2 -2
  92. package/dist/locale/en.js +5 -1
  93. package/dist/locale/en.json.d.ts +4 -0
  94. package/dist/locale/messages.d.ts +8 -0
  95. package/dist/locale/nl.js +5 -1
  96. package/dist/locale/texts-gate.d.ts +1 -1
  97. package/dist/mailbox/messages.d.ts +2 -2
  98. package/dist/mocks/customers.d.ts +1 -1
  99. package/dist/mocks/invoices.d.ts +2 -2
  100. package/dist/mocks/orders.d.ts +2 -2
  101. package/dist/mocks/stockMoves.d.ts +1 -1
  102. package/dist/notifications/bell/messages.d.ts +2 -2
  103. package/dist/organizations/messages.d.ts +2 -2
  104. package/dist/package.js +1 -1
  105. package/dist/plugins/before-sign-in.d.ts +1 -1
  106. package/dist/primitives/messages.d.ts +2 -2
  107. package/dist/shell/assets/{account-page-ve4BUXRh.js → account-page-BNtfocSb.js} +2 -2
  108. package/dist/shell/assets/app-Cfc4Mr5v.js +34 -0
  109. package/dist/shell/assets/{assistant-shell-KyMQvcsn.js → assistant-shell-BPyCi5kW.js} +2 -2
  110. package/dist/shell/assets/board-display-B41TuoWo.js +2 -0
  111. package/dist/shell/assets/calendar-display-63b_rkuL.js +2 -0
  112. package/dist/shell/assets/{call-rings-DUzC7UYz.js → call-rings-DBe0CIEa.js} +2 -2
  113. package/dist/shell/assets/{calls-drZLv0wW.js → calls-DwpgAZRF.js} +2 -2
  114. package/dist/shell/assets/{circle-alert-COV0WNyG.js → circle-alert-C9z9GbbN.js} +2 -2
  115. package/dist/shell/assets/{composed-page-CBJLOXNJ.js → composed-page-UB2y5c99.js} +2 -2
  116. package/dist/shell/assets/{composer-section-05sGMnpR.js → composer-section-CMoh0kSd.js} +2 -2
  117. package/dist/shell/assets/{connect-route-KBsPFlW4.js → connect-route-DRcj6Ruu.js} +2 -2
  118. package/dist/shell/assets/{copy-field-14Vmg95D.js → copy-field-MTVXamwX.js} +2 -2
  119. package/dist/shell/assets/create-route-CEfuAg9p.js +2 -0
  120. package/dist/shell/assets/{custom-step-container-field-D0cmhURR.js → custom-step-container-field-19o4BVGX.js} +4 -4
  121. package/dist/shell/assets/embedded-list-CWzU8ruS.js +3 -0
  122. package/dist/shell/assets/en-BLkfn3BD.js +2 -0
  123. package/dist/shell/assets/{export-dialog-Cz26bxgN.js → export-dialog-DHbFHvEa.js} +2 -2
  124. package/dist/shell/assets/export-worker-D0h27FKA.js +15 -0
  125. package/dist/shell/assets/{first-organization-page-C9ejBI4S.js → first-organization-page-Uc0es2bM.js} +2 -2
  126. package/dist/shell/assets/{graph-view-B3TE-xbG.js → graph-view-C_kd2p_w.js} +2 -2
  127. package/dist/shell/assets/{group-donut-BAyTgqYv.js → group-donut-w_BFP4Nu.js} +2 -2
  128. package/dist/shell/assets/{guest-call-page-CEcPrLXS.js → guest-call-page-D3gaOqIw.js} +3 -3
  129. package/dist/shell/assets/{html-viewer-DaeVR6PB.js → html-viewer-BrCIs_XH.js} +2 -2
  130. package/dist/shell/assets/{import-dialog-6I25EI49.js → import-dialog-DCcZNJgD.js} +2 -2
  131. package/dist/shell/assets/import-table-dialog-CWL7kUhP.js +2 -0
  132. package/dist/shell/assets/{index-CLyiQa16.js → index-CI4ggWZ9.js} +1 -1
  133. package/dist/shell/assets/invitations-page-CX-S9_g6.js +2 -0
  134. package/dist/shell/assets/{layout-grid-BTGS8Vdw.js → layout-grid-DK79NnII.js} +2 -2
  135. package/dist/shell/assets/{legend-item-DkIaBiD0.js → legend-item-IhWkwVRv.js} +2 -2
  136. package/dist/shell/assets/list-page-BJ7BwcjM.js +4 -0
  137. package/dist/shell/assets/{maplibre-JTZsxvhv.js → maplibre-XgWOYlHw.js} +2 -2
  138. package/dist/shell/assets/{markdown-content-DBVa63k_.js → markdown-content-oKb66g72.js} +2 -2
  139. package/dist/shell/assets/members-page-CB947V03.js +2 -0
  140. package/dist/shell/assets/{message-content-DzyGCvgQ.js → message-content-Cae9o0KB.js} +3 -3
  141. package/dist/shell/assets/messages-KWWs-PYa.js +2 -0
  142. package/dist/shell/assets/nl-Ozd1Th1I.js +2 -0
  143. package/dist/shell/assets/organization-page-Daa29-ya.js +2 -0
  144. package/dist/shell/assets/organizations-page-DFla8W4s.js +2 -0
  145. package/dist/shell/assets/parse-worker-BzKm_KiA.js +35 -0
  146. package/dist/shell/assets/{pending-invitation-row-DvqK-Lh5.js → pending-invitation-row-ufQDhiqy.js} +2 -2
  147. package/dist/shell/assets/{period-chart-Cn9bgVfB.js → period-chart-CDAaiRKi.js} +2 -2
  148. package/dist/shell/assets/{person-row-CSBZnBQc.js → person-row-DKpGU4lp.js} +2 -2
  149. package/dist/shell/assets/public-form-page-CWI8qeDR.js +2 -0
  150. package/dist/shell/assets/{record-lines-3DhkRSpH.js → record-lines-Dr5kvt8p.js} +2 -2
  151. package/dist/shell/assets/{record-map-D4rgUOwb.js → record-map-JMNMJGUZ.js} +2 -2
  152. package/dist/shell/assets/{record-opens-BSFQWqio.js → record-opens-iz29YMzQ.js} +2 -2
  153. package/dist/shell/assets/record-page-Db_9ytem.js +3 -0
  154. package/dist/shell/assets/{record-preview-Bdzkrw0H.js → record-preview-BCYfgSHu.js} +2 -2
  155. package/dist/shell/assets/{records-map-BfkBfva4.js → records-map-iNOkFYn9.js} +2 -2
  156. package/dist/shell/assets/render-node-D5xobkr6.js +3 -0
  157. package/dist/shell/assets/reorder-button-05HCaCaE.js +2 -0
  158. package/dist/shell/assets/{run-trace-view-Cd3DppYM.js → run-trace-view-BSrF6_Kg.js} +2 -2
  159. package/dist/shell/assets/{runner-install-field-CK3olYt5.js → runner-install-field-CgXWqOkx.js} +2 -2
  160. package/dist/shell/assets/{runtime-update-BNTp15Vo.js → runtime-update-BrM_FHvq.js} +2 -2
  161. package/dist/shell/assets/shared-protobase-ui-CtGq44Ix.js +1 -0
  162. package/dist/shell/assets/{sheet-source-DONoSDqu.js → sheet-source-BdUpw5K0.js} +3 -3
  163. package/dist/shell/assets/sign-in-policy-page-CavUG1RD.js +2 -0
  164. package/dist/shell/assets/start-block-queries-DrZpbWHB.js +2 -0
  165. package/dist/shell/assets/step-catalog-C49x4u-Y.js +2 -0
  166. package/dist/shell/assets/{step-panel-CoFQOZfZ.js → step-panel-CyZhEKcD.js} +2 -2
  167. package/dist/shell/assets/timeline-display-Bzg1mU4E.js +2 -0
  168. package/dist/shell/assets/{trash-BFH8OA7M.js → trash-CqUcV16Q.js} +2 -2
  169. package/dist/shell/assets/{update-set-CivHicWr.js → update-set-Da02tZfu.js} +2 -2
  170. package/dist/shell/assets/use-calendar-move-D93tEWOf.js +2 -0
  171. package/dist/shell/assets/{use-display-rows-7iLrRpz6.js → use-display-rows-BPgcYLdT.js} +2 -2
  172. package/dist/shell/assets/use-my-invitations-CPQ3DMUh.js +2 -0
  173. package/dist/shell/assets/{use-paged-search-CblCRsCd.js → use-paged-search-w0puq1Yl.js} +2 -2
  174. package/dist/shell/assets/{use-run-trace-vMzYYuXG.js → use-run-trace-BEM0bOMt.js} +2 -2
  175. package/dist/shell/assets/{use-workflow-page-Dac4wyOA.js → use-workflow-page-DpBacPYs.js} +2 -2
  176. package/dist/shell/assets/{use-workflow-types-Bi8u42jQ.js → use-workflow-types-Bc6SdoP6.js} +2 -2
  177. package/dist/shell/assets/{workflow-canvas-2owtFZNz.js → workflow-canvas-DpONgLJR.js} +4 -4
  178. package/dist/shell/assets/{workflow-field-Ct0HoH5Z.js → workflow-field-4i7H_hCR.js} +3 -3
  179. package/dist/shell/assets/{workflow-graph-editor-oAKVQAgf.js → workflow-graph-editor-BP_eCoyB.js} +2 -2
  180. package/dist/shell/assets/{workflow-run-field-C7ff1D9_.js → workflow-run-field-e0JGWLQd.js} +3 -3
  181. package/dist/shell/assets/workflow-status-field-RevEnRLG.js +2 -0
  182. package/dist/shell/assets/workflow-workbench-DY0czZaG.js +4 -0
  183. package/dist/shell/index.html +3 -3
  184. package/dist/shell/protobase.shell.json +2 -2
  185. package/dist/shell/protobase.sw.js +2 -2
  186. package/dist/shell-source-maps/assets/{account-page-ve4BUXRh.js.map → account-page-BNtfocSb.js.map} +1 -1
  187. package/dist/shell-source-maps/assets/app-Cfc4Mr5v.js.map +1 -0
  188. package/dist/shell-source-maps/assets/{assistant-shell-KyMQvcsn.js.map → assistant-shell-BPyCi5kW.js.map} +1 -1
  189. package/dist/shell-source-maps/assets/{board-display-BaMLmYUJ.js.map → board-display-B41TuoWo.js.map} +1 -1
  190. package/dist/shell-source-maps/assets/{calendar-display-CzQPcItV.js.map → calendar-display-63b_rkuL.js.map} +1 -1
  191. package/dist/shell-source-maps/assets/{call-rings-DUzC7UYz.js.map → call-rings-DBe0CIEa.js.map} +1 -1
  192. package/dist/shell-source-maps/assets/{calls-drZLv0wW.js.map → calls-DwpgAZRF.js.map} +1 -1
  193. package/dist/shell-source-maps/assets/{circle-alert-COV0WNyG.js.map → circle-alert-C9z9GbbN.js.map} +1 -1
  194. package/dist/shell-source-maps/assets/{composed-page-CBJLOXNJ.js.map → composed-page-UB2y5c99.js.map} +1 -1
  195. package/dist/shell-source-maps/assets/{composer-section-05sGMnpR.js.map → composer-section-CMoh0kSd.js.map} +1 -1
  196. package/dist/shell-source-maps/assets/{connect-route-KBsPFlW4.js.map → connect-route-DRcj6Ruu.js.map} +1 -1
  197. package/dist/shell-source-maps/assets/{copy-field-14Vmg95D.js.map → copy-field-MTVXamwX.js.map} +1 -1
  198. package/dist/shell-source-maps/assets/{create-route-DAprAV2h.js.map → create-route-CEfuAg9p.js.map} +1 -1
  199. package/dist/shell-source-maps/assets/{custom-step-container-field-D0cmhURR.js.map → custom-step-container-field-19o4BVGX.js.map} +1 -1
  200. package/dist/shell-source-maps/assets/{embedded-list-Ra3OLUh6.js.map → embedded-list-CWzU8ruS.js.map} +1 -1
  201. package/dist/shell-source-maps/assets/en-BLkfn3BD.js.map +1 -0
  202. package/dist/shell-source-maps/assets/{export-dialog-Cz26bxgN.js.map → export-dialog-DHbFHvEa.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/export-worker-D0h27FKA.js.map +1 -0
  204. package/dist/shell-source-maps/assets/{first-organization-page-C9ejBI4S.js.map → first-organization-page-Uc0es2bM.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/{graph-view-B3TE-xbG.js.map → graph-view-C_kd2p_w.js.map} +1 -1
  206. package/dist/shell-source-maps/assets/{group-donut-BAyTgqYv.js.map → group-donut-w_BFP4Nu.js.map} +1 -1
  207. package/dist/shell-source-maps/assets/{guest-call-page-CEcPrLXS.js.map → guest-call-page-D3gaOqIw.js.map} +1 -1
  208. package/dist/shell-source-maps/assets/{html-viewer-DaeVR6PB.js.map → html-viewer-BrCIs_XH.js.map} +1 -1
  209. package/dist/shell-source-maps/assets/{import-dialog-6I25EI49.js.map → import-dialog-DCcZNJgD.js.map} +1 -1
  210. package/dist/shell-source-maps/assets/{import-table-dialog-COsPNket.js.map → import-table-dialog-CWL7kUhP.js.map} +1 -1
  211. package/dist/shell-source-maps/assets/{invitations-page-TBz_-ekD.js.map → invitations-page-CX-S9_g6.js.map} +1 -1
  212. package/dist/shell-source-maps/assets/{layout-grid-BTGS8Vdw.js.map → layout-grid-DK79NnII.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/{legend-item-DkIaBiD0.js.map → legend-item-IhWkwVRv.js.map} +1 -1
  214. package/dist/shell-source-maps/assets/{list-page-Dpq9M7YO.js.map → list-page-BJ7BwcjM.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/{maplibre-JTZsxvhv.js.map → maplibre-XgWOYlHw.js.map} +1 -1
  216. package/dist/shell-source-maps/assets/{markdown-content-DBVa63k_.js.map → markdown-content-oKb66g72.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{members-page-CHRY9H9W.js.map → members-page-CB947V03.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{message-content-DzyGCvgQ.js.map → message-content-Cae9o0KB.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/{messages-BwcGcxFR.js.map → messages-KWWs-PYa.js.map} +1 -1
  220. package/dist/shell-source-maps/assets/nl-Ozd1Th1I.js.map +1 -0
  221. package/dist/shell-source-maps/assets/{organization-page-BE182e_K.js.map → organization-page-Daa29-ya.js.map} +1 -1
  222. package/dist/shell-source-maps/assets/{organizations-page-DaN6zQZj.js.map → organizations-page-DFla8W4s.js.map} +1 -1
  223. package/dist/shell-source-maps/assets/parse-worker-BzKm_KiA.js.map +1 -0
  224. package/dist/shell-source-maps/assets/{pending-invitation-row-DvqK-Lh5.js.map → pending-invitation-row-ufQDhiqy.js.map} +1 -1
  225. package/dist/shell-source-maps/assets/{period-chart-Cn9bgVfB.js.map → period-chart-CDAaiRKi.js.map} +1 -1
  226. package/dist/shell-source-maps/assets/{person-row-CSBZnBQc.js.map → person-row-DKpGU4lp.js.map} +1 -1
  227. package/dist/shell-source-maps/assets/{public-form-page-CaNVr6BS.js.map → public-form-page-CWI8qeDR.js.map} +1 -1
  228. package/dist/shell-source-maps/assets/{record-lines-3DhkRSpH.js.map → record-lines-Dr5kvt8p.js.map} +1 -1
  229. package/dist/shell-source-maps/assets/{record-map-D4rgUOwb.js.map → record-map-JMNMJGUZ.js.map} +1 -1
  230. package/dist/shell-source-maps/assets/{record-opens-BSFQWqio.js.map → record-opens-iz29YMzQ.js.map} +1 -1
  231. package/dist/shell-source-maps/assets/record-page-Db_9ytem.js.map +1 -0
  232. package/dist/shell-source-maps/assets/{record-preview-Bdzkrw0H.js.map → record-preview-BCYfgSHu.js.map} +1 -1
  233. package/dist/shell-source-maps/assets/{records-map-BfkBfva4.js.map → records-map-iNOkFYn9.js.map} +1 -1
  234. package/dist/shell-source-maps/assets/render-node-D5xobkr6.js.map +1 -0
  235. package/dist/shell-source-maps/assets/{reorder-button-pGaEX5DI.js.map → reorder-button-05HCaCaE.js.map} +1 -1
  236. package/dist/shell-source-maps/assets/{run-trace-view-Cd3DppYM.js.map → run-trace-view-BSrF6_Kg.js.map} +1 -1
  237. package/dist/shell-source-maps/assets/{runner-install-field-CK3olYt5.js.map → runner-install-field-CgXWqOkx.js.map} +1 -1
  238. package/dist/shell-source-maps/assets/{runtime-update-BNTp15Vo.js.map → runtime-update-BrM_FHvq.js.map} +1 -1
  239. package/dist/shell-source-maps/assets/{sheet-source-DONoSDqu.js.map → sheet-source-BdUpw5K0.js.map} +1 -1
  240. package/dist/shell-source-maps/assets/{sign-in-policy-page-C4MEEpwM.js.map → sign-in-policy-page-CavUG1RD.js.map} +1 -1
  241. package/dist/shell-source-maps/assets/{start-block-queries-B7qJvkWD.js.map → start-block-queries-DrZpbWHB.js.map} +1 -1
  242. package/dist/shell-source-maps/assets/{step-catalog-CgPcuEu_.js.map → step-catalog-C49x4u-Y.js.map} +1 -1
  243. package/dist/shell-source-maps/assets/{step-panel-CoFQOZfZ.js.map → step-panel-CyZhEKcD.js.map} +1 -1
  244. package/dist/shell-source-maps/assets/{timeline-display-F8qMrey9.js.map → timeline-display-Bzg1mU4E.js.map} +1 -1
  245. package/dist/shell-source-maps/assets/{trash-BFH8OA7M.js.map → trash-CqUcV16Q.js.map} +1 -1
  246. package/dist/shell-source-maps/assets/{update-set-CivHicWr.js.map → update-set-Da02tZfu.js.map} +1 -1
  247. package/dist/shell-source-maps/assets/{use-calendar-move-CezBW0KE.js.map → use-calendar-move-D93tEWOf.js.map} +1 -1
  248. package/dist/shell-source-maps/assets/{use-display-rows-7iLrRpz6.js.map → use-display-rows-BPgcYLdT.js.map} +1 -1
  249. package/dist/shell-source-maps/assets/{use-my-invitations-B7w0Q5kk.js.map → use-my-invitations-CPQ3DMUh.js.map} +1 -1
  250. package/dist/shell-source-maps/assets/{use-paged-search-CblCRsCd.js.map → use-paged-search-w0puq1Yl.js.map} +1 -1
  251. package/dist/shell-source-maps/assets/{use-run-trace-vMzYYuXG.js.map → use-run-trace-BEM0bOMt.js.map} +1 -1
  252. package/dist/shell-source-maps/assets/{use-workflow-page-Dac4wyOA.js.map → use-workflow-page-DpBacPYs.js.map} +1 -1
  253. package/dist/shell-source-maps/assets/{use-workflow-types-Bi8u42jQ.js.map → use-workflow-types-Bc6SdoP6.js.map} +1 -1
  254. package/dist/shell-source-maps/assets/{workflow-canvas-2owtFZNz.js.map → workflow-canvas-DpONgLJR.js.map} +1 -1
  255. package/dist/shell-source-maps/assets/{workflow-field-Ct0HoH5Z.js.map → workflow-field-4i7H_hCR.js.map} +1 -1
  256. package/dist/shell-source-maps/assets/{workflow-graph-editor-oAKVQAgf.js.map → workflow-graph-editor-BP_eCoyB.js.map} +1 -1
  257. package/dist/shell-source-maps/assets/{workflow-run-field-C7ff1D9_.js.map → workflow-run-field-e0JGWLQd.js.map} +1 -1
  258. package/dist/shell-source-maps/assets/workflow-status-field-RevEnRLG.js.map +1 -0
  259. package/dist/shell-source-maps/assets/{workflow-workbench-BCsEjQVw.js.map → workflow-workbench-DY0czZaG.js.map} +1 -1
  260. package/dist/status/messages.d.ts +2 -2
  261. package/dist/users/messages.d.ts +2 -2
  262. package/package.json +5 -5
  263. package/dist/shell/assets/app-DU-Bny4k.js +0 -34
  264. package/dist/shell/assets/board-display-BaMLmYUJ.js +0 -2
  265. package/dist/shell/assets/calendar-display-CzQPcItV.js +0 -2
  266. package/dist/shell/assets/create-route-DAprAV2h.js +0 -2
  267. package/dist/shell/assets/embedded-list-Ra3OLUh6.js +0 -3
  268. package/dist/shell/assets/en-dURxhEht.js +0 -2
  269. package/dist/shell/assets/export-worker-DfIG4xQy.js +0 -15
  270. package/dist/shell/assets/import-table-dialog-COsPNket.js +0 -2
  271. package/dist/shell/assets/invitations-page-TBz_-ekD.js +0 -2
  272. package/dist/shell/assets/list-page-Dpq9M7YO.js +0 -4
  273. package/dist/shell/assets/members-page-CHRY9H9W.js +0 -2
  274. package/dist/shell/assets/messages-BwcGcxFR.js +0 -2
  275. package/dist/shell/assets/nl-B0dpIbbz.js +0 -2
  276. package/dist/shell/assets/organization-page-BE182e_K.js +0 -2
  277. package/dist/shell/assets/organizations-page-DaN6zQZj.js +0 -2
  278. package/dist/shell/assets/parse-worker-VaelBbE0.js +0 -35
  279. package/dist/shell/assets/public-form-page-CaNVr6BS.js +0 -2
  280. package/dist/shell/assets/record-page-Cbx9gqMY.js +0 -3
  281. package/dist/shell/assets/render-node-ChsAMZVA.js +0 -3
  282. package/dist/shell/assets/reorder-button-pGaEX5DI.js +0 -2
  283. package/dist/shell/assets/shared-protobase-ui-gnK6D3Al.js +0 -1
  284. package/dist/shell/assets/sign-in-policy-page-C4MEEpwM.js +0 -2
  285. package/dist/shell/assets/start-block-queries-B7qJvkWD.js +0 -2
  286. package/dist/shell/assets/step-catalog-CgPcuEu_.js +0 -2
  287. package/dist/shell/assets/timeline-display-F8qMrey9.js +0 -2
  288. package/dist/shell/assets/use-calendar-move-CezBW0KE.js +0 -2
  289. package/dist/shell/assets/use-my-invitations-B7w0Q5kk.js +0 -2
  290. package/dist/shell/assets/workflow-status-field-iHUr4FZM.js +0 -2
  291. package/dist/shell/assets/workflow-workbench-BCsEjQVw.js +0 -4
  292. package/dist/shell-source-maps/assets/app-DU-Bny4k.js.map +0 -1
  293. package/dist/shell-source-maps/assets/en-dURxhEht.js.map +0 -1
  294. package/dist/shell-source-maps/assets/export-worker-DfIG4xQy.js.map +0 -1
  295. package/dist/shell-source-maps/assets/nl-B0dpIbbz.js.map +0 -1
  296. package/dist/shell-source-maps/assets/parse-worker-VaelBbE0.js.map +0 -1
  297. package/dist/shell-source-maps/assets/record-page-Cbx9gqMY.js.map +0 -1
  298. package/dist/shell-source-maps/assets/render-node-ChsAMZVA.js.map +0 -1
  299. package/dist/shell-source-maps/assets/workflow-status-field-iHUr4FZM.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$c as r,Ao as i,Bn as a,Hc as o,M as s,Nc as c,Pc as l,R as u,Sc as d,Tc as f,V as p,Wc as m,bc as h,cc as ee,dl as g,gc as te,uc as _,us as ne,wc as re}from"./app-Cfc4Mr5v.js";import{t as ie}from"./circle-alert-C9z9GbbN.js";import{a as ae,c as oe,d as se,f as ce,g as le,h as ue,i as de,m as fe,o as pe,p as me,r as he,s as ge,u as _e}from"./workflow-canvas-DpONgLJR.js";import{t as ve}from"./trash-CqUcV16Q.js";import{A as ye,D as be,F as xe,M as v,_ as Se,a as Ce,c as y,f as we,g as Te,h as b,i as Ee,k as De,m as Oe,n as ke,o as x,s as S,u as C,x as Ae}from"./workflows-Bey4jszG.js";import{E as w,S as je,T,_ as Me,s as E,x as D}from"./use-run-trace-BEM0bOMt.js";import{n as O}from"./use-workflow-types-Bc6SdoP6.js";var Ne={type:`object`,title:`File`,properties:{uri:{type:`string`},name:{type:`string`},type:{type:`string`},size:{type:`integer`}}},Pe=(e,t)=>e.relation&&t?.(e.relation.resource)===`integer`?{type:`integer`}:{type:`string`},Fe=(e,t,n)=>{if(e.file)return t===`read`?Ne:{type:`string`};switch(e.type){case`integer`:return{type:`integer`};case`boolean`:return{type:`boolean`};case`json`:return{};case`enum`:return{type:`string`,...e.enumValues&&{enum:e.enumValues}};case`relation`:return t===`read`?Pe(e,n):{type:[`string`,`integer`]};case`bigint`:return t===`read`?{type:`string`}:{type:[`string`,`integer`]};case`decimal`:return t===`read`?{type:`string`}:{type:[`string`,`number`]};default:return{type:`string`}}},Ie=(e,t,n)=>{let r=Fe(e,t,n);if(t===`read`||!e.nullable||r.type===void 0)return r;let i=Array.isArray(r.type)?r.type:[r.type];return{...r,type:[...i,`null`],...Array.isArray(r.enum)&&{enum:[...r.enum,null]}}},Le=(e,t,n=e.name,r)=>({type:`object`,title:n,properties:Object.fromEntries(Object.values(e.fields).filter(e=>t===`read`||!e.readOnly).map(e=>[e.name,Ie(e,t,r)]))}),Re=e=>t=>{let n=e(t);return n?.primaryKey.length===1?n.fields[n.primaryKey[0]]?.type:void 0},ze={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};ze.node;var k=m(ze),Be={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Be.node;var Ve=m(Be),He={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};He.node;var Ue=m(He),We={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};We.node;var Ge=m(We),Ke={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};Ke.node;var qe=m(Ke),Je={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};Je.node;var Ye=m(Je),Xe={name:`timer`,size:24,node:[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]};Xe.node;var Ze=m(Xe),A=(e,t)=>{let n=structuredClone(e);return t(n),n},j=new Set([`Task`,`Pass`,`Wait`,`Map`,`Block`]),M=(e,t)=>{if(!j.has(e.Type))return;let n=e;delete n.End,n.Next=t},N=(e,t)=>{let n=D(e,t);if(!n)throw Error(`No Map or Block at ${t.join(`/`)}`);return n},Qe=(e,t)=>{let n=new Set(Me(e.stateMachine)),r=1;for(;n.has(`${t} ${r}`);)r++;return`${t} ${r}`},$e=e=>`task`in e?{Type:`Task`,Resource:e.task,Arguments:{},End:!0}:e.type===`Choice`?{Type:`Choice`,Choices:[]}:e.type===`Wait`?{Type:`Wait`,Seconds:60,End:!0}:e.type===`Succeed`?{Type:`Succeed`}:e.type===`Fail`?{Type:`Fail`}:e.type===`Pass`?{Type:`Pass`,End:!0}:e.type===`Block`?{Type:`Block`,Processor:{StartAt:``,States:{}},Cache:{Ttl:`1 hour`},End:!0}:{Type:`Map`,Items:`{% [] %}`,ItemProcessor:{StartAt:``,States:{}},End:!0},P=(e,t,n,r,i)=>A(e,e=>{let a=N(e,t),o=b(e)===`data`,s=$e(n);if(o&&delete s.End,a.States[r]=s,!o&&(a.StartAt===void 0||!Object.hasOwn(a.States,a.StartAt))&&(a.StartAt=r),s.Type!==`Map`&&s.Type!==`Block`)return;let c=Qe(e,i),l=o?{States:{[c]:{Type:`Pass`}}}:{StartAt:c,States:{[c]:{Type:`Pass`,End:!0}}};s.Type===`Map`?s.ItemProcessor=l:s.Processor=l}),et=e=>e.Type===`Choice`||j.has(e.Type),tt=(e,t,n)=>{let r=e.States[t],i=e.States[n];if(!r||!j.has(r.Type))return;let a=r.Next;(a===void 0||et(i))&&(M(r,n),a!==void 0&&(i.Type===`Choice`?i.Default=a:j.has(i.Type)&&M(i,a)))},nt=(e,t,n)=>{let r=N(e,t);if(n!==void 0&&n!==t.join(`/`)){let{name:e}=T(n);return j.has(r.States[e]?.Type)?e:void 0}return Object.keys(r.States).reverse().find(e=>r.States[e].End===!0)},rt=e=>e.kind===`start`?[]:T(e.source).scope,it=e=>e.ErrorEquals.length===1&&e.ErrorEquals[0]===`States.ALL`,at=(e,t)=>{if(t.kind===`start`)return e.stateMachine.StartAt||void 0;let{scope:n,name:r}=T(t.source),i=D(e,n)?.States[r];if(i){if(t.kind===`next`)return i.Next;if(t.kind==="default")return i.Type===`Choice`?i.Default:void 0;if(t.kind===`catch`)return`Catch`in i?i.Catch?.find(it)?.Next:void 0}},ot=(e,t,n,r,i)=>{if(i.kind===`start`)return ct(e,t,n,r);let{scope:a,name:o}=T(i.source);if(i.kind===`next`)return st(e,a,t,n,r,o);let s=at(e,i);return A(P(e,a,t,n,r),e=>{let t=N(e,a),r=t.States[o],c=t.States[n];if(r&&(s===void 0||et(c))){if(i.kind===`rule`&&r.Type===`Choice`&&(r.Choices=[...r.Choices??[],{Condition:``,Next:n}]),i.kind==="default"&&r.Type===`Choice`&&(r.Default=n),i.kind===`catch`&&(r.Type===`Task`||r.Type===`Map`||r.Type===`Block`)){let e=r.Catch?.find(it);e?e.Next=n:r.Catch=[...r.Catch??[],{ErrorEquals:[`States.ALL`],Next:n}]}s!==void 0&&(c.Type===`Choice`?c.Default=s:j.has(c.Type)&&M(c,s))}})},st=(e,t,n,r,i,a)=>{let o=P(e,t,n,r,i);return a===void 0||b(e)===`data`?o:A(o,e=>tt(N(e,t),a,r))},ct=(e,t,n,r)=>{let i=e.stateMachine.StartAt??``,a=P(e,[],t,n,r);return b(e)===`data`?a:A(a,e=>{let t=e.stateMachine.States[n];(i===``||et(t))&&(e.stateMachine.StartAt=n,i!==``&&j.has(t.Type)&&M(t,i),i!==``&&t.Type===`Choice`&&(t.Default=i))})},lt=(e,t)=>{`Next`in e&&e.Next===t&&(delete e.Next,e.End=!0),e.Type===`Choice`&&(e.Choices=(e.Choices??[]).filter(e=>e.Next!==t),e.Default===t&&delete e.Default),`Catch`in e&&e.Catch&&(e.Catch=e.Catch.filter(e=>e.Next!==t),e.Catch.length===0&&delete e.Catch)},ut=(e,t)=>A(e,e=>{let{scope:n,name:r}=T(t),i=N(e,n);delete i.States[r];for(let e of Object.values(i.States))lt(e,r);i.StartAt===r&&(i.StartAt=Object.keys(i.States)[0]??``)}),dt=(e,t,n,r)=>A(e,e=>{let{scope:i,name:a}=T(r);if(t===`start`){e.stateMachine.StartAt=a;return}let o=T(n);if(o.scope.join(`/`)!==i.join(`/`))throw Error(`A state leads only to states of its own machine`);let s=N(e,i).States[o.name];s&&(t===`next`&&M(s,a),t===`rule`&&s.Type===`Choice`&&(s.Choices=[...s.Choices??[],{Condition:``,Next:a}]),t==="default"&&s.Type===`Choice`&&(s.Default=a),t===`catch`&&(s.Type===`Task`||s.Type===`Map`||s.Type===`Block`)&&(s.Catch=[...s.Catch??[],{ErrorEquals:[`States.ALL`],Next:a}]))}),ft=(e,t)=>A(e,e=>{if(t.kind===`start`)return;let{scope:n,name:r}=T(t.source),i=N(e,n).States[r];if(!i)return;let a=Number(/\[(\d+)\]/.exec(t.field)?.[1]);t.kind===`next`&&`Next`in i&&(delete i.Next,i.End=!0),t.kind===`rule`&&i.Type===`Choice`&&(i.Choices=i.Choices.filter((e,t)=>t!==a)),t.kind==="default"&&i.Type===`Choice`&&delete i.Default,t.kind===`catch`&&`Catch`in i&&i.Catch&&(i.Catch=i.Catch.filter((e,t)=>t!==a),i.Catch.length===0&&delete i.Catch)}),pt=(e,t,n)=>A(e,e=>{let{scope:r,name:i}=T(t);N(e,r).States[i]=n}),mt=(e,t,n)=>{e.States=Object.fromEntries(Object.entries(e.States).map(([e,r])=>[e===t?n:e,r])),e.StartAt===t&&(e.StartAt=n);for(let r of Object.values(e.States)){if(`Next`in r&&r.Next===t&&(r.Next=n),r.Type===`Choice`){for(let e of r.Choices??[])e.Next===t&&(e.Next=n);r.Default===t&&(r.Default=n)}if(`Catch`in r)for(let e of r.Catch??[])e.Next===t&&(e.Next=n)}},ht=e=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)&&![`true`,`false`,`null`].includes(e)?e:`\`${e}\``,gt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),F=(e,t,n)=>{if(typeof e==`string`){if(!e.trimStart().startsWith(`{%`))return e;let r=RegExp(`\\$states\\.context\\.Steps\\.(?:${gt(t)}(?![A-Za-z0-9_])|\`${gt(t)}\`)`,`g`);return e.split(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\/\*[\s\S]*?\*\/)/).map((e,t)=>t%2==1?e:e.replace(r,()=>`$states.context.Steps.${ht(n)}`)).join(``)}return Array.isArray(e)?e.map(e=>F(e,t,n)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,F(r,t,n)])):e},_t=(e,t,n)=>A(e,e=>{let{scope:r,name:i}=T(t);mt(N(e,r),i,n),e.stateMachine=F(e.stateMachine,i,n)}),vt=(e,t)=>A(e,e=>{let{scope:n,name:r}=T(t);N(e,n).StartAt=r}),yt=(e,t)=>A(e,e=>{e.trigger=t}),I=e=>typeof e==`object`&&!!e&&!Array.isArray(e),bt=e=>Array.isArray(e.enum)&&e.enum.every(e=>typeof e==`string`)?{kind:`choice`,options:e.enum}:e.type===`string`?{kind:`text`}:e.type===`number`||e.type===`integer`||e.type===`boolean`?{kind:`value`}:e.type===`array`&&I(e.items)&&e.items.type===`string`?{kind:`names`}:{kind:`json`},L=e=>{let t=I(e.properties)?e.properties:{},n=Array.isArray(e.required)?e.required:[];return Object.entries(t).map(([e,t])=>{let r=I(t)?t:{},i=typeof r.title==`string`?r.title:void 0;return{name:e,...bt(r),required:n.includes(e),...i&&{title:i}}})},R=e=>e.message.startsWith(`is missing`),xt=e=>new Map([...e].map(([e,t])=>[e,t.filter(e=>!R(e))])),St=e=>{let t=new Map,n=[],r=(e,n)=>t.set(e,[...t.get(e)??[],n]);for(let{state:t,field:i,message:a}of e){let e={...i!==void 0&&{field:i},message:a};t===void 0?i?.startsWith(`trigger`)||i===`StartAt`||i===`stateMachine.StartAt`?r(``,e):n.push(e):r(t,e)}return{byNode:t,whole:n}},Ct=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),wt=e=>t=>e.flatMap(e=>{let n=t[e.name];return n===void 0||n===``?e.required?[{field:e.name,message:`is missing`}]:[]:e.kind===`names`&&!Ct(n)?[{field:e.name,message:`is a list of names, separated by commas`}]:[]}),Tt=(e,t,n)=>{let r=t.step_types.filter(e=>e.available),i=t.triggers.filter(e=>e.available&&e.id!==`manual`),a=[...t.step_types,...t.triggers].filter(e=>!e.available);return we(e,{resources:r.map(e=>e.id),required:Object.fromEntries(r.map(e=>[e.id,L(e.input).filter(e=>e.required).map(e=>e.name)])),triggers:Object.fromEntries(i.map(e=>[e.id,wt(L(e.input))])),unavailable:Object.fromEntries(a.map(e=>[e.id,e.reason??``])),versioned:ke(r.map(e=>e.id)),...n&&{pins:n}})},Et=e=>{let t=new Map;for(let{state:n,field:r,message:i}of Ce(e))n!==void 0&&t.set(n,[...t.get(n)??[],{...r!==void 0&&{field:r},message:i}]);return t},z=e(n(),1),Dt=({problems:e})=>e.length>0&&(0,z.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-body text-danger-text`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,z.jsx)(ie,{className:`size-4`,"aria-hidden":`true`}),e.every(R)?O(`fillInToSave`,{count:e.length}):O(`cannotSave`,{count:e.length})]}),(0,z.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,z.jsx)(`li`,{children:e.field?O(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),Ot=({warnings:e})=>e.length>0&&(0,z.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-body text-warning-text`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,z.jsx)(te,{className:`size-4`,"aria-hidden":`true`}),O(`warningsSaveAnyway`,{count:e.length})]}),(0,z.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,z.jsx)(`li`,{children:e.field?O(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),B=e(t(),1),kt=({name:e,taken:t,disabled:n,onRename:r})=>{let[a,o]=(0,B.useState)(e),s=a.trim(),c=s===``?O(`nameNeeded`):s!==e&&t.includes(s)?O(`nameTaken`):void 0,l=()=>{!c&&s!==e&&r(s)};return(0,z.jsx)(u,{label:O(`name`),error:c,children:(0,z.jsx)(i,{value:a,invalid:!!c,disabled:n,onChange:e=>o(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`&&l()}})})},V=(e,t)=>{let n=e.filter(e=>e.field===t||e.field?.startsWith(`${t}.`)||e.field?.startsWith(`${t}[`));return n.length>0?n.map(e=>e.message).join(`; `):void 0},H=({label:e,value:t,names:n,none:r,error:i,disabled:a,onChange:o})=>(0,z.jsx)(u,{label:e,error:i,children:(0,z.jsxs)(p,{invalid:!!i,value:t??``,disabled:a,onChange:e=>o(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:r}),t!==void 0&&!n.includes(t)&&(0,z.jsx)(`option`,{value:t,children:t}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})}),At=e=>e===void 0?``:typeof e==`string`?e:JSON.stringify(e,null,2),jt=e=>{if(e.trim()!==``)try{return JSON.parse(e)}catch(t){if(!(t instanceof SyntaxError))throw t;return e}},Mt=e=>{let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},Nt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):At(e),Pt=(0,B.createContext)(void 0),Ft=()=>(0,B.useContext)(Pt),It=e=>e===``?void 0:e,Lt={text:It,value:jt,choice:It,json:jt,names:Mt},U=({label:e,kind:t,options:n=[],required:r,help:o,value:s,error:c,onChange:l,disabled:d,read:f=Lt[t],write:m=t===`names`?Nt:At})=>{let[h,ee]=(0,B.useState)(),g=h!==void 0&&JSON.stringify(f(h))===JSON.stringify(s)?h:m(s),te=Ft(),_=e=>{ee(e),l(f(e))},ne=te!==void 0&&!d&&(s==null||typeof s==`string`)&&(t===`text`||t===`json`||t===`value`);return(0,z.jsxs)(u,{label:e,required:r,help:o,error:c,wide:t===`json`,children:[t===`choice`?(0,z.jsxs)(p,{invalid:!!c,value:g,disabled:d,onChange:e=>l(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:O(`defaultChoice`)}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]}):t===`json`?(0,z.jsx)(a,{invalid:!!c,rows:2,className:`font-mono text-xs`,value:g,disabled:d,onChange:e=>_(e.target.value)}):(0,z.jsx)(i,{invalid:!!c,value:g,disabled:d,onChange:e=>_(e.target.value)}),ne&&(0,z.jsx)(`button`,{type:`button`,"aria-label":O(`insertValueInto`,{field:e}),className:`mt-1 text-xs font-medium text-primary-text hover:underline max-md:min-h-11`,onClick:()=>te({label:e,value:s,set:l}),children:O(`insertValue`)})]})},Rt=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),zt=e=>Array.isArray(e)?e.join(`, `):``,W=({state:e,names:t,problems:n,disabled:r,onChange:i})=>{let a=e.Catch??[],o=t=>{let{Catch:n,...r}=e;i(t.length>0?{...r,Catch:t}:r)},s=(e,t)=>o(a.map((n,r)=>r===e?t:n));return(0,z.jsxs)(z.Fragment,{children:[a.map((e,i)=>(0,z.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border border-danger/40 p-3`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-xs font-medium text-danger-text`,children:O(`errorPathNumber`,{number:i+1})}),(0,z.jsx)(U,{label:O(`errors`),kind:`text`,help:O(`errorsHelp`),value:e.ErrorEquals??[],read:Rt,write:zt,error:V(n,`Catch[${i}].ErrorEquals`),disabled:r,onChange:t=>s(i,{...e,ErrorEquals:t})}),(0,z.jsx)(H,{label:O(`thenGoesTo`),value:e.Next||void 0,names:t,none:O(`chooseStep`),error:V(n,`Catch[${i}].Next`),disabled:r,onChange:t=>s(i,{...e,Next:t??``})}),!r&&(0,z.jsxs)(_,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>o(a.filter((e,t)=>t!==i)),children:[(0,z.jsx)(ve,{className:`size-3.5`}),O(`removeErrorPath`)]})]},i)),!r&&(0,z.jsx)(`div`,{children:(0,z.jsxs)(_,{size:`sm`,onClick:()=>o([...a,{ErrorEquals:[`States.ALL`],Next:``}]),children:[(0,z.jsx)(d,{className:`size-3.5`}),O(`addErrorPath`)]})})]})},Bt=({state:e,names:t,problems:n,disabled:r,onChange:i})=>{let a=e.Choices??[],o=(t,n)=>i({...e,Choices:a.map((e,r)=>r===t?n:e)});return(0,z.jsxs)(z.Fragment,{children:[a.map((s,c)=>(0,z.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border p-3`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:O(`ruleNumber`,{number:c+1})}),(0,z.jsx)(U,{label:O(`condition`),kind:`text`,help:O(`conditionHelp`),value:s.Condition,error:V(n,`Choices[${c}].Condition`),disabled:r,onChange:e=>o(c,{...s,Condition:typeof e==`string`?e:``})}),(0,z.jsx)(H,{label:O(`thenGoesTo`),value:s.Next||void 0,names:t,none:O(`chooseStep`),error:V(n,`Choices[${c}].Next`),disabled:r,onChange:e=>o(c,{...s,Next:e??``})}),!r&&(0,z.jsxs)(_,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>i({...e,Choices:a.filter((e,t)=>t!==c)}),children:[(0,z.jsx)(ve,{className:`size-3.5`}),O(`removeRule`)]})]},c)),!r&&(0,z.jsx)(`div`,{children:(0,z.jsxs)(_,{size:`sm`,onClick:()=>i({...e,Choices:[...a,{Condition:``,Next:``}]}),children:[(0,z.jsx)(d,{className:`size-3.5`}),O(`addRule`)]})}),(0,z.jsx)(H,{label:O(`otherwiseGoesTo`),value:e.Default,names:t,none:O(`noDefault`),error:V(n,`Default`),disabled:r,onChange:t=>{let{Default:n,...r}=e;i(t===void 0?r:{...r,Default:t})}})]})},G=(e,t)=>{let{Cache:n,...r}=e;return t===void 0?r:{...r,Cache:t}},Vt=({state:e,types:t,disabled:n,onChange:r})=>{let[i,a]=(0,B.useState)(!1),o=ge(e,t);return o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(u,{label:O(`cacheResults`),help:O(o.forces?`cacheForceHelp`:`cacheHelp`),children:(0,z.jsx)(s,{checked:o.on,onChange:t=>{if(!n){if(!t)return r(G(e,o.offValue));if(o.disclaimer)return a(!0);r(G(e,!0))}}})}),i&&(0,z.jsx)(ee,{title:O(`cacheConfirmTitle`),description:o.disclaimer,onClose:()=>a(!1),actions:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(_,{onClick:()=>a(!1),children:O(`cacheCancel`)}),(0,z.jsx)(_,{variant:`primary`,onClick:()=>(a(!1),r(G(e,!0))),children:O(`cacheConfirm`)})]})})]}):null},Ht=(e,t,n)=>{let{[t]:r,...i}=e;return n==null||n===``?i:{...i,[t]:n}},Ut=(e,t)=>{let{type:n}=De(e.Resource);if(t){let{Cache:t,...r}=e;return{...r,Resource:`${n}${ye}`}}let{HeartbeatSeconds:r,TimeoutSeconds:i,...a}=e;return{...a,Resource:n,...i!==void 0&&i<=xe.taskTimeoutSeconds&&{TimeoutSeconds:i}}},Wt=e=>Oe(e)===void 0,Gt=(e,t)=>({...e,Resource:`${t}${De(e.Resource).waits&&Wt(t)?ye:``}`}),Kt=(e,t,n)=>{let{[t]:r,...i}=typeof e.Arguments==`object`&&e.Arguments!==null?e.Arguments:{};return{...e,Arguments:n===void 0?i:{...i,[t]:n}}},qt=({state:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=t.step_types.filter(e=>e.available),{type:o,waits:c}=De(e.Resource),l=Wt(o),d=t.step_types.find(e=>e.id===o),f=typeof e.Arguments==`string`||!d;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(u,{label:O(`stepType`),error:V(n,`Resource`),children:(0,z.jsxs)(p,{value:o,disabled:r,onChange:t=>i(Gt(e,t.target.value)),children:[!a.some(e=>e.id===o)&&(0,z.jsx)(`option`,{value:o,children:me(o,d?.label)}),a.map(e=>(0,z.jsx)(`option`,{value:e.id,children:me(e.id,e.label)},e.id))]})}),f?(0,z.jsx)(U,{label:O(`arguments`),kind:`json`,value:e.Arguments,error:V(n,`Arguments`),disabled:r,onChange:t=>i({...e,Arguments:t??{}})}):L(d.input).map(t=>(0,z.jsx)(U,{label:oe(t.name,t.title),kind:t.kind,options:t.options,required:t.required,...t.kind===`names`&&{help:O(`namesHelp`)},value:e.Arguments?.[t.name],error:V(n,`Arguments.${t.name}`),disabled:r,onChange:n=>i(Kt(e,t.name,n))},`${o}:${t.name}`)),l&&(0,z.jsx)(u,{label:O(`waitsForResult`),help:O(`waitsForResultHelp`),children:(0,z.jsx)(s,{checked:c,onChange:t=>!r&&i(Ut(e,t))})}),c||!l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(U,{label:O(`waitTimeout`),help:O(`waitTimeoutHelp`),kind:`json`,value:e.TimeoutSeconds,error:V(n,`TimeoutSeconds`),disabled:r,onChange:t=>i(Ht(e,`TimeoutSeconds`,t))}),(0,z.jsx)(U,{label:O(`heartbeatSeconds`),help:O(`heartbeatHelp`),kind:`json`,value:e.HeartbeatSeconds,error:V(n,`HeartbeatSeconds`),disabled:r,onChange:t=>i(Ht(e,`HeartbeatSeconds`,t))})]}):(0,z.jsx)(Vt,{state:e,types:t,disabled:r,onChange:i})]})},K=(e,t,n)=>{let{[t]:r,...i}=e;return n===void 0?i:{...i,[t]:n}},Jt=({state:e,problems:t,disabled:n,onChange:r})=>(0,z.jsx)(U,{label:O(`onlyWhen`),kind:`text`,help:O(`onlyWhenHelp`),value:e.Condition,error:V(t,`Condition`),disabled:n,onChange:t=>r(K(e,`Condition`,t))}),q=e=>{let{state:t,names:n,problems:r,disabled:i,onChange:a}=e;if(e.data)return(0,z.jsx)(Jt,{...e});let o=t;return(0,z.jsx)(H,{label:O(`goesOnTo`),value:o.Next,names:n,none:O(`endsHere`),error:V(r,`Next`)??V(r,`End`),disabled:i,onChange:e=>{let{Next:t,End:n,...r}=o;a(e===void 0?{...r,End:!0}:{...r,Next:e})}})},Yt=e=>{let{state:t,types:n,problems:r,disabled:i,onChange:a}=e,o=(e,n,o,s)=>(0,z.jsx)(U,{label:n,kind:o,help:s,value:t[e],error:V(r,e),disabled:i,onChange:n=>a(K(t,e,n))});if(t.Type===`Task`)return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(qt,{state:t,types:n,problems:r,disabled:i,onChange:a}),(0,z.jsx)(q,{...e}),!e.data&&(0,z.jsx)(W,{...e,state:t})]});if(t.Type===`Choice`)return(0,z.jsx)(Bt,{...e,state:t});if(t.Type===`Map`)return(0,z.jsxs)(z.Fragment,{children:[o(`Items`,O(`items`),`json`,O(`itemsHelp`)),o(`MaxConcurrency`,O(`maxConcurrency`),`json`),(0,z.jsx)(q,{...e}),!e.data&&(0,z.jsx)(W,{...e,state:t})]});if(t.Type===`Block`){let n=(e,n,o,s)=>(0,z.jsx)(U,{label:n,kind:o,help:s,value:t.Cache?.[e],error:V(r,`Cache.${e}`)??(e===`Ttl`?V(r,`Cache`):void 0),disabled:i,onChange:n=>a({...t,Cache:K(t.Cache??{Ttl:``},e,n)})});return(0,z.jsxs)(z.Fragment,{children:[o(`Arguments`,O(`blockArguments`),`json`,O(`blockArgumentsHelp`)),n(`Ttl`,O(`blockTtl`),`text`,O(`blockTtlHelp`)),n(`Key`,O(`blockKey`),`json`,O(`blockKeyHelp`)),(0,z.jsx)(q,{...e}),!e.data&&(0,z.jsx)(W,{...e,state:t})]})}return t.Type===`Wait`?(0,z.jsxs)(z.Fragment,{children:[o(`Seconds`,O(`seconds`),`json`),(0,z.jsx)(q,{...e})]}):t.Type===`Pass`?(0,z.jsxs)(z.Fragment,{children:[o(`Output`,O(`output`),`json`,O(`outputHelp`)),(0,z.jsx)(q,{...e})]}):t.Type===`Succeed`?o(`Output`,O(`output`),`json`,O(`outputHelp`)):t.Type===`Fail`?(0,z.jsxs)(z.Fragment,{children:[e.data&&(0,z.jsx)(Jt,{...e}),o(`Error`,O(`error`),`text`),o(`Cause`,O(`cause`),`text`)]}):null},Xt=(e,t,n,r)=>{let{[n]:i,...a}=t;return{[e]:r===void 0?a:{...a,[n]:r}}},Zt=({trigger:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=ue(e),o=t.triggers.filter(e=>e.available),s=o.find(e=>e.id===a),c=a!==void 0&&!s?a:void 0,l=a===void 0?{}:e[a]??{};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(u,{label:O(`startsWhen`),error:V(n,`trigger`),help:c&&O(`triggerOtherHelp`),children:(0,z.jsxs)(p,{value:a??``,disabled:r,onChange:e=>i({[e.target.value]:{}}),children:[c!==void 0&&(0,z.jsx)(`option`,{value:c,children:le(c,t.triggers.find(e=>e.id===c)?.label)}),a===void 0&&(0,z.jsx)(`option`,{value:``,children:O(`triggerUnknown`)}),o.map(e=>(0,z.jsx)(`option`,{value:e.id,children:le(e.id,e.label)},e.id))]})}),s&&L(s.input).map(e=>(0,z.jsx)(U,{label:oe(e.name,e.title),kind:e.kind,options:e.options,required:e.required,...e.kind===`names`&&{help:O(`namesHelp`)},value:l[e.name],error:V(n,`trigger.${s.id}.${e.name}`),disabled:r,onChange:t=>i(Xt(s.id,l,e.name,t))},`${s.id}:${e.name}`)),c!==void 0&&(0,z.jsx)(U,{label:O(`triggerInput`),kind:`json`,value:l,error:V(n,`trigger.${c}`),disabled:!0,onChange:()=>void 0})]})},Qt=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.Type==`string`,$t=({kind:e,name:t})=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,z.jsx)(`h3`,{className:`truncate font-semibold text-foreground`,children:t})]}),en=({definition:e,types:t,selected:n,problems:r,warnings:i=[],onChange:a,onSelect:o})=>{let s=w(e,n);if(!s)return null;let{scope:c,name:l}=T(n),u=D(e,c),d=!a,f=e=>a?.(e);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)($t,{kind:_e(s,t),name:l}),(0,z.jsx)(Dt,{problems:r}),(0,z.jsx)(Ot,{warnings:i}),(0,z.jsx)(kt,{name:l,taken:Me(e.stateMachine),disabled:d,onRename:t=>{f(_t(e,n,t)),o(je(c,t))}},n),(0,z.jsx)(Yt,{state:s,types:t,names:Object.keys(u.States),problems:r,disabled:d,data:b(e)===`data`,onChange:t=>f(pt(e,n,t))}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-body font-medium text-muted-foreground`,children:O(`asJson`)}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(U,{label:O(`stepJson`),kind:`json`,help:O(`stepJsonHelp`),value:s,disabled:d,onChange:t=>{Qt(t)&&f(pt(e,n,t))}},n)})]}),a&&(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b(e)===`sequence`&&u.StartAt!==l&&(0,z.jsxs)(_,{size:`sm`,onClick:()=>f(vt(e,n)),children:[(0,z.jsx)(Ve,{className:`size-3.5`}),O(`startHere`)]}),(0,z.jsxs)(_,{size:`sm`,variant:`danger`,onClick:()=>{f(ut(e,n)),o(void 0)},children:[(0,z.jsx)(ve,{className:`size-3.5`}),O(`removeStep`)]})]})]})},tn=e=>{let{definition:t,types:n,selected:r,problems:i,onChange:a}=e;return(0,z.jsx)(`section`,{"aria-label":O(`chosenStep`),className:`flex flex-col gap-4 rounded-lg border bg-background p-4`,children:r===``?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)($t,{kind:O(`trigger`),name:fe(t.trigger,n)}),(0,z.jsx)(Dt,{problems:i}),(0,z.jsx)(Zt,{trigger:t.trigger,types:n,problems:i,disabled:!a,onChange:e=>a?.(yt(t,e))})]}):(0,z.jsx)(en,{...e,selected:r})})},nn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),J=(e,t,n,r)=>{let i=structuredClone(e),{scope:a,name:o}=T(t),s=D(i,a)?.States[o];if(s&&n[0]===`#condition`)return r===void 0?delete s.Condition:s.Condition=r,i;if(!s||s.Type!==`Task`)return e;nn(s.Arguments)||(s.Arguments={});let c=s.Arguments;for(let e of n.slice(0,-1))nn(c[e])||(c[e]={}),c=c[e];let l=n.at(-1);return r===void 0?delete c[l]:c[l]=r,i},rn=e=>[`=`,`!=`,`>`,`<`,`matches`,`and`,`or`,`not`,...e?[`expression`]:[]],an=e=>e.kind===`compare`||e.kind===`matches`?{value:``}:{value:e.kind===`logic`&&e.op===`and`},on=e=>e===`not`?{kind:`not`,sides:[{value:!1}]}:e===`and`||e===`or`?{kind:`logic`,op:e,sides:[{value:e===`and`},{value:e===`and`}]}:e===`matches`?{kind:`matches`,sides:[{value:``},{pattern:`.*`,flags:``}]}:{kind:`compare`,op:e,sides:[{value:``},{value:``}]},sn=`{% true %}`,cn=(e,t)=>{if(t.length===0)return e;let n=e.sides[t[0]];return n&&y(n)?cn(n,t.slice(1)):void 0},Y=(e,t,n)=>({...e,sides:e.sides.map((e,r)=>r===t?n:e)}),X=(e,t,n)=>{if(t.length===0)return n(e);let r=e.sides[t[0]],i=r&&y(r)?X(r,t.slice(1),n):void 0;return i&&Y(e,t[0],i)},ln=(e,t,n)=>{if(e.kind===`logic`&&t===e.sides.length)return{...e,sides:[...e.sides,n]};if(!(t>=e.sides.length)){if(e.kind===`matches`&&t===1)return!y(n)&&`value`in n&&typeof n.value==`string`?Y(e,1,{pattern:n.value||`.*`,flags:e.sides[1].flags}):void 0;if(e.kind!==`compare`&&e.kind!==`matches`||!y(n))return Y(e,t,n)}},un=(e,t,n,r)=>{let i=x(w(e,t)?.Condition),a=i&&n.length>0&&X(i,n.slice(0,-1),e=>ln(e,n.at(-1),r));return a&&x(S(a))?J(e,t,[E],S(a)):e},dn=(e,t,n,r)=>{let i=w(e,t)?.Condition;if(n.length===0)return i!==void 0&&i!==``?e:J(e,t,[E],r===`expression`?sn:S(on(r)));let a=x(i),o=a&&cn(a,n.slice(0,-1)),s=n.at(-1),c=o?.sides[s],l=o?.kind===`logic`&&s===o.sides.length;return r===`expression`||!o||o.kind===`compare`||o.kind===`matches`||!l&&(!c||y(c)||!(`value`in c))?e:un(e,t,n,on(r))},fn=(e,t,n)=>{if(n.length===0)return J(e,t,[E],void 0);let r=x(w(e,t)?.Condition),i=n.at(-1),a=r&&X(r,n.slice(0,-1),e=>{if(!(i>=e.sides.length))return e.kind===`logic`&&e.sides.length>2?{...e,sides:e.sides.filter((e,t)=>t!==i)}:ln(e,i,an(e))});return a?J(e,t,[E],S(a)):e},pn=e=>{let t=[];if(`Next`in e&&e.Next!==void 0&&t.push(e.Next),e.Type===`Choice`){for(let n of e.Choices??[])t.push(n.Next);e.Default!==void 0&&t.push(e.Default)}if(`Catch`in e)for(let n of e.Catch??[])n.Next!==void 0&&t.push(n.Next);return t},mn=(e,t)=>{let n=new Set,r=[t];for(;r.length>0;){let t=r.shift(),i=e.States[t];!n.has(t)&&i&&(n.add(t),r.push(...pn(i)))}return[...n]},hn=e=>e.StartAt===void 0?Object.keys(e.States):mn(e,e.StartAt),gn=e=>{if(e.Resource!==`app:http`||typeof e.Arguments!=`object`||e.Arguments===null)return!1;let t=e.Arguments.method;return t===void 0||typeof t==`string`&&t.toUpperCase()===`GET`},_n=(e,t,n)=>t.flatMap(t=>{let r=e.States[t];if(!r)return[];let i=v(r),a=i?_n(i,hn(i),n):[];return r.Type===`Task`?(n?.step_types.find(e=>e.id===r.Resource)?.writes??!0)===!1||gn(r)?[]:[{name:t,kind:_e(r,n)}]:a}),vn=(e,t)=>{if(!e||t||!(`Assign`in e)||!e.Assign)return e;let n=Object.fromEntries(Object.entries(e.Assign).filter(([,e])=>e!==Ee)),{Assign:r,...i}=e;return Object.keys(n).length===0?i:{...i,Assign:n}},yn=(e,t,n)=>{let r=e?.stateMachine.States[n],i=r!==void 0&&`Output`in r;return JSON.stringify(vn(r,i))!==JSON.stringify(vn(t.stateMachine.States[n],i))},bn=(e,t)=>{let n=Se(e),r=new Set([t]);for(let e=!0;e;){e=!1;for(let[t,i]of n)!r.has(t)&&[...Te(i)].some(e=>r.has(e))&&(r.add(t),e=!0)}return Object.keys(e.States).filter(e=>r.has(e))},xn=(e,t,n=e.stateMachine.StartAt)=>{let r=e.stateMachine;return _n(r,b(e)===`data`?n===void 0?hn(r):bn(r,n):n===void 0?hn(r):mn(r,n),t)},Sn=/^[A-Za-z_][A-Za-z0-9_]*$/,Cn=e=>Sn.test(e)?e:`\`${e.replaceAll("`",``)}\``,Z=e=>{let t=JSON.stringify(e)??``;return t.length>60?`${t.slice(0,59)}…`:t},wn=100,Tn=4,En=e=>{let t=[{path:``,sample:Z(e)}],n=(e,r,i)=>{if(!(i===Tn||typeof r!=`object`||!r||t.length>=wn)){if(Array.isArray(r)){if(r.length===0)return;let a=`${e}[0]`;t.push({path:a,sample:Z(r[0])}),n(a,r[0],i+1);return}for(let[a,o]of Object.entries(r)){let r=e===``?Cn(a):`${e}.${Cn(a)}`;t.push({path:r,sample:Z(o)}),n(r,o,i+1)}}};return n(``,e,0),t.slice(0,wn)},Dn=(e,t)=>t===``?e:`${e}${t.startsWith(`[`)?``:`.`}${t}`,On=(e,t)=>{if(e==null||e===``)return`{% ${t} %}`;if(typeof e!=`string`)throw Error(`A value is inserted only into a field that holds text`);let n=/^\{%([\s\S]*)%\}$/.exec(e.trim());return n?`{% (${n[1].trim()}) & ${t} %}`:`{% ${JSON.stringify(e)} & ${t} %}`},kn=(e,t)=>{let{scope:n,name:r}=T(t),i=(e,t,n)=>Object.keys(e.States).filter(n=>n!==t&&mn(e,n).includes(t)).filter(t=>[`Task`,`Map`,`Block`].includes(e.States[t].Type)).map(e=>[...n,e].join(`/`)),a=i(D(e,n),r,n),o=n.findLastIndex((t,r)=>D(e,n.slice(0,r))?.States[n[r]]?.Type===`Block`);return[...n.flatMap((t,r)=>r<=o?[]:i(D(e,n.slice(0,r)),t,n.slice(0,r))),...a]},An=`{% $states.result %}`,jn=(e,t)=>{let{scope:n,name:r}=T(t),i=D(e,n)?.States[r];return i!==void 0&&`Output`in i},Mn=e=>`Assign`in e&&e.Assign?e.Assign:{},Nn=e=>Object.values(e.States).flatMap(e=>[...Object.keys(Mn(e)),...v(e)?Nn(v(e)):[]]),Pn=(e,t)=>{let n=t.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^(\d)/,`step_$1`)||`value`,r=new Set(Nn(e.stateMachine));if(!r.has(n))return n;let i=2;for(;r.has(`${n}_${i}`);)i++;return`${n}_${i}`},Fn=(e,t)=>{let{scope:n,name:r}=T(t),i=D(e,n).States[r],a=Object.entries(Mn(i)).find(([,e])=>e===An);if(a)return{definition:e,variable:a[0],added:!1};let o=Pn(e,r),s=structuredClone(e),c=D(s,n).States[r];return c.Assign={...c.Assign,[o]:An},{definition:s,variable:o,added:!0}},Q=(e,t)=>e.pure.find(e=>e.id===t),In=(e,t)=>{let n=pe(t.handle);if(!n)return;let r=Q(e,t.node);return r?r.kind===`break`?{node:r.source,path:[...r.path,...n]}:void 0:{node:t.node,path:n}},Ln=(e,t)=>{let n=ae(t.handle);if(n===void 0)return;let r=Q(e,t.node);if(!r)return e.inputs.has(t.node)?{step:t.node,keys:[n]}:void 0;if(r.kind===`make`)return{step:r.target,keys:[r.key,n]};if(r.kind===`select`)return{step:r.target,keys:[r.key],select:r};if((r.kind!==`condition`||r.part.kind!==`matches`||n!==`1`)&&r.kind===`condition`&&r.part.kind!==`expression`)return{step:r.target,keys:[E],side:{node:r,at:[...r.at,Number(n)]}}},Rn=(e,t)=>e.path.length===1&&e.path[0]===`#status`&&t.keys.length===1&&t.keys[0]===`#condition`&&!t.side,zn=(e,t,n)=>{let r=Q(e,t.node);if(n===`out`){let n=pe(t.handle);return(r?.kind===`break`?r.outputs:e.outputs.get(t.node)??[]).find(e=>JSON.stringify(e.path)===JSON.stringify(n))?.type}let i=ae(t.handle);if(!(r?.kind===`condition`&&r.part.kind===`compare`||r?.kind===`select`))return(r?.kind===`make`||r?.kind===`condition`?r.inputs:e.inputs.get(t.node)??[]).find(e=>e.key===i)?.type},Bn=(e,t)=>T(t).scope.some((t,n,r)=>w(e,r.slice(0,n+1).join(`/`))?.Type===`Block`),Vn=(e,t)=>{let{scope:n}=T(t);for(let t=n.length;t>0;t--)if(w(e,n.slice(0,t).join(`/`))?.Type===`Block`)return n.slice(0,t).join(`/`)},Hn=(e,t,n)=>{let{scope:r,name:i}=T(t);if(T(n).scope.join(`/`)!==r.join(`/`))return!1;let a=Se(D(e,r)),o=new Set,s=[i];for(;s.length>0;){let e=s.pop();if(e===T(n).name)return!0;o.has(e)||(o.add(e),s.push(...Te(a.get(e)??{data:new Set,status:new Set,handled:new Set})))}return!1},Un=(e,t,n,r)=>{let i=In(t,n),a=Ln(t,r);if(!i||!a)return{reason:`notPins`};let o=Vn(e,a.step);if(o!==void 0&&i.node!==``&&!i.node.startsWith(`${o}/`))return{reason:`otherScope`,step:T(i.node).name};if(b(e)===`data`&&i.node!==``){let[t,n]=[T(i.node).scope.join(`/`),T(a.step).scope.join(`/`)];if(t!==``&&t!==n&&!n.startsWith(`${t}/`))return{reason:`otherScope`,step:T(i.node).name};if(Hn(e,i.node,a.step))return{reason:`notBefore`,step:T(i.node).name};if(i.path[0]!==`#status`&&jn(e,i.node))return{reason:`shapesOutput`,step:T(i.node).name}}else if(i.node===``){if(Bn(e,a.step))return{reason:`notBefore`,step:T(a.step).name}}else{if(!kn(e,a.step).includes(i.node))return{reason:`notBefore`,step:T(i.node).name};if(jn(e,i.node))return{reason:`shapesOutput`,step:T(i.node).name}}if(Rn(i,a))return;let s=zn(t,n,`out`),c=zn(t,r,`in`);if(s&&c&&!be(s,c))return{reason:`type`,source:s,target:c}},Wn=(e,t,n,r)=>{if(Un(e,t,n,r))return e;let i=In(t,n),a=Ln(t,r),o=e,s;if(i.node===``)s={base:{input:!0},path:i.path};else if(i.path[0]===`#status`)s={base:{step:T(i.node).name},path:i.path.slice(1)};else{let t=Fn(e,i.node);o=t.definition,s={base:{variable:t.variable},path:i.path}}let c=`step`in s.base&&s.path.length===0?{...s,path:[`Status`]}:s;return a.side?un(o,a.step,a.side.at,{read:c}):a.select?J(o,a.step,a.keys,C({...a.select.part,operand:{read:c}})):Rn(i,a)?J(o,a.step,a.keys,S({kind:`compare`,op:`=`,sides:[{read:c},{value:`SUCCEEDED`}]})):J(o,a.step,a.keys,Ae(s))},Gn=(e,t,n)=>{let r=Ln(t,{node:n.target,handle:n.targetHandle});if(r?.side)return fn(e,r.step,r.side.at);if(r?.select)return J(e,r.step,r.keys,C({...r.select.part,operand:{value:``}}));if(r)return J(e,r.step,r.keys,void 0);let i=Q(t,n.target)??Q(t,n.source);return i?Kn(e,t,i):e},Kn=(e,t,n)=>{if(n.kind===`make`||n.kind===`select`)return J(e,n.target,[n.key],void 0);if(n.kind===`condition`)return fn(e,n.target,n.at);let r=e=>t.edges.filter(t=>t.source===e.id&&!t.expression).flatMap(e=>{let n=Q(t,e.target);return n?.kind===`break`?r(n):[e]});return he(t,r(n),e=>de(t,e)).reduce((e,n)=>Gn(e,t,n),e)},qn=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Jn={connect:dt,disconnect:ft,removeState:ut,setArgument:J,connectData:Wn,disconnectData:Gn,removePure:Kn,wireRefusal:Un,addCondition:dn,conditionChoices:rn,setConditionSide:un,addSelect:(e,t,n)=>{let r=w(e,t)?.Arguments?.[n];if(r!==void 0&&!qn(r)||typeof r==`string`&&r.startsWith(`{%`))return e;let i=r??``;return J(e,t,[n],C({operand:{value:``},cases:[{when:``,then:i}],otherwise:i}))}},Yn=(e,t,n={})=>({inputs:Object.fromEntries(e.step_types.map(e=>[e.id,e.input])),outputs:Object.fromEntries([...e.step_types,...e.triggers].flatMap(e=>e.output?[[e.id,e.output]]:[])),records:(e,r)=>{let i=t[e];return i&&Le(i,r,n[e]?.names?.singular??g(e),Re(e=>t[e]))},emails:t=>{let n=e.templates?.find(e=>e.name===t);return n&&{schema:n.schema,languages:n.languages}}}),Xn=e=>{let{data:t}=ne();return(0,B.useMemo)(()=>Yn(e,t?.resources??{},t?.views),[e,t?.resources,t?.views])},$=r(`app/field-types/workflow-page`),Zn={"app:http":{icon:Ge,keywords:[`api`,`fetch`,`url`,`webhook`,`get`,`post`]},"app:mail.send":{icon:f,keywords:[`email`,`send`,`message`]},"app:records.create":{icon:k,keywords:[`insert`,`add`,`new`,`row`]},"app:records.update":{icon:k,keywords:[`change`,`edit`,`row`]},"app:records.get":{icon:k,keywords:[`read`,`find`,`row`]},"app:records.list":{icon:k,keywords:[`read`,`find`,`query`,`rows`]}},Qn=[{type:`Choice`,icon:Ue,description:()=>$(`flowChoice`),keywords:[`if`,`branch`,`switch`,`condition`]},{type:`Map`,icon:Ye,description:()=>$(`flowMap`),keywords:[`loop`,`each`,`list`,`repeat`]},{type:`Block`,icon:re,description:()=>$(`flowBlock`),keywords:[`cache`,`once`,`group`,`reuse`,`wrap`]},{type:`Wait`,icon:Ze,description:()=>$(`flowWait`),keywords:[`delay`,`sleep`,`pause`,`later`]},{type:`Pass`,icon:qe,description:()=>$(`flowPass`),keywords:[`variable`,`assign`,`transform`]},{type:`Succeed`,icon:l,description:()=>$(`flowSucceed`),keywords:[`end`,`stop`,`done`]},{type:`Fail`,icon:c,description:()=>$(`flowFail`),keywords:[`end`,`stop`,`error`]}],$n=e=>({id:`task:${e.id}`,title:ce(e.id,e.label),description:e.description,keywords:[e.id,...Zn[e.id]?.keywords??[]],icon:Zn[e.id]?.icon??(e.id.startsWith(`app:`)?o:h)}),er=e=>e.slice(0,Math.max(e.indexOf(`:`),0)),tr=e=>e===`custom`?$(`customSteps`):e,nr=e=>{let t=new Set(Object.values(ke(e.step_types.map(e=>e.id)))),n=e.step_types.filter(e=>e.available&&(!Oe(e.id)||t.has(e.id))),r=[...new Set(n.map(e=>er(e.id)).filter(e=>e!==`app`))];return[{title:$(`builtIn`),items:n.filter(e=>er(e.id)===`app`).map($n)},...r.map(e=>({title:tr(e),items:n.filter(t=>er(t.id)===e).map($n)})),{title:$(`flow`),items:Qn.map(e=>({id:`type:${e.type}`,title:se(e.type),description:e.description(),keywords:e.keywords,icon:e.icon}))}].filter(e=>e.items.length>0)},rr=e=>e.startsWith(`task:`)?{task:e.slice(5)}:{type:e.slice(5)};export{ht as A,st as C,at as D,Qe as E,nt as O,P as S,ct as T,Tt as _,Jn as a,Et as b,En as c,On as d,yn as f,Dt as g,Pt as h,Xn as i,rt as k,jn as l,tn as m,nr as n,kn as o,xn as p,$ as r,Dn as s,rr as t,Fn as u,R as v,ot as w,xt as x,St as y};
2
+ //# debugId=b8f71e2e-f988-4db6-9252-a99915b7d8b1
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$o as r,Qc as i,Rn as a,Wc as o,Zi as s,is as c,lc as l,tl as u,uc as d,zr as f}from"./app-DU-Bny4k.js";import{l as p,m,n as h,u as g}from"./workflow-canvas-2owtFZNz.js";import{m as _}from"./workflows-Bey4jszG.js";import{E as v,T as y,n as b}from"./use-run-trace-vMzYYuXG.js";var x=e(t(),1),S=e=>e===``?[]:e.split(`/`).map(t=>{let n=/^(.*)\.\d+\[(\d+)\]$/.exec(t);if(!n)throw Error(`"${e}" is not a step's scope`);return{map:decodeURIComponent(n[1]),index:Number(n[2])}}),C=(e,t)=>[...S(e).map(e=>e.map),t].join(`/`),w={succeeded:0,caught:1,retrying:2,failed:3,current:4},T=(e,{inProgress:t,startAt:n,within:r=[]})=>{let i=(e,t)=>[...r,C(e,t)].join(`/`),a=new Map,o=new Map,s=new Map;for(let t of e){let e=i(t.scope,t.state);a.set(e,(a.get(e)??0)+1),o.set(`${t.scope}\n${t.state}`,t),s.set(t.scope,t)}let c=new Map,l=(e,t)=>{let n=c.get(e);(n===void 0||w[t]>w[n])&&c.set(e,t)};for(let e of o.values())l(i(e.scope,e.state),e.status);if(t){!s.has(``)&&n&&l([...r,n].join(`/`),`current`);for(let e of s.values())e.status!==`retrying`&&e.next!==null&&l(i(e.scope,e.next),`current`)}return new Map([...c].map(([e,t])=>[e,{status:t,steps:a.get(e)??0}]))},E=i(`app/field-types/workflow-run`),D=e(n(),1),O=({title:e,children:t})=>(0,D.jsxs)(`div`,{className:`grid gap-1`,children:[(0,D.jsx)(`h5`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),k=e=>new Intl.DateTimeFormat(u(),{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(Date.parse(e)),A=({logs:e})=>(0,D.jsx)(`ol`,{className:`grid gap-0.5 rounded-md bg-muted/60 px-3 py-2 font-mono text-xs`,children:e.map((e,t)=>(0,D.jsxs)(`li`,{className:`whitespace-pre-wrap break-words`,children:[(0,D.jsx)(`time`,{dateTime:e.at,className:`text-muted-foreground`,children:k(e.at)}),` `,e.message]},t))}),j=({step:e,runId:t,valueActions:n})=>{let i=c(),l=typeof e.type==`string`&&_(e.type)!==void 0&&i.resources.workflow_custom_step_jobs!==void 0&&i.permissions.workflow_custom_step_jobs?.read!==!1,u=e.logs?.some(e=>e.message===`Not sent: replay`)??!1,m=S(e.scope),g=e.output!==void 0&&e.output!==null&&(0,D.jsxs)(O,{title:E(`output`),children:[(0,D.jsx)(a,{value:e.output}),n?.(e.output,`output`)]});return(0,D.jsxs)(`article`,{"aria-label":E(`stepTry`,{attempt:e.attempt}),className:`grid gap-3 rounded-lg border bg-background p-3`,children:[(0,D.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-body`,children:[(0,D.jsx)(`span`,{className:`font-medium text-foreground`,children:E(`stepTry`,{attempt:e.attempt})}),m.map((e,t)=>(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:E(`itemOf`,{index:e.index+1,map:e.map})},t)),(0,D.jsx)(r,{tone:h[e.status],children:p(e.status)}),u&&(0,D.jsx)(r,{tone:`violet`,children:E(`notSent`)}),e.reused===!0&&(0,D.jsx)(r,{tone:`blue`,children:E(`reused`)}),e.joined===!0&&(0,D.jsx)(r,{tone:`blue`,children:E(`joined`)}),(0,D.jsx)(`time`,{dateTime:e.started_at,className:`text-muted-foreground`,children:s(Date.parse(e.started_at))}),(0,D.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:E(`duration`,{ms:Number(e.duration_ms??0)})})]}),e.error!=null&&(0,D.jsx)(O,{title:E(`error`),children:(0,D.jsxs)(`p`,{className:`text-body text-danger-text`,children:[(0,D.jsx)(`span`,{className:`font-mono`,children:String(e.error)}),e.cause!=null&&(0,D.jsxs)(`span`,{children:[`: `,String(e.cause)]})]})}),typeof e.run==`string`&&(0,D.jsxs)(`div`,{className:`grid gap-1`,children:[e.reused===!0&&(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`reusedResult`)}),e.joined===!0&&(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`joinedResult`)}),(0,D.jsx)(f,{to:{kind:`record`,resource:`workflow_runs`,key:e.run},className:o(d({size:`sm`}),`justify-self-start`),children:e.reused===!0?E(`openEarlierBlockRun`):E(`openBlockRun`)})]}),l&&(0,D.jsx)(f,{to:{kind:`list`,resource:`workflow_custom_step_jobs`,filter:`run_id = "${t}"`},className:o(d({size:`sm`}),`justify-self-start`),children:E(`openJobs`)}),e.status!==`failed`&&g,e.input!==void 0&&e.input!==null&&(0,D.jsxs)(O,{title:E(`input`),children:[(0,D.jsx)(a,{value:e.input}),n?.(e.input,`input`)]}),e.status===`failed`&&g,e.assigned!=null&&(0,D.jsx)(O,{title:E(`variables`),children:(0,D.jsx)(a,{value:e.assigned})}),e.logs&&e.logs.length>0&&(0,D.jsx)(O,{title:E(`logs`),children:(0,D.jsx)(A,{logs:e.logs})})]})},M=({kind:e,name:t})=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,D.jsx)(`h4`,{className:`truncate font-semibold text-foreground`,children:t})]}),N=({run:e,name:t,block:n,valueActions:r})=>{let i=b(e.id,!1),[a,o]=(0,x.useState)(20);if(i.isPending)return null;let s=(i.data??[]).filter(e=>e.state===t),c=n===void 0?void 0:(i.data??[]).filter(e=>e.state===n&&typeof e.run==`string`).at(-1)?.run;return s.length===0&&typeof c==`string`?(0,D.jsxs)(`div`,{className:`grid gap-2 text-body text-muted-foreground`,children:[(0,D.jsx)(`p`,{children:E(`ranInBlockRun`,{block:n})}),(0,D.jsx)(f,{to:{kind:`record`,resource:`workflow_runs`,key:c},className:d({size:`sm`})+` justify-self-start`,children:E(`openBlockRun`)})]}):s.length===0?(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`notRun`)}):(0,D.jsxs)(`div`,{className:`grid gap-3`,children:[s.slice(0,a).map(t=>(0,D.jsx)(j,{step:t,runId:e.id,...r&&{valueActions:r}},String(t.id))),s.length>a&&(0,D.jsx)(l,{size:`sm`,className:`justify-self-start`,onClick:()=>o(a+20),children:E(`showMore`)})]})},P=({definition:e,run:t,selected:n,types:r})=>{let i=n===``?void 0:v(e,n);return(0,D.jsx)(`section`,{"aria-label":E(`chosenStep`),className:`grid gap-3 rounded-lg border bg-surface p-4`,children:i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:g(i,r),name:y(n).name}),(0,D.jsx)(N,{run:t,name:y(n).name})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:E(`trigger`),name:m(e.trigger,r)}),(0,D.jsx)(O,{title:E(`runInput`),children:(0,D.jsx)(a,{value:t.input??null})})]})})};export{T as a,E as i,P as n,C as o,O as r,N as t};
2
- //# debugId=a8150399-7d95-49f4-ac1f-9fd26b05701c
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$c as r,Gc as i,Qi as a,Rn as o,as as s,dc as c,es as l,nl as u,uc as d,zr as f}from"./app-Cfc4Mr5v.js";import{l as p,m,n as h,u as g}from"./workflow-canvas-DpONgLJR.js";import{m as _}from"./workflows-Bey4jszG.js";import{E as v,T as y,n as b}from"./use-run-trace-BEM0bOMt.js";var x=e(t(),1),S=e=>e===``?[]:e.split(`/`).map(t=>{let n=/^(.*)\.\d+\[(\d+)\]$/.exec(t);if(!n)throw Error(`"${e}" is not a step's scope`);return{map:decodeURIComponent(n[1]),index:Number(n[2])}}),C=(e,t)=>[...S(e).map(e=>e.map),t].join(`/`),w={succeeded:0,caught:1,retrying:2,failed:3,current:4},T=(e,{inProgress:t,startAt:n,within:r=[]})=>{let i=(e,t)=>[...r,C(e,t)].join(`/`),a=new Map,o=new Map,s=new Map;for(let t of e){let e=i(t.scope,t.state);a.set(e,(a.get(e)??0)+1),o.set(`${t.scope}\n${t.state}`,t),s.set(t.scope,t)}let c=new Map,l=(e,t)=>{let n=c.get(e);(n===void 0||w[t]>w[n])&&c.set(e,t)};for(let e of o.values())l(i(e.scope,e.state),e.status);if(t){!s.has(``)&&n&&l([...r,n].join(`/`),`current`);for(let e of s.values())e.status!==`retrying`&&e.next!==null&&l(i(e.scope,e.next),`current`)}return new Map([...c].map(([e,t])=>[e,{status:t,steps:a.get(e)??0}]))},E=r(`app/field-types/workflow-run`),D=e(n(),1),O=({title:e,children:t})=>(0,D.jsxs)(`div`,{className:`grid gap-1`,children:[(0,D.jsx)(`h5`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),k=e=>new Intl.DateTimeFormat(u(),{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(Date.parse(e)),A=({logs:e})=>(0,D.jsx)(`ol`,{className:`grid gap-0.5 rounded-md bg-muted/60 px-3 py-2 font-mono text-xs`,children:e.map((e,t)=>(0,D.jsxs)(`li`,{className:`whitespace-pre-wrap break-words`,children:[(0,D.jsx)(`time`,{dateTime:e.at,className:`text-muted-foreground`,children:k(e.at)}),` `,e.message]},t))}),j=({step:e,runId:t,valueActions:n})=>{let r=s(),u=typeof e.type==`string`&&_(e.type)!==void 0&&r.resources.workflow_custom_step_jobs!==void 0&&r.permissions.workflow_custom_step_jobs?.read!==!1,d=e.logs?.some(e=>e.message===`Not sent: replay`)??!1,m=S(e.scope),g=e.output!==void 0&&e.output!==null&&(0,D.jsxs)(O,{title:E(`output`),children:[(0,D.jsx)(o,{value:e.output}),n?.(e.output,`output`)]});return(0,D.jsxs)(`article`,{"aria-label":E(`stepTry`,{attempt:e.attempt}),className:`grid gap-3 rounded-lg border bg-background p-3`,children:[(0,D.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-body`,children:[(0,D.jsx)(`span`,{className:`font-medium text-foreground`,children:E(`stepTry`,{attempt:e.attempt})}),m.map((e,t)=>(0,D.jsx)(`span`,{className:`text-muted-foreground`,children:E(`itemOf`,{index:e.index+1,map:e.map})},t)),(0,D.jsx)(l,{tone:h[e.status],children:p(e.status)}),d&&(0,D.jsx)(l,{tone:`violet`,children:E(`notSent`)}),e.reused===!0&&(0,D.jsx)(l,{tone:`blue`,children:E(`reused`)}),e.joined===!0&&(0,D.jsx)(l,{tone:`blue`,children:E(`joined`)}),(0,D.jsx)(`time`,{dateTime:e.started_at,className:`text-muted-foreground`,children:a(Date.parse(e.started_at))}),(0,D.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:E(`duration`,{ms:Number(e.duration_ms??0)})})]}),e.error!=null&&(0,D.jsx)(O,{title:E(`error`),children:(0,D.jsxs)(`p`,{className:`text-body text-danger-text`,children:[(0,D.jsx)(`span`,{className:`font-mono`,children:String(e.error)}),e.cause!=null&&(0,D.jsxs)(`span`,{children:[`: `,String(e.cause)]})]})}),typeof e.run==`string`&&(0,D.jsxs)(`div`,{className:`grid gap-1`,children:[e.reused===!0&&(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`reusedResult`)}),e.joined===!0&&(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`joinedResult`)}),(0,D.jsx)(f,{to:{kind:`record`,resource:`workflow_runs`,key:e.run},className:i(c({size:`sm`}),`justify-self-start`),children:e.reused===!0?E(`openEarlierBlockRun`):E(`openBlockRun`)})]}),u&&(0,D.jsx)(f,{to:{kind:`list`,resource:`workflow_custom_step_jobs`,filter:`run_id = "${t}"`},className:i(c({size:`sm`}),`justify-self-start`),children:E(`openJobs`)}),e.status!==`failed`&&g,e.input!==void 0&&e.input!==null&&(0,D.jsxs)(O,{title:E(`input`),children:[(0,D.jsx)(o,{value:e.input}),n?.(e.input,`input`)]}),e.status===`failed`&&g,e.assigned!=null&&(0,D.jsx)(O,{title:E(`variables`),children:(0,D.jsx)(o,{value:e.assigned})}),e.logs&&e.logs.length>0&&(0,D.jsx)(O,{title:E(`logs`),children:(0,D.jsx)(A,{logs:e.logs})})]})},M=({kind:e,name:t})=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,D.jsx)(`h4`,{className:`truncate font-semibold text-foreground`,children:t})]}),N=({run:e,name:t,block:n,valueActions:r})=>{let i=b(e.id,!1),[a,o]=(0,x.useState)(20);if(i.isPending)return null;let s=(i.data??[]).filter(e=>e.state===t),l=n===void 0?void 0:(i.data??[]).filter(e=>e.state===n&&typeof e.run==`string`).at(-1)?.run;return s.length===0&&typeof l==`string`?(0,D.jsxs)(`div`,{className:`grid gap-2 text-body text-muted-foreground`,children:[(0,D.jsx)(`p`,{children:E(`ranInBlockRun`,{block:n})}),(0,D.jsx)(f,{to:{kind:`record`,resource:`workflow_runs`,key:l},className:c({size:`sm`})+` justify-self-start`,children:E(`openBlockRun`)})]}):s.length===0?(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`notRun`)}):(0,D.jsxs)(`div`,{className:`grid gap-3`,children:[s.slice(0,a).map(t=>(0,D.jsx)(j,{step:t,runId:e.id,...r&&{valueActions:r}},String(t.id))),s.length>a&&(0,D.jsx)(d,{size:`sm`,className:`justify-self-start`,onClick:()=>o(a+20),children:E(`showMore`)})]})},P=({definition:e,run:t,selected:n,types:r})=>{let i=n===``?void 0:v(e,n);return(0,D.jsx)(`section`,{"aria-label":E(`chosenStep`),className:`grid gap-3 rounded-lg border bg-surface p-4`,children:i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:g(i,r),name:y(n).name}),(0,D.jsx)(N,{run:t,name:y(n).name})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:E(`trigger`),name:m(e.trigger,r)}),(0,D.jsx)(O,{title:E(`runInput`),children:(0,D.jsx)(o,{value:t.input??null})})]})})};export{T as a,E as i,P as n,C as o,O as r,N as t};
2
+ //# debugId=b266110a-7033-4499-a55d-8482bdf4c7d5
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,Da as i,Gc as a,Zi as o,ca as s,da as c,dl as l,fi as u,gr as d,ka as ee,na as f,oa as p,os as te,ra as m,sc as h,ta as g,vi as _}from"./app-Cfc4Mr5v.js";import{_ as v,a as ne,i as re,n as y,o as b,t as ie,v as x}from"./lib-dnd-kit-core-xi-7xL_N.js";import{a as ae,g as S,h as C,i as w,l as oe,m as se,n as ce,o as T,r as le,t as ue,u as E,v as D}from"./use-calendar-move-D93tEWOf.js";var O=e(t(),1),k=864e5,A=e=>Date.parse(`${e}T00:00:00Z`),j=(e,t=0)=>{let n=new Date(A(e));return new Date(Date.UTC(n.getUTCFullYear(),Math.floor(n.getUTCMonth()/3)*3+3*t,1)).toISOString().slice(0,10)},M=({scale:e,day:t})=>({scale:e,day:e===`week`?C(t):e===`month`?S(t):j(t)}),N=(e,t,n=c())=>M(e??{scale:`month`,day:s(t,n)}),P=(e,t)=>{let{scale:n,day:r}=M(e);return{scale:n,day:n===`week`?E(r,7*t):n===`month`?S(r,t):j(r,t)}},F=e=>{let t=M(e).day,n=(A(P(e,1).day)-A(t))/k;return Array.from({length:n},(e,n)=>E(t,n))},de=e=>({from:M(e).day,to:P(e,1).day}),fe=(e,t,n,r=c())=>{let i=s(n,r),a=F(e);return M({scale:t,day:i>=a[0]&&i<=a.at(-1)?i:a[0]})},I=e=>{let t=F(e);return e.scale===`week`?r(A(t[0]),A(t.at(-1))):e.scale===`month`?g(A(t[0])):m(A(t[0]),A(S(t.at(-1))))},L=e=>{let t=F(e);if(e.scale===`week`)return t.map((e,t)=>({index:t,span:1,label:`${p(A(e))} ${Number(e.slice(8))}`}));if(e.scale===`month`)return t.map((e,t)=>({index:t,span:1,label:String(Number(e.slice(8))),...t%7!=0&&{minor:!0}}));let n=t.flatMap((e,t)=>e.endsWith(`-01`)?[t]:[]);return n.map((e,r)=>({index:e,span:(n[r+1]??t.length)-e,label:f(A(t[e]))}))},R=(e,t,n,r,i=c())=>{let a=D(e,t,n,i),o=r[0],s=r.at(-1);if(!(!a||o===void 0||s===void 0||a.last<o||a.first>s))return{first:a.first<o?0:r.indexOf(a.first),last:a.last>s?r.length-1:r.indexOf(a.last),before:a.first<o,after:a.last>s,start:a.first}},z=`none`,B=(e,t,n,r)=>{let i=r.group,a=i===void 0?void 0:t.fields[i];if(i===void 0||!a)return[{key:``,rows:e}];let o=n?.fields[i],s=new Map;for(let t of e){let e=t.record[i],n=e==null||e===``,r=n?z:`value:${String(e)}`,c=n?u(`noValue`,{label:o?.label??l(i)}):t.labels[i]??_(a,e,o),d=s.get(r)??{value:n?void 0:e,lane:{key:r,label:c,rows:[]}};d.lane.rows.push(t),s.set(r,d)}let c=a.enumValues??[],d=(e,t)=>e.value===void 0||t.value===void 0?Number(e.value===void 0)-Number(t.value===void 0):a.type===`enum`?c.indexOf(String(e.value))-c.indexOf(String(t.value)):a.type===`relation`?e.lane.label.localeCompare(t.lane.label):typeof e.value==`number`&&typeof t.value==`number`?e.value-t.value:String(e.value).localeCompare(String(t.value),void 0,{numeric:!0});return[...s.values()].toSorted(d).map(({lane:e})=>e)},V=e(n(),1),H=`grid grid-cols-1 sm:grid-cols-[12rem_minmax(0,1fr)]`,U=(e,t)=>`${e/t*100}%`,pe=({ticks:e,days:t,today:n,label:r,trackRef:i})=>(0,V.jsxs)(`div`,{className:a(H,`border-b border-border bg-surface`),children:[(0,V.jsx)(`span`,{className:`hidden truncate px-2 py-1 text-xs font-medium text-muted-foreground sm:block`,children:r}),(0,V.jsx)(`div`,{ref:i,"aria-hidden":!0,className:`relative h-6`,children:e.map(e=>(0,V.jsx)(`span`,{className:a(`absolute inset-y-0 items-center truncate px-1 text-xs tabular-nums text-muted-foreground`,e.index>0?`border-l border-border`:`border-border sm:border-l`,e.minor?`hidden sm:flex`:`flex`,e.span===1&&t[e.index]===n&&`font-medium text-primary`),style:{left:U(e.index,t.length),width:U(e.span,t.length)},children:e.label},e.index))})]}),me=({ticks:e,days:t,today:n})=>{let r=t.indexOf(n);return(0,V.jsxs)(`div`,{"aria-hidden":!0,className:a(H,`pointer-events-none absolute inset-0`),children:[(0,V.jsx)(`span`,{className:`hidden sm:block`}),(0,V.jsxs)(`div`,{className:`relative`,children:[r>=0&&(0,V.jsx)(`span`,{className:`absolute inset-y-0 bg-primary/10`,style:{left:U(r,t.length),width:U(1,t.length)}}),e.map(e=>(0,V.jsx)(`span`,{className:a(`absolute inset-y-0 w-px bg-border`,(e.minor||e.index===0)&&`hidden sm:block`),style:{left:U(e.index,t.length)}},e.index))]})]})},he=({model:e,view:t,display:n,row:r,days:i,movable:o,dragged:s})=>{let c=R(r.record,n,e,i);return(0,V.jsxs)(`div`,{className:a(H,`relative border-b border-border last:border-b-0`),children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:`truncate px-2 pt-1 text-body sm:py-1.5`,children:T(e,t,n,r)}),(0,V.jsx)(`div`,{className:`relative h-7`,children:c&&(0,V.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2`,style:{left:U(c.first,i.length),width:U(c.last-c.first+1,i.length)},children:(0,V.jsx)(w,{model:e,view:t,display:n,row:r,day:c.start,movable:o,dragged:s,className:a(c.before&&`rounded-l-none border-l-0`,c.after&&`rounded-r-none border-r-0`)})})})]})},ge=()=>[{scale:`week`,label:u(`week`)},{scale:`month`,label:u(`month`)},{scale:`quarter`,label:u(`quarter`)}],W=({model:e,view:t,display:n,fields:r,filter:a,at:f,linkTo:p,now:m=Date.now()})=>{let[g,_]=(0,O.useState)(),S=N(p?f:g,m),C=F(S),w=L(S),k=le({model:e,display:n,range:de(S),fields:r,filter:a}),{moves:A,move:j}=ce(e,n),M=B(se(ue(k.rows,A),n),e,t,n),R=te(e.name),z=i(R,`update`)&&[n.start,n.end].every(t=>t===void 0||!e.fields[t]?.readOnly),[H,U]=(0,O.useState)(),W=(0,O.useRef)(!1),G=(0,O.useRef)(0),K=(0,O.useRef)(null),q=()=>(K.current?.getBoundingClientRect().width??0)/C.length,J=e=>{let t=q();return t>0?Math.round(e/t):0},_e=({transform:e})=>({...e,x:J(e.x)*q(),y:0}),ve=x(v(ne,{activationConstraint:{distance:4}}),v(b,{activationConstraint:{delay:250,tolerance:5}}),v(re,{keyboardCodes:{start:[`Space`],cancel:[`Escape`],end:[`Space`,`Enter`]},coordinateGetter:(e,{currentCoordinates:t})=>{let n=e.code===`ArrowLeft`?-1:+(e.code===`ArrowRight`);if(n!==0)return e.preventDefault(),{x:t.x+n*q(),y:t.y}}})),Y=s(m,c()),X=r=>T(e,t,n,r.row),Z=e=>o(Date.parse(`${E(e.day,G.current)}T00:00:00Z`)),Q={onDragStart:({active:e})=>u(`pickedUp`,{title:X(e.data.current)}),onDragMove:({active:e})=>u(`startsOn`,{title:X(e.data.current),day:Z(e.data.current)}),onDragOver:()=>void 0,onDragEnd:({active:e})=>G.current===0?u(`putBack`,{title:X(e.data.current)}):u(`wasMovedTo`,{title:X(e.data.current),to:Z(e.data.current)}),onDragCancel:({active:e})=>u(`cancelled`,{title:X(e.data.current)})},$=()=>{U(void 0),setTimeout(()=>W.current=!1)},ye=({active:e})=>{W.current=!0,G.current=0,U(e.data.current)},be=({delta:e})=>G.current=J(e.x),xe=({active:t,delta:r})=>{$(),G.current=J(r.x);let{row:i}=t.data.current,a=D(i.record,n,e);a&&G.current!==0&&j(i,a.first,E(a.first,G.current))},Se=n.group===void 0?t?.names?.plural??l(e.name):t?.fields[n.group]?.label??l(n.group),Ce=!k.loading&&!k.error&&k.rows.length===0;return(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,V.jsx)(oe,{heading:I(S),unit:S.scale,previous:P(S,-1),today:N({scale:S.scale,day:Y},m),next:P(S,1),scales:ge().map(({scale:e,label:t})=>({view:fe(S,e,m),label:t,current:S.scale===e})),scalesLabel:u(`timelineScale`),linkTo:p,onView:_}),k.error&&(0,V.jsx)(d,{title:u(`couldNotLoadRows`),error:k.error}),k.capped&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u(`capped`,{limit:500,unit:S.scale})}),(0,V.jsxs)(ie,{sensors:ve,modifiers:[_e],onDragStart:ye,onDragMove:be,onDragEnd:xe,onDragCancel:$,accessibility:{announcements:Q,screenReaderInstructions:{draggable:u(`timelineInstructions`)}},children:[(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[(0,V.jsx)(pe,{ticks:w,days:C,today:Y,label:Se,trackRef:K}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(me,{ticks:w,days:C,today:Y}),k.loading&&(0,V.jsxs)(`div`,{className:`relative flex flex-col gap-2 p-2`,children:[(0,V.jsx)(h,{className:`h-4`}),(0,V.jsx)(h,{className:`h-4`})]}),Ce&&(0,V.jsx)(`p`,{className:`relative px-2 py-3 text-xs text-muted-foreground`,children:u(`nothingIn`,{unit:S.scale})}),!k.loading&&M.map(r=>(0,V.jsxs)(`section`,{"aria-label":r.label,className:`relative border-b border-border last:border-b-0`,children:[r.label!==void 0&&(0,V.jsxs)(`h3`,{className:`flex items-center gap-1.5 border-b border-border bg-surface px-2 py-1 text-xs font-medium`,children:[r.label,(0,V.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:r.rows.length})]}),r.rows.map(r=>(0,V.jsx)(he,{model:e,view:t,display:n,row:r,days:C,movable:z&&ee(r.record,`update`),dragged:()=>W.current},r.key))]},r.key))]})]}),(0,V.jsx)(y,{children:H&&(0,V.jsx)(ae,{model:e,view:t,display:n,row:H.row,day:H.day})})]})]})};export{W as TimelineDisplay};
2
+ //# debugId=73835994-e047-4cb0-9ba6-1aa215a56eb1
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Uc as e}from"./app-DU-Bny4k.js";var t={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};t.node;var n=e(t);export{n as t};
2
- //# debugId=451fc380-ecc2-445e-91c7-915b861acae5
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Wc as e}from"./app-Cfc4Mr5v.js";var t={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};t.node;var n=e(t);export{n as t};
2
+ //# debugId=aa51c575-e90b-4bfd-bd7c-7083f134ecb6
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$l as e,Bl as t,Ql as n,Xl as r,Yl as i,Zl as a}from"./app-DU-Bny4k.js";import{A as o}from"./vendor-t7Q7QbPu.js";var s=e=>()=>{throw Error(`Not implemented: ${e}() needs the database (the resource's search fields, trigram matching), so it cannot be evaluated against a record`)},c=(t,n,r)=>({...e,search:{...e.search,evaluate:r?e=>i(r,n,e):s(`search`)},similar:{...e.similar,evaluate:s(`similar`)},regex:{...e.regex,evaluate:(e,t)=>e.some(e=>typeof e==`string`&&new RegExp(t).test(e))},now:{...e.now,evaluate:t}}),l=(e,t,n={})=>o(a(e,{expand:!0}),t,{functions:c(n.now??(()=>new Date),t,n.search)}),u=(e,t,n,r={})=>({name:e,kind:t,label:n.label,required:t!==`boolean`&&!n.optional,...n.help!==void 0&&{help:n.help},...n.when!==void 0&&{when:n.when},...n.default!==void 0&&{default:n.default},...r}),d={text:(e,t)=>u(e,`text`,t,{...t.multiline&&{multiline:!0},...t.max!==void 0&&{max:t.max}}),integer:(e,t)=>u(e,`integer`,t),decimal:(e,t)=>u(e,`decimal`,t),boolean:(e,t)=>u(e,`boolean`,t),secret:(e,t)=>u(e,`secret`,t),date:(e,t)=>u(e,`date`,t),choice:(e,t)=>u(e,`choice`,t,`options`in t?{options:t.options.map(({value:e,label:t})=>({value:e,label:t}))}:{resource:t.resource}),checklist:(e,t)=>u(e,`checklist`,t,{...`items`in t&&{items:[...t.items]},...`from`in t&&{from:t.from}}),custom:(e,t)=>u(e,`custom`,t,{component:t.component,...t.props!==void 0&&{props:t.props}})},f={text:`text`,integer:`integer`,decimal:`decimal`,boolean:`boolean`,date:`date`,choice:`text`,secret:`text`,checklist:`json`,custom:`json`},p=e=>({name:e.name,column:e.name,type:e.options?`enum`:f[e.kind],nullable:!0,readOnly:!1,filterable:e.kind!==`custom`&&e.kind!==`checklist`&&e.kind!==`secret`,sortable:!1,aliases:[],...e.options&&{enumValues:e.options.map(e=>e.value)}}),m=e=>({name:`inputs`,table:{name:`inputs`},fields:Object.fromEntries(e.map(e=>[e.name,p(e)])),primaryKey:[]}),h=(e,t)=>{let i=e[t].when;if(i===void 0)return;let a=n(i);if(!a.ok)return a.errors.map(e=>e.message).join(`; `);if(!a.ast)return`it is empty`;let o=r(m(e.slice(0,t)),a.ast);return o.ok?o.filter:o.errors.map(e=>e.message).join(`; `)},g=e=>e.kind===`checklist`?e.items===void 0==(e.from===void 0)?[`input "${e.name}": a checklist takes either "items" or "from"`]:e.items&&e.items.length===0?[`input "${e.name}": a checklist needs at least one item`]:[]:[],_=e=>e.flatMap((t,n)=>{let r=[];e.findIndex(e=>e.name===t.name)!==n&&r.push(`input "${t.name}" is declared twice`),t.kind===`secret`&&t.default!==void 0&&r.push(`input "${t.name}": a secret takes no default`),t.kind!==`secret`&&t.options&&t.default!==void 0&&!t.options.some(e=>e.value===t.default)&&r.push(`input "${t.name}": default "${String(t.default)}" is not one of its options`);let i=h(e,n);return typeof i==`string`&&r.push(`input "${t.name}": "when" is not a valid condition over the inputs before it: ${i}`),[...r,...g(t)]}),v=(e,t)=>{let n=new Set,r={};return e.forEach((i,a)=>{let o=h(e,a);if(typeof o==`string`)throw Error(`Input "${i.name}": ${o}`);let s=o===void 0||l(o,r)===!0;s&&n.add(i.name),r[i.name]=s?t[i.name]??null:null}),n},y=(e,n=[])=>Object.entries(e).flatMap(([e,r])=>{let i=typeof r==`string`?t(r):void 0;if(i===void 0)return[];let a=n.find(e=>e.name===i);return a?a.kind===`secret`?[`set "${e}" names secret input "${i}", which an update never writes; take it in an action's handler`]:[]:[`set "${e}" names input "${i}", which it does not ask for`]}),b=(e,n)=>Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{let i=typeof r==`string`?t(r):void 0;return i===void 0?[[e,r]]:Object.hasOwn(n,i)?[[e,n[i]]]:[]}));export{v as a,d as i,b as n,_ as r,y as t};
2
- //# debugId=a2bc789c-5ab3-439f-9d0a-28c2a83305bf
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$l as e,Ql as t,Ul as n,eu as r,nu as i,tu as a}from"./app-Cfc4Mr5v.js";import{A as o}from"./vendor-t7Q7QbPu.js";var s=e=>()=>{throw Error(`Not implemented: ${e}() needs the database (the resource's search fields, trigram matching), so it cannot be evaluated against a record`)},c=(e,n,r)=>({...i,search:{...i.search,evaluate:r?e=>t(r,n,e):s(`search`)},similar:{...i.similar,evaluate:s(`similar`)},regex:{...i.regex,evaluate:(e,t)=>e.some(e=>typeof e==`string`&&new RegExp(t).test(e))},now:{...i.now,evaluate:e}}),l=(e,t,n={})=>o(r(e,{expand:!0}),t,{functions:c(n.now??(()=>new Date),t,n.search)}),u=(e,t,n,r={})=>({name:e,kind:t,label:n.label,required:t!==`boolean`&&!n.optional,...n.help!==void 0&&{help:n.help},...n.when!==void 0&&{when:n.when},...n.default!==void 0&&{default:n.default},...r}),d={text:(e,t)=>u(e,`text`,t,{...t.multiline&&{multiline:!0},...t.max!==void 0&&{max:t.max}}),integer:(e,t)=>u(e,`integer`,t),decimal:(e,t)=>u(e,`decimal`,t),boolean:(e,t)=>u(e,`boolean`,t),secret:(e,t)=>u(e,`secret`,t),date:(e,t)=>u(e,`date`,t),choice:(e,t)=>u(e,`choice`,t,`options`in t?{options:t.options.map(({value:e,label:t})=>({value:e,label:t}))}:{resource:t.resource}),checklist:(e,t)=>u(e,`checklist`,t,{...`items`in t&&{items:[...t.items]},...`from`in t&&{from:t.from}}),custom:(e,t)=>u(e,`custom`,t,{component:t.component,...t.props!==void 0&&{props:t.props}})},f={text:`text`,integer:`integer`,decimal:`decimal`,boolean:`boolean`,date:`date`,choice:`text`,secret:`text`,checklist:`json`,custom:`json`},p=e=>({name:e.name,column:e.name,type:e.options?`enum`:f[e.kind],nullable:!0,readOnly:!1,filterable:e.kind!==`custom`&&e.kind!==`checklist`&&e.kind!==`secret`,sortable:!1,aliases:[],...e.options&&{enumValues:e.options.map(e=>e.value)}}),m=e=>({name:`inputs`,table:{name:`inputs`},fields:Object.fromEntries(e.map(e=>[e.name,p(e)])),primaryKey:[]}),h=(t,n)=>{let r=t[n].when;if(r===void 0)return;let i=a(r);if(!i.ok)return i.errors.map(e=>e.message).join(`; `);if(!i.ast)return`it is empty`;let o=e(m(t.slice(0,n)),i.ast);return o.ok?o.filter:o.errors.map(e=>e.message).join(`; `)},g=e=>e.kind===`checklist`?e.items===void 0==(e.from===void 0)?[`input "${e.name}": a checklist takes either "items" or "from"`]:e.items&&e.items.length===0?[`input "${e.name}": a checklist needs at least one item`]:[]:[],_=e=>e.flatMap((t,n)=>{let r=[];e.findIndex(e=>e.name===t.name)!==n&&r.push(`input "${t.name}" is declared twice`),t.kind===`secret`&&t.default!==void 0&&r.push(`input "${t.name}": a secret takes no default`),t.kind!==`secret`&&t.options&&t.default!==void 0&&!t.options.some(e=>e.value===t.default)&&r.push(`input "${t.name}": default "${String(t.default)}" is not one of its options`);let i=h(e,n);return typeof i==`string`&&r.push(`input "${t.name}": "when" is not a valid condition over the inputs before it: ${i}`),[...r,...g(t)]}),v=(e,t)=>{let n=new Set,r={};return e.forEach((i,a)=>{let o=h(e,a);if(typeof o==`string`)throw Error(`Input "${i.name}": ${o}`);let s=o===void 0||l(o,r)===!0;s&&n.add(i.name),r[i.name]=s?t[i.name]??null:null}),n},y=(e,t=[])=>Object.entries(e).flatMap(([e,r])=>{let i=typeof r==`string`?n(r):void 0;if(i===void 0)return[];let a=t.find(e=>e.name===i);return a?a.kind===`secret`?[`set "${e}" names secret input "${i}", which an update never writes; take it in an action's handler`]:[]:[`set "${e}" names input "${i}", which it does not ask for`]}),b=(e,t)=>Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{let i=typeof r==`string`?n(r):void 0;return i===void 0?[[e,r]]:Object.hasOwn(t,i)?[[e,t[i]]]:[]}));export{v as a,d as i,b as n,_ as r,y as t};
2
+ //# debugId=dad36b59-7eec-4e36-8347-9cb927cf3881
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Gc as r,Ic as i,La as a,Lc as o,Xl as s,Zi as c,Zl as l,aa as u,as as d,bn as f,ca as p,da as m,dc as h,di as ee,fa as g,fi as _,fs as te,la as v,ll as y,ua as b,vi as ne,wa as re,wo as x,zr as S}from"./app-Cfc4Mr5v.js";import{i as C}from"./vendor-t7Q7QbPu.js";import{r as w,t as T}from"./record-preview-BCYfgSHu.js";import{h as E}from"./lib-dnd-kit-core-xi-7xL_N.js";import{t as D}from"./use-display-rows-BPgcYLdT.js";var O=e(t(),1),k=e(n(),1),A=864e5,j=e=>new Date(e).toISOString().slice(0,10),M=e=>Date.parse(`${e}T00:00:00Z`),N=(e,t)=>j(M(e)+t*A),P=e=>N(e,-((new Date(M(e)).getUTCDay()+6)%7)),F=(e,t=0)=>{let n=new Date(M(e));return j(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+t,1))},I=({scale:e,day:t})=>({scale:e,day:e===`month`?F(t):P(t)}),L=(e,t,n=m())=>I(e??{scale:`month`,day:p(t,n)}),R=(e,t,n=m())=>I({scale:e,day:p(t,n)}),z=(e,t)=>e.scale===`month`?{scale:`month`,day:F(e.day,t)}:{scale:`week`,day:N(P(e.day),7*t)},B=e=>{let t=P(e.scale===`month`?F(e.day):e.day),n=(M(e.scale===`month`?N(P(N(F(e.day,1),-1)),6):N(t,6))-M(t))/A+1;return Array.from({length:n},(e,n)=>N(t,n))},V=e=>{let t=B(e);return{from:t[0],to:N(t.at(-1),1)}},H=(e,t)=>t.fields[e.start]?.type===`timestamp`,U=(e,t,n,r=m())=>{let i=H(e,t),a=e=>new Date(b(e,r)).toISOString().replace(`.000Z`,`Z`),o=e=>i?{kind:`timestamp`,value:a(e),span:{start:0,end:0}}:{kind:`string`,value:e,span:{start:0,end:0}},c=s.and(s.gte(e.start,o(n.from)),s.lt(e.start,o(n.to)));if(e.end===void 0)return l(c);let u=i?s.gt(e.end,o(n.from)):s.gte(e.end,o(n.from));return l(s.or(c,s.and(s.lt(e.start,o(n.from)),u)))},W=(e,t)=>e===``?t:`(${e}) AND (${t})`,G=e=>{if(typeof e!=`string`)return;let t=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00Z`:e);return Number.isNaN(t)?void 0:t},K=(e,t,n,r=m())=>{let i=G(e[t.start]);if(i===void 0)return;let a=H(t,n),o=e=>a?p(e,r):j(e),s=o(i),c=t.end===void 0?void 0:G(e[t.end]),l=c===void 0?s:o(a?c-1:c);return{first:s,last:l<s?s:l}},q=(e,t,n,r,i=m())=>{let a=K(e,t,n,i);return a?r.filter(e=>e>=a.first&&e<=a.last):[]},J=(e,t)=>e.toSorted((e,n)=>(G(e.record[t.start])??0)-(G(n.record[t.start])??0)),Y=(e,t,n,r,i=m())=>{let a=new Map(r.map(e=>[e,[]]));for(let o of J(e,t))for(let e of q(o.record,t,n,r,i))a.get(e).push(o);return a},ie=(e,t,n,r,i,a=m())=>{let o=(M(i)-M(r))/A,s=H(t,n),c=e=>{let t=G(e);if(t!==void 0)return s?new Date(v(t+g(t,a)+o*A,a)).toISOString():N(j(t),o)},l=c(e[t.start]),u=t.end===void 0?void 0:c(e[t.end]);return{...l!==void 0&&{[t.start]:l},...u!==void 0&&{[t.end]:u}}},ae=({heading:e,unit:t,previous:n,today:r,next:a,scales:s,scalesLabel:c,linkTo:l,onView:u})=>{let d=(e,t,n,r,i)=>l?(0,k.jsx)(S,{to:l(e),className:t,"aria-label":n,"aria-current":i?`page`:void 0,children:r}):(0,k.jsx)(`button`,{type:`button`,className:t,"aria-label":n,"aria-pressed":i,onClick:()=>u?.(e),children:r}),f=h({variant:`secondary`,size:`sm`});return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,k.jsx)(`h2`,{className:`text-sm font-medium`,children:e}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1`,children:[d(n,f,_(`previousPeriod`,{unit:t}),(0,k.jsx)(o,{className:`size-3.5`})),d(r,f,_(`today`),_(`today`)),d(a,f,_(`nextPeriod`,{unit:t}),(0,k.jsx)(i,{className:`size-3.5`}))]}),(0,k.jsx)(`span`,{role:`group`,"aria-label":c,className:x.group(),children:s.map(e=>(0,k.jsx)(O.Fragment,{children:d(e.view,x.option(e.current),e.label,e.label,e.current)},e.label))})]})]})},oe=`day:`,X=e=>`${oe}${e}`,Z=(e,t)=>`${e}@${t}`,se=(e,{context:{active:t,collisionRect:n,droppableRects:r,over:i}})=>{let a={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[e.code],o=i?String(i.id).slice(4):t?.data.current?.day;if(a===void 0||!n||o===void 0)return;e.preventDefault();let s=r.get(X(N(o,a)));if(s)return{x:s.left+(s.width-n.width)/2,y:s.top+4}},Q=(e,t,n,r)=>{let i=n.title??y(e,t),a=e.fields[i],o=r.labels[i]??(a?ne(a,r.record[i],t?.fields[i]):``);return o===``?r.key:o},ce=(e,t,n,r)=>{let i=n.record[t.start];if(e.fields[t.start]?.type!==`timestamp`||typeof i!=`string`)return;let a=Date.parse(i);return p(a,m())===r?u(a):void 0},$=({model:e,view:t,display:n,row:i,day:a,className:o})=>{let s=T(e),c=ce(e,n,i,a);return(0,k.jsxs)(S,{to:{kind:`record`,resource:e.name,key:i.key},onClick:()=>s(i.record),className:r(`flex min-w-0 items-baseline gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-xs hover:border-border-strong hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30`,o),children:[c&&(0,k.jsx)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:c}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:Q(e,t,n,i)})]})},le=({movable:e,dragged:t,...n})=>{let{setNodeRef:i,setActivatorNodeRef:a,listeners:o,isDragging:s}=E({id:Z(n.row.key,n.day),data:{row:n.row,day:n.day},disabled:!e});return(0,k.jsx)(`div`,{ref:e=>{i(e),a(e?.querySelector(`a`)??e)},...o,onDragStart:e=>e.preventDefault(),onClickCapture:e=>{t()&&(e.preventDefault(),e.stopPropagation())},className:r(`min-w-0`,e&&`cursor-grab touch-manipulation`,s&&`opacity-40`),children:(0,k.jsx)($,{...n})})},ue=({model:e,display:t,range:n,fields:r,filter:i})=>{let{resources:a,views:o}=d(),s=w({resources:a,views:o,model:e,columns:r,filter:W(i,U(t,e,n)),orderBy:`${t.start} asc`}),c=D(e,s.page,s.key,!0),l=c.more&&!c.loading&&c.rows.length<500;(0,O.useEffect)(()=>{l&&c.loadMore()},[l,c.rows.length]);let u=c.rows.length>500||c.rows.length===500&&c.more;return{rows:c.rows.slice(0,500),capped:u,loading:c.loading,error:c.error}},de=(e,t)=>{let n=new Map(t.map(e=>[e.key,e.patch]));return e.map(e=>n.has(e.key)?{...e,record:{...e.record,...n.get(e.key)}}:e)},fe=(e,t)=>{let n=te(),r=a(),i=f(),[o,s]=(0,O.useState)([]),l=e=>s(t=>t.filter(t=>t.key!==e)),u=C({mutationFn:({row:t,patch:r})=>{let i=typeof t.record.etag==`string`?t.record.etag:`*`;return n.update(e.name,re(e,t.record),r,i)},onMutate:({row:e,patch:t})=>s(n=>[...n.filter(t=>t.key!==e.key),{key:e.key,patch:t}]),onError:(e,{row:t,to:n})=>{l(t.key),r.show({state:`error`,title:_(`couldNotMoveTo`,{to:c(Date.parse(`${n}T00:00:00Z`))}),description:ee(e)})},onSettled:async(t,n,{row:r})=>{await i(e.name),l(r.key)}});return{moves:o,move:(n,r,i)=>u.mutate({row:n,patch:ie(n.record,t,e,r,i),to:i})}};export{V as _,$ as a,R as b,X as c,Y as d,L as f,F as g,P as h,le as i,ae as l,J as m,fe as n,Q as o,B as p,ue as r,se as s,de as t,N as u,K as v,z as y};
2
+ //# debugId=03f77b44-58e7-4300-ab25-c31c996e54f0
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Jr as e}from"./app-DU-Bny4k.js";import{r as t}from"./vendor-t7Q7QbPu.js";var n=(n,r,i,a)=>{let o=t({queryKey:[...i,`display`],enabled:a,initialPageParam:0,queryFn:({pageParam:e})=>r(e),getNextPageParam:(e,t)=>e.rows.length===40&&t.length*40<(t[0]?.total??0)?t.length:void 0}),s=o.data?.pages??[];return{resource:n.name,rows:s.flatMap(t=>t.rows.map(t=>e(n,t))),total:s[0]?.total??0,loading:o.isPending,error:o.error,more:o.hasNextPage,loadMore:()=>void o.fetchNextPage()}};export{n as t};
2
- //# debugId=3b88bad1-a73e-462f-a6ce-19d39b29c77a
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Jr as e}from"./app-Cfc4Mr5v.js";import{r as t}from"./vendor-t7Q7QbPu.js";var n=(n,r,i,a)=>{let o=t({queryKey:[...i,`display`],enabled:a,initialPageParam:0,queryFn:({pageParam:e})=>r(e),getNextPageParam:(e,t)=>e.rows.length===40&&t.length*40<(t[0]?.total??0)?t.length:void 0}),s=o.data?.pages??[];return{resource:n.name,rows:s.flatMap(t=>t.rows.map(t=>e(n,t))),total:s[0]?.total??0,loading:o.isPending,error:o.error,more:o.hasNextPage,loadMore:()=>void o.fetchNextPage()}};export{n as t};
2
+ //# debugId=4f81c60b-7535-455b-a5dc-04a60489cc2e
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Ao as r,Qc as i,Ss as a,Ya as o,_s as s,gs as c,hs as l,ja as u,nl as d,no as f,uc as p}from"./app-Cfc4Mr5v.js";import{o as m}from"./vendor-t7Q7QbPu.js";var h=e(n(),1),g=({invitation:e,t,busy:n,joining:r,onJoin:i})=>{let o=a().organizations?.roles??[],s=e.organizationName??t(`anOrganization`),c=e.appRoles.map(e=>f(o,e)).join(`, `),l=t(`expires`,{date:new Date(e.expiresAt).toLocaleDateString(d(),{dateStyle:`long`})});return(0,h.jsxs)(`li`,{className:`flex flex-col gap-2 px-3 py-2.5 sm:flex-row sm:items-center sm:gap-3`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`span`,{className:`block break-words font-medium`,children:s}),(0,h.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:c?`${c} · ${l}`:l})]}),(0,h.jsx)(p,{variant:`primary`,disabled:n,loading:r,busyLabel:t(`joining`,{name:s}),onClick:i,className:`min-h-10 w-full sm:min-h-0 sm:w-auto`,children:t(`join`,{name:s})})]})},_=e(t(),1),v=({onCreated:e,autoFocus:t=!1})=>{let{session:n}=a(),i=u(),[s,c]=(0,_.useState)(``),[l,d]=(0,_.useState)(!1),{busy:f,error:m,run:g}=o(),v=(0,_.useId)(),y=(0,_.useRef)(null),b=()=>{if(!f){if(s.trim()===``){d(!0),y.current?.focus();return}g(async()=>{await n.organizations.create({name:s.trim()}),e()})}},x=l?i(`nameNeeded`):m;return(0,h.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:e=>{e.preventDefault(),b()},children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,h.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[i(`organizationName`),(0,h.jsx)(r,{ref:y,name:`organization`,autoComplete:`organization`,autoFocus:t,maxLength:200,value:s,invalid:l,"aria-describedby":l?v:void 0,onChange:e=>{c(e.target.value),d(!1)},className:`min-h-6`})]}),x&&(0,h.jsx)(`p`,{id:v,role:`alert`,className:`text-body font-medium text-danger-text`,children:x})]}),(0,h.jsx)(p,{variant:`primary`,type:`submit`,loading:f,busyLabel:i(`creating`),className:`min-h-10`,children:i(`createButton`)})]})},y=e=>{let{session:t}=a(),{busy:n,error:r,run:i}=o(),[s,c]=(0,_.useState)();return{busy:n,error:r,joining:n?s:void 0,join:n=>{c(n),i(async()=>{await t.organizations.acceptMine(n),e()})}}},b=()=>{let{session:e}=a(),t=(0,_.useContext)(l),n=m({queryKey:i.myInvitations,queryFn:()=>e.organizations.myInvitations(),retry:!1});return n.data&&c(n,t)?{state:`ready`,invitations:n.data}:s(n)?{state:`failed`,retry:()=>void n.refetch()}:{state:`loading`}};export{g as i,y as n,v as r,b as t};
2
+ //# debugId=8f4370cc-5218-4e78-b955-1b6fef60b2ad
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Qc as r,Xo as i,Zo as a,_c as o,ko as s,lc as c}from"./app-DU-Bny4k.js";var l=r(`lists`),u=e(n(),1),d=({title:e,description:t,searchLabel:n,placeholder:r,query:d,onQuery:f,list:p,error:m,renderRow:h})=>(0,u.jsxs)(i,{title:e,description:t,children:[(0,u.jsx)(a,{message:m}),(0,u.jsx)(s,{"aria-label":n,placeholder:r,value:d,onChange:e=>f(e.target.value),leading:(0,u.jsx)(o,{className:`size-3.5`}),wrapperClassName:`mb-2`}),(0,u.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[p.found.length,` of `,p.total]}),p.found.length>0&&(0,u.jsx)(`ul`,{className:`divide-y rounded-md border`,children:p.found.map(h)}),p.found.length<p.total&&(0,u.jsx)(c,{className:`mt-3`,loading:p.loading,onClick:()=>void p.more(),children:l(`showMore`)})]}),f=e(t(),1),p=(e,t)=>{let[n,r]=(0,f.useState)([]),[i,a]=(0,f.useState)(0),[o,s]=(0,f.useState)(!1),c=(0,f.useRef)(t);return c.current=t,(0,f.useEffect)(()=>{let n=setTimeout(()=>{s(!0),e(t,0).then(e=>{c.current===t&&(r(e.items),a(e.total),s(!1))},()=>{c.current===t&&(r([]),a(0),s(!1))})},200);return()=>clearTimeout(n)},[e,t]),{found:n,total:i,more:async()=>{let i=t;s(!0);let o=await e(i,n.length).catch(()=>void 0);c.current===i&&(o&&(r(e=>[...e,...o.items]),a(o.total)),s(!1))},loading:o}};export{d as n,p as t};
2
- //# debugId=9b94246c-09d7-498e-8b2f-42a88594a476
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$c as r,Ao as i,Qo as a,Zo as o,uc as s,vc as c}from"./app-Cfc4Mr5v.js";var l=r(`lists`),u=e(n(),1),d=({title:e,description:t,searchLabel:n,placeholder:r,query:d,onQuery:f,list:p,error:m,renderRow:h})=>(0,u.jsxs)(o,{title:e,description:t,children:[(0,u.jsx)(a,{message:m}),(0,u.jsx)(i,{"aria-label":n,placeholder:r,value:d,onChange:e=>f(e.target.value),leading:(0,u.jsx)(c,{className:`size-3.5`}),wrapperClassName:`mb-2`}),(0,u.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[p.found.length,` of `,p.total]}),p.found.length>0&&(0,u.jsx)(`ul`,{className:`divide-y rounded-md border`,children:p.found.map(h)}),p.found.length<p.total&&(0,u.jsx)(s,{className:`mt-3`,loading:p.loading,onClick:()=>void p.more(),children:l(`showMore`)})]}),f=e(t(),1),p=(e,t)=>{let[n,r]=(0,f.useState)([]),[i,a]=(0,f.useState)(0),[o,s]=(0,f.useState)(!1),c=(0,f.useRef)(t);return c.current=t,(0,f.useEffect)(()=>{let n=setTimeout(()=>{s(!0),e(t,0).then(e=>{c.current===t&&(r(e.items),a(e.total),s(!1))},()=>{c.current===t&&(r([]),a(0),s(!1))})},200);return()=>clearTimeout(n)},[e,t]),{found:n,total:i,more:async()=>{let i=t;s(!0);let o=await e(i,n.length).catch(()=>void 0);c.current===i&&(o&&(r(e=>[...e,...o.items]),a(o.total)),s(!1))},loading:o}};export{d as n,p as t};
2
+ //# debugId=30d29baa-d589-4e88-a8d4-78f67e61d48d
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t}from"./react-CuiNlnus.js";import{Ba as n,Va as r,Zc as i,_s as a,ds as o}from"./app-DU-Bny4k.js";import{h as s,o as c}from"./vendor-t7Q7QbPu.js";import{C as l,E as u,M as d,O as f,P as p,S as m,T as h,h as g,t as ee,w as _,y as v}from"./workflows-Bey4jszG.js";var y=()=>({trigger:{manual:{}},stateMachine:{QueryLanguage:`JSONata`,StartAt:``,States:{}}}),b=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return y();let t=e,n=t.stateMachine,r=typeof n?.States==`object`&&n.States!==null&&!Array.isArray(n.States)?n.States:{},i=t.order===`data`?{}:{StartAt:n?.StartAt??``};return{...t,trigger:t.trigger??{manual:{}},stateMachine:{...n,QueryLanguage:`JSONata`,...i,States:r}}},x=e=>b({trigger:e.trigger,order:e.execution_order??`sequence`,stateMachine:e.state_machine,...e.connections?{connections:e.connections}:{},...e.trace?{trace:e.trace}:{}}),S=e=>{let{StartAt:t,...n}=e.stateMachine;return{state_machine:g(e)===`data`?n:e.stateMachine,trigger:e.trigger,execution_order:g(e),connections:e.connections??null,trace:e.trace??null}},C=e=>e.split(`/`),w=(e,t)=>[...e,t].join(`/`),T=e=>{let t=C(e);return{scope:t.slice(0,-1),name:t.at(-1)}},E=(e,t)=>{let n=e.stateMachine;for(let e of t)n=d(n?.States[e]);return n},D=(e,t)=>{let{scope:n,name:r}=T(t);return E(e,n)?.States[r]},O=e=>Object.entries(e.States).flatMap(([e,t])=>{let n=d(t);return[e,...n?.States?O(n):[]]}),k=(e,t,n=[])=>{if(Object.hasOwn(e.States,t))return[...n,t];for(let[r,i]of Object.entries(e.States)){let e=d(i),a=e?.States&&k(e,t,[...n,r]);if(a)return a}},te=e=>e?.Type===`Map`||e?.Type===`Block`,A=e=>typeof e==`object`&&!!e&&!Array.isArray(e),j=e=>{if(!e)return[];let t=[e.anyOf,e.oneOf].find(Array.isArray),n=A(e.properties)?Object.entries(e.properties).filter(e=>A(e[1])):[];if(!t)return n;let r=new Map(n.map(([e,t])=>[e,[t]]));for(let[e,i]of t.filter(A).flatMap(e=>j(e)))n.some(([t])=>t===e)||r.set(e,[...r.get(e)??[],i]);return[...r].map(([e,t])=>[e,t.length===1?t[0]:{anyOf:t}])},M=e=>j(e),N=e=>e===void 0||e===``?`empty`:v(e)?`wired`:p(e)===void 0?A(e)&&Object.values(e).some(e=>p(e)!==void 0)?`made`:`literal`:`expression`,P=e=>`Arguments`in e&&A(e.Arguments)?e.Arguments:{},F=(e,t,n,r)=>{let i=Array.isArray(t.enum)&&t.enum.every(e=>typeof e==`string`)?t.enum:void 0;return{key:e,type:f(t),required:r,value:n,state:N(n),...i&&{options:i}}},ne=(e,t)=>{let n=m(e,t);if(!n)return[];let r=Array.isArray(n.required)?n.required:[],i=P(e);return M(n).map(([e,t])=>F(e,t,i[e],r.includes(e)))},I=e=>{let t=typeof e?.title==`string`?[]:M(e);return t.length===0?[{path:[],type:f(e)}]:t.map(([e,t])=>({path:[e],type:f(t)}))},re=(e,t)=>e.Type===`Task`?I(l(e,t)):e.Type===`Map`?[{path:[],type:f({type:`array`})}]:e.Type===`Block`?[{path:[],type:f(void 0)}]:[],ie=(e,t)=>I(h(e,t)),L=`#status`,R=`#condition`,z={path:[L],type:f(_)},B=e=>({key:R,type:{kinds:[`boolean`]},required:!1,value:e.Condition,state:N(e.Condition)}),V=(e,t,n,r)=>r[0]===`#status`?u(_,r.slice(1)):u(t?l(t,n):h(e,n),r),H=`$trigger`,U=e=>typeof e==`object`&&!!e&&!Array.isArray(e),W=e=>U(e)&&Number.isFinite(e.x)&&Number.isFinite(e.y),G=e=>U(e)?Object.fromEntries(Object.entries(e).flatMap(([e,t])=>W(t)?[[e,{x:t.x,y:t.y}]]:[])):{},K=e=>{let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{t=void 0}let n=U(t)?t:{};return{pins:G(n.pins),simple:G(n.simple)}},q=e=>e.replaceAll(`%`,`%25`).replaceAll(`.`,`%2E`).replace(/^#/,`%23`).replace(/^\$/,`%24`),J=e=>e===``?H:q(T(e).name),ae=e=>e.map(e=>e===`#status`?L:q(e)),oe=(e,t)=>t?.kind===`break`?[J(t.source),...t.path.length===0?[`#break`]:ae(t.path)].join(`.`):t?.kind===`make`?[J(t.target),`#make`,q(t.key)].join(`.`):t?.kind===`select`?[J(t.target),`#select`,q(t.key)].join(`.`):t?.kind===`condition`?[J(t.target),`#when`,...t.at.map(String)].join(`.`):J(e),se=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t)),ce=32,Y={right:24,bottom:24},X=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height,le=(e,t,n)=>{if(![...t.keys()].some(t=>e.has(t)))return e;let r=new Map([...e].map(([e,n])=>[e,{...n,...t.get(e)}])),i=new Map;for(let e of r.keys())i.set(n(e),[...i.get(n(e))??[],e]);let a=e=>e===void 0?0:a(n(e))+1,o=new Set;for(let e of[...i.keys()].sort((e,t)=>a(t)-a(e))){let n=i.get(e);if(n.some(e=>t.has(e)||o.has(e))){let e=n.filter(e=>t.has(e)).map(e=>r.get(e)),i=n.filter(e=>!t.has(e)).map(e=>r.get(e)).sort((e,t)=>e.y-t.y||e.x-t.x);for(let t of i){let n=e.find(e=>X(t,e));for(;n;)t.y=n.y+n.height+ce,n=e.find(e=>X(t,e));e.push(t)}}let a=e===void 0?void 0:r.get(e);if(!a)continue;let s=Math.max(a.width,...n.map(e=>r.get(e)).map(e=>e.x+e.width+Y.right)),c=Math.max(a.height,...n.map(e=>r.get(e)).map(e=>e.y+e.height+Y.bottom));(s!==a.width||c!==a.height)&&(Object.assign(a,{width:s,height:c}),o.add(e))}return r},Z=e(t(),1),Q=1e3,ue=e=>({...e,id:`${e.scope}#${e.seq}`,resume_at:e.resumeAt??null,started_at:e.startedAt,finished_at:e.finishedAt,duration_ms:Date.parse(e.finishedAt)-Date.parse(e.startedAt)}),de=(e,{from:t,steps:n,revision:r})=>({rows:[...e.slice(0,t),...n.map(ue)],revision:r}),$=(e,t)=>{let n=o(),r=s(),a=i.workflowRunTrace(e??``),l=c({queryKey:a,queryFn:async()=>{let t=r.getQueryData(a);return de(t?.rows??[],await n.workflowRunTrace(e,t&&{after:t.rows.length,revision:t.revision}))},select:e=>e.rows,enabled:e!==void 0,refetchInterval:t?Q:!1}),u=(0,Z.useRef)(t),{refetch:d}=l;return(0,Z.useEffect)(()=>{let n=u.current&&!t;u.current=t,n&&e!==void 0&&d()},[t,e,d]),l},fe=new Set([`queued`,`running`,`waiting`]),pe=e=>{let t=s();(0,Z.useEffect)(()=>{if(!e)return;let n=r(t,()=>!1),i=setInterval(()=>n.changed([`workflow_runs`]),Q);return()=>{clearInterval(i),n.stop()}},[e,t])},me=e=>{let t=s(),n=(0,Z.useContext)(a),i=(0,Z.useRef)(e);(0,Z.useEffect)(()=>{let a=i.current&&!e;i.current=e,a&&r(t,()=>n?.paused()??!1).changed([`workflows`])},[e,t,n])},he=(e,t)=>{if(!e)return;let n=typeof t==`string`?k(e.stateMachine,t):void 0,r=n&&D(e,n.join(`/`));return n&&r?.Type===`Block`?{within:n,startAt:r.Processor.StartAt}:{within:[],startAt:e.stateMachine.StartAt}},ge=e=>{let t=n(`workflow_runs`,e??``,e!==void 0),r=t.data?.record,i=r?.workflow_id!=null&&r.version!=null,a=n(`workflow_versions`,[String(r?.workflow_id??``),Number(r?.version??0)],i),o=fe.has(String(r?.status)),s=typeof r?.test_step==`string`?ee(r.test_step):a.data?x(a.data.record):void 0,c=$(e,o);return pe(o),me(o),{id:e,run:r,stored:t.data,definition:s,place:he(s,r?.block_state),steps:c.data??[],going:o,error:t.error??a.error??c.error}};export{k as C,D as E,w as S,T,O as _,se as a,te as b,B as c,F as d,ne as f,ie as g,re as h,le as i,M as l,z as m,$ as n,K as o,L as p,oe as r,R as s,ge as t,V as u,b as v,x as w,E as x,S as y};
2
- //# debugId=2f333618-b971-4f2a-911f-796d930b05a2
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t}from"./react-CuiNlnus.js";import{Ha as n,Qc as r,Va as i,fs as a,vs as o}from"./app-Cfc4Mr5v.js";import{h as s,o as c}from"./vendor-t7Q7QbPu.js";import{C as l,E as u,M as d,O as f,P as p,S as m,T as h,h as g,t as ee,w as _,y as v}from"./workflows-Bey4jszG.js";var y=()=>({trigger:{manual:{}},stateMachine:{QueryLanguage:`JSONata`,StartAt:``,States:{}}}),b=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return y();let t=e,n=t.stateMachine,r=typeof n?.States==`object`&&n.States!==null&&!Array.isArray(n.States)?n.States:{},i=t.order===`data`?{}:{StartAt:n?.StartAt??``};return{...t,trigger:t.trigger??{manual:{}},stateMachine:{...n,QueryLanguage:`JSONata`,...i,States:r}}},x=e=>b({trigger:e.trigger,order:e.execution_order??`sequence`,stateMachine:e.state_machine,...e.connections?{connections:e.connections}:{},...e.trace?{trace:e.trace}:{}}),S=e=>{let{StartAt:t,...n}=e.stateMachine;return{state_machine:g(e)===`data`?n:e.stateMachine,trigger:e.trigger,execution_order:g(e),connections:e.connections??null,trace:e.trace??null}},C=e=>e.split(`/`),w=(e,t)=>[...e,t].join(`/`),T=e=>{let t=C(e);return{scope:t.slice(0,-1),name:t.at(-1)}},E=(e,t)=>{let n=e.stateMachine;for(let e of t)n=d(n?.States[e]);return n},D=(e,t)=>{let{scope:n,name:r}=T(t);return E(e,n)?.States[r]},O=e=>Object.entries(e.States).flatMap(([e,t])=>{let n=d(t);return[e,...n?.States?O(n):[]]}),k=(e,t,n=[])=>{if(Object.hasOwn(e.States,t))return[...n,t];for(let[r,i]of Object.entries(e.States)){let e=d(i),a=e?.States&&k(e,t,[...n,r]);if(a)return a}},te=e=>e?.Type===`Map`||e?.Type===`Block`,A=e=>typeof e==`object`&&!!e&&!Array.isArray(e),j=e=>{if(!e)return[];let t=[e.anyOf,e.oneOf].find(Array.isArray),n=A(e.properties)?Object.entries(e.properties).filter(e=>A(e[1])):[];if(!t)return n;let r=new Map(n.map(([e,t])=>[e,[t]]));for(let[e,i]of t.filter(A).flatMap(e=>j(e)))n.some(([t])=>t===e)||r.set(e,[...r.get(e)??[],i]);return[...r].map(([e,t])=>[e,t.length===1?t[0]:{anyOf:t}])},M=e=>j(e),N=e=>e===void 0||e===``?`empty`:v(e)?`wired`:p(e)===void 0?A(e)&&Object.values(e).some(e=>p(e)!==void 0)?`made`:`literal`:`expression`,P=e=>`Arguments`in e&&A(e.Arguments)?e.Arguments:{},F=(e,t,n,r)=>{let i=Array.isArray(t.enum)&&t.enum.every(e=>typeof e==`string`)?t.enum:void 0;return{key:e,type:f(t),required:r,value:n,state:N(n),...i&&{options:i}}},ne=(e,t)=>{let n=m(e,t);if(!n)return[];let r=Array.isArray(n.required)?n.required:[],i=P(e);return M(n).map(([e,t])=>F(e,t,i[e],r.includes(e)))},I=e=>{let t=typeof e?.title==`string`?[]:M(e);return t.length===0?[{path:[],type:f(e)}]:t.map(([e,t])=>({path:[e],type:f(t)}))},re=(e,t)=>e.Type===`Task`?I(l(e,t)):e.Type===`Map`?[{path:[],type:f({type:`array`})}]:e.Type===`Block`?[{path:[],type:f(void 0)}]:[],ie=(e,t)=>I(h(e,t)),L=`#status`,R=`#condition`,z={path:[L],type:f(_)},B=e=>({key:R,type:{kinds:[`boolean`]},required:!1,value:e.Condition,state:N(e.Condition)}),V=(e,t,n,r)=>r[0]===`#status`?u(_,r.slice(1)):u(t?l(t,n):h(e,n),r),H=`$trigger`,U=e=>typeof e==`object`&&!!e&&!Array.isArray(e),W=e=>U(e)&&Number.isFinite(e.x)&&Number.isFinite(e.y),G=e=>U(e)?Object.fromEntries(Object.entries(e).flatMap(([e,t])=>W(t)?[[e,{x:t.x,y:t.y}]]:[])):{},K=e=>{let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{t=void 0}let n=U(t)?t:{};return{pins:G(n.pins),simple:G(n.simple)}},q=e=>e.replaceAll(`%`,`%25`).replaceAll(`.`,`%2E`).replace(/^#/,`%23`).replace(/^\$/,`%24`),J=e=>e===``?H:q(T(e).name),ae=e=>e.map(e=>e===`#status`?L:q(e)),oe=(e,t)=>t?.kind===`break`?[J(t.source),...t.path.length===0?[`#break`]:ae(t.path)].join(`.`):t?.kind===`make`?[J(t.target),`#make`,q(t.key)].join(`.`):t?.kind===`select`?[J(t.target),`#select`,q(t.key)].join(`.`):t?.kind===`condition`?[J(t.target),`#when`,...t.at.map(String)].join(`.`):J(e),se=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t)),ce=32,Y={right:24,bottom:24},X=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height,le=(e,t,n)=>{if(![...t.keys()].some(t=>e.has(t)))return e;let r=new Map([...e].map(([e,n])=>[e,{...n,...t.get(e)}])),i=new Map;for(let e of r.keys())i.set(n(e),[...i.get(n(e))??[],e]);let a=e=>e===void 0?0:a(n(e))+1,o=new Set;for(let e of[...i.keys()].sort((e,t)=>a(t)-a(e))){let n=i.get(e);if(n.some(e=>t.has(e)||o.has(e))){let e=n.filter(e=>t.has(e)).map(e=>r.get(e)),i=n.filter(e=>!t.has(e)).map(e=>r.get(e)).sort((e,t)=>e.y-t.y||e.x-t.x);for(let t of i){let n=e.find(e=>X(t,e));for(;n;)t.y=n.y+n.height+ce,n=e.find(e=>X(t,e));e.push(t)}}let a=e===void 0?void 0:r.get(e);if(!a)continue;let s=Math.max(a.width,...n.map(e=>r.get(e)).map(e=>e.x+e.width+Y.right)),c=Math.max(a.height,...n.map(e=>r.get(e)).map(e=>e.y+e.height+Y.bottom));(s!==a.width||c!==a.height)&&(Object.assign(a,{width:s,height:c}),o.add(e))}return r},Z=e(t(),1),Q=1e3,ue=e=>({...e,id:`${e.scope}#${e.seq}`,resume_at:e.resumeAt??null,started_at:e.startedAt,finished_at:e.finishedAt,duration_ms:Date.parse(e.finishedAt)-Date.parse(e.startedAt)}),de=(e,{from:t,steps:n,revision:r})=>({rows:[...e.slice(0,t),...n.map(ue)],revision:r}),$=(e,t)=>{let n=a(),i=s(),o=r.workflowRunTrace(e??``),l=c({queryKey:o,queryFn:async()=>{let t=i.getQueryData(o);return de(t?.rows??[],await n.workflowRunTrace(e,t&&{after:t.rows.length,revision:t.revision}))},select:e=>e.rows,enabled:e!==void 0,refetchInterval:t?Q:!1}),u=(0,Z.useRef)(t),{refetch:d}=l;return(0,Z.useEffect)(()=>{let n=u.current&&!t;u.current=t,n&&e!==void 0&&d()},[t,e,d]),l},fe=new Set([`queued`,`running`,`waiting`]),pe=e=>{let t=s();(0,Z.useEffect)(()=>{if(!e)return;let r=n(t,()=>!1),i=setInterval(()=>r.changed([`workflow_runs`]),Q);return()=>{clearInterval(i),r.stop()}},[e,t])},me=e=>{let t=s(),r=(0,Z.useContext)(o),i=(0,Z.useRef)(e);(0,Z.useEffect)(()=>{let a=i.current&&!e;i.current=e,a&&n(t,()=>r?.paused()??!1).changed([`workflows`])},[e,t,r])},he=(e,t)=>{if(!e)return;let n=typeof t==`string`?k(e.stateMachine,t):void 0,r=n&&D(e,n.join(`/`));return n&&r?.Type===`Block`?{within:n,startAt:r.Processor.StartAt}:{within:[],startAt:e.stateMachine.StartAt}},ge=e=>{let t=i(`workflow_runs`,e??``,e!==void 0),n=t.data?.record,r=n?.workflow_id!=null&&n.version!=null,a=i(`workflow_versions`,[String(n?.workflow_id??``),Number(n?.version??0)],r),o=fe.has(String(n?.status)),s=typeof n?.test_step==`string`?ee(n.test_step):a.data?x(a.data.record):void 0,c=$(e,o);return pe(o),me(o),{id:e,run:n,stored:t.data,definition:s,place:he(s,n?.block_state),steps:c.data??[],going:o,error:t.error??a.error??c.error}};export{k as C,D as E,w as S,T,O as _,se as a,te as b,B as c,F as d,ne as f,ie as g,re as h,le as i,M as l,z as m,$ as n,K as o,L as p,oe as r,R as s,ge as t,V as u,b as v,x as w,E as x,S as y};
2
+ //# debugId=443346ce-32d5-4eb7-95b0-10b00cb0464a
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Ba as e,Br as t,Ir as n,Q as r}from"./app-DU-Bny4k.js";import{o as i,t as a,w as o}from"./use-run-trace-vMzYYuXG.js";var s=`workflows`,c=({workflow:e,version:t,run:n})=>({kind:`record`,resource:s,key:e,...t!==void 0&&{version:t},...n&&{run:n}}),l=(e,t,n)=>c({workflow:e,...t!==n&&{version:t}}),u=(e,t,n,r)=>c({workflow:e,...n!==r&&{version:n},run:t}),d=({workflow:e,version:t},n)=>t===void 0?c({workflow:e}):l(e,t,n),f=e=>e==null?void 0:Number(e),p=()=>{let{address:e}=t(),n=r();if(n&&e?.kind===`record`)return{workflow:n.key,...e.version!==void 0&&{version:e.version},...e.run&&{run:e.run}}},m=t=>{let r=e(s,t.workflow),c=f(r.data?.record.version),l=f(r.data?.record.enabled_version),u=`workflow_id = ${JSON.stringify(t.workflow)}`,d=n(`workflow_versions`,{filter:u,orderBy:`version desc`,pageSize:100,fields:[`version`,`saved_at`]}),p=n(`workflow_runs`,{filter:`${u} AND isNull(block_of)`,orderBy:`created_at desc`,pageSize:20,fields:[`id`,`status`,`version`,`created_at`,`duration_ms`,`input`,`started_by`,`rerun_of`,`replay`,`error`]}),m=a(t.run),h=t.version,g=e(`workflow_versions`,[t.workflow,h??0],h!==void 0);return{latest:c,enabled:l,versions:d.items.map(e=>({version:Number(e.version),savedAt:String(e.saved_at)})),runs:p.items,trace:m,shown:h,pastDefinition:g.data&&o(g.data.record),pastLayout:g.data&&i(g.data.record.layout),versionsError:d.error,runsError:p.error,pastError:g.error}};export{l as a,u as i,p as n,c as o,d as r,s,m as t};
2
- //# debugId=da738c32-3801-46b2-b421-e1a7752856a7
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Br as e,Ir as t,Q as n,Va as r}from"./app-Cfc4Mr5v.js";import{o as i,t as a,w as o}from"./use-run-trace-BEM0bOMt.js";var s=`workflows`,c=({workflow:e,version:t,run:n})=>({kind:`record`,resource:s,key:e,...t!==void 0&&{version:t},...n&&{run:n}}),l=(e,t,n)=>c({workflow:e,...t!==n&&{version:t}}),u=(e,t,n,r)=>c({workflow:e,...n!==r&&{version:n},run:t}),d=({workflow:e,version:t},n)=>t===void 0?c({workflow:e}):l(e,t,n),f=e=>e==null?void 0:Number(e),p=()=>{let{address:t}=e(),r=n();if(r&&t?.kind===`record`)return{workflow:r.key,...t.version!==void 0&&{version:t.version},...t.run&&{run:t.run}}},m=e=>{let n=r(s,e.workflow),c=f(n.data?.record.version),l=f(n.data?.record.enabled_version),u=`workflow_id = ${JSON.stringify(e.workflow)}`,d=t(`workflow_versions`,{filter:u,orderBy:`version desc`,pageSize:100,fields:[`version`,`saved_at`]}),p=t(`workflow_runs`,{filter:`${u} AND isNull(block_of)`,orderBy:`created_at desc`,pageSize:20,fields:[`id`,`status`,`version`,`created_at`,`duration_ms`,`input`,`started_by`,`rerun_of`,`replay`,`error`]}),m=a(e.run),h=e.version,g=r(`workflow_versions`,[e.workflow,h??0],h!==void 0);return{latest:c,enabled:l,versions:d.items.map(e=>({version:Number(e.version),savedAt:String(e.saved_at)})),runs:p.items,trace:m,shown:h,pastDefinition:g.data&&o(g.data.record),pastLayout:g.data&&i(g.data.record.layout),versionsError:d.error,runsError:p.error,pastError:g.error}};export{l as a,u as i,p as n,c as o,d as r,s,m as t};
2
+ //# debugId=e905a70f-62c9-4897-beaf-e6616ab25ce9
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{Qc as e,Zc as t,ds as n}from"./app-DU-Bny4k.js";import{o as r}from"./vendor-t7Q7QbPu.js";var i=e(`app/field-types/workflow`),a=()=>{let e=n();return r({queryKey:t.workflowTypes,queryFn:()=>e.workflowTypes()})};export{i as n,a as t};
2
- //# debugId=62f2ee36-8d0f-4576-b724-0c67972448ab
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$c as e,Qc as t,fs as n}from"./app-Cfc4Mr5v.js";import{o as r}from"./vendor-t7Q7QbPu.js";var i=e(`app/field-types/workflow`),a=()=>{let e=n();return r({queryKey:t.workflowTypes,queryFn:()=>e.workflowTypes()})};export{i as n,a as t};
2
+ //# debugId=5ce92768-3fa6-44a9-ae58-e255a7b1ab59
@@ -1,4 +1,4 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$o as r,So as i,Uc as a,V as o,Wc as s,eu as c,ko as l,lc as u,pc as d,ro as f}from"./app-DU-Bny4k.js";import{t as p}from"./circle-alert-COV0WNyG.js";import{t as m}from"./layout-grid-BTGS8Vdw.js";import{E as h,M as g,O as _,P as v,S as ee,_ as y,b as te,c as b,d as x,g as S,h as ne,j as re,k as C,l as w,m as T,o as E,u as D,v as O,x as k,y as ie}from"./workflows-Bey4jszG.js";import{C as ae,S as A,a as oe,b as j,c as M,d as N,f as se,g as ce,h as le,i as ue,l as de,m as fe,o as pe,p as P,r as me,s as he,u as ge}from"./use-run-trace-vMzYYuXG.js";import{n as F}from"./use-workflow-types-Bi8u42jQ.js";import{E as _e,a as I}from"./lib-xyflow-system-hojcPWkY.js";import{a as ve,c as ye,i as be,l as xe,n as Se,o as Ce,r as L,s as we,t as Te,u as Ee}from"./lib-xyflow-react-CuNAzocq.js";import{t as De}from"./use-elk-u1Ql5AOs.js";var Oe={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};Oe.node;var ke=a(Oe),R=e(t(),1),Ae={"app:http":()=>F(`stepHttp`),"app:records.create":()=>F(`stepRecordsCreate`),"app:records.update":()=>F(`stepRecordsUpdate`),"app:records.get":()=>F(`stepRecordsGet`),"app:records.list":()=>F(`stepRecordsList`),"app:mail.send":()=>F(`stepMailSend`),"app:mail.template":()=>F(`stepMailTemplate`),"app:piece":()=>F(`stepPiece`)},je=(e,t)=>Ae[e]?.()??t??e,Me=(e,t)=>{let n=je(e,t),r=T(e);return r?F(`stepTypeVersion`,{type:n,version:r.version}):n},Ne={Pass:()=>F(`typePass`),Choice:()=>F(`typeChoice`),Wait:()=>F(`typeWait`),Map:()=>F(`typeMap`),Block:()=>F(`typeBlock`),Succeed:()=>F(`typeSucceed`),Fail:()=>F(`typeFail`)},Pe=e=>Ne[e]?.()??e,Fe=(e,t)=>{if(e.Type!==`Task`)return Pe(e.Type);let{type:n,waits:r}=C(String(e.Resource)),i=je(n,t?.step_types.find(e=>e.id===n)?.label);return r?F(`stepTypeWaits`,{type:i}):i},Ie={url:()=>F(`inputUrl`),method:()=>F(`inputMethod`),headers:()=>F(`inputHeaders`),query:()=>F(`inputQuery`),body:()=>F(`inputBody`),response:()=>F(`inputResponse`),resource:()=>F(`inputResource`),data:()=>F(`inputData`),key:()=>F(`inputKey`),filter:()=>F(`inputFilter`),order_by:()=>F(`inputOrderBy`),limit:()=>F(`inputLimit`),to:()=>F(`inputTo`),subject:()=>F(`inputSubject`),text:()=>F(`inputText`),html:()=>F(`inputHtml`),attachments:()=>F(`inputAttachments`),piece:()=>F(`inputPiece`),action:()=>F(`inputAction`),connection:()=>F(`inputConnection`),props:()=>F(`inputProps`),when:()=>F(`inputWhen`),body_schema:()=>F(`inputBodySchema`)},Le=(e,t)=>Ie[e]?.()??t??e,Re={manual:()=>F(`triggerManual`),"app:record":()=>F(`triggerRecord`)},ze=(e,t)=>Re[e]?.()??t??e,Be=e=>Object.keys(e??{})[0],Ve=(e,t)=>{let n=Be(e);return n===void 0?F(`triggerUnknown`):ze(n,t?.triggers.find(e=>e.id===n)?.label)},He={succeeded:()=>F(`traceSucceeded`),caught:()=>F(`traceCaught`),retrying:()=>F(`traceRetrying`),failed:()=>F(`traceFailed`),current:()=>F(`traceCurrent`)},Ue=e=>He[e](),We=(e,t)=>t?.step_types.find(t=>t.id===C(e.Resource).type)?.cache,Ge=(e,t)=>e.Type===`Task`&&e.Cache===!0&&We(e,t)?.choice===`discouraged`,Ke=(e,t)=>{let n=We(e,t);if(n?.choice!==`hidden`)return n?.choice===`switch`?{on:e.Cache??n.default===!0,forces:!1,offValue:!1,disclaimer:void 0}:{on:e.Cache===!0,forces:!0,offValue:void 0,disclaimer:n?.choice===`discouraged`?n.disclaimer:void 0}},z=e=>encodeURIComponent(e),qe=e=>e.map(e=>`/${z(e)}`).join(``),Je=e=>e===``?[]:e.split(`/`).slice(1).map(decodeURIComponent),Ye=(e,t)=>`break:${z(e)}|${qe(t)}`,Xe=(e,t)=>`make:${z(e)}|${z(t)}`,Ze=(e,t)=>`when:${z(e)}|${t.join(`/`)}`,Qe=(e,t)=>`select:${z(e)}|${z(t)}`,B=e=>`in:${z(e)}`,V=e=>`out:${qe(e)}`,$e=`break-in`,et=`make-out`,tt=`condition-out`,nt=`select-out`,rt=`value`,it=e=>e?.startsWith(`in:`)?decodeURIComponent(e.slice(3)):void 0,at=e=>e?.startsWith(`out:`)?Je(e.slice(4)):void 0,H=e(n(),1),ot=(e,t)=>{let n=e.pure.find(e=>e.id===t.target),r=it(t.targetHandle);return n?.kind===`condition`&&r!==void 0?{step:n.target,at:[...n.at,Number(r)]}:void 0},st=e=>e.kind===`condition`?{step:e.target,at:e.at}:void 0,ct=(e,t)=>{for(let n=0;n<Math.min(e.length,t.length);n++)if(e[n]!==t[n])return e[n]-t[n];return e.length-t.length},lt=(e,t,n)=>{let r=new Map,i=[];for(let e of t){let t=n(e);if(!t){i.push(e);continue}let a=`step:${t.step}`;r.has(a)||(r.set(a,[]),i.push(a)),r.get(a).push({removal:e,at:t.at})}return i.flatMap(e=>typeof e==`string`&&r.has(e)?r.get(e).toSorted((e,t)=>ct(t.at,e.at)).map(({removal:e})=>e):[e])},ut=e=>e.Type===`Choice`&&Array.isArray(e.Choices)?e.Choices:[],dt=e=>`Catch`in e&&Array.isArray(e.Catch)?e.Catch:[],ft=(e,t,n,r)=>{let i=A(t,n),a=(n,r,a,o)=>Object.hasOwn(e.States,a)?[{id:`${i}\n${r}`,kind:n,source:i,target:A(t,a),field:r,...o!==void 0&&{label:o}}]:[];return[...`Next`in r&&typeof r.Next==`string`?a(`next`,`Next`,r.Next):[],...ut(r).flatMap((e,t)=>a(`rule`,`Choices[${t}].Next`,e.Next,e.Condition)),...r.Type===`Choice`&&typeof r.Default==`string`?a(`default`,`Default`,r.Default):[],...dt(r).flatMap((e,t)=>e.Next===void 0?[]:a(`catch`,`Catch[${t}].Next`,e.Next,Array.isArray(e.ErrorEquals)?e.ErrorEquals.join(`, `):void 0))]},pt=(e,t)=>{let n=t.length>0?t.join(`/`):void 0,r=Object.entries(e.States).map(([r,i])=>{let a={kind:`state`,id:A(t,r),name:r,state:i,scope:t,...n!==void 0&&{parent:n},first:e.StartAt===r},o=g(i),s=o?.States?pt(o,[...t,r]):{nodes:[],edges:[]};return{nodes:[a,...s.nodes],edges:[...ft(e,t,r,i),...s.edges]}});return{nodes:r.flatMap(e=>e.nodes),edges:r.flatMap(e=>e.edges)}},mt=(e,t,n)=>[...y(e)].flatMap(([r,i])=>{let a=A(t,r),o=[...S(i)].map(e=>{let n=i.data.has(e)?`reads`:`status`;return{id:`${A(t,e)}\n${n}\n${a}`,kind:n,source:A(t,e),target:a,field:n}}),s=g(e.States[r]),c=s?.States?mt(s,[...t,r],!1):[];return[...n&&o.length===0?[{id:`\nStart\n${a}`,kind:`start`,source:``,target:a,field:`StartAt`}]:[],...o,...c]}),ht=e=>{let t=e.stateMachine,n=pt(t,[]);if(ne(e)===`data`)return{nodes:[{kind:`trigger`,id:``,trigger:e.trigger},...n.nodes.map(e=>e.kind===`state`?{...e,first:!1}:e)],edges:mt(t,[],!0)};let r=t.StartAt!==void 0&&Object.hasOwn(t.States,t.StartAt)?[{id:`
2
- StartAt`,kind:`start`,source:``,target:t.StartAt,field:`StartAt`}]:[];return{nodes:[{kind:`trigger`,id:``,trigger:e.trigger},...n.nodes],edges:[...r,...n.edges]}},U={width:224,height:64},gt=(e,t)=>`${e}\u0000${t}`,_t={"elk.algorithm":`layered`,"elk.direction":`RIGHT`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.layered.spacing.nodeNodeBetweenLayers":`72`,"elk.spacing.nodeNode":`32`,"elk.edgeLabels.inline":`false`},vt={"elk.layered.layering.strategy":`LONGEST_PATH`},yt={"elk.padding":`[top=48,left=24,bottom=24,right=24]`},bt=e=>e.kind===`state`&&j(e.state),xt=(e,t={})=>{let n=e=>{let n=t.sizes?.get(e)??U,r=t.ports?.get(e);return r?.length?{id:e,...n,layoutOptions:{"elk.portConstraints":`FIXED_POS`},ports:r.map(t=>({id:gt(e,t.handle),x:t.side===`in`?0:n.width,y:t.y,width:0,height:0,layoutOptions:{"elk.port.side":t.side===`in`?`WEST`:`EAST`}}))}:{id:e,...n}},r=(e,n)=>n!==void 0&&t.ports?.get(e)?.some(e=>e.handle===n)?gt(e,n):e,i=e=>(t.pure??[]).filter(t=>t.parent===e).map(e=>n(e.id)),a=t=>{if(!bt(t))return n(t.id);let r=e.nodes.filter(e=>e.kind===`state`&&e.parent===t.id);return{id:t.id,layoutOptions:yt,children:[...r.map(a),...i(t.id)],edges:s(t.id)}},o=n=>{let r=t.pure?.find(e=>e.id===n);if(r)return r.parent;let i=e.nodes.find(e=>e.id===n);return i?.kind===`state`?i.parent:void 0},s=n=>[...e.edges.filter(e=>o(e.target)===n).map(e=>({id:e.id,sources:[e.source],targets:[e.target]})),...(t.wires??[]).filter(e=>o(e.target)===n&&o(e.source)===n).map(e=>({id:e.id,sources:[r(e.source,e.sourceHandle)],targets:[r(e.target,e.targetHandle)]}))],c=e.nodes.filter(e=>e.kind===`trigger`||e.parent===void 0);return{id:`root`,layoutOptions:t.dataOrder?{..._t,...vt}:_t,children:[...c.map(a),...i(void 0)],edges:s(void 0)}},St=e=>{let t=new Map,n=e=>{for(let r of e.children??[])t.set(r.id,{x:r.x??0,y:r.y??0,width:r.width??U.width,height:r.height??U.height}),n(r)};return n(e),t},Ct=async(e,t)=>St(await e.layout(t)),wt=24,Tt=8,Et=(e,t)=>{let n=t?[...e]:e.filter(e=>e.required||e.state!==`empty`);return{shown:n,folded:e.length-n.length}},Dt=(e,t,n,r=52)=>r+Math.max(e,typeof t==`number`?t:t.length)*26+(n?wt:0)+Tt,Ot={string:()=>F(`typeString`),integer:()=>F(`typeInteger`),number:()=>F(`typeNumber`),boolean:()=>F(`typeBoolean`),object:()=>F(`typeObject`),array:()=>F(`typeArray`),null:()=>F(`typeNull`),any:()=>F(`typeAny`)},W=e=>e.title===void 0?e.kinds===`any`?Ot.any():e.kinds.map(e=>Ot[e]()).reduce((e,t)=>F(`typeOr`,{first:e,second:t})):e.title,G=e=>e.kinds===`any`?`any`:e.kinds[0],kt={status:()=>F(`outputStatus`),headers:()=>F(`outputHeaders`),body:()=>F(`outputBody`),record:()=>F(`outputRecord`),resource:()=>F(`outputResource`),key:()=>F(`outputKey`),records:()=>F(`outputRecords`),message_id:()=>F(`outputMessageId`)},At=(e,t=!1,n=!1)=>{if(e.length===0)return F(t?`pinRunInput`:`pinResult`);if(e.length===1&&e[0]===`#status`)return F(`stepStatusType`);let r=e.at(-1);return n||!Object.hasOwn(kt,r)?r:kt[r]()},jt=e=>e===`#condition`?F(`onlyWhen`):Le(e),Mt={"=":()=>F(`conditionEquals`),"!=":()=>F(`conditionNotEquals`),">":()=>F(`conditionGreater`),"<":()=>F(`conditionLess`),matches:()=>F(`conditionMatches`),and:()=>F(`conditionAnd`),or:()=>F(`conditionOr`),not:()=>F(`conditionNot`),expression:()=>F(`conditionExpression`)},Nt=e=>Mt[e](),Pt=({part:e})=>Nt(e.kind===`compare`||e.kind===`logic`?e.op:e.kind),Ft={SUCCEEDED:()=>F(`statusSucceeded`),FAILED:()=>F(`statusFailed`),TIMED_OUT:()=>F(`statusTimedOut`),ABORTED:()=>F(`statusAborted`),SKIPPED:()=>F(`statusSkipped`)},It=e=>Object.hasOwn(Ft,e)?Ft[e]():e,Lt=34,Rt=280,zt=8,Bt=(e,t)=>e.kind===`condition`?{shown:e.inputs,folded:0}:e.kind===`make`?Et(e.inputs,t||e.inputs.length<=zt):{shown:[],folded:0},Vt=(e,t,n)=>{let r=new Set(t.filter(t=>t.source===e.id).map(e=>e.sourceHandle)),i=e.outputs.filter(e=>r.has(V(e.path))),a=i.length>0&&i.length<e.outputs.length;return n||!a?{shown:e.outputs,folded:0,foldable:a}:{shown:i,folded:e.outputs.length-i.length,foldable:a}},Ht=e=>106+e*26+8,Ut=(e,t,n)=>{let r=new Map;for(let i of e.nodes){if(i.kind===`state`&&j(i.state))continue;let{shown:e,folded:a}=Et(t.inputs.get(i.id)??[],n.has(i.id));r.set(i.id,{width:296,height:Dt(e.length,t.outputs.get(i.id)??[],a>0||n.has(i.id))})}for(let e of t.pure){if(e.kind===`condition`&&e.part.kind===`expression`){r.set(e.id,{width:216,height:Ht(e.inputs.length)});continue}if(e.kind===`select`){r.set(e.id,{width:Rt,height:Dt(e.part.cases.length+3,1,!1,Lt)});continue}if(e.kind===`break`){let i=Vt(e,t.edges,n.has(e.id));r.set(e.id,{width:216,height:Dt(0,i.shown.length,i.foldable,Lt)});continue}let{shown:i,folded:a}=Bt(e,n.has(e.id));r.set(e.id,{width:216,height:Dt(i.length,1,e.kind===`make`&&(a>0||n.has(e.id)),Lt)})}return r},Wt=(e,t)=>e+t*26+13,Gt=13,Kt=38,qt=(e,t,n)=>{let r=new Map;for(let i of e.nodes){if(i.kind===`state`&&j(i.state))continue;let{shown:e}=Et(t.inputs.get(i.id)??[],n.has(i.id));r.set(i.id,[...e.map((e,t)=>({handle:B(e.key),side:`in`,y:Wt(52,t)})),...(t.outputs.get(i.id)??[]).map((e,t)=>({handle:V(e.path),side:`out`,y:Wt(52,t)}))])}for(let e of t.pure){let i=(e,t=Kt)=>e.map((e,n)=>({handle:B(e.key),side:`in`,y:Wt(t,n)}));if(e.kind===`break`){let{shown:i}=Vt(e,t.edges,n.has(e.id));r.set(e.id,[{handle:$e,side:`in`,y:Gt},...i.map((e,t)=>({handle:V(e.path),side:`out`,y:Wt(Kt,t)}))])}else if(e.kind===`make`)r.set(e.id,[{handle:et,side:`out`,y:Gt},...i(Bt(e,n.has(e.id)).shown)]);else if(e.kind===`select`)r.set(e.id,[{handle:nt,side:`out`,y:Gt},...i(e.inputs)]);else{let t=e.part.kind===`expression`?Kt+64+4:Kt;r.set(e.id,[{handle:tt,side:`out`,y:Gt},...i(e.inputs,t)])}}return r},Jt=(e,t)=>{let n=e.nodes.find(e=>e.id===(t.kind===`break`?t.source:t.target));return n?.kind===`state`?n.parent:void 0},Yt=`trigger`,K=e=>e===``?Yt:`state:${e}`,q=e=>e!==Yt&&!e.startsWith(`state:`),J=e=>e===Yt?``:e.startsWith(`state:`)?e.slice(6):e,Xt=(e,t,n)=>{let{shown:r,folded:i}=Et(e.inputs.get(t)??[],n);return{inputs:r,outputs:e.outputs.get(t)??[],folded:i,open:n}},Zt=(e,t,n,r,i,a,o,s,c=!1)=>e.nodes.map(e=>{let l=t?.get(e.id)??{x:0,y:0,...U},u=e.kind===`state`?e.parent:void 0,d=e.kind===`trigger`?Ve(e.trigger,a):Fe(e.state,a),f=e.kind===`state`&&Ge(e.state,a),p=e.kind===`state`?F(`stateNode`,{name:e.name,type:d}):F(`triggerNode`,{trigger:d}),m=o?.get(e.id)??[],h=[...f?[F(`cacheForcedAgainst`)]:[],...m.map(e=>e.message)];return{id:K(e.id),type:e.kind,ariaLabel:[p,...h].join(`, `),position:{x:l.x,y:l.y},width:l.width,height:l.height,measured:{width:l.width,height:l.height},data:{node:e,kind:d,problems:n.get(e.id)??[],...i?.has(e.id)&&{trace:i.get(e.id)},...f&&{cacheWarning:f},...m.length>0&&{warnings:m},...s&&{pins:Xt(s.data,e.id,s.open.has(e.id))},...c&&{dataOrder:c}},draggable:!1,deletable:e.kind===`state`,selected:e.id===r,...u!==void 0&&{parentId:K(u),extent:`parent`}}}),Qt=40,$t=e=>e.length>Qt?`${e.slice(0,39)}…`:e,en=e=>{if(e.kind==="default")return F(`otherwise`);if(e.kind===`catch`)return F(`onError`,{errors:e.label??``});if(e.kind===`rule`)return e.label?$t(e.label):F(`conditionToWrite`)},tn=e=>({id:e.id,source:K(e.source),sourceHandle:`out`,target:K(e.target),targetHandle:`in`,deletable:!1,data:{kind:e.kind,field:e.field,source:e.source},...e.kind===`status`&&{className:`pb-workflow-status`}}),nn=(e,t=!1)=>e.edges.map(e=>{if(t)return tn(e);let n=en(e);return{id:e.id,source:K(e.source),sourceHandle:e.kind,target:K(e.target),targetHandle:`in`,deletable:e.kind!==`start`,data:{kind:e.kind,field:e.field,source:e.source},...n!==void 0&&{label:n},...e.kind===`catch`&&{className:`pb-workflow-catch`}}}),rn=(e,t,n,r)=>t.pure.map(i=>{let a=n?.get(i.id)??{x:0,y:0,...U},o=Jt(e,i),{shown:s,folded:c}=Bt(i,r.has(i.id)),l=i.kind===`break`?Vt(i,t.edges,r.has(i.id)):void 0,u=e.nodes.find(e=>e.id===(i.kind===`break`?i.source:i.target));return{id:i.id,type:`pure`,position:{x:a.x,y:a.y},width:a.width,height:a.height,measured:{width:a.width,height:a.height},data:{node:u,kind:i.kind,problems:[],pureData:{pure:i,shownInputs:s,shownOutputs:l?.shown??[],folded:l?.folded??c,open:r.has(i.id),foldable:l?l.foldable:c>0||r.has(i.id)}},draggable:!1,deletable:!0,...o!==void 0&&{parentId:K(o),extent:`parent`}}}),an=(e,t)=>{let n=e=>{let n=t.pure.find(t=>t.id===e);return n?n.kind===`break`?n.source:n.target:e},r=new Set(t.edges.map(e=>`${n(e.source)}\n${n(e.target)}`));return nn({...e,edges:e.edges.filter(e=>e.source!==``&&!r.has(`${e.source}\n${e.target}`))},!0)},on=e=>{let t=new Set(e.pure.map(e=>e.id)),n=e=>t.has(e)?e:K(e);return e.edges.map(e=>({id:e.id,source:n(e.source),sourceHandle:e.sourceHandle,target:n(e.target),targetHandle:e.targetHandle,deletable:!e.expression,data:{kind:`data`,wire:e},className:`pb-wire pb-wire-${G(e.type)}${e.expression?` pb-wire-expression`:``}`}))},sn=(0,R.createContext)(void 0),cn={succeeded:`green`,caught:`amber`,retrying:`amber`,failed:`red`,current:`blue`},ln=(0,R.createContext)(void 0),Y=()=>(0,R.useContext)(ln),un=e=>{if(e.options)return`choice`;if(e.type.kinds===`any`)return;let[t,...n]=e.type.kinds.filter(e=>e!==`null`);if(t===`string`&&n.every(e=>e===`integer`||e===`number`))return`string`;if(!(n.length>0))return t===`integer`||t===`number`?`number`:t===`boolean`?`boolean`:void 0},dn=e=>e.trim()===``?void 0:Number.isNaN(Number(e))?e:Number(e),fn=({name:e,className:t,value:n,onChange:r})=>{let[i,a]=(0,R.useState)();return(0,H.jsx)(l,{"aria-label":e,wrapperClassName:`${t} h-6 w-[55%] px-1.5`,className:`text-xs`,inputMode:`decimal`,value:i??(n===void 0?``:String(n)),onChange:e=>{a(e.target.value),r(dn(e.target.value))},onBlur:()=>a(void 0)})},pn=({pin:e,label:t,onChange:n})=>{if(e.state===`wired`||e.state===`made`||e.key===`#condition`&&e.state!==`expression`)return null;if(e.state===`expression`)return(0,H.jsx)(`span`,{className:`ml-auto shrink-0 rounded bg-muted px-1 font-mono text-xs text-muted-foreground`,title:F(`pinExpression`,{expression:String(e.value)}),children:`ƒ`});let r=un(e);if(e.state===`literal`&&typeof e.value==`object`)return(0,H.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,title:F(`pinObjectValue`),children:`{…}`});if(!r)return e.state===`literal`?(0,H.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-xs text-muted-foreground`,children:String(e.value)}):null;let i=F(`inputValue`,{label:t});if(!n)return(0,H.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-xs text-muted-foreground`,children:e.value===void 0?``:String(e.value)});let a=`nodrag nopan nowheel ml-auto min-w-0`;return r===`boolean`?(0,H.jsx)(f,{className:a,checked:e.value===!0,label:i,onChange:e=>n(e)}):r===`choice`?(0,H.jsxs)(o,{"aria-label":i,className:`${a} h-6 max-w-[55%] px-1 py-0 text-xs`,value:typeof e.value==`string`?e.value:``,onChange:e=>n(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(`option`,{value:``}),e.options.map(t=>(0,H.jsx)(`option`,{value:t,children:e.statuses?It(t):t},t))]}):r===`number`?(0,H.jsx)(fn,{name:i,className:a,value:e.value,onChange:n}):(0,H.jsx)(l,{"aria-label":i,wrapperClassName:`${a} h-6 w-[55%] px-1.5`,className:`text-xs`,value:e.value===void 0?``:String(e.value),onChange:e=>n(e.target.value===``?void 0:e.target.value)})},mn=e=>`pb-pin pb-pin-${G(e.type)}`,hn=({pin:e,step:t,keys:n,connectable:r,name:i,onValue:a,bare:o=!1})=>{let s=Y(),c=i??jt(e.key);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center gap-1.5 pr-2 pl-3`,children:[(0,H.jsx)(L,{id:B(e.key),type:`target`,position:I.Left,isConnectable:r,className:mn(e)}),(0,H.jsxs)(`span`,{className:`min-w-0 shrink truncate text-xs text-body`,title:F(`pinTypeTitle`,{label:c,type:W(e.type)}),children:[c,e.required&&(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-danger-text`,children:`*`})]}),!o&&(0,H.jsx)(pn,{pin:e,label:c,...s&&r&&{onChange:a??(e=>s.setArgument(t,n,e))}})]})},gn=({pin:e,connectable:t,trigger:n=!1,field:r=!1})=>{let i=At(e.path,n,r);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center justify-end pr-3 pl-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-xs text-body`,title:F(`pinTypeTitle`,{label:i,type:W(e.type)}),children:i}),(0,H.jsx)(L,{id:V(e.path),type:`source`,position:I.Right,isConnectable:t,className:mn(e)})]})},_n=({inputs:e,outputs:t,connectable:n})=>{let r=(e,t)=>({top:`${(e+1)*100/(t+1)}%`});return(0,H.jsxs)(H.Fragment,{children:[e.map((t,i)=>(0,H.jsx)(L,{id:B(t.key),type:`target`,position:I.Left,isConnectable:n,className:mn(t),style:r(i,e.length),title:F(`pinTypeTitle`,{label:jt(t.key),type:W(t.type)})},t.key)),t.map((e,i)=>(0,H.jsx)(L,{id:V(e.path),type:`source`,position:I.Right,isConnectable:n,className:mn(e),style:r(i,t.length),title:F(`pinTypeTitle`,{label:At(e.path),type:W(e.type)})},e.path.join(`/`)))]})},vn=({node:e,folded:t,open:n,fields:r=!1})=>{let i=Y();return t===0&&!n?null:(0,H.jsx)(`button`,{type:`button`,className:`nodrag h-6 w-full px-3 text-left text-xs text-muted-foreground hover:text-foreground`,onClick:()=>i?.toggleOpen(e),disabled:!i,children:r?n?F(`foldLessFields`):F(`foldMoreFields`,{count:t}):n?F(`foldLess`):F(`foldMore`,{count:t})})},yn=({node:e,inputs:t,outputs:n,folded:r,open:i,editable:a,trigger:o=!1})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-[3fr_2fr]`,children:[(0,H.jsx)(`div`,{className:`min-w-0`,children:t.map(t=>(0,H.jsx)(hn,{pin:t,step:e,keys:[t.key],connectable:a},t.key))}),(0,H.jsx)(`div`,{className:`min-w-0`,children:n.map(e=>(0,H.jsx)(gn,{pin:e,connectable:a,trigger:o},JSON.stringify(e.path)))})]}),(0,H.jsx)(vn,{node:e,folded:r,open:i})]}),bn=(0,R.createContext)(void 0),xn=`nodrag absolute -top-4 -right-4 z-10`,Sn=({node:e,name:t})=>{let n=(0,R.useContext)(bn);return n?(0,H.jsx)(u,{size:`icon`,className:xn,"aria-label":F(`unpin`,{name:t}),title:F(`unpinHelp`),onClick:t=>{t.stopPropagation(),n(e)},children:(0,H.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0})}):(0,H.jsxs)(`span`,{className:s(xn,`inline-flex size-7 items-center justify-center rounded-md border border-border-strong bg-background text-muted-foreground shadow-sm`),title:F(`movedByHand`),children:[(0,H.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`sr-only`,children:F(`movedByHand`)})]})},X=[18,38],Cn=e=>{if(e.Type===`Choice`)return[{kind:`rule`,top:X[0],label:F(`when`)},{kind:`default`,top:X[1],label:F(`otherwise`)}];let t=[`Task`,`Pass`,`Wait`,`Map`,`Block`].includes(e.Type)?[{kind:`next`,top:X[0]}]:[],n=e.Type===`Task`||e.Type===`Map`||e.Type===`Block`?[{kind:`catch`,top:X[t.length],label:F(`onErrorHandle`)}]:[];return[...t,...n]},wn=(e,t,n)=>{let r=(0,R.useContext)(sn);if(!r||!t)return{};let i=t=>{t.stopPropagation(),r(e)},a=n?F(`addStepAtNamedHandle`,{handle:n}):F(`addStepAtHandle`);return{role:`button`,tabIndex:0,"aria-label":a,title:a,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i(e))}}},Tn=({source:e,path:t,editable:n})=>(0,H.jsx)(L,{id:e.kind,type:`source`,position:I.Right,isConnectable:n,style:{top:e.top},className:s(`pb-workflow-exec`,`pb-workflow-handle-${e.kind}`),...wn({kind:e.kind,source:t},n,e.label),children:e.label&&(0,H.jsx)(`span`,{className:`pb-workflow-handle-label`,children:e.label})}),En=({state:e,path:t,editable:n})=>Cn(e).map(e=>(0,H.jsx)(Tn,{source:e,path:t,editable:n},e.kind)),Dn=({count:e})=>e>0&&(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-danger-text`,title:F(`problemCount`,{count:e}),children:[(0,H.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:F(`problemCount`,{count:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:e})]}),On=({label:e})=>(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center text-warning-text`,title:e,children:[(0,H.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:e})]}),kn=({trace:e})=>(0,H.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end gap-0.5`,children:[e.changed?(0,H.jsx)(`span`,{title:F(`changedSinceRun`),className:`rounded-full border border-dashed px-1.5 text-xs text-muted-foreground`,children:F(`changedShort`)}):(0,H.jsx)(r,{tone:cn[e.status],children:Ue(e.status)}),e.steps>1&&(0,H.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:F(`traceSteps`,{count:e.steps})})]}),An=(e,t,n)=>s(`rounded-lg border bg-background text-body shadow-sm`,t>0||n?.status===`failed`?`border-danger`:`border-border-strong`,e&&`ring-2 ring-primary/40`),jn=({name:e,kind:t,problems:n,first:r,trace:i,warnings:a=[]})=>(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:[t,r&&(0,H.jsxs)(`span`,{className:`text-primary-text`,children:[` · `,F(`startsHere`)]})]}),a.length>0&&(0,H.jsx)(On,{label:a.join(`
3
- `)}),(0,H.jsx)(Dn,{count:n}),i&&(0,H.jsx)(kn,{trace:i})]}),(0,H.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e})]}),Mn=()=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(L,{id:`in`,type:`target`,position:I.Left,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}}),(0,H.jsx)(L,{id:`out`,type:`source`,position:I.Right,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}})]}),Nn=({condition:e})=>e!==void 0&&(0,H.jsx)(`span`,{className:`absolute top-1 right-6 max-w-[45%] truncate rounded bg-muted px-1 text-[0.625rem] text-muted-foreground`,title:e,children:F(`onlyWhenBadge`)}),Pn=({id:e,data:t,selected:n,isConnectable:r})=>{let{node:i,kind:a,problems:o,trace:c,cacheWarning:l,warnings:u=[],pins:d,dataOrder:f,moved:p}=t;return i.kind===`state`?(0,H.jsxs)(`div`,{className:s(An(n,o.length,c),`h-full`,j(i.state)&&`bg-muted/40`),children:[p&&(0,H.jsx)(Sn,{node:e,name:i.name}),(0,H.jsxs)(`div`,{className:`relative h-[52px] py-2 pr-6 pl-4`,children:[f?(0,H.jsx)(Mn,{}):(0,H.jsx)(L,{id:`in`,type:`target`,position:I.Left,isConnectable:r,className:`pb-workflow-exec`,style:{top:X[0]}}),f&&(0,H.jsx)(Nn,{condition:i.state.Condition}),(0,H.jsx)(jn,{name:i.name,kind:a,problems:o.length,first:i.first&&i.parent!==void 0,trace:c,warnings:[...l?[F(`cacheForcedAgainst`)]:[],...u.map(e=>e.message)]}),!f&&(0,H.jsx)(En,{state:i.state,path:i.id,editable:r}),d&&j(i.state)&&(0,H.jsx)(_n,{inputs:d.inputs,outputs:d.outputs,connectable:r})]}),d&&!j(i.state)&&(0,H.jsx)(yn,{node:i.id,inputs:d.inputs,outputs:d.outputs,folded:d.folded,open:d.open,editable:r})]}):null},Fn=({id:e,data:t,selected:n,isConnectable:r})=>{let{node:i,kind:a,problems:o,pins:c,dataOrder:l,moved:u}=t,d=wn({kind:`start`,source:i.id},r&&!l);return i.kind===`trigger`?(0,H.jsxs)(`div`,{className:s(An(n,o.length),`h-full border-dashed`),children:[u&&(0,H.jsx)(Sn,{node:e,name:F(`trigger`)}),(0,H.jsxs)(`div`,{className:`relative h-[52px] py-2 pr-6 pl-4`,children:[(0,H.jsx)(jn,{name:a,kind:F(`trigger`),problems:o.length}),l?(0,H.jsx)(L,{id:`out`,type:`source`,position:I.Right,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}}):(0,H.jsx)(L,{id:`start`,type:`source`,position:I.Right,isConnectable:r,className:`pb-workflow-exec`,style:{top:X[0]},...d})]}),c&&(0,H.jsx)(yn,{node:i.id,inputs:[],outputs:c.outputs,folded:0,open:!1,editable:r,trigger:!0})]}):null},In=`protobase:workflow-graph-view`,Ln=e=>c(()=>e().getItem(`protobase:workflow-graph-view`),null)===`simple`?`simple`:`pins`,Rn=(e,t)=>c(()=>t===`pins`?e().removeItem(In):e().setItem(In,t),void 0),zn=()=>localStorage,Bn=()=>{let[e,t]=(0,R.useState)(()=>Ln(zn));return[e,e=>{t(e),Rn(zn,e)}]},Vn=(e,t)=>e.part.kind===`not`?F(`conditionNotSide`):e.part.kind===`matches`?F(t===`0`?`conditionMatchesText`:`conditionMatchesPattern`):e.part.kind===`logic`?String.fromCharCode(65+Number(t)%26):F(t===`0`?`conditionSideA`:`conditionSideB`),Hn=({node:e,source:t})=>{let n=Y(),[r,i]=(0,R.useState)(),a=t.trim();return(0,H.jsx)(`textarea`,{"aria-label":F(`conditionExpressionText`),className:`nodrag nopan nowheel block w-full resize-none rounded border border-border bg-background px-1.5 py-1 font-mono text-xs text-foreground`,style:{height:64},spellCheck:!1,readOnly:!n,value:r??a,onChange:e=>i(e.target.value),onBlur:()=>{i(void 0);let t=r?.trim();t!==void 0&&t!==a&&n?.setCondition(e.target,t===``?void 0:`{% ${t} %}`)}})},Un=e=>e.replace(/^\$states\.context\.Steps\./,``).replace(/^\$states\.context\.Execution\.Input/,`input`),Wn=({node:e,editable:t})=>{let n=Y(),[r,i]=(0,R.useState)(),a=F(`conditionMatchesPattern`),o=String(e.inputs[1]?.value??``);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center gap-1.5 pr-2 pl-3`,children:[(0,H.jsx)(`span`,{className:`min-w-0 shrink truncate text-xs text-body`,children:a}),(0,H.jsx)(l,{"aria-label":F(`inputValue`,{label:a}),wrapperClassName:`nodrag nopan nowheel ml-auto h-6 w-[60%] min-w-0 px-1.5`,className:`font-mono text-xs`,value:r??o,disabled:!n||!t,onChange:t=>{i(t.target.value),t.target.value!==``&&n?.setConditionSide(e.target,[...e.at,1],t.target.value)},onBlur:()=>i(void 0)})]})},Gn=({node:e,editable:t})=>{let n=Y(),r=(0,H.jsx)(L,{id:tt,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-boolean`,style:{top:13}});return e.part.kind===`expression`?(0,H.jsxs)(`div`,{className:`relative grid gap-1 px-2 pt-1`,children:[r,(0,H.jsx)(Hn,{node:e,source:e.part.source}),(0,H.jsx)(`div`,{className:`-mx-2`,children:e.inputs.map(e=>(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center pr-2 pl-3`,children:[(0,H.jsx)(L,{id:B(e.key),type:`target`,position:I.Left,isConnectable:!1,className:`pb-pin pb-pin-${G(e.type)}`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-body`,title:F(`pinTypeTitle`,{label:e.key,type:W(e.type)}),children:Un(e.key)})]},e.key))})]}):(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[r,e.inputs.map(r=>e.part.kind===`matches`&&r.key===`1`?(0,H.jsx)(Wn,{node:e,editable:t},r.key):(0,H.jsx)(hn,{pin:r,step:e.target,keys:[],name:Vn(e,r.key),bare:e.part.kind===`logic`&&Number(r.key)===e.part.sides.length,connectable:t,onValue:t=>n?.setConditionSide(e.target,[...e.at,Number(r.key)],t??``)},r.key))]})},Kn=(e,t)=>typeof t==`number`&&e.trim()!==``&&Number.isFinite(Number(e))?Number(e):typeof t==`boolean`&&(e===`true`||e===`false`)?e===`true`:e,qn=`nodrag nopan nowheel h-6 min-w-0 px-1.5`,Jn=({label:e,value:t,onChange:n,disabled:r})=>(0,H.jsx)(l,{"aria-label":e,wrapperClassName:`${qn} flex-1`,className:`text-xs`,value:String(t),disabled:r,onChange:e=>n(Kn(e.target.value,t))}),Yn=({node:e,editable:t})=>{let n=Y(),r=!n||!t,i=t=>n?.setArgument(e.target,[e.key],D(t)),{part:a}=e,o=(e,t)=>i({...a,cases:a.cases.map((n,r)=>r===e?{...n,...t}:n)});return(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:nt,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-${G(e.type)}`,style:{top:13}}),e.inputs.map(n=>(0,H.jsx)(hn,{pin:n,step:e.target,keys:[],name:F(`selectInput`),connectable:t,onValue:e=>i({...a,operand:{value:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:``}})},n.key)),a.cases.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1 pr-2 pl-3`,children:[(0,H.jsx)(Jn,{label:F(`selectWhen`,{case:t+1}),value:e.when,disabled:r,onChange:e=>o(t,{when:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-muted-foreground`,children:`→`}),(0,H.jsx)(Jn,{label:F(`selectThen`,{case:t+1}),value:e.then,disabled:r,onChange:e=>o(t,{then:e})}),(0,H.jsx)(`button`,{type:`button`,className:`nodrag shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-40`,"aria-label":F(`selectRemoveCase`,{case:t+1}),disabled:r||a.cases.length===1,onClick:()=>i({...a,cases:a.cases.filter((e,n)=>n!==t)}),children:(0,H.jsx)(d,{className:`size-3`,"aria-hidden":!0})})]},t)),(0,H.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1 pr-2 pl-3`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-body`,children:F(`selectOtherwise`)}),(0,H.jsx)(Jn,{label:F(`selectOtherwise`),value:a.otherwise,disabled:r,onChange:e=>i({...a,otherwise:e})})]}),(0,H.jsx)(`button`,{type:`button`,className:`nodrag h-6 w-full px-3 text-left text-xs text-muted-foreground hover:text-foreground`,disabled:r,onClick:()=>i({...a,cases:[...a.cases,{when:``,then:``}]}),children:F(`selectAddCase`)})]})},Xn=e=>e.kind===`condition`?Pt(e):e.kind===`select`?F(`selectTitle`):e.kind===`break`?F(`breakTitle`,{type:W(e.type)}):F(`makeTitle`,{type:W(e.type)}),Zn=({pure:e})=>(0,H.jsx)(`div`,{className:`truncate border-b px-3 py-1.5 text-xs font-medium text-foreground`,children:Xn(e)}),Qn=({id:e,data:t,selected:n,isConnectable:r})=>{let{pureData:i,moved:a}=t;if(!i)return null;let{pure:o,shownInputs:c,shownOutputs:l,folded:u,open:d,foldable:f}=i;return(0,H.jsxs)(`div`,{className:s(`h-full rounded-lg border border-dashed border-border-strong bg-background text-body shadow-sm`,n&&`ring-2 ring-primary/40`),children:[a&&(0,H.jsx)(Sn,{node:e,name:Xn(o)}),(0,H.jsx)(Zn,{pure:o}),o.kind===`condition`?(0,H.jsx)(Gn,{node:o,editable:r}):o.kind===`select`?(0,H.jsx)(Yn,{node:o,editable:r}):o.kind===`break`?(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:$e,type:`target`,position:I.Left,isConnectable:!1,className:`pb-pin pb-pin-${G(o.type)}`,style:{top:13}}),l.map(e=>(0,H.jsx)(gn,{pin:e,connectable:r,field:!0},JSON.stringify(e.path))),f&&(0,H.jsx)(vn,{node:o.id,folded:u,open:d,fields:!0})]}):(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:et,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-${G(o.type)}`,style:{top:13}}),c.map(e=>(0,H.jsx)(hn,{pin:e,step:o.target,keys:[o.key,e.key],connectable:r},e.key)),(0,H.jsx)(vn,{node:o.id,folded:u,open:d})]})]})},$n=({offer:e,onClose:t})=>(0,H.jsxs)(`div`,{role:`dialog`,"aria-label":F(`pureOfferTitle`),className:`absolute z-10 grid gap-1 rounded-md border bg-background p-1 shadow-md`,style:{left:e.x,top:e.y},children:[e.choices.map((e,n)=>(0,H.jsx)(u,{size:`sm`,variant:`ghost`,className:`justify-start`,autoFocus:n===0,onClick:()=>{e.add(),t()},children:e.label},e.label)),(0,H.jsx)(u,{size:`sm`,variant:`ghost`,onClick:t,children:F(`pureOfferClose`)})]}),er=e=>typeof e==`object`&&!!e&&!Array.isArray(e),tr=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Z={kinds:[`boolean`]},nr=e=>e.sides.flatMap(e=>b(e)?nr(e):`read`in e?[e.read]:[]),rr=e=>!b(e)&&`read`in e&&`step`in e.read.base&&tr(e.read.path,[`Status`]),ir=(e,t)=>{if(t&&t.kinds!==`any`){let e=t.kinds.filter(e=>e!==`null`);if(e.length===1&&[`string`,`integer`,`number`,`boolean`].includes(e[0]))return{kinds:e}}return{kinds:[typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:`string`]}},ar=e=>{let t=new Map;for(let[n,r]of re(e.stateMachine)){let i=`Assign`in r&&er(r.Assign)?r.Assign:{};for(let[r,a]of Object.entries(i)){let i=a===`{% $states.result %}`?ae(e.stateMachine,n)?.join(`/`):void 0;t.set(r,t.has(r)||i===void 0?null:i)}}return t},or=(e,t,n=[])=>{let r=new Map(re(e.stateMachine).map(([t,n])=>[ae(e.stateMachine,t).join(`/`),n])),i=ne(e)===`data`,a=new Map([[``,ce(e,t)],...[...r].map(([e,n])=>[e,[...le(n,t),...i?[fe]:[]]])]),o=new Map([...r].filter(([,e])=>i||e.Type===`Task`).map(([e,n])=>[e,[...i?[M(n)]:[],...se(n,t)]])),s=e=>[...r.keys()].find(t=>t.split(`/`).at(-1)===e),c=new Map,l=new Map,u=[],d=[],f=new Map,p=ar(e),m=(e,t,n,r=!1)=>{let i=`data:${e.node}|${e.handle}->${t}|${n}`;r&&f.has(i)||f.set(i,{id:i,source:e.node,sourceHandle:e.handle,target:t,targetHandle:n,type:e.type,...r&&{expression:!0}})},g=(e,t)=>{let n=e.find(e=>tr(e.path,t));return n||(n={path:t,type:_(void 0)},e.push(n)),n},y=(e,t)=>{let n=a.get(e),r=n.find(e=>tr(e.path,t)),i=n.some(e=>e.path.length>0&&e.path[0]!==`#status`);if(r||t.length===0||i&&t.length===1){let i=r??g(n,t);return{node:e,handle:V(i.path),type:i.type}}let o=S(e,t.slice(0,-1)),s=g(o.outputs,t.slice(-1));return{node:o.id,handle:V(s.path),type:s.type}},S=(n,i)=>{let a=Ye(n,i),o=c.get(a);if(o)return o;let s=ge(e,r.get(n),t,i),l={kind:`break`,id:a,source:n,path:i,type:_(s),outputs:de(s).map(([e,t])=>({path:[e],type:_(t)}))};return c.set(a,l),m(y(n,i),a,$e),l},C=(e,t,n)=>{let r=T(e);if(r)return m(r,t,n);for(let r of O(e)){let e=D(r);e&&m(e,t,n,!0)}},T=e=>{let t=ie(e);return t&&D(t)},D=e=>{if(`step`in e.base){let t=s(e.base.step);return t===void 0||!a.has(t)?void 0:y(t,[P,...e.path])}let t=`input`in e.base?``:p.get(e.base.variable);return t==null||!a.has(t)?void 0:y(t,e.path)},A=e=>{if(b(e)||!(`read`in e))return;if(!rr(e))return D(e.read);let t=s(e.read.base.step);return t===void 0||!a.has(t)?void 0:y(t,[P])},oe=(e,t,n,r)=>{let i=Ze(e,n),a=t.sides,o=a.map(A),s=a.map((e,n)=>{let r=String(n);if(b(e))return{key:r,type:Z,required:!1,value:void 0,state:`made`};if(`read`in e)return{key:r,type:o[n]?.type??_(void 0),required:!1,value:k(e.read),state:`wired`};if(`pattern`in e)return{key:r,type:{kinds:[`string`]},required:!1,value:e.pattern,state:`literal`};if(t.kind===`matches`)return{key:r,type:{kinds:[`string`]},required:!1,value:e.value,state:`literal`};if(t.kind!==`compare`)return{key:r,type:Z,required:!1,value:e.value,state:`literal`};let i=a[1-n];return rr(i)?{key:r,type:{kinds:[`string`]},required:!1,value:e.value,state:`literal`,options:x,statuses:!0}:{key:r,type:ir(e.value,o[1-n]?.type),required:!1,value:e.value,state:`literal`}});t.kind===`logic`&&s.push({key:String(a.length),type:Z,required:!1,value:void 0,state:`empty`}),u.push({kind:`condition`,id:i,target:e,at:n,part:t,inputs:s}),m({node:i,handle:tt,type:Z},r.node,r.handle),a.forEach((t,r)=>{b(t)?oe(e,t,[...n,r],{node:i,handle:B(String(r))}):o[r]&&m(o[r],i,B(String(r)))})},j=(e,t)=>{let n=E(t),r={node:e,handle:B(he)};if(n&&nr(n).every(e=>A({read:e})))return oe(e,n,[],r);let i=Ze(e,[]),a=O(t).flatMap(e=>{let t=A({read:e});return t?[{read:e,source:t}]:[]});u.push({kind:`condition`,id:i,target:e,at:[],part:{kind:`expression`,source:v(t)},inputs:a.map(({read:e,source:t})=>({key:te(e),type:t.type,required:!1,value:k(e),state:`wired`}))}),m({node:i,handle:tt,type:Z},r.node,r.handle);for(let{read:e,source:t}of a)m(t,i,B(te(e)),!0)},ue=(e,t)=>{let n=w(t.value),r=n&&A(n.operand);if(!n||`read`in n.operand&&!r)return!1;let i=Qe(e,t.key),a=`read`in n.operand?{key:rt,type:r.type,required:!1,value:k(n.operand.read),state:`wired`}:{key:rt,type:{kinds:[`string`]},required:!1,value:n.operand.value,state:`literal`};return d.push({kind:`select`,id:i,target:e,key:t.key,part:n,type:t.type,inputs:[a]}),m({node:i,handle:nt,type:t.type},e,B(t.key)),r&&m(r,i,B(rt)),!0},pe=(e,n)=>{let i=Xe(e,n),a=l.get(i);if(a)return a;let s=o.get(e)?.find(e=>e.key===n),c=r.get(e),u=h(ee(c,t),[n]),d=er(s?.value)?s.value:{},f=new Set(Array.isArray(u?.required)?u.required:[]),p=de(u).map(([e,t])=>N(e,t,d[e],f.has(e))),g=Object.keys(d).filter(e=>!p.some(t=>t.key===e)).map(e=>N(e,h(u,[e])??{},d[e],!1)),v={kind:`make`,id:i,target:e,key:n,type:s?.type??_(u),inputs:[...p,...g]};l.set(i,v),m({node:i,handle:et,type:v.type},e,B(n));for(let e of v.inputs)C(e.value,i,B(e.key));return v};for(let[e,t]of o)for(let[n,r]of t.entries()){if(r.key===`#condition`&&r.state===`expression`){t[n]={...r,state:`made`},j(e,r.value);continue}if(r.state===`expression`&&ue(e,r)){t[n]={...r,state:`made`};continue}r.state===`made`&&pe(e,r.key),(r.state===`wired`||r.state===`expression`)&&C(r.value,e,B(r.key))}for(let e of n)e.kind===`break`&&a.has(e.source)&&S(e.source,e.path),e.kind===`make`&&o.get(e.target)?.some(t=>t.key===e.key&&t.state!==`wired`&&t.state!==`expression`)&&pe(e.target,e.key);return{inputs:o,outputs:a,pure:[...c.values(),...l.values(),...u,...d],edges:[...f.values()]}},sr=e=>e.reason===`notBefore`?F(`refuseNotBefore`,{step:e.step}):e.reason===`otherScope`?F(`refuseOtherScope`,{step:e.step}):e.reason===`shapesOutput`?F(`refuseShaped`,{step:e.step}):e.reason===`type`?F(`refuseType`,{source:W(e.source),target:W(e.target)}):F(`refuseNotPins`),Q=e=>it(e)!==void 0||at(e)!==void 0,$=(e,t)=>({node:J(e),handle:t??``}),cr=e=>e!==`any`&&e.includes(`object`),lr=(e,t)=>e.map(e=>({label:Nt(e),add:()=>t(e)})),ur=(e,t)=>{let n=e=>e.kind===`break`?Ye(e.source,e.path):Xe(e.target,e.key),r=e=>e.kind===`break`&&t.some(t=>t.kind===`break`&&t.source===e.source&&t.path.every((t,n)=>e.path[n]===t));return e.filter(e=>!r(e)&&!t.some(t=>t.id===n(e)))},dr=(e,t,n,r,i)=>{let a=r?.edits,[o,s]=(0,R.useState)([]),[c,l]=(0,R.useState)(new Set),[u,d]=(0,R.useState)(),f=(0,R.useRef)({definition:e,editing:r});(0,R.useEffect)(()=>{f.current={definition:e,editing:r}});let p=(0,R.useMemo)(()=>n&&or(e,n,o),[e,n,o]),m=ne(e)===`data`,h=(0,R.useMemo)(()=>{if(p)return{sizes:Ut(t,p,c),pure:p.pure.map(e=>({id:e.id,parent:Jt(t,e)})),wires:p.edges.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),ports:qt(t,p,c),dataOrder:m}},[t,p,c,m]),g=r&&{setArgument:(t,n,i)=>r.onChange(r.edits.setArgument(e,t,n,i)),setConditionSide:(t,n,i)=>r.onChange(r.edits.setConditionSide(e,t,n,{value:i})),setCondition:(t,n)=>r.onChange(r.edits.setArgument(e,t,[`#condition`],n)),toggleOpen:e=>l(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e]))},_=(t,n)=>{if(!p||!a||!Q(t.handle)||!Q(n.handle))return;let[r,i]=at(t.handle)?[t,n]:[n,t],o=a.wireRefusal(e,p,$(r.node,r.handle),$(i.node,i.handle));return o&&sr(o)},v=t=>!!(p&&a)&&a.wireRefusal(e,p,$(t.source,t.sourceHandle),$(t.target,t.targetHandle))===void 0,ee=t=>{r&&p&&r.onChange(r.edits.connectData(e,p,$(t.source,t.sourceHandle),$(t.target,t.targetHandle)))},y=(e,t,n)=>{if(!p||!a)return e;let r=e,i=n.flatMap(e=>{let t=e.data?.wire,n=t&&p.pure.find(e=>e.kind===`break`&&e.id===t.target||e.kind===`make`&&e.id===t.source);return n?[{id:n.id}]:[]}),o=[...t.filter(e=>q(e.id)),...i.filter(e=>!t.some(t=>t.id===e.id))],c=n.flatMap(e=>{let t=e.data?.wire;return t&&!o.some(e=>e.id===t.source||e.id===t.target)?[{wire:t}]:[]}),l=o.flatMap(e=>p.pure.filter(t=>t.id===e.id).map(e=>({pure:e}))),u=[...c,...l];for(let e of lt(p,u,e=>`wire`in e?ot(p,e.wire):st(e.pure)))r=`wire`in e?a.disconnectData(r,p,e.wire):a.removePure(r,p,e.pure);return o.length>0&&s(e=>ur(e,o.flatMap(e=>p.pure.filter(t=>t.id===e.id)))),r},te=(e,t)=>{let{definition:n,editing:r}=f.current;r?.onChange(r.edits.addSelect(n,e,t))},b=(e,t,n)=>{let{definition:r,editing:i}=f.current;i?.onChange(i.edits.addCondition(r,e,t,n))};return{data:p,open:c,layout:h,actions:g,check:_,isValid:v,connect:ee,remove:y,connectEnd:(e,t)=>{if(!p||!r||t.isValid||t.toHandle||!t.fromHandle?.id||!t.fromNode)return;let n=J(t.fromNode.id),a=t.fromHandle.id,o=`changedTouches`in e?e.changedTouches[0]:e,c=i.current?.getBoundingClientRect(),l={x:o.clientX-(c?.left??0),y:o.clientY-(c?.top??0)},u=at(a);if(u){let e=p.pure.find(e=>e.id===n),t=(e?.kind===`break`?e.outputs:p.outputs.get(n)??[]).find(e=>JSON.stringify(e.path)===JSON.stringify(u))?.type;if(!t||!cr(t.kinds))return;let r=e?.kind===`break`?{source:e.source,path:[...e.path,...u]}:{source:n,path:u};d({...l,choices:[{label:F(`breakTitle`,{type:W(t)}),add:()=>s(e=>[...e,{kind:`break`,...r}])}]});return}let f=it(a),m=p.pure.find(e=>e.id===n);if(m?.kind===`condition`){let e=m.inputs.find(e=>e.key===f);if(!e||e.state!==`literal`&&e.state!==`empty`||m.part.kind!==`logic`&&m.part.kind!==`not`)return;d({...l,choices:lr(r.edits.conditionChoices(!1),e=>b(m.target,[...m.at,Number(f)],e))});return}let h=f===void 0?void 0:p.inputs.get(n)?.find(e=>e.key===f);if(h?.key===`#condition`&&h.state===`empty`){d({...l,choices:lr(r.edits.conditionChoices(!0),e=>b(n,[],e))});return}if(h&&h.key!==`#condition`&&!cr(h.type.kinds)&&(h.state===`empty`||h.state===`literal`)){d({...l,choices:[{label:F(`selectOffer`),add:()=>te(n,h.key)}]});return}h&&cr(h.type.kinds)&&h.state!==`wired`&&h.state!==`expression`&&d({...l,choices:[{label:F(`makeTitle`,{type:W(h.type)}),add:()=>s(e=>[...e,{kind:`make`,target:n,key:h.key}])}]})},offer:u,closeOffer:()=>d(void 0)}},fr=(0,R.createContext)(void 0),pr=({fromX:e,fromY:t,toX:n,toY:r,fromPosition:i,toPosition:a,connectionStatus:o,fromNode:s,fromHandle:c,toNode:l,toHandle:u})=>{let d=(0,R.useContext)(fr),[f]=_e({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a}),p=o===`invalid`&&l&&u?.id&&c.id?d?.({node:s.id,handle:c.id},{node:l.id,handle:u.id}):void 0;return(0,H.jsxs)(`g`,{className:p?`pb-wire-refused`:void 0,children:[(0,H.jsx)(`path`,{d:f,fill:`none`,className:`react-flow__connection-path`}),p&&(0,H.jsx)(`foreignObject`,{x:n+12,y:r-30,width:260,height:28,className:`overflow-visible`,children:(0,H.jsx)(`div`,{className:`inline-block rounded border border-danger bg-danger-soft px-1.5 py-0.5 text-xs whitespace-nowrap text-danger-text shadow`,children:p})})]})},mr=(e,t)=>{let n=De(),[r,i]=(0,R.useState)(),a=(0,R.useMemo)(()=>JSON.stringify(xt(e,t)),[e,t]);return(0,R.useEffect)(()=>{if(!n)return;let e=!0;return Ct(n,JSON.parse(a)).then(t=>{e&&i(t)}),()=>{e=!1}},[n,a]),r},hr={state:Pn,trigger:Fn,pure:Qn},gr=e=>e?.kind===`state`?e.scope.join(`/`):``,_r=({laidOut:e,tidied:t})=>{let n=ye();return(0,R.useEffect)(()=>{e&&n.fitView({maxZoom:1,padding:.1})},[e,t]),null},vr=()=>{let e=ye(),t=xe(e=>e.width),n=(0,R.useRef)(t);return(0,R.useEffect)(()=>{let r=n.current;if(n.current=t,r===0||t===0||t===r)return;let{x:i,y:a,zoom:o}=e.getViewport();e.setViewport({x:i+(t-r)/2,y:a,zoom:o})},[t,e]),null},yr=({laidOut:e,ids:t})=>{let n=Ee();return(0,R.useEffect)(()=>{e&&n(t)},[e]),null},br=new Map,xr=({definition:e,problems:t,warnings:n,selected:r,onSelect:a,onChange:o,edits:s,onAddAt:c,traces:l,types:d,schemas:f,fills:p=!1,layout:h,onLayoutChange:g})=>{let _=o&&s&&{onChange:o,edits:s},v=(0,R.useMemo)(()=>ht(e),[e]),ee=(0,R.useRef)(null),[y,te]=Bn(),b=dr(e,v,y===`pins`?f:void 0,_,ee),x=mr(v,b.layout),S=(0,R.useMemo)(()=>new Map(v.nodes.map(e=>[e.id,e])),[v]),re=JSON.stringify(h??{}),C=(0,R.useMemo)(()=>pe(re),[re]),w=C[y],T=e=>g?.({...C,[y]:e}),E=(0,R.useMemo)(()=>new Map([...v.nodes.map(e=>[e.id,me(e.id)]),...(b.data?.pure??[]).map(e=>[e.id,me(e.id,e)])]),[v,b.data]),D=(0,R.useMemo)(()=>new Map([...E].flatMap(([e,t])=>Object.hasOwn(w,t)?[[e,w[t]]]:[])),[E,w]),O=(0,R.useMemo)(()=>{if(!x)return;let e=new Map((b.data?.pure??[]).map(e=>[e.id,e]));return ue(x,D,t=>{let n=S.get(t);return e.has(t)?Jt(v,e.get(t)):n?.kind===`state`?n.parent:void 0})},[x,D,S,v,b.data]),k=!!g,[ie,ae]=(0,R.useState)(br),[A,j]=(0,R.useState)(0),M=ne(e)===`data`,[N,se]=(0,R.useState)(()=>new Set(r===void 0?[]:[K(r)]));(0,R.useEffect)(()=>{se(e=>r===void 0?e.size===1&&!q([...e][0])?new Set:e:e.has(K(r))?e:new Set([K(r)]))},[r]);let ce=(0,R.useMemo)(()=>[...Zt(v,O,t,r,l,d,n,b.data&&{data:b.data,open:b.open},M),...b.data?rn(v,b.data,O,b.open):[]].map(e=>{let t=ie.get(e.id),n=D.has(J(e.id));return{...e,selected:N.has(e.id),draggable:k,...t&&{position:t},...n&&{data:{...e.data,moved:!0},...e.ariaLabel&&{ariaLabel:`${e.ariaLabel}, ${F(`movedByHand`)}`}}}}),[v,O,t,r,l,d,n,b.data,b.open,M,N,ie,D,k]),[le,de]=(0,R.useState)(),fe=(0,R.useMemo)(()=>[...M&&b.data?an(v,b.data):nn(v,M),...b.data?on(b.data):[]].map(e=>({...e,selected:e.id===le})),[v,b.data,le,M]),P=!!_,he=e=>{if(Q(e.sourceHandle)||Q(e.targetHandle))return Q(e.sourceHandle)&&Q(e.targetHandle)&&b.isValid(e);if(e.targetHandle!==`in`)return!1;let t=S.get(J(e.target)),n=S.get(J(e.source));return t?.kind===`state`&&gr(n)===gr(t)},ge=e=>{ae(br);let t=[...e].flatMap(([e,t])=>{let n=J(e),r=E.get(n),i=O?.get(n),a={x:Math.round(t.x),y:Math.round(t.y)};return r===void 0||!D.has(n)&&i&&Math.round(i.x)===a.x&&Math.round(i.y)===a.y?[]:[[r,a]]});t.length>0&&T({...w,...Object.fromEntries(t)})},_e=g&&(e=>{let t=E.get(J(e));t!==void 0&&T(oe(w,t))}),I=()=>{T({}),j(e=>e+1)},ve=e=>{let t=new Map;for(let n of e){if(n.type!==`position`||!n.position||!k)continue;let e=n.position;n.dragging?ae(t=>new Map(t).set(n.id,e)):t.set(n.id,e)}t.size>0&&ge(t);let n=e.filter(e=>e.type===`select`);if(n.length===0)return;let i=new Set(N);for(let e of n)e.selected?i.add(e.id):i.delete(e.id);se(i);let[o]=i.size===1?[...i]:[],s=o===void 0||q(o)?void 0:J(o);if(s!==void 0&&(ye||xe.current))return r===void 0?void 0:a(void 0);s!==r&&a(s)},ye=we(`Shift`),xe=(0,R.useRef)(!1);return(0,H.jsx)(sn.Provider,{value:_?c:void 0,children:(0,H.jsx)(bn.Provider,{value:_e,children:(0,H.jsx)(ln.Provider,{value:b.actions,children:(0,H.jsx)(fr.Provider,{value:b.check,children:(0,H.jsxs)(`div`,{ref:ee,className:`relative h-full w-full`,children:[(0,H.jsxs)(Ce,{className:`pb-workflow`,nodes:ce,edges:fe,nodeTypes:hr,nodesDraggable:k,nodeDragThreshold:4,selectNodesOnDrag:!1,nodesConnectable:P,connectOnClick:!1,connectionDragThreshold:4,edgesFocusable:P,elementsSelectable:!0,deleteKeyCode:P?[`Backspace`,`Delete`]:null,onNodesChange:ve,onEdgesChange:e=>{for(let t of e)t.type===`select`&&(t.selected?de(t.id):de(e=>e===t.id?void 0:e))},isValidConnection:he,onConnect:t=>{if(_&&t.sourceHandle){if(Q(t.sourceHandle))return b.connect(t);_.onChange(_.edits.connect(e,t.sourceHandle,J(t.source),J(t.target)))}},onConnectEnd:b.connectEnd,connectionLineComponent:pr,onDelete:({nodes:t,edges:n})=>{if(!_)return;let r=t.filter(e=>!q(e.id)).map(e=>J(e.id)).filter(e=>e!==``),i=b.remove(e,t,n);for(let e of n){let t=e.data;t.kind!==`data`&&!r.includes(t.source)&&!r.includes(J(e.target))&&(i=_.edits.disconnect(i,t))}for(let e of r)r.some(t=>e.startsWith(`${t}/`))||(i=_.edits.removeState(i,e));_.onChange(i)},multiSelectionKeyCode:`Shift`,onSelectionStart:()=>void(xe.current=!0),onSelectionEnd:()=>void(xe.current=!1),onNodeClick:(e,t)=>!e.shiftKey&&!q(t.id)&&a(J(t.id)),onPaneClick:()=>a(void 0),zoomOnScroll:!0,panOnScroll:!1,panOnDrag:[0,1,2],selectionOnDrag:!1,selectionKeyCode:`Shift`,preventScrolling:!0,onPaneContextMenu:e=>e.preventDefault(),minZoom:.2,maxZoom:1.5,"aria-label":F(`canvas`),children:[(0,H.jsx)(Te,{gap:16}),f&&(0,H.jsx)(be,{position:`top-left`,children:(0,H.jsx)(i,{label:F(`graphView`),value:y,onChange:te,options:[{value:`pins`,label:F(`viewPins`)},{value:`simple`,label:F(`viewSimple`)}]})}),k&&Object.keys(w).length>0&&(0,H.jsx)(be,{position:`top-right`,children:(0,H.jsxs)(u,{title:F(`tidyUpHelp`),onClick:I,children:[(0,H.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),F(`tidyUp`)]})}),(0,H.jsx)(Se,{showInteractive:!1}),(0,H.jsx)(_r,{laidOut:x,tidied:A}),p&&(0,H.jsx)(vr,{}),(0,H.jsx)(yr,{laidOut:O,ids:ce.map(e=>e.id)})]}),b.offer&&(0,H.jsx)($n,{offer:b.offer,onClose:b.closeOffer})]})})})})})},Sr=e=>(0,H.jsx)(ve,{children:(0,H.jsx)(xr,{...e})});export{it as a,Le as c,Pe as d,je as f,ze as g,Be as h,ot as i,Ue as l,Ve as m,cn as n,at as o,Me as p,lt as r,Ke as s,Sr as t,Fe as u};
4
- //# debugId=36a30b45-64dc-4dd7-abbd-5e6af6de573d
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Ao as r,Co as i,Gc as a,V as o,Wc as s,es as c,io as l,mc as u,ru as d,uc as f}from"./app-Cfc4Mr5v.js";import{t as p}from"./circle-alert-C9z9GbbN.js";import{t as m}from"./layout-grid-DK79NnII.js";import{E as h,M as g,O as _,P as v,S as ee,_ as y,b as te,c as b,d as x,g as S,h as ne,j as re,k as C,l as w,m as T,o as E,u as D,v as O,x as k,y as ie}from"./workflows-Bey4jszG.js";import{C as ae,S as A,a as oe,b as j,c as M,d as N,f as se,g as ce,h as le,i as ue,l as de,m as fe,o as pe,p as P,r as me,s as he,u as ge}from"./use-run-trace-BEM0bOMt.js";import{n as F}from"./use-workflow-types-Bc6SdoP6.js";import{E as _e,a as I}from"./lib-xyflow-system-hojcPWkY.js";import{a as ve,c as ye,i as be,l as xe,n as Se,o as Ce,r as L,s as we,t as Te,u as Ee}from"./lib-xyflow-react-CuNAzocq.js";import{t as De}from"./use-elk-u1Ql5AOs.js";var Oe={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};Oe.node;var ke=s(Oe),R=e(t(),1),Ae={"app:http":()=>F(`stepHttp`),"app:records.create":()=>F(`stepRecordsCreate`),"app:records.update":()=>F(`stepRecordsUpdate`),"app:records.get":()=>F(`stepRecordsGet`),"app:records.list":()=>F(`stepRecordsList`),"app:mail.send":()=>F(`stepMailSend`),"app:mail.template":()=>F(`stepMailTemplate`),"app:piece":()=>F(`stepPiece`)},je=(e,t)=>Ae[e]?.()??t??e,Me=(e,t)=>{let n=je(e,t),r=T(e);return r?F(`stepTypeVersion`,{type:n,version:r.version}):n},Ne={Pass:()=>F(`typePass`),Choice:()=>F(`typeChoice`),Wait:()=>F(`typeWait`),Map:()=>F(`typeMap`),Block:()=>F(`typeBlock`),Succeed:()=>F(`typeSucceed`),Fail:()=>F(`typeFail`)},Pe=e=>Ne[e]?.()??e,Fe=(e,t)=>{if(e.Type!==`Task`)return Pe(e.Type);let{type:n,waits:r}=C(String(e.Resource)),i=je(n,t?.step_types.find(e=>e.id===n)?.label);return r?F(`stepTypeWaits`,{type:i}):i},Ie={url:()=>F(`inputUrl`),method:()=>F(`inputMethod`),headers:()=>F(`inputHeaders`),query:()=>F(`inputQuery`),body:()=>F(`inputBody`),response:()=>F(`inputResponse`),resource:()=>F(`inputResource`),data:()=>F(`inputData`),key:()=>F(`inputKey`),filter:()=>F(`inputFilter`),order_by:()=>F(`inputOrderBy`),limit:()=>F(`inputLimit`),to:()=>F(`inputTo`),subject:()=>F(`inputSubject`),text:()=>F(`inputText`),html:()=>F(`inputHtml`),attachments:()=>F(`inputAttachments`),piece:()=>F(`inputPiece`),action:()=>F(`inputAction`),connection:()=>F(`inputConnection`),props:()=>F(`inputProps`),when:()=>F(`inputWhen`),body_schema:()=>F(`inputBodySchema`)},Le=(e,t)=>Ie[e]?.()??t??e,Re={manual:()=>F(`triggerManual`),"app:record":()=>F(`triggerRecord`)},ze=(e,t)=>Re[e]?.()??t??e,Be=e=>Object.keys(e??{})[0],Ve=(e,t)=>{let n=Be(e);return n===void 0?F(`triggerUnknown`):ze(n,t?.triggers.find(e=>e.id===n)?.label)},He={succeeded:()=>F(`traceSucceeded`),caught:()=>F(`traceCaught`),retrying:()=>F(`traceRetrying`),failed:()=>F(`traceFailed`),current:()=>F(`traceCurrent`)},Ue=e=>He[e](),We=(e,t)=>t?.step_types.find(t=>t.id===C(e.Resource).type)?.cache,Ge=(e,t)=>e.Type===`Task`&&e.Cache===!0&&We(e,t)?.choice===`discouraged`,Ke=(e,t)=>{let n=We(e,t);if(n?.choice!==`hidden`)return n?.choice===`switch`?{on:e.Cache??n.default===!0,forces:!1,offValue:!1,disclaimer:void 0}:{on:e.Cache===!0,forces:!0,offValue:void 0,disclaimer:n?.choice===`discouraged`?n.disclaimer:void 0}},z=e=>encodeURIComponent(e),qe=e=>e.map(e=>`/${z(e)}`).join(``),Je=e=>e===``?[]:e.split(`/`).slice(1).map(decodeURIComponent),Ye=(e,t)=>`break:${z(e)}|${qe(t)}`,Xe=(e,t)=>`make:${z(e)}|${z(t)}`,Ze=(e,t)=>`when:${z(e)}|${t.join(`/`)}`,Qe=(e,t)=>`select:${z(e)}|${z(t)}`,B=e=>`in:${z(e)}`,V=e=>`out:${qe(e)}`,$e=`break-in`,et=`make-out`,tt=`condition-out`,nt=`select-out`,rt=`value`,it=e=>e?.startsWith(`in:`)?decodeURIComponent(e.slice(3)):void 0,at=e=>e?.startsWith(`out:`)?Je(e.slice(4)):void 0,H=e(n(),1),ot=(e,t)=>{let n=e.pure.find(e=>e.id===t.target),r=it(t.targetHandle);return n?.kind===`condition`&&r!==void 0?{step:n.target,at:[...n.at,Number(r)]}:void 0},st=e=>e.kind===`condition`?{step:e.target,at:e.at}:void 0,ct=(e,t)=>{for(let n=0;n<Math.min(e.length,t.length);n++)if(e[n]!==t[n])return e[n]-t[n];return e.length-t.length},lt=(e,t,n)=>{let r=new Map,i=[];for(let e of t){let t=n(e);if(!t){i.push(e);continue}let a=`step:${t.step}`;r.has(a)||(r.set(a,[]),i.push(a)),r.get(a).push({removal:e,at:t.at})}return i.flatMap(e=>typeof e==`string`&&r.has(e)?r.get(e).toSorted((e,t)=>ct(t.at,e.at)).map(({removal:e})=>e):[e])},ut=e=>e.Type===`Choice`&&Array.isArray(e.Choices)?e.Choices:[],dt=e=>`Catch`in e&&Array.isArray(e.Catch)?e.Catch:[],ft=(e,t,n,r)=>{let i=A(t,n),a=(n,r,a,o)=>Object.hasOwn(e.States,a)?[{id:`${i}\n${r}`,kind:n,source:i,target:A(t,a),field:r,...o!==void 0&&{label:o}}]:[];return[...`Next`in r&&typeof r.Next==`string`?a(`next`,`Next`,r.Next):[],...ut(r).flatMap((e,t)=>a(`rule`,`Choices[${t}].Next`,e.Next,e.Condition)),...r.Type===`Choice`&&typeof r.Default==`string`?a(`default`,`Default`,r.Default):[],...dt(r).flatMap((e,t)=>e.Next===void 0?[]:a(`catch`,`Catch[${t}].Next`,e.Next,Array.isArray(e.ErrorEquals)?e.ErrorEquals.join(`, `):void 0))]},pt=(e,t)=>{let n=t.length>0?t.join(`/`):void 0,r=Object.entries(e.States).map(([r,i])=>{let a={kind:`state`,id:A(t,r),name:r,state:i,scope:t,...n!==void 0&&{parent:n},first:e.StartAt===r},o=g(i),s=o?.States?pt(o,[...t,r]):{nodes:[],edges:[]};return{nodes:[a,...s.nodes],edges:[...ft(e,t,r,i),...s.edges]}});return{nodes:r.flatMap(e=>e.nodes),edges:r.flatMap(e=>e.edges)}},mt=(e,t,n)=>[...y(e)].flatMap(([r,i])=>{let a=A(t,r),o=[...S(i)].map(e=>{let n=i.data.has(e)?`reads`:`status`;return{id:`${A(t,e)}\n${n}\n${a}`,kind:n,source:A(t,e),target:a,field:n}}),s=g(e.States[r]),c=s?.States?mt(s,[...t,r],!1):[];return[...n&&o.length===0?[{id:`\nStart\n${a}`,kind:`start`,source:``,target:a,field:`StartAt`}]:[],...o,...c]}),ht=e=>{let t=e.stateMachine,n=pt(t,[]);if(ne(e)===`data`)return{nodes:[{kind:`trigger`,id:``,trigger:e.trigger},...n.nodes.map(e=>e.kind===`state`?{...e,first:!1}:e)],edges:mt(t,[],!0)};let r=t.StartAt!==void 0&&Object.hasOwn(t.States,t.StartAt)?[{id:`
2
+ StartAt`,kind:`start`,source:``,target:t.StartAt,field:`StartAt`}]:[];return{nodes:[{kind:`trigger`,id:``,trigger:e.trigger},...n.nodes],edges:[...r,...n.edges]}},U={width:224,height:64},gt=(e,t)=>`${e}\u0000${t}`,_t={"elk.algorithm":`layered`,"elk.direction":`RIGHT`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.layered.spacing.nodeNodeBetweenLayers":`72`,"elk.spacing.nodeNode":`32`,"elk.edgeLabels.inline":`false`},vt={"elk.layered.layering.strategy":`LONGEST_PATH`},yt={"elk.padding":`[top=48,left=24,bottom=24,right=24]`},bt=e=>e.kind===`state`&&j(e.state),xt=(e,t={})=>{let n=e=>{let n=t.sizes?.get(e)??U,r=t.ports?.get(e);return r?.length?{id:e,...n,layoutOptions:{"elk.portConstraints":`FIXED_POS`},ports:r.map(t=>({id:gt(e,t.handle),x:t.side===`in`?0:n.width,y:t.y,width:0,height:0,layoutOptions:{"elk.port.side":t.side===`in`?`WEST`:`EAST`}}))}:{id:e,...n}},r=(e,n)=>n!==void 0&&t.ports?.get(e)?.some(e=>e.handle===n)?gt(e,n):e,i=e=>(t.pure??[]).filter(t=>t.parent===e).map(e=>n(e.id)),a=t=>{if(!bt(t))return n(t.id);let r=e.nodes.filter(e=>e.kind===`state`&&e.parent===t.id);return{id:t.id,layoutOptions:yt,children:[...r.map(a),...i(t.id)],edges:s(t.id)}},o=n=>{let r=t.pure?.find(e=>e.id===n);if(r)return r.parent;let i=e.nodes.find(e=>e.id===n);return i?.kind===`state`?i.parent:void 0},s=n=>[...e.edges.filter(e=>o(e.target)===n).map(e=>({id:e.id,sources:[e.source],targets:[e.target]})),...(t.wires??[]).filter(e=>o(e.target)===n&&o(e.source)===n).map(e=>({id:e.id,sources:[r(e.source,e.sourceHandle)],targets:[r(e.target,e.targetHandle)]}))],c=e.nodes.filter(e=>e.kind===`trigger`||e.parent===void 0);return{id:`root`,layoutOptions:t.dataOrder?{..._t,...vt}:_t,children:[...c.map(a),...i(void 0)],edges:s(void 0)}},St=e=>{let t=new Map,n=e=>{for(let r of e.children??[])t.set(r.id,{x:r.x??0,y:r.y??0,width:r.width??U.width,height:r.height??U.height}),n(r)};return n(e),t},Ct=async(e,t)=>St(await e.layout(t)),wt=24,Tt=8,Et=(e,t)=>{let n=t?[...e]:e.filter(e=>e.required||e.state!==`empty`);return{shown:n,folded:e.length-n.length}},Dt=(e,t,n,r=52)=>r+Math.max(e,typeof t==`number`?t:t.length)*26+(n?wt:0)+Tt,Ot={string:()=>F(`typeString`),integer:()=>F(`typeInteger`),number:()=>F(`typeNumber`),boolean:()=>F(`typeBoolean`),object:()=>F(`typeObject`),array:()=>F(`typeArray`),null:()=>F(`typeNull`),any:()=>F(`typeAny`)},W=e=>e.title===void 0?e.kinds===`any`?Ot.any():e.kinds.map(e=>Ot[e]()).reduce((e,t)=>F(`typeOr`,{first:e,second:t})):e.title,G=e=>e.kinds===`any`?`any`:e.kinds[0],kt={status:()=>F(`outputStatus`),headers:()=>F(`outputHeaders`),body:()=>F(`outputBody`),record:()=>F(`outputRecord`),resource:()=>F(`outputResource`),key:()=>F(`outputKey`),records:()=>F(`outputRecords`),message_id:()=>F(`outputMessageId`)},At=(e,t=!1,n=!1)=>{if(e.length===0)return F(t?`pinRunInput`:`pinResult`);if(e.length===1&&e[0]===`#status`)return F(`stepStatusType`);let r=e.at(-1);return n||!Object.hasOwn(kt,r)?r:kt[r]()},jt=e=>e===`#condition`?F(`onlyWhen`):Le(e),Mt={"=":()=>F(`conditionEquals`),"!=":()=>F(`conditionNotEquals`),">":()=>F(`conditionGreater`),"<":()=>F(`conditionLess`),matches:()=>F(`conditionMatches`),and:()=>F(`conditionAnd`),or:()=>F(`conditionOr`),not:()=>F(`conditionNot`),expression:()=>F(`conditionExpression`)},Nt=e=>Mt[e](),Pt=({part:e})=>Nt(e.kind===`compare`||e.kind===`logic`?e.op:e.kind),Ft={SUCCEEDED:()=>F(`statusSucceeded`),FAILED:()=>F(`statusFailed`),TIMED_OUT:()=>F(`statusTimedOut`),ABORTED:()=>F(`statusAborted`),SKIPPED:()=>F(`statusSkipped`)},It=e=>Object.hasOwn(Ft,e)?Ft[e]():e,Lt=34,Rt=280,zt=8,Bt=(e,t)=>e.kind===`condition`?{shown:e.inputs,folded:0}:e.kind===`make`?Et(e.inputs,t||e.inputs.length<=zt):{shown:[],folded:0},Vt=(e,t,n)=>{let r=new Set(t.filter(t=>t.source===e.id).map(e=>e.sourceHandle)),i=e.outputs.filter(e=>r.has(V(e.path))),a=i.length>0&&i.length<e.outputs.length;return n||!a?{shown:e.outputs,folded:0,foldable:a}:{shown:i,folded:e.outputs.length-i.length,foldable:a}},Ht=e=>106+e*26+8,Ut=(e,t,n)=>{let r=new Map;for(let i of e.nodes){if(i.kind===`state`&&j(i.state))continue;let{shown:e,folded:a}=Et(t.inputs.get(i.id)??[],n.has(i.id));r.set(i.id,{width:296,height:Dt(e.length,t.outputs.get(i.id)??[],a>0||n.has(i.id))})}for(let e of t.pure){if(e.kind===`condition`&&e.part.kind===`expression`){r.set(e.id,{width:216,height:Ht(e.inputs.length)});continue}if(e.kind===`select`){r.set(e.id,{width:Rt,height:Dt(e.part.cases.length+3,1,!1,Lt)});continue}if(e.kind===`break`){let i=Vt(e,t.edges,n.has(e.id));r.set(e.id,{width:216,height:Dt(0,i.shown.length,i.foldable,Lt)});continue}let{shown:i,folded:a}=Bt(e,n.has(e.id));r.set(e.id,{width:216,height:Dt(i.length,1,e.kind===`make`&&(a>0||n.has(e.id)),Lt)})}return r},Wt=(e,t)=>e+t*26+13,Gt=13,Kt=38,qt=(e,t,n)=>{let r=new Map;for(let i of e.nodes){if(i.kind===`state`&&j(i.state))continue;let{shown:e}=Et(t.inputs.get(i.id)??[],n.has(i.id));r.set(i.id,[...e.map((e,t)=>({handle:B(e.key),side:`in`,y:Wt(52,t)})),...(t.outputs.get(i.id)??[]).map((e,t)=>({handle:V(e.path),side:`out`,y:Wt(52,t)}))])}for(let e of t.pure){let i=(e,t=Kt)=>e.map((e,n)=>({handle:B(e.key),side:`in`,y:Wt(t,n)}));if(e.kind===`break`){let{shown:i}=Vt(e,t.edges,n.has(e.id));r.set(e.id,[{handle:$e,side:`in`,y:Gt},...i.map((e,t)=>({handle:V(e.path),side:`out`,y:Wt(Kt,t)}))])}else if(e.kind===`make`)r.set(e.id,[{handle:et,side:`out`,y:Gt},...i(Bt(e,n.has(e.id)).shown)]);else if(e.kind===`select`)r.set(e.id,[{handle:nt,side:`out`,y:Gt},...i(e.inputs)]);else{let t=e.part.kind===`expression`?Kt+64+4:Kt;r.set(e.id,[{handle:tt,side:`out`,y:Gt},...i(e.inputs,t)])}}return r},Jt=(e,t)=>{let n=e.nodes.find(e=>e.id===(t.kind===`break`?t.source:t.target));return n?.kind===`state`?n.parent:void 0},Yt=`trigger`,K=e=>e===``?Yt:`state:${e}`,q=e=>e!==Yt&&!e.startsWith(`state:`),J=e=>e===Yt?``:e.startsWith(`state:`)?e.slice(6):e,Xt=(e,t,n)=>{let{shown:r,folded:i}=Et(e.inputs.get(t)??[],n);return{inputs:r,outputs:e.outputs.get(t)??[],folded:i,open:n}},Zt=(e,t,n,r,i,a,o,s,c=!1)=>e.nodes.map(e=>{let l=t?.get(e.id)??{x:0,y:0,...U},u=e.kind===`state`?e.parent:void 0,d=e.kind===`trigger`?Ve(e.trigger,a):Fe(e.state,a),f=e.kind===`state`&&Ge(e.state,a),p=e.kind===`state`?F(`stateNode`,{name:e.name,type:d}):F(`triggerNode`,{trigger:d}),m=o?.get(e.id)??[],h=[...f?[F(`cacheForcedAgainst`)]:[],...m.map(e=>e.message)];return{id:K(e.id),type:e.kind,ariaLabel:[p,...h].join(`, `),position:{x:l.x,y:l.y},width:l.width,height:l.height,measured:{width:l.width,height:l.height},data:{node:e,kind:d,problems:n.get(e.id)??[],...i?.has(e.id)&&{trace:i.get(e.id)},...f&&{cacheWarning:f},...m.length>0&&{warnings:m},...s&&{pins:Xt(s.data,e.id,s.open.has(e.id))},...c&&{dataOrder:c}},draggable:!1,deletable:e.kind===`state`,selected:e.id===r,...u!==void 0&&{parentId:K(u),extent:`parent`}}}),Qt=40,$t=e=>e.length>Qt?`${e.slice(0,39)}…`:e,en=e=>{if(e.kind==="default")return F(`otherwise`);if(e.kind===`catch`)return F(`onError`,{errors:e.label??``});if(e.kind===`rule`)return e.label?$t(e.label):F(`conditionToWrite`)},tn=e=>({id:e.id,source:K(e.source),sourceHandle:`out`,target:K(e.target),targetHandle:`in`,deletable:!1,data:{kind:e.kind,field:e.field,source:e.source},...e.kind===`status`&&{className:`pb-workflow-status`}}),nn=(e,t=!1)=>e.edges.map(e=>{if(t)return tn(e);let n=en(e);return{id:e.id,source:K(e.source),sourceHandle:e.kind,target:K(e.target),targetHandle:`in`,deletable:e.kind!==`start`,data:{kind:e.kind,field:e.field,source:e.source},...n!==void 0&&{label:n},...e.kind===`catch`&&{className:`pb-workflow-catch`}}}),rn=(e,t,n,r)=>t.pure.map(i=>{let a=n?.get(i.id)??{x:0,y:0,...U},o=Jt(e,i),{shown:s,folded:c}=Bt(i,r.has(i.id)),l=i.kind===`break`?Vt(i,t.edges,r.has(i.id)):void 0,u=e.nodes.find(e=>e.id===(i.kind===`break`?i.source:i.target));return{id:i.id,type:`pure`,position:{x:a.x,y:a.y},width:a.width,height:a.height,measured:{width:a.width,height:a.height},data:{node:u,kind:i.kind,problems:[],pureData:{pure:i,shownInputs:s,shownOutputs:l?.shown??[],folded:l?.folded??c,open:r.has(i.id),foldable:l?l.foldable:c>0||r.has(i.id)}},draggable:!1,deletable:!0,...o!==void 0&&{parentId:K(o),extent:`parent`}}}),an=(e,t)=>{let n=e=>{let n=t.pure.find(t=>t.id===e);return n?n.kind===`break`?n.source:n.target:e},r=new Set(t.edges.map(e=>`${n(e.source)}\n${n(e.target)}`));return nn({...e,edges:e.edges.filter(e=>e.source!==``&&!r.has(`${e.source}\n${e.target}`))},!0)},on=e=>{let t=new Set(e.pure.map(e=>e.id)),n=e=>t.has(e)?e:K(e);return e.edges.map(e=>({id:e.id,source:n(e.source),sourceHandle:e.sourceHandle,target:n(e.target),targetHandle:e.targetHandle,deletable:!e.expression,data:{kind:`data`,wire:e},className:`pb-wire pb-wire-${G(e.type)}${e.expression?` pb-wire-expression`:``}`}))},sn=(0,R.createContext)(void 0),cn={succeeded:`green`,caught:`amber`,retrying:`amber`,failed:`red`,current:`blue`},ln=(0,R.createContext)(void 0),Y=()=>(0,R.useContext)(ln),un=e=>{if(e.options)return`choice`;if(e.type.kinds===`any`)return;let[t,...n]=e.type.kinds.filter(e=>e!==`null`);if(t===`string`&&n.every(e=>e===`integer`||e===`number`))return`string`;if(!(n.length>0))return t===`integer`||t===`number`?`number`:t===`boolean`?`boolean`:void 0},dn=e=>e.trim()===``?void 0:Number.isNaN(Number(e))?e:Number(e),fn=({name:e,className:t,value:n,onChange:i})=>{let[a,o]=(0,R.useState)();return(0,H.jsx)(r,{"aria-label":e,wrapperClassName:`${t} h-6 w-[55%] px-1.5`,className:`text-xs`,inputMode:`decimal`,value:a??(n===void 0?``:String(n)),onChange:e=>{o(e.target.value),i(dn(e.target.value))},onBlur:()=>o(void 0)})},pn=({pin:e,label:t,onChange:n})=>{if(e.state===`wired`||e.state===`made`||e.key===`#condition`&&e.state!==`expression`)return null;if(e.state===`expression`)return(0,H.jsx)(`span`,{className:`ml-auto shrink-0 rounded bg-muted px-1 font-mono text-xs text-muted-foreground`,title:F(`pinExpression`,{expression:String(e.value)}),children:`ƒ`});let i=un(e);if(e.state===`literal`&&typeof e.value==`object`)return(0,H.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,title:F(`pinObjectValue`),children:`{…}`});if(!i)return e.state===`literal`?(0,H.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-xs text-muted-foreground`,children:String(e.value)}):null;let a=F(`inputValue`,{label:t});if(!n)return(0,H.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-xs text-muted-foreground`,children:e.value===void 0?``:String(e.value)});let s=`nodrag nopan nowheel ml-auto min-w-0`;return i===`boolean`?(0,H.jsx)(l,{className:s,checked:e.value===!0,label:a,onChange:e=>n(e)}):i===`choice`?(0,H.jsxs)(o,{"aria-label":a,className:`${s} h-6 max-w-[55%] px-1 py-0 text-xs`,value:typeof e.value==`string`?e.value:``,onChange:e=>n(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(`option`,{value:``}),e.options.map(t=>(0,H.jsx)(`option`,{value:t,children:e.statuses?It(t):t},t))]}):i===`number`?(0,H.jsx)(fn,{name:a,className:s,value:e.value,onChange:n}):(0,H.jsx)(r,{"aria-label":a,wrapperClassName:`${s} h-6 w-[55%] px-1.5`,className:`text-xs`,value:e.value===void 0?``:String(e.value),onChange:e=>n(e.target.value===``?void 0:e.target.value)})},mn=e=>`pb-pin pb-pin-${G(e.type)}`,hn=({pin:e,step:t,keys:n,connectable:r,name:i,onValue:a,bare:o=!1})=>{let s=Y(),c=i??jt(e.key);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center gap-1.5 pr-2 pl-3`,children:[(0,H.jsx)(L,{id:B(e.key),type:`target`,position:I.Left,isConnectable:r,className:mn(e)}),(0,H.jsxs)(`span`,{className:`min-w-0 shrink truncate text-xs text-body`,title:F(`pinTypeTitle`,{label:c,type:W(e.type)}),children:[c,e.required&&(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-danger-text`,children:`*`})]}),!o&&(0,H.jsx)(pn,{pin:e,label:c,...s&&r&&{onChange:a??(e=>s.setArgument(t,n,e))}})]})},gn=({pin:e,connectable:t,trigger:n=!1,field:r=!1})=>{let i=At(e.path,n,r);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center justify-end pr-3 pl-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-xs text-body`,title:F(`pinTypeTitle`,{label:i,type:W(e.type)}),children:i}),(0,H.jsx)(L,{id:V(e.path),type:`source`,position:I.Right,isConnectable:t,className:mn(e)})]})},_n=({inputs:e,outputs:t,connectable:n})=>{let r=(e,t)=>({top:`${(e+1)*100/(t+1)}%`});return(0,H.jsxs)(H.Fragment,{children:[e.map((t,i)=>(0,H.jsx)(L,{id:B(t.key),type:`target`,position:I.Left,isConnectable:n,className:mn(t),style:r(i,e.length),title:F(`pinTypeTitle`,{label:jt(t.key),type:W(t.type)})},t.key)),t.map((e,i)=>(0,H.jsx)(L,{id:V(e.path),type:`source`,position:I.Right,isConnectable:n,className:mn(e),style:r(i,t.length),title:F(`pinTypeTitle`,{label:At(e.path),type:W(e.type)})},e.path.join(`/`)))]})},vn=({node:e,folded:t,open:n,fields:r=!1})=>{let i=Y();return t===0&&!n?null:(0,H.jsx)(`button`,{type:`button`,className:`nodrag h-6 w-full px-3 text-left text-xs text-muted-foreground hover:text-foreground`,onClick:()=>i?.toggleOpen(e),disabled:!i,children:r?n?F(`foldLessFields`):F(`foldMoreFields`,{count:t}):n?F(`foldLess`):F(`foldMore`,{count:t})})},yn=({node:e,inputs:t,outputs:n,folded:r,open:i,editable:a,trigger:o=!1})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-[3fr_2fr]`,children:[(0,H.jsx)(`div`,{className:`min-w-0`,children:t.map(t=>(0,H.jsx)(hn,{pin:t,step:e,keys:[t.key],connectable:a},t.key))}),(0,H.jsx)(`div`,{className:`min-w-0`,children:n.map(e=>(0,H.jsx)(gn,{pin:e,connectable:a,trigger:o},JSON.stringify(e.path)))})]}),(0,H.jsx)(vn,{node:e,folded:r,open:i})]}),bn=(0,R.createContext)(void 0),xn=`nodrag absolute -top-4 -right-4 z-10`,Sn=({node:e,name:t})=>{let n=(0,R.useContext)(bn);return n?(0,H.jsx)(f,{size:`icon`,className:xn,"aria-label":F(`unpin`,{name:t}),title:F(`unpinHelp`),onClick:t=>{t.stopPropagation(),n(e)},children:(0,H.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0})}):(0,H.jsxs)(`span`,{className:a(xn,`inline-flex size-7 items-center justify-center rounded-md border border-border-strong bg-background text-muted-foreground shadow-sm`),title:F(`movedByHand`),children:[(0,H.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`sr-only`,children:F(`movedByHand`)})]})},X=[18,38],Cn=e=>{if(e.Type===`Choice`)return[{kind:`rule`,top:X[0],label:F(`when`)},{kind:`default`,top:X[1],label:F(`otherwise`)}];let t=[`Task`,`Pass`,`Wait`,`Map`,`Block`].includes(e.Type)?[{kind:`next`,top:X[0]}]:[],n=e.Type===`Task`||e.Type===`Map`||e.Type===`Block`?[{kind:`catch`,top:X[t.length],label:F(`onErrorHandle`)}]:[];return[...t,...n]},wn=(e,t,n)=>{let r=(0,R.useContext)(sn);if(!r||!t)return{};let i=t=>{t.stopPropagation(),r(e)},a=n?F(`addStepAtNamedHandle`,{handle:n}):F(`addStepAtHandle`);return{role:`button`,tabIndex:0,"aria-label":a,title:a,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i(e))}}},Tn=({source:e,path:t,editable:n})=>(0,H.jsx)(L,{id:e.kind,type:`source`,position:I.Right,isConnectable:n,style:{top:e.top},className:a(`pb-workflow-exec`,`pb-workflow-handle-${e.kind}`),...wn({kind:e.kind,source:t},n,e.label),children:e.label&&(0,H.jsx)(`span`,{className:`pb-workflow-handle-label`,children:e.label})}),En=({state:e,path:t,editable:n})=>Cn(e).map(e=>(0,H.jsx)(Tn,{source:e,path:t,editable:n},e.kind)),Dn=({count:e})=>e>0&&(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-danger-text`,title:F(`problemCount`,{count:e}),children:[(0,H.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:F(`problemCount`,{count:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:e})]}),On=({label:e})=>(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center text-warning-text`,title:e,children:[(0,H.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:e})]}),kn=({trace:e})=>(0,H.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end gap-0.5`,children:[e.changed?(0,H.jsx)(`span`,{title:F(`changedSinceRun`),className:`rounded-full border border-dashed px-1.5 text-xs text-muted-foreground`,children:F(`changedShort`)}):(0,H.jsx)(c,{tone:cn[e.status],children:Ue(e.status)}),e.steps>1&&(0,H.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:F(`traceSteps`,{count:e.steps})})]}),An=(e,t,n)=>a(`rounded-lg border bg-background text-body shadow-sm`,t>0||n?.status===`failed`?`border-danger`:`border-border-strong`,e&&`ring-2 ring-primary/40`),jn=({name:e,kind:t,problems:n,first:r,trace:i,warnings:a=[]})=>(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:[t,r&&(0,H.jsxs)(`span`,{className:`text-primary-text`,children:[` · `,F(`startsHere`)]})]}),a.length>0&&(0,H.jsx)(On,{label:a.join(`
3
+ `)}),(0,H.jsx)(Dn,{count:n}),i&&(0,H.jsx)(kn,{trace:i})]}),(0,H.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e})]}),Mn=()=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(L,{id:`in`,type:`target`,position:I.Left,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}}),(0,H.jsx)(L,{id:`out`,type:`source`,position:I.Right,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}})]}),Nn=({condition:e})=>e!==void 0&&(0,H.jsx)(`span`,{className:`absolute top-1 right-6 max-w-[45%] truncate rounded bg-muted px-1 text-[0.625rem] text-muted-foreground`,title:e,children:F(`onlyWhenBadge`)}),Pn=({id:e,data:t,selected:n,isConnectable:r})=>{let{node:i,kind:o,problems:s,trace:c,cacheWarning:l,warnings:u=[],pins:d,dataOrder:f,moved:p}=t;return i.kind===`state`?(0,H.jsxs)(`div`,{className:a(An(n,s.length,c),`h-full`,j(i.state)&&`bg-muted/40`),children:[p&&(0,H.jsx)(Sn,{node:e,name:i.name}),(0,H.jsxs)(`div`,{className:`relative h-[52px] py-2 pr-6 pl-4`,children:[f?(0,H.jsx)(Mn,{}):(0,H.jsx)(L,{id:`in`,type:`target`,position:I.Left,isConnectable:r,className:`pb-workflow-exec`,style:{top:X[0]}}),f&&(0,H.jsx)(Nn,{condition:i.state.Condition}),(0,H.jsx)(jn,{name:i.name,kind:o,problems:s.length,first:i.first&&i.parent!==void 0,trace:c,warnings:[...l?[F(`cacheForcedAgainst`)]:[],...u.map(e=>e.message)]}),!f&&(0,H.jsx)(En,{state:i.state,path:i.id,editable:r}),d&&j(i.state)&&(0,H.jsx)(_n,{inputs:d.inputs,outputs:d.outputs,connectable:r})]}),d&&!j(i.state)&&(0,H.jsx)(yn,{node:i.id,inputs:d.inputs,outputs:d.outputs,folded:d.folded,open:d.open,editable:r})]}):null},Fn=({id:e,data:t,selected:n,isConnectable:r})=>{let{node:i,kind:o,problems:s,pins:c,dataOrder:l,moved:u}=t,d=wn({kind:`start`,source:i.id},r&&!l);return i.kind===`trigger`?(0,H.jsxs)(`div`,{className:a(An(n,s.length),`h-full border-dashed`),children:[u&&(0,H.jsx)(Sn,{node:e,name:F(`trigger`)}),(0,H.jsxs)(`div`,{className:`relative h-[52px] py-2 pr-6 pl-4`,children:[(0,H.jsx)(jn,{name:o,kind:F(`trigger`),problems:s.length}),l?(0,H.jsx)(L,{id:`out`,type:`source`,position:I.Right,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}}):(0,H.jsx)(L,{id:`start`,type:`source`,position:I.Right,isConnectable:r,className:`pb-workflow-exec`,style:{top:X[0]},...d})]}),c&&(0,H.jsx)(yn,{node:i.id,inputs:[],outputs:c.outputs,folded:0,open:!1,editable:r,trigger:!0})]}):null},In=`protobase:workflow-graph-view`,Ln=e=>d(()=>e().getItem(`protobase:workflow-graph-view`),null)===`simple`?`simple`:`pins`,Rn=(e,t)=>d(()=>t===`pins`?e().removeItem(In):e().setItem(In,t),void 0),zn=()=>localStorage,Bn=()=>{let[e,t]=(0,R.useState)(()=>Ln(zn));return[e,e=>{t(e),Rn(zn,e)}]},Vn=(e,t)=>e.part.kind===`not`?F(`conditionNotSide`):e.part.kind===`matches`?F(t===`0`?`conditionMatchesText`:`conditionMatchesPattern`):e.part.kind===`logic`?String.fromCharCode(65+Number(t)%26):F(t===`0`?`conditionSideA`:`conditionSideB`),Hn=({node:e,source:t})=>{let n=Y(),[r,i]=(0,R.useState)(),a=t.trim();return(0,H.jsx)(`textarea`,{"aria-label":F(`conditionExpressionText`),className:`nodrag nopan nowheel block w-full resize-none rounded border border-border bg-background px-1.5 py-1 font-mono text-xs text-foreground`,style:{height:64},spellCheck:!1,readOnly:!n,value:r??a,onChange:e=>i(e.target.value),onBlur:()=>{i(void 0);let t=r?.trim();t!==void 0&&t!==a&&n?.setCondition(e.target,t===``?void 0:`{% ${t} %}`)}})},Un=e=>e.replace(/^\$states\.context\.Steps\./,``).replace(/^\$states\.context\.Execution\.Input/,`input`),Wn=({node:e,editable:t})=>{let n=Y(),[i,a]=(0,R.useState)(),o=F(`conditionMatchesPattern`),s=String(e.inputs[1]?.value??``);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center gap-1.5 pr-2 pl-3`,children:[(0,H.jsx)(`span`,{className:`min-w-0 shrink truncate text-xs text-body`,children:o}),(0,H.jsx)(r,{"aria-label":F(`inputValue`,{label:o}),wrapperClassName:`nodrag nopan nowheel ml-auto h-6 w-[60%] min-w-0 px-1.5`,className:`font-mono text-xs`,value:i??s,disabled:!n||!t,onChange:t=>{a(t.target.value),t.target.value!==``&&n?.setConditionSide(e.target,[...e.at,1],t.target.value)},onBlur:()=>a(void 0)})]})},Gn=({node:e,editable:t})=>{let n=Y(),r=(0,H.jsx)(L,{id:tt,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-boolean`,style:{top:13}});return e.part.kind===`expression`?(0,H.jsxs)(`div`,{className:`relative grid gap-1 px-2 pt-1`,children:[r,(0,H.jsx)(Hn,{node:e,source:e.part.source}),(0,H.jsx)(`div`,{className:`-mx-2`,children:e.inputs.map(e=>(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center pr-2 pl-3`,children:[(0,H.jsx)(L,{id:B(e.key),type:`target`,position:I.Left,isConnectable:!1,className:`pb-pin pb-pin-${G(e.type)}`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-body`,title:F(`pinTypeTitle`,{label:e.key,type:W(e.type)}),children:Un(e.key)})]},e.key))})]}):(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[r,e.inputs.map(r=>e.part.kind===`matches`&&r.key===`1`?(0,H.jsx)(Wn,{node:e,editable:t},r.key):(0,H.jsx)(hn,{pin:r,step:e.target,keys:[],name:Vn(e,r.key),bare:e.part.kind===`logic`&&Number(r.key)===e.part.sides.length,connectable:t,onValue:t=>n?.setConditionSide(e.target,[...e.at,Number(r.key)],t??``)},r.key))]})},Kn=(e,t)=>typeof t==`number`&&e.trim()!==``&&Number.isFinite(Number(e))?Number(e):typeof t==`boolean`&&(e===`true`||e===`false`)?e===`true`:e,qn=`nodrag nopan nowheel h-6 min-w-0 px-1.5`,Jn=({label:e,value:t,onChange:n,disabled:i})=>(0,H.jsx)(r,{"aria-label":e,wrapperClassName:`${qn} flex-1`,className:`text-xs`,value:String(t),disabled:i,onChange:e=>n(Kn(e.target.value,t))}),Yn=({node:e,editable:t})=>{let n=Y(),r=!n||!t,i=t=>n?.setArgument(e.target,[e.key],D(t)),{part:a}=e,o=(e,t)=>i({...a,cases:a.cases.map((n,r)=>r===e?{...n,...t}:n)});return(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:nt,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-${G(e.type)}`,style:{top:13}}),e.inputs.map(n=>(0,H.jsx)(hn,{pin:n,step:e.target,keys:[],name:F(`selectInput`),connectable:t,onValue:e=>i({...a,operand:{value:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:``}})},n.key)),a.cases.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1 pr-2 pl-3`,children:[(0,H.jsx)(Jn,{label:F(`selectWhen`,{case:t+1}),value:e.when,disabled:r,onChange:e=>o(t,{when:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-muted-foreground`,children:`→`}),(0,H.jsx)(Jn,{label:F(`selectThen`,{case:t+1}),value:e.then,disabled:r,onChange:e=>o(t,{then:e})}),(0,H.jsx)(`button`,{type:`button`,className:`nodrag shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-40`,"aria-label":F(`selectRemoveCase`,{case:t+1}),disabled:r||a.cases.length===1,onClick:()=>i({...a,cases:a.cases.filter((e,n)=>n!==t)}),children:(0,H.jsx)(u,{className:`size-3`,"aria-hidden":!0})})]},t)),(0,H.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1 pr-2 pl-3`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-body`,children:F(`selectOtherwise`)}),(0,H.jsx)(Jn,{label:F(`selectOtherwise`),value:a.otherwise,disabled:r,onChange:e=>i({...a,otherwise:e})})]}),(0,H.jsx)(`button`,{type:`button`,className:`nodrag h-6 w-full px-3 text-left text-xs text-muted-foreground hover:text-foreground`,disabled:r,onClick:()=>i({...a,cases:[...a.cases,{when:``,then:``}]}),children:F(`selectAddCase`)})]})},Xn=e=>e.kind===`condition`?Pt(e):e.kind===`select`?F(`selectTitle`):e.kind===`break`?F(`breakTitle`,{type:W(e.type)}):F(`makeTitle`,{type:W(e.type)}),Zn=({pure:e})=>(0,H.jsx)(`div`,{className:`truncate border-b px-3 py-1.5 text-xs font-medium text-foreground`,children:Xn(e)}),Qn=({id:e,data:t,selected:n,isConnectable:r})=>{let{pureData:i,moved:o}=t;if(!i)return null;let{pure:s,shownInputs:c,shownOutputs:l,folded:u,open:d,foldable:f}=i;return(0,H.jsxs)(`div`,{className:a(`h-full rounded-lg border border-dashed border-border-strong bg-background text-body shadow-sm`,n&&`ring-2 ring-primary/40`),children:[o&&(0,H.jsx)(Sn,{node:e,name:Xn(s)}),(0,H.jsx)(Zn,{pure:s}),s.kind===`condition`?(0,H.jsx)(Gn,{node:s,editable:r}):s.kind===`select`?(0,H.jsx)(Yn,{node:s,editable:r}):s.kind===`break`?(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:$e,type:`target`,position:I.Left,isConnectable:!1,className:`pb-pin pb-pin-${G(s.type)}`,style:{top:13}}),l.map(e=>(0,H.jsx)(gn,{pin:e,connectable:r,field:!0},JSON.stringify(e.path))),f&&(0,H.jsx)(vn,{node:s.id,folded:u,open:d,fields:!0})]}):(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:et,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-${G(s.type)}`,style:{top:13}}),c.map(e=>(0,H.jsx)(hn,{pin:e,step:s.target,keys:[s.key,e.key],connectable:r},e.key)),(0,H.jsx)(vn,{node:s.id,folded:u,open:d})]})]})},$n=({offer:e,onClose:t})=>(0,H.jsxs)(`div`,{role:`dialog`,"aria-label":F(`pureOfferTitle`),className:`absolute z-10 grid gap-1 rounded-md border bg-background p-1 shadow-md`,style:{left:e.x,top:e.y},children:[e.choices.map((e,n)=>(0,H.jsx)(f,{size:`sm`,variant:`ghost`,className:`justify-start`,autoFocus:n===0,onClick:()=>{e.add(),t()},children:e.label},e.label)),(0,H.jsx)(f,{size:`sm`,variant:`ghost`,onClick:t,children:F(`pureOfferClose`)})]}),er=e=>typeof e==`object`&&!!e&&!Array.isArray(e),tr=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Z={kinds:[`boolean`]},nr=e=>e.sides.flatMap(e=>b(e)?nr(e):`read`in e?[e.read]:[]),rr=e=>!b(e)&&`read`in e&&`step`in e.read.base&&tr(e.read.path,[`Status`]),ir=(e,t)=>{if(t&&t.kinds!==`any`){let e=t.kinds.filter(e=>e!==`null`);if(e.length===1&&[`string`,`integer`,`number`,`boolean`].includes(e[0]))return{kinds:e}}return{kinds:[typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:`string`]}},ar=e=>{let t=new Map;for(let[n,r]of re(e.stateMachine)){let i=`Assign`in r&&er(r.Assign)?r.Assign:{};for(let[r,a]of Object.entries(i)){let i=a===`{% $states.result %}`?ae(e.stateMachine,n)?.join(`/`):void 0;t.set(r,t.has(r)||i===void 0?null:i)}}return t},or=(e,t,n=[])=>{let r=new Map(re(e.stateMachine).map(([t,n])=>[ae(e.stateMachine,t).join(`/`),n])),i=ne(e)===`data`,a=new Map([[``,ce(e,t)],...[...r].map(([e,n])=>[e,[...le(n,t),...i?[fe]:[]]])]),o=new Map([...r].filter(([,e])=>i||e.Type===`Task`).map(([e,n])=>[e,[...i?[M(n)]:[],...se(n,t)]])),s=e=>[...r.keys()].find(t=>t.split(`/`).at(-1)===e),c=new Map,l=new Map,u=[],d=[],f=new Map,p=ar(e),m=(e,t,n,r=!1)=>{let i=`data:${e.node}|${e.handle}->${t}|${n}`;r&&f.has(i)||f.set(i,{id:i,source:e.node,sourceHandle:e.handle,target:t,targetHandle:n,type:e.type,...r&&{expression:!0}})},g=(e,t)=>{let n=e.find(e=>tr(e.path,t));return n||(n={path:t,type:_(void 0)},e.push(n)),n},y=(e,t)=>{let n=a.get(e),r=n.find(e=>tr(e.path,t)),i=n.some(e=>e.path.length>0&&e.path[0]!==`#status`);if(r||t.length===0||i&&t.length===1){let i=r??g(n,t);return{node:e,handle:V(i.path),type:i.type}}let o=S(e,t.slice(0,-1)),s=g(o.outputs,t.slice(-1));return{node:o.id,handle:V(s.path),type:s.type}},S=(n,i)=>{let a=Ye(n,i),o=c.get(a);if(o)return o;let s=ge(e,r.get(n),t,i),l={kind:`break`,id:a,source:n,path:i,type:_(s),outputs:de(s).map(([e,t])=>({path:[e],type:_(t)}))};return c.set(a,l),m(y(n,i),a,$e),l},C=(e,t,n)=>{let r=T(e);if(r)return m(r,t,n);for(let r of O(e)){let e=D(r);e&&m(e,t,n,!0)}},T=e=>{let t=ie(e);return t&&D(t)},D=e=>{if(`step`in e.base){let t=s(e.base.step);return t===void 0||!a.has(t)?void 0:y(t,[P,...e.path])}let t=`input`in e.base?``:p.get(e.base.variable);return t==null||!a.has(t)?void 0:y(t,e.path)},A=e=>{if(b(e)||!(`read`in e))return;if(!rr(e))return D(e.read);let t=s(e.read.base.step);return t===void 0||!a.has(t)?void 0:y(t,[P])},oe=(e,t,n,r)=>{let i=Ze(e,n),a=t.sides,o=a.map(A),s=a.map((e,n)=>{let r=String(n);if(b(e))return{key:r,type:Z,required:!1,value:void 0,state:`made`};if(`read`in e)return{key:r,type:o[n]?.type??_(void 0),required:!1,value:k(e.read),state:`wired`};if(`pattern`in e)return{key:r,type:{kinds:[`string`]},required:!1,value:e.pattern,state:`literal`};if(t.kind===`matches`)return{key:r,type:{kinds:[`string`]},required:!1,value:e.value,state:`literal`};if(t.kind!==`compare`)return{key:r,type:Z,required:!1,value:e.value,state:`literal`};let i=a[1-n];return rr(i)?{key:r,type:{kinds:[`string`]},required:!1,value:e.value,state:`literal`,options:x,statuses:!0}:{key:r,type:ir(e.value,o[1-n]?.type),required:!1,value:e.value,state:`literal`}});t.kind===`logic`&&s.push({key:String(a.length),type:Z,required:!1,value:void 0,state:`empty`}),u.push({kind:`condition`,id:i,target:e,at:n,part:t,inputs:s}),m({node:i,handle:tt,type:Z},r.node,r.handle),a.forEach((t,r)=>{b(t)?oe(e,t,[...n,r],{node:i,handle:B(String(r))}):o[r]&&m(o[r],i,B(String(r)))})},j=(e,t)=>{let n=E(t),r={node:e,handle:B(he)};if(n&&nr(n).every(e=>A({read:e})))return oe(e,n,[],r);let i=Ze(e,[]),a=O(t).flatMap(e=>{let t=A({read:e});return t?[{read:e,source:t}]:[]});u.push({kind:`condition`,id:i,target:e,at:[],part:{kind:`expression`,source:v(t)},inputs:a.map(({read:e,source:t})=>({key:te(e),type:t.type,required:!1,value:k(e),state:`wired`}))}),m({node:i,handle:tt,type:Z},r.node,r.handle);for(let{read:e,source:t}of a)m(t,i,B(te(e)),!0)},ue=(e,t)=>{let n=w(t.value),r=n&&A(n.operand);if(!n||`read`in n.operand&&!r)return!1;let i=Qe(e,t.key),a=`read`in n.operand?{key:rt,type:r.type,required:!1,value:k(n.operand.read),state:`wired`}:{key:rt,type:{kinds:[`string`]},required:!1,value:n.operand.value,state:`literal`};return d.push({kind:`select`,id:i,target:e,key:t.key,part:n,type:t.type,inputs:[a]}),m({node:i,handle:nt,type:t.type},e,B(t.key)),r&&m(r,i,B(rt)),!0},pe=(e,n)=>{let i=Xe(e,n),a=l.get(i);if(a)return a;let s=o.get(e)?.find(e=>e.key===n),c=r.get(e),u=h(ee(c,t),[n]),d=er(s?.value)?s.value:{},f=new Set(Array.isArray(u?.required)?u.required:[]),p=de(u).map(([e,t])=>N(e,t,d[e],f.has(e))),g=Object.keys(d).filter(e=>!p.some(t=>t.key===e)).map(e=>N(e,h(u,[e])??{},d[e],!1)),v={kind:`make`,id:i,target:e,key:n,type:s?.type??_(u),inputs:[...p,...g]};l.set(i,v),m({node:i,handle:et,type:v.type},e,B(n));for(let e of v.inputs)C(e.value,i,B(e.key));return v};for(let[e,t]of o)for(let[n,r]of t.entries()){if(r.key===`#condition`&&r.state===`expression`){t[n]={...r,state:`made`},j(e,r.value);continue}if(r.state===`expression`&&ue(e,r)){t[n]={...r,state:`made`};continue}r.state===`made`&&pe(e,r.key),(r.state===`wired`||r.state===`expression`)&&C(r.value,e,B(r.key))}for(let e of n)e.kind===`break`&&a.has(e.source)&&S(e.source,e.path),e.kind===`make`&&o.get(e.target)?.some(t=>t.key===e.key&&t.state!==`wired`&&t.state!==`expression`)&&pe(e.target,e.key);return{inputs:o,outputs:a,pure:[...c.values(),...l.values(),...u,...d],edges:[...f.values()]}},sr=e=>e.reason===`notBefore`?F(`refuseNotBefore`,{step:e.step}):e.reason===`otherScope`?F(`refuseOtherScope`,{step:e.step}):e.reason===`shapesOutput`?F(`refuseShaped`,{step:e.step}):e.reason===`type`?F(`refuseType`,{source:W(e.source),target:W(e.target)}):F(`refuseNotPins`),Q=e=>it(e)!==void 0||at(e)!==void 0,$=(e,t)=>({node:J(e),handle:t??``}),cr=e=>e!==`any`&&e.includes(`object`),lr=(e,t)=>e.map(e=>({label:Nt(e),add:()=>t(e)})),ur=(e,t)=>{let n=e=>e.kind===`break`?Ye(e.source,e.path):Xe(e.target,e.key),r=e=>e.kind===`break`&&t.some(t=>t.kind===`break`&&t.source===e.source&&t.path.every((t,n)=>e.path[n]===t));return e.filter(e=>!r(e)&&!t.some(t=>t.id===n(e)))},dr=(e,t,n,r,i)=>{let a=r?.edits,[o,s]=(0,R.useState)([]),[c,l]=(0,R.useState)(new Set),[u,d]=(0,R.useState)(),f=(0,R.useRef)({definition:e,editing:r});(0,R.useEffect)(()=>{f.current={definition:e,editing:r}});let p=(0,R.useMemo)(()=>n&&or(e,n,o),[e,n,o]),m=ne(e)===`data`,h=(0,R.useMemo)(()=>{if(p)return{sizes:Ut(t,p,c),pure:p.pure.map(e=>({id:e.id,parent:Jt(t,e)})),wires:p.edges.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),ports:qt(t,p,c),dataOrder:m}},[t,p,c,m]),g=r&&{setArgument:(t,n,i)=>r.onChange(r.edits.setArgument(e,t,n,i)),setConditionSide:(t,n,i)=>r.onChange(r.edits.setConditionSide(e,t,n,{value:i})),setCondition:(t,n)=>r.onChange(r.edits.setArgument(e,t,[`#condition`],n)),toggleOpen:e=>l(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e]))},_=(t,n)=>{if(!p||!a||!Q(t.handle)||!Q(n.handle))return;let[r,i]=at(t.handle)?[t,n]:[n,t],o=a.wireRefusal(e,p,$(r.node,r.handle),$(i.node,i.handle));return o&&sr(o)},v=t=>!!(p&&a)&&a.wireRefusal(e,p,$(t.source,t.sourceHandle),$(t.target,t.targetHandle))===void 0,ee=t=>{r&&p&&r.onChange(r.edits.connectData(e,p,$(t.source,t.sourceHandle),$(t.target,t.targetHandle)))},y=(e,t,n)=>{if(!p||!a)return e;let r=e,i=n.flatMap(e=>{let t=e.data?.wire,n=t&&p.pure.find(e=>e.kind===`break`&&e.id===t.target||e.kind===`make`&&e.id===t.source);return n?[{id:n.id}]:[]}),o=[...t.filter(e=>q(e.id)),...i.filter(e=>!t.some(t=>t.id===e.id))],c=n.flatMap(e=>{let t=e.data?.wire;return t&&!o.some(e=>e.id===t.source||e.id===t.target)?[{wire:t}]:[]}),l=o.flatMap(e=>p.pure.filter(t=>t.id===e.id).map(e=>({pure:e}))),u=[...c,...l];for(let e of lt(p,u,e=>`wire`in e?ot(p,e.wire):st(e.pure)))r=`wire`in e?a.disconnectData(r,p,e.wire):a.removePure(r,p,e.pure);return o.length>0&&s(e=>ur(e,o.flatMap(e=>p.pure.filter(t=>t.id===e.id)))),r},te=(e,t)=>{let{definition:n,editing:r}=f.current;r?.onChange(r.edits.addSelect(n,e,t))},b=(e,t,n)=>{let{definition:r,editing:i}=f.current;i?.onChange(i.edits.addCondition(r,e,t,n))};return{data:p,open:c,layout:h,actions:g,check:_,isValid:v,connect:ee,remove:y,connectEnd:(e,t)=>{if(!p||!r||t.isValid||t.toHandle||!t.fromHandle?.id||!t.fromNode)return;let n=J(t.fromNode.id),a=t.fromHandle.id,o=`changedTouches`in e?e.changedTouches[0]:e,c=i.current?.getBoundingClientRect(),l={x:o.clientX-(c?.left??0),y:o.clientY-(c?.top??0)},u=at(a);if(u){let e=p.pure.find(e=>e.id===n),t=(e?.kind===`break`?e.outputs:p.outputs.get(n)??[]).find(e=>JSON.stringify(e.path)===JSON.stringify(u))?.type;if(!t||!cr(t.kinds))return;let r=e?.kind===`break`?{source:e.source,path:[...e.path,...u]}:{source:n,path:u};d({...l,choices:[{label:F(`breakTitle`,{type:W(t)}),add:()=>s(e=>[...e,{kind:`break`,...r}])}]});return}let f=it(a),m=p.pure.find(e=>e.id===n);if(m?.kind===`condition`){let e=m.inputs.find(e=>e.key===f);if(!e||e.state!==`literal`&&e.state!==`empty`||m.part.kind!==`logic`&&m.part.kind!==`not`)return;d({...l,choices:lr(r.edits.conditionChoices(!1),e=>b(m.target,[...m.at,Number(f)],e))});return}let h=f===void 0?void 0:p.inputs.get(n)?.find(e=>e.key===f);if(h?.key===`#condition`&&h.state===`empty`){d({...l,choices:lr(r.edits.conditionChoices(!0),e=>b(n,[],e))});return}if(h&&h.key!==`#condition`&&!cr(h.type.kinds)&&(h.state===`empty`||h.state===`literal`)){d({...l,choices:[{label:F(`selectOffer`),add:()=>te(n,h.key)}]});return}h&&cr(h.type.kinds)&&h.state!==`wired`&&h.state!==`expression`&&d({...l,choices:[{label:F(`makeTitle`,{type:W(h.type)}),add:()=>s(e=>[...e,{kind:`make`,target:n,key:h.key}])}]})},offer:u,closeOffer:()=>d(void 0)}},fr=(0,R.createContext)(void 0),pr=({fromX:e,fromY:t,toX:n,toY:r,fromPosition:i,toPosition:a,connectionStatus:o,fromNode:s,fromHandle:c,toNode:l,toHandle:u})=>{let d=(0,R.useContext)(fr),[f]=_e({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a}),p=o===`invalid`&&l&&u?.id&&c.id?d?.({node:s.id,handle:c.id},{node:l.id,handle:u.id}):void 0;return(0,H.jsxs)(`g`,{className:p?`pb-wire-refused`:void 0,children:[(0,H.jsx)(`path`,{d:f,fill:`none`,className:`react-flow__connection-path`}),p&&(0,H.jsx)(`foreignObject`,{x:n+12,y:r-30,width:260,height:28,className:`overflow-visible`,children:(0,H.jsx)(`div`,{className:`inline-block rounded border border-danger bg-danger-soft px-1.5 py-0.5 text-xs whitespace-nowrap text-danger-text shadow`,children:p})})]})},mr=(e,t)=>{let n=De(),[r,i]=(0,R.useState)(),a=(0,R.useMemo)(()=>JSON.stringify(xt(e,t)),[e,t]);return(0,R.useEffect)(()=>{if(!n)return;let e=!0;return Ct(n,JSON.parse(a)).then(t=>{e&&i(t)}),()=>{e=!1}},[n,a]),r},hr={state:Pn,trigger:Fn,pure:Qn},gr=e=>e?.kind===`state`?e.scope.join(`/`):``,_r=({laidOut:e,tidied:t})=>{let n=ye();return(0,R.useEffect)(()=>{e&&n.fitView({maxZoom:1,padding:.1})},[e,t]),null},vr=()=>{let e=ye(),t=xe(e=>e.width),n=(0,R.useRef)(t);return(0,R.useEffect)(()=>{let r=n.current;if(n.current=t,r===0||t===0||t===r)return;let{x:i,y:a,zoom:o}=e.getViewport();e.setViewport({x:i+(t-r)/2,y:a,zoom:o})},[t,e]),null},yr=({laidOut:e,ids:t})=>{let n=Ee();return(0,R.useEffect)(()=>{e&&n(t)},[e]),null},br=new Map,xr=({definition:e,problems:t,warnings:n,selected:r,onSelect:a,onChange:o,edits:s,onAddAt:c,traces:l,types:u,schemas:d,fills:p=!1,layout:h,onLayoutChange:g})=>{let _=o&&s&&{onChange:o,edits:s},v=(0,R.useMemo)(()=>ht(e),[e]),ee=(0,R.useRef)(null),[y,te]=Bn(),b=dr(e,v,y===`pins`?d:void 0,_,ee),x=mr(v,b.layout),S=(0,R.useMemo)(()=>new Map(v.nodes.map(e=>[e.id,e])),[v]),re=JSON.stringify(h??{}),C=(0,R.useMemo)(()=>pe(re),[re]),w=C[y],T=e=>g?.({...C,[y]:e}),E=(0,R.useMemo)(()=>new Map([...v.nodes.map(e=>[e.id,me(e.id)]),...(b.data?.pure??[]).map(e=>[e.id,me(e.id,e)])]),[v,b.data]),D=(0,R.useMemo)(()=>new Map([...E].flatMap(([e,t])=>Object.hasOwn(w,t)?[[e,w[t]]]:[])),[E,w]),O=(0,R.useMemo)(()=>{if(!x)return;let e=new Map((b.data?.pure??[]).map(e=>[e.id,e]));return ue(x,D,t=>{let n=S.get(t);return e.has(t)?Jt(v,e.get(t)):n?.kind===`state`?n.parent:void 0})},[x,D,S,v,b.data]),k=!!g,[ie,ae]=(0,R.useState)(br),[A,j]=(0,R.useState)(0),M=ne(e)===`data`,[N,se]=(0,R.useState)(()=>new Set(r===void 0?[]:[K(r)]));(0,R.useEffect)(()=>{se(e=>r===void 0?e.size===1&&!q([...e][0])?new Set:e:e.has(K(r))?e:new Set([K(r)]))},[r]);let ce=(0,R.useMemo)(()=>[...Zt(v,O,t,r,l,u,n,b.data&&{data:b.data,open:b.open},M),...b.data?rn(v,b.data,O,b.open):[]].map(e=>{let t=ie.get(e.id),n=D.has(J(e.id));return{...e,selected:N.has(e.id),draggable:k,...t&&{position:t},...n&&{data:{...e.data,moved:!0},...e.ariaLabel&&{ariaLabel:`${e.ariaLabel}, ${F(`movedByHand`)}`}}}}),[v,O,t,r,l,u,n,b.data,b.open,M,N,ie,D,k]),[le,de]=(0,R.useState)(),fe=(0,R.useMemo)(()=>[...M&&b.data?an(v,b.data):nn(v,M),...b.data?on(b.data):[]].map(e=>({...e,selected:e.id===le})),[v,b.data,le,M]),P=!!_,he=e=>{if(Q(e.sourceHandle)||Q(e.targetHandle))return Q(e.sourceHandle)&&Q(e.targetHandle)&&b.isValid(e);if(e.targetHandle!==`in`)return!1;let t=S.get(J(e.target)),n=S.get(J(e.source));return t?.kind===`state`&&gr(n)===gr(t)},ge=e=>{ae(br);let t=[...e].flatMap(([e,t])=>{let n=J(e),r=E.get(n),i=O?.get(n),a={x:Math.round(t.x),y:Math.round(t.y)};return r===void 0||!D.has(n)&&i&&Math.round(i.x)===a.x&&Math.round(i.y)===a.y?[]:[[r,a]]});t.length>0&&T({...w,...Object.fromEntries(t)})},_e=g&&(e=>{let t=E.get(J(e));t!==void 0&&T(oe(w,t))}),I=()=>{T({}),j(e=>e+1)},ve=e=>{let t=new Map;for(let n of e){if(n.type!==`position`||!n.position||!k)continue;let e=n.position;n.dragging?ae(t=>new Map(t).set(n.id,e)):t.set(n.id,e)}t.size>0&&ge(t);let n=e.filter(e=>e.type===`select`);if(n.length===0)return;let i=new Set(N);for(let e of n)e.selected?i.add(e.id):i.delete(e.id);se(i);let[o]=i.size===1?[...i]:[],s=o===void 0||q(o)?void 0:J(o);if(s!==void 0&&(ye||xe.current))return r===void 0?void 0:a(void 0);s!==r&&a(s)},ye=we(`Shift`),xe=(0,R.useRef)(!1);return(0,H.jsx)(sn.Provider,{value:_?c:void 0,children:(0,H.jsx)(bn.Provider,{value:_e,children:(0,H.jsx)(ln.Provider,{value:b.actions,children:(0,H.jsx)(fr.Provider,{value:b.check,children:(0,H.jsxs)(`div`,{ref:ee,className:`relative h-full w-full`,children:[(0,H.jsxs)(Ce,{className:`pb-workflow`,nodes:ce,edges:fe,nodeTypes:hr,nodesDraggable:k,nodeDragThreshold:4,selectNodesOnDrag:!1,nodesConnectable:P,connectOnClick:!1,connectionDragThreshold:4,edgesFocusable:P,elementsSelectable:!0,deleteKeyCode:P?[`Backspace`,`Delete`]:null,onNodesChange:ve,onEdgesChange:e=>{for(let t of e)t.type===`select`&&(t.selected?de(t.id):de(e=>e===t.id?void 0:e))},isValidConnection:he,onConnect:t=>{if(_&&t.sourceHandle){if(Q(t.sourceHandle))return b.connect(t);_.onChange(_.edits.connect(e,t.sourceHandle,J(t.source),J(t.target)))}},onConnectEnd:b.connectEnd,connectionLineComponent:pr,onDelete:({nodes:t,edges:n})=>{if(!_)return;let r=t.filter(e=>!q(e.id)).map(e=>J(e.id)).filter(e=>e!==``),i=b.remove(e,t,n);for(let e of n){let t=e.data;t.kind!==`data`&&!r.includes(t.source)&&!r.includes(J(e.target))&&(i=_.edits.disconnect(i,t))}for(let e of r)r.some(t=>e.startsWith(`${t}/`))||(i=_.edits.removeState(i,e));_.onChange(i)},multiSelectionKeyCode:`Shift`,onSelectionStart:()=>void(xe.current=!0),onSelectionEnd:()=>void(xe.current=!1),onNodeClick:(e,t)=>!e.shiftKey&&!q(t.id)&&a(J(t.id)),onPaneClick:()=>a(void 0),zoomOnScroll:!0,panOnScroll:!1,panOnDrag:[0,1,2],selectionOnDrag:!1,selectionKeyCode:`Shift`,preventScrolling:!0,onPaneContextMenu:e=>e.preventDefault(),minZoom:.2,maxZoom:1.5,"aria-label":F(`canvas`),children:[(0,H.jsx)(Te,{gap:16}),d&&(0,H.jsx)(be,{position:`top-left`,children:(0,H.jsx)(i,{label:F(`graphView`),value:y,onChange:te,options:[{value:`pins`,label:F(`viewPins`)},{value:`simple`,label:F(`viewSimple`)}]})}),k&&Object.keys(w).length>0&&(0,H.jsx)(be,{position:`top-right`,children:(0,H.jsxs)(f,{title:F(`tidyUpHelp`),onClick:I,children:[(0,H.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),F(`tidyUp`)]})}),(0,H.jsx)(Se,{showInteractive:!1}),(0,H.jsx)(_r,{laidOut:x,tidied:A}),p&&(0,H.jsx)(vr,{}),(0,H.jsx)(yr,{laidOut:O,ids:ce.map(e=>e.id)})]}),b.offer&&(0,H.jsx)($n,{offer:b.offer,onClose:b.closeOffer})]})})})})})},Sr=e=>(0,H.jsx)(ve,{children:(0,H.jsx)(xr,{...e})});export{it as a,Le as c,Pe as d,je as f,ze as g,Be as h,ot as i,Ue as l,Ve as m,cn as n,at as o,Me as p,lt as r,Ke as s,Sr as t,Fe as u};
4
+ //# debugId=e938d80b-2512-4043-b04c-abcb05282375