@protobase/ui 0.121.2 → 0.121.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/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/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/messages.d.ts +2 -2
- 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/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-page/workflow-workbench.js +1 -1
- package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-run/run-trace-view.js +1 -1
- package/dist/app/field-types/workflow-run/step-card.js +1 -1
- package/dist/app/file-viewers/messages.d.ts +2 -2
- 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-edit/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/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-mode/shown-layout.d.ts +1 -1
- 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/saved/use-favorite.d.ts +1 -1
- package/dist/app/search/messages.d.ts +2 -2
- package/dist/app/searches/messages.d.ts +2 -2
- package/dist/app/searches/use-save-search.d.ts +1 -1
- 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/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/focus-page/messages.d.ts +2 -2
- package/dist/format/messages.d.ts +2 -2
- package/dist/forms/messages.d.ts +2 -2
- package/dist/inline-child-table/messages.d.ts +2 -2
- package/dist/invitations/messages.d.ts +2 -2
- package/dist/live/messages.d.ts +2 -2
- package/dist/locale/en.js +20 -1
- package/dist/locale/en.json.d.ts +19 -0
- package/dist/locale/messages.d.ts +38 -0
- package/dist/locale/nl.js +20 -1
- package/dist/mentions/messages.d.ts +2 -2
- 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/primitives/messages.d.ts +2 -2
- package/dist/record-view/messages.d.ts +2 -2
- package/dist/shell/assets/{account-page-BEMlob92.js → account-page-CeUyNpVu.js} +2 -2
- package/dist/shell/assets/{app-CwxoFZn2.js → app-DWzw7ONt.js} +5 -5
- package/dist/shell/assets/{assistant-shell-D1PLZHeQ.js → assistant-shell-CJxZLCrc.js} +2 -2
- package/dist/shell/assets/{board-display-BZb6Av24.js → board-display-gu3WV8NB.js} +2 -2
- package/dist/shell/assets/{calendar-display-CNFg47Me.js → calendar-display-3Em_dlTw.js} +2 -2
- package/dist/shell/assets/{call-rings-B0cAdcLq.js → call-rings-yTRSAxLi.js} +2 -2
- package/dist/shell/assets/{calls-CJX48uHr.js → calls-Cj_KYQdr.js} +2 -2
- package/dist/shell/assets/{circle-alert-B-bmotNV.js → circle-alert-Bq3xnT2L.js} +2 -2
- package/dist/shell/assets/{composed-page-itsBuYQN.js → composed-page-TRd2rtYz.js} +2 -2
- package/dist/shell/assets/{composer-section-CcOJo5ti.js → composer-section-C6Gt6v_l.js} +2 -2
- package/dist/shell/assets/{connect-route-CFKOOd6G.js → connect-route-BtM3rOui.js} +2 -2
- package/dist/shell/assets/{copy-field-DOFRIY_Q.js → copy-field-D7ugPD05.js} +2 -2
- package/dist/shell/assets/{create-route-Dv-SPGqY.js → create-route-CvRfQPm0.js} +2 -2
- package/dist/shell/assets/{custom-step-container-field-Cpk6ImRJ.js → custom-step-container-field-CDHQQJ4p.js} +2 -2
- package/dist/shell/assets/{embedded-list-DoHDT3Av.js → embedded-list-CJcc42i8.js} +3 -3
- package/dist/shell/assets/en-BED8S1rX.js +2 -0
- package/dist/shell/assets/{export-dialog-Ivzdiuhz.js → export-dialog-C-_QPJoC.js} +2 -2
- package/dist/shell/assets/export-worker-S5xPFD_M.js +15 -0
- package/dist/shell/assets/{first-organization-page-in6WzIgy.js → first-organization-page-DAozf5Ps.js} +2 -2
- package/dist/shell/assets/{graph-view-BRuO-SOE.js → graph-view-Bl390vdy.js} +2 -2
- package/dist/shell/assets/{group-donut-3NIqjraT.js → group-donut-BO8wuq87.js} +2 -2
- package/dist/shell/assets/{guest-call-page-NZyVZiKI.js → guest-call-page-xpZr6OKR.js} +3 -3
- package/dist/shell/assets/{html-viewer-C1KycBYl.js → html-viewer-evyf0J-f.js} +2 -2
- package/dist/shell/assets/{import-dialog-CyB3vJn7.js → import-dialog-Dy5RD7HY.js} +2 -2
- package/dist/shell/assets/{import-table-dialog-D8yGy95h.js → import-table-dialog-BC6Am8UM.js} +2 -2
- package/dist/shell/assets/{index-CkkBg7C6.js → index-iUDmWVDo.js} +1 -1
- package/dist/shell/assets/{invitations-page-BjEW7hIz.js → invitations-page-DY1V1iHa.js} +2 -2
- package/dist/shell/assets/{layout-grid-OO8eIGYq.js → layout-grid-CKBISlXn.js} +2 -2
- package/dist/shell/assets/{legend-item-eNQOaTxV.js → legend-item-ClD6cmLU.js} +2 -2
- package/dist/shell/assets/{list-page-bIQkpGOc.js → list-page-Cmo55nyu.js} +4 -4
- package/dist/shell/assets/{maplibre-DV3j-5Y6.js → maplibre-BebZCBmr.js} +2 -2
- package/dist/shell/assets/{markdown-content-C08v-1FZ.js → markdown-content-x-q7O5sE.js} +2 -2
- package/dist/shell/assets/{members-page-B9hyyuVp.js → members-page-CeGHR6Wr.js} +2 -2
- package/dist/shell/assets/{message-content-DLKHIzRa.js → message-content-eRqINcW1.js} +2 -2
- package/dist/shell/assets/{messages-NBuAsjFr.js → messages-BsxKhmlF.js} +2 -2
- package/dist/shell/assets/nl-DjHVomkB.js +2 -0
- package/dist/shell/assets/{organization-page-DeTS9uAn.js → organization-page-B6jzdwDF.js} +2 -2
- package/dist/shell/assets/{organizations-page-qM5TQfyb.js → organizations-page-Bt5w0_qp.js} +2 -2
- package/dist/shell/assets/parse-worker-CO_GFfU7.js +35 -0
- package/dist/shell/assets/{pending-invitation-row-9-2Fmy3F.js → pending-invitation-row-BmKvAohJ.js} +2 -2
- package/dist/shell/assets/{period-chart-UOm7kPWB.js → period-chart-DjLhehbh.js} +2 -2
- package/dist/shell/assets/{person-row-DOXM02rY.js → person-row-CXlarnkF.js} +2 -2
- package/dist/shell/assets/{public-form-page-Bj9YxgGp.js → public-form-page-DM4813zd.js} +2 -2
- package/dist/shell/assets/{record-lines-PZ4g8sb5.js → record-lines-BaC1rj6c.js} +2 -2
- package/dist/shell/assets/{record-map-CkWjStZn.js → record-map-B1IEMP-I.js} +2 -2
- package/dist/shell/assets/{record-opens-6vtBiJ2O.js → record-opens-BDQwpY_X.js} +2 -2
- package/dist/shell/assets/{record-page-DrQL98n9.js → record-page-9Oz99OqO.js} +3 -3
- package/dist/shell/assets/{record-preview-BSqik7HQ.js → record-preview-De0u_rur.js} +2 -2
- package/dist/shell/assets/{records-map-CXBbBlYG.js → records-map--eWX0Hv-.js} +2 -2
- package/dist/shell/assets/{render-node-DEyR63E8.js → render-node-DzeGU2sI.js} +3 -3
- package/dist/shell/assets/{reorder-button-CdgrzXlf.js → reorder-button-BSTpt6yN.js} +2 -2
- package/dist/shell/assets/{run-trace-view-CqcgX5lE.js → run-trace-view-CLpknlc8.js} +2 -2
- package/dist/shell/assets/{runner-install-field-Dm7GhYaF.js → runner-install-field-D9p7sLw0.js} +2 -2
- package/dist/shell/assets/{runtime-update-BdhyiFl9.js → runtime-update-m2oyX8Ey.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-CDtJQrEp.js → shared-protobase-ui-88B63hkV.js} +1 -1
- package/dist/shell/assets/{sheet-source-NKu1Enl2.js → sheet-source-CMNlJ58_.js} +3 -3
- package/dist/shell/assets/{sign-in-policy-page-DINzAtyt.js → sign-in-policy-page-CLSHlwBh.js} +2 -2
- package/dist/shell/assets/{start-block-queries-Bc743CdL.js → start-block-queries-B9DdiMSx.js} +2 -2
- package/dist/shell/assets/{step-catalog-B9QbvZP_.js → step-catalog-DW10Y3PY.js} +2 -2
- package/dist/shell/assets/{step-panel-C5Pnb-Vb.js → step-panel-C753qJg4.js} +2 -2
- package/dist/shell/assets/{timeline-display-hbo62z0J.js → timeline-display-DOwPERG1.js} +2 -2
- package/dist/shell/assets/{trash-YqRXn8JG.js → trash-CxYb_qm6.js} +2 -2
- package/dist/shell/assets/{update-set-DFWECx_E.js → update-set-C1HTHv_S.js} +2 -2
- package/dist/shell/assets/{use-calendar-move-D_6TlMr4.js → use-calendar-move-BCSnh6HR.js} +2 -2
- package/dist/shell/assets/{use-display-rows-1Xjy5pR2.js → use-display-rows-DDKdi43c.js} +2 -2
- package/dist/shell/assets/{use-my-invitations-CrSF37dB.js → use-my-invitations-duEV0TTm.js} +2 -2
- package/dist/shell/assets/{use-paged-search-CtD7Lf-E.js → use-paged-search-CzZjSOdf.js} +2 -2
- package/dist/shell/assets/{use-run-trace-5H4UJvB-.js → use-run-trace-BIs7O0Z-.js} +2 -2
- package/dist/shell/assets/{use-workflow-page-dAWuZvWk.js → use-workflow-page-meYGNSmb.js} +2 -2
- package/dist/shell/assets/{use-workflow-types-Cjkw47Mf.js → use-workflow-types-BxHZj4PR.js} +2 -2
- package/dist/shell/assets/{workflow-canvas-BkFimRd2.js → workflow-canvas-CYEsja4x.js} +2 -2
- package/dist/shell/assets/{workflow-field-BQImywHx.js → workflow-field-Bo7W17jL.js} +3 -3
- package/dist/shell/assets/{workflow-graph-editor-DYBqdH_O.js → workflow-graph-editor-DaaaZYDh.js} +2 -2
- package/dist/shell/assets/{workflow-run-field-CyxK0W7w.js → workflow-run-field-r3LDLelf.js} +3 -3
- package/dist/shell/assets/{workflow-status-field-Bzri4NHN.js → workflow-status-field-3pPD6SMv.js} +2 -2
- package/dist/shell/assets/{workflow-workbench-DC2gtXz1.js → workflow-workbench-peaEJMly.js} +2 -2
- 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-BEMlob92.js.map → account-page-CeUyNpVu.js.map} +1 -1
- package/dist/shell-source-maps/assets/{app-CwxoFZn2.js.map → app-DWzw7ONt.js.map} +1 -1
- package/dist/shell-source-maps/assets/{assistant-shell-D1PLZHeQ.js.map → assistant-shell-CJxZLCrc.js.map} +1 -1
- package/dist/shell-source-maps/assets/{board-display-BZb6Av24.js.map → board-display-gu3WV8NB.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calendar-display-CNFg47Me.js.map → calendar-display-3Em_dlTw.js.map} +1 -1
- package/dist/shell-source-maps/assets/{call-rings-B0cAdcLq.js.map → call-rings-yTRSAxLi.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calls-CJX48uHr.js.map → calls-Cj_KYQdr.js.map} +1 -1
- package/dist/shell-source-maps/assets/{circle-alert-B-bmotNV.js.map → circle-alert-Bq3xnT2L.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composed-page-itsBuYQN.js.map → composed-page-TRd2rtYz.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composer-section-CcOJo5ti.js.map → composer-section-C6Gt6v_l.js.map} +1 -1
- package/dist/shell-source-maps/assets/{connect-route-CFKOOd6G.js.map → connect-route-BtM3rOui.js.map} +1 -1
- package/dist/shell-source-maps/assets/{copy-field-DOFRIY_Q.js.map → copy-field-D7ugPD05.js.map} +1 -1
- package/dist/shell-source-maps/assets/{create-route-Dv-SPGqY.js.map → create-route-CvRfQPm0.js.map} +1 -1
- package/dist/shell-source-maps/assets/{custom-step-container-field-Cpk6ImRJ.js.map → custom-step-container-field-CDHQQJ4p.js.map} +1 -1
- package/dist/shell-source-maps/assets/{embedded-list-DoHDT3Av.js.map → embedded-list-CJcc42i8.js.map} +1 -1
- package/dist/shell-source-maps/assets/en-BED8S1rX.js.map +1 -0
- package/dist/shell-source-maps/assets/{export-dialog-Ivzdiuhz.js.map → export-dialog-C-_QPJoC.js.map} +1 -1
- package/dist/shell-source-maps/assets/export-worker-S5xPFD_M.js.map +1 -0
- package/dist/shell-source-maps/assets/{first-organization-page-in6WzIgy.js.map → first-organization-page-DAozf5Ps.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-BRuO-SOE.js.map → graph-view-Bl390vdy.js.map} +1 -1
- package/dist/shell-source-maps/assets/{group-donut-3NIqjraT.js.map → group-donut-BO8wuq87.js.map} +1 -1
- package/dist/shell-source-maps/assets/{guest-call-page-NZyVZiKI.js.map → guest-call-page-xpZr6OKR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-C1KycBYl.js.map → html-viewer-evyf0J-f.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-dialog-CyB3vJn7.js.map → import-dialog-Dy5RD7HY.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-table-dialog-D8yGy95h.js.map → import-table-dialog-BC6Am8UM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{invitations-page-BjEW7hIz.js.map → invitations-page-DY1V1iHa.js.map} +1 -1
- package/dist/shell-source-maps/assets/{layout-grid-OO8eIGYq.js.map → layout-grid-CKBISlXn.js.map} +1 -1
- package/dist/shell-source-maps/assets/{legend-item-eNQOaTxV.js.map → legend-item-ClD6cmLU.js.map} +1 -1
- package/dist/shell-source-maps/assets/{list-page-bIQkpGOc.js.map → list-page-Cmo55nyu.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-DV3j-5Y6.js.map → maplibre-BebZCBmr.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-C08v-1FZ.js.map → markdown-content-x-q7O5sE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{members-page-B9hyyuVp.js.map → members-page-CeGHR6Wr.js.map} +1 -1
- package/dist/shell-source-maps/assets/{message-content-DLKHIzRa.js.map → message-content-eRqINcW1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{messages-NBuAsjFr.js.map → messages-BsxKhmlF.js.map} +1 -1
- package/dist/shell-source-maps/assets/nl-DjHVomkB.js.map +1 -0
- package/dist/shell-source-maps/assets/{organization-page-DeTS9uAn.js.map → organization-page-B6jzdwDF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organizations-page-qM5TQfyb.js.map → organizations-page-Bt5w0_qp.js.map} +1 -1
- package/dist/shell-source-maps/assets/parse-worker-CO_GFfU7.js.map +1 -0
- package/dist/shell-source-maps/assets/{pending-invitation-row-9-2Fmy3F.js.map → pending-invitation-row-BmKvAohJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{period-chart-UOm7kPWB.js.map → period-chart-DjLhehbh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{person-row-DOXM02rY.js.map → person-row-CXlarnkF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{public-form-page-Bj9YxgGp.js.map → public-form-page-DM4813zd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-lines-PZ4g8sb5.js.map → record-lines-BaC1rj6c.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-CkWjStZn.js.map → record-map-B1IEMP-I.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-opens-6vtBiJ2O.js.map → record-opens-BDQwpY_X.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-page-DrQL98n9.js.map → record-page-9Oz99OqO.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-preview-BSqik7HQ.js.map → record-preview-De0u_rur.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-CXBbBlYG.js.map → records-map--eWX0Hv-.js.map} +1 -1
- package/dist/shell-source-maps/assets/{render-node-DEyR63E8.js.map → render-node-DzeGU2sI.js.map} +1 -1
- package/dist/shell-source-maps/assets/{reorder-button-CdgrzXlf.js.map → reorder-button-BSTpt6yN.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-CqcgX5lE.js.map → run-trace-view-CLpknlc8.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runner-install-field-Dm7GhYaF.js.map → runner-install-field-D9p7sLw0.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runtime-update-BdhyiFl9.js.map → runtime-update-m2oyX8Ey.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sheet-source-NKu1Enl2.js.map → sheet-source-CMNlJ58_.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sign-in-policy-page-DINzAtyt.js.map → sign-in-policy-page-CLSHlwBh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{start-block-queries-Bc743CdL.js.map → start-block-queries-B9DdiMSx.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-catalog-B9QbvZP_.js.map → step-catalog-DW10Y3PY.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-C5Pnb-Vb.js.map → step-panel-C753qJg4.js.map} +1 -1
- package/dist/shell-source-maps/assets/{timeline-display-hbo62z0J.js.map → timeline-display-DOwPERG1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{trash-YqRXn8JG.js.map → trash-CxYb_qm6.js.map} +1 -1
- package/dist/shell-source-maps/assets/{update-set-DFWECx_E.js.map → update-set-C1HTHv_S.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-calendar-move-D_6TlMr4.js.map → use-calendar-move-BCSnh6HR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-display-rows-1Xjy5pR2.js.map → use-display-rows-DDKdi43c.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-my-invitations-CrSF37dB.js.map → use-my-invitations-duEV0TTm.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-paged-search-CtD7Lf-E.js.map → use-paged-search-CzZjSOdf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-run-trace-5H4UJvB-.js.map → use-run-trace-BIs7O0Z-.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-page-dAWuZvWk.js.map → use-workflow-page-meYGNSmb.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-types-Cjkw47Mf.js.map → use-workflow-types-BxHZj4PR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-BkFimRd2.js.map → workflow-canvas-CYEsja4x.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-field-BQImywHx.js.map → workflow-field-Bo7W17jL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-DYBqdH_O.js.map → workflow-graph-editor-DaaaZYDh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-run-field-CyxK0W7w.js.map → workflow-run-field-r3LDLelf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-status-field-Bzri4NHN.js.map → workflow-status-field-3pPD6SMv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-workbench-DC2gtXz1.js.map → workflow-workbench-peaEJMly.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/en-C_BQKBSV.js +0 -2
- package/dist/shell/assets/export-worker-C46NatsO.js +0 -15
- package/dist/shell/assets/nl-DzJ_yv1H.js +0 -2
- package/dist/shell/assets/parse-worker-COWuolaE.js +0 -35
- package/dist/shell-source-maps/assets/en-C_BQKBSV.js.map +0 -1
- package/dist/shell-source-maps/assets/export-worker-C46NatsO.js.map +0 -1
- package/dist/shell-source-maps/assets/nl-DzJ_yv1H.js.map +0 -1
- package/dist/shell-source-maps/assets/parse-worker-COWuolaE.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/import-dialog-
|
|
2
|
-
(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{At as r,Bc as i,C as a,Ca as o,Da as s,Ea as c,El as l,Fi as u,Fr as d,Go as f,Gr as p,Hi as m,Ho as h,Hr as g,Ia as _,Ir as v,It as y,Ji as b,Jn as x,Kc as S,Ln as C,M as w,Mo as T,Nc as E,Nn as ee,O as D,Oa as te,Oo as O,Ql as k,Qn as A,S as ne,Sa as re,T as ie,To as ae,Uc as oe,Vc as se,Vi as j,Vr as ce,Wo as le,Xr as ue,Yn as M,Zn as de,Zs as N,_c as P,b as fe,bc as F,cs as pe,ct as me,di as he,dn as ge,eu as I,fc as L,fl as _e,gc as ve,ic as ye,il as be,iu as xe,ja as Se,jo as Ce,k as we,ka as R,ki as Te,kn as Ee,ko as De,lc as z,ll as Oe,mi as ke,ml as B,ms as V,ni as Ae,nl as H,oc as je,oo as U,os as W,ou as Me,pa as G,pc as Ne,pl as Pe,qc as K,si as Fe,ss as Ie,ti as Le,tl as q,ul as Re,vi as ze,vl as Be,vr as Ve,wa as He,wc as Ue,wo as We,ws as Ge,yn as Ke,za as qe,zi as Je}from"./app-CwxoFZn2.js";import{C as Ye,f as Xe,h as Ze,i as Qe,o as $e,s as et}from"./vendor-t7Q7QbPu.js";import{n as tt}from"./view-chart-ChBtewKd.js";import{$ as nt,A as rt,B as it,D as at,E as ot,F as st,G as ct,H as lt,I as ut,J,K as dt,L as ft,M as pt,N as mt,O as ht,P as gt,Q as _t,R as vt,T as yt,U as bt,V as xt,W as St,X as Ct,Y as wt,Z as Y,b as Tt,d as Et,et as Dt,f as Ot,ft as kt,h as At,i as jt,j as Mt,k as Nt,m as Pt,n as Ft,p as It,pt as Lt,q as Rt,u as zt,v as Bt,w as Vt,x as Ht,xt as X,y as Ut,z as Wt}from"./embedded-list-DoHDT3Av.js";import{a as Gt,i as Kt,n as qt,r as Jt,t as Yt}from"./reorder-button-CdgrzXlf.js";import{t as Xt}from"./trash-YqRXn8JG.js";import{t as Zt}from"./page-header-Ddz2r5ic.js";import{i as Qt,r as $t,t as en}from"./record-preview-BSqik7HQ.js";import{c as tn,l as nn}from"./messages-NBuAsjFr.js";import{t as rn}from"./use-display-rows-1Xjy5pR2.js";var an=new Set(`all.analyse.analyze.and.any.array.as.asc.asymmetric.both.case.cast.check.collate.column.constraint.create.current_catalog.current_date.current_role.current_time.current_timestamp.current_user.default.deferrable.desc.distinct.do.else.end.except.false.fetch.for.foreign.from.grant.group.having.in.initially.intersect.into.lateral.leading.limit.localtime.localtimestamp.not.null.offset.on.only.or.order.placing.primary.references.returning.select.session_user.some.symmetric.system_user.table.then.to.trailing.true.union.unique.user.using.variadic.when.where.window.with`.split(`.`)),on=/^[a-z][a-z0-9_]*$/,sn=[`id`,`etag`,`organization_id`],cn=e=>on.test(e)&&new TextEncoder().encode(e).length<=63,ln=(e,t,n=63)=>{if(typeof e!=`string`||!cn(e)||new TextEncoder().encode(e).length>n)return`form`;if(an.has(e))return`reserved_word`;if(t===`field`&&sn.includes(e))return`reserved_field`},un={name:`bookmark-check`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}],[`path`,{d:`m9 10 2 2 4-4`,key:`1gnqz4`}]]};un.node;var dn=S(un),fn={name:`bookmark-plus`,size:24,node:[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M15 10H9`,key:`o6yqo3`}],[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};fn.node;var pn=S(fn),mn={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};mn.node;var hn=S(mn),gn={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};gn.node;var _n=S(gn),vn={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};vn.node;var yn=S(vn),bn=e=>e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``),xn=(e,t,n)=>(/^[a-z]/.test(e)?e:`${t}_${e}`).slice(0,n).replace(/_+$/,``),Sn=(e,t,n)=>{let r=e;for(let i=2;t.has(r)||an.has(r);i++){let t=`_${i}`;r=`${e.slice(0,n-t.length).replace(/_+$/,``)}${t}`}return r},Cn=e=>e<26?String.fromCharCode(97+e):Cn(Math.floor(e/26)-1)+Cn(e%26),wn=e=>{let t=new Set(sn);return e.map((e,n)=>{let r=bn(e),i=Sn(r===``?`column_${Cn(n)}`:xn(r,`column`,63),t,63);return t.add(i),i})},Tn=(e,t=[],n=63)=>{let r=bn(e.replace(/\.(csv|tsv|txt|xlsx|json)$/i,``));if(r!==``)return Sn(xn(r,`table`,n),new Set(t),n)},Z=e(n(),1),En=`inline-flex h-6 items-center gap-1 rounded-full border border-primary-border bg-primary-soft pl-2.5 pr-1.5 text-xs font-medium text-primary-text`,Dn=({chips:e,lockedLabels:t=[],onRemove:n,onClear:r,scroll:i})=>e.length===0&&t.length===0?null:(0,Z.jsxs)(`div`,{className:i?`flex flex-nowrap items-center gap-1.5 overflow-x-auto pb-1 [&>*]:shrink-0`:`flex flex-wrap items-center gap-1.5`,children:[t.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1.5 rounded-full border border-border-strong bg-muted px-2.5 text-xs font-medium text-foreground`,children:[(0,Z.jsx)(hn,{className:`size-3 text-muted-foreground`}),e]},e)),e.map(e=>(0,Z.jsxs)(`span`,{className:En,children:[e.label,(0,Z.jsx)(`button`,{type:`button`,"aria-label":J(`remove`,{label:e.label}),onClick:()=>n(e.key),className:`rounded-full p-0.5 hover:bg-primary-border/60`,children:(0,Z.jsx)(ve,{className:`size-3`})})]},e.key)),e.length>0&&(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`ml-1 text-xs font-medium text-muted-foreground hover:text-foreground`,children:J(`clearAll`)})]}),On=({value:e,presets:t=Rt,onChange:n})=>(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let r=dt(t);return(0,Z.jsx)(`button`,{type:`button`,disabled:!r,title:r?void 0:J(`unknownPreset`,{id:t}),onClick:()=>n(e===t?void 0:t),className:K(`h-7 rounded-md border px-2.5 text-body font-medium transition-colors`,!r&&`border-dashed text-danger-text`,e===t?`border-primary-border bg-primary-soft text-primary-text`:`border-border-strong bg-background text-muted-foreground hover:bg-muted`),children:r??J(`unsupported`,{id:t})},t)})}),kn=(e,t)=>e.onSearch?e.options:e.options.filter(e=>xt(e.label,t)),An=(e,t,n)=>t===0?-1:n===`ArrowDown`?e<0?0:(e+1)%t:e<0?t-1:(e-1+t)%t,Q=e(t(),1),jn=({config:e,selected:t,onToggle:n,inline:r=!1})=>{let i=(0,Q.useId)(),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(-1),p=r||c,m=kn(e,o),h=(0,Q.useRef)(e.onSearch);h.current=e.onSearch,(0,Q.useEffect)(()=>()=>h.current?.(``),[]);let g=t=>{s(t),f(-1),e.onSearch?.(t)};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex min-h-8 cursor-text flex-wrap items-center gap-1 rounded-md border border-border-strong bg-background px-2 py-1 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20`,onClick:()=>a.current?.focus(),children:[(0,Z.jsx)(F,{className:`size-3.5 shrink-0 text-muted-foreground`}),t.map(t=>(0,Z.jsx)(C,{label:it(e,t),onRemove:()=>n(t)},t)),(0,Z.jsx)(`input`,{ref:a,autoFocus:r,role:`combobox`,"aria-label":e.label,"aria-expanded":p,"aria-controls":`${i}-options`,"aria-autocomplete":`list`,"aria-activedescendant":m[d]?`${i}-${d}`:void 0,placeholder:t.length>0?``:J(`searchIn`,{label:e.label}),className:`h-6 min-w-16 flex-1 bg-transparent text-foreground outline-none placeholder:text-faint-foreground`,value:o,onChange:e=>g(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),f(An(d,m.length,e.key));return}if(e.key===`Enter`&&m[d]){e.preventDefault(),n(m[d].value);return}if(e.key===`Backspace`&&o===``&&t.length>0){n(t[t.length-1]);return}e.key===`Escape`&&o!==``&&(e.stopPropagation(),g(``))},onFocus:()=>l(!0),onBlur:()=>{l(!1),f(-1),!r&&o!==``&&g(``)}})]}),p&&(0,Z.jsxs)(`ul`,{id:`${i}-options`,role:`listbox`,"aria-label":e.label,"aria-multiselectable":!0,className:K(`flex max-h-60 flex-col gap-px overflow-y-auto`,!r&&`rounded-md border bg-background p-1 shadow-sm`),children:[m.map((e,r)=>{let a=t.includes(e.value);return(0,Z.jsxs)(`li`,{id:`${i}-${r}`,role:`option`,"aria-selected":a,tabIndex:-1,className:K(`flex cursor-pointer items-center gap-2 rounded px-1.5 py-1 hover:bg-muted`,r===d&&`bg-muted`),onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.value),children:[(0,Z.jsx)(`span`,{className:K(`inline-flex size-4 shrink-0 items-center justify-center rounded border`,a?`border-primary bg-primary text-primary-foreground`:`border-border-strong bg-background`),children:a&&(0,Z.jsx)(se,{className:`size-3`,strokeWidth:3})}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,Z.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:u(e.count)})]},e.value)}),e.failed&&(0,Z.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-danger-text`,children:J(`couldNotLoadCounts`)}),!e.failed&&m.length===0&&(0,Z.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-faint-foreground`,children:J(`noMatches`)})]})]})},Mn=({config:e,selected:t,onToggle:n})=>{let[r,i]=(0,Q.useState)(``),a=e.options.filter(e=>xt(e.label,r));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.searchable&&(0,Z.jsx)(T,{wrapperClassName:`mb-1 h-7`,leading:(0,Z.jsx)(F,{className:`size-3.5`}),placeholder:J(`searchIn`,{label:e.label}),value:r,onChange:e=>i(e.target.value)}),a.map(e=>(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-1 py-1 hover:bg-muted`,children:[(0,Z.jsx)(U,{checked:t.includes(e.value),onChange:()=>n(e.value),label:e.label}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,Z.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:u(e.count)})]},e.value)),e.failed&&(0,Z.jsx)(`span`,{className:`px-1 py-1 text-xs text-danger-text`,children:J(`couldNotLoadCounts`)}),!e.failed&&a.length===0&&(0,Z.jsx)(`span`,{className:`px-1 py-1 text-xs text-faint-foreground`,children:J(`noMatches`)})]})},Nn=({label:e,activeCount:t,width:n=240,defaultOpen:r=!1,children:a})=>{let[o,s]=(0,Q.useState)(r),[c,l]=(0,Q.useState)({width:n}),u=(0,Q.useRef)(null),d=(0,Q.useRef)(null);(0,Q.useLayoutEffect)(()=>{if(!o||!u.current)return;let e=u.current.getBoundingClientRect(),t=document.documentElement.clientWidth,r=Math.min(n,O(t));l({width:r,right:e.left+r>t?e.right-De(e.right,r,t):void 0})},[o,n]);let f=Ce(o,u,d,c);return(0,Q.useEffect)(()=>{if(!o)return;let e=e=>{e.target instanceof Node&&!u.current?.contains(e.target)&&s(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[o]),(0,Z.jsxs)(`div`,{ref:u,className:`relative`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:()=>s(!o),className:K(`inline-flex h-8 items-center gap-1.5 rounded-md border bg-background px-2.5 font-medium shadow-sm transition-colors hover:bg-muted`,t>0?`border-primary-border text-primary-text`:`border-border-strong text-foreground`),children:[e,t>0&&(0,Z.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,Z.jsx)(i,{className:`size-3.5 text-muted-foreground`})]}),o&&(0,Z.jsx)(`div`,{ref:d,className:K(`absolute top-full z-30 mt-1.5 rounded-lg border bg-background p-3 shadow-pop`,c.right===void 0&&`left-0`),style:{...c,...f},children:typeof a==`function`?a(()=>s(!1)):a})]})},Pn=({title:e,children:t})=>(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2 border-b py-3 last:border-b-0`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),t]}),Fn=({items:e,onPick:t,close:n})=>{let i=(0,Q.useRef)([]);return(0,Q.useEffect)(()=>i.current[0]?.focus(),[]),(0,Z.jsx)(`ul`,{role:`menu`,"aria-label":J(`moreFilters`),onKeyDown:t=>{if(t.key===`Escape`)return n();let a=r(t.key,i.current.indexOf(document.activeElement),e.length);a!==void 0&&(t.preventDefault(),i.current[a]?.focus())},className:`-mx-3 -my-3`,children:e.map((e,r)=>(0,Z.jsx)(`li`,{role:`none`,children:(0,Z.jsx)(`button`,{ref:e=>{i.current[r]=e},type:`button`,role:`menuitem`,className:me,onClick:()=>{n(),t(e.key)},children:e.label})},e.key))})},In=({items:e,onPick:t})=>e.length===0?null:(0,Z.jsx)(Nn,{label:J(`moreFilters`),activeCount:0,children:n=>(0,Z.jsx)(Fn,{items:e,onPick:t,close:n})}),Ln=(e,t,n,r,i)=>{let a=n+(r-n)*e/t;return n+(r-n)*(e+1)/t>i[0]&&a<i[1]},Rn=(e,t,n)=>n===t?0:(e-t)/(n-t),zn=(e,t,n)=>t===0?[Math.min(n,e[1]),e[1]]:[e[0],Math.max(n,e[0])],Bn=1e3,Vn=({config:e,value:t,onChange:n})=>{let{min:r,max:i,step:a,histogram:o,format:s}=e,[c,l]=(0,Q.useState)(),u=c??t??[r,i],d=Math.max(...o),f=()=>{c&&(l(void 0),n(c[0]===r&&c[1]===i?void 0:c))},p=j(c,Bn);return(0,Q.useEffect)(()=>{p&&f()},[p]),e.failed?(0,Z.jsx)(`p`,{className:`text-xs text-danger-text`,children:J(`couldNotLoadCounts`)}):(0,Z.jsxs)(`div`,{className:`w-full`,children:[(0,Z.jsxs)(`div`,{className:`px-[7px]`,children:[o.length>0&&(0,Z.jsx)(`div`,{className:`mb-1 flex h-12 items-end gap-0.5`,children:o.map((e,t)=>(0,Z.jsx)(`span`,{className:K(`flex-1 rounded-t-sm`,Ln(t,o.length,r,i,u)?`bg-primary/70`:`bg-border`),style:{height:`${Math.max(6,e/d*100)}%`}},t))}),(0,Z.jsxs)(`div`,{className:`relative h-4`,children:[(0,Z.jsx)(`span`,{className:`absolute inset-x-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-border`}),(0,Z.jsx)(`span`,{className:`absolute top-1/2 h-1 -translate-y-1/2 rounded-full bg-primary`,style:{left:`${Rn(u[0],r,i)*100}%`,right:`${100-Rn(u[1],r,i)*100}%`}})]})]}),(0,Z.jsx)(`div`,{className:`relative -mt-4 h-4`,children:[0,1].map(t=>(0,Z.jsx)(`input`,{type:`range`,className:`pb-range`,"aria-label":J(t===0?`minimum`:`maximum`,{label:e.label}),min:r,max:i,step:a,value:u[t],onChange:e=>l(zn(u,t,Number(e.target.value))),onPointerUp:f,onTouchEnd:f,onBlur:f},t))}),(0,Z.jsxs)(`div`,{className:`mt-2 flex justify-between text-xs tabular-nums text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:s(u[0])}),(0,Z.jsx)(`span`,{children:s(u[1])})]})]})},Hn=e=>[...new Set(e.map(e=>e.key.split(`:`).slice(0,2).join(`:`)))],Un=(e,t)=>{let n=t.filter(t=>!e.includes(t));return n.length===0?e:[...e,...n]},Wn=(e,t)=>{let n=[...e.facets.map(e=>({key:`facet:${e.id}`,label:e.label,secondary:e.secondary})),...(e.ranges??[]).map(e=>({key:`range:${e.id}`,label:e.label,secondary:e.secondary})),...e.datePresets?[{key:`date`,label:J(`date`),secondary:e.dateSecondary}]:[],...(e.toggles??[]).map(e=>({key:`toggle:${e.id}`,label:e.label,secondary:e.secondary}))],r=new Set,i=[];for(let e of n)!e.secondary||t.includes(e.key)?r.add(e.key):i.push({key:e.key,label:e.label});return{shown:r,more:i}},Gn=({label:e,checked:t,onChange:n})=>(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-between gap-3 py-1`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(w,{checked:t,onChange:n,label:e})]}),Kn=(e,t)=>e.some(e=>e.length>0)||!!t,qn=({groups:e,trailing:t})=>{if(!Kn(e,t))return null;let n=e.filter(e=>e.length>0);return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.map((e,t)=>(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),e]},t)),t&&(0,Z.jsx)(`div`,{className:`flex min-w-32 flex-1 justify-end`,children:t})]})},Jn=(e,t,n)=>{let[r,i]=(0,Q.useState)(t??Wt);return[e??r,e=>{i(e),n?.(e)}]},Yn=({config:e,layout:t,value:n,defaultValue:r,onChange:i,lockedLabels:a,defaultOpenMenu:o,fullWidth:s,leading:c,trailing:l})=>{let[u,d]=Jn(n,r,i),f=vt(e,u),p=Hn(f),[m,h]=(0,Q.useState)(()=>p),[g,_]=(0,Q.useState)();(0,Q.useEffect)(()=>h(e=>Un(e,p)),[p.join(`,`)]);let v=(0,Z.jsx)(Dn,{chips:f,lockedLabels:a,onRemove:e=>d(lt(u,e)),onClear:()=>d(Wt)}),y=(e,t=!1)=>{let n=u.facets[e.id]??[],r=t=>d(St(u,e.id,t));return e.combobox?(0,Z.jsx)(jn,{config:e,selected:n,onToggle:r,inline:t}):(0,Z.jsx)(Mn,{config:e,selected:n,onToggle:r})},b=e.ranges??[],x=e=>(0,Z.jsx)(Vn,{config:e,value:u.ranges?.[e.id],onChange:t=>d(bt(u,e.id,t))}),S=e.datePresets&&(0,Z.jsx)(On,{value:u.date,presets:Array.isArray(e.datePresets)?e.datePresets:void 0,onChange:e=>d({...u,date:e})}),C=(e.toggles??[]).map(e=>(0,Z.jsx)(Gn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(ct(u,e.id))},e.id));if(t===`panel`)return(0,Z.jsxs)(`aside`,{className:s?`flex w-full flex-col gap-1`:`flex w-64 shrink-0 flex-col gap-1 overflow-y-auto rounded-lg border bg-background px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-between pb-1`,children:(0,Z.jsx)(`h2`,{className:`font-semibold`,children:J(`filters`)})}),(f.length>0||(a?.length??0)>0)&&(0,Z.jsx)(`div`,{className:`border-b pb-3`,children:v}),c,e.facets.map(e=>(0,Z.jsx)(Pn,{title:e.label,children:y(e)},e.id)),b.map(e=>(0,Z.jsx)(Pn,{title:e.label,children:x(e)},e.id)),S&&(0,Z.jsx)(Pn,{title:J(`date`),children:S}),C.length>0&&(0,Z.jsx)(Pn,{title:J(`showOnly`),children:C})]});let{shown:w,more:T}=Wn(e,m),E=e=>{h(t=>Un(t,[e])),_(e)},ee=[...e.facets.filter(e=>w.has(`facet:${e.id}`)).map(e=>(0,Z.jsx)(Nn,{label:e.label,activeCount:(u.facets[e.id]??[]).length,width:e.combobox?280:void 0,defaultOpen:o===e.id||g===`facet:${e.id}`,children:y(e,!0)},e.id)),...b.filter(e=>w.has(`range:${e.id}`)).map(e=>(0,Z.jsx)(Nn,{label:e.label,activeCount:+!!u.ranges?.[e.id],width:280,defaultOpen:o===e.id||g===`range:${e.id}`,children:x(e)},`range:${e.id}`)),...S&&w.has(`date`)?[(0,Z.jsx)(Q.Fragment,{children:S},`date`)]:[]],D=(e.toggles??[]).filter(e=>w.has(`toggle:${e.id}`)).map(e=>(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:(0,Z.jsx)(Gn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(ct(u,e.id))})},e.id)),te=[c?[(0,Z.jsx)(Q.Fragment,{children:c},`leading`)]:[],ee,D,T.length>0?[(0,Z.jsx)(In,{items:T,onPick:E},`more`)]:[]];return!Kn(te,l)&&f.length===0&&!a?.length?null:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(qn,{groups:te,trailing:l}),v]})},Xn=H(`app/export`),Zn=()=>new DOMException(Xn(`cancelled`),`AbortError`),Qn=async({client:e,resource:t,filters:n,orderBy:r,plan:i,labels:a,limit:o,port:s,sink:c,signal:l,onProgress:u})=>{let d=i.columns.map(e=>e.name),f=0;try{await c.write(await s.send({kind:`start`,plan:i,locale:be()}));for(let[i,p]of n.entries()){let m=``;do{let h=await e.search(t,{filter:p,orderBy:r,pageSize:500,pageToken:m,fields:d,labels:a});if(l.aborted)throw Zn();let g=h.items.slice(0,o-f);if(await c.write(await s.send({kind:`page`,records:g,labels:h.labels??{}})),f+=g.length,u(f),m=h.nextPageToken,f>=o)return await $n(s,c),{rows:f,truncated:g.length<h.items.length||m!==``||i+1<n.length}}while(m!==``)}return await $n(s,c),{rows:f,truncated:!1}}catch(e){throw await c.abort(),e}finally{s.close()}},$n=async(e,t)=>{await t.write(await e.send({kind:`finish`})),await t.close()},er=1048575,tr=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3
|
-
`,nr=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,rr=`http://schemas.openxmlformats.org/package/2006/relationships`;`${tr}`,`${tr}${rr}${nr}`,`${tr}${rr}${nr}${nr}`,new TextEncoder;var ir=k(),ar=e=>e?.export!==!1,or=e=>Object.values(e.fields).flatMap(e=>e.sensitive?[]:[e.name]),sr=(e,t)=>{let n=new Set(or(e));return Oe(e,t).filter(e=>n.has(e))},cr=(e,t,n)=>Object.fromEntries(ze(e,t,[],n).map(e=>[e.id,e.header])),lr=(e,t,n)=>{let r=cr(e,t,n);return n.flatMap(n=>{let i=e.fields[n];return i?[{name:n,header:r[n],field:i,hints:t?.fields[n]??{}}]:[]})},ur=(e,t)=>{let n=e?.export?e.export.maxRows??1/0:1/0;return Math.min(n,t===`xlsx`?er:1/0)},dr=e=>e.primaryKey.length===1,fr=(e,t)=>{let[n]=e.primaryKey;if(!n||e.primaryKey.length!==1)throw Error(`Not implemented: selected rows are exported by a single-field key`);let r=[];for(let e=0;e<t.length;e+=500)r.push(I(ir.in(n,t.slice(e,e+500))));return r},pr=e=>{if(e.kind!==`counting`)return e.kind===`exact`?e.rows:Math.max(e.rows,10001)},mr=H(`app/import`),hr=e=>typeof e==`object`&&!!e&&`date`in e,gr=e=>typeof e==`object`&&!!e&&`json`in e,_r=e=>e===null||typeof e==`string`&&e.trim()===``,vr=e=>e===null?``:hr(e)?e.date.replace(`T`,` `):gr(e)?JSON.stringify(e.json):typeof e==`boolean`?e?`TRUE`:`FALSE`:String(e),yr=e=>e<26?String.fromCharCode(65+e):yr(Math.floor(e/26)-1)+yr(e%26),br=(e,t)=>e[t]?.trim()?e[t]:mr(`column`,{letters:yr(t)}),xr=(e,t,n,r)=>{let i=wn(t.headers),a=t.headers.map((e,n)=>({column:n,include:!0,name:i[n],label:br(t.headers,n).trim(),type:t.types[n].type,inferred:t.types[n],decimal:t.decimals[n]}));return{name:Tn(e,n,r)??``,pluralLabel:e.replace(/\.[^.]+$/,``).trim(),singularLabel:``,titleField:a.find(e=>e.type===`text`)?.name,fields:a}},Sr=e=>e.fields.filter(e=>e.include),Cr=(e,t,n)=>{let r=e.fields.find(e=>e.column===t),i=e.fields.map(e=>e.column===t?{...e,...n}:e),a=i.find(e=>e.column===t),o=r?.name===e.titleField,s=a.include&&a.type===`text`;return o?{...e,fields:i,titleField:s?a.name:void 0}:{...e,fields:i}},wr=`user_table_fields`,Tr=`table`,Er=(e,t)=>{let n=Sr(t).map((e,t)=>({op:`create`,resource:wr,data:{table_id:{$ref:Tr},name:e.name,label:e.label.trim(),type:e.type,position:t+1,...e.type===`decimal`&&{precision:e.decimal.precision,scale:e.decimal.scale}}})),r=t.titleField?[{op:`update`,resource:e,key:{$ref:Tr},etag:`*`,data:{title_field:t.titleField}}]:[];return[{op:`create`,resource:e,ref:Tr,data:{name:t.name,singular_label:t.singularLabel.trim(),plural_label:t.pluralLabel.trim()}},...n,...r]},Dr=(e,t)=>{let n=new Map(t.map(e=>[e.value,e.count]));return e.map(([e,t])=>({value:e,label:t,...n.get(e)!==void 0&&{count:n.get(e)}}))},Or=(e,t)=>[...new Set(t.filter(t=>!e.includes(t)))],kr=k(),Ar=(e,t,n)=>{let r=V(),[i,a]=(0,Q.useState)({}),o=e=>!!e?.search?.length&&e.primaryKey.length===1,s=e=>{let n=t[e.name];return[e.primaryKey[0],...n?.titleFrom?n.titleFrom.fields:[Re(e,n)]]},c=(e,r)=>{let i=t[e.name],a=String(r[e.primaryKey[0]]);return[a,i?.titleFrom?n(e,i,r,a):String(r[Re(e,i)])]},l=et({queries:e.map(({id:e,target:t})=>{let n=(i[e]??``).trim();return{queryKey:[`reference-search`,e,t?.name??``,n],enabled:o(t)&&n!==``,placeholderData:Xe,queryFn:async()=>(await r.list(t.name,{filter:I(kr.search(n)),fields:s(t),pageSize:20})).items}})});return e.map(({id:e,target:t},n)=>{if(!o(t))return{};let r=t=>a(n=>({...n,[e]:t}));return(i[e]??``).trim()===``?{onSearch:r}:{onSearch:r,matches:(l[n]?.data??[]).map(e=>c(t,e))}})},jr=24,Mr=({model:e,resources:t,views:n,view:r,state:i,extras:a,titleOf:o})=>{let s=V(),c=v(s),l=Ze(),u=st(r,e),d=e=>r?.fields[e]?.label??B(e),f=n=>{let r=e.fields[n];return r?.type===`relation`&&r.relation?t[r.relation.resource]:void 0},p=e=>!!(e&&n[e.name]?.titleFrom),m=u.facets.flatMap(e=>(e.flags?e.options.map(e=>e.value):[e.id]).map(t=>({group:e.id,field:t}))),h=et({queries:m.map(({group:t,field:r})=>{let o=ut(u,{...i,facets:{...i.facets,[t]:[]}},a),s=f(r),l=s?.primaryKey.length===1&&!p(s)?Re(s,n[s.name]):void 0;return{queryKey:q.facets(e.name,r,o),queryFn:()=>c.facets(e.name,r,{filter:o,limit:50,...l&&{label:l}})}})}),g=(e,t)=>h[m.findIndex(n=>n.group===e&&n.field===t)],_=(e,t)=>g(e,t)?.data,y=e=>(_(e,e)??[]).flatMap(e=>e.value===null?[]:[String(e.value)]),b=et({queries:u.facets.map(t=>{let r=f(t.id),a=Or(y(t.id),i.facets[t.id]??[]);return{queryKey:q.labels(`facet:${e.name}.${t.id}`,a.join(`,`)),enabled:!!r&&!p(r)&&a.length>0,queryFn:async()=>[...await de(l,s,r,a,n[r.name])]}})}),S=et({queries:u.facets.map(t=>{let r=f(t.id),a=r&&p(r)?x(r,n[r.name]):void 0,o=[...new Set([...y(t.id),...i.facets[t.id]??[]])];return{queryKey:q.labels(`facet-title:${e.name}.${t.id}`,o.join(`,`)),enabled:a!==void 0&&o.length>0,queryFn:async()=>[...await M(s,r,a,o)]}})}),C=(e,t)=>{let r=f(e);return(S[t]?.data??[]).map(([e,t])=>[e,o(r,n[r.name],t,e)])},w=Ar(u.facets.map(e=>({id:e.id,target:e.combobox?f(e.id):void 0})),n,o),T=u.ranges??[],E=et({queries:T.map(t=>{let n=ut(u,bt(i,t.id,void 0),a),o=gt(r,t.id)?jr:1;return{queryKey:q.histogram(e.name,t.id,o,n),queryFn:()=>c.histogram(e.name,t.id,{filter:n,buckets:o})}})});return{facets:u.facets.map((t,n)=>{if(t.flags){let e=e=>{let n=_(t.id,e);return n&&{count:n.find(e=>String(e.value)===`true`)?.count??0}},n=t.options.map(({value:t})=>({value:t,label:d(t),...e(t)})),r=t.options.some(({value:e})=>g(t.id,e)?.isError);return{...t,options:n,...r&&{failed:r}}}let i=e.fields[t.id],a=(_(t.id,t.id)??[]).flatMap(e=>e.label===void 0?[]:[[String(e.value),e.label]]),o=i?.type===`enum`?(i.enumValues??[]).map(e=>[e,Pe(e,r?.fields[t.id]?.valueLabels)]):[],s=new Map([...o,...a,...b[n]?.data??[],...C(t.id,n)]),c=(_(t.id,t.id)??[]).flatMap(e=>e.value===null?[]:[{value:String(e.value),label:s.get(String(e.value))??String(e.value),count:e.count}]),l=w[n],u=g(t.id,t.id)?.isError;return{...t,label:d(t.id),...u&&{failed:u},options:l.matches?Dr(l.matches,c):c,...s.size>0&&{labels:Object.fromEntries(s)},...l.onSearch&&{onSearch:l.onSearch}}}),ranges:T.flatMap((e,t)=>{let n=E[t];if(n?.isError)return[{...e,label:d(e.id),min:0,max:0,step:1,histogram:[],format:mt(r,e.id),failed:!0}];let i=n?.data;return!i||i.min===null||i.max===null?[]:[{...e,label:d(e.id),min:Math.floor(i.min),max:Math.ceil(i.max),step:Math.max(1,Math.round((i.max-i.min)/100)),histogram:gt(r,e.id)?i.buckets.map(e=>e.count):[],format:mt(r,e.id)}]}),...u.dateField&&{datePresets:u.datePresets??!0,dateField:u.dateField,dateKind:u.dateKind,...u.dateSecondary&&{dateSecondary:!0}},toggles:u.toggles?.map(e=>({...e,label:d(e.id)}))}},Nr=Je(()=>Ye(()=>import(`./import-dialog-CyB3vJn7.js`).then(e=>e.ImportDialog),__vite__mapDeps([0,1,2,3,4,5,6]))),Pr=Je(()=>Ye(()=>import(`./import-table-dialog-D8yGy95h.js`).then(e=>e.ImportTableDialog),__vite__mapDeps([7,1,2,3,4,5,6]))),Fr=({model:e})=>{let{resources:t,views:n}=Ie(),r=pe(e.name),i=pe(wr),[a,o]=(0,Q.useState)(!1),s=n[e.name]?.import;return s===!1||!R(r,`create`)||s===`table`&&!R(i,`create`)?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:()=>o(!0),"aria-haspopup":`dialog`,children:[(0,Z.jsx)(P,{className:`size-3.5`}),mr(s===`table`?`fromFile`:`import`)]}),a&&s===`table`&&(0,Z.jsx)(Pr,{tables:e,resources:t,views:n,onClose:()=>o(!1)}),a&&s!==`table`&&(0,Z.jsx)(Nr,{model:e,resources:t,views:n,canUpdate:R(r,`update`),onClose:()=>o(!1)})]})},Ir=()=>{let e=new Worker(new URL(`/assets/export-worker-C46NatsO.js`,``+import.meta.url),{type:`module`,name:`protobase-export`}),t=[];return e.onmessage=e=>t.shift()?.resolve(e.data.bytes),e.onerror=e=>{e.preventDefault();let n=Error(Xn(`couldNotBuild`,{message:e.message}));for(let e of t.splice(0))e.reject(n)},{send:n=>new Promise((r,i)=>{t.push({resolve:r,reject:i}),e.postMessage(n)}),close:()=>e.terminate()}},Lr={xlsx:{mime:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,extension:`.xlsx`,description:`workbook`},csv:{mime:`text/csv`,extension:`.csv`,description:`csvFile`}},Rr=/[\\/:*?"<>|\u0000-\u001f]/g,zr=(e,t,n=new Date)=>{let r=[n.getFullYear(),String(n.getMonth()+1).padStart(2,`0`),String(n.getDate()).padStart(2,`0`)].join(`-`);return`${e.replace(Rr,` `).trim()} ${r}${Lr[t].extension}`},Br=8e6,Vr=(e,t)=>{let n=new Blob([],{type:Lr[t].mime}),r=[],i=0,a=()=>{n=new Blob([n,...r],{type:Lr[t].mime}),r=[],i=0};return{write:async e=>{e.length!==0&&(r.push(e),i+=e.length,i>=Br&&a())},close:async()=>{a();let t=URL.createObjectURL(n),r=document.createElement(`a`);r.href=t,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(t),6e4)},abort:async()=>{r=[],n=new Blob([])}}},Hr=()=>globalThis.showSaveFilePicker,Ur=()=>typeof Hr()==`function`,Wr=async(e,t)=>{let n=Hr();if(!n)throw Error(`This browser cannot save a file as it is built`);let r=Lr[t],i;try{i=await n({suggestedName:e,types:[{description:Xn(r.description),accept:{[r.mime]:[r.extension]}}]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;throw e}let a=await i.createWritable();return{write:async e=>{e.length>0&&await a.write(e)},close:()=>a.close(),abort:()=>a.abort()}},Gr=Je(()=>Ye(()=>import(`./export-dialog-Ivzdiuhz.js`).then(e=>e.ExportDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),Kr=Je(()=>Ye(()=>import(`./export-dialog-Ivzdiuhz.js`).then(e=>e.ExportProgressDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),qr=(e,t)=>Ur()?Wr(e,t):Promise.resolve(Vr(e,t)),Jr=(e,t)=>{let n=t[e.primaryKey[0]];return typeof n==`object`&&n&&`id`in n?n.id:n},Yr=({model:e,view:t,resources:n,views:r,plural:i,filter:a,orderBy:o,createPort:s=Ir,createSink:c=qr})=>{let l=V(),d=qe(),[f,p]=(0,Q.useState)({kind:`closed`}),m=(0,Q.useRef)(void 0),h=(0,Q.useRef)(void 0),g=$e({queryKey:q.exportCount(e.name,a),enabled:f.kind===`settings`,queryFn:async()=>{let t=await l.list(e.name,{filter:a||void 0,pageSize:1,count:`exact`,fields:e.primaryKey});return t.totalSize===void 0?{kind:`estimate`,rows:t.totalSizeEstimate}:{kind:`exact`,rows:t.totalSize}}}).data??{kind:`counting`},_=(e,t=h.current)=>{let n=h.current;n&&n===t&&(h.current=void 0,n.settle(e?[]:n.rows))},v=(t=[])=>(_(!1),p({kind:`settings`,selected:dr(e)?t.map(t=>Jr(e,t)):[]}),new Promise(e=>{h.current={rows:t,settle:e}})),y=()=>{p({kind:`closed`}),_(!1)},b=async(f,v)=>{let y=zr(i,f.format),b=await c(y,f.format);if(!b)return;let x=h.current,S=ur(t,f.format),C=f.scope===`selected`?v.length:pr(g),w=C===void 0?void 0:Math.min(C,S),T=new AbortController;m.current=T,p({kind:`running`,done:0,total:w});try{let c=await Qn({client:l,resource:e.name,filters:f.scope===`selected`?fr(e,v):[a],orderBy:o,plan:{format:f.format,mode:f.mode,name:i,columns:lr(e,t,f.columns)},labels:f.mode===`shown`?A(n,r,e,f.columns):{},limit:S,port:s(),sink:b,signal:T.signal,onProgress:e=>T.signal.aborted||p({kind:`running`,done:e,total:w})});d.show({state:`success`,title:Xn(`exported`,{count:u(c.rows),plural:i}),description:c.truncated?Xn(`truncated`,{name:y,count:u(c.rows)}):y}),_(!0,x)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;if(!N(e))throw e;d.show({state:`error`,title:Xn(`couldNotExport`,{plural:i}),description:e.message})}finally{m.current=void 0,p(e=>e.kind===`running`?{kind:`closed`}:e),_(!1,x)}},x=()=>{m.current?.abort(),y()},S=or(e),C=cr(e,t,S);return{open:v,dialogs:f.kind===`settings`?(0,Z.jsx)(Gr,{plural:i,view:t,fields:S.map(e=>({name:e,label:C[e]})),initialColumns:sr(e,t),count:g,selected:f.selected.length>0?f.selected.length:void 0,open:!0,onExport:e=>void b(e,f.selected),onClose:y}):f.kind===`running`?(0,Z.jsx)(Kr,{plural:i,done:f.done,total:f.total,onCancel:x}):null}},Xr=({state:e,onClearSearch:t,onClearFilters:n,create:r})=>(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center text-muted-foreground`,children:[(0,Z.jsx)(`p`,{children:e.message}),(e.clearSearch||e.clearFilters||e.create&&r)&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[e.clearSearch&&(0,Z.jsx)(L,{onClick:t,children:X(`clearSearch`)}),e.clearFilters&&(0,Z.jsx)(L,{onClick:n,children:X(`clearFilters`)}),e.create&&r]})]}),Zr=({plural:e,search:t,filtered:n,scoped:r,canCreate:i})=>t?{message:X(`noMatchSearch`,{plural:e,search:t}),clearSearch:!0,clearFilters:n,create:!1}:n?{message:X(`noMatchFilters`,{plural:e}),clearSearch:!1,clearFilters:!0,create:!1}:r?{message:X(`noMatch`,{plural:e}),clearSearch:!1,clearFilters:!1,create:!1}:{message:X(`noneYet`,{plural:e}),clearSearch:!1,clearFilters:!1,create:i},Qr=(e,t)=>{},$r=({windowMs:e=1e3,comebacks:t=2,onHold:n=Qr}={})=>{let r,i=[],a;return(o,s)=>{if(a?.among.has(o))return a.value;if(a&&(a=void 0,i=[]),o===r||(r=o,i=i.filter(t=>s-t.at<=e),i.push({value:o,at:s,comeback:i.some(e=>e.value===o)}),i.filter(e=>e.comeback).length<t))return o;let c=new Set(i.slice(-2*t).map(e=>e.value));return a={value:Math.min(...c),among:c},n(a.value,[...c]),a.value}},ei=e=>Math.max(1,Math.floor((e+12)/252)),ti=(e,t)=>Math.max(0,(e-(t-1)*12)/t),ni=(e,t,n,r)=>({start:e*n,end:Math.max(0,Math.min(r,(t+1)*n)-1)}),ri=(e,t,n)=>{let r=e/t.rowHeight;return t.columns===n.columns?r*n.rowHeight:Math.floor(Math.floor(r)*t.columns/n.columns)*n.rowHeight},ii=(e,t)=>{let n=e/t.rowHeight;return Math.floor(n)*t.columns+n%1},ai=(e,t)=>Math.floor(Math.floor(e)/t)+e%1,oi=8,si=(e,t,n)=>{let r=e.get(t);if(r!==void 0&&r>=n)return e;let i=new Map(e);i.delete(t),i.set(t,n);for(let e of i.keys()){if(i.size<=oi)break;i.delete(e)}return i},ci=({source:e,label:t,initialIndex:n,onScrollIndex:r,minHeight:i,children:a})=>{let{total:o}=e,[s]=(0,Q.useState)(n),[c,l]=(0,Q.useState)(0),u=ei(c),d=ti(c,u),[f,p]=(0,Q.useState)(()=>new Map),m=Math.ceil(Math.max(i(d),f.get(d)??0)),h=m+12,g={columns:u,rowHeight:h},_=(0,Q.useRef)({layout:g,top:0}),v=_.current.top>0&&(_.current.layout.columns!==u||_.current.layout.rowHeight!==h),y=e=>v?ri(_.current.top,_.current.layout,g):e,b=d>0&&f.has(d),x=nt({total:Math.ceil(o/u),rowHeight:h,initialIndex:ai(s,u),settle:y,ready:b,onScroll:e=>r(ii(e,g))});(0,Q.useLayoutEffect)(()=>{v&&x.scrollTo(x.top),_.current={layout:g,top:x.started()?x.top:0}});let S=ni(x.first,x.last,u,o),C=Qt({total:o,rowAt:e.rowAt,loadRows:e.loadRows,cachedRows:e.cachedRows,revision:e.revision,latencyMs:0},S.start,S.end),[w]=(0,Q.useState)(()=>$r());(0,Q.useLayoutEffect)(()=>{let e=x.ref.current;if(!e)return;let t=()=>l(w(e.clientWidth,performance.now())),n=new ResizeObserver(t);return n.observe(e),t(),()=>n.disconnect()},[w]);let T=(0,Q.useRef)(d);T.current=d;let[E]=(0,Q.useState)(()=>new ResizeObserver(e=>{let t=Math.max(...e.map(e=>e.borderBoxSize[0]?.blockSize??e.contentRect.height)),n=T.current;p(e=>si(e,n,t))}));(0,Q.useLayoutEffect)(()=>()=>E.disconnect(),[E]),(0,Q.useLayoutEffect)(()=>{let e=x.ref.current;if(b||d===0||!e)return;let t=[...e.querySelectorAll(`:scope > li[aria-posinset]`)];if(t.length===0)return;let n=Math.max(...t.map(e=>e.getBoundingClientRect().height));p(e=>si(e,d,n))});let ee=(0,Q.useCallback)(e=>{if(e)return E.observe(e),()=>E.unobserve(e)},[E]);return(0,Z.jsx)(`ul`,{ref:x.ref,className:`relative min-w-0 flex-auto`,"aria-label":t,style:{height:x.geometry.contentHeight},children:x.rows.flatMap(({index:e,offset:t})=>Array.from({length:u},(n,r)=>{let i=e*u+r;if(i>=o)return[];let s=C(i),c={top:t,left:r*(d+12),width:d,minHeight:m};return s?(0,Z.jsx)(`li`,{ref:ee,"aria-posinset":i+1,"aria-setsize":o,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:a(s)},s.id):(0,Z.jsx)(`li`,{"aria-hidden":!0,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:(0,Z.jsx)(z,{className:`h-full rounded-lg`})},`skeleton-${i}`)}))})},li=`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,ui=e=>e*.75,di=44,fi=({model:e,view:t,display:n,list:r,empty:i})=>{let a=t?.names?.plural??B(e.name),o=n.card===void 0&&(n.image!==void 0||n.photos!==void 0);return r.isLoading?(0,Z.jsx)(`div`,{"aria-busy":!0,className:`min-h-0 flex-1 overflow-hidden ${li}`,children:Array.from({length:6},(e,t)=>(0,Z.jsx)(z,{className:`h-24`},t))}):r.error?(0,Z.jsx)(Ve,{title:ke(`couldNotLoadRows`),error:r.error}):!r.source||r.source.total===0?i??(0,Z.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:ke(`noneMatch`,{plural:a.toLowerCase()})}):(0,Z.jsx)(ci,{source:r.source,label:a,initialIndex:r.initialIndex,onScrollIndex:r.onScrollIndex,minHeight:e=>(o?ui(e):0)+di,children:r=>(0,Z.jsx)(Vt,{model:e,view:t,display:n,row:ue(e,r)})})},pi=`protobase:list-places`,mi=50,hi=(e,t)=>`${e} ${t}`,gi=e=>{if(typeof e!=`object`||!e)return!1;let{entry:t,url:n,place:r}=e;return typeof t==`string`&&typeof n==`string`&&typeof r==`number`&&Number.isFinite(r)&&r>=0},_i=e=>Me(()=>{let t=e.getItem(pi);if(t===null)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(gi):[]},[]),vi=e=>{let t=new Map(_i(e).map(e=>[hi(e.entry,e.url),e]));return{placeOf:(e,n)=>{let r=t.get(hi(e,n));return r?r.place:[...t.values()].findLast(e=>e.url===n)?.place??0},save:(e,n,r)=>{let i=hi(e,n);t.delete(i),t.set(i,{entry:e,url:n,place:r});for(let e of[...t.keys()].slice(0,Math.max(0,t.size-mi)))t.delete(e)},persist:()=>Me(()=>e.setItem(pi,JSON.stringify([...t.values()])),void 0)}},yi={getItem:()=>null,setItem:()=>{}},bi,xi=()=>bi??=vi(Me(()=>window.sessionStorage,void 0)??yi),Si=()=>{let{entry:e,path:t,params:n}=ye(),r=`${t}?${n.toString()}`,i=xi();(0,Q.useEffect)(()=>{let e=()=>i.persist(),t=()=>document.visibilityState===`hidden`&&i.persist();return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),i.persist()}},[i]);let a=(0,Q.useCallback)(t=>i.save(e,r,t),[i,e,r]);return{initialIndex:i.placeOf(e,r),remember:a}},Ci=e=>e.reduce((e,t)=>e+t.count,0),wi=e=>{let t=Math.floor(e.length/2),n=Ci(e.slice(0,t)),r=Ci(e.slice(e.length-t));return n===0?0:(r-n)/n*100},Ti=H(`activity-chart`),Ei=({title:e,defaultGranularity:t=`day`,data:n,granularity:r,onGranularityChange:i,periodLabel:a,state:o,className:s})=>{let[c,l]=(0,Q.useState)(t),d=r??c,f=i??l,p=wi(n),m=n.map(({at:e,count:t})=>({at:e,value:t,count:t}));return(0,Z.jsxs)(`section`,{className:K(`rounded-lg border bg-background px-4 pb-2 pt-3`,s),children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`h2`,{className:`font-semibold`,children:e}),o===void 0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`font-semibold tabular-nums`,children:u(Ci(n))}),(0,Z.jsxs)(`span`,{className:K(`text-xs font-medium tabular-nums`,p>=0?`text-success-text`:`text-danger-text`),children:[p>=0?`+`:`−`,Math.abs(p).toFixed(1),`%`]})]}),(0,Z.jsx)(`span`,{className:`hidden text-xs text-muted-foreground sm:inline`,children:a??`last ${d===`day`?`30 days`:`12 weeks`}`})]}),(0,Z.jsx)(ae,{value:d,onChange:f,options:[{value:`day`,label:Ti(`day`)},{value:`week`,label:Ti(`week`)}]})]}),(0,Z.jsxs)(`div`,{className:`mt-2`,children:[o===`failed`&&(0,Z.jsx)(`p`,{className:`py-6 text-danger-text`,children:Ti(`couldNotLoad`)}),o===`loading`&&(0,Z.jsx)(z,{className:`h-24 w-full`}),o===void 0&&(0,Z.jsx)(Lt,{points:m,measure:{kind:`count`},bucket:d,type:`bar`,compact:!0})]})]})},Di={"7d":`last 7 days`,"30d":`last 30 days`,"90d":`last 90 days`,"1y":`last year`,all:`all time`},Oi=({resource:e,chart:t,title:n,filter:r})=>{let[i,a]=(0,Q.useState)(t.granularity===`week`?`week`:`day`),o=i===`week`?`90d`:t.range,s=d(e,{field:t.field,range:o,granularity:i,filter:r,timeZone:G()}),c=s.data?.points.map(e=>({at:Date.parse(`${e.bucket}Z`),count:e.count}))??[];return(0,Z.jsx)(Ei,{title:n,data:c,granularity:i,onGranularityChange:a,periodLabel:i===`week`?`last 12 weeks`:Di[o],state:s.isError?`failed`:s.isPending?`loading`:void 0})},ki=(e,t,n)=>{let r=e.sum??e.average;if(r===void 0)return n;let i=t?.fields[r]?.label??B(r);return e.sum===void 0?je(`average`,{label:i}):`${i}`},Ai=({model:e,view:t,chart:n,plural:r,filter:i})=>{let a=t?.fields[n.groupBy]?.label??B(n.groupBy);return(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-background px-4 pb-3 pt-3`,"aria-label":`${ki(n,t,r)} by ${a.toLowerCase()}`,children:[(0,Z.jsxs)(`h2`,{className:`mb-2 font-semibold`,children:[ki(n,t,r),` by `,a.toLowerCase()]}),(0,Z.jsx)(kt,{model:e,view:t,groupBy:n.groupBy,type:n.type,sum:n.sum,average:n.average,limit:n.limit,filter:i})]})},ji=({value:e,onCommit:t,placeholder:n,className:r})=>{let[i,a]=(0,Q.useState)(e);return(0,Q.useEffect)(()=>a(e),[e]),(0,Q.useEffect)(()=>{if(i===e)return;let n=setTimeout(()=>t(i),350);return()=>clearTimeout(n)},[i,e,t]),(0,Z.jsx)(T,{wrapperClassName:K(`min-w-0 flex-1 sm:w-72 sm:flex-initial`,r),leading:(0,Z.jsx)(F,{className:`size-4`}),placeholder:n,"aria-label":X(`search`),value:i,onChange:e=>a(e.target.value),onKeyDown:e=>e.key===`Enter`&&t(i)})},Mi=(e,t,n,r,i)=>{let a=n?.list?.relatedColumns??[];if(a.length===0)return e;let o=new Map(e.map(e=>[e.id,e]));return Oe(t,n).flatMap(e=>{let t=o.get(e);if(t)return[t];let n=a.find(t=>t.name===e),s=n&&r[n.resource];if(!n||!s)return[];let c=n.label??B(n.name);return[{id:n.name,header:c,kind:`text`,width:160,minWidth:Te(c,!1),sortable:!1,render:e=>(0,Z.jsx)(yt,{column:n,records:e[n.name]??[],target:s,view:i[s.name],Card:Vt})}]})},Ni=({model:e,view:t,target:n,children:r})=>{let i=ht(e.name,t.listOf,!0),a=t.names?.plural??B(e.name),o=e=>(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[(0,Z.jsx)(Zt,{title:a,subtitle:t.help}),e]});if(i.error)return o((0,Z.jsx)(Ve,{title:at(`couldNotLoadYour`,{plural:a.toLowerCase()}),error:i.error}));if(!i.data)return o((0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,children:Array.from({length:3},(e,t)=>(0,Z.jsx)(z,{className:`h-24`},t))}));let s=Nt(n,i.data);return s?r(s):o((0,Z.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:at(`noneYet`,{plural:a.toLowerCase()})}))},Pi=({title:e,chips:t,label:n,required:r,initial:i=``,busy:a,onSave:o,onClose:s})=>{let c=(0,Q.useId)(),[l,u]=(0,Q.useState)(i),d=`${c}-form`;return(0,Z.jsx)(b,{open:!0,title:e,onClose:s,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{onClick:s,children:Y(`cancel`)}),(0,Z.jsx)(L,{type:`submit`,form:d,variant:`primary`,loading:a,children:Y(`save`)})]}),children:(0,Z.jsxs)(`form`,{id:d,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),o(l.trim()===``?null:l.trim())},children:[t.length>0&&(0,Z.jsx)(wt,{chips:t}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:c,className:`font-medium`,children:n}),!r&&(0,Z.jsx)(`span`,{id:`${c}-hint`,className:`text-xs text-muted-foreground`,children:Y(`optional`)})]}),(0,Z.jsx)(T,{id:c,value:l,required:r,pattern:r?`.*\\S.*`:void 0,"aria-describedby":r?void 0:`${c}-hint`,autoFocus:!0,autoComplete:`off`,onChange:e=>u(e.target.value)})]})]})})},$=k(),Fi={start:0,end:0},Ii=(e,t)=>$.and(t,{kind:`present`,field:e.field,span:Fi}),Li=e=>{switch(e.kind){case`and`:case`or`:return{...e,args:e.args.map(Li)};case`not`:return Ri(e.arg);case`search`:case`present`:case`isNull`:case`related`:return e;default:return Ii(e,e)}},Ri=e=>{switch(e.kind){case`and`:return $.or(...e.args.map(Ri));case`or`:return $.and(...e.args.map(Ri));case`not`:return Li(e.arg);case`search`:case`present`:case`isNull`:case`related`:return $.not(e);default:return Ii(e,$.not(e))}},zi=e=>{let t=xe(e);if(!t.ok)throw Error(`The filter cannot be read: ${t.errors.map(e=>e.message).join(`; `)}`);return t.ast},Bi=e=>e.kind===`and`||e.kind===`or`?e.args.some(Bi):e.kind===`not`?Bi(e.arg):e.kind===`related`,Vi=(e,t)=>![zi(e),zi(t)].some(e=>e&&Bi(e)),Hi=(e,t)=>{let n=zi(e);if(!n)return null;let r=zi(t),i=$.not(Li(n));return I(r?$.and(r,i):i)},Ui=(e,t)=>Hi(t,e),Wi=e=>e.key.startsWith(`extra:`)?`extra:${e.label}`:e.key,Gi=(e,t)=>{let n=new Map(e.map(e=>[Wi(e),e])),r=new Map(t.map(e=>[Wi(e),e])),i=e.filter(e=>!r.has(Wi(e))).map(e=>({kind:`removed`,label:e.label})),a=t.flatMap(e=>{let t=n.get(Wi(e));return t&&t.label!==e.label?[{kind:`changed`,label:e.label,before:t.label}]:[]}),o=t.filter(e=>!n.has(Wi(e))).map(e=>({kind:`added`,label:e.label}));return[...i,...a,...o]},Ki=(e,t,n,r)=>{let i=e-t;if(i===0)return Y(`asMany`,{plural:r});let a=Math.abs(i)===1?n:r;return i>0?Y(`more`,{count:i,noun:a}):Y(`fewer`,{count:-i,noun:a})},qi=12,Ji={added:{word:`added`,className:`text-success-text`},removed:{word:`removed`,className:`text-danger-text`},changed:{word:`changed`,className:`text-primary-text`}},Yi=({changes:e})=>(0,Z.jsx)(`ul`,{"aria-label":Y(`filterChanges`),className:`divide-y rounded-md border`,children:e.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[72px_1fr] gap-3 px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium ${Ji[e.kind].className}`,children:Y(Ji[e.kind].word)}),e.kind===`changed`?(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,Z.jsx)(`span`,{className:`font-medium`,children:e.label})]}):(0,Z.jsx)(`span`,{className:e.kind===`removed`?`text-muted-foreground line-through`:`font-medium`,children:e.label})]},`${e.kind}:${e.label}`))}),Xi=(e,t)=>{let n=$e({...ge(V(),e,t??``),enabled:t!==null});return t===null?0:n.data},Zi=(e,t,n)=>`${e} ${e===1?t:n}`,Qi=({model:e,view:t,title:n,filter:r,total:i,plural:a})=>{let o=t?.list?.displays?.find(e=>e.kind===`cards`);return(0,Z.jsxs)(`section`,{"aria-label":n,className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`h3`,{className:`font-semibold`,children:[n,` `,(0,Z.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,i??`…`,`)`]})]}),i!==void 0&&i>qi&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Y(`firstOf`,{limit:qi,total:i})}),r===null||i===0?(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:Y(`noPlural`,{plural:a})}):(0,Z.jsx)(Ft,{model:e,view:t,filter:r,sort:re(e,t),limit:qi,display:o?.name??`table`,row:!0,link:!1,empty:`No ${a}.`})]})},$i=({model:e,view:t,before:n,after:r})=>{let i=(0,Q.useMemo)(()=>Hi(n,r),[n,r]),a=(0,Q.useMemo)(()=>Ui(n,r),[n,r]),o=Xi(e,i),s=Xi(e,a),c=(t?.names?.singular??B(e.name)).toLowerCase(),l=(t?.names?.plural??B(e.name)).toLowerCase();return(0,Z.jsxs)(Z.Fragment,{children:[o!==void 0&&s!==void 0?(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`span`,{className:`font-semibold`,children:Ki(o,s,c,l)}),(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[`: `,Y(`addedRemoved`,{added:Zi(o,c,l),removed:s})]})]}):(0,Z.jsx)(z,{className:`h-4 w-48`}),(0,Z.jsx)(Qi,{model:e,view:t,title:Y(`added`),filter:i,total:o,plural:l}),(0,Z.jsx)(Qi,{model:e,view:t,title:Y(`removed`),filter:a,total:s,plural:l})]})},ea=({model:e,view:t,title:n,before:r,after:i,saveNewLabel:a,updating:o,creating:s,onUpdate:c,onSaveNew:l,onCancel:u})=>{let d=Gi(rt(e,r),rt(e,i));return(0,Z.jsx)(b,{open:!0,wide:!0,title:n,onClose:u,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{onClick:u,children:Y(`cancel`)}),(0,Z.jsx)(L,{loading:s,disabled:o,onClick:l,children:a}),(0,Z.jsx)(L,{variant:`primary`,loading:o,disabled:s,onClick:c,children:Y(`update`)})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d.length>0&&(0,Z.jsx)(Yi,{changes:d}),Vi(r,i)?(0,Z.jsx)($i,{model:e,view:t,before:r,after:i}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:Y(`noRecordsDiff`)})]})})},ta=()=>{let{address:e,set:t}=g();return{key:e?.kind===`list`?e.savedSearch:void 0,open:e=>t({savedSearch:e})}},na=e=>e instanceof Error?e.message:Y(`somethingWrong`),ra=(e,t)=>{let n=Ie(),r=V(),i=qe(),a=Ke(),{href:o,open:s}=g(),l=ta(),{resource:u}=e,d=n.resources[u],f=n.views[u]?.searchesOf,p=n.permissions[u],m=d!==void 0&&f!==void 0&&p!==void 0&&R(p,`create`)&&R(p,`delete`),h=n.signIn?.[u]?.signIn,_=Tt(u,m),v=e=>Be(c(d,e)),y=f&&_.data?.find(e=>e[f.filter]===t),b=y||l.key===void 0||!p||!R(p,`update`)?void 0:_.data?.find(e=>v(e)===l.key),x=n.views[u]?.names,S=x?.plural??`saved searches`,C=f?.name===void 0?void 0:d?.fields[f.name],w=Qe({mutationFn:e=>r.create(u,{[f.filter]:t,...f.name&&{[f.name]:e}}),onSuccess:e=>{l.open(v(e.record)),i.show({state:`success`,title:Y(`searchSaved`),action:{label:Y(`openPlural`,{plural:S}),href:o({kind:`list`,resource:u}),onNavigate:s}})},onError:e=>i.show({state:`error`,title:Y(`couldNotSave`),description:na(e)}),onSettled:()=>a(u)}),T=Qe({mutationFn:e=>r.remove(u,v(e)),onError:e=>i.show({state:`error`,title:Y(`couldNotTakeOff`),description:na(e)}),onSettled:()=>a(u)}),E=Qe({mutationFn:e=>r.update(u,v(e),{[f.filter]:t},e.etag??`*`),onSuccess:()=>i.show({state:`success`,title:Y(`searchUpdated`)}),onError:e=>i.show({state:`error`,title:Y(`couldNotUpdate`),description:na(e)}),onSettled:()=>a(u)}),ee=w.isPending||T.isPending||E.isPending;return{mode:m?`save`:h?`sign-in`:void 0,prompt:h,saved:y!==void 0,opened:b&&{filter:String(b[f.filter]??``),name:f.name&&typeof b[f.name]==`string`&&b[f.name]!==``?String(b[f.name]):void 0},noun:(x?.singular??B(u)).toLowerCase(),naming:C&&{label:n.views[u]?.fields[C.name]?.label??B(C.name),required:!C.nullable},ready:_.data!==void 0&&!ee,updating:E.isPending,creating:w.isPending,remove:()=>y&&T.mutate(y),saveNew:(e,t)=>w.mutate(e,t),update:e=>b&&E.mutate(b,e)}},ia=({model:e,view:t,search:n,filter:r,chips:i,className:a})=>{let o=ra(n,r),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)();if(!o.mode)return null;let p=n.label??Y(`saveSearch`);if(o.mode===`sign-in`)return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{className:a,"aria-haspopup":`dialog`,onClick:()=>c(!0),children:[(0,Z.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),p]}),(0,Z.jsx)(y,{as:`dialog`,prompt:o.prompt,open:s,onClose:()=>c(!1)})]});let m=e=>{u(!1),o.naming?f(e):o.saveNew(null)},h=d!==void 0&&o.naming&&(0,Z.jsx)(Pi,{title:d,chips:i,label:o.naming.label,required:o.naming.required,busy:o.creating,onSave:e=>o.saveNew(e,{onSuccess:()=>f(void 0)}),onClose:()=>f(void 0)}),g=o.opened;if(g){let n=Y(`saveAsNew`,{noun:o.noun});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{className:a,"aria-haspopup":`dialog`,"aria-disabled":!o.ready,onClick:()=>o.ready&&u(!0),children:[(0,Z.jsx)(_n,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`max-w-60 truncate`,children:Y(`updateName`,{name:g.name??o.noun})})]}),(0,Z.jsxs)(L,{className:a,"aria-haspopup":o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&m(n),children:[(0,Z.jsx)(pn,{className:`size-3.5`,"aria-hidden":!0}),n]}),l&&(0,Z.jsx)(ea,{model:e,view:t,title:g.name?Y(`updateNameQuestion`,{name:g.name}):Y(`updateNounQuestion`,{noun:o.noun}),before:g.filter,after:r,saveNewLabel:n,updating:o.updating,creating:o.creating,onUpdate:()=>o.update({onSuccess:()=>u(!1)}),onSaveNew:()=>m(n),onCancel:()=>u(!1)}),h]})}let _=o.saved?dn:oe;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{className:a,"aria-pressed":o.saved,"aria-haspopup":!o.saved&&o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&(o.saved?o.remove():m(p)),children:[(0,Z.jsx)(_,{className:o.saved?`size-3.5 text-primary`:`size-3.5`,"aria-hidden":!0}),p]}),h]})},aa=e=>e instanceof Error?e.message:Y(`somethingWrong`),oa=({model:e,view:t,name:n,value:r,onChange:i})=>{let a=(0,Q.useId)(),o=e.fields[n],s=t.fields[n],c=s?.label??B(n);if(o?.type===`boolean`)return(0,Z.jsx)(w,{checked:r===!0,onChange:i,label:c});if(o?.type!==`enum`)throw Error(`Not implemented: "${n}" is ${o?.type??`unknown`}, and a saved search's controls are enums or booleans`);return(0,Z.jsxs)(`label`,{htmlFor:a,className:`flex items-center gap-2 text-muted-foreground`,children:[c,(0,Z.jsx)(`select`,{id:a,value:String(r??``),onChange:e=>i(e.target.value),className:`h-8 rounded-md border border-border-strong bg-background px-2 text-foreground shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20`,children:(o.enumValues??[]).map(e=>(0,Z.jsx)(`option`,{value:e,children:Pe(e,s?.valueLabels)},e))})]})},sa=(e,t,n)=>Object.entries(n).map(([n,r])=>`${t.fields[n]?.label??B(n)}: ${e.fields[n]?.type===`boolean`?Y(r===!0?`on`:`off`):Pe(String(r),t.fields[n]?.valueLabels)}`).join(`, `),ca=({model:e,view:t,recordKey:n,title:r,row:i,fields:a})=>{let o=V(),s=qe(),c=Ke(),l=Qe({mutationFn:t=>o.update(e.name,n,t,i.etag??`*`),onSuccess:(n,i)=>s.show({state:`success`,title:Y(`saved`,{title:r}),description:sa(e,t,i)}),onError:e=>s.show({state:`error`,title:Y(`couldNotChange`),description:aa(e)}),onSettled:()=>c(e.name)});return(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:a.map(n=>(0,Z.jsx)(oa,{model:e,view:t,name:n,value:l.isPending&&n in(l.variables??{})?l.variables[n]:i[n],onChange:e=>l.mutate({[n]:e})},n))})},la=e=>e instanceof Error?e.message:Y(`somethingWrong`),ua=({model:e,view:t,of:n,target:r,targetView:i,row:a,recordKey:o,canRename:s,onDelete:c})=>{let l=V(),u=qe(),d=Ke(),[f,p]=(0,Q.useState)(!1),{name:m,chips:h,title:g,body:_}=Ut({model:e,of:n,target:r,targetView:i,row:a,recordKey:o}),v=Qe({mutationFn:t=>l.update(e.name,o,{[n.name]:t},a.etag??`*`),onSuccess:()=>p(!1),onError:e=>u.show({state:`error`,title:Y(`couldNotRename`),description:la(e)}),onSettled:()=>d(e.name)}),y=n.name===void 0?void 0:e.fields[n.name];return(0,Z.jsxs)(`section`,{"aria-label":g,className:`flex flex-col gap-3 rounded-lg border bg-surface p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,Z.jsx)(ce,{to:{kind:`record`,resource:e.name,key:o},className:`hover:underline`,children:m??(0,Z.jsx)(Ct,{chips:h})})})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.controls&&(0,Z.jsx)(ca,{model:e,view:t,recordKey:o,title:g,row:a,fields:n.controls}),s&&y&&(0,Z.jsx)(L,{variant:`ghost`,"aria-label":Y(`renameTitle`,{title:g}),"aria-haspopup":`dialog`,onClick:()=>p(!0),children:(0,Z.jsx)(Gt,{className:`size-3.5`,"aria-hidden":!0})}),c&&(0,Z.jsx)(L,{variant:`ghost`,"aria-label":Y(`deleteTitle`,{title:g}),onClick:()=>c(g),children:(0,Z.jsx)(Xt,{className:`size-3.5`,"aria-hidden":!0})})]})]}),f&&y&&(0,Z.jsx)(Pi,{title:Y(`renameTitle`,{title:g}),chips:h,label:t.fields[y.name]?.label??B(y.name),required:!y.nullable,initial:m,busy:v.isPending,onSave:e=>v.mutate(e),onClose:()=>p(!1)}),(0,Z.jsx)(Ht,{..._})]})},da=({model:e,view:t})=>{let{resources:n,views:r}=Ie(),i=t.searchesOf,a=n[i.resource],o=r[i.resource],s=Tt(e.name,!0),l=pe(e.name),u=Kt({model:e,view:t}),d=t.names?.plural??B(e.name),f=e=>(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[u.dialogs,(0,Z.jsx)(Zt,{title:d,subtitle:t.help}),e]});if(!a)return f((0,Z.jsx)(W,{title:Y(`notFound`),children:Y.rich(`noResource`,{resource:i.resource})}));if(s.error)return f((0,Z.jsx)(Ve,{title:Y(`couldNotLoadYour`,{plural:d.toLowerCase()}),error:s.error}));if(!s.data)return f((0,Z.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:2},(e,t)=>(0,Z.jsx)(z,{className:`h-56`},t))}));if(s.data.length===0){let e=(o?.names?.plural??B(a.name)).toLowerCase();return f((0,Z.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:Y.rich(`noSavedYet`,{plural:d.toLowerCase(),list:(0,Z.jsx)(ce,{to:{kind:`list`,resource:a.name},className:`font-medium text-primary-text hover:underline`,children:e})})}))}return f((0,Z.jsx)(`div`,{className:`flex flex-col gap-4`,children:s.data.map(n=>{let r=Be(c(e,n)),s=R(l,`delete`)?e=>void u.start({key:r,title:e,etag:n.etag,snapshot:n}):void 0;return(0,Z.jsx)(ua,{model:e,view:t,of:i,target:a,targetView:o,row:n,recordKey:r,canRename:R(l,`update`),onDelete:s},r)})}))},fa=({field:e,hints:t,resource:n,stored:r,onSave:i,close:o})=>{let[s,c]=(0,Q.useState)(()=>D(e,r)),l=(0,Q.useRef)(null),u=(0,Q.useRef)(!1),d=!t?.widget&&(e.type===`boolean`||e.type===`enum`);(0,Q.useEffect)(()=>{l.current?.querySelector(`input, select, textarea, button, [tabindex]`)?.focus()},[]);let f=(t,n,c=s)=>{u.current||(u.current=!0,t&&a(e,c,r)&&i(we(e,c)),o(n))};return(0,Z.jsx)(`div`,{ref:l,className:`w-full min-w-0`,onKeyDown:e=>{ne(e.target)||(e.key===`Enter`?(e.preventDefault(),f(!0)):e.key===`Tab`?(e.preventDefault(),f(!0,e.shiftKey?-1:1)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f(!1)))},onBlur:e=>{!l.current?.contains(e.relatedTarget)&&!ne(e.relatedTarget)&&f(!0)},children:(0,Z.jsx)(fe,{field:e,hints:t,value:s,stored:r,resource:n,onChange:e=>{c(e),d&&f(!0,void 0,e)}})})},pa=H(`app/list-edit`),ma=e=>{let t=V(),n=Ze(),r=qe(),[i,a]=(0,Q.useState)(new Map),o=(0,Q.useRef)(i),s=(0,Q.useRef)(new Map),l=(e,t)=>{o.current=new Map(o.current).set(e,{...o.current.get(e),...t}),a(o.current)},u=async(i,a,s)=>{let u=c(e,i),d=String(o.current.get(i.id)?.etag??i.etag);try{let r=await t.update(e.name,u,{[a]:s},d);l(i.id,{[a]:r.record[a],etag:r.etag}),n.setQueryData(q.record(e.name,Be(u)),r),n.invalidateQueries({queryKey:[`page`,e.name]}),n.invalidateQueries({queryKey:[`list`,e.name]}),n.invalidateQueries({queryKey:[`map`,e.name]}),n.invalidateQueries({queryKey:[`count`,e.name]})}catch(n){if(!N(n))throw l(i.id,{[a]:i[a]}),n;let o=n.status===412,s=o?await t.get(e.name,u):void 0;l(i.id,s?{[a]:s.record[a],etag:s.etag}:{[a]:i[a]});let c=n.errors.find(e=>e.field===a)?.message??n.message;r.show({state:`error`,title:pa(o?`changedBySomeoneElse`:`couldNotSave`),description:c})}};return{patches:i,save:(e,t,n)=>{l(e.id,{[t]:n});let r=(s.current.get(e.id)??Promise.resolve()).then(()=>u(e,t,n));return s.current.set(e.id,r.catch(()=>void 0)),r}}},ha=(e,t,n)=>{let r=ma(e),i=t?.list?.editable??[];return{editor:i.length>0&&R(n,`update`)?{editable:(t,n)=>i.includes(n)&&e.fields[n]!==void 0&&ie(e.fields[n])&&Se(t,`update`),render:(n,i,a)=>(0,Z.jsx)(fa,{field:e.fields[i],hints:t?.fields[i],resource:e.name,stored:n[i],onSave:e=>void r.save(n,i,e),close:a})}:void 0,patches:r.patches}},ga=k(),_a=e=>e.find(e=>e.kind===`search`),va=({address:e})=>{let{resources:t,views:n,signIn:r}=Ie(),i=t[e.resource],a=r?.[e.resource];if(!i)return a?(0,Z.jsx)(y,{as:`page`,prompt:a.signIn}):(0,Z.jsx)(W,{title:je(`notFound`),children:je(`noResource`,{name:e.resource})});let o=l(n[e.resource],e.list);if(e.list!==void 0&&!o)return(0,Z.jsx)(W,{title:je(`notFound`),children:X(`noList`,{name:e.list})});if(o?.searchesOf)return(0,Z.jsx)(da,{model:i,view:o});let s=p(t,n,e.resource,e.list);if(o&&s.listOf){let t=s.model;return(0,Z.jsx)(Ni,{model:i,view:o,target:t,children:n=>(0,Z.jsx)(ya,{model:t,address:e,scope:n,heading:{title:o.names?.plural??B(i.name),subtitle:o.help}})})}return(0,Z.jsx)(ya,{model:i,address:e})},ya=({model:e,address:t,scope:n,heading:r})=>{let i=Ie(),{set:a,listTo:u,go:d,href:p}=g(),v=e.name,y=l(i.views[v],t.list),b=(0,Q.useMemo)(()=>st(y,e),[y,e]),{fields:x}=_(),S=(0,Q.useMemo)(()=>Mi(Ee(ee(ze(e,y),e,y,x),e,i.resources,i.views),e,y,i.resources,i.views),[e,y,x,i.resources,i.views]),C=t.filter,w=(0,Q.useMemo)(()=>ft(b,C),[b,C]),T=w.ok?w.state:Wt,D=w.ok?w.extras:[],{orderBy:O,filterLayout:k}=t,A=le(),ne=f(),[re,ie]=(0,Q.useState)(!1),ae=n?[...D,n]:D,oe=m(),se=Mr({model:e,resources:i.resources,views:i.views,view:y,state:T,extras:ae,titleOf:oe}),j=n?ut(b,T,ae):w.ok?C:``,M=(0,Q.useMemo)(()=>Ae(e,y,S.map(e=>e.id)),[e,y,S]),de=(0,Q.useMemo)(()=>ot(y,i.resources,i.views,M),[y,i.resources,i.views,M]),N=$t({resources:i.resources,views:i.views,model:e,columns:M,filter:j,orderBy:O,related:de}),P=Fe(e,y,t.display),fe=pe(v),F=n?void 0:nn(e,fe),[me,ge]=(0,Q.useState)(!1),I=me&&F!==void 0,ve=!P&&!I&&tn(y,F,O,j),ye=I||P?.kind!==`map`;h(ye);let be=rn(e,N.page,N.key,P?.kind===`custom`),xe=Si(),Ce=_e(e,y),we=e=>({key:e.id,title:String(typeof e[Ce]==`object`?e[Ce].name:e[Ce]??e.id),etag:typeof e.etag==`string`?e.etag:void 0,snapshot:e}),Te=y?.names?.singular??B(v),De=ha(e,y,fe),{state:z}=Ge(),ke=Jt(e),V=Kt({model:e,view:y,restore:ke,onReview:e=>d({kind:`record`,resource:v,key:e.key})}),H=jt(e),je=y?.actions.some(e=>e.run?.kind===`delete`)??!1,U=(e,t=D)=>a({filter:ut(b,e,t)}),W=_a(D),Me=e=>{let t=D.filter(e=>e.kind!==`search`);U(T,e?[...t,ga.search(e)]:t)},G=y?.names?.plural??B(v),Pe=P?.kind===`calendar`||P?.kind===`timeline`||P?.kind===`board`&&he(e)?void 0:P,K=Pe&&(0,Z.jsx)(Et,{model:e,view:y,display:Pe,orderBy:O,onChange:e=>a({orderBy:e})}),q=e.search?.length?(0,Z.jsx)(ji,{value:W?.kind===`search`?W.text:``,onCommit:Me,placeholder:X(`searchPlural`,{plural:G}),className:A?void 0:`min-h-11`}):null,Re=(0,Z.jsx)(Yn,{layout:k,config:se,value:T,onChange:U,leading:k===`bar`?K:void 0,trailing:q}),Be=k===`bar`?Re:(0,Z.jsx)(qn,{groups:[K?[K]:[]],trailing:q}),Ke=vt(se,T),qe=(0,Z.jsx)(Dn,{scroll:!0,chips:Ke,onRemove:e=>U(lt(T,e)),onClear:()=>U(Wt)}),Je=Pe&&(0,Z.jsx)(Pn,{title:X(`sort`),children:(0,Z.jsx)(Et,{model:e,view:y,display:Pe,orderBy:O,onChange:e=>a({orderBy:e}),className:`min-h-11 w-full`})}),Ye=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(L,{className:`min-h-11`,onClick:()=>ie(!0),"aria-haspopup":`dialog`,children:[(0,Z.jsx)(yn,{className:`size-3.5`}),Ke.length>0?X(`filtersCount`,{count:Ke.length}):X(`filters`)]}),q??(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:qe})]}),q&&qe,(0,Z.jsx)(We,{title:X(`filters`),open:re,onClose:()=>ie(!1),children:(0,Z.jsx)(Yn,{layout:`panel`,fullWidth:!0,config:se,value:T,onChange:U,leading:Je})})]}),Xe=!n&&te(y,i.pages,fe)&&(0,Z.jsxs)(ce,{to:{kind:`create`,resource:v},className:Ne({variant:`primary`}),children:[(0,Z.jsx)(Ue,{className:`size-3.5`}),X(`newRecord`,{singular:Te})]}),Ze=y?.saveSearch&&!n&&w.ok&&C&&(0,Z.jsx)(ia,{model:e,view:y,search:y.saveSearch,filter:C,chips:pt(e,y,C,Mt(se))}),Qe=!n&&(0,Z.jsx)(Fr,{model:e}),$e=Yr({model:e,view:y,resources:i.resources,views:i.views,plural:G,filter:j,orderBy:O}),et=ar(y)&&(0,Z.jsxs)(L,{onClick:()=>$e.open(),...!A&&{"aria-label":X(`export`),title:X(`export`)},children:[(0,Z.jsx)(E,{className:`size-3.5`}),A&&X(`export`)]}),nt=F&&!ve&&(0,Z.jsx)(Yt,{sorting:I,onChange:ge,iconOnly:!A}),rt=t=>!I&&(0,Z.jsx)(zt,{view:y,choices:Le(e,y,ne),value:P?.name??`table`,onChange:e=>a({display:e}),menu:t}),it=en(e),at=t=>{it(ue(e,t).record),d({kind:`record`,resource:v,key:c(e,t)})},ct=async e=>{let t=e.map(we),n=await V.startBulk(t);return e.filter((e,r)=>n.includes(t[r]))},J=N.source?(0,Z.jsx)(_t,{columns:S,source:N.source,sort:o(O),onSortChange:e=>a({orderBy:He(e)}),onOpenRow:at,rowLink:t=>({href:p({kind:`record`,resource:v,key:c(e,t)}),onFollow:()=>at(t)}),cellEditor:De.editor,rowPatches:De.patches,initialScrollIndex:xe.initialIndex,onScrollIndex:xe.remember,rowActions:[{label:X(`openRecord`,{singular:Te}),onSelect:at},...H.rowActions,...R(fe,`delete`)&&!je?[{label:X(`delete`),destructive:!0,available:e=>Se(e,`delete`),onSelect:e=>void V.start(we(e))}]:[]],bulkActions:[...ar(y)&&dr(e)?[{label:e=>X(`exportCount`,{count:e}),onRun:e=>$e.open(e)}]:[],...H.bulkActions,...R(fe,`delete`)?[{label:e=>X(`deleteCount`,{count:e}),destructive:!0,onRun:e=>ct(e)}]:[]],rowNumbers:!1,pinKey:z.kind===`signed-in`?Dt(z.user.id,s(v,t.list)):void 0,scroll:`parent`,className:`flex-1`}):(0,Z.jsx)(`div`,{"aria-busy":!0,className:`flex-1 rounded-lg border bg-surface`}),dt={...N,initialIndex:xe.initialIndex,onScrollIndex:xe.remember},mt=Zr({plural:G,search:W?.kind===`search`?W.text:``,filtered:Ke.length>0,scoped:!!n||D.some(e=>e.kind!==`search`),canCreate:!!Xe}),ht=(0,Z.jsx)(Xr,{state:mt,onClearSearch:()=>Me(``),onClearFilters:()=>U(Wt),create:Xe}),gt=I?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:X(`dragToSort`)}),(0,Z.jsx)(qt,{model:e,view:y,field:F,filter:``,columns:Oe(e,y)})]}):ve?(0,Z.jsx)(qt,{model:e,view:y,field:F,filter:``,columns:Oe(e,y),sort:{value:o(O),onChange:e=>a({orderBy:He(e)})}}):P?P.kind===`cards`?(0,Z.jsx)(fi,{model:e,view:y,display:P,list:dt,empty:ht},N.key.join(` `)):P.kind===`map`?(0,Z.jsx)(At,{model:e,view:y,display:P,filter:j,orderBy:O,fields:M,at:t.map,onMove:e=>a({map:e}),flush:!0}):P.kind===`board`?(0,Z.jsx)(Ot,{model:e,view:y,display:P,fields:M,filter:j,orderBy:O}):P.kind===`calendar`?(0,Z.jsx)(It,{model:e,view:y,display:P,fields:M,filter:j,at:t.calendar,linkTo:e=>u({calendar:e})}):P.kind===`timeline`?(0,Z.jsx)(Pt,{model:e,view:y,display:P,fields:M,filter:j,at:t.timeline,linkTo:e=>u({timeline:e})}):(0,Z.jsx)(Bt,{display:P,list:be}):N.source?.total===0&&!N.error?ht:J;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[V.dialogs,$e.dialogs,H.prompt,(0,Z.jsx)(Zt,{title:r?.title??G,subtitle:r?r.subtitle:y?.help,subtitleBelow:!0,actions:(0,Z.jsxs)(Z.Fragment,{children:[rt(!A),nt,Ze,Qe,et,Xe]})}),!w.ok&&(0,Z.jsx)(Ve,{title:X(`unreadableFilter`),error:Error(w.errors.map(e=>e.message).join(`; `))}),N.error&&!P&&!I&&(0,Z.jsx)(Ve,{title:X(`couldNotLoadRows`),error:N.error}),y?.chart&&!I&&(tt(y.chart)?(0,Z.jsx)(Ai,{model:e,view:y,chart:y.chart,plural:G,filter:j}):(0,Z.jsx)(Oi,{resource:v,chart:y.chart,title:X(`created`,{plural:G}),filter:j})),!I&&(A?Be:Ye),A&&k===`panel`&&!I?(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,Z.jsx)(`div`,{className:ye?`sticky top-[calc(var(--pb-sticky-top,0px)+1rem)] flex max-h-[calc(100dvh-var(--pb-sticky-top,0px)-var(--pb-sticky-bottom,0px)-2rem)] shrink-0 self-start`:`flex shrink-0`,children:Re}),gt]}):gt]})};export{va as ListPage,xr as a,_r as c,mr as d,pr as f,ln as h,Sr as i,hr as l,Xn as m,wr as n,vr as o,ur as p,Cr as r,br as s,Er as t,gr as u};
|
|
4
|
-
//# debugId=
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/import-dialog-Dy5RD7HY.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-DWzw7ONt.js","assets/vendor-t7Q7QbPu.js","assets/app-DLkpxjgP.css","assets/sheet-source-CMNlJ58_.js","assets/import-table-dialog-BC6Am8UM.js","assets/export-dialog-C-_QPJoC.js","assets/embedded-list-CJcc42i8.js","assets/update-set-C1HTHv_S.js","assets/layout-grid-CKBISlXn.js","assets/lib-tanstack-react-table-uAPG3Sdi.js","assets/lib-tanstack-store-KbP08Dw1.js","assets/lib-tanstack-react-store-BKI8EKbh.js","assets/lib-use-sync-external-store-D4s7MiFL.js","assets/lib-tanstack-table-core-2MHQ7o_e.js","assets/record-preview-De0u_rur.js","assets/lib-dnd-kit-core-xi-7xL_N.js","assets/lib-dnd-kit-utilities-Bvr0fWXF.js","assets/lib-dnd-kit-accessibility-AUTLnqh4.js","assets/lib-dnd-kit-sortable-CNDSKqCD.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
(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{At as r,Bc as i,C as a,Ca as o,Da as s,Ea as c,El as l,Fi as u,Fr as d,Go as f,Gr as p,Hi as m,Ho as h,Hr as g,Ia as _,Ir as v,It as y,Ji as b,Jn as x,Kc as S,Ln as C,M as w,Mo as T,Nc as E,Nn as ee,O as D,Oa as te,Oo as O,Ql as k,Qn as A,S as ne,Sa as re,T as ie,To as ae,Uc as oe,Vc as se,Vi as j,Vr as ce,Wo as le,Xr as ue,Yn as M,Zn as de,Zs as N,_c as P,b as fe,bc as F,cs as pe,ct as me,di as he,dn as ge,eu as I,fc as L,fl as _e,gc as ve,ic as ye,il as be,iu as xe,ja as Se,jo as Ce,k as we,ka as R,ki as Te,kn as Ee,ko as De,lc as z,ll as Oe,mi as ke,ml as B,ms as V,ni as Ae,nl as H,oc as je,oo as U,os as W,ou as Me,pa as G,pc as Ne,pl as Pe,qc as K,si as Fe,ss as Ie,ti as Le,tl as q,ul as Re,vi as ze,vl as Be,vr as Ve,wa as He,wc as Ue,wo as We,ws as Ge,yn as Ke,za as qe,zi as Je}from"./app-DWzw7ONt.js";import{C as Ye,f as Xe,h as Ze,i as Qe,o as $e,s as et}from"./vendor-t7Q7QbPu.js";import{n as tt}from"./view-chart-ChBtewKd.js";import{$ as nt,A as rt,B as it,D as at,E as ot,F as st,G as ct,H as lt,I as ut,J,K as dt,L as ft,M as pt,N as mt,O as ht,P as gt,Q as _t,R as vt,T as yt,U as bt,V as xt,W as St,X as Ct,Y as wt,Z as Y,b as Tt,d as Et,et as Dt,f as Ot,ft as kt,h as At,i as jt,j as Mt,k as Nt,m as Pt,n as Ft,p as It,pt as Lt,q as Rt,u as zt,v as Bt,w as Vt,x as Ht,xt as X,y as Ut,z as Wt}from"./embedded-list-CJcc42i8.js";import{a as Gt,i as Kt,n as qt,r as Jt,t as Yt}from"./reorder-button-BSTpt6yN.js";import{t as Xt}from"./trash-CxYb_qm6.js";import{t as Zt}from"./page-header-Ddz2r5ic.js";import{i as Qt,r as $t,t as en}from"./record-preview-De0u_rur.js";import{c as tn,l as nn}from"./messages-BsxKhmlF.js";import{t as rn}from"./use-display-rows-DDKdi43c.js";var an=new Set(`all.analyse.analyze.and.any.array.as.asc.asymmetric.both.case.cast.check.collate.column.constraint.create.current_catalog.current_date.current_role.current_time.current_timestamp.current_user.default.deferrable.desc.distinct.do.else.end.except.false.fetch.for.foreign.from.grant.group.having.in.initially.intersect.into.lateral.leading.limit.localtime.localtimestamp.not.null.offset.on.only.or.order.placing.primary.references.returning.select.session_user.some.symmetric.system_user.table.then.to.trailing.true.union.unique.user.using.variadic.when.where.window.with`.split(`.`)),on=/^[a-z][a-z0-9_]*$/,sn=[`id`,`etag`,`organization_id`],cn=e=>on.test(e)&&new TextEncoder().encode(e).length<=63,ln=(e,t,n=63)=>{if(typeof e!=`string`||!cn(e)||new TextEncoder().encode(e).length>n)return`form`;if(an.has(e))return`reserved_word`;if(t===`field`&&sn.includes(e))return`reserved_field`},un={name:`bookmark-check`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}],[`path`,{d:`m9 10 2 2 4-4`,key:`1gnqz4`}]]};un.node;var dn=S(un),fn={name:`bookmark-plus`,size:24,node:[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M15 10H9`,key:`o6yqo3`}],[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};fn.node;var pn=S(fn),mn={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};mn.node;var hn=S(mn),gn={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};gn.node;var _n=S(gn),vn={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};vn.node;var yn=S(vn),bn=e=>e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``),xn=(e,t,n)=>(/^[a-z]/.test(e)?e:`${t}_${e}`).slice(0,n).replace(/_+$/,``),Sn=(e,t,n)=>{let r=e;for(let i=2;t.has(r)||an.has(r);i++){let t=`_${i}`;r=`${e.slice(0,n-t.length).replace(/_+$/,``)}${t}`}return r},Cn=e=>e<26?String.fromCharCode(97+e):Cn(Math.floor(e/26)-1)+Cn(e%26),wn=e=>{let t=new Set(sn);return e.map((e,n)=>{let r=bn(e),i=Sn(r===``?`column_${Cn(n)}`:xn(r,`column`,63),t,63);return t.add(i),i})},Tn=(e,t=[],n=63)=>{let r=bn(e.replace(/\.(csv|tsv|txt|xlsx|json)$/i,``));if(r!==``)return Sn(xn(r,`table`,n),new Set(t),n)},Z=e(n(),1),En=`inline-flex h-6 items-center gap-1 rounded-full border border-primary-border bg-primary-soft pl-2.5 pr-1.5 text-xs font-medium text-primary-text`,Dn=({chips:e,lockedLabels:t=[],onRemove:n,onClear:r,scroll:i})=>e.length===0&&t.length===0?null:(0,Z.jsxs)(`div`,{className:i?`flex flex-nowrap items-center gap-1.5 overflow-x-auto pb-1 [&>*]:shrink-0`:`flex flex-wrap items-center gap-1.5`,children:[t.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1.5 rounded-full border border-border-strong bg-muted px-2.5 text-xs font-medium text-foreground`,children:[(0,Z.jsx)(hn,{className:`size-3 text-muted-foreground`}),e]},e)),e.map(e=>(0,Z.jsxs)(`span`,{className:En,children:[e.label,(0,Z.jsx)(`button`,{type:`button`,"aria-label":J(`remove`,{label:e.label}),onClick:()=>n(e.key),className:`rounded-full p-0.5 hover:bg-primary-border/60`,children:(0,Z.jsx)(ve,{className:`size-3`})})]},e.key)),e.length>0&&(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`ml-1 text-xs font-medium text-muted-foreground hover:text-foreground`,children:J(`clearAll`)})]}),On=({value:e,presets:t=Rt,onChange:n})=>(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let r=dt(t);return(0,Z.jsx)(`button`,{type:`button`,disabled:!r,title:r?void 0:J(`unknownPreset`,{id:t}),onClick:()=>n(e===t?void 0:t),className:K(`h-7 rounded-md border px-2.5 text-body font-medium transition-colors`,!r&&`border-dashed text-danger-text`,e===t?`border-primary-border bg-primary-soft text-primary-text`:`border-border-strong bg-background text-muted-foreground hover:bg-muted`),children:r??J(`unsupported`,{id:t})},t)})}),kn=(e,t)=>e.onSearch?e.options:e.options.filter(e=>xt(e.label,t)),An=(e,t,n)=>t===0?-1:n===`ArrowDown`?e<0?0:(e+1)%t:e<0?t-1:(e-1+t)%t,Q=e(t(),1),jn=({config:e,selected:t,onToggle:n,inline:r=!1})=>{let i=(0,Q.useId)(),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(-1),p=r||c,m=kn(e,o),h=(0,Q.useRef)(e.onSearch);h.current=e.onSearch,(0,Q.useEffect)(()=>()=>h.current?.(``),[]);let g=t=>{s(t),f(-1),e.onSearch?.(t)};return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex min-h-8 cursor-text flex-wrap items-center gap-1 rounded-md border border-border-strong bg-background px-2 py-1 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20`,onClick:()=>a.current?.focus(),children:[(0,Z.jsx)(F,{className:`size-3.5 shrink-0 text-muted-foreground`}),t.map(t=>(0,Z.jsx)(C,{label:it(e,t),onRemove:()=>n(t)},t)),(0,Z.jsx)(`input`,{ref:a,autoFocus:r,role:`combobox`,"aria-label":e.label,"aria-expanded":p,"aria-controls":`${i}-options`,"aria-autocomplete":`list`,"aria-activedescendant":m[d]?`${i}-${d}`:void 0,placeholder:t.length>0?``:J(`searchIn`,{label:e.label}),className:`h-6 min-w-16 flex-1 bg-transparent text-foreground outline-none placeholder:text-faint-foreground`,value:o,onChange:e=>g(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),f(An(d,m.length,e.key));return}if(e.key===`Enter`&&m[d]){e.preventDefault(),n(m[d].value);return}if(e.key===`Backspace`&&o===``&&t.length>0){n(t[t.length-1]);return}e.key===`Escape`&&o!==``&&(e.stopPropagation(),g(``))},onFocus:()=>l(!0),onBlur:()=>{l(!1),f(-1),!r&&o!==``&&g(``)}})]}),p&&(0,Z.jsxs)(`ul`,{id:`${i}-options`,role:`listbox`,"aria-label":e.label,"aria-multiselectable":!0,className:K(`flex max-h-60 flex-col gap-px overflow-y-auto`,!r&&`rounded-md border bg-background p-1 shadow-sm`),children:[m.map((e,r)=>{let a=t.includes(e.value);return(0,Z.jsxs)(`li`,{id:`${i}-${r}`,role:`option`,"aria-selected":a,tabIndex:-1,className:K(`flex cursor-pointer items-center gap-2 rounded px-1.5 py-1 hover:bg-muted`,r===d&&`bg-muted`),onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.value),children:[(0,Z.jsx)(`span`,{className:K(`inline-flex size-4 shrink-0 items-center justify-center rounded border`,a?`border-primary bg-primary text-primary-foreground`:`border-border-strong bg-background`),children:a&&(0,Z.jsx)(se,{className:`size-3`,strokeWidth:3})}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,Z.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:u(e.count)})]},e.value)}),e.failed&&(0,Z.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-danger-text`,children:J(`couldNotLoadCounts`)}),!e.failed&&m.length===0&&(0,Z.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-faint-foreground`,children:J(`noMatches`)})]})]})},Mn=({config:e,selected:t,onToggle:n})=>{let[r,i]=(0,Q.useState)(``),a=e.options.filter(e=>xt(e.label,r));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.searchable&&(0,Z.jsx)(T,{wrapperClassName:`mb-1 h-7`,leading:(0,Z.jsx)(F,{className:`size-3.5`}),placeholder:J(`searchIn`,{label:e.label}),value:r,onChange:e=>i(e.target.value)}),a.map(e=>(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-1 py-1 hover:bg-muted`,children:[(0,Z.jsx)(U,{checked:t.includes(e.value),onChange:()=>n(e.value),label:e.label}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,Z.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:u(e.count)})]},e.value)),e.failed&&(0,Z.jsx)(`span`,{className:`px-1 py-1 text-xs text-danger-text`,children:J(`couldNotLoadCounts`)}),!e.failed&&a.length===0&&(0,Z.jsx)(`span`,{className:`px-1 py-1 text-xs text-faint-foreground`,children:J(`noMatches`)})]})},Nn=({label:e,activeCount:t,width:n=240,defaultOpen:r=!1,children:a})=>{let[o,s]=(0,Q.useState)(r),[c,l]=(0,Q.useState)({width:n}),u=(0,Q.useRef)(null),d=(0,Q.useRef)(null);(0,Q.useLayoutEffect)(()=>{if(!o||!u.current)return;let e=u.current.getBoundingClientRect(),t=document.documentElement.clientWidth,r=Math.min(n,O(t));l({width:r,right:e.left+r>t?e.right-De(e.right,r,t):void 0})},[o,n]);let f=Ce(o,u,d,c);return(0,Q.useEffect)(()=>{if(!o)return;let e=e=>{e.target instanceof Node&&!u.current?.contains(e.target)&&s(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[o]),(0,Z.jsxs)(`div`,{ref:u,className:`relative`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:()=>s(!o),className:K(`inline-flex h-8 items-center gap-1.5 rounded-md border bg-background px-2.5 font-medium shadow-sm transition-colors hover:bg-muted`,t>0?`border-primary-border text-primary-text`:`border-border-strong text-foreground`),children:[e,t>0&&(0,Z.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,Z.jsx)(i,{className:`size-3.5 text-muted-foreground`})]}),o&&(0,Z.jsx)(`div`,{ref:d,className:K(`absolute top-full z-30 mt-1.5 rounded-lg border bg-background p-3 shadow-pop`,c.right===void 0&&`left-0`),style:{...c,...f},children:typeof a==`function`?a(()=>s(!1)):a})]})},Pn=({title:e,children:t})=>(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2 border-b py-3 last:border-b-0`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),t]}),Fn=({items:e,onPick:t,close:n})=>{let i=(0,Q.useRef)([]);return(0,Q.useEffect)(()=>i.current[0]?.focus(),[]),(0,Z.jsx)(`ul`,{role:`menu`,"aria-label":J(`moreFilters`),onKeyDown:t=>{if(t.key===`Escape`)return n();let a=r(t.key,i.current.indexOf(document.activeElement),e.length);a!==void 0&&(t.preventDefault(),i.current[a]?.focus())},className:`-mx-3 -my-3`,children:e.map((e,r)=>(0,Z.jsx)(`li`,{role:`none`,children:(0,Z.jsx)(`button`,{ref:e=>{i.current[r]=e},type:`button`,role:`menuitem`,className:me,onClick:()=>{n(),t(e.key)},children:e.label})},e.key))})},In=({items:e,onPick:t})=>e.length===0?null:(0,Z.jsx)(Nn,{label:J(`moreFilters`),activeCount:0,children:n=>(0,Z.jsx)(Fn,{items:e,onPick:t,close:n})}),Ln=(e,t,n,r,i)=>{let a=n+(r-n)*e/t;return n+(r-n)*(e+1)/t>i[0]&&a<i[1]},Rn=(e,t,n)=>n===t?0:(e-t)/(n-t),zn=(e,t,n)=>t===0?[Math.min(n,e[1]),e[1]]:[e[0],Math.max(n,e[0])],Bn=1e3,Vn=({config:e,value:t,onChange:n})=>{let{min:r,max:i,step:a,histogram:o,format:s}=e,[c,l]=(0,Q.useState)(),u=c??t??[r,i],d=Math.max(...o),f=()=>{c&&(l(void 0),n(c[0]===r&&c[1]===i?void 0:c))},p=j(c,Bn);return(0,Q.useEffect)(()=>{p&&f()},[p]),e.failed?(0,Z.jsx)(`p`,{className:`text-xs text-danger-text`,children:J(`couldNotLoadCounts`)}):(0,Z.jsxs)(`div`,{className:`w-full`,children:[(0,Z.jsxs)(`div`,{className:`px-[7px]`,children:[o.length>0&&(0,Z.jsx)(`div`,{className:`mb-1 flex h-12 items-end gap-0.5`,children:o.map((e,t)=>(0,Z.jsx)(`span`,{className:K(`flex-1 rounded-t-sm`,Ln(t,o.length,r,i,u)?`bg-primary/70`:`bg-border`),style:{height:`${Math.max(6,e/d*100)}%`}},t))}),(0,Z.jsxs)(`div`,{className:`relative h-4`,children:[(0,Z.jsx)(`span`,{className:`absolute inset-x-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-border`}),(0,Z.jsx)(`span`,{className:`absolute top-1/2 h-1 -translate-y-1/2 rounded-full bg-primary`,style:{left:`${Rn(u[0],r,i)*100}%`,right:`${100-Rn(u[1],r,i)*100}%`}})]})]}),(0,Z.jsx)(`div`,{className:`relative -mt-4 h-4`,children:[0,1].map(t=>(0,Z.jsx)(`input`,{type:`range`,className:`pb-range`,"aria-label":J(t===0?`minimum`:`maximum`,{label:e.label}),min:r,max:i,step:a,value:u[t],onChange:e=>l(zn(u,t,Number(e.target.value))),onPointerUp:f,onTouchEnd:f,onBlur:f},t))}),(0,Z.jsxs)(`div`,{className:`mt-2 flex justify-between text-xs tabular-nums text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:s(u[0])}),(0,Z.jsx)(`span`,{children:s(u[1])})]})]})},Hn=e=>[...new Set(e.map(e=>e.key.split(`:`).slice(0,2).join(`:`)))],Un=(e,t)=>{let n=t.filter(t=>!e.includes(t));return n.length===0?e:[...e,...n]},Wn=(e,t)=>{let n=[...e.facets.map(e=>({key:`facet:${e.id}`,label:e.label,secondary:e.secondary})),...(e.ranges??[]).map(e=>({key:`range:${e.id}`,label:e.label,secondary:e.secondary})),...e.datePresets?[{key:`date`,label:J(`date`),secondary:e.dateSecondary}]:[],...(e.toggles??[]).map(e=>({key:`toggle:${e.id}`,label:e.label,secondary:e.secondary}))],r=new Set,i=[];for(let e of n)!e.secondary||t.includes(e.key)?r.add(e.key):i.push({key:e.key,label:e.label});return{shown:r,more:i}},Gn=({label:e,checked:t,onChange:n})=>(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-between gap-3 py-1`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(w,{checked:t,onChange:n,label:e})]}),Kn=(e,t)=>e.some(e=>e.length>0)||!!t,qn=({groups:e,trailing:t})=>{if(!Kn(e,t))return null;let n=e.filter(e=>e.length>0);return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.map((e,t)=>(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),e]},t)),t&&(0,Z.jsx)(`div`,{className:`flex min-w-32 flex-1 justify-end`,children:t})]})},Jn=(e,t,n)=>{let[r,i]=(0,Q.useState)(t??Wt);return[e??r,e=>{i(e),n?.(e)}]},Yn=({config:e,layout:t,value:n,defaultValue:r,onChange:i,lockedLabels:a,defaultOpenMenu:o,fullWidth:s,leading:c,trailing:l})=>{let[u,d]=Jn(n,r,i),f=vt(e,u),p=Hn(f),[m,h]=(0,Q.useState)(()=>p),[g,_]=(0,Q.useState)();(0,Q.useEffect)(()=>h(e=>Un(e,p)),[p.join(`,`)]);let v=(0,Z.jsx)(Dn,{chips:f,lockedLabels:a,onRemove:e=>d(lt(u,e)),onClear:()=>d(Wt)}),y=(e,t=!1)=>{let n=u.facets[e.id]??[],r=t=>d(St(u,e.id,t));return e.combobox?(0,Z.jsx)(jn,{config:e,selected:n,onToggle:r,inline:t}):(0,Z.jsx)(Mn,{config:e,selected:n,onToggle:r})},b=e.ranges??[],x=e=>(0,Z.jsx)(Vn,{config:e,value:u.ranges?.[e.id],onChange:t=>d(bt(u,e.id,t))}),S=e.datePresets&&(0,Z.jsx)(On,{value:u.date,presets:Array.isArray(e.datePresets)?e.datePresets:void 0,onChange:e=>d({...u,date:e})}),C=(e.toggles??[]).map(e=>(0,Z.jsx)(Gn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(ct(u,e.id))},e.id));if(t===`panel`)return(0,Z.jsxs)(`aside`,{className:s?`flex w-full flex-col gap-1`:`flex w-64 shrink-0 flex-col gap-1 overflow-y-auto rounded-lg border bg-background px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-between pb-1`,children:(0,Z.jsx)(`h2`,{className:`font-semibold`,children:J(`filters`)})}),(f.length>0||(a?.length??0)>0)&&(0,Z.jsx)(`div`,{className:`border-b pb-3`,children:v}),c,e.facets.map(e=>(0,Z.jsx)(Pn,{title:e.label,children:y(e)},e.id)),b.map(e=>(0,Z.jsx)(Pn,{title:e.label,children:x(e)},e.id)),S&&(0,Z.jsx)(Pn,{title:J(`date`),children:S}),C.length>0&&(0,Z.jsx)(Pn,{title:J(`showOnly`),children:C})]});let{shown:w,more:T}=Wn(e,m),E=e=>{h(t=>Un(t,[e])),_(e)},ee=[...e.facets.filter(e=>w.has(`facet:${e.id}`)).map(e=>(0,Z.jsx)(Nn,{label:e.label,activeCount:(u.facets[e.id]??[]).length,width:e.combobox?280:void 0,defaultOpen:o===e.id||g===`facet:${e.id}`,children:y(e,!0)},e.id)),...b.filter(e=>w.has(`range:${e.id}`)).map(e=>(0,Z.jsx)(Nn,{label:e.label,activeCount:+!!u.ranges?.[e.id],width:280,defaultOpen:o===e.id||g===`range:${e.id}`,children:x(e)},`range:${e.id}`)),...S&&w.has(`date`)?[(0,Z.jsx)(Q.Fragment,{children:S},`date`)]:[]],D=(e.toggles??[]).filter(e=>w.has(`toggle:${e.id}`)).map(e=>(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:(0,Z.jsx)(Gn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(ct(u,e.id))})},e.id)),te=[c?[(0,Z.jsx)(Q.Fragment,{children:c},`leading`)]:[],ee,D,T.length>0?[(0,Z.jsx)(In,{items:T,onPick:E},`more`)]:[]];return!Kn(te,l)&&f.length===0&&!a?.length?null:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(qn,{groups:te,trailing:l}),v]})},Xn=H(`app/export`),Zn=()=>new DOMException(Xn(`cancelled`),`AbortError`),Qn=async({client:e,resource:t,filters:n,orderBy:r,plan:i,labels:a,limit:o,port:s,sink:c,signal:l,onProgress:u})=>{let d=i.columns.map(e=>e.name),f=0;try{await c.write(await s.send({kind:`start`,plan:i,locale:be()}));for(let[i,p]of n.entries()){let m=``;do{let h=await e.search(t,{filter:p,orderBy:r,pageSize:500,pageToken:m,fields:d,labels:a});if(l.aborted)throw Zn();let g=h.items.slice(0,o-f);if(await c.write(await s.send({kind:`page`,records:g,labels:h.labels??{}})),f+=g.length,u(f),m=h.nextPageToken,f>=o)return await $n(s,c),{rows:f,truncated:g.length<h.items.length||m!==``||i+1<n.length}}while(m!==``)}return await $n(s,c),{rows:f,truncated:!1}}catch(e){throw await c.abort(),e}finally{s.close()}},$n=async(e,t)=>{await t.write(await e.send({kind:`finish`})),await t.close()},er=1048575,tr=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3
|
+
`,nr=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,rr=`http://schemas.openxmlformats.org/package/2006/relationships`;`${tr}`,`${tr}${rr}${nr}`,`${tr}${rr}${nr}${nr}`,new TextEncoder;var ir=k(),ar=e=>e?.export!==!1,or=e=>Object.values(e.fields).flatMap(e=>e.sensitive?[]:[e.name]),sr=(e,t)=>{let n=new Set(or(e));return Oe(e,t).filter(e=>n.has(e))},cr=(e,t,n)=>Object.fromEntries(ze(e,t,[],n).map(e=>[e.id,e.header])),lr=(e,t,n)=>{let r=cr(e,t,n);return n.flatMap(n=>{let i=e.fields[n];return i?[{name:n,header:r[n],field:i,hints:t?.fields[n]??{}}]:[]})},ur=(e,t)=>{let n=e?.export?e.export.maxRows??1/0:1/0;return Math.min(n,t===`xlsx`?er:1/0)},dr=e=>e.primaryKey.length===1,fr=(e,t)=>{let[n]=e.primaryKey;if(!n||e.primaryKey.length!==1)throw Error(`Not implemented: selected rows are exported by a single-field key`);let r=[];for(let e=0;e<t.length;e+=500)r.push(I(ir.in(n,t.slice(e,e+500))));return r},pr=e=>{if(e.kind!==`counting`)return e.kind===`exact`?e.rows:Math.max(e.rows,10001)},mr=H(`app/import`),hr=e=>typeof e==`object`&&!!e&&`date`in e,gr=e=>typeof e==`object`&&!!e&&`json`in e,_r=e=>e===null||typeof e==`string`&&e.trim()===``,vr=e=>e===null?``:hr(e)?e.date.replace(`T`,` `):gr(e)?JSON.stringify(e.json):typeof e==`boolean`?e?`TRUE`:`FALSE`:String(e),yr=e=>e<26?String.fromCharCode(65+e):yr(Math.floor(e/26)-1)+yr(e%26),br=(e,t)=>e[t]?.trim()?e[t]:mr(`column`,{letters:yr(t)}),xr=(e,t,n,r)=>{let i=wn(t.headers),a=t.headers.map((e,n)=>({column:n,include:!0,name:i[n],label:br(t.headers,n).trim(),type:t.types[n].type,inferred:t.types[n],decimal:t.decimals[n]}));return{name:Tn(e,n,r)??``,pluralLabel:e.replace(/\.[^.]+$/,``).trim(),singularLabel:``,titleField:a.find(e=>e.type===`text`)?.name,fields:a}},Sr=e=>e.fields.filter(e=>e.include),Cr=(e,t,n)=>{let r=e.fields.find(e=>e.column===t),i=e.fields.map(e=>e.column===t?{...e,...n}:e),a=i.find(e=>e.column===t),o=r?.name===e.titleField,s=a.include&&a.type===`text`;return o?{...e,fields:i,titleField:s?a.name:void 0}:{...e,fields:i}},wr=`user_table_fields`,Tr=`table`,Er=(e,t)=>{let n=Sr(t).map((e,t)=>({op:`create`,resource:wr,data:{table_id:{$ref:Tr},name:e.name,label:e.label.trim(),type:e.type,position:t+1,...e.type===`decimal`&&{precision:e.decimal.precision,scale:e.decimal.scale}}})),r=t.titleField?[{op:`update`,resource:e,key:{$ref:Tr},etag:`*`,data:{title_field:t.titleField}}]:[];return[{op:`create`,resource:e,ref:Tr,data:{name:t.name,singular_label:t.singularLabel.trim(),plural_label:t.pluralLabel.trim()}},...n,...r]},Dr=(e,t)=>{let n=new Map(t.map(e=>[e.value,e.count]));return e.map(([e,t])=>({value:e,label:t,...n.get(e)!==void 0&&{count:n.get(e)}}))},Or=(e,t)=>[...new Set(t.filter(t=>!e.includes(t)))],kr=k(),Ar=(e,t,n)=>{let r=V(),[i,a]=(0,Q.useState)({}),o=e=>!!e?.search?.length&&e.primaryKey.length===1,s=e=>{let n=t[e.name];return[e.primaryKey[0],...n?.titleFrom?n.titleFrom.fields:[Re(e,n)]]},c=(e,r)=>{let i=t[e.name],a=String(r[e.primaryKey[0]]);return[a,i?.titleFrom?n(e,i,r,a):String(r[Re(e,i)])]},l=et({queries:e.map(({id:e,target:t})=>{let n=(i[e]??``).trim();return{queryKey:[`reference-search`,e,t?.name??``,n],enabled:o(t)&&n!==``,placeholderData:Xe,queryFn:async()=>(await r.list(t.name,{filter:I(kr.search(n)),fields:s(t),pageSize:20})).items}})});return e.map(({id:e,target:t},n)=>{if(!o(t))return{};let r=t=>a(n=>({...n,[e]:t}));return(i[e]??``).trim()===``?{onSearch:r}:{onSearch:r,matches:(l[n]?.data??[]).map(e=>c(t,e))}})},jr=24,Mr=({model:e,resources:t,views:n,view:r,state:i,extras:a,titleOf:o})=>{let s=V(),c=v(s),l=Ze(),u=st(r,e),d=e=>r?.fields[e]?.label??B(e),f=n=>{let r=e.fields[n];return r?.type===`relation`&&r.relation?t[r.relation.resource]:void 0},p=e=>!!(e&&n[e.name]?.titleFrom),m=u.facets.flatMap(e=>(e.flags?e.options.map(e=>e.value):[e.id]).map(t=>({group:e.id,field:t}))),h=et({queries:m.map(({group:t,field:r})=>{let o=ut(u,{...i,facets:{...i.facets,[t]:[]}},a),s=f(r),l=s?.primaryKey.length===1&&!p(s)?Re(s,n[s.name]):void 0;return{queryKey:q.facets(e.name,r,o),queryFn:()=>c.facets(e.name,r,{filter:o,limit:50,...l&&{label:l}})}})}),g=(e,t)=>h[m.findIndex(n=>n.group===e&&n.field===t)],_=(e,t)=>g(e,t)?.data,y=e=>(_(e,e)??[]).flatMap(e=>e.value===null?[]:[String(e.value)]),b=et({queries:u.facets.map(t=>{let r=f(t.id),a=Or(y(t.id),i.facets[t.id]??[]);return{queryKey:q.labels(`facet:${e.name}.${t.id}`,a.join(`,`)),enabled:!!r&&!p(r)&&a.length>0,queryFn:async()=>[...await de(l,s,r,a,n[r.name])]}})}),S=et({queries:u.facets.map(t=>{let r=f(t.id),a=r&&p(r)?x(r,n[r.name]):void 0,o=[...new Set([...y(t.id),...i.facets[t.id]??[]])];return{queryKey:q.labels(`facet-title:${e.name}.${t.id}`,o.join(`,`)),enabled:a!==void 0&&o.length>0,queryFn:async()=>[...await M(s,r,a,o)]}})}),C=(e,t)=>{let r=f(e);return(S[t]?.data??[]).map(([e,t])=>[e,o(r,n[r.name],t,e)])},w=Ar(u.facets.map(e=>({id:e.id,target:e.combobox?f(e.id):void 0})),n,o),T=u.ranges??[],E=et({queries:T.map(t=>{let n=ut(u,bt(i,t.id,void 0),a),o=gt(r,t.id)?jr:1;return{queryKey:q.histogram(e.name,t.id,o,n),queryFn:()=>c.histogram(e.name,t.id,{filter:n,buckets:o})}})});return{facets:u.facets.map((t,n)=>{if(t.flags){let e=e=>{let n=_(t.id,e);return n&&{count:n.find(e=>String(e.value)===`true`)?.count??0}},n=t.options.map(({value:t})=>({value:t,label:d(t),...e(t)})),r=t.options.some(({value:e})=>g(t.id,e)?.isError);return{...t,options:n,...r&&{failed:r}}}let i=e.fields[t.id],a=(_(t.id,t.id)??[]).flatMap(e=>e.label===void 0?[]:[[String(e.value),e.label]]),o=i?.type===`enum`?(i.enumValues??[]).map(e=>[e,Pe(e,r?.fields[t.id]?.valueLabels)]):[],s=new Map([...o,...a,...b[n]?.data??[],...C(t.id,n)]),c=(_(t.id,t.id)??[]).flatMap(e=>e.value===null?[]:[{value:String(e.value),label:s.get(String(e.value))??String(e.value),count:e.count}]),l=w[n],u=g(t.id,t.id)?.isError;return{...t,label:d(t.id),...u&&{failed:u},options:l.matches?Dr(l.matches,c):c,...s.size>0&&{labels:Object.fromEntries(s)},...l.onSearch&&{onSearch:l.onSearch}}}),ranges:T.flatMap((e,t)=>{let n=E[t];if(n?.isError)return[{...e,label:d(e.id),min:0,max:0,step:1,histogram:[],format:mt(r,e.id),failed:!0}];let i=n?.data;return!i||i.min===null||i.max===null?[]:[{...e,label:d(e.id),min:Math.floor(i.min),max:Math.ceil(i.max),step:Math.max(1,Math.round((i.max-i.min)/100)),histogram:gt(r,e.id)?i.buckets.map(e=>e.count):[],format:mt(r,e.id)}]}),...u.dateField&&{datePresets:u.datePresets??!0,dateField:u.dateField,dateKind:u.dateKind,...u.dateSecondary&&{dateSecondary:!0}},toggles:u.toggles?.map(e=>({...e,label:d(e.id)}))}},Nr=Je(()=>Ye(()=>import(`./import-dialog-Dy5RD7HY.js`).then(e=>e.ImportDialog),__vite__mapDeps([0,1,2,3,4,5,6]))),Pr=Je(()=>Ye(()=>import(`./import-table-dialog-BC6Am8UM.js`).then(e=>e.ImportTableDialog),__vite__mapDeps([7,1,2,3,4,5,6]))),Fr=({model:e})=>{let{resources:t,views:n}=Ie(),r=pe(e.name),i=pe(wr),[a,o]=(0,Q.useState)(!1),s=n[e.name]?.import;return s===!1||!R(r,`create`)||s===`table`&&!R(i,`create`)?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{onClick:()=>o(!0),"aria-haspopup":`dialog`,children:[(0,Z.jsx)(P,{className:`size-3.5`}),mr(s===`table`?`fromFile`:`import`)]}),a&&s===`table`&&(0,Z.jsx)(Pr,{tables:e,resources:t,views:n,onClose:()=>o(!1)}),a&&s!==`table`&&(0,Z.jsx)(Nr,{model:e,resources:t,views:n,canUpdate:R(r,`update`),onClose:()=>o(!1)})]})},Ir=()=>{let e=new Worker(new URL(`/assets/export-worker-S5xPFD_M.js`,``+import.meta.url),{type:`module`,name:`protobase-export`}),t=[];return e.onmessage=e=>t.shift()?.resolve(e.data.bytes),e.onerror=e=>{e.preventDefault();let n=Error(Xn(`couldNotBuild`,{message:e.message}));for(let e of t.splice(0))e.reject(n)},{send:n=>new Promise((r,i)=>{t.push({resolve:r,reject:i}),e.postMessage(n)}),close:()=>e.terminate()}},Lr={xlsx:{mime:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,extension:`.xlsx`,description:`workbook`},csv:{mime:`text/csv`,extension:`.csv`,description:`csvFile`}},Rr=/[\\/:*?"<>|\u0000-\u001f]/g,zr=(e,t,n=new Date)=>{let r=[n.getFullYear(),String(n.getMonth()+1).padStart(2,`0`),String(n.getDate()).padStart(2,`0`)].join(`-`);return`${e.replace(Rr,` `).trim()} ${r}${Lr[t].extension}`},Br=8e6,Vr=(e,t)=>{let n=new Blob([],{type:Lr[t].mime}),r=[],i=0,a=()=>{n=new Blob([n,...r],{type:Lr[t].mime}),r=[],i=0};return{write:async e=>{e.length!==0&&(r.push(e),i+=e.length,i>=Br&&a())},close:async()=>{a();let t=URL.createObjectURL(n),r=document.createElement(`a`);r.href=t,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(t),6e4)},abort:async()=>{r=[],n=new Blob([])}}},Hr=()=>globalThis.showSaveFilePicker,Ur=()=>typeof Hr()==`function`,Wr=async(e,t)=>{let n=Hr();if(!n)throw Error(`This browser cannot save a file as it is built`);let r=Lr[t],i;try{i=await n({suggestedName:e,types:[{description:Xn(r.description),accept:{[r.mime]:[r.extension]}}]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;throw e}let a=await i.createWritable();return{write:async e=>{e.length>0&&await a.write(e)},close:()=>a.close(),abort:()=>a.abort()}},Gr=Je(()=>Ye(()=>import(`./export-dialog-C-_QPJoC.js`).then(e=>e.ExportDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),Kr=Je(()=>Ye(()=>import(`./export-dialog-C-_QPJoC.js`).then(e=>e.ExportProgressDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),qr=(e,t)=>Ur()?Wr(e,t):Promise.resolve(Vr(e,t)),Jr=(e,t)=>{let n=t[e.primaryKey[0]];return typeof n==`object`&&n&&`id`in n?n.id:n},Yr=({model:e,view:t,resources:n,views:r,plural:i,filter:a,orderBy:o,createPort:s=Ir,createSink:c=qr})=>{let l=V(),d=qe(),[f,p]=(0,Q.useState)({kind:`closed`}),m=(0,Q.useRef)(void 0),h=(0,Q.useRef)(void 0),g=$e({queryKey:q.exportCount(e.name,a),enabled:f.kind===`settings`,queryFn:async()=>{let t=await l.list(e.name,{filter:a||void 0,pageSize:1,count:`exact`,fields:e.primaryKey});return t.totalSize===void 0?{kind:`estimate`,rows:t.totalSizeEstimate}:{kind:`exact`,rows:t.totalSize}}}).data??{kind:`counting`},_=(e,t=h.current)=>{let n=h.current;n&&n===t&&(h.current=void 0,n.settle(e?[]:n.rows))},v=(t=[])=>(_(!1),p({kind:`settings`,selected:dr(e)?t.map(t=>Jr(e,t)):[]}),new Promise(e=>{h.current={rows:t,settle:e}})),y=()=>{p({kind:`closed`}),_(!1)},b=async(f,v)=>{let y=zr(i,f.format),b=await c(y,f.format);if(!b)return;let x=h.current,S=ur(t,f.format),C=f.scope===`selected`?v.length:pr(g),w=C===void 0?void 0:Math.min(C,S),T=new AbortController;m.current=T,p({kind:`running`,done:0,total:w});try{let c=await Qn({client:l,resource:e.name,filters:f.scope===`selected`?fr(e,v):[a],orderBy:o,plan:{format:f.format,mode:f.mode,name:i,columns:lr(e,t,f.columns)},labels:f.mode===`shown`?A(n,r,e,f.columns):{},limit:S,port:s(),sink:b,signal:T.signal,onProgress:e=>T.signal.aborted||p({kind:`running`,done:e,total:w})});d.show({state:`success`,title:Xn(`exported`,{count:u(c.rows),plural:i}),description:c.truncated?Xn(`truncated`,{name:y,count:u(c.rows)}):y}),_(!0,x)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;if(!N(e))throw e;d.show({state:`error`,title:Xn(`couldNotExport`,{plural:i}),description:e.message})}finally{m.current=void 0,p(e=>e.kind===`running`?{kind:`closed`}:e),_(!1,x)}},x=()=>{m.current?.abort(),y()},S=or(e),C=cr(e,t,S);return{open:v,dialogs:f.kind===`settings`?(0,Z.jsx)(Gr,{plural:i,view:t,fields:S.map(e=>({name:e,label:C[e]})),initialColumns:sr(e,t),count:g,selected:f.selected.length>0?f.selected.length:void 0,open:!0,onExport:e=>void b(e,f.selected),onClose:y}):f.kind===`running`?(0,Z.jsx)(Kr,{plural:i,done:f.done,total:f.total,onCancel:x}):null}},Xr=({state:e,onClearSearch:t,onClearFilters:n,create:r})=>(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center text-muted-foreground`,children:[(0,Z.jsx)(`p`,{children:e.message}),(e.clearSearch||e.clearFilters||e.create&&r)&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[e.clearSearch&&(0,Z.jsx)(L,{onClick:t,children:X(`clearSearch`)}),e.clearFilters&&(0,Z.jsx)(L,{onClick:n,children:X(`clearFilters`)}),e.create&&r]})]}),Zr=({plural:e,search:t,filtered:n,scoped:r,canCreate:i})=>t?{message:X(`noMatchSearch`,{plural:e,search:t}),clearSearch:!0,clearFilters:n,create:!1}:n?{message:X(`noMatchFilters`,{plural:e}),clearSearch:!1,clearFilters:!0,create:!1}:r?{message:X(`noMatch`,{plural:e}),clearSearch:!1,clearFilters:!1,create:!1}:{message:X(`noneYet`,{plural:e}),clearSearch:!1,clearFilters:!1,create:i},Qr=(e,t)=>{},$r=({windowMs:e=1e3,comebacks:t=2,onHold:n=Qr}={})=>{let r,i=[],a;return(o,s)=>{if(a?.among.has(o))return a.value;if(a&&(a=void 0,i=[]),o===r||(r=o,i=i.filter(t=>s-t.at<=e),i.push({value:o,at:s,comeback:i.some(e=>e.value===o)}),i.filter(e=>e.comeback).length<t))return o;let c=new Set(i.slice(-2*t).map(e=>e.value));return a={value:Math.min(...c),among:c},n(a.value,[...c]),a.value}},ei=e=>Math.max(1,Math.floor((e+12)/252)),ti=(e,t)=>Math.max(0,(e-(t-1)*12)/t),ni=(e,t,n,r)=>({start:e*n,end:Math.max(0,Math.min(r,(t+1)*n)-1)}),ri=(e,t,n)=>{let r=e/t.rowHeight;return t.columns===n.columns?r*n.rowHeight:Math.floor(Math.floor(r)*t.columns/n.columns)*n.rowHeight},ii=(e,t)=>{let n=e/t.rowHeight;return Math.floor(n)*t.columns+n%1},ai=(e,t)=>Math.floor(Math.floor(e)/t)+e%1,oi=8,si=(e,t,n)=>{let r=e.get(t);if(r!==void 0&&r>=n)return e;let i=new Map(e);i.delete(t),i.set(t,n);for(let e of i.keys()){if(i.size<=oi)break;i.delete(e)}return i},ci=({source:e,label:t,initialIndex:n,onScrollIndex:r,minHeight:i,children:a})=>{let{total:o}=e,[s]=(0,Q.useState)(n),[c,l]=(0,Q.useState)(0),u=ei(c),d=ti(c,u),[f,p]=(0,Q.useState)(()=>new Map),m=Math.ceil(Math.max(i(d),f.get(d)??0)),h=m+12,g={columns:u,rowHeight:h},_=(0,Q.useRef)({layout:g,top:0}),v=_.current.top>0&&(_.current.layout.columns!==u||_.current.layout.rowHeight!==h),y=e=>v?ri(_.current.top,_.current.layout,g):e,b=d>0&&f.has(d),x=nt({total:Math.ceil(o/u),rowHeight:h,initialIndex:ai(s,u),settle:y,ready:b,onScroll:e=>r(ii(e,g))});(0,Q.useLayoutEffect)(()=>{v&&x.scrollTo(x.top),_.current={layout:g,top:x.started()?x.top:0}});let S=ni(x.first,x.last,u,o),C=Qt({total:o,rowAt:e.rowAt,loadRows:e.loadRows,cachedRows:e.cachedRows,revision:e.revision,latencyMs:0},S.start,S.end),[w]=(0,Q.useState)(()=>$r());(0,Q.useLayoutEffect)(()=>{let e=x.ref.current;if(!e)return;let t=()=>l(w(e.clientWidth,performance.now())),n=new ResizeObserver(t);return n.observe(e),t(),()=>n.disconnect()},[w]);let T=(0,Q.useRef)(d);T.current=d;let[E]=(0,Q.useState)(()=>new ResizeObserver(e=>{let t=Math.max(...e.map(e=>e.borderBoxSize[0]?.blockSize??e.contentRect.height)),n=T.current;p(e=>si(e,n,t))}));(0,Q.useLayoutEffect)(()=>()=>E.disconnect(),[E]),(0,Q.useLayoutEffect)(()=>{let e=x.ref.current;if(b||d===0||!e)return;let t=[...e.querySelectorAll(`:scope > li[aria-posinset]`)];if(t.length===0)return;let n=Math.max(...t.map(e=>e.getBoundingClientRect().height));p(e=>si(e,d,n))});let ee=(0,Q.useCallback)(e=>{if(e)return E.observe(e),()=>E.unobserve(e)},[E]);return(0,Z.jsx)(`ul`,{ref:x.ref,className:`relative min-w-0 flex-auto`,"aria-label":t,style:{height:x.geometry.contentHeight},children:x.rows.flatMap(({index:e,offset:t})=>Array.from({length:u},(n,r)=>{let i=e*u+r;if(i>=o)return[];let s=C(i),c={top:t,left:r*(d+12),width:d,minHeight:m};return s?(0,Z.jsx)(`li`,{ref:ee,"aria-posinset":i+1,"aria-setsize":o,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:a(s)},s.id):(0,Z.jsx)(`li`,{"aria-hidden":!0,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:(0,Z.jsx)(z,{className:`h-full rounded-lg`})},`skeleton-${i}`)}))})},li=`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,ui=e=>e*.75,di=44,fi=({model:e,view:t,display:n,list:r,empty:i})=>{let a=t?.names?.plural??B(e.name),o=n.card===void 0&&(n.image!==void 0||n.photos!==void 0);return r.isLoading?(0,Z.jsx)(`div`,{"aria-busy":!0,className:`min-h-0 flex-1 overflow-hidden ${li}`,children:Array.from({length:6},(e,t)=>(0,Z.jsx)(z,{className:`h-24`},t))}):r.error?(0,Z.jsx)(Ve,{title:ke(`couldNotLoadRows`),error:r.error}):!r.source||r.source.total===0?i??(0,Z.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:ke(`noneMatch`,{plural:a.toLowerCase()})}):(0,Z.jsx)(ci,{source:r.source,label:a,initialIndex:r.initialIndex,onScrollIndex:r.onScrollIndex,minHeight:e=>(o?ui(e):0)+di,children:r=>(0,Z.jsx)(Vt,{model:e,view:t,display:n,row:ue(e,r)})})},pi=`protobase:list-places`,mi=50,hi=(e,t)=>`${e} ${t}`,gi=e=>{if(typeof e!=`object`||!e)return!1;let{entry:t,url:n,place:r}=e;return typeof t==`string`&&typeof n==`string`&&typeof r==`number`&&Number.isFinite(r)&&r>=0},_i=e=>Me(()=>{let t=e.getItem(pi);if(t===null)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(gi):[]},[]),vi=e=>{let t=new Map(_i(e).map(e=>[hi(e.entry,e.url),e]));return{placeOf:(e,n)=>{let r=t.get(hi(e,n));return r?r.place:[...t.values()].findLast(e=>e.url===n)?.place??0},save:(e,n,r)=>{let i=hi(e,n);t.delete(i),t.set(i,{entry:e,url:n,place:r});for(let e of[...t.keys()].slice(0,Math.max(0,t.size-mi)))t.delete(e)},persist:()=>Me(()=>e.setItem(pi,JSON.stringify([...t.values()])),void 0)}},yi={getItem:()=>null,setItem:()=>{}},bi,xi=()=>bi??=vi(Me(()=>window.sessionStorage,void 0)??yi),Si=()=>{let{entry:e,path:t,params:n}=ye(),r=`${t}?${n.toString()}`,i=xi();(0,Q.useEffect)(()=>{let e=()=>i.persist(),t=()=>document.visibilityState===`hidden`&&i.persist();return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),i.persist()}},[i]);let a=(0,Q.useCallback)(t=>i.save(e,r,t),[i,e,r]);return{initialIndex:i.placeOf(e,r),remember:a}},Ci=e=>e.reduce((e,t)=>e+t.count,0),wi=e=>{let t=Math.floor(e.length/2),n=Ci(e.slice(0,t)),r=Ci(e.slice(e.length-t));return n===0?0:(r-n)/n*100},Ti=H(`activity-chart`),Ei=({title:e,defaultGranularity:t=`day`,data:n,granularity:r,onGranularityChange:i,periodLabel:a,state:o,className:s})=>{let[c,l]=(0,Q.useState)(t),d=r??c,f=i??l,p=wi(n),m=n.map(({at:e,count:t})=>({at:e,value:t,count:t}));return(0,Z.jsxs)(`section`,{className:K(`rounded-lg border bg-background px-4 pb-2 pt-3`,s),children:[(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsx)(`h2`,{className:`font-semibold`,children:e}),o===void 0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`font-semibold tabular-nums`,children:u(Ci(n))}),(0,Z.jsxs)(`span`,{className:K(`text-xs font-medium tabular-nums`,p>=0?`text-success-text`:`text-danger-text`),children:[p>=0?`+`:`−`,Math.abs(p).toFixed(1),`%`]})]}),(0,Z.jsx)(`span`,{className:`hidden text-xs text-muted-foreground sm:inline`,children:a??`last ${d===`day`?`30 days`:`12 weeks`}`})]}),(0,Z.jsx)(ae,{value:d,onChange:f,options:[{value:`day`,label:Ti(`day`)},{value:`week`,label:Ti(`week`)}]})]}),(0,Z.jsxs)(`div`,{className:`mt-2`,children:[o===`failed`&&(0,Z.jsx)(`p`,{className:`py-6 text-danger-text`,children:Ti(`couldNotLoad`)}),o===`loading`&&(0,Z.jsx)(z,{className:`h-24 w-full`}),o===void 0&&(0,Z.jsx)(Lt,{points:m,measure:{kind:`count`},bucket:d,type:`bar`,compact:!0})]})]})},Di={"7d":`last 7 days`,"30d":`last 30 days`,"90d":`last 90 days`,"1y":`last year`,all:`all time`},Oi=({resource:e,chart:t,title:n,filter:r})=>{let[i,a]=(0,Q.useState)(t.granularity===`week`?`week`:`day`),o=i===`week`?`90d`:t.range,s=d(e,{field:t.field,range:o,granularity:i,filter:r,timeZone:G()}),c=s.data?.points.map(e=>({at:Date.parse(`${e.bucket}Z`),count:e.count}))??[];return(0,Z.jsx)(Ei,{title:n,data:c,granularity:i,onGranularityChange:a,periodLabel:i===`week`?`last 12 weeks`:Di[o],state:s.isError?`failed`:s.isPending?`loading`:void 0})},ki=(e,t,n)=>{let r=e.sum??e.average;if(r===void 0)return n;let i=t?.fields[r]?.label??B(r);return e.sum===void 0?je(`average`,{label:i}):`${i}`},Ai=({model:e,view:t,chart:n,plural:r,filter:i})=>{let a=t?.fields[n.groupBy]?.label??B(n.groupBy);return(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-background px-4 pb-3 pt-3`,"aria-label":`${ki(n,t,r)} by ${a.toLowerCase()}`,children:[(0,Z.jsxs)(`h2`,{className:`mb-2 font-semibold`,children:[ki(n,t,r),` by `,a.toLowerCase()]}),(0,Z.jsx)(kt,{model:e,view:t,groupBy:n.groupBy,type:n.type,sum:n.sum,average:n.average,limit:n.limit,filter:i})]})},ji=({value:e,onCommit:t,placeholder:n,className:r})=>{let[i,a]=(0,Q.useState)(e);return(0,Q.useEffect)(()=>a(e),[e]),(0,Q.useEffect)(()=>{if(i===e)return;let n=setTimeout(()=>t(i),350);return()=>clearTimeout(n)},[i,e,t]),(0,Z.jsx)(T,{wrapperClassName:K(`min-w-0 flex-1 sm:w-72 sm:flex-initial`,r),leading:(0,Z.jsx)(F,{className:`size-4`}),placeholder:n,"aria-label":X(`search`),value:i,onChange:e=>a(e.target.value),onKeyDown:e=>e.key===`Enter`&&t(i)})},Mi=(e,t,n,r,i)=>{let a=n?.list?.relatedColumns??[];if(a.length===0)return e;let o=new Map(e.map(e=>[e.id,e]));return Oe(t,n).flatMap(e=>{let t=o.get(e);if(t)return[t];let n=a.find(t=>t.name===e),s=n&&r[n.resource];if(!n||!s)return[];let c=n.label??B(n.name);return[{id:n.name,header:c,kind:`text`,width:160,minWidth:Te(c,!1),sortable:!1,render:e=>(0,Z.jsx)(yt,{column:n,records:e[n.name]??[],target:s,view:i[s.name],Card:Vt})}]})},Ni=({model:e,view:t,target:n,children:r})=>{let i=ht(e.name,t.listOf,!0),a=t.names?.plural??B(e.name),o=e=>(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[(0,Z.jsx)(Zt,{title:a,subtitle:t.help}),e]});if(i.error)return o((0,Z.jsx)(Ve,{title:at(`couldNotLoadYour`,{plural:a.toLowerCase()}),error:i.error}));if(!i.data)return o((0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,children:Array.from({length:3},(e,t)=>(0,Z.jsx)(z,{className:`h-24`},t))}));let s=Nt(n,i.data);return s?r(s):o((0,Z.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:at(`noneYet`,{plural:a.toLowerCase()})}))},Pi=({title:e,chips:t,label:n,required:r,initial:i=``,busy:a,onSave:o,onClose:s})=>{let c=(0,Q.useId)(),[l,u]=(0,Q.useState)(i),d=`${c}-form`;return(0,Z.jsx)(b,{open:!0,title:e,onClose:s,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{onClick:s,children:Y(`cancel`)}),(0,Z.jsx)(L,{type:`submit`,form:d,variant:`primary`,loading:a,children:Y(`save`)})]}),children:(0,Z.jsxs)(`form`,{id:d,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),o(l.trim()===``?null:l.trim())},children:[t.length>0&&(0,Z.jsx)(wt,{chips:t}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:c,className:`font-medium`,children:n}),!r&&(0,Z.jsx)(`span`,{id:`${c}-hint`,className:`text-xs text-muted-foreground`,children:Y(`optional`)})]}),(0,Z.jsx)(T,{id:c,value:l,required:r,pattern:r?`.*\\S.*`:void 0,"aria-describedby":r?void 0:`${c}-hint`,autoFocus:!0,autoComplete:`off`,onChange:e=>u(e.target.value)})]})]})})},$=k(),Fi={start:0,end:0},Ii=(e,t)=>$.and(t,{kind:`present`,field:e.field,span:Fi}),Li=e=>{switch(e.kind){case`and`:case`or`:return{...e,args:e.args.map(Li)};case`not`:return Ri(e.arg);case`search`:case`present`:case`isNull`:case`related`:return e;default:return Ii(e,e)}},Ri=e=>{switch(e.kind){case`and`:return $.or(...e.args.map(Ri));case`or`:return $.and(...e.args.map(Ri));case`not`:return Li(e.arg);case`search`:case`present`:case`isNull`:case`related`:return $.not(e);default:return Ii(e,$.not(e))}},zi=e=>{let t=xe(e);if(!t.ok)throw Error(`The filter cannot be read: ${t.errors.map(e=>e.message).join(`; `)}`);return t.ast},Bi=e=>e.kind===`and`||e.kind===`or`?e.args.some(Bi):e.kind===`not`?Bi(e.arg):e.kind===`related`,Vi=(e,t)=>![zi(e),zi(t)].some(e=>e&&Bi(e)),Hi=(e,t)=>{let n=zi(e);if(!n)return null;let r=zi(t),i=$.not(Li(n));return I(r?$.and(r,i):i)},Ui=(e,t)=>Hi(t,e),Wi=e=>e.key.startsWith(`extra:`)?`extra:${e.label}`:e.key,Gi=(e,t)=>{let n=new Map(e.map(e=>[Wi(e),e])),r=new Map(t.map(e=>[Wi(e),e])),i=e.filter(e=>!r.has(Wi(e))).map(e=>({kind:`removed`,label:e.label})),a=t.flatMap(e=>{let t=n.get(Wi(e));return t&&t.label!==e.label?[{kind:`changed`,label:e.label,before:t.label}]:[]}),o=t.filter(e=>!n.has(Wi(e))).map(e=>({kind:`added`,label:e.label}));return[...i,...a,...o]},Ki=(e,t,n,r)=>{let i=e-t;if(i===0)return Y(`asMany`,{plural:r});let a=Math.abs(i)===1?n:r;return i>0?Y(`more`,{count:i,noun:a}):Y(`fewer`,{count:-i,noun:a})},qi=12,Ji={added:{word:`added`,className:`text-success-text`},removed:{word:`removed`,className:`text-danger-text`},changed:{word:`changed`,className:`text-primary-text`}},Yi=({changes:e})=>(0,Z.jsx)(`ul`,{"aria-label":Y(`filterChanges`),className:`divide-y rounded-md border`,children:e.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[72px_1fr] gap-3 px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium ${Ji[e.kind].className}`,children:Y(Ji[e.kind].word)}),e.kind===`changed`?(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,Z.jsx)(`span`,{className:`font-medium`,children:e.label})]}):(0,Z.jsx)(`span`,{className:e.kind===`removed`?`text-muted-foreground line-through`:`font-medium`,children:e.label})]},`${e.kind}:${e.label}`))}),Xi=(e,t)=>{let n=$e({...ge(V(),e,t??``),enabled:t!==null});return t===null?0:n.data},Zi=(e,t,n)=>`${e} ${e===1?t:n}`,Qi=({model:e,view:t,title:n,filter:r,total:i,plural:a})=>{let o=t?.list?.displays?.find(e=>e.kind===`cards`);return(0,Z.jsxs)(`section`,{"aria-label":n,className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`h3`,{className:`font-semibold`,children:[n,` `,(0,Z.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,i??`…`,`)`]})]}),i!==void 0&&i>qi&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Y(`firstOf`,{limit:qi,total:i})}),r===null||i===0?(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:Y(`noPlural`,{plural:a})}):(0,Z.jsx)(Ft,{model:e,view:t,filter:r,sort:re(e,t),limit:qi,display:o?.name??`table`,row:!0,link:!1,empty:`No ${a}.`})]})},$i=({model:e,view:t,before:n,after:r})=>{let i=(0,Q.useMemo)(()=>Hi(n,r),[n,r]),a=(0,Q.useMemo)(()=>Ui(n,r),[n,r]),o=Xi(e,i),s=Xi(e,a),c=(t?.names?.singular??B(e.name)).toLowerCase(),l=(t?.names?.plural??B(e.name)).toLowerCase();return(0,Z.jsxs)(Z.Fragment,{children:[o!==void 0&&s!==void 0?(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`span`,{className:`font-semibold`,children:Ki(o,s,c,l)}),(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[`: `,Y(`addedRemoved`,{added:Zi(o,c,l),removed:s})]})]}):(0,Z.jsx)(z,{className:`h-4 w-48`}),(0,Z.jsx)(Qi,{model:e,view:t,title:Y(`added`),filter:i,total:o,plural:l}),(0,Z.jsx)(Qi,{model:e,view:t,title:Y(`removed`),filter:a,total:s,plural:l})]})},ea=({model:e,view:t,title:n,before:r,after:i,saveNewLabel:a,updating:o,creating:s,onUpdate:c,onSaveNew:l,onCancel:u})=>{let d=Gi(rt(e,r),rt(e,i));return(0,Z.jsx)(b,{open:!0,wide:!0,title:n,onClose:u,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{onClick:u,children:Y(`cancel`)}),(0,Z.jsx)(L,{loading:s,disabled:o,onClick:l,children:a}),(0,Z.jsx)(L,{variant:`primary`,loading:o,disabled:s,onClick:c,children:Y(`update`)})]}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d.length>0&&(0,Z.jsx)(Yi,{changes:d}),Vi(r,i)?(0,Z.jsx)($i,{model:e,view:t,before:r,after:i}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:Y(`noRecordsDiff`)})]})})},ta=()=>{let{address:e,set:t}=g();return{key:e?.kind===`list`?e.savedSearch:void 0,open:e=>t({savedSearch:e})}},na=e=>e instanceof Error?e.message:Y(`somethingWrong`),ra=(e,t)=>{let n=Ie(),r=V(),i=qe(),a=Ke(),{href:o,open:s}=g(),l=ta(),{resource:u}=e,d=n.resources[u],f=n.views[u]?.searchesOf,p=n.permissions[u],m=d!==void 0&&f!==void 0&&p!==void 0&&R(p,`create`)&&R(p,`delete`),h=n.signIn?.[u]?.signIn,_=Tt(u,m),v=e=>Be(c(d,e)),y=f&&_.data?.find(e=>e[f.filter]===t),b=y||l.key===void 0||!p||!R(p,`update`)?void 0:_.data?.find(e=>v(e)===l.key),x=n.views[u]?.names,S=x?.plural??`saved searches`,C=f?.name===void 0?void 0:d?.fields[f.name],w=Qe({mutationFn:e=>r.create(u,{[f.filter]:t,...f.name&&{[f.name]:e}}),onSuccess:e=>{l.open(v(e.record)),i.show({state:`success`,title:Y(`searchSaved`),action:{label:Y(`openPlural`,{plural:S}),href:o({kind:`list`,resource:u}),onNavigate:s}})},onError:e=>i.show({state:`error`,title:Y(`couldNotSave`),description:na(e)}),onSettled:()=>a(u)}),T=Qe({mutationFn:e=>r.remove(u,v(e)),onError:e=>i.show({state:`error`,title:Y(`couldNotTakeOff`),description:na(e)}),onSettled:()=>a(u)}),E=Qe({mutationFn:e=>r.update(u,v(e),{[f.filter]:t},e.etag??`*`),onSuccess:()=>i.show({state:`success`,title:Y(`searchUpdated`)}),onError:e=>i.show({state:`error`,title:Y(`couldNotUpdate`),description:na(e)}),onSettled:()=>a(u)}),ee=w.isPending||T.isPending||E.isPending;return{mode:m?`save`:h?`sign-in`:void 0,prompt:h,saved:y!==void 0,opened:b&&{filter:String(b[f.filter]??``),name:f.name&&typeof b[f.name]==`string`&&b[f.name]!==``?String(b[f.name]):void 0},noun:(x?.singular??B(u)).toLowerCase(),naming:C&&{label:n.views[u]?.fields[C.name]?.label??B(C.name),required:!C.nullable},ready:_.data!==void 0&&!ee,updating:E.isPending,creating:w.isPending,remove:()=>y&&T.mutate(y),saveNew:(e,t)=>w.mutate(e,t),update:e=>b&&E.mutate(b,e)}},ia=({model:e,view:t,search:n,filter:r,chips:i,className:a})=>{let o=ra(n,r),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)();if(!o.mode)return null;let p=n.label??Y(`saveSearch`);if(o.mode===`sign-in`)return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{className:a,"aria-haspopup":`dialog`,onClick:()=>c(!0),children:[(0,Z.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0}),p]}),(0,Z.jsx)(y,{as:`dialog`,prompt:o.prompt,open:s,onClose:()=>c(!1)})]});let m=e=>{u(!1),o.naming?f(e):o.saveNew(null)},h=d!==void 0&&o.naming&&(0,Z.jsx)(Pi,{title:d,chips:i,label:o.naming.label,required:o.naming.required,busy:o.creating,onSave:e=>o.saveNew(e,{onSuccess:()=>f(void 0)}),onClose:()=>f(void 0)}),g=o.opened;if(g){let n=Y(`saveAsNew`,{noun:o.noun});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{className:a,"aria-haspopup":`dialog`,"aria-disabled":!o.ready,onClick:()=>o.ready&&u(!0),children:[(0,Z.jsx)(_n,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`max-w-60 truncate`,children:Y(`updateName`,{name:g.name??o.noun})})]}),(0,Z.jsxs)(L,{className:a,"aria-haspopup":o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&m(n),children:[(0,Z.jsx)(pn,{className:`size-3.5`,"aria-hidden":!0}),n]}),l&&(0,Z.jsx)(ea,{model:e,view:t,title:g.name?Y(`updateNameQuestion`,{name:g.name}):Y(`updateNounQuestion`,{noun:o.noun}),before:g.filter,after:r,saveNewLabel:n,updating:o.updating,creating:o.creating,onUpdate:()=>o.update({onSuccess:()=>u(!1)}),onSaveNew:()=>m(n),onCancel:()=>u(!1)}),h]})}let _=o.saved?dn:oe;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{className:a,"aria-pressed":o.saved,"aria-haspopup":!o.saved&&o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&(o.saved?o.remove():m(p)),children:[(0,Z.jsx)(_,{className:o.saved?`size-3.5 text-primary`:`size-3.5`,"aria-hidden":!0}),p]}),h]})},aa=e=>e instanceof Error?e.message:Y(`somethingWrong`),oa=({model:e,view:t,name:n,value:r,onChange:i})=>{let a=(0,Q.useId)(),o=e.fields[n],s=t.fields[n],c=s?.label??B(n);if(o?.type===`boolean`)return(0,Z.jsx)(w,{checked:r===!0,onChange:i,label:c});if(o?.type!==`enum`)throw Error(`Not implemented: "${n}" is ${o?.type??`unknown`}, and a saved search's controls are enums or booleans`);return(0,Z.jsxs)(`label`,{htmlFor:a,className:`flex items-center gap-2 text-muted-foreground`,children:[c,(0,Z.jsx)(`select`,{id:a,value:String(r??``),onChange:e=>i(e.target.value),className:`h-8 rounded-md border border-border-strong bg-background px-2 text-foreground shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20`,children:(o.enumValues??[]).map(e=>(0,Z.jsx)(`option`,{value:e,children:Pe(e,s?.valueLabels)},e))})]})},sa=(e,t,n)=>Object.entries(n).map(([n,r])=>`${t.fields[n]?.label??B(n)}: ${e.fields[n]?.type===`boolean`?Y(r===!0?`on`:`off`):Pe(String(r),t.fields[n]?.valueLabels)}`).join(`, `),ca=({model:e,view:t,recordKey:n,title:r,row:i,fields:a})=>{let o=V(),s=qe(),c=Ke(),l=Qe({mutationFn:t=>o.update(e.name,n,t,i.etag??`*`),onSuccess:(n,i)=>s.show({state:`success`,title:Y(`saved`,{title:r}),description:sa(e,t,i)}),onError:e=>s.show({state:`error`,title:Y(`couldNotChange`),description:aa(e)}),onSettled:()=>c(e.name)});return(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:a.map(n=>(0,Z.jsx)(oa,{model:e,view:t,name:n,value:l.isPending&&n in(l.variables??{})?l.variables[n]:i[n],onChange:e=>l.mutate({[n]:e})},n))})},la=e=>e instanceof Error?e.message:Y(`somethingWrong`),ua=({model:e,view:t,of:n,target:r,targetView:i,row:a,recordKey:o,canRename:s,onDelete:c})=>{let l=V(),u=qe(),d=Ke(),[f,p]=(0,Q.useState)(!1),{name:m,chips:h,title:g,body:_}=Ut({model:e,of:n,target:r,targetView:i,row:a,recordKey:o}),v=Qe({mutationFn:t=>l.update(e.name,o,{[n.name]:t},a.etag??`*`),onSuccess:()=>p(!1),onError:e=>u.show({state:`error`,title:Y(`couldNotRename`),description:la(e)}),onSettled:()=>d(e.name)}),y=n.name===void 0?void 0:e.fields[n.name];return(0,Z.jsxs)(`section`,{"aria-label":g,className:`flex flex-col gap-3 rounded-lg border bg-surface p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,Z.jsx)(ce,{to:{kind:`record`,resource:e.name,key:o},className:`hover:underline`,children:m??(0,Z.jsx)(Ct,{chips:h})})})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.controls&&(0,Z.jsx)(ca,{model:e,view:t,recordKey:o,title:g,row:a,fields:n.controls}),s&&y&&(0,Z.jsx)(L,{variant:`ghost`,"aria-label":Y(`renameTitle`,{title:g}),"aria-haspopup":`dialog`,onClick:()=>p(!0),children:(0,Z.jsx)(Gt,{className:`size-3.5`,"aria-hidden":!0})}),c&&(0,Z.jsx)(L,{variant:`ghost`,"aria-label":Y(`deleteTitle`,{title:g}),onClick:()=>c(g),children:(0,Z.jsx)(Xt,{className:`size-3.5`,"aria-hidden":!0})})]})]}),f&&y&&(0,Z.jsx)(Pi,{title:Y(`renameTitle`,{title:g}),chips:h,label:t.fields[y.name]?.label??B(y.name),required:!y.nullable,initial:m,busy:v.isPending,onSave:e=>v.mutate(e),onClose:()=>p(!1)}),(0,Z.jsx)(Ht,{..._})]})},da=({model:e,view:t})=>{let{resources:n,views:r}=Ie(),i=t.searchesOf,a=n[i.resource],o=r[i.resource],s=Tt(e.name,!0),l=pe(e.name),u=Kt({model:e,view:t}),d=t.names?.plural??B(e.name),f=e=>(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[u.dialogs,(0,Z.jsx)(Zt,{title:d,subtitle:t.help}),e]});if(!a)return f((0,Z.jsx)(W,{title:Y(`notFound`),children:Y.rich(`noResource`,{resource:i.resource})}));if(s.error)return f((0,Z.jsx)(Ve,{title:Y(`couldNotLoadYour`,{plural:d.toLowerCase()}),error:s.error}));if(!s.data)return f((0,Z.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:2},(e,t)=>(0,Z.jsx)(z,{className:`h-56`},t))}));if(s.data.length===0){let e=(o?.names?.plural??B(a.name)).toLowerCase();return f((0,Z.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:Y.rich(`noSavedYet`,{plural:d.toLowerCase(),list:(0,Z.jsx)(ce,{to:{kind:`list`,resource:a.name},className:`font-medium text-primary-text hover:underline`,children:e})})}))}return f((0,Z.jsx)(`div`,{className:`flex flex-col gap-4`,children:s.data.map(n=>{let r=Be(c(e,n)),s=R(l,`delete`)?e=>void u.start({key:r,title:e,etag:n.etag,snapshot:n}):void 0;return(0,Z.jsx)(ua,{model:e,view:t,of:i,target:a,targetView:o,row:n,recordKey:r,canRename:R(l,`update`),onDelete:s},r)})}))},fa=({field:e,hints:t,resource:n,stored:r,onSave:i,close:o})=>{let[s,c]=(0,Q.useState)(()=>D(e,r)),l=(0,Q.useRef)(null),u=(0,Q.useRef)(!1),d=!t?.widget&&(e.type===`boolean`||e.type===`enum`);(0,Q.useEffect)(()=>{l.current?.querySelector(`input, select, textarea, button, [tabindex]`)?.focus()},[]);let f=(t,n,c=s)=>{u.current||(u.current=!0,t&&a(e,c,r)&&i(we(e,c)),o(n))};return(0,Z.jsx)(`div`,{ref:l,className:`w-full min-w-0`,onKeyDown:e=>{ne(e.target)||(e.key===`Enter`?(e.preventDefault(),f(!0)):e.key===`Tab`?(e.preventDefault(),f(!0,e.shiftKey?-1:1)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f(!1)))},onBlur:e=>{!l.current?.contains(e.relatedTarget)&&!ne(e.relatedTarget)&&f(!0)},children:(0,Z.jsx)(fe,{field:e,hints:t,value:s,stored:r,resource:n,onChange:e=>{c(e),d&&f(!0,void 0,e)}})})},pa=H(`app/list-edit`),ma=e=>{let t=V(),n=Ze(),r=qe(),[i,a]=(0,Q.useState)(new Map),o=(0,Q.useRef)(i),s=(0,Q.useRef)(new Map),l=(e,t)=>{o.current=new Map(o.current).set(e,{...o.current.get(e),...t}),a(o.current)},u=async(i,a,s)=>{let u=c(e,i),d=String(o.current.get(i.id)?.etag??i.etag);try{let r=await t.update(e.name,u,{[a]:s},d);l(i.id,{[a]:r.record[a],etag:r.etag}),n.setQueryData(q.record(e.name,Be(u)),r),n.invalidateQueries({queryKey:[`page`,e.name]}),n.invalidateQueries({queryKey:[`list`,e.name]}),n.invalidateQueries({queryKey:[`map`,e.name]}),n.invalidateQueries({queryKey:[`count`,e.name]})}catch(n){if(!N(n))throw l(i.id,{[a]:i[a]}),n;let o=n.status===412,s=o?await t.get(e.name,u):void 0;l(i.id,s?{[a]:s.record[a],etag:s.etag}:{[a]:i[a]});let c=n.errors.find(e=>e.field===a)?.message??n.message;r.show({state:`error`,title:pa(o?`changedBySomeoneElse`:`couldNotSave`),description:c})}};return{patches:i,save:(e,t,n)=>{l(e.id,{[t]:n});let r=(s.current.get(e.id)??Promise.resolve()).then(()=>u(e,t,n));return s.current.set(e.id,r.catch(()=>void 0)),r}}},ha=(e,t,n)=>{let r=ma(e),i=t?.list?.editable??[];return{editor:i.length>0&&R(n,`update`)?{editable:(t,n)=>i.includes(n)&&e.fields[n]!==void 0&&ie(e.fields[n])&&Se(t,`update`),render:(n,i,a)=>(0,Z.jsx)(fa,{field:e.fields[i],hints:t?.fields[i],resource:e.name,stored:n[i],onSave:e=>void r.save(n,i,e),close:a})}:void 0,patches:r.patches}},ga=k(),_a=e=>e.find(e=>e.kind===`search`),va=({address:e})=>{let{resources:t,views:n,signIn:r}=Ie(),i=t[e.resource],a=r?.[e.resource];if(!i)return a?(0,Z.jsx)(y,{as:`page`,prompt:a.signIn}):(0,Z.jsx)(W,{title:je(`notFound`),children:je(`noResource`,{name:e.resource})});let o=l(n[e.resource],e.list);if(e.list!==void 0&&!o)return(0,Z.jsx)(W,{title:je(`notFound`),children:X(`noList`,{name:e.list})});if(o?.searchesOf)return(0,Z.jsx)(da,{model:i,view:o});let s=p(t,n,e.resource,e.list);if(o&&s.listOf){let t=s.model;return(0,Z.jsx)(Ni,{model:i,view:o,target:t,children:n=>(0,Z.jsx)(ya,{model:t,address:e,scope:n,heading:{title:o.names?.plural??B(i.name),subtitle:o.help}})})}return(0,Z.jsx)(ya,{model:i,address:e})},ya=({model:e,address:t,scope:n,heading:r})=>{let i=Ie(),{set:a,listTo:u,go:d,href:p}=g(),v=e.name,y=l(i.views[v],t.list),b=(0,Q.useMemo)(()=>st(y,e),[y,e]),{fields:x}=_(),S=(0,Q.useMemo)(()=>Mi(Ee(ee(ze(e,y),e,y,x),e,i.resources,i.views),e,y,i.resources,i.views),[e,y,x,i.resources,i.views]),C=t.filter,w=(0,Q.useMemo)(()=>ft(b,C),[b,C]),T=w.ok?w.state:Wt,D=w.ok?w.extras:[],{orderBy:O,filterLayout:k}=t,A=le(),ne=f(),[re,ie]=(0,Q.useState)(!1),ae=n?[...D,n]:D,oe=m(),se=Mr({model:e,resources:i.resources,views:i.views,view:y,state:T,extras:ae,titleOf:oe}),j=n?ut(b,T,ae):w.ok?C:``,M=(0,Q.useMemo)(()=>Ae(e,y,S.map(e=>e.id)),[e,y,S]),de=(0,Q.useMemo)(()=>ot(y,i.resources,i.views,M),[y,i.resources,i.views,M]),N=$t({resources:i.resources,views:i.views,model:e,columns:M,filter:j,orderBy:O,related:de}),P=Fe(e,y,t.display),fe=pe(v),F=n?void 0:nn(e,fe),[me,ge]=(0,Q.useState)(!1),I=me&&F!==void 0,ve=!P&&!I&&tn(y,F,O,j),ye=I||P?.kind!==`map`;h(ye);let be=rn(e,N.page,N.key,P?.kind===`custom`),xe=Si(),Ce=_e(e,y),we=e=>({key:e.id,title:String(typeof e[Ce]==`object`?e[Ce].name:e[Ce]??e.id),etag:typeof e.etag==`string`?e.etag:void 0,snapshot:e}),Te=y?.names?.singular??B(v),De=ha(e,y,fe),{state:z}=Ge(),ke=Jt(e),V=Kt({model:e,view:y,restore:ke,onReview:e=>d({kind:`record`,resource:v,key:e.key})}),H=jt(e),je=y?.actions.some(e=>e.run?.kind===`delete`)??!1,U=(e,t=D)=>a({filter:ut(b,e,t)}),W=_a(D),Me=e=>{let t=D.filter(e=>e.kind!==`search`);U(T,e?[...t,ga.search(e)]:t)},G=y?.names?.plural??B(v),Pe=P?.kind===`calendar`||P?.kind===`timeline`||P?.kind===`board`&&he(e)?void 0:P,K=Pe&&(0,Z.jsx)(Et,{model:e,view:y,display:Pe,orderBy:O,onChange:e=>a({orderBy:e})}),q=e.search?.length?(0,Z.jsx)(ji,{value:W?.kind===`search`?W.text:``,onCommit:Me,placeholder:X(`searchPlural`,{plural:G}),className:A?void 0:`min-h-11`}):null,Re=(0,Z.jsx)(Yn,{layout:k,config:se,value:T,onChange:U,leading:k===`bar`?K:void 0,trailing:q}),Be=k===`bar`?Re:(0,Z.jsx)(qn,{groups:[K?[K]:[]],trailing:q}),Ke=vt(se,T),qe=(0,Z.jsx)(Dn,{scroll:!0,chips:Ke,onRemove:e=>U(lt(T,e)),onClear:()=>U(Wt)}),Je=Pe&&(0,Z.jsx)(Pn,{title:X(`sort`),children:(0,Z.jsx)(Et,{model:e,view:y,display:Pe,orderBy:O,onChange:e=>a({orderBy:e}),className:`min-h-11 w-full`})}),Ye=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(L,{className:`min-h-11`,onClick:()=>ie(!0),"aria-haspopup":`dialog`,children:[(0,Z.jsx)(yn,{className:`size-3.5`}),Ke.length>0?X(`filtersCount`,{count:Ke.length}):X(`filters`)]}),q??(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:qe})]}),q&&qe,(0,Z.jsx)(We,{title:X(`filters`),open:re,onClose:()=>ie(!1),children:(0,Z.jsx)(Yn,{layout:`panel`,fullWidth:!0,config:se,value:T,onChange:U,leading:Je})})]}),Xe=!n&&te(y,i.pages,fe)&&(0,Z.jsxs)(ce,{to:{kind:`create`,resource:v},className:Ne({variant:`primary`}),children:[(0,Z.jsx)(Ue,{className:`size-3.5`}),X(`newRecord`,{singular:Te})]}),Ze=y?.saveSearch&&!n&&w.ok&&C&&(0,Z.jsx)(ia,{model:e,view:y,search:y.saveSearch,filter:C,chips:pt(e,y,C,Mt(se))}),Qe=!n&&(0,Z.jsx)(Fr,{model:e}),$e=Yr({model:e,view:y,resources:i.resources,views:i.views,plural:G,filter:j,orderBy:O}),et=ar(y)&&(0,Z.jsxs)(L,{onClick:()=>$e.open(),...!A&&{"aria-label":X(`export`),title:X(`export`)},children:[(0,Z.jsx)(E,{className:`size-3.5`}),A&&X(`export`)]}),nt=F&&!ve&&(0,Z.jsx)(Yt,{sorting:I,onChange:ge,iconOnly:!A}),rt=t=>!I&&(0,Z.jsx)(zt,{view:y,choices:Le(e,y,ne),value:P?.name??`table`,onChange:e=>a({display:e}),menu:t}),it=en(e),at=t=>{it(ue(e,t).record),d({kind:`record`,resource:v,key:c(e,t)})},ct=async e=>{let t=e.map(we),n=await V.startBulk(t);return e.filter((e,r)=>n.includes(t[r]))},J=N.source?(0,Z.jsx)(_t,{columns:S,source:N.source,sort:o(O),onSortChange:e=>a({orderBy:He(e)}),onOpenRow:at,rowLink:t=>({href:p({kind:`record`,resource:v,key:c(e,t)}),onFollow:()=>at(t)}),cellEditor:De.editor,rowPatches:De.patches,initialScrollIndex:xe.initialIndex,onScrollIndex:xe.remember,rowActions:[{label:X(`openRecord`,{singular:Te}),onSelect:at},...H.rowActions,...R(fe,`delete`)&&!je?[{label:X(`delete`),destructive:!0,available:e=>Se(e,`delete`),onSelect:e=>void V.start(we(e))}]:[]],bulkActions:[...ar(y)&&dr(e)?[{label:e=>X(`exportCount`,{count:e}),onRun:e=>$e.open(e)}]:[],...H.bulkActions,...R(fe,`delete`)?[{label:e=>X(`deleteCount`,{count:e}),destructive:!0,onRun:e=>ct(e)}]:[]],rowNumbers:!1,pinKey:z.kind===`signed-in`?Dt(z.user.id,s(v,t.list)):void 0,scroll:`parent`,className:`flex-1`}):(0,Z.jsx)(`div`,{"aria-busy":!0,className:`flex-1 rounded-lg border bg-surface`}),dt={...N,initialIndex:xe.initialIndex,onScrollIndex:xe.remember},mt=Zr({plural:G,search:W?.kind===`search`?W.text:``,filtered:Ke.length>0,scoped:!!n||D.some(e=>e.kind!==`search`),canCreate:!!Xe}),ht=(0,Z.jsx)(Xr,{state:mt,onClearSearch:()=>Me(``),onClearFilters:()=>U(Wt),create:Xe}),gt=I?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:X(`dragToSort`)}),(0,Z.jsx)(qt,{model:e,view:y,field:F,filter:``,columns:Oe(e,y)})]}):ve?(0,Z.jsx)(qt,{model:e,view:y,field:F,filter:``,columns:Oe(e,y),sort:{value:o(O),onChange:e=>a({orderBy:He(e)})}}):P?P.kind===`cards`?(0,Z.jsx)(fi,{model:e,view:y,display:P,list:dt,empty:ht},N.key.join(` `)):P.kind===`map`?(0,Z.jsx)(At,{model:e,view:y,display:P,filter:j,orderBy:O,fields:M,at:t.map,onMove:e=>a({map:e}),flush:!0}):P.kind===`board`?(0,Z.jsx)(Ot,{model:e,view:y,display:P,fields:M,filter:j,orderBy:O}):P.kind===`calendar`?(0,Z.jsx)(It,{model:e,view:y,display:P,fields:M,filter:j,at:t.calendar,linkTo:e=>u({calendar:e})}):P.kind===`timeline`?(0,Z.jsx)(Pt,{model:e,view:y,display:P,fields:M,filter:j,at:t.timeline,linkTo:e=>u({timeline:e})}):(0,Z.jsx)(Bt,{display:P,list:be}):N.source?.total===0&&!N.error?ht:J;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[V.dialogs,$e.dialogs,H.prompt,(0,Z.jsx)(Zt,{title:r?.title??G,subtitle:r?r.subtitle:y?.help,subtitleBelow:!0,actions:(0,Z.jsxs)(Z.Fragment,{children:[rt(!A),nt,Ze,Qe,et,Xe]})}),!w.ok&&(0,Z.jsx)(Ve,{title:X(`unreadableFilter`),error:Error(w.errors.map(e=>e.message).join(`; `))}),N.error&&!P&&!I&&(0,Z.jsx)(Ve,{title:X(`couldNotLoadRows`),error:N.error}),y?.chart&&!I&&(tt(y.chart)?(0,Z.jsx)(Ai,{model:e,view:y,chart:y.chart,plural:G,filter:j}):(0,Z.jsx)(Oi,{resource:v,chart:y.chart,title:X(`created`,{plural:G}),filter:j})),!I&&(A?Be:Ye),A&&k===`panel`&&!I?(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,Z.jsx)(`div`,{className:ye?`sticky top-[calc(var(--pb-sticky-top,0px)+1rem)] flex max-h-[calc(100dvh-var(--pb-sticky-top,0px)-var(--pb-sticky-bottom,0px)-2rem)] shrink-0 self-start`:`flex shrink-0`,children:Re}),gt]}):gt]})};export{va as ListPage,xr as a,_r as c,mr as d,pr as f,ln as h,Sr as i,hr as l,Xn as m,wr as n,vr as o,ur as p,Cr as r,br as s,Er as t,gr as u};
|
|
4
|
+
//# debugId=a6a39e67-caed-4e12-81d6-bd7edcf0d45a
|
|
@@ -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{Kc as r,To as i,nl as a,ou as o}from"./app-
|
|
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{Kc as r,To as i,nl as a,ou as o}from"./app-DWzw7ONt.js";import{i as s,n as c,r as l,t as u}from"./lib-maplibre-gl-CFGgq6sa.js";import{n as d,o as f,t as p}from"./lib-vis.gl-react-maplibre-1cv426UN.js";import{t as m}from"./lib-pmtiles-G7iEFxNu.js";var h={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};h.node;var g=r(h),_=e(t(),1),v=`protobase:map-layer`,y=(e,t)=>e.find(e=>e.id===t),b=e=>o(()=>e.getItem(v),null),x=(e,t)=>o(()=>t===void 0?e.removeItem(v):e.setItem(v,t),void 0),S=a(`app/map`),C=e(n(),1),w=``,T=({layers:e,below:t})=>{let[n,r]=(0,_.useState)(()=>b(localStorage)),{current:a}=f();if(!e||e.length===0)return null;let o=y(e,n),s=e=>{let t=e===w?void 0:e;x(localStorage,t),r(t??null)},c=t&&a?.getLayer(t)?t:void 0;return(0,C.jsxs)(C.Fragment,{children:[o&&(0,C.jsx)(d,{id:`map-layer-${o.id}`,type:`raster`,tiles:[o.tiles],tileSize:256,attribution:o.attribution,maxzoom:o.maxzoom??22,...o.bounds&&{bounds:o.bounds},children:(0,C.jsx)(p,{id:`map-layer-${o.id}`,type:`raster`,...c&&{beforeId:c}})},o.id),(0,C.jsx)(`div`,{className:`absolute left-2.5 top-2.5 z-10 rounded-md shadow`,children:(0,C.jsx)(i,{label:S(`mapLayer`),value:o?.id??w,onChange:s,options:[{value:w,label:S(`map`)},...e.map(e=>({value:e.id,label:e.label}))]})})]})};l(u),c(`pmtiles`,new m().tile);var E=s;export{T as n,g as r,E as t};
|
|
2
|
+
//# debugId=5e6d9081-9aba-4d17-9bcf-0c28d7e77687
|
|
@@ -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{L as r,qc as i}from"./app-
|
|
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{L as r,qc as i}from"./app-DWzw7ONt.js";import{t as a}from"./lib-dompurify-Dr60P-Rn.js";import{t as o}from"./lib-marked-Bg9_sE-m.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./safe-html-CmkqDcA6.js";var p=e(t(),1),m=(e,t)=>t===0?e:Math.min(6,Math.max(t+1,e+t-1)),h=({inLink:e=!1})=>new o({gfm:!0,breaks:!0,renderer:{html:({text:e,block:t})=>t?`<p>${f(e)}</p>`:f(e),link({href:t,title:n,tokens:r}){let i=this.parser.parseInline(r),a=e?null:s(t,d);return a===null?i:c(a,n,i)},image({href:t,title:n,text:r}){let i=e?null:s(t,l);return i===null?f(r):`<img src="${f(i)}" alt="${f(r)}"${u(n)} loading="lazy">`}}}),g={inLink:h({inLink:!0}),page:h({})},_=(e,{inLink:t=!1,headingsUnder:n=0}={})=>{let r=t?g.inLink:g.page,i=r.lexer(e);return r.walkTokens(i,e=>{e.type===`heading`&&(e.depth=m(e.depth,n))}),r.parser(i)},v=e(n(),1),y=i(`break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,`[&_p]:my-2 [&_ul]:my-2 [&_ol]:my-2 [&_pre]:my-2 [&_blockquote]:my-2 [&_table]:my-2 [&_hr]:my-3`,`[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:mt-4 [&_h2]:mb-2 [&_h2]:text-base [&_h2]:font-semibold`,`[&_h3]:mt-3 [&_h3]:mb-1 [&_h3]:font-semibold [&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:font-semibold [&_h5]:font-semibold [&_h6]:font-semibold`,`[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li:has(>input)]:list-none [&_li>input]:mr-1.5 [&_li>input]:-ml-5 [&_li>input]:align-middle`,`[&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:text-primary-hover`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em]`,`[&_pre]:whitespace-pre-wrap [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground`,`[&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-border [&_th]:bg-surface [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold`,`[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_td]:[overflow-wrap:anywhere]`,`[&_hr]:border-border [&_img]:inline [&_img]:max-w-full [&_img]:rounded [&_del]:text-muted-foreground`),b=i(`[&_*]:my-0 [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ul]:list-inside [&_ol]:list-inside [&_pre]:whitespace-pre-wrap [&_code]:font-mono [&_code]:text-[0.9em]`),x=({source:e,inLink:t=!1,className:n})=>{let o=r(),s=(0,p.useMemo)(()=>a.sanitize(_(e,{inLink:t,headingsUnder:o}),{ADD_ATTR:[`target`]}),[e,t,o]);return(0,v.jsx)(`div`,{className:i(t?b:y,n),dangerouslySetInnerHTML:{__html:s}})};export{x as MarkdownContent};
|
|
2
|
+
//# debugId=31faaece-e6c1-48a5-a6e5-b804d5dedccd
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$o as r,Ds as i,La as a,Na as o,Za as s,ao as c,eo as l,es as u,fc as d,is as f,mc as p,no as m,tl as h,ws as g,xo as _}from"./app-
|
|
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,Ds as i,La as a,Na as o,Za as s,ao as c,eo as l,es as u,fc as d,is as f,mc as p,no as m,tl as h,ws as g,xo as _}from"./app-DWzw7ONt.js";import{o as v}from"./vendor-t7Q7QbPu.js";import{t as y}from"./page-header-Ddz2r5ic.js";import{n as b,t as x}from"./person-row-CXlarnkF.js";var S=e(t(),1),C=e(n(),1),w=e=>e?.role===`owner`?[`owner`,`admin`,`member`]:[`admin`,`member`],T=({member:e,current:t,status:n,presence:r,onChanged:i})=>{let{session:a,organizations:u}=g(),f=o(),p=t.organization.id,{busy:h,error:v,run:y}=s(),S=u?.roles??[],T=e.id===t.memberId,E=w(t),D=e.role===`owner`&&t.role!==`owner`,O=S.filter(e=>e.membership);return(0,C.jsx)(x,{name:e.name,email:e.email,self:T,error:v,...(n||r)&&{status:(0,C.jsx)(_,{status:n,presence:r})},actions:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`select`,{"aria-label":f(`roleOf`,{name:e.name}),value:e.role,disabled:h||D,onChange:t=>void y(async()=>{await a.organizations.setRole(p,e.id,t.target.value),i()}),className:`h-7 rounded-md border border-border-strong bg-background px-2 text-body`,children:(D?[e.role]:E).map(e=>(0,C.jsx)(`option`,{value:e,children:m(e)},e))}),!T&&(0,C.jsx)(d,{size:`sm`,variant:`danger`,loading:h,disabled:D,onClick:()=>void y(async()=>{await a.organizations.removeMember(p,e.id),i()}),children:c(`remove`)})]}),children:(0,C.jsx)(b,{roles:O,selected:e.appRoles,grantable:l(S,t),disabled:h,onChange:t=>void y(async()=>{await a.organizations.setAppRoles(e.id,t),i()})})})},E=({current:e,statuses:t,presence:n})=>{let{session:s}=g(),l=o(),d=e?.organization?.id,m=v({queryKey:h.organizationMembers(d??``),queryFn:()=>s.organizations.members(d),enabled:!!d,retry:!1}),_=m.data,b=m.error?m.error instanceof i?f(m.error):c(`couldNotReadMembers`):void 0,{refetch:x}=m,w=(0,S.useCallback)(()=>void x(),[x]);return e?.organization?(0,C.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,C.jsx)(y,{title:c(`members`),subtitle:c(`whoWorks`,{organization:e.organization.name})}),(0,C.jsxs)(r,{title:c(`members`),description:l(`membersDescription`),children:[(0,C.jsx)(u,{message:b}),_?(0,C.jsx)(`ul`,{className:`divide-y rounded-md border`,children:_.map(r=>(0,C.jsx)(T,{member:r,current:e,status:t?.find(e=>e.userId===r.userId),presence:a(n,r.userId),onChanged:w},`${r.id}/${r.role}/${r.appRoles.join()}`))}):!b&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,C.jsx)(p,{}),` `,c(`loading`)]})]})]}):null};export{E as MembersPage,w as assignableOrganizationRoles};
|
|
2
|
+
//# debugId=9e18747a-5abe-40d1-9fa8-4f71f2520d86
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Dt as r,Ot as i,qc as a}from"./app-
|
|
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{Dt as r,Ot as i,qc as a}from"./app-DWzw7ONt.js";import{t as o}from"./lib-dompurify-Dr60P-Rn.js";import{t as s}from"./lib-marked-Bg9_sE-m.js";import{a as c,i as l,r as u,t as d}from"./safe-html-CmkqDcA6.js";var f=e(t(),1),p=/^(?:[a-z][a-z0-9+.-]*:\/\/)?((?:[\p{L}\p{N}-]+\.)+[\p{L}]{2,})(?::\d+)?(?:[/?#]\S*)?$/iu,m=e=>{if(URL.canParse(e))return new URL(e).hostname.toLowerCase()},h=(e,t)=>{let n=p.exec(e.trim())?.[1];if(!n)return!1;let r=m(`http://${n}`);return!r||m(t)!==r},g=/^ {0,3}(`{3,}(?=[^`]*$)|~{3,})/,_=(e,t)=>RegExp(`^ {0,3}${t}[~\`]* *$`).test(e),v=/^ {0,3}>/,y=/^( {0,3})>(?=[^ \t>])/,b=/^ {0,3}([-*+]|\d{1,9}[.)])([ \t]|$)/,x=/^ {0,3}([-_])[ \t]*(\1[ \t]*){2,}$/,S=/^[ \t]/,C=/\r\n?|\n/,w=e=>{let t=[],n,r=!1;for(let i of e.split(C)){if(n){_(i,n)&&(n=void 0),t.push(i);continue}let e=g.exec(i)?.[1];if(e){n=e,r=!1,t.push(i);continue}let a=i.replace(y,`$1\\>`).replace(x,e=>e.replace(/^ */,`$&\\`)),o=a.trim()===``,s=v.test(a)||b.test(a);r&&!o&&!s&&!S.test(a)&&t.push(``),r=s||r&&!o&&S.test(a),t.push(a)}return t.join(`
|
|
2
2
|
`)},T=()=>void 0,E=e=>e.map(e=>`tokens`in e&&e.tokens?E(e.tokens):`text`in e?e.text:``).join(``),D=new s({gfm:!0,breaks:!0,tokenizer:{heading:T,lheading:T,hr:T,table:T,def:T,code:T},renderer:{html:({text:e,block:t})=>t?`<p>${d(e)}</p>`:d(e),link({href:e,title:t,tokens:n,misleading:r}){let i=this.parser.parseInline(n),a=c(e,u);return a===null?i:r?l(a,t,d(e)):l(a,t,i)},image:({raw:e})=>d(e)}}),O=(e,t)=>r(e,t).map(e=>`mention`in e?`<span class="${d(i)}">@${d(e.mention)}</span>`:d(e.text)).join(``),k=(e,t)=>{let n=D.lexer(w(e));return D.walkTokens(n,e=>{e.type===`link`&&(e.misleading=h(E(e.tokens??[]),e.href)),e.type===`strong`&&e.raw.startsWith(`__`)&&Object.assign(e,{type:`text`,text:e.raw,tokens:void 0}),!(e.type!==`text`||e.tokens)&&(e.text=O(e.text,t),e.escaped=!0)}),D.parser(n)},A=e(n(),1),j=a(`break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,`[&_p]:my-2 [&_ul]:my-1 [&_ol]:my-1 [&_pre]:my-1 [&_blockquote]:my-1`,`[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li:has(>input)]:list-none [&_li>input]:mr-1.5 [&_li>input]:-ml-5 [&_li>input]:align-middle`,`[&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:text-primary-hover`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em]`,`[&_pre]:whitespace-pre-wrap [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground [&_del]:text-muted-foreground`),M=({text:e,mentions:t})=>{let n=(0,f.useMemo)(()=>o.sanitize(k(e,t),{ADD_ATTR:[`target`]}),[e,t]);return(0,A.jsx)(`div`,{className:j,dangerouslySetInnerHTML:{__html:n}})};export{M as MessageContent};
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=1e46a20d-716d-4a7d-b7a1-fa6478518699
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$l as e,Ca as t,Ea as n,Zs as r,dl as i,eu as a,ka as o,nl as s,pi as c,vl as l}from"./app-
|
|
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{$l as e,Ca as t,Ea as n,Zs as r,dl as i,eu as a,ka as o,nl as s,pi as c,vl as l}from"./app-DWzw7ONt.js";var u=(e,t)=>{let n=e.position;if(!n||!o(t,`update`))return;let r=e.fields[n.field];return r&&!r.readOnly?n.field:void 0},d=(e,t)=>e.position?.within===void 0?u(e,t):void 0,f=(e,t,n)=>t.position?.within!==void 0&&e.field===t.position.within&&!e.through&&!e.from&&!e.filter?u(t,n):void 0,p=(e,n,r,i)=>{if(n===void 0||e?.list?.drag?.rank!==!0||i!==``)return!1;let a=t(r);return a.columnId===n&&a.direction===`asc`},m=s(`app/hand-order`),h=(e,t,{title:n,place:i})=>!r(e)||e.status!==412?{state:`error`,title:t,description:c(e)}:n===void 0?{state:`warning`,title:t,description:m(`orderChangedSince`,{place:i})}:{state:`warning`,title:m(`notSaved`,{title:n}),description:m(`orderChangedThere`,{place:i})},g=(e,t,r)=>t.flatMap(({before:t,record:i,etag:a})=>{let o=r.filter(e=>Object.hasOwn(t,e)&&t[e]!==i[e]);return o.length===0?[]:[{op:`update`,resource:e.name,key:n(e,i),data:Object.fromEntries(o.map(e=>[e,t[e]])),etag:a}]}),_=async(e,t,n)=>{let r=[],i=``;do{let a=await e.search(t,{filter:n,pageSize:100,...i&&{pageToken:i}});r.push(...a.items),i=a.nextPageToken}while(i);return r},v=(e,t)=>t===void 0?e:`(${e}) AND (${t})`,y=async(t,r,o,s)=>{let c=r.position?.after;if(!c)return{after:[],before:[]};let u=r.primaryKey[0],d=n(r,s),f=e=>l([e]),p=await _(t,c.resource,v(a(e.or(e.eq(c.field,d),e.eq(c.key,d))),c.filter)),m=(e,t)=>p.flatMap(n=>f(n[e])===f(d)&&f(n[t])!==f(d)?[n[t]]:[]),h=m(c.field,c.key),g=m(c.key,c.field),[y,b]=await Promise.all([_(t,r.name,v(a(e.in(u,[d,...h])),c.while)),g.length===0?[]:_(t,r.name,a(e.in(u,g)))]),x=e=>{let t=l(n(r,e));return{key:t,rank:e[r.position.field],title:i(r,o,e,t)}},S=y.some(e=>f(e[u])===f(d));return{after:y.filter(e=>f(e[u])!==f(d)).map(x),before:S?b.map(x):[]}},b=(e,t,r,i,a,o=!1)=>{let s=t=>i[t]?n(e,i[t]):null,c=o&&a===i.length-1;return{op:`move`,resource:e.name,field:t,key:n(e,i[a]),after:s(a-1),...!c&&{before:s(a+1)},...r&&{filter:r}}},x=(e,t)=>{let n=new Map;for(let r of e)if(r.op===`reorder`||r.op===`move`)for(let e of r.records){let r=t(e.record);n.has(r)||n.set(r,e.previous)}return n},S=s(`app/rank-after`);export{g as a,p as c,y as i,d as l,x as n,h as o,b as r,m as s,S as t,f as u};
|
|
2
|
+
//# debugId=6cc4a866-945d-4870-9744-58f153f79c60
|