@lunora/studio 1.0.0-alpha.7 → 1.0.0-alpha.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -0
- package/dist/index.d.ts +762 -779
- package/dist/index.js +1 -41
- package/dist/mount.d.ts +10 -10
- package/dist/mount.js +1 -26
- package/dist/packem_chunks/ApiTab.js +1 -0
- package/dist/packem_chunks/AuditPanel.js +1 -0
- package/dist/packem_chunks/DeploymentHealthPanel.js +1 -0
- package/dist/packem_chunks/ExportImportPanel.js +3 -0
- package/dist/packem_chunks/FileBrowser.js +4 -0
- package/dist/packem_chunks/FunctionRunner.js +1 -0
- package/dist/packem_chunks/FunctionStatsPanel.js +1 -0
- package/dist/packem_chunks/HealthPanel.js +1 -0
- package/dist/packem_chunks/InsightsPanel.js +1 -0
- package/dist/packem_chunks/LogsPanel.js +1 -0
- package/dist/packem_chunks/MailPanel.js +2 -0
- package/dist/packem_chunks/MetricsPanel.js +1 -0
- package/dist/packem_chunks/MigrationsPanel.js +1 -0
- package/dist/packem_chunks/NotificationsPanel.js +1 -0
- package/dist/packem_chunks/PitrPanel.js +1 -0
- package/dist/packem_chunks/SchemaViewer.js +2 -0
- package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -0
- package/dist/packem_chunks/SettingsPanel.js +1 -0
- package/dist/packem_chunks/SqlEditorPanel.js +4 -0
- package/dist/packem_chunks/TableEditor.js +1 -0
- package/dist/packem_chunks/agents-panel.js +1 -0
- package/dist/packem_chunks/analytics-panel.js +1 -0
- package/dist/packem_chunks/auth-audit-panel.js +1 -0
- package/dist/packem_chunks/auth-config-panel.js +1 -0
- package/dist/packem_chunks/auth-sessions-panel.js +1 -0
- package/dist/packem_chunks/containers-panel.js +1 -0
- package/dist/packem_chunks/dashboards-panel.js +1 -0
- package/dist/packem_chunks/fanout-panel.js +1 -0
- package/dist/packem_chunks/flags-panel.js +1 -0
- package/dist/packem_chunks/issues-panel.js +1 -0
- package/dist/packem_chunks/kv-browser.js +1 -0
- package/dist/packem_chunks/log-drains-panel.js +4 -0
- package/dist/packem_chunks/organizations-panel.js +1 -0
- package/dist/packem_chunks/payments-panel.js +1 -0
- package/dist/packem_chunks/permissions-panel.js +1 -0
- package/dist/packem_chunks/queues-panel.js +1 -0
- package/dist/packem_chunks/rls-panel.js +1 -0
- package/dist/packem_chunks/schedule-panel.js +1 -0
- package/dist/packem_chunks/sparkline.js +1 -0
- package/dist/packem_chunks/storage-rules-panel.js +1 -0
- package/dist/packem_chunks/subscriptions-panel.js +1 -0
- package/dist/packem_chunks/sync-client-panel.js +1 -0
- package/dist/packem_chunks/traces-panel.js +1 -0
- package/dist/packem_chunks/users-panel.js +1 -0
- package/dist/packem_chunks/vector-browser.js +1 -0
- package/dist/packem_chunks/workflows-panel.js +1 -0
- package/dist/packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js +1 -0
- package/dist/packem_shared/ApiDocsPanel-eJYZlylw.js +2 -0
- package/dist/packem_shared/ApiReferencePanel-C42v1jr6.js +1 -0
- package/dist/packem_shared/CommandPalette-CVIaY3j8.js +1 -0
- package/dist/packem_shared/ConfirmButton-CTL3f3kr.js +1 -0
- package/dist/packem_shared/ConnectionBadge-DOk0CQWo.js +1 -0
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js +1 -0
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-B-hcFVoi.js +1 -0
- package/dist/packem_shared/DEFAULT_LOCALE-BZ4NojpD.js +1 -0
- package/dist/packem_shared/DataBrowser-B8J5lHjP.js +1 -0
- package/dist/packem_shared/DataFilters-Csb30F0C.js +1 -0
- package/dist/packem_shared/ErrorBoundary-DvzYskH7.js +1 -0
- package/dist/packem_shared/GlobalDataBrowser-RLJ6NvOs.js +1 -0
- package/dist/packem_shared/HomePanel-DL1HupAN.js +1 -0
- package/dist/packem_shared/OpenRpcReferencePanel-sGsIgYWj.js +1 -0
- package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.js +1 -0
- package/dist/packem_shared/ScheduledJobs-DUbo6epc.js +1 -0
- package/dist/packem_shared/ShardInput-BVn2iCU0.js +1 -0
- package/dist/packem_shared/Studio-BWBclm_C.js +1 -0
- package/dist/packem_shared/StudioApp-BFm73yVr.js +1 -0
- package/dist/packem_shared/StudioI18nProvider-CZ5h4nrV.js +1 -0
- package/dist/packem_shared/advisor-view-DaCX9Jy5.js +1 -0
- package/dist/packem_shared/aggregateMetrics-BNfajLa2.js +1 -0
- package/dist/packem_shared/alert-CVcOFuDR.js +1 -0
- package/dist/packem_shared/app.d-bRPJhby-.d.ts +254 -0
- package/dist/packem_shared/badge-BbuuAio7.js +1 -0
- package/dist/packem_shared/bar-chart-AryFCeoa.js +9 -0
- package/dist/packem_shared/browser-storage-xjTyMKY0.js +1 -0
- package/dist/packem_shared/button-BkCrNcAs.js +1 -0
- package/dist/packem_shared/card-CIDGUN6K.js +1 -0
- package/dist/packem_shared/cf-links-gbDy51nR.js +1 -0
- package/dist/packem_shared/checkbox-StT4Gob6.js +1 -0
- package/dist/packem_shared/data-grid-BMBKzMEJ.js +1 -0
- package/dist/packem_shared/data-view-params-C8T3bW1z.js +1 -0
- package/dist/packem_shared/dropdown-menu-C3RQ_HlW.js +2 -0
- package/dist/packem_shared/empty-state-Cg7t_8qu.js +1 -0
- package/dist/packem_shared/error-alert-B59DnrDI.js +1 -0
- package/dist/packem_shared/grid-features-uZCUj955.js +6 -0
- package/dist/packem_shared/home-panel-B-8BCffw.js +3 -0
- package/dist/packem_shared/input-JHu63lTv.js +1 -0
- package/dist/packem_shared/internal-AtZ4bTal.js +2 -0
- package/dist/packem_shared/label-6uP1obNF.js +1 -0
- package/dist/packem_shared/live-status-CGW2JHf_.js +1 -0
- package/dist/packem_shared/log-fields-CoL3hsIQ.js +1 -0
- package/dist/packem_shared/modal-shell-CUwwWC2o.js +1 -0
- package/dist/packem_shared/reference-view-KvhektwF.js +12 -0
- package/dist/packem_shared/result-chart-CwKhhKM0.js +1 -0
- package/dist/packem_shared/scroll-area-DTEq6Jec.js +2 -0
- package/dist/packem_shared/select-Bul-DeII.js +2 -0
- package/dist/packem_shared/shard-history-DMEW5VBE.js +1 -0
- package/dist/packem_shared/skeleton-C1wQ9M5t.js +1 -0
- package/dist/packem_shared/sparkline-DtcZoU48.js +1 -0
- package/dist/packem_shared/storage-tier-DznqOf-q.js +1 -0
- package/dist/packem_shared/studio-BHA7hnI3.js +2 -0
- package/dist/packem_shared/table-DdJBrClo.js +2 -0
- package/dist/packem_shared/table-list-sidebar-CMCcNALK.js +1 -0
- package/dist/packem_shared/textarea-Bu2-jKAs.js +1 -0
- package/dist/packem_shared/trace-handoff-Dw7mwjxu.js +1 -0
- package/dist/packem_shared/use-admin-query-Di3fLE8H.js +1 -0
- package/dist/packem_shared/use-async-submit-H68GHPz8.js +1 -0
- package/dist/packem_shared/useDebounced-Ihdiid_k.js +1 -0
- package/dist/packem_shared/utils-bhneXptQ.js +1 -0
- package/dist/packem_shared/virtual-rect-1o1veP7R.js +1 -0
- package/dist/standalone/chunk-2F7G7IWQ.js +1 -0
- package/dist/standalone/chunk-2OUPA2WJ.js +1 -0
- package/dist/standalone/chunk-2PJNAWB3.js +1 -0
- package/dist/standalone/chunk-2Y36BVVM.js +4 -0
- package/dist/standalone/chunk-34UVAASH.js +1 -0
- package/dist/standalone/chunk-35II7U25.js +11 -0
- package/dist/standalone/chunk-3FUFEZ65.js +1 -0
- package/dist/standalone/chunk-3QRTYSSX.js +1 -0
- package/dist/standalone/chunk-3RTTXLMU.js +1 -0
- package/dist/standalone/chunk-3XIESWL4.js +1 -0
- package/dist/standalone/chunk-4CGALXS3.js +19 -0
- package/dist/standalone/chunk-4UOFSGUS.js +1 -0
- package/dist/standalone/chunk-4WLYA3XE.js +1 -0
- package/dist/standalone/chunk-54MMVNPT.js +1 -0
- package/dist/standalone/chunk-5L2MD6F6.js +1 -0
- package/dist/standalone/chunk-5OWIOACV.js +13 -0
- package/dist/standalone/chunk-5RF4QDDA.js +6 -0
- package/dist/standalone/chunk-5U2THBI7.js +1 -0
- package/dist/standalone/chunk-5Y3QLNWX.js +1 -0
- package/dist/standalone/chunk-65OTWFS3.js +1 -0
- package/dist/standalone/chunk-6DWCIIHE.js +1 -0
- package/dist/standalone/chunk-6ST5ECQA.js +1 -0
- package/dist/standalone/chunk-7J5N6DGQ.js +1 -0
- package/dist/standalone/chunk-7LQWFOEU.js +1 -0
- package/dist/standalone/chunk-7QIFDWQV.js +1 -0
- package/dist/standalone/chunk-7RXOPYR5.js +1 -0
- package/dist/standalone/chunk-7T7UOTYK.js +1 -0
- package/dist/standalone/chunk-7YEFOSPH.js +1 -0
- package/dist/standalone/chunk-AVAC26HJ.js +1 -0
- package/dist/standalone/chunk-B43FTQJ7.js +1 -0
- package/dist/standalone/chunk-BEH5N5ZA.js +1 -0
- package/dist/standalone/chunk-BGBLQ563.js +1 -0
- package/dist/standalone/chunk-BNUJ7QMG.js +3 -0
- package/dist/standalone/chunk-C43X4M5U.js +1 -0
- package/dist/standalone/chunk-CFPZYHPY.js +2 -0
- package/dist/standalone/chunk-D7XXWV4E.js +1 -0
- package/dist/standalone/chunk-DVOBKIUX.js +1 -0
- package/dist/standalone/chunk-EKRN4ZQM.js +1 -0
- package/dist/standalone/chunk-ESVP44Y3.js +1 -0
- package/dist/standalone/chunk-EVN46TVV.js +1 -0
- package/dist/standalone/chunk-EXFBIISG.js +2 -0
- package/dist/standalone/chunk-F5QWLENA.js +1 -0
- package/dist/standalone/chunk-F6GOKFMU.js +3 -0
- package/dist/standalone/chunk-FGTK44LR.js +1 -0
- package/dist/standalone/chunk-FXCBF4XT.js +1 -0
- package/dist/standalone/chunk-GMR677FL.js +1 -0
- package/dist/standalone/chunk-GRL5MG3Z.js +1 -0
- package/dist/standalone/chunk-GSPTEMYN.js +1 -0
- package/dist/standalone/chunk-GXZAXNZI.js +1 -0
- package/dist/standalone/chunk-H7NIIBHH.js +1 -0
- package/dist/standalone/chunk-HP2UCWND.js +1 -0
- package/dist/standalone/chunk-HPFLBYRI.js +1 -0
- package/dist/standalone/chunk-IC4L6G56.js +1 -0
- package/dist/standalone/chunk-IDNNI63H.js +1 -0
- package/dist/standalone/chunk-ILNELDFC.js +1 -0
- package/dist/standalone/chunk-IVFHIQOT.js +1 -0
- package/dist/standalone/chunk-JN2Y24PY.js +1 -0
- package/dist/standalone/chunk-KDOC2DP5.js +1 -0
- package/dist/standalone/chunk-KUVMORDQ.js +1 -0
- package/dist/standalone/chunk-KYF2E5CJ.js +1 -0
- package/dist/standalone/chunk-L7N7F3DA.js +1 -0
- package/dist/standalone/chunk-LE56LPNH.js +13 -0
- package/dist/standalone/chunk-LEDWUPXM.js +1 -0
- package/dist/standalone/chunk-LFKCLLPT.js +1 -0
- package/dist/standalone/chunk-LFXFP4IF.js +1 -0
- package/dist/standalone/chunk-LJDP7NRB.js +1 -0
- package/dist/standalone/chunk-LLXFYRGQ.js +1 -0
- package/dist/standalone/chunk-M536Y2KX.js +1 -0
- package/dist/standalone/chunk-MIQTKZAR.js +1 -0
- package/dist/standalone/chunk-OHKRN65U.js +1 -0
- package/dist/standalone/chunk-P24JBHEZ.js +4 -0
- package/dist/standalone/chunk-PF7V3G2Z.js +62 -0
- package/dist/standalone/chunk-PWWHP76O.js +1 -0
- package/dist/standalone/chunk-QBWRC5YX.js +1 -0
- package/dist/standalone/chunk-QGKAJTQQ.js +1 -0
- package/dist/standalone/chunk-QLJJ5YYZ.js +1 -0
- package/dist/standalone/chunk-QVEHPYA5.js +1 -0
- package/dist/standalone/chunk-QWGT25SE.js +1 -0
- package/dist/standalone/chunk-QWJ3NPE3.js +1 -0
- package/dist/standalone/chunk-RAA2RGG6.js +1 -0
- package/dist/standalone/chunk-RBU52M5T.js +1 -0
- package/dist/standalone/chunk-SA3MDZC3.js +1 -0
- package/dist/standalone/chunk-SD4BERSA.js +1 -0
- package/dist/standalone/chunk-SFDOII3B.js +1 -0
- package/dist/standalone/chunk-SKHEGARW.js +1 -0
- package/dist/standalone/chunk-SMIESS7P.js +1 -0
- package/dist/standalone/chunk-T2JIUFOD.js +4 -0
- package/dist/standalone/chunk-T6VMSOBB.js +1 -0
- package/dist/standalone/chunk-THIXMMZD.js +1 -0
- package/dist/standalone/chunk-TJ2WZ5OP.js +1 -0
- package/dist/standalone/chunk-TLHJRWNK.js +1 -0
- package/dist/standalone/chunk-UIS34ZPB.js +8 -0
- package/dist/standalone/chunk-UNUU7CJJ.js +1 -0
- package/dist/standalone/chunk-UZERI5YC.js +1 -0
- package/dist/standalone/chunk-V53KNYRN.js +1 -0
- package/dist/standalone/chunk-VPAXCQ2Y.js +4 -0
- package/dist/standalone/chunk-X2FQ6B5V.js +1 -0
- package/dist/standalone/chunk-XBDKZZ67.js +1 -0
- package/dist/standalone/chunk-XEDU5FO4.js +1 -0
- package/dist/standalone/chunk-XQBTNJUQ.js +1 -0
- package/dist/standalone/chunk-XQCVZAGU.js +1 -0
- package/dist/standalone/chunk-XQGANNLS.js +1 -0
- package/dist/standalone/chunk-XSD4Y6SQ.js +1 -0
- package/dist/standalone/chunk-XXQUMVWH.js +1 -0
- package/dist/standalone/chunk-YD5NF6UT.js +1 -0
- package/dist/standalone/chunk-YI3WYUXK.js +1 -0
- package/dist/standalone/chunk-ZJGP6EKR.js +1 -0
- package/dist/standalone/chunk-ZNNAGR6N.js +1 -0
- package/dist/standalone/studio.js +9 -356
- package/dist/styles.css +2 -2
- package/package.json +17 -15
- package/dist/packem_shared/ADMIN_FUNCTIONS-DmBqMZ-z.js +0 -45
- package/dist/packem_shared/ApiDocsPanel-C5-yJ1p7.js +0 -842
- package/dist/packem_shared/ApiReferencePanel-1vubqG5s.js +0 -229
- package/dist/packem_shared/ApiTab-W3no0KOj.js +0 -251
- package/dist/packem_shared/AuditPanel-Bq4o_IqT.js +0 -212
- package/dist/packem_shared/CommandPalette-BtgkBzZI.js +0 -373
- package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
- package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
- package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
- package/dist/packem_shared/DataBrowser-CtBe1So9.js +0 -4542
- package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
- package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
- package/dist/packem_shared/ExportImportPanel-dxY56TDF.js +0 -193
- package/dist/packem_shared/FileBrowser-Dhy4zES8.js +0 -2932
- package/dist/packem_shared/FunctionRunner--fQJRPAD.js +0 -343
- package/dist/packem_shared/FunctionStatsPanel-BjRUA_G3.js +0 -432
- package/dist/packem_shared/GlobalDataBrowser-BTEmGrph.js +0 -318
- package/dist/packem_shared/HealthPanel-PxclMWmA.js +0 -640
- package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
- package/dist/packem_shared/InsightsPanel-CWS_C-xW.js +0 -423
- package/dist/packem_shared/LogsPanel-CTW8CFcM.js +0 -839
- package/dist/packem_shared/MailPanel-BwkvfIHF.js +0 -447
- package/dist/packem_shared/MetricsPanel-BLuOhZQ4.js +0 -1625
- package/dist/packem_shared/MigrationsPanel-DT3lnwHF.js +0 -246
- package/dist/packem_shared/OpenRpcReferencePanel-vbcYbv3V.js +0 -191
- package/dist/packem_shared/PitrPanel-CdErL7EJ.js +0 -252
- package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
- package/dist/packem_shared/ScheduledJobs-CabfKbyM.js +0 -159
- package/dist/packem_shared/SchemaViewer-LJDcmNIO.js +0 -2512
- package/dist/packem_shared/SecurityAdvisorPanel-C_ETsPih.js +0 -79
- package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
- package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
- package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
- package/dist/packem_shared/Studio-BmSGSIuY.js +0 -33
- package/dist/packem_shared/StudioApp-D4azxYBu.js +0 -657
- package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
- package/dist/packem_shared/TableEditor-ChfUOZec.js +0 -371
- package/dist/packem_shared/advisor-view-CGcfMiPq.js +0 -159
- package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
- package/dist/packem_shared/app.d-CCmwDEVs.d.ts +0 -300
- package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
- package/dist/packem_shared/bar-chart-CzJAgqkp.js +0 -3245
- package/dist/packem_shared/button-BhsN2uZH.js +0 -49
- package/dist/packem_shared/card-DURq3ElK.js +0 -175
- package/dist/packem_shared/cf-links-2cktDedA.js +0 -8
- package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
- package/dist/packem_shared/data-grid-B5CaV3wS.js +0 -183
- package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
- package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
- package/dist/packem_shared/grid-features-CzUfqgsM.js +0 -840
- package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
- package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
- package/dist/packem_shared/label-D8ykjn5J.js +0 -46
- package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
- package/dist/packem_shared/reference-view-B4E49Lip.js +0 -2180
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/packem_shared/sparkline-10dG-_f0.js +0 -93
- package/dist/packem_shared/sql-editor-panel-BFRpzj6r.js +0 -2562
- package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
- package/dist/packem_shared/studio-H9fuQgSj.js +0 -10303
- package/dist/packem_shared/table-_RzNvy3R.js +0 -246
- package/dist/packem_shared/table-list-sidebar-Bg7uzbvC.js +0 -832
- package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
- package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
- package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
- package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
- package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
- package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as G}from"react/compiler-runtime";import{useLunora as le}from"@lunora/react";import{useState as P}from"react";import{u as j}from"../packem_shared/button-BkCrNcAs.js";import{u as St,c as kt}from"../packem_shared/card-CIDGUN6K.js";import{E as et}from"../packem_shared/empty-state-Cg7t_8qu.js";import{p as me,d as Nt,m as bt,f as At,n as Ot,u as de}from"../packem_shared/table-DdJBrClo.js";import{T as Ze}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{u as ie,a as Mt}from"../packem_shared/use-async-submit-H68GHPz8.js";import{useAutoRefresh as Dt}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{useT as W}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{h as S,f as Et,e as Lt,i as jt}from"../packem_shared/internal-AtZ4bTal.js";import{u as V}from"../packem_shared/input-JHu63lTv.js";import{p as Pt}from"../packem_shared/label-6uP1obNF.js";import{M as Jt}from"../packem_shared/modal-shell-CUwwWC2o.js";import{l as _t}from"../packem_shared/textarea-Bu2-jKAs.js";import{jsx as n,jsxs as M,Fragment as ht}from"react/jsx-runtime";const Ft=t=>{const e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},Ut=t=>{const e=Ft(t),r={};for(const[s,c]of Object.entries(e)){if(!Array.isArray(c)||c.some(l=>typeof l!="string"))throw new TypeError(`"${s}" must map to an array of action strings`);r[s]=c}return r},Rt=t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),Q=t=>{const e=G(6),{children:r,htmlFor:s,label:c}=t;let l;e[0]!==s||e[1]!==c?(l=n(Pt,{htmlFor:s,children:c}),e[0]=s,e[1]=c,e[2]=l):l=e[2];let o;return e[3]!==r||e[4]!==l?(o=M("div",{className:"flex flex-col gap-1",children:[l,r]}),e[3]=r,e[4]=l,e[5]=o):o=e[5],o},se=({busy:t,canSubmit:e,children:r,destructive:s=!1,error:c,onClose:l,onSubmit:o,submitLabel:a,testId:i,title:m})=>{const d=W();return M(Jt,{label:m,onClose:l,panelTestId:`${i}-panel`,testId:`${i}-overlay`,variant:"dialog",children:[n("h2",{className:"text-sm font-semibold text-foreground",children:m}),r,c!==null&&n("p",{className:"text-sm text-destructive","data-testid":`${i}-error`,role:"alert",children:c}),M("div",{className:"flex justify-end gap-2 pt-1",children:[n(j,{"data-testid":`${i}-cancel`,onClick:l,size:"sm",type:"button",variant:"outline",children:d("Cancel")}),n(j,{"data-testid":`${i}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:s?"destructive":"default",children:t?d("Saving…"):a})]})]})},$t=t=>{const e=G(79),{mode:r,onClose:s,onDone:c,org:l}=t,o=le(),a=W(),{busy:i,error:m,run:d}=ie();let p;e[0]!==l?(p=l?S(l.name):"",e[0]=l,e[1]=p):p=e[1];const[u,g]=P(p);let C;e[2]!==l?(C=l?S(l.slug):"",e[2]=l,e[3]=C):C=e[3];const[b,v]=P(C);let $;e[4]!==l?($=l?S(l.logo):"",e[4]=l,e[5]=$):$=e[5];const[f,w]=P($),[h,x]=P("");let y;e[6]!==r||e[7]!==l?.metadata?(y=r==="edit"?Rt(l?.metadata):"",e[6]=r,e[7]=l?.metadata,e[8]=y):y=e[8];const[I,z]=P(y);let O;e[9]!==o||e[10]!==f||e[11]!==I||e[12]!==r||e[13]!==u||e[14]!==s||e[15]!==c||e[16]!==l?.id||e[17]!==h||e[18]!==d||e[19]!==b?(O=()=>{d(async()=>{const E=I.trim()===""?void 0:Ft(I);r==="create"?await o.createAuthOrganization({logo:f.trim()===""?void 0:f.trim(),metadata:E,name:u.trim(),ownerId:h.trim()===""?void 0:h.trim(),slug:b.trim()===""?void 0:b.trim()}):await o.updateAuthOrganization({logo:f.trim()===""?void 0:f.trim(),metadata:E,name:u.trim()===""?void 0:u.trim(),organizationId:S(l?.id),slug:b.trim()===""?void 0:b.trim()}),c(),s()})},e[9]=o,e[10]=f,e[11]=I,e[12]=r,e[13]=u,e[14]=s,e[15]=c,e[16]=l?.id,e[17]=h,e[18]=d,e[19]=b,e[20]=O):O=e[20];const N=O;let k;e[21]!==r||e[22]!==u?(k=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=k):k=e[23];let D;e[24]!==r||e[25]!==a?(D=a(r==="create"?"Create":"Save"),e[24]=r,e[25]=a,e[26]=D):D=e[26];let _;e[27]!==r||e[28]!==a?(_=a(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=a,e[29]=_):_=e[29];let J;e[30]!==a?(J=a("name"),e[30]=a,e[31]=J):J=e[31];let q;e[32]===Symbol.for("react.memo_cache_sentinel")?(q=E=>{g(E.target.value)},e[32]=q):q=e[32];let U;e[33]!==u?(U=n(V,{"data-testid":"org-form-name",id:"org-form-name",onChange:q,value:u}),e[33]=u,e[34]=U):U=e[34];let L;e[35]!==U||e[36]!==J?(L=n(Q,{htmlFor:"org-form-name",label:J,children:U}),e[35]=U,e[36]=J,e[37]=L):L=e[37];let B;e[38]!==a?(B=a("Slug (optional — derived from name)"),e[38]=a,e[39]=B):B=e[39];let K;e[40]===Symbol.for("react.memo_cache_sentinel")?(K=E=>{v(E.target.value)},e[40]=K):K=e[40];let F;e[41]!==b?(F=n(V,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:K,value:b}),e[41]=b,e[42]=F):F=e[42];let R;e[43]!==B||e[44]!==F?(R=n(Q,{htmlFor:"org-form-slug",label:B,children:F}),e[43]=B,e[44]=F,e[45]=R):R=e[45];let H;e[46]!==a?(H=a("Logo URL (optional)"),e[46]=a,e[47]=H):H=e[47];let re;e[48]===Symbol.for("react.memo_cache_sentinel")?(re=E=>{w(E.target.value)},e[48]=re):re=e[48];let X;e[49]!==f?(X=n(V,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:re,value:f}),e[49]=f,e[50]=X):X=e[50];let Y;e[51]!==H||e[52]!==X?(Y=n(Q,{htmlFor:"org-form-logo",label:H,children:X}),e[51]=H,e[52]=X,e[53]=Y):Y=e[53];let Z;e[54]!==r||e[55]!==h||e[56]!==a?(Z=r==="create"&&n(Q,{htmlFor:"org-form-owner",label:a("Owner user id (optional)"),children:n(V,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:E=>{x(E.target.value)},value:h})}),e[54]=r,e[55]=h,e[56]=a,e[57]=Z):Z=e[57];let ee;e[58]!==a?(ee=a("Metadata (JSON, optional)"),e[58]=a,e[59]=ee):ee=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=E=>{z(E.target.value)},e[60]=oe):oe=e[60];let te;e[61]!==I?(te=n(_t,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:I}),e[61]=I,e[62]=te):te=e[62];let A;e[63]!==ee||e[64]!==te?(A=n(Q,{htmlFor:"org-form-metadata",label:ee,children:te}),e[63]=ee,e[64]=te,e[65]=A):A=e[65];let ne;return e[66]!==i||e[67]!==m||e[68]!==s||e[69]!==N||e[70]!==L||e[71]!==R||e[72]!==Y||e[73]!==Z||e[74]!==A||e[75]!==k||e[76]!==D||e[77]!==_?(ne=M(se,{busy:i,canSubmit:k,error:m,onClose:s,onSubmit:N,submitLabel:D,testId:"org-form",title:_,children:[L,R,Y,Z,A]}),e[66]=i,e[67]=m,e[68]=s,e[69]=N,e[70]=L,e[71]=R,e[72]=Y,e[73]=Z,e[74]=A,e[75]=k,e[76]=D,e[77]=_,e[78]=ne):ne=e[78],ne},Bt=t=>{const e=G(40),{onClose:r,onDone:s,organizationId:c}=t,l=le(),o=W(),{busy:a,error:i,run:m}=ie(),[d,p]=P(""),[u,g]=P("");let C;e[0]!==l||e[1]!==r||e[2]!==s||e[3]!==c||e[4]!==u||e[5]!==m||e[6]!==d?(C=()=>{m(async()=>{await l.addAuthOrgMember({organizationId:c,role:u.trim()===""?void 0:u.trim(),userId:d.trim()}),s(),r()})},e[0]=l,e[1]=r,e[2]=s,e[3]=c,e[4]=u,e[5]=m,e[6]=d,e[7]=C):C=e[7];const b=C;let v;e[8]!==d?(v=d.trim(),e[8]=d,e[9]=v):v=e[9];const $=v!=="";let f;e[10]!==o?(f=o("Add member"),e[10]=o,e[11]=f):f=e[11];let w;e[12]!==o?(w=o("Add member"),e[12]=o,e[13]=w):w=e[13];let h;e[14]!==o?(h=o("User id"),e[14]=o,e[15]=h):h=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=_=>{p(_.target.value)},e[16]=x):x=e[16];let y;e[17]!==d?(y=n(V,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:x,value:d}),e[17]=d,e[18]=y):y=e[18];let I;e[19]!==h||e[20]!==y?(I=n(Q,{htmlFor:"org-add-member-user",label:h,children:y}),e[19]=h,e[20]=y,e[21]=I):I=e[21];let z;e[22]!==o?(z=o("Role (optional)"),e[22]=o,e[23]=z):z=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=_=>{g(_.target.value)},e[24]=O):O=e[24];let N;e[25]!==u?(N=n(V,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:u}),e[25]=u,e[26]=N):N=e[26];let k;e[27]!==z||e[28]!==N?(k=n(Q,{htmlFor:"org-add-member-role",label:z,children:N}),e[27]=z,e[28]=N,e[29]=k):k=e[29];let D;return e[30]!==a||e[31]!==i||e[32]!==r||e[33]!==b||e[34]!==k||e[35]!==$||e[36]!==f||e[37]!==w||e[38]!==I?(D=M(se,{busy:a,canSubmit:$,error:i,onClose:r,onSubmit:b,submitLabel:f,testId:"org-add-member",title:w,children:[I,k]}),e[30]=a,e[31]=i,e[32]=r,e[33]=b,e[34]=k,e[35]=$,e[36]=f,e[37]=w,e[38]=I,e[39]=D):D=e[39],D},Ht=t=>{const e=G(40),{onClose:r,onDone:s,organizationId:c}=t,l=le(),o=W(),{busy:a,error:i,run:m}=ie(),[d,p]=P(""),[u,g]=P("");let C;e[0]!==l||e[1]!==d||e[2]!==r||e[3]!==s||e[4]!==c||e[5]!==u||e[6]!==m?(C=()=>{m(async()=>{await l.inviteAuthOrgMember({email:d.trim(),organizationId:c,role:u.trim()===""?void 0:u.trim()}),s(),r()})},e[0]=l,e[1]=d,e[2]=r,e[3]=s,e[4]=c,e[5]=u,e[6]=m,e[7]=C):C=e[7];const b=C;let v;e[8]!==d?(v=d.trim(),e[8]=d,e[9]=v):v=e[9];const $=v!=="";let f;e[10]!==o?(f=o("Send invitation"),e[10]=o,e[11]=f):f=e[11];let w;e[12]!==o?(w=o("Invite member"),e[12]=o,e[13]=w):w=e[13];let h;e[14]!==o?(h=o("email"),e[14]=o,e[15]=h):h=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=_=>{p(_.target.value)},e[16]=x):x=e[16];let y;e[17]!==d?(y=n(V,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:x,type:"email",value:d}),e[17]=d,e[18]=y):y=e[18];let I;e[19]!==h||e[20]!==y?(I=n(Q,{htmlFor:"org-invite-member-email",label:h,children:y}),e[19]=h,e[20]=y,e[21]=I):I=e[21];let z;e[22]!==o?(z=o("Role (optional)"),e[22]=o,e[23]=z):z=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=_=>{g(_.target.value)},e[24]=O):O=e[24];let N;e[25]!==u?(N=n(V,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:u}),e[25]=u,e[26]=N):N=e[26];let k;e[27]!==z||e[28]!==N?(k=n(Q,{htmlFor:"org-invite-member-role",label:z,children:N}),e[27]=z,e[28]=N,e[29]=k):k=e[29];let D;return e[30]!==a||e[31]!==i||e[32]!==r||e[33]!==b||e[34]!==k||e[35]!==$||e[36]!==f||e[37]!==w||e[38]!==I?(D=M(se,{busy:a,canSubmit:$,error:i,onClose:r,onSubmit:b,submitLabel:f,testId:"org-invite-member",title:w,children:[I,k]}),e[30]=a,e[31]=i,e[32]=r,e[33]=b,e[34]=k,e[35]=$,e[36]=f,e[37]=w,e[38]=I,e[39]=D):D=e[39],D},qt=t=>{const e=G(32),{member:r,onClose:s,onDone:c}=t,l=le(),o=W(),{busy:a,error:i,run:m}=ie();let d;e[0]!==r.role?(d=S(r.role),e[0]=r.role,e[1]=d):d=e[1];const[p,u]=P(d);let g;e[2]!==l||e[3]!==r.id||e[4]!==s||e[5]!==c||e[6]!==p||e[7]!==m?(g=()=>{m(async()=>{await l.setAuthOrgMemberRole({memberId:S(r.id),role:p.trim()}),c(),s()})},e[2]=l,e[3]=r.id,e[4]=s,e[5]=c,e[6]=p,e[7]=m,e[8]=g):g=e[8];const C=g;let b;e[9]!==p?(b=p.trim(),e[9]=p,e[10]=b):b=e[10];const v=b!=="";let $;e[11]!==o?($=o("Save"),e[11]=o,e[12]=$):$=e[12];let f;e[13]!==o?(f=o("Change member role"),e[13]=o,e[14]=f):f=e[14];let w;e[15]!==o?(w=o("Role"),e[15]=o,e[16]=w):w=e[16];let h;e[17]===Symbol.for("react.memo_cache_sentinel")?(h=z=>{u(z.target.value)},e[17]=h):h=e[17];let x;e[18]!==p?(x=n(V,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:h,value:p}),e[18]=p,e[19]=x):x=e[19];let y;e[20]!==w||e[21]!==x?(y=n(Q,{htmlFor:"org-member-role-value",label:w,children:x}),e[20]=w,e[21]=x,e[22]=y):y=e[22];let I;return e[23]!==a||e[24]!==i||e[25]!==s||e[26]!==C||e[27]!==y||e[28]!==v||e[29]!==$||e[30]!==f?(I=n(se,{busy:a,canSubmit:v,error:i,onClose:s,onSubmit:C,submitLabel:$,testId:"org-member-role",title:f,children:y}),e[23]=a,e[24]=i,e[25]=s,e[26]=C,e[27]=y,e[28]=v,e[29]=$,e[30]=f,e[31]=I):I=e[31],I},xt=t=>{const e=G(36),{mode:r,onClose:s,onDone:c,organizationId:l,team:o}=t,a=le(),i=W(),{busy:m,error:d,run:p}=ie();let u;e[0]!==o?(u=o?S(o.name):"",e[0]=o,e[1]=u):u=e[1];const[g,C]=P(u);let b;e[2]!==a||e[3]!==r||e[4]!==g||e[5]!==s||e[6]!==c||e[7]!==l||e[8]!==p||e[9]!==o?.id?(b=()=>{p(async()=>{await(r==="create"?a.createAuthOrgTeam({name:g.trim(),organizationId:l}):a.updateAuthOrgTeam({name:g.trim(),teamId:S(o?.id)})),c(),s()})},e[2]=a,e[3]=r,e[4]=g,e[5]=s,e[6]=c,e[7]=l,e[8]=p,e[9]=o?.id,e[10]=b):b=e[10];const v=b;let $;e[11]!==g?($=g.trim(),e[11]=g,e[12]=$):$=e[12];const f=$!=="";let w;e[13]!==r||e[14]!==i?(w=i(r==="create"?"Create":"Save"),e[13]=r,e[14]=i,e[15]=w):w=e[15];let h;e[16]!==r||e[17]!==i?(h=i(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=i,e[18]=h):h=e[18];let x;e[19]!==i?(x=i("name"),e[19]=i,e[20]=x):x=e[20];let y;e[21]===Symbol.for("react.memo_cache_sentinel")?(y=N=>{C(N.target.value)},e[21]=y):y=e[21];let I;e[22]!==g?(I=n(V,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:y,value:g}),e[22]=g,e[23]=I):I=e[23];let z;e[24]!==x||e[25]!==I?(z=n(Q,{htmlFor:"org-team-form-name",label:x,children:I}),e[24]=x,e[25]=I,e[26]=z):z=e[26];let O;return e[27]!==m||e[28]!==d||e[29]!==s||e[30]!==v||e[31]!==z||e[32]!==f||e[33]!==w||e[34]!==h?(O=n(se,{busy:m,canSubmit:f,error:d,onClose:s,onSubmit:v,submitLabel:w,testId:"org-team-form",title:h,children:z}),e[27]=m,e[28]=d,e[29]=s,e[30]=v,e[31]=z,e[32]=f,e[33]=w,e[34]=h,e[35]=O):O=e[35],O},Kt=t=>{const e=G(30),{onClose:r,onDone:s,teamId:c}=t,l=le(),o=W(),{busy:a,error:i,run:m}=ie(),[d,p]=P("");let u;e[0]!==l||e[1]!==r||e[2]!==s||e[3]!==m||e[4]!==c||e[5]!==d?(u=()=>{m(async()=>{await l.addAuthOrgTeamMember({teamId:c,userId:d.trim()}),s(),r()})},e[0]=l,e[1]=r,e[2]=s,e[3]=m,e[4]=c,e[5]=d,e[6]=u):u=e[6];const g=u;let C;e[7]!==d?(C=d.trim(),e[7]=d,e[8]=C):C=e[8];const b=C!=="";let v;e[9]!==o?(v=o("Add member"),e[9]=o,e[10]=v):v=e[10];let $;e[11]!==o?($=o("Add team member"),e[11]=o,e[12]=$):$=e[12];let f;e[13]!==o?(f=o("User id"),e[13]=o,e[14]=f):f=e[14];let w;e[15]===Symbol.for("react.memo_cache_sentinel")?(w=I=>{p(I.target.value)},e[15]=w):w=e[15];let h;e[16]!==d?(h=n(V,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:w,value:d}),e[16]=d,e[17]=h):h=e[17];let x;e[18]!==f||e[19]!==h?(x=n(Q,{htmlFor:"org-team-add-member-user",label:f,children:h}),e[18]=f,e[19]=h,e[20]=x):x=e[20];let y;return e[21]!==a||e[22]!==i||e[23]!==r||e[24]!==g||e[25]!==b||e[26]!==v||e[27]!==$||e[28]!==x?(y=n(se,{busy:a,canSubmit:b,error:i,onClose:r,onSubmit:g,submitLabel:v,testId:"org-team-add-member",title:$,children:x}),e[21]=a,e[22]=i,e[23]=r,e[24]=g,e[25]=b,e[26]=v,e[27]=$,e[28]=x,e[29]=y):y=e[29],y},zt=t=>{const e=G(47),{mode:r,onClose:s,onDone:c,organizationId:l,role:o}=t,a=le(),i=W(),{busy:m,error:d,run:p}=ie();let u;e[0]!==o?(u=o?S(o.role):"",e[0]=o,e[1]=u):u=e[1];const[g,C]=P(u);let b;e[2]!==r||e[3]!==o?.permission?(b=r==="edit"?Rt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=b):b=e[4];const[v,$]=P(b);let f;e[5]!==a||e[6]!==r||e[7]!==g||e[8]!==s||e[9]!==c||e[10]!==l||e[11]!==v||e[12]!==o?.id||e[13]!==p?(f=()=>{p(async()=>{const _=Ut(v);await(r==="create"?a.createAuthOrgRole({organizationId:l,permission:_,role:g.trim()}):a.updateAuthOrgRole({permission:_,roleId:S(o?.id)})),c(),s()})},e[5]=a,e[6]=r,e[7]=g,e[8]=s,e[9]=c,e[10]=l,e[11]=v,e[12]=o?.id,e[13]=p,e[14]=f):f=e[14];const w=f;let h;e[15]!==r||e[16]!==g||e[17]!==v?(h=v.trim()!==""&&(r==="edit"||g.trim()!==""),e[15]=r,e[16]=g,e[17]=v,e[18]=h):h=e[18];let x;e[19]!==r||e[20]!==i?(x=i(r==="create"?"Create":"Save"),e[19]=r,e[20]=i,e[21]=x):x=e[21];let y;e[22]!==r||e[23]!==i?(y=i(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=i,e[24]=y):y=e[24];let I;e[25]!==r||e[26]!==g||e[27]!==i?(I=r==="create"&&n(Q,{htmlFor:"org-role-form-name",label:i("Role name"),children:n(V,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:_=>{C(_.target.value)},value:g})}),e[25]=r,e[26]=g,e[27]=i,e[28]=I):I=e[28];let z;e[29]!==i?(z=i('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=i,e[30]=z):z=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=_=>{$(_.target.value)},e[31]=O):O=e[31];let N;e[32]!==v?(N=n(_t,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:v}),e[32]=v,e[33]=N):N=e[33];let k;e[34]!==N||e[35]!==z?(k=n(Q,{htmlFor:"org-role-form-permission",label:z,children:N}),e[34]=N,e[35]=z,e[36]=k):k=e[36];let D;return e[37]!==m||e[38]!==d||e[39]!==s||e[40]!==w||e[41]!==k||e[42]!==h||e[43]!==x||e[44]!==y||e[45]!==I?(D=M(se,{busy:m,canSubmit:h,error:d,onClose:s,onSubmit:w,submitLabel:x,testId:"org-role-form",title:y,children:[I,k]}),e[37]=m,e[38]=d,e[39]=s,e[40]=w,e[41]=k,e[42]=h,e[43]=x,e[44]=y,e[45]=I,e[46]=D):D=e[46],D},Tt=t=>{const e=G(18),{action:r,message:s,onClose:c,onDone:l,testId:o,title:a}=t,i=W(),{busy:m,error:d,run:p}=ie();let u;e[0]!==r||e[1]!==c||e[2]!==l||e[3]!==p?(u=()=>{p(async()=>{await r(),l(),c()})},e[0]=r,e[1]=c,e[2]=l,e[3]=p,e[4]=u):u=e[4];const g=u;let C;e[5]!==i?(C=i("Delete"),e[5]=i,e[6]=C):C=e[6];let b;e[7]!==s?(b=n("p",{className:"text-sm text-muted-foreground",children:s}),e[7]=s,e[8]=b):b=e[8];let v;return e[9]!==m||e[10]!==d||e[11]!==c||e[12]!==g||e[13]!==C||e[14]!==b||e[15]!==o||e[16]!==a?(v=n(se,{busy:m,canSubmit:!0,destructive:!0,error:d,onClose:c,onSubmit:g,submitLabel:C,testId:o,title:a,children:b}),e[9]=m,e[10]=d,e[11]=c,e[12]=g,e[13]=C,e[14]=b,e[15]=o,e[16]=a,e[17]=v):v=e[17],v},tt=t=>{const e=G(13),{action:r,children:s,heading:c,testId:l}=t;let o;e[0]!==c?(o=n("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),e[0]=c,e[1]=o):o=e[1];let a;e[2]!==r?(a=r!==void 0&&n("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=a):a=e[3];let i;e[4]!==o||e[5]!==a?(i=M("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,a]}),e[4]=o,e[5]=a,e[6]=i):i=e[6];let m;e[7]!==s?(m=n(St,{className:"px-0",children:s}),e[7]=s,e[8]=m):m=e[8];let d;return e[9]!==i||e[10]!==m||e[11]!==l?(d=M(kt,{className:"overflow-hidden py-0","data-testid":l,children:[i,m]}),e[9]=i,e[10]=m,e[11]=l,e[12]=d):d=e[12],d},rt=t=>{const e=G(23),{columns:r,rowActions:s,rowPrefix:c,rows:l}=t,o=W();let a;e[0]!==r?(a=r.map(Gt),e[0]=r,e[1]=a):a=e[1];let i;e[2]!==o?(i=o("Actions"),e[2]=o,e[3]=i):i=e[3];let m;e[4]!==i?(m=n(me,{"aria-label":i}),e[4]=i,e[5]=m):m=e[5];let d;e[6]!==a||e[7]!==m?(d=n(Nt,{children:M(bt,{children:[a,m]})}),e[6]=a,e[7]=m,e[8]=d):d=e[8];let p;if(e[9]!==r||e[10]!==s||e[11]!==c||e[12]!==l){let C;e[14]!==r||e[15]!==s||e[16]!==c?(C=b=>{const v=S(b.id);return M(bt,{"data-testid":`${c}-${v}`,children:[r.map($=>n(de,{className:$.className,children:$.render(b)},$.head)),n(de,{children:n("div",{className:"flex justify-end gap-1",children:s(b)})})]},v)},e[14]=r,e[15]=s,e[16]=c,e[17]=C):C=e[17],p=l.map(C),e[9]=r,e[10]=s,e[11]=c,e[12]=l,e[13]=p}else p=e[13];let u;e[18]!==p?(u=n(At,{children:p}),e[18]=p,e[19]=u):u=e[19];let g;return e[20]!==d||e[21]!==u?(g=M(Ot,{children:[d,u]}),e[20]=d,e[21]=u,e[22]=g):g=e[22],g},Qt=t=>{const e=G(219),{organizationId:r,rolesEnabled:s,teamsEnabled:c}=t,l=le(),o=W(),[a,i]=P(null),[m,d]=P(null),[p,u]=P(!1),[g,C]=P(null);let b;e[0]!==r?(b=["lunora-auth-org-members",r],e[0]=r,e[1]=b):b=e[1];let v;e[2]!==l||e[3]!==r?(v=()=>l.listAuthOrgMembers({limit:200,organizationId:r}),e[2]=l,e[3]=r,e[4]=v):v=e[4];const $=Ze(b,v);let f;e[5]!==r?(f=["lunora-auth-org-invitations",r],e[5]=r,e[6]=f):f=e[6];let w;e[7]!==l||e[8]!==r?(w=()=>l.listAuthOrgInvitations({limit:200,organizationId:r}),e[7]=l,e[8]=r,e[9]=w):w=e[9];const h=Ze(f,w);let x;e[10]!==r?(x=["lunora-auth-org-teams",r],e[10]=r,e[11]=x):x=e[11];let y;e[12]!==l||e[13]!==r?(y=()=>l.listAuthOrgTeams({limit:200,organizationId:r}),e[12]=l,e[13]=r,e[14]=y):y=e[14];let I;e[15]!==c?(I={enabled:c},e[15]=c,e[16]=I):I=e[16];const z=Ze(x,y,I);let O;e[17]!==r?(O=["lunora-auth-org-roles",r],e[17]=r,e[18]=O):O=e[18];let N;e[19]!==l||e[20]!==r?(N=()=>l.listAuthOrgRoles({limit:200,organizationId:r}),e[19]=l,e[20]=r,e[21]=N):N=e[21];let k;e[22]!==s?(k={enabled:s},e[22]=s,e[23]=k):k=e[23];const D=Ze(O,N,k);let _;e[24]!==m?(_=["lunora-auth-org-team-members",m],e[24]=m,e[25]=_):_=e[25];let J;e[26]!==l||e[27]!==m?(J=()=>l.listAuthOrgTeamMembers({limit:200,teamId:m??""}),e[26]=l,e[27]=m,e[28]=J):J=e[28];const q=m!==null;let U;e[29]!==q?(U={enabled:q},e[29]=q,e[30]=U):U=e[30];const L=Ze(_,J,U);let B;e[31]!==$.data?.rows?(B=$.data?.rows??[],e[31]=$.data?.rows,e[32]=B):B=e[32];const K=B;let F;e[33]!==h.data?.rows?(F=h.data?.rows??[],e[33]=h.data?.rows,e[34]=F):F=e[34];const R=F;let H;e[35]!==z.data?.rows?(H=z.data?.rows??[],e[35]=z.data?.rows,e[36]=H):H=e[36];const re=H;let X;e[37]!==D.data?.rows?(X=D.data?.rows??[],e[37]=D.data?.rows,e[38]=X):X=e[38];const Y=X;let Z;e[39]!==m||e[40]!==L?(Z=m===null?[]:L.data?.rows??[],e[39]=m,e[40]=L,e[41]=Z):Z=e[41];const ee=Z,oe=$.error??h.error??z.error??D.error??L.error;let te;e[42]!==h||e[43]!==$||e[44]!==s||e[45]!==D||e[46]!==m||e[47]!==L||e[48]!==c||e[49]!==z?(te=()=>{$.refetch(),h.refetch(),c&&z.refetch(),s&&D.refetch(),m!==null&&L.refetch()},e[42]=h,e[43]=$,e[44]=s,e[45]=D,e[46]=m,e[47]=L,e[48]=c,e[49]=z,e[50]=te):te=e[50];const A=te;Dt(A,!0);let ne;e[51]===Symbol.for("react.memo_cache_sentinel")?(ne=()=>{i(null)},e[51]=ne):ne=e[51];const E=ne;let ot;e[52]!==A?(ot=T=>{Et((async()=>{u(!0),C(null);try{await T(),A(),u(!1)}catch(gt){C(Lt(gt)),u(!1)}})())},e[52]=A,e[53]=ot):ot=e[53];const ae=ot;let nt;e[54]!==l||e[55]!==o?(nt=T=>{const gt=S(T.id);i({action:async()=>{await l.removeAuthOrgTeam({teamId:gt}),d(Ct=>Ct===gt?null:Ct)},kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},e[54]=l,e[55]=o,e[56]=nt):nt=e[56];const ft=nt;let ce;e[57]!==o?(ce=o("userId"),e[57]=o,e[58]=ce):ce=e[58];let ue;e[59]!==ce?(ue={head:ce,render:Vt},e[59]=ce,e[60]=ue):ue=e[60];let ge;e[61]!==o?(ge=o("role"),e[61]=o,e[62]=ge):ge=e[62];let he;e[63]!==ge?(he={head:ge,render:Wt},e[63]=ge,e[64]=he):he=e[64];let at;e[65]!==ue||e[66]!==he?(at=[ue,he],e[65]=ue,e[66]=he,e[67]=at):at=e[67];const pt=at;let be;e[68]!==o?(be=o("email"),e[68]=o,e[69]=be):be=e[69];let fe;e[70]!==be?(fe={head:be,render:Xt},e[70]=be,e[71]=fe):fe=e[71];let pe;e[72]!==o?(pe=o("role"),e[72]=o,e[73]=pe):pe=e[73];let ve;e[74]!==pe?(ve={head:pe,render:Yt},e[74]=pe,e[75]=ve):ve=e[75];let ye;e[76]!==o?(ye=o("status"),e[76]=o,e[77]=ye):ye=e[77];let Ie;e[78]!==ye?(Ie={head:ye,render:Zt},e[78]=ye,e[79]=Ie):Ie=e[79];let lt;e[80]!==fe||e[81]!==ve||e[82]!==Ie?(lt=[fe,ve,Ie],e[80]=fe,e[81]=ve,e[82]=Ie,e[83]=lt):lt=e[83];const vt=lt;let we;e[84]!==o?(we=o("id"),e[84]=o,e[85]=we):we=e[85];let Ce;e[86]!==we?(Ce={className:"font-mono text-xs",head:we,render:er},e[86]=we,e[87]=Ce):Ce=e[87];let $e;e[88]!==o?($e=o("name"),e[88]=o,e[89]=$e):$e=e[89];let xe;e[90]!==$e?(xe={head:$e,render:tr},e[90]=$e,e[91]=xe):xe=e[91];let it;e[92]!==Ce||e[93]!==xe?(it=[Ce,xe],e[92]=Ce,e[93]=xe,e[94]=it):it=e[94];const yt=it;let ze;e[95]!==o?(ze=o("userId"),e[95]=o,e[96]=ze):ze=e[96];let st;e[97]!==ze?(st=[{head:ze,render:rr}],e[97]=ze,e[98]=st):st=e[98];const It=st;let Se;e[99]!==o?(Se=o("role"),e[99]=o,e[100]=Se):Se=e[100];let ke;e[101]!==Se?(ke={head:Se,render:or},e[101]=Se,e[102]=ke):ke=e[102];let Ne;e[103]!==o?(Ne=o("Permission"),e[103]=o,e[104]=Ne):Ne=e[104];let Ae;e[105]!==Ne?(Ae={className:"font-mono text-xs whitespace-pre-wrap",head:Ne,render:nr},e[105]=Ne,e[106]=Ae):Ae=e[106];let mt;e[107]!==ke||e[108]!==Ae?(mt=[ke,Ae],e[107]=ke,e[108]=Ae,e[109]=mt):mt=e[109];const wt=mt;let Oe;e[110]!==oe?(Oe=oe!==null&&n("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:oe}),e[110]=oe,e[111]=Oe):Oe=e[111];let De;e[112]!==g?(De=g!==null&&n("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[112]=g,e[113]=De):De=e[113];let dt;e[114]===Symbol.for("react.memo_cache_sentinel")?(dt=()=>{i({kind:"add-member"})},e[114]=dt):dt=e[114];let _e;e[115]!==o?(_e=o("Add member"),e[115]=o,e[116]=_e):_e=e[116];let Fe;e[117]!==_e?(Fe=n(j,{"data-testid":"org-open-add-member",onClick:dt,size:"xs",type:"button",variant:"outline",children:_e}),e[117]=_e,e[118]=Fe):Fe=e[118];let ct;e[119]===Symbol.for("react.memo_cache_sentinel")?(ct=()=>{i({kind:"invite-member"})},e[119]=ct):ct=e[119];let Re;e[120]!==o?(Re=o("Invite member"),e[120]=o,e[121]=Re):Re=e[121];let Te;e[122]!==Re?(Te=n(j,{"data-testid":"org-open-invite-member",onClick:ct,size:"xs",type:"button",variant:"outline",children:Re}),e[122]=Re,e[123]=Te):Te=e[123];let Me;e[124]!==Fe||e[125]!==Te?(Me=M(ht,{children:[Fe,Te]}),e[124]=Fe,e[125]=Te,e[126]=Me):Me=e[126];let Ee;e[127]!==o?(Ee=o("Members"),e[127]=o,e[128]=Ee):Ee=e[128];let Le;e[129]!==p||e[130]!==l||e[131]!==pt||e[132]!==K||e[133]!==ae||e[134]!==o?(Le=K.length===0?n("div",{className:"p-3",children:n(et,{testId:"org-members-empty",title:o("No members.")})}):n(rt,{columns:pt,rowActions:T=>M(ht,{children:[n(j,{"data-testid":`org-member-role-${S(T.id)}`,onClick:()=>{i({kind:"member-role",member:T})},size:"xs",type:"button",variant:"ghost",children:o("Change role")}),n(j,{"data-testid":`org-remove-member-${S(T.id)}`,disabled:p,onClick:()=>{ae(()=>l.removeAuthOrgMember({memberId:S(T.id)}))},size:"xs",type:"button",variant:"ghost",children:o("Remove")})]}),rowPrefix:"org-member",rows:K}),e[129]=p,e[130]=l,e[131]=pt,e[132]=K,e[133]=ae,e[134]=o,e[135]=Le):Le=e[135];let je;e[136]!==Me||e[137]!==Ee||e[138]!==Le?(je=n(tt,{action:Me,heading:Ee,testId:"org-members",children:Le}),e[136]=Me,e[137]=Ee,e[138]=Le,e[139]=je):je=e[139];let Pe;e[140]!==p||e[141]!==l||e[142]!==vt||e[143]!==R||e[144]!==ae||e[145]!==o?(Pe=R.length>0&&n(tt,{heading:o("Invitations"),testId:"org-invitations",children:n(rt,{columns:vt,rowActions:T=>n(j,{"data-testid":`org-cancel-invitation-${S(T.id)}`,disabled:p,onClick:()=>{ae(()=>l.cancelAuthOrgInvitation({invitationId:S(T.id)}))},size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),rowPrefix:"org-invitation",rows:R})}),e[140]=p,e[141]=l,e[142]=vt,e[143]=R,e[144]=ae,e[145]=o,e[146]=Pe):Pe=e[146];let Je;e[147]!==ft||e[148]!==m||e[149]!==o||e[150]!==yt||e[151]!==re||e[152]!==c?(Je=c&&n(tt,{action:n(j,{"data-testid":"org-open-create-team",onClick:()=>{i({kind:"team-create"})},size:"xs",type:"button",variant:"outline",children:o("New team")}),heading:o("Teams"),testId:"org-teams",children:re.length===0?n("div",{className:"p-3",children:n(et,{testId:"org-teams-empty",title:o("No teams.")})}):n(rt,{columns:yt,rowActions:T=>M(ht,{children:[n(j,{"aria-pressed":m===S(T.id),"data-testid":`org-team-select-${S(T.id)}`,onClick:()=>{d(S(T.id))},size:"xs",type:"button",variant:"ghost",children:o("Members")}),n(j,{"data-testid":`org-team-rename-${S(T.id)}`,onClick:()=>{i({kind:"team-rename",team:T})},size:"xs",type:"button",variant:"ghost",children:o("Rename")}),n(j,{"data-testid":`org-team-delete-${S(T.id)}`,onClick:()=>{ft(T)},size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),rowPrefix:"org-team",rows:re})}),e[147]=ft,e[148]=m,e[149]=o,e[150]=yt,e[151]=re,e[152]=c,e[153]=Je):Je=e[153];let Ue;e[154]!==p||e[155]!==l||e[156]!==ae||e[157]!==m||e[158]!==o||e[159]!==It||e[160]!==ee||e[161]!==c?(Ue=c&&m!==null&&n(tt,{action:n(j,{"data-testid":"org-open-add-team-member",onClick:()=>{i({kind:"team-add-member",teamId:m})},size:"xs",type:"button",variant:"outline",children:o("Add member")}),heading:o("Team members"),testId:"org-team-members",children:ee.length===0?n("div",{className:"p-3",children:n(et,{testId:"org-team-members-empty",title:o("No team members.")})}):n(rt,{columns:It,rowActions:T=>n(j,{"data-testid":`org-team-remove-member-${S(T.id)}`,disabled:p,onClick:()=>{ae(()=>l.removeAuthOrgTeamMember({teamMemberId:S(T.id)}))},size:"xs",type:"button",variant:"ghost",children:o("Remove")}),rowPrefix:"org-team-member",rows:ee})}),e[154]=p,e[155]=l,e[156]=ae,e[157]=m,e[158]=o,e[159]=It,e[160]=ee,e[161]=c,e[162]=Ue):Ue=e[162];let Be;e[163]!==l||e[164]!==wt||e[165]!==Y||e[166]!==s||e[167]!==o?(Be=s&&n(tt,{action:n(j,{"data-testid":"org-open-create-role",onClick:()=>{i({kind:"role-create"})},size:"xs",type:"button",variant:"outline",children:o("New role")}),heading:o("Roles"),testId:"org-roles",children:Y.length===0?n("div",{className:"p-3",children:n(et,{testId:"org-roles-empty",title:o("No custom roles.")})}):n(rt,{columns:wt,rowActions:T=>M(ht,{children:[n(j,{"data-testid":`org-role-edit-${S(T.id)}`,onClick:()=>{i({kind:"role-edit",role:T})},size:"xs",type:"button",variant:"ghost",children:o("Edit")}),n(j,{"data-testid":`org-role-delete-${S(T.id)}`,onClick:()=>{i({action:()=>l.deleteAuthOrgRole({roleId:S(T.id)}),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),rowPrefix:"org-role",rows:Y})}),e[163]=l,e[164]=wt,e[165]=Y,e[166]=s,e[167]=o,e[168]=Be):Be=e[168];let He;e[169]!==a?.kind||e[170]!==r||e[171]!==A?(He=a?.kind==="add-member"&&n(Bt,{onClose:E,onDone:A,organizationId:r}),e[169]=a?.kind,e[170]=r,e[171]=A,e[172]=He):He=e[172];let qe;e[173]!==a?.kind||e[174]!==r||e[175]!==A?(qe=a?.kind==="invite-member"&&n(Ht,{onClose:E,onDone:A,organizationId:r}),e[173]=a?.kind,e[174]=r,e[175]=A,e[176]=qe):qe=e[176];let Ke;e[177]!==a||e[178]!==A?(Ke=a?.kind==="member-role"&&n(qt,{member:a.member,onClose:E,onDone:A}),e[177]=a,e[178]=A,e[179]=Ke):Ke=e[179];let Qe;e[180]!==a?.kind||e[181]!==r||e[182]!==A?(Qe=a?.kind==="team-create"&&n(xt,{mode:"create",onClose:E,onDone:A,organizationId:r}),e[180]=a?.kind,e[181]=r,e[182]=A,e[183]=Qe):Qe=e[183];let Ge;e[184]!==a||e[185]!==r||e[186]!==A?(Ge=a?.kind==="team-rename"&&n(xt,{mode:"edit",onClose:E,onDone:A,organizationId:r,team:a.team}),e[184]=a,e[185]=r,e[186]=A,e[187]=Ge):Ge=e[187];let Ve;e[188]!==a||e[189]!==A?(Ve=a?.kind==="team-add-member"&&n(Kt,{onClose:E,onDone:A,teamId:a.teamId}),e[188]=a,e[189]=A,e[190]=Ve):Ve=e[190];let We;e[191]!==a?.kind||e[192]!==r||e[193]!==A?(We=a?.kind==="role-create"&&n(zt,{mode:"create",onClose:E,onDone:A,organizationId:r}),e[191]=a?.kind,e[192]=r,e[193]=A,e[194]=We):We=e[194];let Xe;e[195]!==a||e[196]!==r||e[197]!==A?(Xe=a?.kind==="role-edit"&&n(zt,{mode:"edit",onClose:E,onDone:A,organizationId:r,role:a.role}),e[195]=a,e[196]=r,e[197]=A,e[198]=Xe):Xe=e[198];let Ye;e[199]!==a||e[200]!==A?(Ye=a?.kind==="confirm"&&n(Tt,{action:a.action,message:a.message,onClose:E,onDone:A,testId:a.testId,title:a.title}),e[199]=a,e[200]=A,e[201]=Ye):Ye=e[201];let ut;return e[202]!==Oe||e[203]!==De||e[204]!==je||e[205]!==Pe||e[206]!==Je||e[207]!==Ue||e[208]!==Be||e[209]!==He||e[210]!==qe||e[211]!==Ke||e[212]!==Qe||e[213]!==Ge||e[214]!==Ve||e[215]!==We||e[216]!==Xe||e[217]!==Ye?(ut=M("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Oe,De,je,Pe,Je,Ue,Be,He,qe,Ke,Qe,Ge,Ve,We,Xe,Ye]}),e[202]=Oe,e[203]=De,e[204]=je,e[205]=Pe,e[206]=Je,e[207]=Ue,e[208]=Be,e[209]=He,e[210]=qe,e[211]=Ke,e[212]=Qe,e[213]=Ge,e[214]=Ve,e[215]=We,e[216]=Xe,e[217]=Ye,e[218]=ut):ut=e[218],ut};function Gt(t){return n(me,{children:t.head},t.head)}function Vt(t){return n("span",{className:"font-mono text-xs",children:S(t.userId)})}function Wt(t){return S(t.role)}function Xt(t){return S(t.email)}function Yt(t){return S(t.role)}function Zt(t){return S(t.status)}function er(t){return S(t.id)}function tr(t){return S(t.name)}function rr(t){return n("span",{className:"font-mono text-xs",children:S(t.userId)})}function or(t){return S(t.role)}function nr(t){return S(t.permission)}const Cr=()=>{const t=G(62),e=le(),r=W(),{config:s,ready:c}=Mt(),l=s.capabilities.organization,[o,a]=P(null),[i,m]=P(null);let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-orgs"],t[0]=d):d=t[0];let p;t[1]!==e?(p=()=>e.listAuthOrganizations({limit:100}),t[1]=e,t[2]=p):p=t[2];let u;t[3]!==l?(u={enabled:l},t[3]=l,t[4]=u):u=t[4];const g=Ze(d,p,u),C=g.data?.rows??null;let b;t[5]!==g?(b=()=>{g.refetch()},t[5]=g,t[6]=b):b=t[6],Dt(b,l);let v;t[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m(null)},t[7]=v):v=t[7];const $=v;let f;t[8]!==g?(f=()=>{g.refetch()},t[8]=g,t[9]=f):f=t[9];const w=f;let h;t[10]===Symbol.for("react.memo_cache_sentinel")?(h=F=>{a(F)},t[10]=h):h=t[10];const x=h;if(c&&!l){let F;t[11]!==r?(F=r("Enable the organization() plugin in your auth config to manage organizations here."),t[11]=r,t[12]=F):F=t[12];let R;t[13]!==r?(R=r("Organizations are not enabled."),t[13]=r,t[14]=R):R=t[14];let H;return t[15]!==F||t[16]!==R?(H=n(et,{description:F,testId:"org-disabled",title:R}),t[15]=F,t[16]=R,t[17]=H):H=t[17],H}let y;t[18]!==r?(y=r("Organizations"),t[18]=r,t[19]=y):y=t[19];let I;t[20]!==y?(I=n("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y}),t[20]=y,t[21]=I):I=t[21];let z;t[22]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{m({kind:"create"})},t[22]=z):z=t[22];let O;t[23]!==r?(O=r("New organization"),t[23]=r,t[24]=O):O=t[24];let N;t[25]!==O?(N=n(j,{"data-testid":"org-new",onClick:z,size:"sm",type:"button",children:O}),t[25]=O,t[26]=N):N=t[26];let k;t[27]!==N||t[28]!==I?(k=M("div",{className:"flex items-center justify-between",children:[I,N]}),t[27]=N,t[28]=I,t[29]=k):k=t[29];let D;t[30]!==g.error?(D=g.error!==null&&n("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[30]=g.error,t[31]=D):D=t[31];let _;t[32]!==C||t[33]!==r?(_=C!==null&&C.length===0&&n(et,{testId:"org-empty",title:r("No organizations.")}),t[32]=C,t[33]=r,t[34]=_):_=t[34];let J;t[35]!==C||t[36]!==o||t[37]!==r?(J=C!==null&&C.length>0&&n(kt,{className:"overflow-hidden py-0",children:n(St,{className:"px-0",children:M(Ot,{"data-testid":"org-table",children:[n(Nt,{children:M(bt,{children:[n(me,{children:r("id")}),n(me,{children:r("name")}),n(me,{children:r("slug")}),n(me,{children:r("created")}),n(me,{"aria-label":r("Actions")})]})}),n(At,{children:C.map(F=>{const R=S(F.id);return M(bt,{"data-testid":`org-row-${R}`,children:[n(de,{className:"font-mono text-xs",children:R}),n(de,{children:S(F.name)}),n(de,{children:S(F.slug)}),n(de,{className:"text-muted-foreground tabular-nums",children:jt(F.createdAt)}),n(de,{children:M("div",{className:"flex justify-end gap-1",children:[n(j,{"aria-pressed":o===R,"data-testid":`org-select-${R}`,onClick:()=>{x(R)},size:"xs",type:"button",variant:"ghost",children:r("Manage")}),n(j,{"data-testid":`org-edit-${R}`,onClick:()=>{m({kind:"edit",org:F})},size:"xs",type:"button",variant:"ghost",children:r("Edit")}),n(j,{"data-testid":`org-delete-${R}`,onClick:()=>{m({kind:"delete",org:F})},size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},R)})})]})})}),t[35]=C,t[36]=o,t[37]=r,t[38]=J):J=t[38];let q;t[39]!==s.organization||t[40]!==o?(q=o!==null&&n(Qt,{organizationId:o,rolesEnabled:s.organization.roles,teamsEnabled:s.organization.teams}),t[39]=s.organization,t[40]=o,t[41]=q):q=t[41];let U;t[42]!==i?.kind||t[43]!==w?(U=i?.kind==="create"&&n($t,{mode:"create",onClose:$,onDone:w}),t[42]=i?.kind,t[43]=w,t[44]=U):U=t[44];let L;t[45]!==i||t[46]!==w?(L=i?.kind==="edit"&&n($t,{mode:"edit",onClose:$,onDone:w,org:i.org}),t[45]=i,t[46]=w,t[47]=L):L=t[47];let B;t[48]!==e||t[49]!==i||t[50]!==w||t[51]!==r?(B=i?.kind==="delete"&&n(Tt,{action:async()=>{const F=S(i.org.id);await e.deleteAuthOrganization({organizationId:F}),a(R=>R===F?null:R)},message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:$,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[48]=e,t[49]=i,t[50]=w,t[51]=r,t[52]=B):B=t[52];let K;return t[53]!==k||t[54]!==D||t[55]!==_||t[56]!==J||t[57]!==q||t[58]!==U||t[59]!==L||t[60]!==B?(K=M("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[k,D,_,J,q,U,L,B]}),t[53]=k,t[54]=D,t[55]=_,t[56]=J,t[57]=q,t[58]=U,t[59]=L,t[60]=B,t[61]=K):K=t[61],K};export{Cr as OrganizationsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as B}from"../packem_shared/error-alert-B59DnrDI.js";import{g as N}from"../packem_shared/badge-BbuuAio7.js";import{c as y,u as w}from"../packem_shared/card-CIDGUN6K.js";import{E as S}from"../packem_shared/empty-state-Cg7t_8qu.js";import{n as A,d as D,m as b,p,f as I,u as n}from"../packem_shared/table-DdJBrClo.js";import{K as v}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{useAutoRefresh as O}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{S as C}from"../packem_shared/home-panel-B-8BCffw.js";import{useT as M}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as g}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{i as E}from"../packem_shared/internal-AtZ4bTal.js";import{jsx as e,jsxs as o}from"react/jsx-runtime";const F=["subscriptions","events"],G={},P=new Set(["active","trialing"]),H=new Set(["past_due","unpaid"]),s=(a,t)=>{if(a[t]!==void 0)return a[t];const m=a.__doc__;if(typeof m=="string")try{const d=JSON.parse(m);if(d!==null&&typeof d=="object"&&!Array.isArray(d))return d[t]}catch{}},i=a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"",J=a=>P.has(a)?"default":H.has(a)?"destructive":"outline",re=({limit:a=100})=>{const t=M(),m=C(),{data:d}=v(g.listTables,G,{live:!0}),T=d!==void 0,_=Array.isArray(d)&&F.every(r=>d.some(c=>c.name===r)),f=m.payments&&_,l=v(g.readTablePage,{filters:[],limit:a,offset:0,orderBy:[],search:"",table:"subscriptions"},{enabled:f}),u=v(g.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"},{enabled:f});O(()=>{f&&(l.refetch(),u.refetch())},!0);const h=l.data?.rows??[],$=u.data?.rows??[],j=l.error??u.error,R=l.error===null?u.errorSource:l.errorSource,x=h.filter(r=>P.has(i(s(r,"state")))).length,k=$.toSorted((r,c)=>Number(s(c,"processedAt")??0)-Number(s(r,"processedAt")??0));return T&&!f?e("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:e(S,{description:t("No @lunora/payment tables found in this deployment. Declare the store tables (subscriptions, events, …) in lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):o("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[e("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:o(y,{className:"justify-between gap-0 py-0",children:[o("div",{className:"flex flex-col gap-2.5 p-4",children:[e("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),o("div",{className:"flex items-center gap-2",children:[e("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:x}),e(N,{variant:"default",children:t("{count} active",{count:x})})]})]}),e("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:h.length})})]})}),j===null?void 0:e(B,{error:R}),h.length===0&&!l.isLoading?e(S,{testId:"payments-empty",title:t("No subscriptions yet")}):e(y,{className:"overflow-hidden py-0",children:e(w,{className:"px-0",children:o(A,{children:[e(D,{children:o(b,{children:[e(p,{children:t("Provider")}),e(p,{children:t("Reference")}),e(p,{children:t("Plan")}),e(p,{children:t("State")}),e(p,{children:t("Renews")})]})}),e(I,{children:h.map(r=>{const c=i(s(r,"state"));return o(b,{"data-testid":"payment-subscription-row",children:[e(n,{children:i(s(r,"provider"))}),e(n,{children:i(s(r,"referenceId"))}),e(n,{children:i(s(r,"priceId"))}),e(n,{children:e(N,{variant:J(c),children:c})}),e(n,{children:E(s(r,"currentPeriodEnd"))})]},i(s(r,"providerSubscriptionId")))})})]})})}),o(y,{className:"overflow-hidden py-0",children:[e("header",{className:"border-b border-border px-4 py-3",children:e("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),e(w,{className:"px-0",children:e(A,{children:e(I,{children:k.map(r=>o(b,{"data-testid":"payment-event-row",children:[e(n,{children:i(s(r,"provider"))}),e(n,{className:"font-medium",children:i(s(r,"type"))}),e(n,{className:"text-muted-foreground",children:i(s(r,"providerEventId"))}),e(n,{children:E(s(r,"processedAt"))})]},i(s(r,"providerEventId"))))})})})]})]})};export{re as PaymentsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as u,useRef as te,useEffect as J}from"react";import{c as G,n as ae,f as re,m as le,u as H}from"../packem_shared/card-CIDGUN6K.js";import{useT as z}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{c as ie}from"react/compiler-runtime";import{E as se}from"../packem_shared/error-alert-B59DnrDI.js";import{L as oe}from"../packem_shared/live-status-CGW2JHf_.js";import{g as T}from"../packem_shared/badge-BbuuAio7.js";import{u as P}from"../packem_shared/button-BkCrNcAs.js";import{E as Y}from"../packem_shared/empty-state-Cg7t_8qu.js";import{n as ne,d as de,m as U,p as M,f as ce,u as O}from"../packem_shared/table-DdJBrClo.js";import{K as j}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{ADMIN_FUNCTIONS as R}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useLunora as B}from"@lunora/react";import{ShardInput as pe}from"../packem_shared/ShardInput-BVn2iCU0.js";import{u as E}from"../packem_shared/input-JHu63lTv.js";import{p as C}from"../packem_shared/label-6uP1obNF.js";import{l as me}from"../packem_shared/textarea-Bu2-jKAs.js";import{c as fe,a as ue,e as he,f as q}from"../packem_shared/internal-AtZ4bTal.js";const W=["read","insert","update","delete"],xe=(a,t)=>({delete:a("Delete"),insert:a("Insert"),read:a("Read"),update:a("Update")})[t],ye=a=>{const t=new Set;for(const o of a?.advisories??[])if(o.name==="rls_uncovered_table"){const{table:s}=o.metadata;typeof s=="string"&&s!==""&&t.add(s)}return t},ge=(a,t,o)=>{const s=new Map,r=l=>{const d=s.get(l);if(d!==void 0)return d;const n={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:[],table:l,uncovered:o.has(l)};return s.set(l,n),n};for(const l of a)r(l.table).cells[l.on]={procedure:l.procedure};for(const l of t){const d=r(l.table);d.maskedColumns.includes(l.column)||d.maskedColumns.push(l.column)}for(const l of o)r(l);return[...s.values()].toSorted((l,d)=>l.table.localeCompare(d.table))},be=a=>{const t=ie(17);let o;t[0]!==a?(o=a===void 0?{}:a,t[0]=a,t[1]=o):o=t[1];const{onProbe:s}=o,r=z();let l,d;t[2]===Symbol.for("react.memo_cache_sentinel")?(l={},d={live:!0},t[2]=l,t[3]=d):(l=t[2],d=t[3]);const n=j(R.rlsPolicies,l,d);let y;t[4]===Symbol.for("react.memo_cache_sentinel")?(y={},t[4]=y):y=t[4];const f=j(R.maskPolicies,y);let h;t[5]===Symbol.for("react.memo_cache_sentinel")?(h={},t[5]=h):h=t[5];const v=j(R.getAdvisories,h);let N;if(t[6]!==v.data||t[7]!==f.data||t[8]!==s||t[9]!==n||t[10]!==r){let b=null;n.data!==void 0&&(b=Array.isArray(n.data.policies)?n.data.policies:[]);const _=Array.isArray(f.data?.columns)?f.data.columns:[],A=v.data??null,{error:x,errorSource:m,liveError:S}=n,I=b===null?[]:ge(b,_,ye(A));let $;t[12]!==S?($=e("div",{className:"flex items-center justify-end",children:e(oe,{message:S,prefix:"pm"})}),t[12]=S,t[13]=$):$=t[13];let g;t[14]!==x||t[15]!==m?(g=x!==null&&e(se,{error:m,testId:"pm-error"}),t[14]=x,t[15]=m,t[16]=g):g=t[16],N=i("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[$,g,b!==null&&I.length===0?e(Y,{description:r("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:r("No policy")}):i(ne,{"data-testid":"pm-table",children:[e(de,{children:i(U,{children:[e(M,{children:r("Table")}),W.map(p=>e(M,{children:xe(r,p)},p)),e(M,{children:r("Masked columns")})]})}),e(ce,{children:I.map(p=>i(U,{"data-testid":`pm-row-${p.table}`,children:[e(O,{className:"font-mono text-xs",children:i("span",{className:"flex items-center gap-1.5",children:[p.table,p.uncovered&&e(T,{"data-testid":`pm-uncovered-${p.table}`,title:r("Uncovered — reachable without a policy"),variant:"destructive",children:r("Uncovered — reachable without a policy")})]})}),W.map(w=>{const F=p.cells[w];return e(O,{"data-testid":`pm-cell-${p.table}-${w}`,children:F.procedure===void 0?e("span",{className:"text-xs text-muted-foreground",children:r("No policy")}):i("span",{className:"flex flex-col gap-1",children:[e(T,{variant:"secondary",children:r("Covered by {procedure}",{procedure:F.procedure})}),s!==void 0&&e(P,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${p.table}-${w}`,onClick:()=>{s(p.table,w,F.procedure??"")},size:"xs",type:"button",variant:"ghost",children:r("Probe this")})]})},w)}),e(O,{children:p.maskedColumns.length===0?e("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"}):e("span",{className:"flex flex-wrap gap-1",children:p.maskedColumns.map(ve)})})]},p.table))})]})]}),t[6]=v.data,t[7]=f.data,t[8]=s,t[9]=n,t[10]=r,t[11]=N}else N=t[11];return N};function ve(a){return e(T,{variant:"outline",children:a},a)}const Ne=ue(R.runAs),we=()=>{const a=B();return async({args:t,functionPath:o,shardKey:s="",userId:r})=>{const l=Ne;try{return{kind:"allowed",value:await a.query(l,{args:t,functionPath:o,userId:r},fe(s))}}catch(d){return{kind:"denied",message:d instanceof Error?d.message:String(d)}}}},ke=a=>a===void 0?"undefined":JSON.stringify(a,null,2),Pe=({functions:a,prefill:t,runAsIdentity:o=!1}={})=>{const s=B(),r=z(),l=we(),[d,n]=u(null),[y,f]=u(null),h=a??d??[],[v,N]=u(""),[b,_]=u("{}"),[A,x]=u(""),[m,S]=u(""),[I,$]=u(!1),[g,p]=u(null),[w,F]=u(null),D=te(-1);J(()=>{if(a!==void 0)return;let c=!1;return s.listFunctions().then(k=>(c||n(k),k)).catch(k=>{c||f(he(k))}),()=>{c=!0}},[s,a]),J(()=>{if(t===void 0||D.current===t.nonce)return;D.current=t.nonce;const c=t.functionPath;queueMicrotask(()=>{N(c),p(null)})},[t]);const L=v===""?h[0]?.path??"":v,Q=async()=>{if(L==="")return;let c;try{c=b.trim()===""?{}:JSON.parse(b)}catch(k){F(r("Invalid JSON args: {message}",{message:k.message})),p(null);return}F(null),$(!0);try{const k=await l({args:c,functionPath:L,shardKey:A.trim(),userId:m.trim()});p(k)}finally{$(!1)}},V=()=>{q(Q())},X=c=>{N(c.target.value)},Z=c=>{_(c.target.value)},ee=c=>{S(c.target.value)};return i("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[y!==null&&e("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:y}),!o&&e(Y,{description:r("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:r("Set `runAsIdentity` to forge an identity and probe access.")}),i("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[i("div",{className:"flex flex-col gap-1.5",children:[e(C,{htmlFor:"pp-function",children:r("Function")}),e("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:X,value:L,children:h.map(c=>i("option",{value:c.path,children:[c.path," (",c.kind,")"]},c.path))})]}),i("div",{className:"flex flex-col gap-1.5",children:[e(C,{htmlFor:"pp-args",children:r("Arguments")}),e(me,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:Z,value:b})]}),e(pe,{onChange:x,testId:"pp-shard",value:A}),i("div",{className:"flex flex-col gap-1.5",children:[e(C,{htmlFor:"pp-user",children:r("Run as (userId)")}),e(E,{"aria-label":r("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:ee,placeholder:r("Leave empty to run as admin"),value:m})]}),i("div",{className:"flex items-center gap-2",children:[e(P,{"data-testid":"pp-run",disabled:!o||I||L==="",onClick:V,type:"button",children:r(I?"Probing…":"Run probe")}),m.trim()!==""&&e(T,{"data-testid":"pp-as-badge",variant:"secondary",children:r("as {userId}",{userId:m.trim()})})]})]}),w!==null&&e("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:w}),g!==null&&g.kind==="allowed"&&i("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[e(T,{variant:"secondary",children:r("Allowed")}),e("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:ke(g.value)})]}),g!==null&&g.kind==="denied"&&i("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[e(T,{variant:"destructive",children:r("Denied")}),e("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:g.message})]})]})},Ce="/__lunora/policy-scaffold",Se={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists — pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({…}) form — convert it to the builder form (c.use(…).query(…)) before wiring RLS."},Ie=async a=>{const t=await fetch(Ce,{body:JSON.stringify(a),headers:{"Content-Type":"application/json"},method:"POST"}),o=await t.json();if(o.needsManualEdit===!0)return{kind:"needs-manual-edit",message:o.message??"This change must be made by hand."};if(t.ok)return{diagnostics:o.diagnostics??[],kind:"ok",label:o.fileName??o.exportName??""};const s=o.error;return{kind:"error",message:s===void 0?`policy scaffold failed (${String(t.status)})`:Se[s]??s}},K={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},$e=()=>{const a=z(),[t,o]=u(null),[s,r]=u(!1),[l,d]=u(null),[n,y]=u(K),f=x=>{const m=x.target.name,{value:S}=x.target;y(I=>({...I,[m]:S}))},h=()=>{o(null),y(K)},v=async x=>{r(!0),d(null);try{const m=await Ie(x);d(m),m.kind==="ok"&&h()}catch(m){d({kind:"error",message:m instanceof Error?m.message:String(m)})}finally{r(!1)}},N=()=>{q(v({kind:"scaffoldPolicy",name:n.policyName.trim(),table:n.tableName.trim()}))},b=()=>{q(v({exportName:n.exportName.trim(),filePath:n.filePath.trim(),kind:"wireRls",policies:n.policies.trim()}))},_=()=>{d(null),o("scaffold")},A=()=>{d(null),o("wire")};return i(G,{"data-testid":"policy-scaffolder",size:"sm",children:[i(ae,{children:[e(re,{children:a("Scaffold access rules")}),e(le,{children:a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.")})]}),i(H,{children:[i("div",{className:"flex flex-wrap gap-2",children:[e(P,{"data-testid":"policy-scaffolder-new",onClick:_,size:"xs",type:"button",variant:t==="scaffold"?"default":"outline",children:a("New policy file")}),e(P,{"data-testid":"policy-scaffolder-wire",onClick:A,size:"xs",type:"button",variant:t==="wire"?"default":"outline",children:a("Wire into a procedure")})]}),t==="scaffold"&&i("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-name",children:a("Policy name")}),e(E,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:f,value:n.policyName})]}),i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-table",children:a("Table name")}),e(E,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:f,value:n.tableName})]}),e(P,{"data-testid":"policy-scaffolder-create",disabled:s||n.policyName.trim()===""||n.tableName.trim()==="",onClick:N,size:"xs",type:"button",children:a(s?"Creating…":"Create policy file")}),e(P,{onClick:h,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),t==="wire"&&i("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")}),e(E,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:f,value:n.filePath})]}),i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")}),e(E,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:f,value:n.exportName})]}),i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")}),e(E,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:f,value:n.policies})]}),e(P,{"data-testid":"policy-scaffolder-apply",disabled:s||n.filePath.trim()===""||n.exportName.trim()===""||n.policies.trim()==="",onClick:b,size:"xs",type:"button",children:a(s?"Wiring…":"Wire RLS")}),e(P,{onClick:h,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),l?.kind==="error"&&e("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:l.message}),l?.kind==="needs-manual-edit"&&e("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand — the scaffolder only adds new, deny-by-default rules.")}),l?.kind==="ok"&&i("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[e("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:l.label})}),l.diagnostics.length>0&&e("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:l.diagnostics.map(x=>e("li",{className:"font-mono text-[11px] text-destructive",children:x},x))})]})]})]})},Ye=({functions:a,runAsIdentity:t=!1,schemaEditable:o=!1}={})=>{const s=z(),[r,l]=u(void 0),d=(n,y,f)=>{f!==""&&l(h=>({functionPath:f,nonce:(h?.nonce??0)+1}))};return i("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[i("section",{className:"flex flex-col gap-3",children:[e("header",{className:"border-b border-border px-4 py-3",children:e("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Permissions")})}),e(be,{onProbe:d})]}),e("section",{className:"flex flex-col gap-3",children:i(G,{className:"gap-0 py-0",children:[e("header",{className:"border-b border-border px-4 py-3",children:e("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Probe")})}),i(H,{className:"px-4 py-4",children:[e("p",{className:"mb-3 text-sm text-muted-foreground",children:s("Pick a function and an identity, then run it to see the access outcome.")}),e(Pe,{functions:a,prefill:r,runAsIdentity:t})]})]})}),o&&e("section",{className:"flex flex-col gap-2",children:e($e,{})})]})};export{Ye as PermissionsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as P}from"react/compiler-runtime";import{useLunora as He}from"@lunora/react";import{useState as _}from"react";import{E as Ve}from"../packem_shared/error-alert-B59DnrDI.js";import{A as Xe}from"../packem_shared/alert-CVcOFuDR.js";import{g as Qe}from"../packem_shared/badge-BbuuAio7.js";import{u as oe}from"../packem_shared/button-BkCrNcAs.js";import{c as ke,u as Oe}from"../packem_shared/card-CIDGUN6K.js";import{E as Ie}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as Ye}from"../packem_shared/input-JHu63lTv.js";import{p as Ze}from"../packem_shared/scroll-area-DTEq6Jec.js";import{n as Be,d as Je,m as de,p as $,f as Fe,u as w}from"../packem_shared/table-DdJBrClo.js";import{l as et}from"../packem_shared/textarea-Bu2-jKAs.js";import{K as De}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{useAutoRefresh as tt}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{useT as U}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as j}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{c as $e,e as we,a as Ae,i as at,f as Ce}from"../packem_shared/internal-AtZ4bTal.js";import{jsx as a,jsxs as b,Fragment as We}from"react/jsx-runtime";const st=(r,e)=>{const t=new Set(r.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),u=r.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!t.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:u,showReliabilityWarning:u.length>0||d>0}},rt=200,nt=Ae(j.sendQueueMessage),ot=Ae(j.replayQueueMessage),dt=Ae(j.clearQueueMessages),Re=96,lt=r=>{if(r===void 0)return"—";try{return JSON.stringify(r)}catch{return"[unserializable]"}},ut=r=>r.length>Re?`${r.slice(0,Re)}…`:r,ct=r=>r==="error"?"destructive":r==="retry"?"outline":"secondary",it=(r,e)=>e(r==="messages"?"Messages":r==="send"?"Send":"Declared"),mt=r=>{const e=P(11),{loaded:t,queues:u}=r,d=U();let s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=a("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let n;e[4]!==t||e[5]!==u||e[6]!==d?(n=t&&u.length===0?a(Ie,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):a(ke,{className:"overflow-hidden py-0",children:a(Oe,{className:"px-0",children:b(Be,{"data-testid":"queues-table",children:[a(Je,{children:b(de,{children:[a($,{children:d("Export")}),a($,{children:d("Queue")}),a($,{children:d("Mode")}),a($,{children:d("Binding")}),a($,{children:d("Dead-letter")})]})}),a(Fe,{children:u.map(ft)})]})})}),e[4]=t,e[5]=u,e[6]=d,e[7]=n):n=e[7];let h;return e[8]!==o||e[9]!==n?(h=b("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,n]}),e[8]=o,e[9]=n,e[10]=h):h=e[10],h},ht=r=>{const e=P(67),{message:t,onReplay:u,replayingId:d}=r,s=U();let o,n,h,i,y,p,x,l,m,g;if(e[0]!==t.attempts||e[1]!==t.body||e[2]!==t.deadLettered||e[3]!==t.exportName||e[4]!==t.id||e[5]!==t.messageId||e[6]!==t.outcome||e[7]!==t.queue||e[8]!==s){const J=lt(t.body);n=de,p=`queues-message-${t.id}`;const F=t.exportName??t.queue;e[19]!==F?(x=a(w,{className:"font-mono text-xs",children:F}),e[19]=F,e[20]=x):x=e[20],e[21]!==t.messageId?(l=a(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:t.messageId,children:t.messageId}),e[21]=t.messageId,e[22]=l):l=e[22],e[23]!==t.attempts?(m=a(w,{className:"font-mono text-xs tabular-nums",children:t.attempts}),e[23]=t.attempts,e[24]=m):m=e[24];const E=`queues-outcome-${t.id}`;let L;e[25]!==t.outcome?(L=ct(t.outcome),e[25]=t.outcome,e[26]=L):L=e[26];let C;e[27]!==t.outcome||e[28]!==E||e[29]!==L?(C=a(Qe,{"data-testid":E,variant:L,children:t.outcome}),e[27]=t.outcome,e[28]=E,e[29]=L,e[30]=C):C=e[30];let M;e[31]!==t.deadLettered||e[32]!==t.id||e[33]!==s?(M=t.deadLettered&&a(Qe,{"data-testid":`queues-dlq-${t.id}`,variant:"destructive",children:s("DLQ")}),e[31]=t.deadLettered,e[32]=t.id,e[33]=s,e[34]=M):M=e[34],e[35]!==C||e[36]!==M?(g=a(w,{children:b("span",{className:"inline-flex items-center gap-1",children:[C,M]})}),e[35]=C,e[36]=M,e[37]=g):g=e[37],o=w,h="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=J,y=ut(J),e[0]=t.attempts,e[1]=t.body,e[2]=t.deadLettered,e[3]=t.exportName,e[4]=t.id,e[5]=t.messageId,e[6]=t.outcome,e[7]=t.queue,e[8]=s,e[9]=o,e[10]=n,e[11]=h,e[12]=i,e[13]=y,e[14]=p,e[15]=x,e[16]=l,e[17]=m,e[18]=g}else o=e[9],n=e[10],h=e[11],i=e[12],y=e[13],p=e[14],x=e[15],l=e[16],m=e[17],g=e[18];let f;e[38]!==o||e[39]!==h||e[40]!==i||e[41]!==y?(f=a(o,{className:h,title:i,children:y}),e[38]=o,e[39]=h,e[40]=i,e[41]=y,e[42]=f):f=e[42];let q;e[43]!==t.capturedAt?(q=at(t.capturedAt,"—"),e[43]=t.capturedAt,e[44]=q):q=e[44];let N;e[45]!==q?(N=a(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=N):N=e[46];const S=`queues-replay-${t.id}`,A=d!==null;let Q;e[47]!==t.id||e[48]!==d||e[49]!==s?(Q=d===t.id?s("Replaying…"):s("Replay"),e[47]=t.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let I;e[51]!==t.id||e[52]!==u||e[53]!==S||e[54]!==A||e[55]!==Q?(I=a(w,{children:a(oe,{"data-id":t.id,"data-testid":S,disabled:A,onClick:u,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=t.id,e[52]=u,e[53]=S,e[54]=A,e[55]=Q,e[56]=I):I=e[56];let T;return e[57]!==n||e[58]!==N||e[59]!==I||e[60]!==p||e[61]!==x||e[62]!==l||e[63]!==m||e[64]!==g||e[65]!==f?(T=b(n,{"data-testid":p,children:[x,l,m,g,f,N,I]}),e[57]=n,e[58]=N,e[59]=I,e[60]=p,e[61]=x,e[62]=l,e[63]=m,e[64]=g,e[65]=f,e[66]=T):T=e[66],T},pt=r=>{const e=P(26),{hasError:t,messages:u,onClear:d,onReplay:s,replayingId:o}=r,n=U();let h;e[0]!==n?(h=n("Cloudflare Queues have no peek API, so this is what push consumers actually processed — not pending depth."),e[0]=n,e[1]=h):h=e[1];let i;e[2]!==h?(i=a("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=i):i=e[3];const y=u.length===0;let p;e[4]!==n?(p=n("Clear log"),e[4]=n,e[5]=p):p=e[5];let x;e[6]!==d||e[7]!==y||e[8]!==p?(x=a(oe,{className:"ml-auto","data-testid":"queues-clear",disabled:y,onClick:d,size:"sm",type:"button",variant:"outline",children:p}),e[6]=d,e[7]=y,e[8]=p,e[9]=x):x=e[9];let l;e[10]!==u.length||e[11]!==n?(l=u.length>0&&a(Qe,{"data-testid":"queues-count",variant:"secondary",children:n("{count} messages",{count:u.length})}),e[10]=u.length,e[11]=n,e[12]=l):l=e[12];let m;e[13]!==i||e[14]!==x||e[15]!==l?(m=b("div",{className:"flex flex-wrap items-center gap-2",children:[i,x,l]}),e[13]=i,e[14]=x,e[15]=l,e[16]=m):m=e[16];let g;e[17]!==t||e[18]!==u||e[19]!==s||e[20]!==o||e[21]!==n?(g=!t&&u.length===0?a(Ie,{description:n("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:n("No consumed messages yet.")}):a(ke,{className:"overflow-hidden py-0",children:a(Oe,{className:"px-0",children:a(Ze,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:b(Be,{"data-testid":"queues-messages-table",children:[a(Je,{children:b(de,{children:[a($,{children:n("Export")}),a($,{children:n("Message")}),a($,{children:n("Attempts")}),a($,{children:n("Outcome")}),a($,{children:n("Body")}),a($,{children:n("Captured")}),a($,{})]})}),a(Fe,{children:u.map(q=>a(ht,{message:q,onReplay:s,replayingId:o},q.id))})]})})})}),e[17]=t,e[18]=u,e[19]=s,e[20]=o,e[21]=n,e[22]=g):g=e[22];let f;return e[23]!==m||e[24]!==g?(f=b("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[m,g]}),e[23]=m,e[24]=g,e[25]=f):f=e[25],f},gt=r=>{const e=P(20),{batchMode:t,bodyText:u,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:n,onSelectExport:h,onSend:i,queues:y,selectedExportName:p,sending:x}=r,l=U();let m;e[0]!==l?(m=l("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=l,e[1]=m):m=e[1];let g;e[2]!==m?(g=a("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=g):g=e[3];let f;e[4]!==t||e[5]!==u||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==n||e[10]!==h||e[11]!==i||e[12]!==y||e[13]!==p||e[14]!==x||e[15]!==l?(f=y.length===0?a(Ie,{description:l("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:l("No queues to send to")}):b(We,{children:[b("div",{className:"flex flex-wrap items-center gap-2",children:[a("select",{"aria-label":l("Queue"),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":"queues-send-select",onChange:h,value:p,children:y.map(xt)}),a(Ye,{"aria-label":l("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:n,placeholder:l("Delay (s)"),type:"number",value:d}),b("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[a("input",{checked:t,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),l("Send as batch (JSON array)")]}),a(oe,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||p==="",onClick:i,type:"button",children:l(x?"Sending…":"Send message")})]}),a(et,{"aria-label":l("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:t?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:u})]}),e[4]=t,e[5]=u,e[6]=d,e[7]=s,e[8]=o,e[9]=n,e[10]=h,e[11]=i,e[12]=y,e[13]=p,e[14]=x,e[15]=l,e[16]=f):f=e[16];let q;return e[17]!==g||e[18]!==f?(q=b("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[g,f]}),e[17]=g,e[18]=f,e[19]=q):q=e[19],q},Bt=r=>{const e=P(59),{limit:t}=r,u=t??rt,d=He(),s=U(),[o,n]=_("declared"),[h,i]=_(null);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];const{data:p,error:x,errorSource:l}=De(j.listQueues,y);let m;e[1]!==u?(m={limit:u},e[1]=u,e[2]=m):m=e[2];const{data:g,error:f,errorSource:q,refetch:N}=De(j.getQueueMessages,m),S=Array.isArray(p?.queues)?[...p.queues].toSorted(yt):[],A=g?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:I,showReliabilityWarning:T}=st(S,A),[J,F]=_(""),[E,L]=_(""),[C,M]=_(""),[W,ze]=_(!1),[le,Ee]=_(!1),[ue,Le]=_(null),G=S.some(c=>c.exportName===J)?J:S[0]?.exportName??"",Me=o==="messages"?f:x,je=o==="messages"?q:l,ce=Me??h,ie=Me===null?h:je;let K;e[3]!==N?(K=()=>{N()},e[3]=N,e[4]=K):K=e[4],tt(K,o==="messages");const me=async()=>{i(null);const c=G;if(c==="")return;let v=null;const _e=E.trim();if(_e!=="")try{v=JSON.parse(_e)}catch{i(s("Body must be valid JSON."));return}let Se;const Te=C.trim();if(Te!==""){const z=Number(Te);if(!Number.isFinite(z)||z<0){i(s("Delay must be a non-negative number of seconds."));return}Se=z}if(W&&!Array.isArray(v)){i(s("Batch mode needs a JSON array body — each element is enqueued as one message."));return}Ee(!0);const Ke=W?{batch:v,delaySeconds:Se,exportName:c}:{body:v,delaySeconds:Se,exportName:c};try{await d.query(nt,Ke,$e("")),N()}catch(z){i(we(z))}Ee(!1)};let H;e[5]!==d||e[6]!==N?(H=async c=>{i(null),Le(c);try{await d.query(ot,{id:c},$e("")),N()}catch(v){i(we(v))}Le(null)},e[5]=d,e[6]=N,e[7]=H):H=e[7];const he=H;let V;e[8]!==d||e[9]!==N?(V=async()=>{i(null);try{await d.query(dt,{},$e("")),N()}catch(c){i(we(c))}},e[8]=d,e[9]=N,e[10]=V):V=e[10];const pe=V;let X;e[11]===Symbol.for("react.memo_cache_sentinel")?(X=c=>{const v=c.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&n(v)},e[11]=X):X=e[11];const Pe=X;let Y;e[12]===Symbol.for("react.memo_cache_sentinel")?(Y=c=>{F(c.currentTarget.value)},e[12]=Y):Y=e[12];const ge=Y;let Z;e[13]===Symbol.for("react.memo_cache_sentinel")?(Z=c=>{L(c.currentTarget.value)},e[13]=Z):Z=e[13];const fe=Z;let ee;e[14]===Symbol.for("react.memo_cache_sentinel")?(ee=c=>{M(c.currentTarget.value)},e[14]=ee):ee=e[14];const xe=ee;let te;e[15]===Symbol.for("react.memo_cache_sentinel")?(te=c=>{ze(c.currentTarget.checked)},e[15]=te):te=e[15];const ye=te;let ae;e[16]!==me?(ae=()=>{Ce(me())},e[16]=me,e[17]=ae):ae=e[17];const Ne=ae;let se;e[18]!==he?(se=c=>{const{id:v}=c.currentTarget.dataset;v!==void 0&&Ce(he(v))},e[18]=he,e[19]=se):se=e[19];const be=se;let re;e[20]!==pe?(re=()=>{Ce(pe())},e[20]=pe,e[21]=re):re=e[21];const qe=re,Ue="flex flex-col gap-6",Ge="lunora-queues-panel";let D;e[22]!==s||e[23]!==o?(D=a("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(c=>a(oe,{"aria-selected":o===c,"data-tab":c,"data-testid":`queues-tab-${c}`,onClick:Pe,role:"tab",size:"sm",type:"button",variant:o===c?"secondary":"ghost",children:it(c,s)},c))}),e[22]=s,e[23]=o,e[24]=D):D=e[24];let R;e[25]!==ce||e[26]!==ie?(R=ce!==null&&a(Ve,{error:ie,testId:"queues-error"}),e[25]=ce,e[26]=ie,e[27]=R):R=e[27];const ve=T&&a(Xe,{icon:a("span",{"aria-hidden":"true",className:"text-base leading-none",children:"⚠"}),testId:"queues-dlq-warning",variant:"warning",children:b("div",{className:"flex flex-col gap-1",children:[I.length>0&&b(We,{children:[a("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:I.map(Nt).join(", ")})}),a("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&a("p",{className:I.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})});let k;e[28]!==S||e[29]!==p||e[30]!==o?(k=o==="declared"&&a(mt,{loaded:p!==void 0,queues:S}),e[28]=S,e[29]=p,e[30]=o,e[31]=k):k=e[31];let O;e[32]!==A||e[33]!==f||e[34]!==qe||e[35]!==be||e[36]!==ue||e[37]!==o?(O=o==="messages"&&a(pt,{hasError:f!==null,messages:A,onClear:qe,onReplay:be,replayingId:ue}),e[32]=A,e[33]=f,e[34]=qe,e[35]=be,e[36]=ue,e[37]=o,e[38]=O):O=e[38];let B;e[39]!==W||e[40]!==E||e[41]!==C||e[42]!==ye||e[43]!==fe||e[44]!==xe||e[45]!==ge||e[46]!==Ne||e[47]!==S||e[48]!==G||e[49]!==le||e[50]!==o?(B=o==="send"&&a(gt,{batchMode:W,bodyText:E,delayText:C,onBatchModeChange:ye,onBodyChange:fe,onDelayChange:xe,onSelectExport:ge,onSend:Ne,queues:S,selectedExportName:G,sending:le}),e[39]=W,e[40]=E,e[41]=C,e[42]=ye,e[43]=fe,e[44]=xe,e[45]=ge,e[46]=Ne,e[47]=S,e[48]=G,e[49]=le,e[50]=o,e[51]=B):B=e[51];let ne;return e[52]!==D||e[53]!==R||e[54]!==ve||e[55]!==k||e[56]!==O||e[57]!==B?(ne=b("div",{className:Ue,"data-testid":Ge,children:[D,R,ve,k,O,B]}),e[52]=D,e[53]=R,e[54]=ve,e[55]=k,e[56]=O,e[57]=B,e[58]=ne):ne=e[58],ne};function ft(r){return b(de,{"data-testid":`queues-row-${r.exportName}`,children:[a(w,{className:"font-mono text-xs",children:r.exportName}),a(w,{className:"font-mono text-xs text-muted-foreground",children:r.name}),a(w,{className:"font-mono text-xs text-muted-foreground",children:r.mode}),a(w,{className:"font-mono text-xs text-muted-foreground",children:r.binding}),a(w,{className:"font-mono text-xs text-muted-foreground",children:r.deadLetterQueue??"—"})]},r.exportName)}function xt(r){return a("option",{value:r.exportName,children:r.exportName},r.exportName)}function yt(r,e){return r.exportName.localeCompare(e.exportName)}function Nt(r){return r.name}export{Bt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as z}from"react/compiler-runtime";import{E as F}from"../packem_shared/error-alert-B59DnrDI.js";import{g as U}from"../packem_shared/badge-BbuuAio7.js";import{u as D,c as K}from"../packem_shared/card-CIDGUN6K.js";import{E as j}from"../packem_shared/empty-state-Cg7t_8qu.js";import{n as C,d as G,m as E,p as A,f as M,u as S}from"../packem_shared/table-DdJBrClo.js";import{K as J}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{useT as V}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as W}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{jsx as r,jsxs as o}from"react/jsx-runtime";const O=["read","insert","update","delete"],q=(e,t)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[t],B=e=>{const t=new Map;for(const s of e){const l=t.get(s.table)??{operations:new Set,procedures:[],table:s.table};l.operations.add(s.on),l.procedures.includes(s.procedure)||l.procedures.push(s.procedure),t.set(s.table,l)}return[...t.values()].toSorted((s,l)=>s.table.localeCompare(l.table))},ae=()=>{const e=z(49),t=V();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={},e[0]=s):s=e[0];const{data:l,error:I,errorSource:R}=J(W.rlsPolicies,s),c=l!==void 0;let p,n,m,a,h,u,f,x,i;if(e[1]!==l||e[2]!==I||e[3]!==R||e[4]!==c||e[5]!==t){const T=B(Array.isArray(l?.policies)?l.policies:[]);let k;e[15]!==l?(k=Array.isArray(l?.roles)?l.roles:[],e[15]=l,e[16]=k):k=e[16],n=k,f="flex flex-col gap-6",x="lunora-rls-panel",e[17]!==I||e[18]!==R?(i=I!==null&&r(F,{error:R,testId:"rls-error"}),e[17]=I,e[18]=R,e[19]=i):i=e[19],u="flex flex-col gap-2",p=K,m="overflow-hidden py-0";let v;e[20]!==t?(v=t("Policies"),e[20]=t,e[21]=v):v=e[21],e[22]!==v?(a=r("header",{className:"border-b border-border px-4 py-3",children:r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v})}),e[22]=v,e[23]=a):a=e[23],h=c&&T.length===0?r(j,{description:t("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:t("No policies defined")}):r(D,{className:"px-0",children:o(C,{"data-testid":"rls-policies-table",children:[r(G,{children:o(E,{children:[r(A,{children:t("Table")}),O.map(d=>r(A,{children:q(t,d)},d)),r(A,{children:t("Guarded by")})]})}),r(M,{children:T.map(d=>o(E,{"data-testid":`rls-table-${d.table}`,children:[r(S,{className:"font-mono text-xs",children:d.table}),O.map(_=>r(S,{children:d.operations.has(_)?r(U,{variant:"secondary",children:t("Guarded")}):r("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"})},_)),r(S,{className:"font-mono text-xs text-muted-foreground",children:d.procedures.join(", ")})]},d.table))})]})}),e[1]=l,e[2]=I,e[3]=R,e[4]=c,e[5]=t,e[6]=p,e[7]=n,e[8]=m,e[9]=a,e[10]=h,e[11]=u,e[12]=f,e[13]=x,e[14]=i}else p=e[6],n=e[7],m=e[8],a=e[9],h=e[10],u=e[11],f=e[12],x=e[13],i=e[14];let b;e[24]!==p||e[25]!==m||e[26]!==a||e[27]!==h?(b=o(p,{className:m,children:[a,h]}),e[24]=p,e[25]=m,e[26]=a,e[27]=h,e[28]=b):b=e[28];let N;e[29]!==u||e[30]!==b?(N=r("section",{className:u,children:b}),e[29]=u,e[30]=b,e[31]=N):N=e[31];let g;e[32]!==t?(g=t("Roles"),e[32]=t,e[33]=g):g=e[33];let y;e[34]!==g?(y=r("header",{className:"border-b border-border px-4 py-3",children:r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g})}),e[34]=g,e[35]=y):y=e[35];let $;e[36]!==c||e[37]!==n||e[38]!==t?($=c&&n.length===0?r(j,{description:t("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:t("No roles defined")}):r(D,{className:"px-0",children:o(C,{"data-testid":"rls-roles-table",children:[r(G,{children:o(E,{children:[r(A,{children:t("Role")}),r(A,{children:t("Description")}),r(A,{children:t("Permissions")})]})}),r(M,{children:n.map(L)})]})}),e[36]=c,e[37]=n,e[38]=t,e[39]=$):$=e[39];let w;e[40]!==y||e[41]!==$?(w=r("section",{className:"flex flex-col gap-2",children:o(K,{className:"overflow-hidden py-0",children:[y,$]})}),e[40]=y,e[41]=$,e[42]=w):w=e[42];let P;return e[43]!==w||e[44]!==f||e[45]!==x||e[46]!==i||e[47]!==N?(P=o("div",{className:f,"data-testid":x,children:[i,N,w]}),e[43]=w,e[44]=f,e[45]=x,e[46]=i,e[47]=N,e[48]=P):P=e[48],P};function H(e){return r(U,{variant:"outline",children:e},e)}function L(e){return o(E,{"data-testid":`rls-role-${e.name}`,children:[r(S,{className:"font-mono text-xs",children:e.name}),r(S,{className:"text-muted-foreground",children:e.description??""}),r(S,{children:e.permissions.length===0?r("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"}):r("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(H)})})]},e.name)}export{ae as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as D}from"react/compiler-runtime";import{useState as _,useMemo as X}from"react";import{u as G}from"../packem_shared/button-BkCrNcAs.js";import{useT as T}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{useLunora as W}from"@lunora/react";import{ConfirmButton as H}from"../packem_shared/ConfirmButton-CTL3f3kr.js";import{g as Z}from"../packem_shared/badge-BbuuAio7.js";import{c as B,u as A}from"../packem_shared/card-CIDGUN6K.js";import{E as z}from"../packem_shared/empty-state-Cg7t_8qu.js";import{n as E,d as K,m as P,p as x,f as V,u as b}from"../packem_shared/table-DdJBrClo.js";import{T as Y}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{f as R,e as O,i as ee}from"../packem_shared/internal-AtZ4bTal.js";import{jsxs as m,jsx as t}from"react/jsx-runtime";import{useAutoRefresh as Q}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{ScheduledJobs as te}from"../packem_shared/ScheduledJobs-DUbo6epc.js";const oe={kind:"idle"},le=({loadCronJobs:n,runCronJob:e}={})=>{const c=W(),i=T(),[f,a]=_({}),r=Y(["lunora-cron-jobs",n?"custom":"default"],()=>(n??(()=>c.getCronJobs()))()),{data:o,error:k}=r,h=X(()=>e!==void 0?e:n===void 0?l=>c.runCronJob(l):void 0,[c,n,e]),d=async l=>{if(h!==void 0){a(s=>({...s,[l]:{kind:"running"}}));try{await h(l),a(s=>({...s,[l]:{kind:"ok"}})),r.refetch()}catch(s){a(v=>({...v,[l]:{kind:"error",message:O(s)}}))}}};return m("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[k!==null&&t("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:k}),o?.length===0&&t(z,{description:i("Triggers declared with the cronJobs() builder appear here."),icon:m("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:i("No cron triggers.")}),o!==void 0&&o.length>0&&t(B,{className:"overflow-hidden py-0",children:t(A,{className:"px-0",children:m(E,{"data-testid":"cron-table",children:[t(K,{children:m(P,{children:[t(x,{children:i("name")}),t(x,{children:i("schedule")}),t(x,{children:i("target")}),t(x,{children:i("shard")}),h!==void 0&&t(x,{"aria-label":i("Actions")})]})}),t(V,{children:o.map(l=>{const s=f[l.name]??oe;return m(P,{"data-testid":`cron-row-${l.name}`,children:[t(b,{children:l.name}),t(b,{className:"font-mono text-xs tabular-nums",children:l.cron}),t(b,{children:m("span",{className:"flex items-center gap-2",children:[l.workflow===void 0?t(Z,{variant:"outline",children:i("function")}):t(Z,{variant:"secondary",children:i("workflow")}),t("span",{className:"font-mono text-xs",children:l.workflow??l.functionPath})]})}),t(b,{children:l.shardKey??""}),h!==void 0&&t(b,{className:"text-right",children:m("span",{className:"flex items-center justify-end gap-2",children:[s.kind==="ok"&&t("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${l.name}`,children:i("ran")}),s.kind==="error"&&t("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${l.name}`,role:"alert",children:s.message}),t(H,{confirmLabel:i("Run now?"),disabled:s.kind==="running",onConfirm:()=>{R(d(l.name))},testId:`cron-run-${l.name}`,children:s.kind==="running"?i("Running…"):i("Run now")})]})})]},`${l.cron}:${l.name}`)})})]})})})]})},re=n=>Number.isFinite(n)?ee(n,"—"):"—",ne=n=>{const e=D(34);let c;e[0]!==n?(c=n===void 0?{}:n,e[0]=n,e[1]=c):c=e[1];const{loadJobs:i,removeJob:f,retryJob:a}=c,r=W(),o=T();let k;e[2]===Symbol.for("react.memo_cache_sentinel")?(k=["lunora-dead-jobs"],e[2]=k):k=e[2];let h;e[3]!==r||e[4]!==i?(h=async()=>(await(i??(()=>r.listDeadJobs()))()).toSorted(ae),e[3]=r,e[4]=i,e[5]=h):h=e[5];const d=Y(k,h),l=d.data,[s,v]=_(void 0),N=d.error??s,u=i===void 0;let $;e[6]!==r||e[7]!==u||e[8]!==a?($=a??(u?p=>r.retryDeadJob(p):void 0),e[6]=r,e[7]=u,e[8]=a,e[9]=$):$=e[9];const g=$;let w;e[10]!==r||e[11]!==u||e[12]!==f?(w=f??(u?p=>r.removeDeadJob(p):void 0),e[10]=r,e[11]=u,e[12]=f,e[13]=w):w=e[13];const C=w;let J;e[14]!==d?(J=()=>{d.refetch()},e[14]=d,e[15]=J):J=e[15],Q(J,!0);let j;e[16]!==d?(j=async p=>{v(void 0);try{await p,d.refetch()}catch(U){v(O(U))}},e[16]=d,e[17]=j):j=e[17];const S=j,L=g!==void 0||C!==void 0;let q;e[18]!==N?(q=N!==void 0&&t("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:N}),e[18]=N,e[19]=q):q=e[19];let y;e[20]!==l?.length||e[21]!==o?(y=l?.length===0&&t(z,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),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:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=l?.length,e[21]=o,e[22]=y):y=e[22];let M;e[23]!==S||e[24]!==L||e[25]!==l||e[26]!==C||e[27]!==g||e[28]!==o?(M=l!==void 0&&l.length>0&&t(B,{className:"overflow-hidden py-0",children:t(A,{className:"px-0",children:m(E,{"data-testid":"dlq-table",children:[t(K,{children:m(P,{children:[t(x,{children:o("function")}),t(x,{children:o("attempts")}),t(x,{children:o("last tried")}),t(x,{children:o("pool")}),t(x,{children:o("shard")}),t(x,{children:o("id")}),L&&t(x,{"aria-label":o("Actions")})]})}),t(V,{children:l.map(p=>m(P,{"data-testid":`dlq-row-${p.id}`,children:[t(b,{className:"font-mono text-xs",children:p.functionPath}),t(b,{className:"tabular-nums",children:p.attempts??0}),t(b,{className:"text-muted-foreground tabular-nums",children:re(p.scheduledFor)}),t(b,{className:"font-mono text-xs",children:p.pool??""}),t(b,{children:p.shardKey??""}),t(b,{className:"font-mono text-xs",children:p.id}),L&&t(b,{className:"text-right",children:m("div",{className:"flex justify-end gap-1.5",children:[g!==void 0&&t(G,{"data-testid":`dlq-retry-${p.id}`,onClick:()=>{R(S(g(p.id)))},size:"sm",type:"button",variant:"outline",children:o("Retry")}),C!==void 0&&t(H,{confirmLabel:o("Drop job?"),onConfirm:()=>{R(S(C(p.id)))},testId:`dlq-remove-${p.id}`,children:o("Drop")})]})})]},p.id))})]})})}),e[23]=S,e[24]=L,e[25]=l,e[26]=C,e[27]=g,e[28]=o,e[29]=M):M=e[29];let I;return e[30]!==M||e[31]!==q||e[32]!==y?(I=m("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[q,y,M]}),e[30]=M,e[31]=q,e[32]=y,e[33]=I):I=e[33],I};function ae(n,e){return(e.attempts??0)-(n.attempts??0)}const F=n=>{const e=D(8),{label:c,testId:i,value:f}=n;let a;e[0]!==c?(a=t("span",{className:"text-xs text-muted-foreground",children:c}),e[0]=c,e[1]=a):a=e[1];let r;e[2]!==i||e[3]!==f?(r=t("span",{className:"text-2xl font-semibold tabular-nums","data-testid":i,children:f}),e[2]=i,e[3]=f,e[4]=r):r=e[4];let o;return e[5]!==a||e[6]!==r?(o=t(B,{className:"flex-1 py-0",children:m(A,{className:"flex flex-col gap-1 p-4",children:[a,r]})}),e[5]=a,e[6]=r,e[7]=o):o=e[7],o},de=n=>{const e=D(25);let c;e[0]!==n?(c=n===void 0?{}:n,e[0]=n,e[1]=c):c=e[1];const{loadStatus:i}=c,f=W(),a=T(),r=i===void 0;let o;e[2]!==r?(o=["lunora-scheduler-status",r],e[2]=r,e[3]=o):o=e[3];let k;e[4]!==f||e[5]!==i?(k=async()=>{const w=await(i??(()=>f.schedulerStatus()))();return{...w,pools:w.pools.toSorted(ie)}},e[4]=f,e[5]=i,e[6]=k):k=e[6];const h=Y(o,k),{data:d,error:l}=h;let s;e[7]!==h?(s=()=>{h.refetch()},e[7]=h,e[8]=s):s=e[8],Q(s,!0);let v;e[9]!==l?(v=l!==null&&t("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:l}),e[9]=l,e[10]=v):v=e[10];let N;e[11]!==d||e[12]!==a?(N=d!==void 0&&m("div",{className:"flex gap-3","data-testid":"pools-totals",children:[t(F,{label:a("backlog"),testId:"pools-backlog",value:d.backlog}),t(F,{label:a("in flight"),testId:"pools-inflight",value:d.inFlight}),t(F,{label:a("pools"),testId:"pools-count",value:d.pools.length})]}),e[11]=d,e[12]=a,e[13]=N):N=e[13];let u;e[14]!==d?.pools.length||e[15]!==a?(u=d?.pools.length===0&&t(z,{description:a("Pools created with createWorkpool appear here once they have activity."),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 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[14]=d?.pools.length,e[15]=a,e[16]=u):u=e[16];let $;e[17]!==d||e[18]!==a?($=d!==void 0&&d.pools.length>0&&t(B,{className:"overflow-hidden py-0",children:t(A,{className:"px-0",children:m(E,{"data-testid":"pools-table",children:[t(K,{children:m(P,{children:[t(x,{children:a("pool")}),t(x,{children:a("queued")}),t(x,{children:a("in flight")}),t(x,{children:a("max concurrency")})]})}),t(V,{children:d.pools.map(se)})]})})}),e[17]=d,e[18]=a,e[19]=$):$=e[19];let g;return e[20]!==v||e[21]!==N||e[22]!==u||e[23]!==$?(g=m("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[v,N,u,$]}),e[20]=v,e[21]=N,e[22]=u,e[23]=$,e[24]=g):g=e[24],g};function ie(n,e){return e.queued-n.queued}function se(n){return m(P,{"data-testid":`pools-row-${n.name}`,children:[t(b,{className:"font-mono text-xs",children:n.name}),t(b,{className:"tabular-nums",children:n.queued}),m(b,{className:"tabular-nums",children:[n.inFlight," / ",n.maxConcurrency]}),t(b,{className:"tabular-nums",children:n.maxConcurrency})]},n.name)}const ce=["jobs","dead","pools","cron"],Je=n=>{const e=D(41);let c;e[0]!==n?(c=n===void 0?{}:n,e[0]=n,e[1]=c):c=e[1];const{loadCronJobs:i,scheduledCancel:f,scheduledLoad:a}=c,r=T(),[o,k]=_("jobs");let h;e[2]!==r?(h=r("Cron triggers"),e[2]=r,e[3]=h):h=e[3];let d;e[4]!==r?(d=r("Dead letter"),e[4]=r,e[5]=d):d=e[5];let l;e[6]!==r?(l=r("Scheduled jobs"),e[6]=r,e[7]=l):l=e[7];let s;e[8]!==r?(s=r("Pools"),e[8]=r,e[9]=s):s=e[9];let v;e[10]!==h||e[11]!==d||e[12]!==l||e[13]!==s?(v={cron:h,dead:d,jobs:l,pools:s},e[10]=h,e[11]=d,e[12]=l,e[13]=s,e[14]=v):v=e[14];const N=v;let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=y=>{k(y.currentTarget.dataset.view)},e[15]=u):u=e[15];const $=u;let g;e[16]!==r?(g=r("Schedule view"),e[16]=r,e[17]=g):g=e[17];let w;e[18]!==o||e[19]!==N?(w=ce.map(y=>t(G,{"aria-selected":o===y,"data-testid":`schedule-view-${y}`,"data-view":y,onClick:$,role:"tab",size:"sm",type:"button",variant:o===y?"default":"outline",children:N[y]},y)),e[18]=o,e[19]=N,e[20]=w):w=e[20];let C;e[21]!==g||e[22]!==w?(C=t("div",{"aria-label":g,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:w}),e[21]=g,e[22]=w,e[23]=C):C=e[23];let J;e[24]!==f||e[25]!==a||e[26]!==o?(J=o==="jobs"&&t(te,{cancelJob:f,loadJobs:a}),e[24]=f,e[25]=a,e[26]=o,e[27]=J):J=e[27];let j;e[28]!==o?(j=o==="dead"&&t(ne,{}),e[28]=o,e[29]=j):j=e[29];let S;e[30]!==o?(S=o==="pools"&&t(de,{}),e[30]=o,e[31]=S):S=e[31];let L;e[32]!==i||e[33]!==o?(L=o==="cron"&&t(le,{loadCronJobs:i}),e[32]=i,e[33]=o,e[34]=L):L=e[34];let q;return e[35]!==C||e[36]!==J||e[37]!==j||e[38]!==S||e[39]!==L?(q=m("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[C,J,j,S,L]}),e[35]=C,e[36]=J,e[37]=j,e[38]=S,e[39]=L,e[40]=q):q=e[40],q};export{Je as SchedulePanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as m}from"react/compiler-runtime";import{B as u,E as f}from"../packem_shared/bar-chart-AryFCeoa.js";import{jsx as c}from"react/jsx-runtime";const d={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},b=n=>{const e=m(6),{data:o}=n;let a,r;if(e[0]!==o){r=Symbol.for("react.early_return_sentinel");e:{const s=o.slice(-16);if(s.length<3){r=null;break e}a=s.map(h)}e[0]=o,e[1]=a,e[2]=r}else a=e[1],r=e[2];if(r!==Symbol.for("react.early_return_sentinel"))return r;const i=a;let t;e[3]===Symbol.for("react.memo_cache_sentinel")?(t=c(u,{dataKey:"value"}),e[3]=t):t=e[3];let l;return e[4]!==i?(l=c("div",{"aria-hidden":"true",className:"h-8 w-28",children:c(f,{animationType:"none",barCategoryGap:1,className:"h-8 w-full",config:d,data:i,children:t})}),e[4]=i,e[5]=l):l=e[5],l};function h(n,e){return{index:e,value:n}}export{b as Sparkline};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as b}from"react/compiler-runtime";import{E as y}from"../packem_shared/error-alert-B59DnrDI.js";import{g as N}from"../packem_shared/badge-BbuuAio7.js";import{c as k,u as S}from"../packem_shared/card-CIDGUN6K.js";import{E as w}from"../packem_shared/empty-state-Cg7t_8qu.js";import{n as R,d as v,m as x,p as u,f as A,u as p}from"../packem_shared/table-DdJBrClo.js";import{K as E}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{useT as j}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as I}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{jsx as t,jsxs as f}from"react/jsx-runtime";const C=(e,r)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[r],$={delete:2,list:3,read:0,write:1},T=e=>[...e].toSorted((r,s)=>r.bucket.localeCompare(s.bucket)||$[r.on]-$[s.on]||(r.prefix??"").localeCompare(s.prefix??"")),U=()=>{const e=b(14),r=j();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={},e[0]=s):s=e[0];const{data:l,error:i,errorSource:d}=E(I.storageRules,s),h=l!==void 0;let n;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==r){const g=T(Array.isArray(l?.rules)?l.rules:[]);let c;e[7]!==i||e[8]!==d?(c=i!==null&&t(y,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=c):c=e[9];let a;e[10]!==r?(a=r("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=r,e[11]=a):a=e[11];let m;e[12]!==a?(m=t("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:a}),e[12]=a,e[13]=m):m=e[13],n=f("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[c,m,h&&g.length===0?t(w,{description:r("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:r("No storage rules defined")}):t(k,{className:"overflow-hidden py-0",children:t(S,{className:"px-0",children:f(R,{"data-testid":"storage-rules-table",children:[t(v,{children:f(x,{children:[t(u,{children:r("Bucket")}),t(u,{children:r("Operation")}),t(u,{children:r("Key prefix")}),t(u,{children:r("Guarded by")})]})}),t(A,{children:g.map(o=>f(x,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[t(p,{className:"font-mono text-xs",children:o.bucket}),t(p,{children:t(N,{variant:"secondary",children:C(r,o.on)})}),t(p,{className:"font-mono text-xs",children:o.prefix??t("span",{className:"text-muted-foreground",children:r("(whole bucket)")})}),t(p,{className:"font-mono text-xs text-muted-foreground",children:o.procedure})]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=r,e[6]=n}else n=e[6];return n};export{U as StorageRulesPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as T}from"react/compiler-runtime";import{useState as j}from"react";import{E as K}from"../packem_shared/error-alert-B59DnrDI.js";import{ShardInput as P}from"../packem_shared/ShardInput-BVn2iCU0.js";import{g as $}from"../packem_shared/badge-BbuuAio7.js";import{c as _,u as D}from"../packem_shared/card-CIDGUN6K.js";import{E as F}from"../packem_shared/empty-state-Cg7t_8qu.js";import{n as L,d as O,m as C,p as g,f as U,u as N}from"../packem_shared/table-DdJBrClo.js";import{K as W}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{useAutoRefresh as B}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import J from"../packem_shared/useDebounced-Ihdiid_k.js";import{useT as Q}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as R}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{jsx as e,jsxs as c}from"react/jsx-runtime";const E=80,X=a=>{if(a===void 0)return"";const t=JSON.stringify(a);return t.length>E?`${t.slice(0,E)}…`:t},Z=a=>{const t=[];for(const o of a){const n=o.id.toString();if(o.subscriptions.length===0){t.push({admin:o.admin,connectionId:o.id,key:`c${n}`,subscription:null});continue}o.subscriptions.forEach((r,S)=>{t.push({admin:o.admin,connectionId:o.id,key:`c${n}-s${S.toString()}`,subscription:r})})}return t},w=e("span",{className:"text-muted-foreground",children:"—"}),at=a=>{const t=T(22),{initialShardKey:o}=a,n=Q(),[r,S]=j(o??"");let u;t[0]!==r?(u=r.trim(),t[0]=r,t[1]=u):u=t[1];const y=J(u,400);let h;t[2]===Symbol.for("react.memo_cache_sentinel")?(h={},t[2]=h):h=t[2];let p;t[3]!==y?(p={keepPreviousData:!0,shardKey:y},t[3]=y,t[4]=p):p=t[4];const{data:i,error:s,errorSource:m,refetch:M}=W(R.listSubscriptions,h,p);B(M,!0);let f;if(t[5]!==s||t[6]!==m||t[7]!==i||t[8]!==r||t[9]!==n){const k=i===void 0?[]:Z(i.connections);let l;t[11]!==r?(l=e(P,{onChange:S,testId:"subs-shard-input",value:r}),t[11]=r,t[12]=l):l=t[12];let d;t[13]!==i||t[14]!==n?(d=i!==void 0&&c("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[e($,{variant:"secondary",children:n("{count} connections",{count:i.totalConnections})}),e($,{variant:"secondary",children:n("{count} subscriptions",{count:i.totalSubscriptions})})]}),t[13]=i,t[14]=n,t[15]=d):d=t[15];let b;t[16]!==l||t[17]!==d?(b=c("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]}),t[16]=l,t[17]=d,t[18]=b):b=t[18];let v;t[19]!==s||t[20]!==m?(v=s!==null&&e(K,{error:m,testId:"subs-error"}),t[19]=s,t[20]=m,t[21]=v):v=t[21],f=c("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[b,v,s===null&&i!==void 0&&k.length===0&&e(F,{description:n("Active WebSocket subscriptions on this shard."),icon:e("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:e("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),s===null&&k.length>0&&e(_,{className:"overflow-hidden py-0",children:e(D,{className:"px-0",children:c(L,{"data-testid":"subs-table",children:[e(O,{children:c(C,{children:[e(g,{children:n("Connection")}),e(g,{children:n("Function path")}),e(g,{children:n("Table")}),e(g,{children:n("Arguments")})]})}),e(U,{children:k.map(x=>{const{subscription:I}=x,A=X(I?.args);return c(C,{"data-testid":"subs-row",children:[e(N,{className:"font-medium tabular-nums",children:c("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&e($,{variant:"outline",children:n("admin")})]})}),e(N,{className:"font-mono text-xs",children:I?.functionPath??w}),e(N,{children:I?.table??w}),e(N,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:A||void 0,children:A||w})]},x.key)})})]})})})]}),t[5]=s,t[6]=m,t[7]=i,t[8]=r,t[9]=n,t[10]=f}else f=t[10];return f};export{at as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as D}from"react/compiler-runtime";import{useLunora as O}from"@lunora/react";import{g as C}from"../packem_shared/badge-BbuuAio7.js";import{c as K,u as L}from"../packem_shared/card-CIDGUN6K.js";import{E as j}from"../packem_shared/empty-state-Cg7t_8qu.js";import{n as A,d as E,m as T,p as i,f as M,u as c}from"../packem_shared/table-DdJBrClo.js";import{T as Y}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{useAutoRefresh as B}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{useT as F}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{jsx as t,jsxs as s}from"react/jsx-runtime";const G=2e3,H=new Set(["open"]),re=W=>{const e=D(41),{read:x}=W,n=F(),_=O();let S;e[0]!==_||e[1]!==x?(S=()=>Promise.resolve(x?x():_.debug()),e[0]=_,e[1]=x,e[2]=S):S=e[2];const q=S,P=x?"injected":"live";let v;e[3]!==P?(v=["lunora-studio","sync-client-debug",P],e[3]=P,e[4]=v):v=e[4];const{data:l,refetch:z}=Y(v,q);if(B(z,!0,G),!l){let r;e[5]!==n?(r=n("Reading the sync client's state…"),e[5]=n,e[6]=r):r=e[6];let y;e[7]!==n?(y=n("Sync client"),e[7]=n,e[8]=y):y=e[8];let w;return e[9]!==r||e[10]!==y?(w=t(K,{children:t(L,{children:t(j,{description:r,title:y})})}),e[9]=r,e[10]=y,e[11]=w):w=e[11],w}const{pendingWrites:$,shards:b,subscriptions:N}=l;let o;e[12]!==n?(o=n("This Studio session's sync client"),e[12]=n,e[13]=o):o=e[13];let d;e[14]!==o?(d=t("span",{className:"text-sm font-medium",children:o}),e[14]=o,e[15]=d):d=e[15];const R=l.connectionStatus==="connected"?"default":"secondary";let a;e[16]!==l.connectionStatus||e[17]!==R?(a=t(C,{variant:R,children:l.connectionStatus}),e[16]=l.connectionStatus,e[17]=R,e[18]=a):a=e[18];let h;e[19]!==$||e[20]!==n?(h=$>0?t(C,{variant:"secondary",children:n("{count} pending writes",{count:$})}):null,e[19]=$,e[20]=n,e[21]=h):h=e[21];let u;e[22]!==d||e[23]!==a||e[24]!==h?(u=s("div",{className:"flex flex-wrap items-center gap-2",children:[d,a,h]}),e[22]=d,e[23]=a,e[24]=h,e[25]=u):u=e[25];let m;e[26]!==n?(m=n("Reads client.debug() for the client running in this page — not your application's client. Call client.debug() in your app to diagnose a specific stuck overlay there."),e[26]=n,e[27]=m):m=e[27];let p;e[28]!==m?(p=t("p",{className:"text-muted-foreground text-xs",children:m}),e[28]=m,e[29]=p):p=e[29];let f;e[30]!==b||e[31]!==n?(f=b.length===0?t(j,{description:n("No shard connection has been opened yet."),title:n("No shards")}):s(A,{children:[t(E,{children:s(T,{children:[t(i,{children:n("Shard")}),t(i,{children:n("Socket")}),t(i,{children:n("Confirmed watermark")})]})}),t(M,{children:b.map(r=>s(T,{children:[t(c,{children:r.shardKey??n("(default)")}),t(c,{children:t(C,{variant:H.has(r.wsState)?"default":"secondary",children:r.wsState})}),t(c,{children:r.confirmedMutationWatermark})]},r.shardKey??"__default__"))})]}),e[30]=b,e[31]=n,e[32]=f):f=e[32];let g;e[33]!==N||e[34]!==n?(g=N.length===0?t(j,{description:n("This client holds no live queries or shapes."),title:n("No subscriptions")}):s(A,{children:[t(E,{children:s(T,{children:[t(i,{children:n("Subscription")}),t(i,{children:n("Kind")}),t(i,{children:n("Acked")}),t(i,{children:n("Cursor")}),t(i,{children:n("Pending overlays")})]})}),t(M,{children:N.map(r=>s(T,{children:[t(c,{className:"font-mono text-xs",children:r.functionPath}),t(c,{children:r.kind}),t(c,{children:t(C,{variant:r.acked?"default":"secondary",children:r.acked?n("yes"):n("no")})}),t(c,{children:r.serverCursor??"—"}),t(c,{children:r.pendingOptimisticLayers})]},r.id))})]}),e[33]=N,e[34]=n,e[35]=g):g=e[35];let k;return e[36]!==p||e[37]!==f||e[38]!==g||e[39]!==u?(k=t(K,{children:s(L,{className:"flex flex-col gap-4",children:[u,p,f,g]})}),e[36]=p,e[37]=f,e[38]=g,e[39]=u,e[40]=k):k=e[40],k};export{re as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as z}from"react/compiler-runtime";import{useState as Q,useEffect as J}from"react";import{f as Y}from"../packem_shared/log-fields-CoL3hsIQ.js";import{E as Z}from"../packem_shared/error-alert-B59DnrDI.js";import{L as ee}from"../packem_shared/live-status-CGW2JHf_.js";import{ShardInput as te}from"../packem_shared/ShardInput-BVn2iCU0.js";import{g as re}from"../packem_shared/badge-BbuuAio7.js";import{E as ae}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as se}from"../packem_shared/input-JHu63lTv.js";import{K as ne}from"../packem_shared/use-admin-query-Di3fLE8H.js";import oe from"../packem_shared/useDebounced-Ihdiid_k.js";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as le}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{i as ie}from"../packem_shared/internal-AtZ4bTal.js";import{r as de}from"../packem_shared/shard-history-DMEW5VBE.js";import{p as ce,c as me}from"../packem_shared/trace-handoff-Dw7mwjxu.js";import{c as ue}from"../packem_shared/utils-bhneXptQ.js";import{jsx as s,jsxs as B}from"react/jsx-runtime";const V=o=>Math.min(100,Math.max(0,o)),he=(o,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};const t=V(o.offsetMs/e*100),a=o.durationMs/e*100,r=Math.max(.5,Math.min(V(a),100-t));return{leftPercent:t,widthPercent:r}},fe=(o,e)=>{const t=e.trim().toLowerCase();return t===""?[...o]:o.filter(a=>a.rootName.toLowerCase().includes(t)||a.functionPath.toLowerCase().includes(t)||a.traceId.toLowerCase().includes(t))},U=o=>Number.isFinite(o)?o>0&&o<1?`${o.toFixed(2)}ms`:`${String(Math.round(o))}ms`:"—",pe=14,ge=o=>Array.isArray(o?.traces)?o.traces:[],xe=o=>{const e=z(50),{span:t,traceDurationMs:a}=o,r=G();let n;e[0]!==t||e[1]!==a?(n=he(t,a),e[0]=t,e[1]=a,e[2]=n):n=e[2];const{leftPercent:S,widthPercent:x}=n;let P;e[3]!==t.attributes?(P=Y(t.attributes),e[3]=t.attributes,e[4]=P):P=e[4];const M=P,L=t.depth*pe;let y;e[5]!==L?(y={paddingLeft:L},e[5]=L,e[6]=y):y=e[6];const b=y,c=`${String(S)}%`,w=`${String(x)}%`;let p;e[7]!==c||e[8]!==w?(p={left:c,width:w},e[7]=c,e[8]=w,e[9]=p):p=e[9];const l=p,f=t.depth;let i;e[10]!==t.ok||e[11]!==r?(i=t.ok?null:s("span",{"aria-label":r("Errored span"),className:"mr-1 text-destructive","data-testid":"tr-span-error",role:"img",children:"●"}),e[10]=t.ok,e[11]=r,e[12]=i):i=e[12];let v;e[13]!==b||e[14]!==t.name||e[15]!==i?(v=B("span",{className:"w-56 shrink-0 truncate",role:"gridcell",style:b,title:t.name,children:[i,t.name]}),e[13]=b,e[14]=t.name,e[15]=i,e[16]=v):v=e[16];let d;e[17]!==t.durationMs||e[18]!==t.offsetMs||e[19]!==r?(d=r("starts {offset} in, runs {duration}",{duration:U(t.durationMs),offset:U(t.offsetMs)}),e[17]=t.durationMs,e[18]=t.offsetMs,e[19]=r,e[20]=d):d=e[20];const N=t.ok?"bg-primary/70":"bg-destructive";let m;e[21]!==N?(m=ue("absolute inset-y-0 rounded-sm",N),e[21]=N,e[22]=m):m=e[22];let u;e[23]!==l||e[24]!==S||e[25]!==m||e[26]!==x?(u=s("span",{className:m,"data-left":S,"data-testid":"tr-span-bar","data-width":x,style:l}),e[23]=l,e[24]=S,e[25]=m,e[26]=x,e[27]=u):u=e[27];let h;e[28]!==d||e[29]!==u?(h=s("span",{"aria-label":d,className:"relative h-3 flex-1 overflow-hidden rounded-sm bg-muted",role:"gridcell",children:u}),e[28]=d,e[29]=u,e[30]=h):h=e[30];let g;e[31]!==t.durationMs?(g=U(t.durationMs),e[31]=t.durationMs,e[32]=g):g=e[32];let k;e[33]!==g?(k=s("span",{className:"w-16 shrink-0 text-right tabular-nums text-muted-foreground",role:"gridcell",children:g}),e[33]=g,e[34]=k):k=e[34];let I;e[35]!==t.error?(I=t.error===void 0?null:s("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=I):I=e[36];let T;e[37]!==I?(T=s("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:I}),e[37]=I,e[38]=T):T=e[38];let C;e[39]!==M?(C=M===""?null:s("span",{"data-testid":"tr-span-attributes",title:M,children:M}),e[39]=M,e[40]=C):C=e[40];let $;e[41]!==C?($=s("span",{className:"w-64 shrink-0 truncate text-muted-foreground",role:"gridcell",children:C}),e[41]=C,e[42]=$):$=e[42];let F;return e[43]!==t.depth||e[44]!==v||e[45]!==h||e[46]!==k||e[47]!==T||e[48]!==$?(F=B("div",{className:"flex items-center gap-2 border-b border-border px-3 py-1.5 font-mono text-xs last:border-b-0 hover:bg-muted/50","data-depth":f,"data-testid":"tr-span-row",role:"row",children:[v,h,k,T,$]}),e[43]=t.depth,e[44]=v,e[45]=h,e[46]=k,e[47]=T,e[48]=$,e[49]=F):F=e[49],F},be=o=>{const e=z(50),{expanded:t,onToggle:a,trace:r}=o,n=G();let S;e[0]!==a||e[1]!==r.traceId?(S=()=>{a(r.traceId)},e[0]=a,e[1]=r.traceId,e[2]=S):S=e[2];const x=S,P=`tr-row-${r.traceId}`,M=`tr-waterfall-${r.traceId}`,L=`tr-toggle-${r.traceId}`,y=t?"▾":"▸";let b;e[3]!==y?(b=s("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:y}),e[3]=y,e[4]=b):b=e[4];let c;e[5]!==r.rootName?(c=s("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=c):c=e[6];let w;e[7]!==r.functionPath?(w=s("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let p;e[9]!==r.durationMs?(p=U(r.durationMs),e[9]=r.durationMs,e[10]=p):p=e[10];let l;e[11]!==p?(l=s("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:p}),e[11]=p,e[12]=l):l=e[12];let f;e[13]!==n||e[14]!==r.spans.length?(f=n("{count} spans",{count:r.spans.length}),e[13]=n,e[14]=r.spans.length,e[15]=f):f=e[15];let i;e[16]!==f?(i=s("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:f}),e[16]=f,e[17]=i):i=e[17];const v=r.ok?"secondary":"destructive";let d;e[18]!==n||e[19]!==r.ok?(d=r.ok?n("ok"):n("error"),e[18]=n,e[19]=r.ok,e[20]=d):d=e[20];let N;e[21]!==v||e[22]!==d?(N=s("span",{className:"shrink-0",children:s(re,{variant:v,children:d})}),e[21]=v,e[22]=d,e[23]=N):N=e[23];let m;e[24]!==r.startTs?(m=ie(r.startTs),e[24]=r.startTs,e[25]=m):m=e[25];let u;e[26]!==m?(u=s("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:m}),e[26]=m,e[27]=u):u=e[27];let h;e[28]!==t||e[29]!==x||e[30]!==l||e[31]!==i||e[32]!==N||e[33]!==u||e[34]!==M||e[35]!==L||e[36]!==b||e[37]!==c||e[38]!==w?(h=B("button",{"aria-controls":M,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":L,onClick:x,type:"button",children:[b,c,w,l,i,N,u]}),e[28]=t,e[29]=x,e[30]=l,e[31]=i,e[32]=N,e[33]=u,e[34]=M,e[35]=L,e[36]=b,e[37]=c,e[38]=w,e[39]=h):h=e[39];let g;e[40]!==t||e[41]!==n||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(g=t&&s("div",{"aria-label":n("Trace waterfall"),className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,role:"grid",children:r.spans.map(I=>s(xe,{span:I,traceDurationMs:r.durationMs},I.spanId))}),e[40]=t,e[41]=n,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=g):g=e[45];let k;return e[46]!==h||e[47]!==g||e[48]!==P?(k=B("div",{className:"border-b border-border last:border-b-0","data-testid":P,children:[h,g]}),e[46]=h,e[47]=g,e[48]=P,e[49]=k):k=e[49],k},Be=o=>{const e=z(44),{initialShardKey:t}=o,a=G(),[r]=Q(ce),[n,S]=Q(r?.shardKey!==void 0&&r.shardKey!==""?r.shardKey:t??""),[x,P]=Q(r?.traceId??""),[M,L]=Q(we);let y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],J(Ne,y);let b;e[1]!==n?(b=n.trim(),e[1]=n,e[2]=b):b=e[2];const c=oe(b,400);let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let p;e[4]!==c?(p={live:!0,shardKey:c},e[4]=c,e[5]=p):p=e[5];const{data:l,error:f,errorSource:i,isLoading:v,liveError:d}=ne(le.getTraces,w,p);let N,m;e[6]!==l||e[7]!==c?(N=()=>{l!==void 0&&de(c)},m=[l,c],e[6]=l,e[7]=c,e[8]=N,e[9]=m):(N=e[8],m=e[9]),J(N,m);let u;if(e[10]!==l||e[11]!==f||e[12]!==i||e[13]!==M||e[14]!==v||e[15]!==d||e[16]!==x||e[17]!==n||e[18]!==a){const h=ge(l),g=l?.total??h.length,k=g>h.length,I=fe(h,x);let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=_=>{P(_.target.value)},e[20]=T):T=e[20];const C=T;let $;e[21]===Symbol.for("react.memo_cache_sentinel")?($=_=>{L(X=>{const H=new Set(X);return H.has(_)?H.delete(_):H.add(_),H})},e[21]=$):$=e[21];const F=$,W=f===null&&I.length===0&&!v;let K;e[22]!==n?(K=s(te,{onChange:S,testId:"tr-shard-input",value:n}),e[22]=n,e[23]=K):K=e[23];let A;e[24]!==a?(A=a("Search traces"),e[24]=a,e[25]=A):A=e[25];let D;e[26]!==a?(D=a("search trace or function"),e[26]=a,e[27]=D):D=e[27];let j;e[28]!==x||e[29]!==A||e[30]!==D?(j=s(se,{"aria-label":A,className:"h-8 w-56","data-testid":"tr-search",onChange:C,placeholder:D,value:x}),e[28]=x,e[29]=A,e[30]=D,e[31]=j):j=e[31];let E;e[32]!==d?(E=s(ee,{message:d,prefix:"tr"}),e[32]=d,e[33]=E):E=e[33];let R;e[34]!==K||e[35]!==j||e[36]!==E?(R=B("div",{className:"flex flex-wrap items-center gap-2",children:[K,j,E]}),e[34]=K,e[35]=j,e[36]=E,e[37]=R):R=e[37];let O;e[38]!==f||e[39]!==i?(O=f!==null&&s(Z,{error:i,testId:"tr-error"}),e[38]=f,e[39]=i,e[40]=O):O=e[40];let q;e[41]!==W||e[42]!==a?(q=W&&s(ae,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:s("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:s("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[41]=W,e[42]=a,e[43]=q):q=e[43],u=B("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[R,O,q,f===null&&k&&s("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:h.length,total:g})}),f===null&&I.length>0&&s("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:I.map(_=>s(be,{expanded:M.has(_.traceId),onToggle:F,trace:_},_.traceId))})]}),e[10]=l,e[11]=f,e[12]=i,e[13]=M,e[14]=v,e[15]=d,e[16]=x,e[17]=n,e[18]=a,e[19]=u}else u=e[19];return u};function we(){return new Set}function Ne(){me()}export{Be as TracesPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useLunora as ge}from"@lunora/react";import{useState as $,useEffect as Ve}from"react";import{g as M}from"../packem_shared/badge-BbuuAio7.js";import{u as S}from"../packem_shared/button-BkCrNcAs.js";import{c as $e,u as Fe}from"../packem_shared/card-CIDGUN6K.js";import{E as Je}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as j}from"../packem_shared/input-JHu63lTv.js";import{n as Ue,d as Pe,m as L,p as z,f as _e,u as U}from"../packem_shared/table-DdJBrClo.js";import{T as Ke}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{c as Ne}from"react/compiler-runtime";import{a as Oe,u as We}from"../packem_shared/use-async-submit-H68GHPz8.js";import{useAutoRefresh as Ze}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import Qe from"../packem_shared/useDebounced-Ihdiid_k.js";import{useT as ke}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{i as Ie,h as Ae,f as Re,e as Ee}from"../packem_shared/internal-AtZ4bTal.js";import{f as Xe}from"../packem_shared/checkbox-StT4Gob6.js";import{p as V}from"../packem_shared/label-6uP1obNF.js";import{M as Ge}from"../packem_shared/modal-shell-CUwwWC2o.js";import{jsx as t,jsxs as n,Fragment as Ye}from"react/jsx-runtime";const et=()=>{const u=Ne(3),{config:e,ready:s}=Oe();let l;return u[0]!==e.capabilities||u[1]!==s?(l={capabilities:e.capabilities,ready:s},u[0]=e.capabilities,u[1]=s,u[2]=l):l=u[2],l},tt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},at=(u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),lt=(u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;const s=typeof e=="string"?e.trim():"";if(s!==""){if(u.type==="number"){const l=Number(s);return Number.isNaN(l)?void 0:{value:l}}return{value:s}}},st=u=>{const e=Ne(105),{onClose:s,onCreated:l}=u,c=ge(),a=ke(),{config:o}=Oe(),{busy:r,error:i,run:m}=We(),[k,I]=$(""),[x,w]=$(""),[y,A]=$(""),[h,g]=$("");let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v={},e[0]=v):v=e[0];const[f,d]=$(v);let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=p=>{I(p.target.value)},e[1]=C):C=e[1];const b=C;let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=p=>{w(p.target.value)},e[2]=F):F=e[2];const T=F;let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=p=>{A(p.target.value)},e[3]=_):_=e[3];const De=_;let O;e[4]===Symbol.for("react.memo_cache_sentinel")?(O=p=>{g(p.target.value)},e[4]=O):O=e[4];const je=O;let G;e[5]===Symbol.for("react.memo_cache_sentinel")?(G=(p,P)=>{d(q=>({...q,[p]:P}))},e[5]=G):G=e[5];const Se=G;let H;e[6]!==f?(H=p=>f[p.name]??(p.type==="boolean"?!1:""),e[6]=f,e[7]=H):H=e[7];const R=H;let J;if(e[8]!==o.userFields||e[9]!==R){let p;e[11]!==R?(p=P=>!P.required||at(P,R(P)),e[11]=R,e[12]=p):p=e[12],J=o.userFields.every(p),e[8]=o.userFields,e[9]=R,e[10]=J}else J=e[10];const we=J;let K;e[13]!==r||e[14]!==k||e[15]!==x||e[16]!==we?(K=!r&&k.trim()!==""&&x.trim()!==""&&we,e[13]=r,e[14]=k,e[15]=x,e[16]=we,e[17]=K):K=e[17];const Te=K;let W;e[18]!==o.userFields||e[19]!==R?(W=()=>{const p={};for(const P of o.userFields){const q=lt(P,R(P));q!==void 0&&(p[P.name]=q.value)}return Object.keys(p).length===0?void 0:p},e[18]=o.userFields,e[19]=R,e[20]=W):W=e[20];const Ce=W;let Z;e[21]!==Ce||e[22]!==c||e[23]!==k||e[24]!==x||e[25]!==s||e[26]!==l||e[27]!==y||e[28]!==h||e[29]!==m?(Z=()=>{m(async()=>{await c.createAuthUser({data:Ce(),email:k.trim(),name:x.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),l(),s()})},e[21]=Ce,e[22]=c,e[23]=k,e[24]=x,e[25]=s,e[26]=l,e[27]=y,e[28]=h,e[29]=m,e[30]=Z):Z=e[30];const N=Z;let D;e[31]!==a?(D=a("Create user"),e[31]=a,e[32]=D):D=e[32];let B;e[33]!==a?(B=a("Create user"),e[33]=a,e[34]=B):B=e[34];let E;e[35]!==B?(E=t("h2",{className:"text-sm font-semibold text-foreground",children:B}),e[35]=B,e[36]=E):E=e[36];let Q;e[37]!==a?(Q=a("email"),e[37]=a,e[38]=Q):Q=e[38];let X;e[39]!==Q?(X=t(V,{htmlFor:"uc-email",children:Q}),e[39]=Q,e[40]=X):X=e[40];let Y;e[41]!==k?(Y=t(j,{"data-testid":"uc-email",id:"uc-email",onChange:b,type:"email",value:k}),e[41]=k,e[42]=Y):Y=e[42];let ee;e[43]!==X||e[44]!==Y?(ee=n("div",{className:"flex flex-col gap-1",children:[X,Y]}),e[43]=X,e[44]=Y,e[45]=ee):ee=e[45];let te;e[46]!==a?(te=a("name"),e[46]=a,e[47]=te):te=e[47];let ae;e[48]!==te?(ae=t(V,{htmlFor:"uc-name",children:te}),e[48]=te,e[49]=ae):ae=e[49];let le;e[50]!==x?(le=t(j,{"data-testid":"uc-name",id:"uc-name",onChange:T,value:x}),e[50]=x,e[51]=le):le=e[51];let se;e[52]!==ae||e[53]!==le?(se=n("div",{className:"flex flex-col gap-1",children:[ae,le]}),e[52]=ae,e[53]=le,e[54]=se):se=e[54];let re;e[55]!==a?(re=a("Password (optional)"),e[55]=a,e[56]=re):re=e[56];let ie;e[57]!==re?(ie=t(V,{htmlFor:"uc-password",children:re}),e[57]=re,e[58]=ie):ie=e[58];let ne;e[59]!==y?(ne=t(j,{"data-testid":"uc-password",id:"uc-password",onChange:De,type:"password",value:y}),e[59]=y,e[60]=ne):ne=e[60];let de;e[61]!==ie||e[62]!==ne?(de=n("div",{className:"flex flex-col gap-1",children:[ie,ne]}),e[61]=ie,e[62]=ne,e[63]=de):de=e[63];let oe;e[64]!==a?(oe=a("Role (optional)"),e[64]=a,e[65]=oe):oe=e[65];let ce;e[66]!==oe?(ce=t(V,{htmlFor:"uc-role",children:oe}),e[66]=oe,e[67]=ce):ce=e[67];let ue;e[68]!==h?(ue=t(j,{"data-testid":"uc-role",id:"uc-role",onChange:je,value:h}),e[68]=h,e[69]=ue):ue=e[69];let me;e[70]!==ce||e[71]!==ue?(me=n("div",{className:"flex flex-col gap-1",children:[ce,ue]}),e[70]=ce,e[71]=ue,e[72]=me):me=e[72];let he;e[73]!==o.userFields||e[74]!==R||e[75]!==a?(he=o.userFields.length>0&&n("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:a("Plugin fields")}),o.userFields.map(p=>{const P=`uc-field-${p.name}`,q=p.required?"":` (${a("optional")})`;if(p.type==="boolean"){const Me=R(p)===!0;return n("label",{className:"flex items-center gap-2",htmlFor:P,children:[t(Xe,{checked:Me,"data-testid":P,id:P,onCheckedChange:He=>{Se(p.name,He)}}),n("span",{className:"text-sm",children:[p.name,q]})]},p.name)}const qe=R(p);return n("div",{className:"flex flex-col gap-1",children:[n(V,{htmlFor:P,children:[p.name,q]}),t(j,{"data-testid":P,id:P,onChange:Me=>{Se(p.name,Me.target.value)},type:tt[p.type],value:typeof qe=="string"?qe:""})]},p.name)})]}),e[73]=o.userFields,e[74]=R,e[75]=a,e[76]=he):he=e[76];let pe;e[77]!==i?(pe=i!==null&&t("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:i}),e[77]=i,e[78]=pe):pe=e[78];let fe;e[79]!==a?(fe=a("Cancel"),e[79]=a,e[80]=fe):fe=e[80];let ve;e[81]!==s||e[82]!==fe?(ve=t(S,{"data-testid":"uc-cancel",onClick:s,size:"sm",type:"button",variant:"outline",children:fe}),e[81]=s,e[82]=fe,e[83]=ve):ve=e[83];const Be=!Te;let be;e[84]!==r||e[85]!==a?(be=a(r?"Creating…":"Create"),e[84]=r,e[85]=a,e[86]=be):be=e[86];let xe;e[87]!==N||e[88]!==Be||e[89]!==be?(xe=t(S,{"data-testid":"uc-submit",disabled:Be,onClick:N,size:"sm",type:"button",children:be}),e[87]=N,e[88]=Be,e[89]=be,e[90]=xe):xe=e[90];let ye;e[91]!==ve||e[92]!==xe?(ye=n("div",{className:"flex justify-end gap-2 pt-1",children:[ve,xe]}),e[91]=ve,e[92]=xe,e[93]=ye):ye=e[93];let ze;return e[94]!==s||e[95]!==D||e[96]!==E||e[97]!==ee||e[98]!==se||e[99]!==de||e[100]!==me||e[101]!==he||e[102]!==pe||e[103]!==ye?(ze=n(Ge,{label:D,onClose:s,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[E,ee,se,de,me,he,pe,ye]}),e[94]=s,e[95]=D,e[96]=E,e[97]=ee,e[98]=se,e[99]=de,e[100]=me,e[101]=he,e[102]=pe,e[103]=ye,e[104]=ze):ze=e[104],ze},Le=u=>{const e=Ne(2),{children:s}=u;let l;return e[0]!==s?(l=t("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s}),e[0]=s,e[1]=l):l=e[1],l},rt=u=>{const e=Ne(29),{busy:s,runAction:l,userId:c,version:a}=u,o=ge(),r=ke(),[i,m]=$(null),[k,I]=$(null);let x;e[0]!==o||e[1]!==c?(x=()=>{Re((async()=>{I(null);try{const b=await o.listAuthSessions({limit:50,userId:c});m(b.rows)}catch(b){const F=b;m(null),I(Ee(F))}})())},e[0]=o,e[1]=c,e[2]=x):x=e[2];let w;e[3]!==o||e[4]!==c||e[5]!==a?(w=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=w):w=e[6],Ve(x,w);let y;e[7]!==o||e[8]!==l?(y=b=>{l(()=>o.revokeAuthSession({sessionId:b}))},e[7]=o,e[8]=l,e[9]=y):y=e[9];const A=y;let h;e[10]!==r?(h=r("Sessions"),e[10]=r,e[11]=h):h=e[11];let g;e[12]!==h?(g=t(Le,{children:h}),e[12]=h,e[13]=g):g=e[13];let v;e[14]!==k?(v=k!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:k}),e[14]=k,e[15]=v):v=e[15];let f;e[16]!==i||e[17]!==r?(f=i!==null&&i.length===0&&t("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:r("No active sessions.")}),e[16]=i,e[17]=r,e[18]=f):f=e[18];let d;e[19]!==s||e[20]!==A||e[21]!==i||e[22]!==r?(d=i!==null&&i.length>0&&t($e,{className:"overflow-hidden py-0",children:t(Fe,{className:"px-0",children:n(Ue,{"data-testid":"ud-sessions-table",children:[t(Pe,{children:n(L,{children:[t(z,{children:r("expires")}),t(z,{children:r("ip")}),t(z,{children:r("user agent")}),t(z,{"aria-label":r("Actions")})]})}),t(_e,{children:i.map(b=>n(L,{"data-testid":`ud-session-${b.id}`,children:[t(U,{className:"text-muted-foreground tabular-nums",children:Ie(b.expiresAt)}),t(U,{children:b.ipAddress??""}),t(U,{className:"max-w-40 truncate",children:b.userAgent??""}),t(U,{children:t(S,{"data-testid":`ud-revoke-${b.id}`,disabled:s,onClick:()=>{A(b.id)},size:"xs",type:"button",variant:"ghost",children:r("Revoke")})})]},b.id))})]})})}),e[19]=s,e[20]=A,e[21]=i,e[22]=r,e[23]=d):d=e[23];let C;return e[24]!==g||e[25]!==v||e[26]!==f||e[27]!==d?(C=n("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,v,f,d]}),e[24]=g,e[25]=v,e[26]=f,e[27]=d,e[28]=C):C=e[28],C},it=u=>{const e=Ne(30),{busy:s,runAction:l,userId:c,version:a}=u,o=ge(),r=ke(),[i,m]=$(null),[k,I]=$(null);let x;e[0]!==o||e[1]!==c?(x=()=>{Re((async()=>{I(null);try{m(await o.listAuthAccounts({userId:c}))}catch(b){const F=b;m(null),I(Ee(F))}})())},e[0]=o,e[1]=c,e[2]=x):x=e[2];let w;e[3]!==o||e[4]!==c||e[5]!==a?(w=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=w):w=e[6],Ve(x,w);let y;e[7]!==o||e[8]!==l||e[9]!==c?(y=b=>{l(()=>o.unlinkAuthAccount({accountId:b,userId:c}))},e[7]=o,e[8]=l,e[9]=c,e[10]=y):y=e[10];const A=y;let h;e[11]!==r?(h=r("Linked accounts"),e[11]=r,e[12]=h):h=e[12];let g;e[13]!==h?(g=t(Le,{children:h}),e[13]=h,e[14]=g):g=e[14];let v;e[15]!==k?(v=k!==null&&t("p",{className:"text-sm text-destructive",role:"alert",children:k}),e[15]=k,e[16]=v):v=e[16];let f;e[17]!==i||e[18]!==r?(f=i!==null&&i.length===0&&t("p",{className:"text-sm text-muted-foreground",children:r("No linked accounts.")}),e[17]=i,e[18]=r,e[19]=f):f=e[19];let d;e[20]!==i||e[21]!==s||e[22]!==A||e[23]!==r?(d=i!==null&&i.length>0&&t($e,{className:"overflow-hidden py-0",children:t(Fe,{className:"px-0",children:n(Ue,{"data-testid":"ud-accounts-table",children:[t(Pe,{children:n(L,{children:[t(z,{children:r("provider")}),t(z,{children:r("created")}),t(z,{"aria-label":r("Actions")})]})}),t(_e,{children:i.map(b=>{const F=Ae(b.id);return n(L,{"data-testid":`ud-account-${F}`,children:[t(U,{children:Ae(b.providerId)}),t(U,{className:"text-muted-foreground tabular-nums",children:Ie(b.createdAt)}),t(U,{children:t(S,{"data-testid":`ud-unlink-${F}`,disabled:s,onClick:()=>{A(F)},size:"xs",type:"button",variant:"ghost",children:r("Unlink")})})]},F)})})]})})}),e[20]=i,e[21]=s,e[22]=A,e[23]=r,e[24]=d):d=e[24];let C;return e[25]!==g||e[26]!==v||e[27]!==f||e[28]!==d?(C=n("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,v,f,d]}),e[25]=g,e[26]=v,e[27]=f,e[28]=d,e[29]=C):C=e[29],C},nt=u=>{const e=Ne(40),{busy:s,capabilities:l,runAction:c,userId:a,version:o}=u,r=ge(),i=ke(),[m,k]=$(null);let I;e[0]!==l.passkey||e[1]!==r||e[2]!==a?(I=()=>{l.passkey&&Re((async()=>{try{k(await r.listAuthPasskeys({userId:a}))}catch{k(null)}})())},e[0]=l.passkey,e[1]=r,e[2]=a,e[3]=I):I=e[3];let x;e[4]!==l.passkey||e[5]!==r||e[6]!==a||e[7]!==o?(x=[l.passkey,r,a,o],e[4]=l.passkey,e[5]=r,e[6]=a,e[7]=o,e[8]=x):x=e[8],Ve(I,x);let w;e[9]!==r||e[10]!==c||e[11]!==a?(w=()=>{c(()=>r.disableAuthTwoFactor({userId:a}))},e[9]=r,e[10]=c,e[11]=a,e[12]=w):w=e[12];const y=w;let A;e[13]!==r||e[14]!==c?(A=F=>{c(()=>r.deleteAuthPasskey({passkeyId:F}))},e[13]=r,e[14]=c,e[15]=A):A=e[15];const h=A;let g;e[16]!==i?(g=i("Security"),e[16]=i,e[17]=g):g=e[17];let v;e[18]!==g?(v=t(Le,{children:g}),e[18]=g,e[19]=v):v=e[19];let f;e[20]!==s||e[21]!==l.twoFactor||e[22]!==y||e[23]!==i?(f=l.twoFactor&&t(S,{"data-testid":"ud-disable-2fa",disabled:s,onClick:y,size:"sm",type:"button",variant:"outline",children:i("Disable two-factor")}),e[20]=s,e[21]=l.twoFactor,e[22]=y,e[23]=i,e[24]=f):f=e[24];let d;e[25]!==l.passkey||e[26]!==m||e[27]!==i?(d=l.passkey&&m!==null&&m.length===0&&t("p",{className:"text-sm text-muted-foreground",children:i("No passkeys.")}),e[25]=l.passkey,e[26]=m,e[27]=i,e[28]=d):d=e[28];let C;e[29]!==s||e[30]!==l.passkey||e[31]!==h||e[32]!==m||e[33]!==i?(C=l.passkey&&m!==null&&m.length>0&&t($e,{className:"overflow-hidden py-0",children:t(Fe,{className:"px-0",children:n(Ue,{"data-testid":"ud-passkeys-table",children:[t(Pe,{children:n(L,{children:[t(z,{children:i("name")}),t(z,{children:i("created")}),t(z,{"aria-label":i("Actions")})]})}),t(_e,{children:m.map(F=>{const T=Ae(F.id);return n(L,{"data-testid":`ud-passkey-${T}`,children:[t(U,{children:Ae(F.name)||T}),t(U,{className:"text-muted-foreground tabular-nums",children:Ie(F.createdAt)}),t(U,{children:t(S,{"data-testid":`ud-delete-passkey-${T}`,disabled:s,onClick:()=>{h(T)},size:"xs",type:"button",variant:"ghost",children:i("Delete")})})]},T)})})]})})}),e[29]=s,e[30]=l.passkey,e[31]=h,e[32]=m,e[33]=i,e[34]=C):C=e[34];let b;return e[35]!==v||e[36]!==f||e[37]!==d||e[38]!==C?(b=n("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[v,f,d,C]}),e[35]=v,e[36]=f,e[37]=d,e[38]=C,e[39]=b):b=e[39],b},dt=/(?:at|expires)$/iu,ot=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ct=(u,e)=>typeof e=="number"&&dt.test(u)?Ie(e):Ae(e),ut=({capabilities:u,onChanged:e,onClose:s,user:l})=>{const c=ge(),a=ke(),o=l.banned===!0,[r,i]=$(null),[m,k]=$(!1),[I,x]=$(0),[w,y]=$(typeof l.role=="string"?l.role:""),[A,h]=$(""),[g,v]=$(""),[f,d]=$(""),[C,b]=$(null),[F,T]=$(!1),_=(N,D)=>{Re((async()=>{k(!0),i(null);try{const B=await N();D?.refresh!==!1&&(x(E=>E+1),e()),D?.onResult?.(B)}catch(B){i(Ee(B))}finally{k(!1)}})())},De=N=>{y(N.target.value)},O=N=>{h(N.target.value)},je=N=>{v(N.target.value)},G=N=>{d(N.target.value)},Se=()=>{const N=w.trim();N!==""&&_(async()=>{await c.setAuthUserRole({role:N,userId:l.id})})},H=()=>{const N=Number.parseInt(g,10),D=Number.isFinite(N)&&N>0?N*86400:void 0;_(async()=>{await c.banAuthUser({expiresInSeconds:D,reason:A.trim()===""?void 0:A.trim(),userId:l.id})})},R=()=>{_(async()=>{await c.unbanAuthUser({userId:l.id})})},J=()=>{_(async()=>{await c.setAuthUserPassword({newPassword:f,userId:l.id}),d("")})},we=()=>{_(()=>c.impersonateAuthUser({userId:l.id}),{onResult:N=>{b(N.token)},refresh:!1})},K=()=>{_(async()=>{await c.revokeAuthUserSessions({userId:l.id})})},Te=()=>{_(async()=>{await c.removeAuthUser({userId:l.id}),s()})},W=()=>{T(!0)},Ce=()=>{T(!1)},Z=Object.entries(l).filter(([N])=>!ot.has(N));return n(Ge,{label:a("User details"),onClose:s,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[n("div",{className:"flex items-start justify-between gap-2",children:[n("div",{className:"flex flex-col gap-1",children:[t("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id}),t("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),n("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&t(M,{variant:"secondary",children:l.role}),o?t(M,{variant:"destructive",children:a("Banned")}):t(M,{variant:"outline",children:a("Active")}),l.emailVerified===!0?t(M,{variant:"secondary",children:a("verified")}):t(M,{variant:"outline",children:a("unverified")})]})]}),t(S,{"data-testid":"ud-close",onClick:s,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),r!==null&&t("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:r}),u.admin&&n($e,{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:a("Actions")})}),n(Fe,{className:"flex flex-col gap-3 p-3",children:[n("div",{className:"flex items-end gap-2",children:[n("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-role",children:a("Role")}),t(j,{"data-testid":"ud-role-input",id:"ud-role",onChange:De,value:w})]}),t(S,{"data-testid":"ud-set-role",disabled:m||w.trim()==="",onClick:Se,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),o?t(S,{"data-testid":"ud-unban",disabled:m,onClick:R,size:"sm",type:"button",variant:"outline",children:a("Unban")}):n("div",{className:"flex items-end gap-2",children:[n("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),t(j,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:O,value:A})]}),n("div",{className:"flex w-24 flex-col gap-1",children:[t(V,{htmlFor:"ud-ban-days",children:a("Days")}),t(j,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:je,type:"number",value:g})]}),t(S,{"data-testid":"ud-ban",disabled:m,onClick:H,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),n("div",{className:"flex items-end gap-2",children:[n("div",{className:"flex flex-1 flex-col gap-1",children:[t(V,{htmlFor:"ud-password",children:a("New password")}),t(j,{"data-testid":"ud-password",id:"ud-password",onChange:G,type:"password",value:f})]}),t(S,{"data-testid":"ud-set-password",disabled:m||f==="",onClick:J,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),n("div",{className:"flex flex-wrap gap-2",children:[t(S,{"data-testid":"ud-impersonate",disabled:m,onClick:we,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),t(S,{"data-testid":"ud-revoke-all",disabled:m,onClick:K,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),F?n(Ye,{children:[t(S,{"data-testid":"ud-delete-confirm",disabled:m,onClick:Te,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),t(S,{"data-testid":"ud-delete-cancel",onClick:Ce,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):t(S,{"data-testid":"ud-delete",disabled:m,onClick:W,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),C!==null&&n("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[t(V,{htmlFor:"ud-token",children:a("Impersonation token")}),t(j,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:C})]})]})]}),t(rt,{busy:m,runAction:_,userId:l.id,version:I}),u.accounts&&t(it,{busy:m,runAction:_,userId:l.id,version:I}),(u.twoFactor||u.passkey)&&t(nt,{busy:m,capabilities:u,runAction:_,userId:l.id,version:I}),n("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:a("Fields")}),t("dl",{className:"flex flex-col",children:Z.map(([N,D])=>n("div",{className:"flex flex-col border-t border-border py-1.5",children:[t("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),t("dd",{className:"m-0 font-mono text-xs break-words",children:ct(N,D)})]},N))})]})]})},mt=50,Pt=({pageSize:u=mt}={})=>{const e=ge(),s=ke(),[l,c]=$(""),[a,o]=$(""),r=Qe(l),[i,m]=$(null),[k,I]=$(!1),{capabilities:x}=et(),w=r.trim(),y=a.trim(),A=Ke(["lunora-auth-users",w,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:w===""?void 0:w}),{keepPreviousData:!0}),h=A.data?.rows??null,g=A.error,v=()=>{A.refetch()};Ze(()=>{A.refetch()},!0);const f=i===null?null:h?.find(d=>d.id===i)??null;return n("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[n("div",{className:"flex flex-wrap items-center gap-2",children:[t(j,{"aria-label":s("Search users"),className:"w-56","data-testid":"us-search",onChange:d=>{c(d.target.value)},placeholder:s("Search by email or name…"),value:l}),t(j,{"aria-label":s("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:d=>{o(d.target.value)},placeholder:s("Filter by role"),value:a}),t(S,{"data-testid":"us-new",onClick:()=>{I(!0)},size:"sm",type:"button",children:s("New user")})]}),g!==null&&t("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&t(Je,{description:s("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:s("No users.")}),h!==null&&h.length>0&&t($e,{className:"overflow-hidden py-0",children:t(Fe,{className:"px-0",children:n(Ue,{"data-testid":"us-table",children:[t(Pe,{children:n(L,{children:[t(z,{children:s("id")}),t(z,{children:s("email")}),t(z,{children:s("name")}),t(z,{children:s("role")}),t(z,{children:s("status")}),t(z,{children:s("verified")}),t(z,{children:s("created")}),t(z,{"aria-label":s("Actions")})]})}),t(_e,{children:h.map(d=>n(L,{"data-testid":`us-row-${d.id}`,children:[t(U,{className:"font-mono text-xs",children:d.id}),t(U,{children:d.email??""}),t(U,{children:d.name??""}),t(U,{children:typeof d.role=="string"&&d.role!==""?t(M,{variant:"secondary",children:d.role}):""}),t(U,{children:d.banned===!0?t(M,{variant:"destructive",children:s("Banned")}):t(M,{variant:"success",children:s("Active")})}),t(U,{children:d.emailVerified===!0?t(M,{variant:"success",children:s("yes")}):t(M,{variant:"outline",children:s("no")})}),t(U,{className:"text-muted-foreground tabular-nums",children:Ie(d.createdAt)}),t(U,{children:t(S,{"data-testid":`us-manage-${d.id}`,onClick:()=>{m(d.id)},size:"xs",type:"button",variant:"ghost",children:s("Manage")})})]},d.id))})]})})}),f!==null&&t(ut,{capabilities:x,onChanged:v,onClose:()=>{m(null)},user:f}),k&&t(st,{onClose:()=>{I(!1)},onCreated:v})]})};export{Pt as UsersPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as A}from"react/compiler-runtime";import{useLunora as H}from"@lunora/react";import{useState as h,useEffect as Q}from"react";import{u as R}from"../packem_shared/button-BkCrNcAs.js";import{c as V,u as j}from"../packem_shared/card-CIDGUN6K.js";import{E as W}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as D}from"../packem_shared/input-JHu63lTv.js";import{n as q,d as E,m as N,p as o,f as L,u as i}from"../packem_shared/table-DdJBrClo.js";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{f as M,e as B,h as J}from"../packem_shared/internal-AtZ4bTal.js";import{jsxs as n,jsx as e}from"react/jsx-runtime";const O=10,g=x=>{const r=A(7),{label:m,value:a}=x;let l;r[0]!==m?(l=e("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),r[0]=m,r[1]=l):l=r[1];const f=a??"—";let c;r[2]!==f?(c=e("span",{className:"font-mono text-sm",children:f}),r[2]=f,r[3]=c):c=r[3];let u;return r[4]!==l||r[5]!==c?(u=n("div",{className:"flex flex-col gap-0.5",children:[l,c]}),r[4]=l,r[5]=c,r[6]=u):u=r[6],u},ce=({loadIndexes:x,runQuery:r}={})=>{const m=H(),a=G(),[l,f]=h(null),[c,u]=h(null),[v,C]=h(null),[b,F]=h(""),[p,y]=h(null),[k,w]=h(null),[I,S]=h(!1);Q(()=>{const t={cancelled:!1};return M((async()=>{try{const d=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(f(d),u(null),C($=>$??d[0]?.name??null))}catch(d){t.cancelled||(f(null),u(B(d)))}})()),()=>{t.cancelled=!0}},[m,x]);const s=l?.find(t=>t.name===v)??null,K=t=>{C(t.currentTarget.dataset.index??null),y(null),w(null)},T=t=>{F(t.target.value)},Z=async()=>{const t=b.trim();if(!(v===null||t==="")){S(!0),w(null);try{const d=await(r??($=>m.queryVectorIndex($)))({name:v,text:t,topK:O});y(d)}catch(d){y(null),w(B(d))}finally{S(!1)}}},z=()=>{M(Z())};return n("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[c!==null&&e("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:c}),l!==null&&l.length===0&&e(W,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:e("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:e("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:a("No vector indexes.")}),l!==null&&l.length>0&&e(V,{className:"overflow-hidden py-0",children:e(j,{className:"px-0",children:n(q,{"data-testid":"vector-table",children:[e(E,{children:n(N,{children:[e(o,{children:a("name")}),e(o,{children:a("table")}),e(o,{children:a("dimensions")}),e(o,{children:a("metric")}),e(o,{children:a("vectors")})]})}),e(L,{children:l.map(t=>n(N,{className:t.name===v?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:K,children:[e(i,{className:"font-mono text-xs",children:t.name}),e(i,{className:"font-mono text-xs",children:t.table}),e(i,{className:"tabular-nums",children:t.dimensions??"—"}),e(i,{children:t.metric??"—"}),e(i,{className:"tabular-nums",children:t.vectorsCount??"—"})]},t.name))})]})})}),s!==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:[e(g,{label:a("field"),value:s.field}),e(g,{label:a("dimensions"),value:s.dimensions}),e(g,{label:a("metric"),value:s.metric}),e(g,{label:a("vectors"),value:s.vectorsCount})]}),s.metadata!==void 0&&s.metadata.length>0&&n("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",e("span",{className:"font-mono",children:s.metadata.join(", ")})]}),n("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e(D,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:T,placeholder:a("Search by similarity…"),value:b}),e(R,{"data-testid":"vector-search",disabled:I||b.trim()==="",onClick:z,children:a(I?"Searching…":"Search")})]}),k!==null&&e("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:k}),p!==null&&p.length===0&&e("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")}),p!==null&&p.length>0&&e(V,{className:"mt-3 overflow-hidden py-0",children:e(j,{className:"px-0",children:n(q,{"data-testid":"vector-matches",children:[e(E,{children:n(N,{children:[e(o,{children:a("id")}),e(o,{children:a("score")}),e(o,{children:a("metadata")})]})}),e(L,{children:p.map(t=>n(N,{"data-testid":`vector-match-${t.id}`,children:[e(i,{className:"font-mono text-xs",children:t.id}),e(i,{className:"tabular-nums",children:t.score.toFixed(4)}),e(i,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"—":J(t.metadata)})]},t.id))})]})})})]})]})};export{ce as VectorBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useLunora as V}from"@lunora/react";import{useState as m,useEffect as ae,useMemo as P}from"react";import{u as W}from"../packem_shared/button-BkCrNcAs.js";import{c as J,u as L}from"../packem_shared/card-CIDGUN6K.js";import{E as G}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as re}from"../packem_shared/input-JHu63lTv.js";import{n as U,d as _,m as N,p as o,f as K,u as i}from"../packem_shared/table-DdJBrClo.js";import{l as ne}from"../packem_shared/textarea-Bu2-jKAs.js";import{K as se}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{useT as X}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as H}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{f as A,e as E,c as B,a as Y}from"../packem_shared/internal-AtZ4bTal.js";import{jsxs as s,jsx as e}from"react/jsx-runtime";const le=["queued","running","paused","waiting","complete","errored","terminated"],oe=["pause","resume","terminate"],ie="WORKFLOWS_NOT_CONFIGURED",de=d=>typeof d=="object"&&d!==null&&d.code===ie,ce=d=>{const r=d.error??d.output;if(r===void 0)return"—";try{return JSON.stringify(r)}catch{return"(unserializable)"}},me=({loadDetail:d,loadInstances:r,readOnly:b,runAction:R,workflowName:h})=>{const I=V(),n=X(),[w,g]=m(null),[S,$]=m(null),[k,T]=m(""),[v,p]=m(null),[F,C]=m(!1),[j,z]=m(null),f=d??(a=>I.getWorkflowInstance(a)),x=b?void 0:R??(r===void 0?a=>I.setWorkflowInstanceStatus(a):void 0),O=async()=>{p(null),C(!1);const a=k===""?void 0:k;try{if(r===void 0){const l=await I.listWorkflowInstances({name:h,status:a});if(l.configured===!1){g(null),C(!0);return}g(l.instances);return}g(await r({name:h,status:a}))}catch(l){g(null),de(l)?C(!0):p(E(l))}};ae(()=>{$(null),A(O())},[h,k]);const D=async a=>{p(null);try{$(await f({id:a,name:h}))}catch(l){p(E(l))}},q=async(a,l)=>{if(x!==void 0){z(a),p(null);try{await x({action:l,id:a,name:h}),await O()}catch(M){p(E(M))}finally{z(null)}}};return s("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[s("div",{className:"flex items-center justify-between gap-2",children:[e("h3",{className:"text-sm font-medium",children:n("Instance history")}),s("select",{"aria-label":n("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:a=>{T(a.target.value)},value:k,children:[e("option",{value:"",children:n("All statuses")}),le.map(a=>e("option",{value:a,children:a},a))]})]}),v!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v}),F&&e(G,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!F&&w!==null&&w.length===0&&e(G,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),w!==null&&w.length>0&&e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflow-instances-table",children:[e(_,{children:s(N,{children:[e(o,{children:n("Instance id")}),e(o,{children:n("Status")}),e(o,{children:n("Created")}),e(o,{children:n("Ended")}),e(o,{"aria-label":n("Actions")})]})}),e(K,{children:w.map(a=>s(N,{"data-testid":`workflow-instance-${a.id}`,children:[e(i,{className:"font-mono text-xs",children:a.id}),e(i,{className:"font-mono text-xs",children:a.status}),e(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"—"}),e(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"—"}),e(i,{className:"text-right",children:s("div",{className:"flex justify-end gap-1.5",children:[e(W,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:()=>{A(D(a.id))},size:"sm",type:"button",variant:"outline",children:n("Steps")}),x!==void 0&&oe.map(l=>e(W,{"data-testid":`workflow-instance-${l}-${a.id}`,disabled:j===a.id,onClick:()=>{A(q(a.id,l))},size:"sm",type:"button",variant:"ghost",children:n(l)},l))]})})]},a.id))})]})})}),S!==null&&e(J,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:s(L,{className:"flex flex-col gap-2 px-4 py-3",children:[s("div",{className:"flex items-center justify-between",children:[s("span",{className:"font-mono text-xs",children:[n("Steps")," · ",S.id]}),e(W,{"data-testid":"workflow-instance-detail-close",onClick:()=>{$(null)},size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),S.steps.length===0?e("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):s(U,{"data-testid":"workflow-instance-steps",children:[e(_,{children:s(N,{children:[e(o,{children:n("Step")}),e(o,{children:n("Type")}),e(o,{children:n("Attempts")}),e(o,{children:n("Started")}),e(o,{children:n("Output")})]})}),e(K,{children:S.steps.map((a,l)=>s(N,{"data-testid":`workflow-step-${String(l)}`,children:[e(i,{className:"font-mono text-xs",children:a.name}),e(i,{className:"text-xs text-muted-foreground",children:a.type??"—"}),e(i,{className:"tabular-nums",children:a.attempts??"—"}),e(i,{className:"text-muted-foreground tabular-nums",children:a.start??"—"}),e(i,{className:"font-mono text-xs text-muted-foreground",children:ce(a)})]},`${a.name}:${String(l)}`))})]})]})})]})},ue=Y(H.createWorkflowInstance),fe=Y(H.getWorkflowInstanceStatus),he=d=>{if(d.error)return`${d.error.name}: ${d.error.message}`;if(d.output===void 0)return"—";try{return JSON.stringify(d.output)}catch{return"(unserializable)"}},Oe=()=>{const d=V(),r=X(),{data:b,error:R}=se(H.listWorkflows,{}),[h,I]=m(""),[n,w]=m(""),[g,S]=m(""),[$,k]=m(!1),[T,v]=m(null),[p,F]=m([]),[C,j]=m(null),z=b!==void 0,f=P(()=>Array.isArray(b?.workflows)?[...b.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[b]),x=P(()=>f.some(t=>t.exportName===h)?h:f[0]?.exportName??"",[f,h]),O=P(()=>f.find(t=>t.exportName===x),[f,x]),D=t=>{F(u=>{const c=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...c]})},q=async()=>{const t=x;if(t==="")return;let u;const c=g.trim();if(c!=="")try{u=JSON.parse(c)}catch{v(r("Params must be valid JSON"));return}k(!0),v(null);try{const y=n.trim(),Q=await d.query(ue,{exportName:t,id:y===""?void 0:y,params:u},B(""));D({exportName:t,id:Q.id,status:Q.status}),w("")}catch(y){v(E(y))}finally{k(!1)}},a=()=>{A(q())},l=async(t,u)=>{j(u);try{const c=await d.query(fe,{exportName:t,id:u},B(""));D({error:c.error,exportName:t,id:c.id,output:c.output,status:c.status})}catch(c){v(E(c))}finally{j(null)}},M=t=>{I(t.target.value)},Z=t=>{w(t.target.value)},ee=t=>{S(t.target.value)},te=t=>{const{export:u,id:c}=t.currentTarget.dataset;u!==void 0&&c!==void 0&&A(l(u,c))};return s("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[R!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:R}),e("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.")}),z&&f.length===0?e(G,{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")}):e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflows-table",children:[e(_,{children:s(N,{children:[e(o,{children:r("Export")}),e(o,{children:r("Name")}),e(o,{children:r("Class")}),e(o,{children:r("Binding")})]})}),e(K,{children:f.map(t=>s(N,{"data-testid":`workflows-row-${t.exportName}`,children:[e(i,{className:"font-mono text-xs",children:t.exportName}),e(i,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e(i,{className:"font-mono text-xs text-muted-foreground",children:t.className}),e(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),f.length>0&&s("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[e("h3",{className:"text-sm font-medium",children:r("Start instance")}),T!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:T}),s("div",{className:"flex flex-wrap items-center gap-2",children:[e("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:M,value:x,children:f.map(t=>e("option",{value:t.exportName,children:t.exportName},t.exportName))}),e(re,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:Z,placeholder:r("Instance id (optional)"),value:n}),e(W,{"data-testid":"workflows-start-button",disabled:$||x==="",onClick:a,children:r($?"Starting…":"Start instance")})]}),e(ne,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:ee,placeholder:r("Params (JSON, optional)"),value:g})]}),p.length>0&&s("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[e("h3",{className:"text-sm font-medium",children:r("Instances")}),e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflows-instances-table",children:[e(_,{children:s(N,{children:[e(o,{children:r("Workflow")}),e(o,{children:r("Instance id")}),e(o,{children:r("Status")}),e(o,{children:r("Output")}),e(o,{})]})}),e(K,{children:p.map(t=>s(N,{"data-testid":`workflows-instance-${t.id}`,children:[e(i,{className:"font-mono text-xs",children:t.exportName}),e(i,{className:"font-mono text-xs text-muted-foreground",children:t.id}),e(i,{className:"font-mono text-xs",children:t.status}),e(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)}),e(i,{children:e(W,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:te,size:"xs",variant:"outline",children:C===t.id?r("Refreshing…"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),O!==void 0&&e(me,{workflowName:O.name})]})};export{Oe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _="__lunora_admin__:",e={assignIssue:"__lunora_admin__:assignIssue",clearCapturedMail:"__lunora_admin__:clearCapturedMail",clearQueueMessages:"__lunora_admin__:clearQueueMessages",clearTable:"__lunora_admin__:clearTable",createWorkflowInstance:"__lunora_admin__:createWorkflowInstance",deleteRows:"__lunora_admin__:deleteRows",describeTable:"__lunora_admin__:describeTable",describeTables:"__lunora_admin__:describeTables",exportShard:"__lunora_admin__:exportShard",facetColumn:"__lunora_admin__:facetColumn",getAdvisories:"__lunora_admin__:getAdvisories",getAuditLog:"__lunora_admin__:getAuditLog",getAuthAuditLog:"__lunora_admin__:getAuthAuditLog",getAuthMetrics:"__lunora_admin__:getAuthMetrics",getCapturedMail:"__lunora_admin__:getCapturedMail",getFanoutMetrics:"__lunora_admin__:getFanoutMetrics",getFunctionStats:"__lunora_admin__:getFunctionStats",getIssues:"__lunora_admin__:getIssues",listFlags:"__lunora_admin__:listFlags",listPushSubscriptions:"__lunora_admin__:listPushSubscriptions",listQueues:"__lunora_admin__:listQueues",listSubscriptions:"__lunora_admin__:listSubscriptions",listTableIndexes:"__lunora_admin__:listTableIndexes",listWorkflows:"__lunora_admin__:listWorkflows",getLogs:"__lunora_admin__:getLogs",getMetricHistory:"__lunora_admin__:getMetricHistory",getMetricSeries:"__lunora_admin__:getMetricSeries",getMetrics:"__lunora_admin__:getMetrics",getPitrBookmark:"__lunora_admin__:getPitrBookmark",getQueueMessages:"__lunora_admin__:getQueueMessages",getRequestLog:"__lunora_admin__:getRequestLog",getSecurityAudit:"__lunora_admin__:getSecurityAudit",getSettings:"__lunora_admin__:getSettings",getTraces:"__lunora_admin__:getTraces",getWorkflowInstanceStatus:"__lunora_admin__:getWorkflowInstanceStatus",ignoreIssue:"__lunora_admin__:ignoreIssue",importShard:"__lunora_admin__:importShard",listTables:"__lunora_admin__:listTables",maskPolicies:"__lunora_admin__:maskPolicies",migrationStatus:"__lunora_admin__:migrationStatus",pitrRestore:"__lunora_admin__:pitrRestore",readTablePage:"__lunora_admin__:readTablePage",replayQueueMessage:"__lunora_admin__:replayQueueMessage",resolveIssue:"__lunora_admin__:resolveIssue",rlsPolicies:"__lunora_admin__:rlsPolicies",runAs:"__lunora_admin__:runAs",runMigration:"__lunora_admin__:runMigration",runSql:"__lunora_admin__:runSql",sendQueueMessage:"__lunora_admin__:sendQueueMessage",sendTestMail:"__lunora_admin__:sendTestMail",setIssueSeverity:"__lunora_admin__:setIssueSeverity",storageOrphans:"__lunora_admin__:storageOrphans",storageReferences:"__lunora_admin__:storageReferences",storageRules:"__lunora_admin__:storageRules",studioFeatures:"__lunora_admin__:studioFeatures",writeRow:"__lunora_admin__:writeRow"};export{e as ADMIN_FUNCTIONS,_ as ADMIN_FUNCTION_PREFIX};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as F}from"react/compiler-runtime";import{useLunora as G}from"@lunora/react";import{useState as Q,useEffect as ee}from"react";import{u as Z}from"./button-BkCrNcAs.js";import{E as V}from"./empty-state-Cg7t_8qu.js";import{useT as O}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as te}from"./ADMIN_FUNCTIONS-BYNSbBVE.js";import{g as ae,c as ne,a as le}from"./internal-AtZ4bTal.js";import{jsxs as P,jsx as p}from"react/jsx-runtime";const ie=le(te.listTables),oe=["react","client","cli"],re=!1,se={action:"action",mutation:"mutation",query:"query"},X=n=>{const e=n.indexOf(":");return e===-1?{file:"",fn:n}:{file:n.slice(0,e),fn:n.slice(e+1)}},J=({file:n,fn:e,kind:r})=>`await client.${se[r]}(api.${n}.${e}, { /* args */ });`,ce=n=>{const e=`api.${n.file}.${n.fn}`;switch(n.kind){case"action":return J(n);case"mutation":return`const ${n.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},de=({file:n,fn:e})=>`lunora run ${n}:${e} --args '{ }'`,pe=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
|
+
`),fe=(n,e)=>{switch(n){case"cli":return de(e);case"client":return J(e);default:return ce(e)}},W=n=>{const e=F(19),{code:r,label:s,testId:a}=n,l=O();let o;e[0]!==r?(o=()=>{ae(r)},e[0]=r,e[1]=o):o=e[1];const f=o;let t;e[2]!==s?(t=p("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[2]=s,e[3]=t):t=e[3];const c=`${a}-copy`;let i;e[4]!==l?(i=l("Copy"),e[4]=l,e[5]=i):i=e[5];let d;e[6]!==f||e[7]!==c||e[8]!==i?(d=p(Z,{"data-testid":c,onClick:f,size:"xs",type:"button",variant:"ghost",children:i}),e[6]=f,e[7]=c,e[8]=i,e[9]=d):d=e[9];let u;e[10]!==t||e[11]!==d?(u=P("div",{className:"flex items-center justify-between gap-2",children:[t,d]}),e[10]=t,e[11]=d,e[12]=u):u=e[12];let h;e[13]!==r||e[14]!==a?(h=p("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":a,children:r}),e[13]=r,e[14]=a,e[15]=h):h=e[15];let x;return e[16]!==u||e[17]!==h?(x=P("div",{className:"flex flex-col gap-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=x):x=e[18],x},ue=n=>{const e=F(50),{file:r,fn:s,kind:a}=n,l=O(),[o,f]=Q("react");let t,c,i;if(e[0]!==r||e[1]!==s||e[2]!==a||e[3]!==l||e[4]!==o){const y={file:r,fn:s,kind:a};let I;e[8]!==l?(I=l("CLI"),e[8]=l,e[9]=I):I=e[9];let C;e[10]!==l?(C=l("Client"),e[10]=l,e[11]=C):C=e[11];let S;e[12]!==l?(S=l("React"),e[12]=l,e[13]=S):S=e[13];let A;e[14]!==I||e[15]!==C||e[16]!==S?(A={cli:I,client:C,react:S},e[14]=I,e[15]=C,e[16]=S,e[17]=A):A=e[17],i=A;let q;e[18]===Symbol.for("react.memo_cache_sentinel")?(q=H=>{f(H.currentTarget.dataset.tab)},e[18]=q):q=e[18],t=q,c=fe(o,y),e[0]=r,e[1]=s,e[2]=a,e[3]=l,e[4]=o,e[5]=t,e[6]=c,e[7]=i}else t=e[5],c=e[6],i=e[7];const d=c,u=a==="action"&&o==="react"&&!re,h=`api.${r}.${s}`;let x;e[19]!==h?(x=p("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:h}),e[19]=h,e[20]=x):x=e[20];let _;e[21]!==a||e[22]!==l?(_=l("Call this {kind} from your app.",{kind:a}),e[21]=a,e[22]=l,e[23]=_):_=e[23];let k;e[24]!==_?(k=p("p",{className:"text-xs text-muted-foreground",children:_}),e[24]=_,e[25]=k):k=e[25];let m;e[26]!==x||e[27]!==k?(m=P("div",{children:[x,k]}),e[26]=x,e[27]=k,e[28]=m):m=e[28];let g;e[29]!==l?(g=l("Snippet flavour"),e[29]=l,e[30]=g):g=e[30];let $;e[31]!==t||e[32]!==o||e[33]!==i?($=oe.map(y=>p(Z,{"aria-selected":o===y,"data-tab":y,"data-testid":`api-tab-${y}`,onClick:t,role:"tab",size:"xs",type:"button",variant:o===y?"default":"outline",children:i[y]},y)),e[31]=t,e[32]=o,e[33]=i,e[34]=$):$=e[34];let N;e[35]!==g||e[36]!==$?(N=p("div",{"aria-label":g,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:$}),e[35]=g,e[36]=$,e[37]=N):N=e[37];const R=i[o],j=`api-snippet-${o}`;let w;e[38]!==d||e[39]!==R||e[40]!==j?(w=p(W,{code:d,label:R,testId:j}),e[38]=d,e[39]=R,e[40]=j,e[41]=w):w=e[41];let v;e[42]!==u||e[43]!==l?(v=u&&p("p",{className:"text-xs text-muted-foreground","data-testid":"api-action-note",children:l("Actions have no React hook — call them through the client.")}),e[42]=u,e[43]=l,e[44]=v):v=e[44];let T;return e[45]!==w||e[46]!==v||e[47]!==m||e[48]!==N?(T=P("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[m,N,w,v]}),e[45]=w,e[46]=v,e[47]=m,e[48]=N,e[49]=T):T=e[49],T},me=n=>{const e=F(19),{name:r}=n,s=O();let a;e[0]!==r?(a=pe(r),e[0]=r,e[1]=a):a=e[1];const l=a;let o;e[2]!==r?(o=p("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:r}),e[2]=r,e[3]=o):o=e[3];let f;e[4]!==s?(f=s("Read and write this table through the typed data model."),e[4]=s,e[5]=f):f=e[5];let t;e[6]!==f?(t=p("p",{className:"text-xs text-muted-foreground",children:f}),e[6]=f,e[7]=t):t=e[7];let c;e[8]!==o||e[9]!==t?(c=P("div",{children:[o,t]}),e[8]=o,e[9]=t,e[10]=c):c=e[10];let i;e[11]!==s?(i=s("Data model"),e[11]=s,e[12]=i):i=e[12];let d;e[13]!==l||e[14]!==i?(d=p(W,{code:l,label:i,testId:"api-snippet-table"}),e[13]=l,e[14]=i,e[15]=d):d=e[15];let u;return e[16]!==c||e[17]!==d?(u=P("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[c,d]}),e[16]=c,e[17]=d,e[18]=u):u=e[18],u},Y=n=>{const e=F(8),{active:r,label:s,onSelect:a,testId:l,value:o}=n;let f;e[0]!==a||e[1]!==o?(f=()=>{a(o)},e[0]=a,e[1]=o,e[2]=f):f=e[2];const t=f,c=r?"page":void 0;let i;return e[3]!==s||e[4]!==t||e[5]!==c||e[6]!==l?(i=p("button",{"aria-current":c,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":l,onClick:t,type:"button",children:s}),e[3]=s,e[4]=t,e[5]=c,e[6]=l,e[7]=i):i=e[7],i},Re=n=>{const e=F(67),{functions:r,initialShardKey:s}=n,a=O(),l=G(),[o,f]=Q(null),[t,c]=Q(null);let i,d;e[0]!==l||e[1]!==s?(i=()=>{let D=!1;return l.query(ie,{},ne(s??"")).then(E=>(D||f(E),E)).catch(()=>{D||f([])}),()=>{D=!0}},d=[l,s],e[0]=l,e[1]=s,e[2]=i,e[3]=d):(i=e[2],d=e[3]),ee(i,d);let u;e[4]!==r?(u=r??[],e[4]=r,e[5]=u):u=e[5];const h=u;let x;if(e[6]!==h){const D=new Map;for(const E of h){const{file:B,fn:L}=X(E.path),K=D.get(B)??[];K.push({fn:L,kind:E.kind,path:E.path}),D.set(B,K)}x=[...D.entries()].map(xe).toSorted(be),e[6]=h,e[7]=x}else x=e[7];const _=x;let k,m,g,$,N,R,j,w,v,T;if(e[8]!==h||e[9]!==_||e[10]!==t||e[11]!==a||e[12]!==o){const D=(o??[]).map(ge).toSorted(ve);let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=b=>{c({kind:"fn",path:b})},e[23]=E):E=e[23];const B=E;let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=b=>{c({kind:"table",name:b})},e[24]=L):L=e[24];const K=L;if(m=t?.kind==="fn"?h.find(b=>b.path===t.path):void 0,k=h.length>0||D.length>0,g=m===void 0?void 0:X(m.path),$="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",N="lunora-api-docs",e[25]!==a?(R=a("API resources"),e[25]=a,e[26]=R):R=e[26],j="flex flex-col gap-4 overflow-y-auto",w="api-rail",e[27]!==_||e[28]!==t||e[29]!==a){let b;e[31]!==t||e[32]!==a?(b=U=>P("div",{className:"flex flex-col gap-1",children:[p("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:U.file||a("(root)")}),U.items.map(M=>p(Y,{active:t?.kind==="fn"&&t.path===M.path,label:M.fn,onSelect:B,testId:`api-rail-fn-${M.path}`,value:M.path},M.path))]},U.file),e[31]=t,e[32]=a,e[33]=b):b=e[33],v=_.map(b),e[27]=_,e[28]=t,e[29]=a,e[30]=v}else v=e[30];T=D.length>0&&P("div",{className:"flex flex-col gap-1",children:[p("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Tables")}),D.map(b=>p(Y,{active:t?.kind==="table"&&t.name===b,label:b,onSelect:K,testId:`api-rail-table-${b}`,value:b},b))]}),e[8]=h,e[9]=_,e[10]=t,e[11]=a,e[12]=o,e[13]=k,e[14]=m,e[15]=g,e[16]=$,e[17]=N,e[18]=R,e[19]=j,e[20]=w,e[21]=v,e[22]=T}else k=e[13],m=e[14],g=e[15],$=e[16],N=e[17],R=e[18],j=e[19],w=e[20],v=e[21],T=e[22];let y;e[34]!==k||e[35]!==a?(y=!k&&p("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:a("No functions or tables to document yet.")}),e[34]=k,e[35]=a,e[36]=y):y=e[36];let I;e[37]!==y||e[38]!==R||e[39]!==j||e[40]!==w||e[41]!==v||e[42]!==T?(I=P("nav",{"aria-label":R,className:j,"data-testid":w,children:[v,T,y]}),e[37]=y,e[38]=R,e[39]=j,e[40]=w,e[41]=v,e[42]=T,e[43]=I):I=e[43];let C;e[44]!==t||e[45]!==a?(C=t===null&&p(V,{description:a("Select a function or table to see how to call it from your app."),testId:"api-empty",title:a("API usage snippets")}),e[44]=t,e[45]=a,e[46]=C):C=e[46];let S;e[47]!==t?.kind||e[48]!==m||e[49]!==g?(S=t?.kind==="fn"&&m!==void 0&&g!==void 0&&p(ue,{file:g.file,fn:g.fn,kind:m.kind},m.path),e[47]=t?.kind,e[48]=m,e[49]=g,e[50]=S):S=e[50];let A;e[51]!==t?.kind||e[52]!==m||e[53]!==a?(A=t?.kind==="fn"&&m===void 0&&p(V,{testId:"api-empty",title:a("API usage snippets")}),e[51]=t?.kind,e[52]=m,e[53]=a,e[54]=A):A=e[54];let q;e[55]!==t?(q=t?.kind==="table"&&p(me,{name:t.name}),e[55]=t,e[56]=q):q=e[56];let H;e[57]!==C||e[58]!==S||e[59]!==A||e[60]!==q?(H=P("div",{className:"min-w-0",children:[C,S,A,q]}),e[57]=C,e[58]=S,e[59]=A,e[60]=q,e[61]=H):H=e[61];let z;return e[62]!==$||e[63]!==N||e[64]!==I||e[65]!==H?(z=P("div",{className:$,"data-testid":N,children:[I,H]}),e[62]=$,e[63]=N,e[64]=I,e[65]=H,e[66]=z):z=e[66],z};function he(n,e){return n.fn.localeCompare(e.fn)}function xe(n){const[e,r]=n;return{file:e,items:r.toSorted(he)}}function be(n,e){return n.file.localeCompare(e.file)}function ge(n){return n.name}function ve(n,e){return n.localeCompare(e)}export{re as REACT_HAS_ACTION_HOOK,de as buildCliSnippet,J as buildClientSnippet,ce as buildReactSnippet,pe as buildTableSnippet,Re as default,X as splitPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as y}from"react/compiler-runtime";import{useLunora as k}from"@lunora/react";import{E as u}from"./empty-state-Cg7t_8qu.js";import{n as h}from"./skeleton-C1wQ9M5t.js";import{u as v,U as j}from"./reference-view-KvhektwF.js";import{useT as I}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{jsxs as w,jsx as f}from"react/jsx-runtime";const x=["get","post","put","patch","delete","head","options","trace"],g=i=>i?.content?.["application/json"]?.schema,P=(i,e)=>Object.entries(i.responses??{}).map(([a,t])=>{const c=t.$ref?.replace("#/components/responses/",""),n=c===void 0?t:e.components?.responses?.[c]??t;return{description:n.description,schema:g(n),status:a}}),A=(i,e,a,t,c)=>{const n=g(t.requestBody),r=n?.properties?.functionPath?.const,s=typeof r=="string"?r:void 0,m=s===void 0?n:n?.properties?.args,d=t.operationId??`${a} ${e}`;return{argsSchema:m,description:t.description,functionPath:s,httpPath:e,key:i,kind:t["x-lunora-function-kind"],method:a.toUpperCase(),operationId:d,requestSchema:n,responses:P(t,c),summary:t.summary??d,tags:t.tags??[],title:t.summary??d}},O=i=>{const e=[];for(const[a,t]of Object.entries(i.paths??{})){const c=a.includes("#")?a.slice(0,a.indexOf("#")):a;for(const n of x){const r=t[n];r!==void 0&&e.push(A(a,c,n,r,i))}}return e},b=i=>{const e=i??{},a=O(e),t=new Map((e.tags??[]).map(s=>[s.name,s.description])),c=new Set,n=[],r=s=>{if(c.has(s))return;c.add(s);const m=a.filter(d=>(d.tags[0]??"")===s);m.length>0&&n.push({description:t.get(s),name:s,operations:m})};for(const s of e.tags??[])r(s.name);for(const s of a)r(s.tags[0]??"");return{groups:n,operationByKey:new Map(a.map(s=>[s.key,s])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},S=i=>{const{paths:e}=i;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},$=i=>{const e=i;return S(e)?{kind:"empty"}:{kind:"ready",spec:e}},U=i=>{const e=y(23),{spec:a}=i,t=I(),c=k();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const r=v(a,n,$);let s;e[2]!==r.kind||e[3]!==r.spec?(s=r.kind==="ready"?b(r.spec):void 0,e[2]=r.kind,e[3]=r.spec,e[4]=s):s=e[4];const m=s;if(r.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=w("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[f(h,{className:"h-8 w-48"}),f(h,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(r.kind==="error"){let o;e[6]!==r.message||e[7]!==t?(o=t("Couldn't load the OpenAPI spec: {message}",{message:r.message}),e[6]=r.message,e[7]=t,e[8]=o):o=e[8];let p;e[9]!==t?(p=t("API reference unavailable"),e[9]=t,e[10]=p):p=e[10];let l;return e[11]!==o||e[12]!==p?(l=f(u,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=l):l=e[13],l}if(r.kind==="empty"||m===void 0){let o;e[14]!==t?(o=t("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=t,e[15]=o):o=e[15];let p;e[16]!==t?(p=t("No OpenAPI spec configured"),e[16]=t,e[17]=p):p=e[17];let l;return e[18]!==o||e[19]!==p?(l=f(u,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=l):l=e[20],l}let d;return e[21]!==m?(d=f(j,{model:m}),e[21]=m,e[22]=d):d=e[22],d};export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as I}from"react/compiler-runtime";import{Dialog as E}from"@base-ui/react/dialog";import{useNavigate as O}from"@tanstack/react-router";import{useState as F,useRef as U,useEffect as W}from"react";import{useT as X}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{f as j}from"./internal-AtZ4bTal.js";import{c as q}from"./utils-bhneXptQ.js";import{jsx as s,jsxs as L}from"react/jsx-runtime";const M="lunora:command-palette",ne=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(M))},G=B=>{const e=I(18),{active:h,index:n,item:r,onActivate:p,onSelect:f}=B;let c;e[0]!==r||e[1]!==f?(c=()=>{f(r)},e[0]=r,e[1]=f,e[2]=c):c=e[2];const g=c;let i;e[3]!==n||e[4]!==p?(i=()=>{p(n)},e[3]=n,e[4]=p,e[5]=i):i=e[5];const u=i,b=h?"bg-accent text-accent-foreground":"text-foreground";let d;e[6]!==b?(d=q("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",b),e[6]=b,e[7]=d):d=e[7];let m;e[8]!==r.label?(m=s("span",{children:r.label}),e[8]=r.label,e[9]=m):m=e[9];let l;e[10]!==r.group?(l=s("span",{className:"text-xs text-muted-foreground",children:r.group}),e[10]=r.group,e[11]=l):l=e[11];let o;return e[12]!==g||e[13]!==u||e[14]!==d||e[15]!==m||e[16]!==l?(o=s("li",{children:L("button",{className:d,onClick:g,onMouseEnter:u,type:"button",children:[m,l]})}),e[12]=g,e[13]=u,e[14]=d,e[15]=m,e[16]=l,e[17]=o):o=e[17],o},re=B=>{const e=I(39),{items:h}=B,n=X(),r=O(),[p,f]=F(!1),[c,g]=F(""),[i,u]=F(0),b=U(null);let d,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{const t=$=>{($.metaKey||$.ctrlKey)&&$.key.toLowerCase()==="k"&&($.preventDefault(),f(!0))},a=()=>{f(!0)};return globalThis.addEventListener("keydown",t),globalThis.addEventListener(M,a),()=>{globalThis.removeEventListener("keydown",t),globalThis.removeEventListener(M,a)}},m=[],e[0]=d,e[1]=m):(d=e[0],m=e[1]),W(d,m);let l;if(e[2]!==h||e[3]!==c){e:{const t=c.trim().toLowerCase();if(t===""){l=h;break e}l=h.filter(a=>a.label.toLowerCase().includes(t)||a.group.toLowerCase().includes(t))}e[2]=h,e[3]=c,e[4]=l}else l=e[4];const o=l;let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=t=>{f(t),t||(g(""),u(0))},e[5]=S):S=e[5];const H=S;let T;e[6]!==r?(T=t=>{H(!1),j(r({to:t.to}))},e[6]=r,e[7]=T):T=e[7];const x=T;let D;e[8]===Symbol.for("react.memo_cache_sentinel")?(D=t=>{g(t.target.value),u(0)},e[8]=D):D=e[8];const J=D;let A;e[9]!==i||e[10]!==o||e[11]!==x?(A=t=>{e:switch(t.key){case"ArrowDown":{t.preventDefault(),u(a=>o.length===0?0:(a+1)%o.length);break e}case"ArrowUp":{t.preventDefault(),u(a=>o.length===0?0:(a-1+o.length)%o.length);break e}case"Enter":{t.preventDefault();const a=o[i];a!==void 0&&x(a);break e}}},e[9]=i,e[10]=o,e[11]=x,e[12]=A):A=e[12];const R=A;let z;e[13]===Symbol.for("react.memo_cache_sentinel")?(z=s(E.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[13]=z):z=e[13];let v;e[14]!==n?(v=n("Command palette"),e[14]=n,e[15]=v):v=e[15];let w;e[16]!==v?(w=s(E.Title,{className:"sr-only",children:v}),e[16]=v,e[17]=w):w=e[17];let K;e[18]===Symbol.for("react.memo_cache_sentinel")?(K=L("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[s("circle",{cx:"11",cy:"11",r:"7"}),s("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[18]=K):K=e[18];let y;e[19]!==n?(y=n("Search…"),e[19]=n,e[20]=y):y=e[20];let k;e[21]!==R||e[22]!==c||e[23]!==y?(k=L("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[K,s("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:J,onKeyDown:R,placeholder:y,ref:b,type:"text",value:c})]}),e[21]=R,e[22]=c,e[23]=y,e[24]=k):k=e[24];let N;e[25]!==i||e[26]!==o||e[27]!==x||e[28]!==n?(N=o.length===0?s("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:n("No results.")}):o.map((t,a)=>s(G,{active:a===i,index:a,item:t,onActivate:u,onSelect:x},t.to)),e[25]=i,e[26]=o,e[27]=x,e[28]=n,e[29]=N):N=e[29];let C;e[30]!==N?(C=s("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:N}),e[30]=N,e[31]=C):C=e[31];let _;e[32]!==w||e[33]!==k||e[34]!==C?(_=L(E.Portal,{children:[z,L(E.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:b,children:[w,k,C]})]}),e[32]=w,e[33]=k,e[34]=C,e[35]=_):_=e[35];let P;return e[36]!==p||e[37]!==_?(P=s(E.Root,{onOpenChange:H,open:p,children:_}),e[36]=p,e[37]=_,e[38]=P):P=e[38],P};export{re as CommandPalette,ne as openCommandPalette};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as p}from"react";import{useT as u}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{u as i}from"./button-BkCrNcAs.js";import{jsxs as b,jsx as n}from"react/jsx-runtime";const $=({children:o,confirmLabel:r,disabled:s=!1,onConfirm:l,testId:t})=>{const a=u(),[d,e]=p(!1),m=()=>{e(!0)},c=()=>{e(!1)},f=()=>{e(!1),l()};return d?b("span",{className:"inline-flex items-center gap-1","data-testid":`${t}-prompt`,role:"group",children:[n(i,{"data-testid":`${t}-confirm`,disabled:s,onClick:f,size:"sm",type:"button",variant:"destructive",children:r??a("Confirm")}),n(i,{"data-testid":`${t}-cancel`,onClick:c,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):n(i,{"data-testid":t,disabled:s,onClick:m,size:"sm",type:"button",variant:"outline",children:o})};export{$ as ConfirmButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as l}from"react/compiler-runtime";import{useConnectionStatus as d}from"@lunora/react";import{useT as f}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{c as u}from"./utils-bhneXptQ.js";import{jsx as m,jsxs as g}from"react/jsx-runtime";const p={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},j=()=>{const e=l(16),n=f(),a=d();let s;e:switch(a){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}default:s=a}const r=p[a];let o;e[8]!==r?(o=u("size-2 rounded-full",r),e[8]=r,e[9]=o):o=e[9];let c;e[10]!==o?(c=m("span",{"aria-hidden":"true",className:o}),e[10]=o,e[11]=c):c=e[11];let i;return e[12]!==a||e[13]!==c||e[14]!==s?(i=g("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[c,s]}),e[12]=a,e[13]=c,e[14]=s,e[15]=i):i=e[15],i};export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as m}from"react/compiler-runtime";import{useRef as a,useEffect as f}from"react";const d=5e3,h=(e,r,u)=>{const t=m(6),o=u===void 0?d:u,l=a(e);let n;t[0]!==e?(n=()=>{l.current=e},t[0]=e,t[1]=n):n=t[1],f(n);let c,s;t[2]!==r||t[3]!==o?(c=()=>{if(!r)return;const i=setInterval(()=>{globalThis.document?.hidden!==!0&&l.current()},o);return()=>{clearInterval(i)}},s=[r,o],t[2]=r,t[3]=o,t[4]=c,t[5]=s):(c=t[4],s=t[5]),f(c,s)};export{d as DEFAULT_AUTO_REFRESH_MS,h as useAutoRefresh};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c={highErrorRate:.05,highWriteContention:.1,lowCacheHitRate:.5,minCacheSamples:10,minConflictCalls:5,minErrorCalls:5,slowFunctionMs:1e3},l={error:0,info:2,warning:1},u=(i,t)=>{const s=[];if(i.maxDurationMs>=t.slowFunctionMs){const e=i.scannedTables??[];e.length>0?s.push({fn:i.path,kind:"missing-index",severity:"warning",tables:e.map(a=>a.table),value:i.maxDurationMs}):s.push({fn:i.path,kind:"slow-function",severity:"info",value:i.maxDurationMs})}i.calls>=t.minErrorCalls&&i.errors/i.calls>=t.highErrorRate&&s.push({fn:i.path,kind:"high-error-rate",message:i.lastErrorMessage??void 0,severity:"error",value:i.errors/i.calls});const r=i.conflicts??0;return r>0&&i.calls>=t.minConflictCalls&&r/i.calls>=t.highWriteContention&&s.push({fn:i.path,kind:"high-write-contention",severity:"warning",value:r/i.calls}),s},g=(i,t,s=c)=>{const r=[];if(i?.cache){const{evictions:e,hits:a,misses:h}=i.cache,o=a+h;if(o>=s.minCacheSamples){const n=a/o;n<s.lowCacheHitRate&&r.push({kind:"low-cache-hit-rate",severity:"warning",value:n})}e>0&&e>a&&r.push({kind:"high-evictions",severity:"warning",value:e})}for(const e of t??[])r.push(...u(e,s));return r.toSorted((e,a)=>l[e.severity]-l[a.severity])};export{c as DEFAULT_INSIGHT_THRESHOLDS,g as deriveInsights};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setupI18n as a}from"@lingui/core";import{compileMessage as i}from"@lingui/message-utils/compileMessage";import{createContext as c,use as m}from"react";const u={},s="en",p={en:u},f=(e=s,o=p)=>{const t=a();t.setMessagesCompiler(i);for(const[n,r]of Object.entries(o))t.load(n,r);return t.activate(o[e]===void 0?s:e),t},d=f(),I=c(d),L=()=>{const e=m(I);return(o,t)=>e._(o,t)};export{s as DEFAULT_LOCALE,I as StudioI18nContext,f as createStudioI18n,d as studioI18n,L as useT};
|