@lunora/studio 1.0.0-alpha.36 → 1.0.0-alpha.361
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/LICENSE.md +6 -0
- package/README.md +4 -4
- package/dist/index.d.mts +1621 -0
- package/dist/index.d.ts +1013 -809
- package/dist/index.mjs +1 -0
- package/dist/mount.d.mts +23 -0
- package/dist/mount.d.ts +13 -11
- package/dist/mount.mjs +1 -0
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
- package/dist/packem_chunks/ApiTab.mjs +1 -0
- package/dist/packem_chunks/AuditPanel.mjs +1 -0
- package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
- package/dist/packem_chunks/ExportImportPanel.mjs +8 -0
- package/dist/packem_chunks/FileBrowser.mjs +4 -0
- package/dist/packem_chunks/FunctionRunner.mjs +1 -0
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
- package/dist/packem_chunks/HealthPanel.mjs +1 -0
- package/dist/packem_chunks/InsightsPanel.mjs +1 -0
- package/dist/packem_chunks/LogsPanel.mjs +1 -0
- package/dist/packem_chunks/MailPanel.mjs +2 -0
- package/dist/packem_chunks/MetricsPanel.mjs +1 -0
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
- package/dist/packem_chunks/PitrPanel.mjs +1 -0
- package/dist/packem_chunks/SchemaViewer.mjs +1 -0
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
- package/dist/packem_chunks/SettingsPanel.mjs +1 -0
- package/dist/packem_chunks/SqlEditorPanel.mjs +10 -0
- package/dist/packem_chunks/TableEditor.mjs +1 -0
- package/dist/packem_chunks/agents-panel.mjs +1 -0
- package/dist/packem_chunks/ai-usage-panel.mjs +1 -0
- package/dist/packem_chunks/analytics-panel.mjs +1 -0
- package/dist/packem_chunks/architecture-panel.mjs +1 -0
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
- package/dist/packem_chunks/auth-config-panel.mjs +1 -0
- package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
- package/dist/packem_chunks/containers-panel.mjs +1 -0
- package/dist/packem_chunks/dashboards-panel.mjs +1 -0
- package/dist/packem_chunks/evals-panel.mjs +1 -0
- package/dist/packem_chunks/fanout-panel.mjs +1 -0
- package/dist/packem_chunks/flags-panel.mjs +1 -0
- package/dist/packem_chunks/issues-panel.mjs +1 -0
- package/dist/packem_chunks/kv-browser.mjs +1 -0
- package/dist/packem_chunks/log-drains-panel.mjs +4 -0
- package/dist/packem_chunks/migrations-route.mjs +1 -0
- package/dist/packem_chunks/organizations-panel.mjs +1 -0
- package/dist/packem_chunks/payments-panel.mjs +1 -0
- package/dist/packem_chunks/permissions-panel.mjs +1 -0
- package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
- package/dist/packem_chunks/queues-panel.mjs +1 -0
- package/dist/packem_chunks/reactors-panel.mjs +1 -0
- package/dist/packem_chunks/rls-panel.mjs +1 -0
- package/dist/packem_chunks/schedule-panel.mjs +1 -0
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
- package/dist/packem_chunks/sync-client-panel.mjs +1 -0
- package/dist/packem_chunks/theme-indicator.mjs +1 -0
- package/dist/packem_chunks/traces-panel.mjs +1 -0
- package/dist/packem_chunks/users-panel.mjs +1 -0
- package/dist/packem_chunks/vector-browser.mjs +1 -0
- package/dist/packem_chunks/workflows-panel.mjs +1 -0
- package/dist/packem_shared/ADMIN_FUNCTIONS-4aGsMs95.mjs +1 -0
- package/dist/packem_shared/ApiDocsPanel-DD2Uns6b.mjs +2 -0
- package/dist/packem_shared/ApiReferencePanel-CQxU1Ocx.mjs +1 -0
- package/dist/packem_shared/CommandPalette-BZCHLpst.mjs +1 -0
- package/dist/packem_shared/ConfirmButton-CIXYF6Mg.mjs +1 -0
- package/dist/packem_shared/ConnectionBadge-BfcoN-VE.mjs +1 -0
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs +1 -0
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
- package/dist/packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs +1 -0
- package/dist/packem_shared/DataBrowser-CVRWnNWu.mjs +4 -0
- package/dist/packem_shared/DataFilters--ocFTVT2.mjs +1 -0
- package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
- package/dist/packem_shared/GlobalDataBrowser-DC47T6Zl.mjs +1 -0
- package/dist/packem_shared/HomePanel-D12HxHQo.mjs +1 -0
- package/dist/packem_shared/MigrationsPanel-DMkxSXNl.mjs +1 -0
- package/dist/packem_shared/OpenRpcReferencePanel-BFDG91tn.mjs +1 -0
- package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
- package/dist/packem_shared/ScheduledJobs-QCTRdugp.mjs +1 -0
- package/dist/packem_shared/ShardInput-CoySruKZ.mjs +1 -0
- package/dist/packem_shared/Studio-MA8kKZLu.mjs +1 -0
- package/dist/packem_shared/StudioApp-isdWpF9P.mjs +1 -0
- package/dist/packem_shared/StudioI18nProvider-CGXCPnQn.mjs +1 -0
- package/dist/packem_shared/advisor-view-tBumWci_.mjs +1 -0
- package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
- package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
- package/dist/packem_shared/app.d-D425h1XO.d.mts +352 -0
- package/dist/packem_shared/app.d-D425h1XO.d.ts +352 -0
- package/dist/packem_shared/auth-pager-DW77WeZw.mjs +1 -0
- package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
- package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
- package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
- package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
- package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
- package/dist/packem_shared/cf-links-CBJ5SywP.mjs +1 -0
- package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
- package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
- package/dist/packem_shared/data-grid-B5m1OosL.mjs +1 -0
- package/dist/packem_shared/data-view-params-C-_G-biH.mjs +1 -0
- package/dist/packem_shared/diagram-export-panel-Vdt-DZnO.mjs +2 -0
- package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
- package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
- package/dist/packem_shared/error-alert-C0R39DO1.mjs +1 -0
- package/dist/packem_shared/grid-features-Drvfswwy.mjs +6 -0
- package/dist/packem_shared/grid-pagination-DY2erU65.mjs +1 -0
- package/dist/packem_shared/home-panel-CDVTuTF8.mjs +3 -0
- package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
- package/dist/packem_shared/internal-hIuTpSbx.mjs +2 -0
- package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
- package/dist/packem_shared/live-status-D1GasNsH.mjs +1 -0
- package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
- package/dist/packem_shared/log-line-BH0iWiBv.mjs +1 -0
- package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
- package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
- package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
- package/dist/packem_shared/recording-client-DAipTA_n.mjs +1 -0
- package/dist/packem_shared/reference-view-DENugPcj.mjs +13 -0
- package/dist/packem_shared/schema-diagram-CtVPhOGj.mjs +2 -0
- package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
- package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
- package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
- package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
- package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
- package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
- package/dist/packem_shared/sql-result-table-DCwooMGW.mjs +1 -0
- package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
- package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
- package/dist/packem_shared/studio-UhUrPz5J.mjs +2 -0
- package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
- package/dist/packem_shared/table-list-sidebar-CNadcIgG.mjs +1 -0
- package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
- package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
- package/dist/packem_shared/use-admin-query-CaOm4JS3.mjs +1 -0
- package/dist/packem_shared/use-admin-spec-CK7mk3Ui.mjs +1 -0
- package/dist/packem_shared/use-async-submit-D0r7-m2J.mjs +1 -0
- package/dist/packem_shared/use-auth-config-CG7VvAvQ.mjs +1 -0
- package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
- package/dist/packem_shared/use-open-trace-BJKMJjeS.mjs +1 -0
- package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
- package/dist/packem_shared/use-sql-assistant-rZPs3LC3.mjs +1 -0
- package/dist/packem_shared/use-studio-client-DCA50tF2.mjs +1 -0
- package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
- package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
- package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
- package/dist/standalone/chunk-2AH4ABE5.js +1 -0
- package/dist/standalone/chunk-2G57ENH5.js +1 -0
- package/dist/standalone/chunk-3FS22LNI.js +4 -0
- package/dist/standalone/chunk-3GXPALXG.js +1 -0
- package/dist/standalone/chunk-3GYLOE4V.js +1 -0
- package/dist/standalone/chunk-3PAYDWHN.js +8 -0
- package/dist/standalone/chunk-473JK2PQ.js +1 -0
- package/dist/standalone/chunk-4C4THJUD.js +1 -0
- package/dist/standalone/chunk-4DAKKAK7.js +1 -0
- package/dist/standalone/chunk-4M57OYFX.js +1 -0
- package/dist/standalone/chunk-4SQBAPY6.js +1 -0
- package/dist/standalone/chunk-5DNGK3NT.js +1 -0
- package/dist/standalone/chunk-5GIQ6C5N.js +1 -0
- package/dist/standalone/chunk-5R2YO7HF.js +4 -0
- package/dist/standalone/chunk-5WJG7FMH.js +1 -0
- package/dist/standalone/chunk-63KDHS3H.js +1 -0
- package/dist/standalone/chunk-6B6ARRMI.js +1 -0
- package/dist/standalone/chunk-6LMO2D54.js +1 -0
- package/dist/standalone/chunk-6M7FLLMT.js +1 -0
- package/dist/standalone/chunk-6QEXGYWH.js +1 -0
- package/dist/standalone/chunk-6UTZXEW3.js +1 -0
- package/dist/standalone/chunk-6VAY6L4J.js +1 -0
- package/dist/standalone/chunk-7PADVGQX.js +1 -0
- package/dist/standalone/chunk-7RGYCU6F.js +1 -0
- package/dist/standalone/chunk-7UM5ROG6.js +1 -0
- package/dist/standalone/chunk-7ZIYHKLX.js +5 -0
- package/dist/standalone/chunk-A566HCBX.js +1 -0
- package/dist/standalone/chunk-A5JISKHE.js +1 -0
- package/dist/standalone/chunk-ADNRFCMZ.js +1 -0
- package/dist/standalone/chunk-AP4PC2M4.js +1 -0
- package/dist/standalone/chunk-BFE2DRP6.js +33 -0
- package/dist/standalone/chunk-BPEB4KFE.js +1 -0
- package/dist/standalone/chunk-BVX45MU5.js +7 -0
- package/dist/standalone/chunk-BYOGQ2IV.js +3 -0
- package/dist/standalone/chunk-C6GN7ZXJ.js +1 -0
- package/dist/standalone/chunk-CL2VZNDI.js +1 -0
- package/dist/standalone/chunk-CNA3TVUK.js +1 -0
- package/dist/standalone/chunk-CZ6HBDIL.js +1 -0
- package/dist/standalone/chunk-D6S7MXW4.js +1 -0
- package/dist/standalone/chunk-DBVJ5VLI.js +1 -0
- package/dist/standalone/chunk-DX55P3KZ.js +1 -0
- package/dist/standalone/chunk-E26OT26O.js +1 -0
- package/dist/standalone/chunk-FCAXVYAX.js +1 -0
- package/dist/standalone/chunk-FXPAJDES.js +1 -0
- package/dist/standalone/chunk-H7HZ42JY.js +1 -0
- package/dist/standalone/chunk-HHRYM6UW.js +1 -0
- package/dist/standalone/chunk-HPRF5LMA.js +1 -0
- package/dist/standalone/chunk-IB22LETR.js +1 -0
- package/dist/standalone/chunk-IBJVVHV5.js +1 -0
- package/dist/standalone/chunk-IENQRRQT.js +1 -0
- package/dist/standalone/chunk-IH2CJZF2.js +1 -0
- package/dist/standalone/chunk-IQ4TTHQT.js +1 -0
- package/dist/standalone/chunk-ITH5LRWM.js +1 -0
- package/dist/standalone/chunk-J6VFG6M5.js +1 -0
- package/dist/standalone/chunk-JSDKOE4U.js +1 -0
- package/dist/standalone/chunk-JTGGWF7R.js +1 -0
- package/dist/standalone/chunk-JZD7ZN3F.js +1 -0
- package/dist/standalone/chunk-K3CWB3AM.js +1 -0
- package/dist/standalone/chunk-KNFB3FGW.js +1 -0
- package/dist/standalone/chunk-KNXWDE4N.js +1 -0
- package/dist/standalone/chunk-KRPXOSBL.js +1 -0
- package/dist/standalone/chunk-KRY7BYHT.js +1 -0
- package/dist/standalone/chunk-KYAG2YMF.js +1 -0
- package/dist/standalone/chunk-KZCEJFZF.js +1 -0
- package/dist/standalone/chunk-KZILJQX3.js +8 -0
- package/dist/standalone/chunk-LEYUH5TS.js +1 -0
- package/dist/standalone/chunk-LFM672WN.js +1 -0
- package/dist/standalone/chunk-LIGOLZND.js +1 -0
- package/dist/standalone/chunk-LPU6YTSU.js +1 -0
- package/dist/standalone/chunk-LUHXNZI4.js +2 -0
- package/dist/standalone/chunk-MWJC3S62.js +1 -0
- package/dist/standalone/chunk-NGVP66OH.js +1 -0
- package/dist/standalone/chunk-NP2AQOLE.js +1 -0
- package/dist/standalone/chunk-NVKLYDOH.js +1 -0
- package/dist/standalone/chunk-O2NMPIV2.js +59 -0
- package/dist/standalone/chunk-O2X2XYCM.js +1 -0
- package/dist/standalone/chunk-O3MDWYXF.js +1 -0
- package/dist/standalone/chunk-ONG4JEZD.js +1 -0
- package/dist/standalone/chunk-ONWGX5Y4.js +6 -0
- package/dist/standalone/chunk-OS26JXYA.js +1 -0
- package/dist/standalone/chunk-OXFKZ4BM.js +1 -0
- package/dist/standalone/chunk-PGTEGUAB.js +1 -0
- package/dist/standalone/chunk-PQH2LSJX.js +1 -0
- package/dist/standalone/chunk-PTBUWRBY.js +1 -0
- package/dist/standalone/chunk-Q6HA3L2H.js +1 -0
- package/dist/standalone/chunk-QGV5ARD2.js +1 -0
- package/dist/standalone/chunk-QWRK4ESB.js +1 -0
- package/dist/standalone/chunk-R36QXQZX.js +1 -0
- package/dist/standalone/chunk-RL2ITK2N.js +1 -0
- package/dist/standalone/chunk-RTJO3AR4.js +1 -0
- package/dist/standalone/chunk-SFY646MC.js +1 -0
- package/dist/standalone/chunk-SLIDAWNX.js +1 -0
- package/dist/standalone/chunk-SU5DTRGK.js +3 -0
- package/dist/standalone/{chunk-BJGBHGK3.js → chunk-SYGCASPT.js} +1 -1
- package/dist/standalone/chunk-T5UMHPAB.js +1 -0
- package/dist/standalone/chunk-T6HV2FQP.js +2 -0
- package/dist/standalone/chunk-T7ZKNNGX.js +1 -0
- package/dist/standalone/chunk-TCYPNSTV.js +1 -0
- package/dist/standalone/chunk-TDVDZ7XQ.js +1 -0
- package/dist/standalone/chunk-TQM6XHBA.js +1 -0
- package/dist/standalone/chunk-TRMWBRRU.js +1 -0
- package/dist/standalone/chunk-TW7KJSMR.js +15 -0
- package/dist/standalone/chunk-TYD3V4NB.js +1 -0
- package/dist/standalone/chunk-TZKLK52W.js +1 -0
- package/dist/standalone/chunk-U4RXQSQ7.js +1 -0
- package/dist/standalone/chunk-UNZ2UBVL.js +1 -0
- package/dist/standalone/chunk-UYEZR3BI.js +1 -0
- package/dist/standalone/chunk-VEWQWS3J.js +1 -0
- package/dist/standalone/chunk-VJRNOSRY.js +1 -0
- package/dist/standalone/chunk-W2BCSK5S.js +1 -0
- package/dist/standalone/chunk-W7MRISE3.js +1 -0
- package/dist/standalone/chunk-WM72PRE3.js +1 -0
- package/dist/standalone/chunk-WS36BO4R.js +1 -0
- package/dist/standalone/chunk-X4WHMCOZ.js +1 -0
- package/dist/standalone/chunk-X74GEPSG.js +1 -0
- package/dist/standalone/chunk-XIRKBJPD.js +14 -0
- package/dist/standalone/chunk-XKPD4SFN.js +1 -0
- package/dist/standalone/chunk-XMSNLMWU.js +1 -0
- package/dist/standalone/chunk-XOPFDWXX.js +1 -0
- package/dist/standalone/chunk-XQLOVFPP.js +1 -0
- package/dist/standalone/chunk-XSHYZPGF.js +1 -0
- package/dist/standalone/chunk-XST3UEHU.js +1 -0
- package/dist/standalone/chunk-XYR5NST4.js +1 -0
- package/dist/standalone/chunk-Y74LIFSL.js +1 -0
- package/dist/standalone/chunk-YHTHRYP5.js +1 -0
- package/dist/standalone/chunk-YMEKCV27.js +1 -0
- package/dist/standalone/chunk-Z5EV64KS.js +1 -0
- package/dist/standalone/chunk-ZBON5T5A.js +1 -0
- package/dist/standalone/chunk-ZGSL4DPP.js +1 -0
- package/dist/standalone/chunk-ZOQTXWPK.js +1 -0
- package/dist/standalone/chunk-ZTOREMGH.js +1 -0
- package/dist/standalone/chunk-ZZ5GICTF.js +1 -0
- package/dist/standalone/studio.js +9 -214
- package/dist/styles.css +2 -2
- package/package.json +26 -22
- package/dist/index.js +0 -41
- package/dist/mount.js +0 -27
- package/dist/packem_chunks/ApiTab.js +0 -251
- package/dist/packem_chunks/AuditPanel.js +0 -200
- package/dist/packem_chunks/ExportImportPanel.js +0 -198
- package/dist/packem_chunks/FileBrowser.js +0 -2932
- package/dist/packem_chunks/FunctionRunner.js +0 -343
- package/dist/packem_chunks/FunctionStatsPanel.js +0 -377
- package/dist/packem_chunks/HealthPanel.js +0 -648
- package/dist/packem_chunks/InsightsPanel.js +0 -462
- package/dist/packem_chunks/LogsPanel.js +0 -827
- package/dist/packem_chunks/MailPanel.js +0 -353
- package/dist/packem_chunks/MetricsPanel.js +0 -1344
- package/dist/packem_chunks/MigrationsPanel.js +0 -239
- package/dist/packem_chunks/PitrPanel.js +0 -252
- package/dist/packem_chunks/SchemaViewer.js +0 -2513
- package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -95
- package/dist/packem_chunks/SettingsPanel.js +0 -391
- package/dist/packem_chunks/SqlEditorPanel.js +0 -2323
- package/dist/packem_chunks/TableEditor.js +0 -313
- package/dist/packem_chunks/analytics-panel.js +0 -261
- package/dist/packem_chunks/auth-config-panel.js +0 -179
- package/dist/packem_chunks/auth-sessions-panel.js +0 -175
- package/dist/packem_chunks/containers-panel.js +0 -247
- package/dist/packem_chunks/dashboards-panel.js +0 -780
- package/dist/packem_chunks/fanout-panel.js +0 -482
- package/dist/packem_chunks/flags-panel.js +0 -176
- package/dist/packem_chunks/kv-browser.js +0 -1896
- package/dist/packem_chunks/log-drains-panel.js +0 -273
- package/dist/packem_chunks/organizations-panel.js +0 -670
- package/dist/packem_chunks/payments-panel.js +0 -186
- package/dist/packem_chunks/permissions-panel.js +0 -805
- package/dist/packem_chunks/queues-panel.js +0 -1052
- package/dist/packem_chunks/rls-panel.js +0 -315
- package/dist/packem_chunks/schedule-panel.js +0 -831
- package/dist/packem_chunks/sparkline.js +0 -79
- package/dist/packem_chunks/storage-rules-panel.js +0 -140
- package/dist/packem_chunks/subscriptions-panel.js +0 -238
- package/dist/packem_chunks/users-panel.js +0 -1265
- package/dist/packem_chunks/vector-browser.js +0 -281
- package/dist/packem_chunks/workflows-panel.js +0 -562
- package/dist/packem_shared/ADMIN_FUNCTIONS-BHHJi3Gb.js +0 -52
- package/dist/packem_shared/ApiDocsPanel-D4CJf2ad.js +0 -842
- package/dist/packem_shared/ApiReferencePanel-Co_wpRF2.js +0 -230
- package/dist/packem_shared/CommandPalette-BUPpbpMc.js +0 -373
- package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
- package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
- package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
- package/dist/packem_shared/DataBrowser-BeVNxSVm.js +0 -4493
- package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
- package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
- package/dist/packem_shared/GlobalDataBrowser-ErfvIs1S.js +0 -289
- package/dist/packem_shared/HomePanel-D9MQk8I7.js +0 -14
- package/dist/packem_shared/OpenRpcReferencePanel-DLWzrIx9.js +0 -192
- package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
- package/dist/packem_shared/ScheduledJobs-ClaNpZsg.js +0 -262
- package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
- package/dist/packem_shared/Studio-C48P1K5W.js +0 -16
- package/dist/packem_shared/StudioApp-Cqh-SYm2.js +0 -657
- package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
- package/dist/packem_shared/advisor-view-D3-U4kRR.js +0 -159
- package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
- package/dist/packem_shared/alert-CdAET2K_.js +0 -68
- package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
- package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
- package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
- package/dist/packem_shared/browser-storage-tLOxkIHd.js +0 -185
- package/dist/packem_shared/button-BhsN2uZH.js +0 -49
- package/dist/packem_shared/card-DURq3ElK.js +0 -175
- package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
- package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
- package/dist/packem_shared/data-grid-Jz8FqQ2C.js +0 -183
- package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
- package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
- package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
- package/dist/packem_shared/error-alert-BBT6D22d.js +0 -114
- package/dist/packem_shared/grid-features-CUr8Z1_O.js +0 -745
- package/dist/packem_shared/home-panel-CoGxi-oj.js +0 -1639
- package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
- package/dist/packem_shared/internal-DTsYVn-g.js +0 -97
- package/dist/packem_shared/label-D8ykjn5J.js +0 -46
- package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
- package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
- package/dist/packem_shared/reference-view-CSKyUyPl.js +0 -2141
- package/dist/packem_shared/scroll-area-DLhcy-ml.js +0 -93
- package/dist/packem_shared/select-UkNYCT3s.js +0 -273
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
- package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
- package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
- package/dist/packem_shared/studio-CPHA_-3I.js +0 -4015
- package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
- package/dist/packem_shared/table-list-sidebar-B5psdSV1.js +0 -832
- package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
- package/dist/packem_shared/use-admin-query-BHPKmPuj.js +0 -106
- package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
- package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
- package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
- package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
- package/dist/standalone/chunk-22W5VKZ6.js +0 -1
- package/dist/standalone/chunk-2GGMGPEP.js +0 -1
- package/dist/standalone/chunk-2K47A3P6.js +0 -1
- package/dist/standalone/chunk-2NGUNNGW.js +0 -1
- package/dist/standalone/chunk-2THHW7BC.js +0 -1
- package/dist/standalone/chunk-3CJW6NWG.js +0 -4
- package/dist/standalone/chunk-3OA7PECS.js +0 -6
- package/dist/standalone/chunk-46K3NKPA.js +0 -1
- package/dist/standalone/chunk-4QHKBC77.js +0 -1
- package/dist/standalone/chunk-5OH3VPZF.js +0 -1
- package/dist/standalone/chunk-5OIBXYZM.js +0 -1
- package/dist/standalone/chunk-6GFEVKJP.js +0 -1
- package/dist/standalone/chunk-6WRZP62V.js +0 -1
- package/dist/standalone/chunk-764T6X6X.js +0 -1
- package/dist/standalone/chunk-7SLSB2TS.js +0 -4
- package/dist/standalone/chunk-7TJJXVSE.js +0 -1
- package/dist/standalone/chunk-7VF3IAAW.js +0 -2
- package/dist/standalone/chunk-AHILM3ZP.js +0 -1
- package/dist/standalone/chunk-AJIUI7DD.js +0 -1
- package/dist/standalone/chunk-ATYUMPDM.js +0 -1
- package/dist/standalone/chunk-BACPICH6.js +0 -1
- package/dist/standalone/chunk-BI35RXKQ.js +0 -1
- package/dist/standalone/chunk-BOXSWNXZ.js +0 -1
- package/dist/standalone/chunk-BQUQS7QN.js +0 -1
- package/dist/standalone/chunk-CKSHCYGC.js +0 -2
- package/dist/standalone/chunk-DC72CQY4.js +0 -76
- package/dist/standalone/chunk-DORBUITF.js +0 -1
- package/dist/standalone/chunk-DVC6YWVP.js +0 -1
- package/dist/standalone/chunk-DVKPRFIJ.js +0 -1
- package/dist/standalone/chunk-DWDILV2E.js +0 -1
- package/dist/standalone/chunk-DWTBY343.js +0 -1
- package/dist/standalone/chunk-EUIHTPKI.js +0 -1
- package/dist/standalone/chunk-FCSPAJW4.js +0 -1
- package/dist/standalone/chunk-GMSGZDDH.js +0 -13
- package/dist/standalone/chunk-GTM65MVX.js +0 -1
- package/dist/standalone/chunk-HV7G6DFP.js +0 -5
- package/dist/standalone/chunk-ILCTSAOB.js +0 -1
- package/dist/standalone/chunk-IOFMK4D7.js +0 -1
- package/dist/standalone/chunk-J6J54MBP.js +0 -1
- package/dist/standalone/chunk-JE2YOAB7.js +0 -4
- package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
- package/dist/standalone/chunk-K3GNLVYK.js +0 -1
- package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
- package/dist/standalone/chunk-KJJ3WM6H.js +0 -4
- package/dist/standalone/chunk-KZ6INM5M.js +0 -1
- package/dist/standalone/chunk-LAK5VSPI.js +0 -1
- package/dist/standalone/chunk-LD2R263D.js +0 -1
- package/dist/standalone/chunk-LI43EKM6.js +0 -1
- package/dist/standalone/chunk-M55U7NHO.js +0 -1
- package/dist/standalone/chunk-MPTM7ZU3.js +0 -3
- package/dist/standalone/chunk-MPYFGAOW.js +0 -1
- package/dist/standalone/chunk-NKJDGOM3.js +0 -1
- package/dist/standalone/chunk-O3NAGRTR.js +0 -1
- package/dist/standalone/chunk-OCHNCAXJ.js +0 -1
- package/dist/standalone/chunk-OIZ4CHPN.js +0 -8
- package/dist/standalone/chunk-OY3GVYS7.js +0 -4
- package/dist/standalone/chunk-PACH5AHG.js +0 -1
- package/dist/standalone/chunk-PN5NCZDX.js +0 -1
- package/dist/standalone/chunk-PVZI3CXP.js +0 -19
- package/dist/standalone/chunk-PZ7HD5T2.js +0 -1
- package/dist/standalone/chunk-Q52CHOSY.js +0 -1
- package/dist/standalone/chunk-QAFAJBAW.js +0 -1
- package/dist/standalone/chunk-QBAT52GB.js +0 -1
- package/dist/standalone/chunk-QLM6FYZW.js +0 -2
- package/dist/standalone/chunk-RRAFQ5G2.js +0 -1
- package/dist/standalone/chunk-RRCPZMC2.js +0 -22
- package/dist/standalone/chunk-RSEEHNFI.js +0 -1
- package/dist/standalone/chunk-SEU5V7I6.js +0 -1
- package/dist/standalone/chunk-SG3ALJJU.js +0 -1
- package/dist/standalone/chunk-SLKF2L74.js +0 -1
- package/dist/standalone/chunk-TAD43CG5.js +0 -1
- package/dist/standalone/chunk-TBMYIZIO.js +0 -1
- package/dist/standalone/chunk-TDL7NEWA.js +0 -1
- package/dist/standalone/chunk-TO4JQX7W.js +0 -1
- package/dist/standalone/chunk-TOJ3TC35.js +0 -1
- package/dist/standalone/chunk-TQ36RWOP.js +0 -1
- package/dist/standalone/chunk-U4OAQPBT.js +0 -1
- package/dist/standalone/chunk-UK64ZSUW.js +0 -1
- package/dist/standalone/chunk-VLXV72QE.js +0 -1
- package/dist/standalone/chunk-VTGBPW24.js +0 -1
- package/dist/standalone/chunk-WI7GWFEG.js +0 -1
- package/dist/standalone/chunk-WXPWVBIY.js +0 -1
- package/dist/standalone/chunk-X5P2WRYI.js +0 -1
- package/dist/standalone/chunk-X7MMBSNW.js +0 -1
- package/dist/standalone/chunk-XLQ4BHBD.js +0 -1
- package/dist/standalone/chunk-XNJNSCLM.js +0 -1
- package/dist/standalone/chunk-XUGSA2NG.js +0 -1
- package/dist/standalone/chunk-Y2ZPNDL7.js +0 -4
- package/dist/standalone/chunk-YAECF5LW.js +0 -1
- package/dist/standalone/chunk-YEVCU7TB.js +0 -13
- package/dist/standalone/chunk-ZHVTQ37P.js +0 -1
- package/dist/standalone/chunk-ZIGWVHCS.js +0 -1
- package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
- package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
- package/dist/standalone/chunk-ZU4DZ6NK.js +0 -1
- package/dist/standalone/chunk-ZYRGPDZB.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as g}from"./chunk-BPEB4KFE.js";import"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as f}from"./chunk-6UTZXEW3.js";import{c as m}from"./chunk-4DAKKAK7.js";import"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import"./chunk-HHRYM6UW.js";import"./chunk-JSDKOE4U.js";import{l as p}from"./chunk-BFE2DRP6.js";import{a as r,d as h,f as S,g as A}from"./chunk-OXFKZ4BM.js";var R=h(S(),1);var k=h(A(),1);var _=r((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("User subscriptions are ungated")})[s.kind],"k"),w=r(e=>Array.isArray(e.findings)?e.findings:[],"g"),b=r(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),E=r((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: anyone who can reach the worker can open a socket and run ordinary user subscriptions. Admin subscriptions are unaffected \u2014 they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],"A"),O=r(()=>{let e=(0,R.c)(8),s=p(),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let{data:a,error:d,errorSource:c}=m(f.getSecurityAudit,i),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(t=>({description:E(s,t),entity:b(t),issueType:_(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(g,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"T");export{O as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{c as Ue}from"./chunk-UYEZR3BI.js";import{e as _e}from"./chunk-ONWGX5Y4.js";import"./chunk-YMEKCV27.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import{a as ke}from"./chunk-QWRK4ESB.js";import"./chunk-TYD3V4NB.js";import{a as Re}from"./chunk-473JK2PQ.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as Ie}from"./chunk-FXPAJDES.js";import{a as Fe}from"./chunk-XST3UEHU.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-ZTOREMGH.js";import{i as ze}from"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as ee}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as ae}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as ve}from"./chunk-6UTZXEW3.js";import{m as Ke}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as pe}from"./chunk-XMSNLMWU.js";import{a as Oe,b as Ee,c as Le,d as de,e as te,f as X}from"./chunk-HHRYM6UW.js";import{a as De,e as Te}from"./chunk-JSDKOE4U.js";import{B as $e,l as je,n as be,o as ye,p as le,u as xe,y as Z}from"./chunk-BFE2DRP6.js";import{a as h,d as ge,e as bt,f as yt,g as xt}from"./chunk-OXFKZ4BM.js";var B=ge(yt(),1),z=ge(bt(),1);var o=ge(xt(),1);var Ae=h((d,e,t)=>{let{onCopy:r,onDelete:l,onDownload:n,onToggleSelect:c}=t,i=h(()=>{r(d.key)},"c"),s=h(()=>{n(d.key)},"o"),u=h(()=>{l(d.key)},"f"),m=h(()=>{c(d.key)},"h");return{copy:i,download:s,name:d.key.slice(e.length),remove:u,toggle:m}},"Re"),We=h(d=>{let e=(0,B.c)(31),{busy:t,buttonClassName:r,copied:l,objectKey:n,onCopy:c,onDelete:i,onDownload:s,t:u}=d,m=`storage-copy-${n}`,f;e[0]!==l||e[1]!==u?(f=u(l?"Copied":"Copy URL"),e[0]=l,e[1]=u,e[2]=f):f=e[2];let g;e[3]!==t||e[4]!==r||e[5]!==c||e[6]!==m||e[7]!==f?(g=(0,o.jsx)(ee,{className:r,"data-testid":m,disabled:t,onClick:c,size:"sm",type:"button",variant:"ghost",children:f}),e[3]=t,e[4]=r,e[5]=c,e[6]=m,e[7]=f,e[8]=g):g=e[8];let w=`storage-download-${n}`,a;e[9]!==u?(a=u("Download"),e[9]=u,e[10]=a):a=e[10];let k;e[11]!==t||e[12]!==r||e[13]!==s||e[14]!==w||e[15]!==a?(k=(0,o.jsx)(ee,{className:r,"data-testid":w,disabled:t,onClick:s,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=t,e[12]=r,e[13]=s,e[14]=w,e[15]=a,e[16]=k):k=e[16];let S;e[17]!==u?(S=u("Delete object?"),e[17]=u,e[18]=S):S=e[18];let x=`storage-delete-${n}`,b;e[19]!==u?(b=u("Delete"),e[19]=u,e[20]=b):b=e[20];let y;e[21]!==t||e[22]!==i||e[23]!==S||e[24]!==x||e[25]!==b?(y=(0,o.jsx)(Ie,{confirmLabel:S,disabled:t,onConfirm:i,testId:x,children:b}),e[21]=t,e[22]=i,e[23]=S,e[24]=x,e[25]=b,e[26]=y):y=e[26];let v;return e[27]!==y||e[28]!==g||e[29]!==k?(v=(0,o.jsxs)(o.Fragment,{children:[g,k,y]}),e[27]=y,e[28]=g,e[29]=k,e[30]=v):v=e[30],v},"ze"),He=h(d=>{let e=(0,B.c)(14),{objectKey:t,references:r,t:l}=d;if(r===void 0)return null;if(r.length===0){let m=`storage-orphan-${t}`,f;e[0]!==l?(f=l("Orphan"),e[0]=l,e[1]=f):f=e[1];let g;return e[2]!==m||e[3]!==f?(g=(0,o.jsx)(ae,{"data-testid":m,variant:"warning",children:f}),e[2]=m,e[3]=f,e[4]=g):g=e[4],g}let n;e[5]!==r?(n=r.map(vt).join(`
|
|
2
|
+
`),e[5]=r,e[6]=n):n=e[6];let c=n,i=`storage-refs-${t}`,s;e[7]!==r.length||e[8]!==l?(s=r.length===1?l("1 record"):l("{count} records",{count:r.length}),e[7]=r.length,e[8]=l,e[9]=s):s=e[9];let u;return e[10]!==c||e[11]!==i||e[12]!==s?(u=(0,o.jsx)(ae,{"data-testid":i,title:c,variant:"secondary",children:s}),e[10]=c,e[11]=i,e[12]=s,e[13]=u):u=e[13],u},"De"),Ze=h(d=>{let e=(0,B.c)(7),{objectKey:t,onToggle:r,selected:l,t:n}=d,c;e[0]!==n?(c=n("Select row"),e[0]=n,e[1]=c):c=e[1];let i=`storage-select-${t}`,s;return e[2]!==r||e[3]!==l||e[4]!==c||e[5]!==i?(s=(0,o.jsx)(ke,{"aria-label":c,checked:l,"data-testid":i,onCheckedChange:r}),e[2]=r,e[3]=l,e[4]=c,e[5]=i,e[6]=s):s=e[6],s},"je");function vt(d){return`${d.table}\xB7${d.id}`}h(vt,"kt");var kt=h(d=>{let e=(0,B.c)(10),{colSpan:t,name:r,onEnter:l}=d,n;e[0]!==r||e[1]!==l?(n=h(()=>{l(r)},"l"),e[0]=r,e[1]=l,e[2]=n):n=e[2];let c=n,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})}),e[3]=i):i=e[3];let s;e[4]!==c||e[5]!==r?(s=(0,o.jsxs)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:c,type:"button",children:[i,r]}),e[4]=c,e[5]=r,e[6]=s):s=e[6];let u;return e[7]!==t||e[8]!==s?(u=(0,o.jsx)(de,{children:(0,o.jsx)(X,{colSpan:t,children:s})}),e[7]=t,e[8]=s,e[9]=u):u=e[9],u},"St"),wt=h(d=>{let e=(0,B.c)(37),{busy:t,copiedKey:r,handlers:l,object:n,prefix:c,references:i,selected:s,showReferences:u,t:m}=d,f;e[0]!==l||e[1]!==n||e[2]!==c?(f=Ae(n,c,l),e[0]=l,e[1]=n,e[2]=c,e[3]=f):f=e[3];let{copy:g,download:w,name:a,remove:k,toggle:S}=f,x;e[4]!==n.key||e[5]!==s||e[6]!==m||e[7]!==S?(x=(0,o.jsx)(X,{className:"w-8",children:(0,o.jsx)(Ze,{objectKey:n.key,onToggle:S,selected:s,t:m})}),e[4]=n.key,e[5]=s,e[6]=m,e[7]=S,e[8]=x):x=e[8];let b;e[9]!==a?(b=(0,o.jsx)(X,{className:"font-mono text-xs",children:a}),e[9]=a,e[10]=b):b=e[10];let y;e[11]!==n.size?(y=xe(n.size),e[11]=n.size,e[12]=y):y=e[12];let v;e[13]!==y?(v=(0,o.jsx)(X,{className:"tabular-nums text-muted-foreground",children:y}),e[13]=y,e[14]=v):v=e[14];let j=n.httpMetadata?.contentType??"",N;e[15]!==j?(N=(0,o.jsx)(X,{children:j}),e[15]=j,e[16]=N):N=e[16];let C;e[17]!==n.key||e[18]!==i||e[19]!==u||e[20]!==m?(C=u&&(0,o.jsx)(X,{children:(0,o.jsx)(He,{objectKey:n.key,references:i,t:m})}),e[17]=n.key,e[18]=i,e[19]=u,e[20]=m,e[21]=C):C=e[21];let T=r===n.key,D;e[22]!==t||e[23]!==g||e[24]!==w||e[25]!==n.key||e[26]!==k||e[27]!==m||e[28]!==T?(D=(0,o.jsx)(X,{className:"text-right",children:(0,o.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,o.jsx)(We,{busy:t,copied:T,objectKey:n.key,onCopy:g,onDelete:k,onDownload:w,t:m})})}),e[22]=t,e[23]=g,e[24]=w,e[25]=n.key,e[26]=k,e[27]=m,e[28]=T,e[29]=D):D=e[29];let F;return e[30]!==D||e[31]!==x||e[32]!==b||e[33]!==v||e[34]!==N||e[35]!==C?(F=(0,o.jsxs)(de,{"data-testid":"fb-row",children:[x,b,v,N,C,D]}),e[30]=D,e[31]=x,e[32]=b,e[33]=v,e[34]=N,e[35]=C,e[36]=F):F=e[36],F},"wt"),St=h(d=>{let e=(0,B.c)(65),{allSelected:t,busy:r,copiedKey:l,files:n,folders:c,handlers:i,onEnterFolder:s,prefix:u,references:m,selected:f,showReferences:g,someSelected:w,t:a,toggleSelectAll:k}=d,S;e[0]!==a?(S=a("Select all rows"),e[0]=a,e[1]=S):S=e[1];let x;e[2]!==t||e[3]!==w||e[4]!==S||e[5]!==k?(x=(0,o.jsx)(te,{className:"w-8",children:(0,o.jsx)(ke,{"aria-label":S,checked:t,"data-testid":"storage-select-all",indeterminate:w,onCheckedChange:k})}),e[2]=t,e[3]=w,e[4]=S,e[5]=k,e[6]=x):x=e[6];let b;e[7]!==a?(b=a("key"),e[7]=a,e[8]=b):b=e[8];let y;e[9]!==b?(y=(0,o.jsx)(te,{children:b}),e[9]=b,e[10]=y):y=e[10];let v;e[11]!==a?(v=a("size"),e[11]=a,e[12]=v):v=e[12];let j;e[13]!==v?(j=(0,o.jsx)(te,{children:v}),e[13]=v,e[14]=j):j=e[14];let N;e[15]!==a?(N=a("content-type"),e[15]=a,e[16]=N):N=e[16];let C;e[17]!==N?(C=(0,o.jsx)(te,{children:N}),e[17]=N,e[18]=C):C=e[18];let T;e[19]!==g||e[20]!==a?(T=g&&(0,o.jsx)(te,{children:a("used by")}),e[19]=g,e[20]=a,e[21]=T):T=e[21];let D;e[22]!==a?(D=a("Actions"),e[22]=a,e[23]=D):D=e[23];let F;e[24]!==D?(F=(0,o.jsx)(te,{"aria-label":D}),e[24]=D,e[25]=F):F=e[25];let $;e[26]!==F||e[27]!==x||e[28]!==y||e[29]!==j||e[30]!==C||e[31]!==T?($=(0,o.jsx)(Ee,{children:(0,o.jsxs)(de,{children:[x,y,j,C,T,F]})}),e[26]=F,e[27]=x,e[28]=y,e[29]=j,e[30]=C,e[31]=T,e[32]=$):$=e[32];let O;if(e[33]!==c||e[34]!==s||e[35]!==g){let E;e[37]!==s||e[38]!==g?(E=h(I=>(0,o.jsx)(kt,{colSpan:g?6:5,name:I,onEnter:s},I),"D"),e[37]=s,e[38]=g,e[39]=E):E=e[39],O=c.map(E),e[33]=c,e[34]=s,e[35]=g,e[36]=O}else O=e[36];let R;if(e[40]!==r||e[41]!==l||e[42]!==n||e[43]!==i||e[44]!==u||e[45]!==m||e[46]!==f||e[47]!==g||e[48]!==a){let E;e[50]!==r||e[51]!==l||e[52]!==i||e[53]!==u||e[54]!==m||e[55]!==f||e[56]!==g||e[57]!==a?(E=h(I=>(0,o.jsx)(wt,{busy:r,copiedKey:l,handlers:i,object:I,prefix:u,references:m[I.key],selected:f.has(I.key),showReferences:g,t:a},I.key),"D"),e[50]=r,e[51]=l,e[52]=i,e[53]=u,e[54]=m,e[55]=f,e[56]=g,e[57]=a,e[58]=E):E=e[58],R=n.map(E),e[40]=r,e[41]=l,e[42]=n,e[43]=i,e[44]=u,e[45]=m,e[46]=f,e[47]=g,e[48]=a,e[49]=R}else R=e[49];let L;e[59]!==O||e[60]!==R?(L=(0,o.jsxs)(Le,{children:[O,R]}),e[59]=O,e[60]=R,e[61]=L):L=e[61];let _;return e[62]!==$||e[63]!==L?(_=(0,o.jsx)(De,{className:"overflow-hidden py-0",children:(0,o.jsx)(Te,{className:"px-0",children:(0,o.jsxs)(Oe,{"data-testid":"fb-table",children:[$,L]})})}),e[62]=$,e[63]=L,e[64]=_):_=e[64],_},"Ct"),Nt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],Ct=3600,Me=h((d,e)=>{if(e==="size")return d.size;if(e==="type")return d.httpMetadata?.contentType??"";if(e==="date"){if(d.uploaded===void 0)return 0;let t=new Date(d.uploaded).getTime();return Number.isNaN(t)?0:t}return e.startsWith("tag:")?d.customMetadata?.[e.slice(4)]??"":d.key},"we"),jt=h((d,e,t)=>{let r=t==="desc"?-1:1;return d.toSorted((l,n)=>{let c=Me(l,e),i=Me(n,e);return(typeof c=="number"&&typeof i=="number"?c-i:String(c).localeCompare(String(i)))*r})},"Et"),zt=h((d,e)=>{let t=new Set,r=[];for(let l of d){let n=l.key.slice(e.length),c=n.indexOf("/");c===-1?r.push(l):t.add(n.slice(0,c+1))}return{files:r,folders:[...t].toSorted((l,n)=>l.localeCompare(n))}},"_t"),Dt=h(d=>{let e=(0,B.c)(59),{bucket:t,buckets:r,busy:l,draftPrefix:n,expiry:c,fileInputRef:i,onBucketChange:s,onExpiryChange:u,onFileChange:m,onList:f,onPrefixChange:g,onUploadClick:w,t:a}=d,k;e[0]!==g?(k=h(A=>{g(A.target.value)},"v"),e[0]=g,e[1]=k):k=e[1];let S=k,x;e[2]!==s?(x=h(A=>{s(A.target.value)},"y"),e[2]=s,e[3]=x):x=e[3];let b=x,y;e[4]!==u?(y=h(A=>{u(Number.parseInt(A.target.value,10))},"b"),e[4]=u,e[5]=y):y=e[5];let v=y,j;e[6]!==t||e[7]!==r||e[8]!==b||e[9]!==a?(j=r.length>0&&(0,o.jsx)("select",{"aria-label":a("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:b,value:t,children:r.map($t)}),e[6]=t,e[7]=r,e[8]=b,e[9]=a,e[10]=j):j=e[10];let N;e[11]!==a?(N=a("Key prefix"),e[11]=a,e[12]=N):N=e[12];let C;e[13]!==a?(C=a("key prefix (optional)"),e[13]=a,e[14]=C):C=e[14];let T;e[15]!==n||e[16]!==S||e[17]!==N||e[18]!==C?(T=(0,o.jsx)(ze,{"aria-label":N,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:S,placeholder:C,value:n}),e[15]=n,e[16]=S,e[17]=N,e[18]=C,e[19]=T):T=e[19];let D;e[20]!==a?(D=a("List"),e[20]=a,e[21]=D):D=e[21];let F;e[22]!==l||e[23]!==f||e[24]!==D?(F=(0,o.jsx)(ee,{"data-testid":"fb-list",disabled:l,onClick:f,size:"sm",type:"button",children:D}),e[22]=l,e[23]=f,e[24]=D,e[25]=F):F=e[25];let $;e[26]!==l||e[27]!==a?($=a(l?"Uploading\u2026":"Upload"),e[26]=l,e[27]=a,e[28]=$):$=e[28];let O;e[29]!==l||e[30]!==w||e[31]!==$?(O=(0,o.jsx)(ee,{"data-testid":"storage-upload",disabled:l,onClick:w,size:"sm",type:"button",variant:"outline",children:$}),e[29]=l,e[30]=w,e[31]=$,e[32]=O):O=e[32];let R;e[33]!==i||e[34]!==m?(R=(0,o.jsx)("input",{className:"hidden","data-testid":"storage-file-input",onChange:m,ref:i,type:"file"}),e[33]=i,e[34]=m,e[35]=R):R=e[35];let L;e[36]!==a?(L=a("Link expiry"),e[36]=a,e[37]=L):L=e[37];let _;e[38]!==a?(_=Nt.map(A=>(0,o.jsx)("option",{value:A.seconds,children:a(A.label)},A.seconds)),e[38]=a,e[39]=_):_=e[39];let E;e[40]!==c||e[41]!==v||e[42]!==_?(E=(0,o.jsx)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:v,value:c,children:_}),e[40]=c,e[41]=v,e[42]=_,e[43]=E):E=e[43];let I;e[44]!==L||e[45]!==E?(I=(0,o.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[L,E]}),e[44]=L,e[45]=E,e[46]=I):I=e[46];let M;e[47]!==a?(M=a("Open in Cloudflare"),e[47]=a,e[48]=M):M=e[48];let P;e[49]!==M?(P=(0,o.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:Ue,rel:"noreferrer",target:"_blank",children:M}),e[49]=M,e[50]=P):P=e[50];let W;return e[51]!==O||e[52]!==R||e[53]!==I||e[54]!==P||e[55]!==j||e[56]!==T||e[57]!==F?(W=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[j,T,F,O,R,I,P]}),e[51]=O,e[52]=R,e[53]=I,e[54]=P,e[55]=j,e[56]=T,e[57]=F,e[58]=W):W=e[58],W},"$t"),Tt=h(d=>{let e=(0,B.c)(66),{onSortKeyChange:t,onThumbSizeChange:r,showGrid:l,showList:n,sortDirection:c,sortKey:i,t:s,tagKeys:u,thumbSize:m,toggleSortDirection:f,view:g}=d,w;e[0]!==t?(w=h(q=>{t(q.target.value)},"k"),e[0]=t,e[1]=w):w=e[1];let a=w,k;e[2]!==r?(k=h(q=>{r(Number.parseInt(q.target.value,10))},"v"),e[2]=r,e[3]=k):k=e[3];let S=k,x=g==="list",b;e[4]!==s?(b=s("List"),e[4]=s,e[5]=b):b=e[5];let y;e[6]!==n||e[7]!==x||e[8]!==b?(y=(0,o.jsx)("button",{"aria-pressed":x,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:n,type:"button",children:b}),e[6]=n,e[7]=x,e[8]=b,e[9]=y):y=e[9];let v=g==="grid",j;e[10]!==s?(j=s("Grid"),e[10]=s,e[11]=j):j=e[11];let N;e[12]!==l||e[13]!==v||e[14]!==j?(N=(0,o.jsx)("button",{"aria-pressed":v,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:l,type:"button",children:j}),e[12]=l,e[13]=v,e[14]=j,e[15]=N):N=e[15];let C;e[16]!==y||e[17]!==N?(C=(0,o.jsxs)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[y,N]}),e[16]=y,e[17]=N,e[18]=C):C=e[18];let T;e[19]!==s?(T=s("Sort"),e[19]=s,e[20]=T):T=e[20];let D;e[21]!==s?(D=s("Name"),e[21]=s,e[22]=D):D=e[22];let F;e[23]!==D?(F=(0,o.jsx)("option",{value:"name",children:D}),e[23]=D,e[24]=F):F=e[24];let $;e[25]!==s?($=s("size"),e[25]=s,e[26]=$):$=e[26];let O;e[27]!==$?(O=(0,o.jsx)("option",{value:"size",children:$}),e[27]=$,e[28]=O):O=e[28];let R;e[29]!==s?(R=s("Type"),e[29]=s,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,o.jsx)("option",{value:"type",children:R}),e[31]=R,e[32]=L):L=e[32];let _;e[33]!==s?(_=s("Modified"),e[33]=s,e[34]=_):_=e[34];let E;e[35]!==_?(E=(0,o.jsx)("option",{value:"date",children:_}),e[35]=_,e[36]=E):E=e[36];let I;e[37]!==u?(I=u.map(Kt),e[37]=u,e[38]=I):I=e[38];let M;e[39]!==a||e[40]!==i||e[41]!==F||e[42]!==O||e[43]!==L||e[44]!==E||e[45]!==I?(M=(0,o.jsxs)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:a,value:i,children:[F,O,L,E,I]}),e[39]=a,e[40]=i,e[41]=F,e[42]=O,e[43]=L,e[44]=E,e[45]=I,e[46]=M):M=e[46];let P;e[47]!==T||e[48]!==M?(P=(0,o.jsxs)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[T,M]}),e[47]=T,e[48]=M,e[49]=P):P=e[49];let W;e[50]!==s?(W=s("Toggle sort direction"),e[50]=s,e[51]=W):W=e[51];let A=c==="asc"?"\u2191":"\u2193",H;e[52]!==W||e[53]!==A||e[54]!==f?(H=(0,o.jsx)("button",{"aria-label":W,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:f,type:"button",children:A}),e[52]=W,e[53]=A,e[54]=f,e[55]=H):H=e[55];let V;e[56]!==S||e[57]!==s||e[58]!==m||e[59]!==g?(V=g==="grid"&&(0,o.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[s("Thumbnail size"),(0,o.jsx)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:S,step:8,type:"range",value:m})]}),e[56]=S,e[57]=s,e[58]=m,e[59]=g,e[60]=V):V=e[60];let re;return e[61]!==P||e[62]!==H||e[63]!==V||e[64]!==C?(re=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[C,P,H,V]}),e[61]=P,e[62]=H,e[63]=V,e[64]=C,e[65]=re):re=e[65],re},"Ft");function $t(d){return(0,o.jsx)("option",{value:d,children:d},d)}h($t,"Rt");function Kt(d){return(0,o.jsx)("option",{value:`tag:${d}`,children:d},d)}h(Kt,"zt");var Ft=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,Ot=h(d=>(d.httpMetadata?.contentType??"").startsWith("image/")||Ft.test(d.key),"jt"),Et=h(()=>{let d=(0,B.c)(1),e;return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"})}),d[0]=e):e=d[0],e},"Kt"),Lt=h(d=>{let e=(0,B.c)(13),{object:t,resolveUrl:r}=d,[l,n]=(0,z.useState)(null),[c,i]=(0,z.useState)(!1),s;e[0]!==t?(s=Ot(t),e[0]=t,e[1]=s):s=e[1];let u=s,m,f;e[2]!==u||e[3]!==t.key||e[4]!==r?(m=h(()=>{if(!u)return;let k={cancelled:!1};return Z((async()=>{try{let S=await r(t.key);k.cancelled||n(S)}catch{k.cancelled||i(!0)}})()),()=>{k.cancelled=!0}},"h"),f=[u,t.key,r],e[2]=u,e[3]=t.key,e[4]=r,e[5]=m,e[6]=f):(m=e[5],f=e[6]),(0,z.useEffect)(m,f);let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=h(()=>{i(!0)},"m"),e[7]=g):g=e[7];let w=g,a;return e[8]!==c||e[9]!==u||e[10]!==t.key||e[11]!==l?(a=(0,o.jsx)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:u&&l!==null&&!c?(0,o.jsx)("img",{alt:t.key,className:"size-full object-cover",loading:"lazy",onError:w,src:l}):(0,o.jsx)(Et,{})}),e[8]=c,e[9]=u,e[10]=t.key,e[11]=l,e[12]=a):a=e[12],a},"Bt"),It=h(d=>{let e=(0,B.c)(42),{busy:t,copiedKey:r,handlers:l,object:n,prefix:c,references:i,resolveUrl:s,selected:u,showReferences:m,t:f}=d,g;e[0]!==l||e[1]!==n||e[2]!==c?(g=Ae(n,c,l),e[0]=l,e[1]=n,e[2]=c,e[3]=g):g=e[3];let{copy:w,download:a,name:k,remove:S,toggle:x}=g,b;e[4]!==n||e[5]!==s?(b=(0,o.jsx)(Lt,{object:n,resolveUrl:s}),e[4]=n,e[5]=s,e[6]=b):b=e[6];let y;e[7]!==n.key||e[8]!==u||e[9]!==f||e[10]!==x?(y=(0,o.jsx)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,o.jsx)(Ze,{objectKey:n.key,onToggle:x,selected:u,t:f})}),e[7]=n.key,e[8]=u,e[9]=f,e[10]=x,e[11]=y):y=e[11];let v;e[12]!==b||e[13]!==y?(v=(0,o.jsxs)("div",{className:"relative",children:[b,y]}),e[12]=b,e[13]=y,e[14]=v):v=e[14];let j;e[15]!==k?(j=(0,o.jsx)("p",{className:"truncate font-mono text-xs",title:k,children:k}),e[15]=k,e[16]=j):j=e[16];let N;e[17]!==n.size?(N=xe(n.size),e[17]=n.size,e[18]=N):N=e[18];let C;e[19]!==N?(C=(0,o.jsx)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:N}),e[19]=N,e[20]=C):C=e[20];let T;e[21]!==n.key||e[22]!==i||e[23]!==m||e[24]!==f?(T=m&&(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)(He,{objectKey:n.key,references:i,t:f})}),e[21]=n.key,e[22]=i,e[23]=m,e[24]=f,e[25]=T):T=e[25];let D;e[26]!==j||e[27]!==C||e[28]!==T?(D=(0,o.jsxs)("div",{className:"min-w-0",children:[j,C,T]}),e[26]=j,e[27]=C,e[28]=T,e[29]=D):D=e[29];let F=r===n.key,$;e[30]!==t||e[31]!==w||e[32]!==a||e[33]!==n.key||e[34]!==S||e[35]!==f||e[36]!==F?($=(0,o.jsx)("div",{className:"flex items-center gap-1",children:(0,o.jsx)(We,{busy:t,buttonClassName:"h-7 px-2 text-xs",copied:F,objectKey:n.key,onCopy:w,onDelete:S,onDownload:a,t:f})}),e[30]=t,e[31]=w,e[32]=a,e[33]=n.key,e[34]=S,e[35]=f,e[36]=F,e[37]=$):$=e[37];let O;return e[38]!==$||e[39]!==v||e[40]!==D?(O=(0,o.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[v,D,$]}),e[38]=$,e[39]=v,e[40]=D,e[41]=O):O=e[41],O},"Lt"),Rt=h(d=>{let e=(0,B.c)(9),{name:t,onEnter:r}=d,l;e[0]!==t||e[1]!==r?(l=h(()=>{r(t)},"n"),e[0]=t,e[1]=r,e[2]=l):l=e[2];let n=l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,o.jsx)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,o.jsx)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})})}),e[3]=c):c=e[3];let i;e[4]!==t?(i=(0,o.jsx)("span",{className:"truncate font-mono text-xs",title:t,children:t}),e[4]=t,e[5]=i):i=e[5];let s;return e[6]!==n||e[7]!==i?(s=(0,o.jsxs)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:n,type:"button",children:[c,i]}),e[6]=n,e[7]=i,e[8]=s):s=e[8],s},"It"),_t=h(d=>{let e=(0,B.c)(34),{busy:t,copiedKey:r,files:l,folders:n,handlers:c,onEnterFolder:i,prefix:s,references:u,resolveUrl:m,selected:f,showReferences:g,size:w,t:a}=d,k;e[0]!==w?(k=w.toString(),e[0]=w,e[1]=k):k=e[1];let S=`repeat(auto-fill, minmax(${k}px, 1fr))`,x;e[2]!==S?(x={gridTemplateColumns:S},e[2]=S,e[3]=x):x=e[3];let b=x,y;if(e[4]!==n||e[5]!==i){let N;e[7]!==i?(N=h(C=>(0,o.jsx)(Rt,{name:C,onEnter:i},C),"w"),e[7]=i,e[8]=N):N=e[8],y=n.map(N),e[4]=n,e[5]=i,e[6]=y}else y=e[6];let v;if(e[9]!==t||e[10]!==r||e[11]!==l||e[12]!==c||e[13]!==s||e[14]!==u||e[15]!==m||e[16]!==f||e[17]!==g||e[18]!==a){let N;e[20]!==t||e[21]!==r||e[22]!==c||e[23]!==s||e[24]!==u||e[25]!==m||e[26]!==f||e[27]!==g||e[28]!==a?(N=h(C=>(0,o.jsx)(It,{busy:t,copiedKey:r,handlers:c,object:C,prefix:s,references:u[C.key],resolveUrl:m,selected:f.has(C.key),showReferences:g,t:a},C.key),"w"),e[20]=t,e[21]=r,e[22]=c,e[23]=s,e[24]=u,e[25]=m,e[26]=f,e[27]=g,e[28]=a,e[29]=N):N=e[29],v=l.map(N),e[9]=t,e[10]=r,e[11]=l,e[12]=c,e[13]=s,e[14]=u,e[15]=m,e[16]=f,e[17]=g,e[18]=a,e[19]=v}else v=e[19];let j;return e[30]!==b||e[31]!==y||e[32]!==v?(j=(0,o.jsxs)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[y,v]}),e[30]=b,e[31]=y,e[32]=v,e[33]=j):j=e[33],j},"Ot"),Ut=h(d=>{let e=(0,B.c)(23),{reference:t,t:r}=d,l=`fb-dangling-${t.table}-${t.id}-${t.column}`,n=`${t.table}\xB7${t.id}`,c;e[0]!==n?(c=(0,o.jsx)(ae,{variant:"secondary",children:n}),e[0]=n,e[1]=c):c=e[1];let i;e[2]!==t.column?(i=(0,o.jsx)("span",{className:"text-muted-foreground",children:t.column}),e[2]=t.column,e[3]=i):i=e[3];let s;e[4]!==r?(s=r("\u2192"),e[4]=r,e[5]=s):s=e[5];let u;e[6]!==s?(u=(0,o.jsx)("span",{className:"text-muted-foreground/60",children:s}),e[6]=s,e[7]=u):u=e[7];let m;e[8]!==t.key?(m=(0,o.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:t.key}),e[8]=t.key,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==i||e[12]!==u||e[13]!==m?(f=(0,o.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[c,i,u,m]}),e[10]=c,e[11]=i,e[12]=u,e[13]=m,e[14]=f):f=e[14];let g;e[15]!==r?(g=r("Missing object"),e[15]=r,e[16]=g):g=e[16];let w;e[17]!==g?(w=(0,o.jsx)(ae,{className:"border-destructive/40 text-destructive",variant:"outline",children:g}),e[17]=g,e[18]=w):w=e[18];let a;return e[19]!==l||e[20]!==w||e[21]!==f?(a=(0,o.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":l,children:[f,w]}),e[19]=l,e[20]=w,e[21]=f,e[22]=a):a=e[22],a},"At"),Mt=h(d=>{let e=(0,B.c)(42),{busy:t,onCheck:r,references:l,t:n,truncated:c}=d,i;e[0]!==n?(i=n("Integrity"),e[0]=n,e[1]=i):i=e[1];let s;e[2]!==i?(s=(0,o.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[2]=i,e[3]=s):s=e[3];let u;e[4]!==n?(u=n("Orphaned objects"),e[4]=n,e[5]=u):u=e[5];let m;e[6]!==u?(m=(0,o.jsx)("span",{className:"text-sm font-medium text-foreground",children:u}),e[6]=u,e[7]=m):m=e[7];let f;e[8]!==n?(f=n("Find records whose file reference points at an object the bucket no longer has."),e[8]=n,e[9]=f):f=e[9];let g;e[10]!==f?(g=(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[10]=f,e[11]=g):g=e[11];let w;e[12]!==s||e[13]!==m||e[14]!==g?(w=(0,o.jsxs)("div",{className:"flex flex-col gap-1",children:[s,m,g]}),e[12]=s,e[13]=m,e[14]=g,e[15]=w):w=e[15];let a;e[16]!==t||e[17]!==n?(a=n(t?"Checking\u2026":"Check for orphans"),e[16]=t,e[17]=n,e[18]=a):a=e[18];let k;e[19]!==t||e[20]!==r||e[21]!==a?(k=(0,o.jsx)(ee,{"data-testid":"fb-orphans-check",disabled:t,onClick:r,size:"sm",type:"button",variant:"outline",children:a}),e[19]=t,e[20]=r,e[21]=a,e[22]=k):k=e[22];let S;e[23]!==w||e[24]!==k?(S=(0,o.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[w,k]}),e[23]=w,e[24]=k,e[25]=S):S=e[25];let x;e[26]!==l||e[27]!==n||e[28]!==c?(x=c&&(0,o.jsx)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:l===void 0||l.length===0?n("The bucket is larger than the scan's key limit, so dangling references could not be checked."):n("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:l.length})}),e[26]=l,e[27]=n,e[28]=c,e[29]=x):x=e[29];let b;e[30]!==l?.length||e[31]!==n||e[32]!==c?(b=l?.length===0&&!c&&(0,o.jsx)(pe,{description:n("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:n("No dangling references.")}),e[30]=l?.length,e[31]=n,e[32]=c,e[33]=b):b=e[33];let y;e[34]!==l||e[35]!==n?(y=l!==void 0&&l.length>0&&(0,o.jsx)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:l.map(j=>(0,o.jsx)(Ut,{reference:j,t:n},`${j.table}\xB7${j.id}\xB7${j.column}`))}),e[34]=l,e[35]=n,e[36]=y):y=e[36];let v;return e[37]!==S||e[38]!==x||e[39]!==b||e[40]!==y?(v=(0,o.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[S,x,b,y]}),e[37]=S,e[38]=x,e[39]=b,e[40]=y,e[41]=v):v=e[41],v},"Ut"),Bt=h(function(d,e){let t=(0,B.c)(18),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,t[0]=r):r=t[0];let[l,n]=(0,z.useState)(r),c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=h(x=>{n(b=>{let y=new Set(b);return y.has(x)?y.delete(x):y.add(x),y})},"a"),t[1]=c):c=t[1];let i=c,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=h(()=>{n(new Set)},"o"),t[2]=s):s=t[2];let u=s,m,f,g;if(t[3]!==d||t[4]!==e||t[5]!==l){let x;t[9]!==e?(x=h(b=>e(b),"y"),t[9]=e,t[10]=x):x=t[10],f=d.map(x),m=f.length>0&&f.every(b=>l.has(b)),g=!m&&f.some(b=>l.has(b)),t[3]=d,t[4]=e,t[5]=l,t[6]=m,t[7]=f,t[8]=g}else m=t[6],f=t[7],g=t[8];let w=g,a;t[11]!==f?(a=h(()=>{n(x=>f.every(b=>x.has(b))?new Set:new Set(f))},"i"),t[11]=f,t[12]=a):a=t[12];let k=a,S;return t[13]!==m||t[14]!==l||t[15]!==w||t[16]!==k?(S={allSelected:m,clear:u,selected:l,someSelected:w,toggle:i,toggleAll:k},t[13]=m,t[14]=l,t[15]=w,t[16]=k,t[17]=S):S=t[17],S},"Mt"),Pt=be(ve.storageReferences),At=be(ve.storageOrphans),Be=1e4,Wt=1e3,Ht=h(async d=>{let e=[],t,r=!0,l=!1;for(;r&&e.length<Be;){let n=await d.list({cursor:t,limit:Wt}),c=Be-e.length;for(let i of n.objects.slice(0,c))e.push(i.key);l||=n.objects.length>c,t=n.cursor,r=t!==void 0}return{liveKeys:e,truncated:l||r}},"qt"),Zt=3600,qt=h((d,e)=>{if(!("document"in globalThis))return;let t=globalThis.document.createElement("a");t.href=d,t.download=e,t.rel="noopener",globalThis.document.body.append(t),t.click(),t.remove()},"Vt"),Gt=h(d=>d.key,"Zt"),Vt=h(({initialPrefix:d,pageSize:e})=>{let t=Ke(),[r,l]=(0,z.useState)(d??""),[n,c]=(0,z.useState)(d??""),[i,s]=(0,z.useState)(Ct),[u,m]=(0,z.useState)("list"),[f,g]=(0,z.useState)(128),[w,a]=(0,z.useState)("name"),[k,S]=(0,z.useState)("asc"),[x,b]=(0,z.useState)(void 0),[y,v]=(0,z.useState)(void 0),[j,N]=(0,z.useState)(!1),[C,T]=(0,z.useState)(void 0),[D,F]=(0,z.useState)(void 0),[$,O]=(0,z.useState)(""),[R,L]=(0,z.useState)({}),[_,E]=(0,z.useState)(!1),[I,M]=(0,z.useState)(void 0),[P,W]=(0,z.useState)(!1),[A,H]=(0,z.useState)(!1),[V,re]=(0,z.useState)([]),[q,we]=(0,z.useState)(""),ne=(0,z.useRef)(0),Q=(0,z.useRef)(0),ce=(0,z.useRef)(0);(0,z.useEffect)(()=>{let p={cancelled:!1};return Z((async()=>{try{let K=await t.listStorageBuckets();if(!p.cancelled){re(K);let[U]=K;U!==void 0&&we(J=>J===""?U:J)}}catch{}})()),()=>{p.cancelled=!0}},[t]);let G=(0,z.useMemo)(()=>({list:h(p=>t.listStorageObjects({...p,bucket:q}),"list"),remove:h(p=>t.deleteStorageObject(p,{bucket:q}),"remove"),signedUrl:h((p,K)=>t.signedStorageUrl(p,{...K,bucket:q}),"signedUrl"),upload:h(p=>t.uploadStorageObject({...p,bucket:q}),"upload")}),[q,t]),Y=(0,z.useCallback)(async(p,K,U,J=!1)=>{ne.current+=1;let me=ne.current;v(void 0),N(!0);try{let oe=await G.list({cursor:K,limit:e,prefix:p});if(me!==ne.current)return;b(Ce=>U&&Ce!==void 0?[...Ce,...oe.objects]:oe.objects),F(oe.cursor)}catch(oe){if(me!==ne.current)return;if(U||b(void 0),v(le(oe)),J)throw oe}finally{me===ne.current&&N(!1)}},[e,G]);(0,z.useEffect)(()=>{Z(Y(d??"",void 0,!1))},[Y,d]);let qe=(x?.length??0)<=e;Re(()=>Y(r,void 0,!1,!0),qe);let{files:ue,folders:Ge}=zt(x??[],r),Ve=(0,z.useMemo)(()=>{let p=new Set;for(let K of ue)for(let U of Object.keys(K.customMetadata??{}))p.add(U);return[...p].toSorted((K,U)=>K.localeCompare(U))},[ue]),ie=jt(ue,w,k),fe=(0,z.useMemo)(()=>[...new Set(ie.map(p=>p.key))].toSorted((p,K)=>p.localeCompare(K)).join(`
|
|
3
|
+
`),[ie]);(0,z.useEffect)(()=>{let p=fe===""?[]:fe.split(`
|
|
4
|
+
`);if(p.length===0){L({});return}let K={current:!0};return Z((async()=>{try{let U=await t.query(Pt,{keys:p},ye($));K.current&&(L(U.references??{}),E(Object.keys(U.storageColumns??{}).length>0))}catch{K.current&&(L({}),E(!1))}})()),()=>{K.current=!1}},[t,fe,$]);let{allSelected:Qe,clear:se,selected:Se,someSelected:Xe,toggle:Ye,toggleAll:Je}=Bt(ie,Gt),et=h(()=>{l(n),se(),Z(Y(n,void 0,!1))},"Me"),tt=h(()=>{Z(Y(r,D,!0))},"Ge"),Ne=h(p=>{l(p),c(p),se(),Z(Y(p,void 0,!1))},"ve"),rt=h(p=>{Ne(`${r}${p}`)},"He"),nt=h(p=>G.signedUrl(p,{expiresInSeconds:Zt}),"Pe"),ot=h(()=>{m("list")},"qe"),lt=h(()=>{m("grid")},"We"),st=h(p=>{a(p)},"Ve"),at=h(()=>{S(p=>p==="asc"?"desc":"asc")},"Ze"),ct=h(p=>{g(p)},"Xe"),it=h(p=>{s(p)},"Ye"),he=h(p=>{let K=ce.current;v(void 0),N(!0),Z((async()=>{try{await p(),K===ce.current&&await Y(r,void 0,!1)}catch(U){v(le(U))}K===ce.current&&N(!1)})())},"me"),dt=h(()=>{he(async()=>{for(let p of Se)await G.remove(p);se()})},"Je"),ut=h(p=>{v(void 0),Z((async()=>{try{let K=await G.signedUrl(p,{expiresInSeconds:i});$e(K)&&T(p)}catch(K){v(le(K))}})())},"Qe"),ft=h(p=>{v(void 0),Z((async()=>{try{let K=await G.signedUrl(p,{expiresInSeconds:i}),U=p.slice(p.lastIndexOf("/")+1)||p;qt(K,U)}catch(K){v(le(K))}})())},"et");(0,z.useEffect)(()=>{if(C===void 0)return;let p=globalThis.setTimeout(()=>{T(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[C]);let ht=h(p=>{he(async()=>{await G.remove(p)})},"tt"),mt=h(p=>{let K=`${r}${p.name}`;he(async()=>{let U=await p.arrayBuffer();await G.upload({body:U,contentType:p.type===""?void 0:p.type,key:K})})},"st");(0,z.useEffect)(()=>{Q.current+=1,M(void 0),H(!1)},[$]);let gt=h(()=>{Q.current+=1;let p=Q.current;v(void 0),W(!0),Z((async()=>{try{let{liveKeys:K,truncated:U}=await Ht(G);if(U)p===Q.current&&(M(void 0),H(!0));else{let J=await t.query(At,{liveKeys:K},ye($));p===Q.current&&(M(J.references??[]),H(J.truncated===!0))}}catch(K){p===Q.current&&(M(void 0),H(!1),v(le(K)))}p===Q.current&&W(!1)})())},"lt"),pt=h(p=>{ne.current+=1,Q.current+=1,ce.current+=1,we(p),l(d??""),c(d??""),b(void 0),M(void 0),H(!1),se()},"nt");return{allSelected:Qe,bucket:q,buckets:V,bulkDelete:dt,busy:j,checkOrphans:gt,clearSelection:se,copiedKey:C,danglingBusy:P,danglingReferences:I,danglingTruncated:A,draftPrefix:n,enterFolder:rt,error:y,expiry:i,files:ie,folders:Ge,hasObjects:x!==void 0&&x.length>0,hasStorageColumns:_,listFirst:et,loaded:x!==void 0,loadMore:tt,navigate:Ne,nextCursor:D,onCopy:ut,onDelete:ht,onDownload:ft,onExpiryChange:it,onFile:mt,onSortKeyChange:st,onThumbSizeChange:ct,prefix:r,referenceShard:$,references:R,resolveUrl:nt,selectBucket:pt,selected:Se,setDraftPrefix:c,setReferenceShard:O,showGrid:lt,showList:ot,someSelected:Xe,sortDirection:k,sortKey:w,tagKeys:Ve,thumbSize:f,toggleSelect:Ye,toggleSelectAll:Je,toggleSortDirection:at,view:u}},"Xt"),Qt=100,Pe=h(d=>{let e=(0,B.c)(6),{label:t,onNavigate:r,target:l}=d,n;e[0]!==r||e[1]!==l?(n=h(()=>{r(l)},"l"),e[0]=r,e[1]=l,e[2]=n):n=e[2];let c=n,i;return e[3]!==c||e[4]!==t?(i=(0,o.jsx)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:c,type:"button",children:t}),e[3]=c,e[4]=t,e[5]=i):i=e[5],i},"Ne"),Xt=h(d=>{let e=(0,B.c)(11),{onNavigate:t,prefix:r,t:l}=d,n;if(e[0]!==t||e[1]!==r||e[2]!==l){let c=r.split("/").filter(Yt),i;e[4]!==l?(i=l("Folder path"),e[4]=l,e[5]=i):i=e[5];let s;e[6]!==l?(s=l("root"),e[6]=l,e[7]=s):s=e[7];let u;e[8]!==t||e[9]!==s?(u=(0,o.jsx)(Pe,{label:s,onNavigate:t,target:""}),e[8]=t,e[9]=s,e[10]=u):u=e[10],n=(0,o.jsxs)("nav",{"aria-label":i,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[u,c.map((m,f)=>(0,o.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,o.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,o.jsx)(Pe,{label:m,onNavigate:t,target:`${c.slice(0,f+1).join("/")}/`})]},`${m}-${f.toString()}`))]}),e[0]=t,e[1]=r,e[2]=l,e[3]=n}else n=e[3];return n},"Jt"),gr=h(({initialPrefix:d,pageSize:e=Qt})=>{let t=je(),r=Vt({initialPrefix:d,pageSize:e}),l=(0,z.useRef)(null),{onCopy:n,onDelete:c,onDownload:i,onFile:s,toggleSelect:u}=r,m={onCopy:n,onDelete:c,onDownload:i,onToggleSelect:u},f=h(()=>{l.current?.click()},"u"),g=h(a=>{let k=a.target,S=k.files?.[0];k.value="",S&&s(S)},"m"),w=r.loaded&&!r.hasObjects;return(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,o.jsx)(Dt,{bucket:r.bucket,buckets:r.buckets,busy:r.busy,draftPrefix:r.draftPrefix,expiry:r.expiry,fileInputRef:l,onBucketChange:r.selectBucket,onExpiryChange:r.onExpiryChange,onFileChange:g,onList:r.listFirst,onPrefixChange:r.setDraftPrefix,onUploadClick:f,t}),r.loaded&&(0,o.jsx)(Xt,{onNavigate:r.navigate,prefix:r.prefix,t}),r.hasObjects&&(0,o.jsx)(Tt,{onSortKeyChange:r.onSortKeyChange,onThumbSizeChange:r.onThumbSizeChange,showGrid:r.showGrid,showList:r.showList,sortDirection:r.sortDirection,sortKey:r.sortKey,t,tagKeys:r.tagKeys,thumbSize:r.thumbSize,toggleSortDirection:r.toggleSortDirection,view:r.view}),r.hasStorageColumns&&(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,o.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:t("References shard")}),(0,o.jsx)(Fe,{id:"fb-reference-shard-input",onChange:r.setReferenceShard,testId:"fb-reference-shard-input",value:r.referenceShard}),(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:t("Which shard's records are checked for references to these files. Empty = root shard.")})]}),r.hasStorageColumns&&(0,o.jsx)(Mt,{busy:r.danglingBusy,onCheck:r.checkOrphans,references:r.danglingReferences,t,truncated:r.danglingTruncated}),r.selected.size>0&&(0,o.jsx)(_e,{count:r.selected.size,editable:!0,onClear:r.clearSelection,onDelete:r.bulkDelete}),r.error!==void 0&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:r.error}),w&&(0,o.jsx)(pe,{description:t("Objects you upload to your R2 buckets will appear here."),icon:(0,o.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,o.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"}),(0,o.jsx)("path",{d:"M12 11v5m-2.5-2.5h5"})]}),testId:"fb-empty",title:t("No objects.")}),r.hasObjects&&r.view==="list"&&(0,o.jsx)(St,{allSelected:r.allSelected,busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:m,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,selected:r.selected,showReferences:r.hasStorageColumns,someSelected:r.someSelected,t,toggleSelectAll:r.toggleSelectAll}),r.hasObjects&&r.view==="grid"&&(0,o.jsx)(_t,{busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:m,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,resolveUrl:r.resolveUrl,selected:r.selected,showReferences:r.hasStorageColumns,size:r.thumbSize,t}),r.nextCursor!==void 0&&(0,o.jsx)("div",{children:(0,o.jsx)(ee,{"data-testid":"fb-next",disabled:r.busy,onClick:r.loadMore,size:"sm",type:"button",variant:"outline",children:t("Load more")})})]})},"xs");function Yt(d){return d!==""}h(Yt,"Qt");export{gr as FileBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./chunk-4C4THJUD.js";import{a as r,d as i,e as p}from"./chunk-OXFKZ4BM.js";var a=i(p(),1);var R=a.forwardRef(r(function(e,n){let{className:l,render:m,orientation:t="horizontal",style:f,...s}=e;return o("div",e,{state:{orientation:t},ref:n,props:[{role:"separator","aria-orientation":t},s]})},"SeparatorComponent"));export{R as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as E,e as _}from"./chunk-VEWQWS3J.js";import{a as $}from"./chunk-Y74LIFSL.js";import{a as de}from"./chunk-XSHYZPGF.js";import"./chunk-O2NMPIV2.js";import{a as ce}from"./chunk-MWJC3S62.js";import"./chunk-IH2CJZF2.js";import"./chunk-SYGCASPT.js";import"./chunk-ZGSL4DPP.js";import{a as le}from"./chunk-5DNGK3NT.js";import{a as re}from"./chunk-XST3UEHU.js";import"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import"./chunk-ZBON5T5A.js";import{b as K}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as ie}from"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as J}from"./chunk-6UTZXEW3.js";import{c as H}from"./chunk-4DAKKAK7.js";import"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as ne}from"./chunk-XMSNLMWU.js";import{a as R,b as W,c as Z,d as A,e as M,f as S}from"./chunk-HHRYM6UW.js";import{a as q,b as D,c as U,e as oe}from"./chunk-JSDKOE4U.js";import{C as ae,l as F}from"./chunk-BFE2DRP6.js";import{a as p,d as se,f as be,g as ge}from"./chunk-OXFKZ4BM.js";var O=se(be(),1);var o=se(ge(),1);var G="gen_ai.usage.input_tokens",Q="gen_ai.usage.output_tokens",V="gen_ai.usage.cost",fe="gen_ai.request.model",Te="lunora.usage.cost.source",xe=new Set(["ai.embed","ai.generate","ai.stream"]),ue=6e4,Ce=1440,ve="unknown",X=p(()=>({calls:0,estimatedCost:0,inputTokens:0,outputTokens:0,providerCost:0}),"q"),Y=p((n,e)=>{let s=n?.[e];return typeof s=="string"&&s!==""?s:void 0},"J"),z=p((n,e)=>{let s=n?.[e];return typeof s=="number"&&Number.isFinite(s)?s:void 0},"L"),ee=p(n=>Y(n,Te)==="provider"?"provider":"estimated","Q"),me=p((n,e)=>n.reduce((s,a)=>s+e(a),0),"Y"),B=p(n=>n.providerCost+n.estimatedCost,"F"),ke=p(n=>n.estimatedCost>0?n.providerCost>0?"mixed":"estimated":n.providerCost>0?"provider":"none","ae"),ye=p((n,e)=>({calls:n.calls+e.calls,estimatedCost:n.estimatedCost+e.estimatedCost,inputTokens:n.inputTokens+e.inputTokens,outputTokens:n.outputTokens+e.outputTokens,providerCost:n.providerCost+e.providerCost}),"ce"),Ie=p(n=>{let e=X(),s=0,a=0,t=0;for(let c of n){let l=me(c.points,i=>i.sum),r=me(c.points,i=>i.count);c.name===G?(e.inputTokens+=l,s+=r):c.name===Q?(e.outputTokens+=l,a+=r):(t+=r,ee(c.attributes)==="provider"?e.providerCost+=l:e.estimatedCost+=l)}return e.calls=Math.max(s,a,t),e},"ge"),Ne=p((n,e)=>B(e)-B(n)||e.inputTokens+e.outputTokens-(n.inputTokens+n.outputTokens)||n.key.localeCompare(e.key),"Ne"),pe=p((n,e)=>{let s=new Map;for(let a of n){let t=e(a);s.set(t,{key:t,...ye(s.get(t)??X(),a)})}return[...s.values()].toSorted(Ne)},"Z"),we=p(n=>(n?.series??[]).filter(e=>e.name===G||e.name===Q||e.name===V),"xe"),Me=p(n=>Y(n.attributes,fe)??ve,"Se"),Se=p(n=>{let e=new Map;for(let s of n){let a=Me(s),t=JSON.stringify([s.functionPath,a]),c=e.get(t)??{functionPath:s.functionPath,model:a,series:[]};c.series.push(s),e.set(t,c)}return[...e.values()].map(({functionPath:s,model:a,series:t})=>({functionPath:s,model:a,...Ie(t)}))},"Ie"),_e=p(n=>{let e=new Map;for(let r of n){if(r.name!==V)continue;let i=ee(r.attributes)==="provider";for(let u of r.points){let m=e.get(u.bucketMs)??{bucketMs:u.bucketMs,estimatedCost:0,providerCost:0};i?m.providerCost+=u.sum:m.estimatedCost+=u.sum,e.set(u.bucketMs,m)}}let s=[...e.keys()].toSorted((r,i)=>r-i),a=s[0],t=s.at(-1);if(a===void 0||t===void 0)return[];let c=Math.max(a,t-(Ce-1)*ue),l=[];for(let r=c;r<=t;r+=ue)l.push(e.get(r)??{bucketMs:r,estimatedCost:0,providerCost:0});return l},"_e"),Pe=p(n=>{let e=[];for(let s of n)for(let a of s.spans){if(!xe.has(a.name))continue;let{attributes:t}=a,c=z(t,V),l=z(t,G),r=z(t,Q);e.push({...c===void 0?{}:{cost:c,costSource:ee(t)},functionPath:s.functionPath,...l===void 0?{}:{inputTokens:l},model:Y(t,fe)??ve,ok:a.ok,...r===void 0?{}:{outputTokens:r},startTs:s.startTs+a.offsetMs,streaming:a.name==="ai.stream",traceId:s.traceId})}return e.toSorted((s,a)=>a.startTs-s.startTs)},"Me"),Fe=p(n=>n.map(e=>{let s=e.cost??0;return{calls:1,estimatedCost:e.costSource==="provider"?0:s,functionPath:e.functionPath,inputTokens:e.inputTokens??0,model:e.model,outputTokens:e.outputTokens??0,providerCost:e.costSource==="provider"?s:0}}),"Oe"),Oe=p((n,e)=>{let s=we(n),a=Pe(e),t=s.length>0,c=t?Se(s):Fe(a),l=X(),r="none";for(let i of c)l=ye(l,i);return t?r="history":a.length>0&&(r="live"),{byFunction:pe(c,i=>i.functionPath),byModel:pe(c,i=>i.model),calls:a,source:r,totals:l,trend:t?_e(s):[]}},"Ae"),Ke=p(n=>Array.isArray(n?.traces)?n.traces:[],"Ee"),Ae=25,te=p(n=>{let e=(0,O.c)(16),{provenance:s,value:a}=n,t=F();if(s==="none"){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=(0,o.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=m):m=e[0],m}let c;e[1]!==s||e[2]!==a?(c=s==="provider"?E(a):`~${E(a)}`,e[1]=s,e[2]=a,e[3]=c):c=e[3];let l;e[4]!==c?(l=(0,o.jsx)("span",{className:"tabular-nums",children:c}),e[4]=c,e[5]=l):l=e[5];let r;e[6]!==s||e[7]!==t?(r=s==="estimated"?(0,o.jsx)(K,{title:t("Derived from a price table, not reported by the provider."),variant:"warning",children:t("Estimated")}):null,e[6]=s,e[7]=t,e[8]=r):r=e[8];let i;e[9]!==s||e[10]!==t?(i=s==="mixed"?(0,o.jsx)(K,{title:t("Includes cost derived from a price table, not reported by the provider."),variant:"warning",children:t("Partly estimated")}):null,e[9]=s,e[10]=t,e[11]=i):i=e[11];let u;return e[12]!==l||e[13]!==r||e[14]!==i?(u=(0,o.jsxs)("span",{className:"inline-flex items-center gap-2",children:[l,r,i]}),e[12]=l,e[13]=r,e[14]=i,e[15]=u):u=e[15],u},"V"),he=p(n=>{let e=(0,O.c)(40),{keyLabel:s,rows:a,testId:t,title:c}=n,l=F(),r;e[0]!==c?(r=(0,o.jsx)(D,{className:"px-4 py-3",children:(0,o.jsx)(U,{children:c})}),e[0]=c,e[1]=r):r=e[1];let i;e[2]!==s?(i=(0,o.jsx)(M,{children:s}),e[2]=s,e[3]=i):i=e[3];let u;e[4]!==l?(u=l("Calls"),e[4]=l,e[5]=u):u=e[5];let m;e[6]!==u?(m=(0,o.jsx)(M,{className:"text-end",children:u}),e[6]=u,e[7]=m):m=e[7];let k;e[8]!==l?(k=l("Input tokens"),e[8]=l,e[9]=k):k=e[9];let y;e[10]!==k?(y=(0,o.jsx)(M,{className:"text-end",children:k}),e[10]=k,e[11]=y):y=e[11];let b;e[12]!==l?(b=l("Output tokens"),e[12]=l,e[13]=b):b=e[13];let T;e[14]!==b?(T=(0,o.jsx)(M,{className:"text-end",children:b}),e[14]=b,e[15]=T):T=e[15];let g;e[16]!==l?(g=l("Cost"),e[16]=l,e[17]=g):g=e[17];let d;e[18]!==g?(d=(0,o.jsx)(M,{className:"text-end",children:g}),e[18]=g,e[19]=d):d=e[19];let x;e[20]!==d||e[21]!==i||e[22]!==m||e[23]!==y||e[24]!==T?(x=(0,o.jsx)(W,{children:(0,o.jsxs)(A,{children:[i,m,y,T,d]})}),e[20]=d,e[21]=i,e[22]=m,e[23]=y,e[24]=T,e[25]=x):x=e[25];let h;if(e[26]!==a||e[27]!==t){let N;e[29]!==t?(N=p(w=>(0,o.jsxs)(A,{"data-testid":`${t}-row`,children:[(0,o.jsx)(S,{className:"max-w-[280px] truncate font-mono",title:w.key,children:w.key}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.calls)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.inputTokens)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:_(w.outputTokens)}),(0,o.jsx)(S,{className:"text-end",children:(0,o.jsx)(te,{provenance:ke(w),value:B(w)})})]},w.key),"x"),e[29]=t,e[30]=N):N=e[30],h=a.map(N),e[26]=a,e[27]=t,e[28]=h}else h=e[28];let f;e[31]!==h?(f=(0,o.jsx)(Z,{children:h}),e[31]=h,e[32]=f):f=e[32];let v;e[33]!==x||e[34]!==f?(v=(0,o.jsxs)(R,{children:[x,f]}),e[33]=x,e[34]=f,e[35]=v):v=e[35];let C;return e[36]!==r||e[37]!==v||e[38]!==t?(C=(0,o.jsxs)(q,{className:"gap-0 py-0","data-testid":t,children:[r,v]}),e[36]=r,e[37]=v,e[38]=t,e[39]=C):C=e[39],C},"ee"),$e=p(n=>{let e=(0,O.c)(55),{calls:s,onOpenTrace:a}=n,t=F(),c;e[0]!==t?(c=t("Recent calls"),e[0]=t,e[1]=c):c=e[1];let l;e[2]!==c?(l=(0,o.jsx)(D,{className:"px-4 py-3",children:(0,o.jsx)(U,{children:c})}),e[2]=c,e[3]=l):l=e[3];let r;e[4]!==t?(r=t("When"),e[4]=t,e[5]=r):r=e[5];let i;e[6]!==r?(i=(0,o.jsx)(M,{children:r}),e[6]=r,e[7]=i):i=e[7];let u;e[8]!==t?(u=t("Function"),e[8]=t,e[9]=u):u=e[9];let m;e[10]!==u?(m=(0,o.jsx)(M,{children:u}),e[10]=u,e[11]=m):m=e[11];let k;e[12]!==t?(k=t("Model"),e[12]=t,e[13]=k):k=e[13];let y;e[14]!==k?(y=(0,o.jsx)(M,{children:k}),e[14]=k,e[15]=y):y=e[15];let b;e[16]!==t?(b=t("Input tokens"),e[16]=t,e[17]=b):b=e[17];let T;e[18]!==b?(T=(0,o.jsx)(M,{className:"text-end",children:b}),e[18]=b,e[19]=T):T=e[19];let g;e[20]!==t?(g=t("Output tokens"),e[20]=t,e[21]=g):g=e[21];let d;e[22]!==g?(d=(0,o.jsx)(M,{className:"text-end",children:g}),e[22]=g,e[23]=d):d=e[23];let x;e[24]!==t?(x=t("Cost"),e[24]=t,e[25]=x):x=e[25];let h;e[26]!==x?(h=(0,o.jsx)(M,{className:"text-end",children:x}),e[26]=x,e[27]=h):h=e[27];let f;e[28]!==t?(f=t("Trace"),e[28]=t,e[29]=f):f=e[29];let v;e[30]!==f?(v=(0,o.jsx)(M,{children:f}),e[30]=f,e[31]=v):v=e[31];let C;e[32]!==T||e[33]!==d||e[34]!==h||e[35]!==v||e[36]!==i||e[37]!==m||e[38]!==y?(C=(0,o.jsx)(W,{children:(0,o.jsxs)(A,{children:[i,m,y,T,d,h,v]})}),e[32]=T,e[33]=d,e[34]=h,e[35]=v,e[36]=i,e[37]=m,e[38]=y,e[39]=C):C=e[39];let N;if(e[40]!==s||e[41]!==a||e[42]!==t){let j;e[44]!==a||e[45]!==t?(j=p(I=>(0,o.jsxs)(A,{"data-testid":"ai-call",children:[(0,o.jsx)(S,{className:"font-mono text-muted-foreground",children:ae(I.startTs)}),(0,o.jsx)(S,{className:"font-mono",children:(0,o.jsxs)("span",{className:"inline-flex items-center gap-2",children:[I.functionPath,I.streaming?(0,o.jsx)(K,{variant:"outline",children:t("stream")}):null,I.ok?null:(0,o.jsx)(K,{variant:"destructive",children:t("failed")})]})}),(0,o.jsx)(S,{className:"max-w-[240px] truncate font-mono",title:I.model,children:I.model}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:I.inputTokens===void 0?"\u2014":_(I.inputTokens)}),(0,o.jsx)(S,{className:"text-end tabular-nums",children:I.outputTokens===void 0?"\u2014":_(I.outputTokens)}),(0,o.jsx)(S,{className:"text-end",children:(0,o.jsx)(te,{provenance:I.cost===void 0?"none":I.costSource??"estimated",value:I.cost??0})}),(0,o.jsx)(S,{children:(0,o.jsx)("button",{className:"font-mono text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{a(I.traceId)},"onClick"),title:t("Open the trace {trace}",{trace:I.traceId}),type:"button",children:I.traceId.slice(0,8)})})]},`${I.traceId}:${I.startTs.toString()}:${I.model}`),"U"),e[44]=a,e[45]=t,e[46]=j):j=e[46],N=s.slice(0,Ae).map(j),e[40]=s,e[41]=a,e[42]=t,e[43]=N}else N=e[43];let w;e[47]!==N?(w=(0,o.jsx)(Z,{children:N}),e[47]=N,e[48]=w):w=e[48];let P;e[49]!==C||e[50]!==w?(P=(0,o.jsxs)(R,{children:[C,w]}),e[49]=C,e[50]=w,e[51]=P):P=e[51];let L;return e[52]!==l||e[53]!==P?(L=(0,o.jsxs)(q,{className:"gap-0 py-0","data-testid":"ai-calls",children:[l,P]}),e[52]=l,e[53]=P,e[54]=L):L=e[54],L},"Pe"),Ee=p(n=>{let e=(0,O.c)(48),{totals:s,trend:a}=n,t=F(),c;e[0]!==s?(c=ke(s),e[0]=s,e[1]=c):c=e[1];let l=c,r;e[2]!==t||e[3]!==a?(r=a.length>=2?(0,o.jsx)(de,{ariaLabel:t("Cost per minute"),className:"h-7 w-24",series:a,testId:"ai-trend"}):void 0,e[2]=t,e[3]=a,e[4]=r):r=e[4];let i;e[5]!==l||e[6]!==t||e[7]!==s.estimatedCost||e[8]!==s.providerCost?(i=l==="none"?t("No cost reported"):(0,o.jsx)("span",{"data-testid":"ai-cost-split",children:t("{provider} provider-reported \xB7 {estimated} estimated",{estimated:E(s.estimatedCost),provider:E(s.providerCost)})}),e[5]=l,e[6]=t,e[7]=s.estimatedCost,e[8]=s.providerCost,e[9]=i):i=e[9];let u;e[10]!==t?(u=t("Total cost"),e[10]=t,e[11]=u):u=e[11];let m;e[12]!==s?(m=B(s),e[12]=s,e[13]=m):m=e[13];let k;e[14]!==l||e[15]!==m?(k=(0,o.jsx)(te,{provenance:l,value:m}),e[14]=l,e[15]=m,e[16]=k):k=e[16];let y;e[17]!==r||e[18]!==i||e[19]!==u||e[20]!==k?(y=(0,o.jsx)($,{chart:r,footer:i,label:u,testId:"ai-total-cost",value:k}),e[17]=r,e[18]=i,e[19]=u,e[20]=k,e[21]=y):y=e[21];let b;e[22]!==t?(b=t("Input tokens"),e[22]=t,e[23]=b):b=e[23];let T;e[24]!==s.inputTokens?(T=_(s.inputTokens),e[24]=s.inputTokens,e[25]=T):T=e[25];let g;e[26]!==b||e[27]!==T?(g=(0,o.jsx)($,{label:b,testId:"ai-input-tokens",value:T}),e[26]=b,e[27]=T,e[28]=g):g=e[28];let d;e[29]!==t?(d=t("Output tokens"),e[29]=t,e[30]=d):d=e[30];let x;e[31]!==s.outputTokens?(x=_(s.outputTokens),e[31]=s.outputTokens,e[32]=x):x=e[32];let h;e[33]!==d||e[34]!==x?(h=(0,o.jsx)($,{label:d,testId:"ai-output-tokens",value:x}),e[33]=d,e[34]=x,e[35]=h):h=e[35];let f;e[36]!==t?(f=t("Calls"),e[36]=t,e[37]=f):f=e[37];let v;e[38]!==s.calls?(v=_(s.calls),e[38]=s.calls,e[39]=v):v=e[39];let C;e[40]!==f||e[41]!==v?(C=(0,o.jsx)($,{label:f,testId:"ai-calls-total",value:v}),e[40]=f,e[41]=v,e[42]=C):C=e[42];let N;return e[43]!==g||e[44]!==h||e[45]!==C||e[46]!==y?(N=(0,o.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"ai-totals",children:[y,g,h,C]}),e[43]=g,e[44]=h,e[45]=C,e[46]=y,e[47]=N):N=e[47],N},"Ue"),Ye=p(n=>{let e=(0,O.c)(28),{initialShardKey:s}=n,a=F(),{queryShardKey:t,setShardKey:c,shardKey:l}=le(s),r=ce(t),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let u;e[1]!==t?(u={live:!0,shardKey:t},e[1]=t,e[2]=u):u=e[2];let{data:m,error:k}=H(J.getTraces,i,u),y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y={},e[3]=y):y=e[3];let b;e[4]!==t?(b={live:!0,shardKey:t},e[4]=t,e[5]=b):b=e[5];let{data:T}=H(J.getMetricHistory,y,b),g,d;e[6]!==m||e[7]!==T?(d=Oe(T,Ke(m)),g=d.trend.map(Le),e[6]=m,e[7]=T,e[8]=g,e[9]=d):(g=e[8],d=e[9]);let x=g,h;e[10]!==c||e[11]!==l?(h=(0,o.jsx)(re,{onChange:c,testId:"ai-shard-input",value:l}),e[10]=c,e[11]=l,e[12]=h):h=e[12];let f;e[13]!==k?(f=k===null?null:(0,o.jsx)(ie,{error:k,testId:"ai-error"}),e[13]=k,e[14]=f):f=e[14];let v;e[15]!==r||e[16]!==a||e[17]!==x||e[18]!==d.byFunction||e[19]!==d.byModel||e[20]!==d.calls||e[21]!==d.source||e[22]!==d.totals?(v=d.source==="none"?(0,o.jsx)(ne,{description:a("Spend shows up here once an action calls ctx.ai.model(...) \u2014 tokens and cost per function and per model."),testId:"ai-empty",title:a("No AI usage recorded")}):(0,o.jsxs)(o.Fragment,{children:[d.source==="live"?(0,o.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ai-live-only",children:a("No durable history yet \u2014 these totals come from the live trace ring and reset when the shard hibernates.")}):(0,o.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ai-window",children:a("Totals cover the retained metric history (up to the last 24 hours).")}),(0,o.jsx)(Ee,{totals:d.totals,trend:x}),(0,o.jsxs)("div",{className:"grid gap-3 xl:grid-cols-2",children:[(0,o.jsx)(he,{keyLabel:a("Function"),rows:d.byFunction,testId:"ai-by-function",title:a("By function")}),(0,o.jsx)(he,{keyLabel:a("Model"),rows:d.byModel,testId:"ai-by-model",title:a("By model")})]}),d.calls.length===0?(0,o.jsx)(q,{children:(0,o.jsx)(oe,{className:"p-4 text-xs text-muted-foreground","data-testid":"ai-no-calls",children:a("No recent calls in the live trace ring \u2014 it empties when the shard hibernates.")})}):(0,o.jsx)($e,{calls:d.calls,onOpenTrace:r})]}),e[15]=r,e[16]=a,e[17]=x,e[18]=d.byFunction,e[19]=d.byModel,e[20]=d.calls,e[21]=d.source,e[22]=d.totals,e[23]=v):v=e[23];let C;return e[24]!==h||e[25]!==f||e[26]!==v?(C=(0,o.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ai-panel",children:[h,f,v]}),e[24]=h,e[25]=f,e[26]=v,e[27]=C):C=e[27],C},"Ze");function Le(n){return n.providerCost+n.estimatedCost}p(Le,"Ke");export{Ye as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{a as de,b as ue,c as me,d as fe,e as pe}from"./chunk-TCYPNSTV.js";import"./chunk-A566HCBX.js";import{c as ce}from"./chunk-ONWGX5Y4.js";import"./chunk-YMEKCV27.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import"./chunk-TYD3V4NB.js";import{a as ae}from"./chunk-KZCEJFZF.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as se}from"./chunk-FXPAJDES.js";import{a as ie}from"./chunk-XST3UEHU.js";import{b as Y}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-ZTOREMGH.js";import"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as z}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as $}from"./chunk-6UTZXEW3.js";import{c as oe,d as le}from"./chunk-4DAKKAK7.js";import{c as R,d as re,m as ne}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as P,e as W}from"./chunk-JSDKOE4U.js";import{b as D,l as U,n as K,o as F,p as q,y as H}from"./chunk-BFE2DRP6.js";import{a as i,d as Z,e as Ke,f as Ae,g as Be}from"./chunk-OXFKZ4BM.js";var X=Z(Ae(),1);var j=Z(Ke(),1);var d=Z(Be(),1);var E=class extends Error{static{i(this,"_")}problem;constructor(e){super(e.kind),this.name="CsvFormatError",this.problem=e}},De="\uFEFF",Re=i(()=>{let t=[],e=1,r=!1,n=!1,o="start",l="",s=i(()=>{t.push(o==="closing"||l!==""?l:void 0),o="start",l=""},"i"),a=i(c=>{s(),t.some(m=>m!==void 0)&&c.push({cells:t,number:e}),t=[],e+=1},"l"),u=i((c,m)=>{let f=r;if(r=!1,!(f&&c===`
|
|
2
|
+
`)){if(o==="quoted"){c==='"'?o="closing":l+=c;return}if(o==="closing"&&c==='"'){l+=c,o="quoted";return}if(c===","){s();return}if(c==="\r"){a(m),r=!0;return}if(c===`
|
|
3
|
+
`){a(m);return}if(o==="closing")throw new E({kind:"text-after-quote",record:e});if(o==="start"&&c==='"'){o="quoted";return}o="unquoted",l+=c}},"c");return{finish:i(()=>{if(o==="quoted")throw new E({kind:"unterminated-quote",record:e});let c=[];return a(c),c},"finish"),push:i(c=>{let m=[],f=0;for(!n&&c!==""&&(n=!0,f=c.startsWith(De)?1:0);f<c.length;f+=1)u(c.charAt(f),m);return m},"push")}},"De"),ye=i(async function*(t){let e=Re();for await(let r of t)yield*e.push(r);yield*e.finish()},"ie"),M=i((t,e,r)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0})},"$"),ve=i(t=>{let e=[],r=new Set;return t.forEach((n,o)=>{let l=(n??"").trim();if(l==="")throw new E({column:o+1,kind:"empty-header"});if(r.has(l))throw new E({kind:"duplicate-header",name:l});r.add(l),e.push(l)}),e},"le"),Ne=i(({cells:t,number:e},r,n)=>{if(t.length!==r.length)throw new E({expected:r.length,found:t.length,kind:"ragged",record:e});let o={};return r.forEach((l,s)=>{let a=t[s];a!==void 0?M(o,l,a):n.has(l)&&M(o,l,null)}),{doc:o,record:e}},"ae"),Ue=/^-?\d+$/u,Me=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu,Je=/^-?\d{11,}$/u,Ve=/^(\d{4})-(\d{2})-(\d{2})$/u,Ze=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/u,ze=/\.(\d+)/u,Pe=/[1-9]/u,We=/^[+-]?(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/iu,he=i(t=>{let[,e="",r="",n="0"]=We.exec(t)??[],o=`${e}${r}`,l=0,s=o.length;for(;l<s&&o.charAt(l)==="0";)l+=1;for(;s>l&&o.charAt(s-1)==="0";)s-=1;return l===s?{digits:"",exponent:0}:{digits:o.slice(l,s),exponent:Number(n)-r.length+(o.length-s)}},"ee"),He=i((t,e)=>{let r=he(t),n=he(e.toExponential());return r.digits===n.digits&&r.exponent===n.exponent?!0:r.digits!==""&&r.exponent>=0&&Number.isInteger(e)&&BigInt(r.digits)*10n**BigInt(r.exponent)===BigInt(Math.abs(e))},"Xe"),Ye=i(t=>{let e=t.trim();if(!Me.test(e))return;let r=Number(e);if(Number.isFinite(r))return He(e,r)?{number:r}:{inexact:!0}},"Ve"),Ge=i((t,e,r)=>{let n=new Date(0);return n.setUTCFullYear(t,e-1,r),n.getUTCMonth()===e-1&&n.getUTCDate()===r},"He"),Qe=i((t,e,r,n)=>Number(t)<=23&&Number(e)<=59&&Number(r)<=59&&(n==="Z"||Number(n.slice(1,3))<=23&&Number(n.slice(4,6))<=59),"We"),Xe=i(t=>{let[e="",r,...n]=t.split("T"),o=Ve.exec(e),l=r===void 0?void 0:Ze.exec(r);if(o===null||n.length>0||r!==void 0&&l===null)return;let[,s="",a="",u=""]=o;if(!Ge(Number(s),Number(a),Number(u)))return;let[,c="0",m="0",f="0",b]=l??[];if(!Qe(c,m,f,b??"Z"))return;let w=ze.exec(r??"")?.[1]??"";if(Pe.test(w.slice(3)))return;let x=Date.parse(l!==void 0&&b===void 0?`${t}Z`:t);return Number.isFinite(x)?x:void 0},"Je"),_e=i(t=>{let e=Ye(t);return e===void 0?{expected:"number",kind:"rejected"}:"number"in e?{kind:"ok",value:e.number}:{expected:"number",inexact:!0,kind:"rejected"}},"Ye"),et=i(t=>{let e=t.trim(),r=Xe(e);return r===void 0&&Je.test(e)&&(r=Number(e)),r===void 0||!Number.isFinite(new Date(r).getTime())?{expected:"date",kind:"rejected"}:{kind:"ok",value:r}},"Ze"),tt=i(t=>{try{return R(t),!0}catch{return!1}},"ze"),rt=i((t,e)=>{if(e==="bigint"){let r=t.trim();if(!Ue.test(r))return{expected:"bigint",kind:"rejected"};let n=BigInt(r);return tt(n)?{kind:"ok",value:n}:{expected:"bigint",kind:"rejected",tooLong:!0}}if(e==="boolean"){let r=t.trim().toLowerCase();return r==="true"||r==="false"?{kind:"ok",value:r==="true"}:{expected:"boolean",kind:"rejected"}}return e==="number"?_e(t):e==="date"||e==="timestamp"?et(t):{kind:"ok",value:t}},"Ge"),ke=i(({doc:t,record:e},r)=>{let n={};for(let[o,l]of Object.entries(t)){if(l===null){M(n,o,null);continue}let s=rt(l,r.get(o));if(s.kind==="rejected")throw new E({column:o,expected:s.expected,...s.inexact===!0&&{inexact:!0},kind:"cell-type",record:e,...s.tooLong===!0&&{tooLong:!0},value:l});M(n,o,s.value)}return{doc:n,record:e}},"ce"),nt=i(async function*(t,e,r){let n;for await(let o of ye(t))n===void 0?n=ve(o.cells):yield ke(Ne(o,n,r),e)},"Qe"),ot=i(t=>new Set(t.filter(e=>e.nullable===!0&&!e.optional).map(e=>e.name)),"et"),we=i(t=>{if(t instanceof E)return t;throw t},"te"),lt=i(async(t,e,r,n)=>{let o,l,s;for await(let u of ye(t)){if(o===void 0){try{o=ve(u.cells)}catch(m){l=we(m),o=[]}continue}let c;try{c=ke(Ne(u,o,r),e)}catch(m){s??=we(m);continue}n(c)}let a=l??s;if(a!==void 0)throw a},"tt"),it=K($.exportShard),G=K($.importShard),st=K($.listTables),at=K($.describeTable),ct={},dt=i(t=>t.map(e=>JSON.stringify(R(e))).join(`
|
|
4
|
+
`),"it"),ut=i((t,e)=>{let r=t.trim();if(r==="")return;let n=re(JSON.parse(r));if(typeof n!="object"||n===null)throw new D("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);let o=n;if(typeof o.table!="string"||typeof o.doc!="object"||o.doc===null||Array.isArray(o.doc))throw new D("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);return o},"lt"),ge=1024*1024,_=i(async function*(t){let e=new TextDecoder("utf-8",{fatal:!0});for(let n=0;n<t.size;n+=ge){let o=await t.slice(n,n+ge).arrayBuffer();yield e.decode(o,{stream:!0})}let r=e.decode();r!==""&&(yield r)},"H"),mt=i(async function*(t){let e="",r=0;for await(let n of _(t)){let o=`${e}${n}`.split(`
|
|
5
|
+
`);e=o.pop()??"";for(let l of o)r+=1,yield{line:l,lineNumber:r}}e!==""&&(yield{line:e,lineNumber:r+1})},"at"),ft=i(async function*(t){for await(let{line:e,lineNumber:r}of mt(t)){let n=ut(e,r);n!==void 0&&(yield{line:r,row:n})}},"ct"),pt=i(async function*(t,e,r,n){for await(let{doc:o,record:l}of nt(_(t),r,n))yield{line:l,row:{doc:o,table:e}}},"dt"),ht=i(async(t,e,r,n)=>{try{let{columns:o}=await t.query(at,{table:n},F(r));return{kinds:new Map(o.map(l=>[l.name,l.type])),nullOnEmpty:ot(o)}}catch(o){return{failure:e("Couldn't read the columns of {table}: {message}",{message:q(o),table:n})}}},"ut"),be=50,wt=500,J=9e5,ee=i(t=>new TextEncoder().encode(JSON.stringify(R(t))).byteLength,"W"),Q="application/x-ndjson",Te=i(t=>new D("INTERNAL",`line ${t.toString()}: a single row is over the ${J.toString()}-byte import limit`),"de"),gt=i(async t=>{let e=0;for await(let{line:r,row:n}of t){if(ee(n)>J)throw Te(r);e+=1}return e},"mt"),bt=i(async(t,e,r,n)=>{let o={rows:0};if(await lt(_(t),r,n,({doc:l,record:s})=>{o.rows+=1,o.wide===void 0&&ee({doc:l,table:e})>J&&(o.wide=s)}),o.wide!==void 0)throw Te(o.wide);return o.rows},"ht"),xe=i(async(t,e)=>{let r=[],n=0,o=0,l=0;for await(let{line:s,row:a}of t){let u=ee(a),c=s!==l+1;r.length>0&&(c||r.length===wt||n+u>J)&&(await e(r,o),r=[],n=0),r.length===0&&(o=s),r.push(a),n+=u,l=s}r.length>0&&await e(r,o)},"oe"),xt=/\.csv$/iu,yt=i(t=>xt.test(t.name)||t.type==="text/csv","wt"),vt=i((t,e)=>t.expected==="boolean"?e("line {line}: column \u201C{column}\u201D must be true or false, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.tooLong===!0?e("line {line}: column \u201C{column}\u201D holds an integer longer than the import can send.",{column:t.column,line:t.record}):t.expected==="bigint"?e("line {line}: column \u201C{column}\u201D must be an integer, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.expected==="date"?e("line {line}: column \u201C{column}\u201D must be an ISO-8601 date or epoch milliseconds of at least 11 digits, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.inexact===!0?e("line {line}: column \u201C{column}\u201D holds \u201C{value}\u201D, which a number column cannot store exactly. Store a whole number past 9007199254740991 in a bigint column.",{column:t.column,line:t.record,value:t.value}):e("line {line}: column \u201C{column}\u201D must be a number, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}),"gt"),Nt=i((t,e)=>t.kind==="duplicate-header"?e("The header \u201C{name}\u201D appears more than once.",{name:t.name}):t.kind==="empty-header"?e("Header column {column} is empty.",{column:t.column}):t.kind==="ragged"?e("line {line}: expected {expected} cells, found {found}.",{expected:t.expected,found:t.found,line:t.record}):t.kind==="cell-type"?vt(t,e):t.kind==="text-after-quote"?e("line {line}: text follows a closing quote.",{line:t.record}):e("line {line}: a quoted field is never closed.",{line:t.record}),"xt"),kt=i((t,e,r)=>{let n=e instanceof E?Nt(e.problem,r):q(e);return t===null?r("Invalid NDJSON: {message}",{message:n}):r("Invalid CSV: {message}",{message:n})},"yt"),Tt=i(t=>{let e=(0,X.c)(31),{onChange:r,shardKey:n,value:o}=t,l=U(),s;e[0]!==n?(s={shardKey:n},e[0]=n,e[1]=s):s=e[1];let{data:a}=oe($.listTables,ct,s),u;e[2]!==r?(u=i(p=>{r(p??"")},"c"),e[2]=r,e[3]=u):u=e[3];let c;e[4]!==l?(c=l("Target table"),e[4]=l,e[5]=c):c=e[5];let m;e[6]!==l?(m=l("Choose a table"),e[6]=l,e[7]=m):m=e[7];let f;e[8]!==m?(f=(0,d.jsx)(ue,{placeholder:m}),e[8]=m,e[9]=f):f=e[9];let b;e[10]!==c||e[11]!==f?(b=(0,d.jsx)(me,{"aria-label":c,className:"w-56","data-testid":"ei-csv-table",children:f}),e[10]=c,e[11]=f,e[12]=b):b=e[12];let w;e[13]!==a?(w=a??[],e[13]=a,e[14]=w):w=e[14];let x;e[15]!==w?(x=w.map(jt),e[15]=w,e[16]=x):x=e[16];let g;e[17]!==x?(g=(0,d.jsx)(fe,{children:x}),e[17]=x,e[18]=g):g=e[18];let N;e[19]!==u||e[20]!==b||e[21]!==g||e[22]!==o?(N=(0,d.jsxs)(de,{onValueChange:u,value:o,children:[b,g]}),e[19]=u,e[20]=b,e[21]=g,e[22]=o,e[23]=N):N=e[23];let k;e[24]!==l?(k=l("CSV rows have no table column, so choose the table they go into."),e[24]=l,e[25]=k):k=e[25];let h;e[26]!==k?(h=(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:k}),e[26]=k,e[27]=h):h=e[27];let I;return e[28]!==N||e[29]!==h?(I=(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[N,h]}),e[28]=N,e[29]=h,e[30]=I):I=e[30],I},"vt"),Ce=i(t=>Object.values(t).reduce((e,r)=>e+r,0),"ue"),Ct=i(async(t,e,r,n,o,l,s)=>{let a={conflicts:0,errors:[],inserted:{},replaced:0},u,c=l===null?{kinds:new Map,nullOnEmpty:new Set}:await ht(t,e,r,l);if("failure"in c)return{failure:{message:c.failure,rows:0},total:a};let{kinds:m,nullOnEmpty:f}=c;try{if(l===null){let p=i(()=>ft(o),"m");u={rows:await gt(p()),source:p}}else u={rows:await bt(o,l,m,f),source:i(()=>pt(o,l,m,f),"source")}}catch(p){return{failure:{message:kt(l,p,e),rows:0},total:a}}let{rows:b,source:w}=u;if(l!==null&&b===0)return{failure:{message:e("The CSV has no data rows after the header."),rows:0},total:a};let x={conflicts:0,errors:[],inserted:{}};n(e("Checking {total} rows before writing\u2026",{total:b}));try{let p=await t.query(G,{dryRun:!0,onConflict:s,rows:[],startLine:1},F(r));if(p.dryRun!==!0)return{failure:{message:e("This shard predates import checks, so it would write the file while checking it. Nothing was sent. Update the app and import again."),rows:0},total:a};if(s==="replace"&&typeof p.replaced!="number")return{failure:{message:e("This shard cannot overwrite existing rows. Nothing was sent. Update the app and import again."),rows:0},total:a};await xe(w(),async(S,v)=>{let C=await t.query(G,{dryRun:!0,onConflict:s,rows:S,startLine:v},F(r));x.errors.push(...C.errors)})}catch(p){return{failure:{message:q(p),rows:0},total:a}}if(x.errors.length>0)return{failure:{message:e("Nothing was written, because some rows would be refused. Fix the rows listed below and import again."),rows:0},total:x};let g=0,N=1,k={},h={},I=i(async(p,S)=>{n(e("Importing rows {from}\u2013{to} of {total}\u2026",{from:g+1,to:g+p.length,total:b})),h.startLine=S;let v=await t.query(G,{dryRun:!1,onConflict:s,rows:p,startLine:S},F(r));h.startLine=void 0,a.conflicts+=v.conflicts,a.replaced=(a.replaced??0)+(v.replaced??0),a.errors.push(...v.errors);for(let[C,A]of Object.entries(v.inserted))a.inserted[C]=(a.inserted[C]??0)+A;if(g+=p.length,N=S+p.length,v.errors.length>0){let C=Ce(a.inserted)+(a.replaced??0);throw k.refused=!0,new Error(C===0?e("The shard refused {count} rows, so the rest of the file was not sent. Nothing was written. Fix the rows listed below and import again.",{count:v.errors.length}):e("The shard refused {count} rows, so the rest of the file was not sent. {written} rows were already written, so do not import the whole file again. Import the refused rows and any rows from line {line} onward, or delete the written rows first and then import the whole file.",{count:v.errors.length,line:S+p.length,written:C}))}},"T");try{return await xe(w(),I),{failure:void 0,total:a}}catch(p){return{failure:{message:q(p),nextLine:N,rows:g,unknownFrom:h.startLine,...k},total:a}}},"bt"),It=i(t=>{let e=(0,X.c)(14),{result:r}=t,n=U(),o;e[0]!==r.conflicts||e[1]!==r.errors.length||e[2]!==r.inserted||e[3]!==r.replaced||e[4]!==n?(o=n("Inserted {inserted}, replaced {replaced}, {conflicts} conflicts, {errors} errors.",{conflicts:r.conflicts,errors:r.errors.length,inserted:Ce(r.inserted),replaced:r.replaced??0}),e[0]=r.conflicts,e[1]=r.errors.length,e[2]=r.inserted,e[3]=r.replaced,e[4]=n,e[5]=o):o=e[5];let l;e[6]!==o?(l=(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:o}),e[6]=o,e[7]=l):l=e[7];let s;e[8]!==r.errors||e[9]!==n?(s=r.errors.length>0&&(0,d.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:r.errors.map(u=>(0,d.jsx)("li",{className:"text-xs text-destructive",children:n("line {line} ({table}): {message}",{line:u.line,message:u.message,table:u.table})},`${u.table}-${u.line.toString()}`))}),e[8]=r.errors,e[9]=n,e[10]=s):s=e[10];let a;return e[11]!==l||e[12]!==s?(a=(0,d.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[l,s]}),e[11]=l,e[12]=s,e[13]=a):a=e[13],a},"Nt"),Vt=i(({initialShardKey:t})=>{let e=ne(),r=le(),n=U(),[o,l]=(0,j.useState)(t??""),[s,a]=(0,j.useState)(null),[u,c]=(0,j.useState)(null),[m,f]=(0,j.useState)(!1),[b,w]=(0,j.useState)(null),[x,g]=(0,j.useState)(null),[N,k]=(0,j.useState)(null),[h,I]=(0,j.useState)(null),[p,S]=(0,j.useState)(!1),v=s!==null&&yt(s),C=u!==null&&u.shardKey===o?u.table:"",A=s!==null&&(!v||C!==""),Ie=i(async()=>{let T=o;f(!0),w(null),g(null),I(null);try{let O=await e.query(st,{},F(T)),y=new Blob([],{type:Q}),L=0,B=[];for(let{name:Oe}of O){let{rows:V}=await e.query(it,{tables:[Oe]},F(T));if(V.length===0)continue;let te=dt(V);y=new Blob([y,`${te}
|
|
6
|
+
`],{type:Q}),L+=V.length,B.length<be&&B.push(...te.split(`
|
|
7
|
+
`).slice(0,be-B.length))}Y(T),I({blob:y,count:L,preview:B.join(`
|
|
8
|
+
`),shardKey:T})}catch(O){w(q(O))}},"fe"),je=i(async(T,O)=>{f(!0),w(null),g(null),I(null);let{failure:y,total:L}=await Ct(e,n,o,k,T,O,p?"replace":"skip");y===void 0?(Y(o),g(L)):y.unknownFrom===void 0&&(y.refused===!0||y.rows===0)?(L.errors.length>0&&g(L),w(y.message)):y.unknownFrom===void 0?(g(L),w(n("Import stopped after {rows} rows: {message}. The counts below cover those rows. Rows from line {line} onward were not sent: do not import the whole file again, import from that line onward, or delete the written rows first and then import the whole file.",{line:y.nextLine,message:y.message,rows:y.rows}))):(g(L),w(n("Import stopped after {rows} rows: {message}. The counts below cover completed chunks only. The chunk from line {line} may have written rows: check the table for rows from line {line} onward before importing again, or delete the written rows first and then import the whole file.",{line:y.unknownFrom,message:y.message,rows:y.rows}))),r($.readTablePage),r($.listTables)},"me"),Ee=i(()=>{H(Ie().finally(()=>{f(!1)}))},"he"),Se=i(()=>{s!==null&&A&&H(je(s,v?C:null).finally(()=>{k(null),f(!1)}))},"pe"),Le=i(()=>{h!==null&&ce(`${h.shardKey.trim()===""?"shard":h.shardKey.trim()}.ndjson`,h.blob,Q)},"we"),$e=i(T=>{a(T.target.files?.[0]??null),c(null)},"ge"),Fe=i(T=>{c({shardKey:o,table:T})},"xe"),qe=i(T=>{S(T.target.checked)},"ye");return(0,d.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,d.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,d.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,d.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Export")})}),(0,d.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)(ie,{onChange:l,testId:"ei-shard-input",value:o}),(0,d.jsx)(z,{"data-testid":"ei-export",disabled:m,onClick:Ee,type:"button",children:n("Export")})]}),h!==null&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:n("Exported {count} rows.",{count:h.count})}),(0,d.jsx)(z,{"data-testid":"ei-download",onClick:Le,size:"sm",type:"button",variant:"outline",children:n("Download")})]}),h.preview!==""&&(0,d.jsx)("pre",{className:"max-h-60 overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"ei-preview",children:h.preview})]})]})]}),(0,d.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,d.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,d.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Import")})}),(0,d.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,d.jsx)("input",{accept:".ndjson,.jsonl,.csv,application/x-ndjson,text/csv","aria-label":n("Import file"),className:"text-sm","data-testid":"ei-file",onChange:$e,type:"file"}),v&&(0,d.jsx)(Tt,{onChange:Fe,shardKey:o,value:C}),(0,d.jsxs)(ae,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"ei-replace",children:[(0,d.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"ei-replace",id:"ei-replace",onChange:qe,type:"checkbox"}),n("Overwrite rows whose _id already exists (otherwise they are left unchanged and counted as conflicts)")]}),(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,d.jsx)(se,{confirmLabel:n("Import (writes rows)?"),disabled:m||!A,onConfirm:Se,testId:"ei-import",children:n("Import")})}),N!==null&&(0,d.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-progress",role:"status",children:N}),x!==null&&(0,d.jsx)(It,{result:x})]})]}),b!==null&&(0,d.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:b})]})},"Kt");function jt(t){return(0,d.jsx)(pe,{value:t.name,children:t.name},t.name)}i(jt,"Ct");export{Vt as ExportImportPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as A}from"./chunk-BVX45MU5.js";import{r as v}from"./chunk-BFE2DRP6.js";import{a as o,d as R,e as _,f as F}from"./chunk-OXFKZ4BM.js";var M=R(F(),1),i=R(_(),1);var U=6e4,b=o(e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function","g"),g=5e3,x=o((e,r,s)=>{let t=(0,M.c)(9),n=s===void 0?g:s,h=A(),d=(0,i.useRef)(e),c;t[0]!==e?(c=o(()=>{d.current=e},"c"),t[0]=e,t[1]=c):c=t[1],(0,i.useEffect)(c);let u;t[2]!==r||t[3]!==n?(u=o(()=>{if(!r)return;let l=n,p=!1,T,m=o(()=>{p||(T=setTimeout(P,l))},"f"),y=o(()=>{l=n,m()},"p"),E=o(a=>{v(a)||(l=Math.max(n,Math.min(l*2,U)),m())},"_"),P=o(()=>{if(globalThis.document?.hidden===!0){m();return}let a;try{a=d.current()}catch(S){E(S);return}b(a)?Promise.resolve(a).then(y).catch(E):y()},"A");return m(),()=>{p=!0,clearTimeout(T)}},"i"),t[2]=r,t[3]=n,t[4]=u):u=t[4];let f;t[5]!==h||t[6]!==r||t[7]!==n?(f=[h,r,n],t[5]=h,t[6]=r,t[7]=n,t[8]=f):f=t[8],(0,i.useEffect)(u,f)},"U"),D=o(async e=>{let r=(await Promise.allSettled(e)).find(s=>s.status==="rejected");if(r!==void 0)throw r.reason},"v");export{x as a,D as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r,d as p,e as m}from"./chunk-OXFKZ4BM.js";function d(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}r(d,"mergeObjects");var y={};function h(e,t,n,o,i){if(!n&&!o&&!i&&!e)return R(t);let c=R(e);return t&&(c=E(c,t)),n&&(c=E(c,n)),o&&(c=E(c,o)),i&&(c=E(c,i)),c}r(h,"mergeProps");function x(e){if(e.length===0)return y;if(e.length===1)return R(e[0]);let t=R(e[0]);for(let n=1;n<e.length;n+=1)t=E(t,e[n]);return t}r(x,"mergePropsN");function R(e){return b(e)?{...T(e,y)}:J(e)}r(R,"createInitialMergedProps");function E(e,t){return b(t)?T(t,e):q(e,t)}r(E,"mergeInto");function J(e){let t={...e};for(let n in t){let o=t[n];O(n,o)&&(t[n]=k(o))}return t}r(J,"copyInitialProps");function q(e,t){if(!t)return e;for(let n in t){let o=t[n];switch(n){case"style":{e[n]=d(e.style,o);break}case"className":{e[n]=g(e.className,o);break}default:O(n,o)?e[n]=K(e[n],o):e[n]=o}}return e}r(q,"mutablyMergeInto");function O(e,t){let n=e.charCodeAt(0),o=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&o===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}r(O,"isEventHandler");function b(e){return typeof e=="function"}r(b,"isPropsGetter");function T(e,t){return b(e)?e(t):e??y}r(T,"resolvePropsGetter");function K(e,t){return t?e?(...n)=>{let o=n[0];if(_(o)){let c=o;M(c);let s=t(...n);return c.baseUIHandlerPrevented||e?.(...n),s}let i=t(...n);return e?.(...n),i}:k(t):e}r(K,"mergeEventHandlers");function k(e){return e&&((...t)=>{let n=t[0];return _(n)&&M(n),e(...t)})}r(k,"wrapEventHandler");function M(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}r(M,"makeEventPreventable");function g(e,t){return t?e?t+" "+e:t:e}r(g,"mergeClassNames");function _(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}r(_,"isSyntheticEvent");function Q(e,t){return r(function(o,...i){let c=new URL(e);return c.searchParams.set("code",o.toString()),i.forEach(s=>c.searchParams.append("args[]",s)),`${t} error #${o}; visit ${c} for the full message.`},"formatErrorMessage")}r(Q,"createFormatErrorMessage");var X=Q("https://base-ui.com/production-error","Base UI"),L=X;var a=p(m(),1);var j=p(m(),1);var V={};function v(e,t){let n=j.useRef(V);return n.current===V&&(n.current=e(t)),n}r(v,"useRefWithInit");function A(e,t,n,o){let i=v(S).current;return ee(i,e,t,n,o)&&$(i,[e,t,n,o]),i.callback}r(A,"useMergedRefs");function U(e){let t=v(S).current;return te(t,e)&&$(t,e),t.callback}r(U,"useMergedRefsN");function S(){return{callback:null,cleanup:null,refs:[]}}r(S,"createForkRef");function ee(e,t,n,o,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==i}r(ee,"didChange");function te(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}r(te,"didChangeN");function $(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){let o=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){let c=t[i];if(c!=null)switch(typeof c){case"function":{let s=c(n);typeof s=="function"&&(o[i]=s);break}case"object":{c.current=n;break}default:}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){let c=t[i];if(c!=null)switch(typeof c){case"function":{let s=o[i];typeof s=="function"?s():c(null);break}case"object":{c.current=null;break}default:}}}}}}r($,"update");var z=p(m(),1);var B=p(m(),1);var ne=parseInt(B.version,10);function Y(e){return ne>=e}r(Y,"isReactVersionAtLeast");function N(e){if(!z.isValidElement(e))return null;let t=e,n=t.props;return(Y(19)?n?.ref:t.ref)??null}r(N,"getReactElementRef");function we(){}r(we,"NOOP");var Ce=Object.freeze([]),l=Object.freeze({});function D(e,t){let n={};for(let o in e){let i=e[o];if(t?.hasOwnProperty(o)){let c=t[o](i);c!=null&&Object.assign(n,c);continue}i===!0?n[`data-${o.toLowerCase()}`]="":i&&(n[`data-${o.toLowerCase()}`]=i.toString())}return n}r(D,"getStateAttributesProps");function F(e,t){return typeof e=="function"?e(t):e}r(F,"resolveClassName");function W(e,t){return typeof e=="function"?e(t):e}r(W,"resolveStyle");var P=p(m(),1);function We(e,t,n={}){let o=t.render;n.enabled!==!1&&(o=ce(o));let i=re(t,n,o);if(n.enabled===!1)return null;let c=n.state??l;return se(e,o,i,c)}r(We,"useRenderElement");function re(e,t,n){let{className:o,style:i}=e,{state:c=l,ref:s,props:I,stateAttributesMapping:Z,enabled:f=!0}=t,w=f?F(o,c):void 0,C=f?W(i,c):void 0,G=f?D(c,Z):l,H=f&&I?oe(I):void 0,u=f?d(G,H)??{}:l;return typeof document<"u"&&(f?Array.isArray(s)?u.ref=U([u.ref,N(n),...s]):u.ref=A(u.ref,N(n),s):A(null,null)),f?(w!==void 0&&(u.className=g(u.className,w)),C!==void 0&&(u.style=d(u.style,C)),u):l}r(re,"useRenderElementProps");function oe(e){return Array.isArray(e)?x(e):h(void 0,e)}r(oe,"resolveRenderFunctionProps");var ie=Symbol.for("react.lazy");function ce(e){if(e?.$$typeof!==ie)return e;let t=a.Children.toArray(e)[0];return a.isValidElement(t)?t:e}r(ce,"unwrapLazyRenderProp");function se(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);let i=h(n,t.props);return i.ref=n.ref,a.cloneElement(t,i)}if(e&&typeof e=="string")return ue(e,n);throw new Error(L(8))}r(se,"evaluateRenderProp");function ue(e,t){return e==="button"?(0,P.createElement)("button",{type:"button",...t,key:t.key}):e==="img"?(0,P.createElement)("img",{alt:"",...t,key:t.key}):a.createElement(e,t)}r(ue,"renderTag");export{h as a,M as b,L as c,v as d,A as e,Y as f,we as g,Ce as h,l as i,We as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as j,h as v,i as D,m as q}from"./chunk-BVX45MU5.js";import{n as g,o as S,p as P,y as w}from"./chunk-BFE2DRP6.js";import{a as i,d as A,e as L,f as M}from"./chunk-OXFKZ4BM.js";var E=A(M(),1);var p=A(L(),1);var I=300,l=i(t=>typeof t=="string"?t===""?void 0:t:typeof t=="number"||typeof t=="boolean"?String(t):void 0,"c"),u=i(t=>t.filter(r=>r!==void 0).join(" "),"u"),T=i(t=>{let r=Array.isArray(t.filters)?t.filters.length:0,e=typeof t.search=="string"&&t.search!=="";return r===0&&!e?"no predicate":u([r===0?void 0:`${String(r)} filters`,e?"search":void 0])},"q"),N={clearTable:i(t=>u([l(t.table),"whole table"]),"clearTable"),deleteRows:i(t=>u([l(t.table),T(t)]),"deleteRows"),facetColumn:i(t=>u([l(t.table),l(t.column)]),"facetColumn"),importShard:i(t=>{if(!Array.isArray(t.rows))return"";let r=[...new Set(t.rows.filter(e=>typeof e=="object"&&e!==null).map(e=>e.table).filter(e=>typeof e=="string"))].toSorted((e,s)=>e.localeCompare(s));return u([`${String(t.rows.length)} rows`,r.length===0?void 0:`into ${r.join(", ")}`])},"importShard"),lintSql:i(()=>"sql","lintSql"),patchRows:i(t=>u([l(t.table),typeof t.doc=="object"&&t.doc!==null?`set ${Object.keys(t.doc).join(", ")}`:void 0,T(t)]),"patchRows"),pitrRestore:i(t=>u([l(t.time)===void 0?void 0:`to ${String(t.time)}`,typeof t.bookmark=="string"&&t.bookmark!==""?"from bookmark":void 0,t.restart===!0?"restart now":void 0]),"pitrRestore"),readTablePage:i(t=>u([l(t.table),Array.isArray(t.filters)&&t.filters.length>0?`${String(t.filters.length)} filters`:void 0,typeof t.search=="string"&&t.search!==""?"search":void 0,typeof t.limit=="number"?`limit ${String(t.limit)}`:void 0]),"readTablePage"),runMigration:i(t=>u([l(t.id),l(t.direction),t.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(t=>typeof t.sql=="string"?`${String(t.sql.length)} chars`:"","runSql"),schemaVersion:i(t=>typeof t.hash=="string"?t.hash.slice(0,8):"","schemaVersion"),writeRow:i(t=>u([l(t.table),"1 row"]),"writeRow")},$="__lunora_admin__:",F=i((t,r)=>{let e=t.startsWith($)?t.slice($.length):t,s=N[e];if(s!==void 0)return s(r);let n=Object.keys(r);return n.length===0?"":n.join(", ")},"M"),V=i(t=>{if(Array.isArray(t))return t.length;if(!(typeof t!="object"||t===null)){for(let r of Object.values(t))if(Array.isArray(r))return r.length}},"K"),k=class{static{i(this,"x")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(r=>(this.listeners.add(r),()=>{this.listeners.delete(r)}),"subscribe");start(r,e,s){return this.append(r,e,s,"call","pending")}startSubscription(r,e,s){return this.append(r,e,s,"subscription","live")}recordPush(r){if(this.listeners.size===0){let e=this.entries.find(s=>s.seq===r);e!==void 0&&(e.pushes=(e.pushes??0)+1);return}this.patch(r,e=>({...e,pushes:(e.pushes??0)+1}))}failSubscription(r,e){this.patch(r,s=>({...s,error:e,status:"error"}))}endSubscription(r){this.patch(r,e=>e.status==="error"?e:{...e,durationMs:Date.now()-e.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(r=>r.status==="error")?.seq}settle(r,e){this.patch(r,s=>({...s,durationMs:Date.now()-s.startedAt,...e.error===void 0?{resultCount:V(e.result),status:"ok"}:{error:e.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(r,e,s,n,a){let c=this.nextSeq;this.nextSeq+=1;let d={functionPath:r,kind:n,seq:c,shardKey:s,startedAt:Date.now(),status:a,summary:F(r,e),...n==="subscription"?{pushes:0}:{}},o=[...this.entries,d];return this.entries=o.length>I?o.slice(o.length-I):o,this.emit(),c}patch(r,e){let s=this.entries.findIndex(n=>n.seq===r);s!==-1&&(this.entries=this.entries.with(s,e(this.entries[s])),this.emit())}emit(){for(let r of this.listeners)r()}},f=new k,O=i((t,r,e)=>["lunora-admin",t,r,e.trim()],"E"),_=i((t,r)=>[...t,r],"j");function W(t,r,e={}){let s=q(),{enabled:n=!0,keepPreviousData:a=!1,staleTime:c=0}=e,d=_(t,s.clientIdentifier()),o=D({enabled:n,queryFn:r,placeholderData:a?j:void 0,queryKey:d,staleTime:c});return{data:o.data,error:o.error?P(o.error):o.error,errorSource:o.error??void 0,isLoading:o.isLoading,liveError:void 0,refetch:i(()=>{w(o.refetch())},"refetch"),poll:i(async()=>{await o.refetch({throwOnError:!0})},"poll")}}i(W,"F");function Y(t,r,e={}){let s=q(),n=v(),{enabled:a=!0,keepPreviousData:c=!1,live:d=!1,shardKey:o="",staleTime:R}=e,m=O(t,r,o),C=W(m,()=>s.query(g(t),r,S(o)),{enabled:a,keepPreviousData:c,staleTime:R??(d?Number.POSITIVE_INFINITY:0)}),[K,b]=(0,p.useState)(void 0),Q=JSON.stringify(m);return(0,p.useEffect)(()=>{if(!a||!d)return;b(void 0);let y=f.startSubscription(t,r,o),x=s.subscribe(g(t),r,h=>{f.recordPush(y),b(void 0),n.setQueryData(_(m,s.clientIdentifier()),h)},{...S(o),onError:i(h=>{f.failSubscription(y,h.message),b(h.message)},"onError")});return()=>{f.endSubscription(y),x()}},[s,Q,a,d]),{...C,liveError:a&&d?K:void 0}}i(Y,"U");var B=i(()=>{let t=(0,E.c)(2),r=v(),e;return t[0]!==r?(e=i((s,n,a)=>{let c=n===void 0?["lunora-admin",s]:O(s,n,a??"");w(r.invalidateQueries({queryKey:c}))},"r"),t[0]=r,t[1]=e):e=t[1],e},"W");export{f as a,W as b,Y as c,B as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as $}from"./chunk-WS36BO4R.js";import{a as b}from"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as u}from"./chunk-6UTZXEW3.js";import{c as p}from"./chunk-4DAKKAK7.js";import"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as y,b as w,c as j,d as h,e as c,f as i}from"./chunk-HHRYM6UW.js";import{a as d,e as l}from"./chunk-JSDKOE4U.js";import{h as x,l as k}from"./chunk-BFE2DRP6.js";import{a as o,d as I,g as T}from"./chunk-OXFKZ4BM.js";var e=I(T(),1);var m={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},A={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},C=o((r,a)=>`exempt: ${r.exemptReason===void 0||r.exemptReason===""?a:r.exemptReason}`,"E"),E=o(r=>r.toSorted((a,n)=>a.coverage==="clean"&&n.coverage!=="clean"?1:n.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-n.score),"S"),Y=o(({testId:r="advisor-health"})=>{let a=k(),n=p(u.getAdvisories,{},{live:!0}),g=p(u.getAdvisorProcedures,{},{live:!0}),f=n.data?.advisories??null,N=g.data?.procedures??null,t=f===null||N===null?null:$(N,f),v=g.error??n.error;if(v!==null)return(0,e.jsx)(b,{error:v,testId:`${r}-error`});if(t===null)return(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"py-8 text-center text-muted-foreground","data-testid":`${r}-loading`,children:a("Loading\u2026")})});let R=E(t.procedures);return(0,e.jsxs)("div",{className:"space-y-4","data-testid":r,children:[(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:x("text-4xl font-semibold tabular-nums",A[t.grade]),"data-testid":`${r}-score`,children:t.score}),(0,e.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,e.jsx)("span",{className:x("text-sm font-medium uppercase tracking-wide",A[t.grade]),"data-testid":`${r}-grade`,children:t.grade}),(0,e.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${r}-summary`,children:[(0,e.jsxs)("span",{className:m.clean,children:[t.summary.clean," ",a("clean")]}),(0,e.jsxs)("span",{className:m.warned,children:[t.summary.warned," ",a("warned")]}),(0,e.jsxs)("span",{className:m.failing,children:[t.summary.failing," ",a("failing")]}),(0,e.jsxs)("span",{className:m.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"py-4 text-sm","data-testid":`${r}-project`,children:[(0,e.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",t.project.checks.map(s=>s.name).join(", ")]})]})}),(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"p-0",children:(0,e.jsxs)(y,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(c,{className:"w-20",children:a("Score")}),(0,e.jsx)(c,{children:a("Procedure")}),(0,e.jsx)(c,{className:"w-32",children:a("Kind")}),(0,e.jsx)(c,{children:a("Rules fired")})]})}),(0,e.jsx)(j,{children:R.map(s=>(0,e.jsxs)(h,{"data-testid":`${r}-row`,children:[(0,e.jsx)(i,{className:x("tabular-nums font-medium",m[s.coverage]),children:s.coverage==="exempt"?"\u2014":s.score}),(0,e.jsx)(i,{className:"font-mono text-xs",children:s.id}),(0,e.jsxs)(i,{className:"text-muted-foreground text-xs",children:[s.visibility," ",s.kind,s.sensitivity.level==="high"&&(0,e.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,e.jsx)(i,{className:"text-muted-foreground text-xs",children:s.coverage==="exempt"?C(s,a("no reason given")):s.checks.map(S=>S.name).join(", ")})]},s.id))})]})})})]})},"Y");export{Y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Z}from"./chunk-IBJVVHV5.js";import{a as c,d as P,e as Q}from"./chunk-OXFKZ4BM.js";function B(r){return typeof r=="object"?r.key:r}c(B,"getMeasurementKey");function H(r,a){let t=r.length;return new Proxy(r,{get(s,e,n){if(typeof e=="string"){let o=e.charCodeAt(0);if(o>=48&&o<=57){let i=+e;if(Number.isInteger(i)&&i>=0&&i<t){let l=s[i];if(typeof l!="object"){let u=a[i*2];l=s[i]={index:i,key:l,start:u,size:a[i*2+1],end:u+a[i*2+1],lane:0}}return l}}if(e==="length")return t}return Reflect.get(s,e,n)}})}c(H,"createLazyMeasurementsView");function z(r,a,t){let s=t.initialDeps??[],e,n=!0;function o(){var i;let u=0,g=r();if(!(g.length!==s.length||g.some((d,S)=>s[S]!==d)))return e;s=g;let f=0;return e=a(...g),t?.onChange&&!(n&&t.skipInitialOnChange)&&t.onChange(e),n=!1,e}return c(o,"memoizedFunction"),o.updateDeps=i=>{s=i},o}c(z,"memo");function W(r,a){if(r===void 0)throw new Error(`Unexpected undefined${a?`: ${a}`:""}`);return r}c(W,"notUndefined");var k=c((r,a)=>Math.abs(r-a)<1.01,"approxEqual"),$=c((r,a,t)=>{let s;return Object.assign(function(...e){r.clearTimeout(s),s=r.setTimeout(()=>a.apply(this,e),t)},{cancel:c(()=>{r.clearTimeout(s)},"cancel")})},"debounce");var j,V=c(()=>{if(j!==void 0)return j;if(typeof navigator>"u")return j=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return j=!0;let r=navigator.maxTouchPoints;return j=navigator.platform==="MacIntel"&&r!==void 0&&r>0},"isIOSWebKit");var J=c(r=>{let{offsetWidth:a,offsetHeight:t}=r;return{width:a,height:t}},"getRect"),tt=c(r=>r,"defaultKeyExtractor"),et=c(r=>{let a=Math.max(r.startIndex-r.overscan,0),s=Math.min(r.endIndex+r.overscan,r.count-1)-a+1,e=new Array(s);for(let n=0;n<s;n++)e[n]=a+n;return e},"defaultRangeExtractor"),q=c((r,a)=>{let t=r.scrollElement;if(!t)return;let s=r.targetWindow;if(!s)return;let e=c(o=>{let{width:i,height:l}=o;a({width:Math.round(i),height:Math.round(l)})},"handler");if(e(J(t)),!s.ResizeObserver)return()=>{};let n=new s.ResizeObserver(o=>{let i=c(()=>{let l=o[0];if(l?.borderBoxSize){let u=l.borderBoxSize[0];if(u){e({width:u.inlineSize,height:u.blockSize});return}}e(J(t))},"run");r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(t,{box:"border-box"}),()=>{n.unobserve(t)}},"observeElementRect"),F={passive:!0};var st=typeof window>"u"?!0:"onscrollend"in window,nt=c((r,a,t)=>{let s=r.scrollElement;if(!s)return;let e=r.targetWindow;if(!e)return;let n=r.options.useScrollendEvent&&st,o=0,i=n?null:$(e,()=>a(t(s),!1),r.options.isScrollingResetDelay),l=c(h=>()=>{o=t(s),i?.(),a(o,h)},"createHandler"),u=l(!0),g=l(!1);return s.addEventListener("scroll",u,F),n&&s.addEventListener("scrollend",g,F),()=>{s.removeEventListener("scroll",u),n&&s.removeEventListener("scrollend",g),i?.cancel()}},"observeOffset"),U=c((r,a)=>nt(r,a,t=>{let{horizontal:s,isRtl:e}=r.options;return s?t.scrollLeft*(e&&-1||1):t.scrollTop}),"observeElementOffset");var it=c((r,a,t)=>{if(t.options.useCachedMeasurements){let s=t.indexFromElement(r),e=t.options.getItemKey(s);return t.itemSizeCache.get(e)??t.options.estimateSize(s)}if(a?.borderBoxSize){let s=a.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!a){let s=t.indexFromElement(r),e=t.options.getItemKey(s),n=t.itemSizeCache.get(e);if(n!==void 0)return n}return r[t.options.horizontal?"offsetWidth":"offsetHeight"]},"measureElement"),ot=c((r,{adjustments:a=0,behavior:t},s)=>{var e,n;(n=(e=s.scrollElement)==null?void 0:e.scrollTo)==null||n.call(e,{[s.options.horizontal?"left":"top"]:r+a,behavior:t})},"scrollWithAdjustments");var X=ot;function lt(r,a,t,s){if(a===0)return!1;let e=s(0),n=new Set,o=0;for(;o<r;){let l=t(o);if(l===e)break;n.add(l),o++}let i=r-o;if(i===0||i>=a)return!1;for(let l=0;l<i;l++)if(s(l)!==t(o+l))return!1;for(let l=i;l<a;l++)if(n.has(s(l)))return!1;return!0}c(lt,"isAppendWithTrim");var D=class{static{c(this,"Virtualizer")}constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,s,e;return((e=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:e.call(s))??Date.now()},this.observer=(()=>{let t=null,s=c(()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(e=>{e.forEach(n=>{let o=c(()=>{let i=n.target,l=this.indexFromElement(i);if(!i.isConnected){this.observer.unobserve(i);for(let[u,g]of this.elementsCache)if(g===i){this.elementsCache.delete(u);break}return}this.isIndexInRange(l)&&this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(i,n,this))},"run");this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})})),"get");return{disconnect:c(()=>{var e;(e=s())==null||e.disconnect(),t=null},"disconnect"),observe:c(e=>{var n;return(n=s())==null?void 0:n.observe(e,{box:"border-box"})},"observe"),unobserve:c(e=>{var n;return(n=s())==null?void 0:n.unobserve(e)},"unobserve")}})(),this.range=null,this.setOptions=t=>{var s;let e={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:tt,rangeExtractor:et,onChange:c(()=>{},"onChange"),measureElement:it,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let h in t){let f=t[h];f!==void 0&&(e[h]=f)}let n=this.options,o=null,i=null,l=!1;if(n!==void 0&&n.enabled&&e.enabled&&e.anchorTo==="end"&&this.scrollElement!==null){let h=n.count,f=e.count,d=this.getMeasurements(),S=((s=this._singleLaneMeasurements)==null?void 0:s.items)??d,v=c(O=>B(S[O]),"getPreviousKey"),E=h>0?v(0):null,b=h>0?v(h-1):null;if(f!==h||h>0&&f>0&&(e.getItemKey(0)!==E||e.getItemKey(f-1)!==b)){l=!0;let O=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??d[0]:null;O&&(o=[O.key,this.getScrollOffset()-O.start]);let _=e.followOnAppend===!0?"auto":e.followOnAppend||null;_&&f>0&&this.isAtEnd(n.scrollEndThreshold)&&(h===0||e.getItemKey(f-1)!==b)&&(f>h||lt(h,f,v,e.getItemKey))&&(i=_)}}this.options=e,l&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,g=0;if(o&&this.scrollOffset!==null){let[h,f]=o,d=this.getMeasurements(),{count:S,getItemKey:v}=this.options,E=0;for(;E<S&&v(E)!==h;)E++;if(E<S){let b=d[E];if(b){let m=Math.max(0,b.start+f);!i&&m!==this.scrollOffset&&(g=m-this.scrollOffset,this.scrollOffset=m,u=!0)}}}(u||i)&&(this.pendingScrollAnchor=[u?o[0]:null,u?o[1]:0,i,g])},this.notify=t=>{var s,e;(e=(s=this.options).onChange)==null||e.call(s,this,t)},this.maybeNotify=z(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:c(()=>this.options.debug,"debug"),initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t,s;let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{if(i&&this._intendedScrollOffset===null&&o===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(o-this._intendedScrollOffset)<1.5&&(o=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(o-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;let l=this.getScrollOffset();this.scrollDirection=i?l===o?this.scrollDirection:l<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let o=this.scrollElement,i=c(()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},"onTouchStart"),l=c(()=>{this._iosTouching=!1,!(!V()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))},"onTouchEnd");o.addEventListener("touchstart",i,F),o.addEventListener("touchend",l,F),this.unsubs.push(()=>{o.removeEventListener("touchstart",i),o.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){let[o,i,l,u]=n;o!==null&&!l&&(V()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?u!==0&&(this._iosDeferredAdjustment+=u):((s=this.scrollState)==null?void 0:s.behavior)==="smooth"&&!k(this.getScrollOffset()-u,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),l&&this.scrollToEnd({behavior:l})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;let{target:t,maxAtWrite:s}=this._clampedAdjustment,e=this.getMaxScrollOffset();e>s+.5&&(this._clampedAdjustment=t>e+.5?{target:t,maxAtWrite:e}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let t=this.getScrollOffset(),s=this.getMaxScrollOffset();if(t<0||t>s)return;if(this._iosDeferredAdjustment<0&&t>=s-1){this._iosDeferredAdjustment=0;return}let e=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=e,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=z(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,s,e,n,o,i,l,u)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:e,getItemKey:n,enabled:o,lanes:i,laneAssignmentMode:l,gap:u}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=z(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:e,getItemKey:n,enabled:o,lanes:i,laneAssignmentMode:l,gap:u},g)=>{var h;let f=this.itemSizeCache;if(!o)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(let m of this.laneAssignments.keys())m>=t&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));let d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),i===1){let m=t*2,p=(h=this._singleLaneMeasurements)==null?void 0:h.flat;if(!p||p.length<m){let x=new Float64Array(m);p&&d>0&&x.set(p.subarray(0,d*2)),p=x}let O=d===0?new Array(t):this._singleLaneMeasurements.items.slice(),_;if(d===0)_=s+e;else{let x=d-1;_=p[x*2]+p[x*2+1]+u}for(let x=d;x<t;x++){let M=n(x);O[x]=M;let T=f.get(M),C=typeof T=="number"?T:this.options.estimateSize(x);p[x*2]=_,p[x*2+1]=C,_+=C+u}this._singleLaneMeasurements={flat:p,items:O};let y=H(O,p);return this.measurementsCache=y,y}let S=this.measurementsCache.slice(0,d),v=new Array(i).fill(void 0),E=new Float64Array(i),b=0;for(let m=0;m<d;m++){let p=S[m];p&&(v[p.lane]===void 0&&b++,v[p.lane]=m,E[p.lane]=p.end)}for(let m=d;m<t;m++){let p=n(m),O=this.laneAssignments.get(m),_,y,x=l==="estimate"||f.has(p);if(O!==void 0&&this.options.lanes>1){_=O;let R=v[_],w=R!==void 0?S[R]:void 0;y=w?w.end+u:s+e}else if(b===i){let R=0,w=E[0],K=v[0];for(let A=1;A<i;A++){let L=E[A];(L<w||L===w&&v[A]<K)&&(R=A,w=L,K=v[A])}_=R,y=w+u,x&&this.laneAssignments.set(m,_)}else _=m%this.options.lanes,y=s+e,x&&this.laneAssignments.set(m,_);let M=f.get(p),T=typeof M=="number"?M:this.options.estimateSize(m),C=y+T;S[m]={index:m,start:y,size:T,end:C,key:p,lane:_},v[_]===void 0&&b++,v[_]=m,E[_]=C}return this.measurementsCache=S,S},{key:!1,debug:c(()=>this.options.debug,"debug")}),this.calculateRange=z(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,e,n)=>t.length===0||s===0?(this.range=null,null):(this.range=at(t,s,e,n,n===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:c(()=>this.options.debug,"debug")}),this.getVirtualIndexes=z(()=>{let t=null,s=null,e=this.calculateRange();return e&&(t=e.startIndex,s=e.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,e,n,o)=>n===null||o===null?[]:t({startIndex:n,endIndex:o,overscan:s,count:e}),{key:!1,debug:c(()=>this.options.debug,"debug")}),this.indexFromElement=t=>{let s=this.options.indexAttribute,e=t.getAttribute(s);return e?parseInt(e,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;let e=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(e!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,e-n),i=Math.min(this.options.count-1,e+n);return t>=o&&t<=i}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,i)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(i))});return}let s=this.indexFromElement(t);if(!this.isIndexInRange(s))return;let e=this.options.getItemKey(s),n=this.elementsCache.get(e);n!==t&&(n&&this.observer.unobserve(n),this.observer.observe(t),this.elementsCache.set(e,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var e,n,o;if(!this.isIndexInRange(t))return;let i,l,u,g=(e=this._singleLaneMeasurements)==null?void 0:e.flat;if(this.options.lanes===1&&g!=null)u=this.options.getItemKey(t),l=g[t*2],i=g[t*2+1];else{let d=this.measurementsCache[t];if(!d)return;u=d.key,l=d.start,i=d.size}let h=this.itemSizeCache.get(u)??i,f=s-h;if(f!==0){let d=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,S=d?this.getTotalSize():0,v=this.getScrollOffset()+this.scrollAdjustments,b=!this.itemSizeCache.has(u)?l<v:l+h<=v&&this.scrollDirection!=="backward",m=((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:u,start:l,size:i,end:l+i,lane:0},f,this):b);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(u,s),this.itemSizeCacheVersion++;let p=!1;d?p=this.applyScrollAdjustment(this.getTotalSize()-S):m&&(p=this.applyScrollAdjustment(f)),this.notify(p),this._retryClampedAdjustment()}},this.getVirtualItems=z(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{let e=[];for(let n=0,o=t.length;n<o;n++){let i=t[n],l=s[i];e.push(l)}return e},{key:!1,debug:c(()=>this.options.debug,"debug")}),this.getVirtualItemForOffset=t=>{var s;let e=this.getMeasurements();if(e.length===0)return;let n=(s=this._singleLaneMeasurements)==null?void 0:s.flat,o=this.options.lanes===1&&n!=null,i=Y(0,e.length-1,o?l=>n[l*2]:l=>W(e[l]).start,t);return W(e[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,s,e=0)=>{if(!this.scrollElement)return 0;let n=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=t>=o+n?"end":"start"),s==="center"?t+=(e-n)/2:s==="end"&&(t-=n);let i=this.getMaxScrollOffset();return Math.max(Math.min(i,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));let e=this.getSize(),n=this.getScrollOffset(),o=this.measurementsCache[t];if(!o)return;if(s==="auto")if(o.end>=n+e-this.options.scrollPaddingEnd)s="end";else if(o.start<=n+this.options.scrollPaddingStart)s="start";else return[n,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];let i=s==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,o.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:e="auto"}={})=>{this._iosDeferredAdjustment=0;let n=this.getOffsetForAlignment(t,s),o=this.now();this.scrollState={index:null,align:s,behavior:e,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:e="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));let n=this.getOffsetForIndex(t,s);if(!n)return;let[o,i]=n,l=this.now();this.scrollState={index:t,align:i,behavior:e,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{let e=this.getScrollOffset()+t,n=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:n,lastTargetOffset:e,stableFrames:0},this._scrollToOffset(e,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t,s;let e=this.getMeasurements(),n;if(e.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){let o=e.length-1,i=(t=this._singleLaneMeasurements)==null?void 0:t.flat;i!=null?n=i[o*2]+i[o*2+1]:n=((s=e[o])==null?void 0:s.end)??0}else{let o=Array(this.options.lanes).fill(null),i=e.length-1;for(;i>=0&&o.some(l=>l===null);){let l=e[i];o[l.lane]===null&&(o[l.lane]=l.end),i--}n=Math.max(...o.filter(l=>l!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let t=[];if(this.itemSizeCache.size===0)return t;let s=this.getMeasurements();for(let e of s)e&&this.itemSizeCache.has(e.key)&&t.push({index:e.index,key:e.key,start:e.start,size:e.size,end:e.end,lane:e.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:e})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:e,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(a)}applyScrollAdjustment(a,t){if(a===0)return!1;if(V()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=a,!1;{let s=this.getScrollOffset()+this.scrollAdjustments+a,e=this.scrollElement,n=e!==null&&("scrollHeight"in e||"document"in e)?this.getMaxScrollOffset():null;return this._clampedAdjustment=n!==null&&s>n+.5?{target:s,maxAtWrite:n}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,e=s?s[0]:this.scrollState.lastTargetOffset,n=1,o=e!==this.scrollState.lastTargetOffset;if(!o&&k(e,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){let i=this.getSize()||600,l=Math.abs(e-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&l>i;this.scrollState.lastTargetOffset=e,u||(this.scrollState.behavior="auto"),this._scrollToOffset(e,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}},Y=c((r,a,t,s)=>{for(;r<=a;){let e=(r+a)/2|0,n=t(e);if(n<s)r=e+1;else if(n>s)a=e-1;else return e}return r>0?r-1:0},"findNearestBinarySearch");function rt(r,a,t){let s=0;for(;s<=a;){let e=(s+a)/2|0,n=r[e*2];if(n<t)s=e+1;else if(n>t)a=e-1;else return e}return s>0?s-1:0}c(rt,"findNearestBinarySearchFlat");function at(r,a,t,s,e){let n=r.length-1;if(r.length<=s)return{startIndex:0,endIndex:n};if(s===1&&e!==null){let u=rt(e,n,t),g=u,h=t+a;for(;g<n&&e[g*2]+e[g*2+1]<h;)g++;return{startIndex:u,endIndex:g}}let i=Y(0,n,c(u=>r[u].start,"getStart"),t),l=i;if(s===1)for(;l<n&&r[l].end<t+a;)l++;else if(s>1){let u=Array(s).fill(0);for(;l<n&&u.some(h=>h<t+a);){let h=r[l];u[h.lane]=h.end,l++}let g=Array(s).fill(t+a);for(;i>=0&&g.some(h=>h>=t);){let h=r[i];g[h.lane]=h.start,i--}i=Math.max(0,i-i%s),l=Math.min(n,l+(s-1-l%s))}return{startIndex:i,endIndex:l}}c(at,"calculateRangeImpl");var I=P(Q(),1),G=P(Z(),1);var N=typeof document<"u"?I.useLayoutEffect:I.useEffect;function ht({useFlushSync:r=!0,directDomUpdates:a=!1,directDomUpdatesMode:t="transform",...s}){let e=I.useReducer(h=>h+1,0)[1],n=I.useRef({enabled:a,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});n.current.enabled=a,n.current.mode=t;let o=I.useRef(!1),i=c(h=>{let f=n.current;if(!f.enabled||!f.container)return;let d=h.getTotalSize();if(d!==f.lastSize){f.lastSize=d;let S=h.options.horizontal?"width":"height";f.container.style[S]=`${d}px`}},"applyContainerSize"),l=c(h=>{let f=n.current;if(!f.enabled||!f.container)return;i(h);let d=!!h.options.horizontal,S=f.mode==="transform",v=d?"left":"top",E=h.options.scrollMargin,b=h.getVirtualItems();for(let m of b){let p=m.start-E,O=h.elementsCache.get(m.key);O&&f.lastPositions.get(O)!==p&&(f.lastPositions.set(O,p),S?O.style.transform=d?`translate3d(${p}px, 0, 0)`:`translate3d(0, ${p}px, 0)`:O.style[v]=`${p}px`)}},"applyDirectStyles"),u={...s,onChange:c((h,f)=>{var d;let S=n.current,v=!0;if(S.enabled){l(h);let E=h.range,b=S.prevRange;v=!b||b.isScrolling!==h.isScrolling||b.startIndex!==E?.startIndex||b.endIndex!==E?.endIndex,v&&(S.prevRange=E?{startIndex:E.startIndex,endIndex:E.endIndex,isScrolling:h.isScrolling}:null)}v&&(r&&f&&!o.current?(0,G.flushSync)(e):e()),(d=s.onChange)==null||d.call(s,h,f)},"onChange")},[g]=I.useState(()=>{let h=new D(u),f=h.measureElement;return h.measureElement=d=>{o.current=!0;try{f(d)}finally{o.current=!1}},Object.assign(h,{containerRef:c(d=>{let S=n.current;if(S.container=d,S.lastSize=null,d&&S.enabled){let v=h.getTotalSize();S.lastSize=v;let E=h.options.horizontal?"width":"height";d.style[E]=`${v}px`}},"containerRef")})});return g.setOptions(u),N(()=>g._didMount(),[]),N(()=>(i(g),g._willUpdate())),N(()=>{l(g)}),g}c(ht,"useVirtualizerBase");function _t(r){return ht({observeElementRect:q,observeElementOffset:U,scrollToFn:X,...r})}c(_t,"useVirtualizer");export{q as a,U as b,_t as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u,d as y,e as d}from"./chunk-OXFKZ4BM.js";var t=y(d(),1);var S=u((r,a=400)=>{let e=(r??"").trim(),[o,c]=(0,t.useState)(e),[i,n]=(0,t.useState)(e),m=(0,t.useRef)(r);m.current!==r&&(m.current=r,c(e),n(e));let f=o.trim();return(0,t.useEffect)(()=>{let s=setTimeout(()=>{n(f)},a);return()=>{clearTimeout(s)}},[f,a]),{queryShardKey:i,setShardKey:u(s=>{c(s)},"setShardKey"),shardKey:o}},"f");export{S as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as we}from"./chunk-CNA3TVUK.js";import{a as ve}from"./chunk-FXPAJDES.js";import{i as ie}from"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as U}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as te}from"./chunk-6UTZXEW3.js";import{c as Ne}from"./chunk-4DAKKAK7.js";import{m as ue}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as de}from"./chunk-XMSNLMWU.js";import{a as ae,b as re,c as ne,d as j,e as h,f as p}from"./chunk-HHRYM6UW.js";import{a as Y,e as ee}from"./chunk-JSDKOE4U.js";import{l as X,n as ce,o as me,p as z,v as pe,y as q}from"./chunk-BFE2DRP6.js";import{a as s,d as he,e as ke,f as be,g as Se}from"./chunk-OXFKZ4BM.js";var xe=he(be(),1),i=he(ke(),1);var t=he(Se(),1);var Ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],Oe=["pause","resume","restart","terminate"],Ie=s(l=>{let e=(0,xe.c)(7),{busy:w,id:x,onAct:N}=l,b=X(),a;e[0]!==w||e[1]!==x||e[2]!==N||e[3]!==b?(a=Oe.map(m=>m==="restart"?(0,t.jsx)(ve,{confirmLabel:b("Restart?"),disabled:w,onConfirm:s(()=>{N(m)},"onConfirm"),testId:`workflow-instance-${m}-${x}`,children:b(m)},m):(0,t.jsx)(U,{"data-testid":`workflow-instance-${m}-${x}`,disabled:w,onClick:s(()=>{N(m)},"onClick"),size:"sm",type:"button",variant:"ghost",children:b(m)},m)),e[0]=w,e[1]=x,e[2]=N,e[3]=b,e[4]=a):a=e[4];let d;return e[5]!==a?(d=(0,t.jsx)(t.Fragment,{children:a}),e[5]=a,e[6]=d):d=e[6],d},"Ce"),$e="WORKFLOWS_NOT_CONFIGURED",We=s(l=>typeof l=="object"&&l!==null&&l.code===$e,"Oe"),Ae=s(l=>{let e=l.error??l.output;if(e===void 0)return"\u2014";try{return JSON.stringify(e,pe)}catch{return"(unserializable)"}},"Ee"),Te=s(({loadDetail:l,loadInstances:e,readOnly:w,runAction:x,workflowName:N})=>{let b=ue(),a=X(),[d,m]=(0,i.useState)(null),[v,L]=(0,i.useState)(null),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(null),[F,W]=(0,i.useState)(!1),[_,R]=(0,i.useState)(null),g=(0,i.useRef)(0),y=(0,i.useRef)(0),k=(0,i.useRef)(0),A=l??(n=>b.getWorkflowInstance(n)),I=w?void 0:x??(e===void 0?n=>b.setWorkflowInstanceStatus(n):void 0),T=s(async()=>{y.current+=1;let n=y.current;O(null),W(!1);let u=S===""?void 0:S;try{if(e===void 0){let r=await b.listWorkflowInstances({name:N,status:u});if(n!==y.current)return;if(r.configured===!1){m(null),W(!0);return}m(r.instances);return}let f=await e({name:N,status:u});n===y.current&&m(f)}catch(f){if(n!==y.current)return;m(null),We(f)?W(!0):O(z(f))}},"E");(0,i.useEffect)(()=>{g.current+=1,k.current+=1,L(null),q(T())},[N,S]);let P=s(async n=>{k.current+=1;let u=k.current;O(null);try{let f=await A({id:n,name:N});u===k.current&&L(f)}catch(f){u===k.current&&O(z(f))}},"W"),E=s(()=>{k.current+=1,L(null)},"A"),J=s(async(n,u)=>{if(I===void 0)return;let f=g.current;R(n),O(null);try{await I({action:u,id:n,name:N}),f===g.current&&await T()}catch(r){O(z(r))}R(null)},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:a("Instance history")}),(0,t.jsxs)("select",{"aria-label":a("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(n=>{B(n.target.value)},"onChange"),value:S,children:[(0,t.jsx)("option",{value:"",children:a("All statuses")}),Ce.map(n=>(0,t.jsx)("option",{value:n,children:n},n))]})]}),C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),F&&(0,t.jsx)(de,{description:a("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:a("Workflow inspection not configured")}),!F&&d!==null&&d.length===0&&(0,t.jsx)(de,{description:a("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:a("No instances")}),d!==null&&d.length>0&&(0,t.jsx)(Y,{className:"overflow-hidden py-0",children:(0,t.jsx)(ee,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflow-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:a("Instance id")}),(0,t.jsx)(h,{children:a("Status")}),(0,t.jsx)(h,{children:a("Created")}),(0,t.jsx)(h,{children:a("Ended")}),(0,t.jsx)(h,{"aria-label":a("Actions")})]})}),(0,t.jsx)(ne,{children:d.map(n=>(0,t.jsxs)(j,{"data-testid":`workflow-instance-${n.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:n.status}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.createdOn??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.endedOn??"\u2014"}),(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,t.jsx)(U,{"data-testid":`workflow-instance-steps-${n.id}`,onClick:s(()=>{q(P(n.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Steps")}),I!==void 0&&(0,t.jsx)(Ie,{busy:_===n.id,id:n.id,onAct:s(u=>{q(J(n.id,u))},"onAct")},N)]})})]},n.id))})]})})}),v!==null&&(0,t.jsx)(Y,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,t.jsxs)(ee,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("span",{className:"font-mono text-xs",children:[a("Steps")," \xB7 ",v.id]}),(0,t.jsx)(U,{"data-testid":"workflow-instance-detail-close",onClick:E,size:"xs",type:"button",variant:"ghost",children:a("Close")})]}),v.steps.length===0?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:a("This instance has no recorded steps yet.")}):(0,t.jsxs)(ae,{"data-testid":"workflow-instance-steps",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:a("Step")}),(0,t.jsx)(h,{children:a("Type")}),(0,t.jsx)(h,{children:a("Attempts")}),(0,t.jsx)(h,{children:a("Started")}),(0,t.jsx)(h,{children:a("Output")})]})}),(0,t.jsx)(ne,{children:v.steps.map((n,u)=>(0,t.jsxs)(j,{"data-testid":`workflow-step-${String(u)}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:n.name}),(0,t.jsx)(p,{className:"text-xs text-muted-foreground",children:n.type??"\u2014"}),(0,t.jsx)(p,{className:"tabular-nums",children:n.attempts??"\u2014"}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:n.start??"\u2014"}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:Ae(n)})]},`${n.name}:${String(u)}`))})]})]})})]})},"_e"),_e=ce(te.createWorkflowInstance),Ee=ce(te.getWorkflowInstanceStatus),Je=ce(te.sendWorkflowEvent),De=s(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output,pe)}catch{return"(unserializable)"}},"$e"),ge=s(l=>{let e=l.trim();if(e==="")return{value:void 0};try{return{value:JSON.parse(e)}}catch{return null}},"ve"),Fe=s((l,e)=>l.some(w=>w.exportName===e)?e:l[0]?.exportName??"","Fe"),Pe=s(l=>{let e=(0,xe.c)(72),{eventTypes:w,exportName:x,onSent:N}=l,b=ue(),a=X(),[d,m]=(0,i.useState)(""),[v,L]=(0,i.useState)(""),[S,B]=(0,i.useState)(""),[C,O]=(0,i.useState)(!1),[F,W]=(0,i.useState)(null),_;e[0]!==b||e[1]!==x||e[2]!==N||e[3]!==a||e[4]!==v?(_=s(async(D,oe)=>{try{await b.query(Je,{exportName:x,id:D,payload:oe,type:v},me(""))}catch(fe){W(z(fe));return}try{await N(x,D)}catch(fe){let ye=fe;W(`${a("Event sent, but refreshing the instance failed")}: ${z(ye)}`)}},"_"),e[0]=b,e[1]=x,e[2]=N,e[3]=a,e[4]=v,e[5]=_):_=e[5];let R=_,g;e[6]!==R||e[7]!==d||e[8]!==S||e[9]!==a?(g=s(async()=>{let D=d.trim(),oe=ge(S);if(oe===null){W(a("Payload must be valid JSON"));return}O(!0),W(null),await R(D,oe.value).finally(()=>{O(!1)})},"N"),e[6]=R,e[7]=d,e[8]=S,e[9]=a,e[10]=g):g=e[10];let y=g,k;e[11]!==a?(k=a("Send event"),e[11]=a,e[12]=k):k=e[12];let A;e[13]!==k?(A=(0,t.jsx)("h3",{className:"text-sm font-medium",children:k}),e[13]=k,e[14]=A):A=e[14];let I;e[15]!==F?(I=F!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-event-error",role:"alert",children:F}),e[15]=F,e[16]=I):I=e[16];let T;e[17]!==a?(T=a("Instance id"),e[17]=a,e[18]=T):T=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=s(D=>{m(D.target.value)},"O"),e[19]=P):P=e[19];let E;e[20]!==a?(E=a("Instance id"),e[20]=a,e[21]=E):E=e[21];let J;e[22]!==d||e[23]!==T||e[24]!==E?(J=(0,t.jsx)(ie,{"aria-label":T,className:"max-w-48","data-testid":"workflows-event-id",onChange:P,placeholder:E,value:d}),e[22]=d,e[23]=T,e[24]=E,e[25]=J):J=e[25];let n;e[26]!==a?(n=a("Event type"),e[26]=a,e[27]=n):n=e[27];let u;e[28]===Symbol.for("react.memo_cache_sentinel")?(u=s(D=>{L(D.target.value)},"L"),e[28]=u):u=e[28];let f;e[29]!==a?(f=a("Event type"),e[29]=a,e[30]=f):f=e[30];let r;e[31]!==n||e[32]!==f||e[33]!==v?(r=(0,t.jsx)(ie,{"aria-label":n,className:"max-w-48","data-testid":"workflows-event-type",list:"workflows-event-types",onChange:u,placeholder:f,value:v}),e[31]=n,e[32]=f,e[33]=v,e[34]=r):r=e[34];let c;e[35]!==w?(c=w.map(je),e[35]=w,e[36]=c):c=e[36];let o;e[37]!==c?(o=(0,t.jsx)("datalist",{"data-testid":"workflows-event-types",id:"workflows-event-types",children:c}),e[37]=c,e[38]=o):o=e[38];let $;e[39]!==x||e[40]!==d||e[41]!==C||e[42]!==v?($=C||x===""||d.trim()===""||v.trim()==="",e[39]=x,e[40]=d,e[41]=C,e[42]=v,e[43]=$):$=e[43];let K;e[44]!==y?(K=s(()=>{q(y())},"z"),e[44]=y,e[45]=K):K=e[45];let G;e[46]!==C||e[47]!==a?(G=a(C?"Sending\u2026":"Send event"),e[46]=C,e[47]=a,e[48]=G):G=e[48];let M;e[49]!==$||e[50]!==K||e[51]!==G?(M=(0,t.jsx)(U,{"data-testid":"workflows-event-button",disabled:$,onClick:K,children:G}),e[49]=$,e[50]=K,e[51]=G,e[52]=M):M=e[52];let Z;e[53]!==r||e[54]!==o||e[55]!==M||e[56]!==J?(Z=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[J,r,o,M]}),e[53]=r,e[54]=o,e[55]=M,e[56]=J,e[57]=Z):Z=e[57];let H;e[58]!==a?(H=a("Payload (JSON)"),e[58]=a,e[59]=H):H=e[59];let se;e[60]===Symbol.for("react.memo_cache_sentinel")?(se=s(D=>{B(D.target.value)},"Y"),e[60]=se):se=e[60];let Q;e[61]!==a?(Q=a("Payload (JSON, optional)"),e[61]=a,e[62]=Q):Q=e[62];let V;e[63]!==S||e[64]!==H||e[65]!==Q?(V=(0,t.jsx)(we,{"aria-label":H,className:"font-mono","data-testid":"workflows-event-payload",onChange:se,placeholder:Q,value:S}),e[63]=S,e[64]=H,e[65]=Q,e[66]=V):V=e[66];let le;return e[67]!==Z||e[68]!==V||e[69]!==A||e[70]!==I?(le=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-event",children:[A,I,Z,V]}),e[67]=Z,e[68]=V,e[69]=A,e[70]=I,e[71]=le):le=e[71],le},"Pe"),Ve=s(()=>{let l=ue(),e=X(),{data:w,error:x}=Ne(te.listWorkflows,{}),[N,b]=(0,i.useState)(""),[a,d]=(0,i.useState)(""),[m,v]=(0,i.useState)(""),[L,S]=(0,i.useState)(!1),[B,C]=(0,i.useState)(null),[O,F]=(0,i.useState)([]),[W,_]=(0,i.useState)(null),R=w!==void 0,g=Array.isArray(w?.workflows)?[...w.workflows].toSorted((r,c)=>r.exportName.localeCompare(c.exportName)):[],y=Fe(g,N),k=g.find(r=>r.exportName===y),A=s(r=>{F(c=>{let o=c.filter($=>!($.exportName===r.exportName&&$.id===r.id));return[r,...o]})},"T"),I=s(async()=>{let r=y;if(r==="")return;let c=ge(m);if(c===null){C(e("Params must be valid JSON"));return}S(!0),C(null);try{let o=a.trim(),$=await l.query(_e,{exportName:r,id:o===""?void 0:o,params:c.value},me(""));A({exportName:r,id:$.id,status:$.status}),d("")}catch(o){C(z(o))}S(!1)},"F"),T=s(()=>{q(I())},"P"),P=s(async(r,c)=>{_(c);try{let o=await l.query(Ee,{exportName:r,id:c},me(""));A({error:o.error,exportName:r,id:o.id,output:o.output,status:o.status})}catch(o){throw _(null),o}_(null)},"O"),E=s(async(r,c)=>{try{await P(r,c)}catch(o){C(z(o))}},"E"),J=s(r=>{b(r.target.value)},"W"),n=s(r=>{d(r.target.value)},"A"),u=s(r=>{v(r.target.value)},"L"),f=s(r=>{let{export:c,id:o}=r.currentTarget.dataset;c!==void 0&&o!==void 0&&q(E(c,o))},"n");return(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:x}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),R&&g.length===0?(0,t.jsx)(de,{description:e("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:e("No workflows defined")}):(0,t.jsx)(Y,{className:"overflow-hidden py-0",children:(0,t.jsx)(ee,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:e("Export")}),(0,t.jsx)(h,{children:e("Name")}),(0,t.jsx)(h,{children:e("Class")})]})}),(0,t.jsx)(ne,{children:g.map(r=>(0,t.jsxs)(j,{"data-testid":`workflows-row-${r.exportName}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.name}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.className})]},r.exportName))})]})})}),g.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Start instance")}),B!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:B}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":e("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:J,value:y,children:g.map(r=>(0,t.jsx)("option",{value:r.exportName,children:r.exportName},r.exportName))}),(0,t.jsx)(ie,{"aria-label":e("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:n,placeholder:e("Instance id (optional)"),value:a}),(0,t.jsx)(U,{"data-testid":"workflows-start-button",disabled:L||y==="",onClick:T,children:e(L?"Starting\u2026":"Start instance")})]}),(0,t.jsx)(we,{"aria-label":e("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:u,placeholder:e("Params (JSON, optional)"),value:m})]}),g.length>0&&(0,t.jsx)(Pe,{eventTypes:w?.eventTypes??[],exportName:y,onSent:P},y),O.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:e("Instances")}),(0,t.jsx)(Y,{className:"overflow-hidden py-0",children:(0,t.jsx)(ee,{className:"px-0",children:(0,t.jsxs)(ae,{"data-testid":"workflows-instances-table",children:[(0,t.jsx)(re,{children:(0,t.jsxs)(j,{children:[(0,t.jsx)(h,{children:e("Workflow")}),(0,t.jsx)(h,{children:e("Instance id")}),(0,t.jsx)(h,{children:e("Status")}),(0,t.jsx)(h,{children:e("Output")}),(0,t.jsx)(h,{})]})}),(0,t.jsx)(ne,{children:O.map(r=>(0,t.jsxs)(j,{"data-testid":`workflows-instance-${r.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:r.exportName}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:r.id}),(0,t.jsx)(p,{className:"font-mono text-xs",children:r.status}),(0,t.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:De(r)}),(0,t.jsx)(p,{children:(0,t.jsx)(U,{"data-export":r.exportName,"data-id":r.id,"data-testid":`workflows-instance-refresh-${r.id}`,disabled:W===r.id,onClick:f,size:"xs",variant:"outline",children:W===r.id?e("Refreshing\u2026"):e("Refresh")})})]},`${r.exportName}:${r.id}`))})]})})})]}),k!==void 0&&(0,t.jsx)(Te,{workflowName:k.name})]})},"Ze");function je(l){return(0,t.jsx)("option",{value:l,children:l},l)}s(je,"De");export{Ve as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as fe}from"./chunk-UYEZR3BI.js";import{i as ce}from"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as ae}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import"./chunk-H7HZ42JY.js";import{a as le,e as oe}from"./chunk-JSDKOE4U.js";import{B as pe,l as re,p as me,y as ue}from"./chunk-BFE2DRP6.js";import{a as h,d as se,e as be,f as ke,g as ve}from"./chunk-OXFKZ4BM.js";var ne=se(ke(),1),X=se(be(),1);var s=se(ve(),1);var we=h(e=>{let t=(0,ne.c)(23),{destination:r}=e,f=re(),x;t[0]!==r.snippet?(x=h(()=>{pe(r.snippet)},"x"),t[0]=r.snippet,t[1]=x):x=t[1];let u=x,a;t[2]!==r.title?(a=(0,s.jsx)("h4",{className:"text-sm font-semibold",children:r.title}),t[2]=r.title,t[3]=a):a=t[3];let l;t[4]!==r.description?(l=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.description}),t[4]=r.description,t[5]=l):l=t[5];let c;t[6]!==a||t[7]!==l?(c=(0,s.jsxs)("div",{children:[a,l]}),t[6]=a,t[7]=l,t[8]=c):c=t[8];let J=`drain-copy-${r.id}`,o;t[9]!==f?(o=f("Copy"),t[9]=f,t[10]=o):o=t[10];let n;t[11]!==u||t[12]!==J||t[13]!==o?(n=(0,s.jsx)(ae,{"data-testid":J,onClick:u,size:"sm",variant:"outline",children:o}),t[11]=u,t[12]=J,t[13]=o,t[14]=n):n=t[14];let i;t[15]!==c||t[16]!==n?(i=(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[c,n]}),t[15]=c,t[16]=n,t[17]=i):i=t[17];let m;t[18]!==r.snippet?(m=(0,s.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:r.snippet}),t[18]=r.snippet,t[19]=m):m=t[19];let y;return t[20]!==i||t[21]!==m?(y=(0,s.jsx)(le,{className:"py-0","data-testid":"drain-card",children:(0,s.jsxs)(oe,{className:"p-3",children:[i,m]})}),t[20]=i,t[21]=m,t[22]=y):y=t[22],y},"be"),Me=h(()=>{let e=(0,ne.c)(93),t=re(),r;e[0]!==t?(r=t("Stream every request log to R2, a SIEM, or a third-party log service."),e[0]=t,e[1]=r):r=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=["{",' "logpush": true',"}"],e[2]=f):f=e[2];let x=f.join(`
|
|
2
|
+
`),u;e[3]!==t?(u=t("Logpush"),e[3]=t,e[4]=u):u=e[4];let a;e[5]!==r||e[6]!==u?(a={description:r,id:"logpush",snippet:x,title:u},e[5]=r,e[6]=u,e[7]=a):a=e[7];let l;e[8]!==t?(l=t("Send logs programmatically to a Worker for custom capture and forwarding."),e[8]=t,e[9]=l):l=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"],e[10]=c):c=e[10];let J=c.join(`
|
|
3
|
+
`),o;e[11]!==t?(o=t("Tail Workers"),e[11]=t,e[12]=o):o=e[12];let n;e[13]!==l||e[14]!==o?(n={description:l,id:"tail-worker",snippet:J,title:o},e[13]=l,e[14]=o,e[15]=n):n=e[15];let i;e[16]!==t?(i=t("Retain and query recent request logs directly in Cloudflare's dashboard."),e[16]=t,e[17]=i):i=e[17];let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=["{",' "observability": { "enabled": true }',"}"],e[18]=m):m=e[18];let y=m.join(`
|
|
4
|
+
`),b;e[19]!==t?(b=t("Workers Logs"),e[19]=t,e[20]=b):b=e[20];let k;e[21]!==i||e[22]!==b?(k={description:i,id:"workers-logs",snippet:y,title:b},e[21]=i,e[22]=b,e[23]=k):k=e[23];let $;e[24]!==k||e[25]!==a||e[26]!==n?($=[a,n,k],e[24]=k,e[25]=a,e[26]=n,e[27]=$):$=e[27];let Y=$,[d,he]=(0,X.useState)(""),[v,ie]=(0,X.useState)(!1),[A,G]=(0,X.useState)(null),H;e[28]!==t||e[29]!==d?(H=h(async()=>{let g=d.trim();if(g==="")return;let de="fetch"in globalThis?globalThis.fetch:void 0;if(de===void 0){G({kind:"error",message:t("fetch is unavailable in this environment."),url:g});return}let xe={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};ie(!0),G(null);let ye=performance.now();try{let te=await de(g,{body:JSON.stringify(xe),headers:{"Content-Type":"application/json"},method:"POST"});G({kind:"success",latencyMs:Math.round(performance.now()-ye),status:te.status,url:g})}catch(te){G({kind:"error",message:me(te),url:g})}ie(!1)},"V"),e[28]=t,e[29]=d,e[30]=H):H=e[30];let Z=H,K;e[31]!==A||e[32]!==d?(K=A?.url===d.trim()?A:null,e[31]=A,e[32]=d,e[33]=K):K=e[33];let p=K,Q;e[34]!==Z?(Q=h(()=>{ue(Z())},"G"),e[34]=Z,e[35]=Q):Q=e[35];let ee=Q,U;e[36]===Symbol.for("react.memo_cache_sentinel")?(U=h(g=>{he(g.target.value)},"H"),e[36]=U):U=e[36];let ge=U,w;e[37]!==t?(w=t("Open in Cloudflare"),e[37]=t,e[38]=w):w=e[38];let N;e[39]!==w?(N=(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,s.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:fe,rel:"noreferrer",target:"_blank",children:w})}),e[39]=w,e[40]=N):N=e[40];let S;e[41]!==t?(S=t("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector."),e[41]=t,e[42]=S):S=e[42];let C;e[43]!==S?(C=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:S}),e[43]=S,e[44]=C):C=e[44];let _;e[45]!==t?(_=t("Cloudflare destinations"),e[45]=t,e[46]=_):_=e[46];let j;e[47]!==_?(j=(0,s.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_}),e[47]=_,e[48]=j):j=e[48];let T;e[49]!==Y?(T=Y.map(Ne),e[49]=Y,e[50]=T):T=e[50];let q;e[51]!==j||e[52]!==T?(q=(0,s.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[j,T]}),e[51]=j,e[52]=T,e[53]=q):q=e[53];let M;e[54]!==t?(M=t("Webhook test"),e[54]=t,e[55]=M):M=e[55];let O;e[56]!==M?(O=(0,s.jsx)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M}),e[56]=M,e[57]=O):O=e[57];let W;e[58]!==t?(W=t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable."),e[58]=t,e[59]=W):W=e[59];let L;e[60]!==W?(L=(0,s.jsx)("p",{className:"mb-2 text-sm text-muted-foreground",children:W}),e[60]=W,e[61]=L):L=e[61];let I;e[62]!==t?(I=t("https://example.com/logs"),e[62]=t,e[63]=I):I=e[63];let P;e[64]!==I||e[65]!==d?(P=(0,s.jsx)(ce,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:ge,placeholder:I,type:"url",value:d}),e[64]=I,e[65]=d,e[66]=P):P=e[66];let R;e[67]!==v||e[68]!==d?(R=v||d.trim()==="",e[67]=v,e[68]=d,e[69]=R):R=e[69];let D;e[70]!==v||e[71]!==t?(D=t(v?"Sending\u2026":"Send test event"),e[70]=v,e[71]=t,e[72]=D):D=e[72];let z;e[73]!==ee||e[74]!==R||e[75]!==D?(z=(0,s.jsx)(ae,{"data-testid":"drain-webhook-test",disabled:R,onClick:ee,children:D}),e[73]=ee,e[74]=R,e[75]=D,e[76]=z):z=e[76];let B;e[77]!==P||e[78]!==z?(B=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[P,z]}),e[77]=P,e[78]=z,e[79]=B):B=e[79];let E;e[80]!==p||e[81]!==t?(E=p!==null&&(0,s.jsx)("p",{className:p.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:p.kind==="error"?"alert":void 0,children:p.kind==="success"?t("Delivered \u2014 status {status} in {latency}ms",{latency:p.latencyMs,status:p.status}):t("Failed: {message}",{message:p.message})}),e[80]=p,e[81]=t,e[82]=E):E=e[82];let F;e[83]!==O||e[84]!==L||e[85]!==B||e[86]!==E?(F=(0,s.jsx)(le,{className:"py-0",children:(0,s.jsx)(oe,{className:"p-3",children:(0,s.jsxs)("section",{"data-testid":"drain-webhook",children:[O,L,B,E]})})}),e[83]=O,e[84]=L,e[85]=B,e[86]=E,e[87]=F):F=e[87];let V;return e[88]!==N||e[89]!==C||e[90]!==q||e[91]!==F?(V=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[N,C,q,F]}),e[88]=N,e[89]=C,e[90]=q,e[91]=F,e[92]=V):V=e[92],V},"je");function Ne(e){return(0,s.jsx)(we,{destination:e},e.id)}h(Ne,"ye");export{Me as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as dt}from"./chunk-TQM6XHBA.js";import"./chunk-7RGYCU6F.js";import"./chunk-KZILJQX3.js";import"./chunk-SYGCASPT.js";import"./chunk-YMEKCV27.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import{a as De}from"./chunk-KZCEJFZF.js";import{a as st}from"./chunk-KYAG2YMF.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as at}from"./chunk-5DNGK3NT.js";import{a as ot}from"./chunk-FXPAJDES.js";import{a as tt}from"./chunk-XST3UEHU.js";import{b as et}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import{h as Be,i as We}from"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import{i as ze}from"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as He}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as Ue}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as Te}from"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as F}from"./chunk-6UTZXEW3.js";import{c as ce}from"./chunk-4DAKKAK7.js";import{m as Ye}from"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as Oe}from"./chunk-XMSNLMWU.js";import{a as rt,b as it,c as nt,d as _e,e as q,f as T}from"./chunk-HHRYM6UW.js";import{a as Qe,e as Ve}from"./chunk-JSDKOE4U.js";import{C as qe,h as de,l as le,n as Ge,o as Ze,p as Xe,y as je}from"./chunk-BFE2DRP6.js";import{a as s,d as se,e as Je,f as Ae,g as Pe}from"./chunk-OXFKZ4BM.js";var be=se(Ae(),1),he=se(Je(),1);var lt=se(Ae(),1),S=se(Je(),1);var m=se(Pe(),1);var qt=Ge(F.runMigration),ct=s(t=>{let e=(0,lt.c)(98),{initialShardKey:r}=t,i=Ye(),a=le(),{queryShardKey:o,setShardKey:n,shardKey:d}=at(r),[l,f]=(0,S.useState)(""),[h,g]=(0,S.useState)("up"),[p,b]=(0,S.useState)(!0),[y,x]=(0,S.useState)(!1),[v,u]=(0,S.useState)(null),[w,k]=(0,S.useState)(null),L;e[0]!==d?(L=d.trim(),e[0]=d,e[1]=L):L=e[1];let C=L===o,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j={},e[2]=j):j=e[2];let M;e[3]!==o?(M={live:!0,shardKey:o},e[3]=o,e[4]=M):M=e[4];let $=ce(F.migrationStatus,j,M),N=$.data?.migrations??null,Ie=$.error,{errorSource:Fe,liveError:Re}=$,ye,ve;e[5]!==o||e[6]!==$.data?(ye=s(()=>{$.data!==void 0&&et(o)},"W"),ve=[$.data,o],e[5]=o,e[6]=$.data,e[7]=ye,e[8]=ve):(ye=e[7],ve=e[8]),(0,S.useEffect)(ye,ve);let xe;if(e[9]!==i||e[10]!==h||e[11]!==p||e[12]!==l||e[13]!==d||e[14]!==$||e[15]!==a){let I=s(async()=>{let Ee=l.trim();if(Ee===""){k(a("Enter a migration id")),u(null);return}x(!0),k(null);try{let Le=await i.query(qt,{direction:h,dryRun:p,id:Ee},Ze(d));u(Le),$.refetch()}catch(Le){let jt=Le;u(null),k(Xe(jt))}x(!1)},"u");xe=s(()=>{je(I())},"V"),e[9]=i,e[10]=h,e[11]=p,e[12]=l,e[13]=d,e[14]=$,e[15]=a,e[16]=xe}else xe=e[16];let ke=xe,we;e[17]===Symbol.for("react.memo_cache_sentinel")?(we=s(I=>{f(I.target.value)},"Y"),e[17]=we):we=e[17];let Nt=we,$e;e[18]===Symbol.for("react.memo_cache_sentinel")?($e=s(I=>{g(I.target.value==="down"?"down":"up")},"Z"),e[18]=$e):$e=e[18];let St=$e,Ne;e[19]===Symbol.for("react.memo_cache_sentinel")?(Ne=s(I=>{b(I.target.checked)},"ee"),e[19]=Ne):Ne=e[19];let Ot=Ne,_;e[20]!==n||e[21]!==d?(_=(0,m.jsx)(tt,{onChange:n,testId:"mg-shard-input",value:d}),e[20]=n,e[21]=d,e[22]=_):_=e[22];let D;e[23]!==Re?(D=(0,m.jsx)(st,{message:Re,prefix:"mg"}),e[23]=Re,e[24]=D):D=e[24];let K;e[25]!==_||e[26]!==D?(K=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,D]}),e[25]=_,e[26]=D,e[27]=K):K=e[27];let E;e[28]!==Ie||e[29]!==Fe?(E=Ie!==null&&(0,m.jsx)(Te,{error:Fe,testId:"mg-status-error"}),e[28]=Ie,e[29]=Fe,e[30]=E):E=e[30];let J;e[31]!==N||e[32]!==a?(J=N!==null&&N.length===0&&(0,m.jsx)(Oe,{description:a("Data migrations you run against this shard will be tracked here."),icon:(0,m.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,m.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:a("No migrations have run on this shard.")}),e[31]=N,e[32]=a,e[33]=J):J=e[33];let A;e[34]!==N||e[35]!==a?(A=N!==null&&N.length>0&&(0,m.jsx)(Qe,{className:"overflow-hidden py-0",children:(0,m.jsx)(Ve,{className:"px-0",children:(0,m.jsxs)(rt,{"data-testid":"mg-table",children:[(0,m.jsx)(it,{children:(0,m.jsxs)(_e,{children:[(0,m.jsx)(q,{children:a("id")}),(0,m.jsx)(q,{children:a("direction")}),(0,m.jsx)(q,{children:a("status")}),(0,m.jsx)(q,{children:a("processed")}),(0,m.jsx)(q,{children:a("changed")}),(0,m.jsx)(q,{children:a("updated")}),(0,m.jsx)(q,{children:a("error")})]})}),(0,m.jsx)(nt,{children:N.map(Tt)})]})})}),e[34]=N,e[35]=a,e[36]=A):A=e[36];let P;e[37]!==a?(P=a("Run migration"),e[37]=a,e[38]=P):P=e[38];let B;e[39]!==P?(B=(0,m.jsx)(De,{children:P}),e[39]=P,e[40]=B):B=e[40];let W;e[41]!==a?(W=a("Migration id"),e[41]=a,e[42]=W):W=e[42];let U;e[43]!==a?(U=a("migration id"),e[43]=a,e[44]=U):U=e[44];let z;e[45]!==l||e[46]!==W||e[47]!==U?(z=(0,m.jsx)(ze,{"aria-label":W,className:"w-auto","data-testid":"mg-id-input",onChange:Nt,placeholder:U,value:l}),e[45]=l,e[46]=W,e[47]=U,e[48]=z):z=e[48];let H;e[49]!==a?(H=a("Direction"),e[49]=a,e[50]=H):H=e[50];let Q;e[51]!==a?(Q=a("up"),e[51]=a,e[52]=Q):Q=e[52];let V;e[53]!==Q?(V=(0,m.jsx)("option",{value:"up",children:Q}),e[53]=Q,e[54]=V):V=e[54];let G;e[55]!==a?(G=a("down"),e[55]=a,e[56]=G):G=e[56];let Z;e[57]!==G?(Z=(0,m.jsx)("option",{value:"down",children:G}),e[57]=G,e[58]=Z):Z=e[58];let X;e[59]!==h||e[60]!==H||e[61]!==V||e[62]!==Z?(X=(0,m.jsxs)("select",{"aria-label":H,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:St,value:h,children:[V,Z]}),e[59]=h,e[60]=H,e[61]=V,e[62]=Z,e[63]=X):X=e[63];let Y;e[64]!==p?(Y=(0,m.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Ot,type:"checkbox"}),e[64]=p,e[65]=Y):Y=e[65];let ee;e[66]!==a?(ee=a("Dry run"),e[66]=a,e[67]=ee):ee=e[67];let te;e[68]!==Y||e[69]!==ee?(te=(0,m.jsxs)(De,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[Y,ee]}),e[68]=Y,e[69]=ee,e[70]=te):te=e[70];let ae;e[71]!==p||e[72]!==ke||e[73]!==y||e[74]!==C||e[75]!==a?(ae=p?(0,m.jsx)(He,{"data-testid":"mg-run",disabled:y||!C,onClick:ke,type:"button",children:a(y?"Running\u2026":"Run")}):(0,m.jsx)(ot,{confirmLabel:a(y?"Running\u2026":"Run migration?"),disabled:y||!C,onConfirm:ke,testId:"mg-run",children:a("Run")}),e[71]=p,e[72]=ke,e[73]=y,e[74]=C,e[75]=a,e[76]=ae):ae=e[76];let re;e[77]!==z||e[78]!==X||e[79]!==te||e[80]!==ae?(re=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[z,X,te,ae]}),e[77]=z,e[78]=X,e[79]=te,e[80]=ae,e[81]=re):re=e[81];let ie;e[82]!==B||e[83]!==re?(ie=(0,m.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[B,re]}),e[82]=B,e[83]=re,e[84]=ie):ie=e[84];let ne;e[85]!==w?(ne=w!==null&&(0,m.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:w}),e[85]=w,e[86]=ne):ne=e[86];let oe;e[87]!==v||e[88]!==a?(oe=v!==null&&(0,m.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[v.dryRun?a("Dry run: "):"",a("{status} \u2014 processed",{status:v.status}),v.processed,a(", changed"),v.changed]}),e[87]=v,e[88]=a,e[89]=oe):oe=e[89];let Se;return e[90]!==K||e[91]!==E||e[92]!==J||e[93]!==A||e[94]!==ie||e[95]!==ne||e[96]!==oe?(Se=(0,m.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[K,E,J,A,ie,ne,oe]}),e[90]=K,e[91]=E,e[92]=J,e[93]=A,e[94]=ie,e[95]=ne,e[96]=oe,e[97]=Se):Se=e[97],Se},"yt");function Tt(t){return(0,m.jsxs)(_e,{"data-testid":`mg-row-${t.id}`,children:[(0,m.jsx)(T,{children:t.id}),(0,m.jsx)(T,{children:t.direction}),(0,m.jsx)(T,{children:(0,m.jsx)(Ue,{variant:"secondary",children:t.status})}),(0,m.jsx)(T,{children:t.processed}),(0,m.jsx)(T,{children:t.changed}),(0,m.jsx)(T,{children:qe(t.updatedAt)}),(0,m.jsx)(T,{children:t.error??""})]},t.id)}s(Tt,"Je");var c=se(Pe(),1);var Ke=1;function Ct(t){let e={},r=Object.keys(t);r.sort();for(let i of r)e[i]=t[i];return e}s(Ct,"me");var me=s(t=>typeof t=="object"&&t!==null,"O"),Mt=s(t=>me(t)&&me(t.fields)&&me(t.indexes)&&me(t.relations)&&typeof t.shardMode=="string","ue"),It=s(t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(r){return{error:`baseline is not valid JSON: ${r instanceof Error?r.message:String(r)}`,status:"invalid"}}if(!me(e)||e.version!==Ke||!me(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(Ke)})`,status:"invalid"};for(let[r,i]of Object.entries(e.tables))if(!Mt(i))return{error:`baseline table "${r}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:Ke},status:"ok"}},"fe"),Ft=s((t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((r,i)=>r===e.fields[i]),"he"),mt=s(t=>t.unique!==void 0,"V"),ge=s(({nullable:t,optional:e,refined:r,unique:i,...a})=>JSON.stringify(Ct(a)),"q"),ut=s(t=>({form:JSON.stringify([ge(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),"G"),ht=s(t=>t.kind==="union"&&t.members?t.members.map(e=>ut(e)):[ut({...t,nullable:!1,optional:!1})],"Q"),Rt=s((t,e)=>{if(e.kind!=="union")return!1;let r=ht(e);return ht(t).every(i=>r.some(a=>a.form===i.form&&(i.refined||!a.refined)))},"pe"),O=s(t=>{switch(t.kind){case"array":return`array(${t.of?O(t.of):"?"})`;case"from":return t.output===void 0?"from":`from(${t.output})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?O(t.key):"?"}, ${t.of?O(t.of):"?"})`;case"union":return(t.members??[]).map(e=>O(e)).join(" | ");default:return t.kind}},"x"),fe=s((t,e,r)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:r,table:t,type:e}),"F"),pe=s((t,e,r)=>({remediation:"none",scope:"table",severity:"safe",summary:r,table:t,type:e}),"T"),kt=s((t,e)=>{let r=JSON.stringify(t),i=JSON.stringify(e);return r===i?0:r<i?-1:1},"Z"),ue=s(t=>({...t,...t.kind==="from"?{output:void 0}:{},...t.fields?{fields:Object.fromEntries(Object.entries(t.fields).map(([e,r])=>[e,ue(r)]))}:{},...t.key?{key:ue(t.key)}:{},...t.of?{of:ue(t.of)}:{},...t.members?{members:t.members.map(e=>ue(e)).toSorted(kt)}:{}}),"S"),ft=s(t=>t.kind==="union"?t.members??[]:[t],"U"),Lt=s((t,e)=>{let r=[...t],i=[...e],a=new Set,o=new Set,n=s((d,l)=>{for(let[f,h]of r.entries()){if(o.has(f))continue;let g=i.findIndex((p,b)=>!a.has(b)&&d(h,p));g!==-1&&(a.add(g),o.add(f),l&&([r[f],i[g]]=Me(h,i[g])))}},"s");return n((d,l)=>JSON.stringify(d)===JSON.stringify(l),!1),n((d,l)=>ge(ue(d))===ge(ue(l)),!0),[r,i]},"ge"),Me=s((t,e)=>{if(t.kind==="union"||e.kind==="union"){let[a,o]=Lt(ft(t),ft(e)),n=s((d,l)=>d.kind==="union"?{...d,members:l.toSorted(kt)}:l[0],"s");return[n(t,a),n(e,o)]}if(t.kind!==e.kind)return[t,e];if(t.kind==="from")return t.output===void 0||e.output===void 0?[{...t,output:void 0},{...e,output:void 0}]:[t,e];let r={...t.fields?{fields:{...t.fields}}:{}},i={...e.fields?{fields:{...e.fields}}:{}};for(let a of["key","of"])t[a]&&e[a]&&([r[a],i[a]]=Me(t[a],e[a]));for(let a of Object.keys(t.fields??{})){let o=t.fields?.[a],n=e.fields?.[a];o&&n&&r.fields&&i.fields&&([r.fields[a],i.fields[a]]=Me(o,n))}return[{...t,...r},{...e,...i}]},"I"),_t=s((t,e,r,i,a)=>{let[o,n]=Me(r,i);if(o.kind===n.kind&&(!a||ge(o)===ge(n)))return;if(a&&Rt(o,n))return pe(t,"widenedFieldShape",`field ${t}.${e} widened: ${O(o)} \u2192 ${O(n)} \u2014 every stored value stays valid`);if(o.kind!==n.kind)return fe(t,"changedFieldKind",`field ${t}.${e} changed type: ${o.kind} \u2192 ${n.kind} \u2014 add a data migration to convert existing values`);let d=Object.values(n.fields??{});return a&&o.kind==="object"&&Object.keys(o.fields??{}).length===0&&d.length>0&&d.every(l=>l.optional)?pe(t,"widenedFieldShape",`field ${t}.${e} now records its optional object shape \u2014 stored values stay valid`):fe(t,"changedFieldShape",`field ${t}.${e} changed shape: ${O(o)} \u2192 ${O(n)} \u2014 stored values were written against the old shape; add a data migration to convert them`)},"be"),Dt=s((t,e,r,i)=>{let a=[];return r.unique!==i.unique&&a.push(i.unique===!0?fe(t,"addedFieldConstraint",`field ${t}.${e} became unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`):pe(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),r.nullable!==i.nullable&&a.push(i.nullable===!0?pe(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):fe(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable \u2014 rows holding NULL would be invalid; add a data migration to backfill them`)),r.refined!==i.refined&&a.push(i.refined===!0?fe(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement \u2014 stored values were never checked against it; add a data migration if any could fail`):pe(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),a},"ye"),wt=s((t,e,r,i)=>{let a=[],o=mt(r)&&mt(i),n=_t(t,e,r,i,o);return n&&a.push(n),o&&a.push(...Dt(t,e,r,i)),r.optional&&!i.optional?a.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!r.optional&&i.optional&&a.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),a},"N"),Kt=s((t,e,r)=>r.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},"ve"),Et=s((t,e,r,i)=>{for(let[a,o]of Object.entries(r.fields)){let n=e.fields[a];n===void 0?i.push(Kt(t,a,o)):i.push(...wt(t,a,n,o))}for(let a of Object.keys(e.fields))r.fields[a]===void 0&&i.push({remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${a} \u2014 add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},"xe"),Jt=s((t,e,r,i)=>{for(let[a,o]of Object.entries(r.indexes)){let n=e.indexes[a];if(n===void 0){i.push(o.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`added unique index ${a} on ${t} \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"addedIndex"}:{remediation:"none",scope:"table",severity:"safe",summary:`added index ${a} on ${t}`,table:t,type:"addedIndex"});continue}Ft(n,o)||i.push({remediation:"code",severity:"breaking",summary:`index ${a} on ${t} changed shape \u2014 a query may have relied on the old index`,table:t,scope:"table",type:"changedIndex"})}for(let a of Object.keys(e.indexes))r.indexes[a]===void 0&&i.push({remediation:"code",severity:"breaking",summary:`removed index ${a} on ${t} \u2014 a query that used \`.withIndex("${a}")\` would break`,table:t,scope:"table",type:"removedIndex"})},"ke"),At=s((t,e,r,i)=>{for(let a of Object.keys(r.relations))e.relations[a]===void 0&&i.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${a}`,table:t,type:"addedRelation"});for(let a of Object.keys(e.relations))r.relations[a]===void 0&&i.push({remediation:"code",scope:"schema",severity:"breaking",summary:`removed relation ${t}.${a}`,table:t,type:"removedRelation"})},"$e"),pt="shardBy:_unknown_",Ce="global",Pt=s((t,e)=>t===Ce&&e.startsWith(`${Ce}:`)||e===Ce&&t.startsWith(`${Ce}:`),"we"),Bt=s((t,e,r)=>{if(e===r)return r!==pt?void 0:{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} declares a non-literal .shardBy(...) key, so codegen cannot read which column partitions it \u2014 every such key records as "${pt}" and two DIFFERENT keys would compare equal. Pass the shard key as a string literal; until then this is reported on every run, because the alternative is a silent pass on a re-home that strands every row (export/import is the only way back).`,table:t,type:"changedShardMode"};if(!Pt(e,r))return{remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e} \u2192 ${r} \u2014 its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode"}},"Oe"),gt=s(t=>t.memory!==void 0,"B"),bt=s(t=>t.after??0,"K"),R=s(t=>t.after===void 0?`.ttl("${t.field}")`:`.ttl("${t.field}", { after: ${String(t.after)} })`,"w"),Wt=s((t,e,r)=>{if(e===void 0&&r===void 0)return;let i=s(d=>({remediation:"backfill",scope:"table",severity:"breaking",summary:d,table:t,type:"changedTtlPolicy"}),"i"),a=s(d=>({remediation:"none",scope:"table",severity:"safe",summary:d,table:t,type:"changedTtlPolicy"}),"o");if(r===void 0)return a(`table ${t} dropped its TTL policy \u2014 its rows are no longer swept`);if(e===void 0)return i(`table ${t} gained a TTL policy ${R(r)} \u2014 every row already past the cutoff is deleted on the next alarm sweep; add a data migration to refresh or clear "${r.field}" on the rows written before it`);if(e.field!==r.field)return i(`table ${t} moved its TTL to a different column: ${R(e)} \u2192 ${R(r)} \u2014 rows are now expired by a column they were never written against; add a data migration to populate "${r.field}"`);let o=bt(e),n=bt(r);return n<o?i(`table ${t} shortened its TTL: ${R(e)} \u2192 ${R(r)} \u2014 rows that were not expired under the old offset are deleted on the next alarm sweep; add a data migration to refresh "${r.field}" on the rows that must survive`):n>o?a(`table ${t} lengthened its TTL: ${R(e)} \u2192 ${R(r)}`):void 0},"Se"),Ut=s((t,e,r)=>{let i=[];return e.memory!==r.memory&&i.push(r.memory===!0?{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} became a .memory() table \u2014 every row is deleted in every shard on the next Durable Object cold start, and no data migration survives that; export the rows first if they must be kept, or revert`,table:t,type:"changedMemoryMode"}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer a .memory() table \u2014 its rows now survive a cold start`,table:t,type:"changedMemoryMode"}),e.commitOrdered!==r.commitOrdered&&i.push(r.commitOrdered===!0?{remediation:"backfill",scope:"table",severity:"breaking",summary:`table ${t} became .commitOrdered() \u2014 rows written before it carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed never offers them; add a data migration over the table to stamp them (the rewrite allocates a sequence)`,table:t,type:"changedCommitOrdering"}:{remediation:"code",scope:"table",severity:"breaking",summary:`table ${t} is no longer .commitOrdered() \u2014 new rows carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed stops advancing without erroring; update the consumers before deploying`,table:t,type:"changedCommitOrdering"}),i},"je"),zt=s((t,e,r,i)=>{let a=Bt(t,e.shardMode,r.shardMode);if(a&&i.push(a),gt(e)&>(r)){i.push(...Ut(t,e,r));let o=Wt(t,e.ttl,r.ttl);o&&i.push(o)}Et(t,e,r,i),Jt(t,e,r,i),At(t,e,r,i)},"Fe"),Ht=s((t,e)=>{let r=[],i=t?.tables??{};for(let[a,o]of Object.entries(e.tables)){let n=i[a];if(n===void 0){r.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${a}`,table:a,type:"addedTable"});continue}zt(a,n,o,r)}for(let a of Object.keys(i))e.tables[a]===void 0&&r.push({remediation:"rehome",scope:"table",severity:"breaking",summary:`removed table ${a} \u2014 its rows stay in each shard's SQLite, unreachable through the schema; export the shard first if the data must be kept`,table:a,type:"removedTable"});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){let a=t.jurisdiction??"(none)",o=e.jurisdiction??"(none)";r.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${a} to ${o} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:r}},"Te"),yt=s(t=>Object.entries(t.fields).map(([e,r])=>({name:e,optional:r.optional,ref:Object.values(t.relations).find(i=>i.field===e&&i.kind==="one")?.table,type:O(r)})),"Y"),vt=s((t,e,r)=>{let i={},a=e?.fields??{},o=r?.fields??{};for(let[n,d]of Object.entries(o)){let l=a[n];l===void 0?i[n]=e===void 0?"unchanged":"added":i[n]=wt(t,n,l,d).length===0?"unchanged":"changed"}for(let n of Object.keys(a))o[n]===void 0&&(i[n]="removed");return i},"z"),Qt=s((t,e)=>{let{changes:r}=Ht(t,e),i=new Set(r.filter(n=>n.scope==="table"&&n.table!==void 0).map(n=>n.table)),a=[],o=s((n,d)=>n?"added":i.has(d)?"changed":"context","r");for(let[n,d]of Object.entries(e.tables)){let l=t?.tables[n],f=o(l===void 0,n);a.push({columns:yt(d),fieldStatus:vt(n,l,d),name:n,shardMode:d.shardMode,status:f})}for(let[n,d]of Object.entries(t?.tables??{}))e.tables[n]===void 0&&a.push({columns:yt(d),fieldStatus:vt(n,d,void 0),name:n,shardMode:d.shardMode,status:"removed"});return a.sort((n,d)=>n.name.localeCompare(d.name)),{breakingCount:r.filter(n=>n.severity==="breaking").length,changes:r,tables:a}},"Me"),xt=s(t=>{let e=It(t);return e.status==="ok"?e.snapshot:void 0},"X"),Vt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},Gt=s(t=>t==="global"||t.startsWith("global:")?"global":"shard","Ce"),Zt=s(t=>{let e=(0,be.c)(24),{appliedAt:r,hash:i,onSelect:a,selected:o,seq:n}=t,d=o?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",l;e[0]!==d?(l=de("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",d),e[0]=d,e[1]=l):l=e[1];let f=`sh-version-${i}`,h;e[2]!==i||e[3]!==a?(h=s(()=>{a(i)},"f"),e[2]=i,e[3]=a,e[4]=h):h=e[4];let g;e[5]!==n?(g=(0,c.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",n]}),e[5]=n,e[6]=g):g=e[6];let p;e[7]!==i?(p=i.slice(0,7),e[7]=i,e[8]=p):p=e[8];let b;e[9]!==p?(b=(0,c.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=b):b=e[10];let y;e[11]!==g||e[12]!==b?(y=(0,c.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[g,b]}),e[11]=g,e[12]=b,e[13]=y):y=e[13];let x;e[14]!==r?(x=qe(r),e[14]=r,e[15]=x):x=e[15];let v;e[16]!==x?(v=(0,c.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:x}),e[16]=x,e[17]=v):v=e[17];let u;return e[18]!==v||e[19]!==l||e[20]!==f||e[21]!==h||e[22]!==y?(u=(0,c.jsx)("li",{children:(0,c.jsxs)("button",{className:l,"data-testid":f,onClick:h,type:"button",children:[y,v]})}),e[18]=v,e[19]=l,e[20]=f,e[21]=h,e[22]=y,e[23]=u):u=e[23],u},"Ie"),Xt=s(t=>{let e=(0,be.c)(26),{breaking:r,count:i,first:a}=t,o=le();if(a){let b;e[0]!==i?(b=(0,c.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:i}),e[0]=i,e[1]=b):b=e[1];let y;e[2]!==o?(y=o("tables"),e[2]=o,e[3]=y):y=e[3];let x;e[4]!==y?(x=(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:y}),e[4]=y,e[5]=x):x=e[5];let v;return e[6]!==b||e[7]!==x?(v=(0,c.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[b,x]}),e[6]=b,e[7]=x,e[8]=v):v=e[8],v}let n=r>0&&"text-destructive",d;e[9]!==n?(d=de("text-3xl leading-none font-light tracking-tight tabular-nums",n),e[9]=n,e[10]=d):d=e[10];let l;e[11]!==i||e[12]!==d?(l=(0,c.jsx)("span",{className:d,children:i}),e[11]=i,e[12]=d,e[13]=l):l=e[13];let f;e[14]!==i||e[15]!==o?(f=o(i===1?"change":"changes"),e[14]=i,e[15]=o,e[16]=f):f=e[16];let h;e[17]!==f?(h=(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[17]=f,e[18]=h):h=e[18];let g;e[19]!==r||e[20]!==o?(g=r>0&&(0,c.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",o("{count} breaking",{count:r})]}),e[19]=r,e[20]=o,e[21]=g):g=e[21];let p;return e[22]!==l||e[23]!==h||e[24]!==g?(p=(0,c.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[l,h,g]}),e[22]=l,e[23]=h,e[24]=g,e[25]=p):p=e[25],p},"Re"),$t={addedFieldConstraint:{action:"added",kind:"constraint"},addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedCommitOrdering:{action:"changed",kind:"commit ordering"},changedFieldKind:{action:"changed",kind:"field kind"},changedFieldShape:{action:"changed",kind:"field shape"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedMemoryMode:{action:"changed",kind:"memory mode"},changedShardMode:{action:"changed",kind:"shard mode"},changedTtlPolicy:{action:"changed",kind:"TTL policy"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field \u2192 wider"}},Yt=s((t,e)=>{let r=`${$t[t.type].action} ${e} `;return t.summary.startsWith(r)?t.summary.slice(r.length):t.summary},"Ee"),ea=s(t=>{let e=new Map;for(let i of t){let a=i.table??"",o=e.get(a);o===void 0?e.set(a,[i]):o.push(i)}let r=[...e].map(([i,a])=>({changes:a,table:i}));return[...r.filter(i=>i.table!==""),...r.filter(i=>i.table==="")]},"Ae"),ta=s(t=>{let e=(0,be.c)(2),{children:r}=t,i;return e[0]!==r?(i=(0,c.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:r}),e[0]=r,e[1]=i):i=e[1],i},"De"),aa=s(({pane:t,shardKey:e=""})=>{let r=le(),i=We(),a=Be({strict:!1}).version,o=s(u=>{je(i({search:{version:u},to:"/migrations"}))},"s"),n=ce(F.schemaHistory,{},{shardKey:e}),d=n.data?.versions??[],l=a!==void 0&&d.some(u=>u.hash===a)?a:d[0]?.hash,f=d.findIndex(u=>u.hash===l),h=f===-1?void 0:d[f+1]?.hash,g=ce(F.schemaVersion,{hash:l??""},{enabled:l!==void 0,shardKey:e}),p=ce(F.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),b=(0,he.useMemo)(()=>{let u=xt(g.data?.version?.snapshotJson);if(u!==void 0)return Qt(xt(p.data?.version?.snapshotJson),u)},[g.data,p.data]),y=(0,he.useMemo)(()=>(b?.tables??[]).map(u=>({columns:u.columns,name:u.name,tier:Gt(u.shardMode)})),[b]),x=(0,he.useMemo)(()=>{let u={};for(let w of b?.tables??[])u[w.name]=Vt[w.status];return u},[b]);if(n.error!==null)return(0,c.jsx)(Te,{error:n.errorSource,testId:"sh-error"});if(d.length===0)return(0,c.jsx)(Oe,{description:r("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:r("No schema versions recorded yet.")});let v=b?.changes??[];return(0,c.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,c.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,c.jsx)(ta,{children:r("Schema versions")}),(0,c.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:d.map(u=>(0,c.jsx)(Zt,{appliedAt:u.appliedAt,hash:u.hash,onSelect:o,selected:u.hash===l,seq:u.seq},u.hash))})]}),(0,c.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,c.jsx)(Xt,{breaking:b?.breakingCount??0,count:h===void 0?y.length:v.length,first:h===void 0}),t==="diagram"?(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,c.jsx)(dt,{fill:!0,nodeClasses:x,tables:y,testIdPrefix:"sh"})}):(0,c.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:ea(v).map(u=>{let w=(b?.tables??[]).find(k=>k.name===u.table);return(0,c.jsxs)("section",{className:"mb-6",children:[(0,c.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,c.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:u.table===""?r("schema"):u.table}),w!==void 0&&(0,c.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:r("{count} columns",{count:w.columns.length})}),u.changes.length>1&&(0,c.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:u.changes.length})]}),(0,c.jsx)("ul",{children:u.changes.map(k=>{let{action:L,kind:C}=$t[k.type],j=k.severity==="breaking",M=Yt(k,C);return(0,c.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,c.jsx)("span",{"aria-hidden":"true",className:de("-ms-3 h-3 w-0.5 shrink-0 self-center",j?"bg-destructive":"bg-transparent")}),(0,c.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[r(L)," ",C]}),M!==u.table&&(0,c.jsx)("span",{className:de("min-w-0 font-mono text-[13px]",j?"text-destructive":"text-foreground"),children:M}),j&&(0,c.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:r("breaking")})]},`${k.type}-${k.summary}`)})})]},u.table)})})]})]})},"Le"),ra=s(t=>de("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Je"),Ra=s(t=>{let e=(0,be.c)(11),{initialShardKey:r}=t,i=le(),[a,o]=(0,he.useState)("diagram"),n;e[0]!==a?(n=s((g,p,b,y)=>(0,c.jsxs)("button",{"aria-selected":a===g,className:ra(a===g),"data-testid":b,onClick:s(()=>{o(g)},"onClick"),role:"tab",type:"button",children:[p,y!==void 0&&(0,c.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:y})]}),"s"),e[0]=a,e[1]=n):n=e[1];let d=n,l;e[2]!==i||e[3]!==d?(l=(0,c.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[d("diagram",i("Diagram"),"mg-pane-diagram"),d("changes",i("Changes"),"mg-pane-changes"),d("data",i("Data migrations"),"mg-pane-data")]}),e[2]=i,e[3]=d,e[4]=l):l=e[4];let f;e[5]!==r||e[6]!==a?(f=(0,c.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a==="data"?(0,c.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,c.jsx)(ct,{initialShardKey:r})}):(0,c.jsx)(aa,{pane:a,shardKey:r})}),e[5]=r,e[6]=a,e[7]=f):f=e[7];let h;return e[8]!==l||e[9]!==f?(h=(0,c.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[l,f]}),e[8]=l,e[9]=f,e[10]=h):h=e[10],h},"Ze");export{Ra as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as R}from"./chunk-SU5DTRGK.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as B}from"./chunk-6VAY6L4J.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as S}from"./chunk-PQH2LSJX.js";import"./chunk-4C4THJUD.js";import{a as q}from"./chunk-CZ6HBDIL.js";import"./chunk-T5UMHPAB.js";import"./chunk-NVKLYDOH.js";import"./chunk-E26OT26O.js";import{a as U}from"./chunk-6UTZXEW3.js";import{c as O}from"./chunk-4DAKKAK7.js";import"./chunk-BVX45MU5.js";import"./chunk-H7HZ42JY.js";import{a as D}from"./chunk-XMSNLMWU.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-HHRYM6UW.js";import{a as V,e as W}from"./chunk-JSDKOE4U.js";import{C as H,l as P}from"./chunk-BFE2DRP6.js";import{a as n,d as j,e as re,f as ae,g as ie}from"./chunk-OXFKZ4BM.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=P(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=O(U.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(R,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(D,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(V,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};
|