@protobase/ui 0.123.2 → 0.123.3

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 (210) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/app/charts/messages.d.ts +2 -2
  3. package/dist/app/confirm-sign-in-messages.d.ts +2 -2
  4. package/dist/app/conversation-page/messages.d.ts +2 -2
  5. package/dist/app/create/messages.d.ts +2 -2
  6. package/dist/app/delete/messages.d.ts +2 -2
  7. package/dist/app/displays/messages.d.ts +2 -2
  8. package/dist/app/embedded-list/messages.d.ts +2 -2
  9. package/dist/app/export/messages.d.ts +2 -2
  10. package/dist/app/field-messages.d.ts +2 -2
  11. package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
  12. package/dist/app/field-types/json/messages.d.ts +2 -2
  13. package/dist/app/field-types/runner-install/messages.d.ts +2 -2
  14. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  15. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  16. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  17. package/dist/app/field-types/workflow-status/messages.d.ts +2 -2
  18. package/dist/app/file-viewers/messages.d.ts +2 -2
  19. package/dist/app/focus/messages.d.ts +2 -2
  20. package/dist/app/gallery/gallery-layout.d.ts +2 -2
  21. package/dist/app/gallery/messages.d.ts +2 -2
  22. package/dist/app/hand-order/messages.d.ts +2 -2
  23. package/dist/app/history/messages.d.ts +2 -2
  24. package/dist/app/import/messages.d.ts +2 -2
  25. package/dist/app/list-edit/messages.d.ts +2 -2
  26. package/dist/app/list-messages.d.ts +2 -2
  27. package/dist/app/messages.d.ts +2 -2
  28. package/dist/app/meta-gate-messages.d.ts +2 -2
  29. package/dist/app/pages/messages.d.ts +2 -2
  30. package/dist/app/record-chart/messages.d.ts +2 -2
  31. package/dist/app/record-messages.d.ts +2 -2
  32. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  33. package/dist/app/record-row/messages.d.ts +2 -2
  34. package/dist/app/related-cards/messages.d.ts +2 -2
  35. package/dist/app/runtime/messages.d.ts +2 -2
  36. package/dist/app/saved/messages.d.ts +2 -2
  37. package/dist/app/searches/messages.d.ts +2 -2
  38. package/dist/app-shell/messages.d.ts +2 -2
  39. package/dist/assistant-dock/messages.d.ts +2 -2
  40. package/dist/auth/messages.d.ts +2 -2
  41. package/dist/calls/messages.d.ts +2 -2
  42. package/dist/data/use-live-updates.d.ts +1 -1
  43. package/dist/data/use-live-updates.js +3 -1
  44. package/dist/data-grid/column-spec.d.ts +1 -1
  45. package/dist/data-grid/messages.d.ts +2 -2
  46. package/dist/filter-panel/messages.d.ts +2 -2
  47. package/dist/format/messages.d.ts +2 -2
  48. package/dist/forms/messages.d.ts +2 -2
  49. package/dist/inline-child-table/messages.d.ts +2 -2
  50. package/dist/invitations/messages.d.ts +2 -2
  51. package/dist/live/messages.d.ts +2 -2
  52. package/dist/mailbox/messages.d.ts +2 -2
  53. package/dist/mentions/messages.d.ts +2 -2
  54. package/dist/mocks/customers.d.ts +1 -1
  55. package/dist/mocks/invoices.d.ts +2 -2
  56. package/dist/mocks/orders.d.ts +1 -1
  57. package/dist/notifications/bell/messages.d.ts +2 -2
  58. package/dist/organizations/messages.d.ts +2 -2
  59. package/dist/package.js +1 -1
  60. package/dist/relay/relay-store.d.ts +2 -0
  61. package/dist/relay/relay-store.js +6 -0
  62. package/dist/shell/assets/{account-page-B_2UXfOe.js → account-page-IZQQcp3C.js} +2 -2
  63. package/dist/shell/assets/{app-BvzjyTCc.js → app-CgllsYQy.js} +5 -5
  64. package/dist/shell/assets/{assistant-shell-BmIgAtL4.js → assistant-shell-ClWlf9GV.js} +2 -2
  65. package/dist/shell/assets/{board-display-DIZFAoY5.js → board-display-DhHkhSdi.js} +2 -2
  66. package/dist/shell/assets/{calendar-display-BgtOnVYM.js → calendar-display-C_X68Umc.js} +2 -2
  67. package/dist/shell/assets/{call-rings-D8cfZY2c.js → call-rings-B0-gGLW5.js} +2 -2
  68. package/dist/shell/assets/{calls-zNgibv3b.js → calls-VTUC3xS7.js} +2 -2
  69. package/dist/shell/assets/{circle-alert-BcQBR8pH.js → circle-alert-D8UYAgz6.js} +2 -2
  70. package/dist/shell/assets/{composed-page-BLQuVyrR.js → composed-page-FL2hq-qi.js} +2 -2
  71. package/dist/shell/assets/{composer-section-PDfETSwu.js → composer-section-DBsqoWhe.js} +2 -2
  72. package/dist/shell/assets/{connect-route-BaoDVGfJ.js → connect-route-DI8OFx4L.js} +2 -2
  73. package/dist/shell/assets/{copy-field-Dbw_Ios8.js → copy-field-DBuqCBWo.js} +2 -2
  74. package/dist/shell/assets/{create-route-CxlHX_bn.js → create-route-CCx6gOjR.js} +2 -2
  75. package/dist/shell/assets/{custom-step-container-field-CWSaNSrn.js → custom-step-container-field-tmox-exj.js} +2 -2
  76. package/dist/shell/assets/{embedded-list-DMu0yZio.js → embedded-list-BIvz_g-b.js} +3 -3
  77. package/dist/shell/assets/{export-dialog-BTLnnm9r.js → export-dialog-cqfMEBd7.js} +2 -2
  78. package/dist/shell/assets/{first-organization-page-Bioj0eum.js → first-organization-page-CC7DrhYu.js} +2 -2
  79. package/dist/shell/assets/{graph-view-3iZnQUV4.js → graph-view-DRWl6A2P.js} +2 -2
  80. package/dist/shell/assets/{group-donut-AsbAFmVA.js → group-donut-D1l1-O4a.js} +2 -2
  81. package/dist/shell/assets/{guest-call-page-BO9Rtd-m.js → guest-call-page-BLh17iiD.js} +3 -3
  82. package/dist/shell/assets/{html-viewer-ZwvtDSiU.js → html-viewer-BeLoV4vw.js} +2 -2
  83. package/dist/shell/assets/{import-dialog-B_PtcyfU.js → import-dialog-CwnPFP3s.js} +2 -2
  84. package/dist/shell/assets/{import-table-dialog-DKAhRCrZ.js → import-table-dialog-D__S72Yl.js} +2 -2
  85. package/dist/shell/assets/{index-BXU6zoyB.js → index-Nvo-_PXE.js} +1 -1
  86. package/dist/shell/assets/{invitations-page-C0VJILud.js → invitations-page-MQ6ujhc1.js} +2 -2
  87. package/dist/shell/assets/{layout-grid-BFxYQWEw.js → layout-grid-B4X2fG6K.js} +2 -2
  88. package/dist/shell/assets/{legend-item-BgHE4fsr.js → legend-item-BoMo0Yub.js} +2 -2
  89. package/dist/shell/assets/{list-page-CqpvMK2d.js → list-page-BceXf9dP.js} +4 -4
  90. package/dist/shell/assets/{maplibre-DFQRY5p-.js → maplibre-BZGHDnqB.js} +2 -2
  91. package/dist/shell/assets/{markdown-content-MhlLL1_k.js → markdown-content-CB2LNHPp.js} +2 -2
  92. package/dist/shell/assets/{members-page-Cqcpbvz6.js → members-page-DnPAIXBn.js} +2 -2
  93. package/dist/shell/assets/{message-content-BKBGZMM9.js → message-content-C6ld-XsS.js} +2 -2
  94. package/dist/shell/assets/{messages-BYNVAAQ-.js → messages-CWURrUB-.js} +2 -2
  95. package/dist/shell/assets/{organization-page-3t3ySblf.js → organization-page-DnmV85sX.js} +2 -2
  96. package/dist/shell/assets/{organizations-page-DuIZti-g.js → organizations-page-CKJB2qGB.js} +2 -2
  97. package/dist/shell/assets/{pending-invitation-row-D_2XZIoA.js → pending-invitation-row-DAXBo7SZ.js} +2 -2
  98. package/dist/shell/assets/{period-chart-Do9Bof4r.js → period-chart-CbzGqkpY.js} +2 -2
  99. package/dist/shell/assets/{person-row-Fa3H6Lkh.js → person-row-BNM1LeOM.js} +2 -2
  100. package/dist/shell/assets/{public-form-page-oN7Toa7_.js → public-form-page-BTILqkb8.js} +2 -2
  101. package/dist/shell/assets/{record-lines-BZAs2Ue1.js → record-lines-BuGPIPkM.js} +2 -2
  102. package/dist/shell/assets/{record-map-Qqy94R8J.js → record-map-H5uvOI5d.js} +2 -2
  103. package/dist/shell/assets/{record-opens-DEGeAJSe.js → record-opens-BLwJhTqE.js} +2 -2
  104. package/dist/shell/assets/{record-page-BZ5pkjEj.js → record-page-CCfn7bkb.js} +3 -3
  105. package/dist/shell/assets/{record-preview-CL5YvZ8R.js → record-preview-CWciJJ5e.js} +2 -2
  106. package/dist/shell/assets/{records-map-N9uc9OqB.js → records-map-CPYxm3fv.js} +2 -2
  107. package/dist/shell/assets/{render-node-CPEZ65JE.js → render-node-BiDgPc8P.js} +3 -3
  108. package/dist/shell/assets/{reorder-button-BZbAcyy9.js → reorder-button-CeZV0Cqx.js} +2 -2
  109. package/dist/shell/assets/{run-trace-view-B2Q72hZt.js → run-trace-view-CsT4mLDc.js} +2 -2
  110. package/dist/shell/assets/{runner-install-field-BB7jxmAy.js → runner-install-field-8Oz3ILhl.js} +2 -2
  111. package/dist/shell/assets/{runtime-update-gcZkGGbB.js → runtime-update-CQ7qAQHh.js} +2 -2
  112. package/dist/shell/assets/{shared-protobase-ui-DnalR-YE.js → shared-protobase-ui-C3HDx4Ie.js} +1 -1
  113. package/dist/shell/assets/{sheet-source-CAoZtfIe.js → sheet-source-Ch5uFlt5.js} +2 -2
  114. package/dist/shell/assets/{sign-in-policy-page-Dg5CRBn8.js → sign-in-policy-page-DyroONcf.js} +2 -2
  115. package/dist/shell/assets/{start-block-queries-CiHBJzbH.js → start-block-queries-heBbb7IN.js} +2 -2
  116. package/dist/shell/assets/{step-catalog-C9aDf9yp.js → step-catalog-C7zY05CI.js} +2 -2
  117. package/dist/shell/assets/{step-panel-Dn25BrQ4.js → step-panel-DifkdQUN.js} +2 -2
  118. package/dist/shell/assets/{timeline-display-DjT90LDr.js → timeline-display-DgD-tH2t.js} +2 -2
  119. package/dist/shell/assets/{trash-q7TV1G4p.js → trash-sDDKsEVa.js} +2 -2
  120. package/dist/shell/assets/{update-set-Bg_tN6iA.js → update-set-t56Pch6F.js} +2 -2
  121. package/dist/shell/assets/{use-calendar-move-BPqQcS7u.js → use-calendar-move-B5Nd4WqC.js} +2 -2
  122. package/dist/shell/assets/{use-display-rows-CJmSJyrU.js → use-display-rows-Evx7hciH.js} +2 -2
  123. package/dist/shell/assets/{use-my-invitations-DBFH0nwT.js → use-my-invitations-BeEVmA84.js} +2 -2
  124. package/dist/shell/assets/{use-paged-search-Buk64u23.js → use-paged-search-CHtW6YbU.js} +2 -2
  125. package/dist/shell/assets/{use-run-trace-DM48FzsT.js → use-run-trace-B0JxFskZ.js} +2 -2
  126. package/dist/shell/assets/{use-workflow-page-DAU6rWfG.js → use-workflow-page-3QycD-Ie.js} +2 -2
  127. package/dist/shell/assets/{use-workflow-types-Di9JvED2.js → use-workflow-types-7sud5u7m.js} +2 -2
  128. package/dist/shell/assets/{workflow-canvas-Q34kGPs0.js → workflow-canvas-CzzTk8Bv.js} +2 -2
  129. package/dist/shell/assets/{workflow-field-BsnU6q_u.js → workflow-field-ehSWu4Iq.js} +3 -3
  130. package/dist/shell/assets/{workflow-graph-editor-NrFhFNPm.js → workflow-graph-editor-89M8HZOe.js} +2 -2
  131. package/dist/shell/assets/{workflow-run-field-BAXLX7GY.js → workflow-run-field-Dxg2lHnv.js} +3 -3
  132. package/dist/shell/assets/{workflow-status-field-BU2INJoT.js → workflow-status-field-Bws1hFJF.js} +2 -2
  133. package/dist/shell/assets/{workflow-workbench-DCbWEorH.js → workflow-workbench-D2Piourk.js} +2 -2
  134. package/dist/shell/index.html +3 -3
  135. package/dist/shell/protobase.shell.json +2 -2
  136. package/dist/shell/protobase.sw.js +2 -2
  137. package/dist/shell-source-maps/assets/{account-page-B_2UXfOe.js.map → account-page-IZQQcp3C.js.map} +1 -1
  138. package/dist/shell-source-maps/assets/app-CgllsYQy.js.map +1 -0
  139. package/dist/shell-source-maps/assets/{assistant-shell-BmIgAtL4.js.map → assistant-shell-ClWlf9GV.js.map} +1 -1
  140. package/dist/shell-source-maps/assets/{board-display-DIZFAoY5.js.map → board-display-DhHkhSdi.js.map} +1 -1
  141. package/dist/shell-source-maps/assets/{calendar-display-BgtOnVYM.js.map → calendar-display-C_X68Umc.js.map} +1 -1
  142. package/dist/shell-source-maps/assets/{call-rings-D8cfZY2c.js.map → call-rings-B0-gGLW5.js.map} +1 -1
  143. package/dist/shell-source-maps/assets/{calls-zNgibv3b.js.map → calls-VTUC3xS7.js.map} +1 -1
  144. package/dist/shell-source-maps/assets/{circle-alert-BcQBR8pH.js.map → circle-alert-D8UYAgz6.js.map} +1 -1
  145. package/dist/shell-source-maps/assets/{composed-page-BLQuVyrR.js.map → composed-page-FL2hq-qi.js.map} +1 -1
  146. package/dist/shell-source-maps/assets/{composer-section-PDfETSwu.js.map → composer-section-DBsqoWhe.js.map} +1 -1
  147. package/dist/shell-source-maps/assets/{connect-route-BaoDVGfJ.js.map → connect-route-DI8OFx4L.js.map} +1 -1
  148. package/dist/shell-source-maps/assets/{copy-field-Dbw_Ios8.js.map → copy-field-DBuqCBWo.js.map} +1 -1
  149. package/dist/shell-source-maps/assets/{create-route-CxlHX_bn.js.map → create-route-CCx6gOjR.js.map} +1 -1
  150. package/dist/shell-source-maps/assets/{custom-step-container-field-CWSaNSrn.js.map → custom-step-container-field-tmox-exj.js.map} +1 -1
  151. package/dist/shell-source-maps/assets/{embedded-list-DMu0yZio.js.map → embedded-list-BIvz_g-b.js.map} +1 -1
  152. package/dist/shell-source-maps/assets/{export-dialog-BTLnnm9r.js.map → export-dialog-cqfMEBd7.js.map} +1 -1
  153. package/dist/shell-source-maps/assets/{first-organization-page-Bioj0eum.js.map → first-organization-page-CC7DrhYu.js.map} +1 -1
  154. package/dist/shell-source-maps/assets/{graph-view-3iZnQUV4.js.map → graph-view-DRWl6A2P.js.map} +1 -1
  155. package/dist/shell-source-maps/assets/{group-donut-AsbAFmVA.js.map → group-donut-D1l1-O4a.js.map} +1 -1
  156. package/dist/shell-source-maps/assets/{guest-call-page-BO9Rtd-m.js.map → guest-call-page-BLh17iiD.js.map} +1 -1
  157. package/dist/shell-source-maps/assets/{html-viewer-ZwvtDSiU.js.map → html-viewer-BeLoV4vw.js.map} +1 -1
  158. package/dist/shell-source-maps/assets/{import-dialog-B_PtcyfU.js.map → import-dialog-CwnPFP3s.js.map} +1 -1
  159. package/dist/shell-source-maps/assets/{import-table-dialog-DKAhRCrZ.js.map → import-table-dialog-D__S72Yl.js.map} +1 -1
  160. package/dist/shell-source-maps/assets/{invitations-page-C0VJILud.js.map → invitations-page-MQ6ujhc1.js.map} +1 -1
  161. package/dist/shell-source-maps/assets/{layout-grid-BFxYQWEw.js.map → layout-grid-B4X2fG6K.js.map} +1 -1
  162. package/dist/shell-source-maps/assets/{legend-item-BgHE4fsr.js.map → legend-item-BoMo0Yub.js.map} +1 -1
  163. package/dist/shell-source-maps/assets/{list-page-CqpvMK2d.js.map → list-page-BceXf9dP.js.map} +1 -1
  164. package/dist/shell-source-maps/assets/{maplibre-DFQRY5p-.js.map → maplibre-BZGHDnqB.js.map} +1 -1
  165. package/dist/shell-source-maps/assets/{markdown-content-MhlLL1_k.js.map → markdown-content-CB2LNHPp.js.map} +1 -1
  166. package/dist/shell-source-maps/assets/{members-page-Cqcpbvz6.js.map → members-page-DnPAIXBn.js.map} +1 -1
  167. package/dist/shell-source-maps/assets/{message-content-BKBGZMM9.js.map → message-content-C6ld-XsS.js.map} +1 -1
  168. package/dist/shell-source-maps/assets/{messages-BYNVAAQ-.js.map → messages-CWURrUB-.js.map} +1 -1
  169. package/dist/shell-source-maps/assets/{organization-page-3t3ySblf.js.map → organization-page-DnmV85sX.js.map} +1 -1
  170. package/dist/shell-source-maps/assets/{organizations-page-DuIZti-g.js.map → organizations-page-CKJB2qGB.js.map} +1 -1
  171. package/dist/shell-source-maps/assets/{pending-invitation-row-D_2XZIoA.js.map → pending-invitation-row-DAXBo7SZ.js.map} +1 -1
  172. package/dist/shell-source-maps/assets/{period-chart-Do9Bof4r.js.map → period-chart-CbzGqkpY.js.map} +1 -1
  173. package/dist/shell-source-maps/assets/{person-row-Fa3H6Lkh.js.map → person-row-BNM1LeOM.js.map} +1 -1
  174. package/dist/shell-source-maps/assets/{public-form-page-oN7Toa7_.js.map → public-form-page-BTILqkb8.js.map} +1 -1
  175. package/dist/shell-source-maps/assets/{record-lines-BZAs2Ue1.js.map → record-lines-BuGPIPkM.js.map} +1 -1
  176. package/dist/shell-source-maps/assets/{record-map-Qqy94R8J.js.map → record-map-H5uvOI5d.js.map} +1 -1
  177. package/dist/shell-source-maps/assets/{record-opens-DEGeAJSe.js.map → record-opens-BLwJhTqE.js.map} +1 -1
  178. package/dist/shell-source-maps/assets/{record-page-BZ5pkjEj.js.map → record-page-CCfn7bkb.js.map} +1 -1
  179. package/dist/shell-source-maps/assets/{record-preview-CL5YvZ8R.js.map → record-preview-CWciJJ5e.js.map} +1 -1
  180. package/dist/shell-source-maps/assets/{records-map-N9uc9OqB.js.map → records-map-CPYxm3fv.js.map} +1 -1
  181. package/dist/shell-source-maps/assets/{render-node-CPEZ65JE.js.map → render-node-BiDgPc8P.js.map} +1 -1
  182. package/dist/shell-source-maps/assets/{reorder-button-BZbAcyy9.js.map → reorder-button-CeZV0Cqx.js.map} +1 -1
  183. package/dist/shell-source-maps/assets/{run-trace-view-B2Q72hZt.js.map → run-trace-view-CsT4mLDc.js.map} +1 -1
  184. package/dist/shell-source-maps/assets/{runner-install-field-BB7jxmAy.js.map → runner-install-field-8Oz3ILhl.js.map} +1 -1
  185. package/dist/shell-source-maps/assets/{runtime-update-gcZkGGbB.js.map → runtime-update-CQ7qAQHh.js.map} +1 -1
  186. package/dist/shell-source-maps/assets/{sheet-source-CAoZtfIe.js.map → sheet-source-Ch5uFlt5.js.map} +1 -1
  187. package/dist/shell-source-maps/assets/{sign-in-policy-page-Dg5CRBn8.js.map → sign-in-policy-page-DyroONcf.js.map} +1 -1
  188. package/dist/shell-source-maps/assets/{start-block-queries-CiHBJzbH.js.map → start-block-queries-heBbb7IN.js.map} +1 -1
  189. package/dist/shell-source-maps/assets/{step-catalog-C9aDf9yp.js.map → step-catalog-C7zY05CI.js.map} +1 -1
  190. package/dist/shell-source-maps/assets/{step-panel-Dn25BrQ4.js.map → step-panel-DifkdQUN.js.map} +1 -1
  191. package/dist/shell-source-maps/assets/{timeline-display-DjT90LDr.js.map → timeline-display-DgD-tH2t.js.map} +1 -1
  192. package/dist/shell-source-maps/assets/{trash-q7TV1G4p.js.map → trash-sDDKsEVa.js.map} +1 -1
  193. package/dist/shell-source-maps/assets/{update-set-Bg_tN6iA.js.map → update-set-t56Pch6F.js.map} +1 -1
  194. package/dist/shell-source-maps/assets/{use-calendar-move-BPqQcS7u.js.map → use-calendar-move-B5Nd4WqC.js.map} +1 -1
  195. package/dist/shell-source-maps/assets/{use-display-rows-CJmSJyrU.js.map → use-display-rows-Evx7hciH.js.map} +1 -1
  196. package/dist/shell-source-maps/assets/{use-my-invitations-DBFH0nwT.js.map → use-my-invitations-BeEVmA84.js.map} +1 -1
  197. package/dist/shell-source-maps/assets/{use-paged-search-Buk64u23.js.map → use-paged-search-CHtW6YbU.js.map} +1 -1
  198. package/dist/shell-source-maps/assets/{use-run-trace-DM48FzsT.js.map → use-run-trace-B0JxFskZ.js.map} +1 -1
  199. package/dist/shell-source-maps/assets/{use-workflow-page-DAU6rWfG.js.map → use-workflow-page-3QycD-Ie.js.map} +1 -1
  200. package/dist/shell-source-maps/assets/{use-workflow-types-Di9JvED2.js.map → use-workflow-types-7sud5u7m.js.map} +1 -1
  201. package/dist/shell-source-maps/assets/{workflow-canvas-Q34kGPs0.js.map → workflow-canvas-CzzTk8Bv.js.map} +1 -1
  202. package/dist/shell-source-maps/assets/{workflow-field-BsnU6q_u.js.map → workflow-field-ehSWu4Iq.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/{workflow-graph-editor-NrFhFNPm.js.map → workflow-graph-editor-89M8HZOe.js.map} +1 -1
  204. package/dist/shell-source-maps/assets/{workflow-run-field-BAXLX7GY.js.map → workflow-run-field-Dxg2lHnv.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/{workflow-status-field-BU2INJoT.js.map → workflow-status-field-Bws1hFJF.js.map} +1 -1
  206. package/dist/shell-source-maps/assets/{workflow-workbench-DCbWEorH.js.map → workflow-workbench-D2Piourk.js.map} +1 -1
  207. package/dist/status/messages.d.ts +2 -2
  208. package/dist/users/messages.d.ts +2 -2
  209. package/package.json +5 -5
  210. package/dist/shell-source-maps/assets/app-BvzjyTCc.js.map +0 -1
@@ -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{Ac as r,Bl as i,Cl as a,Dn as o,Er as s,Il as c,La as l,Ms as u,Nc as d,Nl as f,Oi as p,Qa as m,Ra as h,Su as g,Ts as _,Xr as v,Ya as y,_c as b,bu as x,hn as S,ii as C,jc as w,ll as T,ml as E,mo as D,or as O,sr as k,ui as A,vc as j,wl as M}from"./app-BvzjyTCc.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-DMu0yZio.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as B,r as ee,s as V,t as H}from"./messages-BYNVAAQ-.js";var U={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};U.node;var W=E(U),G={name:`pencil`,size:24,node:[[`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`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};G.node;var K=E(G),q=e(t(),1),J=M(`app/delete`),Y=x(),X=({blockingPlural:e,noun:t})=>J(`stillPointAt`,{plural:e,noun:t}),Z=({blockedBy:e,resources:t,views:n,noun:r,key:i})=>{let{resource:a,field:o}=e;if(!t[a])return;let s=n[a]?.names?.plural??c(a),l=X({blockingPlural:s,noun:r});if(!o||i===void 0)return{text:l};let u={kind:`list`,resource:a,filter:g(Y.eq(o,i))};return{text:l,link:{label:J(`show`,{plural:s}),to:u}}},Q=e(n(),1),te=({title:e,noun:t,busy:n,onConfirm:r,onCancel:i})=>(0,Q.jsx)(w,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(d,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:r,children:J(`delete`)})]})}),ne=({title:e,changes:t,busy:n,onReview:r,onDeleteAnyway:i,onCancel:a})=>(0,Q.jsx)(w,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(d,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:i,children:J(`deleteAnyway`)})]}),children:t.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noVisibleChanges`)}):(0,Q.jsx)(`ul`,{className:`divide-y rounded-md border`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`grid grid-cols-[96px_1fr] gap-3 px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.after})]})]},e.field))})}),$=e=>{if(e.stage===`confirm`)return(0,Q.jsx)(w,{title:J(`bulkConfirmTitle`,{count:e.count,noun:e.noun,plural:e.plural}),description:J(`bulkConfirmDescription`),onClose:e.onCancel,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(d,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,onClick:e.onConfirm,children:J(`deleteCount`,{count:e.count})})]})});if(e.stage===`running`)return(0,Q.jsx)(w,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(d,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(w,{title:e.failures.length===0?J(`deleted`,{count:t}):J(`deletedOf`,{count:t,total:e.total}),description:e.failures.length===0?void 0:J(`kept`,{count:e.failures.length}),onClose:e.onClose,actions:(0,Q.jsx)(d,{variant:`primary`,onClick:e.onClose,children:J(`done`)}),children:e.failures.length>0&&(0,Q.jsx)(`ul`,{className:`max-h-48 divide-y overflow-y-auto rounded-md border`,children:e.failures.map(e=>(0,Q.jsxs)(`li`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-danger-text`,children:e.message})]},e.title))})})},re=new Set([`updated_at`,`updatedAt`]),ie=(e,t,n,r)=>Object.values(e.fields).flatMap(e=>{if(re.has(e.name)||JSON.stringify(n[e.name]??null)===JSON.stringify(r[e.name]??null))return[];let i=t?.fields[e.name];return[{field:e.name,label:i?.label??c(e.name),before:p(e,n[e.name],i),after:p(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:i})=>{let a=u(),o=N(),s=m(),[l,d]=(0,q.useState)(),[f,p]=(0,q.useState)(!1),h=t?.names?.singular??c(e.name),g=t?.names?.plural??c(e.name),{resources:y,views:x}=_(),{href:S,open:C}=v(),w=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:y,views:x,noun:h,...e.primaryKey.length===1&&{key:n.key}}),T=()=>{for(let t of[`page`,`list`,`first-page`,`map`])o.invalidateQueries({queryKey:[t,e.name]});for(let t of[`facets`,`series`,`aggregate`,`histogram`,`count`])o.invalidateQueries({queryKey:[t,e.name]})},E=async(t,n)=>{let r=n??(await a.get(e.name,t.key)).etag;try{await a.remove(e.name,t.key,{etag:r})}catch(e){if(!(e instanceof b))throw e;return e}},D=t=>{T(),d(void 0),n?.(t),s.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&i&&{action:{label:J(`undo`),onClick:()=>{i(t).then(()=>{T(),s.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!j(e))throw e;T(),s.show({state:e.status===409?`success`:`error`,title:e.status===409?J(`alreadyBack`,{title:t.title}):J(`couldNotRestore`,{title:t.title}),description:e.status===409?void 0:e.message})})}}}})},O=async(n,r)=>{p(!0);try{if(!await E(n,r))return D(n);let i=(await a.get(e.name,n.key)).record;d({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!j(e))throw e;d(void 0);let t=w(e,n);s.show({state:`error`,title:J(`couldNotDelete`,{title:n.title}),description:t?.text??e.message,...t?.link&&{action:{label:t.link.label,href:S(t.link.to),onNavigate:C}}})}finally{p(!1)}},k=async e=>{try{return await E(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!j(t))throw t;return{title:e.title,message:w(t,e)?.text??t.message}}},A=async e=>{let t=[],n=[],r=0;d({kind:`bulk-running`,done:r,total:e.length});let i=[...e];return await Promise.all(Array.from({length:Math.min(ae,e.length)},async()=>{for(let a=i.shift();a;a=i.shift()){let i=await k(a);i&&(t.push(i),n.push(a)),r+=1,d({kind:`bulk-running`,done:r,total:e.length})}})),T(),d({kind:`bulk-done`,total:e.length,failures:t}),n},M=()=>d(void 0);return{dialogs:l&&(0,Q.jsxs)(Q.Fragment,{children:[l.kind===`confirm`&&(0,Q.jsx)(te,{title:l.target.title,noun:h,busy:f,onCancel:M,onConfirm:()=>void O(l.target,l.target.etag)}),l.kind===`conflict`&&(0,Q.jsx)(ne,{title:l.target.title,changes:l.changes,busy:f,onCancel:M,onReview:()=>{M(),r?.(l.target,l.fresh)},onDeleteAnyway:()=>void O(l.target,`*`)}),l.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:l.targets.length,noun:h,plural:g,onCancel:()=>{M(),l.settle(l.targets)},onConfirm:()=>l.settle(A(l.targets))}),l.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:l.done,total:l.total}),l.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:l.total,failures:l.failures,onClose:M})]}),start:t=>e.softDelete?O(t,t.etag):d({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>d({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=u();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:a})=>{let o=t=>r.findIndex(n=>i(h(e,n))===t),s=t.after.find(e=>o(e.key)>a);if(s)return H(`dependsOn`,{record:n,other:s.title});let c=t.before.find(e=>o(e.key)!==-1&&o(e.key)<a);return c?H(`dependsOn`,{record:c.title,other:n}):void 0},le=(e,t,n,r)=>{let i=e[t],a;for(let o=n;o<e.length;o++){let n=r({record:i,order:I(e,t,o),index:o});if(n===void 0)return{to:o,...a!==void 0&&{reason:a}};a??=n}return{to:t,reason:a}},ue=({model:e,view:t,field:n,filter:r,fields:i,rule:s})=>{let c=u(),d=m(),p=o(),{resources:h,views:g}=_(),v=`${n} asc`,y=P({queryKey:[...a.list(e.name,r,v,500,`hand-order`),i.join(`,`)],queryFn:async()=>{let t=O(h,g,e,i),n=[],a=``;do{let o=await c.search(e.name,{filter:r||void 0,orderBy:v,pageSize:500,labels:t,...a&&{pageToken:a}});n.push(...k(h,e,i,o.items,o.labels).map((t,n)=>({...t,id:l(e,o.items[n])}))),a=o.nextPageToken}while(a);return n}}),[b,x]=(0,q.useState)(),S=(0,q.useRef)(void 0),w=(0,q.useRef)([]),T=(0,q.useRef)(void 0),E=(0,q.useRef)(Promise.resolve()),D=(0,q.useRef)(0),A=(0,q.useRef)(void 0),j=async()=>{let t=S.current,r=w.current;if(w.current=[],!t||r.length===0)return;let i=await c.batchWrite(r),a=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[l(e,t.record),t])),o=z(i.results,t=>l(e,t)),s=L(e,[...a].map(([e,t])=>({...t,before:{[n]:o.get(e)}})),[n]);A.current!==void 0&&d.dismiss(A.current),A.current=d.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(s)}}),S.current&&=S.current.map(e=>{let t=a.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},M=(e,t)=>n=>{S.current=void 0,w.current=[],x(void 0),d.show(B(n,e,{place:`list`,title:t?T.current:void 0}))},N=async()=>{--D.current,!(D.current>0)&&(await p(e.name),!(D.current>0)&&(S.current=void 0,x(void 0)))},F=(n,r)=>{let i=S.current??y.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,s);let a=C(e,i[n]).record,o=i[n].id;R(c,e,t,a).then(n=>{let i=S.current??y.data,c=ce(e,n,f(e,t,a,o));H(i,i.findIndex(e=>e.id===o),r,e=>c(e)??s?.(e))},M(V(`couldNotChange`),!1))},H=(i,a,o,s)=>{if(a===-1||a===o)return;let c=s?U(i,a,o,s):o;a!==c&&(S.current=I(i,a,c),w.current=[...w.current,ee(e,n,r,S.current,c)],x(S.current),D.current+=1,T.current=f(e,t,C(e,i[a]).record,i[a].id),E.current=E.current.then(j).catch(M(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>C(e,t).record),n,r,i);return a.reason!==void 0&&d.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{A.current!==void 0&&d.dismiss(A.current),A.current=void 0,D.current+=1,E.current=E.current.then(async()=>{await c.batchWrite(e),S.current=void 0,w.current=[],x(void 0)}).catch(M(V(`couldNotUndo`),!1)).then(N)};return{rows:b??y.data,loading:y.isPending,error:y.error,move:F}},de=({model:e,view:t,field:n,filter:i,columns:a,sort:o})=>{let{resources:c,views:l}=_(),{fields:u,dropRules:d}=y(),{go:p,href:m}=v(),g=o!==void 0,b=(0,q.useMemo)(()=>S(e,t,a,{resources:c,views:l,fieldTypes:u}).map(e=>g?e:{...e,sortable:!1}),[e,t,a.join(`,`),c,l,u,g]),x=(0,q.useMemo)(()=>A(e,t,b.map(e=>e.id)),[e,t,b]),C=t?.list?.drag?.rule,w=C===void 0?void 0:d?.[C],T=ue({model:e,view:t,field:n,filter:i,fields:x,...w&&{rule:w}}),E=T.rows,O=(0,q.useMemo)(()=>E&&{total:E.length,rowAt:e=>E[e]},[E]);if(C!==void 0&&!w)return(0,Q.jsx)(D,{children:V.rich(`noRule`,{rule:C})});if(T.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(r,{className:`h-4 w-full`},t))});if(T.error)return(0,Q.jsx)(s,{title:V(`couldNotLoad`),error:T.error});if(!O||O.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let k=t=>p({kind:`record`,resource:e.name,key:h(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:b,source:O,latencyMs:0,onOpenRow:k,rowLink:t=>({href:m({kind:`record`,resource:e.name,key:h(e,t)}),onFollow:()=>k(t)}),...o&&{sort:o.value,onSortChange:o.onChange},rowNumbers:!1,reorder:{label:n=>f(e,t,n,n.id),onMove:T.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:r=!1})=>{let i=V(e?`done`:`reorder`);return(0,Q.jsxs)(d,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(T,{className:`size-3.5`}):(0,Q.jsx)(W,{className:`size-3.5`}),!r&&i]})};export{K as a,oe as i,de as n,se as r,fe as t};
2
- //# debugId=596c0732-cbd8-4dd0-9ccc-2026ce2b6b7d
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{Ac as r,Bl as i,Cl as a,Dn as o,Er as s,Il as c,La as l,Ms as u,Nc as d,Nl as f,Oi as p,Qa as m,Ra as h,Su as g,Ts as _,Xr as v,Ya as y,_c as b,bu as x,hn as S,ii as C,jc as w,ll as T,ml as E,mo as D,or as O,sr as k,ui as A,vc as j,wl as M}from"./app-CgllsYQy.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-BIvz_g-b.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as B,r as ee,s as V,t as H}from"./messages-CWURrUB-.js";var U={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};U.node;var W=E(U),G={name:`pencil`,size:24,node:[[`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`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};G.node;var K=E(G),q=e(t(),1),J=M(`app/delete`),Y=x(),X=({blockingPlural:e,noun:t})=>J(`stillPointAt`,{plural:e,noun:t}),Z=({blockedBy:e,resources:t,views:n,noun:r,key:i})=>{let{resource:a,field:o}=e;if(!t[a])return;let s=n[a]?.names?.plural??c(a),l=X({blockingPlural:s,noun:r});if(!o||i===void 0)return{text:l};let u={kind:`list`,resource:a,filter:g(Y.eq(o,i))};return{text:l,link:{label:J(`show`,{plural:s}),to:u}}},Q=e(n(),1),te=({title:e,noun:t,busy:n,onConfirm:r,onCancel:i})=>(0,Q.jsx)(w,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(d,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:r,children:J(`delete`)})]})}),ne=({title:e,changes:t,busy:n,onReview:r,onDeleteAnyway:i,onCancel:a})=>(0,Q.jsx)(w,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(d,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:i,children:J(`deleteAnyway`)})]}),children:t.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noVisibleChanges`)}):(0,Q.jsx)(`ul`,{className:`divide-y rounded-md border`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`grid grid-cols-[96px_1fr] gap-3 px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.after})]})]},e.field))})}),$=e=>{if(e.stage===`confirm`)return(0,Q.jsx)(w,{title:J(`bulkConfirmTitle`,{count:e.count,noun:e.noun,plural:e.plural}),description:J(`bulkConfirmDescription`),onClose:e.onCancel,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(d,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,onClick:e.onConfirm,children:J(`deleteCount`,{count:e.count})})]})});if(e.stage===`running`)return(0,Q.jsx)(w,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(d,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(w,{title:e.failures.length===0?J(`deleted`,{count:t}):J(`deletedOf`,{count:t,total:e.total}),description:e.failures.length===0?void 0:J(`kept`,{count:e.failures.length}),onClose:e.onClose,actions:(0,Q.jsx)(d,{variant:`primary`,onClick:e.onClose,children:J(`done`)}),children:e.failures.length>0&&(0,Q.jsx)(`ul`,{className:`max-h-48 divide-y overflow-y-auto rounded-md border`,children:e.failures.map(e=>(0,Q.jsxs)(`li`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-danger-text`,children:e.message})]},e.title))})})},re=new Set([`updated_at`,`updatedAt`]),ie=(e,t,n,r)=>Object.values(e.fields).flatMap(e=>{if(re.has(e.name)||JSON.stringify(n[e.name]??null)===JSON.stringify(r[e.name]??null))return[];let i=t?.fields[e.name];return[{field:e.name,label:i?.label??c(e.name),before:p(e,n[e.name],i),after:p(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:i})=>{let a=u(),o=N(),s=m(),[l,d]=(0,q.useState)(),[f,p]=(0,q.useState)(!1),h=t?.names?.singular??c(e.name),g=t?.names?.plural??c(e.name),{resources:y,views:x}=_(),{href:S,open:C}=v(),w=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:y,views:x,noun:h,...e.primaryKey.length===1&&{key:n.key}}),T=()=>{for(let t of[`page`,`list`,`first-page`,`map`])o.invalidateQueries({queryKey:[t,e.name]});for(let t of[`facets`,`series`,`aggregate`,`histogram`,`count`])o.invalidateQueries({queryKey:[t,e.name]})},E=async(t,n)=>{let r=n??(await a.get(e.name,t.key)).etag;try{await a.remove(e.name,t.key,{etag:r})}catch(e){if(!(e instanceof b))throw e;return e}},D=t=>{T(),d(void 0),n?.(t),s.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&i&&{action:{label:J(`undo`),onClick:()=>{i(t).then(()=>{T(),s.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!j(e))throw e;T(),s.show({state:e.status===409?`success`:`error`,title:e.status===409?J(`alreadyBack`,{title:t.title}):J(`couldNotRestore`,{title:t.title}),description:e.status===409?void 0:e.message})})}}}})},O=async(n,r)=>{p(!0);try{if(!await E(n,r))return D(n);let i=(await a.get(e.name,n.key)).record;d({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!j(e))throw e;d(void 0);let t=w(e,n);s.show({state:`error`,title:J(`couldNotDelete`,{title:n.title}),description:t?.text??e.message,...t?.link&&{action:{label:t.link.label,href:S(t.link.to),onNavigate:C}}})}finally{p(!1)}},k=async e=>{try{return await E(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!j(t))throw t;return{title:e.title,message:w(t,e)?.text??t.message}}},A=async e=>{let t=[],n=[],r=0;d({kind:`bulk-running`,done:r,total:e.length});let i=[...e];return await Promise.all(Array.from({length:Math.min(ae,e.length)},async()=>{for(let a=i.shift();a;a=i.shift()){let i=await k(a);i&&(t.push(i),n.push(a)),r+=1,d({kind:`bulk-running`,done:r,total:e.length})}})),T(),d({kind:`bulk-done`,total:e.length,failures:t}),n},M=()=>d(void 0);return{dialogs:l&&(0,Q.jsxs)(Q.Fragment,{children:[l.kind===`confirm`&&(0,Q.jsx)(te,{title:l.target.title,noun:h,busy:f,onCancel:M,onConfirm:()=>void O(l.target,l.target.etag)}),l.kind===`conflict`&&(0,Q.jsx)(ne,{title:l.target.title,changes:l.changes,busy:f,onCancel:M,onReview:()=>{M(),r?.(l.target,l.fresh)},onDeleteAnyway:()=>void O(l.target,`*`)}),l.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:l.targets.length,noun:h,plural:g,onCancel:()=>{M(),l.settle(l.targets)},onConfirm:()=>l.settle(A(l.targets))}),l.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:l.done,total:l.total}),l.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:l.total,failures:l.failures,onClose:M})]}),start:t=>e.softDelete?O(t,t.etag):d({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>d({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=u();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:a})=>{let o=t=>r.findIndex(n=>i(h(e,n))===t),s=t.after.find(e=>o(e.key)>a);if(s)return H(`dependsOn`,{record:n,other:s.title});let c=t.before.find(e=>o(e.key)!==-1&&o(e.key)<a);return c?H(`dependsOn`,{record:c.title,other:n}):void 0},le=(e,t,n,r)=>{let i=e[t],a;for(let o=n;o<e.length;o++){let n=r({record:i,order:I(e,t,o),index:o});if(n===void 0)return{to:o,...a!==void 0&&{reason:a}};a??=n}return{to:t,reason:a}},ue=({model:e,view:t,field:n,filter:r,fields:i,rule:s})=>{let c=u(),d=m(),p=o(),{resources:h,views:g}=_(),v=`${n} asc`,y=P({queryKey:[...a.list(e.name,r,v,500,`hand-order`),i.join(`,`)],queryFn:async()=>{let t=O(h,g,e,i),n=[],a=``;do{let o=await c.search(e.name,{filter:r||void 0,orderBy:v,pageSize:500,labels:t,...a&&{pageToken:a}});n.push(...k(h,e,i,o.items,o.labels).map((t,n)=>({...t,id:l(e,o.items[n])}))),a=o.nextPageToken}while(a);return n}}),[b,x]=(0,q.useState)(),S=(0,q.useRef)(void 0),w=(0,q.useRef)([]),T=(0,q.useRef)(void 0),E=(0,q.useRef)(Promise.resolve()),D=(0,q.useRef)(0),A=(0,q.useRef)(void 0),j=async()=>{let t=S.current,r=w.current;if(w.current=[],!t||r.length===0)return;let i=await c.batchWrite(r),a=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[l(e,t.record),t])),o=z(i.results,t=>l(e,t)),s=L(e,[...a].map(([e,t])=>({...t,before:{[n]:o.get(e)}})),[n]);A.current!==void 0&&d.dismiss(A.current),A.current=d.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(s)}}),S.current&&=S.current.map(e=>{let t=a.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},M=(e,t)=>n=>{S.current=void 0,w.current=[],x(void 0),d.show(B(n,e,{place:`list`,title:t?T.current:void 0}))},N=async()=>{--D.current,!(D.current>0)&&(await p(e.name),!(D.current>0)&&(S.current=void 0,x(void 0)))},F=(n,r)=>{let i=S.current??y.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,s);let a=C(e,i[n]).record,o=i[n].id;R(c,e,t,a).then(n=>{let i=S.current??y.data,c=ce(e,n,f(e,t,a,o));H(i,i.findIndex(e=>e.id===o),r,e=>c(e)??s?.(e))},M(V(`couldNotChange`),!1))},H=(i,a,o,s)=>{if(a===-1||a===o)return;let c=s?U(i,a,o,s):o;a!==c&&(S.current=I(i,a,c),w.current=[...w.current,ee(e,n,r,S.current,c)],x(S.current),D.current+=1,T.current=f(e,t,C(e,i[a]).record,i[a].id),E.current=E.current.then(j).catch(M(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>C(e,t).record),n,r,i);return a.reason!==void 0&&d.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{A.current!==void 0&&d.dismiss(A.current),A.current=void 0,D.current+=1,E.current=E.current.then(async()=>{await c.batchWrite(e),S.current=void 0,w.current=[],x(void 0)}).catch(M(V(`couldNotUndo`),!1)).then(N)};return{rows:b??y.data,loading:y.isPending,error:y.error,move:F}},de=({model:e,view:t,field:n,filter:i,columns:a,sort:o})=>{let{resources:c,views:l}=_(),{fields:u,dropRules:d}=y(),{go:p,href:m}=v(),g=o!==void 0,b=(0,q.useMemo)(()=>S(e,t,a,{resources:c,views:l,fieldTypes:u}).map(e=>g?e:{...e,sortable:!1}),[e,t,a.join(`,`),c,l,u,g]),x=(0,q.useMemo)(()=>A(e,t,b.map(e=>e.id)),[e,t,b]),C=t?.list?.drag?.rule,w=C===void 0?void 0:d?.[C],T=ue({model:e,view:t,field:n,filter:i,fields:x,...w&&{rule:w}}),E=T.rows,O=(0,q.useMemo)(()=>E&&{total:E.length,rowAt:e=>E[e]},[E]);if(C!==void 0&&!w)return(0,Q.jsx)(D,{children:V.rich(`noRule`,{rule:C})});if(T.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(r,{className:`h-4 w-full`},t))});if(T.error)return(0,Q.jsx)(s,{title:V(`couldNotLoad`),error:T.error});if(!O||O.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let k=t=>p({kind:`record`,resource:e.name,key:h(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:b,source:O,latencyMs:0,onOpenRow:k,rowLink:t=>({href:m({kind:`record`,resource:e.name,key:h(e,t)}),onFollow:()=>k(t)}),...o&&{sort:o.value,onSortChange:o.onChange},rowNumbers:!1,reorder:{label:n=>f(e,t,n,n.id),onMove:T.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:r=!1})=>{let i=V(e?`done`:`reorder`);return(0,Q.jsxs)(d,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(T,{className:`size-3.5`}):(0,Q.jsx)(W,{className:`size-3.5`}),!r&&i]})};export{K as a,oe as i,de as n,se as r,fe as t};
2
+ //# debugId=9e655d02-ab1e-45b0-9d6a-9537a103050f
@@ -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{Ac as r,Er as i}from"./app-BvzjyTCc.js";import{t as a}from"./workflow-canvas-Q34kGPs0.js";import{a as o,i as s,n as c}from"./step-panel-Dn25BrQ4.js";import{t as l}from"./use-run-trace-DM48FzsT.js";import{t as u}from"./use-workflow-types-Di9JvED2.js";import{n as d,t as f}from"./graph-frame-PVfWqgbJ.js";var p=e(t(),1),m=e(n(),1),h=new Map,g=({trace:e,types:t,notice:n,idle:l})=>{let{definition:u,steps:g,going:_,place:v}=e,y=(0,p.useMemo)(()=>v&&o(g,{inProgress:_,...v}),[v,g,_]),[b,x]=(0,p.useState)();if(e.error)return(0,m.jsx)(i,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(r,{className:`h-[28rem] w-full max-sm:h-[22rem]`});let S=[...y].filter(([,e])=>e.status===`failed`).map(([e])=>e).sort((e,t)=>t.split(`/`).length-e.split(`/`).length)[0],C=b===void 0?S:b??void 0,w={...e.run,id:e.id,created_at:String(e.run.created_at)};return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!_&&g.length===0&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`noTrace`)}),(0,m.jsx)(f,{canvas:(0,m.jsx)(a,{definition:u,problems:h,selected:C,onSelect:e=>x(e??null),traces:y,...t&&{types:t}}),panel:(0,m.jsxs)(m.Fragment,{children:[n,C===void 0?l??(0,m.jsx)(d,{children:s(`pickNode`)}):(0,m.jsx)(c,{definition:u,run:w,selected:C,...t&&{types:t}})]})})]})},_=({runId:e})=>{let t=l(e),n=u().data;return(0,m.jsx)(g,{trace:t,...n&&{types:n}})};export{_ as RunTrace};
2
- //# debugId=7643bda1-66de-46dd-90cf-a09fdc566b37
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{Ac as r,Er as i}from"./app-CgllsYQy.js";import{t as a}from"./workflow-canvas-CzzTk8Bv.js";import{a as o,i as s,n as c}from"./step-panel-DifkdQUN.js";import{t as l}from"./use-run-trace-B0JxFskZ.js";import{t as u}from"./use-workflow-types-7sud5u7m.js";import{n as d,t as f}from"./graph-frame-PVfWqgbJ.js";var p=e(t(),1),m=e(n(),1),h=new Map,g=({trace:e,types:t,notice:n,idle:l})=>{let{definition:u,steps:g,going:_,place:v}=e,y=(0,p.useMemo)(()=>v&&o(g,{inProgress:_,...v}),[v,g,_]),[b,x]=(0,p.useState)();if(e.error)return(0,m.jsx)(i,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(r,{className:`h-[28rem] w-full max-sm:h-[22rem]`});let S=[...y].filter(([,e])=>e.status===`failed`).map(([e])=>e).sort((e,t)=>t.split(`/`).length-e.split(`/`).length)[0],C=b===void 0?S:b??void 0,w={...e.run,id:e.id,created_at:String(e.run.created_at)};return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!_&&g.length===0&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`noTrace`)}),(0,m.jsx)(f,{canvas:(0,m.jsx)(a,{definition:u,problems:h,selected:C,onSelect:e=>x(e??null),traces:y,...t&&{types:t}}),panel:(0,m.jsxs)(m.Fragment,{children:[n,C===void 0?l??(0,m.jsx)(d,{children:s(`pickNode`)}):(0,m.jsx)(c,{definition:u,run:w,selected:C,...t&&{types:t}})]})})]})},_=({runId:e})=>{let t=l(e),n=u().data;return(0,m.jsx)(g,{trace:t,...n&&{types:n}})};export{_ as RunTrace};
2
+ //# debugId=ac4f898b-0dc5-40c4-9879-8e02375090ca
@@ -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{Al as r,Ms as i,Nc as a,fa as o,gc as s,wl as c}from"./app-BvzjyTCc.js";import{t as l}from"./copy-field-Dbw_Ios8.js";var u=e(t(),1),d=c(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof s?e.slug===`runner-registered`?d(`registered`):e.slug===`runner-revoked`?d(`revoked`):e.status===404?d(`notYours`):d(`failed`):d(`failed`),m=({value:e})=>{let t=i(),[n,r]=(0,u.useState)(),[s,c]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{c(!0),h(void 0),await t.runnerRegistration(e).then(r,e=>h(p(e))),c(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:o(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(a,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:s,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...r.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
- //# debugId=41ee3c66-0322-4d5a-a4cf-5ece31a92c3a
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{Al as r,Ms as i,Nc as a,fa as o,gc as s,wl as c}from"./app-CgllsYQy.js";import{t as l}from"./copy-field-DBuqCBWo.js";var u=e(t(),1),d=c(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof s?e.slug===`runner-registered`?d(`registered`):e.slug===`runner-revoked`?d(`revoked`):e.status===404?d(`notYours`):d(`failed`):d(`failed`),m=({value:e})=>{let t=i(),[n,r]=(0,u.useState)(),[s,c]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{c(!0),h(void 0),await t.runnerRegistration(e).then(r,e=>h(p(e))),c(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:o(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(a,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:s,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...r.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
+ //# debugId=3c3b3dc8-2e19-4e0f-84d9-bad138faeaba
@@ -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{Fc as r,Nc as i,Ta as a,fa as o,gc as s,jc as c,ml as l,ua as u,uo as d,vc as f,wl as p,yc as m}from"./app-BvzjyTCc.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=l(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new s({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):m(e)},y=e=>{let t=e.url.replace(/\/+$/,``),n=e.fetch??((e,t)=>fetch(e,t)),r=async(r,i)=>{let a=await e.token(),o=await n(`${t}${r}`,{method:i,headers:{accept:`application/json`,...a&&{authorization:`Bearer ${a}`}}});if(!o.ok)throw await v(o);return await o.json()};return{status:()=>r(``,`GET`),update:()=>r(`/update`,`POST`)}},b=e(t(),1),x=p(`app/runtime`),S=e=>!!(e?.updateAvailable&&e.indicator),C=e=>e?5e3:18e5,w=(e,t)=>{if(!e.updateStage)return x(`updatingNow`);let n=x(e.updateStage);if(!e.updateStartedAt)return n;let r=Math.max(0,Math.floor((t-Date.parse(e.updateStartedAt))/1e3));return x(`started`,{stage:n,ago:u(r)})},T=(e,t=Date.now(),n=a())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:o(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=a())=>{let n=o(Date.parse(e.finishedAt),t),r=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${r}: ${e.message}`:`${r}.`},D=e=>f(e)&&e.status<500&&e.problem.detail?e.problem.detail:f(e)&&e.status===409?x(`alreadyLatest`):f(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:a,onUpdate:o,onClose:s})=>{let l=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(c,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(r,{className:`size-3.5`}),T(e)]}):T(e),onClose:s,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{onClick:s,children:x(`close`)}),(0,O.jsx)(i,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:o,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),l&&(0,O.jsx)(`p`,{className:l.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(l)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),a!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=d(),n=(0,b.useRef)(t);n.current=t;let r=t!==void 0;return(0,b.useMemo)(()=>r?y({url:e,token:()=>n.current}):void 0,[e,r])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:a,checkError:o}=M(e),[s,c]=(0,b.useState)(!1);return!t||!s&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(i,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>c(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),s&&(0,O.jsx)(A,{status:t,requesting:r,error:a,checkError:o,onUpdate:()=>void n(),onClose:()=>c(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
2
- //# debugId=20719906-19b0-4de2-ab6e-3225bbab0ad7
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{Fc as r,Nc as i,Ta as a,fa as o,gc as s,jc as c,ml as l,ua as u,uo as d,vc as f,wl as p,yc as m}from"./app-CgllsYQy.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=l(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new s({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):m(e)},y=e=>{let t=e.url.replace(/\/+$/,``),n=e.fetch??((e,t)=>fetch(e,t)),r=async(r,i)=>{let a=await e.token(),o=await n(`${t}${r}`,{method:i,headers:{accept:`application/json`,...a&&{authorization:`Bearer ${a}`}}});if(!o.ok)throw await v(o);return await o.json()};return{status:()=>r(``,`GET`),update:()=>r(`/update`,`POST`)}},b=e(t(),1),x=p(`app/runtime`),S=e=>!!(e?.updateAvailable&&e.indicator),C=e=>e?5e3:18e5,w=(e,t)=>{if(!e.updateStage)return x(`updatingNow`);let n=x(e.updateStage);if(!e.updateStartedAt)return n;let r=Math.max(0,Math.floor((t-Date.parse(e.updateStartedAt))/1e3));return x(`started`,{stage:n,ago:u(r)})},T=(e,t=Date.now(),n=a())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:o(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=a())=>{let n=o(Date.parse(e.finishedAt),t),r=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${r}: ${e.message}`:`${r}.`},D=e=>f(e)&&e.status<500&&e.problem.detail?e.problem.detail:f(e)&&e.status===409?x(`alreadyLatest`):f(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:a,onUpdate:o,onClose:s})=>{let l=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(c,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(r,{className:`size-3.5`}),T(e)]}):T(e),onClose:s,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{onClick:s,children:x(`close`)}),(0,O.jsx)(i,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:o,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),l&&(0,O.jsx)(`p`,{className:l.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(l)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),a!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=d(),n=(0,b.useRef)(t);n.current=t;let r=t!==void 0;return(0,b.useMemo)(()=>r?y({url:e,token:()=>n.current}):void 0,[e,r])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:a,checkError:o}=M(e),[s,c]=(0,b.useState)(!1);return!t||!s&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(i,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>c(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),s&&(0,O.jsx)(A,{status:t,requesting:r,error:a,checkError:o,onUpdate:()=>void n(),onClose:()=>c(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
2
+ //# debugId=90eea010-1e12-4da1-aa0b-0fa4ca979f58
@@ -1 +1 @@
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{$ as e,$o as t,Ao as n,As as r,At as ee,B as te,Bt as i,Ct as a,Dr as o,Dt as s,Et as c,F as l,Fc as u,Fn as d,Fo as f,Ft as p,G as m,H as h,Hr as g,Ht as _,Io as v,Ir as y,It as b,Ja as x,Jr as S,Jt as C,K as w,Kr as T,Lr as E,Lt as D,Mr as O,Ms as k,Mt as A,Nc as j,Nr as M,Ns as N,Nt as P,Oa as F,Oc as I,Or as L,P as R,Pc as z,Pr as B,Pt as V,Q as H,Qa as U,Qo as W,Ro as G,Sl as K,St as q,Tl as J,Tt as Y,U as X,Uo as Z,Ur as Q,Ut as ne,V as re,Vo as ie,Vr as ae,Vt as oe,W as se,Wt as ce,X as le,Xn as ue,Xo as de,Xr as fe,Yr as pe,Za as me,Zt as he,_l as ge,_t as _e,aa as ve,ao as $,bl as ye,bt as be,ca as xe,dt as Se,en as Ce,es as we,et as Te,ft as Ee,gl as De,gt as Oe,ht as ke,i as Ae,ia as je,in as Me,it as Ne,jc as Pe,jn as Fe,jo as Ie,jr as Le,js as Re,ka as ze,ko as Be,kr as Ve,la as He,lo as Ue,lt as We,mt as Ge,na as Ke,nn as qe,no as Je,nt as Ye,oa as Xe,on as Ze,ot as Qe,pt as $e,qa as et,qr as tt,qt as nt,r as rt,ra as it,rn as at,rt as ot,sa as st,sn as ct,ss as lt,t as ut,ts as dt,tt as ft,uo as pt,ut as mt,vl as ht,vr as gt,vt as _t,wt as vt,xl as yt,xt as bt,yl as xt,yt as St,z as Ct,zo as wt}from"./app-BvzjyTCc.js";import{h as Tt,o as Et}from"./vendor-t7Q7QbPu.js";export{q as ActionCard,B as ActionInputError,Re as ApiProvider,tt as App,pe as AppLink,we as AppMark,Ee as AssistantDock,Ie as AuthLayout,G as AvailabilityMark,j as Button,i as CallMark,ce as CallView,w as Carousel,V as ChatDivider,P as ChatMessage,A as ChatThread,te as Choices,Be as CodeForm,be as CompactTable,vt as Composer,Pe as Dialog,_e as DiffView,Ct as Field,Me as FieldBadge,bt as FieldList,L as FileReadError,e as FocusActions,Te as FocusNotice,Ne as FocusPage,ft as FocusPanel,Ye as FocusSlot,R as Form,O as HtmlFrame,rt as InPlaceForm,de as Input,dt as LogoMark,d as Markdown,c as MentionBox,Y as MentionedText,re as MenuSelect,ie as MenuSurface,f as OtpInput,Ge as PartView,_ as RecordCall,Ce as RecordLink,ut as RecordPicker,n as ResendCodeButton,Xe as ResponsiveDialog,I as RouteLink,le as SearchPicker,l as Section,Z as Segmented,Fe as Select,a as SidePanel,D as SignInPrompt,u as Spinner,wt as StatusMark,ke as StepList,ue as Textarea,at as ToneEdge,he as TypingLine,h as allowDelayMs,z as buttonClass,p as chatDayLabel,lt as closeSidebarEvent,et as definePlugin,x as defineUi,_t as diffStats,s as emptyDraft,ge as extensionPointsOf,M as fileNamed,y as isConflict,X as isFramed,t as logoTapEvent,ee as mentionedIds,We as menuItemClass,xt as mergeUi,St as parseDiff,Oe as parsePatch,yt as pluginApi,De as pluginsChangedEvent,K as protobaseVersion,b as sameChatDay,J as showTextsIn,Le as siblingPage,v as signedOutEvent,it as statusRefreshMs,ye as uiFromModule,S as uiReadyEvent,pt as useApiToken,fe as useAppAddress,se as useArmedAfterFocus,Se as useAssistant,mt as useAssistantClient,$e as useBackendData,k as useClient,Ze as useComponentReads,ct as useComponentSelect,Ae as useCreateForm,ae as useFacets,W as useFieldControl,Ve as useFileText,Qe as useFocusPage,H as useFocusRecord,ot as useFocusZoneFilled,m as useGuardedPress,g as useHistogram,st as useInbox,gt as useLayoutRecord,T as useList,qe as useListDisplay,xe as useMarkNotificationsRead,Ke as useMembers,r as useMeta,je as useOwnStatus,ht as usePlugin,ze as usePopoverMenu,me as usePresence,F as usePushNotifications,Et as useQuery,Tt as useQueryClient,Je as useRecord,ne as useRecordCallAddress,oe as useRecordCalls,N as useResourceClient,Q as useSeries,o as useSiblingPage,Ue as useSignedInUser,ve as useStatuses,U as useToast,$ as useTypers,C as useTypingSender,He as useUnreadNotifications,E as useUpdateRecord,nt as useViewChannel};
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{$ as e,$o as t,Ao as n,As as r,At as ee,B as te,Bt as i,Ct as a,Dr as o,Dt as s,Et as c,F as l,Fc as u,Fn as d,Fo as f,Ft as p,G as m,H as h,Hr as g,Ht as _,Io as v,Ir as y,It as b,Ja as x,Jr as S,Jt as C,K as w,Kr as T,Lr as E,Lt as D,Mr as O,Ms as k,Mt as A,Nc as j,Nr as M,Ns as N,Nt as P,Oa as F,Oc as I,Or as L,P as R,Pc as z,Pr as B,Pt as V,Q as H,Qa as U,Qo as W,Ro as G,Sl as K,St as q,Tl as J,Tt as Y,U as X,Uo as Z,Ur as Q,Ut as ne,V as re,Vo as ie,Vr as ae,Vt as oe,W as se,Wt as ce,X as le,Xn as ue,Xo as de,Xr as fe,Yr as pe,Za as me,Zt as he,_l as ge,_t as _e,aa as ve,ao as $,bl as ye,bt as be,ca as xe,dt as Se,en as Ce,es as we,et as Te,ft as Ee,gl as De,gt as Oe,ht as ke,i as Ae,ia as je,in as Me,it as Ne,jc as Pe,jn as Fe,jo as Ie,jr as Le,js as Re,ka as ze,ko as Be,kr as Ve,la as He,lo as Ue,lt as We,mt as Ge,na as Ke,nn as qe,no as Je,nt as Ye,oa as Xe,on as Ze,ot as Qe,pt as $e,qa as et,qr as tt,qt as nt,r as rt,ra as it,rn as at,rt as ot,sa as st,sn as ct,ss as lt,t as ut,ts as dt,tt as ft,uo as pt,ut as mt,vl as ht,vr as gt,vt as _t,wt as vt,xl as yt,xt as bt,yl as xt,yt as St,z as Ct,zo as wt}from"./app-CgllsYQy.js";import{h as Tt,o as Et}from"./vendor-t7Q7QbPu.js";export{q as ActionCard,B as ActionInputError,Re as ApiProvider,tt as App,pe as AppLink,we as AppMark,Ee as AssistantDock,Ie as AuthLayout,G as AvailabilityMark,j as Button,i as CallMark,ce as CallView,w as Carousel,V as ChatDivider,P as ChatMessage,A as ChatThread,te as Choices,Be as CodeForm,be as CompactTable,vt as Composer,Pe as Dialog,_e as DiffView,Ct as Field,Me as FieldBadge,bt as FieldList,L as FileReadError,e as FocusActions,Te as FocusNotice,Ne as FocusPage,ft as FocusPanel,Ye as FocusSlot,R as Form,O as HtmlFrame,rt as InPlaceForm,de as Input,dt as LogoMark,d as Markdown,c as MentionBox,Y as MentionedText,re as MenuSelect,ie as MenuSurface,f as OtpInput,Ge as PartView,_ as RecordCall,Ce as RecordLink,ut as RecordPicker,n as ResendCodeButton,Xe as ResponsiveDialog,I as RouteLink,le as SearchPicker,l as Section,Z as Segmented,Fe as Select,a as SidePanel,D as SignInPrompt,u as Spinner,wt as StatusMark,ke as StepList,ue as Textarea,at as ToneEdge,he as TypingLine,h as allowDelayMs,z as buttonClass,p as chatDayLabel,lt as closeSidebarEvent,et as definePlugin,x as defineUi,_t as diffStats,s as emptyDraft,ge as extensionPointsOf,M as fileNamed,y as isConflict,X as isFramed,t as logoTapEvent,ee as mentionedIds,We as menuItemClass,xt as mergeUi,St as parseDiff,Oe as parsePatch,yt as pluginApi,De as pluginsChangedEvent,K as protobaseVersion,b as sameChatDay,J as showTextsIn,Le as siblingPage,v as signedOutEvent,it as statusRefreshMs,ye as uiFromModule,S as uiReadyEvent,pt as useApiToken,fe as useAppAddress,se as useArmedAfterFocus,Se as useAssistant,mt as useAssistantClient,$e as useBackendData,k as useClient,Ze as useComponentReads,ct as useComponentSelect,Ae as useCreateForm,ae as useFacets,W as useFieldControl,Ve as useFileText,Qe as useFocusPage,H as useFocusRecord,ot as useFocusZoneFilled,m as useGuardedPress,g as useHistogram,st as useInbox,gt as useLayoutRecord,T as useList,qe as useListDisplay,xe as useMarkNotificationsRead,Ke as useMembers,r as useMeta,je as useOwnStatus,ht as usePlugin,ze as usePopoverMenu,me as usePresence,F as usePushNotifications,Et as useQuery,Tt as useQueryClient,Je as useRecord,ne as useRecordCallAddress,oe as useRecordCalls,N as useResourceClient,Q as useSeries,o as useSiblingPage,Ue as useSignedInUser,ve as useStatuses,U as useToast,$ as useTypers,C as useTypingSender,He as useUnreadNotifications,E as useUpdateRecord,nt as useViewChannel};
@@ -1,3 +1,3 @@
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{Dl as r,Do as i,El as a,Er as o,Fc as s,Fl as c,Il as l,M as u,Nc as d,Oi as f,Su as p,bu as m,hl as h,ml as g,tl as _,vc as v}from"./app-BvzjyTCc.js";import{c as y,d as b,l as ee,o as x,u as S}from"./list-page-CqpvMK2d.js";var C={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};C.node;var te=g(C),w=e(t(),1),T=e(n(),1),ne=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,re=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>x(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,b(`line`),b(`problems`)],...n].map(e=>e.map(ne).join(`,`)).join(`\r
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{Dl as r,Do as i,El as a,Er as o,Fc as s,Fl as c,Il as l,M as u,Nc as d,Oi as f,Su as p,bu as m,hl as h,ml as g,tl as _,vc as v}from"./app-CgllsYQy.js";import{c as y,d as b,l as ee,o as x,u as S}from"./list-page-BceXf9dP.js";var C={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};C.node;var te=g(C),w=e(t(),1),T=e(n(),1),ne=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,re=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>x(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,b(`line`),b(`problems`)],...n].map(e=>e.map(ne).join(`,`)).join(`\r
2
2
  `)}\r\n`},E=({label:e,counts:t})=>(0,T.jsx)(`dl`,{"aria-label":e,className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:t.map(([e,t])=>(0,T.jsxs)(`div`,{className:`rounded-lg border px-3 py-2`,children:[(0,T.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,T.jsx)(`dd`,{className:`text-lg font-semibold tabular-nums`,children:t.toLocaleString(r())})]},e))}),D=(e,t)=>e?.fields[t]?.label??l(t),ie=new Set([`text`,`integer`,`bigint`,`decimal`,`boolean`,`date`,`timestamp`,`uuid`,`enum`,`relation`,`currency`,`country`]),O=(e,t)=>{let n=e.relation?t[e.relation.resource]:void 0;return n?.primaryKey.length===1?n:void 0},ae=(e,t,{json:n=!1}={})=>Object.values(e.fields).filter(r=>r.readOnly||r.name===e.tenant?!1:r.type===`json`?n:ie.has(r.type)?r.type!==`relation`||O(r,t)!==void 0:!1),oe=new Set([`text`,`integer`,`bigint`,`uuid`,`date`,`currency`,`country`,`enum`]),se=e=>{let t=e.primaryKey.length===1?[e.fields[e.primaryKey[0]]]:[],n=Object.values(e.fields).filter(t=>t.filterable&&!t.sensitive&&oe.has(t.type)&&!e.primaryKey.includes(t.name));return[...t,...n]},k=(e,t)=>O(e,t),A=e=>!e.nullable&&!e.default,j=e=>e.toLowerCase().replace(/[\s_-]+/g,``),ce=(e,t,n)=>{let r=new Set;return e.flatMap((e,i)=>{let a=j(e);if(a===``)return[];let o=t.find(e=>!r.has(e.name)&&(j(D(n,e.name))===a||j(e.name)===a));return o?(r.add(o.name),[{column:i,field:o.name}]):[]})},le=(e,t,n)=>{if(e===`update`)return[];let r=new Set(n.map(e=>e.field));return t.filter(e=>A(e)&&!r.has(e.name))},M=e=>({ok:!0,value:e}),N=e=>({ok:!1,problem:e}),P=e=>`“${x(e)}”`,F=(e,t)=>{if(typeof e==`number`)return String(e);if(typeof e==`string`)return u(e,t.decimal)},ue=(e,t,n)=>{let r=F(t,n);if(r===void 0)return N(b(`notNumber`,{cell:P(t)}));let[i,a=``]=r.split(`.`);if(/[1-9]/.test(a)||/e/i.test(r))return N(b(`notWholeNumber`,{cell:P(t)}));if(e.type===`bigint`)return M(String(BigInt(i)));let o=Number(i);return Number.isSafeInteger(o)?M(o):N(b(`tooLarge`,{cell:P(t)}))},de=(e,t)=>{let n=F(e,t);return n===void 0?N(b(`notNumber`,{cell:P(e)})):M(n)},fe=new Set([`true`,`yes`,`1`]),pe=new Set([`false`,`no`,`0`]),me=e=>{if(typeof e==`boolean`)return M(e);let t=typeof e==`string`||typeof e==`number`?String(e).trim().toLowerCase():``;return fe.has(t)?M(!0):pe.has(t)?M(!1):N(b(`notBoolean`,{cell:P(e)}))},I=e=>String(e).padStart(2,`0`),he=(e,t,n)=>{let r=new Date(Date.UTC(e,t-1,n));if(r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n)return`${e}-${I(t)}-${I(n)}`},L=`(\\d{1,2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?`,ge=(e,t)=>{let n=RegExp(`^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T ]${L}(Z|[+-]\\d{2}:?\\d{2})?)?$`).exec(e.trim()),r=RegExp(`^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})(?: ${L})?$`).exec(e.trim());if(!n&&!r)return;let[i,a,o]=n?[n[1],n[2],n[3]].map(Number):t===`dmy`?[r[3],r[2],r[1]].map(Number):[r[3],r[1],r[2]].map(Number),s=he(i,a,o);if(!s)return;let[c,l,u=`0`]=n?n.slice(4,7):r.slice(4,7);if(c===void 0)return{date:s};if(!(Number(c)>23||Number(l)>59||Number(u)>59))return{date:s,time:`${I(Number(c))}:${l}:${I(Number(u))}`,zone:n?.[7]}},R=(e,t)=>{if(ee(e)){let[t,n]=e.date.split(`T`);return{date:t,time:n}}return typeof e==`string`?ge(e,t.dateOrder):void 0},z=(e,t)=>N(b(`notDate`,{cell:P(e),dayFirst:t.dateOrder===`dmy`})),_e=(e,t)=>{let n=R(e,t);return n?n.time&&n.time!==`00:00:00`?N(b(`hasTime`,{cell:P(e)})):M(n.date):z(e,t)},ve=(e,t)=>{let n=R(e,t);if(!n)return z(e,t);if(n.zone)return M(new Date(`${n.date}T${n.time}${n.zone===`Z`?`Z`:n.zone.replace(/^([+-]\d{2})(\d{2})$/,`$1:$2`)}`).toISOString());let[r,i,a]=n.date.split(`-`).map(Number),[o,s,c]=(n.time??`00:00:00`).split(`:`).map(Number);return M(new Date(r,i-1,a,o,s,c).toISOString())},B=e=>e.trim().toLowerCase().replace(/\s+/g,` `),ye=(e,t,n)=>{let r=e.enumValues??[],i=B(x(n)),a=r.filter(e=>B(e)===i||B(c(e,t?.valueLabels))===i);return a.length===1?M(a[0]):a.length>1?N(b(`severalValues`,{cell:P(n),values:a.map(e=>c(e,t?.valueLabels)).join(`, `)})):N(b(`notOneOf`,{cell:P(n),values:r.map(e=>c(e,t?.valueLabels)).join(`, `)}))},be=(e,t)=>typeof e==`boolean`&&!t.booleanText?N(b(`notText`,{cell:P(e)})):M(x(e)),xe=e=>S(e)?M(e.json):M(e),V=(e,t,n,r)=>{if(y(n))return e.nullable?M(null):N(b(`emptyRequired`));if(e.type===`json`)return xe(n);if(S(n))return N(b(`nestedValue`,{cell:P(n)}));switch(e.type){case`integer`:case`bigint`:return ue(e,n,r);case`decimal`:return de(n,r);case`boolean`:return me(n);case`date`:return _e(n,r);case`timestamp`:return ve(n,r);case`enum`:return ye(e,t,n);case`text`:case`uuid`:case`currency`:case`country`:return be(n,r);default:throw Error(`Not implemented: importing ${e.type} fields, which importableFields leaves out`)}},Se=(e,t)=>e[t]?.names?.singular??l(t),Ce=(e,t)=>e[t]?.names?.plural??l(t),we=(e,t,n)=>{let{model:r,resources:i,views:a}=n,o=a[r.name],s={},c={},l=[],u=[];for(let{column:n,field:d,matchBy:f}of t.columns){let p=r.fields[d],m=e.cells[n]??null,h=D(o,d),g=k(p,i);if(g&&!y(m)){let e=f??g.primaryKey[0],n=V(g.fields[e],a[g.name]?.fields[e],m,t.options);n.ok?u.push({field:d,finding:{model:g,field:e,value:n.value}}):l.push(`${h}: ${n.problem}`),s[d]=x(m);continue}let _=V(p,o?.fields[d],m,t.options);_.ok?c[d]=s[d]=_.value:l.push(`${h}: ${_.problem}`)}let d;if(t.match&&t.mode!==`create`){let n=r.fields[t.match.field],i=V({...n,nullable:!1},o?.fields[n.name],e.cells[t.match.column]??null,t.options);i.ok?d={model:r,field:n.name,value:i.value}:l.push(`${D(o,n.name)}: ${i.problem}`)}return{values:s,data:c,problems:l,relations:u,match:d}},H=(e,t)=>{let n=e.lookups.keysOf(t.model.name,t.field,t.value),r=`${D(e.views[t.model.name],t.field).toLowerCase()} “${String(t.value)}”`;return n.length===1?{key:n[0]}:n.length===0?{none:b(`noneHas`,{singular:Se(e.views,t.model.name),named:r})}:{several:b(`severalHave`,{count:n.length,plural:Ce(e.views,t.model.name),named:r})}},Te=e=>e.cells.every(y),U=async(e,t,n)=>{let{model:r,views:i}=n,a=e.filter(e=>!Te(e)).map(e=>({row:e,...we(e,t,n)})),o=new Map;for(let e of a.flatMap(e=>[...e.relations.map(e=>e.finding),...e.match?[e.match]:[]])){let t=`${e.model.name}.${e.field}`;o.has(t)||o.set(t,{model:e.model,field:e.field,values:[]}),o.get(t).values.push(e.value)}for(let{model:e,field:t,values:r}of o.values())await n.lookups.load(e,t,r);return a.map(({row:e,values:a,data:o,problems:s,relations:c,match:l})=>{let u={...o};for(let{field:e,finding:t}of c){let a=H(n,t);`key`in a?u[e]=a.key:s.push(`${D(i[r.name],e)}: ${a.none??a.several}`)}let d=l&&H(n,l);d?.several&&s.push(b(`notOneRecord`,{found:d.several})),d?.none&&t.mode===`update`&&s.push(b(`nothingToUpdate`,{found:d.none}));let f={line:e.line,cells:e.cells,values:a,problems:s};return s.length>0?f:d&&`key`in d?{...f,op:{op:`update`,resource:r.name,key:d.key,etag:`*`,data:u}}:{...f,op:{op:`create`,resource:r.name,data:u}}})},Ee=5,De=5,Oe=async(e,t)=>{let n=e.rows(t),{value:r=[]}=await n.next();await n.return(void 0);let[i,...a]=r;return{headers:(i?.cells??[]).map(x),sample:a.slice(0,Ee)}};async function*W(e,t){let n=!0;for await(let r of e.rows(t))yield n?r.slice(1):r,n=!1}var ke=async(e,t,n,r,i,a)=>{let o={rows:0,creates:0,updates:0,problems:[],preview:[]};for await(let s of W(e,t)){a?.throwIfAborted();for(let e of await U(s,n,r))o.rows++,o.preview.length<De&&o.preview.push(e),e.op?.op===`create`?o.creates++:e.op?.op===`update`?o.updates++:o.problems.push({line:e.line,cells:e.cells,problems:e.problems});i(o.rows)}return o},Ae=(e,t)=>{if(!v(e))return[e.message];let n=e.errors.filter(e=>e.field);return n.length===0?[e.message]:n.map(e=>`${D(t.views[t.model.name],e.field)}: ${e.message}`)},je=async(e,t,n,r,{client:i,onProgress:a,cancelled:o})=>{let s={created:0,updated:0,skipped:0,failed:0,notWritten:[]},c=async e=>{let t=[...e];for(;t.length>0;){let e=t.map(e=>e.op);try{let{results:t}=await i.batchWrite(e);for(let e of t)e.op===`create`?s.created++:e.op===`update`&&s.updated++;return}catch(e){let n=v(e)?e.operation:void 0;if(n===void 0||!t[n])throw e;let[i]=t.splice(n,1);s.failed++,s.notWritten.push({line:i.line,cells:i.cells,problems:Ae(e,r)})}}},l=[],u=async e=>{for(;l.length>=100||e&&l.length>0;){if(o())return!1;await c(l.splice(0,100)),a({...s})}return!0};for await(let i of W(e,t)){for(let e of await U(i,n,r))e.op?l.push(e):(s.skipped++,s.notWritten.push({line:e.line,cells:e.cells,problems:e.problems}));if(!await u(!1))return{...s,cancelled:!0}}return await u(!0)?{...s,cancelled:!1}:{...s,cancelled:!0}},G=50,K=(e,t,n)=>i(re(t,n),b(`notImportedFile`,{name:(e??`import`).replace(/\.[^.]+$/,``)}),`text/csv`),q=({rows:e})=>(0,T.jsxs)(`ul`,{"aria-label":b(`rowsNotImported`),className:`flex flex-col gap-1 text-body`,children:[e.slice(0,G).map(e=>(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`span`,{className:`font-medium`,children:b(`rowProblems`,{line:e.line})}),` `,e.problems.join(`; `)]},e.line)),e.length>G&&(0,T.jsx)(`li`,{className:`text-muted-foreground`,children:b(`andMore`,{count:(e.length-G).toLocaleString(r())})})]}),Me=({rows:e})=>(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(s,{className:`size-3.5`}),b(`checkingRows`,{count:e.toLocaleString(r())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:i,headers:a,fileName:o})=>{let s=r[t.name],c=i.map(e=>t.fields[e.field]);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsx)(E,{label:b(`check`),counts:[[b(`rows`),e.rows],[b(`toCreate`),e.creates],[b(`toUpdate`),e.updates],[b(`withProblems`),e.problems.length]]}),e.preview.length>0&&(0,T.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,T.jsxs)(`table`,{"aria-label":b(`firstRows`),className:`w-full text-left text-body`,children:[(0,T.jsx)(`thead`,{className:`bg-muted text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`px-2 py-1.5 font-medium`,children:b(`row`)}),c.map(e=>(0,T.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:D(s,e.name)},e.name))]})}),(0,T.jsx)(`tbody`,{className:`divide-y`,children:e.preview.map(e=>(0,T.jsxs)(`tr`,{className:e.problems.length>0?`bg-danger-soft`:void 0,children:[(0,T.jsx)(`td`,{className:`px-2 py-1.5 tabular-nums text-muted-foreground`,children:e.line}),c.map(t=>(0,T.jsx)(`td`,{className:`max-w-48 truncate px-2 py-1.5`,children:k(t,n)?String(e.values[t.name]??`—`):t.name in e.values?f(t,e.values[t.name],s?.fields[t.name]):``},t.name))]},e.line))})]})}),e.problems.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`problemRows`)}),(0,T.jsxs)(d,{size:`sm`,onClick:()=>K(o,a,e.problems),children:[(0,T.jsx)(_,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(q,{rows:e.problems})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`batches`,{size:100})})]})},Pe=[`.xlsx`,`.csv`,`.json`],Fe=[`text/csv`,`application/json`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],Ie=[`text/comma-separated-values`,`application/csv`,`text/x-csv`,`application/vnd.ms-excel`,`text/plain`,`application/octet-stream`],Le=e=>/\bAndroid\b/.test(e),Re=e=>[...Pe,...Fe,...Le(e)?Ie:[]].join(`,`),J=({label:e,name:t,value:n,options:r,onChange:i,help:a,className:o})=>{let s=(0,w.useId)();return(0,T.jsxs)(`div`,{className:h(`flex min-w-0 flex-col gap-1.5`,o),children:[(0,T.jsx)(`label`,{htmlFor:s,className:`font-medium`,children:e}),(0,T.jsx)(`select`,{id:s,"aria-label":t,value:n,onChange:e=>i(e.target.value),className:`h-8 w-full min-w-0 rounded-md border border-border-strong bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20 max-sm:min-h-11`,children:r.map(e=>(0,T.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a})]})},Y=({file:e,sheets:t,sheet:n,reading:r,onChoose:i,onSheet:a})=>{let o=(0,w.useId)();return(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsx)(`label`,{htmlFor:o,className:`font-medium`,children:b(`file`)}),(0,T.jsx)(`input`,{id:o,type:`file`,accept:Re(globalThis.navigator?.userAgent??``),disabled:r,onChange:e=>{let t=e.target.files?.[0];t&&i(t)},className:`file:mr-3 file:h-8 file:rounded-md file:border file:border-border-strong file:bg-background file:px-3 file:font-medium file:text-foreground max-sm:file:min-h-11`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`fileHint`)})]}),r&&(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,T.jsx)(s,{className:`size-3.5`}),b(`reading`,{name:e?.name??b(`theFile`)})]}),!r&&t.length>1&&(0,T.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,T.jsx)(te,{className:`mb-2 size-4 shrink-0 text-muted-foreground`}),(0,T.jsx)(J,{className:`flex-1`,label:b(`sheet`),value:n??``,options:t.map(e=>({value:e,label:e})),onChange:a})]})]})},X=e=>e.toLocaleString(r()),ze=({progress:e,total:t,cancelling:n})=>{let r=e.created+e.updated+e.failed;return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:b(n?`stopping`:`saving`)}),(0,T.jsxs)(`span`,{className:`tabular-nums`,children:[X(r),` / `,X(t)]})]}),(0,T.jsx)(`div`,{role:`progressbar`,"aria-label":b(`rowsSaved`),"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":t,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${t>0?Math.min(100,r/t*100):0}%`}})})]})},Be=({result:e,stopped:t,headers:n,fileName:r})=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t!==void 0&&(0,T.jsx)(o,{title:b(`stopped`),error:t}),e.cancelled&&(0,T.jsx)(`p`,{role:`status`,children:b(`cancelled`)}),(0,T.jsx)(E,{label:b(`summary`),counts:[[b(`created`),e.created],[b(`updated`),e.updated],[b(`skipped`),e.skipped],[b(`failed`),e.failed]]}),e.notWritten.length>0&&(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`font-medium`,children:b(`rowsNotImported`)}),(0,T.jsxs)(d,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,T.jsx)(_,{className:`size-3.5`}),b(`download`)]})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`notWrittenHint`)}),(0,T.jsx)(q,{rows:[...e.notWritten].sort((e,t)=>e.line-t.line)})]})]}),Ve=m(),Z=100,Q=e=>String(e),He=e=>{let t=new Map,n=(e,n)=>{let r=`${e}.${n}`;return t.has(r)||t.set(r,new Map),t.get(r)};return{load:async(t,r,i)=>{let a=n(t.name,r),o=[...new Map(i.filter(e=>!a.has(Q(e))).map(e=>[Q(e),e])).values()],s=t.primaryKey[0];for(let n=0;n<o.length;n+=Z){let i=o.slice(n,n+Z);for(let e of i)a.set(Q(e),[]);let c=p(Ve.in(r,i)),l;do{let n=await e(t.name).list(t.name,{filter:c,fields:[...new Set([s,r])],pageSize:1e3,pageToken:l});for(let e of n.items)a.get(Q(e[r]))?.push(e[s]);l=n.nextPageToken||void 0}while(l)}},keysOf:(e,t,r)=>n(e,t).get(Q(r))??[]}},Ue=500,$=()=>{let e=new Worker(new URL(`/assets/parse-worker-zWUgfCm6.js`,``+import.meta.url),{type:`module`}),t=[],n;return e.onmessage=e=>{if(n){let t=n;n=void 0,t(e.data)}else t.push(e.data)},e.onerror=e=>{e.preventDefault();let r={type:`error`,message:b(`unreadable`)};n?n(r):t.push(r)},{send:t=>e.postMessage(t),receive:()=>t.length>0?Promise.resolve(t.shift()):new Promise(e=>n=e),stop:()=>e.terminate()}},We=e=>({sheets:async()=>{let t=$();try{t.send({type:`sheets`,file:e,locale:a()});let n=await t.receive();if(n.type===`error`)throw Error(n.message);if(n.type!==`sheets`)throw Error(`The parse worker answered ${n.type} to a request for sheets`);return n.sheets}finally{t.stop()}},rows:async function*(t){let n=$();try{for(n.send({type:`read`,file:e,sheet:t,chunk:Ue,locale:a()});;){let e=await n.receive();if(e.type===`error`)throw Error(e.message);if(e.type===`end`)return;if(e.type!==`rows`)throw Error(`The parse worker answered ${e.type} to a read`);yield e.rows,n.send({type:`next`})}}finally{n.stop()}}});export{A as _,Y as a,Me as c,je as d,ce as f,k as g,se as h,Be as i,ke as l,ae as m,He as n,J as o,D as p,ze as r,Ne as s,We as t,Oe as u,le as v};
