@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 +1 @@
|
|
|
1
|
-
import{useLunora as K}from"@lunora/react";import{useState as S,useEffect as Me}from"react";import{B as q}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as R}from"../packem_shared/button-q0UYSmrn.mjs";import{C as X,a as ee}from"../packem_shared/card-By2O8ULa.mjs";import{E as Ye}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as B}from"../packem_shared/input-CXhxesPC.mjs";import{T as Ee,a as Re,b as Q,c as U,d as Te,e as P}from"../packem_shared/table-D0SBiDu-.mjs";import{a as qe}from"../packem_shared/use-admin-query-CLStXJ7v.mjs";import{c as Z}from"react/compiler-runtime";import{u as Qe}from"../packem_shared/use-auth-config-DtZeS_qf.mjs";import{useAutoRefresh as Ge}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs";import Je from"../packem_shared/useDebounced-DVeQ5-oW.mjs";import{useT as W}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{w as Ke,h as Fe,f as J,l as Pe,b as Ve}from"../packem_shared/internal-BXEjuLPN.mjs";import{A as Xe}from"../packem_shared/auth-pager-DiDnXsfe.mjs";import{jsxs as u,jsx as t,Fragment as et}from"react/jsx-runtime";import{C as tt}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{L as _}from"../packem_shared/label-DKFzyHq6.mjs";import{M as We}from"../packem_shared/modal-shell-CDztwLnv.mjs";import{u as st}from"../packem_shared/use-async-submit-2eBBD0-m.mjs";const nt=()=>{const h=Z(3),{config:e,ready:l}=Qe();let n;return h[0]!==e.capabilities||h[1]!==l?(n={capabilities:e.capabilities,ready:l},h[0]=e.capabilities,h[1]=l,h[2]=n):n=h[2],n},lt=(h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending",He=500,at=(h,e)=>{if(!URL.canParse(h.trim()))return null;const l=new URL(h.trim());return l.searchParams.set("email",e.email),l.searchParams.set("invite",e.token),l.toString()},it=h=>{const e=Z(34),{issued:l,onSignUpPageChange:n,signUpPage:o}=h,s=W(),[f,a]=S(null);let c;e[0]!==l||e[1]!==o?(c=at(o,l),e[0]=l,e[1]=o,e[2]=c):c=e[2];const d=c;let y;e[3]!==d?(y=()=>{const T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;d===null||T===void 0||J(T.writeText(d).then(()=>(a(d),!0)))},e[3]=d,e[4]=y):y=e[4];const C=y;let g;e[5]!==s?(g=s("Send this link to the invitee. It is shown once and cannot be recovered."),e[5]=s,e[6]=g):g=e[6];let w;e[7]!==g?(w=t("p",{className:"text-sm",children:g}),e[7]=g,e[8]=w):w=e[8];const k=d===null;let v;e[9]!==s?(v=s("Your app's sign-up page"),e[9]=s,e[10]=v):v=e[10];let r;e[11]!==n?(r=T=>{n(T.target.value)},e[11]=n,e[12]=r):r=e[12];let m;e[13]!==o||e[14]!==k||e[15]!==v||e[16]!==r?(m=t(B,{"aria-invalid":k,"aria-label":v,"data-testid":"sign-up-invitation-page",onChange:r,value:o}),e[13]=o,e[14]=k,e[15]=v,e[16]=r,e[17]=m):m=e[17];const b=d??"";let x;e[18]!==b?(x=t(B,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:b}),e[18]=b,e[19]=x):x=e[19];let N;e[20]!==f||e[21]!==d||e[22]!==s?(N=s(f!==null&&f===d?"Copied":"Copy"),e[20]=f,e[21]=d,e[22]=s,e[23]=N):N=e[23];let p;e[24]!==C||e[25]!==N?(p=t(R,{"data-testid":"sign-up-invitation-copy",onClick:C,type:"button",children:N}),e[24]=C,e[25]=N,e[26]=p):p=e[26];let i;e[27]!==x||e[28]!==p?(i=u("div",{className:"flex gap-2",children:[x,p]}),e[27]=x,e[28]=p,e[29]=i):i=e[29];let I;return e[30]!==i||e[31]!==w||e[32]!==m?(I=t(X,{children:u(ee,{className:"flex flex-col gap-2 p-4",children:[w,m,i]})}),e[30]=i,e[31]=w,e[32]=m,e[33]=I):I=e[33],I},rt=()=>{const h=K(),e=W(),[l,n]=S(""),[o,s]=S(null),[f,a]=S(null),[c,d]=S(()=>`${Ke(h.url)}/sign-up`),y=qe(["lunora-auth-sign-up-invitations",He],()=>h.listAuthSignUpInvitations({limit:He})),C=y.data?.rows??null,g=y.data?.total??0,w=()=>{const v=l.trim();v!==""&&(s(null),J((async()=>{try{const r=await h.createAuthSignUpInvitation({email:v}),m=typeof r.token=="string"?r.token:void 0;a(m===void 0?null:{email:v,token:m}),n(""),y.refetch()}catch(r){s(r instanceof Error?r.message:String(r))}})()))},k=v=>{s(null),J((async()=>{try{await h.revokeAuthSignUpInvitation({email:v}),y.refetch()}catch(r){s(r instanceof Error?r.message:String(r))}})())};return u("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[u("div",{children:[t("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),t("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed — send the invitee the one-time link yourself.")})]}),u("div",{className:"flex gap-2",children:[t(B,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:v=>{n(v.target.value)},placeholder:e("ada@example.com"),type:"email",value:l}),t(R,{"data-testid":"sign-up-invitation-submit",onClick:w,type:"button",children:e("Invite")})]}),f!==null&&t(it,{issued:f,onSignUpPageChange:d,signUpPage:c},f.token),(o??y.error)!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:o??y.error}),C!==null&&C.length===0&&t(Ye,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),C!==null&&g>C.length&&t("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),C!==null&&C.length>0&&t(X,{children:t(ee,{className:"p-0",children:u(Ee,{children:[t(Re,{children:u(Q,{children:[t(U,{children:e("Email")}),t(U,{children:e("Status")}),t(U,{children:e("Expires")}),t(U,{children:e("Invited by")}),t(U,{})]})}),t(Te,{children:C.map(v=>{const r=lt(v,Date.now()),m=v.email??"";return u(Q,{"data-testid":`sign-up-invitation-${m}`,children:[t(P,{children:m}),u(P,{"data-testid":`sign-up-invitation-status-${m}`,children:[r==="spent"&&e("Accepted"),r==="expired"&&e("Expired"),r==="pending"&&e("Pending")]}),t(P,{children:typeof v.expiresAt=="number"?Fe(v.expiresAt):"—"}),t(P,{children:v.invitedBy??"—"}),t(P,{className:"text-right",children:t(R,{onClick:()=>{k(m)},type:"button",variant:"ghost",children:e("Revoke")})})]},v.id)})})]})})})]})},ot={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},dt=(h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),ct=(h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;const l=typeof e=="string"?e.trim():"";if(l!==""){if(h.type==="number"){const n=Number(l);return Number.isNaN(n)?void 0:{value:n}}return{value:l}}},ut=h=>{const e=Z(105),{onClose:l,onCreated:n}=h,o=K(),s=W(),{config:f}=Qe(),{busy:a,error:c,run:d}=st(),[y,C]=S(""),[g,w]=S(""),[k,v]=S(""),[r,m]=S("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[x,N]=S(b);let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=A=>{C(A.target.value)},e[1]=p):p=e[1];const i=p;let I;e[2]===Symbol.for("react.memo_cache_sentinel")?(I=A=>{w(A.target.value)},e[2]=I):I=e[2];const T=I;let z;e[3]===Symbol.for("react.memo_cache_sentinel")?(z=A=>{v(A.target.value)},e[3]=z):z=e[3];const j=z;let M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M=A=>{m(A.target.value)},e[4]=M):M=e[4];const H=M;let L;e[5]===Symbol.for("react.memo_cache_sentinel")?(L=(A,D)=>{N(G=>({...G,[A]:D}))},e[5]=L):L=e[5];const V=L;let Y;e[6]!==x?(Y=A=>x[A.name]??(A.type==="boolean"?!1:""),e[6]=x,e[7]=Y):Y=e[7];const E=Y;let O;if(e[8]!==f.userFields||e[9]!==E){let A;e[11]!==E?(A=D=>!D.required||dt(D,E(D)),e[11]=E,e[12]=A):A=e[12],O=f.userFields.every(A),e[8]=f.userFields,e[9]=E,e[10]=O}else O=e[10];const F=O;let $;e[13]!==a||e[14]!==y||e[15]!==g||e[16]!==F?($=!a&&y.trim()!==""&&g.trim()!==""&&F,e[13]=a,e[14]=y,e[15]=g,e[16]=F,e[17]=$):$=e[17];const Ue=$;let te;e[18]!==f.userFields||e[19]!==E?(te=()=>{const A={};for(const D of f.userFields){const G=ct(D,E(D));G!==void 0&&(A[D.name]=G.value)}return Object.keys(A).length===0?void 0:A},e[18]=f.userFields,e[19]=E,e[20]=te):te=e[20];const Be=te;let De;e[21]!==Be||e[22]!==o||e[23]!==y||e[24]!==g||e[25]!==l||e[26]!==n||e[27]!==k||e[28]!==r||e[29]!==d?(De=()=>{d(async()=>{await o.createAuthUser({data:Be(),email:y.trim(),name:g.trim(),password:k===""?void 0:k,role:r.trim()===""?void 0:r.trim()}),n(),l()})},e[21]=Be,e[22]=o,e[23]=y,e[24]=g,e[25]=l,e[26]=n,e[27]=k,e[28]=r,e[29]=d,e[30]=De):De=e[30];const ze=De;let se;e[31]!==s?(se=s("Create user"),e[31]=s,e[32]=se):se=e[32];let ne;e[33]!==s?(ne=s("Create user"),e[33]=s,e[34]=ne):ne=e[34];let le;e[35]!==ne?(le=t("h2",{className:"text-sm font-semibold text-foreground",children:ne}),e[35]=ne,e[36]=le):le=e[36];let ae;e[37]!==s?(ae=s("email"),e[37]=s,e[38]=ae):ae=e[38];let ie;e[39]!==ae?(ie=t(_,{htmlFor:"uc-email",children:ae}),e[39]=ae,e[40]=ie):ie=e[40];let re;e[41]!==y?(re=t(B,{"data-testid":"uc-email",id:"uc-email",onChange:i,type:"email",value:y}),e[41]=y,e[42]=re):re=e[42];let oe;e[43]!==ie||e[44]!==re?(oe=u("div",{className:"flex flex-col gap-1",children:[ie,re]}),e[43]=ie,e[44]=re,e[45]=oe):oe=e[45];let de;e[46]!==s?(de=s("name"),e[46]=s,e[47]=de):de=e[47];let ce;e[48]!==de?(ce=t(_,{htmlFor:"uc-name",children:de}),e[48]=de,e[49]=ce):ce=e[49];let ue;e[50]!==g?(ue=t(B,{"data-testid":"uc-name",id:"uc-name",onChange:T,value:g}),e[50]=g,e[51]=ue):ue=e[51];let me;e[52]!==ce||e[53]!==ue?(me=u("div",{className:"flex flex-col gap-1",children:[ce,ue]}),e[52]=ce,e[53]=ue,e[54]=me):me=e[54];let he;e[55]!==s?(he=s("Password (optional)"),e[55]=s,e[56]=he):he=e[56];let fe;e[57]!==he?(fe=t(_,{htmlFor:"uc-password",children:he}),e[57]=he,e[58]=fe):fe=e[58];let pe;e[59]!==k?(pe=t(B,{"data-testid":"uc-password",id:"uc-password",onChange:j,type:"password",value:k}),e[59]=k,e[60]=pe):pe=e[60];let ve;e[61]!==fe||e[62]!==pe?(ve=u("div",{className:"flex flex-col gap-1",children:[fe,pe]}),e[61]=fe,e[62]=pe,e[63]=ve):ve=e[63];let ge;e[64]!==s?(ge=s("Role (optional)"),e[64]=s,e[65]=ge):ge=e[65];let be;e[66]!==ge?(be=t(_,{htmlFor:"uc-role",children:ge}),e[66]=ge,e[67]=be):be=e[67];let xe;e[68]!==r?(xe=t(B,{"data-testid":"uc-role",id:"uc-role",onChange:H,value:r}),e[68]=r,e[69]=xe):xe=e[69];let ye;e[70]!==be||e[71]!==xe?(ye=u("div",{className:"flex flex-col gap-1",children:[be,xe]}),e[70]=be,e[71]=xe,e[72]=ye):ye=e[72];let Ne;e[73]!==f.userFields||e[74]!==E||e[75]!==s?(Ne=f.userFields.length>0&&u("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")}),f.userFields.map(A=>{const D=`uc-field-${A.name}`,G=A.required?"":` (${s("optional")})`;if(A.type==="boolean"){const Oe=E(A)===!0;return u("label",{className:"flex items-center gap-2",htmlFor:D,children:[t(tt,{checked:Oe,"data-testid":D,id:D,onCheckedChange:Ze=>{V(A.name,Ze)}}),u("span",{className:"text-sm",children:[A.name,G]})]},A.name)}const je=E(A);return u("div",{className:"flex flex-col gap-1",children:[u(_,{htmlFor:D,children:[A.name,G]}),t(B,{"data-testid":D,id:D,onChange:Oe=>{V(A.name,Oe.target.value)},type:ot[A.type],value:typeof je=="string"?je:""})]},A.name)})]}),e[73]=f.userFields,e[74]=E,e[75]=s,e[76]=Ne):Ne=e[76];let ke;e[77]!==c?(ke=c!==null&&t("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:c}),e[77]=c,e[78]=ke):ke=e[78];let Ce;e[79]!==s?(Ce=s("Cancel"),e[79]=s,e[80]=Ce):Ce=e[80];let we;e[81]!==l||e[82]!==Ce?(we=t(R,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:Ce}),e[81]=l,e[82]=Ce,e[83]=we):we=e[83];const Le=!Ue;let Ae;e[84]!==a||e[85]!==s?(Ae=s(a?"Creating…":"Create"),e[84]=a,e[85]=s,e[86]=Ae):Ae=e[86];let Ie;e[87]!==ze||e[88]!==Le||e[89]!==Ae?(Ie=t(R,{"data-testid":"uc-submit",disabled:Le,onClick:ze,size:"sm",type:"button",children:Ae}),e[87]=ze,e[88]=Le,e[89]=Ae,e[90]=Ie):Ie=e[90];let Se;e[91]!==we||e[92]!==Ie?(Se=u("div",{className:"flex justify-end gap-2 pt-1",children:[we,Ie]}),e[91]=we,e[92]=Ie,e[93]=Se):Se=e[93];let $e;return e[94]!==l||e[95]!==se||e[96]!==le||e[97]!==oe||e[98]!==me||e[99]!==ve||e[100]!==ye||e[101]!==Ne||e[102]!==ke||e[103]!==Se?($e=u(We,{label:se,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[le,oe,me,ve,ye,Ne,ke,Se]}),e[94]=l,e[95]=se,e[96]=le,e[97]=oe,e[98]=me,e[99]=ve,e[100]=ye,e[101]=Ne,e[102]=ke,e[103]=Se,e[104]=$e):$e=e[104],$e},_e=h=>{const e=Z(2),{children:l}=h;let n;return e[0]!==l?(n=t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=n):n=e[1],n},mt=h=>{const e=Z(29),{busy:l,runAction:n,userId:o,version:s}=h,f=K(),a=W(),[c,d]=S(null),[y,C]=S(null);let g;e[0]!==f||e[1]!==o?(g=()=>{J((async()=>{C(null);try{const i=await f.listAuthSessions({limit:50,userId:o});d(i.rows)}catch(i){const I=i;d(null),C(Ve(I))}})())},e[0]=f,e[1]=o,e[2]=g):g=e[2];let w;e[3]!==f||e[4]!==o||e[5]!==s?(w=[f,o,s],e[3]=f,e[4]=o,e[5]=s,e[6]=w):w=e[6],Me(g,w);let k;e[7]!==f||e[8]!==n?(k=i=>{n(()=>f.revokeAuthSession({sessionId:i}))},e[7]=f,e[8]=n,e[9]=k):k=e[9];const v=k;let r;e[10]!==a?(r=a("Sessions"),e[10]=a,e[11]=r):r=e[11];let m;e[12]!==r?(m=t(_e,{children:r}),e[12]=r,e[13]=m):m=e[13];let b;e[14]!==y?(b=y!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:y}),e[14]=y,e[15]=b):b=e[15];let x;e[16]!==c||e[17]!==a?(x=c!==null&&c.length===0&&t("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:a("No active sessions.")}),e[16]=c,e[17]=a,e[18]=x):x=e[18];let N;e[19]!==l||e[20]!==v||e[21]!==c||e[22]!==a?(N=c!==null&&c.length>0&&t(X,{className:"overflow-hidden py-0",children:t(ee,{className:"px-0",children:u(Ee,{"data-testid":"ud-sessions-table",children:[t(Re,{children:u(Q,{children:[t(U,{children:a("expires")}),t(U,{children:a("ip")}),t(U,{children:a("user agent")}),t(U,{"aria-label":a("Actions")})]})}),t(Te,{children:c.map(i=>u(Q,{"data-testid":`ud-session-${i.id}`,children:[t(P,{className:"text-muted-foreground tabular-nums",children:Fe(i.expiresAt)}),t(P,{children:i.ipAddress??""}),t(P,{className:"max-w-40 truncate",children:i.userAgent??""}),t(P,{children:t(R,{"data-testid":`ud-revoke-${i.id}`,disabled:l,onClick:()=>{v(i.id)},size:"xs",type:"button",variant:"ghost",children:a("Revoke")})})]},i.id))})]})})}),e[19]=l,e[20]=v,e[21]=c,e[22]=a,e[23]=N):N=e[23];let p;return e[24]!==m||e[25]!==b||e[26]!==x||e[27]!==N?(p=u("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[m,b,x,N]}),e[24]=m,e[25]=b,e[26]=x,e[27]=N,e[28]=p):p=e[28],p},ht=h=>{const e=Z(30),{busy:l,runAction:n,userId:o,version:s}=h,f=K(),a=W(),[c,d]=S(null),[y,C]=S(null);let g;e[0]!==f||e[1]!==o?(g=()=>{J((async()=>{C(null);try{d(await f.listAuthAccounts({userId:o}))}catch(i){const I=i;d(null),C(Ve(I))}})())},e[0]=f,e[1]=o,e[2]=g):g=e[2];let w;e[3]!==f||e[4]!==o||e[5]!==s?(w=[f,o,s],e[3]=f,e[4]=o,e[5]=s,e[6]=w):w=e[6],Me(g,w);let k;e[7]!==f||e[8]!==n||e[9]!==o?(k=i=>{n(()=>f.unlinkAuthAccount({accountId:i,userId:o}))},e[7]=f,e[8]=n,e[9]=o,e[10]=k):k=e[10];const v=k;let r;e[11]!==a?(r=a("Linked accounts"),e[11]=a,e[12]=r):r=e[12];let m;e[13]!==r?(m=t(_e,{children:r}),e[13]=r,e[14]=m):m=e[14];let b;e[15]!==y?(b=y!==null&&t("p",{className:"text-sm text-destructive",role:"alert",children:y}),e[15]=y,e[16]=b):b=e[16];let x;e[17]!==c||e[18]!==a?(x=c!==null&&c.length===0&&t("p",{className:"text-sm text-muted-foreground",children:a("No linked accounts.")}),e[17]=c,e[18]=a,e[19]=x):x=e[19];let N;e[20]!==c||e[21]!==l||e[22]!==v||e[23]!==a?(N=c!==null&&c.length>0&&t(X,{className:"overflow-hidden py-0",children:t(ee,{className:"px-0",children:u(Ee,{"data-testid":"ud-accounts-table",children:[t(Re,{children:u(Q,{children:[t(U,{children:a("provider")}),t(U,{children:a("created")}),t(U,{"aria-label":a("Actions")})]})}),t(Te,{children:c.map(i=>{const I=Pe(i.id);return u(Q,{"data-testid":`ud-account-${I}`,children:[t(P,{children:Pe(i.providerId)}),t(P,{className:"text-muted-foreground tabular-nums",children:Fe(i.createdAt)}),t(P,{children:t(R,{"data-testid":`ud-unlink-${I}`,disabled:l,onClick:()=>{v(I)},size:"xs",type:"button",variant:"ghost",children:a("Unlink")})})]},I)})})]})})}),e[20]=c,e[21]=l,e[22]=v,e[23]=a,e[24]=N):N=e[24];let p;return e[25]!==m||e[26]!==b||e[27]!==x||e[28]!==N?(p=u("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[m,b,x,N]}),e[25]=m,e[26]=b,e[27]=x,e[28]=N,e[29]=p):p=e[29],p},ft=h=>{const e=Z(40),{busy:l,capabilities:n,runAction:o,userId:s,version:f}=h,a=K(),c=W(),[d,y]=S(null);let C;e[0]!==n.passkey||e[1]!==a||e[2]!==s?(C=()=>{n.passkey&&J((async()=>{try{y(await a.listAuthPasskeys({userId:s}))}catch{y(null)}})())},e[0]=n.passkey,e[1]=a,e[2]=s,e[3]=C):C=e[3];let g;e[4]!==n.passkey||e[5]!==a||e[6]!==s||e[7]!==f?(g=[n.passkey,a,s,f],e[4]=n.passkey,e[5]=a,e[6]=s,e[7]=f,e[8]=g):g=e[8],Me(C,g);let w;e[9]!==a||e[10]!==o||e[11]!==s?(w=()=>{o(()=>a.disableAuthTwoFactor({userId:s}))},e[9]=a,e[10]=o,e[11]=s,e[12]=w):w=e[12];const k=w;let v;e[13]!==a||e[14]!==o?(v=I=>{o(()=>a.deleteAuthPasskey({passkeyId:I}))},e[13]=a,e[14]=o,e[15]=v):v=e[15];const r=v;let m;e[16]!==c?(m=c("Security"),e[16]=c,e[17]=m):m=e[17];let b;e[18]!==m?(b=t(_e,{children:m}),e[18]=m,e[19]=b):b=e[19];let x;e[20]!==l||e[21]!==n.twoFactor||e[22]!==k||e[23]!==c?(x=n.twoFactor&&t(R,{"data-testid":"ud-disable-2fa",disabled:l,onClick:k,size:"sm",type:"button",variant:"outline",children:c("Disable two-factor")}),e[20]=l,e[21]=n.twoFactor,e[22]=k,e[23]=c,e[24]=x):x=e[24];let N;e[25]!==n.passkey||e[26]!==d||e[27]!==c?(N=n.passkey&&d!==null&&d.length===0&&t("p",{className:"text-sm text-muted-foreground",children:c("No passkeys.")}),e[25]=n.passkey,e[26]=d,e[27]=c,e[28]=N):N=e[28];let p;e[29]!==l||e[30]!==n.passkey||e[31]!==r||e[32]!==d||e[33]!==c?(p=n.passkey&&d!==null&&d.length>0&&t(X,{className:"overflow-hidden py-0",children:t(ee,{className:"px-0",children:u(Ee,{"data-testid":"ud-passkeys-table",children:[t(Re,{children:u(Q,{children:[t(U,{children:c("name")}),t(U,{children:c("created")}),t(U,{"aria-label":c("Actions")})]})}),t(Te,{children:d.map(I=>{const T=Pe(I.id);return u(Q,{"data-testid":`ud-passkey-${T}`,children:[t(P,{children:Pe(I.name)||T}),t(P,{className:"text-muted-foreground tabular-nums",children:Fe(I.createdAt)}),t(P,{children:t(R,{"data-testid":`ud-delete-passkey-${T}`,disabled:l,onClick:()=>{r(T)},size:"xs",type:"button",variant:"ghost",children:c("Delete")})})]},T)})})]})})}),e[29]=l,e[30]=n.passkey,e[31]=r,e[32]=d,e[33]=c,e[34]=p):p=e[34];let i;return e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==p?(i=u("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,x,N,p]}),e[35]=b,e[36]=x,e[37]=N,e[38]=p,e[39]=i):i=e[39],i},pt=/(?:at|expires)$/iu,vt=/^[1-9]\d*$/u,gt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),bt=h=>{const e=Z(51),{busy:l,onBan:n}=h,o=W(),[s,f]=S(""),[a,c]=S(""),[d,y]=S(!1);let C;e[0]!==a?(C=vt.test(a.trim())&&Number.isSafeInteger(Number(a.trim())*86400)?Number(a.trim()):void 0,e[0]=a,e[1]=C):C=e[1];const g=C,w=d||g!==void 0;let k;e[2]!==n||e[3]!==d||e[4]!==s||e[5]!==g?(k=()=>{n({expiresInSeconds:d||g===void 0?void 0:g*86400,reason:s.trim()===""?void 0:s.trim()})},e[2]=n,e[3]=d,e[4]=s,e[5]=g,e[6]=k):k=e[6];const v=k;let r;e[7]!==o?(r=o("Ban reason (optional)"),e[7]=o,e[8]=r):r=e[8];let m;e[9]!==r?(m=t(_,{htmlFor:"ud-ban-reason",children:r}),e[9]=r,e[10]=m):m=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=$=>{f($.target.value)},e[11]=b):b=e[11];let x;e[12]!==s?(x=t(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:b,value:s}),e[12]=s,e[13]=x):x=e[13];let N;e[14]!==m||e[15]!==x?(N=u("div",{className:"flex flex-1 flex-col gap-1",children:[m,x]}),e[14]=m,e[15]=x,e[16]=N):N=e[16];let p;e[17]!==o?(p=o("Days"),e[17]=o,e[18]=p):p=e[18];let i;e[19]!==p?(i=t(_,{htmlFor:"ud-ban-days",children:p}),e[19]=p,e[20]=i):i=e[20];let I;e[21]!==a||e[22]!==g?(I=a.trim()!==""&&g===void 0,e[21]=a,e[22]=g,e[23]=I):I=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=$=>{c($.target.value)},e[24]=T):T=e[24];let z;e[25]!==a||e[26]!==d||e[27]!==I?(z=t(B,{"aria-invalid":I,"data-testid":"ud-ban-days",disabled:d,id:"ud-ban-days",min:1,onChange:T,step:1,type:"number",value:a}),e[25]=a,e[26]=d,e[27]=I,e[28]=z):z=e[28];let j;e[29]!==z||e[30]!==i?(j=u("div",{className:"flex w-24 flex-col gap-1",children:[i,z]}),e[29]=z,e[30]=i,e[31]=j):j=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=$=>{y($.target.checked)},e[32]=M):M=e[32];let H;e[33]!==d?(H=t("input",{checked:d,className:"size-4 accent-destructive","data-testid":"ud-ban-permanent",id:"ud-ban-permanent",onChange:M,type:"checkbox"}),e[33]=d,e[34]=H):H=e[34];let L;e[35]!==o?(L=o("Permanent"),e[35]=o,e[36]=L):L=e[36];let V;e[37]!==H||e[38]!==L?(V=u(_,{className:"flex items-center gap-1.5 pb-2 text-xs font-normal",htmlFor:"ud-ban-permanent",children:[H,L]}),e[37]=H,e[38]=L,e[39]=V):V=e[39];const Y=l||!w;let E;e[40]!==o?(E=o("Ban user"),e[40]=o,e[41]=E):E=e[41];let O;e[42]!==v||e[43]!==Y||e[44]!==E?(O=t(R,{"data-testid":"ud-ban",disabled:Y,onClick:v,size:"sm",type:"button",variant:"destructive",children:E}),e[42]=v,e[43]=Y,e[44]=E,e[45]=O):O=e[45];let F;return e[46]!==j||e[47]!==V||e[48]!==O||e[49]!==N?(F=u("div",{className:"flex items-end gap-2",children:[N,j,V,O]}),e[46]=j,e[47]=V,e[48]=O,e[49]=N,e[50]=F):F=e[50],F},xt=(h,e)=>typeof e=="number"&&pt.test(h)?Fe(e):Pe(e),yt=({capabilities:h,onChanged:e,onClose:l,user:n})=>{const o=K(),s=W(),f=n.banned===!0,[a,c]=S(null),[d,y]=S(!1),[C,g]=S(0),[w,k]=S(typeof n.role=="string"?n.role:""),[v,r]=S(""),[m,b]=S(null),[x,N]=S(!1),p=(F,$)=>{J((async()=>{y(!0),c(null);try{const Ue=await F();$?.refresh!==!1&&(g(te=>te+1),e()),$?.onResult?.(Ue)}catch(Ue){c(Ve(Ue))}y(!1)})())},i=F=>{k(F.target.value)},I=F=>{r(F.target.value)},T=()=>{const F=w.trim();F!==""&&p(async()=>{await o.setAuthUserRole({role:F,userId:n.id})})},z=F=>{p(async()=>{await o.banAuthUser({...F,userId:n.id})})},j=()=>{p(async()=>{await o.unbanAuthUser({userId:n.id})})},M=()=>{p(async()=>{await o.setAuthUserPassword({newPassword:v,userId:n.id}),r("")})},H=()=>{p(()=>o.impersonateAuthUser({userId:n.id}),{onResult:F=>{b(F.token)},refresh:!1})},L=()=>{p(async()=>{await o.revokeAuthUserSessions({userId:n.id})})},V=()=>{p(async()=>{await o.removeAuthUser({userId:n.id}),l()})},Y=()=>{N(!0)},E=()=>{N(!1)},O=Object.entries(n).filter(([F])=>!gt.has(F));return u(We,{label:s("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[u("div",{className:"flex items-start justify-between gap-2",children:[u("div",{className:"flex flex-col gap-1",children:[t("h2",{className:"text-sm font-semibold text-foreground",children:n.name??n.email??n.id}),t("p",{className:"font-mono text-xs text-muted-foreground",children:n.id}),u("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof n.role=="string"&&n.role!==""&&t(q,{variant:"secondary",children:n.role}),f?t(q,{variant:"destructive",children:s("Banned")}):t(q,{variant:"outline",children:s("Active")}),n.emailVerified===!0?t(q,{variant:"secondary",children:s("verified")}):t(q,{variant:"outline",children:s("unverified")})]})]}),t(R,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:s("Close")})]}),a!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:a}),h.admin&&u(X,{className:"gap-0 py-0",children:[t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")})}),u(ee,{className:"flex flex-col gap-3 p-3",children:[u("div",{className:"flex items-end gap-2",children:[u("div",{className:"flex flex-1 flex-col gap-1",children:[t(_,{htmlFor:"ud-role",children:s("Role")}),t(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:i,value:w})]}),t(R,{"data-testid":"ud-set-role",disabled:d||w.trim()==="",onClick:T,size:"sm",type:"button",variant:"outline",children:s("Set role")})]}),f?t(R,{"data-testid":"ud-unban",disabled:d,onClick:j,size:"sm",type:"button",variant:"outline",children:s("Unban")}):t(bt,{busy:d,onBan:z}),u("div",{className:"flex items-end gap-2",children:[u("div",{className:"flex flex-1 flex-col gap-1",children:[t(_,{htmlFor:"ud-password",children:s("New password")}),t(B,{"data-testid":"ud-password",id:"ud-password",onChange:I,type:"password",value:v})]}),t(R,{"data-testid":"ud-set-password",disabled:d||v==="",onClick:M,size:"sm",type:"button",variant:"outline",children:s("Set password")})]}),u("div",{className:"flex flex-wrap gap-2",children:[t(R,{"data-testid":"ud-impersonate",disabled:d,onClick:H,size:"sm",type:"button",variant:"outline",children:s("Impersonate")}),t(R,{"data-testid":"ud-revoke-all",disabled:d,onClick:L,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")}),x?u(et,{children:[t(R,{"data-testid":"ud-delete-confirm",disabled:d,onClick:V,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")}),t(R,{"data-testid":"ud-delete-cancel",onClick:E,size:"sm",type:"button",variant:"ghost",children:s("Cancel")})]}):t(R,{"data-testid":"ud-delete",disabled:d,onClick:Y,size:"sm",type:"button",variant:"destructive",children:s("Delete user")})]}),m!==null&&u("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[t(_,{htmlFor:"ud-token",children:s("Impersonation token")}),t(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:m})]})]})]}),t(mt,{busy:d,runAction:p,userId:n.id,version:C}),h.accounts&&t(ht,{busy:d,runAction:p,userId:n.id,version:C}),(h.twoFactor||h.passkey)&&t(ft,{busy:d,capabilities:h,runAction:p,userId:n.id,version:C}),u("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")}),t("dl",{className:"flex flex-col",children:O.map(([F,$])=>u("div",{className:"flex flex-col border-t border-border py-1.5",children:[t("dt",{className:"text-xs font-semibold text-muted-foreground",children:F}),t("dd",{className:"m-0 font-mono text-xs break-words",children:xt(F,$)})]},F))})]})]})},Nt=50,jt=({pageSize:h=Nt}={})=>{const e=K(),l=W(),[n,o]=S(""),[s,f]=S(""),[a,c]=S(0),d=Je(n),[y,C]=S(null),[g,w]=S(!1),{capabilities:k}=nt(),v=d.trim(),r=s.trim(),m=qe(["lunora-auth-users",v,r,h,a],()=>e.listAuthUsers({filterField:r===""?void 0:"role",filterValue:r===""?void 0:r,limit:h,offset:a,search:v===""?void 0:v}).then(i=>({...i,offset:a})),{keepPreviousData:!0}),b=m.data?.rows??null,x=m.error,N=()=>{m.refetch()};Ge(()=>m.poll(),!0);const p=y===null?null:b?.find(i=>i.id===y)??null;return u("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[u("div",{className:"flex flex-wrap items-center gap-2",children:[t(B,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:i=>{o(i.target.value),c(0)},placeholder:l("Search by email or name…"),value:n}),t(B,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:i=>{f(i.target.value),c(0)},placeholder:l("Filter by role"),value:s}),t(R,{"data-testid":"us-new",onClick:()=>{w(!0)},size:"sm",type:"button",children:l("New user")})]}),x!==null&&t("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:x}),b!==null&&b.length===0&&t(Ye,{description:l("Users who sign up to your app will appear here."),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:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),b!==null&&b.length>0&&t(X,{className:"overflow-hidden py-0",children:t(ee,{className:"px-0",children:u(Ee,{"data-testid":"us-table",children:[t(Re,{children:u(Q,{children:[t(U,{children:l("id")}),t(U,{children:l("email")}),t(U,{children:l("name")}),t(U,{children:l("role")}),t(U,{children:l("status")}),t(U,{children:l("verified")}),t(U,{children:l("created")}),t(U,{"aria-label":l("Actions")})]})}),t(Te,{children:b.map(i=>u(Q,{"data-testid":`us-row-${i.id}`,children:[t(P,{className:"font-mono text-xs",children:i.id}),t(P,{children:i.email??""}),t(P,{children:i.name??""}),t(P,{children:typeof i.role=="string"&&i.role!==""?t(q,{variant:"secondary",children:i.role}):""}),t(P,{children:i.banned===!0?t(q,{variant:"destructive",children:l("Banned")}):t(q,{variant:"success",children:l("Active")})}),t(P,{children:i.emailVerified===!0?t(q,{variant:"success",children:l("yes")}):t(q,{variant:"outline",children:l("no")})}),t(P,{className:"text-muted-foreground tabular-nums",children:Fe(i.createdAt)}),t(P,{children:t(R,{"data-testid":`us-manage-${i.id}`,onClick:()=>{C(i.id)},size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},i.id))})]})})}),b!==null&&t(Xe,{count:b.length,offset:m.data?.offset??0,onOffsetChange:c,pageSize:h,prefix:"us",total:m.data?.total}),p!==null&&t(yt,{capabilities:k,onChanged:N,onClose:()=>{C(null)},user:p}),g&&t(ut,{onClose:()=>{w(!1)},onCreated:N}),k.inviteOnly&&t(rt,{})]})};export{jt as UsersPanel};
|
|
1
|
+
import{useState as I,useEffect as Me}from"react";import{B as q}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as R}from"../packem_shared/button-q0UYSmrn.mjs";import{C as K,a as X}from"../packem_shared/card-By2O8ULa.mjs";import{E as Ye}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as B}from"../packem_shared/input-CXhxesPC.mjs";import{T as Ee,a as Re,b as Q,c as U,d as Te,e as P}from"../packem_shared/table-D0SBiDu-.mjs";import{a as qe}from"../packem_shared/use-admin-query-BW9IuacC.mjs";import{c as Z}from"react/compiler-runtime";import{u as Qe}from"../packem_shared/use-auth-config-KO9tnI39.mjs";import{useAutoRefresh as Ge}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-CG7Q45ZS.mjs";import Je from"../packem_shared/useDebounced-DVeQ5-oW.mjs";import{u as ee}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as W}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{w as Ke,h as Fe,f as J,l as Pe,b as Ve}from"../packem_shared/internal-BXEjuLPN.mjs";import{A as Xe}from"../packem_shared/auth-pager-DW77WeZw.mjs";import{jsxs as u,jsx as t,Fragment as et}from"react/jsx-runtime";import{C as tt}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{L as _}from"../packem_shared/label-DKFzyHq6.mjs";import{M as We}from"../packem_shared/modal-shell-CDztwLnv.mjs";import{u as st}from"../packem_shared/use-async-submit-2eBBD0-m.mjs";const nt=()=>{const h=Z(3),{config:e,ready:l}=Qe();let n;return h[0]!==e.capabilities||h[1]!==l?(n={capabilities:e.capabilities,ready:l},h[0]=e.capabilities,h[1]=l,h[2]=n):n=h[2],n},lt=(h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending",He=500,at=(h,e)=>{if(!URL.canParse(h.trim()))return null;const l=new URL(h.trim());return l.searchParams.set("email",e.email),l.searchParams.set("invite",e.token),l.toString()},it=h=>{const e=Z(34),{issued:l,onSignUpPageChange:n,signUpPage:o}=h,s=W(),[f,a]=I(null);let c;e[0]!==l||e[1]!==o?(c=at(o,l),e[0]=l,e[1]=o,e[2]=c):c=e[2];const d=c;let y;e[3]!==d?(y=()=>{const T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;d===null||T===void 0||J(T.writeText(d).then(()=>(a(d),!0)))},e[3]=d,e[4]=y):y=e[4];const C=y;let g;e[5]!==s?(g=s("Send this link to the invitee. It is shown once and cannot be recovered."),e[5]=s,e[6]=g):g=e[6];let w;e[7]!==g?(w=t("p",{className:"text-sm",children:g}),e[7]=g,e[8]=w):w=e[8];const k=d===null;let v;e[9]!==s?(v=s("Your app's sign-up page"),e[9]=s,e[10]=v):v=e[10];let r;e[11]!==n?(r=T=>{n(T.target.value)},e[11]=n,e[12]=r):r=e[12];let m;e[13]!==o||e[14]!==k||e[15]!==v||e[16]!==r?(m=t(B,{"aria-invalid":k,"aria-label":v,"data-testid":"sign-up-invitation-page",onChange:r,value:o}),e[13]=o,e[14]=k,e[15]=v,e[16]=r,e[17]=m):m=e[17];const b=d??"";let x;e[18]!==b?(x=t(B,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:b}),e[18]=b,e[19]=x):x=e[19];let N;e[20]!==f||e[21]!==d||e[22]!==s?(N=s(f!==null&&f===d?"Copied":"Copy"),e[20]=f,e[21]=d,e[22]=s,e[23]=N):N=e[23];let p;e[24]!==C||e[25]!==N?(p=t(R,{"data-testid":"sign-up-invitation-copy",onClick:C,type:"button",children:N}),e[24]=C,e[25]=N,e[26]=p):p=e[26];let i;e[27]!==x||e[28]!==p?(i=u("div",{className:"flex gap-2",children:[x,p]}),e[27]=x,e[28]=p,e[29]=i):i=e[29];let S;return e[30]!==i||e[31]!==w||e[32]!==m?(S=t(K,{children:u(X,{className:"flex flex-col gap-2 p-4",children:[w,m,i]})}),e[30]=i,e[31]=w,e[32]=m,e[33]=S):S=e[33],S},rt=()=>{const h=ee(),e=W(),[l,n]=I(""),[o,s]=I(null),[f,a]=I(null),[c,d]=I(()=>`${Ke(h.url)}/sign-up`),y=qe(["lunora-auth-sign-up-invitations",He],()=>h.listAuthSignUpInvitations({limit:He})),C=y.data?.rows??null,g=y.data?.total??0,w=()=>{const v=l.trim();v!==""&&(s(null),J((async()=>{try{const r=await h.createAuthSignUpInvitation({email:v}),m=typeof r.token=="string"?r.token:void 0;a(m===void 0?null:{email:v,token:m}),n(""),y.refetch()}catch(r){s(r instanceof Error?r.message:String(r))}})()))},k=v=>{s(null),J((async()=>{try{await h.revokeAuthSignUpInvitation({email:v}),y.refetch()}catch(r){s(r instanceof Error?r.message:String(r))}})())};return u("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[u("div",{children:[t("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),t("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed — send the invitee the one-time link yourself.")})]}),u("div",{className:"flex gap-2",children:[t(B,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:v=>{n(v.target.value)},placeholder:e("ada@example.com"),type:"email",value:l}),t(R,{"data-testid":"sign-up-invitation-submit",onClick:w,type:"button",children:e("Invite")})]}),f!==null&&t(it,{issued:f,onSignUpPageChange:d,signUpPage:c},f.token),(o??y.error)!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:o??y.error}),C!==null&&C.length===0&&t(Ye,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),C!==null&&g>C.length&&t("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),C!==null&&C.length>0&&t(K,{children:t(X,{className:"p-0",children:u(Ee,{children:[t(Re,{children:u(Q,{children:[t(U,{children:e("Email")}),t(U,{children:e("Status")}),t(U,{children:e("Expires")}),t(U,{children:e("Invited by")}),t(U,{})]})}),t(Te,{children:C.map(v=>{const r=lt(v,Date.now()),m=v.email??"";return u(Q,{"data-testid":`sign-up-invitation-${m}`,children:[t(P,{children:m}),u(P,{"data-testid":`sign-up-invitation-status-${m}`,children:[r==="spent"&&e("Accepted"),r==="expired"&&e("Expired"),r==="pending"&&e("Pending")]}),t(P,{children:typeof v.expiresAt=="number"?Fe(v.expiresAt):"—"}),t(P,{children:v.invitedBy??"—"}),t(P,{className:"text-right",children:t(R,{onClick:()=>{k(m)},type:"button",variant:"ghost",children:e("Revoke")})})]},v.id)})})]})})})]})},ot={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},dt=(h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),ct=(h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;const l=typeof e=="string"?e.trim():"";if(l!==""){if(h.type==="number"){const n=Number(l);return Number.isNaN(n)?void 0:{value:n}}return{value:l}}},ut=h=>{const e=Z(105),{onClose:l,onCreated:n}=h,o=ee(),s=W(),{config:f}=Qe(),{busy:a,error:c,run:d}=st(),[y,C]=I(""),[g,w]=I(""),[k,v]=I(""),[r,m]=I("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const[x,N]=I(b);let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=A=>{C(A.target.value)},e[1]=p):p=e[1];const i=p;let S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=A=>{w(A.target.value)},e[2]=S):S=e[2];const T=S;let z;e[3]===Symbol.for("react.memo_cache_sentinel")?(z=A=>{v(A.target.value)},e[3]=z):z=e[3];const j=z;let M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M=A=>{m(A.target.value)},e[4]=M):M=e[4];const H=M;let L;e[5]===Symbol.for("react.memo_cache_sentinel")?(L=(A,D)=>{N(G=>({...G,[A]:D}))},e[5]=L):L=e[5];const V=L;let Y;e[6]!==x?(Y=A=>x[A.name]??(A.type==="boolean"?!1:""),e[6]=x,e[7]=Y):Y=e[7];const E=Y;let O;if(e[8]!==f.userFields||e[9]!==E){let A;e[11]!==E?(A=D=>!D.required||dt(D,E(D)),e[11]=E,e[12]=A):A=e[12],O=f.userFields.every(A),e[8]=f.userFields,e[9]=E,e[10]=O}else O=e[10];const F=O;let $;e[13]!==a||e[14]!==y||e[15]!==g||e[16]!==F?($=!a&&y.trim()!==""&&g.trim()!==""&&F,e[13]=a,e[14]=y,e[15]=g,e[16]=F,e[17]=$):$=e[17];const Ue=$;let te;e[18]!==f.userFields||e[19]!==E?(te=()=>{const A={};for(const D of f.userFields){const G=ct(D,E(D));G!==void 0&&(A[D.name]=G.value)}return Object.keys(A).length===0?void 0:A},e[18]=f.userFields,e[19]=E,e[20]=te):te=e[20];const Be=te;let De;e[21]!==Be||e[22]!==o||e[23]!==y||e[24]!==g||e[25]!==l||e[26]!==n||e[27]!==k||e[28]!==r||e[29]!==d?(De=()=>{d(async()=>{await o.createAuthUser({data:Be(),email:y.trim(),name:g.trim(),password:k===""?void 0:k,role:r.trim()===""?void 0:r.trim()}),n(),l()})},e[21]=Be,e[22]=o,e[23]=y,e[24]=g,e[25]=l,e[26]=n,e[27]=k,e[28]=r,e[29]=d,e[30]=De):De=e[30];const ze=De;let se;e[31]!==s?(se=s("Create user"),e[31]=s,e[32]=se):se=e[32];let ne;e[33]!==s?(ne=s("Create user"),e[33]=s,e[34]=ne):ne=e[34];let le;e[35]!==ne?(le=t("h2",{className:"text-sm font-semibold text-foreground",children:ne}),e[35]=ne,e[36]=le):le=e[36];let ae;e[37]!==s?(ae=s("email"),e[37]=s,e[38]=ae):ae=e[38];let ie;e[39]!==ae?(ie=t(_,{htmlFor:"uc-email",children:ae}),e[39]=ae,e[40]=ie):ie=e[40];let re;e[41]!==y?(re=t(B,{"data-testid":"uc-email",id:"uc-email",onChange:i,type:"email",value:y}),e[41]=y,e[42]=re):re=e[42];let oe;e[43]!==ie||e[44]!==re?(oe=u("div",{className:"flex flex-col gap-1",children:[ie,re]}),e[43]=ie,e[44]=re,e[45]=oe):oe=e[45];let de;e[46]!==s?(de=s("name"),e[46]=s,e[47]=de):de=e[47];let ce;e[48]!==de?(ce=t(_,{htmlFor:"uc-name",children:de}),e[48]=de,e[49]=ce):ce=e[49];let ue;e[50]!==g?(ue=t(B,{"data-testid":"uc-name",id:"uc-name",onChange:T,value:g}),e[50]=g,e[51]=ue):ue=e[51];let me;e[52]!==ce||e[53]!==ue?(me=u("div",{className:"flex flex-col gap-1",children:[ce,ue]}),e[52]=ce,e[53]=ue,e[54]=me):me=e[54];let he;e[55]!==s?(he=s("Password (optional)"),e[55]=s,e[56]=he):he=e[56];let fe;e[57]!==he?(fe=t(_,{htmlFor:"uc-password",children:he}),e[57]=he,e[58]=fe):fe=e[58];let pe;e[59]!==k?(pe=t(B,{"data-testid":"uc-password",id:"uc-password",onChange:j,type:"password",value:k}),e[59]=k,e[60]=pe):pe=e[60];let ve;e[61]!==fe||e[62]!==pe?(ve=u("div",{className:"flex flex-col gap-1",children:[fe,pe]}),e[61]=fe,e[62]=pe,e[63]=ve):ve=e[63];let ge;e[64]!==s?(ge=s("Role (optional)"),e[64]=s,e[65]=ge):ge=e[65];let be;e[66]!==ge?(be=t(_,{htmlFor:"uc-role",children:ge}),e[66]=ge,e[67]=be):be=e[67];let xe;e[68]!==r?(xe=t(B,{"data-testid":"uc-role",id:"uc-role",onChange:H,value:r}),e[68]=r,e[69]=xe):xe=e[69];let ye;e[70]!==be||e[71]!==xe?(ye=u("div",{className:"flex flex-col gap-1",children:[be,xe]}),e[70]=be,e[71]=xe,e[72]=ye):ye=e[72];let Ne;e[73]!==f.userFields||e[74]!==E||e[75]!==s?(Ne=f.userFields.length>0&&u("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Plugin fields")}),f.userFields.map(A=>{const D=`uc-field-${A.name}`,G=A.required?"":` (${s("optional")})`;if(A.type==="boolean"){const Oe=E(A)===!0;return u("label",{className:"flex items-center gap-2",htmlFor:D,children:[t(tt,{checked:Oe,"data-testid":D,id:D,onCheckedChange:Ze=>{V(A.name,Ze)}}),u("span",{className:"text-sm",children:[A.name,G]})]},A.name)}const je=E(A);return u("div",{className:"flex flex-col gap-1",children:[u(_,{htmlFor:D,children:[A.name,G]}),t(B,{"data-testid":D,id:D,onChange:Oe=>{V(A.name,Oe.target.value)},type:ot[A.type],value:typeof je=="string"?je:""})]},A.name)})]}),e[73]=f.userFields,e[74]=E,e[75]=s,e[76]=Ne):Ne=e[76];let ke;e[77]!==c?(ke=c!==null&&t("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:c}),e[77]=c,e[78]=ke):ke=e[78];let Ce;e[79]!==s?(Ce=s("Cancel"),e[79]=s,e[80]=Ce):Ce=e[80];let we;e[81]!==l||e[82]!==Ce?(we=t(R,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:Ce}),e[81]=l,e[82]=Ce,e[83]=we):we=e[83];const Le=!Ue;let Ae;e[84]!==a||e[85]!==s?(Ae=s(a?"Creating…":"Create"),e[84]=a,e[85]=s,e[86]=Ae):Ae=e[86];let Se;e[87]!==ze||e[88]!==Le||e[89]!==Ae?(Se=t(R,{"data-testid":"uc-submit",disabled:Le,onClick:ze,size:"sm",type:"button",children:Ae}),e[87]=ze,e[88]=Le,e[89]=Ae,e[90]=Se):Se=e[90];let Ie;e[91]!==we||e[92]!==Se?(Ie=u("div",{className:"flex justify-end gap-2 pt-1",children:[we,Se]}),e[91]=we,e[92]=Se,e[93]=Ie):Ie=e[93];let $e;return e[94]!==l||e[95]!==se||e[96]!==le||e[97]!==oe||e[98]!==me||e[99]!==ve||e[100]!==ye||e[101]!==Ne||e[102]!==ke||e[103]!==Ie?($e=u(We,{label:se,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[le,oe,me,ve,ye,Ne,ke,Ie]}),e[94]=l,e[95]=se,e[96]=le,e[97]=oe,e[98]=me,e[99]=ve,e[100]=ye,e[101]=Ne,e[102]=ke,e[103]=Ie,e[104]=$e):$e=e[104],$e},_e=h=>{const e=Z(2),{children:l}=h;let n;return e[0]!==l?(n=t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=n):n=e[1],n},mt=h=>{const e=Z(29),{busy:l,runAction:n,userId:o,version:s}=h,f=ee(),a=W(),[c,d]=I(null),[y,C]=I(null);let g;e[0]!==f||e[1]!==o?(g=()=>{J((async()=>{C(null);try{const i=await f.listAuthSessions({limit:50,userId:o});d(i.rows)}catch(i){const S=i;d(null),C(Ve(S))}})())},e[0]=f,e[1]=o,e[2]=g):g=e[2];let w;e[3]!==f||e[4]!==o||e[5]!==s?(w=[f,o,s],e[3]=f,e[4]=o,e[5]=s,e[6]=w):w=e[6],Me(g,w);let k;e[7]!==f||e[8]!==n?(k=i=>{n(()=>f.revokeAuthSession({sessionId:i}))},e[7]=f,e[8]=n,e[9]=k):k=e[9];const v=k;let r;e[10]!==a?(r=a("Sessions"),e[10]=a,e[11]=r):r=e[11];let m;e[12]!==r?(m=t(_e,{children:r}),e[12]=r,e[13]=m):m=e[13];let b;e[14]!==y?(b=y!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:y}),e[14]=y,e[15]=b):b=e[15];let x;e[16]!==c||e[17]!==a?(x=c!==null&&c.length===0&&t("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:a("No active sessions.")}),e[16]=c,e[17]=a,e[18]=x):x=e[18];let N;e[19]!==l||e[20]!==v||e[21]!==c||e[22]!==a?(N=c!==null&&c.length>0&&t(K,{className:"overflow-hidden py-0",children:t(X,{className:"px-0",children:u(Ee,{"data-testid":"ud-sessions-table",children:[t(Re,{children:u(Q,{children:[t(U,{children:a("expires")}),t(U,{children:a("ip")}),t(U,{children:a("user agent")}),t(U,{"aria-label":a("Actions")})]})}),t(Te,{children:c.map(i=>u(Q,{"data-testid":`ud-session-${i.id}`,children:[t(P,{className:"text-muted-foreground tabular-nums",children:Fe(i.expiresAt)}),t(P,{children:i.ipAddress??""}),t(P,{className:"max-w-40 truncate",children:i.userAgent??""}),t(P,{children:t(R,{"data-testid":`ud-revoke-${i.id}`,disabled:l,onClick:()=>{v(i.id)},size:"xs",type:"button",variant:"ghost",children:a("Revoke")})})]},i.id))})]})})}),e[19]=l,e[20]=v,e[21]=c,e[22]=a,e[23]=N):N=e[23];let p;return e[24]!==m||e[25]!==b||e[26]!==x||e[27]!==N?(p=u("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[m,b,x,N]}),e[24]=m,e[25]=b,e[26]=x,e[27]=N,e[28]=p):p=e[28],p},ht=h=>{const e=Z(30),{busy:l,runAction:n,userId:o,version:s}=h,f=ee(),a=W(),[c,d]=I(null),[y,C]=I(null);let g;e[0]!==f||e[1]!==o?(g=()=>{J((async()=>{C(null);try{d(await f.listAuthAccounts({userId:o}))}catch(i){const S=i;d(null),C(Ve(S))}})())},e[0]=f,e[1]=o,e[2]=g):g=e[2];let w;e[3]!==f||e[4]!==o||e[5]!==s?(w=[f,o,s],e[3]=f,e[4]=o,e[5]=s,e[6]=w):w=e[6],Me(g,w);let k;e[7]!==f||e[8]!==n||e[9]!==o?(k=i=>{n(()=>f.unlinkAuthAccount({accountId:i,userId:o}))},e[7]=f,e[8]=n,e[9]=o,e[10]=k):k=e[10];const v=k;let r;e[11]!==a?(r=a("Linked accounts"),e[11]=a,e[12]=r):r=e[12];let m;e[13]!==r?(m=t(_e,{children:r}),e[13]=r,e[14]=m):m=e[14];let b;e[15]!==y?(b=y!==null&&t("p",{className:"text-sm text-destructive",role:"alert",children:y}),e[15]=y,e[16]=b):b=e[16];let x;e[17]!==c||e[18]!==a?(x=c!==null&&c.length===0&&t("p",{className:"text-sm text-muted-foreground",children:a("No linked accounts.")}),e[17]=c,e[18]=a,e[19]=x):x=e[19];let N;e[20]!==c||e[21]!==l||e[22]!==v||e[23]!==a?(N=c!==null&&c.length>0&&t(K,{className:"overflow-hidden py-0",children:t(X,{className:"px-0",children:u(Ee,{"data-testid":"ud-accounts-table",children:[t(Re,{children:u(Q,{children:[t(U,{children:a("provider")}),t(U,{children:a("created")}),t(U,{"aria-label":a("Actions")})]})}),t(Te,{children:c.map(i=>{const S=Pe(i.id);return u(Q,{"data-testid":`ud-account-${S}`,children:[t(P,{children:Pe(i.providerId)}),t(P,{className:"text-muted-foreground tabular-nums",children:Fe(i.createdAt)}),t(P,{children:t(R,{"data-testid":`ud-unlink-${S}`,disabled:l,onClick:()=>{v(S)},size:"xs",type:"button",variant:"ghost",children:a("Unlink")})})]},S)})})]})})}),e[20]=c,e[21]=l,e[22]=v,e[23]=a,e[24]=N):N=e[24];let p;return e[25]!==m||e[26]!==b||e[27]!==x||e[28]!==N?(p=u("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[m,b,x,N]}),e[25]=m,e[26]=b,e[27]=x,e[28]=N,e[29]=p):p=e[29],p},ft=h=>{const e=Z(40),{busy:l,capabilities:n,runAction:o,userId:s,version:f}=h,a=ee(),c=W(),[d,y]=I(null);let C;e[0]!==n.passkey||e[1]!==a||e[2]!==s?(C=()=>{n.passkey&&J((async()=>{try{y(await a.listAuthPasskeys({userId:s}))}catch{y(null)}})())},e[0]=n.passkey,e[1]=a,e[2]=s,e[3]=C):C=e[3];let g;e[4]!==n.passkey||e[5]!==a||e[6]!==s||e[7]!==f?(g=[n.passkey,a,s,f],e[4]=n.passkey,e[5]=a,e[6]=s,e[7]=f,e[8]=g):g=e[8],Me(C,g);let w;e[9]!==a||e[10]!==o||e[11]!==s?(w=()=>{o(()=>a.disableAuthTwoFactor({userId:s}))},e[9]=a,e[10]=o,e[11]=s,e[12]=w):w=e[12];const k=w;let v;e[13]!==a||e[14]!==o?(v=S=>{o(()=>a.deleteAuthPasskey({passkeyId:S}))},e[13]=a,e[14]=o,e[15]=v):v=e[15];const r=v;let m;e[16]!==c?(m=c("Security"),e[16]=c,e[17]=m):m=e[17];let b;e[18]!==m?(b=t(_e,{children:m}),e[18]=m,e[19]=b):b=e[19];let x;e[20]!==l||e[21]!==n.twoFactor||e[22]!==k||e[23]!==c?(x=n.twoFactor&&t(R,{"data-testid":"ud-disable-2fa",disabled:l,onClick:k,size:"sm",type:"button",variant:"outline",children:c("Disable two-factor")}),e[20]=l,e[21]=n.twoFactor,e[22]=k,e[23]=c,e[24]=x):x=e[24];let N;e[25]!==n.passkey||e[26]!==d||e[27]!==c?(N=n.passkey&&d!==null&&d.length===0&&t("p",{className:"text-sm text-muted-foreground",children:c("No passkeys.")}),e[25]=n.passkey,e[26]=d,e[27]=c,e[28]=N):N=e[28];let p;e[29]!==l||e[30]!==n.passkey||e[31]!==r||e[32]!==d||e[33]!==c?(p=n.passkey&&d!==null&&d.length>0&&t(K,{className:"overflow-hidden py-0",children:t(X,{className:"px-0",children:u(Ee,{"data-testid":"ud-passkeys-table",children:[t(Re,{children:u(Q,{children:[t(U,{children:c("name")}),t(U,{children:c("created")}),t(U,{"aria-label":c("Actions")})]})}),t(Te,{children:d.map(S=>{const T=Pe(S.id);return u(Q,{"data-testid":`ud-passkey-${T}`,children:[t(P,{children:Pe(S.name)||T}),t(P,{className:"text-muted-foreground tabular-nums",children:Fe(S.createdAt)}),t(P,{children:t(R,{"data-testid":`ud-delete-passkey-${T}`,disabled:l,onClick:()=>{r(T)},size:"xs",type:"button",variant:"ghost",children:c("Delete")})})]},T)})})]})})}),e[29]=l,e[30]=n.passkey,e[31]=r,e[32]=d,e[33]=c,e[34]=p):p=e[34];let i;return e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==p?(i=u("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,x,N,p]}),e[35]=b,e[36]=x,e[37]=N,e[38]=p,e[39]=i):i=e[39],i},pt=/(?:at|expires)$/iu,vt=/^[1-9]\d*$/u,gt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),bt=h=>{const e=Z(51),{busy:l,onBan:n}=h,o=W(),[s,f]=I(""),[a,c]=I(""),[d,y]=I(!1);let C;e[0]!==a?(C=vt.test(a.trim())&&Number.isSafeInteger(Number(a.trim())*86400)?Number(a.trim()):void 0,e[0]=a,e[1]=C):C=e[1];const g=C,w=d||g!==void 0;let k;e[2]!==n||e[3]!==d||e[4]!==s||e[5]!==g?(k=()=>{n({expiresInSeconds:d||g===void 0?void 0:g*86400,reason:s.trim()===""?void 0:s.trim()})},e[2]=n,e[3]=d,e[4]=s,e[5]=g,e[6]=k):k=e[6];const v=k;let r;e[7]!==o?(r=o("Ban reason (optional)"),e[7]=o,e[8]=r):r=e[8];let m;e[9]!==r?(m=t(_,{htmlFor:"ud-ban-reason",children:r}),e[9]=r,e[10]=m):m=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=$=>{f($.target.value)},e[11]=b):b=e[11];let x;e[12]!==s?(x=t(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:b,value:s}),e[12]=s,e[13]=x):x=e[13];let N;e[14]!==m||e[15]!==x?(N=u("div",{className:"flex flex-1 flex-col gap-1",children:[m,x]}),e[14]=m,e[15]=x,e[16]=N):N=e[16];let p;e[17]!==o?(p=o("Days"),e[17]=o,e[18]=p):p=e[18];let i;e[19]!==p?(i=t(_,{htmlFor:"ud-ban-days",children:p}),e[19]=p,e[20]=i):i=e[20];let S;e[21]!==a||e[22]!==g?(S=a.trim()!==""&&g===void 0,e[21]=a,e[22]=g,e[23]=S):S=e[23];let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=$=>{c($.target.value)},e[24]=T):T=e[24];let z;e[25]!==a||e[26]!==d||e[27]!==S?(z=t(B,{"aria-invalid":S,"data-testid":"ud-ban-days",disabled:d,id:"ud-ban-days",min:1,onChange:T,step:1,type:"number",value:a}),e[25]=a,e[26]=d,e[27]=S,e[28]=z):z=e[28];let j;e[29]!==z||e[30]!==i?(j=u("div",{className:"flex w-24 flex-col gap-1",children:[i,z]}),e[29]=z,e[30]=i,e[31]=j):j=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=$=>{y($.target.checked)},e[32]=M):M=e[32];let H;e[33]!==d?(H=t("input",{checked:d,className:"size-4 accent-destructive","data-testid":"ud-ban-permanent",id:"ud-ban-permanent",onChange:M,type:"checkbox"}),e[33]=d,e[34]=H):H=e[34];let L;e[35]!==o?(L=o("Permanent"),e[35]=o,e[36]=L):L=e[36];let V;e[37]!==H||e[38]!==L?(V=u(_,{className:"flex items-center gap-1.5 pb-2 text-xs font-normal",htmlFor:"ud-ban-permanent",children:[H,L]}),e[37]=H,e[38]=L,e[39]=V):V=e[39];const Y=l||!w;let E;e[40]!==o?(E=o("Ban user"),e[40]=o,e[41]=E):E=e[41];let O;e[42]!==v||e[43]!==Y||e[44]!==E?(O=t(R,{"data-testid":"ud-ban",disabled:Y,onClick:v,size:"sm",type:"button",variant:"destructive",children:E}),e[42]=v,e[43]=Y,e[44]=E,e[45]=O):O=e[45];let F;return e[46]!==j||e[47]!==V||e[48]!==O||e[49]!==N?(F=u("div",{className:"flex items-end gap-2",children:[N,j,V,O]}),e[46]=j,e[47]=V,e[48]=O,e[49]=N,e[50]=F):F=e[50],F},xt=(h,e)=>typeof e=="number"&&pt.test(h)?Fe(e):Pe(e),yt=({capabilities:h,onChanged:e,onClose:l,user:n})=>{const o=ee(),s=W(),f=n.banned===!0,[a,c]=I(null),[d,y]=I(!1),[C,g]=I(0),[w,k]=I(typeof n.role=="string"?n.role:""),[v,r]=I(""),[m,b]=I(null),[x,N]=I(!1),p=(F,$)=>{J((async()=>{y(!0),c(null);try{const Ue=await F();$?.refresh!==!1&&(g(te=>te+1),e()),$?.onResult?.(Ue)}catch(Ue){c(Ve(Ue))}y(!1)})())},i=F=>{k(F.target.value)},S=F=>{r(F.target.value)},T=()=>{const F=w.trim();F!==""&&p(async()=>{await o.setAuthUserRole({role:F,userId:n.id})})},z=F=>{p(async()=>{await o.banAuthUser({...F,userId:n.id})})},j=()=>{p(async()=>{await o.unbanAuthUser({userId:n.id})})},M=()=>{p(async()=>{await o.setAuthUserPassword({newPassword:v,userId:n.id}),r("")})},H=()=>{p(()=>o.impersonateAuthUser({userId:n.id}),{onResult:F=>{b(F.token)},refresh:!1})},L=()=>{p(async()=>{await o.revokeAuthUserSessions({userId:n.id})})},V=()=>{p(async()=>{await o.removeAuthUser({userId:n.id}),l()})},Y=()=>{N(!0)},E=()=>{N(!1)},O=Object.entries(n).filter(([F])=>!gt.has(F));return u(We,{label:s("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[u("div",{className:"flex items-start justify-between gap-2",children:[u("div",{className:"flex flex-col gap-1",children:[t("h2",{className:"text-sm font-semibold text-foreground",children:n.name??n.email??n.id}),t("p",{className:"font-mono text-xs text-muted-foreground",children:n.id}),u("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof n.role=="string"&&n.role!==""&&t(q,{variant:"secondary",children:n.role}),f?t(q,{variant:"destructive",children:s("Banned")}):t(q,{variant:"outline",children:s("Active")}),n.emailVerified===!0?t(q,{variant:"secondary",children:s("verified")}):t(q,{variant:"outline",children:s("unverified")})]})]}),t(R,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:s("Close")})]}),a!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:a}),h.admin&&u(K,{className:"gap-0 py-0",children:[t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Actions")})}),u(X,{className:"flex flex-col gap-3 p-3",children:[u("div",{className:"flex items-end gap-2",children:[u("div",{className:"flex flex-1 flex-col gap-1",children:[t(_,{htmlFor:"ud-role",children:s("Role")}),t(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:i,value:w})]}),t(R,{"data-testid":"ud-set-role",disabled:d||w.trim()==="",onClick:T,size:"sm",type:"button",variant:"outline",children:s("Set role")})]}),f?t(R,{"data-testid":"ud-unban",disabled:d,onClick:j,size:"sm",type:"button",variant:"outline",children:s("Unban")}):t(bt,{busy:d,onBan:z}),u("div",{className:"flex items-end gap-2",children:[u("div",{className:"flex flex-1 flex-col gap-1",children:[t(_,{htmlFor:"ud-password",children:s("New password")}),t(B,{"data-testid":"ud-password",id:"ud-password",onChange:S,type:"password",value:v})]}),t(R,{"data-testid":"ud-set-password",disabled:d||v==="",onClick:M,size:"sm",type:"button",variant:"outline",children:s("Set password")})]}),u("div",{className:"flex flex-wrap gap-2",children:[t(R,{"data-testid":"ud-impersonate",disabled:d,onClick:H,size:"sm",type:"button",variant:"outline",children:s("Impersonate")}),t(R,{"data-testid":"ud-revoke-all",disabled:d,onClick:L,size:"sm",type:"button",variant:"outline",children:s("Revoke all sessions")}),x?u(et,{children:[t(R,{"data-testid":"ud-delete-confirm",disabled:d,onClick:V,size:"sm",type:"button",variant:"destructive",children:s("Confirm delete")}),t(R,{"data-testid":"ud-delete-cancel",onClick:E,size:"sm",type:"button",variant:"ghost",children:s("Cancel")})]}):t(R,{"data-testid":"ud-delete",disabled:d,onClick:Y,size:"sm",type:"button",variant:"destructive",children:s("Delete user")})]}),m!==null&&u("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[t(_,{htmlFor:"ud-token",children:s("Impersonation token")}),t(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:m})]})]})]}),t(mt,{busy:d,runAction:p,userId:n.id,version:C}),h.accounts&&t(ht,{busy:d,runAction:p,userId:n.id,version:C}),(h.twoFactor||h.passkey)&&t(ft,{busy:d,capabilities:h,runAction:p,userId:n.id,version:C}),u("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Fields")}),t("dl",{className:"flex flex-col",children:O.map(([F,$])=>u("div",{className:"flex flex-col border-t border-border py-1.5",children:[t("dt",{className:"text-xs font-semibold text-muted-foreground",children:F}),t("dd",{className:"m-0 font-mono text-xs break-words",children:xt(F,$)})]},F))})]})]})},Nt=50,jt=({pageSize:h=Nt}={})=>{const e=ee(),l=W(),[n,o]=I(""),[s,f]=I(""),[a,c]=I(0),d=Je(n),[y,C]=I(null),[g,w]=I(!1),{capabilities:k}=nt(),v=d.trim(),r=s.trim(),m=qe(["lunora-auth-users",v,r,h,a],()=>e.listAuthUsers({filterField:r===""?void 0:"role",filterValue:r===""?void 0:r,limit:h,offset:a,search:v===""?void 0:v}).then(i=>({...i,offset:a})),{keepPreviousData:!0}),b=m.data?.rows??null,x=m.error,N=()=>{m.refetch()};Ge(()=>m.poll(),!0);const p=y===null?null:b?.find(i=>i.id===y)??null;return u("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[u("div",{className:"flex flex-wrap items-center gap-2",children:[t(B,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:i=>{o(i.target.value),c(0)},placeholder:l("Search by email or name…"),value:n}),t(B,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:i=>{f(i.target.value),c(0)},placeholder:l("Filter by role"),value:s}),t(R,{"data-testid":"us-new",onClick:()=>{w(!0)},size:"sm",type:"button",children:l("New user")})]}),x!==null&&t("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:x}),b!==null&&b.length===0&&t(Ye,{description:l("Users who sign up to your app will appear here."),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:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),b!==null&&b.length>0&&t(K,{className:"overflow-hidden py-0",children:t(X,{className:"px-0",children:u(Ee,{"data-testid":"us-table",children:[t(Re,{children:u(Q,{children:[t(U,{children:l("id")}),t(U,{children:l("email")}),t(U,{children:l("name")}),t(U,{children:l("role")}),t(U,{children:l("status")}),t(U,{children:l("verified")}),t(U,{children:l("created")}),t(U,{"aria-label":l("Actions")})]})}),t(Te,{children:b.map(i=>u(Q,{"data-testid":`us-row-${i.id}`,children:[t(P,{className:"font-mono text-xs",children:i.id}),t(P,{children:i.email??""}),t(P,{children:i.name??""}),t(P,{children:typeof i.role=="string"&&i.role!==""?t(q,{variant:"secondary",children:i.role}):""}),t(P,{children:i.banned===!0?t(q,{variant:"destructive",children:l("Banned")}):t(q,{variant:"success",children:l("Active")})}),t(P,{children:i.emailVerified===!0?t(q,{variant:"success",children:l("yes")}):t(q,{variant:"outline",children:l("no")})}),t(P,{className:"text-muted-foreground tabular-nums",children:Fe(i.createdAt)}),t(P,{children:t(R,{"data-testid":`us-manage-${i.id}`,onClick:()=>{C(i.id)},size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},i.id))})]})})}),b!==null&&t(Xe,{count:b.length,offset:m.data?.offset??0,onOffsetChange:c,pageSize:h,prefix:"us",total:m.data?.total}),p!==null&&t(yt,{capabilities:k,onChanged:N,onClose:()=>{C(null)},user:p}),g&&t(ut,{onClose:()=>{w(!1)},onCreated:N}),k.inviteOnly&&t(rt,{})]})};export{jt as UsersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as B}from"react/compiler-runtime";import{useState as k,useRef as z,useEffect as O}from"react";import{B as P}from"../packem_shared/button-q0UYSmrn.mjs";import{C as F,a as L}from"../packem_shared/card-By2O8ULa.mjs";import{E as U}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as W}from"../packem_shared/input-CXhxesPC.mjs";import{b as V,e as C,c as S,a as Q,d as A,T as D}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Z}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as M}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{f as $,b as j,l as G}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsxs as N,jsx as t}from"react/jsx-runtime";const J=10,_=f=>{const e=B(7),{label:i,value:l}=f;let s;e[0]!==i?(s=t("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[0]=i,e[1]=s):s=e[1];const r=l??"—";let a;e[2]!==r?(a=t("span",{className:"font-mono text-sm",children:r}),e[2]=r,e[3]=a):a=e[3];let n;return e[4]!==s||e[5]!==a?(n=N("div",{className:"flex flex-col gap-0.5",children:[s,a]}),e[4]=s,e[5]=a,e[6]=n):n=e[6],n},X=f=>{const e=B(38),{indexes:i,onSelect:l,selected:s}=f,r=M();let a;e[0]!==r?(a=r("name"),e[0]=r,e[1]=a):a=e[1];let n;e[2]!==a?(n=t(S,{children:a}),e[2]=a,e[3]=n):n=e[3];let c;e[4]!==r?(c=r("table"),e[4]=r,e[5]=c):c=e[5];let d;e[6]!==c?(d=t(S,{children:c}),e[6]=c,e[7]=d):d=e[7];let o;e[8]!==r?(o=r("dimensions"),e[8]=r,e[9]=o):o=e[9];let h;e[10]!==o?(h=t(S,{children:o}),e[10]=o,e[11]=h):h=e[11];let m;e[12]!==r?(m=r("metric"),e[12]=r,e[13]=m):m=e[13];let p;e[14]!==m?(p=t(S,{children:m}),e[14]=m,e[15]=p):p=e[15];let u;e[16]!==r?(u=r("vectors"),e[16]=r,e[17]=u):u=e[17];let x;e[18]!==u?(x=t(S,{children:u}),e[18]=u,e[19]=x):x=e[19];let w;e[20]!==x||e[21]!==n||e[22]!==d||e[23]!==h||e[24]!==p?(w=t(Q,{children:N(V,{children:[n,d,h,p,x]})}),e[20]=x,e[21]=n,e[22]=d,e[23]=h,e[24]=p,e[25]=w):w=e[25];let T;if(e[26]!==i||e[27]!==l||e[28]!==s){let q;e[30]!==l||e[31]!==s?(q=y=>N(V,{className:y.name===s?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":y.name,"data-testid":`vector-row-${y.name}`,onClick:l,children:[t(C,{className:"font-mono text-xs",children:y.name}),t(C,{className:"font-mono text-xs",children:y.table}),t(C,{className:"tabular-nums",children:y.dimensions??"—"}),t(C,{children:y.metric??"—"}),t(C,{className:"tabular-nums",children:y.vectorsCount??"—"})]},y.name),e[30]=l,e[31]=s,e[32]=q):q=e[32],T=i.map(q),e[26]=i,e[27]=l,e[28]=s,e[29]=T}else T=e[29];let b;e[33]!==T?(b=t(A,{children:T}),e[33]=T,e[34]=b):b=e[34];let v;return e[35]!==w||e[36]!==b?(v=t(F,{className:"overflow-hidden py-0",children:t(L,{className:"px-0",children:N(D,{"data-testid":"vector-table",children:[w,b]})})}),e[35]=w,e[36]=b,e[37]=v):v=e[37],v},Y=f=>{const e=B(27),{matches:i}=f,l=M();if(i.length===0){let u;e[0]!==l?(u=l("No matches."),e[0]=l,e[1]=u):u=e[1];let x;return e[2]!==u?(x=t("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:u}),e[2]=u,e[3]=x):x=e[3],x}let s;e[4]!==l?(s=l("id"),e[4]=l,e[5]=s):s=e[5];let r;e[6]!==s?(r=t(S,{children:s}),e[6]=s,e[7]=r):r=e[7];let a;e[8]!==l?(a=l("score"),e[8]=l,e[9]=a):a=e[9];let n;e[10]!==a?(n=t(S,{children:a}),e[10]=a,e[11]=n):n=e[11];let c;e[12]!==l?(c=l("metadata"),e[12]=l,e[13]=c):c=e[13];let d;e[14]!==c?(d=t(S,{children:c}),e[14]=c,e[15]=d):d=e[15];let o;e[16]!==r||e[17]!==n||e[18]!==d?(o=t(Q,{children:N(V,{children:[r,n,d]})}),e[16]=r,e[17]=n,e[18]=d,e[19]=o):o=e[19];let h;e[20]!==i?(h=i.map(ee),e[20]=i,e[21]=h):h=e[21];let m;e[22]!==h?(m=t(A,{children:h}),e[22]=h,e[23]=m):m=e[23];let p;return e[24]!==o||e[25]!==m?(p=t(F,{className:"mt-3 overflow-hidden py-0",children:t(L,{className:"px-0",children:N(D,{"data-testid":"vector-matches",children:[o,m]})})}),e[24]=o,e[25]=m,e[26]=p):p=e[26],p},ue=({loadIndexes:f,runQuery:e}={})=>{const i=Z(),l=M(),[s,r]=k(null),[a,n]=k(null),[c,d]=k(null),[o,h]=k(""),[m,p]=k(null),[u,x]=k(null),[w,T]=k(!1),b=z(0);O(()=>{const g={cancelled:!1};return $((async()=>{try{const I=await(f??(()=>i.listVectorIndexes()))();g.cancelled||(r(I),n(null),d(E=>E??I[0]?.name??null))}catch(I){g.cancelled||(r(null),n(j(I)))}})()),()=>{g.cancelled=!0}},[i,f]);const v=s?.find(g=>g.name===c)??null,q=g=>{b.current+=1,d(g.currentTarget.dataset.index??null),p(null),x(null),T(!1)},y=g=>{h(g.target.value)},H=async()=>{const g=o.trim();if(c===null||g==="")return;b.current+=1;const I=b.current;T(!0),x(null);try{const E=await(e??(R=>i.queryVectorIndex(R)))({name:c,text:g,topK:J});if(I!==b.current)return;p(E)}catch(E){if(I!==b.current)return;p(null),x(j(E))}T(!1)},K=()=>{$(H())};return N("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[a!==null&&t("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:a}),s!==null&&s.length===0&&t(U,{description:l("Indexes declared with .vectorize() or defineVectorIndex() appear here."),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:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:l("No vector indexes.")}),s!==null&&s.length>0&&t(X,{indexes:s,onSelect:q,selected:c}),v!==null&&N("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[N("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[t(_,{label:l("field"),value:v.field}),t(_,{label:l("dimensions"),value:v.dimensions}),t(_,{label:l("metric"),value:v.metric}),t(_,{label:l("vectors"),value:v.vectorsCount})]}),v.metadata!==void 0&&v.metadata.length>0&&N("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[l("metadata"),": ",t("span",{className:"font-mono",children:v.metadata.join(", ")})]}),N("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t(W,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:y,placeholder:l("Search by similarity…"),value:o}),t(P,{"data-testid":"vector-search",disabled:w||o.trim()==="",onClick:K,children:l(w?"Searching…":"Search")})]}),u!==null&&t("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:u}),m!==null&&t(Y,{matches:m})]})]})};function ee(f){return N(V,{"data-testid":`vector-match-${f.id}`,children:[t(C,{className:"font-mono text-xs",children:f.id}),t(C,{className:"tabular-nums",children:f.score.toFixed(4)}),t(C,{className:"max-w-md truncate font-mono text-xs",children:f.metadata===void 0?"—":G(f.metadata)})]},f.id)}export{ue as VectorBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useLunora as ee}from"@lunora/react";import{useState as f,useRef as G,useEffect as se}from"react";import{B as W}from"../packem_shared/button-q0UYSmrn.mjs";import{C as P,a as q}from"../packem_shared/card-By2O8ULa.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ne}from"../packem_shared/input-CXhxesPC.mjs";import{T as U,a as j,b as y,c as i,d as z,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as ae}from"../packem_shared/textarea--40GKAyz.mjs";import{u as oe}from"../packem_shared/use-admin-query-CLStXJ7v.mjs";import{useT as M}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as Q}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as A,b as E,k as te,d as Z,c as re}from"../packem_shared/internal-BXEjuLPN.mjs";import{c as le}from"react/compiler-runtime";import{ConfirmButton as ie}from"../packem_shared/ConfirmButton-DU4p72Er.mjs";import{jsxs as o,jsx as t,Fragment as de}from"react/jsx-runtime";const ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],ue=["pause","resume","restart","terminate"],me=l=>{const r=le(7),{busy:h,id:g,onAct:u}=l,x=M();let s;r[0]!==h||r[1]!==g||r[2]!==u||r[3]!==x?(s=ue.map(c=>c==="restart"?t(ie,{confirmLabel:x("Restart?"),disabled:h,onConfirm:()=>{u(c)},testId:`workflow-instance-${c}-${g}`,children:x(c)},c):t(W,{"data-testid":`workflow-instance-${c}-${g}`,disabled:h,onClick:()=>{u(c)},size:"sm",type:"button",variant:"ghost",children:x(c)},c)),r[0]=h,r[1]=g,r[2]=u,r[3]=x,r[4]=s):s=r[4];let m;return r[5]!==s?(m=t(de,{children:s}),r[5]=s,r[6]=m):m=r[6],m},fe="WORKFLOWS_NOT_CONFIGURED",he=l=>typeof l=="object"&&l!==null&&l.code===fe,pe=l=>{const r=l.error??l.output;if(r===void 0)return"—";try{return JSON.stringify(r,te)}catch{return"(unserializable)"}},xe=({loadDetail:l,loadInstances:r,readOnly:h,runAction:g,workflowName:u})=>{const x=ee(),s=M(),[m,c]=f(null),[S,C]=f(null),[k,R]=f(""),[I,b]=f(null),[$,O]=f(!1),[_,F]=f(null),w=G(0),N=G(0),v=G(0),D=l??(e=>x.getWorkflowInstance(e)),T=h?void 0:g??(r===void 0?e=>x.setWorkflowInstanceStatus(e):void 0),L=async()=>{N.current+=1;const e=N.current;b(null),O(!1);const n=k===""?void 0:k;try{if(r===void 0){const p=await x.listWorkflowInstances({name:u,status:n});if(e!==N.current)return;if(p.configured===!1){c(null),O(!0);return}c(p.instances);return}const a=await r({name:u,status:n});e===N.current&&c(a)}catch(a){if(e!==N.current)return;c(null),he(a)?O(!0):b(E(a))}};se(()=>{w.current+=1,v.current+=1,C(null),A(L())},[u,k]);const B=async e=>{v.current+=1;const n=v.current;b(null);try{const a=await D({id:e,name:u});n===v.current&&C(a)}catch(a){n===v.current&&b(E(a))}},J=()=>{v.current+=1,C(null)},K=async(e,n)=>{if(T===void 0)return;const a=w.current;F(e),b(null);try{await T({action:n,id:e,name:u}),a===w.current&&await L()}catch(p){b(E(p))}F(null)};return o("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[o("div",{className:"flex items-center justify-between gap-2",children:[t("h3",{className:"text-sm font-medium",children:s("Instance history")}),o("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:e=>{R(e.target.value)},value:k,children:[t("option",{value:"",children:s("All statuses")}),ce.map(e=>t("option",{value:e,children:e},e))]})]}),I!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:I}),$&&t(H,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!$&&m!==null&&m.length===0&&t(H,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),m!==null&&m.length>0&&t(P,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflow-instances-table",children:[t(j,{children:o(y,{children:[t(i,{children:s("Instance id")}),t(i,{children:s("Status")}),t(i,{children:s("Created")}),t(i,{children:s("Ended")}),t(i,{"aria-label":s("Actions")})]})}),t(z,{children:m.map(e=>o(y,{"data-testid":`workflow-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"text-muted-foreground tabular-nums",children:e.createdOn??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.endedOn??"—"}),t(d,{className:"text-right",children:o("div",{className:"flex justify-end gap-1.5",children:[t(W,{"data-testid":`workflow-instance-steps-${e.id}`,onClick:()=>{A(B(e.id))},size:"sm",type:"button",variant:"outline",children:s("Steps")}),T!==void 0&&t(me,{busy:_===e.id,id:e.id,onAct:n=>{A(K(e.id,n))}},u)]})})]},e.id))})]})})}),S!==null&&t(P,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:o(q,{className:"flex flex-col gap-2 px-4 py-3",children:[o("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-mono text-xs",children:[s("Steps")," · ",S.id]}),t(W,{"data-testid":"workflow-instance-detail-close",onClick:J,size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?t("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):o(U,{"data-testid":"workflow-instance-steps",children:[t(j,{children:o(y,{children:[t(i,{children:s("Step")}),t(i,{children:s("Type")}),t(i,{children:s("Attempts")}),t(i,{children:s("Started")}),t(i,{children:s("Output")})]})}),t(z,{children:S.steps.map((e,n)=>o(y,{"data-testid":`workflow-step-${String(n)}`,children:[t(d,{className:"font-mono text-xs",children:e.name}),t(d,{className:"text-xs text-muted-foreground",children:e.type??"—"}),t(d,{className:"tabular-nums",children:e.attempts??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.start??"—"}),t(d,{className:"font-mono text-xs text-muted-foreground",children:pe(e)})]},`${e.name}:${String(n)}`))})]})]})})]})},we=re(Q.createWorkflowInstance),Ne=re(Q.getWorkflowInstanceStatus),ge=l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"—";try{return JSON.stringify(l.output,te)}catch{return"(unserializable)"}},be=(l,r)=>l.some(h=>h.exportName===r)?r:l[0]?.exportName??"",De=()=>{const l=ee(),r=M(),{data:h,error:g}=oe(Q.listWorkflows,{}),[u,x]=f(""),[s,m]=f(""),[c,S]=f(""),[C,k]=f(!1),[R,I]=f(null),[b,$]=f([]),[O,_]=f(null),F=h!==void 0,w=Array.isArray(h?.workflows)?[...h.workflows].toSorted((e,n)=>e.exportName.localeCompare(n.exportName)):[],N=be(w,u),v=w.find(e=>e.exportName===N),D=e=>{$(n=>{const a=n.filter(p=>!(p.exportName===e.exportName&&p.id===e.id));return[e,...a]})},V=async()=>{const e=N;if(e==="")return;let n;const a=c.trim();if(a!=="")try{n=JSON.parse(a)}catch{I(r("Params must be valid JSON"));return}k(!0),I(null);try{const p=s.trim(),Y=await l.query(we,{exportName:e,id:p===""?void 0:p,params:n},Z(""));D({exportName:e,id:Y.id,status:Y.status}),m("")}catch(p){I(E(p))}k(!1)},X=()=>{A(V())},T=async(e,n)=>{_(n);try{const a=await l.query(Ne,{exportName:e,id:n},Z(""));D({error:a.error,exportName:e,id:a.id,output:a.output,status:a.status})}catch(a){I(E(a))}_(null)},L=e=>{x(e.target.value)},B=e=>{m(e.target.value)},J=e=>{S(e.target.value)},K=e=>{const{export:n,id:a}=e.currentTarget.dataset;n!==void 0&&a!==void 0&&A(T(n,a))};return o("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[g!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:g}),t("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),F&&w.length===0?t(H,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):t(P,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflows-table",children:[t(j,{children:o(y,{children:[t(i,{children:r("Export")}),t(i,{children:r("Name")}),t(i,{children:r("Class")})]})}),t(z,{children:w.map(e=>o(y,{"data-testid":`workflows-row-${e.exportName}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.name}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.className})]},e.exportName))})]})})}),w.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[t("h3",{className:"text-sm font-medium",children:r("Start instance")}),R!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:R}),o("div",{className:"flex flex-wrap items-center gap-2",children:[t("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:L,value:N,children:w.map(e=>t("option",{value:e.exportName,children:e.exportName},e.exportName))}),t(ne,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:B,placeholder:r("Instance id (optional)"),value:s}),t(W,{"data-testid":"workflows-start-button",disabled:C||N==="",onClick:X,children:r(C?"Starting…":"Start instance")})]}),t(ae,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:J,placeholder:r("Params (JSON, optional)"),value:c})]}),b.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[t("h3",{className:"text-sm font-medium",children:r("Instances")}),t(P,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflows-instances-table",children:[t(j,{children:o(y,{children:[t(i,{children:r("Workflow")}),t(i,{children:r("Instance id")}),t(i,{children:r("Status")}),t(i,{children:r("Output")}),t(i,{})]})}),t(z,{children:b.map(e=>o(y,{"data-testid":`workflows-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"font-mono text-xs text-muted-foreground",children:ge(e)}),t(d,{children:t(W,{"data-export":e.exportName,"data-id":e.id,"data-testid":`workflows-instance-refresh-${e.id}`,disabled:O===e.id,onClick:K,size:"xs",variant:"outline",children:O===e.id?r("Refreshing…"):r("Refresh")})})]},`${e.exportName}:${e.id}`))})]})})})]}),v!==void 0&&t(xe,{workflowName:v.name})]})};export{De as default};
|
|
1
|
+
import{useState as f,useRef as G,useEffect as se}from"react";import{B as W}from"../packem_shared/button-q0UYSmrn.mjs";import{C as L,a as q}from"../packem_shared/card-By2O8ULa.mjs";import{E as H}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ne}from"../packem_shared/input-CXhxesPC.mjs";import{T as U,a as j,b as y,c as i,d as z,e as d}from"../packem_shared/table-D0SBiDu-.mjs";import{T as ae}from"../packem_shared/textarea--40GKAyz.mjs";import{u as oe}from"../packem_shared/use-admin-query-BW9IuacC.mjs";import{u as ee}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as M}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as Q}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as A,b as E,k as te,d as Z,c as re}from"../packem_shared/internal-BXEjuLPN.mjs";import{c as le}from"react/compiler-runtime";import{ConfirmButton as ie}from"../packem_shared/ConfirmButton-CIXYF6Mg.mjs";import{jsxs as o,jsx as t,Fragment as de}from"react/jsx-runtime";const ce=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],ue=["pause","resume","restart","terminate"],me=l=>{const r=le(7),{busy:h,id:g,onAct:u}=l,x=M();let s;r[0]!==h||r[1]!==g||r[2]!==u||r[3]!==x?(s=ue.map(c=>c==="restart"?t(ie,{confirmLabel:x("Restart?"),disabled:h,onConfirm:()=>{u(c)},testId:`workflow-instance-${c}-${g}`,children:x(c)},c):t(W,{"data-testid":`workflow-instance-${c}-${g}`,disabled:h,onClick:()=>{u(c)},size:"sm",type:"button",variant:"ghost",children:x(c)},c)),r[0]=h,r[1]=g,r[2]=u,r[3]=x,r[4]=s):s=r[4];let m;return r[5]!==s?(m=t(de,{children:s}),r[5]=s,r[6]=m):m=r[6],m},fe="WORKFLOWS_NOT_CONFIGURED",he=l=>typeof l=="object"&&l!==null&&l.code===fe,pe=l=>{const r=l.error??l.output;if(r===void 0)return"—";try{return JSON.stringify(r,te)}catch{return"(unserializable)"}},xe=({loadDetail:l,loadInstances:r,readOnly:h,runAction:g,workflowName:u})=>{const x=ee(),s=M(),[m,c]=f(null),[S,C]=f(null),[k,R]=f(""),[I,b]=f(null),[$,O]=f(!1),[_,F]=f(null),w=G(0),N=G(0),v=G(0),D=l??(e=>x.getWorkflowInstance(e)),T=h?void 0:g??(r===void 0?e=>x.setWorkflowInstanceStatus(e):void 0),P=async()=>{N.current+=1;const e=N.current;b(null),O(!1);const n=k===""?void 0:k;try{if(r===void 0){const p=await x.listWorkflowInstances({name:u,status:n});if(e!==N.current)return;if(p.configured===!1){c(null),O(!0);return}c(p.instances);return}const a=await r({name:u,status:n});e===N.current&&c(a)}catch(a){if(e!==N.current)return;c(null),he(a)?O(!0):b(E(a))}};se(()=>{w.current+=1,v.current+=1,C(null),A(P())},[u,k]);const B=async e=>{v.current+=1;const n=v.current;b(null);try{const a=await D({id:e,name:u});n===v.current&&C(a)}catch(a){n===v.current&&b(E(a))}},J=()=>{v.current+=1,C(null)},K=async(e,n)=>{if(T===void 0)return;const a=w.current;F(e),b(null);try{await T({action:n,id:e,name:u}),a===w.current&&await P()}catch(p){b(E(p))}F(null)};return o("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[o("div",{className:"flex items-center justify-between gap-2",children:[t("h3",{className:"text-sm font-medium",children:s("Instance history")}),o("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:e=>{R(e.target.value)},value:k,children:[t("option",{value:"",children:s("All statuses")}),ce.map(e=>t("option",{value:e,children:e},e))]})]}),I!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:I}),$&&t(H,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!$&&m!==null&&m.length===0&&t(H,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),m!==null&&m.length>0&&t(L,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflow-instances-table",children:[t(j,{children:o(y,{children:[t(i,{children:s("Instance id")}),t(i,{children:s("Status")}),t(i,{children:s("Created")}),t(i,{children:s("Ended")}),t(i,{"aria-label":s("Actions")})]})}),t(z,{children:m.map(e=>o(y,{"data-testid":`workflow-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"text-muted-foreground tabular-nums",children:e.createdOn??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.endedOn??"—"}),t(d,{className:"text-right",children:o("div",{className:"flex justify-end gap-1.5",children:[t(W,{"data-testid":`workflow-instance-steps-${e.id}`,onClick:()=>{A(B(e.id))},size:"sm",type:"button",variant:"outline",children:s("Steps")}),T!==void 0&&t(me,{busy:_===e.id,id:e.id,onAct:n=>{A(K(e.id,n))}},u)]})})]},e.id))})]})})}),S!==null&&t(L,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:o(q,{className:"flex flex-col gap-2 px-4 py-3",children:[o("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-mono text-xs",children:[s("Steps")," · ",S.id]}),t(W,{"data-testid":"workflow-instance-detail-close",onClick:J,size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?t("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):o(U,{"data-testid":"workflow-instance-steps",children:[t(j,{children:o(y,{children:[t(i,{children:s("Step")}),t(i,{children:s("Type")}),t(i,{children:s("Attempts")}),t(i,{children:s("Started")}),t(i,{children:s("Output")})]})}),t(z,{children:S.steps.map((e,n)=>o(y,{"data-testid":`workflow-step-${String(n)}`,children:[t(d,{className:"font-mono text-xs",children:e.name}),t(d,{className:"text-xs text-muted-foreground",children:e.type??"—"}),t(d,{className:"tabular-nums",children:e.attempts??"—"}),t(d,{className:"text-muted-foreground tabular-nums",children:e.start??"—"}),t(d,{className:"font-mono text-xs text-muted-foreground",children:pe(e)})]},`${e.name}:${String(n)}`))})]})]})})]})},we=re(Q.createWorkflowInstance),Ne=re(Q.getWorkflowInstanceStatus),ge=l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"—";try{return JSON.stringify(l.output,te)}catch{return"(unserializable)"}},be=(l,r)=>l.some(h=>h.exportName===r)?r:l[0]?.exportName??"",De=()=>{const l=ee(),r=M(),{data:h,error:g}=oe(Q.listWorkflows,{}),[u,x]=f(""),[s,m]=f(""),[c,S]=f(""),[C,k]=f(!1),[R,I]=f(null),[b,$]=f([]),[O,_]=f(null),F=h!==void 0,w=Array.isArray(h?.workflows)?[...h.workflows].toSorted((e,n)=>e.exportName.localeCompare(n.exportName)):[],N=be(w,u),v=w.find(e=>e.exportName===N),D=e=>{$(n=>{const a=n.filter(p=>!(p.exportName===e.exportName&&p.id===e.id));return[e,...a]})},V=async()=>{const e=N;if(e==="")return;let n;const a=c.trim();if(a!=="")try{n=JSON.parse(a)}catch{I(r("Params must be valid JSON"));return}k(!0),I(null);try{const p=s.trim(),Y=await l.query(we,{exportName:e,id:p===""?void 0:p,params:n},Z(""));D({exportName:e,id:Y.id,status:Y.status}),m("")}catch(p){I(E(p))}k(!1)},X=()=>{A(V())},T=async(e,n)=>{_(n);try{const a=await l.query(Ne,{exportName:e,id:n},Z(""));D({error:a.error,exportName:e,id:a.id,output:a.output,status:a.status})}catch(a){I(E(a))}_(null)},P=e=>{x(e.target.value)},B=e=>{m(e.target.value)},J=e=>{S(e.target.value)},K=e=>{const{export:n,id:a}=e.currentTarget.dataset;n!==void 0&&a!==void 0&&A(T(n,a))};return o("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[g!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:g}),t("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),F&&w.length===0?t(H,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):t(L,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflows-table",children:[t(j,{children:o(y,{children:[t(i,{children:r("Export")}),t(i,{children:r("Name")}),t(i,{children:r("Class")})]})}),t(z,{children:w.map(e=>o(y,{"data-testid":`workflows-row-${e.exportName}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.name}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.className})]},e.exportName))})]})})}),w.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[t("h3",{className:"text-sm font-medium",children:r("Start instance")}),R!==null&&t("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:R}),o("div",{className:"flex flex-wrap items-center gap-2",children:[t("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:P,value:N,children:w.map(e=>t("option",{value:e.exportName,children:e.exportName},e.exportName))}),t(ne,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:B,placeholder:r("Instance id (optional)"),value:s}),t(W,{"data-testid":"workflows-start-button",disabled:C||N==="",onClick:X,children:r(C?"Starting…":"Start instance")})]}),t(ae,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:J,placeholder:r("Params (JSON, optional)"),value:c})]}),b.length>0&&o("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[t("h3",{className:"text-sm font-medium",children:r("Instances")}),t(L,{className:"overflow-hidden py-0",children:t(q,{className:"px-0",children:o(U,{"data-testid":"workflows-instances-table",children:[t(j,{children:o(y,{children:[t(i,{children:r("Workflow")}),t(i,{children:r("Instance id")}),t(i,{children:r("Status")}),t(i,{children:r("Output")}),t(i,{})]})}),t(z,{children:b.map(e=>o(y,{"data-testid":`workflows-instance-${e.id}`,children:[t(d,{className:"font-mono text-xs",children:e.exportName}),t(d,{className:"font-mono text-xs text-muted-foreground",children:e.id}),t(d,{className:"font-mono text-xs",children:e.status}),t(d,{className:"font-mono text-xs text-muted-foreground",children:ge(e)}),t(d,{children:t(W,{"data-export":e.exportName,"data-id":e.id,"data-testid":`workflows-instance-refresh-${e.id}`,disabled:O===e.id,onClick:K,size:"xs",variant:"outline",children:O===e.id?r("Refreshing…"):r("Refresh")})})]},`${e.exportName}:${e.id}`))})]})})})]}),v!==void 0&&t(xe,{workflowName:v.name})]})};export{De as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as F}from"react/compiler-runtime";import{
|
|
2
|
-
`),re=(
|
|
1
|
+
import{c as F}from"react/compiler-runtime";import{useState as z,useEffect as V}from"react";import{B as H}from"./button-q0UYSmrn.mjs";import{E as K}from"./empty-state-D7jEML_T.mjs";import{u as W}from"./use-studio-client-DCA50tF2.mjs";import{useT as M}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as X}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as Z,d as ee,g as te}from"./internal-BXEjuLPN.mjs";import{jsxs as R,jsx as u}from"react/jsx-runtime";const le=Z(X.listTables),ie=["react","client","cli"],ne={action:"action",mutation:"mutation",query:"query"},Q=n=>{const e=n.indexOf(":");return e===-1?{file:"",fn:n}:{file:n.slice(0,e),fn:n.slice(e+1)}},ae=({file:n,fn:e,kind:a})=>`await client.${ne[a]}(api.${n}.${e}, { /* args */ });`,se=n=>{const e=`api.${n.file}.${n.fn}`;switch(n.kind){case"action":return`const { call: ${n.fn} } = useAction(${e});`;case"mutation":return`const ${n.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},oe=({file:n,fn:e})=>`lunora run ${n}:${e} --args '{ }'`,ce=n=>["// Read rows",`const rows = await ctx.db.query("${n}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${n}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${n}">;`,`type RowId = Id<"${n}">;`].join(`
|
|
2
|
+
`),re=(n,e)=>{switch(n){case"cli":return oe(e);case"client":return ae(e);default:return se(e)}},U=n=>{const e=F(19),{code:a,label:s,testId:l}=n,i=M();let c;e[0]!==a?(c=()=>{te(a)},e[0]=a,e[1]=c):c=e[1];const m=c;let t;e[2]!==s?(t=u("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[2]=s,e[3]=t):t=e[3];const d=`${l}-copy`;let o;e[4]!==i?(o=i("Copy"),e[4]=i,e[5]=o):o=e[5];let f;e[6]!==m||e[7]!==d||e[8]!==o?(f=u(H,{"data-testid":d,onClick:m,size:"xs",type:"button",variant:"ghost",children:o}),e[6]=m,e[7]=d,e[8]=o,e[9]=f):f=e[9];let p;e[10]!==t||e[11]!==f?(p=R("div",{className:"flex items-center justify-between gap-2",children:[t,f]}),e[10]=t,e[11]=f,e[12]=p):p=e[12];let r;e[13]!==a||e[14]!==l?(r=u("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":l,children:a}),e[13]=a,e[14]=l,e[15]=r):r=e[15];let b;return e[16]!==p||e[17]!==r?(b=R("div",{className:"flex flex-col gap-1.5",children:[p,r]}),e[16]=p,e[17]=r,e[18]=b):b=e[18],b},de=n=>{const e=F(46),{file:a,fn:s,kind:l}=n,i=M(),[c,m]=z("react");let t,d,o;if(e[0]!==a||e[1]!==s||e[2]!==l||e[3]!==i||e[4]!==c){const x={file:a,fn:s,kind:l};let k;e[8]!==i?(k=i("CLI"),e[8]=i,e[9]=k):k=e[9];let w;e[10]!==i?(w=i("Client"),e[10]=i,e[11]=w):w=e[11];let I;e[12]!==i?(I=i("React"),e[12]=i,e[13]=I):I=e[13];let C;e[14]!==k||e[15]!==w||e[16]!==I?(C={cli:k,client:w,react:I},e[14]=k,e[15]=w,e[16]=I,e[17]=C):C=e[17],o=C;let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=D=>{m(D.currentTarget.dataset.tab)},e[18]=B):B=e[18],t=B,d=re(c,x),e[0]=a,e[1]=s,e[2]=l,e[3]=i,e[4]=c,e[5]=t,e[6]=d,e[7]=o}else t=e[5],d=e[6],o=e[7];const f=d,p=`api.${a}.${s}`;let r;e[19]!==p?(r=u("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:p}),e[19]=p,e[20]=r):r=e[20];let b;e[21]!==l||e[22]!==i?(b=i("Call this {kind} from your app.",{kind:l}),e[21]=l,e[22]=i,e[23]=b):b=e[23];let h;e[24]!==b?(h=u("p",{className:"text-xs text-muted-foreground",children:b}),e[24]=b,e[25]=h):h=e[25];let v;e[26]!==r||e[27]!==h?(v=R("div",{children:[r,h]}),e[26]=r,e[27]=h,e[28]=v):v=e[28];let $;e[29]!==i?($=i("Snippet flavour"),e[29]=i,e[30]=$):$=e[30];let y;e[31]!==t||e[32]!==c||e[33]!==o?(y=ie.map(x=>u(H,{"aria-selected":c===x,"data-tab":x,"data-testid":`api-tab-${x}`,onClick:t,role:"tab",size:"xs",type:"button",variant:c===x?"default":"outline",children:o[x]},x)),e[31]=t,e[32]=c,e[33]=o,e[34]=y):y=e[34];let N;e[35]!==$||e[36]!==y?(N=u("div",{"aria-label":$,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:y}),e[35]=$,e[36]=y,e[37]=N):N=e[37];const _=o[c],A=`api-snippet-${c}`;let S;e[38]!==f||e[39]!==_||e[40]!==A?(S=u(U,{code:f,label:_,testId:A}),e[38]=f,e[39]=_,e[40]=A,e[41]=S):S=e[41];let T;return e[42]!==S||e[43]!==v||e[44]!==N?(T=R("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[v,N,S]}),e[42]=S,e[43]=v,e[44]=N,e[45]=T):T=e[45],T},fe=n=>{const e=F(19),{name:a}=n,s=M();let l;e[0]!==a?(l=ce(a),e[0]=a,e[1]=l):l=e[1];const i=l;let c;e[2]!==a?(c=u("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:a}),e[2]=a,e[3]=c):c=e[3];let m;e[4]!==s?(m=s("Read and write this table through the typed data model."),e[4]=s,e[5]=m):m=e[5];let t;e[6]!==m?(t=u("p",{className:"text-xs text-muted-foreground",children:m}),e[6]=m,e[7]=t):t=e[7];let d;e[8]!==c||e[9]!==t?(d=R("div",{children:[c,t]}),e[8]=c,e[9]=t,e[10]=d):d=e[10];let o;e[11]!==s?(o=s("Data model"),e[11]=s,e[12]=o):o=e[12];let f;e[13]!==i||e[14]!==o?(f=u(U,{code:i,label:o,testId:"api-snippet-table"}),e[13]=i,e[14]=o,e[15]=f):f=e[15];let p;return e[16]!==d||e[17]!==f?(p=R("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[d,f]}),e[16]=d,e[17]=f,e[18]=p):p=e[18],p},G=n=>{const e=F(8),{active:a,label:s,onSelect:l,testId:i,value:c}=n;let m;e[0]!==l||e[1]!==c?(m=()=>{l(c)},e[0]=l,e[1]=c,e[2]=m):m=e[2];const t=m,d=a?"page":void 0;let o;return e[3]!==s||e[4]!==t||e[5]!==d||e[6]!==i?(o=u("button",{"aria-current":d,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":i,onClick:t,type:"button",children:s}),e[3]=s,e[4]=t,e[5]=d,e[6]=i,e[7]=o):o=e[7],o},pe=n=>{const e=new Map;for(const a of n){const{file:s,fn:l}=Q(a.path),i=e.get(s)??[];i.push({fn:l,kind:a.kind,path:a.path}),e.set(s,i)}return[...e.entries()].map(([a,s])=>({file:a,items:s.toSorted((l,i)=>l.fn.localeCompare(i.fn))})).toSorted((a,s)=>a.file.localeCompare(s.file))},ke=n=>{const e=F(58),{functions:a,initialShardKey:s}=n,l=M(),i=W(),[c,m]=z(null),[t,d]=z(null);let o,f;e[0]!==i||e[1]!==s?(o=()=>{let D=!1;return i.query(le,{},ee(s??"")).then(L=>(D||m(L),L)).catch(()=>{D||m([])}),()=>{D=!0}},f=[i,s],e[0]=i,e[1]=s,e[2]=o,e[3]=f):(o=e[2],f=e[3]),V(o,f);let p,r,b,h,v,$,y,N,_,A;if(e[4]!==a||e[5]!==t||e[6]!==l||e[7]!==c){const D=a??[],L=pe(D),O=(c??[]).map(ue).toSorted(me);let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=g=>{d({kind:"fn",path:g})},e[18]=P):P=e[18];const Y=P;let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=g=>{d({kind:"table",name:g})},e[19]=j):j=e[19];const J=j;r=t?.kind==="fn"?D.find(g=>g.path===t.path):void 0,p=D.length>0||O.length>0,b=r===void 0?void 0:Q(r.path),_="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",A="lunora-api-docs",e[20]!==l?(h=l("API resources"),e[20]=l,e[21]=h):h=e[21],v="flex flex-col gap-4 overflow-y-auto",$="api-rail";let q;e[22]!==t||e[23]!==l?(q=g=>R("div",{className:"flex flex-col gap-1",children:[u("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g.file||l("(root)")}),g.items.map(E=>u(G,{active:t?.kind==="fn"&&t.path===E.path,label:E.fn,onSelect:Y,testId:`api-rail-fn-${E.path}`,value:E.path},E.path))]},g.file),e[22]=t,e[23]=l,e[24]=q):q=e[24],y=L.map(q),N=O.length>0&&R("div",{className:"flex flex-col gap-1",children:[u("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l("Tables")}),O.map(g=>u(G,{active:t?.kind==="table"&&t.name===g,label:g,onSelect:J,testId:`api-rail-table-${g}`,value:g},g))]}),e[4]=a,e[5]=t,e[6]=l,e[7]=c,e[8]=p,e[9]=r,e[10]=b,e[11]=h,e[12]=v,e[13]=$,e[14]=y,e[15]=N,e[16]=_,e[17]=A}else p=e[8],r=e[9],b=e[10],h=e[11],v=e[12],$=e[13],y=e[14],N=e[15],_=e[16],A=e[17];let S;e[25]!==p||e[26]!==l?(S=!p&&u("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:l("No functions or tables to document yet.")}),e[25]=p,e[26]=l,e[27]=S):S=e[27];let T;e[28]!==S||e[29]!==h||e[30]!==v||e[31]!==$||e[32]!==y||e[33]!==N?(T=R("nav",{"aria-label":h,className:v,"data-testid":$,children:[y,N,S]}),e[28]=S,e[29]=h,e[30]=v,e[31]=$,e[32]=y,e[33]=N,e[34]=T):T=e[34];let x;e[35]!==t||e[36]!==l?(x=t===null&&u(K,{description:l("Select a function or table to see how to call it from your app."),testId:"api-empty",title:l("API usage snippets")}),e[35]=t,e[36]=l,e[37]=x):x=e[37];let k;e[38]!==t?.kind||e[39]!==r||e[40]!==b?(k=t?.kind==="fn"&&r!==void 0&&b!==void 0&&u(de,{file:b.file,fn:b.fn,kind:r.kind},r.path),e[38]=t?.kind,e[39]=r,e[40]=b,e[41]=k):k=e[41];let w;e[42]!==t?.kind||e[43]!==r||e[44]!==l?(w=t?.kind==="fn"&&r===void 0&&u(K,{testId:"api-empty",title:l("API usage snippets")}),e[42]=t?.kind,e[43]=r,e[44]=l,e[45]=w):w=e[45];let I;e[46]!==t?(I=t?.kind==="table"&&u(fe,{name:t.name}),e[46]=t,e[47]=I):I=e[47];let C;e[48]!==x||e[49]!==k||e[50]!==w||e[51]!==I?(C=R("div",{className:"min-w-0",children:[x,k,w,I]}),e[48]=x,e[49]=k,e[50]=w,e[51]=I,e[52]=C):C=e[52];let B;return e[53]!==T||e[54]!==C||e[55]!==_||e[56]!==A?(B=R("div",{className:_,"data-testid":A,children:[T,C]}),e[53]=T,e[54]=C,e[55]=_,e[56]=A,e[57]=B):B=e[57],B};function ue(n){return n.name}function me(n,e){return n.localeCompare(e)}export{oe as buildCliSnippet,ae as buildClientSnippet,se as buildReactSnippet,ce as buildTableSnippet,ke as default,Q as splitPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as k}from"react/compiler-runtime";import{E as h}from"./empty-state-D7jEML_T.mjs";import{S as g}from"./skeleton-DX1gfixl.mjs";import{u as v}from"./use-admin-spec-BdNLZbTO.mjs";import{u as O}from"./use-studio-client-DCA50tF2.mjs";import{useT as S}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{R as A}from"./reference-view-DCEC5kjY.mjs";import{jsxs as I,jsx as m}from"react/jsx-runtime";const P=["get","post","put","patch","delete","head","options","trace"],y=r=>r?.content?.["application/json"]?.schema,j=(r,e)=>Object.entries(r.responses??{}).map(([i,s])=>{const c=s.$ref?.replace("#/components/responses/",""),n=c===void 0?s:e.components?.responses?.[c]??s;return{description:n.description,schema:y(n),status:i}}),b=(r,e,i,s,c)=>{const n=y(s.requestBody),l=n?.properties?.functionPath?.const,t=typeof l=="string"?l:void 0,f=t===void 0?n:n?.properties?.args,a=s.operationId??`${i} ${e}`;return{argsSchema:f,description:s.description,functionPath:t,httpPath:e,key:r,kind:s["x-lunora-function-kind"],method:i.toUpperCase(),operationId:a,requestSchema:n,responses:j(s,c),summary:s.summary??a,tags:s.tags??[],title:s.summary??a}},x=r=>{const e=[];for(const[i,s]of Object.entries(r.paths??{})){const c=i.includes("#")?i.slice(0,i.indexOf("#")):i;for(const n of P){const l=s[n];l!==void 0&&e.push(b(i,c,n,l,r))}}return e},w=r=>{const e=r??{},i=x(e),s=new Map((e.tags??[]).map(t=>[t.name,t.description])),c=new Set,n=[],l=t=>{if(c.has(t))return;c.add(t);const f=i.filter(a=>(a.tags[0]??"")===t);f.length>0&&n.push({description:s.get(t),name:t,operations:f})};for(const t of e.tags??[])l(t.name);for(const t of i)l(t.tags[0]??"");return{groups:n,operationByKey:new Map(i.map(t=>[t.key,t])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},R=r=>{const{paths:e}=r;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},T=r=>{const e=r;return R(e)?{kind:"empty"}:{kind:"ready",spec:e}},H=r=>{const e=k(23),{spec:i}=r,s=S(),c=O();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const t=v(i,n,T);let f;e[2]!==t.kind||e[3]!==t.spec?(f=t.kind==="ready"?w(t.spec):void 0,e[2]=t.kind,e[3]=t.spec,e[4]=f):f=e[4];const a=f;if(t.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=I("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[m(g,{className:"h-8 w-48"}),m(g,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(t.kind==="error"){let o;e[6]!==t.message||e[7]!==s?(o=s("Couldn't load the OpenAPI spec: {message}",{message:t.message}),e[6]=t.message,e[7]=s,e[8]=o):o=e[8];let p;e[9]!==s?(p=s("API reference unavailable"),e[9]=s,e[10]=p):p=e[10];let d;return e[11]!==o||e[12]!==p?(d=m(h,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=d):d=e[13],d}if(t.kind==="empty"||a===void 0){let o;e[14]!==s?(o=s("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=s,e[15]=o):o=e[15];let p;e[16]!==s?(p=s("No OpenAPI spec configured"),e[16]=s,e[17]=p):p=e[17];let d;return e[18]!==o||e[19]!==p?(d=m(h,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=d):d=e[20],d}let u;return e[21]!==a?(u=m(A,{model:a}),e[21]=a,e[22]=u):u=e[22],u};export{H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as U}from"react/compiler-runtime";import{Dialog as D}from"@base-ui/react/dialog";import{useNavigate as H}from"@tanstack/react-router";import{useState as B,useRef as Q,useEffect as V}from"react";import{useT as W}from"./DEFAULT_LOCALE-
|
|
1
|
+
import{c as U}from"react/compiler-runtime";import{Dialog as D}from"@base-ui/react/dialog";import{useNavigate as H}from"@tanstack/react-router";import{useState as B,useRef as Q,useEffect as V}from"react";import{useT as W}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{f as X}from"./internal-BXEjuLPN.mjs";import{u as G}from"./shortcuts-B9gDaXmw.mjs";import{c as J}from"./utils-bhneXptQ.mjs";import{jsx as r,jsxs as A}from"react/jsx-runtime";const F="lunora:command-palette",ce=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(F))},Y=v=>{const e=U(18),{active:f,index:o,item:n,onActivate:h,onSelect:b}=v;let g;e[0]!==n||e[1]!==b?(g=()=>{b(n)},e[0]=n,e[1]=b,e[2]=g):g=e[2];const c=g;let x;e[3]!==o||e[4]!==h?(x=()=>{h(o)},e[3]=o,e[4]=h,e[5]=x):x=e[5];const d=x,m=f?"bg-accent text-accent-foreground":"text-foreground";let u;e[6]!==m?(u=J("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",m),e[6]=m,e[7]=u):u=e[7];let s;e[8]!==n.label?(s=r("span",{children:n.label}),e[8]=n.label,e[9]=s):s=e[9];let i;e[10]!==n.group?(i=r("span",{className:"text-xs text-muted-foreground",children:n.group}),e[10]=n.group,e[11]=i):i=e[11];let p;return e[12]!==c||e[13]!==d||e[14]!==u||e[15]!==s||e[16]!==i?(p=r("li",{children:A("button",{className:u,onClick:c,onMouseEnter:d,type:"button",children:[s,i]})}),e[12]=c,e[13]=d,e[14]=u,e[15]=s,e[16]=i,e[17]=p):p=e[17],p},Z=(v,e)=>{const f=e.trim().toLowerCase();return f===""?v:v.filter(o=>o.label.toLowerCase().includes(f)||o.group.toLowerCase().includes(f))},de=v=>{const e=U(40),{items:f}=v,o=W(),n=H(),{palette:h}=G(),[b,g]=B(!1),[c,x]=B(""),[d,m]=B(0),u=Q(null);let s,i;e[0]!==h?(s=()=>{const t=S=>{if(!(S.metaKey||S.ctrlKey)||S.key.toLowerCase()!==h)return;const{target:_}=S;_ instanceof HTMLElement&&(_.isContentEditable||["INPUT","SELECT","TEXTAREA"].includes(_.tagName))||(S.preventDefault(),g(!0))},l=()=>{g(!0)};return globalThis.addEventListener("keydown",t),globalThis.addEventListener(F,l),()=>{globalThis.removeEventListener("keydown",t),globalThis.removeEventListener(F,l)}},i=[h],e[0]=h,e[1]=s,e[2]=i):(s=e[1],i=e[2]),V(s,i);let p;e[3]!==f||e[4]!==c?(p=Z(f,c),e[3]=f,e[4]=c,e[5]=p):p=e[5];const a=p;let I;e[6]===Symbol.for("react.memo_cache_sentinel")?(I=t=>{g(t),t||(x(""),m(0))},e[6]=I):I=e[6];const M=I;let K;e[7]!==n?(K=t=>{if(M(!1),t.run!==void 0){t.run();return}t.to!==void 0&&X(n({to:t.to}))},e[7]=n,e[8]=K):K=e[8];const w=K;let P;e[9]===Symbol.for("react.memo_cache_sentinel")?(P=t=>{x(t.target.value),m(0)},e[9]=P):P=e[9];const q=P;let z;e[10]!==d||e[11]!==a||e[12]!==w?(z=t=>{e:switch(t.key){case"ArrowDown":{t.preventDefault(),m(l=>a.length===0?0:(l+1)%a.length);break e}case"ArrowUp":{t.preventDefault(),m(l=>a.length===0?0:(l-1+a.length)%a.length);break e}case"Enter":{t.preventDefault();const l=a[d];l!==void 0&&w(l);break e}}},e[10]=d,e[11]=a,e[12]=w,e[13]=z):z=e[13];const j=z;let R;e[14]===Symbol.for("react.memo_cache_sentinel")?(R=r(D.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),e[14]=R):R=e[14];let y;e[15]!==o?(y=o("Command palette"),e[15]=o,e[16]=y):y=e[16];let E;e[17]!==y?(E=r(D.Title,{className:"sr-only",children:y}),e[17]=y,e[18]=E):E=e[18];let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=A("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[19]=O):O=e[19];let N;e[20]!==o?(N=o("Search…"),e[20]=o,e[21]=N):N=e[21];let C;e[22]!==j||e[23]!==c||e[24]!==N?(C=A("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[O,r("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:q,onKeyDown:j,placeholder:N,ref:u,type:"text",value:c})]}),e[22]=j,e[23]=c,e[24]=N,e[25]=C):C=e[25];let T;e[26]!==d||e[27]!==a||e[28]!==w||e[29]!==o?(T=a.length===0?r("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o("No results.")}):a.map((t,l)=>r(Y,{active:l===d,index:l,item:t,onActivate:m,onSelect:w},t.to??`${t.group}:${t.label}`)),e[26]=d,e[27]=a,e[28]=w,e[29]=o,e[30]=T):T=e[30];let k;e[31]!==T?(k=r("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:T}),e[31]=T,e[32]=k):k=e[32];let L;e[33]!==E||e[34]!==C||e[35]!==k?(L=A(D.Portal,{children:[R,A(D.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:u,children:[E,C,k]})]}),e[33]=E,e[34]=C,e[35]=k,e[36]=L):L=e[36];let $;return e[37]!==b||e[38]!==L?($=r(D.Root,{onOpenChange:M,open:b,children:L}),e[37]=b,e[38]=L,e[39]=$):$=e[39],$};export{de as CommandPalette,ce as openCommandPalette};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as u}from"react";import{useT as C}from"./DEFAULT_LOCALE-
|
|
1
|
+
import{useState as u}from"react";import{useT as C}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{B as o}from"./button-q0UYSmrn.mjs";import{jsx as e,jsxs as d}from"react/jsx-runtime";const k=({children:s,confirmLabel:a,disabled:i=!1,onConfirm:c,testId:t})=>{const r=C(),[m,n]=u(!1),f=()=>{n(!0)},l=()=>{n(!1)},p=()=>{n(!1),c()};return m?d("span",{className:"inline-flex items-center gap-1","data-testid":`${t}-prompt`,role:"group",children:[e(o,{"data-testid":`${t}-confirm`,disabled:i,onClick:p,size:"sm",type:"button",variant:"destructive",children:a??r("Confirm")}),e(o,{"data-testid":`${t}-cancel`,onClick:l,size:"sm",type:"button",variant:"ghost",children:r("Cancel")})]}):e(o,{"data-testid":t,disabled:i,onClick:f,size:"sm",type:"button",variant:"outline",children:s})};export{k as ConfirmButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r}from"react/compiler-runtime";import{useConnectionStatus as f}from"@lunora/react";import{useT as d}from"./DEFAULT_LOCALE-
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import{useConnectionStatus as f}from"@lunora/react";import{useT as d}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{c as u}from"./utils-bhneXptQ.mjs";import{jsx as g,jsxs as m}from"react/jsx-runtime";const p={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},T=()=>{const e=r(18),n=d(),i=f();let s;e:switch(i){case"connected":{let t;e[0]!==n?(t=n("Connected"),e[0]=n,e[1]=t):t=e[1],s=t;break e}case"connecting":{let t;e[2]!==n?(t=n("Connecting…"),e[2]=n,e[3]=t):t=e[3],s=t;break e}case"idle":{let t;e[4]!==n?(t=n("Idle"),e[4]=n,e[5]=t):t=e[5],s=t;break e}case"offline":{let t;e[6]!==n?(t=n("Offline"),e[6]=n,e[7]=t):t=e[7],s=t;break e}case"polling":{let t;e[8]!==n?(t=n("Polling"),e[8]=n,e[9]=t):t=e[9],s=t;break e}default:s=i}const c=p[i];let l;e[10]!==c?(l=u("size-2 rounded-full",c),e[10]=c,e[11]=l):l=e[11];let o;e[12]!==l?(o=g("span",{"aria-hidden":"true",className:l}),e[12]=l,e[13]=o):o=e[13];let a;return e[14]!==i||e[15]!==o||e[16]!==s?(a=m("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":i,"data-testid":"dash-connection",role:"status",children:[o,s]}),e[14]=i,e[15]=o,e[16]=s,e[17]=a):a=e[17],a};export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as R}from"react/compiler-runtime";import{useRef as S,useEffect as M}from"react";import{i as F}from"./internal-BXEjuLPN.mjs";import{u as P}from"./use-studio-client-DCA50tF2.mjs";const T=6e4,g=e=>(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function",D=5e3,U=(e,s,r)=>{const t=R(9),o=r===void 0?D:r,u=P(),a=S(e);let c;t[0]!==e?(c=()=>{a.current=e},t[0]=e,t[1]=c):c=t[1],M(c);let i;t[2]!==s||t[3]!==o?(i=()=>{if(!s)return;let l=o,d=!1,h;const f=()=>{d||(h=setTimeout(A,l))},p=()=>{l=o,f()},_=y=>{F(y)||(l=Math.max(o,Math.min(l*2,T)),f())},A=()=>{if(globalThis.document?.hidden===!0){f();return}let m;try{m=a.current()}catch(E){_(E);return}g(m)?Promise.resolve(m).then(p).catch(_):p()};return f(),()=>{d=!0,clearTimeout(h)}},t[2]=s,t[3]=o,t[4]=i):i=t[4];let n;t[5]!==u||t[6]!==s||t[7]!==o?(n=[u,s,o],t[5]=u,t[6]=s,t[7]=o,t[8]=n):n=t[8],M(i,n)},v=async e=>{const r=(await Promise.allSettled(e)).find(t=>t.status==="rejected");if(r!==void 0)throw r.reason};export{D as DEFAULT_AUTO_REFRESH_MS,v as settlePolls,U as useAutoRefresh};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setupI18n as r}from"@lingui/core";import{compileMessage as d}from"@lingui/message-utils/compileMessage";import{createContext as p,use as a}from"react";const u={},s="en",l={en:u},n=new Map,m=1e4,I=e=>{let t=n.get(e);return t===void 0?(t=d(e),n.size>=m&&n.delete(n.keys().next().value)):n.delete(e),n.set(e,t),t},M=(e=s,t=l)=>{const o=r();o.setMessagesCompiler(I);for(const[c,i]of Object.entries(t))o.load(c,i);return o.activate(t[e]===void 0?s:e),o},f=M(),C=p(f),S=()=>{const e=a(C);return(t,o)=>e._(t,o)};export{s as DEFAULT_LOCALE,C as StudioI18nContext,M as createStudioI18n,f as studioI18n,S as useT};
|