@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,2 @@
|
|
|
1
|
+
import{a as hr}from"./chunk-7QIFDWQV.js";import{a as D,b as It,c as F,h as ve,i as Ce,j as yt}from"./chunk-2OUPA2WJ.js";import{a as Et,c as ue,d as z,g as V,i as de,j as $}from"./chunk-6ST5ECQA.js";import{a as r,d as te,e as g,f as y,g as vr,h as re,j as Ct}from"./chunk-3XIESWL4.js";var mr=g(vr(),1),Ba=g(y(),1);var dr=g(y(),1);var qe={};te(qe,{Control:()=>sr,Description:()=>tr,Error:()=>Zt,Item:()=>ur,Label:()=>Gt,Root:()=>qt,Validity:()=>lr});var A=g(y(),1);var Ee=g(y(),1);var He=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});var oe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fe={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Ft={disabled:!1,...fe},W={valid(e){return e===null?null:e?{[He.valid]:""}:{[He.invalid]:""}}};var Cr={invalid:void 0,name:void 0,validityData:{state:oe,errors:[],error:"",value:"",initialValue:null},setValidityData:V,disabled:void 0,touched:fe.touched,setTouched:V,dirty:fe.dirty,setDirty:V,filled:fe.filled,setFilled:V,focused:fe.focused,setFocused:V,validate:r(()=>null,"validate"),validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:r(()=>!1,"shouldValidateOnChange"),state:Ft,markedDirtyRef:{current:!1},registerFieldControl:V,validation:{getValidationProps:r((e,t=de)=>t,"getValidationProps"),inputRef:{current:null},registerInput:V,commit:r(async()=>{},"commit"),change:V}},Je=Ee.createContext(Cr);function B(e=!0){let t=Ee.useContext(Je);if(t.setValidityData===V&&!e)throw new Error(ue(28));return t}r(B,"useFieldRootContext");var Ie=g(y(),1);var Er=Ie.createContext(void 0);function Tt(e=!1){let t=Ie.useContext(Er);if(!t&&!e)throw new Error(ue(86));return t}r(Tt,"useFieldsetRootContext");var ye=g(y(),1);var Ir=ye.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:V,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function H(){return ye.useContext(Ir)}r(H,"useFormContext");var Q=g(y(),1);var Fe=g(y(),1);var Dt=0;function yr(e,t="mui"){let[o,n]=Fe.useState(e),i=e||o;return Fe.useEffect(()=>{o==null&&(Dt+=1,n(`${t}-${Dt}`))},[o,t]),i}r(yr,"useGlobalId");var St=It.useId;function At(e,t){if(St!==void 0){let o=St();return e??(t?`${t}-${o}`:o)}return yr(e,t)}r(At,"useId");function J(e){return At(e,"base-ui")}r(J,"useBaseUiId");var Te=g(y(),1);var Xe=Te.createContext({controlId:void 0,registerControlId:V,labelId:void 0,setLabelId:V,messageIds:[],setMessageIds:V,getDescriptionProps:r(e=>e,"getDescriptionProps")});function P(){return Te.useContext(Xe)}r(P,"useLabelableContext");var Vt=g(re(),1);var De=r(function(t){let o=J(),n=t.controlId===void 0?o:t.controlId,[i,s]=Q.useState(n),[l,a]=Q.useState(t.labelId),[u,d]=Q.useState([]),m=z(()=>new Map),{messageIds:f}=P(),h=F((R,T)=>{let N=m.current;if(T===void 0){N.delete(R);return}N.set(R,T),s(C=>{if(N.size===0)return;let k;for(let c of N.values()){if(C!==void 0&&c===C)return C;k===void 0&&(k=c)}return k})}),p=Q.useCallback(R=>{let T=R["aria-describedby"]?R["aria-describedby"].split(" "):[];return T.push(...f,...u),{...R,"aria-describedby":Array.from(new Set(T)).join(" ")||void 0}},[f,u]),v=Q.useMemo(()=>({controlId:i,registerControlId:h,labelId:l,setLabelId:a,messageIds:u,setMessageIds:d,getDescriptionProps:p}),[i,h,l,a,u,d,p]);return(0,Vt.jsx)(Xe.Provider,{value:v,children:t.children})},"LabelableProvider");var be=g(y(),1);function Nt(e={}){let{id:t,implicit:o=!1,controlRef:n}=e,{controlId:i,registerControlId:s}=P(),l=J(t),a=o?i:void 0,u=z(()=>Symbol("labelable-control")),d=be.useRef(!1),m=be.useRef(t!=null),f=F(()=>{!d.current||s===V||(d.current=!1,s(u.current,void 0))});return D(()=>{if(s===V)return;let h;if(o){let p=n?.current;ve(p)&&p.closest("label")!=null?h=t??null:h=a??l}else if(t!=null)m.current=!0,h=t;else if(m.current)h=l;else{f();return}if(h===void 0){f();return}d.current=!0,s(u.current,h)},[t,n,a,s,o,l,u,f]),be.useEffect(()=>f,[f]),i??l}r(Nt,"useLabelableId");function Se(e){return e?.ownerDocument||document}r(Se,"ownerDocument");var Ae={};te(Ae,{engine:()=>rt,env:()=>nt,os:()=>et,screenReader:()=>ot});var et={};te(et,{android:()=>_t,apple:()=>Ze,ios:()=>Qe,linux:()=>Ar,mac:()=>Ot,windows:()=>Sr});function Fr(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}r(Fr,"readRawData");var{userAgent:Tr,platform:Dr,maxTouchPoints:wt}=Fr(),ne=Tr.toLowerCase(),ie=Dr.toLowerCase();var Qe=/^i(os$|p)/.test(ie)||ie==="macintel"&&wt>1,Lt="android",_t=ie===Lt||ne.includes(Lt),Ot=!Qe&&ie.startsWith("mac"),Sr=ie.startsWith("win"),Ar=!_t&&/^(linux|chrome os)/.test(ie),Ze=Ot||Qe;var rt={};te(rt,{blink:()=>Nr,gecko:()=>Vr,webkit:()=>tt});var tt=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Vr=!tt&&ne.includes("firefox"),Nr=!tt&&ne.includes("chrom");var ot={};te(ot,{voiceOver:()=>wr});var wr=Ze;var nt={};te(nt,{jsdom:()=>Lr});var Lr=/jsdom|happydom/.test(ne);var it="data-base-ui-focusable";var st="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Fn="ArrowLeft",Tn="ArrowRight",Dn="ArrowUp",Sn="ArrowDown";function at(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}r(at,"activeElement");function Mt(e,t){if(!e||!t)return!1;let o=t.getRootNode?.();if(e.contains(t))return!0;if(o&&yt(o)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}r(Mt,"contains");function lt(e){return"composedPath"in e?e.composedPath()[0]:e.target}r(lt,"getTarget");function Pn(e,t){if(!ve(e))return!1;let o=e;if(t.hasElement(o))return!o.hasAttribute("data-trigger-disabled");for(let[,n]of t.entries())if(Mt(n,o))return!n.hasAttribute("data-trigger-disabled");return!1}r(Pn,"isTargetInsideEnabledTrigger");function kn(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let o=e;return o.target!=null&&t.contains(o.target)}r(kn,"isEventTargetWithin");function Un(e){return e.matches("html,body")}r(Un,"isRootElement");function _r(e){return Ce(e)&&e.matches(st)}r(_r,"isTypeableElement");function jn(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${st}`)!=null}r(jn,"isInteractiveElement");function Bn(e){return e?e.getAttribute("role")==="combobox"&&_r(e):!1}r(Bn,"isTypeableCombobox");function $n(e){if(!e||Ae.env.jsdom)return!0;try{return e.matches(":focus-visible")}catch{return!0}}r($n,"matchesFocusVisible");function Wn(e){return e?e.hasAttribute(it)?e:e.querySelector(`[${it}]`)||e:null}r(Wn,"getFloatingFocusElement");function Pt(e,t){let o=J(e);return D(()=>(t(o),()=>{t(void 0)}),[o,t]),o}r(Pt,"useRegisteredLabelId");function kt(e={}){let{id:t,fallbackControlId:o,native:n=!1,setLabelId:i,focusControl:s}=e,{controlId:l,setLabelId:a}=P(),u=F(p=>{a(p),i?.(p)}),d=Pt(t,u),m=l??o;function f(p){if(s){s(p,m);return}if(!m)return;let v=Se(p.currentTarget).getElementById(m);Ce(v)&&Or(v)}r(f,"focusControl");function h(p){lt(p.nativeEvent)?.closest("button,input,select,textarea")||(!p.defaultPrevented&&p.detail>1&&p.preventDefault(),!n&&f(p))}return r(h,"handleInteraction"),n?{id:d,htmlFor:m??void 0,onMouseDown:h}:{id:d,onClick:h,onPointerDown(p){p.preventDefault()}}}r(kt,"useLabel");function Or(e){e.focus({focusVisible:!0})}r(Or,"focusElementWithVisible");var Z=g(y(),1);var Ut=g(y(),1);var Mr=[];function Ve(e){Ut.useEffect(e,Mr)}r(Ve,"useOnMount");var xe=0,ct=class e{static{r(this,"Timeout")}static create(){return new e}currentId=xe;start(t,o){this.clear(),this.currentId=setTimeout(()=>{this.currentId=xe,o()},t)}isStarted(){return this.currentId!==xe}clear=r(()=>{this.currentId!==xe&&(clearTimeout(this.currentId),this.currentId=xe)},"clear");disposeEffect=r(()=>this.clear,"disposeEffect")};function jt(){let e=z(ct.create).current;return Ve(e.disposeEffect),e}r(jt,"useTimeout");function se(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}r(se,"getCombinedFieldValidityData");var Ne=Object.keys(oe);function Pr(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(let o of Ne)o!=="valid"&&(o==="valueMissing"?t=e[o]:e[o]&&(t=!1));return t}r(Pr,"isOnlyValueMissing");function kr(e){let t=null;for(let o of e)if(!o.disabled){if(!o.validity.valid)return o;t??=o}return t}r(kr,"findRepresentativeInput");function Bt(e,t){let o=!1;for(let n of t)n.setCustomValidity(""),o||=n===e;o||e.setCustomValidity("")}r(Bt,"clearCustomValidity");function $t(e){let{formRef:t}=H(),{setValidityData:o,validate:n,validityData:i,validationDebounceTime:s,invalid:l,markedDirtyRef:a,state:u,shouldValidateOnChange:d,getRegisteredFieldId:m}=e,{controlId:f,getDescriptionProps:h}=P(),p=jt(),v=Z.useRef(null),R=z(()=>new Set).current,T=Z.useRef(0),N=Z.useCallback(b=>{if(b)return R.add(b),()=>{R.delete(b)}},[R]),C=F(async(b,w=!1)=>{let E=kr(R)??v.current;if(!E)return;T.current+=1;let ee=T.current;function q(M,S=l){let _=m()??f;if(_==null)return;let x=t.current.fields.get(_);if(!x)return;let K=se(M,S);t.current.fields.set(_,{...x,validityData:K})}if(r(q,"updateRegisteredFieldValidity"),w){if(u.valid!==!1)return;let M=E.validity;if(!M.valueMissing){let _={value:b,state:{...oe,valid:!0},error:"",errors:[],initialValue:i.initialValue};Bt(E,R),q(_,!1),o(_);return}let S=Ne.reduce((_,x)=>(_[x]=M[x],_),{});if(!S.valid&&!Pr(S))return}function G(M){let S=Ne.reduce((x,K)=>(x[K]=M.validity[K],x),{}),_=!1;for(let x of Ne)if(x!=="valid"){if(x==="valueMissing"&&S[x])_=!0;else if(S[x])return S}return _&&!a.current&&(S.valid=!0,S.valueMissing=!1),S}r(G,"getState"),p.clear();let I=null,O=[],U=G(E),j,Y=d();if(E.validationMessage&&!Y)j=E.validationMessage,O=[E.validationMessage];else{let M=Array.from(t.current.fields.values()).reduce((_,x)=>(x.name&&(_[x.name]=x.getValue()),_),{}),S=n(b,M);if(typeof S=="object"&&S!==null&&"then"in S){if(I=await S,ee!==T.current)return}else I=S;I!==null?(U.valid=!1,U.customError=!0,Array.isArray(I)?(O=I,E.setCustomValidity(I.join(`
|
|
2
|
+
`))):I&&(O=[I],E.setCustomValidity(I))):Y&&(Bt(E,R),U.customError=!1,E.validationMessage?(j=E.validationMessage,O=[E.validationMessage]):E.validity.valid&&!U.valid&&(U.valid=!0))}let L={value:b,state:U,error:j??(Array.isArray(I)?I[0]:I??""),errors:O,initialValue:i.initialValue};q(L),o(L)}),k=F(b=>{p.clear();let w=d();w&&b!==""&&s?(T.current+=1,p.start(s,()=>{C(b)})):C(b,!w)}),c=Z.useCallback((b,w={})=>Et(h(w),u.valid===!1&&!u.disabled&&!b?{"aria-invalid":!0}:de),[h,u.disabled,u.valid]);return Z.useMemo(()=>({getValidationProps:c,inputRef:v,registerInput:N,commit:C,change:k}),[c,N,C,k])}r($t,"useFieldValidation");var we=g(y(),1);function Wt(e){let{commit:t,invalid:o,markedDirtyRef:n,name:i,setRegisteredFieldName:s,setRegisteredFieldId:l,setValidityData:a,validityData:u}=e,{formRef:d}=H(),m=we.useRef(null),f=we.useRef(null),h=we.useRef(null),p=F(()=>{let c=f.current;if(c)return c.getValue?c.getValue():c.value});function v(c){return c.value===void 0?p():c.value}r(v,"getRegistrationValue");let R=F(()=>{let c=f.current;if(n.current=!0,!c){t(u.value);return}t(v(c))});function T(){let c=f.current;!c||!c.id||d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R})}r(T,"refreshRegistration");function N(c=f.current?.id){c&&d.current.fields.delete(c)}r(N,"deleteRegistration");function C(){let c=f.current;if(!c)return;let b=v(c);u.initialValue===null&&b!==null&&a(w=>({...w,initialValue:b}))}r(C,"syncInitialValue"),D(()=>{let c=f.current;!c||!c.id||(s(i?void 0:c.name),d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R}))},[d,p,o,i,s,R,u]),D(()=>{let c=d.current.fields;return()=>{let b=f.current?.id;b&&c.delete(b)}},[d]);let k=F((c,b)=>{if(!b){m.current===c&&(m.current=null,N(),f.current=null,s(void 0),l(void 0));return}let w=f.current?.id;m.current=c,f.current=b,i||s(b.name),l(b.id),w&&w!==b.id&&N(w),C(),T()});return[R,k]}r(Wt,"useFieldControlRegistration");var Le=g(re(),1);var Ur=A.forwardRef(r(function(t,o){let{errors:n,validationMode:i,submitAttemptedRef:s}=H(),{render:l,className:a,validate:u,validationDebounceTime:d=0,validationMode:m=i,name:f,disabled:h=!1,invalid:p,dirty:v,touched:R,actionsRef:T,style:N,...C}=t,k=Tt(!0)?.disabled,c=F(u||(()=>null)),b=k||h,[w,E]=A.useState(!1),[ee,q]=A.useState(!1),[G,I]=A.useState(!1),[O,U]=A.useState(!1),j=v??ee,Y=R??w,L=A.useRef(j),M=A.useRef(void 0),[S,_]=A.useState(),x=f??S;D(()=>{v!==void 0&&(L.current=v)},[v]);let K=A.useCallback(()=>M.current,[]),br=A.useCallback(ce=>{M.current=ce},[]),xt=F(ce=>{v===void 0&&(ce&&(L.current=!0),q(ce))}),gt=F(ce=>{R===void 0&&E(ce)}),Ge=F(()=>m==="onChange"||m==="onSubmit"&&s.current),Ye=x&&Object.hasOwn(n,x)?n[x]:null,xr=!!(Array.isArray(Ye)?Ye.length:Ye),me=p===!0||xr,[pe,Ke]=A.useState({state:oe,error:"",errors:[],value:null,initialValue:null}),Rt=b?null:!me&&pe.state.valid,he=A.useMemo(()=>({disabled:b,touched:Y,dirty:j,valid:Rt,filled:G,focused:O}),[b,Y,j,Rt,G,O]),ze=$t({setValidityData:Ke,validate:c,validityData:pe,validationDebounceTime:d,invalid:me,markedDirtyRef:L,state:he,shouldValidateOnChange:Ge,getRegisteredFieldId:K}),[ht,vt]=Wt({commit:ze.commit,invalid:me,markedDirtyRef:L,name:f,setRegisteredFieldName:_,setRegisteredFieldId:br,setValidityData:Ke,validityData:pe});A.useImperativeHandle(T,()=>({validate:ht}),[ht]);let gr=A.useMemo(()=>({invalid:me,name:x,validityData:pe,setValidityData:Ke,disabled:b,touched:Y,setTouched:gt,dirty:j,setDirty:xt,filled:G,setFilled:I,focused:O,setFocused:U,validate:c,validationMode:m,validationDebounceTime:d,shouldValidateOnChange:Ge,state:he,markedDirtyRef:L,registerFieldControl:vt,validation:ze}),[me,x,pe,b,Y,gt,j,xt,G,I,O,U,c,m,d,Ge,he,vt,ze]),Rr=$("div",t,{ref:o,state:he,props:C,stateAttributesMapping:W});return(0,Le.jsx)(Je.Provider,{value:gr,children:Rr})},"FieldRootInner")),qt=A.forwardRef(r(function(t,o){return(0,Le.jsx)(De,{children:(0,Le.jsx)(Ur,{...t,ref:o})})},"FieldRoot"));var ge=g(y(),1);var _e=g(y(),1);var ut=_e.createContext({disabled:!1});function Oe(){return _e.useContext(ut)}r(Oe,"useFieldItemContext");var Gt=ge.forwardRef(r(function(t,o){let{render:n,className:i,style:s,id:l,nativeLabel:a=!0,...u}=t,d=B(!1),m=Oe(),{labelId:f}=P(),h={...d.state,disabled:d.disabled||m.disabled},p=ge.useRef(null),v=kt({id:f??l,native:a});return $("label",t,{ref:[o,p],state:h,props:[v,u],stateAttributesMapping:W})},"FieldLabel"));var ae=g(y(),1);var Xt=g(y(),1);var Ht=g(hr(),1);var Me=null,Zi=globalThis.requestAnimationFrame,dt=class{static{r(this,"Scheduler")}callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=r(t=>{this.isScheduled=!1;let o=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let i=0;i<o.length;i+=1)o[i]?.(t)},"tick");request(t){let o=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),o}cancel(t){let o=t-this.startId;o<0||o>=this.callbacks.length||(this.callbacks[o]=null,this.callbacksCount-=1)}},Pe=new dt,X=class e{static{r(this,"AnimationFrame")}static create(){return new e}static request(t){return Pe.request(t)}static cancel(t){return Pe.cancel(t)}currentId=Me;request(t){this.cancel(),this.currentId=Pe.request(()=>{this.currentId=Me,t()})}cancel=r(()=>{this.currentId!==Me&&(Pe.cancel(this.currentId),this.currentId=Me)},"cancel");disposeEffect=r(()=>this.cancel,"disposeEffect")};function Yt(){let e=z(X.create).current;return Ve(e.disposeEffect),e}r(Yt,"useAnimationFrame");function Kt(e){return e==null?e:"current"in e?e.current:e}r(Kt,"resolveRef");var ke=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({}),jr={[ke.startingStyle]:""},Br={[ke.endingStyle]:""},zt={transitionStatus(e){return e==="starting"?jr:e==="ending"?Br:null}};function Jt(e,t=!1,o=!0){let n=Yt();return F((i,s=null)=>{n.cancel();let l=Kt(e);if(l==null)return;let a=l,u=r(()=>{Ht.flushSync(i)},"done");if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function d(){Promise.all(a.getAnimations().map(m=>m.finished)).then(()=>{s?.aborted||u()}).catch(()=>{if(o){s?.aborted||u();return}let m=a.getAnimations();!s?.aborted&&m.length>0&&m.some(f=>f.pending||f.playState!=="finished")&&d()})}if(r(d,"exec"),t){let m=ke.startingStyle;if(!a.hasAttribute(m)){n.request(d);return}let f=new MutationObserver(()=>{a.hasAttribute(m)||(f.disconnect(),d())});f.observe(a,{attributes:!0,attributeFilter:[m]}),s?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}n.request(d)})}r(Jt,"useAnimationsFinished");function Qt(e){let{enabled:t=!0,open:o,ref:n,onComplete:i}=e,s=F(i),l=Jt(n,o,!1);Xt.useEffect(()=>{if(!t)return;let a=new AbortController;return l(s,a.signal),()=>{a.abort()}},[t,o,s,l])}r(Qt,"useOpenChangeComplete");var ft=g(y(),1);function Ue(e,t=!1,o=!1){let[n,i]=ft.useState(e&&t?"idle":void 0),[s,l]=ft.useState(e);return e&&!s&&(l(!0),i("starting")),!e&&s&&n!=="ending"&&!o&&i("ending"),!e&&!s&&n==="ending"&&i(void 0),D(()=>{if(!e&&s&&n!=="ending"&&o){let a=X.request(()=>{i("ending")});return()=>{X.cancel(a)}}},[e,s,n,o]),D(()=>{if(!e||t)return;let a=X.request(()=>{i(void 0)});return()=>{X.cancel(a)}},[t,e]),D(()=>{if(!e||!t)return;e&&s&&n!=="idle"&&i("starting");let a=X.request(()=>{i("idle")});return()=>{X.cancel(a)}},[t,e,s,n]),{mounted:s,setMounted:l,transitionStatus:n}}r(Ue,"useTransitionStatus");var mt=g(re(),1);var $r={...W,...zt},Zt=ae.forwardRef(r(function(t,o){let{render:n,id:i,className:s,match:l,style:a,...u}=t,d=J(i),{validityData:m,state:f,name:h}=B(!1),{setMessageIds:p}=P(),{errors:v}=H(),R=h&&Object.hasOwn(v,h)?v[h]:null,T=!!(Array.isArray(R)?R.length:R),N=typeof l=="string",C=!1;l===!0?C=!0:f.disabled?C=!1:N?C=!!m.state[l]:C=T||m.state.valid===!1;let{mounted:k,transitionStatus:c,setMounted:b}=Ue(C);D(()=>{if(!(!C||!d))return p(L=>L.concat(d)),()=>{p(L=>L.filter(M=>M!==d))}},[C,d,p]);let w=ae.useRef(null),[E,ee]=ae.useState(null),[q,G]=ae.useState(null),I=m.error;!N&&T?I=R:m.errors.length>1&&(I=m.errors);let O=I??"";Array.isArray(I)&&(O=I.length>1?(0,mt.jsx)("ul",{children:I.map(L=>(0,mt.jsx)("li",{children:L},L))}):I[0]??"");let U=Array.isArray(I)?JSON.stringify(I):I;C&&U!==q&&(G(U),ee(O)),Qt({open:C,ref:w,onComplete(){C||b(!1)}});let j={...f,transitionStatus:c},Y=$("div",t,{ref:[o,w],state:j,props:[{id:d,children:C?O:E},u],stateAttributesMapping:$r,enabled:k});return k?Y:null},"FieldError"));var er=g(y(),1);var tr=er.forwardRef(r(function(t,o){let{render:n,id:i,className:s,style:l,...a}=t,u=J(i),d=B(!1),m=Oe(),{setMessageIds:f}=P(),h={...d.state,disabled:d.disabled||m.disabled};return D(()=>{if(u)return f(v=>v.concat(u)),()=>{f(v=>v.filter(R=>R!==u))}},[u,f]),$("p",t,{ref:o,state:h,props:[{id:u},a],stateAttributesMapping:W})},"FieldDescription"));var Be=g(y(),1);var le=g(y(),1);function rr({controlled:e,default:t,name:o,state:n="value"}){let{current:i}=le.useRef(e!==void 0),[s,l]=le.useState(t),a=i?e:s,u=le.useCallback(d=>{i||l(d)},[]);return[a,u]}r(rr,"useControlled");var or=g(y(),1);function nr(e,t,o,n,i=!0,s){let{registerFieldControl:l}=B(),a=or.useRef(null);a.current||(a.current=Symbol()),D(()=>{let u=a.current;return!u||!i?void 0:(l(u,{controlRef:e,getValue:n,id:t,name:s,value:o}),()=>{l(u,void 0)})},[e,i,n,t,s,l,o])}r(nr,"useRegisterFieldControl");var je={};te(je,{cancelOpen:()=>go,chipRemovePress:()=>Qr,clearPress:()=>Xr,closePress:()=>Hr,closeWatcher:()=>co,decrementPress:()=>to,disabled:()=>ho,drag:()=>po,escapeKey:()=>lo,focusOut:()=>ao,imperativeAction:()=>Eo,incrementPress:()=>eo,initial:()=>Co,inputBlur:()=>no,inputChange:()=>ro,inputClear:()=>oo,inputPaste:()=>io,inputPress:()=>so,itemPress:()=>zr,keyboard:()=>fo,linkPress:()=>Jr,listNavigation:()=>uo,missing:()=>vo,none:()=>Wr,outsidePress:()=>Kr,pointer:()=>mo,scrub:()=>xo,siblingOpen:()=>Ro,swipe:()=>Io,trackPress:()=>Zr,triggerFocus:()=>Yr,triggerHover:()=>Gr,triggerPress:()=>qr,wheel:()=>bo,windowResize:()=>yo});var Wr="none",qr="trigger-press",Gr="trigger-hover",Yr="trigger-focus",Kr="outside-press",zr="item-press",Hr="close-press",Jr="link-press",Xr="clear-press",Qr="chip-remove-press",Zr="track-press",eo="increment-press",to="decrement-press",ro="input-change",oo="input-clear",no="input-blur",io="input-paste",so="input-press",ao="focus-out",lo="escape-key",co="close-watcher",uo="list-navigation",fo="keyboard",mo="pointer",po="drag",bo="wheel",xo="scrub",go="cancel-open",Ro="sibling-open",ho="disabled",vo="missing",Co="initial",Eo="imperative-action",Io="swipe",yo="window-resize";function ir(e,t,o,n){let i=!1,s=!1,l=n??de;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:o,...l}}r(ir,"createChangeEventDetails");var sr=Be.forwardRef(r(function(t,o){let{render:n,className:i,id:s,name:l,value:a,disabled:u=!1,onValueChange:d,defaultValue:m,autoFocus:f=!1,style:h,...p}=t,{state:v,name:R,disabled:T,setTouched:N,setDirty:C,validityData:k,setFocused:c,setFilled:b,validationMode:w,validation:E}=B(),{clearErrors:ee}=H(),q=T||u,G=R??l,I={...v,disabled:q},{labelId:O}=P(),U=Nt({id:s});D(()=>{let x=a!=null;E.inputRef.current?.value||x&&a!==""?b(!0):x&&a===""&&b(!1)},[E.inputRef,b,a]);let j=Be.useRef(null);D(()=>{f&&j.current===at(Se(j.current))&&c(!0)},[f,c]);let[Y]=rr({controlled:a,default:m,name:"FieldControl",state:"value"}),L=a!==void 0,M=L?Y:void 0,S=F(()=>E.inputRef.current?.value);return nr(E.inputRef,U,M,S,!q,l),$("input",t,{ref:[o,j],state:I,props:[{id:U,disabled:q,name:G,ref:E.inputRef,"aria-labelledby":O,autoFocus:f,...L?{value:M}:{defaultValue:m},onChange(x){let K=x.currentTarget.value;d?.(K,ir(je.none,x.nativeEvent)),C(K!==k.initialValue),b(K!==""),x.nativeEvent.defaultPrevented||(ee(G),E.change(K))},onFocus(){c(!0)},onBlur(x){N(!0),c(!1),w==="onBlur"&&E.commit(x.currentTarget.value)},onKeyDown(x){x.currentTarget.tagName==="INPUT"&&x.key==="Enter"&&(N(!0),E.commit(x.currentTarget.value))}},p,x=>E.getValidationProps(q,x)],stateAttributesMapping:W})},"FieldControl"));var Re=g(y(),1);var ar=g(re(),1);var lr=r(function(t){let{children:o}=t,{validityData:n,invalid:i}=B(!1),s=Re.useMemo(()=>se(n,i),[n,i]),l=s.state.valid===!1,{transitionStatus:a}=Ue(l),u=Re.useMemo(()=>({...s,validity:s.state,transitionStatus:a}),[s,a]);return(0,ar.jsx)(Re.Fragment,{children:o(u)})},"FieldValidity");var We=g(y(),1);var $e=g(y(),1);var Fo=$e.createContext(void 0);function cr(e=!0){let t=$e.useContext(Fo);if(t===void 0&&!e)throw new Error(ue(3));return t}r(cr,"useCheckboxGroupContext");var pt=g(re(),1);var ur=We.forwardRef(r(function(t,o){let{render:n,className:i,style:s,disabled:l=!1,...a}=t,{state:u,disabled:d}=B(!1),m=d||l,f={...u,disabled:m},h=cr(),v=h?.allValues!==void 0?h?.parent.id:void 0,R=We.useMemo(()=>({disabled:m}),[m]),T=$("div",t,{ref:o,state:f,props:a,stateAttributesMapping:W});return(0,pt.jsx)(De,{controlId:v,children:(0,pt.jsx)(ut.Provider,{value:R,children:T})})},"FieldItem"));var fr=g(re(),1);var bt=dr.forwardRef(r(function(t,o){return(0,fr.jsx)(qe.Control,{ref:o,...t})},"Input"));var pr=g(re(),1);function qa(e){let t=(0,mr.c)(10),o,n,i;t[0]!==e?({className:o,type:i,...n}=e,t[0]=e,t[1]=o,t[2]=n,t[3]=i):(o=t[1],n=t[2],i=t[3]);let s;t[4]!==o?(s=Ct("h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",o),t[4]=o,t[5]=s):s=t[5];let l;return t[6]!==n||t[7]!==s||t[8]!==i?(l=(0,pr.jsx)(bt,{type:i,"data-slot":"input",className:s,...n}),t[6]=n,t[7]=s,t[8]=i,t[9]=l):l=t[9],l}r(qa,"g");export{W as a,B as b,H as c,At as d,J as e,P as f,Nt as g,Se as h,Ae as i,it as j,Fn as k,Tn as l,Dn as m,Sn as n,at as o,Mt as p,lt as q,Pn as r,kn as s,Un as t,_r as u,jn as v,Bn as w,$n as x,Wn as y,kt as z,Ve as A,ct as B,jt as C,Oe as D,X as E,Yt as F,Kt as G,ke as H,zt as I,Jt as J,Qt as K,Ue as L,rr as M,nr as N,je as O,ir as P,cr as Q,qa as R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as ee}from"./chunk-XSD4Y6SQ.js";import{a as z,b as D,c as F,d as w,e as l,f as o}from"./chunk-MIQTKZAR.js";import{a as E,e as j}from"./chunk-UZERI5YC.js";import{a as te}from"./chunk-V53KNYRN.js";import{R as Z}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as I}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as K}from"./chunk-GXZAXNZI.js";import{f as G}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as P}from"./chunk-XQCVZAGU.js";import{d as H,f as Q,g as V,h as W,m as $}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as n,e as Y,f as ne,h as le}from"./chunk-3XIESWL4.js";var i=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(c=>typeof c=="object"&&c!==null&&c.code===de,"de"),me=n(c=>{let r=c.error??c.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"ce"),ue=n(({loadDetail:c,loadInstances:r,readOnly:b,runAction:_,workflowName:h})=>{let A=G(),s=H(),[N,g]=(0,i.useState)(null),[S,O]=(0,i.useState)(null),[k,J]=(0,i.useState)(""),[v,p]=(0,i.useState)(null),[L,C]=(0,i.useState)(!1),[R,U]=(0,i.useState)(null),f=c??(a=>A.getWorkflowInstance(a)),x=b?void 0:_??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{p(null),C(!1);let a=k===""?void 0:k;try{if(r===void 0){let d=await A.listWorkflowInstances({name:h,status:a});if(d.configured===!1){g(null),C(!0);return}g(d.instances);return}g(await r({name:h,status:a}))}catch(d){g(null),ce(d)?C(!0):p(W(d))}},"O");(0,i.useEffect)(()=>{O(null),$(T())},[h,k]);let q=n(async a=>{p(null);try{O(await f({id:a,name:h}))}catch(d){p(W(d))}},"D"),M=n(async(a,d)=>{if(x!==void 0){U(a),p(null);try{await x({action:d,id:a,name:h}),await T()}catch(B){p(W(B))}finally{U(null)}}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{J(a.target.value)},"onChange"),value:k,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),v!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:v}),L&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!L&&N!==null&&N.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),N!==null&&N.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Instance id")}),(0,e.jsx)(l,{children:s("Status")}),(0,e.jsx)(l,{children:s("Created")}),(0,e.jsx)(l,{children:s("Ended")}),(0,e.jsx)(l,{"aria-label":s("Actions")})]})}),(0,e.jsx)(F,{children:N.map(a=>(0,e.jsxs)(w,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(I,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),x!==void 0&&ie.map(d=>(0,e.jsx)(I,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(M(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(j,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(I,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{O(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(z,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:s("Step")}),(0,e.jsx)(l,{children:s("Type")}),(0,e.jsx)(l,{children:s("Attempts")}),(0,e.jsx)(l,{children:s("Started")}),(0,e.jsx)(l,{children:s("Output")})]})}),(0,e.jsx)(F,{children:S.steps.map((a,d)=>(0,e.jsxs)(w,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(o,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"me"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"he"),Ie=n(()=>{let c=G(),r=H(),{data:b,error:_}=ee(K.listWorkflows,{}),[h,A]=(0,i.useState)(""),[s,N]=(0,i.useState)(""),[g,S]=(0,i.useState)(""),[O,k]=(0,i.useState)(!1),[J,v]=(0,i.useState)(null),[p,L]=(0,i.useState)([]),[C,R]=(0,i.useState)(null),U=b!==void 0,f=(0,i.useMemo)(()=>Array.isArray(b?.workflows)?[...b.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[b]),x=(0,i.useMemo)(()=>f.some(t=>t.exportName===h)?h:f[0]?.exportName??"",[f,h]),T=(0,i.useMemo)(()=>f.find(t=>t.exportName===x),[f,x]),q=n(t=>{L(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"D"),M=n(async()=>{let t=x;if(t==="")return;let u,m=g.trim();if(m!=="")try{u=JSON.parse(m)}catch{v(r("Params must be valid JSON"));return}k(!0),v(null);try{let y=s.trim(),X=await c.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),N("")}catch(y){v(W(y))}finally{k(!1)}},"q"),a=n(()=>{$(M())},"a"),d=n(async(t,u)=>{R(u);try{let m=await c.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){v(W(m))}finally{R(null)}},"l"),B=n(t=>{A(t.target.value)},"M"),ae=n(t=>{N(t.target.value)},"Z"),re=n(t=>{S(t.target.value)},"ee"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"te");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[_!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:_}),(0,e.jsx)("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.")}),U&&f.length===0?(0,e.jsx)(P,{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")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Export")}),(0,e.jsx)(l,{children:r("Name")}),(0,e.jsx)(l,{children:r("Class")}),(0,e.jsx)(l,{children:r("Binding")})]})}),(0,e.jsx)(F,{children:f.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),J!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:J}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("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:B,value:x,children:f.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(I,{"data-testid":"workflows-start-button",disabled:O||x==="",onClick:a,children:r(O?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:g})]}),p.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(z,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(w,{children:[(0,e.jsx)(l,{children:r("Workflow")}),(0,e.jsx)(l,{children:r("Instance id")}),(0,e.jsx)(l,{children:r("Status")}),(0,e.jsx)(l,{children:r("Output")}),(0,e.jsx)(l,{})]})}),(0,e.jsx)(F,{children:p.map(t=>(0,e.jsxs)(w,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(o,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(o,{children:(0,e.jsx)(I,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:se,size:"xs",variant:"outline",children:C===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Oe");export{Ie as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as U}from"./chunk-54MMVNPT.js";import{a as Q}from"./chunk-7LQWFOEU.js";import{a as E}from"./chunk-XSD4Y6SQ.js";import{a as K,b as V,c as z,d as F,e as v,f as b}from"./chunk-MIQTKZAR.js";import{a as D,e as P}from"./chunk-UZERI5YC.js";import{c as te}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as ee}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{f as T}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as _}from"./chunk-XQCVZAGU.js";import{d as B,h as O,m as W,q as Z}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as m,e as R,f as oe,g as ae,h as le}from"./chunk-3XIESWL4.js";var Y=R(ae(),1),G=R(oe(),1);var t=R(le(),1);var ne=R(ae(),1);var X=R(oe(),1);var c=R(le(),1);var ie=m(a=>Number.isFinite(a)?Z(a,"\u2014"):"\u2014","Y"),se=m(a=>a.toSorted((e,h)=>e.scheduledFor-h.scheduledFor),"T"),de=m(a=>{let e=(0,ne.c)(33),h;e[0]!==a?(h=a===void 0?{}:a,e[0]=a,e[1]=h):h=e[1];let{cancelJob:i,loadJobs:p}=h,l=T(),o=B(),r=p===void 0,y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=["lunora-scheduled-jobs"],e[2]=y):y=e[2];let f;e[3]!==l||e[4]!==p?(f=m(async()=>{let d=await(p??(()=>l.listScheduledJobs()))();return se(d)},"j"),e[3]=l,e[4]=p,e[5]=f):f=e[5];let n=E(y,f),[s,u]=(0,X.useState)(void 0),[J,j]=(0,X.useState)(void 0),x,C;e[6]!==l||e[7]!==r?(x=m(()=>{if(r)return l.subscribeScheduledJobs(d=>{j(void 0),u(se(d))})},"N"),C=[r,l],e[6]=l,e[7]=r,e[8]=x,e[9]=C):(x=e[8],C=e[9]),(0,X.useEffect)(x,C);let g;e[10]!==n?(g=m(()=>{n.refetch()},"$"),e[10]=n,e[11]=g):g=e[11],U(g,!r);let S;e:{if(i!==void 0){S=i;break e}let d;e[12]!==l||e[13]!==p?(d=p===void 0?H=>l.cancelScheduledJob(H):void 0,e[12]=l,e[13]=p,e[14]=d):d=e[14],S=d}let k=S,w=s??n.data,$=J??n.error,q;e[15]!==k||e[16]!==n||e[17]!==r?(q=m(async d=>{if(k!==void 0){j(void 0);try{await k(d),r||n.refetch()}catch(H){j(O(H))}}},"S"),e[15]=k,e[16]=n,e[17]=r,e[18]=q):q=e[18];let I=q,L;e[19]!==$?(L=$!==null&&(0,c.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:$}),e[19]=$,e[20]=L):L=e[20];let N;e[21]!==w?.length||e[22]!==o?(N=w?.length===0&&(0,c.jsx)(_,{description:o("Jobs queued with runAfter / runAt will appear here."),icon:(0,c.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,c.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,c.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:o("No scheduled jobs.")}),e[21]=w?.length,e[22]=o,e[23]=N):N=e[23];let M;e[24]!==I||e[25]!==k||e[26]!==w||e[27]!==o?(M=w!==void 0&&w.length>0&&(0,c.jsx)(D,{className:"overflow-hidden py-0",children:(0,c.jsx)(P,{className:"px-0",children:(0,c.jsxs)(K,{"data-testid":"sj-table",children:[(0,c.jsx)(V,{children:(0,c.jsxs)(F,{children:[(0,c.jsx)(v,{children:o("function")}),(0,c.jsx)(v,{children:o("scheduled for")}),(0,c.jsx)(v,{children:o("pool")}),(0,c.jsx)(v,{children:o("attempts")}),(0,c.jsx)(v,{children:o("shard")}),(0,c.jsx)(v,{children:o("id")}),k!==void 0&&(0,c.jsx)(v,{"aria-label":o("Actions")})]})}),(0,c.jsx)(z,{children:w.map(d=>(0,c.jsxs)(F,{"data-testid":`sj-row-${d.id}`,children:[(0,c.jsx)(b,{className:"font-mono text-xs",children:d.functionPath}),(0,c.jsx)(b,{className:"text-muted-foreground tabular-nums",children:ie(d.scheduledFor)}),(0,c.jsx)(b,{className:"font-mono text-xs",children:d.pool??""}),(0,c.jsx)(b,{className:"tabular-nums",children:d.attempts??0}),(0,c.jsx)(b,{children:d.shardKey??""}),(0,c.jsx)(b,{className:"font-mono text-xs",children:d.id}),k!==void 0&&(0,c.jsx)(b,{className:"text-right",children:(0,c.jsx)(Q,{confirmLabel:o("Cancel job?"),onConfirm:m(()=>{W(I(d.id))},"onConfirm"),testId:`sj-cancel-${d.id}`,children:o("Cancel")})})]},d.id))})]})})}),e[24]=I,e[25]=k,e[26]=w,e[27]=o,e[28]=M):M=e[28];let A;return e[29]!==N||e[30]!==M||e[31]!==L?(A=(0,c.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduled-jobs",children:[L,N,M]}),e[29]=N,e[30]=M,e[31]=L,e[32]=A):A=e[32],A},"he");var ce={kind:"idle"},he=m(({loadCronJobs:a,runCronJob:e}={})=>{let h=T(),i=B(),[p,l]=(0,G.useState)({}),o=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>h.getCronJobs()))()),{data:r,error:y}=o,f=(0,G.useMemo)(()=>e!==void 0?e:a===void 0?s=>h.runCronJob(s):void 0,[h,a,e]),n=m(async s=>{if(f!==void 0){l(u=>({...u,[s]:{kind:"running"}}));try{await f(s),l(u=>({...u,[s]:{kind:"ok"}})),o.refetch()}catch(u){l(J=>({...J,[s]:{kind:"error",message:O(u)}}))}}},"d");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:y}),r?.length===0&&(0,t.jsx)(_,{description:i("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:i("No cron triggers.")}),r!==void 0&&r.length>0&&(0,t.jsx)(D,{className:"overflow-hidden py-0",children:(0,t.jsx)(P,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(v,{children:i("name")}),(0,t.jsx)(v,{children:i("schedule")}),(0,t.jsx)(v,{children:i("target")}),(0,t.jsx)(v,{children:i("shard")}),f!==void 0&&(0,t.jsx)(v,{"aria-label":i("Actions")})]})}),(0,t.jsx)(z,{children:r.map(s=>{let u=p[s.name]??ce;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(b,{children:s.name}),(0,t.jsx)(b,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(b,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(ee,{variant:"outline",children:i("function")}):(0,t.jsx)(ee,{variant:"secondary",children:i("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(b,{children:s.shardKey??""}),f!==void 0&&(0,t.jsx)(b,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:i("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:u.message}),(0,t.jsx)(Q,{confirmLabel:i("Run now?"),disabled:u.kind==="running",onConfirm:m(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:u.kind==="running"?i("Running\u2026"):i("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),me=m(a=>Number.isFinite(a)?Z(a,"\u2014"):"\u2014","re"),ue=m(a=>{let e=(0,Y.c)(34),h;e[0]!==a?(h=a===void 0?{}:a,e[0]=a,e[1]=h):h=e[1];let{loadJobs:i,removeJob:p,retryJob:l}=h,o=T(),r=B(),y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=["lunora-dead-jobs"],e[2]=y):y=e[2];let f;e[3]!==o||e[4]!==i?(f=m(async()=>(await(i??(()=>o.listDeadJobs()))()).toSorted(fe),"h"),e[3]=o,e[4]=i,e[5]=f):f=e[5];let n=E(y,f),s=n.data,[u,J]=(0,G.useState)(void 0),j=n.error??u,x=i===void 0,C;e[6]!==o||e[7]!==x||e[8]!==l?(C=l??(x?d=>o.retryDeadJob(d):void 0),e[6]=o,e[7]=x,e[8]=l,e[9]=C):C=e[9];let g=C,S;e[10]!==o||e[11]!==x||e[12]!==p?(S=p??(x?d=>o.removeDeadJob(d):void 0),e[10]=o,e[11]=x,e[12]=p,e[13]=S):S=e[13];let k=S,w;e[14]!==n?(w=m(()=>{n.refetch()},"J"),e[14]=n,e[15]=w):w=e[15],U(w,!0);let $;e[16]!==n?($=m(async d=>{J(void 0);try{await d,n.refetch()}catch(H){J(O(H))}},"j"),e[16]=n,e[17]=$):$=e[17];let q=$,I=g!==void 0||k!==void 0,L;e[18]!==j?(L=j!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:j}),e[18]=j,e[19]=L):L=e[19];let N;e[20]!==s?.length||e[21]!==r?(N=s?.length===0&&(0,t.jsx)(_,{description:r("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:r("No dead-letter jobs.")}),e[20]=s?.length,e[21]=r,e[22]=N):N=e[22];let M;e[23]!==q||e[24]!==I||e[25]!==s||e[26]!==k||e[27]!==g||e[28]!==r?(M=s!==void 0&&s.length>0&&(0,t.jsx)(D,{className:"overflow-hidden py-0",children:(0,t.jsx)(P,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(v,{children:r("function")}),(0,t.jsx)(v,{children:r("attempts")}),(0,t.jsx)(v,{children:r("last tried")}),(0,t.jsx)(v,{children:r("pool")}),(0,t.jsx)(v,{children:r("shard")}),(0,t.jsx)(v,{children:r("id")}),I&&(0,t.jsx)(v,{"aria-label":r("Actions")})]})}),(0,t.jsx)(z,{children:s.map(d=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${d.id}`,children:[(0,t.jsx)(b,{className:"font-mono text-xs",children:d.functionPath}),(0,t.jsx)(b,{className:"tabular-nums",children:d.attempts??0}),(0,t.jsx)(b,{className:"text-muted-foreground tabular-nums",children:me(d.scheduledFor)}),(0,t.jsx)(b,{className:"font-mono text-xs",children:d.pool??""}),(0,t.jsx)(b,{children:d.shardKey??""}),(0,t.jsx)(b,{className:"font-mono text-xs",children:d.id}),I&&(0,t.jsx)(b,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[g!==void 0&&(0,t.jsx)(te,{"data-testid":`dlq-retry-${d.id}`,onClick:m(()=>{W(q(g(d.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:r("Retry")}),k!==void 0&&(0,t.jsx)(Q,{confirmLabel:r("Drop job?"),onConfirm:m(()=>{W(q(k(d.id)))},"onConfirm"),testId:`dlq-remove-${d.id}`,children:r("Drop")})]})})]},d.id))})]})})}),e[23]=q,e[24]=I,e[25]=s,e[26]=k,e[27]=g,e[28]=r,e[29]=M):M=e[29];let A;return e[30]!==M||e[31]!==L||e[32]!==N?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[L,N,M]}),e[30]=M,e[31]=L,e[32]=N,e[33]=A):A=e[33],A},"ne");function fe(a,e){return(e.attempts??0)-(a.attempts??0)}m(fe,"ae");var re=m(a=>{let e=(0,Y.c)(8),{label:h,testId:i,value:p}=a,l;e[0]!==h?(l=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:h}),e[0]=h,e[1]=l):l=e[1];let o;e[2]!==i||e[3]!==p?(o=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":i,children:p}),e[2]=i,e[3]=p,e[4]=o):o=e[4];let r;return e[5]!==l||e[6]!==o?(r=(0,t.jsx)(D,{className:"flex-1 py-0",children:(0,t.jsxs)(P,{className:"flex flex-col gap-1 p-4",children:[l,o]})}),e[5]=l,e[6]=o,e[7]=r):r=e[7],r},"F"),pe=m(a=>{let e=(0,Y.c)(25),h;e[0]!==a?(h=a===void 0?{}:a,e[0]=a,e[1]=h):h=e[1];let{loadStatus:i}=h,p=T(),l=B(),o=i===void 0,r;e[2]!==o?(r=["lunora-scheduler-status",o],e[2]=o,e[3]=r):r=e[3];let y;e[4]!==p||e[5]!==i?(y=m(async()=>{let S=await(i??(()=>p.schedulerStatus()))();return{...S,pools:S.pools.toSorted(ve)}},"k"),e[4]=p,e[5]=i,e[6]=y):y=e[6];let f=E(r,y),{data:n,error:s}=f,u;e[7]!==f?(u=m(()=>{f.refetch()},"s"),e[7]=f,e[8]=u):u=e[8],U(u,!0);let J;e[9]!==s?(J=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=J):J=e[10];let j;e[11]!==n||e[12]!==l?(j=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(re,{label:l("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(re,{label:l("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(re,{label:l("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=l,e[13]=j):j=e[13];let x;e[14]!==n?.pools.length||e[15]!==l?(x=n?.pools.length===0&&(0,t.jsx)(_,{description:l("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:l("No workpools.")}),e[14]=n?.pools.length,e[15]=l,e[16]=x):x=e[16];let C;e[17]!==n||e[18]!==l?(C=n!==void 0&&n.pools.length>0&&(0,t.jsx)(D,{className:"overflow-hidden py-0",children:(0,t.jsx)(P,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(v,{children:l("pool")}),(0,t.jsx)(v,{children:l("queued")}),(0,t.jsx)(v,{children:l("in flight")}),(0,t.jsx)(v,{children:l("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(be)})]})})}),e[17]=n,e[18]=l,e[19]=C):C=e[19];let g;return e[20]!==J||e[21]!==j||e[22]!==x||e[23]!==C?(g=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[J,j,x,C]}),e[20]=J,e[21]=j,e[22]=x,e[23]=C,e[24]=g):g=e[24],g},"de");function ve(a,e){return e.queued-a.queued}m(ve,"ie");function be(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(b,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(b,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(b,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(b,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}m(be,"se");var xe=["jobs","dead","pools","cron"],Ee=m(a=>{let e=(0,Y.c)(41),h;e[0]!==a?(h=a===void 0?{}:a,e[0]=a,e[1]=h):h=e[1];let{loadCronJobs:i,scheduledCancel:p,scheduledLoad:l}=h,o=B(),[r,y]=(0,G.useState)("jobs"),f;e[2]!==o?(f=o("Cron triggers"),e[2]=o,e[3]=f):f=e[3];let n;e[4]!==o?(n=o("Dead letter"),e[4]=o,e[5]=n):n=e[5];let s;e[6]!==o?(s=o("Scheduled jobs"),e[6]=o,e[7]=s):s=e[7];let u;e[8]!==o?(u=o("Pools"),e[8]=o,e[9]=u):u=e[9];let J;e[10]!==f||e[11]!==n||e[12]!==s||e[13]!==u?(J={cron:f,dead:n,jobs:s,pools:u},e[10]=f,e[11]=n,e[12]=s,e[13]=u,e[14]=J):J=e[14];let j=J,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=m(N=>{y(N.currentTarget.dataset.view)},"u"),e[15]=x):x=e[15];let C=x,g;e[16]!==o?(g=o("Schedule view"),e[16]=o,e[17]=g):g=e[17];let S;e[18]!==r||e[19]!==j?(S=xe.map(N=>(0,t.jsx)(te,{"aria-selected":r===N,"data-testid":`schedule-view-${N}`,"data-view":N,onClick:C,role:"tab",size:"sm",type:"button",variant:r===N?"default":"outline",children:j[N]},N)),e[18]=r,e[19]=j,e[20]=S):S=e[20];let k;e[21]!==g||e[22]!==S?(k=(0,t.jsx)("div",{"aria-label":g,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:S}),e[21]=g,e[22]=S,e[23]=k):k=e[23];let w;e[24]!==p||e[25]!==l||e[26]!==r?(w=r==="jobs"&&(0,t.jsx)(de,{cancelJob:p,loadJobs:l}),e[24]=p,e[25]=l,e[26]=r,e[27]=w):w=e[27];let $;e[28]!==r?($=r==="dead"&&(0,t.jsx)(ue,{}),e[28]=r,e[29]=$):$=e[29];let q;e[30]!==r?(q=r==="pools"&&(0,t.jsx)(pe,{}),e[30]=r,e[31]=q):q=e[31];let I;e[32]!==i||e[33]!==r?(I=r==="cron"&&(0,t.jsx)(he,{loadCronJobs:i}),e[32]=i,e[33]=r,e[34]=I):I=e[34];let L;return e[35]!==k||e[36]!==w||e[37]!==$||e[38]!==q||e[39]!==I?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[k,w,$,q,I]}),e[35]=k,e[36]=w,e[37]=$,e[38]=q,e[39]=I,e[40]=L):L=e[40],L},"Je");export{Ee as SchedulePanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as de,e as F}from"./chunk-5L2MD6F6.js";import{a as ce}from"./chunk-X2FQ6B5V.js";import"./chunk-PF7V3G2Z.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import"./chunk-T6VMSOBB.js";import{b as ie}from"./chunk-XSD4Y6SQ.js";import{a as k}from"./chunk-UZERI5YC.js";import{a as oe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-7QIFDWQV.js";import{b as A}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as y}from"./chunk-GXZAXNZI.js";import{f as ae,g as le}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{d as R,f as S,g as Q,h as V,m as z,q as ne}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as p,e as q,f as qe,g as re,h as se,j as w}from"./chunk-3XIESWL4.js";var xe=q(re(),1);var c=q(qe(),1);var ue=q(re(),1);var K=q(se(),1);var Ae={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},me=p(()=>{let t=(0,ue.c)(16),e=R(),a=le(),s;e:switch(a){case"connected":{let i;t[0]!==e?(i=e("Connected"),t[0]=e,t[1]=i):i=t[1],s=i;break e}case"connecting":{let i;t[2]!==e?(i=e("Connecting\u2026"),t[2]=e,t[3]=i):i=t[3],s=i;break e}case"idle":{let i;t[4]!==e?(i=e("Idle"),t[4]=e,t[5]=i):i=t[5],s=i;break e}case"offline":{let i;t[6]!==e?(i=e("Offline"),t[6]=e,t[7]=i):i=t[7],s=i;break e}default:s=a}let l=Ae[a],d;t[8]!==l?(d=w("size-2 rounded-full",l),t[8]=l,t[9]=d):d=t[9];let u;t[10]!==d?(u=(0,K.jsx)("span",{"aria-hidden":"true",className:d}),t[10]=d,t[11]=u):u=t[11];let o;return t[12]!==a||t[13]!==u||t[14]!==s?(o=(0,K.jsxs)("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:[u,s]}),t[12]=a,t[13]=u,t[14]=s,t[15]=o):o=t[15],o},"j");var r=q(se(),1);var fe={completed:0,failed:2,in_progress:1},Ee=p(t=>{let e=0,a=0,s=0,l=0,d=[];for(let{metrics:u}of t){if(u===null){l+=1;continue}s+=1,e+=u.requests,a+=u.errors,d.push(...u.history??[])}return{errors:a,failed:l,history:d,reachable:s,requests:e}},"Se"),je=p(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"Me"),Ie=p(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let d=fe[s.status]-fe[l.status];(d>0||d===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"qe"),De=S(y.getAuthMetrics),Ce=S(y.getFunctionStats),Pe=S(y.getLogs),Le=S(y.getMetrics),Te=S(y.migrationStatus),Re=5,pe=2e3,ze=5,he=.01,ge=.05,Fe=.1,Ke=.3,Oe=1,_e=50,W=p((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","V"),$e=p((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","Re"),He={crit:"destructive",ok:"secondary",warn:"default"},O=p((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"F"),Ue=p(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"_e"),Be=p(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"ze"),Ge=p((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"Ke"),ve={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},be={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Je={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Qe=p(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Ue"),_=p(t=>{let e=(0,xe.c)(19),{chart:a,label:s,level:l,testId:d,value:u}=t,o=ve[l],i;e[0]!==o?(i=w("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=i):i=e[1];let h;e[2]!==i?(h=(0,r.jsx)("span",{"aria-hidden":"true",className:i}),e[2]=i,e[3]=h):h=e[3];let g;e[4]!==s||e[5]!==h?(g=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[h,s]}),e[4]=s,e[5]=h,e[6]=g):g=e[6];let N=be[l],f;e[7]!==N?(f=w("truncate text-2xl font-semibold tabular-nums",N),e[7]=N,e[8]=f):f=e[8];let m;e[9]!==f||e[10]!==d||e[11]!==u?(m=(0,r.jsx)("span",{className:f,"data-testid":d,children:u}),e[9]=f,e[10]=d,e[11]=u,e[12]=m):m=e[12];let x;e[13]!==a||e[14]!==m?(x=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[m,a]}),e[13]=a,e[14]=m,e[15]=x):x=e[15];let v;return e[16]!==g||e[17]!==x?(v=(0,r.jsx)(k,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,x]})}),e[16]=g,e[17]=x,e[18]=v):v=e[18],v},"R"),Ve=p(async(t,e,a)=>{let s=await Promise.all(a.map(f=>{let m=Q(f);return Promise.allSettled([t.query(Le,{},m),t.query(Ce,{},m),t.query(Te,{},m)])})),l=Q(e),d=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[u,o,i]=await Promise.allSettled([t.query(Pe,{},l),t.query(De,{},l),d]),h=s.map(([f,m,x])=>({functions:m.status==="fulfilled"?m.value.functions:[],metrics:f.status==="fulfilled"?f.value:null,migrations:x.status==="fulfilled"?x.value.migrations:[]})),g=Ee(h),N=s[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:u.status==="fulfilled"?u.value.entries:[],functions:je(h.map(f=>f.functions)),logsError:u.status==="rejected"?V(u.reason):null,metricsError:g.reachable===0&&N?.status==="rejected"?V(N.reason):null,migrations:Ie(h.map(f=>f.migrations)),scheduler:i.status==="fulfilled"?i.value:null,totals:g}},"Be"),pt=p(({initialShardKey:t})=>{let e=ae(),a=R(),[s,l]=(0,c.useState)([]),[d,u]=(0,c.useState)(null),[o,i]=(0,c.useState)(null),[h,g]=(0,c.useState)(null),[N,f]=(0,c.useState)([]),[m,x]=(0,c.useState)(null),[v,Ne]=(0,c.useState)(null),[we,ye]=(0,c.useState)([]),[M]=(0,c.useState)(oe),E=(0,c.useRef)(!1),$=(0,c.useRef)(!0);(0,c.useEffect)(()=>($.current=!0,()=>{$.current=!1}),[]);let j=t??"",I=(0,c.useCallback)(async()=>{if(E.current)return;E.current=!0;let n=await Ve(e,j,de(j,M));if(!$.current){E.current=!1;return}i(n.totals),g(n.metricsError),f(n.functions),ye(n.migrations),l(n.entries),u(n.logsError),x(n.auth),Ne(n.scheduler),E.current=!1},[e,M,j]);(0,c.useEffect)(()=>{z(I())},[I]);let H=(0,c.useRef)(0),D=(0,c.useRef)(null),ke=p(()=>{let n=Date.now()-H.current;if(n>=pe){H.current=Date.now(),z(I());return}D.current??=setTimeout(()=>{D.current=null,H.current=Date.now(),z(I())},pe-n)},"de");(0,c.useEffect)(()=>()=>{D.current!==null&&clearTimeout(D.current)},[]);let{data:X,liveError:Se}=ie(y.getMetrics,{},{live:!0,shardKey:j});(0,c.useEffect)(()=>{X!==void 0&&ke()},[X]);let U=s.filter(n=>n.level==="error"),B=U.slice(0,Re),C=Ue(o?.history),Y=(0,c.useMemo)(()=>{let n=m?.history??[];return{attempts:n.map(b=>b.attempts),failures:n.map(b=>b.failures)}},[m?.history]),Z=N.filter(n=>n.calls>0).toSorted((n,b)=>b.errors/b.calls-n.errors/n.calls||b.calls-n.calls).slice(0,ze),G=Be(we),Me=o===null||o.requests===0?0:o.errors/o.requests,J=W(Me,he,ge),ee=m===null?"ok":W(m.failureRate,Fe,Ke),te=v===null?"ok":$e(v.backlog,Oe,_e),P=Qe([J,ee,te,G.level]),L,T;return P==="crit"?(L=a("Critical"),T=a("One or more service levels are breached.")):P==="warn"?(L=a("Degraded"),T=a("Some service levels need attention.")):(L=a("All systems healthy"),T=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:w("flex size-10 shrink-0 items-center justify-center rounded-full",Je[P]),children:(0,r.jsx)("span",{className:w("size-3 rounded-full",ve[P])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:L}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:T})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[C.requests.length>=2&&(0,r.jsx)(F,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:C.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(o?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:w("text-lg font-semibold tabular-nums",be[J]),"data-testid":"hl-error-rate",children:o===null?"\u2014":O(o.errors,o.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(me,{}),(0,r.jsx)(ce,{message:Se,prefix:"hl"})]})]})]}),h!==null&&(0,r.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:h})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(_,{chart:C.errors.length>=2?(0,r.jsx)(F,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:C.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:o===null?"\u2014":O(o.errors,o.requests)}),(0,r.jsx)(_,{chart:Y.failures.length>=2?(0,r.jsx)(F,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:Y.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:ee,testId:"hl-slo-auth",value:m===null?"\u2014":O(m.failures,m.attempts)}),(0,r.jsx)(_,{label:a("Scheduler backlog"),level:te,testId:"hl-slo-backlog",value:v===null?"\u2014":v.backlog.toString()}),(0,r.jsx)(_,{label:a("Migrations"),level:G.level,testId:"hl-slo-migrations",value:Ge(G,a)})]}),(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,r.jsxs)(k,{className:"gap-0 py-0","data-testid":"hl-functions",children:[(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Functions by error rate")})}),Z.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:a("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:Z.map(n=>(0,r.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:n.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:a("{count} calls",{count:n.calls.toString()})}),(0,r.jsx)(A,{variant:He[W(n.errors/n.calls,he,ge)],children:O(n.errors,n.calls)})]})]},n.path))})]}),(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Recent errors")}),(0,r.jsx)(A,{"data-testid":"hl-error-count",variant:U.length>0?"destructive":"outline",children:U.length})]}),d!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:d}),d===null&&B.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:a("No recent errors.")}),B.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:B.map((n,b)=>(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ne(n.timestamp)}),n.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:n.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:n.message})]},`${n.timestamp.toString()}-${b.toString()}`))})]})]}),(0,r.jsxs)(k,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Shards seen")}),(0,r.jsx)(A,{"data-testid":"hl-shard-count",variant:"outline",children:M.length})]}),M.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:M.map(n=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(A,{variant:"secondary",children:n})},n))})]})]})},"ot");export{pt as HealthPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i,e as v,g as j,h as I,j as k}from"./chunk-3XIESWL4.js";var y=v(j(),1);var h=v(I(),1);var z={dialog:"fixed inset-0 z-[1000] flex justify-center bg-black/20 pt-[10vh]",drawer:"fixed inset-0 z-[1000] flex justify-end bg-black/20"},C={dialog:"flex h-fit w-[min(28rem,92vw)] flex-col gap-3 rounded-lg border border-border bg-background p-4 shadow-xl",drawer:"flex h-full w-[min(34rem,100vw)] flex-col gap-4 overflow-auto border-l border-border bg-background p-4 shadow-xl"},D=i(N=>{let e=(0,y.c)(18),{className:n,children:c,label:b,onClose:r,panelTestId:f,testId:g,variant:u}=N,o;e[0]!==r?(o=i(s=>{s.target===s.currentTarget&&r()},"t"),e[0]=r,e[1]=o):o=e[1];let m=o,t;e[2]!==r?(t=i(s=>{s.key==="Escape"&&r()},"a"),e[2]=r,e[3]=t):t=e[3];let p=t,x=z[u],w=C[u],l;e[4]!==n||e[5]!==w?(l=k(w,n),e[4]=n,e[5]=w,e[6]=l):l=e[6];let a;e[7]!==c||e[8]!==b||e[9]!==f||e[10]!==l?(a=(0,h.jsx)("div",{"aria-label":b,className:l,"data-testid":f,role:"dialog",children:c}),e[7]=c,e[8]=b,e[9]=f,e[10]=l,e[11]=a):a=e[11];let d;return e[12]!==m||e[13]!==p||e[14]!==x||e[15]!==a||e[16]!==g?(d=(0,h.jsx)("div",{className:x,"data-testid":g,onClick:m,onKeyDown:p,role:"presentation",children:a}),e[12]=m,e[13]=p,e[14]=x,e[15]=a,e[16]=g,e[17]=d):d=e[17],d},"I");export{D as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ae}from"./chunk-7RXOPYR5.js";import"./chunk-PF7V3G2Z.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import"./chunk-T6VMSOBB.js";import{a as te}from"./chunk-XXQUMVWH.js";import{a as Q,b as U,c as D,e as V}from"./chunk-UZERI5YC.js";import{d as Y,f as ee}from"./chunk-7T7UOTYK.js";import"./chunk-7QIFDWQV.js";import{c as T}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as X}from"./chunk-GXZAXNZI.js";import{f as F}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as H}from"./chunk-XQCVZAGU.js";import{d as W,f as Z,g as G,h as J,m as P}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as C,e as O,f as de,g as le,h as ie}from"./chunk-3XIESWL4.js";var A=O(le(),1),$=O(de(),1);var i=O(ie(),1);var se=Z(X.runSql),re=C((M,e)=>{let a=F(),[m,t]=(0,$.useState)(void 0),[d,s]=(0,$.useState)(void 0),[l,c]=(0,$.useState)(!0),N=(0,$.useCallback)(async r=>{c(!0);try{let w=await a.query(se,{sql:M},G(e));r.cancelled||(t(w),s(void 0))}catch(w){r.cancelled||(t(void 0),s(J(w)))}finally{r.cancelled||c(!1)}},[a,M,e]);return(0,$.useEffect)(()=>{let r={cancelled:!1};return P(N(r)),()=>{r.cancelled=!0}},[N]),{error:d,loading:l,result:m}},"ie"),oe="lunora-studio-dashboards",B={shardKey:"",sql:"",title:""},ne=C(M=>{let e=(0,A.c)(54),{onEdit:a,onRemove:m,widget:t}=M,d=W(),{error:s,loading:l,result:c}=re(t.sql,t.shardKey??""),N;e[0]!==a||e[1]!==t.id?(N=C(()=>{a(t.id)},"C"),e[0]=a,e[1]=t.id,e[2]=N):N=e[2];let r=N,w;e[3]!==m||e[4]!==t.id?(w=C(()=>{m(t.id)},"w"),e[3]=m,e[4]=t.id,e[5]=w):w=e[5];let L=w,_=`dashboards-widget-${t.id}`,q;e[6]!==t.title?(q=(0,i.jsx)(D,{className:"min-w-0 truncate",title:t.title,children:t.title}),e[6]=t.title,e[7]=q):q=e[7];let E;e[8]!==d?(E=d("Edit widget"),e[8]=d,e[9]=E):E=e[9];let j=`dashboards-widget-edit-${t.id}`,R;e[10]!==d?(R=d("Edit widget"),e[10]=d,e[11]=R):R=e[11];let k;e[12]===Symbol.for("react.memo_cache_sentinel")?(k=(0,i.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,i.jsx)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[12]=k):k=e[12];let x;e[13]!==r||e[14]!==E||e[15]!==j||e[16]!==R?(x=(0,i.jsx)(T,{"aria-label":E,"data-testid":j,onClick:r,size:"icon-xs",title:R,type:"button",variant:"ghost",children:k}),e[13]=r,e[14]=E,e[15]=j,e[16]=R,e[17]=x):x=e[17];let p;e[18]!==d?(p=d("Remove widget"),e[18]=d,e[19]=p):p=e[19];let K=`dashboards-widget-remove-${t.id}`,h;e[20]!==d?(h=d("Remove widget"),e[20]=d,e[21]=h):h=e[21];let v;e[22]===Symbol.for("react.memo_cache_sentinel")?(v=(0,i.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,i.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[22]=v):v=e[22];let u;e[23]!==L||e[24]!==p||e[25]!==K||e[26]!==h?(u=(0,i.jsx)(T,{"aria-label":p,"data-testid":K,onClick:L,size:"icon-xs",title:h,type:"button",variant:"ghost",children:v}),e[23]=L,e[24]=p,e[25]=K,e[26]=h,e[27]=u):u=e[27];let b;e[28]!==u||e[29]!==x?(b=(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[x,u]}),e[28]=u,e[29]=x,e[30]=b):b=e[30];let g;e[31]!==b||e[32]!==q?(g=(0,i.jsxs)(U,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[q,b]}),e[31]=b,e[32]=q,e[33]=g):g=e[33];let f;e[34]!==s||e[35]!==t.id?(f=s!==void 0&&(0,i.jsx)(te,{className:"font-mono text-xs",testId:`dashboards-widget-error-${t.id}`,variant:"destructive",children:s}),e[34]=s,e[35]=t.id,e[36]=f):f=e[36];let S;e[37]!==s||e[38]!==l||e[39]!==c||e[40]!==d||e[41]!==t.id?(S=s===void 0&&l&&c===void 0&&(0,i.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${t.id}`,children:d("Running\u2026")}),e[37]=s,e[38]=l,e[39]=c,e[40]=d,e[41]=t.id,e[42]=S):S=e[42];let o;e[43]!==s||e[44]!==c?(o=s===void 0&&c!==void 0&&(0,i.jsx)(ae,{result:c}),e[43]=s,e[44]=c,e[45]=o):o=e[45];let n;e[46]!==f||e[47]!==S||e[48]!==o?(n=(0,i.jsxs)(V,{className:"min-h-32 py-2",children:[f,S,o]}),e[46]=f,e[47]=S,e[48]=o,e[49]=n):n=e[49];let y;return e[50]!==g||e[51]!==n||e[52]!==_?(y=(0,i.jsxs)(Q,{"data-testid":_,children:[g,n]}),e[50]=g,e[51]=n,e[52]=_,e[53]=y):y=e[53],y},"ae"),ce=C(M=>{let e=(0,A.c)(58),{draft:a,editing:m,onCancel:t,onChange:d,onSubmit:s}=M,l=W(),c;e[0]!==a||e[1]!==d?(c=C(z=>{d({...a,title:z.target.value})},"n"),e[0]=a,e[1]=d,e[2]=c):c=e[2];let N=c,r;e[3]!==a||e[4]!==d?(r=C(z=>{d({...a,sql:z.target.value})},"s"),e[3]=a,e[4]=d,e[5]=r):r=e[5];let w=r,L;e[6]!==a||e[7]!==d?(L=C(z=>{d({...a,shardKey:z.target.value})},"$"),e[6]=a,e[7]=d,e[8]=L):L=e[8];let _=L,q;e[9]!==s?(q=C(()=>{s()},"q"),e[9]=s,e[10]=q):q=e[10];let E=q,j;e[11]!==a.sql||e[12]!==a.title?(j=a.title.trim()!==""&&a.sql.trim()!=="",e[11]=a.sql,e[12]=a.title,e[13]=j):j=e[13];let R=j,k;e[14]!==l?(k=l("Widget title"),e[14]=l,e[15]=k):k=e[15];let x;e[16]!==l?(x=l("Widget title"),e[16]=l,e[17]=x):x=e[17];let p;e[18]!==a.title||e[19]!==N||e[20]!==k||e[21]!==x?(p=(0,i.jsx)("input",{"aria-label":k,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:N,placeholder:x,type:"text",value:a.title}),e[18]=a.title,e[19]=N,e[20]=k,e[21]=x,e[22]=p):p=e[22];let K;e[23]!==l?(K=l("SQL query"),e[23]=l,e[24]=K):K=e[24];let h;e[25]!==a.sql||e[26]!==w||e[27]!==K?(h=(0,i.jsx)("textarea",{"aria-label":K,className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:w,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:a.sql}),e[25]=a.sql,e[26]=w,e[27]=K,e[28]=h):h=e[28];let v;e[29]!==l?(v=l("Shard key (optional)"),e[29]=l,e[30]=v):v=e[30];let u;e[31]!==l?(u=l("Shard key (optional)"),e[31]=l,e[32]=u):u=e[32];let b;e[33]!==a.shardKey||e[34]!==_||e[35]!==v||e[36]!==u?(b=(0,i.jsx)("input",{"aria-label":v,className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:_,placeholder:u,type:"text",value:a.shardKey}),e[33]=a.shardKey,e[34]=_,e[35]=v,e[36]=u,e[37]=b):b=e[37];let g;e[38]!==l?(g=l("Cancel"),e[38]=l,e[39]=g):g=e[39];let f;e[40]!==t||e[41]!==g?(f=(0,i.jsx)(T,{"data-testid":"dashboards-form-cancel",onClick:t,size:"sm",type:"button",variant:"outline",children:g}),e[40]=t,e[41]=g,e[42]=f):f=e[42];let S=!R,o;e[43]!==m||e[44]!==l?(o=l(m?"Save widget":"Add widget"),e[43]=m,e[44]=l,e[45]=o):o=e[45];let n;e[46]!==E||e[47]!==S||e[48]!==o?(n=(0,i.jsx)(T,{"data-testid":"dashboards-form-save",disabled:S,onClick:E,size:"sm",type:"button",children:o}),e[46]=E,e[47]=S,e[48]=o,e[49]=n):n=e[49];let y;e[50]!==f||e[51]!==n?(y=(0,i.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[f,n]}),e[50]=f,e[51]=n,e[52]=y):y=e[52];let I;return e[53]!==h||e[54]!==b||e[55]!==y||e[56]!==p?(I=(0,i.jsx)(Q,{"data-testid":"dashboards-form",children:(0,i.jsxs)(V,{className:"flex flex-col gap-3 py-4",children:[p,h,b,y]})}),e[53]=h,e[54]=b,e[55]=y,e[56]=p,e[57]=I):I=e[57],I},"oe"),we=C(M=>{let e=(0,A.c)(39),{initialShardKey:a}=M,m=W(),[t,d]=Y(oe),[s,l]=(0,$.useState)(B),[c,N]=(0,$.useState)(null),[r,w]=(0,$.useState)(!1),L;e[0]!==a?(L=C(()=>{N(null),l({...B,shardKey:a??""}),w(!0)},"$"),e[0]=a,e[1]=L):L=e[1];let _=L,q;e[2]===Symbol.for("react.memo_cache_sentinel")?(q=C(()=>{w(!1),N(null),l(B)},"q"),e[2]=q):q=e[2];let E=q,j;e[3]!==t?(j=C(o=>{let n=t.find(y=>y.id===o);n!==void 0&&(N(o),l({shardKey:n.shardKey??"",sql:n.sql,title:n.title}),w(!0))},"L"),e[3]=t,e[4]=j):j=e[4];let R=j,k;e[5]!==d?(k=C(o=>{d(n=>n.filter(y=>y.id!==o))},"k"),e[5]=d,e[6]=k):k=e[6];let x=k,p;e[7]!==s.shardKey||e[8]!==s.sql||e[9]!==s.title||e[10]!==c||e[11]!==d?(p=C(()=>{let o=s.title.trim(),n=s.sql.trim();if(o===""||n==="")return;let y=s.shardKey.trim();d(c===null?I=>[...I,{id:ee("w"),shardKey:y,sql:n,title:o}]:I=>I.map(z=>z.id===c?{...z,shardKey:y,sql:n,title:o}:z)),E()},"p"),e[7]=s.shardKey,e[8]=s.sql,e[9]=s.title,e[10]=c,e[11]=d,e[12]=p):p=e[12];let K=p,h;e[13]!==m?(h=m("Chart widgets backed by saved read-only SQL queries."),e[13]=m,e[14]=h):h=e[14];let v;e[15]!==h?(v=(0,i.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[15]=h,e[16]=v):v=e[16];let u;e[17]!==r||e[18]!==_||e[19]!==m?(u=!r&&(0,i.jsx)(T,{"data-testid":"dashboards-add",onClick:_,size:"sm",type:"button",children:m("Add widget")}),e[17]=r,e[18]=_,e[19]=m,e[20]=u):u=e[20];let b;e[21]!==v||e[22]!==u?(b=(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[v,u]}),e[21]=v,e[22]=u,e[23]=b):b=e[23];let g;e[24]!==s||e[25]!==c||e[26]!==r||e[27]!==K?(g=r&&(0,i.jsx)(ce,{draft:s,editing:c!==null,onCancel:E,onChange:l,onSubmit:K}),e[24]=s,e[25]=c,e[26]=r,e[27]=K,e[28]=g):g=e[28];let f;e[29]!==r||e[30]!==R||e[31]!==x||e[32]!==m||e[33]!==t?(f=t.length===0&&!r?(0,i.jsx)(H,{description:m("Add a widget to chart a saved SQL query on this browser."),testId:"dashboards-empty",title:m("No widgets yet")}):(0,i.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:t.map(o=>(0,i.jsx)(ne,{onEdit:R,onRemove:x,widget:o},o.id))}),e[29]=r,e[30]=R,e[31]=x,e[32]=m,e[33]=t,e[34]=f):f=e[34];let S;return e[35]!==g||e[36]!==f||e[37]!==b?(S=(0,i.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[b,g,f]}),e[35]=g,e[36]=f,e[37]=b,e[38]=S):S=e[38],S},"qe");export{we as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as B}from"./chunk-LEDWUPXM.js";import"./chunk-2PJNAWB3.js";import{a as k}from"./chunk-IC4L6G56.js";import{a as D}from"./chunk-54MMVNPT.js";import"./chunk-BGBLQ563.js";import{a as P}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as q}from"./chunk-XSD4Y6SQ.js";import{R as I}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as H}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as f}from"./chunk-GXZAXNZI.js";import{f as A}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as O}from"./chunk-XQCVZAGU.js";import{d as F,f as v,g as N,h as w,m as y,o as _,q as C}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as s,e as $,f as se,h as de,j as E}from"./chunk-3XIESWL4.js";var l=$(se(),1);var e=$(de(),1);function le({className:r,orientation:h="horizontal",...a}){return(0,e.jsx)(k,{"data-slot":"separator",orientation:h,className:E("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",r),...a})}s(le,"de");var oe=v(f.clearCapturedMail),ne=v(f.sendTestMail),ce=/https?:\/\/[^\s"'<>)]+/i,K=s(r=>r===void 0?void 0:ce.exec(r)?.[0],"S"),me=s(r=>{if(r!==void 0)return K(r.html)??K(r.text)},"ce"),ue=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,he=s(r=>`${ue}${r}`,"ue"),x=s(r=>r===void 0?"":Array.isArray(r)?r.join(", "):r,"f"),Le=s(({limit:r=100})=>{let h=A(),a=F(),{data:j,error:T,errorSource:R,isLoading:U,refetch:g}=q(f.getCapturedMail,{limit:r}),[z,p]=(0,l.useState)(null),[M,S]=(0,l.useState)(null),[m,W]=(0,l.useState)("html"),[b,G]=(0,l.useState)(""),o=(0,l.useMemo)(()=>j?.entries??[],[j]),L=T??z,J=T===null?z:R,Q=s(async()=>{p(null);try{await h.query(oe,{},N("")),S(null),g()}catch(t){p(w(t))}},"I"),V=s(async()=>{p(null);try{await h.query(ne,{},N("")),g()}catch(t){p(w(t))}},"_");D(()=>{g()},!0);let X=s(()=>{y(Q())},"q"),Y=s(()=>{y(V())},"P"),Z=s(t=>{G(t.currentTarget.value)},"D"),ee=s(t=>{let{id:d}=t.currentTarget.dataset;d!==void 0&&S(d)},"R"),te=s(t=>{let d=t.currentTarget.dataset.tab;(d==="headers"||d==="html"||d==="text")&&W(d)},"B"),ae=s(t=>a(t==="html"?"HTML":t==="text"?"Plain text":"Headers"),"K"),u=(0,l.useMemo)(()=>{let t=b.trim().toLowerCase();return t===""?o:o.filter(d=>`${d.subject} ${x(d.to)}`.toLowerCase().includes(t))},[o,b]),i=(0,l.useMemo)(()=>{if(u.length!==0)return u.find(t=>t.id===M)??u[0]},[u,M]),n=me(i),re=s(()=>{n!==void 0&&_(n)},"U"),ie=s(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"W");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(c,{"data-testid":"mail-send-test",onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Send test")}),(0,e.jsx)(c,{"data-testid":"mail-clear",disabled:o.length===0,onClick:X,size:"sm",type:"button",variant:"outline",children:a("Clear inbox")}),o.length>0&&(0,e.jsx)(H,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:a("{count} messages",{count:o.length})})]}),L!==null&&(0,e.jsx)(P,{error:J,testId:"mail-error"}),L===null&&!U&&o.length===0&&(0,e.jsx)(O,{description:a("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,e.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{d:"M4 5h16v14H4z"}),(0,e.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:a("No captured email.")}),o.length>0&&(0,e.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)(I,{"aria-label":a("Search messages"),"data-testid":"mail-search",onChange:Z,placeholder:a("Filter messages"),type:"search",value:b}),(0,e.jsx)(B,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,e.jsx)("ul",{className:"divide-y",children:u.map(t=>{let d=t.id===i?.id;return(0,e.jsx)("li",{children:(0,e.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${d?"bg-muted":""}`,"data-active":d,"data-id":t.id,"data-testid":"mail-list-item",onClick:ee,type:"button",children:[(0,e.jsx)("span",{className:"w-full truncate font-medium",children:t.subject||a("(no subject)")}),(0,e.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:x(t.to)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:C(t.capturedAt,"\u2014")})]})},t.id)})})})]}),i!==void 0&&(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||a("(no subject)")}),(0,e.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,e.jsx)("dt",{children:a("From")}),(0,e.jsx)("dd",{className:"truncate font-mono",children:i.from??"\u2014"}),(0,e.jsx)("dt",{children:a("To")}),(0,e.jsx)("dd",{className:"truncate font-mono",children:x(i.to)}),i.cc!==void 0&&i.cc.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("dt",{children:a("Cc")}),(0,e.jsx)("dd",{className:"truncate font-mono",children:x(i.cc)})]}),(0,e.jsx)("dt",{children:a("Sent")}),(0,e.jsx)("dd",{className:"tabular-nums",children:C(i.capturedAt,"\u2014")})]})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,e.jsx)(c,{"data-testid":"mail-copy-link",disabled:n===void 0,onClick:re,size:"sm",type:"button",variant:"outline",children:a("Copy link")}),(0,e.jsx)(c,{"data-testid":"mail-open-link",disabled:n===void 0,onClick:ie,size:"sm",type:"button",variant:"outline",children:a("Open in new tab")})]}),(0,e.jsx)(le,{}),(0,e.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(t=>(0,e.jsx)(c,{"aria-selected":m===t,"data-tab":t,"data-testid":`mail-tab-${t}`,onClick:te,role:"tab",size:"sm",type:"button",variant:m===t?"secondary":"ghost",children:ae(t)},t))}),(0,e.jsxs)("div",{className:"min-h-[12rem]",children:[m==="html"&&(i.html===void 0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:a("No HTML body.")}):(0,e.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:he(i.html),title:a("Email preview")})),m==="text"&&(i.text===void 0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:a("No text body.")}):(0,e.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text})),m==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:a("No headers.")}):(0,e.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([t,d])=>`${t}: ${d}`).join(`
|
|
2
|
+
`)}))]})]})]})]})},"ze");export{Le as MailPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as D}from"./chunk-54MMVNPT.js";import{a as B}from"./chunk-XSD4Y6SQ.js";import{a as q,b as E,c as M,d as S,e as r,f as s}from"./chunk-MIQTKZAR.js";import{a as A,e as L}from"./chunk-UZERI5YC.js";import{b as x}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{f as W}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as _}from"./chunk-XQCVZAGU.js";import{d as z}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as R,e as O,g as $,h as I}from"./chunk-3XIESWL4.js";var F=O($(),1);var n=O(I(),1);var J=2e3,Q=new Set(["open"]),re=R(G=>{let e=(0,F.c)(41),{read:y}=G,t=z(),j=W(),v;e[0]!==j||e[1]!==y?(v=R(()=>Promise.resolve(y?y():j.debug()),"S"),e[0]=j,e[1]=y,e[2]=v):v=e[2];let H=v,K=y?"injected":"live",b;e[3]!==K?(b=["lunora-studio","sync-client-debug",K],e[3]=K,e[4]=b):b=e[4];let{data:c,refetch:Y}=B(b,H);if(D(Y,!0,J),!c){let i;e[5]!==t?(i=t("Reading the sync client's state\u2026"),e[5]=t,e[6]=i):i=e[6];let g;e[7]!==t?(g=t("Sync client"),e[7]=t,e[8]=g):g=e[8];let T;return e[9]!==i||e[10]!==g?(T=(0,n.jsx)(A,{children:(0,n.jsx)(L,{children:(0,n.jsx)(_,{description:i,title:g})})}),e[9]=i,e[10]=g,e[11]=T):T=e[11],T}let{pendingWrites:k,shards:N,subscriptions:w}=c,l;e[12]!==t?(l=t("This Studio session's sync client"),e[12]=t,e[13]=l):l=e[13];let a;e[14]!==l?(a=(0,n.jsx)("span",{className:"text-sm font-medium",children:l}),e[14]=l,e[15]=a):a=e[15];let P=c.connectionStatus==="connected"?"default":"secondary",o;e[16]!==c.connectionStatus||e[17]!==P?(o=(0,n.jsx)(x,{variant:P,children:c.connectionStatus}),e[16]=c.connectionStatus,e[17]=P,e[18]=o):o=e[18];let d;e[19]!==k||e[20]!==t?(d=k>0?(0,n.jsx)(x,{variant:"secondary",children:t("{count} pending writes",{count:k})}):null,e[19]=k,e[20]=t,e[21]=d):d=e[21];let h;e[22]!==a||e[23]!==o||e[24]!==d?(h=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[a,o,d]}),e[22]=a,e[23]=o,e[24]=d,e[25]=h):h=e[25];let u;e[26]!==t?(u=t("Reads client.debug() for the client running in this page \u2014 not your application's client. Call client.debug() in your app to diagnose a specific stuck overlay there."),e[26]=t,e[27]=u):u=e[27];let m;e[28]!==u?(m=(0,n.jsx)("p",{className:"text-muted-foreground text-xs",children:u}),e[28]=u,e[29]=m):m=e[29];let p;e[30]!==N||e[31]!==t?(p=N.length===0?(0,n.jsx)(_,{description:t("No shard connection has been opened yet."),title:t("No shards")}):(0,n.jsxs)(q,{children:[(0,n.jsx)(E,{children:(0,n.jsxs)(S,{children:[(0,n.jsx)(r,{children:t("Shard")}),(0,n.jsx)(r,{children:t("Socket")}),(0,n.jsx)(r,{children:t("Confirmed watermark")})]})}),(0,n.jsx)(M,{children:N.map(i=>(0,n.jsxs)(S,{children:[(0,n.jsx)(s,{children:i.shardKey??t("(default)")}),(0,n.jsx)(s,{children:(0,n.jsx)(x,{variant:Q.has(i.wsState)?"default":"secondary",children:i.wsState})}),(0,n.jsx)(s,{children:i.confirmedMutationWatermark})]},i.shardKey??"__default__"))})]}),e[30]=N,e[31]=t,e[32]=p):p=e[32];let f;e[33]!==w||e[34]!==t?(f=w.length===0?(0,n.jsx)(_,{description:t("This client holds no live queries or shapes."),title:t("No subscriptions")}):(0,n.jsxs)(q,{children:[(0,n.jsx)(E,{children:(0,n.jsxs)(S,{children:[(0,n.jsx)(r,{children:t("Subscription")}),(0,n.jsx)(r,{children:t("Kind")}),(0,n.jsx)(r,{children:t("Acked")}),(0,n.jsx)(r,{children:t("Cursor")}),(0,n.jsx)(r,{children:t("Pending overlays")})]})}),(0,n.jsx)(M,{children:w.map(i=>(0,n.jsxs)(S,{children:[(0,n.jsx)(s,{className:"font-mono text-xs",children:i.functionPath}),(0,n.jsx)(s,{children:i.kind}),(0,n.jsx)(s,{children:(0,n.jsx)(x,{variant:i.acked?"default":"secondary",children:i.acked?t("yes"):t("no")})}),(0,n.jsx)(s,{children:i.serverCursor??"\u2014"}),(0,n.jsx)(s,{children:i.pendingOptimisticLayers})]},i.id))})]}),e[33]=w,e[34]=t,e[35]=f):f=e[35];let C;return e[36]!==m||e[37]!==p||e[38]!==f||e[39]!==h?(C=(0,n.jsx)(A,{children:(0,n.jsxs)(L,{className:"flex flex-col gap-4",children:[h,m,p,f]})}),e[36]=m,e[37]=p,e[38]=f,e[39]=h,e[40]=C):C=e[40],C},"re");export{re as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as nt}from"./chunk-SFDOII3B.js";import{e as Ee}from"./chunk-SMIESS7P.js";import{b as ke}from"./chunk-XSD4Y6SQ.js";import{a as T,e as He}from"./chunk-UZERI5YC.js";import{c as Ue}from"./chunk-FXCBF4XT.js";import{b as Fe}from"./chunk-THIXMMZD.js";import{a as D}from"./chunk-GXZAXNZI.js";import{f as We}from"./chunk-35II7U25.js";import{a as Ye}from"./chunk-XQCVZAGU.js";import{d as $,f as Qe,g as Xe,m as Se,n as et,o as tt,p as at}from"./chunk-4CGALXS3.js";import{a as m,e as Ve,f as ct,g as dt,h as mt,j as Be}from"./chunk-3XIESWL4.js";var S=Ve(dt(),1);var L=Ve(ct(),1);var n=Ve(mt(),1);var ut=Qe(D.studioFeatures),it={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},pt=m(t=>{if(t===null||typeof t!="object")return it;let e=t,s=m(a=>typeof e[a]=="boolean"?e[a]:!0,"a");return{analytics:s("analytics"),auth:s("auth"),containers:s("containers"),flags:s("flags"),kv:s("kv"),mail:s("mail"),payments:s("payments"),queues:s("queues"),scheduler:s("scheduler"),storage:s("storage"),vectors:s("vectors"),workflows:s("workflows")}},"ut"),ft=m(()=>{let t=(0,S.c)(3),e=We(),[s,a]=(0,L.useState)(it),r,l;return t[0]!==e?(r=m(()=>{Se((async()=>{try{a(pt(await e.query(ut,{},Xe(""))))}catch{}})())},"s"),l=[e],t[0]=e,t[1]=r,t[2]=l):(r=t[1],l=t[2]),(0,L.useEffect)(r,l),s},"pt"),ht=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"ft"),gt=m(t=>{let e=(0,S.c)(24),{group:s}=t,a=$(),r=Ee(),l;e[0]!==s.tab||e[1]!==r?(l=m(()=>{Se(r({to:`/${s.tab}`}))},"o"),e[0]=s.tab,e[1]=r,e[2]=l):l=e[2];let o=l,i=s.bindings.length,c;e[3]!==s.label?(c=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),e[3]=s.label,e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,n.jsx)(ht,{}),e[5]=p):p=e[5];let d;e[6]!==c?(d=(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[c,p]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==a?(f=i===1?a("1 binding"):a("{count} bindings",{count:i}),e[8]=i,e[9]=a,e[10]=f):f=e[10];let u;e[11]!==f?(u=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let h;e[13]!==i||e[14]!==s.bindings?(h=i>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.bindings.map(yt)}),e[13]=i,e[14]=s.bindings,e[15]=h):h=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==h?(g=(0,n.jsxs)(He,{className:"flex flex-col gap-2 py-4",children:[d,u,h]}),e[16]=d,e[17]=u,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==s.testId||e[21]!==o||e[22]!==g?(x=(0,n.jsx)(T,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":s.testId,onClick:o,children:g}),e[20]=s.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},"ht"),st=["kv","files","vectors"],xt=m((t,e)=>[...t.filter(s=>s.tab!==e.tab),e].toSorted((s,a)=>st.indexOf(s.tab)-st.indexOf(a.tab)),"gt"),bt=m(()=>{let t=(0,S.c)(19),e=We(),s=ft(),a=$(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];let[l,o]=(0,L.useState)(r),i,c;if(t[1]!==e||t[2]!==s.kv||t[3]!==s.storage||t[4]!==s.vectors||t[5]!==a?(i=m(()=>{let g={cancelled:!1},x=[{enabled:s.kv,label:a("KV Namespaces"),load:m(async()=>(await e.listKvNamespaces()).map(vt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:s.storage,label:a("R2 Buckets"),load:m(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:s.vectors,label:a("Vectorize Indexes"),load:m(async()=>(await e.listVectorIndexes()).map(Nt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Se((async()=>{try{let y=await b.load();if(!g.cancelled){let k={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(A=>xt(A,k))}}catch{}})());return()=>{g.cancelled=!0}},"i"),c=[e,s.kv,s.storage,s.vectors,a],t[1]=e,t[2]=s.kv,t[3]=s.storage,t[4]=s.vectors,t[5]=a,t[6]=i,t[7]=c):(i=t[6],c=t[7]),(0,L.useEffect)(i,c),l.length===0)return null;let p;t[8]!==a?(p=a("Bindings"),t[8]=a,t[9]=p):p=t[9];let d;t[10]!==p?(d=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:p}),t[10]=p,t[11]=d):d=t[11];let f;t[12]!==l?(f=l.map(_t),t[12]=l,t[13]=f):f=t[13];let u;t[14]!==f?(u=(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let h;return t[16]!==d||t[17]!==u?(h=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=h):h=t[18],h},"xt");function yt(t){return(0,n.jsx)(Fe,{variant:"secondary",children:t},t)}m(yt,"bt");function vt(t){return t.binding}m(vt,"yt");function Nt(t){return t.name}m(Nt,"vt");function _t(t){return(0,n.jsx)(gt,{group:t},t.tab)}m(_t,"Nt");var St=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],kt=m(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"St"),wt=m(t=>{let e=St.map(s=>`- ${s.name} \u2014 ${s.summary}`).join(`
|
|
2
|
+
`);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
|
|
3
|
+
`)},"kt"),Mt=1500,It=m(()=>{let t=(0,S.c)(35),e=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=et(),t[0]=s):s=t[0];let a=s,[r,l]=(0,L.useState)(null),o,i;t[1]!==r?(o=m(()=>{if(r===null)return;let C=globalThis.setTimeout(()=>{l(null)},Mt);return()=>{globalThis.clearTimeout(C)}},"l"),i=[r],t[1]=r,t[2]=o,t[3]=i):(o=t[2],i=t[3]),(0,L.useEffect)(o,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=m((C,j)=>{tt(j)&&l(C)},"c"),t[4]=c):c=t[4];let p=c,d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=m(()=>{p("config",kt(a))},"d"),t[5]=d):d=t[5];let f=d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m(()=>{p("prompt",wt(a))},"m"),t[6]=u):u=t[6];let h=u,g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let k;t[15]!==x||t[16]!==y?(k=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=k):k=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let w;t[19]!==r||t[20]!==e?(w=e(r==="config"?"Copied":"Copy MCP config"),t[19]=r,t[20]=e,t[21]=w):w=t[21];let v;t[22]!==w?(v=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:w}),t[22]=w,t[23]=v):v=t[23];let M;t[24]!==r||t[25]!==e?(M=e(r==="prompt"?"Copied":"Copy agent prompt"),t[24]=r,t[25]=e,t[26]=M):M=t[26];let I;t[27]!==M?(I=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-prompt",onClick:h,size:"xs",variant:"outline",children:M}),t[27]=M,t[28]=I):I=t[28];let N;t[29]!==v||t[30]!==I?(N=(0,n.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[v,I]})]}),t[29]=v,t[30]=I,t[31]=N):N=t[31];let _;return t[32]!==k||t[33]!==N?(_=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[k,N]}),t[32]=k,t[33]=N,t[34]=_):_=t[34],_},"$t"),Lt=(0,L.lazy)(()=>import("./chunk-QLJJ5YYZ.js").then(t=>({default:t.Sparkline}))),Ze=m(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"Be"),At=m((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let a=Math.round(s/60);if(a<60)return`${String(a)}m ago`;let r=Math.round(a/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"Mt"),rt=m((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let a of t)s.set(a.bucketMs,(s.get(a.bucketMs)??0)+a[e]);return[...s.entries()].toSorted(([a],[r])=>a-r).map(([,a])=>a)},"He"),lt=m((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),a=t.slice(0,s).reduce((o,i)=>o+i,0),r=t.slice(s).reduce((o,i)=>o+i,0);if(a===0)return null;let l=(r-a)/a*100;return{positive:e?l>=0:l<=0,text:`${l>=0?"+":""}${l.toFixed(1)}%`}},"Je"),Ke=m(t=>{let e=(0,S.c)(24),{delta:s,footer:a,label:r,trend:l,unit:o,value:i}=t,c=$(),p;e[0]!==r?(p=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=p):p=e[1];let d;e[2]!==i?(d=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==o?(f=o!==void 0&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let h;e[9]!==l?(h=l!==void 0&&(0,n.jsx)(L.Suspense,{fallback:(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,n.jsx)(Lt,{data:l})}),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==u||e[12]!==h?(g=(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,h]}),e[11]=u,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==p||e[15]!==g?(x=(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]}),e[14]=p,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==a||e[19]!==c?(b=s==null?a!=null&&(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:a}):(0,n.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,n.jsx)("span",{className:Be("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,n.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=a,e[19]=c,e[20]=b):b=e[20];let y;return e[21]!==x||e[22]!==b?(y=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},"Oe"),Ct=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"At"),Je=m(t=>{let e=(0,S.c)(7),{command:s,label:a}=t,r;e[0]!==a?(r=(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:a})}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==s?(l=(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=l):l=e[3];let o;return e[4]!==r||e[5]!==l?(o=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,l]}),e[4]=r,e[5]=l,e[6]=o):o=e[6],o},"De"),ot=m(t=>{let e=(0,S.c)(18),{count:s,onView:a,testId:r,title:l}=t,o=$(),i;e[0]!==l?(i=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==o?(c=s===null?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o("No data yet")}):(0,n.jsx)(Fe,{variant:s>0?"destructive":"success",children:s>0?s:o("All clear")}),e[2]=s,e[3]=o,e[4]=c):c=e[4];let p;e[5]!==i||e[6]!==c?(p=(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=p):p=e[7];let d;e[8]!==o?(d=o("View"),e[8]=o,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)(Ct,{}),e[10]=f):f=e[10];let u;e[11]!==a||e[12]!==d?(u=(0,n.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:a,type:"button",children:[d,f]}),e[11]=a,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==p||e[15]!==u||e[16]!==r?(h=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[p,u]}),e[14]=p,e[15]=u,e[16]=r,e[17]=h):h=e[17],h},"Ge"),$t=m(t=>{let e=(0,S.c)(7),{functions:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=[...s].toSorted(Kt).slice(0,5),o;e[3]!==a?(o=a("Top functions"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,l.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No functions called yet.")}):(0,n.jsxs)("div",{className:"divide-y divide-border",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,n.jsx)("span",{children:a("Function")}),(0,n.jsx)("span",{className:"text-end",children:a("Calls")}),(0,n.jsx)("span",{className:"w-12 text-end",children:a("Avg")}),(0,n.jsx)("span",{className:"w-8 text-end",children:a("Err")})]}),l.map(Rt)]})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Ct"),jt=m(t=>{let e=(0,S.c)(26),{subs:s}=t,a=$(),r;e[0]!==a?(r=a("Live connections"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=l):l=e[3];let o=s?.totalConnections??0,i;e[4]!==o?(i=o.toLocaleString(),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let p;e[8]!==a?(p=a("sockets"),e[8]=a,e[9]=p):p=e[9];let d;e[10]!==p?(d=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p}),e[10]=p,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];let u=s?.totalSubscriptions??0,h;e[15]!==u?(h=u.toLocaleString(),e[15]=u,e[16]=h):h=e[16];let g;e[17]!==a?(g=a("active subscriptions"),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,n.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==l||e[24]!==f?(b=(0,n.jsx)(T,{"data-testid":"home-live-connections",children:(0,n.jsxs)(He,{className:"flex flex-col gap-2.5 py-4",children:[l,f,x]})}),e[22]=x,e[23]=l,e[24]=f,e[25]=b):b=e[25],b},"It"),Tt=m(t=>{let e=(0,S.c)(7),{entries:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=Date.now(),o;e[3]!==a?(o=a("Recent activity"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,s.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No recent activity.")}):(0,n.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,n.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:At(c.ts,l)})]},c.seq))})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"jt"),Ot=m(t=>{let e=t.reduce((s,a)=>s+a.calls,0);return e===0?null:t.reduce((s,a)=>s+a.totalDurationMs,0)/e},"Tt"),Gt=m(t=>{let e=(0,S.c)(151),{initialShardKey:s}=t,a=$(),r=Ee(),l=s??"",o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==l?(i={shardKey:l},e[1]=l,e[2]=i):i=e[2];let c=ke(D.getMetrics,o,i),p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={},e[3]=p):p=e[3];let d;e[4]!==l?(d={shardKey:l},e[4]=l,e[5]=d):d=e[5];let f=ke(D.getFunctionStats,p,d),u,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},h={shardKey:""},e[6]=u,e[7]=h):(u=e[6],h=e[7]);let g=ke(D.getSecurityAudit,u,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==l?(b={shardKey:l},e[9]=l,e[10]=b):b=e[10];let y=ke(D.listSubscriptions,x,b),k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k={},e[11]=k):k=e[11];let A;e[12]!==l?(A={shardKey:l},e[12]=l,e[13]=A):A=e[13];let w=ke(D.getAuditLog,k,A),v=c.data??null,M,I,N,_,C,j,P,O,K,V,W,E,R,q,B,F,U,H;if(e[14]!==w.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==r||e[19]!==f.data||e[20]!==y.data||e[21]!==a){_=Array.isArray(f.data?.functions)?f.data.functions:[],P=y.data??null;let Le;e[40]!==w.data?(Le=Array.isArray(w.data?.entries)?w.data.entries:[],e[40]=w.data,e[41]=Le):Le=e[41],I=Le,C=c.data===void 0||f.data===void 0?null:nt(v,_).length,j=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ae;e[42]!==r?(Ae=m(()=>{Se(r({to:"/security"}))},"Me"),e[42]=r,e[43]=Ae):Ae=e[43],H=Ae;let Ce;e[44]!==r?(Ce=m(()=>{Se(r({to:"/insights"}))},"Ae"),e[44]=r,e[45]=Ce):Ce=e[45],U=Ce;let $e=rt(v?.history,"calls"),je=rt(v?.history,"errors"),Ge=Ot(_),Te=Math.max(0,..._.map(qt)),z=v?.cache,Oe;e[46]!==z?(Oe=z!=null&&z.hits+z.misses>0?Math.round(z.hits/(z.hits+z.misses)*100):null,e[46]=z,e[47]=Oe):Oe=e[47],N=Oe,B="flex flex-col gap-6",F="lunora-home",W="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let qe=lt($e),ye;e[48]!==a?(ye=a("Requests"),e[48]=a,e[49]=ye):ye=e[49];let ze=v?.requests??0,ve;e[50]!==ze?(ve=ze.toLocaleString(),e[50]=ze,e[51]=ve):ve=e[51],e[52]!==$e||e[53]!==qe||e[54]!==ye||e[55]!==ve?(R=(0,n.jsx)(Ke,{delta:qe,label:ye,trend:$e,value:ve}),e[52]=$e,e[53]=qe,e[54]=ye,e[55]=ve,e[56]=R):R=e[56];let De=lt(je,!1),Ne;e[57]!==a?(Ne=a("Errors"),e[57]=a,e[58]=Ne):Ne=e[58];let Pe=v?.errors??0,_e;e[59]!==Pe?(_e=Pe.toLocaleString(),e[59]=Pe,e[60]=_e):_e=e[60],e[61]!==je||e[62]!==De||e[63]!==Ne||e[64]!==_e?(q=(0,n.jsx)(Ke,{delta:De,label:Ne,trend:je,value:_e}),e[61]=je,e[62]=De,e[63]=Ne,e[64]=_e,e[65]=q):q=e[65],M=Ke,e[66]!==Te||e[67]!==a?(O=Te>0?`${a("max")} ${Ze(Te)}`:void 0,e[66]=Te,e[67]=a,e[68]=O):O=e[68],e[69]!==a?(K=a("Avg latency"),e[69]=a,e[70]=K):K=e[70],V=Ge===null?"\u2014":Ze(Ge),e[14]=w.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=r,e[19]=f.data,e[20]=y.data,e[21]=a,e[22]=M,e[23]=I,e[24]=N,e[25]=_,e[26]=C,e[27]=j,e[28]=P,e[29]=O,e[30]=K,e[31]=V,e[32]=W,e[33]=E,e[34]=R,e[35]=q,e[36]=B,e[37]=F,e[38]=U,e[39]=H}else M=e[22],I=e[23],N=e[24],_=e[25],C=e[26],j=e[27],P=e[28],O=e[29],K=e[30],V=e[31],W=e[32],E=e[33],R=e[34],q=e[35],B=e[36],F=e[37],U=e[38],H=e[39];let J;e[71]!==M||e[72]!==O||e[73]!==K||e[74]!==V?(J=(0,n.jsx)(M,{footer:O,label:K,value:V}),e[71]=M,e[72]=O,e[73]=K,e[74]=V,e[75]=J):J=e[75];let Z;e[76]!==N||e[77]!==a?(Z=N===null?void 0:`${String(N)}% ${a("cache hit")}`,e[76]=N,e[77]=a,e[78]=Z):Z=e[78];let G;e[79]!==a?(G=a("Database size"),e[79]=a,e[80]=G):G=e[80];let Re=v?.databaseSize??null,Y;e[81]!==Re?(Y=at(Re),e[81]=Re,e[82]=Y):Y=e[82];let Q;e[83]!==Z||e[84]!==G||e[85]!==Y?(Q=(0,n.jsx)(Ke,{footer:Z,label:G,value:Y}),e[83]=Z,e[84]=G,e[85]=Y,e[86]=Q):Q=e[86];let X;e[87]!==W||e[88]!==E||e[89]!==R||e[90]!==q||e[91]!==J||e[92]!==Q?(X=(0,n.jsxs)("div",{className:W,"data-testid":E,children:[R,q,J,Q]}),e[87]=W,e[88]=E,e[89]=R,e[90]=q,e[91]=J,e[92]=Q,e[93]=X):X=e[93];let we;e[94]===Symbol.for("react.memo_cache_sentinel")?(we=(0,n.jsx)(bt,{}),e[94]=we):we=e[94];let ee;e[95]!==_?(ee=(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)($t,{functions:_})}),e[95]=_,e[96]=ee):ee=e[96];let te;e[97]!==P?(te=(0,n.jsx)(jt,{subs:P}),e[97]=P,e[98]=te):te=e[98];let ae;e[99]!==I?(ae=(0,n.jsx)(Tt,{entries:I}),e[99]=I,e[100]=ae):ae=e[100];let ne;e[101]!==te||e[102]!==ae?(ne=(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[te,ae]}),e[101]=te,e[102]=ae,e[103]=ne):ne=e[103];let se;e[104]!==ee||e[105]!==ne?(se=(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[ee,ne]}),e[104]=ee,e[105]=ne,e[106]=se):se=e[106];let re;e[107]!==a?(re=a("Advisors"),e[107]=a,e[108]=re):re=e[108];let le;e[109]!==re?(le=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:re}),e[109]=re,e[110]=le):le=e[110];let oe;e[111]!==C||e[112]!==j||e[113]!==a||e[114]!==U||e[115]!==H?(oe=j===0&&C===0?(0,n.jsx)(Ye,{description:a("No security or performance issues detected."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,n.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:a("No issues found")}):(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(ot,{count:j,onView:H,testId:"home-security",title:a("Security findings")}),(0,n.jsx)(ot,{count:C,onView:U,testId:"home-performance",title:a("Performance issues")})]}),e[111]=C,e[112]=j,e[113]=a,e[114]=U,e[115]=H,e[116]=oe):oe=e[116];let ie;e[117]!==le||e[118]!==oe?(ie=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[le,oe]}),e[117]=le,e[118]=oe,e[119]=ie):ie=e[119];let ce;e[120]!==a?(ce=a("Get connected"),e[120]=a,e[121]=ce):ce=e[121];let de;e[122]!==ce?(de=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ce}),e[122]=ce,e[123]=de):de=e[123];let me;e[124]!==a?(me=a("Client SDK"),e[124]=a,e[125]=me):me=e[125];let ue;e[126]!==me?(ue=(0,n.jsx)(Je,{command:"npm i @lunora/client",label:me}),e[126]=me,e[127]=ue):ue=e[127];let pe;e[128]!==a?(pe=a("React"),e[128]=a,e[129]=pe):pe=e[129];let fe;e[130]!==pe?(fe=(0,n.jsx)(Je,{command:"npm i @lunora/react",label:pe}),e[130]=pe,e[131]=fe):fe=e[131];let he;e[132]!==a?(he=a("CLI"),e[132]=a,e[133]=he):he=e[133];let ge;e[134]!==he?(ge=(0,n.jsx)(Je,{command:"lunora dev",label:he}),e[134]=he,e[135]=ge):ge=e[135];let xe;e[136]!==ue||e[137]!==fe||e[138]!==ge?(xe=(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[ue,fe,ge]}),e[136]=ue,e[137]=fe,e[138]=ge,e[139]=xe):xe=e[139];let Me;e[140]===Symbol.for("react.memo_cache_sentinel")?(Me=(0,n.jsx)(It,{}),e[140]=Me):Me=e[140];let be;e[141]!==de||e[142]!==xe?(be=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[de,xe,Me]}),e[141]=de,e[142]=xe,e[143]=be):be=e[143];let Ie;return e[144]!==B||e[145]!==F||e[146]!==X||e[147]!==se||e[148]!==ie||e[149]!==be?(Ie=(0,n.jsxs)("div",{className:B,"data-testid":F,children:[X,we,se,ie,be]}),e[144]=B,e[145]=F,e[146]=X,e[147]=se,e[148]=ie,e[149]=be,e[150]=Ie):Ie=e[150],Ie},"Zt");function Kt(t,e){return e.calls-t.calls}m(Kt,"Ot");function Rt(t){return(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,n.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,n.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,n.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Ze(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,n.jsx)("span",{className:Be("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}m(Rt,"Kt");function qt(t){return t.maxDurationMs}m(qt,"Rt");export{ft as a,Gt as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as C}from"./chunk-54MMVNPT.js";import{a as _}from"./chunk-XSD4Y6SQ.js";import{a as $,b as z,c as B,d as g,e as n,f as i}from"./chunk-MIQTKZAR.js";import{a as S,e as I}from"./chunk-UZERI5YC.js";import{c as w}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{f as b}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as j}from"./chunk-XQCVZAGU.js";import{d as k,m as R,q as T}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as h,e as y,g as P,h as Q}from"./chunk-3XIESWL4.js";var L=y(P(),1);var s=y(Q(),1);var E=200,U=h(()=>{let e=(0,L.c)(21),l=b(),t=k(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",E],e[0]=u):u=e[0];let p;e[1]!==l?(p=h(()=>l.listAuthSessions({limit:E}),"u"),e[1]=l,e[2]=p):p=e[2];let o=_(u,p),{error:f}=o,a=o.data?.rows??null,x;e[3]!==o?(x=h(()=>{o.refetch()},"f"),e[3]=o,e[4]=x):x=e[4],C(x,!0);let N;e[5]!==l||e[6]!==o?(N=h(r=>{R((async()=>{await l.revokeAuthSession({sessionId:r}),o.refetch()})())},"x"),e[5]=l,e[6]=o,e[7]=N):N=e[7];let A=N,d;e[8]!==f?(d=f!==null&&(0,s.jsx)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:f}),e[8]=f,e[9]=d):d=e[9];let c;e[10]!==a||e[11]!==t?(c=a!==null&&a.length===0&&(0,s.jsx)(j,{testId:"auth-sessions-empty",title:t("No active sessions.")}),e[10]=a,e[11]=t,e[12]=c):c=e[12];let m;e[13]!==A||e[14]!==a||e[15]!==t?(m=a!==null&&a.length>0&&(0,s.jsx)(S,{className:"overflow-hidden py-0",children:(0,s.jsx)(I,{className:"px-0",children:(0,s.jsxs)($,{"data-testid":"auth-sessions-table",children:[(0,s.jsx)(z,{children:(0,s.jsxs)(g,{children:[(0,s.jsx)(n,{children:t("user")}),(0,s.jsx)(n,{children:t("expires")}),(0,s.jsx)(n,{children:t("ip")}),(0,s.jsx)(n,{children:t("user agent")}),(0,s.jsx)(n,{children:t("impersonated by")}),(0,s.jsx)(n,{"aria-label":t("Actions")})]})}),(0,s.jsx)(B,{children:a.map(r=>(0,s.jsxs)(g,{"data-testid":`auth-session-${r.id}`,children:[(0,s.jsx)(i,{className:"font-mono text-xs",children:r.userId}),(0,s.jsx)(i,{className:"text-muted-foreground tabular-nums",children:T(r.expiresAt)}),(0,s.jsx)(i,{children:r.ipAddress??""}),(0,s.jsx)(i,{className:"max-w-40 truncate",children:r.userAgent??""}),(0,s.jsx)(i,{className:"font-mono text-xs",children:r.impersonatedBy??""}),(0,s.jsx)(i,{children:(0,s.jsx)(w,{"data-testid":`auth-session-revoke-${r.id}`,onClick:h(()=>{A(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Revoke")})})]},r.id))})]})})}),e[13]=A,e[14]=a,e[15]=t,e[16]=m):m=e[16];let v;return e[17]!==d||e[18]!==c||e[19]!==m?(v=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[d,c,m]}),e[17]=d,e[18]=c,e[19]=m,e[20]=v):v=e[20],v},"Q");export{U as AuthSessionsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as K,c as W,i as V}from"./chunk-2OUPA2WJ.js";import{a as O,b as B,c as U,j as S}from"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-XBDKZZ67.js";import{a as s,e as g,f as v,h as Y,j as _}from"./chunk-3XIESWL4.js";var $=g(v(),1);var b=g(v(),1);var h=g(v(),1);var Z=h.createContext(void 0);function H(n=!1){let t=h.useContext(Z);if(t===void 0&&!n)throw new Error(U(16));return t}s(H,"useCompositeRootContext");var A=g(v(),1);function F(n){let{focusableWhenDisabled:t,disabled:r,composite:u=!1,tabIndex:o=0,isNativeButton:i}=n,p=u&&t!==!1,f=u&&t===!1;return{props:A.useMemo(()=>{let a={onKeyDown(d){r&&t&&d.key!=="Tab"&&d.preventDefault()}};return u||(a.tabIndex=o,!i&&r&&(a.tabIndex=t?o:-1)),(i&&(t||p)||!i&&r)&&(a["aria-disabled"]=r),i&&(!t||f)&&(a.disabled=r),a},[u,r,t,p,f,i,o])}}s(F,"useFocusableWhenDisabled");function L(n={}){let{disabled:t=!1,focusableWhenDisabled:r,tabIndex:u=0,native:o=!0,composite:i}=n,p=b.useRef(null),f=H(!0),c=i??f!==void 0,{props:a}=F({focusableWhenDisabled:r,disabled:t,composite:c,tabIndex:u,isNativeButton:o}),d=b.useCallback(()=>{let l=p.current;C(l)&&c&&t&&a.disabled===void 0&&l.disabled&&(l.disabled=!1)},[t,a.disabled,c]);K(d,[d]);let k=b.useCallback((l={})=>{let{onClick:m,onMouseDown:R,onKeyUp:q,onKeyDown:G,onPointerDown:J,...Q}=l;return O({onClick(e){if(t){e.preventDefault();return}m?.(e)},onMouseDown(e){t||R?.(e)},onKeyDown(e){if(t||(B(e),G?.(e),e.baseUIHandlerPrevented))return;let N=e.target===e.currentTarget,x=e.currentTarget,E=C(x),z=!o&&ee(x),P=N&&(o?E:!z),T=e.key==="Enter",I=e.key===" ",y=x.getAttribute("role"),X=y?.startsWith("menuitem")||y==="option"||y==="gridcell";if(N&&c&&I){if(e.defaultPrevented&&X)return;e.preventDefault(),z||o&&E?(x.click(),e.preventBaseUIHandler()):P&&(m?.(e),e.preventBaseUIHandler());return}P&&(!o&&(I||T)&&e.preventDefault(),!o&&T&&m?.(e))},onKeyUp(e){if(!t){if(B(e),q?.(e),e.target===e.currentTarget&&o&&c&&C(e.currentTarget)&&e.key===" "){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!o&&!c&&e.key===" "&&m?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}J?.(e)}},o?{type:"button"}:{role:"button"},a,Q)},[t,a,c,o]),w=W(l=>{p.current=l,d()});return{getButtonProps:k,buttonRef:w}}s(L,"useButton");function C(n){return V(n)&&n.tagName==="BUTTON"}s(C,"isButtonElement");function ee(n){return!!(n?.tagName==="A"&&n?.href)}s(ee,"isValidLinkElement");var D=$.forwardRef(s(function(t,r){let{render:u,className:o,disabled:i=!1,focusableWhenDisabled:p=!1,nativeButton:f=!0,style:c,...a}=t,{getButtonProps:d,buttonRef:k}=L({disabled:i,focusableWhenDisabled:p,native:f});return S("button",t,{state:{disabled:i},ref:[r,k],props:[a,d]})},"Button"));var j=g(Y(),1);var te=M("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ce({className:n,variant:t="default",size:r="default",...u}){return(0,j.jsx)(D,{"data-slot":"button",className:_(te({variant:t,size:r,className:n})),...u})}s(Ce,"g");export{H as a,L as b,Ce as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d,e as n,g as c,h as p}from"./chunk-3XIESWL4.js";var b=n(c(),1),s=n(p(),1);var y={alignItems:"center",border:"1px solid",borderRadius:4,display:"inline-flex",fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:400,gap:6,letterSpacing:"0.06em",lineHeight:1.4,padding:"1px 8px",textTransform:"uppercase"},g={borderRadius:"50%",display:"inline-block",height:7,width:7},h=d((r,e,t,a)=>({badgeStyle:{...y,borderColor:r,color:r},color:r,dotStyle:{...g,backgroundColor:r},hint:a,label:e,title:t}),"i"),S={global:h("var(--royal-amethyst)","Global \xB7 D1","Global table \u2014 a single D1 table shared across all shards","Declared .global() and stored once in Cloudflare D1, shared across every shard and tenant. Auth tables (user, session, \u2026) live here too."),shard:h("var(--sky-sapphire)","Shard-local","Shard-local table \u2014 per-shard SQLite inside a Durable Object","Stored per shard key in a Durable Object's SQLite (.shardBy(...)). You are viewing one shard at a time \u2014 change the shard key to inspect another.")},m=d(r=>{let e=(0,b.c)(9),{tier:t}=r,a=S[t],i=`storage-tier-${t}`,l;e[0]!==a.dotStyle?(l=(0,s.jsx)("span",{"aria-hidden":"true",style:a.dotStyle}),e[0]=a.dotStyle,e[1]=l):l=e[1];let o;return e[2]!==a.badgeStyle||e[3]!==a.label||e[4]!==a.title||e[5]!==i||e[6]!==l||e[7]!==t?(o=(0,s.jsxs)("span",{"data-testid":i,"data-tier":t,style:a.badgeStyle,title:a.title,children:[l,a.label]}),e[2]=a.badgeStyle,e[3]=a.label,e[4]=a.title,e[5]=i,e[6]=l,e[7]=t,e[8]=o):o=e[8],o},"S");export{S as a,m as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as o,c as i}from"./chunk-7T7UOTYK.js";import{a as t}from"./chunk-3XIESWL4.js";var a="lunora-studio-recent-shards",l=10,n=t(()=>o(a,"session").filter(s=>typeof s=="string"),"t"),u=t(s=>{let r=s.trim();if(r==="")return n();let e=[r,...n().filter(c=>c!==r)].slice(0,l);return i(a,e,"session"),e},"d");export{n as a,u as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as p}from"./chunk-XSD4Y6SQ.js";import{a as C,b as K,c as j,d as m,e as n,f as o}from"./chunk-MIQTKZAR.js";import{a as A,e as k}from"./chunk-UZERI5YC.js";import{c as w}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as f}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as T}from"./chunk-XQCVZAGU.js";import{d as z,q as B}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as i,e as U,f as W,h as X}from"./chunk-3XIESWL4.js";var D=U(W(),1);var e=U(X(),1);var F="agent_threads",Y="agent_messages",Z=100,ee=250,te={},ae={filters:[],limit:Z,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:F},l=i((s,t)=>{let a=s[t];return typeof a=="string"?a:void 0},"d"),I=i((s,t)=>{let a=s[t];return typeof a=="number"?a:void 0},"b"),M=i(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:a}=t;return typeof a=="number"?a:void 0},"z"),re=i(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(a=>a!==null&&typeof a=="object"?a.name:void 0).filter(a=>typeof a=="string"):[]},"ee"),se=i(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"te"),ne=i(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"ae"),fe=i(({initialShardKey:s=""})=>{let t=z(),[a,$]=(0,D.useState)(void 0),{data:x}=p(f.listTables,te,{live:!0,shardKey:s}),L=x!==void 0,u=Array.isArray(x)&&x.some(r=>r.name===F),{data:_,error:O,errorSource:R,liveError:G}=p(f.readTablePage,ae,{enabled:u,live:!0,shardKey:s}),H={filters:[{column:"threadKey",operator:"eq",value:a??""}],limit:ee,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:Y},{data:q,error:J,errorSource:Q}=p(f.readTablePage,H,{enabled:u&&a!==void 0,live:!0,shardKey:s}),v=Array.isArray(_?.rows)?_.rows:[],E=Array.isArray(q?.rows)?q.rows:[],P=v.find(r=>l(r,"key")===a),h;return L&&!u?h=(0,e.jsx)(T,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):u&&v.length===0?h=(0,e.jsx)(T,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):h=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(A,{className:"overflow-hidden py-0",children:(0,e.jsx)(k,{className:"px-0",children:(0,e.jsxs)(C,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(m,{children:[(0,e.jsx)(n,{children:t("Agent")}),(0,e.jsx)(n,{children:t("Key")}),(0,e.jsx)(n,{children:t("Status")}),(0,e.jsx)(n,{children:t("Messages")}),(0,e.jsx)(n,{children:t("Tokens")}),(0,e.jsx)(n,{children:t("Updated")}),(0,e.jsx)(n,{"aria-label":t("Actions")})]})}),(0,e.jsx)(j,{children:v.map(r=>{let d=l(r,"key")??"",c=l(r,"status"),g=M(r);return(0,e.jsxs)(m,{"data-active":d===a?"":void 0,"data-testid":`agents-thread-${d}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:l(r,"agent")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:d}),(0,e.jsx)(o,{children:(0,e.jsx)(b,{"data-testid":`agents-thread-status-${d}`,variant:se(c),children:c??"\u2014"})}),(0,e.jsx)(o,{className:"tabular-nums",children:I(r,"messageCount")??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums text-muted-foreground",children:g??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:B(I(r,"updatedAt"),"\u2014")}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsx)(w,{"data-testid":`agents-thread-open-${d}`,onClick:i(()=>{$(d)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},d)})})]})})}),J!==null&&(0,e.jsx)(S,{error:Q,testId:"agents-messages-error"}),a!==void 0&&(0,e.jsx)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(k,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",a,P!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",M(P)??0," ",t("Tokens")]})]}),(0,e.jsx)(w,{"data-testid":"agents-thread-detail-close",onClick:i(()=>{$(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),E.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(C,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(m,{children:[(0,e.jsx)(n,{children:t("Role")}),(0,e.jsx)(n,{children:t("Content")}),(0,e.jsx)(n,{children:t("Tool")}),(0,e.jsx)(n,{children:t("Approval")})]})}),(0,e.jsx)(j,{children:E.map((r,d)=>{let c=l(r,"role")??"\u2014",g=re(r),V=l(r,"toolName"),y=l(r,"status"),N=I(r,"seq")??d;return(0,e.jsxs)(m,{"data-testid":`agents-message-${String(N)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:c}),(0,e.jsx)(o,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(r,"content")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:V??(g.length>0?g.join(", "):"\u2014")}),(0,e.jsx)(o,{className:"align-top",children:y===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(b,{"data-testid":`agents-message-approval-${String(N)}`,variant:ne(y),children:y})})]},l(r,"messageKey")??`${c}:${String(N)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[O!==null&&(0,e.jsx)(S,{error:R,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),G!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),h]})},"pe");export{fe as AgentsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _={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{_ as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v}from"./chunk-UNUU7CJJ.js";import{a as w,b as y,c as $,d,e as c,f as i}from"./chunk-MIQTKZAR.js";import{a as b,e as N}from"./chunk-UZERI5YC.js";import{d as x}from"./chunk-4CGALXS3.js";import{a as s,e as g,f as T,h as O,j as h}from"./chunk-3XIESWL4.js";var m=g(T(),1);var e=g(O(),1);var S={ERROR:"error",INFO:"info",WARN:"warning"},M=s(r=>{let n=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:n,issueType:r.title,key:r.cacheKey,level:S[r.level]}},"q"),j=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},C=s((r,n)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[n],"S"),W=s((r,n,o)=>({error:r("{count} errors",{count:o}),info:r("{count} suggestions",{count:o}),warning:r("{count} warnings",{count:o})})[n],"j"),q=s((r,n)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[n],"C"),G=s(({error:r=null,errorSource:n,rows:o,testId:l,toolbar:f})=>{let a=x(),[u,k]=(0,m.useState)("error"),I=(0,m.useMemo)(()=>{let t={error:0,info:0,warning:0};for(let R of o??[])t[R.level]+=1;return t},[o]),p=(o??[]).filter(t=>t.level===u),E=s(t=>{k(t.currentTarget.dataset.level)},"h");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsx)("div",{className:"flex border-b border-border",role:"tablist",children:j.map(t=>(0,e.jsxs)("button",{"aria-selected":u===t,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":t,"data-testid":`${l}-tab-${t}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:h("size-2 rounded-sm",A[t])}),C(a,t)]}),(0,e.jsx)("span",{className:"ps-4 text-xs text-muted-foreground",children:W(a,t,I[t])})]},t))}),f!==void 0&&(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:f}),r!==null&&(0,e.jsx)(v,{error:n??r,testId:`${l}-error`}),(0,e.jsx)(b,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(w,{children:[(0,e.jsx)(y,{children:(0,e.jsxs)(d,{children:[(0,e.jsx)(c,{children:a("Issue type")}),(0,e.jsx)(c,{children:a("Entity/item")}),(0,e.jsx)(c,{children:a("Description")})]})}),(0,e.jsx)($,{children:p.length===0?(0,e.jsx)(d,{children:(0,e.jsxs)(i,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsx)("span",{className:"block text-sm font-medium text-foreground",children:q(a,u)}),(0,e.jsx)("span",{className:"block text-sm",children:a("Nothing to report for this deployment.")})]})}):p.map(t=>(0,e.jsxs)(d,{children:[(0,e.jsx)(i,{className:"font-medium text-foreground",children:t.issueType}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"}),(0,e.jsxs)(i,{className:"text-muted-foreground",children:[(0,e.jsx)("span",{children:t.description}),t.action!==void 0&&(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action})]})]},t.key))})]})})})]})},"B");export{M as a,G as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as U}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as O}from"./chunk-XSD4Y6SQ.js";import{a as B,b as G,c as H,d as P,e as x,f as w}from"./chunk-MIQTKZAR.js";import{a as z,e as D}from"./chunk-UZERI5YC.js";import{R as k}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as q}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as F}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as R}from"./chunk-GXZAXNZI.js";import"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as K}from"./chunk-XQCVZAGU.js";import{d as T,q as M}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as L,e as j,f as V,g as X,h as Y}from"./chunk-3XIESWL4.js";var J=j(X(),1),W=j(V(),1);var t=j(Y(),1);var de=L(()=>{let e=(0,J.c)(39),r=T(),[s,$]=(0,W.useState)(""),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let{data:b,error:i,errorSource:S,isLoading:_,refetch:E}=O(R.getAuthAuditLog,N),A;if(e[1]!==b?.entries||e[2]!==s){let a=b?.entries??[],v=s.trim().toLowerCase();A=v===""?a:a.filter(y=>y.event.toLowerCase().includes(v)||(y.actorId??"").toLowerCase().includes(v)||(y.actorEmail??"").toLowerCase().includes(v)||(y.ip??"").toLowerCase().includes(v)||y.outcome.toLowerCase().includes(v)),e[1]=b?.entries,e[2]=s,e[3]=A}else A=e[3];let o=A,C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C=L(a=>{$(a.target.value)},"I"),e[4]=C):C=e[4];let Q=C,l;e[5]!==r?(l=r("Filter security events"),e[5]=r,e[6]=l):l=e[6];let n;e[7]!==r?(n=r("filter event, actor, IP"),e[7]=r,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==l||e[11]!==n?(c=(0,t.jsx)(k,{"aria-label":l,className:"h-8 w-56","data-testid":"aa-search",onChange:Q,placeholder:n,value:s}),e[9]=s,e[10]=l,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==E?(d=L(()=>{E()},"m"),e[13]=E,e[14]=d):d=e[14];let m;e[15]!==r?(m=r("Refresh"),e[15]=r,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(q,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==i||e[24]!==S?(f=i!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=i,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==i||e[27]!==o.length||e[28]!==_||e[29]!==r?(p=i===null&&!_&&o.length===0&&(0,t.jsx)(K,{description:r("Authentication and security events are recorded here."),testId:"aa-empty",title:r("No security events.")}),e[26]=i,e[27]=o.length,e[28]=_,e[29]=r,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==r?(g=o.length>0&&(0,t.jsx)(z,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(B,{"data-testid":"aa-table",children:[(0,t.jsx)(G,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(x,{children:r("time")}),(0,t.jsx)(x,{children:r("event")}),(0,t.jsx)(x,{children:r("actor")}),(0,t.jsx)(x,{children:r("ip / user agent")}),(0,t.jsx)(x,{children:r("outcome")})]})}),(0,t.jsx)(H,{children:o.map(a=>(0,t.jsxs)(P,{"data-testid":"aa-row",children:[(0,t.jsx)(w,{className:"text-muted-foreground tabular-nums",children:M(a.ts,"\u2014")}),(0,t.jsx)(w,{children:(0,t.jsx)(F,{variant:"secondary",children:a.event})}),(0,t.jsx)(w,{className:"max-w-[24ch] truncate font-mono text-xs",title:a.actorId??void 0,children:a.actorEmail??a.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(w,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:a.userAgent??void 0,children:[a.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),a.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",a.userAgent]})]}),(0,t.jsx)(w,{children:(0,t.jsx)(F,{variant:a.outcome==="failure"?"destructive":"outline",children:r(a.outcome)})})]},a.seq))})]})})}),e[31]=o,e[32]=r,e[33]=g):g=e[33];let I;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(I=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=I):I=e[38],I},"ce");export{de as AuthAuditPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,e as l,g as i,h as p,j as n}from"./chunk-3XIESWL4.js";var c=l(i(),1);var d=l(p(),1);function f(r){let t=(0,c.c)(8),e,s;t[0]!==r?({className:e,...s}=r,t[0]=r,t[1]=e,t[2]=s):(e=t[1],s=t[2]);let o;t[3]!==e?(o=n("animate-pulse rounded-md bg-muted",e),t[3]=e,t[4]=o):o=t[4];let m;return t[5]!==s||t[6]!==o?(m=(0,d.jsx)("div",{"data-slot":"skeleton",className:o,...s}),t[5]=s,t[6]=o,t[7]=m):m=t[7],m}a(f,"p");export{f as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./chunk-6ST5ECQA.js";import{a as r,e as i,f as p}from"./chunk-3XIESWL4.js";var a=i(p(),1);var R=a.forwardRef(r(function(e,n){let{className:l,render:m,orientation:t="horizontal",style:f,...s}=e;return o("div",e,{state:{orientation:t},ref:n,props:[{role:"separator","aria-orientation":t},s]})},"SeparatorComponent"));export{R as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ae}from"./chunk-UZERI5YC.js";import{a as le}from"./chunk-HPFLBYRI.js";import{b as re}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{d as de,f as oe}from"./chunk-35II7U25.js";import"./chunk-XBDKZZ67.js";import{a as me}from"./chunk-XQCVZAGU.js";import{d as ce,q as pe}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as k,e as ie,g as xe,h as ge,j as Z}from"./chunk-3XIESWL4.js";var ne=ie(xe(),1);var a=ie(ge(),1);var ye="/_lunora/health",Ne="/_lunora/health/ready",ve=k((n,e)=>(n.endsWith("/")?n.slice(0,-1):n)+e,"xe"),be=k(()=>{let n=oe();return async e=>{let w=e==="ready"?Ne:ye,t=n.getAuthToken(),_=ve(n.url,w);try{let l=await fetch(_,{headers:t===null?{}:{authorization:`Bearer ${t}`}}),d=null;try{d=await l.json()}catch{d=null}return{body:d,ok:l.ok,status:l.status}}catch(l){return{body:null,error:l instanceof Error?l.message:String(l),ok:!1,status:0}}}},"Ne"),he={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ke={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},we=k(n=>n==="unhealthy"?"crit":n==="degraded"?"warn":"ok","ye"),ue=k(n=>{let e=(0,ne.c)(13),{label:w,level:t,testId:_,value:l}=n,d=he[t],o;e[0]!==d?(o=Z("size-1.5 shrink-0 rounded-full",d),e[0]=d,e[1]=o):o=e[1];let c;e[2]!==o?(c=(0,a.jsx)("span",{"aria-hidden":"true",className:o}),e[2]=o,e[3]=c):c=e[3];let x;e[4]!==w||e[5]!==c?(x=(0,a.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[c,w]}),e[4]=w,e[5]=c,e[6]=x):x=e[6];let g;e[7]!==_||e[8]!==l?(g=(0,a.jsx)("span",{className:"text-lg font-semibold text-foreground","data-testid":_,children:l}),e[7]=_,e[8]=l,e[9]=g):g=e[9];let u;return e[10]!==x||e[11]!==g?(u=(0,a.jsx)(ae,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[x,g]})}),e[10]=x,e[11]=g,e[12]=u):u=e[12],u},"ne"),De=k(n=>{let e=(0,ne.c)(115),{probe:w}=n,t=ce(),_=be(),l=w??_,d;e[0]!==l?(d=k(async()=>{let[s,i]=await Promise.all([l("live"),l("ready")]);return{live:s,ready:i}},"d"),e[0]=l,e[1]=d):d=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=["deployment-health"],e[2]=o):o=e[2];let c;e[3]!==d?(c={queryFn:d,queryKey:o},e[3]=d,e[4]=c):c=e[4];let{data:x,isPending:g}=de(c),u=x?.live??null,fe=x?.ready??null;if(g){let s;return e[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[(0,a.jsx)(le,{className:"h-16 w-full"}),(0,a.jsx)(le,{className:"h-40 w-full"})]}),e[5]=s):s=e[5],s}let r=u?.body??null;if(r===null){let s=u?.status===403,i;e[6]!==s||e[7]!==u?.error||e[8]!==t?(i=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:u?.error??t("no response")}),e[6]=s,e[7]=u?.error,e[8]=t,e[9]=i):i=e[9];let h;e[10]!==t?(h=t("Health endpoint unavailable"),e[10]=t,e[11]=h):h=e[11];let p;return e[12]!==i||e[13]!==h?(p=(0,a.jsx)(me,{description:i,testId:"deployment-health-error",title:h}),e[12]=i,e[13]=h,e[14]=p):p=e[14],p}let ee;e[15]!==r.status?(ee=we(r.status),e[15]=r.status,e[16]=ee):ee=e[16];let j=ee,m;if(r.status==="unhealthy"){let s;e[17]!==t?(s=t("Unhealthy"),e[17]=t,e[18]=s):s=e[18],m=s}else if(r.status==="degraded"){let s;e[19]!==t?(s=t("Degraded"),e[19]=t,e[20]=s):s=e[20],m=s}else{let s;e[21]!==t?(s=t("Healthy"),e[21]=t,e[22]=s):s=e[22],m=s}let C=fe?.ok??!1,Y=C?"ok":"crit",z,I,y,N,v,S,V,b,$,H;if(e[23]!==r.appName||e[24]!==r.appVersion||e[25]!==r.checks||e[26]!==r.timestamp||e[27]!==j||e[28]!==Y||e[29]!==C||e[30]!==m||e[31]!==t){let s=[...r.checks].toSorted(_e);H="flex flex-col gap-6",I="deployment-health";let i;e[42]!==t?(i=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint \u2014 wire an uptime monitor or a Cloudflare Health Check at it."),e[42]=t,e[43]=i):i=e[43],e[44]!==i?(y=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:i}),e[44]=i,e[45]=y):y=e[45];let h=ke[j],p;e[46]!==h?(p=Z("flex size-10 shrink-0 items-center justify-center rounded-full",h),e[46]=h,e[47]=p):p=e[47];let se=he[j],D;e[48]!==se?(D=Z("size-3 rounded-full",se),e[48]=se,e[49]=D):D=e[49];let L;e[50]!==D?(L=(0,a.jsx)("span",{className:D}),e[50]=D,e[51]=L):L=e[51];let T;e[52]!==p||e[53]!==L?(T=(0,a.jsx)("span",{"aria-hidden":"true",className:p,children:L}),e[52]=p,e[53]=L,e[54]=T):T=e[54];let q;e[55]!==m?(q=(0,a.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:m}),e[55]=m,e[56]=q):q=e[56];let E;e[57]!==r.appName||e[58]!==r.appVersion?(E=(0,a.jsxs)("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[r.appName," \xB7 ",r.appVersion]}),e[57]=r.appName,e[58]=r.appVersion,e[59]=E):E=e[59];let R;e[60]!==q||e[61]!==E?(R=(0,a.jsxs)("div",{className:"grid leading-tight",children:[q,E]}),e[60]=q,e[61]=E,e[62]=R):R=e[62];let U;e[63]!==T||e[64]!==R?(U=(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[T,R]}),e[63]=T,e[64]=R,e[65]=U):U=e[65];let A;e[66]!==t?(A=t("Checked"),e[66]=t,e[67]=A):A=e[67];let B;e[68]!==A?(B=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:A}),e[68]=A,e[69]=B):B=e[69];let F;e[70]!==r.timestamp?(F=pe(r.timestamp),e[70]=r.timestamp,e[71]=F):F=e[71];let K;e[72]!==F?(K=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:F}),e[72]=F,e[73]=K):K=e[73];let Q;e[74]!==B||e[75]!==K?(Q=(0,a.jsxs)("div",{className:"text-end",children:[B,K]}),e[74]=B,e[75]=K,e[76]=Q):Q=e[76],e[77]!==U||e[78]!==Q?(N=(0,a.jsx)(ae,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[U,Q]})}),e[77]=U,e[78]=Q,e[79]=N):N=e[79];let W;e[80]!==t?(W=t("Liveness"),e[80]=t,e[81]=W):W=e[81];let G;e[82]!==j||e[83]!==m||e[84]!==W?(G=(0,a.jsx)(ue,{label:W,level:j,testId:"dh-liveness",value:m}),e[82]=j,e[83]=m,e[84]=W,e[85]=G):G=e[85];let J;e[86]!==t?(J=t("Readiness"),e[86]=t,e[87]=J):J=e[87];let M;e[88]!==C||e[89]!==t?(M=t(C?"Ready":"Not ready"),e[88]=C,e[89]=t,e[90]=M):M=e[90];let O;e[91]!==Y||e[92]!==J||e[93]!==M?(O=(0,a.jsx)(ue,{label:J,level:Y,testId:"dh-readiness",value:M}),e[91]=Y,e[92]=J,e[93]=M,e[94]=O):O=e[94],e[95]!==G||e[96]!==O?(v=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[G,O]}),e[95]=G,e[96]=O,e[97]=v):v=e[97],z=ae,S="gap-0 py-0",V="dh-checks";let X;e[98]!==t?(X=t("Subsystem checks"),e[98]=t,e[99]=X):X=e[99],e[100]!==X?(b=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:X})}),e[100]=X,e[101]=b):b=e[101],$=s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.map(f=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${f.name}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:Z("size-1.5 shrink-0 rounded-full",f.status==="up"?"bg-success":"bg-destructive")}),(0,a.jsx)("span",{className:"font-mono text-foreground",children:f.name}),f.critical&&(0,a.jsx)(re,{variant:"outline",children:t("Critical")})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[f.message!==void 0&&(0,a.jsx)("span",{className:"text-muted-foreground",children:f.message}),(0,a.jsx)(re,{"data-testid":`dh-check-status-${f.name}`,variant:f.status==="up"?"secondary":"destructive",children:f.status==="up"?t("Up"):t("Down")})]})]},f.name))}),e[23]=r.appName,e[24]=r.appVersion,e[25]=r.checks,e[26]=r.timestamp,e[27]=j,e[28]=Y,e[29]=C,e[30]=m,e[31]=t,e[32]=z,e[33]=I,e[34]=y,e[35]=N,e[36]=v,e[37]=S,e[38]=V,e[39]=b,e[40]=$,e[41]=H}else z=e[32],I=e[33],y=e[34],N=e[35],v=e[36],S=e[37],V=e[38],b=e[39],$=e[40],H=e[41];let P;e[102]!==z||e[103]!==S||e[104]!==V||e[105]!==b||e[106]!==$?(P=(0,a.jsxs)(z,{className:S,"data-testid":V,children:[b,$]}),e[102]=z,e[103]=S,e[104]=V,e[105]=b,e[106]=$,e[107]=P):P=e[107];let te;return e[108]!==I||e[109]!==y||e[110]!==N||e[111]!==v||e[112]!==P||e[113]!==H?(te=(0,a.jsxs)("div",{className:H,"data-testid":I,children:[y,N,v,P]}),e[108]=I,e[109]=y,e[110]=N,e[111]=v,e[112]=P,e[113]=H,e[114]=te):te=e[114],te},"Ie");function _e(n,e){return n.name.localeCompare(e.name)}k(_e,"be");export{De as DeploymentHealthPanel};
|