3
- //# debugId=80a19b5f-21eb-4add-b9fa-02afc1b78530
3
+ //# debugId=a1e6e165-b797-47fa-b08f-12fb52899f76
@@ -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{Dl as r,Fc as i,Gs as a,Hs as o,Nc as s,Ss as c,Vs as l,_s as u,bs as d,fa as f,hl as p,vs as m}from"./app-BvzjyTCc.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:l(`on`)},{value:`forbidden`,label:l(`off`)}],v=()=>[{value:`allowed`,label:l(`optional`)},{value:`required`,label:l(`required`)},{value:`forbidden`,label:l(`off`)}],y=()=>[{method:`password`,label:l(`password`),description:l(`passwordDescription`),rules:_()},{method:`emailCode`,label:l(`emailedSignInCode`),description:l(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:l(`passkeys`),description:l(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:l(`twoFactor`),description:l(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:l(`staffAccess`),description:l(`staffAccessDescription`),rules:[{value:`allowed`,label:l(`on`)},{value:`notify`,label:l(`emailThePerson`)},{value:`forbidden`,label:l(`off`)}]},{method:`platformSignIn`,label:l(`platformSignIn`),description:l(`platformSignInDescription`),rules:_()}],b=(e,t)=>{let n=y().find(t=>t.method===e)?.rules.find(e=>e.value===t)?.label;if(n===void 0)throw Error(`No label for the ${t} rule of ${e}`);return n},x=e(n(),1),S=({row:e,value:t,onChange:n})=>(0,x.jsx)(`span`,{role:`radiogroup`,"aria-label":e.label,className:`inline-flex h-8 shrink-0 rounded-md bg-muted p-0.5`,children:e.rules.map(e=>(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.value===t,onClick:()=>n(e.value),className:p(`rounded px-3 text-body font-medium transition-colors`,e.value===t?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.value))}),C=({method:e},t,{mail:n,effective:r,policy:i})=>{if(e===`emailCode`&&!n)return l(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return l(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return l(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return l(`platformOff`);if(t[e]===i[e]&&r[e]!==i[e])return l(`appliesAs`,{rule:b(e,r[e])})},w=({operator:e,platformProviders:t=[]})=>y().flatMap(n=>n.method===`staffAccess`&&!e?[]:n.method===`platformSignIn`?t.length>0?[{...n,label:l(`platformSignInWith`,{provider:new Intl.ListFormat(r(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:r,notice:i})=>{let[a,o]=(0,g.useState)(e.policy),c=w(e),u=c.some(({method:t})=>a[t]!==e.policy[t]);return(0,x.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(a)},children:[(0,x.jsx)(`ul`,{className:`divide-y rounded-lg border bg-background`,children:c.map(t=>{let n=C(t,a,e);return(0,x.jsxs)(`li`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h2`,{className:`font-semibold`,children:t.label}),(0,x.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:t.description}),n&&(0,x.jsx)(`p`,{className:`mt-1.5 text-xs font-medium text-warning-text`,children:n})]}),(0,x.jsx)(S,{row:t,value:a[t.method],onChange:e=>o({...a,[t.method]:e})})]},t.method)})}),r&&(0,x.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger-soft px-3 py-2 text-body font-medium text-danger-text`,children:r}),i&&!u&&(0,x.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:i}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.savedAt?e.savedBy?l(`lastSavedBy`,{name:e.savedBy,time:f(Date.parse(e.savedAt))}):l(`lastSaved`,{time:f(Date.parse(e.savedAt))}):l(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,x.jsx)(s,{onClick:()=>o(e.policy),children:l(`reset`)}),(0,x.jsx)(s,{variant:`primary`,type:`submit`,loading:n,disabled:!u,children:l(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(d,{tone:`neutral`,children:l(`stopped`,{time:f(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(d,{tone:`neutral`,children:l(`ended`,{time:f(Date.parse(e.expiresAt))})}):(0,x.jsx)(d,{tone:`amber`,children:l(`signedInUntil`,{time:f(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:r=Date.now()})=>(0,x.jsxs)(u,{title:l(`staffSignIns`),description:l(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(m,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:l(`noStaffSignIns`)}),e&&e.length>0&&(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,x.jsxs)(`li`,{className:`flex flex-col gap-1.5 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.staffName?`${e.staffName} (${e.staff})`:e.staff}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:l(`as`)}),(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.user})]}),(0,x.jsx)(`p`,{className:`break-words`,children:e.reason}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:f(Date.parse(e.startedAt))}),E(e,r)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=o(),[n,r]=(0,g.useState)(),[i,s]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>s(e instanceof a?c(e):l(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:i})},k=()=>{let{session:e}=o(),[t,n]=(0,g.useState)(),[r,s]=(0,g.useState)(!1),[u,d]=(0,g.useState)(),[f,p]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>d(e instanceof a?c(e):l(`couldNotReadPolicy`)))},[e]);let m=async t=>{s(!0),d(void 0),p(void 0);try{n(await e.signInPolicy.save(t)),p(l(`policySaved`))}catch(e){if(!(e instanceof a))throw e;d(c(e))}s(!1)};return(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,x.jsx)(h,{title:l(`signInPolicy`),subtitle:l(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:u,notice:f,onSave:e=>void m(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):u?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:u}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(i,{}),` `,l(`loading`)]})]})};export{k as SignInPolicyPage};
2
- //# debugId=e0e42441-9fcc-4eb3-9ffd-dbf60566f7e6
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{Dl as r,Fc as i,Gs as a,Hs as o,Nc as s,Ss as c,Vs as l,_s as u,bs as d,fa as f,hl as p,vs as m}from"./app-CgllsYQy.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:l(`on`)},{value:`forbidden`,label:l(`off`)}],v=()=>[{value:`allowed`,label:l(`optional`)},{value:`required`,label:l(`required`)},{value:`forbidden`,label:l(`off`)}],y=()=>[{method:`password`,label:l(`password`),description:l(`passwordDescription`),rules:_()},{method:`emailCode`,label:l(`emailedSignInCode`),description:l(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:l(`passkeys`),description:l(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:l(`twoFactor`),description:l(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:l(`staffAccess`),description:l(`staffAccessDescription`),rules:[{value:`allowed`,label:l(`on`)},{value:`notify`,label:l(`emailThePerson`)},{value:`forbidden`,label:l(`off`)}]},{method:`platformSignIn`,label:l(`platformSignIn`),description:l(`platformSignInDescription`),rules:_()}],b=(e,t)=>{let n=y().find(t=>t.method===e)?.rules.find(e=>e.value===t)?.label;if(n===void 0)throw Error(`No label for the ${t} rule of ${e}`);return n},x=e(n(),1),S=({row:e,value:t,onChange:n})=>(0,x.jsx)(`span`,{role:`radiogroup`,"aria-label":e.label,className:`inline-flex h-8 shrink-0 rounded-md bg-muted p-0.5`,children:e.rules.map(e=>(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.value===t,onClick:()=>n(e.value),className:p(`rounded px-3 text-body font-medium transition-colors`,e.value===t?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.value))}),C=({method:e},t,{mail:n,effective:r,policy:i})=>{if(e===`emailCode`&&!n)return l(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return l(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return l(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return l(`platformOff`);if(t[e]===i[e]&&r[e]!==i[e])return l(`appliesAs`,{rule:b(e,r[e])})},w=({operator:e,platformProviders:t=[]})=>y().flatMap(n=>n.method===`staffAccess`&&!e?[]:n.method===`platformSignIn`?t.length>0?[{...n,label:l(`platformSignInWith`,{provider:new Intl.ListFormat(r(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:r,notice:i})=>{let[a,o]=(0,g.useState)(e.policy),c=w(e),u=c.some(({method:t})=>a[t]!==e.policy[t]);return(0,x.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(a)},children:[(0,x.jsx)(`ul`,{className:`divide-y rounded-lg border bg-background`,children:c.map(t=>{let n=C(t,a,e);return(0,x.jsxs)(`li`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h2`,{className:`font-semibold`,children:t.label}),(0,x.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:t.description}),n&&(0,x.jsx)(`p`,{className:`mt-1.5 text-xs font-medium text-warning-text`,children:n})]}),(0,x.jsx)(S,{row:t,value:a[t.method],onChange:e=>o({...a,[t.method]:e})})]},t.method)})}),r&&(0,x.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger-soft px-3 py-2 text-body font-medium text-danger-text`,children:r}),i&&!u&&(0,x.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:i}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.savedAt?e.savedBy?l(`lastSavedBy`,{name:e.savedBy,time:f(Date.parse(e.savedAt))}):l(`lastSaved`,{time:f(Date.parse(e.savedAt))}):l(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[u&&(0,x.jsx)(s,{onClick:()=>o(e.policy),children:l(`reset`)}),(0,x.jsx)(s,{variant:`primary`,type:`submit`,loading:n,disabled:!u,children:l(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(d,{tone:`neutral`,children:l(`stopped`,{time:f(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(d,{tone:`neutral`,children:l(`ended`,{time:f(Date.parse(e.expiresAt))})}):(0,x.jsx)(d,{tone:`amber`,children:l(`signedInUntil`,{time:f(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:r=Date.now()})=>(0,x.jsxs)(u,{title:l(`staffSignIns`),description:l(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(m,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:l(`noStaffSignIns`)}),e&&e.length>0&&(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,x.jsxs)(`li`,{className:`flex flex-col gap-1.5 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.staffName?`${e.staffName} (${e.staff})`:e.staff}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:l(`as`)}),(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.user})]}),(0,x.jsx)(`p`,{className:`break-words`,children:e.reason}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:f(Date.parse(e.startedAt))}),E(e,r)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=o(),[n,r]=(0,g.useState)(),[i,s]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>s(e instanceof a?c(e):l(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:i})},k=()=>{let{session:e}=o(),[t,n]=(0,g.useState)(),[r,s]=(0,g.useState)(!1),[u,d]=(0,g.useState)(),[f,p]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>d(e instanceof a?c(e):l(`couldNotReadPolicy`)))},[e]);let m=async t=>{s(!0),d(void 0),p(void 0);try{n(await e.signInPolicy.save(t)),p(l(`policySaved`))}catch(e){if(!(e instanceof a))throw e;d(c(e))}s(!1)};return(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,x.jsx)(h,{title:l(`signInPolicy`),subtitle:l(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:u,notice:f,onSave:e=>void m(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):u?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:u}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(i,{}),` `,l(`loading`)]})]})};export{k as SignInPolicyPage};
2
+ //# debugId=f2ae838d-71f0-4b5b-abd7-e7f7b90aacfe
@@ -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{Gr as n,Ms as r,Pa as i,Qs as a,Rr as o,Ts as s,Ya as c,Ys as l,_r as u,bn as d,dc as f,ec as p,fn as m,fr as h,ls as g,mn as _,or as v,pn as y,ur as b,xn as x,yn as S,yr as C}from"./app-BvzjyTCc.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-DMu0yZio.js";import{n as O}from"./record-preview-CL5YvZ8R.js";var k=e(t(),1),A=e=>({queryKey:e.queryKey,start:t=>t.prefetchQuery(e)}),j=e=>({queryKey:e.queryKey,start:t=>t.prefetchInfiniteQuery(e)}),M={Table:(e,t,n)=>{let{resource:r,filter:a=``,sort:o=``,columns:s,button:c,bulk:l=!1,limit:u=10,select:f}=y(e),h=r===void 0?void 0:n.resources[r];if(!h)return[];if(t.part===`chosen`){let e=f===void 0?void 0:n.given[f];return e?[A(d(n.client,h,{key:e}))]:[]}let g=n.views[h.name],{fields:v,read:b}=_({...n,model:h,view:g,columns:s?.map(p),button:c,bulk:l,phoneColumns:m(s)});return[A(D(n,{model:h,filter:a,orderBy:o||i(h,g),limit:u,fields:v,read:b}))]},Chart:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m}=y(e),h=r[a],g=h&&E({model:h,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m},r,i);return h&&g?[A(o(n,h.name,g))]:[]},RecordCards:(e,t,{client:n,resources:r,views:a})=>{let{resource:o,filter:s=``,sort:c=``,limit:l=10}=y(e),u=r[o];if(!u)return[];let d=c||i(u,a[u.name]);return[A(x(n,u,{filter:s,sort:d,pageSize:l})),A(S(n,u,s))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=y(e),l=i[o];if(!l)return[];let u=a[l.name];return u?.searchesOf||u?.listOf!==void 0?[]:[A(O({queryClient:r,client:n,resources:i,views:a,model:l,...T(l,u,{filter:s,sort:c})}))]},Thread:(e,t,{client:r,resources:i,views:a})=>{let{resource:o,filter:s,sender:c,time:l,calls:u,limit:d=50}=y(e);if(t.part===`calls`){let e=u&&i[u.resource];return e?[j(n(r,e.name,{filter:u.filter,orderBy:f(u.time),pageSize:d}))]:[]}let p=i[o];if(!p)return[];let m=v(i,a,p,c===void 0?[]:[c]);return[j(n(r,p.name,{filter:s,orderBy:f(l),pageSize:d,labels:m}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(S(n,i))]:[]},P=(e,t,n)=>(n?.reads??[]).flatMap(n=>{let r=a(t,n.block);if(!r||r.custom)return[];if(n.part===`condition`)return N(r,n,e);if(n.split)return[];let i=M[r.type];return i?i(l(r,{stack:[],params:e.params,...e.root&&{root:e.root}}),n,e):[]}),F=({tree:e,plan:t})=>{let n=r(),i=w(),{resources:a,views:o}=s(),l=c().fields,d=g(),f=b(),p=h(),m=u(C()),_=(0,k.useMemo)(()=>P({client:n,queryClient:i,resources:a,views:o,fieldTypes:l,xs:d,params:f,given:p,...m&&{root:m}},e,t),[n,i,a,o,l,d,f,p,m,e,t]);return(0,k.useEffect)(()=>{for(let e of _)e.start(i)},[_,i]),null};export{F as t};
2
- //# debugId=a21c1273-6c7d-4573-a9f2-5bf63493ff16
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{Gr as n,Ms as r,Pa as i,Qs as a,Rr as o,Ts as s,Ya as c,Ys as l,_r as u,bn as d,dc as f,ec as p,fn as m,fr as h,ls as g,mn as _,or as v,pn as y,ur as b,xn as x,yn as S,yr as C}from"./app-CgllsYQy.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-BIvz_g-b.js";import{n as O}from"./record-preview-CWciJJ5e.js";var k=e(t(),1),A=e=>({queryKey:e.queryKey,start:t=>t.prefetchQuery(e)}),j=e=>({queryKey:e.queryKey,start:t=>t.prefetchInfiniteQuery(e)}),M={Table:(e,t,n)=>{let{resource:r,filter:a=``,sort:o=``,columns:s,button:c,bulk:l=!1,limit:u=10,select:f}=y(e),h=r===void 0?void 0:n.resources[r];if(!h)return[];if(t.part===`chosen`){let e=f===void 0?void 0:n.given[f];return e?[A(d(n.client,h,{key:e}))]:[]}let g=n.views[h.name],{fields:v,read:b}=_({...n,model:h,view:g,columns:s?.map(p),button:c,bulk:l,phoneColumns:m(s)});return[A(D(n,{model:h,filter:a,orderBy:o||i(h,g),limit:u,fields:v,read:b}))]},Chart:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m}=y(e),h=r[a],g=h&&E({model:h,groupBy:s,splitBy:c,sum:l,average:u,filter:d,granularity:f,range:p,limit:m},r,i);return h&&g?[A(o(n,h.name,g))]:[]},RecordCards:(e,t,{client:n,resources:r,views:a})=>{let{resource:o,filter:s=``,sort:c=``,limit:l=10}=y(e),u=r[o];if(!u)return[];let d=c||i(u,a[u.name]);return[A(x(n,u,{filter:s,sort:d,pageSize:l})),A(S(n,u,s))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=y(e),l=i[o];if(!l)return[];let u=a[l.name];return u?.searchesOf||u?.listOf!==void 0?[]:[A(O({queryClient:r,client:n,resources:i,views:a,model:l,...T(l,u,{filter:s,sort:c})}))]},Thread:(e,t,{client:r,resources:i,views:a})=>{let{resource:o,filter:s,sender:c,time:l,calls:u,limit:d=50}=y(e);if(t.part===`calls`){let e=u&&i[u.resource];return e?[j(n(r,e.name,{filter:u.filter,orderBy:f(u.time),pageSize:d}))]:[]}let p=i[o];if(!p)return[];let m=v(i,a,p,c===void 0?[]:[c]);return[j(n(r,p.name,{filter:s,orderBy:f(l),pageSize:d,labels:m}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(S(n,i))]:[]},P=(e,t,n)=>(n?.reads??[]).flatMap(n=>{let r=a(t,n.block);if(!r||r.custom)return[];if(n.part===`condition`)return N(r,n,e);if(n.split)return[];let i=M[r.type];return i?i(l(r,{stack:[],params:e.params,...e.root&&{root:e.root}}),n,e):[]}),F=({tree:e,plan:t})=>{let n=r(),i=w(),{resources:a,views:o}=s(),l=c().fields,d=g(),f=b(),p=h(),m=u(C()),_=(0,k.useMemo)(()=>P({client:n,queryClient:i,resources:a,views:o,fieldTypes:l,xs:d,params:f,given:p,...m&&{root:m}},e,t),[n,i,a,o,l,d,f,p,m,e,t]);return(0,k.useEffect)(()=>{for(let e of _)e.start(i)},[_,i]),null};export{F as t};
2
+ //# debugId=217816db-ec83-4a80-aeb7-4e12772107b8
@@ -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{As as r,Gc as i,Il as a,Jc as o,N as s,Nc as c,Uc as l,Xn as u,Xo as d,Yc as f,fl as p,il as ee,jc as m,jn as h,ml as g,rl as _,wl as te,z as v,zc as ne}from"./app-BvzjyTCc.js";import{t as re}from"./circle-alert-BcQBR8pH.js";import{a as ie,c as ae,d as oe,f as se,g as ce,h as le,i as ue,m as de,o as fe,p as pe,r as me,s as he,u as ge}from"./workflow-canvas-Q34kGPs0.js";import{t as _e}from"./trash-q7TV1G4p.js";import{A as ve,D as ye,F as be,M as y,_ as xe,a as Se,c as b,f as Ce,g as we,h as x,i as Te,k as S,m as Ee,n as De,o as C,s as w,u as Oe,x as ke}from"./workflows-Bey4jszG.js";import{E as T,S as Ae,T as E,_ as je,s as D,x as O}from"./use-run-trace-DM48FzsT.js";import{n as k}from"./use-workflow-types-Di9JvED2.js";var Me={type:`object`,title:`File`,properties:{uri:{type:`string`},name:{type:`string`},type:{type:`string`},size:{type:`integer`}}},Ne=(e,t)=>e.relation&&t?.(e.relation.resource)===`integer`?{type:`integer`}:{type:`string`},Pe=(e,t,n)=>{if(e.file)return t===`read`?Me:{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`?Ne(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`}}},Fe=(e,t,n)=>{let r=Pe(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]}}},Ie=(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,Fe(e,t,r)]))}),Le=e=>t=>{let n=e(t);return n?.primaryKey.length===1?n.fields[n.primaryKey[0]]?.type:void 0},Re={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`}]]};Re.node;var A=g(Re),ze={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`}]]};ze.node;var Be=g(ze),Ve={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`}]]};Ve.node;var He=g(Ve),Ue={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`}]]};Ue.node;var We=g(Ue),Ge={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`]};Ge.node;var Ke=g(Ge),qe={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`}]]};qe.node;var Je=g(qe),Ye={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`}]]};Ye.node;var Xe=g(Ye),j=(e,t)=>{let n=structuredClone(e);return t(n),n},M=new Set([`Task`,`Pass`,`Wait`,`Map`,`Block`]),N=(e,t)=>{if(!M.has(e.Type))return;let n=e;delete n.End,n.Next=t},P=(e,t)=>{let n=O(e,t);if(!n)throw Error(`No Map or Block at ${t.join(`/`)}`);return n},Ze=(e,t)=>{let n=new Set(je(e.stateMachine)),r=1;for(;n.has(`${t} ${r}`);)r++;return`${t} ${r}`},Qe=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},F=(e,t,n,r,i)=>j(e,e=>{let a=P(e,t),o=x(e)===`data`,s=Qe(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=Ze(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}),$e=e=>e.Type===`Choice`||M.has(e.Type),et=(e,t,n)=>{let r=e.States[t],i=e.States[n];if(!r||!M.has(r.Type))return;let a=r.Next;(a===void 0||$e(i))&&(N(r,n),a!==void 0&&(i.Type===`Choice`?i.Default=a:M.has(i.Type)&&N(i,a)))},tt=(e,t,n)=>{let r=P(e,t);if(n!==void 0&&n!==t.join(`/`)){let{name:e}=E(n);return M.has(r.States[e]?.Type)?e:void 0}return Object.keys(r.States).reverse().find(e=>r.States[e].End===!0)},nt=e=>e.kind===`start`?[]:E(e.source).scope,rt=e=>e.ErrorEquals.length===1&&e.ErrorEquals[0]===`States.ALL`,it=(e,t)=>{if(t.kind===`start`)return e.stateMachine.StartAt||void 0;let{scope:n,name:r}=E(t.source),i=O(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(rt)?.Next:void 0}},at=(e,t,n,r,i)=>{if(i.kind===`start`)return st(e,t,n,r);let{scope:a,name:o}=E(i.source);if(i.kind===`next`)return ot(e,a,t,n,r,o);let s=it(e,i);return j(F(e,a,t,n,r),e=>{let t=P(e,a),r=t.States[o],c=t.States[n];if(r&&(s===void 0||$e(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(rt);e?e.Next=n:r.Catch=[...r.Catch??[],{ErrorEquals:[`States.ALL`],Next:n}]}s!==void 0&&(c.Type===`Choice`?c.Default=s:M.has(c.Type)&&N(c,s))}})},ot=(e,t,n,r,i,a)=>{let o=F(e,t,n,r,i);return a===void 0||x(e)===`data`?o:j(o,e=>et(P(e,t),a,r))},st=(e,t,n,r)=>{let i=e.stateMachine.StartAt??``,a=F(e,[],t,n,r);return x(e)===`data`?a:j(a,e=>{let t=e.stateMachine.States[n];(i===``||$e(t))&&(e.stateMachine.StartAt=n,i!==``&&M.has(t.Type)&&N(t,i),i!==``&&t.Type===`Choice`&&(t.Default=i))})},ct=(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)},lt=(e,t)=>j(e,e=>{let{scope:n,name:r}=E(t),i=P(e,n);delete i.States[r];for(let e of Object.values(i.States))ct(e,r);i.StartAt===r&&(i.StartAt=Object.keys(i.States)[0]??``)}),ut=(e,t,n,r)=>j(e,e=>{let{scope:i,name:a}=E(r);if(t===`start`){e.stateMachine.StartAt=a;return}let o=E(n);if(o.scope.join(`/`)!==i.join(`/`))throw Error(`A state leads only to states of its own machine`);let s=P(e,i).States[o.name];s&&(t===`next`&&N(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}]))}),dt=(e,t)=>j(e,e=>{if(t.kind===`start`)return;let{scope:n,name:r}=E(t.source),i=P(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)}),ft=(e,t,n)=>j(e,e=>{let{scope:r,name:i}=E(t);P(e,r).States[i]=n}),pt=(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)}},mt=e=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)&&![`true`,`false`,`null`].includes(e)?e:`\`${e}\``,ht=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),I=(e,t,n)=>{if(typeof e==`string`){if(!e.trimStart().startsWith(`{%`))return e;let r=RegExp(`\\$states\\.context\\.Steps\\.(?:${ht(t)}(?![A-Za-z0-9_])|\`${ht(t)}\`)`,`g`);return e.split(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\/\*[\s\S]*?\*\/)/).map((e,t)=>t%2==1?e:e.replace(r,()=>`$states.context.Steps.${mt(n)}`)).join(``)}return Array.isArray(e)?e.map(e=>I(e,t,n)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,I(r,t,n)])):e},gt=(e,t,n)=>j(e,e=>{let{scope:r,name:i}=E(t);pt(P(e,r),i,n),e.stateMachine=I(e.stateMachine,i,n)}),_t=(e,t)=>j(e,e=>{let{scope:n,name:r}=E(t);P(e,n).StartAt=r}),vt=(e,t)=>j(e,e=>{e.trigger=t}),L=e=>typeof e==`object`&&!!e&&!Array.isArray(e),yt=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`&&L(e.items)&&e.items.type===`string`?{kind:`names`}:{kind:`json`},R=e=>{let t=L(e.properties)?e.properties:{},n=Array.isArray(e.required)?e.required:[];return Object.entries(t).map(([e,t])=>{let r=L(t)?t:{},i=typeof r.title==`string`?r.title:void 0;return{name:e,...yt(r),required:n.includes(e),...i&&{title:i}}})},z=e=>e.message.startsWith(`is missing`),bt=e=>new Map([...e].map(([e,t])=>[e,t.filter(e=>!z(e))])),xt=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}},St=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),Ct=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`&&!St(n)?[{field:e.name,message:`is a list of names, separated by commas`}]:[]}),wt=(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 Ce(e,{resources:r.map(e=>e.id),required:Object.fromEntries(r.map(e=>[e.id,R(e.input).filter(e=>e.required).map(e=>e.name)])),triggers:Object.fromEntries(i.map(e=>[e.id,Ct(R(e.input))])),unavailable:Object.fromEntries(a.map(e=>[e.id,e.reason??``])),versioned:De(r.map(e=>e.id)),...n&&{pins:n}})},Tt=e=>{let t=new Map;for(let{state:n,field:r,message:i}of Se(e))n!==void 0&&t.set(n,[...t.get(n)??[],{...r!==void 0&&{field:r},message:i}]);return t},B=e(n(),1),Et=({problems:e})=>e.length>0&&(0,B.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-body text-danger-text`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(re,{className:`size-4`,"aria-hidden":`true`}),e.every(z)?k(`fillInToSave`,{count:e.length}):k(`cannotSave`,{count:e.length})]}),(0,B.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,B.jsx)(`li`,{children:e.field?k(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),Dt=({warnings:e})=>e.length>0&&(0,B.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-body text-warning-text`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(ne,{className:`size-4`,"aria-hidden":`true`}),k(`warningsSaveAnyway`,{count:e.length})]}),(0,B.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,B.jsx)(`li`,{children:e.field?k(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),V=e(t(),1),Ot=({name:e,taken:t,disabled:n,onRename:r})=>{let[i,a]=(0,V.useState)(e),o=i.trim(),s=o===``?k(`nameNeeded`):o!==e&&t.includes(o)?k(`nameTaken`):void 0,c=()=>{!s&&o!==e&&r(o)};return(0,B.jsx)(v,{label:k(`name`),error:s,children:(0,B.jsx)(d,{value:i,invalid:!!s,disabled:n,onChange:e=>a(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&c()}})})},H=(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},U=({label:e,value:t,names:n,none:r,error:i,disabled:a,onChange:o})=>(0,B.jsx)(v,{label:e,error:i,children:(0,B.jsxs)(h,{invalid:!!i,value:t??``,disabled:a,onChange:e=>o(e.target.value===``?void 0:e.target.value),children:[(0,B.jsx)(`option`,{value:``,children:r}),t!==void 0&&!n.includes(t)&&(0,B.jsx)(`option`,{value:t,children:t}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})}),kt=e=>e===void 0?``:typeof e==`string`?e:JSON.stringify(e,null,2),At=e=>{if(e.trim()!==``)try{return JSON.parse(e)}catch(t){if(!(t instanceof SyntaxError))throw t;return e}},jt=e=>{let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},Mt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):kt(e),Nt=(0,V.createContext)(void 0),Pt=()=>(0,V.useContext)(Nt),Ft=e=>e===``?void 0:e,It={text:Ft,value:At,choice:Ft,json:At,names:jt},W=({label:e,kind:t,options:n=[],required:r,help:i,value:a,error:o,onChange:s,disabled:c,read:l=It[t],write:f=t===`names`?Mt:kt})=>{let[p,ee]=(0,V.useState)(),m=p!==void 0&&JSON.stringify(l(p))===JSON.stringify(a)?p:f(a),g=Pt(),_=e=>{ee(e),s(l(e))},te=g!==void 0&&!c&&(a==null||typeof a==`string`)&&(t===`text`||t===`json`||t===`value`);return(0,B.jsxs)(v,{label:e,required:r,help:i,error:o,wide:t===`json`,children:[t===`choice`?(0,B.jsxs)(h,{invalid:!!o,value:m,disabled:c,onChange:e=>s(e.target.value===``?void 0:e.target.value),children:[(0,B.jsx)(`option`,{value:``,children:k(`defaultChoice`)}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}):t===`json`?(0,B.jsx)(u,{invalid:!!o,rows:2,className:`font-mono text-xs`,value:m,disabled:c,onChange:e=>_(e.target.value)}):(0,B.jsx)(d,{invalid:!!o,value:m,disabled:c,onChange:e=>_(e.target.value)}),te&&(0,B.jsx)(`button`,{type:`button`,"aria-label":k(`insertValueInto`,{field:e}),className:`mt-1 text-xs font-medium text-primary-text hover:underline max-md:min-h-11`,onClick:()=>g({label:e,value:a,set:s}),children:k(`insertValue`)})]})},Lt=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),Rt=e=>Array.isArray(e)?e.join(`, `):``,G=({state:e,names:t,problems:n,disabled:r,onChange:a})=>{let o=e.Catch??[],s=t=>{let{Catch:n,...r}=e;a(t.length>0?{...r,Catch:t}:r)},l=(e,t)=>s(o.map((n,r)=>r===e?t:n));return(0,B.jsxs)(B.Fragment,{children:[o.map((e,i)=>(0,B.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border border-danger/40 p-3`,children:[(0,B.jsx)(`legend`,{className:`px-1 text-xs font-medium text-danger-text`,children:k(`errorPathNumber`,{number:i+1})}),(0,B.jsx)(W,{label:k(`errors`),kind:`text`,help:k(`errorsHelp`),value:e.ErrorEquals??[],read:Lt,write:Rt,error:H(n,`Catch[${i}].ErrorEquals`),disabled:r,onChange:t=>l(i,{...e,ErrorEquals:t})}),(0,B.jsx)(U,{label:k(`thenGoesTo`),value:e.Next||void 0,names:t,none:k(`chooseStep`),error:H(n,`Catch[${i}].Next`),disabled:r,onChange:t=>l(i,{...e,Next:t??``})}),!r&&(0,B.jsxs)(c,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>s(o.filter((e,t)=>t!==i)),children:[(0,B.jsx)(_e,{className:`size-3.5`}),k(`removeErrorPath`)]})]},i)),!r&&(0,B.jsx)(`div`,{children:(0,B.jsxs)(c,{size:`sm`,onClick:()=>s([...o,{ErrorEquals:[`States.ALL`],Next:``}]),children:[(0,B.jsx)(i,{className:`size-3.5`}),k(`addErrorPath`)]})})]})},zt=({state:e,names:t,problems:n,disabled:r,onChange:a})=>{let o=e.Choices??[],s=(t,n)=>a({...e,Choices:o.map((e,r)=>r===t?n:e)});return(0,B.jsxs)(B.Fragment,{children:[o.map((i,l)=>(0,B.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border p-3`,children:[(0,B.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:k(`ruleNumber`,{number:l+1})}),(0,B.jsx)(W,{label:k(`condition`),kind:`text`,help:k(`conditionHelp`),value:i.Condition,error:H(n,`Choices[${l}].Condition`),disabled:r,onChange:e=>s(l,{...i,Condition:typeof e==`string`?e:``})}),(0,B.jsx)(U,{label:k(`thenGoesTo`),value:i.Next||void 0,names:t,none:k(`chooseStep`),error:H(n,`Choices[${l}].Next`),disabled:r,onChange:e=>s(l,{...i,Next:e??``})}),!r&&(0,B.jsxs)(c,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>a({...e,Choices:o.filter((e,t)=>t!==l)}),children:[(0,B.jsx)(_e,{className:`size-3.5`}),k(`removeRule`)]})]},l)),!r&&(0,B.jsx)(`div`,{children:(0,B.jsxs)(c,{size:`sm`,onClick:()=>a({...e,Choices:[...o,{Condition:``,Next:``}]}),children:[(0,B.jsx)(i,{className:`size-3.5`}),k(`addRule`)]})}),(0,B.jsx)(U,{label:k(`otherwiseGoesTo`),value:e.Default,names:t,none:k(`noDefault`),error:H(n,`Default`),disabled:r,onChange:t=>{let{Default:n,...r}=e;a(t===void 0?r:{...r,Default:t})}})]})},K=(e,t)=>{let{Cache:n,...r}=e;return t===void 0?r:{...r,Cache:t}},Bt=({state:e,types:t,disabled:n,onChange:r})=>{let[i,a]=(0,V.useState)(!1),o=he(e,t);return o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{label:k(`cacheResults`),help:k(o.forces?`cacheForceHelp`:`cacheHelp`),children:(0,B.jsx)(s,{checked:o.on,onChange:t=>{if(!n){if(!t)return r(K(e,o.offValue));if(o.disclaimer)return a(!0);r(K(e,!0))}}})}),i&&(0,B.jsx)(m,{title:k(`cacheConfirmTitle`),description:o.disclaimer,onClose:()=>a(!1),actions:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(c,{onClick:()=>a(!1),children:k(`cacheCancel`)}),(0,B.jsx)(c,{variant:`primary`,onClick:()=>(a(!1),r(K(e,!0))),children:k(`cacheConfirm`)})]})})]}):null},Vt=(e,t,n)=>{let{[t]:r,...i}=e;return n==null||n===``?i:{...i,[t]:n}},Ht=(e,t)=>{let{type:n}=S(e.Resource);if(t){let{Cache:t,...r}=e;return{...r,Resource:`${n}${ve}`}}let{HeartbeatSeconds:r,TimeoutSeconds:i,...a}=e;return{...a,Resource:n,...i!==void 0&&i<=be.taskTimeoutSeconds&&{TimeoutSeconds:i}}},Ut=e=>Ee(e)===void 0,Wt=(e,t)=>({...e,Resource:`${t}${S(e.Resource).waits&&Ut(t)?ve:``}`}),Gt=(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}}},Kt=({state:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=t.step_types.filter(e=>e.available),{type:o,waits:c}=S(e.Resource),l=Ut(o),u=t.step_types.find(e=>e.id===o),d=typeof e.Arguments==`string`||!u;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{label:k(`stepType`),error:H(n,`Resource`),children:(0,B.jsxs)(h,{value:o,disabled:r,onChange:t=>i(Wt(e,t.target.value)),children:[!a.some(e=>e.id===o)&&(0,B.jsx)(`option`,{value:o,children:pe(o,u?.label)}),a.map(e=>(0,B.jsx)(`option`,{value:e.id,children:pe(e.id,e.label)},e.id))]})}),d?(0,B.jsx)(W,{label:k(`arguments`),kind:`json`,value:e.Arguments,error:H(n,`Arguments`),disabled:r,onChange:t=>i({...e,Arguments:t??{}})}):R(u.input).map(t=>(0,B.jsx)(W,{label:ae(t.name,t.title),kind:t.kind,options:t.options,required:t.required,...t.kind===`names`&&{help:k(`namesHelp`)},value:e.Arguments?.[t.name],error:H(n,`Arguments.${t.name}`),disabled:r,onChange:n=>i(Gt(e,t.name,n))},`${o}:${t.name}`)),l&&(0,B.jsx)(v,{label:k(`waitsForResult`),help:k(`waitsForResultHelp`),children:(0,B.jsx)(s,{checked:c,onChange:t=>!r&&i(Ht(e,t))})}),c||!l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(W,{label:k(`waitTimeout`),help:k(`waitTimeoutHelp`),kind:`json`,value:e.TimeoutSeconds,error:H(n,`TimeoutSeconds`),disabled:r,onChange:t=>i(Vt(e,`TimeoutSeconds`,t))}),(0,B.jsx)(W,{label:k(`heartbeatSeconds`),help:k(`heartbeatHelp`),kind:`json`,value:e.HeartbeatSeconds,error:H(n,`HeartbeatSeconds`),disabled:r,onChange:t=>i(Vt(e,`HeartbeatSeconds`,t))})]}):(0,B.jsx)(Bt,{state:e,types:t,disabled:r,onChange:i})]})},q=(e,t,n)=>{let{[t]:r,...i}=e;return n===void 0?i:{...i,[t]:n}},qt=({state:e,problems:t,disabled:n,onChange:r})=>(0,B.jsx)(W,{label:k(`onlyWhen`),kind:`text`,help:k(`onlyWhenHelp`),value:e.Condition,error:H(t,`Condition`),disabled:n,onChange:t=>r(q(e,`Condition`,t))}),J=e=>{let{state:t,names:n,problems:r,disabled:i,onChange:a}=e;if(e.data)return(0,B.jsx)(qt,{...e});let o=t;return(0,B.jsx)(U,{label:k(`goesOnTo`),value:o.Next,names:n,none:k(`endsHere`),error:H(r,`Next`)??H(r,`End`),disabled:i,onChange:e=>{let{Next:t,End:n,...r}=o;a(e===void 0?{...r,End:!0}:{...r,Next:e})}})},Jt=e=>{let{state:t,types:n,problems:r,disabled:i,onChange:a}=e,o=(e,n,o,s)=>(0,B.jsx)(W,{label:n,kind:o,help:s,value:t[e],error:H(r,e),disabled:i,onChange:n=>a(q(t,e,n))});if(t.Type===`Task`)return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Kt,{state:t,types:n,problems:r,disabled:i,onChange:a}),(0,B.jsx)(J,{...e}),!e.data&&(0,B.jsx)(G,{...e,state:t})]});if(t.Type===`Choice`)return(0,B.jsx)(zt,{...e,state:t});if(t.Type===`Map`)return(0,B.jsxs)(B.Fragment,{children:[o(`Items`,k(`items`),`json`,k(`itemsHelp`)),o(`MaxConcurrency`,k(`maxConcurrency`),`json`),(0,B.jsx)(J,{...e}),!e.data&&(0,B.jsx)(G,{...e,state:t})]});if(t.Type===`Block`){let n=(e,n,o,s)=>(0,B.jsx)(W,{label:n,kind:o,help:s,value:t.Cache?.[e],error:H(r,`Cache.${e}`)??(e===`Ttl`?H(r,`Cache`):void 0),disabled:i,onChange:n=>a({...t,Cache:q(t.Cache??{Ttl:``},e,n)})});return(0,B.jsxs)(B.Fragment,{children:[o(`Arguments`,k(`blockArguments`),`json`,k(`blockArgumentsHelp`)),n(`Ttl`,k(`blockTtl`),`text`,k(`blockTtlHelp`)),n(`Key`,k(`blockKey`),`json`,k(`blockKeyHelp`)),(0,B.jsx)(J,{...e}),!e.data&&(0,B.jsx)(G,{...e,state:t})]})}return t.Type===`Wait`?(0,B.jsxs)(B.Fragment,{children:[o(`Seconds`,k(`seconds`),`json`),(0,B.jsx)(J,{...e})]}):t.Type===`Pass`?(0,B.jsxs)(B.Fragment,{children:[o(`Output`,k(`output`),`json`,k(`outputHelp`)),(0,B.jsx)(J,{...e})]}):t.Type===`Succeed`?o(`Output`,k(`output`),`json`,k(`outputHelp`)):t.Type===`Fail`?(0,B.jsxs)(B.Fragment,{children:[e.data&&(0,B.jsx)(qt,{...e}),o(`Error`,k(`error`),`text`),o(`Cause`,k(`cause`),`text`)]}):null},Yt=(e,t,n,r)=>{let{[n]:i,...a}=t;return{[e]:r===void 0?a:{...a,[n]:r}}},Xt=({trigger:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=le(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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{label:k(`startsWhen`),error:H(n,`trigger`),help:c&&k(`triggerOtherHelp`),children:(0,B.jsxs)(h,{value:a??``,disabled:r,onChange:e=>i({[e.target.value]:{}}),children:[c!==void 0&&(0,B.jsx)(`option`,{value:c,children:ce(c,t.triggers.find(e=>e.id===c)?.label)}),a===void 0&&(0,B.jsx)(`option`,{value:``,children:k(`triggerUnknown`)}),o.map(e=>(0,B.jsx)(`option`,{value:e.id,children:ce(e.id,e.label)},e.id))]})}),s&&R(s.input).map(e=>(0,B.jsx)(W,{label:ae(e.name,e.title),kind:e.kind,options:e.options,required:e.required,...e.kind===`names`&&{help:k(`namesHelp`)},value:l[e.name],error:H(n,`trigger.${s.id}.${e.name}`),disabled:r,onChange:t=>i(Yt(s.id,l,e.name,t))},`${s.id}:${e.name}`)),c!==void 0&&(0,B.jsx)(W,{label:k(`triggerInput`),kind:`json`,value:l,error:H(n,`trigger.${c}`),disabled:!0,onChange:()=>void 0})]})},Zt=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.Type==`string`,Qt=({kind:e,name:t})=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,B.jsx)(`h3`,{className:`truncate font-semibold text-foreground`,children:t})]}),$t=({definition:e,types:t,selected:n,problems:r,warnings:i=[],onChange:a,onSelect:o})=>{let s=T(e,n);if(!s)return null;let{scope:l,name:u}=E(n),d=O(e,l),f=!a,p=e=>a?.(e);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qt,{kind:ge(s,t),name:u}),(0,B.jsx)(Et,{problems:r}),(0,B.jsx)(Dt,{warnings:i}),(0,B.jsx)(Ot,{name:u,taken:je(e.stateMachine),disabled:f,onRename:t=>{p(gt(e,n,t)),o(Ae(l,t))}},n),(0,B.jsx)(Jt,{state:s,types:t,names:Object.keys(d.States),problems:r,disabled:f,data:x(e)===`data`,onChange:t=>p(ft(e,n,t))}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-body font-medium text-muted-foreground`,children:k(`asJson`)}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(W,{label:k(`stepJson`),kind:`json`,help:k(`stepJsonHelp`),value:s,disabled:f,onChange:t=>{Zt(t)&&p(ft(e,n,t))}},n)})]}),a&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x(e)===`sequence`&&d.StartAt!==u&&(0,B.jsxs)(c,{size:`sm`,onClick:()=>p(_t(e,n)),children:[(0,B.jsx)(Be,{className:`size-3.5`}),k(`startHere`)]}),(0,B.jsxs)(c,{size:`sm`,variant:`danger`,onClick:()=>{p(lt(e,n)),o(void 0)},children:[(0,B.jsx)(_e,{className:`size-3.5`}),k(`removeStep`)]})]})]})},en=e=>{let{definition:t,types:n,selected:r,problems:i,onChange:a}=e;return(0,B.jsx)(`section`,{"aria-label":k(`chosenStep`),className:`flex flex-col gap-4 rounded-lg border bg-background p-4`,children:r===``?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qt,{kind:k(`trigger`),name:de(t.trigger,n)}),(0,B.jsx)(Et,{problems:i}),(0,B.jsx)(Xt,{trigger:t.trigger,types:n,problems:i,disabled:!a,onChange:e=>a?.(vt(t,e))})]}):(0,B.jsx)($t,{...e,selected:r})})},tn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=(e,t,n,r)=>{let i=structuredClone(e),{scope:a,name:o}=E(t),s=O(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;tn(s.Arguments)||(s.Arguments={});let c=s.Arguments;for(let e of n.slice(0,-1))tn(c[e])||(c[e]={}),c=c[e];let l=n.at(-1);return r===void 0?delete c[l]:c[l]=r,i},nn=e=>[`=`,`!=`,`>`,`<`,`matches`,`and`,`or`,`not`,...e?[`expression`]:[]],rn=e=>e.kind===`compare`||e.kind===`matches`?{value:``}:{value:e.kind===`logic`&&e.op===`and`},an=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:``}]},on=`{% true %}`,sn=(e,t)=>{if(t.length===0)return e;let n=e.sides[t[0]];return n&&b(n)?sn(n,t.slice(1)):void 0},X=(e,t,n)=>({...e,sides:e.sides.map((e,r)=>r===t?n:e)}),Z=(e,t,n)=>{if(t.length===0)return n(e);let r=e.sides[t[0]],i=r&&b(r)?Z(r,t.slice(1),n):void 0;return i&&X(e,t[0],i)},cn=(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!b(n)&&`value`in n&&typeof n.value==`string`?X(e,1,{pattern:n.value||`.*`,flags:e.sides[1].flags}):void 0;if(e.kind!==`compare`&&e.kind!==`matches`||!b(n))return X(e,t,n)}},ln=(e,t,n,r)=>{let i=C(T(e,t)?.Condition),a=i&&n.length>0&&Z(i,n.slice(0,-1),e=>cn(e,n.at(-1),r));return a&&C(w(a))?Y(e,t,[D],w(a)):e},un=(e,t,n,r)=>{let i=T(e,t)?.Condition;if(n.length===0)return i!==void 0&&i!==``?e:Y(e,t,[D],r===`expression`?on:w(an(r)));let a=C(i),o=a&&sn(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||b(c)||!(`value`in c))?e:ln(e,t,n,an(r))},dn=(e,t,n)=>{if(n.length===0)return Y(e,t,[D],void 0);let r=C(T(e,t)?.Condition),i=n.at(-1),a=r&&Z(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)}:cn(e,i,rn(e))});return a?Y(e,t,[D],w(a)):e},fn=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},pn=(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(...fn(i)))}return[...n]},mn=e=>e.StartAt===void 0?Object.keys(e.States):pn(e,e.StartAt),hn=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`},gn=(e,t,n)=>t.flatMap(t=>{let r=e.States[t];if(!r)return[];let i=y(r),a=i?gn(i,mn(i),n):[];return r.Type===`Task`?(n?.step_types.find(e=>e.id===r.Resource)?.writes??!0)===!1||hn(r)?[]:[{name:t,kind:ge(r,n)}]:a}),_n=(e,t)=>{if(!e||t||!(`Assign`in e)||!e.Assign)return e;let n=Object.fromEntries(Object.entries(e.Assign).filter(([,e])=>e!==Te)),{Assign:r,...i}=e;return Object.keys(n).length===0?i:{...i,Assign:n}},vn=(e,t,n)=>{let r=e?.stateMachine.States[n],i=r!==void 0&&`Output`in r;return JSON.stringify(_n(r,i))!==JSON.stringify(_n(t.stateMachine.States[n],i))},yn=(e,t)=>{let n=xe(e),r=new Set([t]);for(let e=!0;e;){e=!1;for(let[t,i]of n)!r.has(t)&&[...we(i)].some(e=>r.has(e))&&(r.add(t),e=!0)}return Object.keys(e.States).filter(e=>r.has(e))},bn=(e,t,n=e.stateMachine.StartAt)=>{let r=e.stateMachine;return gn(r,x(e)===`data`?n===void 0?mn(r):yn(r,n):n===void 0?mn(r):pn(r,n),t)},xn=/^[A-Za-z_][A-Za-z0-9_]*$/,Sn=e=>xn.test(e)?e:`\`${e.replaceAll("`",``)}\``,Cn=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:Cn(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:Cn(r[0])}),n(a,r[0],i+1);return}for(let[a,o]of Object.entries(r)){let r=e===``?Sn(a):`${e}.${Sn(a)}`;t.push({path:r,sample:Cn(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}=E(t),i=(e,t,n)=>Object.keys(e.States).filter(n=>n!==t&&pn(e,n).includes(t)).filter(t=>[`Task`,`Map`,`Block`].includes(e.States[t].Type)).map(e=>[...n,e].join(`/`)),a=i(O(e,n),r,n),o=n.findLastIndex((t,r)=>O(e,n.slice(0,r))?.States[n[r]]?.Type===`Block`);return[...n.flatMap((t,r)=>r<=o?[]:i(O(e,n.slice(0,r)),t,n.slice(0,r))),...a]},An=`{% $states.result %}`,jn=(e,t)=>{let{scope:n,name:r}=E(t),i=O(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)),...y(e)?Nn(y(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}=E(t),i=O(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=O(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=fe(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=ie(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:[D],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=fe(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=ie(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)=>E(t).scope.some((t,n,r)=>T(e,r.slice(0,n+1).join(`/`))?.Type===`Block`),Vn=(e,t)=>{let{scope:n}=E(t);for(let t=n.length;t>0;t--)if(T(e,n.slice(0,t).join(`/`))?.Type===`Block`)return n.slice(0,t).join(`/`)},Hn=(e,t,n)=>{let{scope:r,name:i}=E(t);if(E(n).scope.join(`/`)!==r.join(`/`))return!1;let a=xe(O(e,r)),o=new Set,s=[i];for(;s.length>0;){let e=s.pop();if(e===E(n).name)return!0;o.has(e)||(o.add(e),s.push(...we(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:E(i.node).name};if(x(e)===`data`&&i.node!==``){let[t,n]=[E(i.node).scope.join(`/`),E(a.step).scope.join(`/`)];if(t!==``&&t!==n&&!n.startsWith(`${t}/`))return{reason:`otherScope`,step:E(i.node).name};if(Hn(e,i.node,a.step))return{reason:`notBefore`,step:E(i.node).name};if(i.path[0]!==`#status`&&jn(e,i.node))return{reason:`shapesOutput`,step:E(i.node).name}}else if(i.node===``){if(Bn(e,a.step))return{reason:`notBefore`,step:E(a.step).name}}else{if(!kn(e,a.step).includes(i.node))return{reason:`notBefore`,step:E(i.node).name};if(jn(e,i.node))return{reason:`shapesOutput`,step:E(i.node).name}}if(Rn(i,a))return;let s=zn(t,n,`out`),c=zn(t,r,`in`);if(s&&c&&!ye(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:E(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?ln(o,a.step,a.side.at,{read:c}):a.select?Y(o,a.step,a.keys,Oe({...a.select.part,operand:{read:c}})):Rn(i,a)?Y(o,a.step,a.keys,w({kind:`compare`,op:`=`,sides:[{read:c},{value:`SUCCEEDED`}]})):Y(o,a.step,a.keys,ke(s))},Gn=(e,t,n)=>{let r=Ln(t,{node:n.target,handle:n.targetHandle});if(r?.side)return dn(e,r.step,r.side.at);if(r?.select)return Y(e,r.step,r.keys,Oe({...r.select.part,operand:{value:``}}));if(r)return Y(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 Y(e,n.target,[n.key],void 0);if(n.kind===`condition`)return dn(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 me(t,r(n),e=>ue(t,e)).reduce((e,n)=>Gn(e,t,n),e)},qn=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Jn={connect:ut,disconnect:dt,removeState:lt,setArgument:Y,connectData:Wn,disconnectData:Gn,removePure:Kn,wireRefusal:Un,addCondition:un,conditionChoices:nn,setConditionSide:ln,addSelect:(e,t,n)=>{let r=T(e,t)?.Arguments?.[n];if(r!==void 0&&!qn(r)||typeof r==`string`&&r.startsWith(`{%`))return e;let i=r??``;return Y(e,t,[n],Oe({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&&Ie(i,r,n[e]?.names?.singular??a(e),Le(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}=r();return(0,V.useMemo)(()=>Yn(e,t?.resources??{},t?.views),[e,t?.resources,t?.views])},$=te(`app/field-types/workflow-page`),Zn={"app:http":{icon:We,keywords:[`api`,`fetch`,`url`,`webhook`,`get`,`post`]},"app:mail.send":{icon:f,keywords:[`email`,`send`,`message`]},"app:records.create":{icon:A,keywords:[`insert`,`add`,`new`,`row`]},"app:records.update":{icon:A,keywords:[`change`,`edit`,`row`]},"app:records.get":{icon:A,keywords:[`read`,`find`,`row`]},"app:records.list":{icon:A,keywords:[`read`,`find`,`query`,`rows`]}},Qn=[{type:`Choice`,icon:He,description:()=>$(`flowChoice`),keywords:[`if`,`branch`,`switch`,`condition`]},{type:`Map`,icon:Je,description:()=>$(`flowMap`),keywords:[`loop`,`each`,`list`,`repeat`]},{type:`Block`,icon:o,description:()=>$(`flowBlock`),keywords:[`cache`,`once`,`group`,`reuse`,`wrap`]},{type:`Wait`,icon:Xe,description:()=>$(`flowWait`),keywords:[`delay`,`sleep`,`pause`,`later`]},{type:`Pass`,icon:Ke,description:()=>$(`flowPass`),keywords:[`variable`,`assign`,`transform`]},{type:`Succeed`,icon:ee,description:()=>$(`flowSucceed`),keywords:[`end`,`stop`,`done`]},{type:`Fail`,icon:_,description:()=>$(`flowFail`),keywords:[`end`,`stop`,`error`]}],$n=e=>({id:`task:${e.id}`,title:se(e.id,e.label),description:e.description,keywords:[e.id,...Zn[e.id]?.keywords??[]],icon:Zn[e.id]?.icon??(e.id.startsWith(`app:`)?p:l)}),er=e=>e.slice(0,Math.max(e.indexOf(`:`),0)),tr=e=>e===`custom`?$(`customSteps`):e,nr=e=>{let t=new Set(Object.values(De(e.step_types.map(e=>e.id)))),n=e.step_types.filter(e=>e.available&&(!Ee(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:oe(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{mt as A,ot as C,it as D,Ze as E,tt as O,F as S,st as T,wt as _,Jn as a,Tt as b,En as c,On as d,vn as f,Et as g,Nt as h,Xn as i,nt as k,jn as l,en as m,nr as n,kn as o,bn as p,$ as r,Dn as s,rr as t,Fn as u,z as v,at as w,bt as x,xt as y};
2
- //# debugId=bd6837fd-ca9f-4c80-9254-1cee7cd4d804
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{As as r,Gc as i,Il as a,Jc as o,N as s,Nc as c,Uc as l,Xn as u,Xo as d,Yc as f,fl as p,il as ee,jc as m,jn as h,ml as g,rl as _,wl as te,z as v,zc as ne}from"./app-CgllsYQy.js";import{t as re}from"./circle-alert-D8UYAgz6.js";import{a as ie,c as ae,d as oe,f as se,g as ce,h as le,i as ue,m as de,o as fe,p as pe,r as me,s as he,u as ge}from"./workflow-canvas-CzzTk8Bv.js";import{t as _e}from"./trash-sDDKsEVa.js";import{A as ve,D as ye,F as be,M as y,_ as xe,a as Se,c as b,f as Ce,g as we,h as x,i as Te,k as S,m as Ee,n as De,o as C,s as w,u as Oe,x as ke}from"./workflows-Bey4jszG.js";import{E as T,S as Ae,T as E,_ as je,s as D,x as O}from"./use-run-trace-B0JxFskZ.js";import{n as k}from"./use-workflow-types-7sud5u7m.js";var Me={type:`object`,title:`File`,properties:{uri:{type:`string`},name:{type:`string`},type:{type:`string`},size:{type:`integer`}}},Ne=(e,t)=>e.relation&&t?.(e.relation.resource)===`integer`?{type:`integer`}:{type:`string`},Pe=(e,t,n)=>{if(e.file)return t===`read`?Me:{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`?Ne(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`}}},Fe=(e,t,n)=>{let r=Pe(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]}}},Ie=(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,Fe(e,t,r)]))}),Le=e=>t=>{let n=e(t);return n?.primaryKey.length===1?n.fields[n.primaryKey[0]]?.type:void 0},Re={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`}]]};Re.node;var A=g(Re),ze={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`}]]};ze.node;var Be=g(ze),Ve={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`}]]};Ve.node;var He=g(Ve),Ue={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`}]]};Ue.node;var We=g(Ue),Ge={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`]};Ge.node;var Ke=g(Ge),qe={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`}]]};qe.node;var Je=g(qe),Ye={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`}]]};Ye.node;var Xe=g(Ye),j=(e,t)=>{let n=structuredClone(e);return t(n),n},M=new Set([`Task`,`Pass`,`Wait`,`Map`,`Block`]),N=(e,t)=>{if(!M.has(e.Type))return;let n=e;delete n.End,n.Next=t},P=(e,t)=>{let n=O(e,t);if(!n)throw Error(`No Map or Block at ${t.join(`/`)}`);return n},Ze=(e,t)=>{let n=new Set(je(e.stateMachine)),r=1;for(;n.has(`${t} ${r}`);)r++;return`${t} ${r}`},Qe=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},F=(e,t,n,r,i)=>j(e,e=>{let a=P(e,t),o=x(e)===`data`,s=Qe(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=Ze(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}),$e=e=>e.Type===`Choice`||M.has(e.Type),et=(e,t,n)=>{let r=e.States[t],i=e.States[n];if(!r||!M.has(r.Type))return;let a=r.Next;(a===void 0||$e(i))&&(N(r,n),a!==void 0&&(i.Type===`Choice`?i.Default=a:M.has(i.Type)&&N(i,a)))},tt=(e,t,n)=>{let r=P(e,t);if(n!==void 0&&n!==t.join(`/`)){let{name:e}=E(n);return M.has(r.States[e]?.Type)?e:void 0}return Object.keys(r.States).reverse().find(e=>r.States[e].End===!0)},nt=e=>e.kind===`start`?[]:E(e.source).scope,rt=e=>e.ErrorEquals.length===1&&e.ErrorEquals[0]===`States.ALL`,it=(e,t)=>{if(t.kind===`start`)return e.stateMachine.StartAt||void 0;let{scope:n,name:r}=E(t.source),i=O(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(rt)?.Next:void 0}},at=(e,t,n,r,i)=>{if(i.kind===`start`)return st(e,t,n,r);let{scope:a,name:o}=E(i.source);if(i.kind===`next`)return ot(e,a,t,n,r,o);let s=it(e,i);return j(F(e,a,t,n,r),e=>{let t=P(e,a),r=t.States[o],c=t.States[n];if(r&&(s===void 0||$e(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(rt);e?e.Next=n:r.Catch=[...r.Catch??[],{ErrorEquals:[`States.ALL`],Next:n}]}s!==void 0&&(c.Type===`Choice`?c.Default=s:M.has(c.Type)&&N(c,s))}})},ot=(e,t,n,r,i,a)=>{let o=F(e,t,n,r,i);return a===void 0||x(e)===`data`?o:j(o,e=>et(P(e,t),a,r))},st=(e,t,n,r)=>{let i=e.stateMachine.StartAt??``,a=F(e,[],t,n,r);return x(e)===`data`?a:j(a,e=>{let t=e.stateMachine.States[n];(i===``||$e(t))&&(e.stateMachine.StartAt=n,i!==``&&M.has(t.Type)&&N(t,i),i!==``&&t.Type===`Choice`&&(t.Default=i))})},ct=(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)},lt=(e,t)=>j(e,e=>{let{scope:n,name:r}=E(t),i=P(e,n);delete i.States[r];for(let e of Object.values(i.States))ct(e,r);i.StartAt===r&&(i.StartAt=Object.keys(i.States)[0]??``)}),ut=(e,t,n,r)=>j(e,e=>{let{scope:i,name:a}=E(r);if(t===`start`){e.stateMachine.StartAt=a;return}let o=E(n);if(o.scope.join(`/`)!==i.join(`/`))throw Error(`A state leads only to states of its own machine`);let s=P(e,i).States[o.name];s&&(t===`next`&&N(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}]))}),dt=(e,t)=>j(e,e=>{if(t.kind===`start`)return;let{scope:n,name:r}=E(t.source),i=P(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)}),ft=(e,t,n)=>j(e,e=>{let{scope:r,name:i}=E(t);P(e,r).States[i]=n}),pt=(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)}},mt=e=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)&&![`true`,`false`,`null`].includes(e)?e:`\`${e}\``,ht=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),I=(e,t,n)=>{if(typeof e==`string`){if(!e.trimStart().startsWith(`{%`))return e;let r=RegExp(`\\$states\\.context\\.Steps\\.(?:${ht(t)}(?![A-Za-z0-9_])|\`${ht(t)}\`)`,`g`);return e.split(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\/\*[\s\S]*?\*\/)/).map((e,t)=>t%2==1?e:e.replace(r,()=>`$states.context.Steps.${mt(n)}`)).join(``)}return Array.isArray(e)?e.map(e=>I(e,t,n)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,I(r,t,n)])):e},gt=(e,t,n)=>j(e,e=>{let{scope:r,name:i}=E(t);pt(P(e,r),i,n),e.stateMachine=I(e.stateMachine,i,n)}),_t=(e,t)=>j(e,e=>{let{scope:n,name:r}=E(t);P(e,n).StartAt=r}),vt=(e,t)=>j(e,e=>{e.trigger=t}),L=e=>typeof e==`object`&&!!e&&!Array.isArray(e),yt=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`&&L(e.items)&&e.items.type===`string`?{kind:`names`}:{kind:`json`},R=e=>{let t=L(e.properties)?e.properties:{},n=Array.isArray(e.required)?e.required:[];return Object.entries(t).map(([e,t])=>{let r=L(t)?t:{},i=typeof r.title==`string`?r.title:void 0;return{name:e,...yt(r),required:n.includes(e),...i&&{title:i}}})},z=e=>e.message.startsWith(`is missing`),bt=e=>new Map([...e].map(([e,t])=>[e,t.filter(e=>!z(e))])),xt=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}},St=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),Ct=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`&&!St(n)?[{field:e.name,message:`is a list of names, separated by commas`}]:[]}),wt=(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 Ce(e,{resources:r.map(e=>e.id),required:Object.fromEntries(r.map(e=>[e.id,R(e.input).filter(e=>e.required).map(e=>e.name)])),triggers:Object.fromEntries(i.map(e=>[e.id,Ct(R(e.input))])),unavailable:Object.fromEntries(a.map(e=>[e.id,e.reason??``])),versioned:De(r.map(e=>e.id)),...n&&{pins:n}})},Tt=e=>{let t=new Map;for(let{state:n,field:r,message:i}of Se(e))n!==void 0&&t.set(n,[...t.get(n)??[],{...r!==void 0&&{field:r},message:i}]);return t},B=e(n(),1),Et=({problems:e})=>e.length>0&&(0,B.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-body text-danger-text`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(re,{className:`size-4`,"aria-hidden":`true`}),e.every(z)?k(`fillInToSave`,{count:e.length}):k(`cannotSave`,{count:e.length})]}),(0,B.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,B.jsx)(`li`,{children:e.field?k(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),Dt=({warnings:e})=>e.length>0&&(0,B.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-body text-warning-text`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,B.jsx)(ne,{className:`size-4`,"aria-hidden":`true`}),k(`warningsSaveAnyway`,{count:e.length})]}),(0,B.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,B.jsx)(`li`,{children:e.field?k(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),V=e(t(),1),Ot=({name:e,taken:t,disabled:n,onRename:r})=>{let[i,a]=(0,V.useState)(e),o=i.trim(),s=o===``?k(`nameNeeded`):o!==e&&t.includes(o)?k(`nameTaken`):void 0,c=()=>{!s&&o!==e&&r(o)};return(0,B.jsx)(v,{label:k(`name`),error:s,children:(0,B.jsx)(d,{value:i,invalid:!!s,disabled:n,onChange:e=>a(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&c()}})})},H=(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},U=({label:e,value:t,names:n,none:r,error:i,disabled:a,onChange:o})=>(0,B.jsx)(v,{label:e,error:i,children:(0,B.jsxs)(h,{invalid:!!i,value:t??``,disabled:a,onChange:e=>o(e.target.value===``?void 0:e.target.value),children:[(0,B.jsx)(`option`,{value:``,children:r}),t!==void 0&&!n.includes(t)&&(0,B.jsx)(`option`,{value:t,children:t}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})}),kt=e=>e===void 0?``:typeof e==`string`?e:JSON.stringify(e,null,2),At=e=>{if(e.trim()!==``)try{return JSON.parse(e)}catch(t){if(!(t instanceof SyntaxError))throw t;return e}},jt=e=>{let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0},Mt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):kt(e),Nt=(0,V.createContext)(void 0),Pt=()=>(0,V.useContext)(Nt),Ft=e=>e===``?void 0:e,It={text:Ft,value:At,choice:Ft,json:At,names:jt},W=({label:e,kind:t,options:n=[],required:r,help:i,value:a,error:o,onChange:s,disabled:c,read:l=It[t],write:f=t===`names`?Mt:kt})=>{let[p,ee]=(0,V.useState)(),m=p!==void 0&&JSON.stringify(l(p))===JSON.stringify(a)?p:f(a),g=Pt(),_=e=>{ee(e),s(l(e))},te=g!==void 0&&!c&&(a==null||typeof a==`string`)&&(t===`text`||t===`json`||t===`value`);return(0,B.jsxs)(v,{label:e,required:r,help:i,error:o,wide:t===`json`,children:[t===`choice`?(0,B.jsxs)(h,{invalid:!!o,value:m,disabled:c,onChange:e=>s(e.target.value===``?void 0:e.target.value),children:[(0,B.jsx)(`option`,{value:``,children:k(`defaultChoice`)}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}):t===`json`?(0,B.jsx)(u,{invalid:!!o,rows:2,className:`font-mono text-xs`,value:m,disabled:c,onChange:e=>_(e.target.value)}):(0,B.jsx)(d,{invalid:!!o,value:m,disabled:c,onChange:e=>_(e.target.value)}),te&&(0,B.jsx)(`button`,{type:`button`,"aria-label":k(`insertValueInto`,{field:e}),className:`mt-1 text-xs font-medium text-primary-text hover:underline max-md:min-h-11`,onClick:()=>g({label:e,value:a,set:s}),children:k(`insertValue`)})]})},Lt=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),Rt=e=>Array.isArray(e)?e.join(`, `):``,G=({state:e,names:t,problems:n,disabled:r,onChange:a})=>{let o=e.Catch??[],s=t=>{let{Catch:n,...r}=e;a(t.length>0?{...r,Catch:t}:r)},l=(e,t)=>s(o.map((n,r)=>r===e?t:n));return(0,B.jsxs)(B.Fragment,{children:[o.map((e,i)=>(0,B.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border border-danger/40 p-3`,children:[(0,B.jsx)(`legend`,{className:`px-1 text-xs font-medium text-danger-text`,children:k(`errorPathNumber`,{number:i+1})}),(0,B.jsx)(W,{label:k(`errors`),kind:`text`,help:k(`errorsHelp`),value:e.ErrorEquals??[],read:Lt,write:Rt,error:H(n,`Catch[${i}].ErrorEquals`),disabled:r,onChange:t=>l(i,{...e,ErrorEquals:t})}),(0,B.jsx)(U,{label:k(`thenGoesTo`),value:e.Next||void 0,names:t,none:k(`chooseStep`),error:H(n,`Catch[${i}].Next`),disabled:r,onChange:t=>l(i,{...e,Next:t??``})}),!r&&(0,B.jsxs)(c,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>s(o.filter((e,t)=>t!==i)),children:[(0,B.jsx)(_e,{className:`size-3.5`}),k(`removeErrorPath`)]})]},i)),!r&&(0,B.jsx)(`div`,{children:(0,B.jsxs)(c,{size:`sm`,onClick:()=>s([...o,{ErrorEquals:[`States.ALL`],Next:``}]),children:[(0,B.jsx)(i,{className:`size-3.5`}),k(`addErrorPath`)]})})]})},zt=({state:e,names:t,problems:n,disabled:r,onChange:a})=>{let o=e.Choices??[],s=(t,n)=>a({...e,Choices:o.map((e,r)=>r===t?n:e)});return(0,B.jsxs)(B.Fragment,{children:[o.map((i,l)=>(0,B.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border p-3`,children:[(0,B.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:k(`ruleNumber`,{number:l+1})}),(0,B.jsx)(W,{label:k(`condition`),kind:`text`,help:k(`conditionHelp`),value:i.Condition,error:H(n,`Choices[${l}].Condition`),disabled:r,onChange:e=>s(l,{...i,Condition:typeof e==`string`?e:``})}),(0,B.jsx)(U,{label:k(`thenGoesTo`),value:i.Next||void 0,names:t,none:k(`chooseStep`),error:H(n,`Choices[${l}].Next`),disabled:r,onChange:e=>s(l,{...i,Next:e??``})}),!r&&(0,B.jsxs)(c,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>a({...e,Choices:o.filter((e,t)=>t!==l)}),children:[(0,B.jsx)(_e,{className:`size-3.5`}),k(`removeRule`)]})]},l)),!r&&(0,B.jsx)(`div`,{children:(0,B.jsxs)(c,{size:`sm`,onClick:()=>a({...e,Choices:[...o,{Condition:``,Next:``}]}),children:[(0,B.jsx)(i,{className:`size-3.5`}),k(`addRule`)]})}),(0,B.jsx)(U,{label:k(`otherwiseGoesTo`),value:e.Default,names:t,none:k(`noDefault`),error:H(n,`Default`),disabled:r,onChange:t=>{let{Default:n,...r}=e;a(t===void 0?r:{...r,Default:t})}})]})},K=(e,t)=>{let{Cache:n,...r}=e;return t===void 0?r:{...r,Cache:t}},Bt=({state:e,types:t,disabled:n,onChange:r})=>{let[i,a]=(0,V.useState)(!1),o=he(e,t);return o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{label:k(`cacheResults`),help:k(o.forces?`cacheForceHelp`:`cacheHelp`),children:(0,B.jsx)(s,{checked:o.on,onChange:t=>{if(!n){if(!t)return r(K(e,o.offValue));if(o.disclaimer)return a(!0);r(K(e,!0))}}})}),i&&(0,B.jsx)(m,{title:k(`cacheConfirmTitle`),description:o.disclaimer,onClose:()=>a(!1),actions:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(c,{onClick:()=>a(!1),children:k(`cacheCancel`)}),(0,B.jsx)(c,{variant:`primary`,onClick:()=>(a(!1),r(K(e,!0))),children:k(`cacheConfirm`)})]})})]}):null},Vt=(e,t,n)=>{let{[t]:r,...i}=e;return n==null||n===``?i:{...i,[t]:n}},Ht=(e,t)=>{let{type:n}=S(e.Resource);if(t){let{Cache:t,...r}=e;return{...r,Resource:`${n}${ve}`}}let{HeartbeatSeconds:r,TimeoutSeconds:i,...a}=e;return{...a,Resource:n,...i!==void 0&&i<=be.taskTimeoutSeconds&&{TimeoutSeconds:i}}},Ut=e=>Ee(e)===void 0,Wt=(e,t)=>({...e,Resource:`${t}${S(e.Resource).waits&&Ut(t)?ve:``}`}),Gt=(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}}},Kt=({state:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=t.step_types.filter(e=>e.available),{type:o,waits:c}=S(e.Resource),l=Ut(o),u=t.step_types.find(e=>e.id===o),d=typeof e.Arguments==`string`||!u;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{label:k(`stepType`),error:H(n,`Resource`),children:(0,B.jsxs)(h,{value:o,disabled:r,onChange:t=>i(Wt(e,t.target.value)),children:[!a.some(e=>e.id===o)&&(0,B.jsx)(`option`,{value:o,children:pe(o,u?.label)}),a.map(e=>(0,B.jsx)(`option`,{value:e.id,children:pe(e.id,e.label)},e.id))]})}),d?(0,B.jsx)(W,{label:k(`arguments`),kind:`json`,value:e.Arguments,error:H(n,`Arguments`),disabled:r,onChange:t=>i({...e,Arguments:t??{}})}):R(u.input).map(t=>(0,B.jsx)(W,{label:ae(t.name,t.title),kind:t.kind,options:t.options,required:t.required,...t.kind===`names`&&{help:k(`namesHelp`)},value:e.Arguments?.[t.name],error:H(n,`Arguments.${t.name}`),disabled:r,onChange:n=>i(Gt(e,t.name,n))},`${o}:${t.name}`)),l&&(0,B.jsx)(v,{label:k(`waitsForResult`),help:k(`waitsForResultHelp`),children:(0,B.jsx)(s,{checked:c,onChange:t=>!r&&i(Ht(e,t))})}),c||!l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(W,{label:k(`waitTimeout`),help:k(`waitTimeoutHelp`),kind:`json`,value:e.TimeoutSeconds,error:H(n,`TimeoutSeconds`),disabled:r,onChange:t=>i(Vt(e,`TimeoutSeconds`,t))}),(0,B.jsx)(W,{label:k(`heartbeatSeconds`),help:k(`heartbeatHelp`),kind:`json`,value:e.HeartbeatSeconds,error:H(n,`HeartbeatSeconds`),disabled:r,onChange:t=>i(Vt(e,`HeartbeatSeconds`,t))})]}):(0,B.jsx)(Bt,{state:e,types:t,disabled:r,onChange:i})]})},q=(e,t,n)=>{let{[t]:r,...i}=e;return n===void 0?i:{...i,[t]:n}},qt=({state:e,problems:t,disabled:n,onChange:r})=>(0,B.jsx)(W,{label:k(`onlyWhen`),kind:`text`,help:k(`onlyWhenHelp`),value:e.Condition,error:H(t,`Condition`),disabled:n,onChange:t=>r(q(e,`Condition`,t))}),J=e=>{let{state:t,names:n,problems:r,disabled:i,onChange:a}=e;if(e.data)return(0,B.jsx)(qt,{...e});let o=t;return(0,B.jsx)(U,{label:k(`goesOnTo`),value:o.Next,names:n,none:k(`endsHere`),error:H(r,`Next`)??H(r,`End`),disabled:i,onChange:e=>{let{Next:t,End:n,...r}=o;a(e===void 0?{...r,End:!0}:{...r,Next:e})}})},Jt=e=>{let{state:t,types:n,problems:r,disabled:i,onChange:a}=e,o=(e,n,o,s)=>(0,B.jsx)(W,{label:n,kind:o,help:s,value:t[e],error:H(r,e),disabled:i,onChange:n=>a(q(t,e,n))});if(t.Type===`Task`)return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Kt,{state:t,types:n,problems:r,disabled:i,onChange:a}),(0,B.jsx)(J,{...e}),!e.data&&(0,B.jsx)(G,{...e,state:t})]});if(t.Type===`Choice`)return(0,B.jsx)(zt,{...e,state:t});if(t.Type===`Map`)return(0,B.jsxs)(B.Fragment,{children:[o(`Items`,k(`items`),`json`,k(`itemsHelp`)),o(`MaxConcurrency`,k(`maxConcurrency`),`json`),(0,B.jsx)(J,{...e}),!e.data&&(0,B.jsx)(G,{...e,state:t})]});if(t.Type===`Block`){let n=(e,n,o,s)=>(0,B.jsx)(W,{label:n,kind:o,help:s,value:t.Cache?.[e],error:H(r,`Cache.${e}`)??(e===`Ttl`?H(r,`Cache`):void 0),disabled:i,onChange:n=>a({...t,Cache:q(t.Cache??{Ttl:``},e,n)})});return(0,B.jsxs)(B.Fragment,{children:[o(`Arguments`,k(`blockArguments`),`json`,k(`blockArgumentsHelp`)),n(`Ttl`,k(`blockTtl`),`text`,k(`blockTtlHelp`)),n(`Key`,k(`blockKey`),`json`,k(`blockKeyHelp`)),(0,B.jsx)(J,{...e}),!e.data&&(0,B.jsx)(G,{...e,state:t})]})}return t.Type===`Wait`?(0,B.jsxs)(B.Fragment,{children:[o(`Seconds`,k(`seconds`),`json`),(0,B.jsx)(J,{...e})]}):t.Type===`Pass`?(0,B.jsxs)(B.Fragment,{children:[o(`Output`,k(`output`),`json`,k(`outputHelp`)),(0,B.jsx)(J,{...e})]}):t.Type===`Succeed`?o(`Output`,k(`output`),`json`,k(`outputHelp`)):t.Type===`Fail`?(0,B.jsxs)(B.Fragment,{children:[e.data&&(0,B.jsx)(qt,{...e}),o(`Error`,k(`error`),`text`),o(`Cause`,k(`cause`),`text`)]}):null},Yt=(e,t,n,r)=>{let{[n]:i,...a}=t;return{[e]:r===void 0?a:{...a,[n]:r}}},Xt=({trigger:e,types:t,problems:n,disabled:r,onChange:i})=>{let a=le(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,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{label:k(`startsWhen`),error:H(n,`trigger`),help:c&&k(`triggerOtherHelp`),children:(0,B.jsxs)(h,{value:a??``,disabled:r,onChange:e=>i({[e.target.value]:{}}),children:[c!==void 0&&(0,B.jsx)(`option`,{value:c,children:ce(c,t.triggers.find(e=>e.id===c)?.label)}),a===void 0&&(0,B.jsx)(`option`,{value:``,children:k(`triggerUnknown`)}),o.map(e=>(0,B.jsx)(`option`,{value:e.id,children:ce(e.id,e.label)},e.id))]})}),s&&R(s.input).map(e=>(0,B.jsx)(W,{label:ae(e.name,e.title),kind:e.kind,options:e.options,required:e.required,...e.kind===`names`&&{help:k(`namesHelp`)},value:l[e.name],error:H(n,`trigger.${s.id}.${e.name}`),disabled:r,onChange:t=>i(Yt(s.id,l,e.name,t))},`${s.id}:${e.name}`)),c!==void 0&&(0,B.jsx)(W,{label:k(`triggerInput`),kind:`json`,value:l,error:H(n,`trigger.${c}`),disabled:!0,onChange:()=>void 0})]})},Zt=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.Type==`string`,Qt=({kind:e,name:t})=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,B.jsx)(`h3`,{className:`truncate font-semibold text-foreground`,children:t})]}),$t=({definition:e,types:t,selected:n,problems:r,warnings:i=[],onChange:a,onSelect:o})=>{let s=T(e,n);if(!s)return null;let{scope:l,name:u}=E(n),d=O(e,l),f=!a,p=e=>a?.(e);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qt,{kind:ge(s,t),name:u}),(0,B.jsx)(Et,{problems:r}),(0,B.jsx)(Dt,{warnings:i}),(0,B.jsx)(Ot,{name:u,taken:je(e.stateMachine),disabled:f,onRename:t=>{p(gt(e,n,t)),o(Ae(l,t))}},n),(0,B.jsx)(Jt,{state:s,types:t,names:Object.keys(d.States),problems:r,disabled:f,data:x(e)===`data`,onChange:t=>p(ft(e,n,t))}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-body font-medium text-muted-foreground`,children:k(`asJson`)}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(W,{label:k(`stepJson`),kind:`json`,help:k(`stepJsonHelp`),value:s,disabled:f,onChange:t=>{Zt(t)&&p(ft(e,n,t))}},n)})]}),a&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x(e)===`sequence`&&d.StartAt!==u&&(0,B.jsxs)(c,{size:`sm`,onClick:()=>p(_t(e,n)),children:[(0,B.jsx)(Be,{className:`size-3.5`}),k(`startHere`)]}),(0,B.jsxs)(c,{size:`sm`,variant:`danger`,onClick:()=>{p(lt(e,n)),o(void 0)},children:[(0,B.jsx)(_e,{className:`size-3.5`}),k(`removeStep`)]})]})]})},en=e=>{let{definition:t,types:n,selected:r,problems:i,onChange:a}=e;return(0,B.jsx)(`section`,{"aria-label":k(`chosenStep`),className:`flex flex-col gap-4 rounded-lg border bg-background p-4`,children:r===``?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Qt,{kind:k(`trigger`),name:de(t.trigger,n)}),(0,B.jsx)(Et,{problems:i}),(0,B.jsx)(Xt,{trigger:t.trigger,types:n,problems:i,disabled:!a,onChange:e=>a?.(vt(t,e))})]}):(0,B.jsx)($t,{...e,selected:r})})},tn=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=(e,t,n,r)=>{let i=structuredClone(e),{scope:a,name:o}=E(t),s=O(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;tn(s.Arguments)||(s.Arguments={});let c=s.Arguments;for(let e of n.slice(0,-1))tn(c[e])||(c[e]={}),c=c[e];let l=n.at(-1);return r===void 0?delete c[l]:c[l]=r,i},nn=e=>[`=`,`!=`,`>`,`<`,`matches`,`and`,`or`,`not`,...e?[`expression`]:[]],rn=e=>e.kind===`compare`||e.kind===`matches`?{value:``}:{value:e.kind===`logic`&&e.op===`and`},an=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:``}]},on=`{% true %}`,sn=(e,t)=>{if(t.length===0)return e;let n=e.sides[t[0]];return n&&b(n)?sn(n,t.slice(1)):void 0},X=(e,t,n)=>({...e,sides:e.sides.map((e,r)=>r===t?n:e)}),Z=(e,t,n)=>{if(t.length===0)return n(e);let r=e.sides[t[0]],i=r&&b(r)?Z(r,t.slice(1),n):void 0;return i&&X(e,t[0],i)},cn=(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!b(n)&&`value`in n&&typeof n.value==`string`?X(e,1,{pattern:n.value||`.*`,flags:e.sides[1].flags}):void 0;if(e.kind!==`compare`&&e.kind!==`matches`||!b(n))return X(e,t,n)}},ln=(e,t,n,r)=>{let i=C(T(e,t)?.Condition),a=i&&n.length>0&&Z(i,n.slice(0,-1),e=>cn(e,n.at(-1),r));return a&&C(w(a))?Y(e,t,[D],w(a)):e},un=(e,t,n,r)=>{let i=T(e,t)?.Condition;if(n.length===0)return i!==void 0&&i!==``?e:Y(e,t,[D],r===`expression`?on:w(an(r)));let a=C(i),o=a&&sn(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||b(c)||!(`value`in c))?e:ln(e,t,n,an(r))},dn=(e,t,n)=>{if(n.length===0)return Y(e,t,[D],void 0);let r=C(T(e,t)?.Condition),i=n.at(-1),a=r&&Z(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)}:cn(e,i,rn(e))});return a?Y(e,t,[D],w(a)):e},fn=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},pn=(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(...fn(i)))}return[...n]},mn=e=>e.StartAt===void 0?Object.keys(e.States):pn(e,e.StartAt),hn=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`},gn=(e,t,n)=>t.flatMap(t=>{let r=e.States[t];if(!r)return[];let i=y(r),a=i?gn(i,mn(i),n):[];return r.Type===`Task`?(n?.step_types.find(e=>e.id===r.Resource)?.writes??!0)===!1||hn(r)?[]:[{name:t,kind:ge(r,n)}]:a}),_n=(e,t)=>{if(!e||t||!(`Assign`in e)||!e.Assign)return e;let n=Object.fromEntries(Object.entries(e.Assign).filter(([,e])=>e!==Te)),{Assign:r,...i}=e;return Object.keys(n).length===0?i:{...i,Assign:n}},vn=(e,t,n)=>{let r=e?.stateMachine.States[n],i=r!==void 0&&`Output`in r;return JSON.stringify(_n(r,i))!==JSON.stringify(_n(t.stateMachine.States[n],i))},yn=(e,t)=>{let n=xe(e),r=new Set([t]);for(let e=!0;e;){e=!1;for(let[t,i]of n)!r.has(t)&&[...we(i)].some(e=>r.has(e))&&(r.add(t),e=!0)}return Object.keys(e.States).filter(e=>r.has(e))},bn=(e,t,n=e.stateMachine.StartAt)=>{let r=e.stateMachine;return gn(r,x(e)===`data`?n===void 0?mn(r):yn(r,n):n===void 0?mn(r):pn(r,n),t)},xn=/^[A-Za-z_][A-Za-z0-9_]*$/,Sn=e=>xn.test(e)?e:`\`${e.replaceAll("`",``)}\``,Cn=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:Cn(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:Cn(r[0])}),n(a,r[0],i+1);return}for(let[a,o]of Object.entries(r)){let r=e===``?Sn(a):`${e}.${Sn(a)}`;t.push({path:r,sample:Cn(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}=E(t),i=(e,t,n)=>Object.keys(e.States).filter(n=>n!==t&&pn(e,n).includes(t)).filter(t=>[`Task`,`Map`,`Block`].includes(e.States[t].Type)).map(e=>[...n,e].join(`/`)),a=i(O(e,n),r,n),o=n.findLastIndex((t,r)=>O(e,n.slice(0,r))?.States[n[r]]?.Type===`Block`);return[...n.flatMap((t,r)=>r<=o?[]:i(O(e,n.slice(0,r)),t,n.slice(0,r))),...a]},An=`{% $states.result %}`,jn=(e,t)=>{let{scope:n,name:r}=E(t),i=O(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)),...y(e)?Nn(y(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}=E(t),i=O(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=O(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=fe(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=ie(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:[D],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=fe(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=ie(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)=>E(t).scope.some((t,n,r)=>T(e,r.slice(0,n+1).join(`/`))?.Type===`Block`),Vn=(e,t)=>{let{scope:n}=E(t);for(let t=n.length;t>0;t--)if(T(e,n.slice(0,t).join(`/`))?.Type===`Block`)return n.slice(0,t).join(`/`)},Hn=(e,t,n)=>{let{scope:r,name:i}=E(t);if(E(n).scope.join(`/`)!==r.join(`/`))return!1;let a=xe(O(e,r)),o=new Set,s=[i];for(;s.length>0;){let e=s.pop();if(e===E(n).name)return!0;o.has(e)||(o.add(e),s.push(...we(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:E(i.node).name};if(x(e)===`data`&&i.node!==``){let[t,n]=[E(i.node).scope.join(`/`),E(a.step).scope.join(`/`)];if(t!==``&&t!==n&&!n.startsWith(`${t}/`))return{reason:`otherScope`,step:E(i.node).name};if(Hn(e,i.node,a.step))return{reason:`notBefore`,step:E(i.node).name};if(i.path[0]!==`#status`&&jn(e,i.node))return{reason:`shapesOutput`,step:E(i.node).name}}else if(i.node===``){if(Bn(e,a.step))return{reason:`notBefore`,step:E(a.step).name}}else{if(!kn(e,a.step).includes(i.node))return{reason:`notBefore`,step:E(i.node).name};if(jn(e,i.node))return{reason:`shapesOutput`,step:E(i.node).name}}if(Rn(i,a))return;let s=zn(t,n,`out`),c=zn(t,r,`in`);if(s&&c&&!ye(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:E(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?ln(o,a.step,a.side.at,{read:c}):a.select?Y(o,a.step,a.keys,Oe({...a.select.part,operand:{read:c}})):Rn(i,a)?Y(o,a.step,a.keys,w({kind:`compare`,op:`=`,sides:[{read:c},{value:`SUCCEEDED`}]})):Y(o,a.step,a.keys,ke(s))},Gn=(e,t,n)=>{let r=Ln(t,{node:n.target,handle:n.targetHandle});if(r?.side)return dn(e,r.step,r.side.at);if(r?.select)return Y(e,r.step,r.keys,Oe({...r.select.part,operand:{value:``}}));if(r)return Y(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 Y(e,n.target,[n.key],void 0);if(n.kind===`condition`)return dn(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 me(t,r(n),e=>ue(t,e)).reduce((e,n)=>Gn(e,t,n),e)},qn=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Jn={connect:ut,disconnect:dt,removeState:lt,setArgument:Y,connectData:Wn,disconnectData:Gn,removePure:Kn,wireRefusal:Un,addCondition:un,conditionChoices:nn,setConditionSide:ln,addSelect:(e,t,n)=>{let r=T(e,t)?.Arguments?.[n];if(r!==void 0&&!qn(r)||typeof r==`string`&&r.startsWith(`{%`))return e;let i=r??``;return Y(e,t,[n],Oe({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&&Ie(i,r,n[e]?.names?.singular??a(e),Le(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}=r();return(0,V.useMemo)(()=>Yn(e,t?.resources??{},t?.views),[e,t?.resources,t?.views])},$=te(`app/field-types/workflow-page`),Zn={"app:http":{icon:We,keywords:[`api`,`fetch`,`url`,`webhook`,`get`,`post`]},"app:mail.send":{icon:f,keywords:[`email`,`send`,`message`]},"app:records.create":{icon:A,keywords:[`insert`,`add`,`new`,`row`]},"app:records.update":{icon:A,keywords:[`change`,`edit`,`row`]},"app:records.get":{icon:A,keywords:[`read`,`find`,`row`]},"app:records.list":{icon:A,keywords:[`read`,`find`,`query`,`rows`]}},Qn=[{type:`Choice`,icon:He,description:()=>$(`flowChoice`),keywords:[`if`,`branch`,`switch`,`condition`]},{type:`Map`,icon:Je,description:()=>$(`flowMap`),keywords:[`loop`,`each`,`list`,`repeat`]},{type:`Block`,icon:o,description:()=>$(`flowBlock`),keywords:[`cache`,`once`,`group`,`reuse`,`wrap`]},{type:`Wait`,icon:Xe,description:()=>$(`flowWait`),keywords:[`delay`,`sleep`,`pause`,`later`]},{type:`Pass`,icon:Ke,description:()=>$(`flowPass`),keywords:[`variable`,`assign`,`transform`]},{type:`Succeed`,icon:ee,description:()=>$(`flowSucceed`),keywords:[`end`,`stop`,`done`]},{type:`Fail`,icon:_,description:()=>$(`flowFail`),keywords:[`end`,`stop`,`error`]}],$n=e=>({id:`task:${e.id}`,title:se(e.id,e.label),description:e.description,keywords:[e.id,...Zn[e.id]?.keywords??[]],icon:Zn[e.id]?.icon??(e.id.startsWith(`app:`)?p:l)}),er=e=>e.slice(0,Math.max(e.indexOf(`:`),0)),tr=e=>e===`custom`?$(`customSteps`):e,nr=e=>{let t=new Set(Object.values(De(e.step_types.map(e=>e.id)))),n=e.step_types.filter(e=>e.available&&(!Ee(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:oe(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{mt as A,ot as C,it as D,Ze as E,tt as O,F as S,st as T,wt as _,Jn as a,Tt as b,En as c,On as d,vn as f,Et as g,Nt as h,Xn as i,nt as k,jn as l,en as m,nr as n,kn as o,bn as p,$ as r,Dn as s,rr as t,Fn as u,z as v,at as w,bt as x,xt as y};
2
+ //# debugId=bbcd8d39-0889-4c4b-9aeb-f4a7829ad7b6
@@ -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{Dl as r,Jn as i,Nc as a,Pc as o,Ts as s,Yr as c,bs as l,fa as u,hl as d,wl as f}from"./app-BvzjyTCc.js";import{l as p,m,n as h,u as g}from"./workflow-canvas-Q34kGPs0.js";import{m as _}from"./workflows-Bey4jszG.js";import{E as v,T as y,n as b}from"./use-run-trace-DM48FzsT.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=f(`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(r(),{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(),a=typeof e.type==`string`&&_(e.type)!==void 0&&r.resources.workflow_custom_step_jobs!==void 0&&r.permissions.workflow_custom_step_jobs?.read!==!1,f=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)(i,{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)}),f&&(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:u(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)(c,{to:{kind:`record`,resource:`workflow_runs`,key:e.run},className:d(o({size:`sm`}),`justify-self-start`),children:e.reused===!0?E(`openEarlierBlockRun`):E(`openBlockRun`)})]}),a&&(0,D.jsx)(c,{to:{kind:`list`,resource:`workflow_custom_step_jobs`,filter:`run_id = "${t}"`},className:d(o({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)(i,{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)(i,{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),[s,l]=(0,x.useState)(20);if(i.isPending)return null;let u=(i.data??[]).filter(e=>e.state===t),d=n===void 0?void 0:(i.data??[]).filter(e=>e.state===n&&typeof e.run==`string`).at(-1)?.run;return u.length===0&&typeof d==`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)(c,{to:{kind:`record`,resource:`workflow_runs`,key:d},className:o({size:`sm`})+` justify-self-start`,children:E(`openBlockRun`)})]}):u.length===0?(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`notRun`)}):(0,D.jsxs)(`div`,{className:`grid gap-3`,children:[u.slice(0,s).map(t=>(0,D.jsx)(j,{step:t,runId:e.id,...r&&{valueActions:r}},String(t.id))),u.length>s&&(0,D.jsx)(a,{size:`sm`,className:`justify-self-start`,onClick:()=>l(s+20),children:E(`showMore`)})]})},P=({definition:e,run:t,selected:n,types:r})=>{let a=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:a?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:g(a,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)(i,{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=e7db906b-4381-4465-8d12-64c94d69d1bc
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{Dl as r,Jn as i,Nc as a,Pc as o,Ts as s,Yr as c,bs as l,fa as u,hl as d,wl as f}from"./app-CgllsYQy.js";import{l as p,m,n as h,u as g}from"./workflow-canvas-CzzTk8Bv.js";import{m as _}from"./workflows-Bey4jszG.js";import{E as v,T as y,n as b}from"./use-run-trace-B0JxFskZ.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=f(`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(r(),{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(),a=typeof e.type==`string`&&_(e.type)!==void 0&&r.resources.workflow_custom_step_jobs!==void 0&&r.permissions.workflow_custom_step_jobs?.read!==!1,f=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)(i,{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)}),f&&(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:u(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)(c,{to:{kind:`record`,resource:`workflow_runs`,key:e.run},className:d(o({size:`sm`}),`justify-self-start`),children:e.reused===!0?E(`openEarlierBlockRun`):E(`openBlockRun`)})]}),a&&(0,D.jsx)(c,{to:{kind:`list`,resource:`workflow_custom_step_jobs`,filter:`run_id = "${t}"`},className:d(o({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)(i,{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)(i,{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),[s,l]=(0,x.useState)(20);if(i.isPending)return null;let u=(i.data??[]).filter(e=>e.state===t),d=n===void 0?void 0:(i.data??[]).filter(e=>e.state===n&&typeof e.run==`string`).at(-1)?.run;return u.length===0&&typeof d==`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)(c,{to:{kind:`record`,resource:`workflow_runs`,key:d},className:o({size:`sm`})+` justify-self-start`,children:E(`openBlockRun`)})]}):u.length===0?(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`notRun`)}):(0,D.jsxs)(`div`,{className:`grid gap-3`,children:[u.slice(0,s).map(t=>(0,D.jsx)(j,{step:t,runId:e.id,...r&&{valueActions:r}},String(t.id))),u.length>s&&(0,D.jsx)(a,{size:`sm`,className:`justify-self-start`,onClick:()=>l(s+20),children:E(`showMore`)})]})},P=({definition:e,run:t,selected:n,types:r})=>{let a=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:a?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(M,{kind:g(a,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)(i,{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=e27e4750-50de-41c6-894e-027fe9ce70f3
@@ -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{Ac as r,Er as i,Es as a,Il as o,Oi as s,Sa as c,Si as l,Ta as u,Ua as d,Va as f,_a as p,ba as m,da as ee,ga as h,ha as g,hl as _,pa as v}from"./app-BvzjyTCc.js";import{_ as y,a as b,i as te,n as ne,o as re,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 T,o as E,r as ce,t as le,u as D,v as O}from"./use-calendar-move-BPqQcS7u.js";var k=e(t(),1),A=864e5,j=e=>Date.parse(`${e}T00:00:00Z`),M=(e,t=0)=>{let n=new Date(j(e));return new Date(Date.UTC(n.getUTCFullYear(),Math.floor(n.getUTCMonth()/3)*3+3*t,1)).toISOString().slice(0,10)},N=({scale:e,day:t})=>({scale:e,day:e===`week`?C(t):e===`month`?S(t):M(t)}),P=(e,t,n=u())=>N(e??{scale:`month`,day:c(t,n)}),F=(e,t)=>{let{scale:n,day:r}=N(e);return{scale:n,day:n===`week`?D(r,7*t):n===`month`?S(r,t):M(r,t)}},I=e=>{let t=N(e).day,n=(j(F(e,1).day)-j(t))/A;return Array.from({length:n},(e,n)=>D(t,n))},ue=e=>({from:N(e).day,to:F(e,1).day}),de=(e,t,n,r=u())=>{let i=c(n,r),a=I(e);return N({scale:t,day:i>=a[0]&&i<=a.at(-1)?i:a[0]})},fe=e=>{let t=I(e);return e.scale===`week`?v(j(t[0]),j(t.at(-1))):e.scale===`month`?g(j(t[0])):p(j(t[0]),j(S(t.at(-1))))},L=e=>{let t=I(e);if(e.scale===`week`)return t.map((e,t)=>({index:t,span:1,label:`${m(j(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:h(j(t[e]))}))},R=(e,t,n,r,i=u())=>{let a=O(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 c=n?.fields[i],u=new Map;for(let t of e){let e=t.record[i],n=e==null||e===``,r=n?z:`value:${String(e)}`,d=n?l(`noValue`,{label:c?.label??o(i)}):t.labels[i]??s(a,e,c),f=u.get(r)??{value:n?void 0:e,lane:{key:r,label:d,rows:[]}};f.lane.rows.push(t),u.set(r,f)}let d=a.enumValues??[],f=(e,t)=>e.value===void 0||t.value===void 0?Number(e.value===void 0)-Number(t.value===void 0):a.type===`enum`?d.indexOf(String(e.value))-d.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[...u.values()].toSorted(f).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:_(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:_(`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:_(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:_(`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:a,dragged:o})=>{let s=R(r.record,n,e,i);return(0,V.jsxs)(`div`,{className:_(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:E(e,t,n,r)}),(0,V.jsx)(`div`,{className:`relative h-7`,children:s&&(0,V.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2`,style:{left:U(s.first,i.length),width:U(s.last-s.first+1,i.length)},children:(0,V.jsx)(w,{model:e,view:t,display:n,row:r,day:s.start,movable:a,dragged:o,className:_(s.before&&`rounded-l-none border-l-0`,s.after&&`rounded-r-none border-r-0`)})})})]})},ge=()=>[{scale:`week`,label:l(`week`)},{scale:`month`,label:l(`month`)},{scale:`quarter`,label:l(`quarter`)}],W=({model:e,view:t,display:n,fields:s,filter:p,at:m,linkTo:h,now:g=Date.now()})=>{let[_,v]=(0,k.useState)(),S=P(h?m:_,g),C=I(S),w=L(S),A=ce({model:e,display:n,range:ue(S),fields:s,filter:p}),{moves:j,move:M}=T(e,n),N=B(se(le(A.rows,j),n),e,t,n),R=a(e.name),z=f(R,`update`)&&[n.start,n.end].every(t=>t===void 0||!e.fields[t]?.readOnly),[H,U]=(0,k.useState)(),W=(0,k.useRef)(!1),G=(0,k.useRef)(0),K=(0,k.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}),Y=x(y(b,{activationConstraint:{distance:4}}),y(re,{activationConstraint:{delay:250,tolerance:5}}),y(te,{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}}})),X=c(g,u()),Z=r=>E(e,t,n,r.row),Q=e=>ee(Date.parse(`${D(e.day,G.current)}T00:00:00Z`)),ve={onDragStart:({active:e})=>l(`pickedUp`,{title:Z(e.data.current)}),onDragMove:({active:e})=>l(`startsOn`,{title:Z(e.data.current),day:Q(e.data.current)}),onDragOver:()=>void 0,onDragEnd:({active:e})=>G.current===0?l(`putBack`,{title:Z(e.data.current)}):l(`wasMovedTo`,{title:Z(e.data.current),to:Q(e.data.current)}),onDragCancel:({active:e})=>l(`cancelled`,{title:Z(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=O(i.record,n,e);a&&G.current!==0&&M(i,a.first,D(a.first,G.current))},Se=n.group===void 0?t?.names?.plural??o(e.name):t?.fields[n.group]?.label??o(n.group),Ce=!A.loading&&!A.error&&A.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:fe(S),unit:S.scale,previous:F(S,-1),today:P({scale:S.scale,day:X},g),next:F(S,1),scales:ge().map(({scale:e,label:t})=>({view:de(S,e,g),label:t,current:S.scale===e})),scalesLabel:l(`timelineScale`),linkTo:h,onView:v}),A.error&&(0,V.jsx)(i,{title:l(`couldNotLoadRows`),error:A.error}),A.capped&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`capped`,{limit:500,unit:S.scale})}),(0,V.jsxs)(ie,{sensors:Y,modifiers:[_e],onDragStart:ye,onDragMove:be,onDragEnd:xe,onDragCancel:$,accessibility:{announcements:ve,screenReaderInstructions:{draggable:l(`timelineInstructions`)}},children:[(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[(0,V.jsx)(pe,{ticks:w,days:C,today:X,label:Se,trackRef:K}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(me,{ticks:w,days:C,today:X}),A.loading&&(0,V.jsxs)(`div`,{className:`relative flex flex-col gap-2 p-2`,children:[(0,V.jsx)(r,{className:`h-4`}),(0,V.jsx)(r,{className:`h-4`})]}),Ce&&(0,V.jsx)(`p`,{className:`relative px-2 py-3 text-xs text-muted-foreground`,children:l(`nothingIn`,{unit:S.scale})}),!A.loading&&N.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&&d(r.record,`update`),dragged:()=>W.current},r.key))]},r.key))]})]}),(0,V.jsx)(ne,{children:H&&(0,V.jsx)(ae,{model:e,view:t,display:n,row:H.row,day:H.day})})]})]})};export{W as TimelineDisplay};
2
- //# debugId=e34fdd0b-0eb9-4470-b4ca-02255bf4635a
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{Ac as r,Er as i,Es as a,Il as o,Oi as s,Sa as c,Si as l,Ta as u,Ua as d,Va as f,_a as p,ba as m,da as ee,ga as h,ha as g,hl as _,pa as v}from"./app-CgllsYQy.js";import{_ as y,a as b,i as te,n as ne,o as re,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 T,o as E,r as ce,t as le,u as D,v as O}from"./use-calendar-move-B5Nd4WqC.js";var k=e(t(),1),A=864e5,j=e=>Date.parse(`${e}T00:00:00Z`),M=(e,t=0)=>{let n=new Date(j(e));return new Date(Date.UTC(n.getUTCFullYear(),Math.floor(n.getUTCMonth()/3)*3+3*t,1)).toISOString().slice(0,10)},N=({scale:e,day:t})=>({scale:e,day:e===`week`?C(t):e===`month`?S(t):M(t)}),P=(e,t,n=u())=>N(e??{scale:`month`,day:c(t,n)}),F=(e,t)=>{let{scale:n,day:r}=N(e);return{scale:n,day:n===`week`?D(r,7*t):n===`month`?S(r,t):M(r,t)}},I=e=>{let t=N(e).day,n=(j(F(e,1).day)-j(t))/A;return Array.from({length:n},(e,n)=>D(t,n))},ue=e=>({from:N(e).day,to:F(e,1).day}),de=(e,t,n,r=u())=>{let i=c(n,r),a=I(e);return N({scale:t,day:i>=a[0]&&i<=a.at(-1)?i:a[0]})},fe=e=>{let t=I(e);return e.scale===`week`?v(j(t[0]),j(t.at(-1))):e.scale===`month`?g(j(t[0])):p(j(t[0]),j(S(t.at(-1))))},L=e=>{let t=I(e);if(e.scale===`week`)return t.map((e,t)=>({index:t,span:1,label:`${m(j(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:h(j(t[e]))}))},R=(e,t,n,r,i=u())=>{let a=O(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 c=n?.fields[i],u=new Map;for(let t of e){let e=t.record[i],n=e==null||e===``,r=n?z:`value:${String(e)}`,d=n?l(`noValue`,{label:c?.label??o(i)}):t.labels[i]??s(a,e,c),f=u.get(r)??{value:n?void 0:e,lane:{key:r,label:d,rows:[]}};f.lane.rows.push(t),u.set(r,f)}let d=a.enumValues??[],f=(e,t)=>e.value===void 0||t.value===void 0?Number(e.value===void 0)-Number(t.value===void 0):a.type===`enum`?d.indexOf(String(e.value))-d.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[...u.values()].toSorted(f).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:_(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:_(`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:_(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:_(`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:a,dragged:o})=>{let s=R(r.record,n,e,i);return(0,V.jsxs)(`div`,{className:_(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:E(e,t,n,r)}),(0,V.jsx)(`div`,{className:`relative h-7`,children:s&&(0,V.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2`,style:{left:U(s.first,i.length),width:U(s.last-s.first+1,i.length)},children:(0,V.jsx)(w,{model:e,view:t,display:n,row:r,day:s.start,movable:a,dragged:o,className:_(s.before&&`rounded-l-none border-l-0`,s.after&&`rounded-r-none border-r-0`)})})})]})},ge=()=>[{scale:`week`,label:l(`week`)},{scale:`month`,label:l(`month`)},{scale:`quarter`,label:l(`quarter`)}],W=({model:e,view:t,display:n,fields:s,filter:p,at:m,linkTo:h,now:g=Date.now()})=>{let[_,v]=(0,k.useState)(),S=P(h?m:_,g),C=I(S),w=L(S),A=ce({model:e,display:n,range:ue(S),fields:s,filter:p}),{moves:j,move:M}=T(e,n),N=B(se(le(A.rows,j),n),e,t,n),R=a(e.name),z=f(R,`update`)&&[n.start,n.end].every(t=>t===void 0||!e.fields[t]?.readOnly),[H,U]=(0,k.useState)(),W=(0,k.useRef)(!1),G=(0,k.useRef)(0),K=(0,k.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}),Y=x(y(b,{activationConstraint:{distance:4}}),y(re,{activationConstraint:{delay:250,tolerance:5}}),y(te,{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}}})),X=c(g,u()),Z=r=>E(e,t,n,r.row),Q=e=>ee(Date.parse(`${D(e.day,G.current)}T00:00:00Z`)),ve={onDragStart:({active:e})=>l(`pickedUp`,{title:Z(e.data.current)}),onDragMove:({active:e})=>l(`startsOn`,{title:Z(e.data.current),day:Q(e.data.current)}),onDragOver:()=>void 0,onDragEnd:({active:e})=>G.current===0?l(`putBack`,{title:Z(e.data.current)}):l(`wasMovedTo`,{title:Z(e.data.current),to:Q(e.data.current)}),onDragCancel:({active:e})=>l(`cancelled`,{title:Z(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=O(i.record,n,e);a&&G.current!==0&&M(i,a.first,D(a.first,G.current))},Se=n.group===void 0?t?.names?.plural??o(e.name):t?.fields[n.group]?.label??o(n.group),Ce=!A.loading&&!A.error&&A.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:fe(S),unit:S.scale,previous:F(S,-1),today:P({scale:S.scale,day:X},g),next:F(S,1),scales:ge().map(({scale:e,label:t})=>({view:de(S,e,g),label:t,current:S.scale===e})),scalesLabel:l(`timelineScale`),linkTo:h,onView:v}),A.error&&(0,V.jsx)(i,{title:l(`couldNotLoadRows`),error:A.error}),A.capped&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`capped`,{limit:500,unit:S.scale})}),(0,V.jsxs)(ie,{sensors:Y,modifiers:[_e],onDragStart:ye,onDragMove:be,onDragEnd:xe,onDragCancel:$,accessibility:{announcements:ve,screenReaderInstructions:{draggable:l(`timelineInstructions`)}},children:[(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[(0,V.jsx)(pe,{ticks:w,days:C,today:X,label:Se,trackRef:K}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(me,{ticks:w,days:C,today:X}),A.loading&&(0,V.jsxs)(`div`,{className:`relative flex flex-col gap-2 p-2`,children:[(0,V.jsx)(r,{className:`h-4`}),(0,V.jsx)(r,{className:`h-4`})]}),Ce&&(0,V.jsx)(`p`,{className:`relative px-2 py-3 text-xs text-muted-foreground`,children:l(`nothingIn`,{unit:S.scale})}),!A.loading&&N.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&&d(r.record,`update`),dragged:()=>W.current},r.key))]},r.key))]})]}),(0,V.jsx)(ne,{children:H&&(0,V.jsx)(ae,{model:e,view:t,display:n,row:H.row,day:H.day})})]})]})};export{W as TimelineDisplay};
2
+ //# debugId=e00feb47-dadc-4548-9db5-034e35f99421
@@ -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{ml as e}from"./app-BvzjyTCc.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=2aed3575-1b8a-4780-8a75-437323b1e6af
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{ml as e}from"./app-CgllsYQy.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=2c0c32ac-1156-4a6c-8b49-2f0cbde72ce6
@@ -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{Cu as e,Du as t,Eu as n,Tu as r,mu as i,wu as a}from"./app-BvzjyTCc.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=(n,r,i)=>({...t,search:{...t.search,evaluate:i?t=>e(i,r,t):s(`search`)},similar:{...t.similar,evaluate:s(`similar`)},regex:{...t.regex,evaluate:(e,t)=>e.some(e=>typeof e==`string`&&new RegExp(t).test(e))},now:{...t.now,evaluate:n}}),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=(e,t)=>{let r=e[t].when;if(r===void 0)return;let i=n(r);if(!i.ok)return i.errors.map(e=>e.message).join(`; `);if(!i.ast)return`it is empty`;let o=a(m(e.slice(0,t)),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,n])=>{let r=typeof n==`string`?i(n):void 0;if(r===void 0)return[];let a=t.find(e=>e.name===r);return a?a.kind===`secret`?[`set "${e}" names secret input "${r}", which an update never writes; take it in an action's handler`]:[]:[`set "${e}" names input "${r}", which it does not ask for`]}),b=(e,t)=>Object.fromEntries(Object.entries(e).flatMap(([e,n])=>{let r=typeof n==`string`?i(n):void 0;return r===void 0?[[e,n]]:Object.hasOwn(t,r)?[[e,t[r]]]:[]}));export{v as a,d as i,b as n,_ as r,y as t};
2
- //# debugId=60fed37a-8807-4342-92d1-f8514be2fa95
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{Cu as e,Du as t,Eu as n,Tu as r,mu as i,wu as a}from"./app-CgllsYQy.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=(n,r,i)=>({...t,search:{...t.search,evaluate:i?t=>e(i,r,t):s(`search`)},similar:{...t.similar,evaluate:s(`similar`)},regex:{...t.regex,evaluate:(e,t)=>e.some(e=>typeof e==`string`&&new RegExp(t).test(e))},now:{...t.now,evaluate:n}}),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=(e,t)=>{let r=e[t].when;if(r===void 0)return;let i=n(r);if(!i.ok)return i.errors.map(e=>e.message).join(`; `);if(!i.ast)return`it is empty`;let o=a(m(e.slice(0,t)),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,n])=>{let r=typeof n==`string`?i(n):void 0;if(r===void 0)return[];let a=t.find(e=>e.name===r);return a?a.kind===`secret`?[`set "${e}" names secret input "${r}", which an update never writes; take it in an action's handler`]:[]:[`set "${e}" names input "${r}", which it does not ask for`]}),b=(e,t)=>Object.fromEntries(Object.entries(e).flatMap(([e,n])=>{let r=typeof n==`string`?i(n):void 0;return r===void 0?[[e,n]]:Object.hasOwn(t,r)?[[e,t[r]]]:[]}));export{v as a,d as i,b as n,_ as r,y as t};
2
+ //# debugId=2de7a3dc-87a1-45cf-bf8c-fdbd8ccb009b