@protobase/ui 0.121.0 → 0.121.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/blocks/personal-mail-block.js +4 -0
- package/dist/account/messages.d.ts +2 -2
- package/dist/activity-chart/messages.d.ts +2 -2
- package/dist/app/change-confirm/messages.d.ts +2 -2
- package/dist/app/charts/messages.d.ts +2 -2
- package/dist/app/comments/messages.d.ts +2 -2
- package/dist/app/confirm-sign-in-messages.d.ts +2 -2
- package/dist/app/conversation/messages.d.ts +2 -2
- package/dist/app/conversation-page/messages.d.ts +2 -2
- package/dist/app/create/messages.d.ts +2 -2
- package/dist/app/delete/messages.d.ts +2 -2
- package/dist/app/displays/messages.d.ts +2 -2
- package/dist/app/embedded-list/messages.d.ts +2 -2
- package/dist/app/export/builder.js +2 -1
- package/dist/app/export/messages.d.ts +2 -2
- package/dist/app/field-editor.js +8 -1
- package/dist/app/field-errors.js +2 -1
- package/dist/app/field-messages.d.ts +2 -2
- package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
- package/dist/app/field-types/runner-install/messages.d.ts +2 -2
- package/dist/app/field-types/workflow/cache-field.js +1 -1
- package/dist/app/field-types/workflow/definition.d.ts +1 -1
- package/dist/app/field-types/workflow/flow-elements.js +2 -2
- package/dist/app/field-types/workflow/flow-nodes.js +2 -2
- package/dist/app/field-types/workflow/messages.d.ts +2 -2
- package/dist/app/field-types/workflow/node-panel.js +2 -2
- package/dist/app/field-types/workflow/pins/data-edits.js +1 -1
- package/dist/app/field-types/workflow/pins/pin-text.js +1 -1
- package/dist/app/field-types/workflow/task-fields.js +2 -2
- package/dist/app/field-types/workflow/trigger-fields.js +1 -1
- package/dist/app/field-types/workflow/workflow-canvas.js +3 -3
- package/dist/app/field-types/workflow/workflow-field.js +1 -1
- package/dist/app/field-types/workflow/workflow-graph-editor.js +3 -3
- package/dist/app/field-types/workflow-page/insert-value-view.js +3 -3
- package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-page/publish-panel.js +2 -2
- package/dist/app/field-types/workflow-page/rerun-panel.js +1 -1
- package/dist/app/field-types/workflow-page/run-notice.js +1 -1
- package/dist/app/field-types/workflow-page/runs-panel.js +1 -1
- package/dist/app/field-types/workflow-page/test-run-panel.js +2 -2
- package/dist/app/field-types/workflow-page/use-workflow-page.js +2 -2
- package/dist/app/field-types/workflow-page/workbench-bar.js +2 -2
- package/dist/app/field-types/workflow-page/workflow-workbench.js +12 -12
- package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-run/run-trace-view.js +4 -4
- package/dist/app/field-types/workflow-run/step-card.js +1 -1
- package/dist/app/field-types/workflow-run/step-panel.js +1 -1
- package/dist/app/focus/messages.d.ts +2 -2
- package/dist/app/gallery/gallery-layout.d.ts +2 -2
- package/dist/app/gallery/messages.d.ts +2 -2
- package/dist/app/hand-order/messages.d.ts +2 -2
- package/dist/app/history/messages.d.ts +2 -2
- package/dist/app/import/messages.d.ts +2 -2
- package/dist/app/list-messages.d.ts +2 -2
- package/dist/app/messages.d.ts +2 -2
- package/dist/app/meta-gate-messages.d.ts +2 -2
- package/dist/app/new-version/messages.d.ts +2 -2
- package/dist/app/pages/field-value.d.ts +1 -1
- package/dist/app/pages/field-value.js +3 -1
- package/dist/app/pages/messages.d.ts +2 -2
- package/dist/app/record-chart/messages.d.ts +2 -2
- package/dist/app/record-messages.d.ts +2 -2
- package/dist/app/record-row/messages.d.ts +2 -2
- package/dist/app/related-cards/messages.d.ts +2 -2
- package/dist/app/runtime/messages.d.ts +2 -2
- package/dist/app/saved/messages.d.ts +2 -2
- package/dist/app/searches/messages.d.ts +2 -2
- package/dist/app-shell/messages.d.ts +2 -2
- package/dist/assistant-dock/messages.d.ts +2 -2
- package/dist/auth/messages.d.ts +2 -2
- package/dist/calls/messages.d.ts +2 -2
- package/dist/chat/messages.d.ts +2 -2
- package/dist/data-grid/column-spec.d.ts +1 -1
- package/dist/data-grid/messages.d.ts +2 -2
- package/dist/filter-panel/messages.d.ts +2 -2
- package/dist/format/messages.d.ts +2 -2
- package/dist/forms/messages.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/inline-child-table/messages.d.ts +2 -2
- package/dist/invitations/messages.d.ts +2 -2
- package/dist/live/field-values.js +2 -1
- package/dist/live/messages.d.ts +2 -2
- package/dist/locale/en.js +9 -1
- package/dist/locale/en.json.d.ts +8 -0
- package/dist/locale/messages.d.ts +16 -0
- package/dist/locale/nl.js +9 -1
- package/dist/mailbox/mail-sender-select.d.ts +23 -0
- package/dist/mailbox/mail-sender-select.js +81 -0
- package/dist/mailbox/mailbox-connect.js +1 -1
- package/dist/mailbox/messages.d.ts +2 -2
- package/dist/mailbox/sender-options-read.d.ts +14 -0
- package/dist/mailbox/sender-options-read.js +31 -0
- package/dist/mailbox/sender-options.d.ts +17 -0
- package/dist/mailbox/sender-options.js +17 -0
- package/dist/mailbox/use-sender-options.d.ts +14 -0
- package/dist/mailbox/use-sender-options.js +57 -0
- package/dist/mocks/customers.d.ts +1 -1
- package/dist/mocks/invoices.d.ts +2 -2
- package/dist/mocks/orders.d.ts +3 -3
- package/dist/notifications/bell/messages.d.ts +2 -2
- package/dist/organizations/messages.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/plugins/messages.d.ts +2 -2
- package/dist/primitives/messages.d.ts +2 -2
- package/dist/shell/assets/{account-page-DIIa49Sf.js → account-page-BEMlob92.js} +2 -2
- package/dist/shell/assets/app-CwxoFZn2.js +34 -0
- package/dist/shell/assets/{assistant-shell-CLGyb2ss.js → assistant-shell-D1PLZHeQ.js} +2 -2
- package/dist/shell/assets/board-display-BZb6Av24.js +2 -0
- package/dist/shell/assets/calendar-display-CNFg47Me.js +2 -0
- package/dist/shell/assets/{call-rings-AviIOqM7.js → call-rings-B0cAdcLq.js} +2 -2
- package/dist/shell/assets/{calls-C2CUgWkn.js → calls-CJX48uHr.js} +2 -2
- package/dist/shell/assets/{circle-alert-DOaXkZQv.js → circle-alert-B-bmotNV.js} +2 -2
- package/dist/shell/assets/composed-page-itsBuYQN.js +2 -0
- package/dist/shell/assets/{composer-section-BLqTkqi8.js → composer-section-CcOJo5ti.js} +2 -2
- package/dist/shell/assets/{connect-route-41MPQMtp.js → connect-route-CFKOOd6G.js} +2 -2
- package/dist/shell/assets/{copy-field-Ct-6xn8T.js → copy-field-DOFRIY_Q.js} +2 -2
- package/dist/shell/assets/create-route-Dv-SPGqY.js +2 -0
- package/dist/shell/assets/{custom-step-container-field-C0uZrHjV.js → custom-step-container-field-Cpk6ImRJ.js} +4 -4
- package/dist/shell/assets/embedded-list-DoHDT3Av.js +3 -0
- package/dist/shell/assets/en-C_BQKBSV.js +2 -0
- package/dist/shell/assets/{export-dialog-BerhgfFO.js → export-dialog-Ivzdiuhz.js} +2 -2
- package/dist/shell/assets/export-worker-C46NatsO.js +15 -0
- package/dist/shell/assets/{first-organization-page-CKYevHep.js → first-organization-page-in6WzIgy.js} +2 -2
- package/dist/shell/assets/{graph-view-CoLu3Uhs.js → graph-view-BRuO-SOE.js} +2 -2
- package/dist/shell/assets/{group-donut-B8v2SWzP.js → group-donut-3NIqjraT.js} +2 -2
- package/dist/shell/assets/{guest-call-page-DqQMPCVU.js → guest-call-page-NZyVZiKI.js} +3 -3
- package/dist/shell/assets/{html-viewer-BntGWVRA.js → html-viewer-C1KycBYl.js} +2 -2
- package/dist/shell/assets/{import-dialog-DThTUXFS.js → import-dialog-CyB3vJn7.js} +2 -2
- package/dist/shell/assets/{import-table-dialog-C-XIx1Dd.js → import-table-dialog-D8yGy95h.js} +2 -2
- package/dist/shell/assets/{index-CI7L8s0t.js → index-CkkBg7C6.js} +1 -1
- package/dist/shell/assets/{invitations-page-COFjv2AV.js → invitations-page-BjEW7hIz.js} +2 -2
- package/dist/shell/assets/{layout-grid-CvCNKDtn.js → layout-grid-OO8eIGYq.js} +2 -2
- package/dist/shell/assets/{legend-item-9nkaAII6.js → legend-item-eNQOaTxV.js} +2 -2
- package/dist/shell/assets/{lib-zod-B92j-KH2.js → lib-zod-CxxP7Qhu.js} +2 -2
- package/dist/shell/assets/list-page-bIQkpGOc.js +4 -0
- package/dist/shell/assets/{maplibre-5GcVztUc.js → maplibre-DV3j-5Y6.js} +2 -2
- package/dist/shell/assets/{markdown-content-DVmg_kx3.js → markdown-content-C08v-1FZ.js} +2 -2
- package/dist/shell/assets/members-page-B9hyyuVp.js +2 -0
- package/dist/shell/assets/{message-content-BpfTrsWh.js → message-content-DLKHIzRa.js} +3 -3
- package/dist/shell/assets/messages-NBuAsjFr.js +2 -0
- package/dist/shell/assets/nl-DzJ_yv1H.js +2 -0
- package/dist/shell/assets/organization-page-DeTS9uAn.js +2 -0
- package/dist/shell/assets/organizations-page-qM5TQfyb.js +2 -0
- package/dist/shell/assets/parse-worker-COWuolaE.js +35 -0
- package/dist/shell/assets/{pending-invitation-row-t63yAwI8.js → pending-invitation-row-9-2Fmy3F.js} +2 -2
- package/dist/shell/assets/{period-chart-BVv9kC_E.js → period-chart-UOm7kPWB.js} +2 -2
- package/dist/shell/assets/{person-row-CgvcHRmL.js → person-row-DOXM02rY.js} +2 -2
- package/dist/shell/assets/public-form-page-Bj9YxgGp.js +2 -0
- package/dist/shell/assets/{record-lines-Dts68Cfq.js → record-lines-PZ4g8sb5.js} +2 -2
- package/dist/shell/assets/{record-map-BO9rZaxg.js → record-map-CkWjStZn.js} +2 -2
- package/dist/shell/assets/{record-opens-Ds9nDyw1.js → record-opens-6vtBiJ2O.js} +2 -2
- package/dist/shell/assets/record-page-DrQL98n9.js +3 -0
- package/dist/shell/assets/{record-preview-CwySCCRj.js → record-preview-BSqik7HQ.js} +2 -2
- package/dist/shell/assets/{records-map-Bq_dBgiT.js → records-map-CXBbBlYG.js} +2 -2
- package/dist/shell/assets/render-node-DEyR63E8.js +3 -0
- package/dist/shell/assets/reorder-button-CdgrzXlf.js +2 -0
- package/dist/shell/assets/{run-trace-view-BtyPPUyt.js → run-trace-view-CqcgX5lE.js} +2 -2
- package/dist/shell/assets/{runner-install-field-DvuPCX28.js → runner-install-field-Dm7GhYaF.js} +2 -2
- package/dist/shell/assets/{runtime-update-e56Spv--.js → runtime-update-BdhyiFl9.js} +2 -2
- package/dist/shell/assets/shared-protobase-ui-CDtJQrEp.js +1 -0
- package/dist/shell/assets/{sheet-source-Cenf8A74.js → sheet-source-NKu1Enl2.js} +3 -3
- package/dist/shell/assets/sign-in-policy-page-DINzAtyt.js +2 -0
- package/dist/shell/assets/start-block-queries-Bc743CdL.js +2 -0
- package/dist/shell/assets/step-catalog-B9QbvZP_.js +2 -0
- package/dist/shell/assets/{step-panel-DD821ue5.js → step-panel-C5Pnb-Vb.js} +2 -2
- package/dist/shell/assets/timeline-display-hbo62z0J.js +2 -0
- package/dist/shell/assets/{trash-Ch2JFURM.js → trash-YqRXn8JG.js} +2 -2
- package/dist/shell/assets/{update-set-Zch9kB-u.js → update-set-DFWECx_E.js} +2 -2
- package/dist/shell/assets/use-calendar-move-D_6TlMr4.js +2 -0
- package/dist/shell/assets/{use-display-rows-s-zuk4Lc.js → use-display-rows-1Xjy5pR2.js} +2 -2
- package/dist/shell/assets/use-my-invitations-CrSF37dB.js +2 -0
- package/dist/shell/assets/{use-paged-search-CxaSlMkh.js → use-paged-search-CtD7Lf-E.js} +2 -2
- package/dist/shell/assets/{use-run-trace-CRG2_uVq.js → use-run-trace-5H4UJvB-.js} +2 -2
- package/dist/shell/assets/{use-workflow-page-BPZWN9Iv.js → use-workflow-page-dAWuZvWk.js} +2 -2
- package/dist/shell/assets/{use-workflow-types-Dk4FOVoz.js → use-workflow-types-Cjkw47Mf.js} +2 -2
- package/dist/shell/assets/{workflow-canvas-DBlvFI_n.js → workflow-canvas-BkFimRd2.js} +4 -4
- package/dist/shell/assets/{workflow-field-DXiYYH5X.js → workflow-field-BQImywHx.js} +3 -3
- package/dist/shell/assets/{workflow-graph-editor-BtNoPI_a.js → workflow-graph-editor-DYBqdH_O.js} +2 -2
- package/dist/shell/assets/{workflow-run-field-CztPPLbi.js → workflow-run-field-CyxK0W7w.js} +3 -3
- package/dist/shell/assets/workflow-status-field-Bzri4NHN.js +2 -0
- package/dist/shell/assets/workflow-workbench-DC2gtXz1.js +4 -0
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/{account-page-DIIa49Sf.js.map → account-page-BEMlob92.js.map} +1 -1
- package/dist/shell-source-maps/assets/app-CwxoFZn2.js.map +1 -0
- package/dist/shell-source-maps/assets/{assistant-shell-CLGyb2ss.js.map → assistant-shell-D1PLZHeQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{board-display-DJJD_jjY.js.map → board-display-BZb6Av24.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calendar-display-7R7Vz5Vm.js.map → calendar-display-CNFg47Me.js.map} +1 -1
- package/dist/shell-source-maps/assets/{call-rings-AviIOqM7.js.map → call-rings-B0cAdcLq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calls-C2CUgWkn.js.map → calls-CJX48uHr.js.map} +1 -1
- package/dist/shell-source-maps/assets/{circle-alert-DOaXkZQv.js.map → circle-alert-B-bmotNV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composed-page-DjGZy9C7.js.map → composed-page-itsBuYQN.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composer-section-BLqTkqi8.js.map → composer-section-CcOJo5ti.js.map} +1 -1
- package/dist/shell-source-maps/assets/{connect-route-41MPQMtp.js.map → connect-route-CFKOOd6G.js.map} +1 -1
- package/dist/shell-source-maps/assets/{copy-field-Ct-6xn8T.js.map → copy-field-DOFRIY_Q.js.map} +1 -1
- package/dist/shell-source-maps/assets/{create-route-CRZSYoTi.js.map → create-route-Dv-SPGqY.js.map} +1 -1
- package/dist/shell-source-maps/assets/{custom-step-container-field-C0uZrHjV.js.map → custom-step-container-field-Cpk6ImRJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/embedded-list-DoHDT3Av.js.map +1 -0
- package/dist/shell-source-maps/assets/en-C_BQKBSV.js.map +1 -0
- package/dist/shell-source-maps/assets/{export-dialog-BerhgfFO.js.map → export-dialog-Ivzdiuhz.js.map} +1 -1
- package/dist/shell-source-maps/assets/export-worker-C46NatsO.js.map +1 -0
- package/dist/shell-source-maps/assets/{first-organization-page-CKYevHep.js.map → first-organization-page-in6WzIgy.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-CoLu3Uhs.js.map → graph-view-BRuO-SOE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{group-donut-B8v2SWzP.js.map → group-donut-3NIqjraT.js.map} +1 -1
- package/dist/shell-source-maps/assets/{guest-call-page-DqQMPCVU.js.map → guest-call-page-NZyVZiKI.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-BntGWVRA.js.map → html-viewer-C1KycBYl.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-dialog-DThTUXFS.js.map → import-dialog-CyB3vJn7.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-table-dialog-C-XIx1Dd.js.map → import-table-dialog-D8yGy95h.js.map} +1 -1
- package/dist/shell-source-maps/assets/{invitations-page-COFjv2AV.js.map → invitations-page-BjEW7hIz.js.map} +1 -1
- package/dist/shell-source-maps/assets/{layout-grid-CvCNKDtn.js.map → layout-grid-OO8eIGYq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{legend-item-9nkaAII6.js.map → legend-item-eNQOaTxV.js.map} +1 -1
- package/dist/shell-source-maps/assets/lib-zod-CxxP7Qhu.js.map +1 -0
- package/dist/shell-source-maps/assets/{list-page-D3nIEwGf.js.map → list-page-bIQkpGOc.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-5GcVztUc.js.map → maplibre-DV3j-5Y6.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-DVmg_kx3.js.map → markdown-content-C08v-1FZ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{members-page-DoRl-b9K.js.map → members-page-B9hyyuVp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{message-content-BpfTrsWh.js.map → message-content-DLKHIzRa.js.map} +1 -1
- package/dist/shell-source-maps/assets/{messages-CZQvPUZQ.js.map → messages-NBuAsjFr.js.map} +1 -1
- package/dist/shell-source-maps/assets/nl-DzJ_yv1H.js.map +1 -0
- package/dist/shell-source-maps/assets/{organization-page-DeaQlPop.js.map → organization-page-DeTS9uAn.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organizations-page-Dlosll2b.js.map → organizations-page-qM5TQfyb.js.map} +1 -1
- package/dist/shell-source-maps/assets/parse-worker-COWuolaE.js.map +1 -0
- package/dist/shell-source-maps/assets/{pending-invitation-row-t63yAwI8.js.map → pending-invitation-row-9-2Fmy3F.js.map} +1 -1
- package/dist/shell-source-maps/assets/{period-chart-BVv9kC_E.js.map → period-chart-UOm7kPWB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{person-row-CgvcHRmL.js.map → person-row-DOXM02rY.js.map} +1 -1
- package/dist/shell-source-maps/assets/{public-form-page-CruNnqqc.js.map → public-form-page-Bj9YxgGp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-lines-Dts68Cfq.js.map → record-lines-PZ4g8sb5.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-BO9rZaxg.js.map → record-map-CkWjStZn.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-opens-Ds9nDyw1.js.map → record-opens-6vtBiJ2O.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-page-DJgscks5.js.map → record-page-DrQL98n9.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-preview-CwySCCRj.js.map → record-preview-BSqik7HQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-Bq_dBgiT.js.map → records-map-CXBbBlYG.js.map} +1 -1
- package/dist/shell-source-maps/assets/render-node-DEyR63E8.js.map +1 -0
- package/dist/shell-source-maps/assets/{reorder-button-BGgoLDx3.js.map → reorder-button-CdgrzXlf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-BtyPPUyt.js.map → run-trace-view-CqcgX5lE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runner-install-field-DvuPCX28.js.map → runner-install-field-Dm7GhYaF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runtime-update-e56Spv--.js.map → runtime-update-BdhyiFl9.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sheet-source-Cenf8A74.js.map → sheet-source-NKu1Enl2.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sign-in-policy-page-CUiU8ZIN.js.map → sign-in-policy-page-DINzAtyt.js.map} +1 -1
- package/dist/shell-source-maps/assets/{start-block-queries-DUvYFyeX.js.map → start-block-queries-Bc743CdL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-catalog-CKmRa3SA.js.map → step-catalog-B9QbvZP_.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-DD821ue5.js.map → step-panel-C5Pnb-Vb.js.map} +1 -1
- package/dist/shell-source-maps/assets/{timeline-display-ChPHZfO_.js.map → timeline-display-hbo62z0J.js.map} +1 -1
- package/dist/shell-source-maps/assets/{trash-Ch2JFURM.js.map → trash-YqRXn8JG.js.map} +1 -1
- package/dist/shell-source-maps/assets/{update-set-Zch9kB-u.js.map → update-set-DFWECx_E.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-calendar-move-Cl14_xWL.js.map → use-calendar-move-D_6TlMr4.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-display-rows-s-zuk4Lc.js.map → use-display-rows-1Xjy5pR2.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-my-invitations-APXH_Xf1.js.map → use-my-invitations-CrSF37dB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-paged-search-CxaSlMkh.js.map → use-paged-search-CtD7Lf-E.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-run-trace-CRG2_uVq.js.map → use-run-trace-5H4UJvB-.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-page-BPZWN9Iv.js.map → use-workflow-page-dAWuZvWk.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-types-Dk4FOVoz.js.map → use-workflow-types-Cjkw47Mf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-DBlvFI_n.js.map → workflow-canvas-BkFimRd2.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-field-DXiYYH5X.js.map → workflow-field-BQImywHx.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-BtNoPI_a.js.map → workflow-graph-editor-DYBqdH_O.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-run-field-CztPPLbi.js.map → workflow-run-field-CyxK0W7w.js.map} +1 -1
- package/dist/shell-source-maps/assets/workflow-status-field-Bzri4NHN.js.map +1 -0
- package/dist/shell-source-maps/assets/{workflow-workbench-CAz04v9t.js.map → workflow-workbench-DC2gtXz1.js.map} +1 -1
- package/dist/status/messages.d.ts +2 -2
- package/dist/users/messages.d.ts +2 -2
- package/package.json +5 -5
- package/dist/shell/assets/app-B8KcM2Z-.js +0 -34
- package/dist/shell/assets/board-display-DJJD_jjY.js +0 -2
- package/dist/shell/assets/calendar-display-7R7Vz5Vm.js +0 -2
- package/dist/shell/assets/composed-page-DjGZy9C7.js +0 -2
- package/dist/shell/assets/create-route-CRZSYoTi.js +0 -2
- package/dist/shell/assets/embedded-list-C3nd1V5o.js +0 -3
- package/dist/shell/assets/en-BHrKuf4K.js +0 -2
- package/dist/shell/assets/export-worker-CNhkzttC.js +0 -15
- package/dist/shell/assets/list-page-D3nIEwGf.js +0 -4
- package/dist/shell/assets/members-page-DoRl-b9K.js +0 -2
- package/dist/shell/assets/messages-CZQvPUZQ.js +0 -2
- package/dist/shell/assets/nl-D11b5T7-.js +0 -2
- package/dist/shell/assets/organization-page-DeaQlPop.js +0 -2
- package/dist/shell/assets/organizations-page-Dlosll2b.js +0 -2
- package/dist/shell/assets/parse-worker-CAcPVcu7.js +0 -35
- package/dist/shell/assets/public-form-page-CruNnqqc.js +0 -2
- package/dist/shell/assets/record-page-DJgscks5.js +0 -3
- package/dist/shell/assets/render-node-zjMYynnA.js +0 -3
- package/dist/shell/assets/reorder-button-BGgoLDx3.js +0 -2
- package/dist/shell/assets/shared-protobase-ui-QP42FY24.js +0 -1
- package/dist/shell/assets/sign-in-policy-page-CUiU8ZIN.js +0 -2
- package/dist/shell/assets/start-block-queries-DUvYFyeX.js +0 -2
- package/dist/shell/assets/step-catalog-CKmRa3SA.js +0 -2
- package/dist/shell/assets/timeline-display-ChPHZfO_.js +0 -2
- package/dist/shell/assets/use-calendar-move-Cl14_xWL.js +0 -2
- package/dist/shell/assets/use-my-invitations-APXH_Xf1.js +0 -2
- package/dist/shell/assets/workflow-status-field-K3DE4tPj.js +0 -2
- package/dist/shell/assets/workflow-workbench-CAz04v9t.js +0 -4
- package/dist/shell-source-maps/assets/app-B8KcM2Z-.js.map +0 -1
- package/dist/shell-source-maps/assets/embedded-list-C3nd1V5o.js.map +0 -1
- package/dist/shell-source-maps/assets/en-BHrKuf4K.js.map +0 -1
- package/dist/shell-source-maps/assets/export-worker-CNhkzttC.js.map +0 -1
- package/dist/shell-source-maps/assets/lib-zod-B92j-KH2.js.map +0 -1
- package/dist/shell-source-maps/assets/nl-D11b5T7-.js.map +0 -1
- package/dist/shell-source-maps/assets/parse-worker-CAcPVcu7.js.map +0 -1
- package/dist/shell-source-maps/assets/render-node-zjMYynnA.js.map +0 -1
- package/dist/shell-source-maps/assets/workflow-status-field-K3DE4tPj.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Cn as r,Dc as i,Ec as a,Fc as o,Hn as s,Ic as c,Kc as l,M as u,Mo as d,R as f,Sc as p,Wc as ee,fc as m,fs as te,ml as h,nl as ne,uc as re,vc as ie,wc as ae}from"./app-CwxoFZn2.js";import{t as oe}from"./circle-alert-B-bmotNV.js";import{a as se,c as ce,d as le,f as ue,g as de,h as fe,i as pe,m as me,o as he,p as ge,r as _e,s as ve,u as ye}from"./workflow-canvas-BkFimRd2.js";import{t as g}from"./trash-YqRXn8JG.js";import{A as be,D as xe,F as Se,M as _,_ as Ce,a as we,c as v,f as Te,g as Ee,h as y,i as De,k as b,m as Oe,n as ke,o as x,s as S,u as Ae,x as je}from"./workflows-Bey4jszG.js";import{E as C,S as Me,T as w,_ as Ne,s as T,x as E}from"./use-run-trace-5H4UJvB-.js";import{n as D}from"./use-workflow-types-Cjkw47Mf.js";var Pe={type:`object`,title:`File`,properties:{uri:{type:`string`},name:{type:`string`},type:{type:`string`},size:{type:`integer`}}},Fe=(e,t)=>e.relation&&t?.(e.relation.resource)===`integer`?{type:`integer`}:{type:`string`},Ie=(e,t,n)=>{if(e.file)return t===`read`?Pe:{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`?Fe(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`}}},Le=(e,t,n)=>{let r=Ie(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]}}},Re=(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,Le(e,t,r)]))}),ze=e=>t=>{let n=e(t);return n?.primaryKey.length===1?n.fields[n.primaryKey[0]]?.type:void 0},Be={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`}]]};Be.node;var O=l(Be),Ve={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`}]]};Ve.node;var He=l(Ve),Ue={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`}]]};Ue.node;var We=l(Ue),Ge={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`}]]};Ge.node;var Ke=l(Ge),qe={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`]};qe.node;var Je=l(qe),Ye={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`}]]};Ye.node;var Xe=l(Ye),Ze={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`}]]};Ze.node;var Qe=l(Ze),k=(e,t)=>{let n=structuredClone(e);return t(n),n},A=new Set([`Task`,`Pass`,`Wait`,`Map`,`Block`]),j=(e,t)=>{if(!A.has(e.Type))return;let n=e;delete n.End,n.Next=t},M=(e,t)=>{let n=E(e,t);if(!n)throw Error(`No Map or Block at ${t.join(`/`)}`);return n},$e=(e,t)=>{let n=new Set(Ne(e.stateMachine)),r=1;for(;n.has(`${t} ${r}`);)r++;return`${t} ${r}`},et=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},N=(e,t,n,r,i)=>k(e,e=>{let a=M(e,t),o=y(e)===`data`,s=et(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=$e(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}),P=e=>e.Type===`Choice`||A.has(e.Type),tt=(e,t,n)=>{let r=e.States[t],i=e.States[n];if(!r||!A.has(r.Type))return;let a=r.Next;(a===void 0||P(i))&&(j(r,n),a!==void 0&&(i.Type===`Choice`?i.Default=a:A.has(i.Type)&&j(i,a)))},nt=(e,t,n)=>{let r=M(e,t);if(n!==void 0&&n!==t.join(`/`)){let{name:e}=w(n);return A.has(r.States[e]?.Type)?e:void 0}return Object.keys(r.States).reverse().find(e=>r.States[e].End===!0)},rt=e=>e.kind===`start`?[]:w(e.source).scope,it=e=>e.ErrorEquals.length===1&&e.ErrorEquals[0]===`States.ALL`,at=(e,t)=>{if(t.kind===`start`)return e.stateMachine.StartAt||void 0;let{scope:n,name:r}=w(t.source),i=E(e,n)?.States[r];if(i){if(t.kind===`next`)return i.Next;if(t.kind==="default")return i.Type===`Choice`?i.Default:void 0;if(t.kind===`catch`)return`Catch`in i?i.Catch?.find(it)?.Next:void 0}},ot=(e,t,n,r,i)=>{if(i.kind===`start`)return ct(e,t,n,r);let{scope:a,name:o}=w(i.source);if(i.kind===`next`)return st(e,a,t,n,r,o);let s=at(e,i);return k(N(e,a,t,n,r),e=>{let t=M(e,a),r=t.States[o],c=t.States[n];if(r&&(s===void 0||P(c))){if(i.kind===`rule`&&r.Type===`Choice`&&(r.Choices=[...r.Choices??[],{Condition:``,Next:n}]),i.kind==="default"&&r.Type===`Choice`&&(r.Default=n),i.kind===`catch`&&(r.Type===`Task`||r.Type===`Map`||r.Type===`Block`)){let e=r.Catch?.find(it);e?e.Next=n:r.Catch=[...r.Catch??[],{ErrorEquals:[`States.ALL`],Next:n}]}s!==void 0&&(c.Type===`Choice`?c.Default=s:A.has(c.Type)&&j(c,s))}})},st=(e,t,n,r,i,a)=>{let o=N(e,t,n,r,i);return a===void 0||y(e)===`data`?o:k(o,e=>tt(M(e,t),a,r))},ct=(e,t,n,r)=>{let i=e.stateMachine.StartAt??``,a=N(e,[],t,n,r);return y(e)===`data`?a:k(a,e=>{let t=e.stateMachine.States[n];(i===``||P(t))&&(e.stateMachine.StartAt=n,i!==``&&A.has(t.Type)&&j(t,i),i!==``&&t.Type===`Choice`&&(t.Default=i))})},lt=(e,t)=>{`Next`in e&&e.Next===t&&(delete e.Next,e.End=!0),e.Type===`Choice`&&(e.Choices=(e.Choices??[]).filter(e=>e.Next!==t),e.Default===t&&delete e.Default),`Catch`in e&&e.Catch&&(e.Catch=e.Catch.filter(e=>e.Next!==t),e.Catch.length===0&&delete e.Catch)},ut=(e,t)=>k(e,e=>{let{scope:n,name:r}=w(t),i=M(e,n);delete i.States[r];for(let e of Object.values(i.States))lt(e,r);i.StartAt===r&&(i.StartAt=Object.keys(i.States)[0]??``)}),dt=(e,t,n,r)=>k(e,e=>{let{scope:i,name:a}=w(r);if(t===`start`){e.stateMachine.StartAt=a;return}let o=w(n);if(o.scope.join(`/`)!==i.join(`/`))throw Error(`A state leads only to states of its own machine`);let s=M(e,i).States[o.name];s&&(t===`next`&&j(s,a),t===`rule`&&s.Type===`Choice`&&(s.Choices=[...s.Choices??[],{Condition:``,Next:a}]),t==="default"&&s.Type===`Choice`&&(s.Default=a),t===`catch`&&(s.Type===`Task`||s.Type===`Map`||s.Type===`Block`)&&(s.Catch=[...s.Catch??[],{ErrorEquals:[`States.ALL`],Next:a}]))}),ft=(e,t)=>k(e,e=>{if(t.kind===`start`)return;let{scope:n,name:r}=w(t.source),i=M(e,n).States[r];if(!i)return;let a=Number(/\[(\d+)\]/.exec(t.field)?.[1]);t.kind===`next`&&`Next`in i&&(delete i.Next,i.End=!0),t.kind===`rule`&&i.Type===`Choice`&&(i.Choices=i.Choices.filter((e,t)=>t!==a)),t.kind==="default"&&i.Type===`Choice`&&delete i.Default,t.kind===`catch`&&`Catch`in i&&i.Catch&&(i.Catch=i.Catch.filter((e,t)=>t!==a),i.Catch.length===0&&delete i.Catch)}),pt=(e,t,n)=>k(e,e=>{let{scope:r,name:i}=w(t);M(e,r).States[i]=n}),mt=(e,t,n)=>{e.States=Object.fromEntries(Object.entries(e.States).map(([e,r])=>[e===t?n:e,r])),e.StartAt===t&&(e.StartAt=n);for(let r of Object.values(e.States)){if(`Next`in r&&r.Next===t&&(r.Next=n),r.Type===`Choice`){for(let e of r.Choices??[])e.Next===t&&(e.Next=n);r.Default===t&&(r.Default=n)}if(`Catch`in r)for(let e of r.Catch??[])e.Next===t&&(e.Next=n)}},ht=e=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)&&![`true`,`false`,`null`].includes(e)?e:`\`${e}\``,gt=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),F=(e,t,n)=>{if(typeof e==`string`){if(!e.trimStart().startsWith(`{%`))return e;let r=RegExp(`\\$states\\.context\\.Steps\\.(?:${gt(t)}(?![A-Za-z0-9_])|\`${gt(t)}\`)`,`g`);return e.split(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\/\*[\s\S]*?\*\/)/).map((e,t)=>t%2==1?e:e.replace(r,()=>`$states.context.Steps.${ht(n)}`)).join(``)}return Array.isArray(e)?e.map(e=>F(e,t,n)):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,F(r,t,n)])):e},_t=(e,t,n)=>k(e,e=>{let{scope:r,name:i}=w(t);mt(M(e,r),i,n),e.stateMachine=F(e.stateMachine,i,n)}),vt=(e,t)=>k(e,e=>{let{scope:n,name:r}=w(t);M(e,n).StartAt=r}),yt=(e,t)=>k(e,e=>{e.trigger=t}),I=e=>typeof e==`object`&&!!e&&!Array.isArray(e),bt=e=>Array.isArray(e.enum)&&e.enum.every(e=>typeof e==`string`)?{kind:`choice`,options:e.enum}:e.type===`string`?{kind:`text`}:e.type===`number`||e.type===`integer`||e.type===`boolean`?{kind:`value`}:e.type===`array`&&I(e.items)&&e.items.type===`string`?{kind:`names`}:{kind:`json`},L=e=>{let t=I(e.properties)?e.properties:{},n=Array.isArray(e.required)?e.required:[];return Object.entries(t).map(([e,t])=>{let r=I(t)?t:{},i=typeof r.title==`string`?r.title:void 0;return{name:e,...bt(r),required:n.includes(e),...i&&{title:i}}})},R=e=>e.message.startsWith(`is missing`),xt=e=>new Map([...e].map(([e,t])=>[e,t.filter(e=>!R(e))])),St=e=>{let t=new Map,n=[],r=(e,n)=>t.set(e,[...t.get(e)??[],n]);for(let{state:t,field:i,message:a}of e){let e={...i!==void 0&&{field:i},message:a};t===void 0?i?.startsWith(`trigger`)||i===`StartAt`||i===`stateMachine.StartAt`?r(``,e):n.push(e):r(t,e)}return{byNode:t,whole:n}},Ct=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),wt=e=>t=>e.flatMap(e=>{let n=t[e.name];return n===void 0||n===``?e.required?[{field:e.name,message:`is missing`}]:[]:e.kind===`names`&&!Ct(n)?[{field:e.name,message:`is a list of names, separated by commas`}]:[]}),Tt=(e,t,n)=>{let r=t.step_types.filter(e=>e.available),i=t.triggers.filter(e=>e.available&&e.id!==`manual`),a=[...t.step_types,...t.triggers].filter(e=>!e.available);return Te(e,{resources:r.map(e=>e.id),required:Object.fromEntries(r.map(e=>[e.id,L(e.input).filter(e=>e.required).map(e=>e.name)])),triggers:Object.fromEntries(i.map(e=>[e.id,wt(L(e.input))])),unavailable:Object.fromEntries(a.map(e=>[e.id,e.reason??``])),versioned:ke(r.map(e=>e.id)),...n&&{pins:n}})},Et=e=>{let t=new Map;for(let{state:n,field:r,message:i}of we(e))n!==void 0&&t.set(n,[...t.get(n)??[],{...r!==void 0&&{field:r},message:i}]);return t},z=e(n(),1),B=({problems:e})=>e.length>0&&(0,z.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-body text-danger-text`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,z.jsx)(oe,{className:`size-4`,"aria-hidden":`true`}),e.every(R)?D(`fillInToSave`,{count:e.length}):D(`cannotSave`,{count:e.length})]}),(0,z.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,z.jsx)(`li`,{children:e.field?D(`fieldProblem`,{field:e.field,message:e.message}):e.message},t))})]}),Dt=({warnings:e})=>e.length>0&&(0,z.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning-soft px-3 py-2 text-body text-warning-text`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,z.jsx)(ie,{className:`size-4`,"aria-hidden":`true`}),D(`warningsSaveAnyway`,{count:e.length})]}),(0,z.jsx)(`ul`,{className:`mt-1 list-disc pl-6`,children:e.map((e,t)=>(0,z.jsx)(`li`,{children:e.field?D(`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===``?D(`nameNeeded`):o!==e&&t.includes(o)?D(`nameTaken`):void 0,c=()=>{!s&&o!==e&&r(o)};return(0,z.jsx)(f,{label:D(`name`),error:s,children:(0,z.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:i,error:a,disabled:o,onChange:s})=>(0,z.jsx)(f,{label:e,error:a,children:(0,z.jsxs)(r,{invalid:!!a,value:t??``,disabled:o,onChange:e=>s(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:i}),t!==void 0&&!n.includes(t)&&(0,z.jsx)(`option`,{value:t,children:t}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]})}),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:i,help:a,value:o,error:c,onChange:l,disabled:u,read:p=It[t],write:ee=t===`names`?Mt:kt})=>{let[m,te]=(0,V.useState)(),h=m!==void 0&&JSON.stringify(p(m))===JSON.stringify(o)?m:ee(o),ne=Pt(),re=e=>{te(e),l(p(e))},ie=ne!==void 0&&!u&&(o==null||typeof o==`string`)&&(t===`text`||t===`json`||t===`value`);return(0,z.jsxs)(f,{label:e,required:i,help:a,error:c,wide:t===`json`,children:[t===`choice`?(0,z.jsxs)(r,{invalid:!!c,value:h,disabled:u,onChange:e=>l(e.target.value===``?void 0:e.target.value),children:[(0,z.jsx)(`option`,{value:``,children:D(`defaultChoice`)}),n.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]}):t===`json`?(0,z.jsx)(s,{invalid:!!c,rows:2,className:`font-mono text-xs`,value:h,disabled:u,onChange:e=>re(e.target.value)}):(0,z.jsx)(d,{invalid:!!c,value:h,disabled:u,onChange:e=>re(e.target.value)}),ie&&(0,z.jsx)(`button`,{type:`button`,"aria-label":D(`insertValueInto`,{field:e}),className:`mt-1 text-xs font-medium text-primary-text hover:underline max-md:min-h-11`,onClick:()=>ne({label:e,value:o,set:l}),children:D(`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:i})=>{let a=e.Catch??[],o=t=>{let{Catch:n,...r}=e;i(t.length>0?{...r,Catch:t}:r)},s=(e,t)=>o(a.map((n,r)=>r===e?t:n));return(0,z.jsxs)(z.Fragment,{children:[a.map((e,i)=>(0,z.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border border-danger/40 p-3`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-xs font-medium text-danger-text`,children:D(`errorPathNumber`,{number:i+1})}),(0,z.jsx)(W,{label:D(`errors`),kind:`text`,help:D(`errorsHelp`),value:e.ErrorEquals??[],read:Lt,write:Rt,error:H(n,`Catch[${i}].ErrorEquals`),disabled:r,onChange:t=>s(i,{...e,ErrorEquals:t})}),(0,z.jsx)(U,{label:D(`thenGoesTo`),value:e.Next||void 0,names:t,none:D(`chooseStep`),error:H(n,`Catch[${i}].Next`),disabled:r,onChange:t=>s(i,{...e,Next:t??``})}),!r&&(0,z.jsxs)(m,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>o(a.filter((e,t)=>t!==i)),children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeErrorPath`)]})]},i)),!r&&(0,z.jsx)(`div`,{children:(0,z.jsxs)(m,{size:`sm`,onClick:()=>o([...a,{ErrorEquals:[`States.ALL`],Next:``}]),children:[(0,z.jsx)(ae,{className:`size-3.5`}),D(`addErrorPath`)]})})]})},zt=({state:e,names:t,problems:n,disabled:r,onChange:i})=>{let a=e.Choices??[],o=(t,n)=>i({...e,Choices:a.map((e,r)=>r===t?n:e)});return(0,z.jsxs)(z.Fragment,{children:[a.map((s,c)=>(0,z.jsxs)(`fieldset`,{className:`flex flex-col gap-3 rounded-md border p-3`,children:[(0,z.jsx)(`legend`,{className:`px-1 text-xs font-medium text-muted-foreground`,children:D(`ruleNumber`,{number:c+1})}),(0,z.jsx)(W,{label:D(`condition`),kind:`text`,help:D(`conditionHelp`),value:s.Condition,error:H(n,`Choices[${c}].Condition`),disabled:r,onChange:e=>o(c,{...s,Condition:typeof e==`string`?e:``})}),(0,z.jsx)(U,{label:D(`thenGoesTo`),value:s.Next||void 0,names:t,none:D(`chooseStep`),error:H(n,`Choices[${c}].Next`),disabled:r,onChange:e=>o(c,{...s,Next:e??``})}),!r&&(0,z.jsxs)(m,{size:`sm`,variant:`ghost`,className:`self-start`,onClick:()=>i({...e,Choices:a.filter((e,t)=>t!==c)}),children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeRule`)]})]},c)),!r&&(0,z.jsx)(`div`,{children:(0,z.jsxs)(m,{size:`sm`,onClick:()=>i({...e,Choices:[...a,{Condition:``,Next:``}]}),children:[(0,z.jsx)(ae,{className:`size-3.5`}),D(`addRule`)]})}),(0,z.jsx)(U,{label:D(`otherwiseGoesTo`),value:e.Default,names:t,none:D(`noDefault`),error:H(n,`Default`),disabled:r,onChange:t=>{let{Default:n,...r}=e;i(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=ve(e,t);return o?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`cacheResults`),help:D(o.forces?`cacheForceHelp`:`cacheHelp`),children:(0,z.jsx)(u,{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,z.jsx)(re,{title:D(`cacheConfirmTitle`),description:o.disclaimer,onClose:()=>a(!1),actions:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(m,{onClick:()=>a(!1),children:D(`cacheCancel`)}),(0,z.jsx)(m,{variant:`primary`,onClick:()=>(a(!1),r(K(e,!0))),children:D(`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}=b(e.Resource);if(t){let{Cache:t,...r}=e;return{...r,Resource:`${n}${be}`}}let{HeartbeatSeconds:r,TimeoutSeconds:i,...a}=e;return{...a,Resource:n,...i!==void 0&&i<=Se.taskTimeoutSeconds&&{TimeoutSeconds:i}}},Ut=e=>Oe(e)===void 0,Wt=(e,t)=>({...e,Resource:`${t}${b(e.Resource).waits&&Ut(t)?be:``}`}),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:i,onChange:a})=>{let o=t.step_types.filter(e=>e.available),{type:s,waits:c}=b(e.Resource),l=Ut(s),d=t.step_types.find(e=>e.id===s),p=typeof e.Arguments==`string`||!d;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`stepType`),error:H(n,`Resource`),children:(0,z.jsxs)(r,{value:s,disabled:i,onChange:t=>a(Wt(e,t.target.value)),children:[!o.some(e=>e.id===s)&&(0,z.jsx)(`option`,{value:s,children:ge(s,d?.label)}),o.map(e=>(0,z.jsx)(`option`,{value:e.id,children:ge(e.id,e.label)},e.id))]})}),p?(0,z.jsx)(W,{label:D(`arguments`),kind:`json`,value:e.Arguments,error:H(n,`Arguments`),disabled:i,onChange:t=>a({...e,Arguments:t??{}})}):L(d.input).map(t=>(0,z.jsx)(W,{label:ce(t.name,t.title),kind:t.kind,options:t.options,required:t.required,...t.kind===`names`&&{help:D(`namesHelp`)},value:e.Arguments?.[t.name],error:H(n,`Arguments.${t.name}`),disabled:i,onChange:n=>a(Gt(e,t.name,n))},`${s}:${t.name}`)),l&&(0,z.jsx)(f,{label:D(`waitsForResult`),help:D(`waitsForResultHelp`),children:(0,z.jsx)(u,{checked:c,onChange:t=>!i&&a(Ht(e,t))})}),c||!l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(W,{label:D(`waitTimeout`),help:D(`waitTimeoutHelp`),kind:`json`,value:e.TimeoutSeconds,error:H(n,`TimeoutSeconds`),disabled:i,onChange:t=>a(Vt(e,`TimeoutSeconds`,t))}),(0,z.jsx)(W,{label:D(`heartbeatSeconds`),help:D(`heartbeatHelp`),kind:`json`,value:e.HeartbeatSeconds,error:H(n,`HeartbeatSeconds`),disabled:i,onChange:t=>a(Vt(e,`HeartbeatSeconds`,t))})]}):(0,z.jsx)(Bt,{state:e,types:t,disabled:i,onChange:a})]})},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,z.jsx)(W,{label:D(`onlyWhen`),kind:`text`,help:D(`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,z.jsx)(qt,{...e});let o=t;return(0,z.jsx)(U,{label:D(`goesOnTo`),value:o.Next,names:n,none:D(`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,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Kt,{state:t,types:n,problems:r,disabled:i,onChange:a}),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]});if(t.Type===`Choice`)return(0,z.jsx)(zt,{...e,state:t});if(t.Type===`Map`)return(0,z.jsxs)(z.Fragment,{children:[o(`Items`,D(`items`),`json`,D(`itemsHelp`)),o(`MaxConcurrency`,D(`maxConcurrency`),`json`),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]});if(t.Type===`Block`){let n=(e,n,o,s)=>(0,z.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,z.jsxs)(z.Fragment,{children:[o(`Arguments`,D(`blockArguments`),`json`,D(`blockArgumentsHelp`)),n(`Ttl`,D(`blockTtl`),`text`,D(`blockTtlHelp`)),n(`Key`,D(`blockKey`),`json`,D(`blockKeyHelp`)),(0,z.jsx)(J,{...e}),!e.data&&(0,z.jsx)(G,{...e,state:t})]})}return t.Type===`Wait`?(0,z.jsxs)(z.Fragment,{children:[o(`Seconds`,D(`seconds`),`json`),(0,z.jsx)(J,{...e})]}):t.Type===`Pass`?(0,z.jsxs)(z.Fragment,{children:[o(`Output`,D(`output`),`json`,D(`outputHelp`)),(0,z.jsx)(J,{...e})]}):t.Type===`Succeed`?o(`Output`,D(`output`),`json`,D(`outputHelp`)):t.Type===`Fail`?(0,z.jsxs)(z.Fragment,{children:[e.data&&(0,z.jsx)(qt,{...e}),o(`Error`,D(`error`),`text`),o(`Cause`,D(`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:i,onChange:a})=>{let o=fe(e),s=t.triggers.filter(e=>e.available),c=s.find(e=>e.id===o),l=o!==void 0&&!c?o:void 0,u=o===void 0?{}:e[o]??{};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{label:D(`startsWhen`),error:H(n,`trigger`),help:l&&D(`triggerOtherHelp`),children:(0,z.jsxs)(r,{value:o??``,disabled:i,onChange:e=>a({[e.target.value]:{}}),children:[l!==void 0&&(0,z.jsx)(`option`,{value:l,children:de(l,t.triggers.find(e=>e.id===l)?.label)}),o===void 0&&(0,z.jsx)(`option`,{value:``,children:D(`triggerUnknown`)}),s.map(e=>(0,z.jsx)(`option`,{value:e.id,children:de(e.id,e.label)},e.id))]})}),c&&L(c.input).map(e=>(0,z.jsx)(W,{label:ce(e.name,e.title),kind:e.kind,options:e.options,required:e.required,...e.kind===`names`&&{help:D(`namesHelp`)},value:u[e.name],error:H(n,`trigger.${c.id}.${e.name}`),disabled:i,onChange:t=>a(Yt(c.id,u,e.name,t))},`${c.id}:${e.name}`)),l!==void 0&&(0,z.jsx)(W,{label:D(`triggerInput`),kind:`json`,value:u,error:H(n,`trigger.${l}`),disabled:!0,onChange:()=>void 0})]})},Zt=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.Type==`string`,Qt=({kind:e,name:t})=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e}),(0,z.jsx)(`h3`,{className:`truncate font-semibold text-foreground`,children:t})]}),$t=({definition:e,types:t,selected:n,problems:r,warnings:i=[],onChange:a,onSelect:o})=>{let s=C(e,n);if(!s)return null;let{scope:c,name:l}=w(n),u=E(e,c),d=!a,f=e=>a?.(e);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Qt,{kind:ye(s,t),name:l}),(0,z.jsx)(B,{problems:r}),(0,z.jsx)(Dt,{warnings:i}),(0,z.jsx)(Ot,{name:l,taken:Ne(e.stateMachine),disabled:d,onRename:t=>{f(_t(e,n,t)),o(Me(c,t))}},n),(0,z.jsx)(Jt,{state:s,types:t,names:Object.keys(u.States),problems:r,disabled:d,data:y(e)===`data`,onChange:t=>f(pt(e,n,t))}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-body font-medium text-muted-foreground`,children:D(`asJson`)}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{label:D(`stepJson`),kind:`json`,help:D(`stepJsonHelp`),value:s,disabled:d,onChange:t=>{Zt(t)&&f(pt(e,n,t))}},n)})]}),a&&(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[y(e)===`sequence`&&u.StartAt!==l&&(0,z.jsxs)(m,{size:`sm`,onClick:()=>f(vt(e,n)),children:[(0,z.jsx)(He,{className:`size-3.5`}),D(`startHere`)]}),(0,z.jsxs)(m,{size:`sm`,variant:`danger`,onClick:()=>{f(ut(e,n)),o(void 0)},children:[(0,z.jsx)(g,{className:`size-3.5`}),D(`removeStep`)]})]})]})},en=e=>{let{definition:t,types:n,selected:r,problems:i,onChange:a}=e;return(0,z.jsx)(`section`,{"aria-label":D(`chosenStep`),className:`flex flex-col gap-4 rounded-lg border bg-background p-4`,children:r===``?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Qt,{kind:D(`trigger`),name:me(t.trigger,n)}),(0,z.jsx)(B,{problems:i}),(0,z.jsx)(Xt,{trigger:t.trigger,types:n,problems:i,disabled:!a,onChange:e=>a?.(yt(t,e))})]}):(0,z.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}=w(t),s=E(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&&v(n)?sn(n,t.slice(1)):void 0},cn=(e,t,n)=>({...e,sides:e.sides.map((e,r)=>r===t?n:e)}),ln=(e,t,n)=>{if(t.length===0)return n(e);let r=e.sides[t[0]],i=r&&v(r)?ln(r,t.slice(1),n):void 0;return i&&cn(e,t[0],i)},un=(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!v(n)&&`value`in n&&typeof n.value==`string`?cn(e,1,{pattern:n.value||`.*`,flags:e.sides[1].flags}):void 0;if(e.kind!==`compare`&&e.kind!==`matches`||!v(n))return cn(e,t,n)}},dn=(e,t,n,r)=>{let i=x(C(e,t)?.Condition),a=i&&n.length>0&&ln(i,n.slice(0,-1),e=>un(e,n.at(-1),r));return a&&x(S(a))?Y(e,t,[T],S(a)):e},fn=(e,t,n,r)=>{let i=C(e,t)?.Condition;if(n.length===0)return i!==void 0&&i!==``?e:Y(e,t,[T],r===`expression`?on:S(an(r)));let a=x(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||v(c)||!(`value`in c))?e:dn(e,t,n,an(r))},pn=(e,t,n)=>{if(n.length===0)return Y(e,t,[T],void 0);let r=x(C(e,t)?.Condition),i=n.at(-1),a=r&&ln(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)}:un(e,i,rn(e))});return a?Y(e,t,[T],S(a)):e},mn=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},hn=(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(...mn(i)))}return[...n]},gn=e=>e.StartAt===void 0?Object.keys(e.States):hn(e,e.StartAt),_n=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`},vn=(e,t,n)=>t.flatMap(t=>{let r=e.States[t];if(!r)return[];let i=_(r),a=i?vn(i,gn(i),n):[];return r.Type===`Task`?(n?.step_types.find(e=>e.id===r.Resource)?.writes??!0)===!1||_n(r)?[]:[{name:t,kind:ye(r,n)}]:a}),yn=(e,t)=>{if(!e||t||!(`Assign`in e)||!e.Assign)return e;let n=Object.fromEntries(Object.entries(e.Assign).filter(([,e])=>e!==De)),{Assign:r,...i}=e;return Object.keys(n).length===0?i:{...i,Assign:n}},bn=(e,t,n)=>{let r=e?.stateMachine.States[n],i=r!==void 0&&`Output`in r;return JSON.stringify(yn(r,i))!==JSON.stringify(yn(t.stateMachine.States[n],i))},xn=(e,t)=>{let n=Ce(e),r=new Set([t]);for(let e=!0;e;){e=!1;for(let[t,i]of n)!r.has(t)&&[...Ee(i)].some(e=>r.has(e))&&(r.add(t),e=!0)}return Object.keys(e.States).filter(e=>r.has(e))},Sn=(e,t,n=e.stateMachine.StartAt)=>{let r=e.stateMachine;return vn(r,y(e)===`data`?n===void 0?gn(r):xn(r,n):n===void 0?gn(r):hn(r,n),t)},Cn=/^[A-Za-z_][A-Za-z0-9_]*$/,wn=e=>Cn.test(e)?e:`\`${e.replaceAll("`",``)}\``,X=e=>{let t=JSON.stringify(e)??``;return t.length>60?`${t.slice(0,59)}…`:t},Tn=100,En=4,Dn=e=>{let t=[{path:``,sample:X(e)}],n=(e,r,i)=>{if(!(i===En||typeof r!=`object`||!r||t.length>=Tn)){if(Array.isArray(r)){if(r.length===0)return;let a=`${e}[0]`;t.push({path:a,sample:X(r[0])}),n(a,r[0],i+1);return}for(let[a,o]of Object.entries(r)){let r=e===``?wn(a):`${e}.${wn(a)}`;t.push({path:r,sample:X(o)}),n(r,o,i+1)}}};return n(``,e,0),t.slice(0,Tn)},On=(e,t)=>t===``?e:`${e}${t.startsWith(`[`)?``:`.`}${t}`,kn=(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} %}`},An=(e,t)=>{let{scope:n,name:r}=w(t),i=(e,t,n)=>Object.keys(e.States).filter(n=>n!==t&&hn(e,n).includes(t)).filter(t=>[`Task`,`Map`,`Block`].includes(e.States[t].Type)).map(e=>[...n,e].join(`/`)),a=i(E(e,n),r,n),o=n.findLastIndex((t,r)=>E(e,n.slice(0,r))?.States[n[r]]?.Type===`Block`);return[...n.flatMap((t,r)=>r<=o?[]:i(E(e,n.slice(0,r)),t,n.slice(0,r))),...a]},jn=`{% $states.result %}`,Mn=(e,t)=>{let{scope:n,name:r}=w(t),i=E(e,n)?.States[r];return i!==void 0&&`Output`in i},Nn=e=>`Assign`in e&&e.Assign?e.Assign:{},Pn=e=>Object.values(e.States).flatMap(e=>[...Object.keys(Nn(e)),..._(e)?Pn(_(e)):[]]),Fn=(e,t)=>{let n=t.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^(\d)/,`step_$1`)||`value`,r=new Set(Pn(e.stateMachine));if(!r.has(n))return n;let i=2;for(;r.has(`${n}_${i}`);)i++;return`${n}_${i}`},In=(e,t)=>{let{scope:n,name:r}=w(t),i=E(e,n).States[r],a=Object.entries(Nn(i)).find(([,e])=>e===jn);if(a)return{definition:e,variable:a[0],added:!1};let o=Fn(e,r),s=structuredClone(e),c=E(s,n).States[r];return c.Assign={...c.Assign,[o]:jn},{definition:s,variable:o,added:!0}},Z=(e,t)=>e.pure.find(e=>e.id===t),Ln=(e,t)=>{let n=he(t.handle);if(!n)return;let r=Z(e,t.node);return r?r.kind===`break`?{node:r.source,path:[...r.path,...n]}:void 0:{node:t.node,path:n}},Rn=(e,t)=>{let n=se(t.handle);if(n===void 0)return;let r=Z(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:[T],side:{node:r,at:[...r.at,Number(n)]}}},zn=(e,t)=>e.path.length===1&&e.path[0]===`#status`&&t.keys.length===1&&t.keys[0]===`#condition`&&!t.side,Bn=(e,t,n)=>{let r=Z(e,t.node);if(n===`out`){let n=he(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=se(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},Vn=(e,t)=>w(t).scope.some((t,n,r)=>C(e,r.slice(0,n+1).join(`/`))?.Type===`Block`),Hn=(e,t)=>{let{scope:n}=w(t);for(let t=n.length;t>0;t--)if(C(e,n.slice(0,t).join(`/`))?.Type===`Block`)return n.slice(0,t).join(`/`)},Un=(e,t,n)=>{let{scope:r,name:i}=w(t);if(w(n).scope.join(`/`)!==r.join(`/`))return!1;let a=Ce(E(e,r)),o=new Set,s=[i];for(;s.length>0;){let e=s.pop();if(e===w(n).name)return!0;o.has(e)||(o.add(e),s.push(...Ee(a.get(e)??{data:new Set,status:new Set,handled:new Set})))}return!1},Wn=(e,t,n,r)=>{let i=Ln(t,n),a=Rn(t,r);if(!i||!a)return{reason:`notPins`};let o=Hn(e,a.step);if(o!==void 0&&i.node!==``&&!i.node.startsWith(`${o}/`))return{reason:`otherScope`,step:w(i.node).name};if(y(e)===`data`&&i.node!==``){let[t,n]=[w(i.node).scope.join(`/`),w(a.step).scope.join(`/`)];if(t!==``&&t!==n&&!n.startsWith(`${t}/`))return{reason:`otherScope`,step:w(i.node).name};if(Un(e,i.node,a.step))return{reason:`notBefore`,step:w(i.node).name};if(i.path[0]!==`#status`&&Mn(e,i.node))return{reason:`shapesOutput`,step:w(i.node).name}}else if(i.node===``){if(Vn(e,a.step))return{reason:`notBefore`,step:w(a.step).name}}else{if(!An(e,a.step).includes(i.node))return{reason:`notBefore`,step:w(i.node).name};if(Mn(e,i.node))return{reason:`shapesOutput`,step:w(i.node).name}}if(zn(i,a))return;let s=Bn(t,n,`out`),c=Bn(t,r,`in`);if(s&&c&&!xe(s,c))return{reason:`type`,source:s,target:c}},Gn=(e,t,n,r)=>{if(Wn(e,t,n,r))return e;let i=Ln(t,n),a=Rn(t,r),o=e,s;if(i.node===``)s={base:{input:!0},path:i.path};else if(i.path[0]===`#status`)s={base:{step:w(i.node).name},path:i.path.slice(1)};else{let t=In(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?dn(o,a.step,a.side.at,{read:c}):a.select?Y(o,a.step,a.keys,Ae({...a.select.part,operand:{read:c}})):zn(i,a)?Y(o,a.step,a.keys,S({kind:`compare`,op:`=`,sides:[{read:c},{value:`SUCCEEDED`}]})):Y(o,a.step,a.keys,je(s))},Kn=(e,t,n)=>{let r=Rn(t,{node:n.target,handle:n.targetHandle});if(r?.side)return pn(e,r.step,r.side.at);if(r?.select)return Y(e,r.step,r.keys,Ae({...r.select.part,operand:{value:``}}));if(r)return Y(e,r.step,r.keys,void 0);let i=Z(t,n.target)??Z(t,n.source);return i?qn(e,t,i):e},qn=(e,t,n)=>{if(n.kind===`make`||n.kind===`select`)return Y(e,n.target,[n.key],void 0);if(n.kind===`condition`)return pn(e,n.target,n.at);let r=e=>t.edges.filter(t=>t.source===e.id&&!t.expression).flatMap(e=>{let n=Z(t,e.target);return n?.kind===`break`?r(n):[e]});return _e(t,r(n),e=>pe(t,e)).reduce((e,n)=>Kn(e,t,n),e)},Jn=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`,Yn={connect:dt,disconnect:ft,removeState:ut,setArgument:Y,connectData:Gn,disconnectData:Kn,removePure:qn,wireRefusal:Wn,addCondition:fn,conditionChoices:nn,setConditionSide:dn,addSelect:(e,t,n)=>{let r=C(e,t)?.Arguments?.[n];if(r!==void 0&&!Jn(r)||typeof r==`string`&&r.startsWith(`{%`))return e;let i=r??``;return Y(e,t,[n],Ae({operand:{value:``},cases:[{when:``,then:i}],otherwise:i}))}},Xn=(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&&Re(i,r,n[e]?.names?.singular??h(e),ze(e=>t[e]))},emails:t=>{let n=e.templates?.find(e=>e.name===t);return n&&{schema:n.schema,languages:n.languages}}}),Zn=e=>{let{data:t}=te();return(0,V.useMemo)(()=>Xn(e,t?.resources??{},t?.views),[e,t?.resources,t?.views])},Q=ne(`app/field-types/workflow-page`),Qn={"app:http":{icon:Ke,keywords:[`api`,`fetch`,`url`,`webhook`,`get`,`post`]},"app:mail.send":{icon:i,keywords:[`email`,`send`,`message`]},"app:records.create":{icon:O,keywords:[`insert`,`add`,`new`,`row`]},"app:records.update":{icon:O,keywords:[`change`,`edit`,`row`]},"app:records.get":{icon:O,keywords:[`read`,`find`,`row`]},"app:records.list":{icon:O,keywords:[`read`,`find`,`query`,`rows`]}},$n=[{type:`Choice`,icon:We,description:()=>Q(`flowChoice`),keywords:[`if`,`branch`,`switch`,`condition`]},{type:`Map`,icon:Xe,description:()=>Q(`flowMap`),keywords:[`loop`,`each`,`list`,`repeat`]},{type:`Block`,icon:a,description:()=>Q(`flowBlock`),keywords:[`cache`,`once`,`group`,`reuse`,`wrap`]},{type:`Wait`,icon:Qe,description:()=>Q(`flowWait`),keywords:[`delay`,`sleep`,`pause`,`later`]},{type:`Pass`,icon:Je,description:()=>Q(`flowPass`),keywords:[`variable`,`assign`,`transform`]},{type:`Succeed`,icon:c,description:()=>Q(`flowSucceed`),keywords:[`end`,`stop`,`done`]},{type:`Fail`,icon:o,description:()=>Q(`flowFail`),keywords:[`end`,`stop`,`error`]}],er=e=>({id:`task:${e.id}`,title:ue(e.id,e.label),description:e.description,keywords:[e.id,...Qn[e.id]?.keywords??[]],icon:Qn[e.id]?.icon??(e.id.startsWith(`app:`)?ee:p)}),$=e=>e.slice(0,Math.max(e.indexOf(`:`),0)),tr=e=>e===`custom`?Q(`customSteps`):e,nr=e=>{let t=new Set(Object.values(ke(e.step_types.map(e=>e.id)))),n=e.step_types.filter(e=>e.available&&(!Oe(e.id)||t.has(e.id))),r=[...new Set(n.map(e=>$(e.id)).filter(e=>e!==`app`))];return[{title:Q(`builtIn`),items:n.filter(e=>$(e.id)===`app`).map(er)},...r.map(e=>({title:tr(e),items:n.filter(t=>$(t.id)===e).map(er)})),{title:Q(`flow`),items:$n.map(e=>({id:`type:${e.type}`,title:le(e.type),description:e.description(),keywords:e.keywords,icon:e.icon}))}].filter(e=>e.items.length>0)},rr=e=>e.startsWith(`task:`)?{task:e.slice(5)}:{type:e.slice(5)};export{ht as A,st as C,at as D,$e as E,nt as O,N as S,ct as T,Tt as _,Yn as a,Et as b,Dn as c,kn as d,bn as f,B as g,Nt as h,Zn as i,rt as k,Mn as l,en as m,nr as n,An as o,Sn as p,Q as r,On as s,rr as t,In as u,R as v,ot as w,xt as x,St as y};
|
|
2
|
+
//# debugId=7d41bbd9-3ffc-42ce-a212-1d500a4be6f1
|
|
@@ -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{
|
|
2
|
-
//# debugId=
|
|
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{Bn as r,Vr as i,al as a,ea as o,fc as s,nl as c,ns as l,pc as u,qc as d,ss as f}from"./app-CwxoFZn2.js";import{l as p,m,n as h,u as g}from"./workflow-canvas-BkFimRd2.js";import{m as _}from"./workflows-Bey4jszG.js";import{E as v,T as y,n as b}from"./use-run-trace-5H4UJvB-.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=c(`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(a(),{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 a=f(),s=typeof e.type==`string`&&_(e.type)!==void 0&&a.resources.workflow_custom_step_jobs!==void 0&&a.permissions.workflow_custom_step_jobs?.read!==!1,c=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)(r,{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)}),c&&(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:o(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)(i,{to:{kind:`record`,resource:`workflow_runs`,key:e.run},className:d(u({size:`sm`}),`justify-self-start`),children:e.reused===!0?E(`openEarlierBlockRun`):E(`openBlockRun`)})]}),s&&(0,D.jsx)(i,{to:{kind:`list`,resource:`workflow_custom_step_jobs`,filter:`run_id = "${t}"`},className:d(u({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)(r,{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)(r,{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 a=b(e.id,!1),[o,c]=(0,x.useState)(20);if(a.isPending)return null;let l=(a.data??[]).filter(e=>e.state===t),d=n===void 0?void 0:(a.data??[]).filter(e=>e.state===n&&typeof e.run==`string`).at(-1)?.run;return l.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)(i,{to:{kind:`record`,resource:`workflow_runs`,key:d},className:u({size:`sm`})+` justify-self-start`,children:E(`openBlockRun`)})]}):l.length===0?(0,D.jsx)(`p`,{className:`text-body text-muted-foreground`,children:E(`notRun`)}):(0,D.jsxs)(`div`,{className:`grid gap-3`,children:[l.slice(0,o).map(t=>(0,D.jsx)(j,{step:t,runId:e.id,...r&&{valueActions:r}},String(t.id))),l.length>o&&(0,D.jsx)(s,{size:`sm`,className:`justify-self-start`,onClick:()=>c(o+20),children:E(`showMore`)})]})},P=({definition:e,run:t,selected:n,types:i})=>{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,i),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,i)}),(0,D.jsx)(O,{title:E(`runInput`),children:(0,D.jsx)(r,{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=b93e76fe-55b1-4d4f-b617-0eacaaea67e2
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,aa as i,bi as a,ca as o,cs as s,ia as c,ja as l,ka as u,lc as d,mi as f,ml as p,pa as m,qc as h,ra as g,ta as _,ua as v,vr as ee}from"./app-CwxoFZn2.js";import{_ as y,a as te,i as ne,n as re,o as b,t as ie,v as x}from"./lib-dnd-kit-core-xi-7xL_N.js";import{a as S,g as C,h as w,i as T,l as ae,m as oe,n as se,o as E,r as ce,t as le,u as D,v as O}from"./use-calendar-move-D_6TlMr4.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`?w(t):e===`month`?C(t):M(t)}),P=(e,t,n=m())=>N(e??{scale:`month`,day:v(t,n)}),F=(e,t)=>{let{scale:n,day:r}=N(e);return{scale:n,day:n===`week`?D(r,7*t):n===`month`?C(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=m())=>{let i=v(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`?_(j(t[0]),j(t.at(-1))):e.scale===`month`?g(j(t[0])):i(j(t[0]),j(C(t.at(-1))))},L=e=>{let t=I(e);if(e.scale===`week`)return t.map((e,t)=>({index:t,span:1,label:`${o(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:c(j(t[e]))}))},R=(e,t,n,r,i=m())=>{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,o=i===void 0?void 0:t.fields[i];if(i===void 0||!o)return[{key:``,rows:e}];let s=n?.fields[i],c=new Map;for(let t of e){let e=t.record[i],n=e==null||e===``,r=n?z:`value:${String(e)}`,l=n?f(`noValue`,{label:s?.label??p(i)}):t.labels[i]??a(o,e,s),u=c.get(r)??{value:n?void 0:e,lane:{key:r,label:l,rows:[]}};u.lane.rows.push(t),c.set(r,u)}let l=o.enumValues??[],u=(e,t)=>e.value===void 0||t.value===void 0?Number(e.value===void 0)-Number(t.value===void 0):o.type===`enum`?l.indexOf(String(e.value))-l.indexOf(String(t.value)):o.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[...c.values()].toSorted(u).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(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:h(`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(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:h(`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(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)(T,{model:e,view:t,display:n,row:r,day:s.start,movable:a,dragged:o,className:h(s.before&&`rounded-l-none border-l-0`,s.after&&`rounded-r-none border-r-0`)})})})]})},ge=()=>[{scale:`week`,label:f(`week`)},{scale:`month`,label:f(`month`)},{scale:`quarter`,label:f(`quarter`)}],W=({model:e,view:t,display:n,fields:i,filter:a,at:o,linkTo:c,now:h=Date.now()})=>{let[g,_]=(0,k.useState)(),C=P(c?o:g,h),w=I(C),T=L(C),A=ce({model:e,display:n,range:ue(C),fields:i,filter:a}),{moves:j,move:M}=se(e,n),N=B(oe(le(A.rows,j),n),e,t,n),R=s(e.name),z=u(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)/w.length,J=e=>{let t=q();return t>0?Math.round(e/t):0},_e=({transform:e})=>({...e,x:J(e.x)*q(),y:0}),ve=x(y(te,{activationConstraint:{distance:4}}),y(b,{activationConstraint:{delay:250,tolerance:5}}),y(ne,{keyboardCodes:{start:[`Space`],cancel:[`Escape`],end:[`Space`,`Enter`]},coordinateGetter:(e,{currentCoordinates:t})=>{let n=e.code===`ArrowLeft`?-1:+(e.code===`ArrowRight`);if(n!==0)return e.preventDefault(),{x:t.x+n*q(),y:t.y}}})),Y=v(h,m()),X=r=>E(e,t,n,r.row),Z=e=>r(Date.parse(`${D(e.day,G.current)}T00:00:00Z`)),ye={onDragStart:({active:e})=>f(`pickedUp`,{title:X(e.data.current)}),onDragMove:({active:e})=>f(`startsOn`,{title:X(e.data.current),day:Z(e.data.current)}),onDragOver:()=>void 0,onDragEnd:({active:e})=>G.current===0?f(`putBack`,{title:X(e.data.current)}):f(`wasMovedTo`,{title:X(e.data.current),to:Z(e.data.current)}),onDragCancel:({active:e})=>f(`cancelled`,{title:X(e.data.current)})},Q=()=>{U(void 0),setTimeout(()=>W.current=!1)},$=({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})=>{Q(),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??p(e.name):t?.fields[n.group]?.label??p(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)(ae,{heading:fe(C),unit:C.scale,previous:F(C,-1),today:P({scale:C.scale,day:Y},h),next:F(C,1),scales:ge().map(({scale:e,label:t})=>({view:de(C,e,h),label:t,current:C.scale===e})),scalesLabel:f(`timelineScale`),linkTo:c,onView:_}),A.error&&(0,V.jsx)(ee,{title:f(`couldNotLoadRows`),error:A.error}),A.capped&&(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f(`capped`,{limit:500,unit:C.scale})}),(0,V.jsxs)(ie,{sensors:ve,modifiers:[_e],onDragStart:$,onDragMove:be,onDragEnd:xe,onDragCancel:Q,accessibility:{announcements:ye,screenReaderInstructions:{draggable:f(`timelineInstructions`)}},children:[(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[(0,V.jsx)(pe,{ticks:T,days:w,today:Y,label:Se,trackRef:K}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(me,{ticks:T,days:w,today:Y}),A.loading&&(0,V.jsxs)(`div`,{className:`relative flex flex-col gap-2 p-2`,children:[(0,V.jsx)(d,{className:`h-4`}),(0,V.jsx)(d,{className:`h-4`})]}),Ce&&(0,V.jsx)(`p`,{className:`relative px-2 py-3 text-xs text-muted-foreground`,children:f(`nothingIn`,{unit:C.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:w,movable:z&&l(r.record,`update`),dragged:()=>W.current},r.key))]},r.key))]})]}),(0,V.jsx)(re,{children:H&&(0,V.jsx)(S,{model:e,view:t,display:n,row:H.row,day:H.day})})]})]})};export{W as TimelineDisplay};
|
|
2
|
+
//# debugId=216e8eb6-cf42-484a-8b16-dc1b2f54108a
|
|
@@ -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{
|
|
2
|
-
//# debugId=
|
|
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{Kc as e}from"./app-CwxoFZn2.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=18a915e7-f091-449f-8b02-eb1c422308ec
|
|
@@ -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{
|
|
2
|
-
//# debugId=
|
|
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{Kl as e,au as t,iu as n,nu as r,ru as i,tu as a}from"./app-CwxoFZn2.js";import{A as o}from"./vendor-t7Q7QbPu.js";var s=e=>()=>{throw Error(`Not implemented: ${e}() needs the database (the resource's search fields, trigram matching), so it cannot be evaluated against a record`)},c=(e,n,r)=>({...t,search:{...t.search,evaluate:r?e=>a(r,n,e):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:e}}),l=(e,t,n={})=>o(i(e,{expand:!0}),t,{functions:c(n.now??(()=>new Date),t,n.search)}),u=(e,t,n,r={})=>({name:e,kind:t,label:n.label,required:t!==`boolean`&&!n.optional,...n.help!==void 0&&{help:n.help},...n.when!==void 0&&{when:n.when},...n.default!==void 0&&{default:n.default},...r}),d={text:(e,t)=>u(e,`text`,t,{...t.multiline&&{multiline:!0},...t.max!==void 0&&{max:t.max}}),integer:(e,t)=>u(e,`integer`,t),decimal:(e,t)=>u(e,`decimal`,t),boolean:(e,t)=>u(e,`boolean`,t),secret:(e,t)=>u(e,`secret`,t),date:(e,t)=>u(e,`date`,t),choice:(e,t)=>u(e,`choice`,t,`options`in t?{options:t.options.map(({value:e,label:t})=>({value:e,label:t}))}:{resource:t.resource}),checklist:(e,t)=>u(e,`checklist`,t,{...`items`in t&&{items:[...t.items]},...`from`in t&&{from:t.from}}),custom:(e,t)=>u(e,`custom`,t,{component:t.component,...t.props!==void 0&&{props:t.props}})},f={text:`text`,integer:`integer`,decimal:`decimal`,boolean:`boolean`,date:`date`,choice:`text`,secret:`text`,checklist:`json`,custom:`json`},p=e=>({name:e.name,column:e.name,type:e.options?`enum`:f[e.kind],nullable:!0,readOnly:!1,filterable:e.kind!==`custom`&&e.kind!==`checklist`&&e.kind!==`secret`,sortable:!1,aliases:[],...e.options&&{enumValues:e.options.map(e=>e.value)}}),m=e=>({name:`inputs`,table:{name:`inputs`},fields:Object.fromEntries(e.map(e=>[e.name,p(e)])),primaryKey:[]}),h=(e,t)=>{let i=e[t].when;if(i===void 0)return;let a=n(i);if(!a.ok)return a.errors.map(e=>e.message).join(`; `);if(!a.ast)return`it is empty`;let o=r(m(e.slice(0,t)),a.ast);return o.ok?o.filter:o.errors.map(e=>e.message).join(`; `)},g=e=>e.kind===`checklist`?e.items===void 0==(e.from===void 0)?[`input "${e.name}": a checklist takes either "items" or "from"`]:e.items&&e.items.length===0?[`input "${e.name}": a checklist needs at least one item`]:[]:[],_=e=>e.flatMap((t,n)=>{let r=[];e.findIndex(e=>e.name===t.name)!==n&&r.push(`input "${t.name}" is declared twice`),t.kind===`secret`&&t.default!==void 0&&r.push(`input "${t.name}": a secret takes no default`),t.kind!==`secret`&&t.options&&t.default!==void 0&&!t.options.some(e=>e.value===t.default)&&r.push(`input "${t.name}": default "${String(t.default)}" is not one of its options`);let i=h(e,n);return typeof i==`string`&&r.push(`input "${t.name}": "when" is not a valid condition over the inputs before it: ${i}`),[...r,...g(t)]}),v=(e,t)=>{let n=new Set,r={};return e.forEach((i,a)=>{let o=h(e,a);if(typeof o==`string`)throw Error(`Input "${i.name}": ${o}`);let s=o===void 0||l(o,r)===!0;s&&n.add(i.name),r[i.name]=s?t[i.name]??null:null}),n},y=(t,n=[])=>Object.entries(t).flatMap(([t,r])=>{let i=typeof r==`string`?e(r):void 0;if(i===void 0)return[];let a=n.find(e=>e.name===i);return a?a.kind===`secret`?[`set "${t}" names secret input "${i}", which an update never writes; take it in an action's handler`]:[]:[`set "${t}" names input "${i}", which it does not ask for`]}),b=(t,n)=>Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=typeof r==`string`?e(r):void 0;return i===void 0?[[t,r]]:Object.hasOwn(n,i)?[[t,n[i]]]:[]}));export{v as a,d as i,b as n,_ as r,y as t};
|
|
2
|
+
//# debugId=c55840b1-fc41-4f45-902d-37ec91b55a95
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,$l as i,Ea as a,Eo as o,Rc as s,Vr as c,bi as l,da as u,eu as d,fa as f,fl as p,ma as m,mi as h,ms as ee,pa as g,pc as te,pi as _,qc as v,sa as y,ss as ne,ua as b,yn as x,za as S,zc as C}from"./app-CwxoFZn2.js";import{i as w}from"./vendor-t7Q7QbPu.js";import{r as re,t as T}from"./record-preview-BSqik7HQ.js";import{h as E}from"./lib-dnd-kit-core-xi-7xL_N.js";import{t as D}from"./use-display-rows-1Xjy5pR2.js";var O=e(t(),1),k=e(n(),1),A=864e5,j=e=>new Date(e).toISOString().slice(0,10),M=e=>Date.parse(`${e}T00:00:00Z`),N=(e,t)=>j(M(e)+t*A),P=e=>N(e,-((new Date(M(e)).getUTCDay()+6)%7)),F=(e,t=0)=>{let n=new Date(M(e));return j(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+t,1))},I=({scale:e,day:t})=>({scale:e,day:e===`month`?F(t):P(t)}),L=(e,t,n=g())=>I(e??{scale:`month`,day:b(t,n)}),R=(e,t,n=g())=>I({scale:e,day:b(t,n)}),z=(e,t)=>e.scale===`month`?{scale:`month`,day:F(e.day,t)}:{scale:`week`,day:N(P(e.day),7*t)},B=e=>{let t=P(e.scale===`month`?F(e.day):e.day),n=(M(e.scale===`month`?N(P(N(F(e.day,1),-1)),6):N(t,6))-M(t))/A+1;return Array.from({length:n},(e,n)=>N(t,n))},V=e=>{let t=B(e);return{from:t[0],to:N(t.at(-1),1)}},H=(e,t)=>t.fields[e.start]?.type===`timestamp`,U=(e,t,n,r=g())=>{let a=H(e,t),o=e=>new Date(f(e,r)).toISOString().replace(`.000Z`,`Z`),s=e=>a?{kind:`timestamp`,value:o(e),span:{start:0,end:0}}:{kind:`string`,value:e,span:{start:0,end:0}},c=i.and(i.gte(e.start,s(n.from)),i.lt(e.start,s(n.to)));if(e.end===void 0)return d(c);let l=a?i.gt(e.end,s(n.from)):i.gte(e.end,s(n.from));return d(i.or(c,i.and(i.lt(e.start,s(n.from)),l)))},W=(e,t)=>e===``?t:`(${e}) AND (${t})`,G=e=>{if(typeof e!=`string`)return;let t=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(e)?`${e}T00:00:00Z`:e);return Number.isNaN(t)?void 0:t},K=(e,t,n,r=g())=>{let i=G(e[t.start]);if(i===void 0)return;let a=H(t,n),o=e=>a?b(e,r):j(e),s=o(i),c=t.end===void 0?void 0:G(e[t.end]),l=c===void 0?s:o(a?c-1:c);return{first:s,last:l<s?s:l}},q=(e,t,n,r,i=g())=>{let a=K(e,t,n,i);return a?r.filter(e=>e>=a.first&&e<=a.last):[]},J=(e,t)=>e.toSorted((e,n)=>(G(e.record[t.start])??0)-(G(n.record[t.start])??0)),Y=(e,t,n,r,i=g())=>{let a=new Map(r.map(e=>[e,[]]));for(let o of J(e,t))for(let e of q(o.record,t,n,r,i))a.get(e).push(o);return a},ie=(e,t,n,r,i,a=g())=>{let o=(M(i)-M(r))/A,s=H(t,n),c=e=>{let t=G(e);if(t!==void 0)return s?new Date(u(t+m(t,a)+o*A,a)).toISOString():N(j(t),o)},l=c(e[t.start]),d=t.end===void 0?void 0:c(e[t.end]);return{...l!==void 0&&{[t.start]:l},...d!==void 0&&{[t.end]:d}}},ae=({heading:e,unit:t,previous:n,today:r,next:i,scales:a,scalesLabel:l,linkTo:u,onView:d})=>{let f=(e,t,n,r,i)=>u?(0,k.jsx)(c,{to:u(e),className:t,"aria-label":n,"aria-current":i?`page`:void 0,children:r}):(0,k.jsx)(`button`,{type:`button`,className:t,"aria-label":n,"aria-pressed":i,onClick:()=>d?.(e),children:r}),p=te({variant:`secondary`,size:`sm`});return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,k.jsx)(`h2`,{className:`text-sm font-medium`,children:e}),(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1`,children:[f(n,p,h(`previousPeriod`,{unit:t}),(0,k.jsx)(C,{className:`size-3.5`})),f(r,p,h(`today`),h(`today`)),f(i,p,h(`nextPeriod`,{unit:t}),(0,k.jsx)(s,{className:`size-3.5`}))]}),(0,k.jsx)(`span`,{role:`group`,"aria-label":l,className:o.group(),children:a.map(e=>(0,k.jsx)(O.Fragment,{children:f(e.view,o.option(e.current),e.label,e.label,e.current)},e.label))})]})]})},X=`day:`,Z=e=>`${X}${e}`,oe=(e,t)=>`${e}@${t}`,se=(e,{context:{active:t,collisionRect:n,droppableRects:r,over:i}})=>{let a={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7}[e.code],o=i?String(i.id).slice(4):t?.data.current?.day;if(a===void 0||!n||o===void 0)return;e.preventDefault();let s=r.get(Z(N(o,a)));if(s)return{x:s.left+(s.width-n.width)/2,y:s.top+4}},Q=(e,t,n,r)=>{let i=n.title??p(e,t),a=e.fields[i],o=r.labels[i]??(a?l(a,r.record[i],t?.fields[i]):``);return o===``?r.key:o},ce=(e,t,n,r)=>{let i=n.record[t.start];if(e.fields[t.start]?.type!==`timestamp`||typeof i!=`string`)return;let a=Date.parse(i);return b(a,g())===r?y(a):void 0},$=({model:e,view:t,display:n,row:r,day:i,className:a})=>{let o=T(e),s=ce(e,n,r,i);return(0,k.jsxs)(c,{to:{kind:`record`,resource:e.name,key:r.key},onClick:()=>o(r.record),className:v(`flex min-w-0 items-baseline gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-xs hover:border-border-strong hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30`,a),children:[s&&(0,k.jsx)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:s}),(0,k.jsx)(`span`,{className:`min-w-0 truncate`,children:Q(e,t,n,r)})]})},le=({movable:e,dragged:t,...n})=>{let{setNodeRef:r,setActivatorNodeRef:i,listeners:a,isDragging:o}=E({id:oe(n.row.key,n.day),data:{row:n.row,day:n.day},disabled:!e});return(0,k.jsx)(`div`,{ref:e=>{r(e),i(e?.querySelector(`a`)??e)},...a,onDragStart:e=>e.preventDefault(),onClickCapture:e=>{t()&&(e.preventDefault(),e.stopPropagation())},className:v(`min-w-0`,e&&`cursor-grab touch-manipulation`,o&&`opacity-40`),children:(0,k.jsx)($,{...n})})},ue=({model:e,display:t,range:n,fields:r,filter:i})=>{let{resources:a,views:o}=ne(),s=re({resources:a,views:o,model:e,columns:r,filter:W(i,U(t,e,n)),orderBy:`${t.start} asc`}),c=D(e,s.page,s.key,!0),l=c.more&&!c.loading&&c.rows.length<500;(0,O.useEffect)(()=>{l&&c.loadMore()},[l,c.rows.length]);let u=c.rows.length>500||c.rows.length===500&&c.more;return{rows:c.rows.slice(0,500),capped:u,loading:c.loading,error:c.error}},de=(e,t)=>{let n=new Map(t.map(e=>[e.key,e.patch]));return e.map(e=>n.has(e.key)?{...e,record:{...e.record,...n.get(e.key)}}:e)},fe=(e,t)=>{let n=ee(),i=S(),o=x(),[s,c]=(0,O.useState)([]),l=e=>c(t=>t.filter(t=>t.key!==e)),u=w({mutationFn:({row:t,patch:r})=>{let i=typeof t.record.etag==`string`?t.record.etag:`*`;return n.update(e.name,a(e,t.record),r,i)},onMutate:({row:e,patch:t})=>c(n=>[...n.filter(t=>t.key!==e.key),{key:e.key,patch:t}]),onError:(e,{row:t,to:n})=>{l(t.key),i.show({state:`error`,title:h(`couldNotMoveTo`,{to:r(Date.parse(`${n}T00:00:00Z`))}),description:_(e)})},onSettled:async(t,n,{row:r})=>{await o(e.name),l(r.key)}});return{moves:s,move:(n,r,i)=>u.mutate({row:n,patch:ie(n.record,t,e,r,i),to:i})}};export{V as _,$ as a,R as b,Z as c,Y as d,L as f,F as g,P as h,le as i,ae as l,J as m,fe as n,Q as o,B as p,ue as r,se as s,de as t,N as u,K as v,z as y};
|
|
2
|
+
//# debugId=ffe9394c-af8e-4e25-a2e9-31fc3b0ff901
|
|
@@ -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{
|
|
2
|
-
//# debugId=
|
|
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{Xr as e}from"./app-CwxoFZn2.js";import{r as t}from"./vendor-t7Q7QbPu.js";var n=(n,r,i,a)=>{let o=t({queryKey:[...i,`display`],enabled:a,initialPageParam:0,queryFn:({pageParam:e})=>r(e),getNextPageParam:(e,t)=>e.rows.length===40&&t.length*40<(t[0]?.total??0)?t.length:void 0}),s=o.data?.pages??[];return{resource:n.name,rows:s.flatMap(t=>t.rows.map(t=>e(n,t))),total:s[0]?.total??0,loading:o.isPending,error:o.error,more:o.hasNextPage,loadMore:()=>void o.fetchNextPage()}};export{n as t};
|
|
2
|
+
//# debugId=355e3cb9-a51d-4034-8921-5cc3fc58eaf8
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Mo as r,Na as i,Za as a,_s as o,al as s,fc as c,io as l,tl as u,vs as d,ws as f,ys as p}from"./app-CwxoFZn2.js";import{o as m}from"./vendor-t7Q7QbPu.js";var h=e(n(),1),g=({invitation:e,t,busy:n,joining:r,onJoin:i})=>{let a=f().organizations?.roles??[],o=e.organizationName??t(`anOrganization`),u=e.appRoles.map(e=>l(a,e)).join(`, `),d=t(`expires`,{date:new Date(e.expiresAt).toLocaleDateString(s(),{dateStyle:`long`})});return(0,h.jsxs)(`li`,{className:`flex flex-col gap-2 px-3 py-2.5 sm:flex-row sm:items-center sm:gap-3`,children:[(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`span`,{className:`block break-words font-medium`,children:o}),(0,h.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:u?`${u} · ${d}`:d})]}),(0,h.jsx)(c,{variant:`primary`,disabled:n,loading:r,busyLabel:t(`joining`,{name:o}),onClick:i,className:`min-h-10 w-full sm:min-h-0 sm:w-auto`,children:t(`join`,{name:o})})]})},_=e(t(),1),v=({onCreated:e,autoFocus:t=!1})=>{let{session:n}=f(),o=i(),[s,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(!1),{busy:p,error:m,run:g}=a(),v=(0,_.useId)(),y=(0,_.useRef)(null),b=()=>{if(!p){if(s.trim()===``){d(!0),y.current?.focus();return}g(async()=>{await n.organizations.create({name:s.trim()}),e()})}},x=u?o(`nameNeeded`):m;return(0,h.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:e=>{e.preventDefault(),b()},children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,h.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[o(`organizationName`),(0,h.jsx)(r,{ref:y,name:`organization`,autoComplete:`organization`,autoFocus:t,maxLength:200,value:s,invalid:u,"aria-describedby":u?v:void 0,onChange:e=>{l(e.target.value),d(!1)},className:`min-h-6`})]}),x&&(0,h.jsx)(`p`,{id:v,role:`alert`,className:`text-body font-medium text-danger-text`,children:x})]}),(0,h.jsx)(c,{variant:`primary`,type:`submit`,loading:p,busyLabel:o(`creating`),className:`min-h-10`,children:o(`createButton`)})]})},y=e=>{let{session:t}=f(),{busy:n,error:r,run:i}=a(),[o,s]=(0,_.useState)();return{busy:n,error:r,joining:n?o:void 0,join:n=>{s(n),i(async()=>{await t.organizations.acceptMine(n),e()})}}},b=()=>{let{session:e}=f(),t=(0,_.useContext)(o),n=m({queryKey:u.myInvitations,queryFn:()=>e.organizations.myInvitations(),retry:!1});return n.data&&d(n,t)?{state:`ready`,invitations:n.data}:p(n)?{state:`failed`,retry:()=>void n.refetch()}:{state:`loading`}};export{g as i,y as n,v as r,b as t};
|
|
2
|
+
//# debugId=ab485dfb-7411-4959-bbf4-37148de64315
|
|
@@ -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{
|
|
2
|
-
//# debugId=
|
|
1
|
+
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$o as r,Mo as i,bc as a,es as o,fc as s,nl as c}from"./app-CwxoFZn2.js";var l=c(`lists`),u=e(n(),1),d=({title:e,description:t,searchLabel:n,placeholder:c,query:d,onQuery:f,list:p,error:m,renderRow:h})=>(0,u.jsxs)(r,{title:e,description:t,children:[(0,u.jsx)(o,{message:m}),(0,u.jsx)(i,{"aria-label":n,placeholder:c,value:d,onChange:e=>f(e.target.value),leading:(0,u.jsx)(a,{className:`size-3.5`}),wrapperClassName:`mb-2`}),(0,u.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[p.found.length,` of `,p.total]}),p.found.length>0&&(0,u.jsx)(`ul`,{className:`divide-y rounded-md border`,children:p.found.map(h)}),p.found.length<p.total&&(0,u.jsx)(s,{className:`mt-3`,loading:p.loading,onClick:()=>void p.more(),children:l(`showMore`)})]}),f=e(t(),1),p=(e,t)=>{let[n,r]=(0,f.useState)([]),[i,a]=(0,f.useState)(0),[o,s]=(0,f.useState)(!1),c=(0,f.useRef)(t);return c.current=t,(0,f.useEffect)(()=>{let n=setTimeout(()=>{s(!0),e(t,0).then(e=>{c.current===t&&(r(e.items),a(e.total),s(!1))},()=>{c.current===t&&(r([]),a(0),s(!1))})},200);return()=>clearTimeout(n)},[e,t]),{found:n,total:i,more:async()=>{let i=t;s(!0);let o=await e(i,n.length).catch(()=>void 0);c.current===i&&(o&&(r(e=>[...e,...o.items]),a(o.total)),s(!1))},loading:o}};export{d as n,p as t};
|
|
2
|
+
//# debugId=ad0fb2df-f84a-47b5-a063-ce690dbf1e12
|
|
@@ -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{
|
|
2
|
-
//# debugId=
|
|
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{Ua as n,Wa as r,bs as i,ms as a,tl as o}from"./app-CwxoFZn2.js";import{h as s,o as c}from"./vendor-t7Q7QbPu.js";import{C as l,E as u,M as d,O as f,P as p,S as m,T as h,h as g,t as ee,w as _,y as v}from"./workflows-Bey4jszG.js";var y=()=>({trigger:{manual:{}},stateMachine:{QueryLanguage:`JSONata`,StartAt:``,States:{}}}),b=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return y();let t=e,n=t.stateMachine,r=typeof n?.States==`object`&&n.States!==null&&!Array.isArray(n.States)?n.States:{},i=t.order===`data`?{}:{StartAt:n?.StartAt??``};return{...t,trigger:t.trigger??{manual:{}},stateMachine:{...n,QueryLanguage:`JSONata`,...i,States:r}}},x=e=>b({trigger:e.trigger,order:e.execution_order??`sequence`,stateMachine:e.state_machine,...e.connections?{connections:e.connections}:{},...e.trace?{trace:e.trace}:{}}),S=e=>{let{StartAt:t,...n}=e.stateMachine;return{state_machine:g(e)===`data`?n:e.stateMachine,trigger:e.trigger,execution_order:g(e),connections:e.connections??null,trace:e.trace??null}},C=e=>e.split(`/`),w=(e,t)=>[...e,t].join(`/`),T=e=>{let t=C(e);return{scope:t.slice(0,-1),name:t.at(-1)}},E=(e,t)=>{let n=e.stateMachine;for(let e of t)n=d(n?.States[e]);return n},D=(e,t)=>{let{scope:n,name:r}=T(t);return E(e,n)?.States[r]},O=e=>Object.entries(e.States).flatMap(([e,t])=>{let n=d(t);return[e,...n?.States?O(n):[]]}),k=(e,t,n=[])=>{if(Object.hasOwn(e.States,t))return[...n,t];for(let[r,i]of Object.entries(e.States)){let e=d(i),a=e?.States&&k(e,t,[...n,r]);if(a)return a}},te=e=>e?.Type===`Map`||e?.Type===`Block`,A=e=>typeof e==`object`&&!!e&&!Array.isArray(e),j=e=>{if(!e)return[];let t=[e.anyOf,e.oneOf].find(Array.isArray),n=A(e.properties)?Object.entries(e.properties).filter(e=>A(e[1])):[];if(!t)return n;let r=new Map(n.map(([e,t])=>[e,[t]]));for(let[e,i]of t.filter(A).flatMap(e=>j(e)))n.some(([t])=>t===e)||r.set(e,[...r.get(e)??[],i]);return[...r].map(([e,t])=>[e,t.length===1?t[0]:{anyOf:t}])},M=e=>j(e),N=e=>e===void 0||e===``?`empty`:v(e)?`wired`:p(e)===void 0?A(e)&&Object.values(e).some(e=>p(e)!==void 0)?`made`:`literal`:`expression`,P=e=>`Arguments`in e&&A(e.Arguments)?e.Arguments:{},F=(e,t,n,r)=>{let i=Array.isArray(t.enum)&&t.enum.every(e=>typeof e==`string`)?t.enum:void 0;return{key:e,type:f(t),required:r,value:n,state:N(n),...i&&{options:i}}},ne=(e,t)=>{let n=m(e,t);if(!n)return[];let r=Array.isArray(n.required)?n.required:[],i=P(e);return M(n).map(([e,t])=>F(e,t,i[e],r.includes(e)))},I=e=>{let t=typeof e?.title==`string`?[]:M(e);return t.length===0?[{path:[],type:f(e)}]:t.map(([e,t])=>({path:[e],type:f(t)}))},re=(e,t)=>e.Type===`Task`?I(l(e,t)):e.Type===`Map`?[{path:[],type:f({type:`array`})}]:e.Type===`Block`?[{path:[],type:f(void 0)}]:[],ie=(e,t)=>I(h(e,t)),L=`#status`,R=`#condition`,z={path:[L],type:f(_)},B=e=>({key:R,type:{kinds:[`boolean`]},required:!1,value:e.Condition,state:N(e.Condition)}),V=(e,t,n,r)=>r[0]===`#status`?u(_,r.slice(1)):u(t?l(t,n):h(e,n),r),H=`$trigger`,U=e=>typeof e==`object`&&!!e&&!Array.isArray(e),W=e=>U(e)&&Number.isFinite(e.x)&&Number.isFinite(e.y),G=e=>U(e)?Object.fromEntries(Object.entries(e).flatMap(([e,t])=>W(t)?[[e,{x:t.x,y:t.y}]]:[])):{},K=e=>{let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{t=void 0}let n=U(t)?t:{};return{pins:G(n.pins),simple:G(n.simple)}},q=e=>e.replaceAll(`%`,`%25`).replaceAll(`.`,`%2E`).replace(/^#/,`%23`).replace(/^\$/,`%24`),J=e=>e===``?H:q(T(e).name),ae=e=>e.map(e=>e===`#status`?L:q(e)),oe=(e,t)=>t?.kind===`break`?[J(t.source),...t.path.length===0?[`#break`]:ae(t.path)].join(`.`):t?.kind===`make`?[J(t.target),`#make`,q(t.key)].join(`.`):t?.kind===`select`?[J(t.target),`#select`,q(t.key)].join(`.`):t?.kind===`condition`?[J(t.target),`#when`,...t.at.map(String)].join(`.`):J(e),se=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t)),ce=32,Y={right:24,bottom:24},X=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height,le=(e,t,n)=>{if(![...t.keys()].some(t=>e.has(t)))return e;let r=new Map([...e].map(([e,n])=>[e,{...n,...t.get(e)}])),i=new Map;for(let e of r.keys())i.set(n(e),[...i.get(n(e))??[],e]);let a=e=>e===void 0?0:a(n(e))+1,o=new Set;for(let e of[...i.keys()].sort((e,t)=>a(t)-a(e))){let n=i.get(e);if(n.some(e=>t.has(e)||o.has(e))){let e=n.filter(e=>t.has(e)).map(e=>r.get(e)),i=n.filter(e=>!t.has(e)).map(e=>r.get(e)).sort((e,t)=>e.y-t.y||e.x-t.x);for(let t of i){let n=e.find(e=>X(t,e));for(;n;)t.y=n.y+n.height+ce,n=e.find(e=>X(t,e));e.push(t)}}let a=e===void 0?void 0:r.get(e);if(!a)continue;let s=Math.max(a.width,...n.map(e=>r.get(e)).map(e=>e.x+e.width+Y.right)),c=Math.max(a.height,...n.map(e=>r.get(e)).map(e=>e.y+e.height+Y.bottom));(s!==a.width||c!==a.height)&&(Object.assign(a,{width:s,height:c}),o.add(e))}return r},Z=e(t(),1),Q=1e3,ue=e=>({...e,id:`${e.scope}#${e.seq}`,resume_at:e.resumeAt??null,started_at:e.startedAt,finished_at:e.finishedAt,duration_ms:Date.parse(e.finishedAt)-Date.parse(e.startedAt)}),de=(e,{from:t,steps:n,revision:r})=>({rows:[...e.slice(0,t),...n.map(ue)],revision:r}),$=(e,t)=>{let n=a(),r=s(),i=o.workflowRunTrace(e??``),l=c({queryKey:i,queryFn:async()=>{let t=r.getQueryData(i);return de(t?.rows??[],await n.workflowRunTrace(e,t&&{after:t.rows.length,revision:t.revision}))},select:e=>e.rows,enabled:e!==void 0,refetchInterval:t?Q:!1}),u=(0,Z.useRef)(t),{refetch:d}=l;return(0,Z.useEffect)(()=>{let n=u.current&&!t;u.current=t,n&&e!==void 0&&d()},[t,e,d]),l},fe=new Set([`queued`,`running`,`waiting`]),pe=e=>{let t=s();(0,Z.useEffect)(()=>{if(!e)return;let n=r(t,()=>!1),i=setInterval(()=>n.changed([`workflow_runs`]),Q);return()=>{clearInterval(i),n.stop()}},[e,t])},me=e=>{let t=s(),n=(0,Z.useContext)(i),a=(0,Z.useRef)(e);(0,Z.useEffect)(()=>{let i=a.current&&!e;a.current=e,i&&r(t,()=>n?.paused()??!1).changed([`workflows`])},[e,t,n])},he=(e,t)=>{if(!e)return;let n=typeof t==`string`?k(e.stateMachine,t):void 0,r=n&&D(e,n.join(`/`));return n&&r?.Type===`Block`?{within:n,startAt:r.Processor.StartAt}:{within:[],startAt:e.stateMachine.StartAt}},ge=e=>{let t=n(`workflow_runs`,e??``,e!==void 0),r=t.data?.record,i=r?.workflow_id!=null&&r.version!=null,a=n(`workflow_versions`,[String(r?.workflow_id??``),Number(r?.version??0)],i),o=fe.has(String(r?.status)),s=typeof r?.test_step==`string`?ee(r.test_step):a.data?x(a.data.record):void 0,c=$(e,o);return pe(o),me(o),{id:e,run:r,stored:t.data,definition:s,place:he(s,r?.block_state),steps:c.data??[],going:o,error:t.error??a.error??c.error}};export{k as C,D as E,w as S,T,O as _,se as a,te as b,B as c,F as d,ne as f,ie as g,re as h,le as i,M as l,z as m,$ as n,K as o,L as p,oe as r,R as s,ge as t,V as u,b as v,x as w,E as x,S as y};
|
|
2
|
+
//# debugId=391f8509-bc1f-4491-b3d2-237659526df7
|
|
@@ -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{
|
|
2
|
-
//# debugId=
|
|
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{Hr as e,Rr as t,Ua as n,Z as r}from"./app-CwxoFZn2.js";import{o as i,t as a,w as o}from"./use-run-trace-5H4UJvB-.js";var s=`workflows`,c=({workflow:e,version:t,run:n})=>({kind:`record`,resource:s,key:e,...t!==void 0&&{version:t},...n&&{run:n}}),l=(e,t,n)=>c({workflow:e,...t!==n&&{version:t}}),u=(e,t,n,r)=>c({workflow:e,...n!==r&&{version:n},run:t}),d=({workflow:e,version:t},n)=>t===void 0?c({workflow:e}):l(e,t,n),f=e=>e==null?void 0:Number(e),p=()=>{let{address:t}=e(),n=r();if(n&&t?.kind===`record`)return{workflow:n.key,...t.version!==void 0&&{version:t.version},...t.run&&{run:t.run}}},m=e=>{let r=n(s,e.workflow),c=f(r.data?.record.version),l=f(r.data?.record.enabled_version),u=`workflow_id = ${JSON.stringify(e.workflow)}`,d=t(`workflow_versions`,{filter:u,orderBy:`version desc`,pageSize:100,fields:[`version`,`saved_at`]}),p=t(`workflow_runs`,{filter:`${u} AND isNull(block_of)`,orderBy:`created_at desc`,pageSize:20,fields:[`id`,`status`,`version`,`created_at`,`duration_ms`,`input`,`started_by`,`rerun_of`,`replay`,`error`]}),m=a(e.run),h=e.version,g=n(`workflow_versions`,[e.workflow,h??0],h!==void 0);return{latest:c,enabled:l,versions:d.items.map(e=>({version:Number(e.version),savedAt:String(e.saved_at)})),runs:p.items,trace:m,shown:h,pastDefinition:g.data&&o(g.data.record),pastLayout:g.data&&i(g.data.record.layout),versionsError:d.error,runsError:p.error,pastError:g.error}};export{l as a,u as i,p as n,c as o,d as r,s,m as t};
|
|
2
|
+
//# debugId=1d016b99-bd69-4e85-8821-554006b4fd14
|
|
@@ -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{
|
|
2
|
-
//# debugId=
|
|
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{ms as e,nl as t,tl as n}from"./app-CwxoFZn2.js";import{o as r}from"./vendor-t7Q7QbPu.js";var i=t(`app/field-types/workflow`),a=()=>{let t=e();return r({queryKey:n.workflowTypes,queryFn:()=>t.workflowTypes()})};export{i as n,a as t};
|
|
2
|
+
//# debugId=a3930e3b-31f4-4806-9b3f-9fc6f3281d08
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{
|
|
2
|
-
StartAt`,kind:`start`,source:``,target:t.StartAt,field:`StartAt`}]:[];return{nodes:[{kind:`trigger`,id:``,trigger:e.trigger},...n.nodes],edges:[...r,...n.edges]}},U={width:224,height:64},gt=(e,t)=>`${e}\u0000${t}`,_t={"elk.algorithm":`layered`,"elk.direction":`RIGHT`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.layered.spacing.nodeNodeBetweenLayers":`72`,"elk.spacing.nodeNode":`32`,"elk.edgeLabels.inline":`false`},vt={"elk.layered.layering.strategy":`LONGEST_PATH`},yt={"elk.padding":`[top=48,left=24,bottom=24,right=24]`},bt=e=>e.kind===`state`&&j(e.state),xt=(e,t={})=>{let n=e=>{let n=t.sizes?.get(e)??U,r=t.ports?.get(e);return r?.length?{id:e,...n,layoutOptions:{"elk.portConstraints":`FIXED_POS`},ports:r.map(t=>({id:gt(e,t.handle),x:t.side===`in`?0:n.width,y:t.y,width:0,height:0,layoutOptions:{"elk.port.side":t.side===`in`?`WEST`:`EAST`}}))}:{id:e,...n}},r=(e,n)=>n!==void 0&&t.ports?.get(e)?.some(e=>e.handle===n)?gt(e,n):e,i=e=>(t.pure??[]).filter(t=>t.parent===e).map(e=>n(e.id)),a=t=>{if(!bt(t))return n(t.id);let r=e.nodes.filter(e=>e.kind===`state`&&e.parent===t.id);return{id:t.id,layoutOptions:yt,children:[...r.map(a),...i(t.id)],edges:s(t.id)}},o=n=>{let r=t.pure?.find(e=>e.id===n);if(r)return r.parent;let i=e.nodes.find(e=>e.id===n);return i?.kind===`state`?i.parent:void 0},s=n=>[...e.edges.filter(e=>o(e.target)===n).map(e=>({id:e.id,sources:[e.source],targets:[e.target]})),...(t.wires??[]).filter(e=>o(e.target)===n&&o(e.source)===n).map(e=>({id:e.id,sources:[r(e.source,e.sourceHandle)],targets:[r(e.target,e.targetHandle)]}))],c=e.nodes.filter(e=>e.kind===`trigger`||e.parent===void 0);return{id:`root`,layoutOptions:t.dataOrder?{..._t,...vt}:_t,children:[...c.map(a),...i(void 0)],edges:s(void 0)}},St=e=>{let t=new Map,n=e=>{for(let r of e.children??[])t.set(r.id,{x:r.x??0,y:r.y??0,width:r.width??U.width,height:r.height??U.height}),n(r)};return n(e),t},Ct=async(e,t)=>St(await e.layout(t)),wt=24,Tt=8,Et=(e,t)=>{let n=t?[...e]:e.filter(e=>e.required||e.state!==`empty`);return{shown:n,folded:e.length-n.length}},Dt=(e,t,n,r=52)=>r+Math.max(e,typeof t==`number`?t:t.length)*26+(n?wt:0)+Tt,Ot={string:()=>F(`typeString`),integer:()=>F(`typeInteger`),number:()=>F(`typeNumber`),boolean:()=>F(`typeBoolean`),object:()=>F(`typeObject`),array:()=>F(`typeArray`),null:()=>F(`typeNull`),any:()=>F(`typeAny`)},W=e=>e.title===void 0?e.kinds===`any`?Ot.any():e.kinds.map(e=>Ot[e]()).reduce((e,t)=>F(`typeOr`,{first:e,second:t})):e.title,G=e=>e.kinds===`any`?`any`:e.kinds[0],kt={status:()=>F(`outputStatus`),headers:()=>F(`outputHeaders`),body:()=>F(`outputBody`),record:()=>F(`outputRecord`),resource:()=>F(`outputResource`),key:()=>F(`outputKey`),records:()=>F(`outputRecords`),message_id:()=>F(`outputMessageId`)},At=(e,t=!1,n=!1)=>{if(e.length===0)return F(t?`pinRunInput`:`pinResult`);if(e.length===1&&e[0]===`#status`)return F(`stepStatusType`);let r=e.at(-1);return n||!Object.hasOwn(kt,r)?r:kt[r]()},jt=e=>e===`#condition`?F(`onlyWhen`):Le(e),Mt={"=":()=>F(`conditionEquals`),"!=":()=>F(`conditionNotEquals`),">":()=>F(`conditionGreater`),"<":()=>F(`conditionLess`),matches:()=>F(`conditionMatches`),and:()=>F(`conditionAnd`),or:()=>F(`conditionOr`),not:()=>F(`conditionNot`),expression:()=>F(`conditionExpression`)},Nt=e=>Mt[e](),Pt=({part:e})=>Nt(e.kind===`compare`||e.kind===`logic`?e.op:e.kind),Ft={SUCCEEDED:()=>F(`statusSucceeded`),FAILED:()=>F(`statusFailed`),TIMED_OUT:()=>F(`statusTimedOut`),ABORTED:()=>F(`statusAborted`),SKIPPED:()=>F(`statusSkipped`)},It=e=>Object.hasOwn(Ft,e)?Ft[e]():e,Lt=34,Rt=280,zt=8,Bt=(e,t)=>e.kind===`condition`?{shown:e.inputs,folded:0}:e.kind===`make`?Et(e.inputs,t||e.inputs.length<=zt):{shown:[],folded:0},Vt=(e,t,n)=>{let r=new Set(t.filter(t=>t.source===e.id).map(e=>e.sourceHandle)),i=e.outputs.filter(e=>r.has(V(e.path))),a=i.length>0&&i.length<e.outputs.length;return n||!a?{shown:e.outputs,folded:0,foldable:a}:{shown:i,folded:e.outputs.length-i.length,foldable:a}},Ht=e=>106+e*26+8,Ut=(e,t,n)=>{let r=new Map;for(let i of e.nodes){if(i.kind===`state`&&j(i.state))continue;let{shown:e,folded:a}=Et(t.inputs.get(i.id)??[],n.has(i.id));r.set(i.id,{width:296,height:Dt(e.length,t.outputs.get(i.id)??[],a>0||n.has(i.id))})}for(let e of t.pure){if(e.kind===`condition`&&e.part.kind===`expression`){r.set(e.id,{width:216,height:Ht(e.inputs.length)});continue}if(e.kind===`select`){r.set(e.id,{width:Rt,height:Dt(e.part.cases.length+3,1,!1,Lt)});continue}if(e.kind===`break`){let i=Vt(e,t.edges,n.has(e.id));r.set(e.id,{width:216,height:Dt(0,i.shown.length,i.foldable,Lt)});continue}let{shown:i,folded:a}=Bt(e,n.has(e.id));r.set(e.id,{width:216,height:Dt(i.length,1,e.kind===`make`&&(a>0||n.has(e.id)),Lt)})}return r},Wt=(e,t)=>e+t*26+13,Gt=13,Kt=38,qt=(e,t,n)=>{let r=new Map;for(let i of e.nodes){if(i.kind===`state`&&j(i.state))continue;let{shown:e}=Et(t.inputs.get(i.id)??[],n.has(i.id));r.set(i.id,[...e.map((e,t)=>({handle:B(e.key),side:`in`,y:Wt(52,t)})),...(t.outputs.get(i.id)??[]).map((e,t)=>({handle:V(e.path),side:`out`,y:Wt(52,t)}))])}for(let e of t.pure){let i=(e,t=Kt)=>e.map((e,n)=>({handle:B(e.key),side:`in`,y:Wt(t,n)}));if(e.kind===`break`){let{shown:i}=Vt(e,t.edges,n.has(e.id));r.set(e.id,[{handle:$e,side:`in`,y:Gt},...i.map((e,t)=>({handle:V(e.path),side:`out`,y:Wt(Kt,t)}))])}else if(e.kind===`make`)r.set(e.id,[{handle:et,side:`out`,y:Gt},...i(Bt(e,n.has(e.id)).shown)]);else if(e.kind===`select`)r.set(e.id,[{handle:nt,side:`out`,y:Gt},...i(e.inputs)]);else{let t=e.part.kind===`expression`?Kt+64+4:Kt;r.set(e.id,[{handle:tt,side:`out`,y:Gt},...i(e.inputs,t)])}}return r},Jt=(e,t)=>{let n=e.nodes.find(e=>e.id===(t.kind===`break`?t.source:t.target));return n?.kind===`state`?n.parent:void 0},Yt=`trigger`,K=e=>e===``?Yt:`state:${e}`,q=e=>e!==Yt&&!e.startsWith(`state:`),J=e=>e===Yt?``:e.startsWith(`state:`)?e.slice(6):e,Xt=(e,t,n)=>{let{shown:r,folded:i}=Et(e.inputs.get(t)??[],n);return{inputs:r,outputs:e.outputs.get(t)??[],folded:i,open:n}},Zt=(e,t,n,r,i,a,o,s,c=!1)=>e.nodes.map(e=>{let l=t?.get(e.id)??{x:0,y:0,...U},u=e.kind===`state`?e.parent:void 0,d=e.kind===`trigger`?Ve(e.trigger,a):Fe(e.state,a),f=e.kind===`state`&&Ge(e.state,a),p=e.kind===`state`?F(`stateNode`,{name:e.name,type:d}):F(`triggerNode`,{trigger:d}),m=o?.get(e.id)??[],h=[...f?[F(`cacheForcedAgainst`)]:[],...m.map(e=>e.message)];return{id:K(e.id),type:e.kind,ariaLabel:[p,...h].join(`, `),position:{x:l.x,y:l.y},width:l.width,height:l.height,measured:{width:l.width,height:l.height},data:{node:e,kind:d,problems:n.get(e.id)??[],...i?.has(e.id)&&{trace:i.get(e.id)},...f&&{cacheWarning:f},...m.length>0&&{warnings:m},...s&&{pins:Xt(s.data,e.id,s.open.has(e.id))},...c&&{dataOrder:c}},draggable:!1,deletable:e.kind===`state`,selected:e.id===r,...u!==void 0&&{parentId:K(u),extent:`parent`}}}),Qt=40,$t=e=>e.length>Qt?`${e.slice(0,39)}…`:e,en=e=>{if(e.kind==="default")return F(`otherwise`);if(e.kind===`catch`)return F(`onError`,{errors:e.label??``});if(e.kind===`rule`)return e.label?$t(e.label):F(`conditionToWrite`)},tn=e=>({id:e.id,source:K(e.source),sourceHandle:`out`,target:K(e.target),targetHandle:`in`,deletable:!1,data:{kind:e.kind,field:e.field,source:e.source},...e.kind===`status`&&{className:`pb-workflow-status`}}),nn=(e,t=!1)=>e.edges.map(e=>{if(t)return tn(e);let n=en(e);return{id:e.id,source:K(e.source),sourceHandle:e.kind,target:K(e.target),targetHandle:`in`,deletable:e.kind!==`start`,data:{kind:e.kind,field:e.field,source:e.source},...n!==void 0&&{label:n},...e.kind===`catch`&&{className:`pb-workflow-catch`}}}),rn=(e,t,n,r)=>t.pure.map(i=>{let a=n?.get(i.id)??{x:0,y:0,...U},o=Jt(e,i),{shown:s,folded:c}=Bt(i,r.has(i.id)),l=i.kind===`break`?Vt(i,t.edges,r.has(i.id)):void 0,u=e.nodes.find(e=>e.id===(i.kind===`break`?i.source:i.target));return{id:i.id,type:`pure`,position:{x:a.x,y:a.y},width:a.width,height:a.height,measured:{width:a.width,height:a.height},data:{node:u,kind:i.kind,problems:[],pureData:{pure:i,shownInputs:s,shownOutputs:l?.shown??[],folded:l?.folded??c,open:r.has(i.id),foldable:l?l.foldable:c>0||r.has(i.id)}},draggable:!1,deletable:!0,...o!==void 0&&{parentId:K(o),extent:`parent`}}}),an=(e,t)=>{let n=e=>{let n=t.pure.find(t=>t.id===e);return n?n.kind===`break`?n.source:n.target:e},r=new Set(t.edges.map(e=>`${n(e.source)}\n${n(e.target)}`));return nn({...e,edges:e.edges.filter(e=>e.source!==``&&!r.has(`${e.source}\n${e.target}`))},!0)},on=e=>{let t=new Set(e.pure.map(e=>e.id)),n=e=>t.has(e)?e:K(e);return e.edges.map(e=>({id:e.id,source:n(e.source),sourceHandle:e.sourceHandle,target:n(e.target),targetHandle:e.targetHandle,deletable:!e.expression,data:{kind:`data`,wire:e},className:`pb-wire pb-wire-${G(e.type)}${e.expression?` pb-wire-expression`:``}`}))},sn=(0,R.createContext)(void 0),cn={succeeded:`green`,caught:`amber`,retrying:`amber`,failed:`red`,current:`blue`},ln=(0,R.createContext)(void 0),Y=()=>(0,R.useContext)(ln),un=e=>{if(e.options)return`choice`;if(e.type.kinds===`any`)return;let[t,...n]=e.type.kinds.filter(e=>e!==`null`);if(t===`string`&&n.every(e=>e===`integer`||e===`number`))return`string`;if(!(n.length>0))return t===`integer`||t===`number`?`number`:t===`boolean`?`boolean`:void 0},dn=e=>e.trim()===``?void 0:Number.isNaN(Number(e))?e:Number(e),fn=({name:e,className:t,value:n,onChange:i})=>{let[a,o]=(0,R.useState)();return(0,H.jsx)(r,{"aria-label":e,wrapperClassName:`${t} h-6 w-[55%] px-1.5`,className:`text-xs`,inputMode:`decimal`,value:a??(n===void 0?``:String(n)),onChange:e=>{o(e.target.value),i(dn(e.target.value))},onBlur:()=>o(void 0)})},pn=({pin:e,label:t,onChange:n})=>{if(e.state===`wired`||e.state===`made`||e.key===`#condition`&&e.state!==`expression`)return null;if(e.state===`expression`)return(0,H.jsx)(`span`,{className:`ml-auto shrink-0 rounded bg-muted px-1 font-mono text-xs text-muted-foreground`,title:F(`pinExpression`,{expression:String(e.value)}),children:`ƒ`});let i=un(e);if(e.state===`literal`&&typeof e.value==`object`)return(0,H.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,title:F(`pinObjectValue`),children:`{…}`});if(!i)return e.state===`literal`?(0,H.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-xs text-muted-foreground`,children:String(e.value)}):null;let a=F(`inputValue`,{label:t});if(!n)return(0,H.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-xs text-muted-foreground`,children:e.value===void 0?``:String(e.value)});let s=`nodrag nopan nowheel ml-auto min-w-0`;return i===`boolean`?(0,H.jsx)(l,{className:s,checked:e.value===!0,label:a,onChange:e=>n(e)}):i===`choice`?(0,H.jsxs)(o,{"aria-label":a,className:`${s} h-6 max-w-[55%] px-1 py-0 text-xs`,value:typeof e.value==`string`?e.value:``,onChange:e=>n(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(`option`,{value:``}),e.options.map(t=>(0,H.jsx)(`option`,{value:t,children:e.statuses?It(t):t},t))]}):i===`number`?(0,H.jsx)(fn,{name:a,className:s,value:e.value,onChange:n}):(0,H.jsx)(r,{"aria-label":a,wrapperClassName:`${s} h-6 w-[55%] px-1.5`,className:`text-xs`,value:e.value===void 0?``:String(e.value),onChange:e=>n(e.target.value===``?void 0:e.target.value)})},mn=e=>`pb-pin pb-pin-${G(e.type)}`,hn=({pin:e,step:t,keys:n,connectable:r,name:i,onValue:a,bare:o=!1})=>{let s=Y(),c=i??jt(e.key);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center gap-1.5 pr-2 pl-3`,children:[(0,H.jsx)(L,{id:B(e.key),type:`target`,position:I.Left,isConnectable:r,className:mn(e)}),(0,H.jsxs)(`span`,{className:`min-w-0 shrink truncate text-xs text-body`,title:F(`pinTypeTitle`,{label:c,type:W(e.type)}),children:[c,e.required&&(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-danger-text`,children:`*`})]}),!o&&(0,H.jsx)(pn,{pin:e,label:c,...s&&r&&{onChange:a??(e=>s.setArgument(t,n,e))}})]})},gn=({pin:e,connectable:t,trigger:n=!1,field:r=!1})=>{let i=At(e.path,n,r);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center justify-end pr-3 pl-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-xs text-body`,title:F(`pinTypeTitle`,{label:i,type:W(e.type)}),children:i}),(0,H.jsx)(L,{id:V(e.path),type:`source`,position:I.Right,isConnectable:t,className:mn(e)})]})},_n=({inputs:e,outputs:t,connectable:n})=>{let r=(e,t)=>({top:`${(e+1)*100/(t+1)}%`});return(0,H.jsxs)(H.Fragment,{children:[e.map((t,i)=>(0,H.jsx)(L,{id:B(t.key),type:`target`,position:I.Left,isConnectable:n,className:mn(t),style:r(i,e.length),title:F(`pinTypeTitle`,{label:jt(t.key),type:W(t.type)})},t.key)),t.map((e,i)=>(0,H.jsx)(L,{id:V(e.path),type:`source`,position:I.Right,isConnectable:n,className:mn(e),style:r(i,t.length),title:F(`pinTypeTitle`,{label:At(e.path),type:W(e.type)})},e.path.join(`/`)))]})},vn=({node:e,folded:t,open:n,fields:r=!1})=>{let i=Y();return t===0&&!n?null:(0,H.jsx)(`button`,{type:`button`,className:`nodrag h-6 w-full px-3 text-left text-xs text-muted-foreground hover:text-foreground`,onClick:()=>i?.toggleOpen(e),disabled:!i,children:r?n?F(`foldLessFields`):F(`foldMoreFields`,{count:t}):n?F(`foldLess`):F(`foldMore`,{count:t})})},yn=({node:e,inputs:t,outputs:n,folded:r,open:i,editable:a,trigger:o=!1})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-[3fr_2fr]`,children:[(0,H.jsx)(`div`,{className:`min-w-0`,children:t.map(t=>(0,H.jsx)(hn,{pin:t,step:e,keys:[t.key],connectable:a},t.key))}),(0,H.jsx)(`div`,{className:`min-w-0`,children:n.map(e=>(0,H.jsx)(gn,{pin:e,connectable:a,trigger:o},JSON.stringify(e.path)))})]}),(0,H.jsx)(vn,{node:e,folded:r,open:i})]}),bn=(0,R.createContext)(void 0),xn=`nodrag absolute -top-4 -right-4 z-10`,Sn=({node:e,name:t})=>{let n=(0,R.useContext)(bn);return n?(0,H.jsx)(f,{size:`icon`,className:xn,"aria-label":F(`unpin`,{name:t}),title:F(`unpinHelp`),onClick:t=>{t.stopPropagation(),n(e)},children:(0,H.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0})}):(0,H.jsxs)(`span`,{className:a(xn,`inline-flex size-7 items-center justify-center rounded-md border border-border-strong bg-background text-muted-foreground shadow-sm`),title:F(`movedByHand`),children:[(0,H.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`sr-only`,children:F(`movedByHand`)})]})},X=[18,38],Cn=e=>{if(e.Type===`Choice`)return[{kind:`rule`,top:X[0],label:F(`when`)},{kind:`default`,top:X[1],label:F(`otherwise`)}];let t=[`Task`,`Pass`,`Wait`,`Map`,`Block`].includes(e.Type)?[{kind:`next`,top:X[0]}]:[],n=e.Type===`Task`||e.Type===`Map`||e.Type===`Block`?[{kind:`catch`,top:X[t.length],label:F(`onErrorHandle`)}]:[];return[...t,...n]},wn=(e,t,n)=>{let r=(0,R.useContext)(sn);if(!r||!t)return{};let i=t=>{t.stopPropagation(),r(e)},a=n?F(`addStepAtNamedHandle`,{handle:n}):F(`addStepAtHandle`);return{role:`button`,tabIndex:0,"aria-label":a,title:a,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i(e))}}},Tn=({source:e,path:t,editable:n})=>(0,H.jsx)(L,{id:e.kind,type:`source`,position:I.Right,isConnectable:n,style:{top:e.top},className:a(`pb-workflow-exec`,`pb-workflow-handle-${e.kind}`),...wn({kind:e.kind,source:t},n,e.label),children:e.label&&(0,H.jsx)(`span`,{className:`pb-workflow-handle-label`,children:e.label})}),En=({state:e,path:t,editable:n})=>Cn(e).map(e=>(0,H.jsx)(Tn,{source:e,path:t,editable:n},e.kind)),Dn=({count:e})=>e>0&&(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-danger-text`,title:F(`problemCount`,{count:e}),children:[(0,H.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:F(`problemCount`,{count:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:e})]}),On=({label:e})=>(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center text-warning-text`,title:e,children:[(0,H.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:e})]}),kn=({trace:e})=>(0,H.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end gap-0.5`,children:[e.changed?(0,H.jsx)(`span`,{title:F(`changedSinceRun`),className:`rounded-full border border-dashed px-1.5 text-xs text-muted-foreground`,children:F(`changedShort`)}):(0,H.jsx)(c,{tone:cn[e.status],children:Ue(e.status)}),e.steps>1&&(0,H.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:F(`traceSteps`,{count:e.steps})})]}),An=(e,t,n)=>a(`rounded-lg border bg-background text-body shadow-sm`,t>0||n?.status===`failed`?`border-danger`:`border-border-strong`,e&&`ring-2 ring-primary/40`),jn=({name:e,kind:t,problems:n,first:r,trace:i,warnings:a=[]})=>(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:[t,r&&(0,H.jsxs)(`span`,{className:`text-primary-text`,children:[` · `,F(`startsHere`)]})]}),a.length>0&&(0,H.jsx)(On,{label:a.join(`
|
|
3
|
-
`)}),(0,H.jsx)(Dn,{count:n}),i&&(0,H.jsx)(kn,{trace:i})]}),(0,H.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e})]}),Mn=()=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(L,{id:`in`,type:`target`,position:I.Left,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}}),(0,H.jsx)(L,{id:`out`,type:`source`,position:I.Right,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}})]}),Nn=({condition:e})=>e!==void 0&&(0,H.jsx)(`span`,{className:`absolute top-1 right-6 max-w-[45%] truncate rounded bg-muted px-1 text-[0.625rem] text-muted-foreground`,title:e,children:F(`onlyWhenBadge`)}),Pn=({id:e,data:t,selected:n,isConnectable:r})=>{let{node:i,kind:o,problems:s,trace:c,cacheWarning:l,warnings:u=[],pins:d,dataOrder:f,moved:p}=t;return i.kind===`state`?(0,H.jsxs)(`div`,{className:a(An(n,s.length,c),`h-full`,j(i.state)&&`bg-muted/40`),children:[p&&(0,H.jsx)(Sn,{node:e,name:i.name}),(0,H.jsxs)(`div`,{className:`relative h-[52px] py-2 pr-6 pl-4`,children:[f?(0,H.jsx)(Mn,{}):(0,H.jsx)(L,{id:`in`,type:`target`,position:I.Left,isConnectable:r,className:`pb-workflow-exec`,style:{top:X[0]}}),f&&(0,H.jsx)(Nn,{condition:i.state.Condition}),(0,H.jsx)(jn,{name:i.name,kind:o,problems:s.length,first:i.first&&i.parent!==void 0,trace:c,warnings:[...l?[F(`cacheForcedAgainst`)]:[],...u.map(e=>e.message)]}),!f&&(0,H.jsx)(En,{state:i.state,path:i.id,editable:r}),d&&j(i.state)&&(0,H.jsx)(_n,{inputs:d.inputs,outputs:d.outputs,connectable:r})]}),d&&!j(i.state)&&(0,H.jsx)(yn,{node:i.id,inputs:d.inputs,outputs:d.outputs,folded:d.folded,open:d.open,editable:r})]}):null},Fn=({id:e,data:t,selected:n,isConnectable:r})=>{let{node:i,kind:o,problems:s,pins:c,dataOrder:l,moved:u}=t,d=wn({kind:`start`,source:i.id},r&&!l);return i.kind===`trigger`?(0,H.jsxs)(`div`,{className:a(An(n,s.length),`h-full border-dashed`),children:[u&&(0,H.jsx)(Sn,{node:e,name:F(`trigger`)}),(0,H.jsxs)(`div`,{className:`relative h-[52px] py-2 pr-6 pl-4`,children:[(0,H.jsx)(jn,{name:o,kind:F(`trigger`),problems:s.length}),l?(0,H.jsx)(L,{id:`out`,type:`source`,position:I.Right,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}}):(0,H.jsx)(L,{id:`start`,type:`source`,position:I.Right,isConnectable:r,className:`pb-workflow-exec`,style:{top:X[0]},...d})]}),c&&(0,H.jsx)(yn,{node:i.id,inputs:[],outputs:c.outputs,folded:0,open:!1,editable:r,trigger:!0})]}):null},In=`protobase:workflow-graph-view`,Ln=e=>u(()=>e().getItem(`protobase:workflow-graph-view`),null)===`simple`?`simple`:`pins`,Rn=(e,t)=>u(()=>t===`pins`?e().removeItem(In):e().setItem(In,t),void 0),zn=()=>localStorage,Bn=()=>{let[e,t]=(0,R.useState)(()=>Ln(zn));return[e,e=>{t(e),Rn(zn,e)}]},Vn=(e,t)=>e.part.kind===`not`?F(`conditionNotSide`):e.part.kind===`matches`?F(t===`0`?`conditionMatchesText`:`conditionMatchesPattern`):e.part.kind===`logic`?String.fromCharCode(65+Number(t)%26):F(t===`0`?`conditionSideA`:`conditionSideB`),Hn=({node:e,source:t})=>{let n=Y(),[r,i]=(0,R.useState)(),a=t.trim();return(0,H.jsx)(`textarea`,{"aria-label":F(`conditionExpressionText`),className:`nodrag nopan nowheel block w-full resize-none rounded border border-border bg-background px-1.5 py-1 font-mono text-xs text-foreground`,style:{height:64},spellCheck:!1,readOnly:!n,value:r??a,onChange:e=>i(e.target.value),onBlur:()=>{i(void 0);let t=r?.trim();t!==void 0&&t!==a&&n?.setCondition(e.target,t===``?void 0:`{% ${t} %}`)}})},Un=e=>e.replace(/^\$states\.context\.Steps\./,``).replace(/^\$states\.context\.Execution\.Input/,`input`),Wn=({node:e,editable:t})=>{let n=Y(),[i,a]=(0,R.useState)(),o=F(`conditionMatchesPattern`),s=String(e.inputs[1]?.value??``);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center gap-1.5 pr-2 pl-3`,children:[(0,H.jsx)(`span`,{className:`min-w-0 shrink truncate text-xs text-body`,children:o}),(0,H.jsx)(r,{"aria-label":F(`inputValue`,{label:o}),wrapperClassName:`nodrag nopan nowheel ml-auto h-6 w-[60%] min-w-0 px-1.5`,className:`font-mono text-xs`,value:i??s,disabled:!n||!t,onChange:t=>{a(t.target.value),t.target.value!==``&&n?.setConditionSide(e.target,[...e.at,1],t.target.value)},onBlur:()=>a(void 0)})]})},Gn=({node:e,editable:t})=>{let n=Y(),r=(0,H.jsx)(L,{id:tt,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-boolean`,style:{top:13}});return e.part.kind===`expression`?(0,H.jsxs)(`div`,{className:`relative grid gap-1 px-2 pt-1`,children:[r,(0,H.jsx)(Hn,{node:e,source:e.part.source}),(0,H.jsx)(`div`,{className:`-mx-2`,children:e.inputs.map(e=>(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center pr-2 pl-3`,children:[(0,H.jsx)(L,{id:B(e.key),type:`target`,position:I.Left,isConnectable:!1,className:`pb-pin pb-pin-${G(e.type)}`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-body`,title:F(`pinTypeTitle`,{label:e.key,type:W(e.type)}),children:Un(e.key)})]},e.key))})]}):(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[r,e.inputs.map(r=>e.part.kind===`matches`&&r.key===`1`?(0,H.jsx)(Wn,{node:e,editable:t},r.key):(0,H.jsx)(hn,{pin:r,step:e.target,keys:[],name:Vn(e,r.key),bare:e.part.kind===`logic`&&Number(r.key)===e.part.sides.length,connectable:t,onValue:t=>n?.setConditionSide(e.target,[...e.at,Number(r.key)],t??``)},r.key))]})},Kn=(e,t)=>typeof t==`number`&&e.trim()!==``&&Number.isFinite(Number(e))?Number(e):typeof t==`boolean`&&(e===`true`||e===`false`)?e===`true`:e,qn=`nodrag nopan nowheel h-6 min-w-0 px-1.5`,Jn=({label:e,value:t,onChange:n,disabled:i})=>(0,H.jsx)(r,{"aria-label":e,wrapperClassName:`${qn} flex-1`,className:`text-xs`,value:String(t),disabled:i,onChange:e=>n(Kn(e.target.value,t))}),Yn=({node:e,editable:t})=>{let n=Y(),r=!n||!t,i=t=>n?.setArgument(e.target,[e.key],D(t)),{part:a}=e,o=(e,t)=>i({...a,cases:a.cases.map((n,r)=>r===e?{...n,...t}:n)});return(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:nt,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-${G(e.type)}`,style:{top:13}}),e.inputs.map(n=>(0,H.jsx)(hn,{pin:n,step:e.target,keys:[],name:F(`selectInput`),connectable:t,onValue:e=>i({...a,operand:{value:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:``}})},n.key)),a.cases.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1 pr-2 pl-3`,children:[(0,H.jsx)(Jn,{label:F(`selectWhen`,{case:t+1}),value:e.when,disabled:r,onChange:e=>o(t,{when:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-muted-foreground`,children:`→`}),(0,H.jsx)(Jn,{label:F(`selectThen`,{case:t+1}),value:e.then,disabled:r,onChange:e=>o(t,{then:e})}),(0,H.jsx)(`button`,{type:`button`,className:`nodrag shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-40`,"aria-label":F(`selectRemoveCase`,{case:t+1}),disabled:r||a.cases.length===1,onClick:()=>i({...a,cases:a.cases.filter((e,n)=>n!==t)}),children:(0,H.jsx)(d,{className:`size-3`,"aria-hidden":!0})})]},t)),(0,H.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1 pr-2 pl-3`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-body`,children:F(`selectOtherwise`)}),(0,H.jsx)(Jn,{label:F(`selectOtherwise`),value:a.otherwise,disabled:r,onChange:e=>i({...a,otherwise:e})})]}),(0,H.jsx)(`button`,{type:`button`,className:`nodrag h-6 w-full px-3 text-left text-xs text-muted-foreground hover:text-foreground`,disabled:r,onClick:()=>i({...a,cases:[...a.cases,{when:``,then:``}]}),children:F(`selectAddCase`)})]})},Xn=e=>e.kind===`condition`?Pt(e):e.kind===`select`?F(`selectTitle`):e.kind===`break`?F(`breakTitle`,{type:W(e.type)}):F(`makeTitle`,{type:W(e.type)}),Zn=({pure:e})=>(0,H.jsx)(`div`,{className:`truncate border-b px-3 py-1.5 text-xs font-medium text-foreground`,children:Xn(e)}),Qn=({id:e,data:t,selected:n,isConnectable:r})=>{let{pureData:i,moved:o}=t;if(!i)return null;let{pure:s,shownInputs:c,shownOutputs:l,folded:u,open:d,foldable:f}=i;return(0,H.jsxs)(`div`,{className:a(`h-full rounded-lg border border-dashed border-border-strong bg-background text-body shadow-sm`,n&&`ring-2 ring-primary/40`),children:[o&&(0,H.jsx)(Sn,{node:e,name:Xn(s)}),(0,H.jsx)(Zn,{pure:s}),s.kind===`condition`?(0,H.jsx)(Gn,{node:s,editable:r}):s.kind===`select`?(0,H.jsx)(Yn,{node:s,editable:r}):s.kind===`break`?(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:$e,type:`target`,position:I.Left,isConnectable:!1,className:`pb-pin pb-pin-${G(s.type)}`,style:{top:13}}),l.map(e=>(0,H.jsx)(gn,{pin:e,connectable:r,field:!0},JSON.stringify(e.path))),f&&(0,H.jsx)(vn,{node:s.id,folded:u,open:d,fields:!0})]}):(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:et,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-${G(s.type)}`,style:{top:13}}),c.map(e=>(0,H.jsx)(hn,{pin:e,step:s.target,keys:[s.key,e.key],connectable:r},e.key)),(0,H.jsx)(vn,{node:s.id,folded:u,open:d})]})]})},$n=({offer:e,onClose:t})=>(0,H.jsxs)(`div`,{role:`dialog`,"aria-label":F(`pureOfferTitle`),className:`absolute z-10 grid gap-1 rounded-md border bg-background p-1 shadow-md`,style:{left:e.x,top:e.y},children:[e.choices.map((e,n)=>(0,H.jsx)(f,{size:`sm`,variant:`ghost`,className:`justify-start`,autoFocus:n===0,onClick:()=>{e.add(),t()},children:e.label},e.label)),(0,H.jsx)(f,{size:`sm`,variant:`ghost`,onClick:t,children:F(`pureOfferClose`)})]}),er=e=>typeof e==`object`&&!!e&&!Array.isArray(e),tr=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Z={kinds:[`boolean`]},nr=e=>e.sides.flatMap(e=>b(e)?nr(e):`read`in e?[e.read]:[]),rr=e=>!b(e)&&`read`in e&&`step`in e.read.base&&tr(e.read.path,[`Status`]),ir=(e,t)=>{if(t&&t.kinds!==`any`){let e=t.kinds.filter(e=>e!==`null`);if(e.length===1&&[`string`,`integer`,`number`,`boolean`].includes(e[0]))return{kinds:e}}return{kinds:[typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:`string`]}},ar=e=>{let t=new Map;for(let[n,r]of re(e.stateMachine)){let i=`Assign`in r&&er(r.Assign)?r.Assign:{};for(let[r,a]of Object.entries(i)){let i=a===`{% $states.result %}`?ae(e.stateMachine,n)?.join(`/`):void 0;t.set(r,t.has(r)||i===void 0?null:i)}}return t},or=(e,t,n=[])=>{let r=new Map(re(e.stateMachine).map(([t,n])=>[ae(e.stateMachine,t).join(`/`),n])),i=ne(e)===`data`,a=new Map([[``,ce(e,t)],...[...r].map(([e,n])=>[e,[...le(n,t),...i?[fe]:[]]])]),o=new Map([...r].filter(([,e])=>i||e.Type===`Task`).map(([e,n])=>[e,[...i?[M(n)]:[],...se(n,t)]])),s=e=>[...r.keys()].find(t=>t.split(`/`).at(-1)===e),c=new Map,l=new Map,u=[],d=[],f=new Map,p=ar(e),m=(e,t,n,r=!1)=>{let i=`data:${e.node}|${e.handle}->${t}|${n}`;r&&f.has(i)||f.set(i,{id:i,source:e.node,sourceHandle:e.handle,target:t,targetHandle:n,type:e.type,...r&&{expression:!0}})},g=(e,t)=>{let n=e.find(e=>tr(e.path,t));return n||(n={path:t,type:_(void 0)},e.push(n)),n},y=(e,t)=>{let n=a.get(e),r=n.find(e=>tr(e.path,t)),i=n.some(e=>e.path.length>0&&e.path[0]!==`#status`);if(r||t.length===0||i&&t.length===1){let i=r??g(n,t);return{node:e,handle:V(i.path),type:i.type}}let o=S(e,t.slice(0,-1)),s=g(o.outputs,t.slice(-1));return{node:o.id,handle:V(s.path),type:s.type}},S=(n,i)=>{let a=Ye(n,i),o=c.get(a);if(o)return o;let s=ge(e,r.get(n),t,i),l={kind:`break`,id:a,source:n,path:i,type:_(s),outputs:de(s).map(([e,t])=>({path:[e],type:_(t)}))};return c.set(a,l),m(y(n,i),a,$e),l},C=(e,t,n)=>{let r=T(e);if(r)return m(r,t,n);for(let r of O(e)){let e=D(r);e&&m(e,t,n,!0)}},T=e=>{let t=ie(e);return t&&D(t)},D=e=>{if(`step`in e.base){let t=s(e.base.step);return t===void 0||!a.has(t)?void 0:y(t,[P,...e.path])}let t=`input`in e.base?``:p.get(e.base.variable);return t==null||!a.has(t)?void 0:y(t,e.path)},A=e=>{if(b(e)||!(`read`in e))return;if(!rr(e))return D(e.read);let t=s(e.read.base.step);return t===void 0||!a.has(t)?void 0:y(t,[P])},oe=(e,t,n,r)=>{let i=Ze(e,n),a=t.sides,o=a.map(A),s=a.map((e,n)=>{let r=String(n);if(b(e))return{key:r,type:Z,required:!1,value:void 0,state:`made`};if(`read`in e)return{key:r,type:o[n]?.type??_(void 0),required:!1,value:k(e.read),state:`wired`};if(`pattern`in e)return{key:r,type:{kinds:[`string`]},required:!1,value:e.pattern,state:`literal`};if(t.kind===`matches`)return{key:r,type:{kinds:[`string`]},required:!1,value:e.value,state:`literal`};if(t.kind!==`compare`)return{key:r,type:Z,required:!1,value:e.value,state:`literal`};let i=a[1-n];return rr(i)?{key:r,type:{kinds:[`string`]},required:!1,value:e.value,state:`literal`,options:x,statuses:!0}:{key:r,type:ir(e.value,o[1-n]?.type),required:!1,value:e.value,state:`literal`}});t.kind===`logic`&&s.push({key:String(a.length),type:Z,required:!1,value:void 0,state:`empty`}),u.push({kind:`condition`,id:i,target:e,at:n,part:t,inputs:s}),m({node:i,handle:tt,type:Z},r.node,r.handle),a.forEach((t,r)=>{b(t)?oe(e,t,[...n,r],{node:i,handle:B(String(r))}):o[r]&&m(o[r],i,B(String(r)))})},j=(e,t)=>{let n=E(t),r={node:e,handle:B(he)};if(n&&nr(n).every(e=>A({read:e})))return oe(e,n,[],r);let i=Ze(e,[]),a=O(t).flatMap(e=>{let t=A({read:e});return t?[{read:e,source:t}]:[]});u.push({kind:`condition`,id:i,target:e,at:[],part:{kind:`expression`,source:v(t)},inputs:a.map(({read:e,source:t})=>({key:te(e),type:t.type,required:!1,value:k(e),state:`wired`}))}),m({node:i,handle:tt,type:Z},r.node,r.handle);for(let{read:e,source:t}of a)m(t,i,B(te(e)),!0)},ue=(e,t)=>{let n=w(t.value),r=n&&A(n.operand);if(!n||`read`in n.operand&&!r)return!1;let i=Qe(e,t.key),a=`read`in n.operand?{key:rt,type:r.type,required:!1,value:k(n.operand.read),state:`wired`}:{key:rt,type:{kinds:[`string`]},required:!1,value:n.operand.value,state:`literal`};return d.push({kind:`select`,id:i,target:e,key:t.key,part:n,type:t.type,inputs:[a]}),m({node:i,handle:nt,type:t.type},e,B(t.key)),r&&m(r,i,B(rt)),!0},pe=(e,n)=>{let i=Xe(e,n),a=l.get(i);if(a)return a;let s=o.get(e)?.find(e=>e.key===n),c=r.get(e),u=h(ee(c,t),[n]),d=er(s?.value)?s.value:{},f=new Set(Array.isArray(u?.required)?u.required:[]),p=de(u).map(([e,t])=>N(e,t,d[e],f.has(e))),g=Object.keys(d).filter(e=>!p.some(t=>t.key===e)).map(e=>N(e,h(u,[e])??{},d[e],!1)),v={kind:`make`,id:i,target:e,key:n,type:s?.type??_(u),inputs:[...p,...g]};l.set(i,v),m({node:i,handle:et,type:v.type},e,B(n));for(let e of v.inputs)C(e.value,i,B(e.key));return v};for(let[e,t]of o)for(let[n,r]of t.entries()){if(r.key===`#condition`&&r.state===`expression`){t[n]={...r,state:`made`},j(e,r.value);continue}if(r.state===`expression`&&ue(e,r)){t[n]={...r,state:`made`};continue}r.state===`made`&&pe(e,r.key),(r.state===`wired`||r.state===`expression`)&&C(r.value,e,B(r.key))}for(let e of n)e.kind===`break`&&a.has(e.source)&&S(e.source,e.path),e.kind===`make`&&o.get(e.target)?.some(t=>t.key===e.key&&t.state!==`wired`&&t.state!==`expression`)&&pe(e.target,e.key);return{inputs:o,outputs:a,pure:[...c.values(),...l.values(),...u,...d],edges:[...f.values()]}},sr=e=>e.reason===`notBefore`?F(`refuseNotBefore`,{step:e.step}):e.reason===`otherScope`?F(`refuseOtherScope`,{step:e.step}):e.reason===`shapesOutput`?F(`refuseShaped`,{step:e.step}):e.reason===`type`?F(`refuseType`,{source:W(e.source),target:W(e.target)}):F(`refuseNotPins`),Q=e=>it(e)!==void 0||at(e)!==void 0,$=(e,t)=>({node:J(e),handle:t??``}),cr=e=>e!==`any`&&e.includes(`object`),lr=(e,t)=>e.map(e=>({label:Nt(e),add:()=>t(e)})),ur=(e,t)=>{let n=e=>e.kind===`break`?Ye(e.source,e.path):Xe(e.target,e.key),r=e=>e.kind===`break`&&t.some(t=>t.kind===`break`&&t.source===e.source&&t.path.every((t,n)=>e.path[n]===t));return e.filter(e=>!r(e)&&!t.some(t=>t.id===n(e)))},dr=(e,t,n,r,i)=>{let a=r?.edits,[o,s]=(0,R.useState)([]),[c,l]=(0,R.useState)(new Set),[u,d]=(0,R.useState)(),f=(0,R.useRef)({definition:e,editing:r});(0,R.useEffect)(()=>{f.current={definition:e,editing:r}});let p=(0,R.useMemo)(()=>n&&or(e,n,o),[e,n,o]),m=ne(e)===`data`,h=(0,R.useMemo)(()=>{if(p)return{sizes:Ut(t,p,c),pure:p.pure.map(e=>({id:e.id,parent:Jt(t,e)})),wires:p.edges.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),ports:qt(t,p,c),dataOrder:m}},[t,p,c,m]),g=r&&{setArgument:(t,n,i)=>r.onChange(r.edits.setArgument(e,t,n,i)),setConditionSide:(t,n,i)=>r.onChange(r.edits.setConditionSide(e,t,n,{value:i})),setCondition:(t,n)=>r.onChange(r.edits.setArgument(e,t,[`#condition`],n)),toggleOpen:e=>l(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e]))},_=(t,n)=>{if(!p||!a||!Q(t.handle)||!Q(n.handle))return;let[r,i]=at(t.handle)?[t,n]:[n,t],o=a.wireRefusal(e,p,$(r.node,r.handle),$(i.node,i.handle));return o&&sr(o)},v=t=>!!(p&&a)&&a.wireRefusal(e,p,$(t.source,t.sourceHandle),$(t.target,t.targetHandle))===void 0,ee=t=>{r&&p&&r.onChange(r.edits.connectData(e,p,$(t.source,t.sourceHandle),$(t.target,t.targetHandle)))},y=(e,t,n)=>{if(!p||!a)return e;let r=e,i=n.flatMap(e=>{let t=e.data?.wire,n=t&&p.pure.find(e=>e.kind===`break`&&e.id===t.target||e.kind===`make`&&e.id===t.source);return n?[{id:n.id}]:[]}),o=[...t.filter(e=>q(e.id)),...i.filter(e=>!t.some(t=>t.id===e.id))],c=n.flatMap(e=>{let t=e.data?.wire;return t&&!o.some(e=>e.id===t.source||e.id===t.target)?[{wire:t}]:[]}),l=o.flatMap(e=>p.pure.filter(t=>t.id===e.id).map(e=>({pure:e}))),u=[...c,...l];for(let e of lt(p,u,e=>`wire`in e?ot(p,e.wire):st(e.pure)))r=`wire`in e?a.disconnectData(r,p,e.wire):a.removePure(r,p,e.pure);return o.length>0&&s(e=>ur(e,o.flatMap(e=>p.pure.filter(t=>t.id===e.id)))),r},te=(e,t)=>{let{definition:n,editing:r}=f.current;r?.onChange(r.edits.addSelect(n,e,t))},b=(e,t,n)=>{let{definition:r,editing:i}=f.current;i?.onChange(i.edits.addCondition(r,e,t,n))};return{data:p,open:c,layout:h,actions:g,check:_,isValid:v,connect:ee,remove:y,connectEnd:(e,t)=>{if(!p||!r||t.isValid||t.toHandle||!t.fromHandle?.id||!t.fromNode)return;let n=J(t.fromNode.id),a=t.fromHandle.id,o=`changedTouches`in e?e.changedTouches[0]:e,c=i.current?.getBoundingClientRect(),l={x:o.clientX-(c?.left??0),y:o.clientY-(c?.top??0)},u=at(a);if(u){let e=p.pure.find(e=>e.id===n),t=(e?.kind===`break`?e.outputs:p.outputs.get(n)??[]).find(e=>JSON.stringify(e.path)===JSON.stringify(u))?.type;if(!t||!cr(t.kinds))return;let r=e?.kind===`break`?{source:e.source,path:[...e.path,...u]}:{source:n,path:u};d({...l,choices:[{label:F(`breakTitle`,{type:W(t)}),add:()=>s(e=>[...e,{kind:`break`,...r}])}]});return}let f=it(a),m=p.pure.find(e=>e.id===n);if(m?.kind===`condition`){let e=m.inputs.find(e=>e.key===f);if(!e||e.state!==`literal`&&e.state!==`empty`||m.part.kind!==`logic`&&m.part.kind!==`not`)return;d({...l,choices:lr(r.edits.conditionChoices(!1),e=>b(m.target,[...m.at,Number(f)],e))});return}let h=f===void 0?void 0:p.inputs.get(n)?.find(e=>e.key===f);if(h?.key===`#condition`&&h.state===`empty`){d({...l,choices:lr(r.edits.conditionChoices(!0),e=>b(n,[],e))});return}if(h&&h.key!==`#condition`&&!cr(h.type.kinds)&&(h.state===`empty`||h.state===`literal`)){d({...l,choices:[{label:F(`selectOffer`),add:()=>te(n,h.key)}]});return}h&&cr(h.type.kinds)&&h.state!==`wired`&&h.state!==`expression`&&d({...l,choices:[{label:F(`makeTitle`,{type:W(h.type)}),add:()=>s(e=>[...e,{kind:`make`,target:n,key:h.key}])}]})},offer:u,closeOffer:()=>d(void 0)}},fr=(0,R.createContext)(void 0),pr=({fromX:e,fromY:t,toX:n,toY:r,fromPosition:i,toPosition:a,connectionStatus:o,fromNode:s,fromHandle:c,toNode:l,toHandle:u})=>{let d=(0,R.useContext)(fr),[f]=_e({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a}),p=o===`invalid`&&l&&u?.id&&c.id?d?.({node:s.id,handle:c.id},{node:l.id,handle:u.id}):void 0;return(0,H.jsxs)(`g`,{className:p?`pb-wire-refused`:void 0,children:[(0,H.jsx)(`path`,{d:f,fill:`none`,className:`react-flow__connection-path`}),p&&(0,H.jsx)(`foreignObject`,{x:n+12,y:r-30,width:260,height:28,className:`overflow-visible`,children:(0,H.jsx)(`div`,{className:`inline-block rounded border border-danger bg-danger-soft px-1.5 py-0.5 text-xs whitespace-nowrap text-danger-text shadow`,children:p})})]})},mr=(e,t)=>{let n=De(),[r,i]=(0,R.useState)(),a=(0,R.useMemo)(()=>JSON.stringify(xt(e,t)),[e,t]);return(0,R.useEffect)(()=>{if(!n)return;let e=!0;return Ct(n,JSON.parse(a)).then(t=>{e&&i(t)}),()=>{e=!1}},[n,a]),r},hr={state:Pn,trigger:Fn,pure:Qn},gr=e=>e?.kind===`state`?e.scope.join(`/`):``,_r=({laidOut:e,tidied:t})=>{let n=ye();return(0,R.useEffect)(()=>{e&&n.fitView({maxZoom:1,padding:.1})},[e,t]),null},vr=()=>{let e=ye(),t=xe(e=>e.width),n=(0,R.useRef)(t);return(0,R.useEffect)(()=>{let r=n.current;if(n.current=t,r===0||t===0||t===r)return;let{x:i,y:a,zoom:o}=e.getViewport();e.setViewport({x:i+(t-r)/2,y:a,zoom:o})},[t,e]),null},yr=({laidOut:e,ids:t})=>{let n=Ee();return(0,R.useEffect)(()=>{e&&n(t)},[e]),null},br=new Map,xr=({definition:e,problems:t,warnings:n,selected:r,onSelect:a,onChange:o,edits:s,onAddAt:c,traces:l,types:u,schemas:d,fills:p=!1,layout:h,onLayoutChange:g})=>{let _=o&&s&&{onChange:o,edits:s},v=(0,R.useMemo)(()=>ht(e),[e]),ee=(0,R.useRef)(null),[y,te]=Bn(),b=dr(e,v,y===`pins`?d:void 0,_,ee),x=mr(v,b.layout),S=(0,R.useMemo)(()=>new Map(v.nodes.map(e=>[e.id,e])),[v]),re=JSON.stringify(h??{}),C=(0,R.useMemo)(()=>pe(re),[re]),w=C[y],T=e=>g?.({...C,[y]:e}),E=(0,R.useMemo)(()=>new Map([...v.nodes.map(e=>[e.id,me(e.id)]),...(b.data?.pure??[]).map(e=>[e.id,me(e.id,e)])]),[v,b.data]),D=(0,R.useMemo)(()=>new Map([...E].flatMap(([e,t])=>Object.hasOwn(w,t)?[[e,w[t]]]:[])),[E,w]),O=(0,R.useMemo)(()=>{if(!x)return;let e=new Map((b.data?.pure??[]).map(e=>[e.id,e]));return ue(x,D,t=>{let n=S.get(t);return e.has(t)?Jt(v,e.get(t)):n?.kind===`state`?n.parent:void 0})},[x,D,S,v,b.data]),k=!!g,[ie,ae]=(0,R.useState)(br),[A,j]=(0,R.useState)(0),M=ne(e)===`data`,[N,se]=(0,R.useState)(()=>new Set(r===void 0?[]:[K(r)]));(0,R.useEffect)(()=>{se(e=>r===void 0?e.size===1&&!q([...e][0])?new Set:e:e.has(K(r))?e:new Set([K(r)]))},[r]);let ce=(0,R.useMemo)(()=>[...Zt(v,O,t,r,l,u,n,b.data&&{data:b.data,open:b.open},M),...b.data?rn(v,b.data,O,b.open):[]].map(e=>{let t=ie.get(e.id),n=D.has(J(e.id));return{...e,selected:N.has(e.id),draggable:k,...t&&{position:t},...n&&{data:{...e.data,moved:!0},...e.ariaLabel&&{ariaLabel:`${e.ariaLabel}, ${F(`movedByHand`)}`}}}}),[v,O,t,r,l,u,n,b.data,b.open,M,N,ie,D,k]),[le,de]=(0,R.useState)(),fe=(0,R.useMemo)(()=>[...M&&b.data?an(v,b.data):nn(v,M),...b.data?on(b.data):[]].map(e=>({...e,selected:e.id===le})),[v,b.data,le,M]),P=!!_,he=e=>{if(Q(e.sourceHandle)||Q(e.targetHandle))return Q(e.sourceHandle)&&Q(e.targetHandle)&&b.isValid(e);if(e.targetHandle!==`in`)return!1;let t=S.get(J(e.target)),n=S.get(J(e.source));return t?.kind===`state`&&gr(n)===gr(t)},ge=e=>{ae(br);let t=[...e].flatMap(([e,t])=>{let n=J(e),r=E.get(n),i=O?.get(n),a={x:Math.round(t.x),y:Math.round(t.y)};return r===void 0||!D.has(n)&&i&&Math.round(i.x)===a.x&&Math.round(i.y)===a.y?[]:[[r,a]]});t.length>0&&T({...w,...Object.fromEntries(t)})},_e=g&&(e=>{let t=E.get(J(e));t!==void 0&&T(oe(w,t))}),I=()=>{T({}),j(e=>e+1)},ve=e=>{let t=new Map;for(let n of e){if(n.type!==`position`||!n.position||!k)continue;let e=n.position;n.dragging?ae(t=>new Map(t).set(n.id,e)):t.set(n.id,e)}t.size>0&&ge(t);let n=e.filter(e=>e.type===`select`);if(n.length===0)return;let i=new Set(N);for(let e of n)e.selected?i.add(e.id):i.delete(e.id);se(i);let[o]=i.size===1?[...i]:[],s=o===void 0||q(o)?void 0:J(o);if(s!==void 0&&(ye||xe.current))return r===void 0?void 0:a(void 0);s!==r&&a(s)},ye=we(`Shift`),xe=(0,R.useRef)(!1);return(0,H.jsx)(sn.Provider,{value:_?c:void 0,children:(0,H.jsx)(bn.Provider,{value:_e,children:(0,H.jsx)(ln.Provider,{value:b.actions,children:(0,H.jsx)(fr.Provider,{value:b.check,children:(0,H.jsxs)(`div`,{ref:ee,className:`relative h-full w-full`,children:[(0,H.jsxs)(Ce,{className:`pb-workflow`,nodes:ce,edges:fe,nodeTypes:hr,nodesDraggable:k,nodeDragThreshold:4,selectNodesOnDrag:!1,nodesConnectable:P,connectOnClick:!1,connectionDragThreshold:4,edgesFocusable:P,elementsSelectable:!0,deleteKeyCode:P?[`Backspace`,`Delete`]:null,onNodesChange:ve,onEdgesChange:e=>{for(let t of e)t.type===`select`&&(t.selected?de(t.id):de(e=>e===t.id?void 0:e))},isValidConnection:he,onConnect:t=>{if(_&&t.sourceHandle){if(Q(t.sourceHandle))return b.connect(t);_.onChange(_.edits.connect(e,t.sourceHandle,J(t.source),J(t.target)))}},onConnectEnd:b.connectEnd,connectionLineComponent:pr,onDelete:({nodes:t,edges:n})=>{if(!_)return;let r=t.filter(e=>!q(e.id)).map(e=>J(e.id)).filter(e=>e!==``),i=b.remove(e,t,n);for(let e of n){let t=e.data;t.kind!==`data`&&!r.includes(t.source)&&!r.includes(J(e.target))&&(i=_.edits.disconnect(i,t))}for(let e of r)r.some(t=>e.startsWith(`${t}/`))||(i=_.edits.removeState(i,e));_.onChange(i)},multiSelectionKeyCode:`Shift`,onSelectionStart:()=>void(xe.current=!0),onSelectionEnd:()=>void(xe.current=!1),onNodeClick:(e,t)=>!e.shiftKey&&!q(t.id)&&a(J(t.id)),onPaneClick:()=>a(void 0),zoomOnScroll:!0,panOnScroll:!1,panOnDrag:[0,1,2],selectionOnDrag:!1,selectionKeyCode:`Shift`,preventScrolling:!0,onPaneContextMenu:e=>e.preventDefault(),minZoom:.2,maxZoom:1.5,"aria-label":F(`canvas`),children:[(0,H.jsx)(Te,{gap:16}),d&&(0,H.jsx)(be,{position:`top-left`,children:(0,H.jsx)(i,{label:F(`graphView`),value:y,onChange:te,options:[{value:`pins`,label:F(`viewPins`)},{value:`simple`,label:F(`viewSimple`)}]})}),k&&Object.keys(w).length>0&&(0,H.jsx)(be,{position:`top-right`,children:(0,H.jsxs)(f,{title:F(`tidyUpHelp`),onClick:I,children:[(0,H.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),F(`tidyUp`)]})}),(0,H.jsx)(Se,{showInteractive:!1}),(0,H.jsx)(_r,{laidOut:x,tidied:A}),p&&(0,H.jsx)(vr,{}),(0,H.jsx)(yr,{laidOut:O,ids:ce.map(e=>e.id)})]}),b.offer&&(0,H.jsx)($n,{offer:b.offer,onClose:b.closeOffer})]})})})})})},Sr=e=>(0,H.jsx)(ve,{children:(0,H.jsx)(xr,{...e})});export{it as a,Le as c,Pe as d,je as f,ze as g,Be as h,ot as i,Ue as l,Ve as m,cn as n,at as o,Me as p,lt as r,Ke as s,Sr as t,Fe as u};
|
|
4
|
-
//# debugId=
|
|
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{Cn as r,Kc as i,Mo as a,To as o,fc as s,gc as c,ns as l,oo as u,ou as d,qc as f}from"./app-CwxoFZn2.js";import{t as p}from"./circle-alert-B-bmotNV.js";import{t as m}from"./layout-grid-OO8eIGYq.js";import{E as h,M as g,O as _,P as v,S as ee,_ as y,b as te,c as b,d as x,g as S,h as ne,j as re,k as C,l as w,m as T,o as E,u as D,v as O,x as k,y as ie}from"./workflows-Bey4jszG.js";import{C as ae,S as A,a as oe,b as j,c as M,d as N,f as se,g as ce,h as le,i as ue,l as de,m as fe,o as pe,p as P,r as me,s as he,u as ge}from"./use-run-trace-5H4UJvB-.js";import{n as F}from"./use-workflow-types-Cjkw47Mf.js";import{E as _e,a as I}from"./lib-xyflow-system-hojcPWkY.js";import{a as ve,c as ye,i as be,l as xe,n as Se,o as Ce,r as L,s as we,t as Te,u as Ee}from"./lib-xyflow-react-CuNAzocq.js";import{t as De}from"./use-elk-u1Ql5AOs.js";var Oe={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};Oe.node;var ke=i(Oe),R=e(t(),1),Ae={"app:http":()=>F(`stepHttp`),"app:records.create":()=>F(`stepRecordsCreate`),"app:records.update":()=>F(`stepRecordsUpdate`),"app:records.get":()=>F(`stepRecordsGet`),"app:records.list":()=>F(`stepRecordsList`),"app:mail.send":()=>F(`stepMailSend`),"app:mail.template":()=>F(`stepMailTemplate`),"app:piece":()=>F(`stepPiece`)},je=(e,t)=>Ae[e]?.()??t??e,Me=(e,t)=>{let n=je(e,t),r=T(e);return r?F(`stepTypeVersion`,{type:n,version:r.version}):n},Ne={Pass:()=>F(`typePass`),Choice:()=>F(`typeChoice`),Wait:()=>F(`typeWait`),Map:()=>F(`typeMap`),Block:()=>F(`typeBlock`),Succeed:()=>F(`typeSucceed`),Fail:()=>F(`typeFail`)},Pe=e=>Ne[e]?.()??e,Fe=(e,t)=>{if(e.Type!==`Task`)return Pe(e.Type);let{type:n,waits:r}=C(String(e.Resource)),i=je(n,t?.step_types.find(e=>e.id===n)?.label);return r?F(`stepTypeWaits`,{type:i}):i},Ie={url:()=>F(`inputUrl`),method:()=>F(`inputMethod`),headers:()=>F(`inputHeaders`),query:()=>F(`inputQuery`),body:()=>F(`inputBody`),response:()=>F(`inputResponse`),resource:()=>F(`inputResource`),data:()=>F(`inputData`),key:()=>F(`inputKey`),filter:()=>F(`inputFilter`),order_by:()=>F(`inputOrderBy`),limit:()=>F(`inputLimit`),to:()=>F(`inputTo`),subject:()=>F(`inputSubject`),text:()=>F(`inputText`),html:()=>F(`inputHtml`),attachments:()=>F(`inputAttachments`),piece:()=>F(`inputPiece`),action:()=>F(`inputAction`),connection:()=>F(`inputConnection`),props:()=>F(`inputProps`),when:()=>F(`inputWhen`),body_schema:()=>F(`inputBodySchema`)},Le=(e,t)=>Ie[e]?.()??t??e,Re={manual:()=>F(`triggerManual`),"app:record":()=>F(`triggerRecord`)},ze=(e,t)=>Re[e]?.()??t??e,Be=e=>Object.keys(e??{})[0],Ve=(e,t)=>{let n=Be(e);return n===void 0?F(`triggerUnknown`):ze(n,t?.triggers.find(e=>e.id===n)?.label)},He={succeeded:()=>F(`traceSucceeded`),caught:()=>F(`traceCaught`),retrying:()=>F(`traceRetrying`),failed:()=>F(`traceFailed`),current:()=>F(`traceCurrent`)},Ue=e=>He[e](),We=(e,t)=>t?.step_types.find(t=>t.id===C(e.Resource).type)?.cache,Ge=(e,t)=>e.Type===`Task`&&e.Cache===!0&&We(e,t)?.choice===`discouraged`,Ke=(e,t)=>{let n=We(e,t);if(n?.choice!==`hidden`)return n?.choice===`switch`?{on:e.Cache??n.default===!0,forces:!1,offValue:!1,disclaimer:void 0}:{on:e.Cache===!0,forces:!0,offValue:void 0,disclaimer:n?.choice===`discouraged`?n.disclaimer:void 0}},z=e=>encodeURIComponent(e),qe=e=>e.map(e=>`/${z(e)}`).join(``),Je=e=>e===``?[]:e.split(`/`).slice(1).map(decodeURIComponent),Ye=(e,t)=>`break:${z(e)}|${qe(t)}`,Xe=(e,t)=>`make:${z(e)}|${z(t)}`,Ze=(e,t)=>`when:${z(e)}|${t.join(`/`)}`,Qe=(e,t)=>`select:${z(e)}|${z(t)}`,B=e=>`in:${z(e)}`,V=e=>`out:${qe(e)}`,$e=`break-in`,et=`make-out`,tt=`condition-out`,nt=`select-out`,rt=`value`,it=e=>e?.startsWith(`in:`)?decodeURIComponent(e.slice(3)):void 0,at=e=>e?.startsWith(`out:`)?Je(e.slice(4)):void 0,H=e(n(),1),ot=(e,t)=>{let n=e.pure.find(e=>e.id===t.target),r=it(t.targetHandle);return n?.kind===`condition`&&r!==void 0?{step:n.target,at:[...n.at,Number(r)]}:void 0},st=e=>e.kind===`condition`?{step:e.target,at:e.at}:void 0,ct=(e,t)=>{for(let n=0;n<Math.min(e.length,t.length);n++)if(e[n]!==t[n])return e[n]-t[n];return e.length-t.length},lt=(e,t,n)=>{let r=new Map,i=[];for(let e of t){let t=n(e);if(!t){i.push(e);continue}let a=`step:${t.step}`;r.has(a)||(r.set(a,[]),i.push(a)),r.get(a).push({removal:e,at:t.at})}return i.flatMap(e=>typeof e==`string`&&r.has(e)?r.get(e).toSorted((e,t)=>ct(t.at,e.at)).map(({removal:e})=>e):[e])},ut=e=>e.Type===`Choice`&&Array.isArray(e.Choices)?e.Choices:[],dt=e=>`Catch`in e&&Array.isArray(e.Catch)?e.Catch:[],ft=(e,t,n,r)=>{let i=A(t,n),a=(n,r,a,o)=>Object.hasOwn(e.States,a)?[{id:`${i}\n${r}`,kind:n,source:i,target:A(t,a),field:r,...o!==void 0&&{label:o}}]:[];return[...`Next`in r&&typeof r.Next==`string`?a(`next`,`Next`,r.Next):[],...ut(r).flatMap((e,t)=>a(`rule`,`Choices[${t}].Next`,e.Next,e.Condition)),...r.Type===`Choice`&&typeof r.Default==`string`?a(`default`,`Default`,r.Default):[],...dt(r).flatMap((e,t)=>e.Next===void 0?[]:a(`catch`,`Catch[${t}].Next`,e.Next,Array.isArray(e.ErrorEquals)?e.ErrorEquals.join(`, `):void 0))]},pt=(e,t)=>{let n=t.length>0?t.join(`/`):void 0,r=Object.entries(e.States).map(([r,i])=>{let a={kind:`state`,id:A(t,r),name:r,state:i,scope:t,...n!==void 0&&{parent:n},first:e.StartAt===r},o=g(i),s=o?.States?pt(o,[...t,r]):{nodes:[],edges:[]};return{nodes:[a,...s.nodes],edges:[...ft(e,t,r,i),...s.edges]}});return{nodes:r.flatMap(e=>e.nodes),edges:r.flatMap(e=>e.edges)}},mt=(e,t,n)=>[...y(e)].flatMap(([r,i])=>{let a=A(t,r),o=[...S(i)].map(e=>{let n=i.data.has(e)?`reads`:`status`;return{id:`${A(t,e)}\n${n}\n${a}`,kind:n,source:A(t,e),target:a,field:n}}),s=g(e.States[r]),c=s?.States?mt(s,[...t,r],!1):[];return[...n&&o.length===0?[{id:`\nStart\n${a}`,kind:`start`,source:``,target:a,field:`StartAt`}]:[],...o,...c]}),ht=e=>{let t=e.stateMachine,n=pt(t,[]);if(ne(e)===`data`)return{nodes:[{kind:`trigger`,id:``,trigger:e.trigger},...n.nodes.map(e=>e.kind===`state`?{...e,first:!1}:e)],edges:mt(t,[],!0)};let r=t.StartAt!==void 0&&Object.hasOwn(t.States,t.StartAt)?[{id:`
|
|
2
|
+
StartAt`,kind:`start`,source:``,target:t.StartAt,field:`StartAt`}]:[];return{nodes:[{kind:`trigger`,id:``,trigger:e.trigger},...n.nodes],edges:[...r,...n.edges]}},U={width:224,height:64},gt=(e,t)=>`${e}\u0000${t}`,_t={"elk.algorithm":`layered`,"elk.direction":`RIGHT`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.layered.spacing.nodeNodeBetweenLayers":`72`,"elk.spacing.nodeNode":`32`,"elk.edgeLabels.inline":`false`},vt={"elk.layered.layering.strategy":`LONGEST_PATH`},yt={"elk.padding":`[top=48,left=24,bottom=24,right=24]`},bt=e=>e.kind===`state`&&j(e.state),xt=(e,t={})=>{let n=e=>{let n=t.sizes?.get(e)??U,r=t.ports?.get(e);return r?.length?{id:e,...n,layoutOptions:{"elk.portConstraints":`FIXED_POS`},ports:r.map(t=>({id:gt(e,t.handle),x:t.side===`in`?0:n.width,y:t.y,width:0,height:0,layoutOptions:{"elk.port.side":t.side===`in`?`WEST`:`EAST`}}))}:{id:e,...n}},r=(e,n)=>n!==void 0&&t.ports?.get(e)?.some(e=>e.handle===n)?gt(e,n):e,i=e=>(t.pure??[]).filter(t=>t.parent===e).map(e=>n(e.id)),a=t=>{if(!bt(t))return n(t.id);let r=e.nodes.filter(e=>e.kind===`state`&&e.parent===t.id);return{id:t.id,layoutOptions:yt,children:[...r.map(a),...i(t.id)],edges:s(t.id)}},o=n=>{let r=t.pure?.find(e=>e.id===n);if(r)return r.parent;let i=e.nodes.find(e=>e.id===n);return i?.kind===`state`?i.parent:void 0},s=n=>[...e.edges.filter(e=>o(e.target)===n).map(e=>({id:e.id,sources:[e.source],targets:[e.target]})),...(t.wires??[]).filter(e=>o(e.target)===n&&o(e.source)===n).map(e=>({id:e.id,sources:[r(e.source,e.sourceHandle)],targets:[r(e.target,e.targetHandle)]}))],c=e.nodes.filter(e=>e.kind===`trigger`||e.parent===void 0);return{id:`root`,layoutOptions:t.dataOrder?{..._t,...vt}:_t,children:[...c.map(a),...i(void 0)],edges:s(void 0)}},St=e=>{let t=new Map,n=e=>{for(let r of e.children??[])t.set(r.id,{x:r.x??0,y:r.y??0,width:r.width??U.width,height:r.height??U.height}),n(r)};return n(e),t},Ct=async(e,t)=>St(await e.layout(t)),wt=24,Tt=8,Et=(e,t)=>{let n=t?[...e]:e.filter(e=>e.required||e.state!==`empty`);return{shown:n,folded:e.length-n.length}},Dt=(e,t,n,r=52)=>r+Math.max(e,typeof t==`number`?t:t.length)*26+(n?wt:0)+Tt,Ot={string:()=>F(`typeString`),integer:()=>F(`typeInteger`),number:()=>F(`typeNumber`),boolean:()=>F(`typeBoolean`),object:()=>F(`typeObject`),array:()=>F(`typeArray`),null:()=>F(`typeNull`),any:()=>F(`typeAny`)},W=e=>e.title===void 0?e.kinds===`any`?Ot.any():e.kinds.map(e=>Ot[e]()).reduce((e,t)=>F(`typeOr`,{first:e,second:t})):e.title,G=e=>e.kinds===`any`?`any`:e.kinds[0],kt={status:()=>F(`outputStatus`),headers:()=>F(`outputHeaders`),body:()=>F(`outputBody`),record:()=>F(`outputRecord`),resource:()=>F(`outputResource`),key:()=>F(`outputKey`),records:()=>F(`outputRecords`),message_id:()=>F(`outputMessageId`)},At=(e,t=!1,n=!1)=>{if(e.length===0)return F(t?`pinRunInput`:`pinResult`);if(e.length===1&&e[0]===`#status`)return F(`stepStatusType`);let r=e.at(-1);return n||!Object.hasOwn(kt,r)?r:kt[r]()},jt=e=>e===`#condition`?F(`onlyWhen`):Le(e),Mt={"=":()=>F(`conditionEquals`),"!=":()=>F(`conditionNotEquals`),">":()=>F(`conditionGreater`),"<":()=>F(`conditionLess`),matches:()=>F(`conditionMatches`),and:()=>F(`conditionAnd`),or:()=>F(`conditionOr`),not:()=>F(`conditionNot`),expression:()=>F(`conditionExpression`)},Nt=e=>Mt[e](),Pt=({part:e})=>Nt(e.kind===`compare`||e.kind===`logic`?e.op:e.kind),Ft={SUCCEEDED:()=>F(`statusSucceeded`),FAILED:()=>F(`statusFailed`),TIMED_OUT:()=>F(`statusTimedOut`),ABORTED:()=>F(`statusAborted`),SKIPPED:()=>F(`statusSkipped`)},It=e=>Object.hasOwn(Ft,e)?Ft[e]():e,Lt=34,Rt=280,zt=8,Bt=(e,t)=>e.kind===`condition`?{shown:e.inputs,folded:0}:e.kind===`make`?Et(e.inputs,t||e.inputs.length<=zt):{shown:[],folded:0},Vt=(e,t,n)=>{let r=new Set(t.filter(t=>t.source===e.id).map(e=>e.sourceHandle)),i=e.outputs.filter(e=>r.has(V(e.path))),a=i.length>0&&i.length<e.outputs.length;return n||!a?{shown:e.outputs,folded:0,foldable:a}:{shown:i,folded:e.outputs.length-i.length,foldable:a}},Ht=e=>106+e*26+8,Ut=(e,t,n)=>{let r=new Map;for(let i of e.nodes){if(i.kind===`state`&&j(i.state))continue;let{shown:e,folded:a}=Et(t.inputs.get(i.id)??[],n.has(i.id));r.set(i.id,{width:296,height:Dt(e.length,t.outputs.get(i.id)??[],a>0||n.has(i.id))})}for(let e of t.pure){if(e.kind===`condition`&&e.part.kind===`expression`){r.set(e.id,{width:216,height:Ht(e.inputs.length)});continue}if(e.kind===`select`){r.set(e.id,{width:Rt,height:Dt(e.part.cases.length+3,1,!1,Lt)});continue}if(e.kind===`break`){let i=Vt(e,t.edges,n.has(e.id));r.set(e.id,{width:216,height:Dt(0,i.shown.length,i.foldable,Lt)});continue}let{shown:i,folded:a}=Bt(e,n.has(e.id));r.set(e.id,{width:216,height:Dt(i.length,1,e.kind===`make`&&(a>0||n.has(e.id)),Lt)})}return r},Wt=(e,t)=>e+t*26+13,Gt=13,Kt=38,qt=(e,t,n)=>{let r=new Map;for(let i of e.nodes){if(i.kind===`state`&&j(i.state))continue;let{shown:e}=Et(t.inputs.get(i.id)??[],n.has(i.id));r.set(i.id,[...e.map((e,t)=>({handle:B(e.key),side:`in`,y:Wt(52,t)})),...(t.outputs.get(i.id)??[]).map((e,t)=>({handle:V(e.path),side:`out`,y:Wt(52,t)}))])}for(let e of t.pure){let i=(e,t=Kt)=>e.map((e,n)=>({handle:B(e.key),side:`in`,y:Wt(t,n)}));if(e.kind===`break`){let{shown:i}=Vt(e,t.edges,n.has(e.id));r.set(e.id,[{handle:$e,side:`in`,y:Gt},...i.map((e,t)=>({handle:V(e.path),side:`out`,y:Wt(Kt,t)}))])}else if(e.kind===`make`)r.set(e.id,[{handle:et,side:`out`,y:Gt},...i(Bt(e,n.has(e.id)).shown)]);else if(e.kind===`select`)r.set(e.id,[{handle:nt,side:`out`,y:Gt},...i(e.inputs)]);else{let t=e.part.kind===`expression`?Kt+64+4:Kt;r.set(e.id,[{handle:tt,side:`out`,y:Gt},...i(e.inputs,t)])}}return r},Jt=(e,t)=>{let n=e.nodes.find(e=>e.id===(t.kind===`break`?t.source:t.target));return n?.kind===`state`?n.parent:void 0},Yt=`trigger`,K=e=>e===``?Yt:`state:${e}`,q=e=>e!==Yt&&!e.startsWith(`state:`),J=e=>e===Yt?``:e.startsWith(`state:`)?e.slice(6):e,Xt=(e,t,n)=>{let{shown:r,folded:i}=Et(e.inputs.get(t)??[],n);return{inputs:r,outputs:e.outputs.get(t)??[],folded:i,open:n}},Zt=(e,t,n,r,i,a,o,s,c=!1)=>e.nodes.map(e=>{let l=t?.get(e.id)??{x:0,y:0,...U},u=e.kind===`state`?e.parent:void 0,d=e.kind===`trigger`?Ve(e.trigger,a):Fe(e.state,a),f=e.kind===`state`&&Ge(e.state,a),p=e.kind===`state`?F(`stateNode`,{name:e.name,type:d}):F(`triggerNode`,{trigger:d}),m=o?.get(e.id)??[],h=[...f?[F(`cacheForcedAgainst`)]:[],...m.map(e=>e.message)];return{id:K(e.id),type:e.kind,ariaLabel:[p,...h].join(`, `),position:{x:l.x,y:l.y},width:l.width,height:l.height,measured:{width:l.width,height:l.height},data:{node:e,kind:d,problems:n.get(e.id)??[],...i?.has(e.id)&&{trace:i.get(e.id)},...f&&{cacheWarning:f},...m.length>0&&{warnings:m},...s&&{pins:Xt(s.data,e.id,s.open.has(e.id))},...c&&{dataOrder:c}},draggable:!1,deletable:e.kind===`state`,selected:e.id===r,...u!==void 0&&{parentId:K(u),extent:`parent`}}}),Qt=40,$t=e=>e.length>Qt?`${e.slice(0,39)}…`:e,en=e=>{if(e.kind==="default")return F(`otherwise`);if(e.kind===`catch`)return F(`onError`,{errors:e.label??``});if(e.kind===`rule`)return e.label?$t(e.label):F(`conditionToWrite`)},tn=e=>({id:e.id,source:K(e.source),sourceHandle:`out`,target:K(e.target),targetHandle:`in`,deletable:!1,data:{kind:e.kind,field:e.field,source:e.source},...e.kind===`status`&&{className:`pb-workflow-status`}}),nn=(e,t=!1)=>e.edges.map(e=>{if(t)return tn(e);let n=en(e);return{id:e.id,source:K(e.source),sourceHandle:e.kind,target:K(e.target),targetHandle:`in`,deletable:e.kind!==`start`,data:{kind:e.kind,field:e.field,source:e.source},...n!==void 0&&{label:n},...e.kind===`catch`&&{className:`pb-workflow-catch`}}}),rn=(e,t,n,r)=>t.pure.map(i=>{let a=n?.get(i.id)??{x:0,y:0,...U},o=Jt(e,i),{shown:s,folded:c}=Bt(i,r.has(i.id)),l=i.kind===`break`?Vt(i,t.edges,r.has(i.id)):void 0,u=e.nodes.find(e=>e.id===(i.kind===`break`?i.source:i.target));return{id:i.id,type:`pure`,position:{x:a.x,y:a.y},width:a.width,height:a.height,measured:{width:a.width,height:a.height},data:{node:u,kind:i.kind,problems:[],pureData:{pure:i,shownInputs:s,shownOutputs:l?.shown??[],folded:l?.folded??c,open:r.has(i.id),foldable:l?l.foldable:c>0||r.has(i.id)}},draggable:!1,deletable:!0,...o!==void 0&&{parentId:K(o),extent:`parent`}}}),an=(e,t)=>{let n=e=>{let n=t.pure.find(t=>t.id===e);return n?n.kind===`break`?n.source:n.target:e},r=new Set(t.edges.map(e=>`${n(e.source)}\n${n(e.target)}`));return nn({...e,edges:e.edges.filter(e=>e.source!==``&&!r.has(`${e.source}\n${e.target}`))},!0)},on=e=>{let t=new Set(e.pure.map(e=>e.id)),n=e=>t.has(e)?e:K(e);return e.edges.map(e=>({id:e.id,source:n(e.source),sourceHandle:e.sourceHandle,target:n(e.target),targetHandle:e.targetHandle,deletable:!e.expression,data:{kind:`data`,wire:e},className:`pb-wire pb-wire-${G(e.type)}${e.expression?` pb-wire-expression`:``}`}))},sn=(0,R.createContext)(void 0),cn={succeeded:`green`,caught:`amber`,retrying:`amber`,failed:`red`,current:`blue`},ln=(0,R.createContext)(void 0),Y=()=>(0,R.useContext)(ln),un=e=>{if(e.options)return`choice`;if(e.type.kinds===`any`)return;let[t,...n]=e.type.kinds.filter(e=>e!==`null`);if(t===`string`&&n.every(e=>e===`integer`||e===`number`))return`string`;if(!(n.length>0))return t===`integer`||t===`number`?`number`:t===`boolean`?`boolean`:void 0},dn=e=>e.trim()===``?void 0:Number.isNaN(Number(e))?e:Number(e),fn=({name:e,className:t,value:n,onChange:r})=>{let[i,o]=(0,R.useState)();return(0,H.jsx)(a,{"aria-label":e,wrapperClassName:`${t} h-6 w-[55%] px-1.5`,className:`text-xs`,inputMode:`decimal`,value:i??(n===void 0?``:String(n)),onChange:e=>{o(e.target.value),r(dn(e.target.value))},onBlur:()=>o(void 0)})},pn=({pin:e,label:t,onChange:n})=>{if(e.state===`wired`||e.state===`made`||e.key===`#condition`&&e.state!==`expression`)return null;if(e.state===`expression`)return(0,H.jsx)(`span`,{className:`ml-auto shrink-0 rounded bg-muted px-1 font-mono text-xs text-muted-foreground`,title:F(`pinExpression`,{expression:String(e.value)}),children:`ƒ`});let i=un(e);if(e.state===`literal`&&typeof e.value==`object`)return(0,H.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,title:F(`pinObjectValue`),children:`{…}`});if(!i)return e.state===`literal`?(0,H.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-xs text-muted-foreground`,children:String(e.value)}):null;let o=F(`inputValue`,{label:t});if(!n)return(0,H.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-xs text-muted-foreground`,children:e.value===void 0?``:String(e.value)});let s=`nodrag nopan nowheel ml-auto min-w-0`;return i===`boolean`?(0,H.jsx)(u,{className:s,checked:e.value===!0,label:o,onChange:e=>n(e)}):i===`choice`?(0,H.jsxs)(r,{"aria-label":o,className:`${s} h-6 max-w-[55%] px-1 py-0 text-xs`,value:typeof e.value==`string`?e.value:``,onChange:e=>n(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(`option`,{value:``}),e.options.map(t=>(0,H.jsx)(`option`,{value:t,children:e.statuses?It(t):t},t))]}):i===`number`?(0,H.jsx)(fn,{name:o,className:s,value:e.value,onChange:n}):(0,H.jsx)(a,{"aria-label":o,wrapperClassName:`${s} h-6 w-[55%] px-1.5`,className:`text-xs`,value:e.value===void 0?``:String(e.value),onChange:e=>n(e.target.value===``?void 0:e.target.value)})},mn=e=>`pb-pin pb-pin-${G(e.type)}`,hn=({pin:e,step:t,keys:n,connectable:r,name:i,onValue:a,bare:o=!1})=>{let s=Y(),c=i??jt(e.key);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center gap-1.5 pr-2 pl-3`,children:[(0,H.jsx)(L,{id:B(e.key),type:`target`,position:I.Left,isConnectable:r,className:mn(e)}),(0,H.jsxs)(`span`,{className:`min-w-0 shrink truncate text-xs text-body`,title:F(`pinTypeTitle`,{label:c,type:W(e.type)}),children:[c,e.required&&(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-danger-text`,children:`*`})]}),!o&&(0,H.jsx)(pn,{pin:e,label:c,...s&&r&&{onChange:a??(e=>s.setArgument(t,n,e))}})]})},gn=({pin:e,connectable:t,trigger:n=!1,field:r=!1})=>{let i=At(e.path,n,r);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center justify-end pr-3 pl-2`,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate text-xs text-body`,title:F(`pinTypeTitle`,{label:i,type:W(e.type)}),children:i}),(0,H.jsx)(L,{id:V(e.path),type:`source`,position:I.Right,isConnectable:t,className:mn(e)})]})},_n=({inputs:e,outputs:t,connectable:n})=>{let r=(e,t)=>({top:`${(e+1)*100/(t+1)}%`});return(0,H.jsxs)(H.Fragment,{children:[e.map((t,i)=>(0,H.jsx)(L,{id:B(t.key),type:`target`,position:I.Left,isConnectable:n,className:mn(t),style:r(i,e.length),title:F(`pinTypeTitle`,{label:jt(t.key),type:W(t.type)})},t.key)),t.map((e,i)=>(0,H.jsx)(L,{id:V(e.path),type:`source`,position:I.Right,isConnectable:n,className:mn(e),style:r(i,t.length),title:F(`pinTypeTitle`,{label:At(e.path),type:W(e.type)})},e.path.join(`/`)))]})},vn=({node:e,folded:t,open:n,fields:r=!1})=>{let i=Y();return t===0&&!n?null:(0,H.jsx)(`button`,{type:`button`,className:`nodrag h-6 w-full px-3 text-left text-xs text-muted-foreground hover:text-foreground`,onClick:()=>i?.toggleOpen(e),disabled:!i,children:r?n?F(`foldLessFields`):F(`foldMoreFields`,{count:t}):n?F(`foldLess`):F(`foldMore`,{count:t})})},yn=({node:e,inputs:t,outputs:n,folded:r,open:i,editable:a,trigger:o=!1})=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-[3fr_2fr]`,children:[(0,H.jsx)(`div`,{className:`min-w-0`,children:t.map(t=>(0,H.jsx)(hn,{pin:t,step:e,keys:[t.key],connectable:a},t.key))}),(0,H.jsx)(`div`,{className:`min-w-0`,children:n.map(e=>(0,H.jsx)(gn,{pin:e,connectable:a,trigger:o},JSON.stringify(e.path)))})]}),(0,H.jsx)(vn,{node:e,folded:r,open:i})]}),bn=(0,R.createContext)(void 0),xn=`nodrag absolute -top-4 -right-4 z-10`,Sn=({node:e,name:t})=>{let n=(0,R.useContext)(bn);return n?(0,H.jsx)(s,{size:`icon`,className:xn,"aria-label":F(`unpin`,{name:t}),title:F(`unpinHelp`),onClick:t=>{t.stopPropagation(),n(e)},children:(0,H.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0})}):(0,H.jsxs)(`span`,{className:f(xn,`inline-flex size-7 items-center justify-center rounded-md border border-border-strong bg-background text-muted-foreground shadow-sm`),title:F(`movedByHand`),children:[(0,H.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`sr-only`,children:F(`movedByHand`)})]})},X=[18,38],Cn=e=>{if(e.Type===`Choice`)return[{kind:`rule`,top:X[0],label:F(`when`)},{kind:`default`,top:X[1],label:F(`otherwise`)}];let t=[`Task`,`Pass`,`Wait`,`Map`,`Block`].includes(e.Type)?[{kind:`next`,top:X[0]}]:[],n=e.Type===`Task`||e.Type===`Map`||e.Type===`Block`?[{kind:`catch`,top:X[t.length],label:F(`onErrorHandle`)}]:[];return[...t,...n]},wn=(e,t,n)=>{let r=(0,R.useContext)(sn);if(!r||!t)return{};let i=t=>{t.stopPropagation(),r(e)},a=n?F(`addStepAtNamedHandle`,{handle:n}):F(`addStepAtHandle`);return{role:`button`,tabIndex:0,"aria-label":a,title:a,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i(e))}}},Tn=({source:e,path:t,editable:n})=>(0,H.jsx)(L,{id:e.kind,type:`source`,position:I.Right,isConnectable:n,style:{top:e.top},className:f(`pb-workflow-exec`,`pb-workflow-handle-${e.kind}`),...wn({kind:e.kind,source:t},n,e.label),children:e.label&&(0,H.jsx)(`span`,{className:`pb-workflow-handle-label`,children:e.label})}),En=({state:e,path:t,editable:n})=>Cn(e).map(e=>(0,H.jsx)(Tn,{source:e,path:t,editable:n},e.kind)),Dn=({count:e})=>e>0&&(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-danger-text`,title:F(`problemCount`,{count:e}),children:[(0,H.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:F(`problemCount`,{count:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:e})]}),On=({label:e})=>(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center text-warning-text`,title:e,children:[(0,H.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`sr-only`,children:e})]}),kn=({trace:e})=>(0,H.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end gap-0.5`,children:[e.changed?(0,H.jsx)(`span`,{title:F(`changedSinceRun`),className:`rounded-full border border-dashed px-1.5 text-xs text-muted-foreground`,children:F(`changedShort`)}):(0,H.jsx)(l,{tone:cn[e.status],children:Ue(e.status)}),e.steps>1&&(0,H.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:F(`traceSteps`,{count:e.steps})})]}),An=(e,t,n)=>f(`rounded-lg border bg-background text-body shadow-sm`,t>0||n?.status===`failed`?`border-danger`:`border-border-strong`,e&&`ring-2 ring-primary/40`),jn=({name:e,kind:t,problems:n,first:r,trace:i,warnings:a=[]})=>(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:[t,r&&(0,H.jsxs)(`span`,{className:`text-primary-text`,children:[` · `,F(`startsHere`)]})]}),a.length>0&&(0,H.jsx)(On,{label:a.join(`
|
|
3
|
+
`)}),(0,H.jsx)(Dn,{count:n}),i&&(0,H.jsx)(kn,{trace:i})]}),(0,H.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e})]}),Mn=()=>(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(L,{id:`in`,type:`target`,position:I.Left,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}}),(0,H.jsx)(L,{id:`out`,type:`source`,position:I.Right,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}})]}),Nn=({condition:e})=>e!==void 0&&(0,H.jsx)(`span`,{className:`absolute top-1 right-6 max-w-[45%] truncate rounded bg-muted px-1 text-[0.625rem] text-muted-foreground`,title:e,children:F(`onlyWhenBadge`)}),Pn=({id:e,data:t,selected:n,isConnectable:r})=>{let{node:i,kind:a,problems:o,trace:s,cacheWarning:c,warnings:l=[],pins:u,dataOrder:d,moved:p}=t;return i.kind===`state`?(0,H.jsxs)(`div`,{className:f(An(n,o.length,s),`h-full`,j(i.state)&&`bg-muted/40`),children:[p&&(0,H.jsx)(Sn,{node:e,name:i.name}),(0,H.jsxs)(`div`,{className:`relative h-[52px] py-2 pr-6 pl-4`,children:[d?(0,H.jsx)(Mn,{}):(0,H.jsx)(L,{id:`in`,type:`target`,position:I.Left,isConnectable:r,className:`pb-workflow-exec`,style:{top:X[0]}}),d&&(0,H.jsx)(Nn,{condition:i.state.Condition}),(0,H.jsx)(jn,{name:i.name,kind:a,problems:o.length,first:i.first&&i.parent!==void 0,trace:s,warnings:[...c?[F(`cacheForcedAgainst`)]:[],...l.map(e=>e.message)]}),!d&&(0,H.jsx)(En,{state:i.state,path:i.id,editable:r}),u&&j(i.state)&&(0,H.jsx)(_n,{inputs:u.inputs,outputs:u.outputs,connectable:r})]}),u&&!j(i.state)&&(0,H.jsx)(yn,{node:i.id,inputs:u.inputs,outputs:u.outputs,folded:u.folded,open:u.open,editable:r})]}):null},Fn=({id:e,data:t,selected:n,isConnectable:r})=>{let{node:i,kind:a,problems:o,pins:s,dataOrder:c,moved:l}=t,u=wn({kind:`start`,source:i.id},r&&!c);return i.kind===`trigger`?(0,H.jsxs)(`div`,{className:f(An(n,o.length),`h-full border-dashed`),children:[l&&(0,H.jsx)(Sn,{node:e,name:F(`trigger`)}),(0,H.jsxs)(`div`,{className:`relative h-[52px] py-2 pr-6 pl-4`,children:[(0,H.jsx)(jn,{name:a,kind:F(`trigger`),problems:o.length}),c?(0,H.jsx)(L,{id:`out`,type:`source`,position:I.Right,isConnectable:!1,className:`pb-workflow-side`,style:{top:X[0]}}):(0,H.jsx)(L,{id:`start`,type:`source`,position:I.Right,isConnectable:r,className:`pb-workflow-exec`,style:{top:X[0]},...u})]}),s&&(0,H.jsx)(yn,{node:i.id,inputs:[],outputs:s.outputs,folded:0,open:!1,editable:r,trigger:!0})]}):null},In=`protobase:workflow-graph-view`,Ln=e=>d(()=>e().getItem(`protobase:workflow-graph-view`),null)===`simple`?`simple`:`pins`,Rn=(e,t)=>d(()=>t===`pins`?e().removeItem(In):e().setItem(In,t),void 0),zn=()=>localStorage,Bn=()=>{let[e,t]=(0,R.useState)(()=>Ln(zn));return[e,e=>{t(e),Rn(zn,e)}]},Vn=(e,t)=>e.part.kind===`not`?F(`conditionNotSide`):e.part.kind===`matches`?F(t===`0`?`conditionMatchesText`:`conditionMatchesPattern`):e.part.kind===`logic`?String.fromCharCode(65+Number(t)%26):F(t===`0`?`conditionSideA`:`conditionSideB`),Hn=({node:e,source:t})=>{let n=Y(),[r,i]=(0,R.useState)(),a=t.trim();return(0,H.jsx)(`textarea`,{"aria-label":F(`conditionExpressionText`),className:`nodrag nopan nowheel block w-full resize-none rounded border border-border bg-background px-1.5 py-1 font-mono text-xs text-foreground`,style:{height:64},spellCheck:!1,readOnly:!n,value:r??a,onChange:e=>i(e.target.value),onBlur:()=>{i(void 0);let t=r?.trim();t!==void 0&&t!==a&&n?.setCondition(e.target,t===``?void 0:`{% ${t} %}`)}})},Un=e=>e.replace(/^\$states\.context\.Steps\./,``).replace(/^\$states\.context\.Execution\.Input/,`input`),Wn=({node:e,editable:t})=>{let n=Y(),[r,i]=(0,R.useState)(),o=F(`conditionMatchesPattern`),s=String(e.inputs[1]?.value??``);return(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center gap-1.5 pr-2 pl-3`,children:[(0,H.jsx)(`span`,{className:`min-w-0 shrink truncate text-xs text-body`,children:o}),(0,H.jsx)(a,{"aria-label":F(`inputValue`,{label:o}),wrapperClassName:`nodrag nopan nowheel ml-auto h-6 w-[60%] min-w-0 px-1.5`,className:`font-mono text-xs`,value:r??s,disabled:!n||!t,onChange:t=>{i(t.target.value),t.target.value!==``&&n?.setConditionSide(e.target,[...e.at,1],t.target.value)},onBlur:()=>i(void 0)})]})},Gn=({node:e,editable:t})=>{let n=Y(),r=(0,H.jsx)(L,{id:tt,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-boolean`,style:{top:13}});return e.part.kind===`expression`?(0,H.jsxs)(`div`,{className:`relative grid gap-1 px-2 pt-1`,children:[r,(0,H.jsx)(Hn,{node:e,source:e.part.source}),(0,H.jsx)(`div`,{className:`-mx-2`,children:e.inputs.map(e=>(0,H.jsxs)(`div`,{className:`relative flex h-[26px] items-center pr-2 pl-3`,children:[(0,H.jsx)(L,{id:B(e.key),type:`target`,position:I.Left,isConnectable:!1,className:`pb-pin pb-pin-${G(e.type)}`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-body`,title:F(`pinTypeTitle`,{label:e.key,type:W(e.type)}),children:Un(e.key)})]},e.key))})]}):(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[r,e.inputs.map(r=>e.part.kind===`matches`&&r.key===`1`?(0,H.jsx)(Wn,{node:e,editable:t},r.key):(0,H.jsx)(hn,{pin:r,step:e.target,keys:[],name:Vn(e,r.key),bare:e.part.kind===`logic`&&Number(r.key)===e.part.sides.length,connectable:t,onValue:t=>n?.setConditionSide(e.target,[...e.at,Number(r.key)],t??``)},r.key))]})},Kn=(e,t)=>typeof t==`number`&&e.trim()!==``&&Number.isFinite(Number(e))?Number(e):typeof t==`boolean`&&(e===`true`||e===`false`)?e===`true`:e,qn=`nodrag nopan nowheel h-6 min-w-0 px-1.5`,Jn=({label:e,value:t,onChange:n,disabled:r})=>(0,H.jsx)(a,{"aria-label":e,wrapperClassName:`${qn} flex-1`,className:`text-xs`,value:String(t),disabled:r,onChange:e=>n(Kn(e.target.value,t))}),Yn=({node:e,editable:t})=>{let n=Y(),r=!n||!t,i=t=>n?.setArgument(e.target,[e.key],D(t)),{part:a}=e,o=(e,t)=>i({...a,cases:a.cases.map((n,r)=>r===e?{...n,...t}:n)});return(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:nt,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-${G(e.type)}`,style:{top:13}}),e.inputs.map(n=>(0,H.jsx)(hn,{pin:n,step:e.target,keys:[],name:F(`selectInput`),connectable:t,onValue:e=>i({...a,operand:{value:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:``}})},n.key)),a.cases.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1 pr-2 pl-3`,children:[(0,H.jsx)(Jn,{label:F(`selectWhen`,{case:t+1}),value:e.when,disabled:r,onChange:e=>o(t,{when:e})}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-muted-foreground`,children:`→`}),(0,H.jsx)(Jn,{label:F(`selectThen`,{case:t+1}),value:e.then,disabled:r,onChange:e=>o(t,{then:e})}),(0,H.jsx)(`button`,{type:`button`,className:`nodrag shrink-0 text-muted-foreground hover:text-foreground disabled:opacity-40`,"aria-label":F(`selectRemoveCase`,{case:t+1}),disabled:r||a.cases.length===1,onClick:()=>i({...a,cases:a.cases.filter((e,n)=>n!==t)}),children:(0,H.jsx)(c,{className:`size-3`,"aria-hidden":!0})})]},t)),(0,H.jsxs)(`div`,{className:`flex h-[26px] items-center gap-1 pr-2 pl-3`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-body`,children:F(`selectOtherwise`)}),(0,H.jsx)(Jn,{label:F(`selectOtherwise`),value:a.otherwise,disabled:r,onChange:e=>i({...a,otherwise:e})})]}),(0,H.jsx)(`button`,{type:`button`,className:`nodrag h-6 w-full px-3 text-left text-xs text-muted-foreground hover:text-foreground`,disabled:r,onClick:()=>i({...a,cases:[...a.cases,{when:``,then:``}]}),children:F(`selectAddCase`)})]})},Xn=e=>e.kind===`condition`?Pt(e):e.kind===`select`?F(`selectTitle`):e.kind===`break`?F(`breakTitle`,{type:W(e.type)}):F(`makeTitle`,{type:W(e.type)}),Zn=({pure:e})=>(0,H.jsx)(`div`,{className:`truncate border-b px-3 py-1.5 text-xs font-medium text-foreground`,children:Xn(e)}),Qn=({id:e,data:t,selected:n,isConnectable:r})=>{let{pureData:i,moved:a}=t;if(!i)return null;let{pure:o,shownInputs:s,shownOutputs:c,folded:l,open:u,foldable:d}=i;return(0,H.jsxs)(`div`,{className:f(`h-full rounded-lg border border-dashed border-border-strong bg-background text-body shadow-sm`,n&&`ring-2 ring-primary/40`),children:[a&&(0,H.jsx)(Sn,{node:e,name:Xn(o)}),(0,H.jsx)(Zn,{pure:o}),o.kind===`condition`?(0,H.jsx)(Gn,{node:o,editable:r}):o.kind===`select`?(0,H.jsx)(Yn,{node:o,editable:r}):o.kind===`break`?(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:$e,type:`target`,position:I.Left,isConnectable:!1,className:`pb-pin pb-pin-${G(o.type)}`,style:{top:13}}),c.map(e=>(0,H.jsx)(gn,{pin:e,connectable:r,field:!0},JSON.stringify(e.path))),d&&(0,H.jsx)(vn,{node:o.id,folded:l,open:u,fields:!0})]}):(0,H.jsxs)(`div`,{className:`relative pt-1`,children:[(0,H.jsx)(L,{id:et,type:`source`,position:I.Right,isConnectable:!1,className:`pb-pin pb-pin-${G(o.type)}`,style:{top:13}}),s.map(e=>(0,H.jsx)(hn,{pin:e,step:o.target,keys:[o.key,e.key],connectable:r},e.key)),(0,H.jsx)(vn,{node:o.id,folded:l,open:u})]})]})},$n=({offer:e,onClose:t})=>(0,H.jsxs)(`div`,{role:`dialog`,"aria-label":F(`pureOfferTitle`),className:`absolute z-10 grid gap-1 rounded-md border bg-background p-1 shadow-md`,style:{left:e.x,top:e.y},children:[e.choices.map((e,n)=>(0,H.jsx)(s,{size:`sm`,variant:`ghost`,className:`justify-start`,autoFocus:n===0,onClick:()=>{e.add(),t()},children:e.label},e.label)),(0,H.jsx)(s,{size:`sm`,variant:`ghost`,onClick:t,children:F(`pureOfferClose`)})]}),er=e=>typeof e==`object`&&!!e&&!Array.isArray(e),tr=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Z={kinds:[`boolean`]},nr=e=>e.sides.flatMap(e=>b(e)?nr(e):`read`in e?[e.read]:[]),rr=e=>!b(e)&&`read`in e&&`step`in e.read.base&&tr(e.read.path,[`Status`]),ir=(e,t)=>{if(t&&t.kinds!==`any`){let e=t.kinds.filter(e=>e!==`null`);if(e.length===1&&[`string`,`integer`,`number`,`boolean`].includes(e[0]))return{kinds:e}}return{kinds:[typeof e==`number`?`number`:typeof e==`boolean`?`boolean`:`string`]}},ar=e=>{let t=new Map;for(let[n,r]of re(e.stateMachine)){let i=`Assign`in r&&er(r.Assign)?r.Assign:{};for(let[r,a]of Object.entries(i)){let i=a===`{% $states.result %}`?ae(e.stateMachine,n)?.join(`/`):void 0;t.set(r,t.has(r)||i===void 0?null:i)}}return t},or=(e,t,n=[])=>{let r=new Map(re(e.stateMachine).map(([t,n])=>[ae(e.stateMachine,t).join(`/`),n])),i=ne(e)===`data`,a=new Map([[``,ce(e,t)],...[...r].map(([e,n])=>[e,[...le(n,t),...i?[fe]:[]]])]),o=new Map([...r].filter(([,e])=>i||e.Type===`Task`).map(([e,n])=>[e,[...i?[M(n)]:[],...se(n,t)]])),s=e=>[...r.keys()].find(t=>t.split(`/`).at(-1)===e),c=new Map,l=new Map,u=[],d=[],f=new Map,p=ar(e),m=(e,t,n,r=!1)=>{let i=`data:${e.node}|${e.handle}->${t}|${n}`;r&&f.has(i)||f.set(i,{id:i,source:e.node,sourceHandle:e.handle,target:t,targetHandle:n,type:e.type,...r&&{expression:!0}})},g=(e,t)=>{let n=e.find(e=>tr(e.path,t));return n||(n={path:t,type:_(void 0)},e.push(n)),n},y=(e,t)=>{let n=a.get(e),r=n.find(e=>tr(e.path,t)),i=n.some(e=>e.path.length>0&&e.path[0]!==`#status`);if(r||t.length===0||i&&t.length===1){let i=r??g(n,t);return{node:e,handle:V(i.path),type:i.type}}let o=S(e,t.slice(0,-1)),s=g(o.outputs,t.slice(-1));return{node:o.id,handle:V(s.path),type:s.type}},S=(n,i)=>{let a=Ye(n,i),o=c.get(a);if(o)return o;let s=ge(e,r.get(n),t,i),l={kind:`break`,id:a,source:n,path:i,type:_(s),outputs:de(s).map(([e,t])=>({path:[e],type:_(t)}))};return c.set(a,l),m(y(n,i),a,$e),l},C=(e,t,n)=>{let r=T(e);if(r)return m(r,t,n);for(let r of O(e)){let e=D(r);e&&m(e,t,n,!0)}},T=e=>{let t=ie(e);return t&&D(t)},D=e=>{if(`step`in e.base){let t=s(e.base.step);return t===void 0||!a.has(t)?void 0:y(t,[P,...e.path])}let t=`input`in e.base?``:p.get(e.base.variable);return t==null||!a.has(t)?void 0:y(t,e.path)},A=e=>{if(b(e)||!(`read`in e))return;if(!rr(e))return D(e.read);let t=s(e.read.base.step);return t===void 0||!a.has(t)?void 0:y(t,[P])},oe=(e,t,n,r)=>{let i=Ze(e,n),a=t.sides,o=a.map(A),s=a.map((e,n)=>{let r=String(n);if(b(e))return{key:r,type:Z,required:!1,value:void 0,state:`made`};if(`read`in e)return{key:r,type:o[n]?.type??_(void 0),required:!1,value:k(e.read),state:`wired`};if(`pattern`in e)return{key:r,type:{kinds:[`string`]},required:!1,value:e.pattern,state:`literal`};if(t.kind===`matches`)return{key:r,type:{kinds:[`string`]},required:!1,value:e.value,state:`literal`};if(t.kind!==`compare`)return{key:r,type:Z,required:!1,value:e.value,state:`literal`};let i=a[1-n];return rr(i)?{key:r,type:{kinds:[`string`]},required:!1,value:e.value,state:`literal`,options:x,statuses:!0}:{key:r,type:ir(e.value,o[1-n]?.type),required:!1,value:e.value,state:`literal`}});t.kind===`logic`&&s.push({key:String(a.length),type:Z,required:!1,value:void 0,state:`empty`}),u.push({kind:`condition`,id:i,target:e,at:n,part:t,inputs:s}),m({node:i,handle:tt,type:Z},r.node,r.handle),a.forEach((t,r)=>{b(t)?oe(e,t,[...n,r],{node:i,handle:B(String(r))}):o[r]&&m(o[r],i,B(String(r)))})},j=(e,t)=>{let n=E(t),r={node:e,handle:B(he)};if(n&&nr(n).every(e=>A({read:e})))return oe(e,n,[],r);let i=Ze(e,[]),a=O(t).flatMap(e=>{let t=A({read:e});return t?[{read:e,source:t}]:[]});u.push({kind:`condition`,id:i,target:e,at:[],part:{kind:`expression`,source:v(t)},inputs:a.map(({read:e,source:t})=>({key:te(e),type:t.type,required:!1,value:k(e),state:`wired`}))}),m({node:i,handle:tt,type:Z},r.node,r.handle);for(let{read:e,source:t}of a)m(t,i,B(te(e)),!0)},ue=(e,t)=>{let n=w(t.value),r=n&&A(n.operand);if(!n||`read`in n.operand&&!r)return!1;let i=Qe(e,t.key),a=`read`in n.operand?{key:rt,type:r.type,required:!1,value:k(n.operand.read),state:`wired`}:{key:rt,type:{kinds:[`string`]},required:!1,value:n.operand.value,state:`literal`};return d.push({kind:`select`,id:i,target:e,key:t.key,part:n,type:t.type,inputs:[a]}),m({node:i,handle:nt,type:t.type},e,B(t.key)),r&&m(r,i,B(rt)),!0},pe=(e,n)=>{let i=Xe(e,n),a=l.get(i);if(a)return a;let s=o.get(e)?.find(e=>e.key===n),c=r.get(e),u=h(ee(c,t),[n]),d=er(s?.value)?s.value:{},f=new Set(Array.isArray(u?.required)?u.required:[]),p=de(u).map(([e,t])=>N(e,t,d[e],f.has(e))),g=Object.keys(d).filter(e=>!p.some(t=>t.key===e)).map(e=>N(e,h(u,[e])??{},d[e],!1)),v={kind:`make`,id:i,target:e,key:n,type:s?.type??_(u),inputs:[...p,...g]};l.set(i,v),m({node:i,handle:et,type:v.type},e,B(n));for(let e of v.inputs)C(e.value,i,B(e.key));return v};for(let[e,t]of o)for(let[n,r]of t.entries()){if(r.key===`#condition`&&r.state===`expression`){t[n]={...r,state:`made`},j(e,r.value);continue}if(r.state===`expression`&&ue(e,r)){t[n]={...r,state:`made`};continue}r.state===`made`&&pe(e,r.key),(r.state===`wired`||r.state===`expression`)&&C(r.value,e,B(r.key))}for(let e of n)e.kind===`break`&&a.has(e.source)&&S(e.source,e.path),e.kind===`make`&&o.get(e.target)?.some(t=>t.key===e.key&&t.state!==`wired`&&t.state!==`expression`)&&pe(e.target,e.key);return{inputs:o,outputs:a,pure:[...c.values(),...l.values(),...u,...d],edges:[...f.values()]}},sr=e=>e.reason===`notBefore`?F(`refuseNotBefore`,{step:e.step}):e.reason===`otherScope`?F(`refuseOtherScope`,{step:e.step}):e.reason===`shapesOutput`?F(`refuseShaped`,{step:e.step}):e.reason===`type`?F(`refuseType`,{source:W(e.source),target:W(e.target)}):F(`refuseNotPins`),Q=e=>it(e)!==void 0||at(e)!==void 0,$=(e,t)=>({node:J(e),handle:t??``}),cr=e=>e!==`any`&&e.includes(`object`),lr=(e,t)=>e.map(e=>({label:Nt(e),add:()=>t(e)})),ur=(e,t)=>{let n=e=>e.kind===`break`?Ye(e.source,e.path):Xe(e.target,e.key),r=e=>e.kind===`break`&&t.some(t=>t.kind===`break`&&t.source===e.source&&t.path.every((t,n)=>e.path[n]===t));return e.filter(e=>!r(e)&&!t.some(t=>t.id===n(e)))},dr=(e,t,n,r,i)=>{let a=r?.edits,[o,s]=(0,R.useState)([]),[c,l]=(0,R.useState)(new Set),[u,d]=(0,R.useState)(),f=(0,R.useRef)({definition:e,editing:r});(0,R.useEffect)(()=>{f.current={definition:e,editing:r}});let p=(0,R.useMemo)(()=>n&&or(e,n,o),[e,n,o]),m=ne(e)===`data`,h=(0,R.useMemo)(()=>{if(p)return{sizes:Ut(t,p,c),pure:p.pure.map(e=>({id:e.id,parent:Jt(t,e)})),wires:p.edges.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),ports:qt(t,p,c),dataOrder:m}},[t,p,c,m]),g=r&&{setArgument:(t,n,i)=>r.onChange(r.edits.setArgument(e,t,n,i)),setConditionSide:(t,n,i)=>r.onChange(r.edits.setConditionSide(e,t,n,{value:i})),setCondition:(t,n)=>r.onChange(r.edits.setArgument(e,t,[`#condition`],n)),toggleOpen:e=>l(t=>t.has(e)?new Set([...t].filter(t=>t!==e)):new Set([...t,e]))},_=(t,n)=>{if(!p||!a||!Q(t.handle)||!Q(n.handle))return;let[r,i]=at(t.handle)?[t,n]:[n,t],o=a.wireRefusal(e,p,$(r.node,r.handle),$(i.node,i.handle));return o&&sr(o)},v=t=>!!(p&&a)&&a.wireRefusal(e,p,$(t.source,t.sourceHandle),$(t.target,t.targetHandle))===void 0,ee=t=>{r&&p&&r.onChange(r.edits.connectData(e,p,$(t.source,t.sourceHandle),$(t.target,t.targetHandle)))},y=(e,t,n)=>{if(!p||!a)return e;let r=e,i=n.flatMap(e=>{let t=e.data?.wire,n=t&&p.pure.find(e=>e.kind===`break`&&e.id===t.target||e.kind===`make`&&e.id===t.source);return n?[{id:n.id}]:[]}),o=[...t.filter(e=>q(e.id)),...i.filter(e=>!t.some(t=>t.id===e.id))],c=n.flatMap(e=>{let t=e.data?.wire;return t&&!o.some(e=>e.id===t.source||e.id===t.target)?[{wire:t}]:[]}),l=o.flatMap(e=>p.pure.filter(t=>t.id===e.id).map(e=>({pure:e}))),u=[...c,...l];for(let e of lt(p,u,e=>`wire`in e?ot(p,e.wire):st(e.pure)))r=`wire`in e?a.disconnectData(r,p,e.wire):a.removePure(r,p,e.pure);return o.length>0&&s(e=>ur(e,o.flatMap(e=>p.pure.filter(t=>t.id===e.id)))),r},te=(e,t)=>{let{definition:n,editing:r}=f.current;r?.onChange(r.edits.addSelect(n,e,t))},b=(e,t,n)=>{let{definition:r,editing:i}=f.current;i?.onChange(i.edits.addCondition(r,e,t,n))};return{data:p,open:c,layout:h,actions:g,check:_,isValid:v,connect:ee,remove:y,connectEnd:(e,t)=>{if(!p||!r||t.isValid||t.toHandle||!t.fromHandle?.id||!t.fromNode)return;let n=J(t.fromNode.id),a=t.fromHandle.id,o=`changedTouches`in e?e.changedTouches[0]:e,c=i.current?.getBoundingClientRect(),l={x:o.clientX-(c?.left??0),y:o.clientY-(c?.top??0)},u=at(a);if(u){let e=p.pure.find(e=>e.id===n),t=(e?.kind===`break`?e.outputs:p.outputs.get(n)??[]).find(e=>JSON.stringify(e.path)===JSON.stringify(u))?.type;if(!t||!cr(t.kinds))return;let r=e?.kind===`break`?{source:e.source,path:[...e.path,...u]}:{source:n,path:u};d({...l,choices:[{label:F(`breakTitle`,{type:W(t)}),add:()=>s(e=>[...e,{kind:`break`,...r}])}]});return}let f=it(a),m=p.pure.find(e=>e.id===n);if(m?.kind===`condition`){let e=m.inputs.find(e=>e.key===f);if(!e||e.state!==`literal`&&e.state!==`empty`||m.part.kind!==`logic`&&m.part.kind!==`not`)return;d({...l,choices:lr(r.edits.conditionChoices(!1),e=>b(m.target,[...m.at,Number(f)],e))});return}let h=f===void 0?void 0:p.inputs.get(n)?.find(e=>e.key===f);if(h?.key===`#condition`&&h.state===`empty`){d({...l,choices:lr(r.edits.conditionChoices(!0),e=>b(n,[],e))});return}if(h&&h.key!==`#condition`&&!cr(h.type.kinds)&&(h.state===`empty`||h.state===`literal`)){d({...l,choices:[{label:F(`selectOffer`),add:()=>te(n,h.key)}]});return}h&&cr(h.type.kinds)&&h.state!==`wired`&&h.state!==`expression`&&d({...l,choices:[{label:F(`makeTitle`,{type:W(h.type)}),add:()=>s(e=>[...e,{kind:`make`,target:n,key:h.key}])}]})},offer:u,closeOffer:()=>d(void 0)}},fr=(0,R.createContext)(void 0),pr=({fromX:e,fromY:t,toX:n,toY:r,fromPosition:i,toPosition:a,connectionStatus:o,fromNode:s,fromHandle:c,toNode:l,toHandle:u})=>{let d=(0,R.useContext)(fr),[f]=_e({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a}),p=o===`invalid`&&l&&u?.id&&c.id?d?.({node:s.id,handle:c.id},{node:l.id,handle:u.id}):void 0;return(0,H.jsxs)(`g`,{className:p?`pb-wire-refused`:void 0,children:[(0,H.jsx)(`path`,{d:f,fill:`none`,className:`react-flow__connection-path`}),p&&(0,H.jsx)(`foreignObject`,{x:n+12,y:r-30,width:260,height:28,className:`overflow-visible`,children:(0,H.jsx)(`div`,{className:`inline-block rounded border border-danger bg-danger-soft px-1.5 py-0.5 text-xs whitespace-nowrap text-danger-text shadow`,children:p})})]})},mr=(e,t)=>{let n=De(),[r,i]=(0,R.useState)(),a=(0,R.useMemo)(()=>JSON.stringify(xt(e,t)),[e,t]);return(0,R.useEffect)(()=>{if(!n)return;let e=!0;return Ct(n,JSON.parse(a)).then(t=>{e&&i(t)}),()=>{e=!1}},[n,a]),r},hr={state:Pn,trigger:Fn,pure:Qn},gr=e=>e?.kind===`state`?e.scope.join(`/`):``,_r=({laidOut:e,tidied:t})=>{let n=ye();return(0,R.useEffect)(()=>{e&&n.fitView({maxZoom:1,padding:.1})},[e,t]),null},vr=()=>{let e=ye(),t=xe(e=>e.width),n=(0,R.useRef)(t);return(0,R.useEffect)(()=>{let r=n.current;if(n.current=t,r===0||t===0||t===r)return;let{x:i,y:a,zoom:o}=e.getViewport();e.setViewport({x:i+(t-r)/2,y:a,zoom:o})},[t,e]),null},yr=({laidOut:e,ids:t})=>{let n=Ee();return(0,R.useEffect)(()=>{e&&n(t)},[e]),null},br=new Map,xr=({definition:e,problems:t,warnings:n,selected:r,onSelect:i,onChange:a,edits:c,onAddAt:l,traces:u,types:d,schemas:f,fills:p=!1,layout:h,onLayoutChange:g})=>{let _=a&&c&&{onChange:a,edits:c},v=(0,R.useMemo)(()=>ht(e),[e]),ee=(0,R.useRef)(null),[y,te]=Bn(),b=dr(e,v,y===`pins`?f:void 0,_,ee),x=mr(v,b.layout),S=(0,R.useMemo)(()=>new Map(v.nodes.map(e=>[e.id,e])),[v]),re=JSON.stringify(h??{}),C=(0,R.useMemo)(()=>pe(re),[re]),w=C[y],T=e=>g?.({...C,[y]:e}),E=(0,R.useMemo)(()=>new Map([...v.nodes.map(e=>[e.id,me(e.id)]),...(b.data?.pure??[]).map(e=>[e.id,me(e.id,e)])]),[v,b.data]),D=(0,R.useMemo)(()=>new Map([...E].flatMap(([e,t])=>Object.hasOwn(w,t)?[[e,w[t]]]:[])),[E,w]),O=(0,R.useMemo)(()=>{if(!x)return;let e=new Map((b.data?.pure??[]).map(e=>[e.id,e]));return ue(x,D,t=>{let n=S.get(t);return e.has(t)?Jt(v,e.get(t)):n?.kind===`state`?n.parent:void 0})},[x,D,S,v,b.data]),k=!!g,[ie,ae]=(0,R.useState)(br),[A,j]=(0,R.useState)(0),M=ne(e)===`data`,[N,se]=(0,R.useState)(()=>new Set(r===void 0?[]:[K(r)]));(0,R.useEffect)(()=>{se(e=>r===void 0?e.size===1&&!q([...e][0])?new Set:e:e.has(K(r))?e:new Set([K(r)]))},[r]);let ce=(0,R.useMemo)(()=>[...Zt(v,O,t,r,u,d,n,b.data&&{data:b.data,open:b.open},M),...b.data?rn(v,b.data,O,b.open):[]].map(e=>{let t=ie.get(e.id),n=D.has(J(e.id));return{...e,selected:N.has(e.id),draggable:k,...t&&{position:t},...n&&{data:{...e.data,moved:!0},...e.ariaLabel&&{ariaLabel:`${e.ariaLabel}, ${F(`movedByHand`)}`}}}}),[v,O,t,r,u,d,n,b.data,b.open,M,N,ie,D,k]),[le,de]=(0,R.useState)(),fe=(0,R.useMemo)(()=>[...M&&b.data?an(v,b.data):nn(v,M),...b.data?on(b.data):[]].map(e=>({...e,selected:e.id===le})),[v,b.data,le,M]),P=!!_,he=e=>{if(Q(e.sourceHandle)||Q(e.targetHandle))return Q(e.sourceHandle)&&Q(e.targetHandle)&&b.isValid(e);if(e.targetHandle!==`in`)return!1;let t=S.get(J(e.target)),n=S.get(J(e.source));return t?.kind===`state`&&gr(n)===gr(t)},ge=e=>{ae(br);let t=[...e].flatMap(([e,t])=>{let n=J(e),r=E.get(n),i=O?.get(n),a={x:Math.round(t.x),y:Math.round(t.y)};return r===void 0||!D.has(n)&&i&&Math.round(i.x)===a.x&&Math.round(i.y)===a.y?[]:[[r,a]]});t.length>0&&T({...w,...Object.fromEntries(t)})},_e=g&&(e=>{let t=E.get(J(e));t!==void 0&&T(oe(w,t))}),I=()=>{T({}),j(e=>e+1)},ve=e=>{let t=new Map;for(let n of e){if(n.type!==`position`||!n.position||!k)continue;let e=n.position;n.dragging?ae(t=>new Map(t).set(n.id,e)):t.set(n.id,e)}t.size>0&&ge(t);let n=e.filter(e=>e.type===`select`);if(n.length===0)return;let a=new Set(N);for(let e of n)e.selected?a.add(e.id):a.delete(e.id);se(a);let[o]=a.size===1?[...a]:[],s=o===void 0||q(o)?void 0:J(o);if(s!==void 0&&(ye||xe.current))return r===void 0?void 0:i(void 0);s!==r&&i(s)},ye=we(`Shift`),xe=(0,R.useRef)(!1);return(0,H.jsx)(sn.Provider,{value:_?l:void 0,children:(0,H.jsx)(bn.Provider,{value:_e,children:(0,H.jsx)(ln.Provider,{value:b.actions,children:(0,H.jsx)(fr.Provider,{value:b.check,children:(0,H.jsxs)(`div`,{ref:ee,className:`relative h-full w-full`,children:[(0,H.jsxs)(Ce,{className:`pb-workflow`,nodes:ce,edges:fe,nodeTypes:hr,nodesDraggable:k,nodeDragThreshold:4,selectNodesOnDrag:!1,nodesConnectable:P,connectOnClick:!1,connectionDragThreshold:4,edgesFocusable:P,elementsSelectable:!0,deleteKeyCode:P?[`Backspace`,`Delete`]:null,onNodesChange:ve,onEdgesChange:e=>{for(let t of e)t.type===`select`&&(t.selected?de(t.id):de(e=>e===t.id?void 0:e))},isValidConnection:he,onConnect:t=>{if(_&&t.sourceHandle){if(Q(t.sourceHandle))return b.connect(t);_.onChange(_.edits.connect(e,t.sourceHandle,J(t.source),J(t.target)))}},onConnectEnd:b.connectEnd,connectionLineComponent:pr,onDelete:({nodes:t,edges:n})=>{if(!_)return;let r=t.filter(e=>!q(e.id)).map(e=>J(e.id)).filter(e=>e!==``),i=b.remove(e,t,n);for(let e of n){let t=e.data;t.kind!==`data`&&!r.includes(t.source)&&!r.includes(J(e.target))&&(i=_.edits.disconnect(i,t))}for(let e of r)r.some(t=>e.startsWith(`${t}/`))||(i=_.edits.removeState(i,e));_.onChange(i)},multiSelectionKeyCode:`Shift`,onSelectionStart:()=>void(xe.current=!0),onSelectionEnd:()=>void(xe.current=!1),onNodeClick:(e,t)=>!e.shiftKey&&!q(t.id)&&i(J(t.id)),onPaneClick:()=>i(void 0),zoomOnScroll:!0,panOnScroll:!1,panOnDrag:[0,1,2],selectionOnDrag:!1,selectionKeyCode:`Shift`,preventScrolling:!0,onPaneContextMenu:e=>e.preventDefault(),minZoom:.2,maxZoom:1.5,"aria-label":F(`canvas`),children:[(0,H.jsx)(Te,{gap:16}),f&&(0,H.jsx)(be,{position:`top-left`,children:(0,H.jsx)(o,{label:F(`graphView`),value:y,onChange:te,options:[{value:`pins`,label:F(`viewPins`)},{value:`simple`,label:F(`viewSimple`)}]})}),k&&Object.keys(w).length>0&&(0,H.jsx)(be,{position:`top-right`,children:(0,H.jsxs)(s,{title:F(`tidyUpHelp`),onClick:I,children:[(0,H.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),F(`tidyUp`)]})}),(0,H.jsx)(Se,{showInteractive:!1}),(0,H.jsx)(_r,{laidOut:x,tidied:A}),p&&(0,H.jsx)(vr,{}),(0,H.jsx)(yr,{laidOut:O,ids:ce.map(e=>e.id)})]}),b.offer&&(0,H.jsx)($n,{offer:b.offer,onClose:b.closeOffer})]})})})})})},Sr=e=>(0,H.jsx)(ve,{children:(0,H.jsx)(xr,{...e})});export{it as a,Le as c,Pe as d,je as f,ze as g,Be as h,ot as i,Ue as l,Ve as m,cn as n,at as o,Me as p,lt as r,Ke as s,Sr as t,Fe as u};
|
|
4
|
+
//# debugId=64162991-776c-4906-981b-7db9ca05aa68
|