@lunora/studio 1.0.0-alpha.349 → 1.0.0-alpha.350
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/README.md +3 -3
- package/dist/index.d.mts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.mjs +1 -1
- package/dist/mount.d.mts +3 -2
- package/dist/mount.d.ts +3 -2
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ApiTab.mjs +1 -1
- package/dist/packem_chunks/AuditPanel.mjs +1 -1
- package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +5 -5
- package/dist/packem_chunks/FileBrowser.mjs +3 -3
- package/dist/packem_chunks/FunctionRunner.mjs +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
- package/dist/packem_chunks/HealthPanel.mjs +1 -1
- package/dist/packem_chunks/InsightsPanel.mjs +1 -1
- package/dist/packem_chunks/LogsPanel.mjs +1 -1
- package/dist/packem_chunks/MailPanel.mjs +1 -1
- package/dist/packem_chunks/MetricsPanel.mjs +1 -1
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
- package/dist/packem_chunks/PitrPanel.mjs +1 -1
- package/dist/packem_chunks/SchemaViewer.mjs +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
- package/dist/packem_chunks/SettingsPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +7 -7
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/agents-panel.mjs +1 -1
- package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
- package/dist/packem_chunks/analytics-panel.mjs +1 -1
- package/dist/packem_chunks/architecture-panel.mjs +1 -1
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
- package/dist/packem_chunks/auth-config-panel.mjs +1 -1
- package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
- package/dist/packem_chunks/containers-panel.mjs +1 -1
- package/dist/packem_chunks/dashboards-panel.mjs +1 -1
- package/dist/packem_chunks/evals-panel.mjs +1 -1
- package/dist/packem_chunks/fanout-panel.mjs +1 -1
- package/dist/packem_chunks/flags-panel.mjs +1 -1
- package/dist/packem_chunks/issues-panel.mjs +1 -1
- package/dist/packem_chunks/kv-browser.mjs +1 -1
- package/dist/packem_chunks/log-drains-panel.mjs +1 -1
- package/dist/packem_chunks/migrations-route.mjs +1 -1
- package/dist/packem_chunks/organizations-panel.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_chunks/permissions-panel.mjs +1 -1
- package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
- package/dist/packem_chunks/queues-panel.mjs +1 -1
- package/dist/packem_chunks/reactors-panel.mjs +1 -1
- package/dist/packem_chunks/rls-panel.mjs +1 -1
- package/dist/packem_chunks/schedule-panel.mjs +1 -1
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
- package/dist/packem_chunks/sync-client-panel.mjs +1 -1
- package/dist/packem_chunks/theme-indicator.mjs +1 -0
- package/dist/packem_chunks/traces-panel.mjs +1 -1
- package/dist/packem_chunks/users-panel.mjs +1 -1
- package/dist/packem_chunks/vector-browser.mjs +1 -1
- package/dist/packem_chunks/workflows-panel.mjs +1 -1
- package/dist/packem_shared/{ApiDocsPanel-Py7C4ibM.mjs → ApiDocsPanel-B_RaW7Br.mjs} +2 -2
- package/dist/packem_shared/ApiReferencePanel-u9Rrljdf.mjs +1 -0
- package/dist/packem_shared/{CommandPalette-CM1hqAOD.mjs → CommandPalette-5OsK8PNe.mjs} +1 -1
- package/dist/packem_shared/{ConfirmButton-DU4p72Er.mjs → ConfirmButton-CIXYF6Mg.mjs} +1 -1
- package/dist/packem_shared/{ConnectionBadge-B8Hj5DaE.mjs → ConnectionBadge-BfcoN-VE.mjs} +1 -1
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-CG7Q45ZS.mjs +1 -0
- package/dist/packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs +1 -0
- package/dist/packem_shared/{DataBrowser-DFjQeYYF.mjs → DataBrowser-Cc1qZX-4.mjs} +1 -1
- package/dist/packem_shared/{DataFilters-faurWYyX.mjs → DataFilters--ocFTVT2.mjs} +1 -1
- package/dist/packem_shared/GlobalDataBrowser-Hq6gTlkb.mjs +1 -0
- package/dist/packem_shared/{HomePanel-C8sb1fFJ.mjs → HomePanel-DeyYLVxc.mjs} +1 -1
- package/dist/packem_shared/MigrationsPanel-CMZYYcQ5.mjs +1 -0
- package/dist/packem_shared/OpenRpcReferencePanel-E9cDfHRv.mjs +1 -0
- package/dist/packem_shared/ScheduledJobs-D4CUj7aX.mjs +1 -0
- package/dist/packem_shared/{ShardInput-C6mjgAh4.mjs → ShardInput-CoySruKZ.mjs} +1 -1
- package/dist/packem_shared/Studio-BhTqTeGb.mjs +1 -0
- package/dist/packem_shared/StudioApp-B1d0beD4.mjs +1 -0
- package/dist/packem_shared/{StudioI18nProvider-fVsCSs5L.mjs → StudioI18nProvider-CGXCPnQn.mjs} +1 -1
- package/dist/packem_shared/{advisor-view-B8oIluyS.mjs → advisor-view-fNcNYW2Q.mjs} +1 -1
- package/dist/packem_shared/{app.d-D45VvUTx.d.mts → app.d-D425h1XO.d.mts} +4 -3
- package/dist/packem_shared/{app.d-D45VvUTx.d.ts → app.d-D425h1XO.d.ts} +4 -3
- package/dist/packem_shared/{auth-pager-DiDnXsfe.mjs → auth-pager-DW77WeZw.mjs} +1 -1
- package/dist/packem_shared/{data-grid-BHTuvSI7.mjs → data-grid-r3isM8Nq.mjs} +1 -1
- package/dist/packem_shared/{diagram-export-panel-BMLzao0Y.mjs → diagram-export-panel-aBDQdX4e.mjs} +1 -1
- package/dist/packem_shared/{error-alert-CNQjdAhi.mjs → error-alert-54TiaMvZ.mjs} +1 -1
- package/dist/packem_shared/{grid-features-8DoaKdS1.mjs → grid-features-2c5SaBtH.mjs} +1 -1
- package/dist/packem_shared/{grid-pagination-DgzyzfBh.mjs → grid-pagination-DY2erU65.mjs} +1 -1
- package/dist/packem_shared/home-panel-0XMGe1hP.mjs +3 -0
- package/dist/packem_shared/{live-status-BuJdUZFU.mjs → live-status-D1GasNsH.mjs} +1 -1
- package/dist/packem_shared/{recording-client-neIRrUNz.mjs → recording-client-MbGZ28I0.mjs} +1 -1
- package/dist/packem_shared/{reference-view-BrsL8UGn.mjs → reference-view-DCEC5kjY.mjs} +4 -4
- package/dist/packem_shared/{schema-diagram-ghsOCED7.mjs → schema-diagram-k7cFl7Wp.mjs} +1 -1
- package/dist/packem_shared/{sql-result-table-COsfUSGc.mjs → sql-result-table-CatgdmMh.mjs} +1 -1
- package/dist/packem_shared/studio-CA3ZKwVK.mjs +2 -0
- package/dist/packem_shared/{table-list-sidebar-B7IOSxLN.mjs → table-list-sidebar-nA7g7uSk.mjs} +1 -1
- package/dist/packem_shared/use-admin-query-BW9IuacC.mjs +1 -0
- package/dist/packem_shared/use-auth-config-KO9tnI39.mjs +1 -0
- package/dist/packem_shared/use-sql-assistant-DXnqbBs-.mjs +1 -0
- package/dist/packem_shared/use-studio-client-DCA50tF2.mjs +1 -0
- package/dist/standalone/chunk-26OKWFLO.js +1 -0
- package/dist/standalone/chunk-2EL4EMYZ.js +1 -0
- package/dist/standalone/chunk-2O6KKVH2.js +1 -0
- package/dist/standalone/{chunk-WX647YQ7.js → chunk-2WNL74MI.js} +3 -3
- package/dist/standalone/chunk-2X6O33OX.js +1 -0
- package/dist/standalone/chunk-2ZO7XY3Z.js +1 -0
- package/dist/standalone/{chunk-Y3AYVFTK.js → chunk-3GXPALXG.js} +1 -1
- package/dist/standalone/chunk-3Y5K3IQO.js +1 -0
- package/dist/standalone/{chunk-BOMPSVRC.js → chunk-4C4THJUD.js} +1 -1
- package/dist/standalone/{chunk-WVWCUB4S.js → chunk-4IEMXFUB.js} +1 -1
- package/dist/standalone/{chunk-5B2RTXBS.js → chunk-4SQBAPY6.js} +1 -1
- package/dist/standalone/{chunk-R6U22RSY.js → chunk-5DNGK3NT.js} +1 -1
- package/dist/standalone/{chunk-WOEHFC4J.js → chunk-5J32EGHF.js} +1 -1
- package/dist/standalone/chunk-5NZWQEEJ.js +1 -0
- package/dist/standalone/chunk-6I42AM75.js +1 -0
- package/dist/standalone/{chunk-RGMVGZV4.js → chunk-6M7FLLMT.js} +1 -1
- package/dist/standalone/{chunk-IWZ7GVQO.js → chunk-6QEXGYWH.js} +1 -1
- package/dist/standalone/chunk-7AZYREIY.js +1 -0
- package/dist/standalone/{chunk-G43F7LYA.js → chunk-7F3S5OQT.js} +1 -1
- package/dist/standalone/chunk-7MN724WR.js +1 -0
- package/dist/standalone/{chunk-Q6IT6ZD7.js → chunk-7RGYCU6F.js} +1 -1
- package/dist/standalone/{chunk-NRP22GKC.js → chunk-A566HCBX.js} +1 -1
- package/dist/standalone/{chunk-253UHWDX.js → chunk-AOHKAKKL.js} +1 -1
- package/dist/standalone/{chunk-OYCUPD3Q.js → chunk-AP4PC2M4.js} +1 -1
- package/dist/standalone/chunk-B3AXFXAD.js +1 -0
- package/dist/standalone/chunk-B7MHW3A5.js +1 -0
- package/dist/standalone/{chunk-CWPBPBWJ.js → chunk-BHOLL76W.js} +6 -6
- package/dist/standalone/{chunk-I57ZVLUB.js → chunk-BTRYFPZH.js} +1 -1
- package/dist/standalone/chunk-BVKQA5OL.js +1 -0
- package/dist/standalone/chunk-CGZVMM3P.js +1 -0
- package/dist/standalone/chunk-CIVMATZK.js +3 -0
- package/dist/standalone/chunk-CLINNLLE.js +1 -0
- package/dist/standalone/chunk-CTE6RPXC.js +1 -0
- package/dist/standalone/chunk-CW57Q264.js +1 -0
- package/dist/standalone/chunk-D7JK65OK.js +1 -0
- package/dist/standalone/{chunk-FUYEZFBP.js → chunk-DBVJ5VLI.js} +1 -1
- package/dist/standalone/{chunk-XCYFP44W.js → chunk-DS7HZKZ2.js} +1 -1
- package/dist/standalone/{chunk-2WDKJ74A.js → chunk-DX55P3KZ.js} +1 -1
- package/dist/standalone/{chunk-55UGUCQ6.js → chunk-E26OT26O.js} +1 -1
- package/dist/standalone/{chunk-YUPEDAX3.js → chunk-E32FS6PE.js} +2 -2
- package/dist/standalone/chunk-E3VSRIQU.js +1 -0
- package/dist/standalone/chunk-EDGOSJXL.js +1 -0
- package/dist/standalone/chunk-EOR73TZZ.js +1 -0
- package/dist/standalone/chunk-F5LTDUMB.js +1 -0
- package/dist/standalone/chunk-FLVDICZL.js +1 -0
- package/dist/standalone/{chunk-5J4FLDJH.js → chunk-FPIUVV7Q.js} +1 -1
- package/dist/standalone/chunk-GMW2DYFU.js +1 -0
- package/dist/standalone/{chunk-VFFW3ANI.js → chunk-GPOSJNMV.js} +5 -5
- package/dist/standalone/chunk-GQYA5W5T.js +1 -0
- package/dist/standalone/chunk-HFYFYNSX.js +1 -0
- package/dist/standalone/chunk-HKLF627N.js +1 -0
- package/dist/standalone/{chunk-PSMQQV6S.js → chunk-HKPDPKXD.js} +1 -1
- package/dist/standalone/chunk-HLAAOW33.js +1 -0
- package/dist/standalone/{chunk-75M6ZLLS.js → chunk-HOPAJ5F6.js} +2 -2
- package/dist/standalone/{chunk-7Y3SY37W.js → chunk-IBJVVHV5.js} +1 -1
- package/dist/standalone/{chunk-VESGIGMQ.js → chunk-IH2CJZF2.js} +1 -1
- package/dist/standalone/chunk-JAHK7RRJ.js +1 -0
- package/dist/standalone/chunk-JG2C7SS2.js +1 -0
- package/dist/standalone/chunk-JGMQQ3S7.js +1 -0
- package/dist/standalone/{chunk-3YXASVTP.js → chunk-JTGGWF7R.js} +1 -1
- package/dist/standalone/chunk-KFNDET5D.js +1 -0
- package/dist/standalone/{chunk-NXQW5E6W.js → chunk-KRPXOSBL.js} +1 -1
- package/dist/standalone/{chunk-7Q256NLI.js → chunk-KYONGQQ4.js} +1 -1
- package/dist/standalone/{chunk-OPM7ESDV.js → chunk-LIGOLZND.js} +1 -1
- package/dist/standalone/{chunk-VQRCJJXS.js → chunk-LKCO3E2B.js} +1 -1
- package/dist/standalone/chunk-LOV52GLG.js +1 -0
- package/dist/standalone/chunk-LPINY2IJ.js +19 -0
- package/dist/standalone/{chunk-XKISL2CG.js → chunk-LRXCL6IA.js} +1 -1
- package/dist/standalone/{chunk-OQ6I6OXT.js → chunk-LUHXNZI4.js} +1 -1
- package/dist/standalone/chunk-MD67S53Z.js +1 -0
- package/dist/standalone/{chunk-HIJGQX6F.js → chunk-MDAXV2XH.js} +1 -1
- package/dist/standalone/{chunk-ZN7TURF4.js → chunk-MFNO5BFR.js} +1 -1
- package/dist/standalone/chunk-MMJTKSHL.js +1 -0
- package/dist/standalone/chunk-NMVFSJM7.js +1 -0
- package/dist/standalone/chunk-NVHHB5EV.js +2 -0
- package/dist/standalone/chunk-O3FDK56W.js +1 -0
- package/dist/standalone/{chunk-C7FJ2JKY.js → chunk-OECMBE6Q.js} +1 -1
- package/dist/standalone/chunk-OSJ7HV7B.js +1 -0
- package/dist/standalone/chunk-OUFWXYEF.js +1 -0
- package/dist/standalone/chunk-OXFKZ4BM.js +1 -0
- package/dist/standalone/{chunk-63QLK2KW.js → chunk-P5GAJKDW.js} +1 -1
- package/dist/standalone/chunk-P6L6ABWO.js +1 -0
- package/dist/standalone/chunk-PZZWUL5U.js +1 -0
- package/dist/standalone/chunk-QAQVT4FS.js +1 -0
- package/dist/standalone/{chunk-VCFEO3RI.js → chunk-R36QXQZX.js} +1 -1
- package/dist/standalone/chunk-R3KLR5EP.js +1 -0
- package/dist/standalone/chunk-RXVXXRYD.js +1 -0
- package/dist/standalone/chunk-S7XAAH7U.js +1 -0
- package/dist/standalone/{chunk-E4PXACVL.js → chunk-SDQH4HR6.js} +1 -1
- package/dist/standalone/chunk-SFY646MC.js +1 -0
- package/dist/standalone/{chunk-VDC6JP4A.js → chunk-SJLEEYCR.js} +1 -1
- package/dist/standalone/{chunk-ZKJS6EBE.js → chunk-SLIDAWNX.js} +1 -1
- package/dist/standalone/chunk-SOO2HXV6.js +1 -0
- package/dist/standalone/chunk-SXD6JQXF.js +1 -0
- package/dist/standalone/{chunk-AUGKHAMQ.js → chunk-SYGCASPT.js} +1 -1
- package/dist/standalone/{chunk-2I4NHEKA.js → chunk-TDVDZ7XQ.js} +1 -1
- package/dist/standalone/chunk-TRZTGE4R.js +1 -0
- package/dist/standalone/chunk-TWMS2TMF.js +1 -0
- package/dist/standalone/chunk-U76DVXTR.js +21 -0
- package/dist/standalone/chunk-UTX6IBA3.js +1 -0
- package/dist/standalone/chunk-UZIBQZ2F.js +1 -0
- package/dist/standalone/chunk-VB6YJKPA.js +1 -0
- package/dist/standalone/{chunk-CVXNHIQW.js → chunk-VEWQWS3J.js} +1 -1
- package/dist/standalone/{chunk-UC7MNI2F.js → chunk-W2BCSK5S.js} +1 -1
- package/dist/standalone/chunk-W2XSKODB.js +1 -0
- package/dist/standalone/{chunk-MVWZMWPD.js → chunk-W7MRISE3.js} +1 -1
- package/dist/standalone/chunk-W7Z35E2E.js +1 -0
- package/dist/standalone/chunk-WIET27J3.js +1 -0
- package/dist/standalone/chunk-WQGT24W6.js +1 -0
- package/dist/standalone/{chunk-GZEWLX7U.js → chunk-WS36BO4R.js} +1 -1
- package/dist/standalone/chunk-WZTY3ZYI.js +1 -0
- package/dist/standalone/chunk-X5KWBDTF.js +1 -0
- package/dist/standalone/chunk-X74GEPSG.js +1 -0
- package/dist/standalone/chunk-XBZUJDHD.js +1 -0
- package/dist/standalone/chunk-XMEVNOCA.js +1 -0
- package/dist/standalone/chunk-XWEDIIIT.js +1 -0
- package/dist/standalone/{chunk-GHQ2VDI2.js → chunk-XYR5NST4.js} +1 -1
- package/dist/standalone/{chunk-XGCIDUJF.js → chunk-YHTHRYP5.js} +1 -1
- package/dist/standalone/{chunk-RX755NMO.js → chunk-YJ2WHOGO.js} +1 -1
- package/dist/standalone/chunk-YJWR6ZWC.js +1 -0
- package/dist/standalone/{chunk-CGQMJYCW.js → chunk-Z5EV64KS.js} +1 -1
- package/dist/standalone/{chunk-LVIL2SFA.js → chunk-ZBFWT34B.js} +1 -1
- package/dist/standalone/{chunk-AUAECCXB.js → chunk-ZBON5T5A.js} +1 -1
- package/dist/standalone/chunk-ZGSL4DPP.js +1 -0
- package/dist/standalone/chunk-ZMQ6PKLN.js +1 -0
- package/dist/standalone/{chunk-SJQERRSZ.js → chunk-ZTOREMGH.js} +1 -1
- package/dist/standalone/chunk-ZTOXQK4V.js +1 -0
- package/dist/standalone/chunk-ZWDORIZY.js +1 -0
- package/dist/standalone/chunk-ZZAJHNZ6.js +1 -0
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
- package/dist/packem_chunks/sparkline.mjs +0 -1
- package/dist/packem_shared/ApiReferencePanel-DlYVADAy.mjs +0 -1
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs +0 -1
- package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs +0 -1
- package/dist/packem_shared/GlobalDataBrowser-CPfjubP_.mjs +0 -1
- package/dist/packem_shared/MigrationsPanel-Dzjf42y8.mjs +0 -1
- package/dist/packem_shared/OpenRpcReferencePanel-nYyfjjse.mjs +0 -1
- package/dist/packem_shared/ScheduledJobs-BJ1uZW1U.mjs +0 -1
- package/dist/packem_shared/Studio-CgqntIfx.mjs +0 -1
- package/dist/packem_shared/StudioApp-DfFjQPGJ.mjs +0 -1
- package/dist/packem_shared/home-panel-BJXZsAaD.mjs +0 -3
- package/dist/packem_shared/studio-CFSjGWyw.mjs +0 -2
- package/dist/packem_shared/use-admin-query-CLStXJ7v.mjs +0 -1
- package/dist/packem_shared/use-auth-config-DtZeS_qf.mjs +0 -1
- package/dist/packem_shared/use-sql-assistant-DxNeNdCs.mjs +0 -1
- package/dist/standalone/chunk-2IKDEUCX.js +0 -1
- package/dist/standalone/chunk-37WYCOQ2.js +0 -1
- package/dist/standalone/chunk-4H5PBJNF.js +0 -1
- package/dist/standalone/chunk-4UBF7HMZ.js +0 -1
- package/dist/standalone/chunk-533J6WYA.js +0 -1
- package/dist/standalone/chunk-5QR2SQIS.js +0 -1
- package/dist/standalone/chunk-5ZNIQENA.js +0 -1
- package/dist/standalone/chunk-63Z6OJ6G.js +0 -1
- package/dist/standalone/chunk-74IYYDDI.js +0 -19
- package/dist/standalone/chunk-7EHAUFJY.js +0 -2
- package/dist/standalone/chunk-7G4Z6Q7X.js +0 -1
- package/dist/standalone/chunk-7RKB5KS7.js +0 -1
- package/dist/standalone/chunk-7TN6VTTF.js +0 -1
- package/dist/standalone/chunk-AWWECTQT.js +0 -1
- package/dist/standalone/chunk-AXL4YZJR.js +0 -1
- package/dist/standalone/chunk-COK5BCWN.js +0 -1
- package/dist/standalone/chunk-CULVXE3K.js +0 -1
- package/dist/standalone/chunk-E4BAGQ53.js +0 -1
- package/dist/standalone/chunk-EBTYSPZB.js +0 -1
- package/dist/standalone/chunk-EC5PMSQ6.js +0 -1
- package/dist/standalone/chunk-ECY2JC5F.js +0 -1
- package/dist/standalone/chunk-EWMBX5N2.js +0 -1
- package/dist/standalone/chunk-FPI7AMQJ.js +0 -1
- package/dist/standalone/chunk-GC5UHRDR.js +0 -1
- package/dist/standalone/chunk-GRHO2IUN.js +0 -1
- package/dist/standalone/chunk-GUDC24NJ.js +0 -1
- package/dist/standalone/chunk-H467GBSD.js +0 -1
- package/dist/standalone/chunk-HBO4SMAO.js +0 -15
- package/dist/standalone/chunk-HBTGWHTW.js +0 -1
- package/dist/standalone/chunk-HCTJKP5J.js +0 -1
- package/dist/standalone/chunk-HZTJLEIJ.js +0 -1
- package/dist/standalone/chunk-I26MS5PJ.js +0 -1
- package/dist/standalone/chunk-IRKWOUXO.js +0 -1
- package/dist/standalone/chunk-IUSKFS3B.js +0 -1
- package/dist/standalone/chunk-K2EHRNYW.js +0 -1
- package/dist/standalone/chunk-L5MI4PTP.js +0 -1
- package/dist/standalone/chunk-LXCVA5SP.js +0 -1
- package/dist/standalone/chunk-LYQZERWS.js +0 -1
- package/dist/standalone/chunk-MPEIBWCJ.js +0 -1
- package/dist/standalone/chunk-NCFYQR4L.js +0 -1
- package/dist/standalone/chunk-NCPW7WHO.js +0 -1
- package/dist/standalone/chunk-NOS2OC45.js +0 -1
- package/dist/standalone/chunk-NQZALRU3.js +0 -1
- package/dist/standalone/chunk-OQ2ORNN6.js +0 -1
- package/dist/standalone/chunk-OVBYLXPD.js +0 -1
- package/dist/standalone/chunk-OWQHP4KI.js +0 -1
- package/dist/standalone/chunk-PKSRXFSZ.js +0 -1
- package/dist/standalone/chunk-Q6ED4KUL.js +0 -1
- package/dist/standalone/chunk-QAQDMS6R.js +0 -1
- package/dist/standalone/chunk-QC2GLF3I.js +0 -1
- package/dist/standalone/chunk-QFK4UI4Q.js +0 -1
- package/dist/standalone/chunk-QJ4AALXU.js +0 -1
- package/dist/standalone/chunk-QJLHH3ET.js +0 -1
- package/dist/standalone/chunk-R3RBUT32.js +0 -1
- package/dist/standalone/chunk-RNYOBPQA.js +0 -1
- package/dist/standalone/chunk-RWVIV3U7.js +0 -1
- package/dist/standalone/chunk-RYBLB23Z.js +0 -1
- package/dist/standalone/chunk-S3EWTSAN.js +0 -1
- package/dist/standalone/chunk-S4AR74DJ.js +0 -3
- package/dist/standalone/chunk-S4Z7K55A.js +0 -1
- package/dist/standalone/chunk-SA2OGF3F.js +0 -1
- package/dist/standalone/chunk-SFMIR4YV.js +0 -1
- package/dist/standalone/chunk-SROQCZ3P.js +0 -1
- package/dist/standalone/chunk-T4SIZOJG.js +0 -1
- package/dist/standalone/chunk-U37BPX5J.js +0 -1
- package/dist/standalone/chunk-UFZVSXRW.js +0 -1
- package/dist/standalone/chunk-UQWGBWQ3.js +0 -1
- package/dist/standalone/chunk-V6LPISRQ.js +0 -1
- package/dist/standalone/chunk-WEPM5G3R.js +0 -1
- package/dist/standalone/chunk-WGBAHXMK.js +0 -1
- package/dist/standalone/chunk-WGUN4FNJ.js +0 -1
- package/dist/standalone/chunk-WJRYEML4.js +0 -1
- package/dist/standalone/chunk-WNMY5ZKL.js +0 -1
- package/dist/standalone/chunk-YBDF3DET.js +0 -7
- package/dist/standalone/chunk-YJI56OCF.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{E as se}from"../packem_shared/error-alert-
|
|
1
|
+
import{E as se}from"../packem_shared/error-alert-54TiaMvZ.mjs";import{B as ie}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as g}from"../packem_shared/button-q0UYSmrn.mjs";import{E as oe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ne}from"../packem_shared/input-CXhxesPC.mjs";import{S as le}from"../packem_shared/scroll-area-CXCQH7VT.mjs";import{Separator as de}from"@base-ui/react/separator";import{c as ce}from"../packem_shared/utils-bhneXptQ.mjs";import{jsx as t,jsxs as n,Fragment as me}from"react/jsx-runtime";import{useT as ue}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{c as ae,d as X,b as Z,f as ee,g as he,h as te}from"../packem_shared/internal-BXEjuLPN.mjs";import{c as pe}from"react/compiler-runtime";import{useState as F}from"react";import{u as fe}from"../packem_shared/use-admin-query-BW9IuacC.mjs";import{useAutoRefresh as xe}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-CG7Q45ZS.mjs";import{u as be}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{ADMIN_FUNCTIONS as J}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";function ge({className:r,orientation:e="horizontal",...i}){return t(de,{"data-slot":"separator",orientation:e,className:ce("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",r),...i})}const ve=/https?:\/\/[^\s"'<>)]+/i,re=r=>r===void 0?void 0:ve.exec(r)?.[0],v=r=>r===void 0?"":Array.isArray(r)?r.join(", "):r,Ne=/<a\s(?:[^>]*?\s)?href\s*=\s*["'](https?:\/\/[^"'\s]+)["']/iu,we=/&(?:amp|#0*38|#x0*26);/giu,ye=r=>r===void 0?void 0:((r.html===void 0?void 0:Ne.exec(r.html)?.[1])??re(r.text)??re(r.html))?.replaceAll(we,"&"),Ce=(r,e)=>{const i=e.trim().toLowerCase();return i===""?r:r.filter(o=>`${o.subject} ${v(o.to)} ${v(o.cc)}`.toLowerCase().includes(i))},Se=(r,e)=>{if(r.length!==0)return r.find(i=>i.id===e)??r[0]},Te=ae(J.clearCapturedMail),ke=ae(J.sendTestMail),Ae=r=>{const e=pe(36),{limit:i}=r,o=be();let p;e[0]!==i?(p={limit:i},e[0]=i,e[1]=p):p=e[1];const{data:P,error:N,errorSource:w,isLoading:b,poll:R,refetch:m}=fe(J.getCapturedMail,p),[y,f]=F(null),[O,C]=F(null),[s,h]=F("html"),[x,H]=F(""),a=P?.entries??[],u=N??y,B=N===null?y:w;let S;e[2]!==o||e[3]!==m?(S=async()=>{f(null);try{await o.query(Te,{},X("")),C(null),m()}catch(d){f(Z(d))}},e[2]=o,e[3]=m,e[4]=S):S=e[4];const D=S;let T;e[5]!==o||e[6]!==m?(T=async()=>{f(null);try{await o.query(ke,{},X("")),m()}catch(d){f(Z(d))}},e[5]=o,e[6]=m,e[7]=T):T=e[7];const q=T;xe(R,!0);let k;e[8]!==D?(k=()=>{ee(D())},e[8]=D,e[9]=k):k=e[9];const U=k;let A;e[10]!==q?(A=()=>{ee(q())},e[10]=q,e[11]=A):A=e[11];const W=A;let E;e[12]===Symbol.for("react.memo_cache_sentinel")?(E=d=>{H(d.currentTarget.value)},e[12]=E):E=e[12];const K=E;let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=d=>{const{id:c}=d.currentTarget.dataset;c!==void 0&&C(c)},e[13]=_):_=e[13];const Q=_;let L;e[14]===Symbol.for("react.memo_cache_sentinel")?(L=d=>{const c=d.currentTarget.dataset.tab;(c==="headers"||c==="html"||c==="text")&&h(c)},e[14]=L):L=e[14];const V=L,M=Ce(a,x),I=Se(M,O),l=ye(I);let j;e[15]!==l?(j=()=>{l!==void 0&&he(l)},e[15]=l,e[16]=j):j=e[16];const Y=j;let $;e[17]!==l?($=()=>{l!==void 0&&"window"in globalThis&&globalThis.window.open(l,"_blank","noopener")},e[17]=l,e[18]=$):$=e[18];const G=$;let z;return e[19]!==a||e[20]!==u||e[21]!==B||e[22]!==x||e[23]!==b||e[24]!==l||e[25]!==U||e[26]!==Y||e[27]!==K||e[28]!==G||e[29]!==Q||e[30]!==V||e[31]!==W||e[32]!==I||e[33]!==s||e[34]!==M?(z={entries:a,error:u,errorSource:B,filter:x,isLoading:b,link:l,onClear:U,onCopyLink:Y,onFilterChange:K,onOpenLink:G,onSelectMessage:Q,onSelectTab:V,onSendTest:W,selected:I,tab:s,visible:M},e[19]=a,e[20]=u,e[21]=B,e[22]=x,e[23]=b,e[24]=l,e[25]=U,e[26]=Y,e[27]=K,e[28]=G,e[29]=Q,e[30]=V,e[31]=W,e[32]=I,e[33]=s,e[34]=M,e[35]=z):z=e[35],z},Ee=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,_e=r=>`${Ee}${r}`,Qe=({limit:r=100})=>{const e=ue(),{entries:i,error:o,errorSource:p,filter:P,isLoading:N,link:w,onClear:b,onCopyLink:R,onFilterChange:m,onOpenLink:y,onSelectMessage:f,onSelectTab:O,onSendTest:C,selected:s,tab:h,visible:x}=Ae({limit:r}),H=a=>e(a==="html"?"HTML":a==="text"?"Plain text":"Headers");return n("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[n("div",{className:"flex flex-wrap items-center gap-2",children:[t(g,{"data-testid":"mail-send-test",onClick:C,size:"sm",type:"button",variant:"outline",children:e("Send test")}),t(g,{"data-testid":"mail-clear",disabled:i.length===0,onClick:b,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),i.length>0&&t(ie,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:i.length})})]}),o!==null&&t(se,{error:p,testId:"mail-error"}),o===null&&!N&&i.length===0&&t(oe,{description:e("Email your app sends in dev is captured here — nothing is delivered."),icon:n("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("path",{d:"M4 5h16v14H4z"}),t("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),i.length>0&&n("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[n("div",{className:"flex flex-col gap-2",children:[t(ne,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:m,placeholder:e("Filter messages"),type:"search",value:P}),t(le,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:t("ul",{className:"divide-y",children:x.map(a=>{const u=a.id===s?.id;return t("li",{children:n("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${u?"bg-muted":""}`,"data-active":u,"data-id":a.id,"data-testid":"mail-list-item",onClick:f,type:"button",children:[t("span",{className:"w-full truncate font-medium",children:a.subject||e("(no subject)")}),t("span",{className:"w-full truncate text-xs text-muted-foreground",children:v(a.to)}),t("span",{className:"text-xs text-muted-foreground tabular-nums",children:te(a.capturedAt,"—")})]})},a.id)})})})]}),s!==void 0&&n("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[n("div",{className:"flex flex-col gap-1",children:[t("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:s.subject||e("(no subject)")}),n("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[t("dt",{children:e("From")}),t("dd",{className:"truncate font-mono",children:s.from??"—"}),t("dt",{children:e("To")}),t("dd",{className:"truncate font-mono",children:v(s.to)}),s.cc!==void 0&&s.cc.length>0&&n(me,{children:[t("dt",{children:e("Cc")}),t("dd",{className:"truncate font-mono",children:v(s.cc)})]}),t("dt",{children:e("Sent")}),t("dd",{className:"tabular-nums",children:te(s.capturedAt,"—")})]})]}),n("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[t(g,{"data-testid":"mail-copy-link",disabled:w===void 0,onClick:R,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),t(g,{"data-testid":"mail-open-link",disabled:w===void 0,onClick:y,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),t(ge,{}),t("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(a=>t(g,{"aria-selected":h===a,"data-tab":a,"data-testid":`mail-tab-${a}`,onClick:O,role:"tab",size:"sm",type:"button",variant:h===a?"secondary":"ghost",children:H(a)},a))}),n("div",{className:"min-h-[12rem]",children:[h==="html"&&(s.html===void 0?t("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):t("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:_e(s.html),title:e("Email preview")})),h==="text"&&(s.text===void 0?t("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):t("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:s.text})),h==="headers"&&(s.headers===void 0||Object.keys(s.headers).length===0?t("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):t("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(s.headers).map(([a,u])=>`${a}: ${u}`).join(`
|
|
2
2
|
`)}))]})]})]})]})};export{Qe as MailPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLunora as ht}from"@lunora/react";import{useState as pe,useRef as Je,useEffect as et,useMemo as gt}from"react";import{L as pt}from"../packem_shared/live-status-BuJdUZFU.mjs";import{ShardInput as xt}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as tt}from"../packem_shared/button-q0UYSmrn.mjs";import{u as je}from"../packem_shared/use-admin-query-CLStXJ7v.mjs";import{u as bt}from"../packem_shared/use-open-trace-B_0LbTD7.mjs";import{u as vt}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as xe}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as Fe}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as yt}from"../packem_shared/cf-links-CBJ5SywP.mjs";import{j as Nt,n as Xe,f as St,d as wt,b as qt,c as Tt}from"../packem_shared/internal-BXEjuLPN.mjs";import{r as _t,l as Ct}from"../packem_shared/shard-history-CaO3C4KQ.mjs";import{c as Le}from"react/compiler-runtime";import{f as Rt}from"../packem_shared/log-fields-BolUoZ9g.mjs";import{B as Ze}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as he,a as ge,b as Pe,d as Mt,c as Qe}from"../packem_shared/card-By2O8ULa.mjs";import{b as Ve,e as oe,T as ot,c as de,a as ct,d as dt}from"../packem_shared/table-D0SBiDu-.mjs";import{stableStringify as kt}from"@lunora/wire";import{S as mt}from"../packem_shared/sparkline-B_sPPO_8.mjs";import{jsxs as n,jsx as t,Fragment as Ye}from"react/jsx-runtime";import{aggregateMetrics as It,computeLatencyPercentiles as Dt,enrichQueryStats as $t,shardsToAggregate as At}from"../packem_shared/aggregateMetrics-DKFJc-o5.mjs";import{S as me}from"../packem_shared/stat-card-BAv73QtB.mjs";import{b as rt,c as Lt,h as Et}from"../packem_shared/metrics-format-1sNGG47R.mjs";import{ResponsiveContainer as st,AreaChart as Ft,CartesianGrid as lt,XAxis as at,YAxis as it,Tooltip as nt,Area as zt,LineChart as Ot,Line as Kt}from"recharts";import{E as Bt}from"../packem_shared/empty-state-D7jEML_T.mjs";import{c as Pt}from"../packem_shared/utils-bhneXptQ.mjs";import{S as Qt,a as Ht,c as He,b as Ut,d as jt}from"../packem_shared/select-DPyS18Vy.mjs";const ut=(i,e,a)=>`${i}:${e}:${kt(a??{})}`,ft=(i,e)=>i==="gauge"?e.last:i==="histogram"?e.sum/Math.max(1,e.count):e.sum,Vt=(i,e)=>ft(i,e),Gt=i=>ft(i.kind,i),We=i=>Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}),Jt=i=>Array.isArray(i?.series)?i.series:[],Wt="FUNCTION_NOT_FOUND",Xt=i=>{const e=new Map;if(!Array.isArray(i?.series))return e;for(const a of i.series)e.set(ut(a.kind,a.name,a.attributes),a.points);return e},Yt={counter:"secondary",gauge:"default",histogram:"outline"},Zt=i=>{const e=Le(18),{name:a,onOpenTrace:s,traceId:r}=i,f=xe();if(r===void 0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t("span",{className:"text-muted-foreground",children:"—"}),e[0]=d):d=e[0],d}let o;e[1]!==r?(o=r.slice(0,8),e[1]=r,e[2]=o):o=e[2];const l=o;if(s===void 0){const d=`mt-instrument-trace-${a}`;let p;return e[3]!==l||e[4]!==d||e[5]!==r?(p=t("span",{className:"text-muted-foreground","data-testid":d,title:r,children:l}),e[3]=l,e[4]=d,e[5]=r,e[6]=p):p=e[6],p}const h=`mt-instrument-trace-${a}`;let v;e[7]!==s||e[8]!==r?(v=()=>{s(r)},e[7]=s,e[8]=r,e[9]=v):v=e[9];let w;e[10]!==f||e[11]!==r?(w=f("Open the exemplar trace {trace}",{trace:r}),e[10]=f,e[11]=r,e[12]=w):w=e[12];let g;return e[13]!==l||e[14]!==h||e[15]!==v||e[16]!==w?(g=t("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":h,onClick:v,title:w,type:"button",children:l}),e[13]=l,e[14]=h,e[15]=v,e[16]=w,e[17]=g):g=e[17],g},er=i=>{const e=Le(105),{onOpenTrace:a,shardKey:s}=i,r=xe();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let o;e[1]!==s?(o={live:!0,shardKey:s},e[1]=s,e[2]=o):o=e[2];const{data:l,error:h,errorSource:v}=je(Fe.getMetricSeries,f,o);let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let g;e[4]!==s?(g={live:!0,shardKey:s},e[4]=s,e[5]=g):g=e[5];const{data:d}=je(Fe.getMetricHistory,w,g);let p,y,q,C,c,T,x,b,_,R,u,M,k;if(e[6]!==l||e[7]!==h||e[8]!==v||e[9]!==d||e[10]!==a||e[11]!==r){b=Symbol.for("react.early_return_sentinel");e:{const F=Jt(l),z=Nt(v)===Wt;if(h!==null&&!z){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let P;e[27]!==m?(P=t("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=P):P=e[28];let Q;e[29]!==h||e[30]!==r?(Q=r("Instruments unavailable: {error}",{error:h}),e[29]=h,e[30]=r,e[31]=Q):Q=e[31];let U;e[32]!==Q?(U=t("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:Q}),e[32]=Q,e[33]=U):U=e[33];let j;e[34]!==P||e[35]!==U?(j=n("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[P,U]}),e[34]=P,e[35]=U,e[36]=j):j=e[36],b=j;break e}if(F.length===0){b=null;break e}const O=Xt(d);let L;e[37]!==r?(L=m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),e[37]=r,e[38]=L):L=e[38];const H=L;c="flex flex-col gap-2",T="mt-instruments";let B;e[39]!==r?(B=r("Instruments"),e[39]=r,e[40]=B):B=e[40],e[41]!==B?(x=t("h3",{className:"text-sm font-semibold text-foreground",children:B}),e[41]=B,e[42]=x):x=e[42],C=he,k="overflow-hidden py-0",q=ge,M="px-0",y=ot,R="mt-instruments-table";let E;e[43]!==r?(E=r("name"),e[43]=r,e[44]=E):E=e[44];let K;e[45]!==E?(K=t(de,{children:E}),e[45]=E,e[46]=K):K=e[46];let G;e[47]!==r?(G=r("kind"),e[47]=r,e[48]=G):G=e[48];let J;e[49]!==G?(J=t(de,{children:G}),e[49]=G,e[50]=J):J=e[50];let W;e[51]!==r?(W=r("value"),e[51]=r,e[52]=W):W=e[52];let X;e[53]!==W?(X=t(de,{className:"text-right",children:W}),e[53]=W,e[54]=X):X=e[54];let Y;e[55]!==r?(Y=r("count"),e[55]=r,e[56]=Y):Y=e[56];let Z;e[57]!==Y?(Z=t(de,{className:"text-right",children:Y}),e[57]=Y,e[58]=Z):Z=e[58];let ee;e[59]!==r?(ee=r("range"),e[59]=r,e[60]=ee):ee=e[60];let te;e[61]!==ee?(te=t(de,{className:"text-right",children:ee}),e[61]=ee,e[62]=te):te=e[62];let re;e[63]!==r?(re=r("trend"),e[63]=r,e[64]=re):re=e[64];let se;e[65]!==re?(se=t(de,{children:re}),e[65]=re,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ae;e[69]!==le?(ae=t(de,{children:le}),e[69]=le,e[70]=ae):ae=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let ne;e[73]!==ie?(ne=t(de,{children:ie}),e[73]=ie,e[74]=ne):ne=e[74],e[75]!==K||e[76]!==J||e[77]!==X||e[78]!==Z||e[79]!==te||e[80]!==se||e[81]!==ae||e[82]!==ne?(u=t(ct,{children:n(Ve,{children:[K,J,X,Z,te,se,ae,ne]})}),e[75]=K,e[76]=J,e[77]=X,e[78]=Z,e[79]=te,e[80]=se,e[81]=ae,e[82]=ne,e[83]=u):u=e[83],p=dt,_=F.map(m=>{const P=Rt(m.attributes),Q=ut(m.kind,m.name,m.attributes),j=(O.get(Q)??[]).map(ue=>Vt(m.kind,ue));return n(Ve,{"data-testid":`mt-instrument-${m.name}`,children:[t(oe,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),t(oe,{children:t(Ze,{variant:Yt[m.kind],children:H(m.kind)})}),t(oe,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:We(Gt(m))}),t(oe,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),t(oe,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"—":`${We(m.min)}–${We(m.max)}`}),t(oe,{children:j.length>=2?t(mt,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:j,testId:`mt-instrument-trend-${m.name}`}):t("span",{className:"text-xs text-muted-foreground",children:"—"})}),t(oe,{className:"font-mono text-xs",children:t(Zt,{name:m.name,onOpenTrace:a,traceId:m.exemplarTraceId})}),t(oe,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:P,children:P===""?"—":P})]},Q)})}e[6]=l,e[7]=h,e[8]=v,e[9]=d,e[10]=a,e[11]=r,e[12]=p,e[13]=y,e[14]=q,e[15]=C,e[16]=c,e[17]=T,e[18]=x,e[19]=b,e[20]=_,e[21]=R,e[22]=u,e[23]=M,e[24]=k}else p=e[12],y=e[13],q=e[14],C=e[15],c=e[16],T=e[17],x=e[18],b=e[19],_=e[20],R=e[21],u=e[22],M=e[23],k=e[24];if(b!==Symbol.for("react.early_return_sentinel"))return b;let I;e[84]!==p||e[85]!==_?(I=t(p,{children:_}),e[84]=p,e[85]=_,e[86]=I):I=e[86];let D;e[87]!==y||e[88]!==I||e[89]!==R||e[90]!==u?(D=n(y,{"data-testid":R,children:[u,I]}),e[87]=y,e[88]=I,e[89]=R,e[90]=u,e[91]=D):D=e[91];let S;e[92]!==q||e[93]!==D||e[94]!==M?(S=t(q,{className:M,children:D}),e[92]=q,e[93]=D,e[94]=M,e[95]=S):S=e[95];let N;e[96]!==C||e[97]!==S||e[98]!==k?(N=t(C,{className:k,children:S}),e[96]=C,e[97]=S,e[98]=k,e[99]=N):N=e[99];let A;return e[100]!==c||e[101]!==T||e[102]!==x||e[103]!==N?(A=n("section",{className:c,"data-testid":T,children:[x,N]}),e[100]=c,e[101]=T,e[102]=x,e[103]=N,e[104]=A):A=e[104],A},tr=i=>{const e=Le(74),{aggregate:a,shardResults:s}=i,r=xe();let f;e[0]!==r?(f=r("Shards"),e[0]=r,e[1]=f):f=e[1];let o;e[2]!==a.failed||e[3]!==a.reachable||e[4]!==r?(o=a.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:a.failed,reachable:a.reachable}):r("{reachable} reachable",{reachable:a.reachable}),e[2]=a.failed,e[3]=a.reachable,e[4]=r,e[5]=o):o=e[5];let l;e[6]!==f||e[7]!==o?(l=t(me,{label:f,testId:"mt-agg-shards",value:o}),e[6]=f,e[7]=o,e[8]=l):l=e[8];let h;e[9]!==r?(h=r("Total requests"),e[9]=r,e[10]=h):h=e[10];let v;e[11]!==a.totalRequests||e[12]!==h?(v=t(me,{label:h,testId:"mt-agg-requests",value:a.totalRequests}),e[11]=a.totalRequests,e[12]=h,e[13]=v):v=e[13];let w;e[14]!==r?(w=r("Total errors"),e[14]=r,e[15]=w):w=e[15];let g;e[16]!==a.totalErrors||e[17]!==w?(g=t(me,{label:w,testId:"mt-agg-errors",value:a.totalErrors}),e[16]=a.totalErrors,e[17]=w,e[18]=g):g=e[18];let d;e[19]!==r?(d=r("Total database size"),e[19]=r,e[20]=d):d=e[20];let p;e[21]!==a.totalDatabaseSize?(p=Xe(a.totalDatabaseSize),e[21]=a.totalDatabaseSize,e[22]=p):p=e[22];let y;e[23]!==d||e[24]!==p?(y=t(me,{label:d,testId:"mt-agg-db-size",value:p}),e[23]=d,e[24]=p,e[25]=y):y=e[25];let q;e[26]!==r?(q=r("Combined cache hit rate"),e[26]=r,e[27]=q):q=e[27];let C;e[28]!==a.hitRate||e[29]!==r?(C=a.hitRate===null?r("no cache configured"):`${(a.hitRate*100).toFixed(1)}%`,e[28]=a.hitRate,e[29]=r,e[30]=C):C=e[30];let c;e[31]!==q||e[32]!==C?(c=t(me,{label:q,testId:"mt-agg-cache",value:C}),e[31]=q,e[32]=C,e[33]=c):c=e[33];let T;e[34]!==y||e[35]!==c||e[36]!==l||e[37]!==v||e[38]!==g?(T=n("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[l,v,g,y,c]}),e[34]=y,e[35]=c,e[36]=l,e[37]=v,e[38]=g,e[39]=T):T=e[39];let x;e[40]!==r?(x=r("shard"),e[40]=r,e[41]=x):x=e[41];let b;e[42]!==x?(b=t(de,{children:x}),e[42]=x,e[43]=b):b=e[43];let _;e[44]!==r?(_=r("requests"),e[44]=r,e[45]=_):_=e[45];let R;e[46]!==_?(R=t(de,{children:_}),e[46]=_,e[47]=R):R=e[47];let u;e[48]!==r?(u=r("errors"),e[48]=r,e[49]=u):u=e[49];let M;e[50]!==u?(M=t(de,{children:u}),e[50]=u,e[51]=M):M=e[51];let k;e[52]!==r?(k=r("db size"),e[52]=r,e[53]=k):k=e[53];let I;e[54]!==k?(I=t(de,{children:k}),e[54]=k,e[55]=I):I=e[55];let D;e[56]!==b||e[57]!==R||e[58]!==M||e[59]!==I?(D=t(ct,{children:n(Ve,{children:[b,R,M,I]})}),e[56]=b,e[57]=R,e[58]=M,e[59]=I,e[60]=D):D=e[60];let S;if(e[61]!==s||e[62]!==r){let z;e[64]!==r?(z=O=>n(Ve,{"data-testid":`mt-agg-row-${O.shard}`,children:[t(oe,{children:O.shard}),O.metrics===null?t(oe,{className:"text-destructive",colSpan:3,children:O.error??r("unreachable")}):n(Ye,{children:[t(oe,{className:"tabular-nums",children:O.metrics.requests}),t(oe,{className:"tabular-nums",children:O.metrics.errors}),t(oe,{className:"tabular-nums",children:Xe(O.metrics.databaseSize)})]})]},O.shard),e[64]=r,e[65]=z):z=e[65],S=s.map(z),e[61]=s,e[62]=r,e[63]=S}else S=e[63];let N;e[66]!==S?(N=t(dt,{children:S}),e[66]=S,e[67]=N):N=e[67];let A;e[68]!==D||e[69]!==N?(A=t(he,{className:"overflow-hidden py-0",children:t(ge,{className:"px-0",children:n(ot,{"data-testid":"mt-agg-table",children:[D,N]})})}),e[68]=D,e[69]=N,e[70]=A):A=e[70];let F;return e[71]!==T||e[72]!==A?(F=n("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[T,A]}),e[71]=T,e[72]=A,e[73]=F):F=e[73],F},rr=i=>{const e=Le(75),{currentDelta:a,errorRate:s,history:r,latencyPercentiles:f,metrics:o}=i,l=xe(),{cache:h}=o;let v;e[0]!==r||e[1]!==l?(v=r.length>=2?t(mt,{ariaLabel:l("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=l,e[2]=v):v=e[2];let w;e[3]!==a||e[4]!==r.length||e[5]!==l?(w=r.length>=2?n(Ye,{children:[t("span",{className:"font-semibold text-foreground",children:`+${a.toLocaleString()}`})," ",l("last interval")]}):t("span",{"data-testid":"mt-sparkline-empty",children:l("collecting samples…")}),e[3]=a,e[4]=r.length,e[5]=l,e[6]=w):w=e[6];let g;e[7]!==l?(g=l("Requests"),e[7]=l,e[8]=g):g=e[8];let d;e[9]!==o.requests||e[10]!==v||e[11]!==w||e[12]!==g?(d=t(me,{chart:v,footer:w,label:g,testId:"mt-requests",value:o.requests}),e[9]=o.requests,e[10]=v,e[11]=w,e[12]=g,e[13]=d):d=e[13];let p;e[14]!==s||e[15]!==l?(p=l("{rate} error rate",{rate:s}),e[14]=s,e[15]=l,e[16]=p):p=e[16];let y;e[17]!==l?(y=l("Errors"),e[17]=l,e[18]=y):y=e[18];let q;e[19]!==s||e[20]!==o.errors?(q=n(Ye,{children:[o.errors," (",s,")"]}),e[19]=s,e[20]=o.errors,e[21]=q):q=e[21];let C;e[22]!==p||e[23]!==y||e[24]!==q?(C=t(me,{footer:p,label:y,testId:"mt-errors",value:q}),e[22]=p,e[23]=y,e[24]=q,e[25]=C):C=e[25];let c;e[26]!==f.p90?(c=f.p90>0?`P90 ${rt(f.p90)}`:void 0,e[26]=f.p90,e[27]=c):c=e[27];let T;e[28]!==l?(T=l("P95 latency"),e[28]=l,e[29]=T):T=e[29];let x;e[30]!==f.p95?(x=f.p95>0?rt(f.p95):"—",e[30]=f.p95,e[31]=x):x=e[31];let b;e[32]!==T||e[33]!==x||e[34]!==c?(b=t(me,{footer:c,label:T,testId:"mt-p95",value:x}),e[32]=T,e[33]=x,e[34]=c,e[35]=b):b=e[35];let _;e[36]!==h||e[37]!==l?(_=h?`${h.entries.toLocaleString()} ${l("cache entries")}`:void 0,e[36]=h,e[37]=l,e[38]=_):_=e[38];let R;e[39]!==l?(R=l("Database size"),e[39]=l,e[40]=R):R=e[40];let u;e[41]!==o.databaseSize?(u=Xe(o.databaseSize),e[41]=o.databaseSize,e[42]=u):u=e[42];let M;e[43]!==_||e[44]!==R||e[45]!==u?(M=t(me,{footer:_,label:R,testId:"mt-db-size",value:u}),e[43]=_,e[44]=R,e[45]=u,e[46]=M):M=e[46];let k;e[47]!==l?(k=l("Shard"),e[47]=l,e[48]=k):k=e[48];let I;e[49]!==o.shard||e[50]!==k?(I=t(me,{label:k,testId:"mt-shard",value:o.shard}),e[49]=o.shard,e[50]=k,e[51]=I):I=e[51];let D;e[52]!==l?(D=l("Uptime"),e[52]=l,e[53]=D):D=e[53];let S;e[54]!==o.uptimeMs?(S=Lt(o.uptimeMs),e[54]=o.uptimeMs,e[55]=S):S=e[55];let N;e[56]!==D||e[57]!==S?(N=t(me,{label:D,testId:"mt-uptime",value:S}),e[56]=D,e[57]=S,e[58]=N):N=e[58];let A;e[59]!==l?(A=l("Cache hit rate"),e[59]=l,e[60]=A):A=e[60];let F;e[61]!==h||e[62]!==l?(F=h?l("{rate} ({count} entries)",{count:h.entries,rate:Et(h.hits,h.misses)}):l("no cache configured"),e[61]=h,e[62]=l,e[63]=F):F=e[63];let z;e[64]!==A||e[65]!==F?(z=t(me,{label:A,testId:"mt-cache",value:F}),e[64]=A,e[65]=F,e[66]=z):z=e[66];let O;return e[67]!==b||e[68]!==M||e[69]!==I||e[70]!==N||e[71]!==z||e[72]!==d||e[73]!==C?(O=n("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[d,C,b,M,I,N,z]}),e[67]=b,e[68]=M,e[69]=I,e[70]=N,e[71]=z,e[72]=d,e[73]=C,e[74]=O):O=e[74],O},Ge=i=>i>=100?"critical":i>=50?"warning":"good",Ee=i=>i<1?`${(i*1e3).toFixed(0)}μs`:i<1e3?`${i.toFixed(1)}ms`:`${(i/1e3).toFixed(2)}s`,Ue=i=>i>=1e9?`${(i/1e9).toFixed(1)}B`:i>=1e6?`${(i/1e6).toFixed(1)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:i.toLocaleString(),sr=i=>{const e=Le(3),{level:a}=i;if(a==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t(Ze,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(a==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"}),e[1]=r):r=e[1],r}let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=t("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"}),e[2]=s):s=e[2],s},lr=(i,e)=>{const a=[...i];return a.sort((s,r)=>{switch(e){case"avgTime":return r.avgDurationMs-s.avgDurationMs;case"execCount":return r.execCount-s.execCount;case"rowsRead":return r.rowsRead-s.rowsRead;default:return r.totalDurationMs-s.totalDurationMs}}),a},ar=i=>{const e=Le(161),{queryStats:a}=i,s=xe(),[r,f]=pe("totalTime");let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=new Set,e[0]=o):o=e[0];const[l,h]=pe(o);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=k=>{k!==null&&f(k)},e[1]=v):v=e[1];const w=v;let g,d,p,y,q,C,c,T,x,b;if(e[2]!==l||e[3]!==a||e[4]!==r||e[5]!==s){p=Symbol.for("react.early_return_sentinel");e:{const k=lr(a,r);let I;e[16]!==a?(I=a.filter(ir),e[16]=a,e[17]=I):I=e[17];const D=I.length;let S;e[18]!==a?(S=a.filter(nr),e[18]=a,e[19]=S):S=e[19];const N=S.length;let A;e[20]!==a?(A=a.filter(or),e[20]=a,e[21]=A):A=e[21];const F=A.length;let z;e[22]===Symbol.for("react.memo_cache_sentinel")?(z=$=>{h(ce=>{const V=new Set(ce);return V.has($)?V.delete($):V.add($),V})},e[22]=z):z=e[22];const O=z;if(a.length===0){let $;e[23]!==s?($=s("No query insights yet"),e[23]=s,e[24]=$):$=e[24];let ce;e[25]!==$?(ce=t("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:$}),e[25]=$,e[26]=ce):ce=e[26];let V;e[27]!==s?(V=s("Query insights appear once statements are executed against this shard."),e[27]=s,e[28]=V):V=e[28];let fe;e[29]!==V?(fe=t("p",{className:"mt-1 text-sm",children:V}),e[29]=V,e[30]=fe):fe=e[30];let Be;e[31]!==ce||e[32]!==fe?(Be=t(he,{children:t(ge,{className:"py-12",children:n("div",{className:"text-center text-muted-foreground",children:[ce,fe]})})}),e[31]=ce,e[32]=fe,e[33]=Be):Be=e[33],p=Be;break e}c="space-y-4",T="qi-root";let L;e[34]!==s?(L=s("Critical queries"),e[34]=s,e[35]=L):L=e[35];let H;e[36]!==L?(H=t(Pe,{className:"pb-2",children:t(Qe,{className:"text-sm font-medium",children:L})}),e[36]=L,e[37]=H):H=e[37];let B;e[38]!==D?(B=t("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:D}),e[38]=D,e[39]=B):B=e[39];let E;e[40]!==s?(E=s(">100ms avg execution"),e[40]=s,e[41]=E):E=e[41];let K;e[42]!==E?(K=t("p",{className:"text-xs text-muted-foreground",children:E}),e[42]=E,e[43]=K):K=e[43];let G;e[44]!==B||e[45]!==K?(G=n(ge,{children:[B,K]}),e[44]=B,e[45]=K,e[46]=G):G=e[46];let J;e[47]!==H||e[48]!==G?(J=n(he,{children:[H,G]}),e[47]=H,e[48]=G,e[49]=J):J=e[49];let W;e[50]!==s?(W=s("Moderate queries"),e[50]=s,e[51]=W):W=e[51];let X;e[52]!==W?(X=t(Pe,{className:"pb-2",children:t(Qe,{className:"text-sm font-medium",children:W})}),e[52]=W,e[53]=X):X=e[53];let Y;e[54]!==N?(Y=t("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:N}),e[54]=N,e[55]=Y):Y=e[55];let Z;e[56]!==s?(Z=s("50–100ms avg execution"),e[56]=s,e[57]=Z):Z=e[57];let ee;e[58]!==Z?(ee=t("p",{className:"text-xs text-muted-foreground",children:Z}),e[58]=Z,e[59]=ee):ee=e[59];let te;e[60]!==Y||e[61]!==ee?(te=n(ge,{children:[Y,ee]}),e[60]=Y,e[61]=ee,e[62]=te):te=e[62];let re;e[63]!==X||e[64]!==te?(re=n(he,{children:[X,te]}),e[63]=X,e[64]=te,e[65]=re):re=e[65];let se;e[66]!==s?(se=s("Fast queries"),e[66]=s,e[67]=se):se=e[67];let le;e[68]!==se?(le=t(Pe,{className:"pb-2",children:t(Qe,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ae;e[70]!==F?(ae=t("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:F}),e[70]=F,e[71]=ae):ae=e[71];let ie;e[72]!==s?(ie=s("<50ms avg execution"),e[72]=s,e[73]=ie):ie=e[73];let ne;e[74]!==ie?(ne=t("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=ne):ne=e[75];let m;e[76]!==ae||e[77]!==ne?(m=n(ge,{children:[ae,ne]}),e[76]=ae,e[77]=ne,e[78]=m):m=e[78];let P;e[79]!==le||e[80]!==m?(P=n(he,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=P):P=e[81],e[82]!==J||e[83]!==re||e[84]!==P?(x=n("div",{className:"grid gap-4 md:grid-cols-3",children:[J,re,P]}),e[82]=J,e[83]=re,e[84]=P,e[85]=x):x=e[85];let Q;e[86]!==s?(Q=s("Query leaderboard"),e[86]=s,e[87]=Q):Q=e[87];let U;e[88]!==Q?(U=t("h3",{className:"text-lg font-semibold",children:Q}),e[88]=Q,e[89]=U):U=e[89];let j;e[90]!==r||e[91]!==s?(j=s("Slow queries sorted by {sortField}",{sortField:s(r)}),e[90]=r,e[91]=s,e[92]=j):j=e[92];let ue;e[93]!==j?(ue=t("p",{className:"text-sm text-muted-foreground",children:j}),e[93]=j,e[94]=ue):ue=e[94];let be;e[95]!==U||e[96]!==ue?(be=n("div",{children:[U,ue]}),e[95]=U,e[96]=ue,e[97]=be):be=e[97];let ve;e[98]!==s?(ve=s("Sort by"),e[98]=s,e[99]=ve):ve=e[99];let ye;e[100]!==ve?(ye=t("span",{className:"text-sm text-muted-foreground",children:ve}),e[100]=ve,e[101]=ye):ye=e[101];let Ne;e[102]!==s?(Ne=s("Sort queries by"),e[102]=s,e[103]=Ne):Ne=e[103];let ze;e[104]===Symbol.for("react.memo_cache_sentinel")?(ze=t(Qt,{}),e[104]=ze):ze=e[104];let Se;e[105]!==Ne?(Se=t(Ht,{"aria-label":Ne,className:"w-[140px]","data-testid":"qi-sort",children:ze}),e[105]=Ne,e[106]=Se):Se=e[106];let we;e[107]!==s?(we=s("Total time"),e[107]=s,e[108]=we):we=e[108];let qe;e[109]!==we?(qe=t(He,{value:"totalTime",children:we}),e[109]=we,e[110]=qe):qe=e[110];let Te;e[111]!==s?(Te=s("Avg time"),e[111]=s,e[112]=Te):Te=e[112];let _e;e[113]!==Te?(_e=t(He,{value:"avgTime",children:Te}),e[113]=Te,e[114]=_e):_e=e[114];let Ce;e[115]!==s?(Ce=s("Execution count"),e[115]=s,e[116]=Ce):Ce=e[116];let Re;e[117]!==Ce?(Re=t(He,{value:"execCount",children:Ce}),e[117]=Ce,e[118]=Re):Re=e[118];let Me;e[119]!==s?(Me=s("Rows read"),e[119]=s,e[120]=Me):Me=e[120];let ke;e[121]!==Me?(ke=t(He,{value:"rowsRead",children:Me}),e[121]=Me,e[122]=ke):ke=e[122];let Ie;e[123]!==qe||e[124]!==_e||e[125]!==Re||e[126]!==ke?(Ie=n(Ut,{children:[qe,_e,Re,ke]}),e[123]=qe,e[124]=_e,e[125]=Re,e[126]=ke,e[127]=Ie):Ie=e[127];let De;e[128]!==r||e[129]!==Se||e[130]!==Ie?(De=n(jt,{onValueChange:w,value:r,children:[Se,Ie]}),e[128]=r,e[129]=Se,e[130]=Ie,e[131]=De):De=e[131];let $e;e[132]!==ye||e[133]!==De?($e=n("div",{className:"flex items-center gap-2",children:[ye,De]}),e[132]=ye,e[133]=De,e[134]=$e):$e=e[134],e[135]!==be||e[136]!==$e?(b=n("div",{className:"flex items-center justify-between",children:[be,$e]}),e[135]=be,e[136]=$e,e[137]=b):b=e[137],d=he;let Ae;e[138]!==s?(Ae=s("Statements"),e[138]=s,e[139]=Ae):Ae=e[139];let Oe;e[140]!==Ae?(Oe=t(Qe,{children:Ae}),e[140]=Ae,e[141]=Oe):Oe=e[141],C=n(Pe,{children:[Oe,t(Mt,{children:s("{count} tracked statements",{count:k.length})})]}),g=ge,y="space-y-2";let Ke;e[142]!==l||e[143]!==s?(Ke=$=>{const ce=$.normalizedSql,V=l.has(ce),fe=Ge($.avgDurationMs);return n("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[n("button",{"aria-expanded":V,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:()=>{O(ce)},type:"button",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[t(sr,{level:fe}),t("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:$.normalizedSql})]}),n("div",{className:"flex shrink-0 items-center gap-4",children:[n("div",{className:"text-right",children:[t("div",{className:"text-sm font-medium",children:Ee($.totalDurationMs)}),t("div",{className:"text-xs text-muted-foreground",children:s("total")})]}),n("div",{className:"text-right",children:[t("div",{className:"text-sm font-medium",children:Ee($.avgDurationMs)}),t("div",{className:"text-xs text-muted-foreground",children:s("avg")})]}),$.p95DurationMs!==void 0&&n("div",{className:"text-right",children:[t("div",{className:"text-sm font-medium",children:Ee($.p95DurationMs)}),t("div",{className:"text-xs text-muted-foreground",children:s("p95")})]}),n("div",{className:"text-right",children:[t("div",{className:"text-sm font-medium",children:Ue($.execCount)}),t("div",{className:"text-xs text-muted-foreground",children:s("calls")})]})]})]}),V&&n("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[n("div",{children:[t("p",{className:"mb-2 text-sm font-medium",children:s("Full statement")}),t("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:$.normalizedSql})]}),n("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[$.p50DurationMs!==void 0&&n("div",{children:[t("span",{className:"text-muted-foreground",children:s("p50")}),t("span",{className:"block font-medium tabular-nums",children:Ee($.p50DurationMs)})]}),n("div",{children:[t("span",{className:"text-muted-foreground",children:s("Exec count")}),t("span",{className:"block font-medium tabular-nums",children:Ue($.execCount)})]}),n("div",{children:[t("span",{className:"text-muted-foreground",children:s("Total time")}),t("span",{className:"block font-medium tabular-nums",children:Ee($.totalDurationMs)})]}),n("div",{children:[t("span",{className:"text-muted-foreground",children:s("Rows read")}),t("span",{className:"block font-medium tabular-nums",children:Ue($.rowsRead)})]}),n("div",{children:[t("span",{className:"text-muted-foreground",children:s("Rows written")}),t("span",{className:"block font-medium tabular-nums",children:Ue($.rowsWritten)})]})]})]})]},ce)},e[142]=l,e[143]=s,e[144]=Ke):Ke=e[144],q=k.map(Ke)}e[2]=l,e[3]=a,e[4]=r,e[5]=s,e[6]=g,e[7]=d,e[8]=p,e[9]=y,e[10]=q,e[11]=C,e[12]=c,e[13]=T,e[14]=x,e[15]=b}else g=e[6],d=e[7],p=e[8],y=e[9],q=e[10],C=e[11],c=e[12],T=e[13],x=e[14],b=e[15];if(p!==Symbol.for("react.early_return_sentinel"))return p;let _;e[145]!==y||e[146]!==q?(_=t("div",{className:y,children:q}),e[145]=y,e[146]=q,e[147]=_):_=e[147];let R;e[148]!==g||e[149]!==_?(R=t(g,{children:_}),e[148]=g,e[149]=_,e[150]=R):R=e[150];let u;e[151]!==d||e[152]!==R||e[153]!==C?(u=n(d,{children:[C,R]}),e[151]=d,e[152]=R,e[153]=C,e[154]=u):u=e[154];let M;return e[155]!==u||e[156]!==c||e[157]!==T||e[158]!==x||e[159]!==b?(M=n("div",{className:c,"data-testid":T,children:[x,b,u]}),e[155]=u,e[156]=c,e[157]=T,e[158]=x,e[159]=b,e[160]=M):M=e[160],M};function ir(i){return Ge(i.avgDurationMs)==="critical"}function nr(i){return Ge(i.avgDurationMs)==="warning"}function or(i){return Ge(i.avgDurationMs)==="good"}const cr=["1m","5m","15m","1h"],dr=i=>new Date(i).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),mr=i=>i.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:dr(e.bucketMs)})),ur=({shardKey:i=""})=>{const e=xe(),[a,s]=pe("15m"),f=je(Fe.getQueryInsights,{range:a},{live:!0,shardKey:i}).data,o=mr(f?.buckets??[]);return n("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[n("div",{className:"flex flex-wrap items-center gap-2",children:[t("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:cr.map(l=>t("button",{"aria-pressed":l===a,className:Pt("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",l===a&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${l}`,onClick:()=>{s(l)},type:"button",children:l},l))}),f?.capped===!0&&t(Ze,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),o.length===0?t(Bt,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):n("div",{className:"grid gap-4 lg:grid-cols-2",children:[n("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[t("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),t(st,{height:140,width:"100%",children:n(Ft,{data:o,children:[t(lt,{strokeDasharray:"3 3",vertical:!1}),t(at,{dataKey:"label",fontSize:10,tickLine:!1}),t(it,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),t(nt,{}),t(zt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),n("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[t("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),t(st,{height:140,width:"100%",children:n(Ot,{data:o,children:[t(lt,{strokeDasharray:"3 3",vertical:!1}),t(at,{dataKey:"label",fontSize:10,tickLine:!1}),t(it,{fontSize:10,tickLine:!1,width:32}),t(nt,{}),t(Kt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),t(ar,{queryStats:f?.entries??[]})]})},fr=Tt(Fe.getMetrics),hr=(i,e)=>i?e:"overview",Qr=({initialShardKey:i})=>{const e=ht(),a=xe(),{queryShardKey:s,setShardKey:r,shardKey:f}=vt(i),[o,l]=pe("overview"),[h,v]=pe([]),w=Je(null),g=Je(null),d=Je(!0);et(()=>(d.current=!0,()=>{d.current=!1}),[]);const p=bt(s),{data:y,error:q,liveError:C}=je(Fe.getMetrics,{},{live:!0,shardKey:s}),c=y??null;et(()=>{if(y===void 0)return;_t(s);const L=y,H=w.current,B=g.current!==null&&g.current!==L.shard;if(g.current=L.shard,w.current=L.requests,B){v([]);return}H!==null&&L.requests>=H&&v(E=>[...E,L.requests-H].slice(-30))},[y,s]);const[T,x]=pe(null),[b,_]=pe(!1),R=async()=>{_(!0);const L=f,H=At(L,Ct());try{const B=await Promise.all(H.map(async E=>{try{const K=await e.query(fr,{},wt(E));return{error:null,metrics:K,shard:E===""?K.shard:E}}catch(K){return{error:qt(K),metrics:null,shard:E===""?"__root__":E}}}));d.current&&x({results:B,shard:L})}finally{d.current&&_(!1)}},u=T?.shard===f?T.results:null,M=u===null?null:It(u),k=c===null||c.requests===0?"—":`${(c.errors/c.requests*100).toFixed(1)}%`,I=h.length>0?h.at(-1):0,D=c?Dt(c):{p90:0,p95:0},S=gt(()=>{if(!c||!("queryStats"in c))return;const L=c.queryStats;if(!(!L||!Array.isArray(L)))return $t(L)},[c]),N=hr(S!==void 0,o),A=()=>{St(R())},F=()=>{x(null)},z=()=>{l("overview")},O=()=>{l("query-insights")};return n("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[n("div",{className:"flex flex-wrap items-center gap-2",children:[t(xt,{onChange:r,testId:"mt-shard-input",value:f}),t(pt,{message:C,prefix:"mt"}),t(tt,{"data-testid":"mt-aggregate",disabled:b,onClick:A,size:"sm",type:"button",variant:"secondary",children:a(b?"Aggregating…":"All shards")}),u!==null&&t(tt,{"data-testid":"mt-aggregate-clear",onClick:F,size:"sm",type:"button",variant:"ghost",children:a("Hide")}),t("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:yt,rel:"noreferrer",target:"_blank",children:a("Open in Cloudflare")})]}),q!==null&&t("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:q}),S!==void 0&&n("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[t("button",{className:`pb-2 text-sm font-medium transition-colors ${N==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:z,type:"button",children:a("Overview")}),n("button",{className:`pb-2 text-sm font-medium transition-colors ${N==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:O,type:"button",children:[a("Query insights"),S.length>0&&t("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:S.length})]})]}),N==="query-insights"&&S!==void 0&&t(ur,{shardKey:s}),N==="overview"&&c!==null&&t(rr,{currentDelta:I,errorRate:k,history:h,latencyPercentiles:D,metrics:c}),N==="overview"&&c===null&&null,N==="overview"&&t(er,{onOpenTrace:p,shardKey:s}),N==="overview"&&M!==null&&u!==null&&t(tr,{aggregate:M,shardResults:u})]})};export{Qr as MetricsPanel};
|
|
1
|
+
import{c as me}from"react/compiler-runtime";import{useState as be,useRef as Je,useEffect as We}from"react";import{L as gt}from"../packem_shared/live-status-D1GasNsH.mjs";import{ShardInput as pt}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{B as tt}from"../packem_shared/button-q0UYSmrn.mjs";import{u as je}from"../packem_shared/use-admin-query-BW9IuacC.mjs";import{u as xt}from"../packem_shared/use-open-trace-B_0LbTD7.mjs";import{u as bt}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{u as vt}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as ge}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as Fe}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as yt}from"../packem_shared/cf-links-CBJ5SywP.mjs";import{j as Nt,n as Xe,f as St,d as wt,b as Tt,c as qt}from"../packem_shared/internal-BXEjuLPN.mjs";import{l as _t,r as Ct}from"../packem_shared/shard-history-CaO3C4KQ.mjs";import{f as Rt}from"../packem_shared/log-fields-BolUoZ9g.mjs";import{B as et}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as pe,a as xe,b as Be,d as Mt,c as Qe}from"../packem_shared/card-By2O8ULa.mjs";import{b as Ve,e as ie,T as ct,c as oe,a as dt,d as mt}from"../packem_shared/table-D0SBiDu-.mjs";import{stableStringify as kt}from"@lunora/wire";import{S as ft}from"../packem_shared/sparkline-B_sPPO_8.mjs";import{jsxs as f,jsx as s,Fragment as Ze}from"react/jsx-runtime";import{aggregateMetrics as At,enrichQueryStats as It,shardsToAggregate as $t,computeLatencyPercentiles as Dt}from"../packem_shared/aggregateMetrics-DKFJc-o5.mjs";import{S as ce}from"../packem_shared/stat-card-BAv73QtB.mjs";import{b as st,c as Et,h as Lt}from"../packem_shared/metrics-format-1sNGG47R.mjs";import{ResponsiveContainer as rt,AreaChart as Ft,CartesianGrid as lt,XAxis as at,YAxis as it,Tooltip as nt,Area as Ot,LineChart as zt,Line as Kt}from"recharts";import{E as Pt}from"../packem_shared/empty-state-D7jEML_T.mjs";import{c as Bt}from"../packem_shared/utils-bhneXptQ.mjs";import{S as Qt,a as Ht,c as He,b as Ut,d as jt}from"../packem_shared/select-DPyS18Vy.mjs";const ut=(i,e,l)=>`${i}:${e}:${kt(l??{})}`,ht=(i,e)=>i==="gauge"?e.last:i==="histogram"?e.sum/Math.max(1,e.count):e.sum,Vt=(i,e)=>ht(i,e),Gt=i=>ht(i.kind,i),Ye=i=>Number.isInteger(i)?i.toLocaleString():i.toLocaleString(void 0,{maximumFractionDigits:2}),Yt=i=>Array.isArray(i?.series)?i.series:[],Jt="FUNCTION_NOT_FOUND",Wt=i=>{const e=new Map;if(!Array.isArray(i?.series))return e;for(const l of i.series)e.set(ut(l.kind,l.name,l.attributes),l.points);return e},Xt={counter:"secondary",gauge:"default",histogram:"outline"},Zt=i=>{const e=me(18),{name:l,onOpenTrace:r,traceId:t}=i,o=ge();if(t===void 0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s("span",{className:"text-muted-foreground",children:"—"}),e[0]=d):d=e[0],d}let n;e[1]!==t?(n=t.slice(0,8),e[1]=t,e[2]=n):n=e[2];const a=n;if(r===void 0){const d=`mt-instrument-trace-${l}`;let c;return e[3]!==a||e[4]!==d||e[5]!==t?(c=s("span",{className:"text-muted-foreground","data-testid":d,title:t,children:a}),e[3]=a,e[4]=d,e[5]=t,e[6]=c):c=e[6],c}const m=`mt-instrument-trace-${l}`;let p;e[7]!==r||e[8]!==t?(p=()=>{r(t)},e[7]=r,e[8]=t,e[9]=p):p=e[9];let h;e[10]!==o||e[11]!==t?(h=o("Open the exemplar trace {trace}",{trace:t}),e[10]=o,e[11]=t,e[12]=h):h=e[12];let u;return e[13]!==a||e[14]!==m||e[15]!==p||e[16]!==h?(u=s("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":m,onClick:p,title:h,type:"button",children:a}),e[13]=a,e[14]=m,e[15]=p,e[16]=h,e[17]=u):u=e[17],u},es=i=>{const e=me(105),{onOpenTrace:l,shardKey:r}=i,t=ge();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let n;e[1]!==r?(n={live:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];const{data:a,error:m,errorSource:p}=je(Fe.getMetricSeries,o,n);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let u;e[4]!==r?(u={live:!0,shardKey:r},e[4]=r,e[5]=u):u=e[5];const{data:d}=je(Fe.getMetricHistory,h,u);let c,x,g,v,b,S,y,w,M,_,N,$,q;if(e[6]!==a||e[7]!==m||e[8]!==p||e[9]!==d||e[10]!==l||e[11]!==t){w=Symbol.for("react.early_return_sentinel");e:{const E=Yt(a),L=Nt(p)===Jt;if(m!==null&&!L){let T;e[25]!==t?(T=t("Instruments"),e[25]=t,e[26]=T):T=e[26];let O;e[27]!==T?(O=s("h3",{className:"text-sm font-semibold text-foreground",children:T}),e[27]=T,e[28]=O):O=e[28];let z;e[29]!==m||e[30]!==t?(z=t("Instruments unavailable: {error}",{error:m}),e[29]=m,e[30]=t,e[31]=z):z=e[31];let K;e[32]!==z?(K=s("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:z}),e[32]=z,e[33]=K):K=e[33];let P;e[34]!==O||e[35]!==K?(P=f("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[O,K]}),e[34]=O,e[35]=K,e[36]=P):P=e[36],w=P;break e}if(E.length===0){w=null;break e}const F=Wt(d);let de;e[37]!==t?(de=T=>t(T==="counter"?"Counter":T==="gauge"?"Gauge":"Histogram"),e[37]=t,e[38]=de):de=e[38];const fe=de;b="flex flex-col gap-2",S="mt-instruments";let Q;e[39]!==t?(Q=t("Instruments"),e[39]=t,e[40]=Q):Q=e[40],e[41]!==Q?(y=s("h3",{className:"text-sm font-semibold text-foreground",children:Q}),e[41]=Q,e[42]=y):y=e[42],v=pe,q="overflow-hidden py-0",g=xe,$="px-0",x=ct,_="mt-instruments-table";let H;e[43]!==t?(H=t("name"),e[43]=t,e[44]=H):H=e[44];let U;e[45]!==H?(U=s(oe,{children:H}),e[45]=H,e[46]=U):U=e[46];let j;e[47]!==t?(j=t("kind"),e[47]=t,e[48]=j):j=e[48];let V;e[49]!==j?(V=s(oe,{children:j}),e[49]=j,e[50]=V):V=e[50];let G;e[51]!==t?(G=t("value"),e[51]=t,e[52]=G):G=e[52];let Y;e[53]!==G?(Y=s(oe,{className:"text-right",children:G}),e[53]=G,e[54]=Y):Y=e[54];let J;e[55]!==t?(J=t("count"),e[55]=t,e[56]=J):J=e[56];let W;e[57]!==J?(W=s(oe,{className:"text-right",children:J}),e[57]=J,e[58]=W):W=e[58];let X;e[59]!==t?(X=t("range"),e[59]=t,e[60]=X):X=e[60];let Z;e[61]!==X?(Z=s(oe,{className:"text-right",children:X}),e[61]=X,e[62]=Z):Z=e[62];let ee;e[63]!==t?(ee=t("trend"),e[63]=t,e[64]=ee):ee=e[64];let te;e[65]!==ee?(te=s(oe,{children:ee}),e[65]=ee,e[66]=te):te=e[66];let se;e[67]!==t?(se=t("trace"),e[67]=t,e[68]=se):se=e[68];let re;e[69]!==se?(re=s(oe,{children:se}),e[69]=se,e[70]=re):re=e[70];let le;e[71]!==t?(le=t("dimensions"),e[71]=t,e[72]=le):le=e[72];let ae;e[73]!==le?(ae=s(oe,{children:le}),e[73]=le,e[74]=ae):ae=e[74],e[75]!==U||e[76]!==V||e[77]!==Y||e[78]!==W||e[79]!==Z||e[80]!==te||e[81]!==re||e[82]!==ae?(N=s(dt,{children:f(Ve,{children:[U,V,Y,W,Z,te,re,ae]})}),e[75]=U,e[76]=V,e[77]=Y,e[78]=W,e[79]=Z,e[80]=te,e[81]=re,e[82]=ae,e[83]=N):N=e[83],c=mt,M=E.map(T=>{const O=Rt(T.attributes),z=ut(T.kind,T.name,T.attributes),P=(F.get(z)??[]).map(ue=>Vt(T.kind,ue));return f(Ve,{"data-testid":`mt-instrument-${T.name}`,children:[s(ie,{className:"font-mono text-xs",title:T.functionPath,children:T.name}),s(ie,{children:s(et,{variant:Xt[T.kind],children:fe(T.kind)})}),s(ie,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${T.name}`,children:Ye(Gt(T))}),s(ie,{className:"text-right tabular-nums text-muted-foreground",children:T.count.toLocaleString()}),s(ie,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:T.min===T.max?"—":`${Ye(T.min)}–${Ye(T.max)}`}),s(ie,{children:P.length>=2?s(ft,{ariaLabel:t("{name} trend",{name:T.name}),className:"h-6 w-24 text-foreground",series:P,testId:`mt-instrument-trend-${T.name}`}):s("span",{className:"text-xs text-muted-foreground",children:"—"})}),s(ie,{className:"font-mono text-xs",children:s(Zt,{name:T.name,onOpenTrace:l,traceId:T.exemplarTraceId})}),s(ie,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:O,children:O===""?"—":O})]},z)})}e[6]=a,e[7]=m,e[8]=p,e[9]=d,e[10]=l,e[11]=t,e[12]=c,e[13]=x,e[14]=g,e[15]=v,e[16]=b,e[17]=S,e[18]=y,e[19]=w,e[20]=M,e[21]=_,e[22]=N,e[23]=$,e[24]=q}else c=e[12],x=e[13],g=e[14],v=e[15],b=e[16],S=e[17],y=e[18],w=e[19],M=e[20],_=e[21],N=e[22],$=e[23],q=e[24];if(w!==Symbol.for("react.early_return_sentinel"))return w;let C;e[84]!==c||e[85]!==M?(C=s(c,{children:M}),e[84]=c,e[85]=M,e[86]=C):C=e[86];let k;e[87]!==x||e[88]!==C||e[89]!==_||e[90]!==N?(k=f(x,{"data-testid":_,children:[N,C]}),e[87]=x,e[88]=C,e[89]=_,e[90]=N,e[91]=k):k=e[91];let R;e[92]!==g||e[93]!==k||e[94]!==$?(R=s(g,{className:$,children:k}),e[92]=g,e[93]=k,e[94]=$,e[95]=R):R=e[95];let A;e[96]!==v||e[97]!==R||e[98]!==q?(A=s(v,{className:q,children:R}),e[96]=v,e[97]=R,e[98]=q,e[99]=A):A=e[99];let I;return e[100]!==b||e[101]!==S||e[102]!==y||e[103]!==A?(I=f("section",{className:b,"data-testid":S,children:[y,A]}),e[100]=b,e[101]=S,e[102]=y,e[103]=A,e[104]=I):I=e[104],I},ts=i=>{const e=me(74),{aggregate:l,shardResults:r}=i,t=ge();let o;e[0]!==t?(o=t("Shards"),e[0]=t,e[1]=o):o=e[1];let n;e[2]!==l.failed||e[3]!==l.reachable||e[4]!==t?(n=l.failed>0?t("{reachable} reachable, {failed} unreachable",{failed:l.failed,reachable:l.reachable}):t("{reachable} reachable",{reachable:l.reachable}),e[2]=l.failed,e[3]=l.reachable,e[4]=t,e[5]=n):n=e[5];let a;e[6]!==o||e[7]!==n?(a=s(ce,{label:o,testId:"mt-agg-shards",value:n}),e[6]=o,e[7]=n,e[8]=a):a=e[8];let m;e[9]!==t?(m=t("Total requests"),e[9]=t,e[10]=m):m=e[10];let p;e[11]!==l.totalRequests||e[12]!==m?(p=s(ce,{label:m,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=m,e[13]=p):p=e[13];let h;e[14]!==t?(h=t("Total errors"),e[14]=t,e[15]=h):h=e[15];let u;e[16]!==l.totalErrors||e[17]!==h?(u=s(ce,{label:h,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=h,e[18]=u):u=e[18];let d;e[19]!==t?(d=t("Total database size"),e[19]=t,e[20]=d):d=e[20];let c;e[21]!==l.totalDatabaseSize?(c=Xe(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=c):c=e[22];let x;e[23]!==d||e[24]!==c?(x=s(ce,{label:d,testId:"mt-agg-db-size",value:c}),e[23]=d,e[24]=c,e[25]=x):x=e[25];let g;e[26]!==t?(g=t("Combined cache hit rate"),e[26]=t,e[27]=g):g=e[27];let v;e[28]!==l.hitRate||e[29]!==t?(v=l.hitRate===null?t("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=t,e[30]=v):v=e[30];let b;e[31]!==g||e[32]!==v?(b=s(ce,{label:g,testId:"mt-agg-cache",value:v}),e[31]=g,e[32]=v,e[33]=b):b=e[33];let S;e[34]!==x||e[35]!==b||e[36]!==a||e[37]!==p||e[38]!==u?(S=f("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[a,p,u,x,b]}),e[34]=x,e[35]=b,e[36]=a,e[37]=p,e[38]=u,e[39]=S):S=e[39];let y;e[40]!==t?(y=t("shard"),e[40]=t,e[41]=y):y=e[41];let w;e[42]!==y?(w=s(oe,{children:y}),e[42]=y,e[43]=w):w=e[43];let M;e[44]!==t?(M=t("requests"),e[44]=t,e[45]=M):M=e[45];let _;e[46]!==M?(_=s(oe,{children:M}),e[46]=M,e[47]=_):_=e[47];let N;e[48]!==t?(N=t("errors"),e[48]=t,e[49]=N):N=e[49];let $;e[50]!==N?($=s(oe,{children:N}),e[50]=N,e[51]=$):$=e[51];let q;e[52]!==t?(q=t("db size"),e[52]=t,e[53]=q):q=e[53];let C;e[54]!==q?(C=s(oe,{children:q}),e[54]=q,e[55]=C):C=e[55];let k;e[56]!==w||e[57]!==_||e[58]!==$||e[59]!==C?(k=s(dt,{children:f(Ve,{children:[w,_,$,C]})}),e[56]=w,e[57]=_,e[58]=$,e[59]=C,e[60]=k):k=e[60];let R;if(e[61]!==r||e[62]!==t){let L;e[64]!==t?(L=F=>f(Ve,{"data-testid":`mt-agg-row-${F.shard}`,children:[s(ie,{children:F.shard}),F.metrics===null?s(ie,{className:"text-destructive",colSpan:3,children:F.error??t("unreachable")}):f(Ze,{children:[s(ie,{className:"tabular-nums",children:F.metrics.requests}),s(ie,{className:"tabular-nums",children:F.metrics.errors}),s(ie,{className:"tabular-nums",children:Xe(F.metrics.databaseSize)})]})]},F.shard),e[64]=t,e[65]=L):L=e[65],R=r.map(L),e[61]=r,e[62]=t,e[63]=R}else R=e[63];let A;e[66]!==R?(A=s(mt,{children:R}),e[66]=R,e[67]=A):A=e[67];let I;e[68]!==k||e[69]!==A?(I=s(pe,{className:"overflow-hidden py-0",children:s(xe,{className:"px-0",children:f(ct,{"data-testid":"mt-agg-table",children:[k,A]})})}),e[68]=k,e[69]=A,e[70]=I):I=e[70];let E;return e[71]!==S||e[72]!==I?(E=f("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[S,I]}),e[71]=S,e[72]=I,e[73]=E):E=e[73],E},ss=i=>{const e=me(75),{currentDelta:l,errorRate:r,history:t,latencyPercentiles:o,metrics:n}=i,a=ge(),{cache:m}=n;let p;e[0]!==t||e[1]!==a?(p=t.length>=2?s(ft,{ariaLabel:a("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:t,testId:"mt-sparkline"}):void 0,e[0]=t,e[1]=a,e[2]=p):p=e[2];let h;e[3]!==l||e[4]!==t.length||e[5]!==a?(h=t.length>=2?f(Ze,{children:[s("span",{className:"font-semibold text-foreground",children:`+${l.toLocaleString()}`})," ",a("last interval")]}):s("span",{"data-testid":"mt-sparkline-empty",children:a("collecting samples…")}),e[3]=l,e[4]=t.length,e[5]=a,e[6]=h):h=e[6];let u;e[7]!==a?(u=a("Requests"),e[7]=a,e[8]=u):u=e[8];let d;e[9]!==n.requests||e[10]!==p||e[11]!==h||e[12]!==u?(d=s(ce,{chart:p,footer:h,label:u,testId:"mt-requests",value:n.requests}),e[9]=n.requests,e[10]=p,e[11]=h,e[12]=u,e[13]=d):d=e[13];let c;e[14]!==r||e[15]!==a?(c=a("{rate} error rate",{rate:r}),e[14]=r,e[15]=a,e[16]=c):c=e[16];let x;e[17]!==a?(x=a("Errors"),e[17]=a,e[18]=x):x=e[18];let g;e[19]!==r||e[20]!==n.errors?(g=f(Ze,{children:[n.errors," (",r,")"]}),e[19]=r,e[20]=n.errors,e[21]=g):g=e[21];let v;e[22]!==c||e[23]!==x||e[24]!==g?(v=s(ce,{footer:c,label:x,testId:"mt-errors",value:g}),e[22]=c,e[23]=x,e[24]=g,e[25]=v):v=e[25];let b;e[26]!==o.p90?(b=o.p90>0?`P90 ${st(o.p90)}`:void 0,e[26]=o.p90,e[27]=b):b=e[27];let S;e[28]!==a?(S=a("P95 latency"),e[28]=a,e[29]=S):S=e[29];let y;e[30]!==o.p95?(y=o.p95>0?st(o.p95):"—",e[30]=o.p95,e[31]=y):y=e[31];let w;e[32]!==S||e[33]!==y||e[34]!==b?(w=s(ce,{footer:b,label:S,testId:"mt-p95",value:y}),e[32]=S,e[33]=y,e[34]=b,e[35]=w):w=e[35];let M;e[36]!==m||e[37]!==a?(M=m?`${m.entries.toLocaleString()} ${a("cache entries")}`:void 0,e[36]=m,e[37]=a,e[38]=M):M=e[38];let _;e[39]!==a?(_=a("Database size"),e[39]=a,e[40]=_):_=e[40];let N;e[41]!==n.databaseSize?(N=Xe(n.databaseSize),e[41]=n.databaseSize,e[42]=N):N=e[42];let $;e[43]!==M||e[44]!==_||e[45]!==N?($=s(ce,{footer:M,label:_,testId:"mt-db-size",value:N}),e[43]=M,e[44]=_,e[45]=N,e[46]=$):$=e[46];let q;e[47]!==a?(q=a("Shard"),e[47]=a,e[48]=q):q=e[48];let C;e[49]!==n.shard||e[50]!==q?(C=s(ce,{label:q,testId:"mt-shard",value:n.shard}),e[49]=n.shard,e[50]=q,e[51]=C):C=e[51];let k;e[52]!==a?(k=a("Uptime"),e[52]=a,e[53]=k):k=e[53];let R;e[54]!==n.uptimeMs?(R=Et(n.uptimeMs),e[54]=n.uptimeMs,e[55]=R):R=e[55];let A;e[56]!==k||e[57]!==R?(A=s(ce,{label:k,testId:"mt-uptime",value:R}),e[56]=k,e[57]=R,e[58]=A):A=e[58];let I;e[59]!==a?(I=a("Cache hit rate"),e[59]=a,e[60]=I):I=e[60];let E;e[61]!==m||e[62]!==a?(E=m?a("{rate} ({count} entries)",{count:m.entries,rate:Lt(m.hits,m.misses)}):a("no cache configured"),e[61]=m,e[62]=a,e[63]=E):E=e[63];let L;e[64]!==I||e[65]!==E?(L=s(ce,{label:I,testId:"mt-cache",value:E}),e[64]=I,e[65]=E,e[66]=L):L=e[66];let F;return e[67]!==w||e[68]!==$||e[69]!==C||e[70]!==A||e[71]!==L||e[72]!==d||e[73]!==v?(F=f("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[d,v,w,$,C,A,L]}),e[67]=w,e[68]=$,e[69]=C,e[70]=A,e[71]=L,e[72]=d,e[73]=v,e[74]=F):F=e[74],F},Ge=i=>i>=100?"critical":i>=50?"warning":"good",Le=i=>i<1?`${(i*1e3).toFixed(0)}μs`:i<1e3?`${i.toFixed(1)}ms`:`${(i/1e3).toFixed(2)}s`,Ue=i=>i>=1e9?`${(i/1e9).toFixed(1)}B`:i>=1e6?`${(i/1e6).toFixed(1)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:i.toLocaleString(),rs=i=>{const e=me(3),{level:l}=i;if(l==="critical"){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s(et,{variant:"destructive",children:"Slow"}),e[0]=t):t=e[0],t}if(l==="warning"){let t;return e[1]===Symbol.for("react.memo_cache_sentinel")?(t=s("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"}),e[1]=t):t=e[1],t}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"}),e[2]=r):r=e[2],r},ls=(i,e)=>{const l=[...i];return l.sort((r,t)=>{switch(e){case"avgTime":return t.avgDurationMs-r.avgDurationMs;case"execCount":return t.execCount-r.execCount;case"rowsRead":return t.rowsRead-r.rowsRead;default:return t.totalDurationMs-r.totalDurationMs}}),l},as=i=>{const e=me(161),{queryStats:l}=i,r=ge(),[t,o]=be("totalTime");let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=new Set,e[0]=n):n=e[0];const[a,m]=be(n);let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=q=>{q!==null&&o(q)},e[1]=p):p=e[1];const h=p;let u,d,c,x,g,v,b,S,y,w;if(e[2]!==a||e[3]!==l||e[4]!==t||e[5]!==r){c=Symbol.for("react.early_return_sentinel");e:{const q=ls(l,t);let C;e[16]!==l?(C=l.filter(is),e[16]=l,e[17]=C):C=e[17];const k=C.length;let R;e[18]!==l?(R=l.filter(ns),e[18]=l,e[19]=R):R=e[19];const A=R.length;let I;e[20]!==l?(I=l.filter(os),e[20]=l,e[21]=I):I=e[21];const E=I.length;let L;e[22]===Symbol.for("react.memo_cache_sentinel")?(L=D=>{m(ne=>{const B=new Set(ne);return B.has(D)?B.delete(D):B.add(D),B})},e[22]=L):L=e[22];const F=L;if(l.length===0){let D;e[23]!==r?(D=r("No query insights yet"),e[23]=r,e[24]=D):D=e[24];let ne;e[25]!==D?(ne=s("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:D}),e[25]=D,e[26]=ne):ne=e[26];let B;e[27]!==r?(B=r("Query insights appear once statements are executed against this shard."),e[27]=r,e[28]=B):B=e[28];let he;e[29]!==B?(he=s("p",{className:"mt-1 text-sm",children:B}),e[29]=B,e[30]=he):he=e[30];let Pe;e[31]!==ne||e[32]!==he?(Pe=s(pe,{children:s(xe,{className:"py-12",children:f("div",{className:"text-center text-muted-foreground",children:[ne,he]})})}),e[31]=ne,e[32]=he,e[33]=Pe):Pe=e[33],c=Pe;break e}b="space-y-4",S="qi-root";let de;e[34]!==r?(de=r("Critical queries"),e[34]=r,e[35]=de):de=e[35];let fe;e[36]!==de?(fe=s(Be,{className:"pb-2",children:s(Qe,{className:"text-sm font-medium",children:de})}),e[36]=de,e[37]=fe):fe=e[37];let Q;e[38]!==k?(Q=s("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:k}),e[38]=k,e[39]=Q):Q=e[39];let H;e[40]!==r?(H=r(">100ms avg execution"),e[40]=r,e[41]=H):H=e[41];let U;e[42]!==H?(U=s("p",{className:"text-xs text-muted-foreground",children:H}),e[42]=H,e[43]=U):U=e[43];let j;e[44]!==Q||e[45]!==U?(j=f(xe,{children:[Q,U]}),e[44]=Q,e[45]=U,e[46]=j):j=e[46];let V;e[47]!==fe||e[48]!==j?(V=f(pe,{children:[fe,j]}),e[47]=fe,e[48]=j,e[49]=V):V=e[49];let G;e[50]!==r?(G=r("Moderate queries"),e[50]=r,e[51]=G):G=e[51];let Y;e[52]!==G?(Y=s(Be,{className:"pb-2",children:s(Qe,{className:"text-sm font-medium",children:G})}),e[52]=G,e[53]=Y):Y=e[53];let J;e[54]!==A?(J=s("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:A}),e[54]=A,e[55]=J):J=e[55];let W;e[56]!==r?(W=r("50–100ms avg execution"),e[56]=r,e[57]=W):W=e[57];let X;e[58]!==W?(X=s("p",{className:"text-xs text-muted-foreground",children:W}),e[58]=W,e[59]=X):X=e[59];let Z;e[60]!==J||e[61]!==X?(Z=f(xe,{children:[J,X]}),e[60]=J,e[61]=X,e[62]=Z):Z=e[62];let ee;e[63]!==Y||e[64]!==Z?(ee=f(pe,{children:[Y,Z]}),e[63]=Y,e[64]=Z,e[65]=ee):ee=e[65];let te;e[66]!==r?(te=r("Fast queries"),e[66]=r,e[67]=te):te=e[67];let se;e[68]!==te?(se=s(Be,{className:"pb-2",children:s(Qe,{className:"text-sm font-medium",children:te})}),e[68]=te,e[69]=se):se=e[69];let re;e[70]!==E?(re=s("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:E}),e[70]=E,e[71]=re):re=e[71];let le;e[72]!==r?(le=r("<50ms avg execution"),e[72]=r,e[73]=le):le=e[73];let ae;e[74]!==le?(ae=s("p",{className:"text-xs text-muted-foreground",children:le}),e[74]=le,e[75]=ae):ae=e[75];let T;e[76]!==re||e[77]!==ae?(T=f(xe,{children:[re,ae]}),e[76]=re,e[77]=ae,e[78]=T):T=e[78];let O;e[79]!==se||e[80]!==T?(O=f(pe,{children:[se,T]}),e[79]=se,e[80]=T,e[81]=O):O=e[81],e[82]!==V||e[83]!==ee||e[84]!==O?(y=f("div",{className:"grid gap-4 md:grid-cols-3",children:[V,ee,O]}),e[82]=V,e[83]=ee,e[84]=O,e[85]=y):y=e[85];let z;e[86]!==r?(z=r("Query leaderboard"),e[86]=r,e[87]=z):z=e[87];let K;e[88]!==z?(K=s("h3",{className:"text-lg font-semibold",children:z}),e[88]=z,e[89]=K):K=e[89];let P;e[90]!==t||e[91]!==r?(P=r("Slow queries sorted by {sortField}",{sortField:r(t)}),e[90]=t,e[91]=r,e[92]=P):P=e[92];let ue;e[93]!==P?(ue=s("p",{className:"text-sm text-muted-foreground",children:P}),e[93]=P,e[94]=ue):ue=e[94];let ve;e[95]!==K||e[96]!==ue?(ve=f("div",{children:[K,ue]}),e[95]=K,e[96]=ue,e[97]=ve):ve=e[97];let ye;e[98]!==r?(ye=r("Sort by"),e[98]=r,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=s("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==r?(Se=r("Sort queries by"),e[102]=r,e[103]=Se):Se=e[103];let Oe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Oe=s(Qt,{}),e[104]=Oe):Oe=e[104];let we;e[105]!==Se?(we=s(Ht,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Oe}),e[105]=Se,e[106]=we):we=e[106];let Te;e[107]!==r?(Te=r("Total time"),e[107]=r,e[108]=Te):Te=e[108];let qe;e[109]!==Te?(qe=s(He,{value:"totalTime",children:Te}),e[109]=Te,e[110]=qe):qe=e[110];let _e;e[111]!==r?(_e=r("Avg time"),e[111]=r,e[112]=_e):_e=e[112];let Ce;e[113]!==_e?(Ce=s(He,{value:"avgTime",children:_e}),e[113]=_e,e[114]=Ce):Ce=e[114];let Re;e[115]!==r?(Re=r("Execution count"),e[115]=r,e[116]=Re):Re=e[116];let Me;e[117]!==Re?(Me=s(He,{value:"execCount",children:Re}),e[117]=Re,e[118]=Me):Me=e[118];let ke;e[119]!==r?(ke=r("Rows read"),e[119]=r,e[120]=ke):ke=e[120];let Ae;e[121]!==ke?(Ae=s(He,{value:"rowsRead",children:ke}),e[121]=ke,e[122]=Ae):Ae=e[122];let Ie;e[123]!==qe||e[124]!==Ce||e[125]!==Me||e[126]!==Ae?(Ie=f(Ut,{children:[qe,Ce,Me,Ae]}),e[123]=qe,e[124]=Ce,e[125]=Me,e[126]=Ae,e[127]=Ie):Ie=e[127];let $e;e[128]!==t||e[129]!==we||e[130]!==Ie?($e=f(jt,{onValueChange:h,value:t,children:[we,Ie]}),e[128]=t,e[129]=we,e[130]=Ie,e[131]=$e):$e=e[131];let De;e[132]!==Ne||e[133]!==$e?(De=f("div",{className:"flex items-center gap-2",children:[Ne,$e]}),e[132]=Ne,e[133]=$e,e[134]=De):De=e[134],e[135]!==ve||e[136]!==De?(w=f("div",{className:"flex items-center justify-between",children:[ve,De]}),e[135]=ve,e[136]=De,e[137]=w):w=e[137],d=pe;let Ee;e[138]!==r?(Ee=r("Statements"),e[138]=r,e[139]=Ee):Ee=e[139];let ze;e[140]!==Ee?(ze=s(Qe,{children:Ee}),e[140]=Ee,e[141]=ze):ze=e[141],v=f(Be,{children:[ze,s(Mt,{children:r("{count} tracked statements",{count:q.length})})]}),u=xe,x="space-y-2";let Ke;e[142]!==a||e[143]!==r?(Ke=D=>{const ne=D.normalizedSql,B=a.has(ne),he=Ge(D.avgDurationMs);return f("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[f("button",{"aria-expanded":B,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:()=>{F(ne)},type:"button",children:[f("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s(rs,{level:he}),s("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:D.normalizedSql})]}),f("div",{className:"flex shrink-0 items-center gap-4",children:[f("div",{className:"text-right",children:[s("div",{className:"text-sm font-medium",children:Le(D.totalDurationMs)}),s("div",{className:"text-xs text-muted-foreground",children:r("total")})]}),f("div",{className:"text-right",children:[s("div",{className:"text-sm font-medium",children:Le(D.avgDurationMs)}),s("div",{className:"text-xs text-muted-foreground",children:r("avg")})]}),D.p95DurationMs!==void 0&&f("div",{className:"text-right",children:[s("div",{className:"text-sm font-medium",children:Le(D.p95DurationMs)}),s("div",{className:"text-xs text-muted-foreground",children:r("p95")})]}),f("div",{className:"text-right",children:[s("div",{className:"text-sm font-medium",children:Ue(D.execCount)}),s("div",{className:"text-xs text-muted-foreground",children:r("calls")})]})]})]}),B&&f("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[f("div",{children:[s("p",{className:"mb-2 text-sm font-medium",children:r("Full statement")}),s("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:D.normalizedSql})]}),f("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[D.p50DurationMs!==void 0&&f("div",{children:[s("span",{className:"text-muted-foreground",children:r("p50")}),s("span",{className:"block font-medium tabular-nums",children:Le(D.p50DurationMs)})]}),f("div",{children:[s("span",{className:"text-muted-foreground",children:r("Exec count")}),s("span",{className:"block font-medium tabular-nums",children:Ue(D.execCount)})]}),f("div",{children:[s("span",{className:"text-muted-foreground",children:r("Total time")}),s("span",{className:"block font-medium tabular-nums",children:Le(D.totalDurationMs)})]}),f("div",{children:[s("span",{className:"text-muted-foreground",children:r("Rows read")}),s("span",{className:"block font-medium tabular-nums",children:Ue(D.rowsRead)})]}),f("div",{children:[s("span",{className:"text-muted-foreground",children:r("Rows written")}),s("span",{className:"block font-medium tabular-nums",children:Ue(D.rowsWritten)})]})]})]})]},ne)},e[142]=a,e[143]=r,e[144]=Ke):Ke=e[144],g=q.map(Ke)}e[2]=a,e[3]=l,e[4]=t,e[5]=r,e[6]=u,e[7]=d,e[8]=c,e[9]=x,e[10]=g,e[11]=v,e[12]=b,e[13]=S,e[14]=y,e[15]=w}else u=e[6],d=e[7],c=e[8],x=e[9],g=e[10],v=e[11],b=e[12],S=e[13],y=e[14],w=e[15];if(c!==Symbol.for("react.early_return_sentinel"))return c;let M;e[145]!==x||e[146]!==g?(M=s("div",{className:x,children:g}),e[145]=x,e[146]=g,e[147]=M):M=e[147];let _;e[148]!==u||e[149]!==M?(_=s(u,{children:M}),e[148]=u,e[149]=M,e[150]=_):_=e[150];let N;e[151]!==d||e[152]!==_||e[153]!==v?(N=f(d,{children:[v,_]}),e[151]=d,e[152]=_,e[153]=v,e[154]=N):N=e[154];let $;return e[155]!==N||e[156]!==b||e[157]!==S||e[158]!==y||e[159]!==w?($=f("div",{className:b,"data-testid":S,children:[y,w,N]}),e[155]=N,e[156]=b,e[157]=S,e[158]=y,e[159]=w,e[160]=$):$=e[160],$};function is(i){return Ge(i.avgDurationMs)==="critical"}function ns(i){return Ge(i.avgDurationMs)==="warning"}function os(i){return Ge(i.avgDurationMs)==="good"}const cs=["1m","5m","15m","1h"],ds=i=>new Date(i).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),ms=i=>i.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ds(e.bucketMs)})),fs=({shardKey:i=""})=>{const e=ge(),[l,r]=be("15m"),o=je(Fe.getQueryInsights,{range:l},{live:!0,shardKey:i}).data,n=ms(o?.buckets??[]);return f("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[f("div",{className:"flex flex-wrap items-center gap-2",children:[s("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:cs.map(a=>s("button",{"aria-pressed":a===l,className:Bt("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",a===l&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${a}`,onClick:()=>{r(a)},type:"button",children:a},a))}),o?.capped===!0&&s(et,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),n.length===0?s(Pt,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):f("div",{className:"grid gap-4 lg:grid-cols-2",children:[f("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[s("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),s(rt,{height:140,width:"100%",children:f(Ft,{data:n,children:[s(lt,{strokeDasharray:"3 3",vertical:!1}),s(at,{dataKey:"label",fontSize:10,tickLine:!1}),s(it,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),s(nt,{}),s(Ot,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),f("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[s("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),s(rt,{height:140,width:"100%",children:f(zt,{data:n,children:[s(lt,{strokeDasharray:"3 3",vertical:!1}),s(at,{dataKey:"label",fontSize:10,tickLine:!1}),s(it,{fontSize:10,tickLine:!1,width:32}),s(nt,{}),s(Kt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),s(as,{queryStats:o?.entries??[]})]})},us=qt(Fe.getMetrics),hs=[],gs=(i,e)=>i?e:"overview",ps=i=>{const e=me(14);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let r;e[1]!==i?(r={live:!0,shardKey:i},e[1]=i,e[2]=r):r=e[2];const t=je(Fe.getMetrics,l,r),{data:o}=t;let n;e[3]===Symbol.for("react.memo_cache_sentinel")?(n={points:[],shard:null},e[3]=n):n=e[3];const[a,m]=be(n),p=Je(null),h=Je(null);let u,d;e[4]!==o||e[5]!==i?(u=()=>{o!==void 0&&Ct(i)},d=[o,i],e[4]=o,e[5]=i,e[6]=u,e[7]=d):(u=e[6],d=e[7]),We(u,d);let c,x;e[8]!==o?(c=()=>{if(o===void 0)return;const b=o,S=h.current!==null&&h.current!==b.shard,y=h.current===b.shard?p.current:null;if(h.current=b.shard,p.current=b.requests,S){m({points:[],shard:b.shard});return}y!==null&&b.requests>=y&&m(w=>({points:[...w.shard===b.shard?w.points:[],b.requests-y].slice(-30),shard:b.shard}))},x=[o],e[8]=o,e[9]=c,e[10]=x):(c=e[9],x=e[10]),We(c,x);const g=a.shard!==null&&a.shard===o?.shard?a.points:hs;let v;return e[11]!==t||e[12]!==g?(v={...t,history:g},e[11]=t,e[12]=g,e[13]=v):v=e[13],v},xs=i=>{const e=vt(),l=Je(!0);We(()=>(l.current=!0,()=>{l.current=!1}),[]);const[r,t]=be(null),[o,n]=be(!1),a=async()=>{n(!0);const p=i,h=$t(p,_t());try{const u=await Promise.all(h.map(async d=>{try{const c=await e.query(us,{},wt(d));return{error:null,metrics:c,shard:d===""?c.shard:d}}catch(c){return{error:Tt(c),metrics:null,shard:d===""?"__root__":d}}}));l.current&&t({results:u,shard:p})}finally{l.current&&n(!1)}},m=r?.shard===i?r.results:null;return{aggregate:m===null?null:At(m),aggregating:o,clearAggregate:()=>{t(null)},runAggregate:()=>{St(a())},shardResults:m}},bs=i=>{if(!i||!("queryStats"in i))return;const e=i.queryStats;if(!(!e||!Array.isArray(e)))return It(e)},ot=i=>`pb-2 text-sm font-medium transition-colors ${i?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,vs=i=>{const e=me(26),{activeTab:l,onSelect:r,queryCount:t}=i,o=ge();let n;e[0]!==r?(n=()=>{r("overview")},e[0]=r,e[1]=n):n=e[1];const a=n;let m;e[2]!==r?(m=()=>{r("query-insights")},e[2]=r,e[3]=m):m=e[3];const p=m,h=l==="overview";let u;e[4]!==h?(u=ot(h),e[4]=h,e[5]=u):u=e[5];let d;e[6]!==o?(d=o("Overview"),e[6]=o,e[7]=d):d=e[7];let c;e[8]!==a||e[9]!==u||e[10]!==d?(c=s("button",{className:u,"data-testid":"mt-tab-overview",onClick:a,type:"button",children:d}),e[8]=a,e[9]=u,e[10]=d,e[11]=c):c=e[11];const x=l==="query-insights";let g;e[12]!==x?(g=ot(x),e[12]=x,e[13]=g):g=e[13];let v;e[14]!==o?(v=o("Query insights"),e[14]=o,e[15]=v):v=e[15];let b;e[16]!==t?(b=t>0&&s("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:t}),e[16]=t,e[17]=b):b=e[17];let S;e[18]!==p||e[19]!==b||e[20]!==g||e[21]!==v?(S=f("button",{className:g,"data-testid":"mt-tab-query-insights",onClick:p,type:"button",children:[v,b]}),e[18]=p,e[19]=b,e[20]=g,e[21]=v,e[22]=S):S=e[22];let y;return e[23]!==S||e[24]!==c?(y=f("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[c,S]}),e[23]=S,e[24]=c,e[25]=y):y=e[25],y},ys=i=>{const e=me(13),{history:l,metrics:r}=i;let t;e[0]!==l?(t=l.at(-1)??0,e[0]=l,e[1]=t):t=e[1];let o;e[2]!==r.errors||e[3]!==r.requests?(o=r.requests===0?"—":`${(r.errors/r.requests*100).toFixed(1)}%`,e[2]=r.errors,e[3]=r.requests,e[4]=o):o=e[4];let n;e[5]!==r?(n=Dt(r),e[5]=r,e[6]=n):n=e[6];let a;return e[7]!==l||e[8]!==r||e[9]!==t||e[10]!==o||e[11]!==n?(a=s(ss,{currentDelta:t,errorRate:o,history:l,latencyPercentiles:n,metrics:r}),e[7]=l,e[8]=r,e[9]=t,e[10]=o,e[11]=n,e[12]=a):a=e[12],a},Ns=i=>{const e=me(25),{aggregating:l,liveError:r,onAggregate:t,onClearAggregate:o,onShardKeyChange:n,shardKey:a}=i,m=ge();let p;e[0]!==n||e[1]!==a?(p=s(pt,{onChange:n,testId:"mt-shard-input",value:a}),e[0]=n,e[1]=a,e[2]=p):p=e[2];let h;e[3]!==r?(h=s(gt,{message:r,prefix:"mt"}),e[3]=r,e[4]=h):h=e[4];let u;e[5]!==l||e[6]!==m?(u=m(l?"Aggregating…":"All shards"),e[5]=l,e[6]=m,e[7]=u):u=e[7];let d;e[8]!==l||e[9]!==t||e[10]!==u?(d=s(tt,{"data-testid":"mt-aggregate",disabled:l,onClick:t,size:"sm",type:"button",variant:"secondary",children:u}),e[8]=l,e[9]=t,e[10]=u,e[11]=d):d=e[11];let c;e[12]!==o||e[13]!==m?(c=o!==void 0&&s(tt,{"data-testid":"mt-aggregate-clear",onClick:o,size:"sm",type:"button",variant:"ghost",children:m("Hide")}),e[12]=o,e[13]=m,e[14]=c):c=e[14];let x;e[15]!==m?(x=m("Open in Cloudflare"),e[15]=m,e[16]=x):x=e[16];let g;e[17]!==x?(g=s("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:yt,rel:"noreferrer",target:"_blank",children:x}),e[17]=x,e[18]=g):g=e[18];let v;return e[19]!==p||e[20]!==h||e[21]!==d||e[22]!==c||e[23]!==g?(v=f("div",{className:"flex flex-wrap items-center gap-2",children:[p,h,d,c,g]}),e[19]=p,e[20]=h,e[21]=d,e[22]=c,e[23]=g,e[24]=v):v=e[24],v},Js=i=>{const e=me(41),{initialShardKey:l}=i,{queryShardKey:r,setShardKey:t,shardKey:o}=bt(l),[n,a]=be("overview"),m=xt(r),{data:p,error:h,history:u,liveError:d}=ps(r),c=p??null,{aggregate:x,aggregating:g,clearAggregate:v,runAggregate:b,shardResults:S}=xs(o);let y;e[0]!==c?(y=bs(c),e[0]=c,e[1]=y):y=e[1];const w=y,M=w!==void 0;let _;e[2]!==n||e[3]!==M?(_=gs(M,n),e[2]=n,e[3]=M,e[4]=_):_=e[4];const N=_,$=S===null?void 0:v;let q;e[5]!==g||e[6]!==d||e[7]!==b||e[8]!==t||e[9]!==o||e[10]!==$?(q=s(Ns,{aggregating:g,liveError:d,onAggregate:b,onClearAggregate:$,onShardKeyChange:t,shardKey:o}),e[5]=g,e[6]=d,e[7]=b,e[8]=t,e[9]=o,e[10]=$,e[11]=q):q=e[11];let C;e[12]!==h?(C=h!==null&&s("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:h}),e[12]=h,e[13]=C):C=e[13];let k;e[14]!==N||e[15]!==w?(k=w!==void 0&&s(vs,{activeTab:N,onSelect:a,queryCount:w.length}),e[14]=N,e[15]=w,e[16]=k):k=e[16];let R;e[17]!==N||e[18]!==r||e[19]!==w?(R=N==="query-insights"&&w!==void 0&&s(fs,{shardKey:r}),e[17]=N,e[18]=r,e[19]=w,e[20]=R):R=e[20];let A;e[21]!==N||e[22]!==u||e[23]!==c?(A=N==="overview"&&c!==null&&s(ys,{history:u,metrics:c}),e[21]=N,e[22]=u,e[23]=c,e[24]=A):A=e[24];let I;e[25]!==N||e[26]!==m||e[27]!==r?(I=N==="overview"&&s(es,{onOpenTrace:m,shardKey:r}),e[25]=N,e[26]=m,e[27]=r,e[28]=I):I=e[28];let E;e[29]!==x||e[30]!==N||e[31]!==S?(E=N==="overview"&&x!==null&&S!==null&&s(ts,{aggregate:x,shardResults:S}),e[29]=x,e[30]=N,e[31]=S,e[32]=E):E=e[32];let L;return e[33]!==I||e[34]!==E||e[35]!==q||e[36]!==C||e[37]!==k||e[38]!==R||e[39]!==A?(L=f("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[q,C,k,R,A,I,E]}),e[33]=I,e[34]=E,e[35]=q,e[36]=C,e[37]=k,e[38]=R,e[39]=A,e[40]=L):L=e[40],L};export{Js as MetricsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as D}from"react/compiler-runtime";import{useState as j}from"react";import{E as K}from"../packem_shared/error-alert-
|
|
1
|
+
import{c as D}from"react/compiler-runtime";import{useState as j}from"react";import{E as K}from"../packem_shared/error-alert-54TiaMvZ.mjs";import{B as L}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as F}from"../packem_shared/button-q0UYSmrn.mjs";import{C as O,a as Q}from"../packem_shared/card-By2O8ULa.mjs";import{E as U}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as q}from"../packem_shared/input-CXhxesPC.mjs";import{T as G,a as J,b as H,c as h,d as X,e as u}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Y}from"../packem_shared/use-admin-query-BW9IuacC.mjs";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as _}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{h as ee}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsx as t,jsxs as x}from"react/jsx-runtime";const te=e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary",M=e=>e.endpoint??e.id,ge=()=>{const e=D(38),r=Z(),[a,P]=j("all"),[n,V]=j("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const{data:T,error:i,errorSource:p,isLoading:v,refetch:g}=Y(_.listPushSubscriptions,b);let N;if(e[1]!==T?.subscriptions||e[2]!==i||e[3]!==p||e[4]!==v||e[5]!==a||e[6]!==g||e[7]!==n||e[8]!==r){const I=T?.subscriptions??[],$=n.trim().toLowerCase(),A=I.filter(s=>a!=="all"&&s.kind!==a?!1:$===""?!0:`${M(s)} ${s.userId??""}`.toLowerCase().includes($));let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=s=>{V(s.target.value)},e[10]=w):w=e[10];const z=w;let y;e[11]!==g?(y=()=>{g()},e[11]=g,e[12]=y):y=e[12];const B=y;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=["all","web-push","fcm"],e[13]=C):C=e[13];const W=C;let o;e[14]!==a||e[15]!==r?(o=t("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:W.map(s=>t(F,{"aria-selected":a===s,"data-testid":`nt-kind-${s}`,onClick:()=>{P(s)},role:"tab",size:"sm",type:"button",variant:a===s?"secondary":"ghost",children:s==="all"?r("All"):s},s))}),e[14]=a,e[15]=r,e[16]=o):o=e[16];let l;e[17]!==r?(l=r("Filter devices"),e[17]=r,e[18]=l):l=e[18];let d;e[19]!==r?(d=r("filter endpoint, user"),e[19]=r,e[20]=d):d=e[20];let c;e[21]!==n||e[22]!==l||e[23]!==d?(c=t(q,{"aria-label":l,className:"h-8 w-56","data-testid":"nt-search",onChange:z,placeholder:d,value:n}),e[21]=n,e[22]=l,e[23]=d,e[24]=c):c=e[24];let m;e[25]!==r?(m=r("Refresh"),e[25]=r,e[26]=m):m=e[26];let f;e[27]!==B||e[28]!==m?(f=t(F,{className:"ml-auto","data-testid":"nt-refresh",onClick:B,size:"sm",type:"button",variant:"outline",children:m}),e[27]=B,e[28]=m,e[29]=f):f=e[29];const E=I.length>0&&t(L,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:I.length})});let k;e[30]!==f||e[31]!==E||e[32]!==o||e[33]!==c?(k=x("div",{className:"flex flex-wrap items-center gap-2",children:[o,c,f,E]}),e[30]=f,e[31]=E,e[32]=o,e[33]=c,e[34]=k):k=e[34];let S;e[35]!==i||e[36]!==p?(S=i!==null&&t(K,{error:p,testId:"nt-error"}),e[35]=i,e[36]=p,e[37]=S):S=e[37],N=x("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[k,S,i===null&&!v&&A.length===0&&t(U,{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:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("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&&t(O,{className:"overflow-hidden py-0",children:t(Q,{className:"max-h-[30rem] overflow-auto px-0",children:x(G,{"data-testid":"nt-table",children:[t(J,{children:x(H,{children:[t(h,{children:r("kind")}),t(h,{children:r("endpoint")}),t(h,{children:r("user")}),t(h,{children:r("last seen")}),t(h,{children:r("status")}),t(h,{children:r("error")})]})}),t(X,{children:A.map(s=>{const R=M(s);return x(H,{"data-testid":"nt-row",children:[t(u,{children:t(L,{variant:"outline",children:s.kind})}),t(u,{className:"max-w-[28ch] truncate font-mono text-xs",title:R,children:R}),t(u,{className:"max-w-[16ch] truncate font-mono text-xs",children:s.userId??t("span",{className:"text-muted-foreground",children:"—"})}),t(u,{className:"text-muted-foreground tabular-nums",children:ee(s.lastSeenAt,"—")}),t(u,{children:t(L,{"data-testid":`nt-status-${s.id}`,variant:te(s.lastStatus),children:s.lastStatus??r("n/a")})}),t(u,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:s.lastError??void 0,children:s.lastError??t("span",{className:"text-muted-foreground",children:"—"})})]},s.id)})})]})})})]}),e[1]=T?.subscriptions,e[2]=i,e[3]=p,e[4]=v,e[5]=a,e[6]=g,e[7]=n,e[8]=r,e[9]=N}else N=e[9];return N};export{ge as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as Ke}from"react/compiler-runtime";import{
|
|
1
|
+
import{c as Ke}from"react/compiler-runtime";import{useState as k,useEffect as We}from"react";import{ConfirmButton as Le}from"../packem_shared/ConfirmButton-CIXYF6Mg.mjs";import{B as Xe}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as Ye}from"../packem_shared/button-q0UYSmrn.mjs";import{I as Ue}from"../packem_shared/input-CXhxesPC.mjs";import{L as Se}from"../packem_shared/label-DKFzyHq6.mjs";import{useAutoRefresh as et}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-CG7Q45ZS.mjs";import{u as tt}from"../packem_shared/use-mirrored-ref-CVDf2z1M.mjs";import{u as rt}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as je}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as qe}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as ze,d as _e,j as Fe,b as Pe,f as Ae}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsxs as i,jsx as s}from"react/jsx-runtime";const Me=ze(qe.getPitrBookmark),st=ze(qe.pitrRestore),ot=/^\d+$/u,De=ne=>{const e=ne.trim(),u=ot.test(e)?Number(e):Date.parse(e),l=new Date(u);return Number.isNaN(l.getTime())?void 0:{epochMs:u,iso:l.toISOString()}},lt=ne=>{const e=Ke(9),{text:u}=ne,l=je();if(u.trim()==="")return null;let t,r,f;if(e[0]!==l||e[1]!==u){const y=De(u);t="font-mono text-xs text-muted-foreground",r="pitr-time-resolved",f=y===void 0?l("Not a time — use epoch-ms or ISO 8601."):l("Resolves to {instant} (a date-time without an offset is read in this browser's time zone; a bare date is UTC)",{instant:y.iso}),e[0]=l,e[1]=u,e[2]=t,e[3]=r,e[4]=f}else t=e[2],r=e[3],f=e[4];let v;return e[5]!==t||e[6]!==r||e[7]!==f?(v=s("p",{className:t,"data-testid":r,children:f}),e[5]=t,e[6]=r,e[7]=f,e[8]=v):v=e[8],v},Nt=ne=>{const e=Ke(140),{initialShardKey:u}=ne,l=rt(),t=je(),r=u??"",f=tt(r),[v,y]=k(null),[p,$e]=k(""),[de,Oe]=k(null),[d,He]=k(""),[h,Ve]=k(!1),[n,Ge]=k(null),[me,R]=k(null),[ce,_]=k(!1),[w,Ee]=k(!1);let fe;e[0]!==l||e[1]!==r?(fe=async o=>{_(!0),R(null);let c;try{c={current:(await l.query(Me,{},_e(r))).current,error:null,unavailable:!1}}catch(a){const N=a;c={current:null,error:Pe(N),unavailable:Fe(N)==="PITR_UNAVAILABLE"}}o?.aborted!==!0&&(c.error===null?y(c.current):R(c.error),Ee(c.unavailable),_(!1))},e[0]=l,e[1]=r,e[2]=fe):fe=e[2];const b=fe;let ue,pe;e[3]!==b?(ue=()=>{const o=new AbortController;return Ae(b(o.signal)),()=>{o.abort()}},pe=[b],e[3]=b,e[4]=ue,e[5]=pe):(ue=e[4],pe=e[5]),We(ue,pe);let he;e[6]!==l||e[7]!==r?(he=async()=>{const o=await l.query(Me,{},_e(r));y(o.current)},e[6]=l,e[7]=r,e[8]=he):he=e[8],et(he,!w);let be;e[9]===Symbol.for("react.memo_cache_sentinel")?(be=o=>{$e(o.target.value)},e[9]=be):be=e[9];const Ze=be;let xe;e[10]===Symbol.for("react.memo_cache_sentinel")?(xe=o=>{He(o.target.value)},e[10]=xe):xe=e[10];const Je=xe;let ke;e[11]===Symbol.for("react.memo_cache_sentinel")?(ke=o=>{Ve(o.target.checked)},e[11]=ke):ke=e[11];const Qe=ke;let ve,C,m,x,g,ge;if(e[12]!==d||e[13]!==l||e[14]!==de||e[15]!==b||e[16]!==r||e[17]!==f||e[18]!==t||e[19]!==p){m=De(p),C=()=>{if(m===void 0)return;const c=r;Ae((async()=>{_(!0),R(null);let a;try{a={result:await l.query(Me,{time:m.epochMs},_e(c))}}catch(N){a={error:Pe(N)}}f.current===c&&("result"in a?(Oe(a.result.forTime===void 0?null:{bookmark:a.result.forTime,shard:c}),y(a.result.current)):(Oe(null),R(a.error)),_(!1))})())},g=de?.shard===r?de.bookmark:null;let o;e[26]!==l||e[27]!==b||e[28]!==r?(o=c=>{Ae((async()=>{_(!0),R(null);try{const a=await l.mutation(st,c,_e(r));Ge(a),await b()}catch(a){const N=a;R(Pe(N)),Fe(N)==="PITR_UNAVAILABLE"&&Ee(!0)}_(!1)})())},e[26]=l,e[27]=b,e[28]=r,e[29]=o):o=e[29],x=o,ve=d.trim()!==""||m!==void 0,ge=t("Restore {shard} to {target}?",{shard:r===""?t("root"):r,target:d.trim()===""?m?.iso??"":t("the given bookmark")}),e[12]=d,e[13]=l,e[14]=de,e[15]=b,e[16]=r,e[17]=f,e[18]=t,e[19]=p,e[20]=ve,e[21]=C,e[22]=m,e[23]=x,e[24]=g,e[25]=ge}else ve=e[20],C=e[21],m=e[22],x=e[23],g=e[24],ge=e[25];const we=ge;let Ne;e[30]!==d||e[31]!==m?.epochMs||e[32]!==h||e[33]!==x?(Ne=()=>{const o=h?{restart:!0}:{};d.trim()===""?o.time=m?.epochMs:o.bookmark=d.trim(),x(o)},e[30]=d,e[31]=m?.epochMs,e[32]=h,e[33]=x,e[34]=Ne):Ne=e[34];const Ce=Ne;let ye;e[35]!==h||e[36]!==n||e[37]!==x?(ye=()=>{n!==null&&x(h?{bookmark:n.undoBookmark,restart:!0}:{bookmark:n.undoBookmark})},e[35]=h,e[36]=n,e[37]=x,e[38]=ye):ye=e[38];const Te=ye;let T;e[39]!==t?(T=t("Shard"),e[39]=t,e[40]=T):T=e[40];let B;e[41]!==r||e[42]!==t?(B=r===""?t("root"):r,e[41]=r,e[42]=t,e[43]=B):B=e[43];let I;e[44]!==B?(I=s("span",{className:"font-mono",children:B}),e[44]=B,e[45]=I):I=e[45];let S;e[46]!==T||e[47]!==I?(S=s("div",{className:"flex flex-wrap items-center gap-3",children:i("span",{className:"text-xs text-muted-foreground",children:[T,": ",I]})}),e[46]=T,e[47]=I,e[48]=S):S=e[48];let P;e[49]!==t?(P=t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier."),e[49]=t,e[50]=P):P=e[50];let A;e[51]!==P?(A=s("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:P}),e[51]=P,e[52]=A):A=e[52];let M;e[53]!==me?(M=me!==null&&s("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:me}),e[53]=me,e[54]=M):M=e[54];let O;e[55]!==t?(O=t("Current bookmark"),e[55]=t,e[56]=O):O=e[56];let E;e[57]!==O?(E=s("h3",{className:"mb-2 text-sm font-semibold",children:O}),e[57]=O,e[58]=E):E=e[58];let L;e[59]!==v?(L=v??s("span",{className:"text-muted-foreground",children:"—"}),e[59]=v,e[60]=L):L=e[60];let U;e[61]!==L?(U=s("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:L}),e[61]=L,e[62]=U):U=e[62];let F;e[63]!==E||e[64]!==U?(F=i("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[E,U]}),e[63]=E,e[64]=U,e[65]=F):F=e[65];let K;e[66]!==t?(K=t("Restore"),e[66]=t,e[67]=K):K=e[67];let j;e[68]!==K?(j=s("h3",{className:"text-sm font-semibold",children:K}),e[68]=K,e[69]=j):j=e[69];let q;e[70]!==t?(q=t("Time (ISO or epoch-ms, last 30 days)"),e[70]=t,e[71]=q):q=e[71];let z;e[72]!==q?(z=s(Se,{htmlFor:"pitr-time",children:q}),e[72]=q,e[73]=z):z=e[73];let D;e[74]!==p?(D=s(Ue,{"data-testid":"pitr-time",id:"pitr-time",onChange:Ze,placeholder:"2026-06-01T00:00:00.000Z",value:p}),e[74]=p,e[75]=D):D=e[75];const Be=ce||w||m===void 0;let $;e[76]!==t?($=t("Preview"),e[76]=t,e[77]=$):$=e[77];let H;e[78]!==C||e[79]!==Be||e[80]!==$?(H=s(Ye,{"data-testid":"pitr-preview",disabled:Be,onClick:C,size:"sm",type:"button",variant:"outline",children:$}),e[78]=C,e[79]=Be,e[80]=$,e[81]=H):H=e[81];let V;e[82]!==D||e[83]!==H?(V=i("div",{className:"flex items-center gap-2",children:[D,H]}),e[82]=D,e[83]=H,e[84]=V):V=e[84];let G;e[85]!==p?(G=s(lt,{text:p}),e[85]=p,e[86]=G):G=e[86];let Z;e[87]!==g||e[88]!==t?(Z=g!==null&&i("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",g]}),e[87]=g,e[88]=t,e[89]=Z):Z=e[89];let J;e[90]!==z||e[91]!==V||e[92]!==G||e[93]!==Z?(J=i("div",{className:"flex flex-col gap-1",children:[z,V,G,Z]}),e[90]=z,e[91]=V,e[92]=G,e[93]=Z,e[94]=J):J=e[94];let Q;e[95]!==t?(Q=t("Or an explicit bookmark (wins over time)"),e[95]=t,e[96]=Q):Q=e[96];let W;e[97]!==Q?(W=s(Se,{htmlFor:"pitr-bookmark",children:Q}),e[97]=Q,e[98]=W):W=e[98];let X;e[99]!==t?(X=t("bookmark string"),e[99]=t,e[100]=X):X=e[100];let Y;e[101]!==d||e[102]!==X?(Y=s(Ue,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:Je,placeholder:X,value:d}),e[101]=d,e[102]=X,e[103]=Y):Y=e[103];let ee;e[104]!==W||e[105]!==Y?(ee=i("div",{className:"flex flex-col gap-1",children:[W,Y]}),e[104]=W,e[105]=Y,e[106]=ee):ee=e[106];let te;e[107]!==h?(te=s("input",{checked:h,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:Qe,type:"checkbox"}),e[107]=h,e[108]=te):te=e[108];let re;e[109]!==t?(re=t("Restart the shard now so recovery applies immediately"),e[109]=t,e[110]=re):re=e[110];let se;e[111]!==te||e[112]!==re?(se=i(Se,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[te,re]}),e[111]=te,e[112]=re,e[113]=se):se=e[113];const Ie=ce||w||!ve;let oe;e[114]!==t?(oe=t("Restore"),e[114]=t,e[115]=oe):oe=e[115];let le;e[116]!==we||e[117]!==Ce||e[118]!==Ie||e[119]!==oe?(le=s("div",{children:s(Le,{confirmLabel:we,disabled:Ie,onConfirm:Ce,testId:"pitr-restore",children:oe})}),e[116]=we,e[117]=Ce,e[118]=Ie,e[119]=oe,e[120]=le):le=e[120];let ae;e[121]!==j||e[122]!==J||e[123]!==ee||e[124]!==se||e[125]!==le?(ae=i("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[j,J,ee,se,le]}),e[121]=j,e[122]=J,e[123]=ee,e[124]=se,e[125]=le,e[126]=ae):ae=e[126];let ie;e[127]!==ce||e[128]!==Te||e[129]!==n||e[130]!==t||e[131]!==w?(ie=n!==null&&i("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[i("div",{className:"flex items-center gap-2",children:[s("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),s(Xe,{variant:n.restarted?"destructive":"secondary",children:n.restarted?t("restarted now"):t("on next restart")})]}),i("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",n.restoredTo]}),i("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",n.undoBookmark]}),s("div",{children:s(Le,{confirmLabel:t("Confirm undo"),disabled:ce||w,onConfirm:Te,testId:"pitr-undo",children:t("Undo restore")})})]}),e[127]=ce,e[128]=Te,e[129]=n,e[130]=t,e[131]=w,e[132]=ie):ie=e[132];let Re;return e[133]!==S||e[134]!==A||e[135]!==M||e[136]!==F||e[137]!==ae||e[138]!==ie?(Re=i("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[S,A,M,F,ae,ie]}),e[133]=S,e[134]=A,e[135]=M,e[136]=F,e[137]=ae,e[138]=ie,e[139]=Re):Re=e[139],Re};export{Nt as PitrPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as we}from"react/compiler-runtime";import{ShardInput as Ze}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{S as Ke,T as Pe}from"../packem_shared/storage-tier-C2mKwYRj.mjs";import{B as Fe}from"../packem_shared/badge-r_5B4LHP.mjs";import{c as Ge,d as ze,b as Be,a as De,C as je}from"../packem_shared/card-By2O8ULa.mjs";import{E as et}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ke}from"../packem_shared/input-CXhxesPC.mjs";import{useT as Le}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as Oe,d as Ae,b as $e,f as Ce}from"../packem_shared/internal-BXEjuLPN.mjs";import{c as Qe}from"../packem_shared/utils-bhneXptQ.mjs";import{useLunora as tt}from"@lunora/react";import{useState as _,useRef as Ue,useEffect as qe}from"react";import{u as lt}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{ADMIN_FUNCTIONS as Me}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{r as st}from"../packem_shared/shard-history-CaO3C4KQ.mjs";import{S as at}from"../packem_shared/schema-diagram-ghsOCED7.mjs";import{useNavigate as nt}from"@tanstack/react-router";import{B as ye}from"../packem_shared/button-q0UYSmrn.mjs";import{L as Ee}from"../packem_shared/label-DKFzyHq6.mjs";import{jsx as l,jsxs as p,Fragment as Ve}from"react/jsx-runtime";const ot=Oe(Me.listTables),it=Oe(Me.listTableIndexes),rt=Oe(Me.readTablePage),dt=Oe(Me.describeTables),ct={},Ye=[],mt=n=>{const e=we(74),{initialShardKey:m,initialTable:a}=n,t=tt(),[s,c]=_("graph"),{queryShardKey:d,setShardKey:r,shardKey:g}=lt(m),[o,u]=_(""),[i,v]=_(null),[f,L]=_(null);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S={},e[0]=S):S=e[0];const[G,y]=_(S);let O;e[1]===Symbol.for("react.memo_cache_sentinel")?(O={},e[1]=O):O=e[1];const[$,z]=_(O),[T,C]=_(null);let A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A={},e[2]=A):A=e[2];const[F,pe]=_(A);let te;e[3]===Symbol.for("react.memo_cache_sentinel")?(te={},e[3]=te):te=e[3];const[E,M]=_(te),[w,ge]=_(null),[B,ce]=_(null);let le;e[4]===Symbol.for("react.memo_cache_sentinel")?(le={},e[4]=le):le=e[4];const[J,Ne]=_(le),[W,me]=_(null),be=Ue(0);let D;e[5]!==t?(D=async h=>{be.current=be.current+1;const x=be.current;L(null);try{const N=await t.query(ot,{},Ae(h));if(x!==be.current)return;st(h),v(N),y({}),z({}),C(null),pe(k=>Object.fromEntries(Object.entries(k).filter(I=>{const[he]=I;return he!==h}))),M(k=>Object.fromEntries(Object.entries(k).filter(I=>{const[he]=I;return he!==h})))}catch(N){const k=N;if(x!==be.current)return;v(null),L($e(k))}},e[5]=t,e[6]=D):D=e[6];const j=D;let se;e[7]!==t?(se=async()=>{ce(null);try{ge(await t.listGlobalTables())}catch(h){const x=h;ge(null),ce($e(x))}},e[7]=t,e[8]=se):se=e[8];const ue=se;let R,ae;e[9]!==d||e[10]!==j||e[11]!==ue?(R=()=>{Ce(j(d)),Ce(ue())},ae=[j,ue,d],e[9]=d,e[10]=j,e[11]=ue,e[12]=R,e[13]=ae):(R=e[12],ae=e[13]),qe(R,ae);let K;e[14]!==t||e[15]!==G||e[16]!==T||e[17]!==d?(K=async h=>{if(T===h){C(null);return}C(h);const x=`${d}:${h}`;if(G[x]!==void 0)return;const[N,k]=await Promise.allSettled([t.query(rt,{limit:1,offset:0,table:h},Ae(d)),t.query(it,{table:h},Ae(d))]);N.status==="fulfilled"?y(I=>({...I,[x]:N.value.columns})):L($e(N.reason)),k.status==="fulfilled"&&z(I=>({...I,[x]:k.value.indexes}))},e[14]=t,e[15]=G,e[16]=T,e[17]=d,e[18]=K):K=e[18];const ne=K;let oe;e[19]!==t||e[20]!==J||e[21]!==W?(oe=async h=>{if(W===h){me(null);return}if(me(h),J[h]===void 0)try{const x=await t.readGlobalTablePage({limit:1,offset:0,table:h});Ne(N=>({...N,[h]:x.columns}))}catch(x){ce($e(x))}},e[19]=t,e[20]=J,e[21]=W,e[22]=oe):oe=e[22];const fe=oe,X=Ue(void 0);let Q,U;e[23]!==a||e[24]!==i||e[25]!==ne?(Q=()=>{a===void 0||i===null||X.current===a||i.some(h=>h.name===a)&&(X.current=a,Ce(ne(a)))},U=[a,i,ne],e[23]=a,e[24]=i,e[25]=ne,e[26]=Q,e[27]=U):(Q=e[26],U=e[27]),qe(Q,U);let ie;e[28]!==t?(ie=async(h,x,N)=>{const[k,I]=await Promise.all([Promise.allSettled([t.query(dt,{tables:[...x,...N]},Ae(h))]),Promise.all(N.map(async H=>{const Se=await Promise.allSettled([t.readGlobalTablePage({limit:1,offset:0,table:H})]),Re=Se[0].status==="fulfilled"?Se[0].value:void 0;return{columns:Re?.columns??[],refs:Re?.refs??{},table:H}}))]),he=k[0].status==="fulfilled"?k[0].value?.columnsByTable??{}:{},_e=k[0].status==="rejected",Ie=new Map(I.map(ut)),q=[...x,...N].map(H=>{const Se=he[H]??[];return[H,Se.length>0?Se:Ie.get(H)??[]]});pe(H=>({...H,[h]:Object.fromEntries(q)})),M(H=>({...H,[h]:_e}))},e[28]=t,e[29]=ie):ie=e[29];const V=ie;let re,Y;e[30]!==B||e[31]!==w||e[32]!==V||e[33]!==d||e[34]!==F||e[35]!==i||e[36]!==s?(re=()=>{s!=="graph"||i===null||w===null&&B===null||F[d]!==void 0||Ce(V(d,i.map(ft),(w??[]).map(ht)))},Y=[s,i,w,B,d,F,V],e[30]=B,e[31]=w,e[32]=V,e[33]=d,e[34]=F,e[35]=i,e[36]=s,e[37]=re,e[38]=Y):(re=e[37],Y=e[38]),qe(re,Y);const P=F[d]??ct;let Z;if(e[39]!==P||e[40]!==w||e[41]!==i){let h;e[43]!==P?(h=I=>({columns:P[I.name]??Ye,name:I.name,tier:"shard"}),e[43]=P,e[44]=h):h=e[44];const x=(i??[]).map(h);let N;e[45]!==P?(N=I=>({columns:P[I.name]??Ye,name:I.name,tier:"global"}),e[45]=P,e[46]=N):N=e[46];const k=(w??[]).map(N);Z=[...x,...k],e[39]=P,e[40]=w,e[41]=i,e[42]=Z}else Z=e[42];const b=Z;let ee;if(e[47]!==o||e[48]!==i){const h=o.trim().toLowerCase();ee=(i??[]).filter(x=>x.name.toLowerCase().includes(h)),e[47]=o,e[48]=i,e[49]=ee}else ee=e[49];const de=ee;let xe;if(e[50]!==w||e[51]!==o){const h=o.trim().toLowerCase();xe=(w??[]).filter(x=>x.name.toLowerCase().includes(h)),e[50]=w,e[51]=o,e[52]=xe}else xe=e[52];const Te=xe;let ve;return e[53]!==G||e[54]!==b||e[55]!==f||e[56]!==T||e[57]!==Te||e[58]!==de||e[59]!==J||e[60]!==B||e[61]!==W||e[62]!==w||e[63]!==$||e[64]!==j||e[65]!==r||e[66]!==E||e[67]!==g||e[68]!==o||e[69]!==i||e[70]!==ne||e[71]!==fe||e[72]!==s?(ve={columns:G,diagramTables:b,error:f,expanded:T,filteredGlobalTables:Te,filteredTables:de,globalColumns:J,globalError:B,globalExpanded:W,globalTables:w,indexes:$,refresh:j,setShardKey:r,setTableFilter:u,setView:c,shardColumnsError:E,shardKey:g,tableFilter:o,tables:i,toggle:ne,toggleGlobal:fe,view:s},e[53]=G,e[54]=b,e[55]=f,e[56]=T,e[57]=Te,e[58]=de,e[59]=J,e[60]=B,e[61]=W,e[62]=w,e[63]=$,e[64]=j,e[65]=r,e[66]=E,e[67]=g,e[68]=o,e[69]=i,e[70]=ne,e[71]=fe,e[72]=s,e[73]=ve):ve=e[73],ve};function ut(n){const{columns:e,refs:m,table:a}=n;return[a,e.map(t=>{const s=m[t];return s===void 0?{name:t,optional:!1,type:""}:{name:t,optional:!1,ref:s,type:"id"}})]}function ft(n){return n.name}function ht(n){return n.name}const pt="/__lunora/schema-edit",gt=async n=>{const e=await fetch(pt,{body:JSON.stringify(n),headers:{"Content-Type":"application/json"},method:"POST"}),m=await e.json();return m.needsMigration===!0?{kind:"needs-migration",message:m.message??"This edit needs a migration."}:e.ok&&m.tables!==void 0?{diagnostics:m.diagnostics??[],kind:"ok",tables:m.tables}:{kind:"error",message:m.error??`schema edit failed (${String(e.status)})`}},bt=n=>{const e=we(32),{hasTables:m,mode:a,onAddColumn:t,onAddIndex:s,onAddTable:c,onDestructive:d}=n,r=Le(),g=a==="addTable"?"default":"outline";let o;e[0]!==r?(o=r("Add table"),e[0]=r,e[1]=o):o=e[1];let u;e[2]!==c||e[3]!==g||e[4]!==o?(u=l(ye,{"data-testid":"sc-editor-add-table",onClick:c,size:"xs",type:"button",variant:g,children:o}),e[2]=c,e[3]=g,e[4]=o,e[5]=u):u=e[5];const i=!m,v=a==="addColumn"?"default":"outline";let f;e[6]!==r?(f=r("Add column"),e[6]=r,e[7]=f):f=e[7];let L;e[8]!==t||e[9]!==i||e[10]!==v||e[11]!==f?(L=l(ye,{"data-testid":"sc-editor-add-column",disabled:i,onClick:t,size:"xs",type:"button",variant:v,children:f}),e[8]=t,e[9]=i,e[10]=v,e[11]=f,e[12]=L):L=e[12];const S=!m,G=a==="addIndex"?"default":"outline";let y;e[13]!==r?(y=r("Add index"),e[13]=r,e[14]=y):y=e[14];let O;e[15]!==s||e[16]!==y||e[17]!==S||e[18]!==G?(O=l(ye,{"data-testid":"sc-editor-add-index",disabled:S,onClick:s,size:"xs",type:"button",variant:G,children:y}),e[15]=s,e[16]=y,e[17]=S,e[18]=G,e[19]=O):O=e[19];const $=!m,z=a==="destructive"?"default":"ghost";let T;e[20]!==r?(T=r("Rename / drop / change type…"),e[20]=r,e[21]=T):T=e[21];let C;e[22]!==d||e[23]!==$||e[24]!==z||e[25]!==T?(C=l(ye,{"data-testid":"sc-editor-destructive",disabled:$,onClick:d,size:"xs",type:"button",variant:z,children:T}),e[22]=d,e[23]=$,e[24]=z,e[25]=T,e[26]=C):C=e[26];let A;return e[27]!==O||e[28]!==C||e[29]!==u||e[30]!==L?(A=p("div",{className:"flex flex-wrap gap-2",children:[u,L,O,C]}),e[27]=O,e[28]=C,e[29]=u,e[30]=L,e[31]=A):A=e[31],A},xt=n=>{const e=we(28),{onOpenMigrations:m,result:a}=n,t=Le();if(a===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=l(Ve,{}),e[0]=o):o=e[0],o}if(a.kind==="error"){let o;return e[1]!==a.message?(o=l("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:a.message}),e[1]=a.message,e[2]=o):o=e[2],o}if(a.kind==="needs-migration"){let o;e[3]!==a.message||e[4]!==t?(o=a.message===""?t("This edit changes stored data and must go through a migration. Review the migration before applying."):a.message,e[3]=a.message,e[4]=t,e[5]=o):o=e[5];let u;e[6]!==o?(u=l("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=u):u=e[7];let i;e[8]!==t?(i=t("Open Migrations"),e[8]=t,e[9]=i):i=e[9];let v;e[10]!==m||e[11]!==i?(v=l(ye,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:m,size:"xs",type:"button",variant:"outline",children:i}),e[10]=m,e[11]=i,e[12]=v):v=e[12];let f;return e[13]!==u||e[14]!==v?(f=p("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[u,v]}),e[13]=u,e[14]=v,e[15]=f):f=e[15],f}if(a.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=l(Ve,{}),e[16]=o):o=e[16],o}let s;e[17]!==t?(s=t("Codegen reported diagnostics:"),e[17]=t,e[18]=s):s=e[18];let c;e[19]!==s?(c=l("p",{className:"text-sm text-destructive",role:"alert",children:s}),e[19]=s,e[20]=c):c=e[20];let d;e[21]!==a.diagnostics?(d=a.diagnostics.map(vt),e[21]=a.diagnostics,e[22]=d):d=e[22];let r;e[23]!==d?(r=l("ul",{className:"flex flex-col gap-0.5",children:d}),e[23]=d,e[24]=r):r=e[24];let g;return e[25]!==c||e[26]!==r?(g=p("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[c,r]}),e[25]=c,e[26]=r,e[27]=g):g=e[27],g};function vt(n){return l("li",{className:"font-mono text-[11px] text-destructive",children:n},n)}const yt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.bigint()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Ct="v.string()",Nt=n=>n.split(",").map(e=>e.trim()).filter(e=>e!==""),Tt=n=>{const e=we(83),{onApplied:m,tableNames:a}=n,t=Le(),s=nt(),[c,d]=_(null),[r,g]=_(!1),[o,u]=_(null),[i,v]=_(""),[f,L]=_(""),[S,G]=_(Ct),[y,O]=_(a[0]??""),[$,z]=_(""),[T,C]=_(""),[A,F]=_(!1);let pe;e[0]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>{d(null),v(""),L(""),z(""),C(""),F(!1)},e[0]=pe):pe=e[0];const te=pe;let E;e[1]!==m?(E=async q=>{g(!0),u(null);try{const H=await gt(q);u(H),H.kind==="ok"&&(m(H.tables),te())}catch(H){const Se=H;u({kind:"error",message:Se instanceof Error?Se.message:String(Se)})}g(!1)},e[1]=m,e[2]=E):E=e[2];const M=E;let w;e[3]!==M||e[4]!==i?(w=()=>{Ce(M({kind:"addTable",table:i.trim()}))},e[3]=M,e[4]=i,e[5]=w):w=e[5];const ge=w;let B;e[6]!==f||e[7]!==M||e[8]!==y||e[9]!==S?(B=()=>{Ce(M({column:f.trim(),kind:"addOptionalColumn",table:y,validator:S}))},e[6]=f,e[7]=M,e[8]=y,e[9]=S,e[10]=B):B=e[10];const ce=B;let le;e[11]!==T||e[12]!==$||e[13]!==M||e[14]!==y||e[15]!==A?(le=()=>{Ce(M({fields:Nt(T),kind:"addIndex",name:$.trim(),table:y,unique:A}))},e[11]=T,e[12]=$,e[13]=M,e[14]=y,e[15]=A,e[16]=le):le=e[16];const J=le;let Ne;e[17]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>{u(null),d("addTable")},e[17]=Ne):Ne=e[17];const W=Ne;let me;e[18]===Symbol.for("react.memo_cache_sentinel")?(me=()=>{u(null),d("addColumn")},e[18]=me):me=e[18];const be=me;let D;e[19]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{u(null),d("addIndex")},e[19]=D):D=e[19];const j=D;let se;e[20]!==t?(se=()=>{d("destructive"),u({kind:"needs-migration",message:t("This edit changes stored data and must go through a migration. Review the migration before applying.")})},e[20]=t,e[21]=se):se=e[21];const ue=se;let R;e[22]===Symbol.for("react.memo_cache_sentinel")?(R=q=>{v(q.target.value)},e[22]=R):R=e[22];const ae=R;let K;e[23]===Symbol.for("react.memo_cache_sentinel")?(K=q=>{L(q.target.value)},e[23]=K):K=e[23];const ne=K;let oe;e[24]===Symbol.for("react.memo_cache_sentinel")?(oe=q=>{G(q.target.value)},e[24]=oe):oe=e[24];const fe=oe;let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=q=>{O(q.target.value)},e[25]=X):X=e[25];const Q=X;let U;e[26]===Symbol.for("react.memo_cache_sentinel")?(U=q=>{z(q.target.value)},e[26]=U):U=e[26];const ie=U;let V;e[27]===Symbol.for("react.memo_cache_sentinel")?(V=q=>{C(q.target.value)},e[27]=V):V=e[27];const re=V;let Y;e[28]===Symbol.for("react.memo_cache_sentinel")?(Y=q=>{F(q.target.checked)},e[28]=Y):Y=e[28];const P=Y;let Z;e[29]!==s?(Z=()=>{Ce(s({to:"/migrations"}))},e[29]=s,e[30]=Z):Z=e[30];const b=Z;let ee;e[31]!==t?(ee=t("Edit schema"),e[31]=t,e[32]=ee):ee=e[32];let de;e[33]!==ee?(de=l(Ge,{children:ee}),e[33]=ee,e[34]=de):de=e[34];let xe;e[35]!==t?(xe=t("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=t,e[36]=xe):xe=e[36];let Te;e[37]!==xe?(Te=l(ze,{children:xe}),e[37]=xe,e[38]=Te):Te=e[38];let ve;e[39]!==de||e[40]!==Te?(ve=p(Be,{children:[de,Te]}),e[39]=de,e[40]=Te,e[41]=ve):ve=e[41];const h=a.length>0;let x;e[42]!==c||e[43]!==ue||e[44]!==h?(x=l(bt,{hasTables:h,mode:c,onAddColumn:be,onAddIndex:j,onAddTable:W,onDestructive:ue}),e[42]=c,e[43]=ue,e[44]=h,e[45]=x):x=e[45];let N;e[46]!==r||e[47]!==c||e[48]!==ge||e[49]!==t||e[50]!==i?(N=c==="addTable"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-table-name",children:t("Table name")}),l(ke,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:ae,value:i})]}),l(ye,{"data-testid":"sc-editor-table-apply",disabled:r||i.trim()==="",onClick:ge,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ye,{onClick:te,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[46]=r,e[47]=c,e[48]=ge,e[49]=t,e[50]=i,e[51]=N):N=e[51];let k;e[52]!==r||e[53]!==f||e[54]!==c||e[55]!==ce||e[56]!==t||e[57]!==a||e[58]!==y||e[59]!==S?(k=c==="addColumn"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-column-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:Q,value:y,children:a.map(St)})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-column-name",children:t("Column name")}),l(ke,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:ne,value:f})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-column-type",children:t("Column type")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:fe,value:S,children:yt.map(wt)})]}),l("span",{className:"text-[11px] text-muted-foreground",children:t("Optional")}),l(ye,{"data-testid":"sc-editor-column-apply",disabled:r||f.trim()===""||y==="",onClick:ce,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ye,{onClick:te,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[52]=r,e[53]=f,e[54]=c,e[55]=ce,e[56]=t,e[57]=a,e[58]=y,e[59]=S,e[60]=k):k=e[60];let I;e[61]!==r||e[62]!==T||e[63]!==$||e[64]!==c||e[65]!==J||e[66]!==t||e[67]!==a||e[68]!==y||e[69]!==A?(I=c==="addIndex"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-index-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:Q,value:y,children:a.map(_t)})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-index-name",children:t("Index name")}),l(ke,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:ie,value:$})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-index-fields",children:t("Index fields (comma-separated)")}),l(ke,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:re,value:T})]}),p(Ee,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[l("input",{checked:A,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:P,type:"checkbox"}),l("span",{className:"text-muted-foreground",children:t("Unique")})]}),l(ye,{"data-testid":"sc-editor-index-apply",disabled:r||$.trim()===""||T.trim()==="",onClick:J,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ye,{onClick:te,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[61]=r,e[62]=T,e[63]=$,e[64]=c,e[65]=J,e[66]=t,e[67]=a,e[68]=y,e[69]=A,e[70]=I):I=e[70];let he;e[71]!==b||e[72]!==o?(he=l(xt,{onOpenMigrations:b,result:o}),e[71]=b,e[72]=o,e[73]=he):he=e[73];let _e;e[74]!==x||e[75]!==N||e[76]!==k||e[77]!==I||e[78]!==he?(_e=p(De,{children:[x,N,k,I,he]}),e[74]=x,e[75]=N,e[76]=k,e[77]=I,e[78]=he,e[79]=_e):_e=e[79];let Ie;return e[80]!==ve||e[81]!==_e?(Ie=p(je,{"data-testid":"sc-editor",size:"sm",children:[ve,_e]}),e[80]=ve,e[81]=_e,e[82]=Ie):Ie=e[82],Ie};function St(n){return l("option",{value:n,children:n},n)}function wt(n){return l("option",{value:n.validator,children:n.label},n.validator)}function _t(n){return l("option",{value:n,children:n},n)}const He=[],Et=n=>{const e=we(5),{open:m}=n,a=m&&"rotate-90";let t;e[0]!==a?(t=Qe("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",a),e[0]=a,e[1]=t):t=e[1];let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=l("path",{d:"m9 6 6 6-6 6"}),e[2]=s):s=e[2];let c;return e[3]!==t?(c=l("svg",{"aria-hidden":"true",className:t,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:s}),e[3]=t,e[4]=c):c=e[4],c},Je=n=>{const e=we(20),{children:m,expanded:a,name:t,onToggle:s,rowCount:c,rowTestId:d,toggleTestId:r}=n;let g;e[0]!==a?(g=l(Et,{open:a}),e[0]=a,e[1]=g):g=e[1];let o;e[2]!==t?(o=l("span",{className:"truncate font-mono text-xs text-foreground",title:t,children:t}),e[2]=t,e[3]=o):o=e[3];let u;e[4]!==c?(u=p("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",c,")"]}),e[4]=c,e[5]=u):u=e[5];let i;e[6]!==a||e[7]!==s||e[8]!==g||e[9]!==o||e[10]!==u||e[11]!==r?(i=p("button",{"aria-expanded":a,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":r,onClick:s,type:"button",children:[g,o," ",u]}),e[6]=a,e[7]=s,e[8]=g,e[9]=o,e[10]=u,e[11]=r,e[12]=i):i=e[12];let v;e[13]!==m||e[14]!==a?(v=a&&l("div",{className:"px-3 pb-3 ps-8",children:m}),e[13]=m,e[14]=a,e[15]=v):v=e[15];let f;return e[16]!==d||e[17]!==i||e[18]!==v?(f=p("li",{className:"border-t border-border/60 first:border-t-0","data-testid":d,children:[i,v]}),e[16]=d,e[17]=i,e[18]=v,e[19]=f):f=e[19],f},We=n=>{const e=we(5),{columns:m,testId:a}=n;let t;e[0]!==m?(t=m.map(kt),e[0]=m,e[1]=t):t=e[1];let s;return e[2]!==t||e[3]!==a?(s=l("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":a,children:t}),e[2]=t,e[3]=a,e[4]=s):s=e[4],s},It=n=>{const e=we(10),{heading:m,indexes:a,testId:t}=n;let s;e[0]!==m?(s=l("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:m}),e[0]=m,e[1]=s):s=e[1];let c;e[2]!==a?(c=a.map(At),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==c||e[5]!==t?(d=l("ul",{className:"flex flex-col gap-1","data-testid":t,children:c}),e[4]=c,e[5]=t,e[6]=d):d=e[6];let r;return e[7]!==s||e[8]!==d?(r=p("div",{className:"pt-3",children:[s,d]}),e[7]=s,e[8]=d,e[9]=r):r=e[9],r},Xe=n=>Qe("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",n?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),Qt=n=>{const e=we(85),{initialShardKey:m,initialTable:a,schemaEditable:t}=n,s=Le();let c;e[0]!==m||e[1]!==a?(c={initialShardKey:m,initialTable:a},e[0]=m,e[1]=a,e[2]=c):c=e[2];const{columns:d,diagramTables:r,error:g,expanded:o,filteredGlobalTables:u,filteredTables:i,globalColumns:v,globalError:f,globalExpanded:L,globalTables:S,indexes:G,refresh:y,setShardKey:O,setTableFilter:$,setView:z,shardColumnsError:T,shardKey:C,tableFilter:A,tables:F,toggle:pe,toggleGlobal:te,view:E}=mt(c);let M;e[3]!==z?(M=()=>{z("list")},e[3]=z,e[4]=M):M=e[4];const w=M;let ge;e[5]!==z?(ge=()=>{z("graph")},e[5]=z,e[6]=ge):ge=e[6];const B=ge;let ce;e[7]!==$?(ce=b=>{$(b.target.value)},e[7]=$,e[8]=ce):ce=e[8];const le=ce;let J;e[9]!==y||e[10]!==C?(J=b=>{Ce(y(C))},e[9]=y,e[10]=C,e[11]=J):J=e[11];const Ne=J;let W;e[12]!==F?(W=F??[],e[12]=F,e[13]=W):W=e[13];let me;e[14]!==W?(me=W.map($t),e[14]=W,e[15]=me):me=e[15];const be=me;let D;e[16]!==O||e[17]!==C?(D=l(Ze,{onChange:O,testId:"sc-shard-input",value:C}),e[16]=O,e[17]=C,e[18]=D):D=e[18];let j;e[19]!==s?(j=s("Schema view"),e[19]=s,e[20]=j):j=e[20];const se=E==="graph",ue=E==="graph";let R;e[21]!==ue?(R=Xe(ue),e[21]=ue,e[22]=R):R=e[22];let ae;e[23]!==s?(ae=s("Graph"),e[23]=s,e[24]=ae):ae=e[24];let K;e[25]!==B||e[26]!==se||e[27]!==R||e[28]!==ae?(K=l("button",{"aria-selected":se,className:R,"data-testid":"sc-view-graph",onClick:B,role:"tab",type:"button",children:ae}),e[25]=B,e[26]=se,e[27]=R,e[28]=ae,e[29]=K):K=e[29];const ne=E==="list",oe=E==="list";let fe;e[30]!==oe?(fe=Xe(oe),e[30]=oe,e[31]=fe):fe=e[31];let X;e[32]!==s?(X=s("Table list"),e[32]=s,e[33]=X):X=e[33];let Q;e[34]!==w||e[35]!==ne||e[36]!==fe||e[37]!==X?(Q=l("button",{"aria-selected":ne,className:fe,"data-testid":"sc-view-list",onClick:w,role:"tab",type:"button",children:X}),e[34]=w,e[35]=ne,e[36]=fe,e[37]=X,e[38]=Q):Q=e[38];let U;e[39]!==K||e[40]!==Q||e[41]!==j?(U=p("div",{"aria-label":j,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[K,Q]}),e[39]=K,e[40]=Q,e[41]=j,e[42]=U):U=e[42];let ie;e[43]!==U||e[44]!==D?(ie=p("div",{className:"flex flex-wrap items-center gap-3",children:[D,U]}),e[43]=U,e[44]=D,e[45]=ie):ie=e[45];let V;e[46]!==Ne||e[47]!==t||e[48]!==be?(V=t===!0&&l(Tt,{onApplied:Ne,tableNames:be}),e[46]=Ne,e[47]=t,e[48]=be,e[49]=V):V=e[49];let re;e[50]!==le||e[51]!==s||e[52]!==A||e[53]!==E?(re=E==="list"&&l(ke,{"aria-label":s("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:le,placeholder:s("Filter tables"),value:A}),e[50]=le,e[51]=s,e[52]=A,e[53]=E,e[54]=re):re=e[54];let Y;e[55]!==r||e[56]!==g||e[57]!==f||e[58]!==T||e[59]!==C||e[60]!==E?(Y=E==="graph"&&p("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[g!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),f!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:f}),l(at,{columnsError:T[C]===!0,tables:r,testIdPrefix:"sc-graph"})]}),e[55]=r,e[56]=g,e[57]=f,e[58]=T,e[59]=C,e[60]=E,e[61]=Y):Y=e[61];let P;e[62]!==d||e[63]!==g||e[64]!==o||e[65]!==u||e[66]!==i||e[67]!==v||e[68]!==f||e[69]!==L||e[70]!==S||e[71]!==G||e[72]!==C||e[73]!==s||e[74]!==F||e[75]!==pe||e[76]!==te||e[77]!==E?(P=E==="list"&&p("div",{className:"flex flex-col gap-4",children:[p(je,{"data-testid":"sc-shard-section",size:"sm",children:[p(Be,{children:[p("div",{className:"flex items-center gap-2",children:[l(Ke,{tier:"shard"}),l(Ge,{children:s("Shard tables")}),F!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),l(ze,{children:Pe.shard.hint})]}),p(De,{children:[g!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),F!==null&&F.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:s("No tables in this shard.")}),F!==null&&F.length>0&&i.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:s("No tables match your filter.")}),i.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(b=>{const ee=`${C}:${b.name}`,de=G[ee]??[];return p(Je,{expanded:o===b.name,name:b.name,onToggle:()=>{Ce(pe(b.name))},rowCount:b.rowCount,rowTestId:`sc-table-${b.name}`,toggleTestId:`sc-toggle-${b.name}`,children:[l(We,{columns:d[ee]??He,testId:`sc-columns-${b.name}`}),de.length>0&&l(It,{heading:s("Indexes"),indexes:de,testId:`sc-indexes-${b.name}`})]},b.name)})})]})]}),p(je,{"data-testid":"sc-global-section",size:"sm",children:[p(Be,{children:[p("div",{className:"flex items-center gap-2",children:[l(Ke,{tier:"global"}),l(Ge,{children:s("Global tables (D1)")}),S!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:u.length})]}),l(ze,{children:Pe.global.hint})]}),p(De,{children:[f!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:f}),S!==null&&S.length===0&&l(et,{description:Pe.global.hint,testId:"sc-global-empty",title:s("No global tables.")}),S!==null&&S.length>0&&u.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:s("No tables match your filter.")}),u.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:u.map(b=>l(Je,{expanded:L===b.name,name:b.name,onToggle:()=>{Ce(te(b.name))},rowCount:b.rowCount,rowTestId:`sc-global-table-${b.name}`,toggleTestId:`sc-global-toggle-${b.name}`,children:l(We,{columns:v[b.name]??He,testId:`sc-global-columns-${b.name}`})},b.name))})]})]})]}),e[62]=d,e[63]=g,e[64]=o,e[65]=u,e[66]=i,e[67]=v,e[68]=f,e[69]=L,e[70]=S,e[71]=G,e[72]=C,e[73]=s,e[74]=F,e[75]=pe,e[76]=te,e[77]=E,e[78]=P):P=e[78];let Z;return e[79]!==ie||e[80]!==V||e[81]!==re||e[82]!==Y||e[83]!==P?(Z=p("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[ie,V,re,Y,P]}),e[79]=ie,e[80]=V,e[81]=re,e[82]=Y,e[83]=P,e[84]=Z):Z=e[84],Z};function kt(n){return l("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:n},n)}function At(n){return p("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[l("span",{className:"font-mono",children:n.name}),l(Fe,{variant:"outline",children:n.type}),n.unique===!0&&l(Fe,{variant:"secondary",children:"unique"}),l("span",{className:"text-muted-foreground",children:n.fields.join(", ")})]},`${n.type}:${n.name}`)}function $t(n){return n.name}export{Qt as SchemaViewer};
|
|
1
|
+
import{c as we}from"react/compiler-runtime";import{ShardInput as Ze}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{S as Ke,T as Pe}from"../packem_shared/storage-tier-C2mKwYRj.mjs";import{B as Fe}from"../packem_shared/badge-r_5B4LHP.mjs";import{c as Ge,d as ze,b as Be,a as De,C as je}from"../packem_shared/card-By2O8ULa.mjs";import{E as et}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ke}from"../packem_shared/input-CXhxesPC.mjs";import{useT as Oe}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{c as Le,d as Ae,b as $e,f as Ce}from"../packem_shared/internal-BXEjuLPN.mjs";import{c as Qe}from"../packem_shared/utils-bhneXptQ.mjs";import{useState as _,useRef as Ue,useEffect as qe}from"react";import{u as tt}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{u as lt}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{ADMIN_FUNCTIONS as Me}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{r as st}from"../packem_shared/shard-history-CaO3C4KQ.mjs";import{S as at}from"../packem_shared/schema-diagram-k7cFl7Wp.mjs";import{useNavigate as nt}from"@tanstack/react-router";import{B as ye}from"../packem_shared/button-q0UYSmrn.mjs";import{L as Ee}from"../packem_shared/label-DKFzyHq6.mjs";import{jsx as l,jsxs as p,Fragment as Ve}from"react/jsx-runtime";const ot=Le(Me.listTables),it=Le(Me.listTableIndexes),rt=Le(Me.readTablePage),dt=Le(Me.describeTables),ct={},Ye=[],mt=n=>{const e=we(74),{initialShardKey:m,initialTable:a}=n,t=lt(),[s,c]=_("graph"),{queryShardKey:d,setShardKey:r,shardKey:g}=tt(m),[o,u]=_(""),[i,v]=_(null),[f,O]=_(null);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S={},e[0]=S):S=e[0];const[G,y]=_(S);let L;e[1]===Symbol.for("react.memo_cache_sentinel")?(L={},e[1]=L):L=e[1];const[$,z]=_(L),[T,C]=_(null);let A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A={},e[2]=A):A=e[2];const[F,pe]=_(A);let te;e[3]===Symbol.for("react.memo_cache_sentinel")?(te={},e[3]=te):te=e[3];const[E,M]=_(te),[w,ge]=_(null),[B,ce]=_(null);let le;e[4]===Symbol.for("react.memo_cache_sentinel")?(le={},e[4]=le):le=e[4];const[J,Ne]=_(le),[W,me]=_(null),be=Ue(0);let D;e[5]!==t?(D=async h=>{be.current=be.current+1;const x=be.current;O(null);try{const N=await t.query(ot,{},Ae(h));if(x!==be.current)return;st(h),v(N),y({}),z({}),C(null),pe(k=>Object.fromEntries(Object.entries(k).filter(I=>{const[he]=I;return he!==h}))),M(k=>Object.fromEntries(Object.entries(k).filter(I=>{const[he]=I;return he!==h})))}catch(N){const k=N;if(x!==be.current)return;v(null),O($e(k))}},e[5]=t,e[6]=D):D=e[6];const j=D;let se;e[7]!==t?(se=async()=>{ce(null);try{ge(await t.listGlobalTables())}catch(h){const x=h;ge(null),ce($e(x))}},e[7]=t,e[8]=se):se=e[8];const ue=se;let R,ae;e[9]!==d||e[10]!==j||e[11]!==ue?(R=()=>{Ce(j(d)),Ce(ue())},ae=[j,ue,d],e[9]=d,e[10]=j,e[11]=ue,e[12]=R,e[13]=ae):(R=e[12],ae=e[13]),qe(R,ae);let K;e[14]!==t||e[15]!==G||e[16]!==T||e[17]!==d?(K=async h=>{if(T===h){C(null);return}C(h);const x=`${d}:${h}`;if(G[x]!==void 0)return;const[N,k]=await Promise.allSettled([t.query(rt,{limit:1,offset:0,table:h},Ae(d)),t.query(it,{table:h},Ae(d))]);N.status==="fulfilled"?y(I=>({...I,[x]:N.value.columns})):O($e(N.reason)),k.status==="fulfilled"&&z(I=>({...I,[x]:k.value.indexes}))},e[14]=t,e[15]=G,e[16]=T,e[17]=d,e[18]=K):K=e[18];const ne=K;let oe;e[19]!==t||e[20]!==J||e[21]!==W?(oe=async h=>{if(W===h){me(null);return}if(me(h),J[h]===void 0)try{const x=await t.readGlobalTablePage({limit:1,offset:0,table:h});Ne(N=>({...N,[h]:x.columns}))}catch(x){ce($e(x))}},e[19]=t,e[20]=J,e[21]=W,e[22]=oe):oe=e[22];const fe=oe,X=Ue(void 0);let Q,U;e[23]!==a||e[24]!==i||e[25]!==ne?(Q=()=>{a===void 0||i===null||X.current===a||i.some(h=>h.name===a)&&(X.current=a,Ce(ne(a)))},U=[a,i,ne],e[23]=a,e[24]=i,e[25]=ne,e[26]=Q,e[27]=U):(Q=e[26],U=e[27]),qe(Q,U);let ie;e[28]!==t?(ie=async(h,x,N)=>{const[k,I]=await Promise.all([Promise.allSettled([t.query(dt,{tables:[...x,...N]},Ae(h))]),Promise.all(N.map(async H=>{const Se=await Promise.allSettled([t.readGlobalTablePage({limit:1,offset:0,table:H})]),Re=Se[0].status==="fulfilled"?Se[0].value:void 0;return{columns:Re?.columns??[],refs:Re?.refs??{},table:H}}))]),he=k[0].status==="fulfilled"?k[0].value?.columnsByTable??{}:{},_e=k[0].status==="rejected",Ie=new Map(I.map(ut)),q=[...x,...N].map(H=>{const Se=he[H]??[];return[H,Se.length>0?Se:Ie.get(H)??[]]});pe(H=>({...H,[h]:Object.fromEntries(q)})),M(H=>({...H,[h]:_e}))},e[28]=t,e[29]=ie):ie=e[29];const V=ie;let re,Y;e[30]!==B||e[31]!==w||e[32]!==V||e[33]!==d||e[34]!==F||e[35]!==i||e[36]!==s?(re=()=>{s!=="graph"||i===null||w===null&&B===null||F[d]!==void 0||Ce(V(d,i.map(ft),(w??[]).map(ht)))},Y=[s,i,w,B,d,F,V],e[30]=B,e[31]=w,e[32]=V,e[33]=d,e[34]=F,e[35]=i,e[36]=s,e[37]=re,e[38]=Y):(re=e[37],Y=e[38]),qe(re,Y);const P=F[d]??ct;let Z;if(e[39]!==P||e[40]!==w||e[41]!==i){let h;e[43]!==P?(h=I=>({columns:P[I.name]??Ye,name:I.name,tier:"shard"}),e[43]=P,e[44]=h):h=e[44];const x=(i??[]).map(h);let N;e[45]!==P?(N=I=>({columns:P[I.name]??Ye,name:I.name,tier:"global"}),e[45]=P,e[46]=N):N=e[46];const k=(w??[]).map(N);Z=[...x,...k],e[39]=P,e[40]=w,e[41]=i,e[42]=Z}else Z=e[42];const b=Z;let ee;if(e[47]!==o||e[48]!==i){const h=o.trim().toLowerCase();ee=(i??[]).filter(x=>x.name.toLowerCase().includes(h)),e[47]=o,e[48]=i,e[49]=ee}else ee=e[49];const de=ee;let xe;if(e[50]!==w||e[51]!==o){const h=o.trim().toLowerCase();xe=(w??[]).filter(x=>x.name.toLowerCase().includes(h)),e[50]=w,e[51]=o,e[52]=xe}else xe=e[52];const Te=xe;let ve;return e[53]!==G||e[54]!==b||e[55]!==f||e[56]!==T||e[57]!==Te||e[58]!==de||e[59]!==J||e[60]!==B||e[61]!==W||e[62]!==w||e[63]!==$||e[64]!==j||e[65]!==r||e[66]!==E||e[67]!==g||e[68]!==o||e[69]!==i||e[70]!==ne||e[71]!==fe||e[72]!==s?(ve={columns:G,diagramTables:b,error:f,expanded:T,filteredGlobalTables:Te,filteredTables:de,globalColumns:J,globalError:B,globalExpanded:W,globalTables:w,indexes:$,refresh:j,setShardKey:r,setTableFilter:u,setView:c,shardColumnsError:E,shardKey:g,tableFilter:o,tables:i,toggle:ne,toggleGlobal:fe,view:s},e[53]=G,e[54]=b,e[55]=f,e[56]=T,e[57]=Te,e[58]=de,e[59]=J,e[60]=B,e[61]=W,e[62]=w,e[63]=$,e[64]=j,e[65]=r,e[66]=E,e[67]=g,e[68]=o,e[69]=i,e[70]=ne,e[71]=fe,e[72]=s,e[73]=ve):ve=e[73],ve};function ut(n){const{columns:e,refs:m,table:a}=n;return[a,e.map(t=>{const s=m[t];return s===void 0?{name:t,optional:!1,type:""}:{name:t,optional:!1,ref:s,type:"id"}})]}function ft(n){return n.name}function ht(n){return n.name}const pt="/__lunora/schema-edit",gt=async n=>{const e=await fetch(pt,{body:JSON.stringify(n),headers:{"Content-Type":"application/json"},method:"POST"}),m=await e.json();return m.needsMigration===!0?{kind:"needs-migration",message:m.message??"This edit needs a migration."}:e.ok&&m.tables!==void 0?{diagnostics:m.diagnostics??[],kind:"ok",tables:m.tables}:{kind:"error",message:m.error??`schema edit failed (${String(e.status)})`}},bt=n=>{const e=we(32),{hasTables:m,mode:a,onAddColumn:t,onAddIndex:s,onAddTable:c,onDestructive:d}=n,r=Oe(),g=a==="addTable"?"default":"outline";let o;e[0]!==r?(o=r("Add table"),e[0]=r,e[1]=o):o=e[1];let u;e[2]!==c||e[3]!==g||e[4]!==o?(u=l(ye,{"data-testid":"sc-editor-add-table",onClick:c,size:"xs",type:"button",variant:g,children:o}),e[2]=c,e[3]=g,e[4]=o,e[5]=u):u=e[5];const i=!m,v=a==="addColumn"?"default":"outline";let f;e[6]!==r?(f=r("Add column"),e[6]=r,e[7]=f):f=e[7];let O;e[8]!==t||e[9]!==i||e[10]!==v||e[11]!==f?(O=l(ye,{"data-testid":"sc-editor-add-column",disabled:i,onClick:t,size:"xs",type:"button",variant:v,children:f}),e[8]=t,e[9]=i,e[10]=v,e[11]=f,e[12]=O):O=e[12];const S=!m,G=a==="addIndex"?"default":"outline";let y;e[13]!==r?(y=r("Add index"),e[13]=r,e[14]=y):y=e[14];let L;e[15]!==s||e[16]!==y||e[17]!==S||e[18]!==G?(L=l(ye,{"data-testid":"sc-editor-add-index",disabled:S,onClick:s,size:"xs",type:"button",variant:G,children:y}),e[15]=s,e[16]=y,e[17]=S,e[18]=G,e[19]=L):L=e[19];const $=!m,z=a==="destructive"?"default":"ghost";let T;e[20]!==r?(T=r("Rename / drop / change type…"),e[20]=r,e[21]=T):T=e[21];let C;e[22]!==d||e[23]!==$||e[24]!==z||e[25]!==T?(C=l(ye,{"data-testid":"sc-editor-destructive",disabled:$,onClick:d,size:"xs",type:"button",variant:z,children:T}),e[22]=d,e[23]=$,e[24]=z,e[25]=T,e[26]=C):C=e[26];let A;return e[27]!==L||e[28]!==C||e[29]!==u||e[30]!==O?(A=p("div",{className:"flex flex-wrap gap-2",children:[u,O,L,C]}),e[27]=L,e[28]=C,e[29]=u,e[30]=O,e[31]=A):A=e[31],A},xt=n=>{const e=we(28),{onOpenMigrations:m,result:a}=n,t=Oe();if(a===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=l(Ve,{}),e[0]=o):o=e[0],o}if(a.kind==="error"){let o;return e[1]!==a.message?(o=l("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:a.message}),e[1]=a.message,e[2]=o):o=e[2],o}if(a.kind==="needs-migration"){let o;e[3]!==a.message||e[4]!==t?(o=a.message===""?t("This edit changes stored data and must go through a migration. Review the migration before applying."):a.message,e[3]=a.message,e[4]=t,e[5]=o):o=e[5];let u;e[6]!==o?(u=l("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=u):u=e[7];let i;e[8]!==t?(i=t("Open Migrations"),e[8]=t,e[9]=i):i=e[9];let v;e[10]!==m||e[11]!==i?(v=l(ye,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:m,size:"xs",type:"button",variant:"outline",children:i}),e[10]=m,e[11]=i,e[12]=v):v=e[12];let f;return e[13]!==u||e[14]!==v?(f=p("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[u,v]}),e[13]=u,e[14]=v,e[15]=f):f=e[15],f}if(a.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=l(Ve,{}),e[16]=o):o=e[16],o}let s;e[17]!==t?(s=t("Codegen reported diagnostics:"),e[17]=t,e[18]=s):s=e[18];let c;e[19]!==s?(c=l("p",{className:"text-sm text-destructive",role:"alert",children:s}),e[19]=s,e[20]=c):c=e[20];let d;e[21]!==a.diagnostics?(d=a.diagnostics.map(vt),e[21]=a.diagnostics,e[22]=d):d=e[22];let r;e[23]!==d?(r=l("ul",{className:"flex flex-col gap-0.5",children:d}),e[23]=d,e[24]=r):r=e[24];let g;return e[25]!==c||e[26]!==r?(g=p("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[c,r]}),e[25]=c,e[26]=r,e[27]=g):g=e[27],g};function vt(n){return l("li",{className:"font-mono text-[11px] text-destructive",children:n},n)}const yt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.bigint()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Ct="v.string()",Nt=n=>n.split(",").map(e=>e.trim()).filter(e=>e!==""),Tt=n=>{const e=we(83),{onApplied:m,tableNames:a}=n,t=Oe(),s=nt(),[c,d]=_(null),[r,g]=_(!1),[o,u]=_(null),[i,v]=_(""),[f,O]=_(""),[S,G]=_(Ct),[y,L]=_(a[0]??""),[$,z]=_(""),[T,C]=_(""),[A,F]=_(!1);let pe;e[0]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>{d(null),v(""),O(""),z(""),C(""),F(!1)},e[0]=pe):pe=e[0];const te=pe;let E;e[1]!==m?(E=async q=>{g(!0),u(null);try{const H=await gt(q);u(H),H.kind==="ok"&&(m(H.tables),te())}catch(H){const Se=H;u({kind:"error",message:Se instanceof Error?Se.message:String(Se)})}g(!1)},e[1]=m,e[2]=E):E=e[2];const M=E;let w;e[3]!==M||e[4]!==i?(w=()=>{Ce(M({kind:"addTable",table:i.trim()}))},e[3]=M,e[4]=i,e[5]=w):w=e[5];const ge=w;let B;e[6]!==f||e[7]!==M||e[8]!==y||e[9]!==S?(B=()=>{Ce(M({column:f.trim(),kind:"addOptionalColumn",table:y,validator:S}))},e[6]=f,e[7]=M,e[8]=y,e[9]=S,e[10]=B):B=e[10];const ce=B;let le;e[11]!==T||e[12]!==$||e[13]!==M||e[14]!==y||e[15]!==A?(le=()=>{Ce(M({fields:Nt(T),kind:"addIndex",name:$.trim(),table:y,unique:A}))},e[11]=T,e[12]=$,e[13]=M,e[14]=y,e[15]=A,e[16]=le):le=e[16];const J=le;let Ne;e[17]===Symbol.for("react.memo_cache_sentinel")?(Ne=()=>{u(null),d("addTable")},e[17]=Ne):Ne=e[17];const W=Ne;let me;e[18]===Symbol.for("react.memo_cache_sentinel")?(me=()=>{u(null),d("addColumn")},e[18]=me):me=e[18];const be=me;let D;e[19]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{u(null),d("addIndex")},e[19]=D):D=e[19];const j=D;let se;e[20]!==t?(se=()=>{d("destructive"),u({kind:"needs-migration",message:t("This edit changes stored data and must go through a migration. Review the migration before applying.")})},e[20]=t,e[21]=se):se=e[21];const ue=se;let R;e[22]===Symbol.for("react.memo_cache_sentinel")?(R=q=>{v(q.target.value)},e[22]=R):R=e[22];const ae=R;let K;e[23]===Symbol.for("react.memo_cache_sentinel")?(K=q=>{O(q.target.value)},e[23]=K):K=e[23];const ne=K;let oe;e[24]===Symbol.for("react.memo_cache_sentinel")?(oe=q=>{G(q.target.value)},e[24]=oe):oe=e[24];const fe=oe;let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=q=>{L(q.target.value)},e[25]=X):X=e[25];const Q=X;let U;e[26]===Symbol.for("react.memo_cache_sentinel")?(U=q=>{z(q.target.value)},e[26]=U):U=e[26];const ie=U;let V;e[27]===Symbol.for("react.memo_cache_sentinel")?(V=q=>{C(q.target.value)},e[27]=V):V=e[27];const re=V;let Y;e[28]===Symbol.for("react.memo_cache_sentinel")?(Y=q=>{F(q.target.checked)},e[28]=Y):Y=e[28];const P=Y;let Z;e[29]!==s?(Z=()=>{Ce(s({to:"/migrations"}))},e[29]=s,e[30]=Z):Z=e[30];const b=Z;let ee;e[31]!==t?(ee=t("Edit schema"),e[31]=t,e[32]=ee):ee=e[32];let de;e[33]!==ee?(de=l(Ge,{children:ee}),e[33]=ee,e[34]=de):de=e[34];let xe;e[35]!==t?(xe=t("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=t,e[36]=xe):xe=e[36];let Te;e[37]!==xe?(Te=l(ze,{children:xe}),e[37]=xe,e[38]=Te):Te=e[38];let ve;e[39]!==de||e[40]!==Te?(ve=p(Be,{children:[de,Te]}),e[39]=de,e[40]=Te,e[41]=ve):ve=e[41];const h=a.length>0;let x;e[42]!==c||e[43]!==ue||e[44]!==h?(x=l(bt,{hasTables:h,mode:c,onAddColumn:be,onAddIndex:j,onAddTable:W,onDestructive:ue}),e[42]=c,e[43]=ue,e[44]=h,e[45]=x):x=e[45];let N;e[46]!==r||e[47]!==c||e[48]!==ge||e[49]!==t||e[50]!==i?(N=c==="addTable"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-table-name",children:t("Table name")}),l(ke,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:ae,value:i})]}),l(ye,{"data-testid":"sc-editor-table-apply",disabled:r||i.trim()==="",onClick:ge,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ye,{onClick:te,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[46]=r,e[47]=c,e[48]=ge,e[49]=t,e[50]=i,e[51]=N):N=e[51];let k;e[52]!==r||e[53]!==f||e[54]!==c||e[55]!==ce||e[56]!==t||e[57]!==a||e[58]!==y||e[59]!==S?(k=c==="addColumn"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-column-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:Q,value:y,children:a.map(St)})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-column-name",children:t("Column name")}),l(ke,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:ne,value:f})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-column-type",children:t("Column type")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:fe,value:S,children:yt.map(wt)})]}),l("span",{className:"text-[11px] text-muted-foreground",children:t("Optional")}),l(ye,{"data-testid":"sc-editor-column-apply",disabled:r||f.trim()===""||y==="",onClick:ce,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ye,{onClick:te,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[52]=r,e[53]=f,e[54]=c,e[55]=ce,e[56]=t,e[57]=a,e[58]=y,e[59]=S,e[60]=k):k=e[60];let I;e[61]!==r||e[62]!==T||e[63]!==$||e[64]!==c||e[65]!==J||e[66]!==t||e[67]!==a||e[68]!==y||e[69]!==A?(I=c==="addIndex"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-index-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:Q,value:y,children:a.map(_t)})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-index-name",children:t("Index name")}),l(ke,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:ie,value:$})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(Ee,{htmlFor:"sc-editor-index-fields",children:t("Index fields (comma-separated)")}),l(ke,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:re,value:T})]}),p(Ee,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[l("input",{checked:A,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:P,type:"checkbox"}),l("span",{className:"text-muted-foreground",children:t("Unique")})]}),l(ye,{"data-testid":"sc-editor-index-apply",disabled:r||$.trim()===""||T.trim()==="",onClick:J,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ye,{onClick:te,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[61]=r,e[62]=T,e[63]=$,e[64]=c,e[65]=J,e[66]=t,e[67]=a,e[68]=y,e[69]=A,e[70]=I):I=e[70];let he;e[71]!==b||e[72]!==o?(he=l(xt,{onOpenMigrations:b,result:o}),e[71]=b,e[72]=o,e[73]=he):he=e[73];let _e;e[74]!==x||e[75]!==N||e[76]!==k||e[77]!==I||e[78]!==he?(_e=p(De,{children:[x,N,k,I,he]}),e[74]=x,e[75]=N,e[76]=k,e[77]=I,e[78]=he,e[79]=_e):_e=e[79];let Ie;return e[80]!==ve||e[81]!==_e?(Ie=p(je,{"data-testid":"sc-editor",size:"sm",children:[ve,_e]}),e[80]=ve,e[81]=_e,e[82]=Ie):Ie=e[82],Ie};function St(n){return l("option",{value:n,children:n},n)}function wt(n){return l("option",{value:n.validator,children:n.label},n.validator)}function _t(n){return l("option",{value:n,children:n},n)}const He=[],Et=n=>{const e=we(5),{open:m}=n,a=m&&"rotate-90";let t;e[0]!==a?(t=Qe("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",a),e[0]=a,e[1]=t):t=e[1];let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=l("path",{d:"m9 6 6 6-6 6"}),e[2]=s):s=e[2];let c;return e[3]!==t?(c=l("svg",{"aria-hidden":"true",className:t,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:s}),e[3]=t,e[4]=c):c=e[4],c},Je=n=>{const e=we(20),{children:m,expanded:a,name:t,onToggle:s,rowCount:c,rowTestId:d,toggleTestId:r}=n;let g;e[0]!==a?(g=l(Et,{open:a}),e[0]=a,e[1]=g):g=e[1];let o;e[2]!==t?(o=l("span",{className:"truncate font-mono text-xs text-foreground",title:t,children:t}),e[2]=t,e[3]=o):o=e[3];let u;e[4]!==c?(u=p("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",c,")"]}),e[4]=c,e[5]=u):u=e[5];let i;e[6]!==a||e[7]!==s||e[8]!==g||e[9]!==o||e[10]!==u||e[11]!==r?(i=p("button",{"aria-expanded":a,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":r,onClick:s,type:"button",children:[g,o," ",u]}),e[6]=a,e[7]=s,e[8]=g,e[9]=o,e[10]=u,e[11]=r,e[12]=i):i=e[12];let v;e[13]!==m||e[14]!==a?(v=a&&l("div",{className:"px-3 pb-3 ps-8",children:m}),e[13]=m,e[14]=a,e[15]=v):v=e[15];let f;return e[16]!==d||e[17]!==i||e[18]!==v?(f=p("li",{className:"border-t border-border/60 first:border-t-0","data-testid":d,children:[i,v]}),e[16]=d,e[17]=i,e[18]=v,e[19]=f):f=e[19],f},We=n=>{const e=we(5),{columns:m,testId:a}=n;let t;e[0]!==m?(t=m.map(kt),e[0]=m,e[1]=t):t=e[1];let s;return e[2]!==t||e[3]!==a?(s=l("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":a,children:t}),e[2]=t,e[3]=a,e[4]=s):s=e[4],s},It=n=>{const e=we(10),{heading:m,indexes:a,testId:t}=n;let s;e[0]!==m?(s=l("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:m}),e[0]=m,e[1]=s):s=e[1];let c;e[2]!==a?(c=a.map(At),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==c||e[5]!==t?(d=l("ul",{className:"flex flex-col gap-1","data-testid":t,children:c}),e[4]=c,e[5]=t,e[6]=d):d=e[6];let r;return e[7]!==s||e[8]!==d?(r=p("div",{className:"pt-3",children:[s,d]}),e[7]=s,e[8]=d,e[9]=r):r=e[9],r},Xe=n=>Qe("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",n?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),Qt=n=>{const e=we(85),{initialShardKey:m,initialTable:a,schemaEditable:t}=n,s=Oe();let c;e[0]!==m||e[1]!==a?(c={initialShardKey:m,initialTable:a},e[0]=m,e[1]=a,e[2]=c):c=e[2];const{columns:d,diagramTables:r,error:g,expanded:o,filteredGlobalTables:u,filteredTables:i,globalColumns:v,globalError:f,globalExpanded:O,globalTables:S,indexes:G,refresh:y,setShardKey:L,setTableFilter:$,setView:z,shardColumnsError:T,shardKey:C,tableFilter:A,tables:F,toggle:pe,toggleGlobal:te,view:E}=mt(c);let M;e[3]!==z?(M=()=>{z("list")},e[3]=z,e[4]=M):M=e[4];const w=M;let ge;e[5]!==z?(ge=()=>{z("graph")},e[5]=z,e[6]=ge):ge=e[6];const B=ge;let ce;e[7]!==$?(ce=b=>{$(b.target.value)},e[7]=$,e[8]=ce):ce=e[8];const le=ce;let J;e[9]!==y||e[10]!==C?(J=b=>{Ce(y(C))},e[9]=y,e[10]=C,e[11]=J):J=e[11];const Ne=J;let W;e[12]!==F?(W=F??[],e[12]=F,e[13]=W):W=e[13];let me;e[14]!==W?(me=W.map($t),e[14]=W,e[15]=me):me=e[15];const be=me;let D;e[16]!==L||e[17]!==C?(D=l(Ze,{onChange:L,testId:"sc-shard-input",value:C}),e[16]=L,e[17]=C,e[18]=D):D=e[18];let j;e[19]!==s?(j=s("Schema view"),e[19]=s,e[20]=j):j=e[20];const se=E==="graph",ue=E==="graph";let R;e[21]!==ue?(R=Xe(ue),e[21]=ue,e[22]=R):R=e[22];let ae;e[23]!==s?(ae=s("Graph"),e[23]=s,e[24]=ae):ae=e[24];let K;e[25]!==B||e[26]!==se||e[27]!==R||e[28]!==ae?(K=l("button",{"aria-selected":se,className:R,"data-testid":"sc-view-graph",onClick:B,role:"tab",type:"button",children:ae}),e[25]=B,e[26]=se,e[27]=R,e[28]=ae,e[29]=K):K=e[29];const ne=E==="list",oe=E==="list";let fe;e[30]!==oe?(fe=Xe(oe),e[30]=oe,e[31]=fe):fe=e[31];let X;e[32]!==s?(X=s("Table list"),e[32]=s,e[33]=X):X=e[33];let Q;e[34]!==w||e[35]!==ne||e[36]!==fe||e[37]!==X?(Q=l("button",{"aria-selected":ne,className:fe,"data-testid":"sc-view-list",onClick:w,role:"tab",type:"button",children:X}),e[34]=w,e[35]=ne,e[36]=fe,e[37]=X,e[38]=Q):Q=e[38];let U;e[39]!==K||e[40]!==Q||e[41]!==j?(U=p("div",{"aria-label":j,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[K,Q]}),e[39]=K,e[40]=Q,e[41]=j,e[42]=U):U=e[42];let ie;e[43]!==U||e[44]!==D?(ie=p("div",{className:"flex flex-wrap items-center gap-3",children:[D,U]}),e[43]=U,e[44]=D,e[45]=ie):ie=e[45];let V;e[46]!==Ne||e[47]!==t||e[48]!==be?(V=t===!0&&l(Tt,{onApplied:Ne,tableNames:be}),e[46]=Ne,e[47]=t,e[48]=be,e[49]=V):V=e[49];let re;e[50]!==le||e[51]!==s||e[52]!==A||e[53]!==E?(re=E==="list"&&l(ke,{"aria-label":s("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:le,placeholder:s("Filter tables"),value:A}),e[50]=le,e[51]=s,e[52]=A,e[53]=E,e[54]=re):re=e[54];let Y;e[55]!==r||e[56]!==g||e[57]!==f||e[58]!==T||e[59]!==C||e[60]!==E?(Y=E==="graph"&&p("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[g!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),f!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:f}),l(at,{columnsError:T[C]===!0,tables:r,testIdPrefix:"sc-graph"})]}),e[55]=r,e[56]=g,e[57]=f,e[58]=T,e[59]=C,e[60]=E,e[61]=Y):Y=e[61];let P;e[62]!==d||e[63]!==g||e[64]!==o||e[65]!==u||e[66]!==i||e[67]!==v||e[68]!==f||e[69]!==O||e[70]!==S||e[71]!==G||e[72]!==C||e[73]!==s||e[74]!==F||e[75]!==pe||e[76]!==te||e[77]!==E?(P=E==="list"&&p("div",{className:"flex flex-col gap-4",children:[p(je,{"data-testid":"sc-shard-section",size:"sm",children:[p(Be,{children:[p("div",{className:"flex items-center gap-2",children:[l(Ke,{tier:"shard"}),l(Ge,{children:s("Shard tables")}),F!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),l(ze,{children:Pe.shard.hint})]}),p(De,{children:[g!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),F!==null&&F.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:s("No tables in this shard.")}),F!==null&&F.length>0&&i.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:s("No tables match your filter.")}),i.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(b=>{const ee=`${C}:${b.name}`,de=G[ee]??[];return p(Je,{expanded:o===b.name,name:b.name,onToggle:()=>{Ce(pe(b.name))},rowCount:b.rowCount,rowTestId:`sc-table-${b.name}`,toggleTestId:`sc-toggle-${b.name}`,children:[l(We,{columns:d[ee]??He,testId:`sc-columns-${b.name}`}),de.length>0&&l(It,{heading:s("Indexes"),indexes:de,testId:`sc-indexes-${b.name}`})]},b.name)})})]})]}),p(je,{"data-testid":"sc-global-section",size:"sm",children:[p(Be,{children:[p("div",{className:"flex items-center gap-2",children:[l(Ke,{tier:"global"}),l(Ge,{children:s("Global tables (D1)")}),S!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:u.length})]}),l(ze,{children:Pe.global.hint})]}),p(De,{children:[f!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:f}),S!==null&&S.length===0&&l(et,{description:Pe.global.hint,testId:"sc-global-empty",title:s("No global tables.")}),S!==null&&S.length>0&&u.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:s("No tables match your filter.")}),u.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:u.map(b=>l(Je,{expanded:O===b.name,name:b.name,onToggle:()=>{Ce(te(b.name))},rowCount:b.rowCount,rowTestId:`sc-global-table-${b.name}`,toggleTestId:`sc-global-toggle-${b.name}`,children:l(We,{columns:v[b.name]??He,testId:`sc-global-columns-${b.name}`})},b.name))})]})]})]}),e[62]=d,e[63]=g,e[64]=o,e[65]=u,e[66]=i,e[67]=v,e[68]=f,e[69]=O,e[70]=S,e[71]=G,e[72]=C,e[73]=s,e[74]=F,e[75]=pe,e[76]=te,e[77]=E,e[78]=P):P=e[78];let Z;return e[79]!==ie||e[80]!==V||e[81]!==re||e[82]!==Y||e[83]!==P?(Z=p("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[ie,V,re,Y,P]}),e[79]=ie,e[80]=V,e[81]=re,e[82]=Y,e[83]=P,e[84]=Z):Z=e[84],Z};function kt(n){return l("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:n},n)}function At(n){return p("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[l("span",{className:"font-mono",children:n.name}),l(Fe,{variant:"outline",children:n.type}),n.unique===!0&&l(Fe,{variant:"secondary",children:"unique"}),l("span",{className:"text-muted-foreground",children:n.fields.join(", ")})]},`${n.type}:${n.name}`)}function $t(n){return n.name}export{Qt as SchemaViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u}from"react/compiler-runtime";import{u as h}from"../packem_shared/use-admin-query-
|
|
1
|
+
import{c as u}from"react/compiler-runtime";import{u as h}from"../packem_shared/use-admin-query-BW9IuacC.mjs";import{useT as m}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as p}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{A as f}from"../packem_shared/advisor-view-fNcNYW2Q.mjs";import{jsx as R}from"react/jsx-runtime";const k=(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],g=e=>Array.isArray(e.findings)?e.findings:[],S=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],A=(e,s)=>({"admin-token-weak":e("Your admin token is {length} characters — 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 — 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 — 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 — they need the admin token. Set it if subscribers should present a shared credential.")})[s.kind],T=()=>{const e=u(8),s=m();let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={},e[0]=t):t=e[0];const{data:i,error:o,errorSource:d}=h(p.getSecurityAudit,t);let a;if(e[1]!==i||e[2]!==s){const l=i===void 0?null:g(i);a=l===null?null:l.map(r=>({description:A(s,r),entity:S(r),issueType:k(s,r),key:r.kind,level:r.level})),e[1]=i,e[2]=s,e[3]=a}else a=e[3];const c=a;let n;return e[4]!==o||e[5]!==d||e[6]!==c?(n=R(f,{error:o,errorSource:d,rows:c,testId:"lunora-security-advisor"}),e[4]=o,e[5]=d,e[6]=c,e[7]=n):n=e[7],n};export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as G}from"react/compiler-runtime";import{E as X}from"../packem_shared/error-alert-
|
|
1
|
+
import{c as G}from"react/compiler-runtime";import{E as X}from"../packem_shared/error-alert-54TiaMvZ.mjs";import{B as Y}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as M,a as P}from"../packem_shared/card-By2O8ULa.mjs";import{T as Z,a as ee,b as J,c as Q,d as te,e as W}from"../packem_shared/table-D0SBiDu-.mjs";import{u as re}from"../packem_shared/use-admin-query-BW9IuacC.mjs";import{useT as se}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as le}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{C as ne}from"../packem_shared/cf-links-CBJ5SywP.mjs";import{r as ae,u as ie,s as oe}from"../packem_shared/shortcuts-B9gDaXmw.mjs";import{jsxs as d,jsx as r}from"react/jsx-runtime";const de={binding:"outline",secret:"destructive",var:"secondary"},ce=(s,e)=>{if(s===void 0)return[];const u=[];return s.workerUrl!==void 0&&u.push({label:e("URL"),value:s.workerUrl}),s.environment!==void 0&&u.push({label:e("Environment"),value:s.environment}),s.deploymentId!==void 0&&u.push({label:e("Deployment"),value:s.deploymentId}),s.versionTag!==void 0&&u.push({label:e("Version"),value:s.versionTag}),u},z=s=>{const e=G(18),{modifier:u,name:t,label:p}=s,F=ie();let b;e[0]!==t?(b=a=>{if(!["Escape","Tab"].includes(a.key)){if(a.shiftKey){a.preventDefault();return}a.preventDefault(),oe(t,a.key)}},e[0]=t,e[1]=b):b=e[1];const c=b,m=`set-shortcut-${t}`;let f;e[2]!==p?(f=r("dt",{className:"text-muted-foreground",children:p}),e[2]=p,e[3]=f):f=e[3];let h;e[4]!==u?(h=r("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:u}),e[4]=u,e[5]=h):h=e[5];const n=`set-shortcut-input-${t}`,x=F[t];let i;e[6]!==p||e[7]!==c||e[8]!==n||e[9]!==x?(i=r("input",{"aria-label":p,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":n,onKeyDown:c,readOnly:!0,value:x}),e[6]=p,e[7]=c,e[8]=n,e[9]=x,e[10]=i):i=e[10];let l;e[11]!==h||e[12]!==i?(l=d("dd",{className:"flex items-center gap-1.5",children:[h,i]}),e[11]=h,e[12]=i,e[13]=l):l=e[13];let o;return e[14]!==m||e[15]!==f||e[16]!==l?(o=d("div",{className:"contents","data-testid":m,children:[f,l]}),e[14]=m,e[15]=f,e[16]=l,e[17]=o):o=e[17],o},Ce=s=>{const e=G(85),{initialShardKey:u}=s,t=se();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];const F=u??"";let b;e[1]!==F?(b={shardKey:F},e[1]=F,e[2]=b):b=e[2];const{data:c,error:m,errorSource:f,isLoading:h}=re(le.getSettings,p,b);let n,x,i,l,o,a,g;if(e[3]!==m||e[4]!==f||e[5]!==c?.deploy||e[6]!==c?.settings||e[7]!==t){const q=ce(c?.deploy,t);let H;e[15]!==c?.settings?(H=c?.settings??[],e[15]=c?.settings,e[16]=H):H=e[16],n=H,x="flex flex-col gap-4",i="lunora-settings";let j;e[17]!==t?(j=t("Open in Cloudflare"),e[17]=t,e[18]=j):j=e[18],e[19]!==j?(l=r("div",{className:"flex flex-wrap items-center gap-3",children:r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:ne,rel:"noreferrer",target:"_blank",children:j})}),e[19]=j,e[20]=l):l=e[20];let B;e[21]!==t?(B=t("View-only — values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=t,e[22]=B):B=e[22],e[23]!==B?(o=r("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:B}),e[23]=B,e[24]=o):o=e[24],e[25]!==m||e[26]!==f?(a=m!==null&&r(X,{error:f,testId:"set-error"}),e[25]=m,e[26]=f,e[27]=a):a=e[27],g=q.length>0&&d(M,{className:"py-0","data-testid":"set-deploy",children:[r("header",{className:"border-b border-border px-4 py-3",children:r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")})}),r(P,{className:"py-3",children:r("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:q.map(me)})})]}),e[3]=m,e[4]=f,e[5]=c?.deploy,e[6]=c?.settings,e[7]=t,e[8]=n,e[9]=x,e[10]=i,e[11]=l,e[12]=o,e[13]=a,e[14]=g}else n=e[8],x=e[9],i=e[10],l=e[11],o=e[12],a=e[13],g=e[14];let N;e[28]!==t?(N=t("Keyboard shortcuts"),e[28]=t,e[29]=N):N=e[29];let v;e[30]!==N?(v=r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:N}),e[30]=N,e[31]=v):v=e[31];let y;e[32]!==t?(y=t("Reset"),e[32]=t,e[33]=y):y=e[33];let k;e[34]!==y?(k=r("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:ae,type:"button",children:y}),e[34]=y,e[35]=k):k=e[35];let w;e[36]!==v||e[37]!==k?(w=d("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[v,k]}),e[36]=v,e[37]=k,e[38]=w):w=e[38];let C;e[39]!==t?(C=t("Command palette"),e[39]=t,e[40]=C):C=e[40];let T;e[41]!==C?(T=r(z,{label:C,modifier:"⌘/Ctrl",name:"palette"}),e[41]=C,e[42]=T):T=e[42];let S;e[43]!==t?(S=t("Operation console"),e[43]=t,e[44]=S):S=e[44];let R;e[45]!==S?(R=r(z,{label:S,modifier:"Ctrl",name:"console"}),e[45]=S,e[46]=R):R=e[46];let _;e[47]!==T||e[48]!==R?(_=d("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[T,R]}),e[47]=T,e[48]=R,e[49]=_):_=e[49];let D;e[50]!==t?(D=t("Stored in this browser. Focus a box and press a key to rebind it."),e[50]=t,e[51]=D):D=e[51];let E;e[52]!==D?(E=r("p",{className:"pt-3 text-xs text-muted-foreground",children:D}),e[52]=D,e[53]=E):E=e[53];let I;e[54]!==_||e[55]!==E?(I=d(P,{className:"py-3",children:[_,E]}),e[54]=_,e[55]=E,e[56]=I):I=e[56];let K;e[57]!==w||e[58]!==I?(K=d(M,{className:"py-0","data-testid":"set-preferences",children:[w,I]}),e[57]=w,e[58]=I,e[59]=K):K=e[59];let A;e[60]!==t?(A=t("Environment & bindings"),e[60]=t,e[61]=A):A=e[61];let O;e[62]!==A?(O=r("header",{className:"border-b border-border px-4 py-3",children:r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A})}),e[62]=A,e[63]=O):O=e[63];let U;e[64]!==m||e[65]!==h||e[66]!==n.length||e[67]!==t?(U=m===null&&!h&&n.length===0&&r("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")}),e[64]=m,e[65]=h,e[66]=n.length,e[67]=t,e[68]=U):U=e[68];let L;e[69]!==n||e[70]!==t?(L=n.length>0&&r(P,{className:"px-0 py-0",children:d(Z,{"data-testid":"set-table",children:[r(ee,{children:d(J,{children:[r(Q,{children:t("name")}),r(Q,{children:t("kind")}),r(Q,{children:t("value")})]})}),r(te,{children:n.map(fe)})]})}),e[69]=n,e[70]=t,e[71]=L):L=e[71];let $;e[72]!==O||e[73]!==U||e[74]!==L?($=d(M,{className:"py-0",children:[O,U,L]}),e[72]=O,e[73]=U,e[74]=L,e[75]=$):$=e[75];let V;return e[76]!==K||e[77]!==$||e[78]!==x||e[79]!==i||e[80]!==l||e[81]!==o||e[82]!==a||e[83]!==g?(V=d("div",{className:x,"data-testid":i,children:[l,o,a,g,K,$]}),e[76]=K,e[77]=$,e[78]=x,e[79]=i,e[80]=l,e[81]=o,e[82]=a,e[83]=g,e[84]=V):V=e[84],V};function me(s){return d("div",{className:"contents","data-testid":"set-deploy-row",children:[r("dt",{className:"text-muted-foreground",children:s.label}),r("dd",{className:"truncate font-mono text-xs",title:s.value,children:s.value})]},s.label)}function fe(s){return d(J,{"data-testid":"set-row",children:[r(W,{className:"font-mono text-xs font-medium",children:s.name}),r(W,{children:r(Y,{variant:de[s.kind],children:s.bindingType??s.kind})}),r(W,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:s.value??r("span",{className:"text-muted-foreground",children:"—"})})]},s.name)}export{Ce as SettingsPanel};
|