@lunora/studio 1.0.0-alpha.90 → 1.0.0-alpha.91

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.
Files changed (148) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/mount.js +1 -1
  3. package/dist/packem_chunks/AdvisorHealthPanel.js +1 -1
  4. package/dist/packem_chunks/ApiTab.js +1 -1
  5. package/dist/packem_chunks/AuditPanel.js +1 -1
  6. package/dist/packem_chunks/DeploymentHealthPanel.js +1 -1
  7. package/dist/packem_chunks/ExportImportPanel.js +1 -1
  8. package/dist/packem_chunks/FileBrowser.js +1 -1
  9. package/dist/packem_chunks/FunctionRunner.js +1 -1
  10. package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
  11. package/dist/packem_chunks/HealthPanel.js +1 -1
  12. package/dist/packem_chunks/InsightsPanel.js +1 -1
  13. package/dist/packem_chunks/LogsPanel.js +1 -1
  14. package/dist/packem_chunks/MailPanel.js +1 -1
  15. package/dist/packem_chunks/MetricsPanel.js +1 -1
  16. package/dist/packem_chunks/NotificationsPanel.js +1 -1
  17. package/dist/packem_chunks/PitrPanel.js +1 -1
  18. package/dist/packem_chunks/SchemaViewer.js +1 -1
  19. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
  20. package/dist/packem_chunks/SettingsPanel.js +1 -1
  21. package/dist/packem_chunks/SqlEditorPanel.js +1 -1
  22. package/dist/packem_chunks/TableEditor.js +1 -1
  23. package/dist/packem_chunks/agents-panel.js +1 -1
  24. package/dist/packem_chunks/analytics-panel.js +1 -1
  25. package/dist/packem_chunks/auth-audit-panel.js +1 -1
  26. package/dist/packem_chunks/auth-config-panel.js +1 -1
  27. package/dist/packem_chunks/auth-sessions-panel.js +1 -1
  28. package/dist/packem_chunks/containers-panel.js +1 -1
  29. package/dist/packem_chunks/dashboards-panel.js +1 -1
  30. package/dist/packem_chunks/fanout-panel.js +1 -1
  31. package/dist/packem_chunks/flags-panel.js +1 -1
  32. package/dist/packem_chunks/issues-panel.js +1 -1
  33. package/dist/packem_chunks/kv-browser.js +1 -1
  34. package/dist/packem_chunks/log-drains-panel.js +1 -1
  35. package/dist/packem_chunks/migrations-route.js +1 -1
  36. package/dist/packem_chunks/organizations-panel.js +1 -1
  37. package/dist/packem_chunks/payments-panel.js +1 -1
  38. package/dist/packem_chunks/permissions-panel.js +1 -1
  39. package/dist/packem_chunks/queues-panel.js +1 -1
  40. package/dist/packem_chunks/rls-panel.js +1 -1
  41. package/dist/packem_chunks/schedule-panel.js +1 -1
  42. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  43. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  44. package/dist/packem_chunks/sync-client-panel.js +1 -1
  45. package/dist/packem_chunks/traces-panel.js +1 -1
  46. package/dist/packem_chunks/users-panel.js +1 -1
  47. package/dist/packem_chunks/vector-browser.js +1 -1
  48. package/dist/packem_chunks/workflows-panel.js +1 -1
  49. package/dist/packem_shared/{ApiDocsPanel-DLMeLZ5-.js → ApiDocsPanel-Cu_QmzO0.js} +1 -1
  50. package/dist/packem_shared/{ApiReferencePanel-9q8BbJl-.js → ApiReferencePanel-DuIU1P8B.js} +1 -1
  51. package/dist/packem_shared/{CommandPalette--SQwfTW1.js → CommandPalette-mPR8-vIm.js} +1 -1
  52. package/dist/packem_shared/DataBrowser-BPRDaOHx.js +1 -0
  53. package/dist/packem_shared/{GlobalDataBrowser-DpkjHfDg.js → GlobalDataBrowser-CeA8bDjX.js} +1 -1
  54. package/dist/packem_shared/HomePanel-DLP1nQdC.js +1 -0
  55. package/dist/packem_shared/{MigrationsPanel-dygzHUvg.js → MigrationsPanel-dm_M75mR.js} +1 -1
  56. package/dist/packem_shared/{OpenRpcReferencePanel-qOZcWXMs.js → OpenRpcReferencePanel-DXeffPFr.js} +1 -1
  57. package/dist/packem_shared/{ScheduledJobs-D8kBZWBu.js → ScheduledJobs-DDJG9Je7.js} +1 -1
  58. package/dist/packem_shared/{Studio-forQt-PC.js → Studio-BYg65qWq.js} +1 -1
  59. package/dist/packem_shared/{StudioApp-B1AWsBzi.js → StudioApp-D0UOg0a_.js} +1 -1
  60. package/dist/packem_shared/{advisor-view-Pa8HLtBv.js → advisor-view-Coipc04R.js} +1 -1
  61. package/dist/packem_shared/{data-grid-DcxyIXwG.js → data-grid-Ci4-tZkk.js} +1 -1
  62. package/dist/packem_shared/{error-alert-t6cpEi0z.js → error-alert--Ie7ofJ0.js} +1 -1
  63. package/dist/packem_shared/{grid-features-jnrD0SpX.js → grid-features-Db_BNYRo.js} +3 -3
  64. package/dist/packem_shared/{home-panel-CeeqqV0z.js → home-panel-BtxdqXDe.js} +1 -1
  65. package/dist/packem_shared/internal-zkEvTqy8.js +2 -0
  66. package/dist/packem_shared/{recording-client-DRAZEmzE.js → recording-client-DtUxwVNY.js} +1 -1
  67. package/dist/packem_shared/{reference-view-DnYYWr7I.js → reference-view-DncEStdm.js} +1 -1
  68. package/dist/packem_shared/{result-chart-DzJOVsaw.js → result-chart-Gywg9DOk.js} +1 -1
  69. package/dist/packem_shared/{schema-diagram-cg-bz_VL.js → schema-diagram-DTRaCp6Y.js} +1 -1
  70. package/dist/packem_shared/{studio-BtC7WPbz.js → studio-Drf4en3j.js} +1 -1
  71. package/dist/packem_shared/{table-list-sidebar-D9Bd4qgi.js → table-list-sidebar-fz0m_4I4.js} +1 -1
  72. package/dist/packem_shared/{use-admin-query-QJ-ibl5u.js → use-admin-query-CnnyWJXM.js} +1 -1
  73. package/dist/packem_shared/{use-async-submit-q3ymBJkD.js → use-async-submit-BFIMhRqh.js} +1 -1
  74. package/dist/packem_shared/{use-auth-config-BObBpdsi.js → use-auth-config-0EnNCdLu.js} +1 -1
  75. package/dist/packem_shared/{use-sql-assistant-C6dl2_Ty.js → use-sql-assistant-Dtw55kKM.js} +1 -1
  76. package/dist/packem_shared/wire-codec-BUrWLklj.js +1 -0
  77. package/dist/standalone/{chunk-ZPLWCC4I.js → chunk-2NX5QU44.js} +1 -1
  78. package/dist/standalone/{chunk-WB5IUUUU.js → chunk-2QWHVQ6P.js} +1 -1
  79. package/dist/standalone/{chunk-WLZ7YPBH.js → chunk-3FIN5PH4.js} +4 -4
  80. package/dist/standalone/{chunk-XZSGE5ST.js → chunk-3XQMTTW2.js} +1 -1
  81. package/dist/standalone/{chunk-SHMNA6UL.js → chunk-4D7XIQ5Q.js} +1 -1
  82. package/dist/standalone/{chunk-SF4MF2FT.js → chunk-4PLB4ZNI.js} +1 -1
  83. package/dist/standalone/{chunk-PB7FNRDB.js → chunk-4VEAVSAZ.js} +1 -1
  84. package/dist/standalone/{chunk-3AV5CV6K.js → chunk-6QKJ6JPJ.js} +1 -1
  85. package/dist/standalone/{chunk-IC64YIX5.js → chunk-6WWX4FJB.js} +1 -1
  86. package/dist/standalone/{chunk-62EKHKTS.js → chunk-6XKVQES4.js} +1 -1
  87. package/dist/standalone/{chunk-C3HXK3A5.js → chunk-7QMX3D4D.js} +1 -1
  88. package/dist/standalone/{chunk-ULCZDGWQ.js → chunk-7YXDJXNL.js} +1 -1
  89. package/dist/standalone/{chunk-DMCYISRF.js → chunk-A7647FJE.js} +1 -1
  90. package/dist/standalone/{chunk-D3HXVA33.js → chunk-AQT6EPZT.js} +1 -1
  91. package/dist/standalone/{chunk-QXXIJAD5.js → chunk-AREBQI6D.js} +1 -1
  92. package/dist/standalone/{chunk-TBBJPPZ3.js → chunk-BCGEI67L.js} +1 -1
  93. package/dist/standalone/chunk-BENJFRZL.js +1 -0
  94. package/dist/standalone/{chunk-LQAKPCFX.js → chunk-BYIS2KWZ.js} +1 -1
  95. package/dist/standalone/{chunk-QYIOW7CD.js → chunk-C6GLTSPO.js} +1 -1
  96. package/dist/standalone/{chunk-JFW3YNVQ.js → chunk-CMP33R3N.js} +1 -1
  97. package/dist/standalone/{chunk-5ZXDB6LB.js → chunk-CRHCAN4W.js} +1 -1
  98. package/dist/standalone/{chunk-BRQMMGOS.js → chunk-CUAGAM2B.js} +1 -1
  99. package/dist/standalone/chunk-DBWOWJYT.js +11 -0
  100. package/dist/standalone/{chunk-QV6KV4SD.js → chunk-ESEEVSPC.js} +1 -1
  101. package/dist/standalone/chunk-F3TP5L34.js +1 -0
  102. package/dist/standalone/{chunk-6MKDYZ7A.js → chunk-FBNRATNR.js} +1 -1
  103. package/dist/standalone/{chunk-LAHYLAT4.js → chunk-HKG5I64M.js} +1 -1
  104. package/dist/standalone/{chunk-GKSRVABT.js → chunk-HWOD25QD.js} +1 -1
  105. package/dist/standalone/{chunk-XR7RBXKA.js → chunk-IBVBIKUI.js} +1 -1
  106. package/dist/standalone/{chunk-CTNB2KIA.js → chunk-IGCNMZSB.js} +1 -1
  107. package/dist/standalone/{chunk-IAKPXGTQ.js → chunk-IUUSMC2R.js} +1 -1
  108. package/dist/standalone/{chunk-OG4N2XHD.js → chunk-IUYFXK4X.js} +9 -9
  109. package/dist/standalone/{chunk-E7TB4USI.js → chunk-IZ3ISXSM.js} +1 -1
  110. package/dist/standalone/{chunk-BUTBQGUU.js → chunk-J3FR2XBV.js} +1 -1
  111. package/dist/standalone/{chunk-QP7IQOKF.js → chunk-JWXKUXYA.js} +1 -1
  112. package/dist/standalone/{chunk-OG2AMGOC.js → chunk-KUFAOKU3.js} +1 -1
  113. package/dist/standalone/{chunk-PM37X2V3.js → chunk-LDYOCGEG.js} +1 -1
  114. package/dist/standalone/{chunk-CT6ZDXLL.js → chunk-LUU4SDHW.js} +1 -1
  115. package/dist/standalone/chunk-LYQY7L72.js +4 -0
  116. package/dist/standalone/{chunk-GSKOAKQ2.js → chunk-LZH7RDRV.js} +1 -1
  117. package/dist/standalone/{chunk-LJISXTZJ.js → chunk-ML5IJMH6.js} +1 -1
  118. package/dist/standalone/{chunk-DG7YINFM.js → chunk-N233NOIN.js} +1 -1
  119. package/dist/standalone/{chunk-QWBRD6PX.js → chunk-NH3VWHCL.js} +1 -1
  120. package/dist/standalone/{chunk-ARP36PTE.js → chunk-NNRFDPSD.js} +1 -1
  121. package/dist/standalone/{chunk-AQX2QFCN.js → chunk-O2QUUHGF.js} +1 -1
  122. package/dist/standalone/{chunk-U6TNNM5U.js → chunk-Q2Q7FR3R.js} +1 -1
  123. package/dist/standalone/{chunk-Z7G74IH4.js → chunk-Q4AI6JRP.js} +1 -1
  124. package/dist/standalone/{chunk-AZAGCJVI.js → chunk-QGA2HITH.js} +1 -1
  125. package/dist/standalone/{chunk-6VTLIGVX.js → chunk-QWJ4HKPY.js} +1 -1
  126. package/dist/standalone/{chunk-Y7JXGNXD.js → chunk-QZGTDXV5.js} +1 -1
  127. package/dist/standalone/{chunk-24JLZ2Z5.js → chunk-RHPP74O4.js} +1 -1
  128. package/dist/standalone/{chunk-AUQKJYHL.js → chunk-RKGCSNAW.js} +1 -1
  129. package/dist/standalone/{chunk-X665E2HU.js → chunk-RMN2JN4S.js} +1 -1
  130. package/dist/standalone/{chunk-S4ILMYP5.js → chunk-RNOSWEMO.js} +1 -1
  131. package/dist/standalone/{chunk-MHAXZQVO.js → chunk-ULYM26IH.js} +1 -1
  132. package/dist/standalone/{chunk-PGC523I2.js → chunk-WOEGO5M6.js} +1 -1
  133. package/dist/standalone/{chunk-67DKQC23.js → chunk-XDEDCAYN.js} +1 -1
  134. package/dist/standalone/{chunk-YOUKADZH.js → chunk-XGMZESWC.js} +1 -1
  135. package/dist/standalone/{chunk-T6OAYQTX.js → chunk-XKKP2VFZ.js} +1 -1
  136. package/dist/standalone/{chunk-SP5SBO2W.js → chunk-XTEWLG3J.js} +2 -2
  137. package/dist/standalone/{chunk-BL6NO3U3.js → chunk-XXXMUP6L.js} +1 -1
  138. package/dist/standalone/{chunk-LJIFMW67.js → chunk-ZKTWHB7Q.js} +1 -1
  139. package/dist/standalone/{chunk-53KJRSHE.js → chunk-ZNMZQXWN.js} +1 -1
  140. package/dist/standalone/{chunk-YU5CI2FD.js → chunk-ZWSTXAG3.js} +1 -1
  141. package/dist/standalone/studio.js +1 -1
  142. package/package.json +1 -1
  143. package/dist/packem_shared/DataBrowser-CZZ_WkJ-.js +0 -1
  144. package/dist/packem_shared/HomePanel-3baDsDBU.js +0 -1
  145. package/dist/packem_shared/internal-BSIsQVC6.js +0 -2
  146. package/dist/standalone/chunk-4COKHD2C.js +0 -1
  147. package/dist/standalone/chunk-V2U5CL3S.js +0 -11
  148. package/dist/standalone/chunk-VFQDHG7I.js +0 -4
@@ -1 +1 @@
1
- import{a as jt}from"./chunk-KUVMORDQ.js";import{a as me}from"./chunk-EQZTSISX.js";import{a as Kt,b as Lt,c as At,d as Ot,e as ot}from"./chunk-4LCY5XUR.js";import{a as zt}from"./chunk-QWGT25SE.js";import{e as Dt}from"./chunk-XF2B7P5A.js";import{a as It,b as Ct,c as Tt,d as Rt,e as Pe}from"./chunk-UU2QJMGJ.js";import"./chunk-2PJNAWB3.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as _t}from"./chunk-CTNB2KIA.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import{a as et,b as tt,c as rt,d as yt,e as Nt,f as at,g as st,h as St,i as wt}from"./chunk-S3DWUXGY.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import{a as Mt}from"./chunk-3CWGJYBB.js";import{a as $t}from"./chunk-X665E2HU.js";import{a as qt,b as kt}from"./chunk-GRL5MG3Z.js";import{e as ut}from"./chunk-SMIESS7P.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as Ze}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Be}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import"./chunk-QLQADHFE.js";import{a as Le}from"./chunk-VDW32UET.js";import{c as je}from"./chunk-SHMNA6UL.js";import{f as mt}from"./chunk-V2U5CL3S.js";import"./chunk-XBDKZZ67.js";import{a as ft}from"./chunk-XQCVZAGU.js";import{a as lt,b as nt,c as it,d as Ee,e as ce,f as B}from"./chunk-MIQTKZAR.js";import{a as fe,b as Ae,c as Oe,d as gt,e as pe}from"./chunk-UZERI5YC.js";import{d as ge,f as pt,g as xt,h as bt,i as vt,m as Qe,p as Ge}from"./chunk-OG4N2XHD.js";import"./chunk-XNGYYOLS.js";import{a as o,e as Ye,f as Ft,g as Jt,h as Ht,j as ht}from"./chunk-3XIESWL4.js";var P=Ye(Ft(),1);var xe=Ye(Jt(),1);var t=Ye(Ht(),1);var Wt=o((s,e)=>s<e?-1:s>e?1:0,"Jt"),ct=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s))return`[${s.map(c=>ct(c)).join(",")}]`;let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let c=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${c} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,a=Object.keys(l).toSorted(Wt),r=[];for(let c of a){let i=l[c];i!==void 0&&r.push(`${JSON.stringify(c)}:${ct(i)}`)}return`{${r.join(",")}}`},"Ze"),Pt=o((s,e,l)=>`${s}:${e}:${ct(l??{})}`,"gt"),Ut=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ft"),Bt=o((s,e)=>Ut(s,e),"Ht"),Gt=o(s=>Ut(s.kind,s),"Gt"),dt=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"Xe"),Vt=o(s=>Array.isArray(s?.series)?s.series:[],"Wt"),Xt="FUNCTION_NOT_FOUND",Yt=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(Pt(l.kind,l.name,l.attributes),l.points);return e},"Yt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},Qt=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,c=ge();if(r===void 0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=u):u=e[0],u}let i;e[1]!==r?(i=r.slice(0,8),e[1]=r,e[2]=i):i=e[2];let n=i;if(a===void 0){let u=`mt-instrument-trace-${l}`,h;return e[3]!==n||e[4]!==u||e[5]!==r?(h=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":u,title:r,children:n}),e[3]=n,e[4]=u,e[5]=r,e[6]=h):h=e[6],h}let $=`mt-instrument-trace-${l}`,f;e[7]!==a||e[8]!==r?(f=o(()=>{a(r)},"f"),e[7]=a,e[8]=r,e[9]=f):f=e[9];let S;e[10]!==c||e[11]!==r?(S=c("Open the exemplar trace {trace}",{trace:r}),e[10]=c,e[11]=r,e[12]=S):S=e[12];let p;return e[13]!==n||e[14]!==$||e[15]!==f||e[16]!==S?(p=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":$,onClick:f,title:S,type:"button",children:n}),e[13]=n,e[14]=$,e[15]=f,e[16]=S,e[17]=p):p=e[17],p},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let i;e[1]!==a?(i={live:!0,shardKey:a},e[1]=a,e[2]=i):i=e[2];let{data:n,error:$,errorSource:f}=je(Le.getMetricSeries,c,i),S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S={},e[3]=S):S=e[3];let p;e[4]!==a?(p={live:!0,shardKey:a},e[4]=a,e[5]=p):p=e[5];let{data:u}=je(Le.getMetricHistory,S,p),h,M,b,w,_,d,g,x,q,k,y,D,I;if(e[6]!==n||e[7]!==$||e[8]!==f||e[9]!==u||e[10]!==l||e[11]!==r){x=Symbol.for("react.early_return_sentinel");e:{let A=Vt(n),j=vt(f)===Xt;if($!==null&&!j){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let E;e[27]!==m?(E=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=E):E=e[28];let U;e[29]!==$||e[30]!==r?(U=r("Instruments unavailable: {error}",{error:$}),e[29]=$,e[30]=r,e[31]=U):U=e[31];let F;e[32]!==U?(F=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:U}),e[32]=U,e[33]=F):F=e[33];let de;e[34]!==E||e[35]!==F?(de=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[E,F]}),e[34]=E,e[35]=F,e[36]=de):de=e[36],x=de;break e}if(A.length===0){x=null;break e}let J=Yt(u),K;e[37]!==r?(K=o(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"L"),e[37]=r,e[38]=K):K=e[38];let H=K;_="flex flex-col gap-2",d="mt-instruments";let L;e[39]!==r?(L=r("Instruments"),e[39]=r,e[40]=L):L=e[40],e[41]!==L?(g=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:L}),e[41]=L,e[42]=g):g=e[42],w=fe,I="overflow-hidden py-0",b=pe,D="px-0",M=lt,k="mt-instruments-table";let O;e[43]!==r?(O=r("name"),e[43]=r,e[44]=O):O=e[44];let G;e[45]!==O?(G=(0,t.jsx)(ce,{children:O}),e[45]=O,e[46]=G):G=e[46];let V;e[47]!==r?(V=r("kind"),e[47]=r,e[48]=V):V=e[48];let X;e[49]!==V?(X=(0,t.jsx)(ce,{children:V}),e[49]=V,e[50]=X):X=e[50];let Y;e[51]!==r?(Y=r("value"),e[51]=r,e[52]=Y):Y=e[52];let Z;e[53]!==Y?(Z=(0,t.jsx)(ce,{className:"text-right",children:Y}),e[53]=Y,e[54]=Z):Z=e[54];let Q;e[55]!==r?(Q=r("count"),e[55]=r,e[56]=Q):Q=e[56];let ee;e[57]!==Q?(ee=(0,t.jsx)(ce,{className:"text-right",children:Q}),e[57]=Q,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(ce,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(ce,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(ce,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(ce,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==G||e[76]!==X||e[77]!==Z||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(y=(0,t.jsx)(nt,{children:(0,t.jsxs)(Ee,{children:[G,X,Z,ee,re,se,ne,oe]})}),e[75]=G,e[76]=X,e[77]=Z,e[78]=ee,e[79]=re,e[80]=se,e[81]=ne,e[82]=oe,e[83]=y):y=e[83],h=it,q=A.map(m=>{let E=zt(m.attributes),U=Pt(m.kind,m.name,m.attributes),F=(J.get(U)??[]).map(de=>Bt(m.kind,de));return(0,t.jsxs)(Ee,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(B,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(B,{children:(0,t.jsx)(Be,{variant:Zt[m.kind],children:H(m.kind)})}),(0,t.jsx)(B,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:dt(Gt(m))}),(0,t.jsx)(B,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(B,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${dt(m.min)}\u2013${dt(m.max)}`}),(0,t.jsx)(B,{children:F.length>=2?(0,t.jsx)(ot,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:F,testId:`mt-instrument-trend-${m.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(B,{className:"font-mono text-xs",children:(0,t.jsx)(Qt,{name:m.name,onOpenTrace:l,traceId:m.exemplarTraceId})}),(0,t.jsx)(B,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:E,children:E===""?"\u2014":E})]},U)})}e[6]=n,e[7]=$,e[8]=f,e[9]=u,e[10]=l,e[11]=r,e[12]=h,e[13]=M,e[14]=b,e[15]=w,e[16]=_,e[17]=d,e[18]=g,e[19]=x,e[20]=q,e[21]=k,e[22]=y,e[23]=D,e[24]=I}else h=e[12],M=e[13],b=e[14],w=e[15],_=e[16],d=e[17],g=e[18],x=e[19],q=e[20],k=e[21],y=e[22],D=e[23],I=e[24];if(x!==Symbol.for("react.early_return_sentinel"))return x;let C;e[84]!==h||e[85]!==q?(C=(0,t.jsx)(h,{children:q}),e[84]=h,e[85]=q,e[86]=C):C=e[86];let T;e[87]!==M||e[88]!==C||e[89]!==k||e[90]!==y?(T=(0,t.jsxs)(M,{"data-testid":k,children:[y,C]}),e[87]=M,e[88]=C,e[89]=k,e[90]=y,e[91]=T):T=e[91];let N;e[92]!==b||e[93]!==T||e[94]!==D?(N=(0,t.jsx)(b,{className:D,children:T}),e[92]=b,e[93]=T,e[94]=D,e[95]=N):N=e[95];let v;e[96]!==w||e[97]!==N||e[98]!==I?(v=(0,t.jsx)(w,{className:I,children:N}),e[96]=w,e[97]=N,e[98]=I,e[99]=v):v=e[99];let z;return e[100]!==_||e[101]!==d||e[102]!==g||e[103]!==v?(z=(0,t.jsxs)("section",{className:_,"data-testid":d,children:[g,v]}),e[100]=_,e[101]=d,e[102]=g,e[103]=v,e[104]=z):z=e[104],z},"er"),tr=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),c;e[0]!==r?(c=r("Shards"),e[0]=r,e[1]=c):c=e[1];let i;e[2]!==l.failed||e[3]!==l.reachable||e[4]!==r?(i=l.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:l.failed,reachable:l.reachable}):r("{reachable} reachable",{reachable:l.reachable}),e[2]=l.failed,e[3]=l.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==c||e[7]!==i?(n=(0,t.jsx)(me,{label:c,testId:"mt-agg-shards",value:i}),e[6]=c,e[7]=i,e[8]=n):n=e[8];let $;e[9]!==r?($=r("Total requests"),e[9]=r,e[10]=$):$=e[10];let f;e[11]!==l.totalRequests||e[12]!==$?(f=(0,t.jsx)(me,{label:$,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=$,e[13]=f):f=e[13];let S;e[14]!==r?(S=r("Total errors"),e[14]=r,e[15]=S):S=e[15];let p;e[16]!==l.totalErrors||e[17]!==S?(p=(0,t.jsx)(me,{label:S,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=S,e[18]=p):p=e[18];let u;e[19]!==r?(u=r("Total database size"),e[19]=r,e[20]=u):u=e[20];let h;e[21]!==l.totalDatabaseSize?(h=Ge(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=h):h=e[22];let M;e[23]!==u||e[24]!==h?(M=(0,t.jsx)(me,{label:u,testId:"mt-agg-db-size",value:h}),e[23]=u,e[24]=h,e[25]=M):M=e[25];let b;e[26]!==r?(b=r("Combined cache hit rate"),e[26]=r,e[27]=b):b=e[27];let w;e[28]!==l.hitRate||e[29]!==r?(w=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=w):w=e[30];let _;e[31]!==b||e[32]!==w?(_=(0,t.jsx)(me,{label:b,testId:"mt-agg-cache",value:w}),e[31]=b,e[32]=w,e[33]=_):_=e[33];let d;e[34]!==M||e[35]!==_||e[36]!==n||e[37]!==f||e[38]!==p?(d=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,f,p,M,_]}),e[34]=M,e[35]=_,e[36]=n,e[37]=f,e[38]=p,e[39]=d):d=e[39];let g;e[40]!==r?(g=r("shard"),e[40]=r,e[41]=g):g=e[41];let x;e[42]!==g?(x=(0,t.jsx)(ce,{children:g}),e[42]=g,e[43]=x):x=e[43];let q;e[44]!==r?(q=r("requests"),e[44]=r,e[45]=q):q=e[45];let k;e[46]!==q?(k=(0,t.jsx)(ce,{children:q}),e[46]=q,e[47]=k):k=e[47];let y;e[48]!==r?(y=r("errors"),e[48]=r,e[49]=y):y=e[49];let D;e[50]!==y?(D=(0,t.jsx)(ce,{children:y}),e[50]=y,e[51]=D):D=e[51];let I;e[52]!==r?(I=r("db size"),e[52]=r,e[53]=I):I=e[53];let C;e[54]!==I?(C=(0,t.jsx)(ce,{children:I}),e[54]=I,e[55]=C):C=e[55];let T;e[56]!==x||e[57]!==k||e[58]!==D||e[59]!==C?(T=(0,t.jsx)(nt,{children:(0,t.jsxs)(Ee,{children:[x,k,D,C]})}),e[56]=x,e[57]=k,e[58]=D,e[59]=C,e[60]=T):T=e[60];let N;if(e[61]!==a||e[62]!==r){let j;e[64]!==r?(j=o(J=>(0,t.jsxs)(Ee,{"data-testid":`mt-agg-row-${J.shard}`,children:[(0,t.jsx)(B,{children:J.shard}),J.metrics===null?(0,t.jsx)(B,{className:"text-destructive",colSpan:3,children:J.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"tabular-nums",children:J.metrics.requests}),(0,t.jsx)(B,{className:"tabular-nums",children:J.metrics.errors}),(0,t.jsx)(B,{className:"tabular-nums",children:Ge(J.metrics.databaseSize)})]})]},J.shard),"K"),e[64]=r,e[65]=j):j=e[65],N=a.map(j),e[61]=a,e[62]=r,e[63]=N}else N=e[63];let v;e[66]!==N?(v=(0,t.jsx)(it,{children:N}),e[66]=N,e[67]=v):v=e[67];let z;e[68]!==T||e[69]!==v?(z=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(lt,{"data-testid":"mt-agg-table",children:[T,v]})})}),e[68]=T,e[69]=v,e[70]=z):z=e[70];let A;return e[71]!==d||e[72]!==z?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[d,z]}),e[71]=d,e[72]=z,e[73]=A):A=e[73],A},"tr"),rr=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return l>0?`${l.toString()}h ${a.toString()}m`:a>0?`${a.toString()}m ${r.toString()}s`:`${r.toString()}s`},"rr"),ar=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"ar"),Et=o(s=>s<=0?"\u2014":s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"ct"),sr=o(s=>{let e=(0,xe.c)(75),{currentDelta:l,errorRate:a,history:r,latencyPercentiles:c,metrics:i}=s,n=ge(),$;e[0]!==r||e[1]!==n?($=r.length>=2?(0,t.jsx)(ot,{ariaLabel:n("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=n,e[2]=$):$=e[2];let f;e[3]!==l||e[4]!==r.length||e[5]!==n?(f=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${l.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=l,e[4]=r.length,e[5]=n,e[6]=f):f=e[6];let S;e[7]!==n?(S=n("Requests"),e[7]=n,e[8]=S):S=e[8];let p;e[9]!==i.requests||e[10]!==$||e[11]!==f||e[12]!==S?(p=(0,t.jsx)(me,{chart:$,footer:f,label:S,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=$,e[11]=f,e[12]=S,e[13]=p):p=e[13];let u;e[14]!==a||e[15]!==n?(u=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=u):u=e[16];let h;e[17]!==n?(h=n("Errors"),e[17]=n,e[18]=h):h=e[18];let M;e[19]!==a||e[20]!==i.errors?(M=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=M):M=e[21];let b;e[22]!==u||e[23]!==h||e[24]!==M?(b=(0,t.jsx)(me,{footer:u,label:h,testId:"mt-errors",value:M}),e[22]=u,e[23]=h,e[24]=M,e[25]=b):b=e[25];let w;e[26]!==c.p90?(w=c.p90>0?`P90 ${Et(c.p90)}`:void 0,e[26]=c.p90,e[27]=w):w=e[27];let _;e[28]!==n?(_=n("P95 latency"),e[28]=n,e[29]=_):_=e[29];let d;e[30]!==c.p95?(d=c.p95>0?Et(c.p95):"\u2014",e[30]=c.p95,e[31]=d):d=e[31];let g;e[32]!==_||e[33]!==d||e[34]!==w?(g=(0,t.jsx)(me,{footer:w,label:_,testId:"mt-p95",value:d}),e[32]=_,e[33]=d,e[34]=w,e[35]=g):g=e[35];let x;e[36]!==i.cache||e[37]!==n?(x=i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${n("cache entries")}`,e[36]=i.cache,e[37]=n,e[38]=x):x=e[38];let q;e[39]!==n?(q=n("Database size"),e[39]=n,e[40]=q):q=e[40];let k;e[41]!==i.databaseSize?(k=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=k):k=e[42];let y;e[43]!==x||e[44]!==q||e[45]!==k?(y=(0,t.jsx)(me,{footer:x,label:q,testId:"mt-db-size",value:k}),e[43]=x,e[44]=q,e[45]=k,e[46]=y):y=e[46];let D;e[47]!==n?(D=n("Shard"),e[47]=n,e[48]=D):D=e[48];let I;e[49]!==i.shard||e[50]!==D?(I=(0,t.jsx)(me,{label:D,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=D,e[51]=I):I=e[51];let C;e[52]!==n?(C=n("Uptime"),e[52]=n,e[53]=C):C=e[53];let T;e[54]!==i.uptimeMs?(T=rr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=T):T=e[55];let N;e[56]!==C||e[57]!==T?(N=(0,t.jsx)(me,{label:C,testId:"mt-uptime",value:T}),e[56]=C,e[57]=T,e[58]=N):N=e[58];let v;e[59]!==n?(v=n("Cache hit rate"),e[59]=n,e[60]=v):v=e[60];let z;e[61]!==i.cache||e[62]!==n?(z=i.cache===null?n("no cache configured"):n("{rate} ({count} entries)",{count:i.cache.entries,rate:ar(i.cache.hits,i.cache.misses)}),e[61]=i.cache,e[62]=n,e[63]=z):z=e[63];let A;e[64]!==v||e[65]!==z?(A=(0,t.jsx)(me,{label:v,testId:"mt-cache",value:z}),e[64]=v,e[65]=z,e[66]=A):A=e[66];let j;return e[67]!==g||e[68]!==y||e[69]!==I||e[70]!==N||e[71]!==A||e[72]!==p||e[73]!==b?(j=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[p,b,g,y,I,N,A]}),e[67]=g,e[68]=y,e[69]=I,e[70]=N,e[71]=A,e[72]=p,e[73]=b,e[74]=j):j=e[74],j},"lr"),Xe=o(s=>s>=100?"critical":s>=50?"warning":"good","Ge"),Ue=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Oe"),Ve=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"Be"),lr=o(s=>{let e=(0,xe.c)(3),{level:l}=s;if(l==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Be,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(l==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"}),e[1]=r):r=e[1],r}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"}),e[2]=a):a=e[2],a},"sr"),nr=o((s,e)=>{let l=[...s];return l.sort((a,r)=>{switch(e){case"avgTime":return r.avgDurationMs-a.avgDurationMs;case"execCount":return r.execCount-a.execCount;case"rowsRead":return r.rowsRead-a.rowsRead;default:return r.totalDurationMs-a.totalDurationMs}}),l},"nr"),ir=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,c]=(0,P.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,$]=(0,P.useState)(i),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o(I=>{I!==null&&c(I)},"f"),e[1]=f):f=e[1];let S=f,p,u,h,M,b,w,_,d,g,x;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){h=Symbol.for("react.early_return_sentinel");e:{let I=nr(l,r),C;e[16]!==l?(C=l.filter(or),e[16]=l,e[17]=C):C=e[17];let T=C.length,N;e[18]!==l?(N=l.filter(dr),e[18]=l,e[19]=N):N=e[19];let v=N.length,z;e[20]!==l?(z=l.filter(cr),e[20]=l,e[21]=z):z=e[21];let A=z.length,j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=o(R=>{$(ue=>{let W=new Set(ue);return W.has(R)?W.delete(R):W.add(R),W})},"K"),e[22]=j):j=e[22];let J=j;if(l.length===0){let R;e[23]!==a?(R=a("No query insights yet"),e[23]=a,e[24]=R):R=e[24];let ue;e[25]!==R?(ue=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:R}),e[25]=R,e[26]=ue):ue=e[26];let W;e[27]!==a?(W=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=W):W=e[28];let he;e[29]!==W?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:W}),e[29]=W,e[30]=he):he=e[30];let We;e[31]!==ue||e[32]!==he?(We=(0,t.jsx)(fe,{children:(0,t.jsx)(pe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ue,he]})})}),e[31]=ue,e[32]=he,e[33]=We):We=e[33],h=We;break e}_="space-y-4",d="qi-root";let K;e[34]!==a?(K=a("Critical queries"),e[34]=a,e[35]=K):K=e[35];let H;e[36]!==K?(H=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:K})}),e[36]=K,e[37]=H):H=e[37];let L;e[38]!==T?(L=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:T}),e[38]=T,e[39]=L):L=e[39];let O;e[40]!==a?(O=a(">100ms avg execution"),e[40]=a,e[41]=O):O=e[41];let G;e[42]!==O?(G=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:O}),e[42]=O,e[43]=G):G=e[43];let V;e[44]!==L||e[45]!==G?(V=(0,t.jsxs)(pe,{children:[L,G]}),e[44]=L,e[45]=G,e[46]=V):V=e[46];let X;e[47]!==H||e[48]!==V?(X=(0,t.jsxs)(fe,{children:[H,V]}),e[47]=H,e[48]=V,e[49]=X):X=e[49];let Y;e[50]!==a?(Y=a("Moderate queries"),e[50]=a,e[51]=Y):Y=e[51];let Z;e[52]!==Y?(Z=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:Y})}),e[52]=Y,e[53]=Z):Z=e[53];let Q;e[54]!==v?(Q=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:v}),e[54]=v,e[55]=Q):Q=e[55];let ee;e[56]!==a?(ee=a("50\u2013100ms avg execution"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==ee?(te=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ee}),e[58]=ee,e[59]=te):te=e[59];let re;e[60]!==Q||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[Q,te]}),e[60]=Q,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Z||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Z,re]}),e[63]=Z,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==A?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:A}),e[70]=A,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let E;e[79]!==le||e[80]!==m?(E=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=E):E=e[81],e[82]!==X||e[83]!==ae||e[84]!==E?(g=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[X,ae,E]}),e[82]=X,e[83]=ae,e[84]=E,e[85]=g):g=e[85];let U;e[86]!==a?(U=a("Query leaderboard"),e[86]=a,e[87]=U):U=e[87];let F;e[88]!==U?(F=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:U}),e[88]=U,e[89]=F):F=e[89];let de;e[90]!==r||e[91]!==a?(de=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=de):de=e[92];let be;e[93]!==de?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:de}),e[93]=de,e[94]=be):be=e[94];let ve;e[95]!==F||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[F,be]}),e[95]=F,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Fe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Fe=(0,t.jsx)(Ct,{}),e[104]=Fe):Fe=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Tt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Fe}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let ke;e[109]!==qe?(ke=(0,t.jsx)(Pe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=ke):ke=e[110];let $e;e[111]!==a?($e=a("Avg time"),e[111]=a,e[112]=$e):$e=e[112];let Me;e[113]!==$e?(Me=(0,t.jsx)(Pe,{value:"avgTime",children:$e}),e[113]=$e,e[114]=Me):Me=e[114];let _e;e[115]!==a?(_e=a("Execution count"),e[115]=a,e[116]=_e):_e=e[116];let De;e[117]!==_e?(De=(0,t.jsx)(Pe,{value:"execCount",children:_e}),e[117]=_e,e[118]=De):De=e[118];let Ie;e[119]!==a?(Ie=a("Rows read"),e[119]=a,e[120]=Ie):Ie=e[120];let Ce;e[121]!==Ie?(Ce=(0,t.jsx)(Pe,{value:"rowsRead",children:Ie}),e[121]=Ie,e[122]=Ce):Ce=e[122];let Te;e[123]!==ke||e[124]!==Me||e[125]!==De||e[126]!==Ce?(Te=(0,t.jsxs)(Rt,{children:[ke,Me,De,Ce]}),e[123]=ke,e[124]=Me,e[125]=De,e[126]=Ce,e[127]=Te):Te=e[127];let Re;e[128]!==r||e[129]!==we||e[130]!==Te?(Re=(0,t.jsxs)(It,{onValueChange:S,value:r,children:[we,Te]}),e[128]=r,e[129]=we,e[130]=Te,e[131]=Re):Re=e[131];let ze;e[132]!==Ne||e[133]!==Re?(ze=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Re]}),e[132]=Ne,e[133]=Re,e[134]=ze):ze=e[134],e[135]!==ve||e[136]!==ze?(x=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,ze]}),e[135]=ve,e[136]=ze,e[137]=x):x=e[137],u=fe;let Ke;e[138]!==a?(Ke=a("Statements"),e[138]=a,e[139]=Ke):Ke=e[139];let Je;e[140]!==Ke?(Je=(0,t.jsx)(Oe,{children:Ke}),e[140]=Ke,e[141]=Je):Je=e[141],w=(0,t.jsxs)(Ae,{children:[Je,(0,t.jsx)(gt,{children:a("{count} tracked statements",{count:I.length})})]}),p=pe,M="space-y-2";let He;e[142]!==n||e[143]!==a?(He=o(R=>{let ue=R.normalizedSql,W=n.has(ue),he=Xe(R.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":W,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{J(ue)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(lr,{level:he}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:R.normalizedSql})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ue(R.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ue(R.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),R.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ue(R.p95DurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("p95")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ve(R.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),W&&(0,t.jsxs)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-medium",children:a("Full statement")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:R.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[R.p50DurationMs!==void 0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("p50")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ue(R.p50DurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(R.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ue(R.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(R.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(R.rowsWritten)})]})]})]})]},ue)},"Ee"),e[142]=n,e[143]=a,e[144]=He):He=e[144],b=I.map(He)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=p,e[7]=u,e[8]=h,e[9]=M,e[10]=b,e[11]=w,e[12]=_,e[13]=d,e[14]=g,e[15]=x}else p=e[6],u=e[7],h=e[8],M=e[9],b=e[10],w=e[11],_=e[12],d=e[13],g=e[14],x=e[15];if(h!==Symbol.for("react.early_return_sentinel"))return h;let q;e[145]!==M||e[146]!==b?(q=(0,t.jsx)("div",{className:M,children:b}),e[145]=M,e[146]=b,e[147]=q):q=e[147];let k;e[148]!==p||e[149]!==q?(k=(0,t.jsx)(p,{children:q}),e[148]=p,e[149]=q,e[150]=k):k=e[150];let y;e[151]!==u||e[152]!==k||e[153]!==w?(y=(0,t.jsxs)(u,{children:[w,k]}),e[151]=u,e[152]=k,e[153]=w,e[154]=y):y=e[154];let D;return e[155]!==y||e[156]!==_||e[157]!==d||e[158]!==g||e[159]!==x?(D=(0,t.jsxs)("div",{className:_,"data-testid":d,children:[g,x,y]}),e[155]=y,e[156]=_,e[157]=d,e[158]=g,e[159]=x,e[160]=D):D=e[160],D},"ir");function or(s){return Xe(s.avgDurationMs)==="critical"}o(or,"or");function dr(s){return Xe(s.avgDurationMs)==="warning"}o(dr,"cr");function cr(s){return Xe(s.avgDurationMs)==="good"}o(cr,"dr");var mr=["1m","5m","15m","1h"],ur=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ur"),hr=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),"hr"),gr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,P.useState)("15m"),r=je(Le.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,c=hr(r?.buckets??[]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:mr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===l,className:ht("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===l&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:o(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Be,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),c.length===0?(0,t.jsx)(ft,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),(0,t.jsx)(et,{height:140,width:"100%",children:(0,t.jsxs)(wt,{data:c,children:[(0,t.jsx)(rt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(at,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(st,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(tt,{}),(0,t.jsx)(Nt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),(0,t.jsx)(et,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:c,children:[(0,t.jsx)(rt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(at,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(st,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(tt,{}),(0,t.jsx)(yt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(ir,{queryStats:r?.entries??[]})]})},"gr"),fr=pt(Le.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),Pr=o(({initialShardKey:s})=>{let e=mt(),l=ge(),a=ut(),{queryShardKey:r,setShardKey:c,shardKey:i}=Mt(s),[n,$]=(0,P.useState)("overview"),[f,S]=(0,P.useState)([]),p=(0,P.useRef)(null),u=(0,P.useRef)(null),h=(0,P.useRef)(!0);(0,P.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let M=o(K=>{jt({shardKey:r,traceId:K}),Qe(a({to:"/traces"}))},"M"),{data:b,error:w,liveError:_}=je(Le.getMetrics,{},{live:!0,shardKey:r}),d=b??null;(0,P.useEffect)(()=>{if(b===void 0)return;kt(r);let K=b,H=p.current,L=u.current!==null&&u.current!==K.shard;if(u.current=K.shard,p.current=K.requests,L){S([]);return}H!==null&&K.requests>=H&&S(O=>[...O,K.requests-H].slice(-30))},[b,r]);let[g,x]=(0,P.useState)(null),[q,k]=(0,P.useState)(!1),y=o(async()=>{k(!0);let K=Lt(i,qt());try{let H=await Promise.all(K.map(async L=>{try{let O=await e.query(fr,{},xt(L));return{error:null,metrics:O,shard:L===""?O.shard:L}}catch(O){return{error:bt(O),metrics:null,shard:L===""?"__root__":L}}}));h.current&&x(H)}finally{h.current&&k(!1)}},"y"),D=g===null?null:Kt(g),I=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,C=f.length>0?f.at(-1):0,T=d?At(d):{p90:0,p95:0},N=(0,P.useMemo)(()=>{if(!d||!("queryStats"in d))return;let K=d.queryStats;if(!(!K||!Array.isArray(K)))return Ot(K)},[d]),v=pr(N!==void 0,n),z=o(()=>{Qe(y())},"T"),A=o(()=>{x(null)},"z"),j=o(()=>{$("overview")},"K"),J=o(()=>{$("query-insights")},"Q");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)($t,{onChange:c,testId:"mt-shard-input",value:i}),(0,t.jsx)(_t,{message:_,prefix:"mt"}),(0,t.jsx)(Ze,{"data-testid":"mt-aggregate",disabled:q,onClick:z,size:"sm",type:"button",variant:"secondary",children:l(q?"Aggregating\u2026":"All shards")}),g!==null&&(0,t.jsx)(Ze,{"data-testid":"mt-aggregate-clear",onClick:A,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:Dt,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:w}),N!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("button",{className:`pb-2 text-sm font-medium transition-colors ${v==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:j,type:"button",children:l("Overview")}),(0,t.jsxs)("button",{className:`pb-2 text-sm font-medium transition-colors ${v==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:J,type:"button",children:[l("Query insights"),N.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:N.length})]})]}),v==="query-insights"&&N!==void 0&&(0,t.jsx)(gr,{shardKey:r}),v==="overview"&&d!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:f,latencyPercentiles:T,metrics:d}),v==="overview"&&d===null&&null,v==="overview"&&(0,t.jsx)(er,{onOpenTrace:M,shardKey:r}),v==="overview"&&D!==null&&g!==null&&(0,t.jsx)(tr,{aggregate:D,shardResults:g})]})},"Ur");export{Pr as MetricsPanel};
1
+ import{a as jt}from"./chunk-KUVMORDQ.js";import{a as me}from"./chunk-EQZTSISX.js";import{a as Kt,b as Lt,c as At,d as Ot,e as ot}from"./chunk-4LCY5XUR.js";import{a as zt}from"./chunk-QWGT25SE.js";import{e as Dt}from"./chunk-XF2B7P5A.js";import{a as It,b as Ct,c as Tt,d as Rt,e as Pe}from"./chunk-UU2QJMGJ.js";import"./chunk-2PJNAWB3.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as _t}from"./chunk-IGCNMZSB.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import{a as et,b as tt,c as rt,d as yt,e as Nt,f as at,g as st,h as St,i as wt}from"./chunk-S3DWUXGY.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import{a as Mt}from"./chunk-3CWGJYBB.js";import{a as $t}from"./chunk-RMN2JN4S.js";import{a as qt,b as kt}from"./chunk-GRL5MG3Z.js";import{e as ut}from"./chunk-SMIESS7P.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as Ze}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Be}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import"./chunk-QLQADHFE.js";import{a as Le}from"./chunk-VDW32UET.js";import{c as je}from"./chunk-4D7XIQ5Q.js";import{f as mt}from"./chunk-DBWOWJYT.js";import"./chunk-XBDKZZ67.js";import{a as ft}from"./chunk-XQCVZAGU.js";import{a as lt,b as nt,c as it,d as Ee,e as ce,f as B}from"./chunk-MIQTKZAR.js";import{a as fe,b as Ae,c as Oe,d as gt,e as pe}from"./chunk-UZERI5YC.js";import{d as ge,f as pt,g as xt,h as bt,i as vt,l as Ge,o as Qe}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as o,e as Ye,f as Ft,g as Jt,h as Ht,j as ht}from"./chunk-3XIESWL4.js";var P=Ye(Ft(),1);var xe=Ye(Jt(),1);var t=Ye(Ht(),1);var Wt=o((s,e)=>s<e?-1:s>e?1:0,"Jt"),ct=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s))return`[${s.map(c=>ct(c)).join(",")}]`;let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let c=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${c} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,a=Object.keys(l).toSorted(Wt),r=[];for(let c of a){let i=l[c];i!==void 0&&r.push(`${JSON.stringify(c)}:${ct(i)}`)}return`{${r.join(",")}}`},"Ze"),Pt=o((s,e,l)=>`${s}:${e}:${ct(l??{})}`,"gt"),Ut=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ft"),Bt=o((s,e)=>Ut(s,e),"Ht"),Gt=o(s=>Ut(s.kind,s),"Gt"),dt=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"Xe"),Vt=o(s=>Array.isArray(s?.series)?s.series:[],"Wt"),Xt="FUNCTION_NOT_FOUND",Yt=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(Pt(l.kind,l.name,l.attributes),l.points);return e},"Yt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},Qt=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,c=ge();if(r===void 0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=u):u=e[0],u}let i;e[1]!==r?(i=r.slice(0,8),e[1]=r,e[2]=i):i=e[2];let n=i;if(a===void 0){let u=`mt-instrument-trace-${l}`,h;return e[3]!==n||e[4]!==u||e[5]!==r?(h=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":u,title:r,children:n}),e[3]=n,e[4]=u,e[5]=r,e[6]=h):h=e[6],h}let $=`mt-instrument-trace-${l}`,f;e[7]!==a||e[8]!==r?(f=o(()=>{a(r)},"f"),e[7]=a,e[8]=r,e[9]=f):f=e[9];let S;e[10]!==c||e[11]!==r?(S=c("Open the exemplar trace {trace}",{trace:r}),e[10]=c,e[11]=r,e[12]=S):S=e[12];let p;return e[13]!==n||e[14]!==$||e[15]!==f||e[16]!==S?(p=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":$,onClick:f,title:S,type:"button",children:n}),e[13]=n,e[14]=$,e[15]=f,e[16]=S,e[17]=p):p=e[17],p},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let i;e[1]!==a?(i={live:!0,shardKey:a},e[1]=a,e[2]=i):i=e[2];let{data:n,error:$,errorSource:f}=je(Le.getMetricSeries,c,i),S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S={},e[3]=S):S=e[3];let p;e[4]!==a?(p={live:!0,shardKey:a},e[4]=a,e[5]=p):p=e[5];let{data:u}=je(Le.getMetricHistory,S,p),h,M,b,w,_,d,g,x,q,k,y,D,I;if(e[6]!==n||e[7]!==$||e[8]!==f||e[9]!==u||e[10]!==l||e[11]!==r){x=Symbol.for("react.early_return_sentinel");e:{let A=Vt(n),j=vt(f)===Xt;if($!==null&&!j){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let E;e[27]!==m?(E=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=E):E=e[28];let U;e[29]!==$||e[30]!==r?(U=r("Instruments unavailable: {error}",{error:$}),e[29]=$,e[30]=r,e[31]=U):U=e[31];let F;e[32]!==U?(F=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:U}),e[32]=U,e[33]=F):F=e[33];let de;e[34]!==E||e[35]!==F?(de=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[E,F]}),e[34]=E,e[35]=F,e[36]=de):de=e[36],x=de;break e}if(A.length===0){x=null;break e}let J=Yt(u),K;e[37]!==r?(K=o(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"L"),e[37]=r,e[38]=K):K=e[38];let H=K;_="flex flex-col gap-2",d="mt-instruments";let L;e[39]!==r?(L=r("Instruments"),e[39]=r,e[40]=L):L=e[40],e[41]!==L?(g=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:L}),e[41]=L,e[42]=g):g=e[42],w=fe,I="overflow-hidden py-0",b=pe,D="px-0",M=lt,k="mt-instruments-table";let O;e[43]!==r?(O=r("name"),e[43]=r,e[44]=O):O=e[44];let G;e[45]!==O?(G=(0,t.jsx)(ce,{children:O}),e[45]=O,e[46]=G):G=e[46];let V;e[47]!==r?(V=r("kind"),e[47]=r,e[48]=V):V=e[48];let X;e[49]!==V?(X=(0,t.jsx)(ce,{children:V}),e[49]=V,e[50]=X):X=e[50];let Y;e[51]!==r?(Y=r("value"),e[51]=r,e[52]=Y):Y=e[52];let Z;e[53]!==Y?(Z=(0,t.jsx)(ce,{className:"text-right",children:Y}),e[53]=Y,e[54]=Z):Z=e[54];let Q;e[55]!==r?(Q=r("count"),e[55]=r,e[56]=Q):Q=e[56];let ee;e[57]!==Q?(ee=(0,t.jsx)(ce,{className:"text-right",children:Q}),e[57]=Q,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(ce,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(ce,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(ce,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(ce,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==G||e[76]!==X||e[77]!==Z||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(y=(0,t.jsx)(nt,{children:(0,t.jsxs)(Ee,{children:[G,X,Z,ee,re,se,ne,oe]})}),e[75]=G,e[76]=X,e[77]=Z,e[78]=ee,e[79]=re,e[80]=se,e[81]=ne,e[82]=oe,e[83]=y):y=e[83],h=it,q=A.map(m=>{let E=zt(m.attributes),U=Pt(m.kind,m.name,m.attributes),F=(J.get(U)??[]).map(de=>Bt(m.kind,de));return(0,t.jsxs)(Ee,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(B,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(B,{children:(0,t.jsx)(Be,{variant:Zt[m.kind],children:H(m.kind)})}),(0,t.jsx)(B,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:dt(Gt(m))}),(0,t.jsx)(B,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(B,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${dt(m.min)}\u2013${dt(m.max)}`}),(0,t.jsx)(B,{children:F.length>=2?(0,t.jsx)(ot,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:F,testId:`mt-instrument-trend-${m.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(B,{className:"font-mono text-xs",children:(0,t.jsx)(Qt,{name:m.name,onOpenTrace:l,traceId:m.exemplarTraceId})}),(0,t.jsx)(B,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:E,children:E===""?"\u2014":E})]},U)})}e[6]=n,e[7]=$,e[8]=f,e[9]=u,e[10]=l,e[11]=r,e[12]=h,e[13]=M,e[14]=b,e[15]=w,e[16]=_,e[17]=d,e[18]=g,e[19]=x,e[20]=q,e[21]=k,e[22]=y,e[23]=D,e[24]=I}else h=e[12],M=e[13],b=e[14],w=e[15],_=e[16],d=e[17],g=e[18],x=e[19],q=e[20],k=e[21],y=e[22],D=e[23],I=e[24];if(x!==Symbol.for("react.early_return_sentinel"))return x;let C;e[84]!==h||e[85]!==q?(C=(0,t.jsx)(h,{children:q}),e[84]=h,e[85]=q,e[86]=C):C=e[86];let T;e[87]!==M||e[88]!==C||e[89]!==k||e[90]!==y?(T=(0,t.jsxs)(M,{"data-testid":k,children:[y,C]}),e[87]=M,e[88]=C,e[89]=k,e[90]=y,e[91]=T):T=e[91];let N;e[92]!==b||e[93]!==T||e[94]!==D?(N=(0,t.jsx)(b,{className:D,children:T}),e[92]=b,e[93]=T,e[94]=D,e[95]=N):N=e[95];let v;e[96]!==w||e[97]!==N||e[98]!==I?(v=(0,t.jsx)(w,{className:I,children:N}),e[96]=w,e[97]=N,e[98]=I,e[99]=v):v=e[99];let z;return e[100]!==_||e[101]!==d||e[102]!==g||e[103]!==v?(z=(0,t.jsxs)("section",{className:_,"data-testid":d,children:[g,v]}),e[100]=_,e[101]=d,e[102]=g,e[103]=v,e[104]=z):z=e[104],z},"er"),tr=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),c;e[0]!==r?(c=r("Shards"),e[0]=r,e[1]=c):c=e[1];let i;e[2]!==l.failed||e[3]!==l.reachable||e[4]!==r?(i=l.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:l.failed,reachable:l.reachable}):r("{reachable} reachable",{reachable:l.reachable}),e[2]=l.failed,e[3]=l.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==c||e[7]!==i?(n=(0,t.jsx)(me,{label:c,testId:"mt-agg-shards",value:i}),e[6]=c,e[7]=i,e[8]=n):n=e[8];let $;e[9]!==r?($=r("Total requests"),e[9]=r,e[10]=$):$=e[10];let f;e[11]!==l.totalRequests||e[12]!==$?(f=(0,t.jsx)(me,{label:$,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=$,e[13]=f):f=e[13];let S;e[14]!==r?(S=r("Total errors"),e[14]=r,e[15]=S):S=e[15];let p;e[16]!==l.totalErrors||e[17]!==S?(p=(0,t.jsx)(me,{label:S,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=S,e[18]=p):p=e[18];let u;e[19]!==r?(u=r("Total database size"),e[19]=r,e[20]=u):u=e[20];let h;e[21]!==l.totalDatabaseSize?(h=Ge(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=h):h=e[22];let M;e[23]!==u||e[24]!==h?(M=(0,t.jsx)(me,{label:u,testId:"mt-agg-db-size",value:h}),e[23]=u,e[24]=h,e[25]=M):M=e[25];let b;e[26]!==r?(b=r("Combined cache hit rate"),e[26]=r,e[27]=b):b=e[27];let w;e[28]!==l.hitRate||e[29]!==r?(w=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=w):w=e[30];let _;e[31]!==b||e[32]!==w?(_=(0,t.jsx)(me,{label:b,testId:"mt-agg-cache",value:w}),e[31]=b,e[32]=w,e[33]=_):_=e[33];let d;e[34]!==M||e[35]!==_||e[36]!==n||e[37]!==f||e[38]!==p?(d=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,f,p,M,_]}),e[34]=M,e[35]=_,e[36]=n,e[37]=f,e[38]=p,e[39]=d):d=e[39];let g;e[40]!==r?(g=r("shard"),e[40]=r,e[41]=g):g=e[41];let x;e[42]!==g?(x=(0,t.jsx)(ce,{children:g}),e[42]=g,e[43]=x):x=e[43];let q;e[44]!==r?(q=r("requests"),e[44]=r,e[45]=q):q=e[45];let k;e[46]!==q?(k=(0,t.jsx)(ce,{children:q}),e[46]=q,e[47]=k):k=e[47];let y;e[48]!==r?(y=r("errors"),e[48]=r,e[49]=y):y=e[49];let D;e[50]!==y?(D=(0,t.jsx)(ce,{children:y}),e[50]=y,e[51]=D):D=e[51];let I;e[52]!==r?(I=r("db size"),e[52]=r,e[53]=I):I=e[53];let C;e[54]!==I?(C=(0,t.jsx)(ce,{children:I}),e[54]=I,e[55]=C):C=e[55];let T;e[56]!==x||e[57]!==k||e[58]!==D||e[59]!==C?(T=(0,t.jsx)(nt,{children:(0,t.jsxs)(Ee,{children:[x,k,D,C]})}),e[56]=x,e[57]=k,e[58]=D,e[59]=C,e[60]=T):T=e[60];let N;if(e[61]!==a||e[62]!==r){let j;e[64]!==r?(j=o(J=>(0,t.jsxs)(Ee,{"data-testid":`mt-agg-row-${J.shard}`,children:[(0,t.jsx)(B,{children:J.shard}),J.metrics===null?(0,t.jsx)(B,{className:"text-destructive",colSpan:3,children:J.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B,{className:"tabular-nums",children:J.metrics.requests}),(0,t.jsx)(B,{className:"tabular-nums",children:J.metrics.errors}),(0,t.jsx)(B,{className:"tabular-nums",children:Ge(J.metrics.databaseSize)})]})]},J.shard),"K"),e[64]=r,e[65]=j):j=e[65],N=a.map(j),e[61]=a,e[62]=r,e[63]=N}else N=e[63];let v;e[66]!==N?(v=(0,t.jsx)(it,{children:N}),e[66]=N,e[67]=v):v=e[67];let z;e[68]!==T||e[69]!==v?(z=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(lt,{"data-testid":"mt-agg-table",children:[T,v]})})}),e[68]=T,e[69]=v,e[70]=z):z=e[70];let A;return e[71]!==d||e[72]!==z?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[d,z]}),e[71]=d,e[72]=z,e[73]=A):A=e[73],A},"tr"),rr=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return l>0?`${l.toString()}h ${a.toString()}m`:a>0?`${a.toString()}m ${r.toString()}s`:`${r.toString()}s`},"rr"),ar=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"ar"),Et=o(s=>s<=0?"\u2014":s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"ct"),sr=o(s=>{let e=(0,xe.c)(75),{currentDelta:l,errorRate:a,history:r,latencyPercentiles:c,metrics:i}=s,n=ge(),$;e[0]!==r||e[1]!==n?($=r.length>=2?(0,t.jsx)(ot,{ariaLabel:n("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=n,e[2]=$):$=e[2];let f;e[3]!==l||e[4]!==r.length||e[5]!==n?(f=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${l.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=l,e[4]=r.length,e[5]=n,e[6]=f):f=e[6];let S;e[7]!==n?(S=n("Requests"),e[7]=n,e[8]=S):S=e[8];let p;e[9]!==i.requests||e[10]!==$||e[11]!==f||e[12]!==S?(p=(0,t.jsx)(me,{chart:$,footer:f,label:S,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=$,e[11]=f,e[12]=S,e[13]=p):p=e[13];let u;e[14]!==a||e[15]!==n?(u=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=u):u=e[16];let h;e[17]!==n?(h=n("Errors"),e[17]=n,e[18]=h):h=e[18];let M;e[19]!==a||e[20]!==i.errors?(M=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=M):M=e[21];let b;e[22]!==u||e[23]!==h||e[24]!==M?(b=(0,t.jsx)(me,{footer:u,label:h,testId:"mt-errors",value:M}),e[22]=u,e[23]=h,e[24]=M,e[25]=b):b=e[25];let w;e[26]!==c.p90?(w=c.p90>0?`P90 ${Et(c.p90)}`:void 0,e[26]=c.p90,e[27]=w):w=e[27];let _;e[28]!==n?(_=n("P95 latency"),e[28]=n,e[29]=_):_=e[29];let d;e[30]!==c.p95?(d=c.p95>0?Et(c.p95):"\u2014",e[30]=c.p95,e[31]=d):d=e[31];let g;e[32]!==_||e[33]!==d||e[34]!==w?(g=(0,t.jsx)(me,{footer:w,label:_,testId:"mt-p95",value:d}),e[32]=_,e[33]=d,e[34]=w,e[35]=g):g=e[35];let x;e[36]!==i.cache||e[37]!==n?(x=i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${n("cache entries")}`,e[36]=i.cache,e[37]=n,e[38]=x):x=e[38];let q;e[39]!==n?(q=n("Database size"),e[39]=n,e[40]=q):q=e[40];let k;e[41]!==i.databaseSize?(k=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=k):k=e[42];let y;e[43]!==x||e[44]!==q||e[45]!==k?(y=(0,t.jsx)(me,{footer:x,label:q,testId:"mt-db-size",value:k}),e[43]=x,e[44]=q,e[45]=k,e[46]=y):y=e[46];let D;e[47]!==n?(D=n("Shard"),e[47]=n,e[48]=D):D=e[48];let I;e[49]!==i.shard||e[50]!==D?(I=(0,t.jsx)(me,{label:D,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=D,e[51]=I):I=e[51];let C;e[52]!==n?(C=n("Uptime"),e[52]=n,e[53]=C):C=e[53];let T;e[54]!==i.uptimeMs?(T=rr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=T):T=e[55];let N;e[56]!==C||e[57]!==T?(N=(0,t.jsx)(me,{label:C,testId:"mt-uptime",value:T}),e[56]=C,e[57]=T,e[58]=N):N=e[58];let v;e[59]!==n?(v=n("Cache hit rate"),e[59]=n,e[60]=v):v=e[60];let z;e[61]!==i.cache||e[62]!==n?(z=i.cache===null?n("no cache configured"):n("{rate} ({count} entries)",{count:i.cache.entries,rate:ar(i.cache.hits,i.cache.misses)}),e[61]=i.cache,e[62]=n,e[63]=z):z=e[63];let A;e[64]!==v||e[65]!==z?(A=(0,t.jsx)(me,{label:v,testId:"mt-cache",value:z}),e[64]=v,e[65]=z,e[66]=A):A=e[66];let j;return e[67]!==g||e[68]!==y||e[69]!==I||e[70]!==N||e[71]!==A||e[72]!==p||e[73]!==b?(j=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[p,b,g,y,I,N,A]}),e[67]=g,e[68]=y,e[69]=I,e[70]=N,e[71]=A,e[72]=p,e[73]=b,e[74]=j):j=e[74],j},"lr"),Xe=o(s=>s>=100?"critical":s>=50?"warning":"good","Ge"),Ue=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Oe"),Ve=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"Be"),lr=o(s=>{let e=(0,xe.c)(3),{level:l}=s;if(l==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Be,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(l==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"}),e[1]=r):r=e[1],r}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"}),e[2]=a):a=e[2],a},"sr"),nr=o((s,e)=>{let l=[...s];return l.sort((a,r)=>{switch(e){case"avgTime":return r.avgDurationMs-a.avgDurationMs;case"execCount":return r.execCount-a.execCount;case"rowsRead":return r.rowsRead-a.rowsRead;default:return r.totalDurationMs-a.totalDurationMs}}),l},"nr"),ir=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,c]=(0,P.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,$]=(0,P.useState)(i),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=o(I=>{I!==null&&c(I)},"f"),e[1]=f):f=e[1];let S=f,p,u,h,M,b,w,_,d,g,x;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){h=Symbol.for("react.early_return_sentinel");e:{let I=nr(l,r),C;e[16]!==l?(C=l.filter(or),e[16]=l,e[17]=C):C=e[17];let T=C.length,N;e[18]!==l?(N=l.filter(dr),e[18]=l,e[19]=N):N=e[19];let v=N.length,z;e[20]!==l?(z=l.filter(cr),e[20]=l,e[21]=z):z=e[21];let A=z.length,j;e[22]===Symbol.for("react.memo_cache_sentinel")?(j=o(R=>{$(ue=>{let W=new Set(ue);return W.has(R)?W.delete(R):W.add(R),W})},"K"),e[22]=j):j=e[22];let J=j;if(l.length===0){let R;e[23]!==a?(R=a("No query insights yet"),e[23]=a,e[24]=R):R=e[24];let ue;e[25]!==R?(ue=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:R}),e[25]=R,e[26]=ue):ue=e[26];let W;e[27]!==a?(W=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=W):W=e[28];let he;e[29]!==W?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:W}),e[29]=W,e[30]=he):he=e[30];let We;e[31]!==ue||e[32]!==he?(We=(0,t.jsx)(fe,{children:(0,t.jsx)(pe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ue,he]})})}),e[31]=ue,e[32]=he,e[33]=We):We=e[33],h=We;break e}_="space-y-4",d="qi-root";let K;e[34]!==a?(K=a("Critical queries"),e[34]=a,e[35]=K):K=e[35];let H;e[36]!==K?(H=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:K})}),e[36]=K,e[37]=H):H=e[37];let L;e[38]!==T?(L=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:T}),e[38]=T,e[39]=L):L=e[39];let O;e[40]!==a?(O=a(">100ms avg execution"),e[40]=a,e[41]=O):O=e[41];let G;e[42]!==O?(G=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:O}),e[42]=O,e[43]=G):G=e[43];let V;e[44]!==L||e[45]!==G?(V=(0,t.jsxs)(pe,{children:[L,G]}),e[44]=L,e[45]=G,e[46]=V):V=e[46];let X;e[47]!==H||e[48]!==V?(X=(0,t.jsxs)(fe,{children:[H,V]}),e[47]=H,e[48]=V,e[49]=X):X=e[49];let Y;e[50]!==a?(Y=a("Moderate queries"),e[50]=a,e[51]=Y):Y=e[51];let Z;e[52]!==Y?(Z=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:Y})}),e[52]=Y,e[53]=Z):Z=e[53];let Q;e[54]!==v?(Q=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:v}),e[54]=v,e[55]=Q):Q=e[55];let ee;e[56]!==a?(ee=a("50\u2013100ms avg execution"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==ee?(te=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ee}),e[58]=ee,e[59]=te):te=e[59];let re;e[60]!==Q||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[Q,te]}),e[60]=Q,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Z||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Z,re]}),e[63]=Z,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==A?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:A}),e[70]=A,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let E;e[79]!==le||e[80]!==m?(E=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=E):E=e[81],e[82]!==X||e[83]!==ae||e[84]!==E?(g=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[X,ae,E]}),e[82]=X,e[83]=ae,e[84]=E,e[85]=g):g=e[85];let U;e[86]!==a?(U=a("Query leaderboard"),e[86]=a,e[87]=U):U=e[87];let F;e[88]!==U?(F=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:U}),e[88]=U,e[89]=F):F=e[89];let de;e[90]!==r||e[91]!==a?(de=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=de):de=e[92];let be;e[93]!==de?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:de}),e[93]=de,e[94]=be):be=e[94];let ve;e[95]!==F||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[F,be]}),e[95]=F,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Fe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Fe=(0,t.jsx)(Ct,{}),e[104]=Fe):Fe=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Tt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Fe}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let ke;e[109]!==qe?(ke=(0,t.jsx)(Pe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=ke):ke=e[110];let $e;e[111]!==a?($e=a("Avg time"),e[111]=a,e[112]=$e):$e=e[112];let Me;e[113]!==$e?(Me=(0,t.jsx)(Pe,{value:"avgTime",children:$e}),e[113]=$e,e[114]=Me):Me=e[114];let _e;e[115]!==a?(_e=a("Execution count"),e[115]=a,e[116]=_e):_e=e[116];let De;e[117]!==_e?(De=(0,t.jsx)(Pe,{value:"execCount",children:_e}),e[117]=_e,e[118]=De):De=e[118];let Ie;e[119]!==a?(Ie=a("Rows read"),e[119]=a,e[120]=Ie):Ie=e[120];let Ce;e[121]!==Ie?(Ce=(0,t.jsx)(Pe,{value:"rowsRead",children:Ie}),e[121]=Ie,e[122]=Ce):Ce=e[122];let Te;e[123]!==ke||e[124]!==Me||e[125]!==De||e[126]!==Ce?(Te=(0,t.jsxs)(Rt,{children:[ke,Me,De,Ce]}),e[123]=ke,e[124]=Me,e[125]=De,e[126]=Ce,e[127]=Te):Te=e[127];let Re;e[128]!==r||e[129]!==we||e[130]!==Te?(Re=(0,t.jsxs)(It,{onValueChange:S,value:r,children:[we,Te]}),e[128]=r,e[129]=we,e[130]=Te,e[131]=Re):Re=e[131];let ze;e[132]!==Ne||e[133]!==Re?(ze=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Re]}),e[132]=Ne,e[133]=Re,e[134]=ze):ze=e[134],e[135]!==ve||e[136]!==ze?(x=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,ze]}),e[135]=ve,e[136]=ze,e[137]=x):x=e[137],u=fe;let Ke;e[138]!==a?(Ke=a("Statements"),e[138]=a,e[139]=Ke):Ke=e[139];let Je;e[140]!==Ke?(Je=(0,t.jsx)(Oe,{children:Ke}),e[140]=Ke,e[141]=Je):Je=e[141],w=(0,t.jsxs)(Ae,{children:[Je,(0,t.jsx)(gt,{children:a("{count} tracked statements",{count:I.length})})]}),p=pe,M="space-y-2";let He;e[142]!==n||e[143]!==a?(He=o(R=>{let ue=R.normalizedSql,W=n.has(ue),he=Xe(R.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":W,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{J(ue)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(lr,{level:he}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:R.normalizedSql})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ue(R.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ue(R.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),R.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ue(R.p95DurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("p95")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ve(R.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),W&&(0,t.jsxs)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-medium",children:a("Full statement")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:R.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[R.p50DurationMs!==void 0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("p50")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ue(R.p50DurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(R.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ue(R.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(R.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ve(R.rowsWritten)})]})]})]})]},ue)},"Ee"),e[142]=n,e[143]=a,e[144]=He):He=e[144],b=I.map(He)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=p,e[7]=u,e[8]=h,e[9]=M,e[10]=b,e[11]=w,e[12]=_,e[13]=d,e[14]=g,e[15]=x}else p=e[6],u=e[7],h=e[8],M=e[9],b=e[10],w=e[11],_=e[12],d=e[13],g=e[14],x=e[15];if(h!==Symbol.for("react.early_return_sentinel"))return h;let q;e[145]!==M||e[146]!==b?(q=(0,t.jsx)("div",{className:M,children:b}),e[145]=M,e[146]=b,e[147]=q):q=e[147];let k;e[148]!==p||e[149]!==q?(k=(0,t.jsx)(p,{children:q}),e[148]=p,e[149]=q,e[150]=k):k=e[150];let y;e[151]!==u||e[152]!==k||e[153]!==w?(y=(0,t.jsxs)(u,{children:[w,k]}),e[151]=u,e[152]=k,e[153]=w,e[154]=y):y=e[154];let D;return e[155]!==y||e[156]!==_||e[157]!==d||e[158]!==g||e[159]!==x?(D=(0,t.jsxs)("div",{className:_,"data-testid":d,children:[g,x,y]}),e[155]=y,e[156]=_,e[157]=d,e[158]=g,e[159]=x,e[160]=D):D=e[160],D},"ir");function or(s){return Xe(s.avgDurationMs)==="critical"}o(or,"or");function dr(s){return Xe(s.avgDurationMs)==="warning"}o(dr,"cr");function cr(s){return Xe(s.avgDurationMs)==="good"}o(cr,"dr");var mr=["1m","5m","15m","1h"],ur=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ur"),hr=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),"hr"),gr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,P.useState)("15m"),r=je(Le.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,c=hr(r?.buckets??[]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:mr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===l,className:ht("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===l&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:o(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Be,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),c.length===0?(0,t.jsx)(ft,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),(0,t.jsx)(et,{height:140,width:"100%",children:(0,t.jsxs)(wt,{data:c,children:[(0,t.jsx)(rt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(at,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(st,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(tt,{}),(0,t.jsx)(Nt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),(0,t.jsx)(et,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:c,children:[(0,t.jsx)(rt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(at,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(st,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(tt,{}),(0,t.jsx)(yt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(ir,{queryStats:r?.entries??[]})]})},"gr"),fr=pt(Le.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),Pr=o(({initialShardKey:s})=>{let e=mt(),l=ge(),a=ut(),{queryShardKey:r,setShardKey:c,shardKey:i}=Mt(s),[n,$]=(0,P.useState)("overview"),[f,S]=(0,P.useState)([]),p=(0,P.useRef)(null),u=(0,P.useRef)(null),h=(0,P.useRef)(!0);(0,P.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let M=o(K=>{jt({shardKey:r,traceId:K}),Qe(a({to:"/traces"}))},"M"),{data:b,error:w,liveError:_}=je(Le.getMetrics,{},{live:!0,shardKey:r}),d=b??null;(0,P.useEffect)(()=>{if(b===void 0)return;kt(r);let K=b,H=p.current,L=u.current!==null&&u.current!==K.shard;if(u.current=K.shard,p.current=K.requests,L){S([]);return}H!==null&&K.requests>=H&&S(O=>[...O,K.requests-H].slice(-30))},[b,r]);let[g,x]=(0,P.useState)(null),[q,k]=(0,P.useState)(!1),y=o(async()=>{k(!0);let K=Lt(i,qt());try{let H=await Promise.all(K.map(async L=>{try{let O=await e.query(fr,{},xt(L));return{error:null,metrics:O,shard:L===""?O.shard:L}}catch(O){return{error:bt(O),metrics:null,shard:L===""?"__root__":L}}}));h.current&&x(H)}finally{h.current&&k(!1)}},"y"),D=g===null?null:Kt(g),I=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,C=f.length>0?f.at(-1):0,T=d?At(d):{p90:0,p95:0},N=(0,P.useMemo)(()=>{if(!d||!("queryStats"in d))return;let K=d.queryStats;if(!(!K||!Array.isArray(K)))return Ot(K)},[d]),v=pr(N!==void 0,n),z=o(()=>{Qe(y())},"T"),A=o(()=>{x(null)},"z"),j=o(()=>{$("overview")},"K"),J=o(()=>{$("query-insights")},"Q");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)($t,{onChange:c,testId:"mt-shard-input",value:i}),(0,t.jsx)(_t,{message:_,prefix:"mt"}),(0,t.jsx)(Ze,{"data-testid":"mt-aggregate",disabled:q,onClick:z,size:"sm",type:"button",variant:"secondary",children:l(q?"Aggregating\u2026":"All shards")}),g!==null&&(0,t.jsx)(Ze,{"data-testid":"mt-aggregate-clear",onClick:A,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:Dt,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:w}),N!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("button",{className:`pb-2 text-sm font-medium transition-colors ${v==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:j,type:"button",children:l("Overview")}),(0,t.jsxs)("button",{className:`pb-2 text-sm font-medium transition-colors ${v==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:J,type:"button",children:[l("Query insights"),N.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:N.length})]})]}),v==="query-insights"&&N!==void 0&&(0,t.jsx)(gr,{shardKey:r}),v==="overview"&&d!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:f,latencyPercentiles:T,metrics:d}),v==="overview"&&d===null&&null,v==="overview"&&(0,t.jsx)(er,{onOpenTrace:M,shardKey:r}),v==="overview"&&D!==null&&g!==null&&(0,t.jsx)(tr,{aggregate:D,shardResults:g})]})},"Ur");export{Pr as MetricsPanel};
@@ -1 +1 @@
1
- import{b as R}from"./chunk-YOUKADZH.js";import"./chunk-LJIFMW67.js";import"./chunk-XXQUMVWH.js";import"./chunk-QWBRD6PX.js";import"./chunk-QLQADHFE.js";import{a as p}from"./chunk-VDW32UET.js";import{c as h}from"./chunk-SHMNA6UL.js";import"./chunk-V2U5CL3S.js";import"./chunk-XBDKZZ67.js";import"./chunk-MIQTKZAR.js";import"./chunk-UZERI5YC.js";import{d as g}from"./chunk-OG4N2XHD.js";import"./chunk-XNGYYOLS.js";import{a as s,e as m,g as S,h as _}from"./chunk-3XIESWL4.js";var f=m(S(),1);var k=m(_(),1);var A=s((e,t)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("Live admin subscriptions are ungated")})[t.kind],"R"),w=s(e=>Array.isArray(e.findings)?e.findings:[],"k"),E=s(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),T=s((e,t)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:t.detail?.length,min:t.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:t.detail?.length,min:t.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.")})[t.kind],"A"),O=s(()=>{let e=(0,f.c)(8),t=g(),r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let{data:a,error:d,errorSource:c}=h(p.getSecurityAudit,r),n;if(e[1]!==a||e[2]!==t){let u=a===void 0?null:w(a);n=u===null?null:u.map(i=>({description:T(t,i),entity:E(i),issueType:A(t,i),key:i.kind,level:i.level})),e[1]=a,e[2]=t,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(R,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"N");export{O as default};
1
+ import{b as R}from"./chunk-XGMZESWC.js";import"./chunk-ZKTWHB7Q.js";import"./chunk-XXQUMVWH.js";import"./chunk-NH3VWHCL.js";import"./chunk-QLQADHFE.js";import{a as p}from"./chunk-VDW32UET.js";import{c as h}from"./chunk-4D7XIQ5Q.js";import"./chunk-DBWOWJYT.js";import"./chunk-XBDKZZ67.js";import"./chunk-MIQTKZAR.js";import"./chunk-UZERI5YC.js";import{d as g}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as s,e as m,g as S,h as _}from"./chunk-3XIESWL4.js";var f=m(S(),1);var k=m(_(),1);var A=s((e,t)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("Live admin subscriptions are ungated")})[t.kind],"R"),w=s(e=>Array.isArray(e.findings)?e.findings:[],"k"),E=s(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"S"),T=s((e,t)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:t.detail?.length,min:t.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:t.detail?.length,min:t.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.")})[t.kind],"A"),O=s(()=>{let e=(0,f.c)(8),t=g(),r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let{data:a,error:d,errorSource:c}=h(p.getSecurityAudit,r),n;if(e[1]!==a||e[2]!==t){let u=a===void 0?null:w(a);n=u===null?null:u.map(i=>({description:T(t,i),entity:E(i),issueType:A(t,i),key:i.kind,level:i.level})),e[1]=a,e[2]=t,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(R,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"N");export{O as default};
@@ -1 +1 @@
1
- import{h as u,m as f}from"./chunk-OG4N2XHD.js";import{a as s,e as l,f as h,g as S}from"./chunk-3XIESWL4.js";var i=l(S(),1),c=l(h(),1);var g=s(()=>{let t=(0,i.c)(4),[a,n]=(0,c.useState)(!1),[e,m]=(0,c.useState)(null),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s(p=>{f((async()=>{n(!0),m(null);try{await p()}catch(b){m(u(b))}n(!1)})())},"e"),t[0]=r):r=t[0];let y=r,o;return t[1]!==a||t[2]!==e?(o={busy:a,error:e,run:y},t[1]=a,t[2]=e,t[3]=o):o=t[3],o},"g");export{g as a};
1
+ import{h as u,o as f}from"./chunk-IUYFXK4X.js";import{a as s,e as l,f as h,g as S}from"./chunk-3XIESWL4.js";var i=l(S(),1),c=l(h(),1);var g=s(()=>{let t=(0,i.c)(4),[a,n]=(0,c.useState)(!1),[e,m]=(0,c.useState)(null),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s(p=>{f((async()=>{n(!0),m(null);try{await p()}catch(b){m(u(b))}n(!1)})())},"e"),t[0]=r):r=t[0];let y=r,o;return t[1]!==a||t[2]!==e?(o={busy:a,error:e,run:y},t[1]=a,t[2]=e,t[3]=o):o=t[3],o},"g");export{g as a};
@@ -1 +1 @@
1
- import{a as de}from"./chunk-XR7RBXKA.js";import"./chunk-S3DWUXGY.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import{d as Y,f as ee}from"./chunk-7T7UOTYK.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as T}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as te}from"./chunk-XXQUMVWH.js";import{a as X}from"./chunk-VDW32UET.js";import{f as F}from"./chunk-V2U5CL3S.js";import"./chunk-XBDKZZ67.js";import{a as H}from"./chunk-XQCVZAGU.js";import{a as Q,b as U,c as D,e as V}from"./chunk-UZERI5YC.js";import{d as A,f as Z,g as G,h as J,m as P}from"./chunk-OG4N2XHD.js";import"./chunk-XNGYYOLS.js";import{a as k,e as O,f as ae,g as le,h as se}from"./chunk-3XIESWL4.js";var W=O(le(),1),I=O(ae(),1);var s=O(se(),1);var re=Z(X.runSql),ie=k((_,e)=>{let t=(0,W.c)(11),m=F(),[d,a]=(0,I.useState)(void 0),[r,l]=(0,I.useState)(void 0),[o,E]=(0,I.useState)(!0),c;t[0]!==m||t[1]!==e||t[2]!==_?(c=k(async u=>{E(!0);try{let N=await m.query(re,{sql:_},G(e));u.cancelled||(a(N),l(void 0))}catch(N){let $=N;u.cancelled||(a(void 0),l(J($)))}u.cancelled||E(!1)},"n"),t[0]=m,t[1]=e,t[2]=_,t[3]=c):c=t[3];let C=c,y,K;t[4]!==C?(y=k(()=>{let u={cancelled:!1};return P(C(u)),()=>{u.cancelled=!0}},"y"),K=[C],t[4]=C,t[5]=y,t[6]=K):(y=t[5],K=t[6]),(0,I.useEffect)(y,K);let h;return t[7]!==r||t[8]!==o||t[9]!==d?(h={error:r,loading:o,result:d},t[7]=r,t[8]=o,t[9]=d,t[10]=h):h=t[10],h},"re"),oe="lunora-studio-dashboards",B={shardKey:"",sql:"",title:""},ne=k(_=>{let e=(0,W.c)(54),{onEdit:t,onRemove:m,widget:d}=_,a=A(),{error:r,loading:l,result:o}=ie(d.sql,d.shardKey??""),E;e[0]!==t||e[1]!==d.id?(E=k(()=>{t(d.id)},"$"),e[0]=t,e[1]=d.id,e[2]=E):E=e[2];let c=E,C;e[3]!==m||e[4]!==d.id?(C=k(()=>{m(d.id)},"k"),e[3]=m,e[4]=d.id,e[5]=C):C=e[5];let y=C,K=`dashboards-widget-${d.id}`,h;e[6]!==d.title?(h=(0,s.jsx)(D,{className:"min-w-0 truncate",title:d.title,children:d.title}),e[6]=d.title,e[7]=h):h=e[7];let u;e[8]!==a?(u=a("Edit widget"),e[8]=a,e[9]=u):u=e[9];let N=`dashboards-widget-edit-${d.id}`,$;e[10]!==a?($=a("Edit widget"),e[10]=a,e[11]=$):$=e[11];let L;e[12]===Symbol.for("react.memo_cache_sentinel")?(L=(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[12]=L):L=e[12];let S;e[13]!==c||e[14]!==u||e[15]!==N||e[16]!==$?(S=(0,s.jsx)(T,{"aria-label":u,"data-testid":N,onClick:c,size:"icon-xs",title:$,type:"button",variant:"ghost",children:L}),e[13]=c,e[14]=u,e[15]=N,e[16]=$,e[17]=S):S=e[17];let x;e[18]!==a?(x=a("Remove widget"),e[18]=a,e[19]=x):x=e[19];let j=`dashboards-widget-remove-${d.id}`,g;e[20]!==a?(g=a("Remove widget"),e[20]=a,e[21]=g):g=e[21];let w;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[22]=w):w=e[22];let b;e[23]!==y||e[24]!==x||e[25]!==j||e[26]!==g?(b=(0,s.jsx)(T,{"aria-label":x,"data-testid":j,onClick:y,size:"icon-xs",title:g,type:"button",variant:"ghost",children:w}),e[23]=y,e[24]=x,e[25]=j,e[26]=g,e[27]=b):b=e[27];let f;e[28]!==b||e[29]!==S?(f=(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[S,b]}),e[28]=b,e[29]=S,e[30]=f):f=e[30];let p;e[31]!==f||e[32]!==h?(p=(0,s.jsxs)(U,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[h,f]}),e[31]=f,e[32]=h,e[33]=p):p=e[33];let v;e[34]!==r||e[35]!==d.id?(v=r!==void 0&&(0,s.jsx)(te,{className:"font-mono text-xs",testId:`dashboards-widget-error-${d.id}`,variant:"destructive",children:r}),e[34]=r,e[35]=d.id,e[36]=v):v=e[36];let R;e[37]!==r||e[38]!==l||e[39]!==o||e[40]!==a||e[41]!==d.id?(R=r===void 0&&l&&o===void 0&&(0,s.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${d.id}`,children:a("Running\u2026")}),e[37]=r,e[38]=l,e[39]=o,e[40]=a,e[41]=d.id,e[42]=R):R=e[42];let i;e[43]!==r||e[44]!==o?(i=r===void 0&&o!==void 0&&(0,s.jsx)(de,{result:o}),e[43]=r,e[44]=o,e[45]=i):i=e[45];let n;e[46]!==v||e[47]!==R||e[48]!==i?(n=(0,s.jsxs)(V,{className:"min-h-32 py-2",children:[v,R,i]}),e[46]=v,e[47]=R,e[48]=i,e[49]=n):n=e[49];let q;return e[50]!==p||e[51]!==n||e[52]!==K?(q=(0,s.jsxs)(Q,{"data-testid":K,children:[p,n]}),e[50]=p,e[51]=n,e[52]=K,e[53]=q):q=e[53],q},"ie"),ce=k(_=>{let e=(0,W.c)(58),{draft:t,editing:m,onCancel:d,onChange:a,onSubmit:r}=_,l=A(),o;e[0]!==t||e[1]!==a?(o=k(z=>{a({...t,title:z.target.value})},"a"),e[0]=t,e[1]=a,e[2]=o):o=e[2];let E=o,c;e[3]!==t||e[4]!==a?(c=k(z=>{a({...t,sql:z.target.value})},"n"),e[3]=t,e[4]=a,e[5]=c):c=e[5];let C=c,y;e[6]!==t||e[7]!==a?(y=k(z=>{a({...t,shardKey:z.target.value})},"y"),e[6]=t,e[7]=a,e[8]=y):y=e[8];let K=y,h;e[9]!==r?(h=k(()=>{r()},"h"),e[9]=r,e[10]=h):h=e[10];let u=h,N;e[11]!==t.sql||e[12]!==t.title?(N=t.title.trim()!==""&&t.sql.trim()!=="",e[11]=t.sql,e[12]=t.title,e[13]=N):N=e[13];let $=N,L;e[14]!==l?(L=l("Widget title"),e[14]=l,e[15]=L):L=e[15];let S;e[16]!==l?(S=l("Widget title"),e[16]=l,e[17]=S):S=e[17];let x;e[18]!==t.title||e[19]!==E||e[20]!==L||e[21]!==S?(x=(0,s.jsx)("input",{"aria-label":L,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:E,placeholder:S,type:"text",value:t.title}),e[18]=t.title,e[19]=E,e[20]=L,e[21]=S,e[22]=x):x=e[22];let j;e[23]!==l?(j=l("SQL query"),e[23]=l,e[24]=j):j=e[24];let g;e[25]!==t.sql||e[26]!==C||e[27]!==j?(g=(0,s.jsx)("textarea",{"aria-label":j,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:C,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:t.sql}),e[25]=t.sql,e[26]=C,e[27]=j,e[28]=g):g=e[28];let w;e[29]!==l?(w=l("Shard key (optional)"),e[29]=l,e[30]=w):w=e[30];let b;e[31]!==l?(b=l("Shard key (optional)"),e[31]=l,e[32]=b):b=e[32];let f;e[33]!==t.shardKey||e[34]!==K||e[35]!==w||e[36]!==b?(f=(0,s.jsx)("input",{"aria-label":w,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:K,placeholder:b,type:"text",value:t.shardKey}),e[33]=t.shardKey,e[34]=K,e[35]=w,e[36]=b,e[37]=f):f=e[37];let p;e[38]!==l?(p=l("Cancel"),e[38]=l,e[39]=p):p=e[39];let v;e[40]!==d||e[41]!==p?(v=(0,s.jsx)(T,{"data-testid":"dashboards-form-cancel",onClick:d,size:"sm",type:"button",variant:"outline",children:p}),e[40]=d,e[41]=p,e[42]=v):v=e[42];let R=!$,i;e[43]!==m||e[44]!==l?(i=l(m?"Save widget":"Add widget"),e[43]=m,e[44]=l,e[45]=i):i=e[45];let n;e[46]!==u||e[47]!==R||e[48]!==i?(n=(0,s.jsx)(T,{"data-testid":"dashboards-form-save",disabled:R,onClick:u,size:"sm",type:"button",children:i}),e[46]=u,e[47]=R,e[48]=i,e[49]=n):n=e[49];let q;e[50]!==v||e[51]!==n?(q=(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[v,n]}),e[50]=v,e[51]=n,e[52]=q):q=e[52];let M;return e[53]!==g||e[54]!==f||e[55]!==q||e[56]!==x?(M=(0,s.jsx)(Q,{"data-testid":"dashboards-form",children:(0,s.jsxs)(V,{className:"flex flex-col gap-3 py-4",children:[x,g,f,q]})}),e[53]=g,e[54]=f,e[55]=q,e[56]=x,e[57]=M):M=e[57],M},"ae"),we=k(_=>{let e=(0,W.c)(39),{initialShardKey:t}=_,m=A(),[d,a]=Y(oe),[r,l]=(0,I.useState)(B),[o,E]=(0,I.useState)(null),[c,C]=(0,I.useState)(!1),y;e[0]!==t?(y=k(()=>{E(null),l({...B,shardKey:t??""}),C(!0)},"y"),e[0]=t,e[1]=y):y=e[1];let K=y,h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=k(()=>{C(!1),E(null),l(B)},"h"),e[2]=h):h=e[2];let u=h,N;e[3]!==d?(N=k(i=>{let n=d.find(q=>q.id===i);n!==void 0&&(E(i),l({shardKey:n.shardKey??"",sql:n.sql,title:n.title}),C(!0))},"C"),e[3]=d,e[4]=N):N=e[4];let $=N,L;e[5]!==a?(L=k(i=>{a(n=>n.filter(q=>q.id!==i))},"K"),e[5]=a,e[6]=L):L=e[6];let S=L,x;e[7]!==r.shardKey||e[8]!==r.sql||e[9]!==r.title||e[10]!==o||e[11]!==a?(x=k(()=>{let i=r.title.trim(),n=r.sql.trim();if(i===""||n==="")return;let q=r.shardKey.trim();a(o===null?M=>[...M,{id:ee("w"),shardKey:q,sql:n,title:i}]:M=>M.map(z=>z.id===o?{...z,shardKey:q,sql:n,title:i}:z)),u()},"x"),e[7]=r.shardKey,e[8]=r.sql,e[9]=r.title,e[10]=o,e[11]=a,e[12]=x):x=e[12];let j=x,g;e[13]!==m?(g=m("Chart widgets backed by saved read-only SQL queries."),e[13]=m,e[14]=g):g=e[14];let w;e[15]!==g?(w=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:g}),e[15]=g,e[16]=w):w=e[16];let b;e[17]!==c||e[18]!==K||e[19]!==m?(b=!c&&(0,s.jsx)(T,{"data-testid":"dashboards-add",onClick:K,size:"sm",type:"button",children:m("Add widget")}),e[17]=c,e[18]=K,e[19]=m,e[20]=b):b=e[20];let f;e[21]!==w||e[22]!==b?(f=(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[w,b]}),e[21]=w,e[22]=b,e[23]=f):f=e[23];let p;e[24]!==r||e[25]!==o||e[26]!==c||e[27]!==j?(p=c&&(0,s.jsx)(ce,{draft:r,editing:o!==null,onCancel:u,onChange:l,onSubmit:j}),e[24]=r,e[25]=o,e[26]=c,e[27]=j,e[28]=p):p=e[28];let v;e[29]!==c||e[30]!==$||e[31]!==S||e[32]!==m||e[33]!==d?(v=d.length===0&&!c?(0,s.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,s.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:d.map(i=>(0,s.jsx)(ne,{onEdit:$,onRemove:S,widget:i},i.id))}),e[29]=c,e[30]=$,e[31]=S,e[32]=m,e[33]=d,e[34]=v):v=e[34];let R;return e[35]!==p||e[36]!==v||e[37]!==f?(R=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[f,p,v]}),e[35]=p,e[36]=v,e[37]=f,e[38]=R):R=e[38],R},"we");export{we as default};
1
+ import{a as de}from"./chunk-IBVBIKUI.js";import"./chunk-S3DWUXGY.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import{d as Y,f as ee}from"./chunk-7T7UOTYK.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as T}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{a as te}from"./chunk-XXQUMVWH.js";import{a as X}from"./chunk-VDW32UET.js";import{f as F}from"./chunk-DBWOWJYT.js";import"./chunk-XBDKZZ67.js";import{a as H}from"./chunk-XQCVZAGU.js";import{a as Q,b as U,c as D,e as V}from"./chunk-UZERI5YC.js";import{d as A,f as Z,g as G,h as J,o as P}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as k,e as O,f as ae,g as le,h as se}from"./chunk-3XIESWL4.js";var W=O(le(),1),I=O(ae(),1);var s=O(se(),1);var re=Z(X.runSql),ie=k((_,e)=>{let t=(0,W.c)(11),m=F(),[d,a]=(0,I.useState)(void 0),[r,l]=(0,I.useState)(void 0),[o,E]=(0,I.useState)(!0),c;t[0]!==m||t[1]!==e||t[2]!==_?(c=k(async u=>{E(!0);try{let N=await m.query(re,{sql:_},G(e));u.cancelled||(a(N),l(void 0))}catch(N){let $=N;u.cancelled||(a(void 0),l(J($)))}u.cancelled||E(!1)},"n"),t[0]=m,t[1]=e,t[2]=_,t[3]=c):c=t[3];let C=c,y,K;t[4]!==C?(y=k(()=>{let u={cancelled:!1};return P(C(u)),()=>{u.cancelled=!0}},"y"),K=[C],t[4]=C,t[5]=y,t[6]=K):(y=t[5],K=t[6]),(0,I.useEffect)(y,K);let h;return t[7]!==r||t[8]!==o||t[9]!==d?(h={error:r,loading:o,result:d},t[7]=r,t[8]=o,t[9]=d,t[10]=h):h=t[10],h},"re"),oe="lunora-studio-dashboards",B={shardKey:"",sql:"",title:""},ne=k(_=>{let e=(0,W.c)(54),{onEdit:t,onRemove:m,widget:d}=_,a=A(),{error:r,loading:l,result:o}=ie(d.sql,d.shardKey??""),E;e[0]!==t||e[1]!==d.id?(E=k(()=>{t(d.id)},"$"),e[0]=t,e[1]=d.id,e[2]=E):E=e[2];let c=E,C;e[3]!==m||e[4]!==d.id?(C=k(()=>{m(d.id)},"k"),e[3]=m,e[4]=d.id,e[5]=C):C=e[5];let y=C,K=`dashboards-widget-${d.id}`,h;e[6]!==d.title?(h=(0,s.jsx)(D,{className:"min-w-0 truncate",title:d.title,children:d.title}),e[6]=d.title,e[7]=h):h=e[7];let u;e[8]!==a?(u=a("Edit widget"),e[8]=a,e[9]=u):u=e[9];let N=`dashboards-widget-edit-${d.id}`,$;e[10]!==a?($=a("Edit widget"),e[10]=a,e[11]=$):$=e[11];let L;e[12]===Symbol.for("react.memo_cache_sentinel")?(L=(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[12]=L):L=e[12];let S;e[13]!==c||e[14]!==u||e[15]!==N||e[16]!==$?(S=(0,s.jsx)(T,{"aria-label":u,"data-testid":N,onClick:c,size:"icon-xs",title:$,type:"button",variant:"ghost",children:L}),e[13]=c,e[14]=u,e[15]=N,e[16]=$,e[17]=S):S=e[17];let x;e[18]!==a?(x=a("Remove widget"),e[18]=a,e[19]=x):x=e[19];let j=`dashboards-widget-remove-${d.id}`,g;e[20]!==a?(g=a("Remove widget"),e[20]=a,e[21]=g):g=e[21];let w;e[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[22]=w):w=e[22];let b;e[23]!==y||e[24]!==x||e[25]!==j||e[26]!==g?(b=(0,s.jsx)(T,{"aria-label":x,"data-testid":j,onClick:y,size:"icon-xs",title:g,type:"button",variant:"ghost",children:w}),e[23]=y,e[24]=x,e[25]=j,e[26]=g,e[27]=b):b=e[27];let f;e[28]!==b||e[29]!==S?(f=(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[S,b]}),e[28]=b,e[29]=S,e[30]=f):f=e[30];let p;e[31]!==f||e[32]!==h?(p=(0,s.jsxs)(U,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[h,f]}),e[31]=f,e[32]=h,e[33]=p):p=e[33];let v;e[34]!==r||e[35]!==d.id?(v=r!==void 0&&(0,s.jsx)(te,{className:"font-mono text-xs",testId:`dashboards-widget-error-${d.id}`,variant:"destructive",children:r}),e[34]=r,e[35]=d.id,e[36]=v):v=e[36];let R;e[37]!==r||e[38]!==l||e[39]!==o||e[40]!==a||e[41]!==d.id?(R=r===void 0&&l&&o===void 0&&(0,s.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${d.id}`,children:a("Running\u2026")}),e[37]=r,e[38]=l,e[39]=o,e[40]=a,e[41]=d.id,e[42]=R):R=e[42];let i;e[43]!==r||e[44]!==o?(i=r===void 0&&o!==void 0&&(0,s.jsx)(de,{result:o}),e[43]=r,e[44]=o,e[45]=i):i=e[45];let n;e[46]!==v||e[47]!==R||e[48]!==i?(n=(0,s.jsxs)(V,{className:"min-h-32 py-2",children:[v,R,i]}),e[46]=v,e[47]=R,e[48]=i,e[49]=n):n=e[49];let q;return e[50]!==p||e[51]!==n||e[52]!==K?(q=(0,s.jsxs)(Q,{"data-testid":K,children:[p,n]}),e[50]=p,e[51]=n,e[52]=K,e[53]=q):q=e[53],q},"ie"),ce=k(_=>{let e=(0,W.c)(58),{draft:t,editing:m,onCancel:d,onChange:a,onSubmit:r}=_,l=A(),o;e[0]!==t||e[1]!==a?(o=k(z=>{a({...t,title:z.target.value})},"a"),e[0]=t,e[1]=a,e[2]=o):o=e[2];let E=o,c;e[3]!==t||e[4]!==a?(c=k(z=>{a({...t,sql:z.target.value})},"n"),e[3]=t,e[4]=a,e[5]=c):c=e[5];let C=c,y;e[6]!==t||e[7]!==a?(y=k(z=>{a({...t,shardKey:z.target.value})},"y"),e[6]=t,e[7]=a,e[8]=y):y=e[8];let K=y,h;e[9]!==r?(h=k(()=>{r()},"h"),e[9]=r,e[10]=h):h=e[10];let u=h,N;e[11]!==t.sql||e[12]!==t.title?(N=t.title.trim()!==""&&t.sql.trim()!=="",e[11]=t.sql,e[12]=t.title,e[13]=N):N=e[13];let $=N,L;e[14]!==l?(L=l("Widget title"),e[14]=l,e[15]=L):L=e[15];let S;e[16]!==l?(S=l("Widget title"),e[16]=l,e[17]=S):S=e[17];let x;e[18]!==t.title||e[19]!==E||e[20]!==L||e[21]!==S?(x=(0,s.jsx)("input",{"aria-label":L,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:E,placeholder:S,type:"text",value:t.title}),e[18]=t.title,e[19]=E,e[20]=L,e[21]=S,e[22]=x):x=e[22];let j;e[23]!==l?(j=l("SQL query"),e[23]=l,e[24]=j):j=e[24];let g;e[25]!==t.sql||e[26]!==C||e[27]!==j?(g=(0,s.jsx)("textarea",{"aria-label":j,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:C,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:t.sql}),e[25]=t.sql,e[26]=C,e[27]=j,e[28]=g):g=e[28];let w;e[29]!==l?(w=l("Shard key (optional)"),e[29]=l,e[30]=w):w=e[30];let b;e[31]!==l?(b=l("Shard key (optional)"),e[31]=l,e[32]=b):b=e[32];let f;e[33]!==t.shardKey||e[34]!==K||e[35]!==w||e[36]!==b?(f=(0,s.jsx)("input",{"aria-label":w,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:K,placeholder:b,type:"text",value:t.shardKey}),e[33]=t.shardKey,e[34]=K,e[35]=w,e[36]=b,e[37]=f):f=e[37];let p;e[38]!==l?(p=l("Cancel"),e[38]=l,e[39]=p):p=e[39];let v;e[40]!==d||e[41]!==p?(v=(0,s.jsx)(T,{"data-testid":"dashboards-form-cancel",onClick:d,size:"sm",type:"button",variant:"outline",children:p}),e[40]=d,e[41]=p,e[42]=v):v=e[42];let R=!$,i;e[43]!==m||e[44]!==l?(i=l(m?"Save widget":"Add widget"),e[43]=m,e[44]=l,e[45]=i):i=e[45];let n;e[46]!==u||e[47]!==R||e[48]!==i?(n=(0,s.jsx)(T,{"data-testid":"dashboards-form-save",disabled:R,onClick:u,size:"sm",type:"button",children:i}),e[46]=u,e[47]=R,e[48]=i,e[49]=n):n=e[49];let q;e[50]!==v||e[51]!==n?(q=(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[v,n]}),e[50]=v,e[51]=n,e[52]=q):q=e[52];let M;return e[53]!==g||e[54]!==f||e[55]!==q||e[56]!==x?(M=(0,s.jsx)(Q,{"data-testid":"dashboards-form",children:(0,s.jsxs)(V,{className:"flex flex-col gap-3 py-4",children:[x,g,f,q]})}),e[53]=g,e[54]=f,e[55]=q,e[56]=x,e[57]=M):M=e[57],M},"ae"),we=k(_=>{let e=(0,W.c)(39),{initialShardKey:t}=_,m=A(),[d,a]=Y(oe),[r,l]=(0,I.useState)(B),[o,E]=(0,I.useState)(null),[c,C]=(0,I.useState)(!1),y;e[0]!==t?(y=k(()=>{E(null),l({...B,shardKey:t??""}),C(!0)},"y"),e[0]=t,e[1]=y):y=e[1];let K=y,h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=k(()=>{C(!1),E(null),l(B)},"h"),e[2]=h):h=e[2];let u=h,N;e[3]!==d?(N=k(i=>{let n=d.find(q=>q.id===i);n!==void 0&&(E(i),l({shardKey:n.shardKey??"",sql:n.sql,title:n.title}),C(!0))},"C"),e[3]=d,e[4]=N):N=e[4];let $=N,L;e[5]!==a?(L=k(i=>{a(n=>n.filter(q=>q.id!==i))},"K"),e[5]=a,e[6]=L):L=e[6];let S=L,x;e[7]!==r.shardKey||e[8]!==r.sql||e[9]!==r.title||e[10]!==o||e[11]!==a?(x=k(()=>{let i=r.title.trim(),n=r.sql.trim();if(i===""||n==="")return;let q=r.shardKey.trim();a(o===null?M=>[...M,{id:ee("w"),shardKey:q,sql:n,title:i}]:M=>M.map(z=>z.id===o?{...z,shardKey:q,sql:n,title:i}:z)),u()},"x"),e[7]=r.shardKey,e[8]=r.sql,e[9]=r.title,e[10]=o,e[11]=a,e[12]=x):x=e[12];let j=x,g;e[13]!==m?(g=m("Chart widgets backed by saved read-only SQL queries."),e[13]=m,e[14]=g):g=e[14];let w;e[15]!==g?(w=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:g}),e[15]=g,e[16]=w):w=e[16];let b;e[17]!==c||e[18]!==K||e[19]!==m?(b=!c&&(0,s.jsx)(T,{"data-testid":"dashboards-add",onClick:K,size:"sm",type:"button",children:m("Add widget")}),e[17]=c,e[18]=K,e[19]=m,e[20]=b):b=e[20];let f;e[21]!==w||e[22]!==b?(f=(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[w,b]}),e[21]=w,e[22]=b,e[23]=f):f=e[23];let p;e[24]!==r||e[25]!==o||e[26]!==c||e[27]!==j?(p=c&&(0,s.jsx)(ce,{draft:r,editing:o!==null,onCancel:u,onChange:l,onSubmit:j}),e[24]=r,e[25]=o,e[26]=c,e[27]=j,e[28]=p):p=e[28];let v;e[29]!==c||e[30]!==$||e[31]!==S||e[32]!==m||e[33]!==d?(v=d.length===0&&!c?(0,s.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,s.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:d.map(i=>(0,s.jsx)(ne,{onEdit:$,onRemove:S,widget:i},i.id))}),e[29]=c,e[30]=$,e[31]=S,e[32]=m,e[33]=d,e[34]=v):v=e[34];let R;return e[35]!==p||e[36]!==v||e[37]!==f?(R=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[f,p,v]}),e[35]=p,e[36]=v,e[37]=f,e[38]=R):R=e[38],R},"we");export{we as default};
@@ -1 +1 @@
1
- import{b as B}from"./chunk-XF2B7P5A.js";import{b as A}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as P}from"./chunk-LJIFMW67.js";import"./chunk-XXQUMVWH.js";import"./chunk-QWBRD6PX.js";import"./chunk-QLQADHFE.js";import{a as M}from"./chunk-VDW32UET.js";import{c as F}from"./chunk-SHMNA6UL.js";import"./chunk-V2U5CL3S.js";import"./chunk-XBDKZZ67.js";import{a as R,b as q,c as z,d as K,e as _,f as C}from"./chunk-MIQTKZAR.js";import{a as D,e as j}from"./chunk-UZERI5YC.js";import{d as V}from"./chunk-OG4N2XHD.js";import"./chunk-XNGYYOLS.js";import{a as k,e as O,g as H,h as W}from"./chunk-3XIESWL4.js";var G=O(H(),1);var t=O(W(),1);var $={binding:"outline",secret:"destructive",var:"secondary"},J=k((n,e)=>{if(n===void 0)return[];let m=[];return n.workerUrl!==void 0&&m.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&m.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&m.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&m.push({label:e("Version"),value:n.versionTag}),m},"B"),le=k(n=>{let e=(0,G.c)(52),{initialShardKey:m}=n,r=V(),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let E=m??"",S;e[1]!==E?(S={shardKey:E},e[1]=E,e[2]=S):S=e[2];let{data:s,error:l,errorSource:b,isLoading:U}=F(M.getSettings,w,S),a,c,p,d,o,i,u;if(e[3]!==l||e[4]!==b||e[5]!==s?.deploy||e[6]!==s?.settings||e[7]!==r){let L=J(s?.deploy,r),T;e[15]!==s?.settings?(T=s?.settings??[],e[15]=s?.settings,e[16]=T):T=e[16],a=T,c="flex flex-col gap-4",p="lunora-settings";let y;e[17]!==r?(y=r("Open in Cloudflare"),e[17]=r,e[18]=y):y=e[18],e[19]!==y?(d=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:B,rel:"noreferrer",target:"_blank",children:y})}),e[19]=y,e[20]=d):d=e[20];let N;e[21]!==r?(N=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=N):N=e[22],e[23]!==N?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:N}),e[23]=N,e[24]=o):o=e[24],e[25]!==l||e[26]!==b?(i=l!==null&&(0,t.jsx)(P,{error:b,testId:"set-error"}),e[25]=l,e[26]=b,e[27]=i):i=e[27],u=L.length>0&&(0,t.jsxs)(D,{className:"py-0","data-testid":"set-deploy",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Deployment")})}),(0,t.jsx)(j,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:L.map(Q)})})]}),e[3]=l,e[4]=b,e[5]=s?.deploy,e[6]=s?.settings,e[7]=r,e[8]=a,e[9]=c,e[10]=p,e[11]=d,e[12]=o,e[13]=i,e[14]=u}else a=e[8],c=e[9],p=e[10],d=e[11],o=e[12],i=e[13],u=e[14];let h;e[28]!==r?(h=r("Environment & bindings"),e[28]=r,e[29]=h):h=e[29];let f;e[30]!==h?(f=(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h})}),e[30]=h,e[31]=f):f=e[31];let g;e[32]!==l||e[33]!==U||e[34]!==a.length||e[35]!==r?(g=l===null&&!U&&a.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[32]=l,e[33]=U,e[34]=a.length,e[35]=r,e[36]=g):g=e[36];let x;e[37]!==a||e[38]!==r?(x=a.length>0&&(0,t.jsx)(j,{className:"px-0 py-0",children:(0,t.jsxs)(R,{"data-testid":"set-table",children:[(0,t.jsx)(q,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(_,{children:r("name")}),(0,t.jsx)(_,{children:r("kind")}),(0,t.jsx)(_,{children:r("value")})]})}),(0,t.jsx)(z,{children:a.map(X)})]})}),e[37]=a,e[38]=r,e[39]=x):x=e[39];let v;e[40]!==f||e[41]!==g||e[42]!==x?(v=(0,t.jsxs)(D,{className:"py-0",children:[f,g,x]}),e[40]=f,e[41]=g,e[42]=x,e[43]=v):v=e[43];let I;return e[44]!==v||e[45]!==c||e[46]!==p||e[47]!==d||e[48]!==o||e[49]!==i||e[50]!==u?(I=(0,t.jsxs)("div",{className:c,"data-testid":p,children:[d,o,i,u,v]}),e[44]=v,e[45]=c,e[46]=p,e[47]=d,e[48]=o,e[49]=i,e[50]=u,e[51]=I):I=e[51],I},"le");function Q(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}k(Q,"G");function X(n){return(0,t.jsxs)(K,{"data-testid":"set-row",children:[(0,t.jsx)(C,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(C,{children:(0,t.jsx)(A,{variant:$[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(C,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}k(X,"H");export{le as SettingsPanel};
1
+ import{b as B}from"./chunk-XF2B7P5A.js";import{b as A}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as P}from"./chunk-ZKTWHB7Q.js";import"./chunk-XXQUMVWH.js";import"./chunk-NH3VWHCL.js";import"./chunk-QLQADHFE.js";import{a as M}from"./chunk-VDW32UET.js";import{c as F}from"./chunk-4D7XIQ5Q.js";import"./chunk-DBWOWJYT.js";import"./chunk-XBDKZZ67.js";import{a as R,b as q,c as z,d as K,e as _,f as C}from"./chunk-MIQTKZAR.js";import{a as D,e as j}from"./chunk-UZERI5YC.js";import{d as V}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as k,e as O,g as H,h as W}from"./chunk-3XIESWL4.js";var G=O(H(),1);var t=O(W(),1);var $={binding:"outline",secret:"destructive",var:"secondary"},J=k((n,e)=>{if(n===void 0)return[];let m=[];return n.workerUrl!==void 0&&m.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&m.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&m.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&m.push({label:e("Version"),value:n.versionTag}),m},"B"),le=k(n=>{let e=(0,G.c)(52),{initialShardKey:m}=n,r=V(),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let E=m??"",S;e[1]!==E?(S={shardKey:E},e[1]=E,e[2]=S):S=e[2];let{data:s,error:l,errorSource:b,isLoading:U}=F(M.getSettings,w,S),a,c,p,d,o,i,u;if(e[3]!==l||e[4]!==b||e[5]!==s?.deploy||e[6]!==s?.settings||e[7]!==r){let L=J(s?.deploy,r),T;e[15]!==s?.settings?(T=s?.settings??[],e[15]=s?.settings,e[16]=T):T=e[16],a=T,c="flex flex-col gap-4",p="lunora-settings";let y;e[17]!==r?(y=r("Open in Cloudflare"),e[17]=r,e[18]=y):y=e[18],e[19]!==y?(d=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:B,rel:"noreferrer",target:"_blank",children:y})}),e[19]=y,e[20]=d):d=e[20];let N;e[21]!==r?(N=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=N):N=e[22],e[23]!==N?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:N}),e[23]=N,e[24]=o):o=e[24],e[25]!==l||e[26]!==b?(i=l!==null&&(0,t.jsx)(P,{error:b,testId:"set-error"}),e[25]=l,e[26]=b,e[27]=i):i=e[27],u=L.length>0&&(0,t.jsxs)(D,{className:"py-0","data-testid":"set-deploy",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Deployment")})}),(0,t.jsx)(j,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:L.map(Q)})})]}),e[3]=l,e[4]=b,e[5]=s?.deploy,e[6]=s?.settings,e[7]=r,e[8]=a,e[9]=c,e[10]=p,e[11]=d,e[12]=o,e[13]=i,e[14]=u}else a=e[8],c=e[9],p=e[10],d=e[11],o=e[12],i=e[13],u=e[14];let h;e[28]!==r?(h=r("Environment & bindings"),e[28]=r,e[29]=h):h=e[29];let f;e[30]!==h?(f=(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h})}),e[30]=h,e[31]=f):f=e[31];let g;e[32]!==l||e[33]!==U||e[34]!==a.length||e[35]!==r?(g=l===null&&!U&&a.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[32]=l,e[33]=U,e[34]=a.length,e[35]=r,e[36]=g):g=e[36];let x;e[37]!==a||e[38]!==r?(x=a.length>0&&(0,t.jsx)(j,{className:"px-0 py-0",children:(0,t.jsxs)(R,{"data-testid":"set-table",children:[(0,t.jsx)(q,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(_,{children:r("name")}),(0,t.jsx)(_,{children:r("kind")}),(0,t.jsx)(_,{children:r("value")})]})}),(0,t.jsx)(z,{children:a.map(X)})]})}),e[37]=a,e[38]=r,e[39]=x):x=e[39];let v;e[40]!==f||e[41]!==g||e[42]!==x?(v=(0,t.jsxs)(D,{className:"py-0",children:[f,g,x]}),e[40]=f,e[41]=g,e[42]=x,e[43]=v):v=e[43];let I;return e[44]!==v||e[45]!==c||e[46]!==p||e[47]!==d||e[48]!==o||e[49]!==i||e[50]!==u?(I=(0,t.jsxs)("div",{className:c,"data-testid":p,children:[d,o,i,u,v]}),e[44]=v,e[45]=c,e[46]=p,e[47]=d,e[48]=o,e[49]=i,e[50]=u,e[51]=I):I=e[51],I},"le");function Q(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}k(Q,"G");function X(n){return(0,t.jsxs)(K,{"data-testid":"set-row",children:[(0,t.jsx)(C,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(C,{children:(0,t.jsx)(A,{variant:$[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(C,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}k(X,"H");export{le as SettingsPanel};
@@ -1 +1 @@
1
- import{a as H}from"./chunk-54MMVNPT.js";import{a as G}from"./chunk-QXXIJAD5.js";import{c as ee}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Z}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{b as E}from"./chunk-SHMNA6UL.js";import{f as _}from"./chunk-V2U5CL3S.js";import"./chunk-XBDKZZ67.js";import{a as W}from"./chunk-XQCVZAGU.js";import{a as K,b as V,c as z,d as M,e as u,f}from"./chunk-MIQTKZAR.js";import{a as B,e as D}from"./chunk-UZERI5YC.js";import{d as A,h as O,m as T,q as X}from"./chunk-OG4N2XHD.js";import"./chunk-XNGYYOLS.js";import{a as c,e as R,f as oe,g as re,h as ae}from"./chunk-3XIESWL4.js";var U=R(re(),1),Y=R(oe(),1);var t=R(ae(),1);var se=R(re(),1);var Q=R(oe(),1);var h=R(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","Q"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"A"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"U"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,p=_(),r=A(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let g=await(d??(()=>p.listScheduledJobs()))();return le(g)}),[b,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),k,w;e[1]!==p||e[2]!==l?(k=c(()=>{if(l)return p.subscribeScheduledJobs(g=>{m(void 0),n(le(g))})},"v"),w=[l,p],e[1]=p,e[2]=l,e[3]=k,e[4]=w):(k=e[3],w=e[4]),(0,Q.useEffect)(k,w);let x;e[5]!==N?(x=c(()=>{N.refetch()},"j"),e[5]=N,e[6]=x):x=e[6],H(x,!l);let J=ce(p,i,d),v=b??N.data,j=s??N.error,q=c(async g=>{if(J!==void 0){m(void 0);try{await J(g),l||N.refetch()}catch(P){m(O(P))}}},"k"),I="flex flex-col gap-3",F="lunora-scheduled-jobs",C;e[7]!==j?(C=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=C):C=e[8];let S;e[9]!==v?.length||e[10]!==r?(S=v?.length===0&&(0,h.jsx)(W,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=v?.length,e[10]=r,e[11]=S):S=e[11];let $=v!==void 0&&v.length>0&&(0,h.jsx)(B,{className:"overflow-hidden py-0",children:(0,h.jsx)(D,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(M,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:v.map(g=>(0,h.jsxs)(M,{"data-testid":`sj-row-${g.id}`,children:[(0,h.jsx)(f,{className:"font-mono text-xs",children:g.functionPath}),(0,h.jsx)(f,{className:"text-muted-foreground tabular-nums",children:ie(g.scheduledFor)}),(0,h.jsx)(f,{className:"font-mono text-xs",children:g.pool??""}),(0,h.jsx)(f,{className:"tabular-nums",children:g.attempts??0}),(0,h.jsx)(f,{children:g.shardKey??""}),(0,h.jsx)(f,{className:"font-mono text-xs",children:g.id}),J!==void 0&&(0,h.jsx)(f,{className:"text-right",children:(0,h.jsx)(G,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{T(q(g.id))},"onConfirm"),testId:`sj-cancel-${g.id}`,children:r("Cancel")})})]},g.id))})]})})}),y;return e[12]!==$||e[13]!==C||e[14]!==S?(y=(0,h.jsxs)("div",{className:I,"data-testid":F,children:[C,S,$]}),e[12]=$,e[13]=C,e[14]=S,e[15]=y):y=e[15],y},"me");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"oe"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=_(),d=A(),[p,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,b=me(i,a,e),n=c(async s=>{if(b!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await b(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(k=>({...k,[s]:{kind:"error",message:O(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(W,{description:d("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:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),b!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=p[s.name]??he;return(0,t.jsxs)(M,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(f,{children:s.name}),(0,t.jsx)(f,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(f,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(f,{children:s.shardKey??""}),b!==void 0&&(0,t.jsx)(f,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(G,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{T(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),fe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","re"),pe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:p,retryJob:r}=i,l=_(),o=A(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let b;e[3]!==l||e[4]!==d?(b=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(ve),"h"),e[3]=l,e[4]=d,e[5]=b):b=e[5];let n=E(N,b),s=n.data,[m,k]=(0,Y.useState)(void 0),w=n.error??m,x=d===void 0,J;e[6]!==l||e[7]!==x||e[8]!==r?(J=r??(x?L=>l.retryDeadJob(L):void 0),e[6]=l,e[7]=x,e[8]=r,e[9]=J):J=e[9];let v=J,j;e[10]!==l||e[11]!==x||e[12]!==p?(j=p??(x?L=>l.removeDeadJob(L):void 0),e[10]=l,e[11]=x,e[12]=p,e[13]=j):j=e[13];let q=j,I;e[14]!==n?(I=c(()=>{n.refetch()},"J"),e[14]=n,e[15]=I):I=e[15],H(I,!0);let F;e[16]!==n?(F=c(async L=>{k(void 0);try{await L,n.refetch()}catch(ne){k(O(ne))}},"j"),e[16]=n,e[17]=F):F=e[17];let C=F,S=v!==void 0||q!==void 0,$;e[18]!==w?($=w!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:w}),e[18]=w,e[19]=$):$=e[19];let y;e[20]!==s?.length||e[21]!==o?(y=s?.length===0&&(0,t.jsx)(W,{description:o("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:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=y):y=e[22];let g;e[23]!==C||e[24]!==S||e[25]!==s||e[26]!==q||e[27]!==v||e[28]!==o?(g=s!==void 0&&s.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),S&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(L=>(0,t.jsxs)(M,{"data-testid":`dlq-row-${L.id}`,children:[(0,t.jsx)(f,{className:"font-mono text-xs",children:L.functionPath}),(0,t.jsx)(f,{className:"tabular-nums",children:L.attempts??0}),(0,t.jsx)(f,{className:"text-muted-foreground tabular-nums",children:fe(L.scheduledFor)}),(0,t.jsx)(f,{className:"font-mono text-xs",children:L.pool??""}),(0,t.jsx)(f,{children:L.shardKey??""}),(0,t.jsx)(f,{className:"font-mono text-xs",children:L.id}),S&&(0,t.jsx)(f,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${L.id}`,onClick:c(()=>{T(C(v(L.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),q!==void 0&&(0,t.jsx)(G,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{T(C(q(L.id)))},"onConfirm"),testId:`dlq-remove-${L.id}`,children:o("Drop")})]})})]},L.id))})]})})}),e[23]=C,e[24]=S,e[25]=s,e[26]=q,e[27]=v,e[28]=o,e[29]=g):g=e[29];let P;return e[30]!==g||e[31]!==$||e[32]!==y?(P=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,y,g]}),e[30]=g,e[31]=$,e[32]=y,e[33]=P):P=e[33],P},"ne");function ve(a,e){return(e.attempts??0)-(a.attempts??0)}c(ve,"ae");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:p}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==p?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:p}),e[2]=d,e[3]=p,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(B,{className:"flex-1 py-0",children:(0,t.jsxs)(D,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"F"),be=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,p=_(),r=A(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==p||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>p.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"k"),e[4]=p,e[5]=d,e[6]=N):N=e[6];let b=E(o,N),{data:n,error:s}=b,m;e[7]!==b?(m=c(()=>{b.refetch()},"s"),e[7]=b,e[8]=m):m=e[8],H(m,!0);let k;e[9]!==s?(k=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=k):k=e[10];let w;e[11]!==n||e[12]!==r?(w=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=w):w=e[13];let x;e[14]!==n?.pools.length||e[15]!==r?(x=n?.pools.length===0&&(0,t.jsx)(W,{description:r("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:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=x):x=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let v;return e[20]!==k||e[21]!==w||e[22]!==x||e[23]!==J?(v=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[k,w,x,J]}),e[20]=k,e[21]=w,e[22]=x,e[23]=J,e[24]=v):v=e[24],v},"de");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(M,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(f,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(f,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(f,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(f,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"se");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:p,scheduledLoad:r}=i,l=A(),[o,N]=(0,Y.useState)("jobs"),b;e[2]!==l?(b=l("Cron triggers"),e[2]=l,e[3]=b):b=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let k;e[10]!==b||e[11]!==n||e[12]!==s||e[13]!==m?(k={cron:b,dead:n,jobs:s,pools:m},e[10]=b,e[11]=n,e[12]=s,e[13]=m,e[14]=k):k=e[14];let w=k,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=c(y=>{N(y.currentTarget.dataset.view)},"u"),e[15]=x):x=e[15];let J=x,v;e[16]!==l?(v=l("Schedule view"),e[16]=l,e[17]=v):v=e[17];let j;e[18]!==o||e[19]!==w?(j=Ne.map(y=>(0,t.jsx)(ee,{"aria-selected":o===y,"data-testid":`schedule-view-${y}`,"data-view":y,onClick:J,role:"tab",size:"sm",type:"button",variant:o===y?"default":"outline",children:w[y]},y)),e[18]=o,e[19]=w,e[20]=j):j=e[20];let q;e[21]!==v||e[22]!==j?(q=(0,t.jsx)("div",{"aria-label":v,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=v,e[22]=j,e[23]=q):q=e[23];let I;e[24]!==p||e[25]!==r||e[26]!==o?(I=o==="jobs"&&(0,t.jsx)(de,{cancelJob:p,loadJobs:r}),e[24]=p,e[25]=r,e[26]=o,e[27]=I):I=e[27];let F;e[28]!==o?(F=o==="dead"&&(0,t.jsx)(pe,{}),e[28]=o,e[29]=F):F=e[29];let C;e[30]!==o?(C=o==="pools"&&(0,t.jsx)(be,{}),e[30]=o,e[31]=C):C=e[31];let S;e[32]!==d||e[33]!==o?(S=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=S):S=e[34];let $;return e[35]!==q||e[36]!==I||e[37]!==F||e[38]!==C||e[39]!==S?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[q,I,F,C,S]}),e[35]=q,e[36]=I,e[37]=F,e[38]=C,e[39]=S,e[40]=$):$=e[40],$},"Je");export{Ve as SchedulePanel};
1
+ import{a as H}from"./chunk-54MMVNPT.js";import{a as G}from"./chunk-AREBQI6D.js";import{c as ee}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Z}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{b as E}from"./chunk-4D7XIQ5Q.js";import{f as _}from"./chunk-DBWOWJYT.js";import"./chunk-XBDKZZ67.js";import{a as W}from"./chunk-XQCVZAGU.js";import{a as K,b as V,c as z,d as M,e as u,f}from"./chunk-MIQTKZAR.js";import{a as B,e as D}from"./chunk-UZERI5YC.js";import{d as A,h as O,o as T,r as X}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as c,e as R,f as oe,g as re,h as ae}from"./chunk-3XIESWL4.js";var U=R(re(),1),Y=R(oe(),1);var t=R(ae(),1);var se=R(re(),1);var Q=R(oe(),1);var h=R(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","Q"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"A"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"U"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,p=_(),r=A(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let g=await(d??(()=>p.listScheduledJobs()))();return le(g)}),[b,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),k,w;e[1]!==p||e[2]!==l?(k=c(()=>{if(l)return p.subscribeScheduledJobs(g=>{m(void 0),n(le(g))})},"v"),w=[l,p],e[1]=p,e[2]=l,e[3]=k,e[4]=w):(k=e[3],w=e[4]),(0,Q.useEffect)(k,w);let x;e[5]!==N?(x=c(()=>{N.refetch()},"j"),e[5]=N,e[6]=x):x=e[6],H(x,!l);let J=ce(p,i,d),v=b??N.data,j=s??N.error,q=c(async g=>{if(J!==void 0){m(void 0);try{await J(g),l||N.refetch()}catch(P){m(O(P))}}},"k"),I="flex flex-col gap-3",F="lunora-scheduled-jobs",C;e[7]!==j?(C=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=C):C=e[8];let S;e[9]!==v?.length||e[10]!==r?(S=v?.length===0&&(0,h.jsx)(W,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=v?.length,e[10]=r,e[11]=S):S=e[11];let $=v!==void 0&&v.length>0&&(0,h.jsx)(B,{className:"overflow-hidden py-0",children:(0,h.jsx)(D,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(M,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:v.map(g=>(0,h.jsxs)(M,{"data-testid":`sj-row-${g.id}`,children:[(0,h.jsx)(f,{className:"font-mono text-xs",children:g.functionPath}),(0,h.jsx)(f,{className:"text-muted-foreground tabular-nums",children:ie(g.scheduledFor)}),(0,h.jsx)(f,{className:"font-mono text-xs",children:g.pool??""}),(0,h.jsx)(f,{className:"tabular-nums",children:g.attempts??0}),(0,h.jsx)(f,{children:g.shardKey??""}),(0,h.jsx)(f,{className:"font-mono text-xs",children:g.id}),J!==void 0&&(0,h.jsx)(f,{className:"text-right",children:(0,h.jsx)(G,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{T(q(g.id))},"onConfirm"),testId:`sj-cancel-${g.id}`,children:r("Cancel")})})]},g.id))})]})})}),y;return e[12]!==$||e[13]!==C||e[14]!==S?(y=(0,h.jsxs)("div",{className:I,"data-testid":F,children:[C,S,$]}),e[12]=$,e[13]=C,e[14]=S,e[15]=y):y=e[15],y},"me");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"oe"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=_(),d=A(),[p,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,b=me(i,a,e),n=c(async s=>{if(b!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await b(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(k=>({...k,[s]:{kind:"error",message:O(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(W,{description:d("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:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),b!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=p[s.name]??he;return(0,t.jsxs)(M,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(f,{children:s.name}),(0,t.jsx)(f,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(f,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(f,{children:s.shardKey??""}),b!==void 0&&(0,t.jsx)(f,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(G,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{T(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),fe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","re"),pe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:p,retryJob:r}=i,l=_(),o=A(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let b;e[3]!==l||e[4]!==d?(b=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(ve),"h"),e[3]=l,e[4]=d,e[5]=b):b=e[5];let n=E(N,b),s=n.data,[m,k]=(0,Y.useState)(void 0),w=n.error??m,x=d===void 0,J;e[6]!==l||e[7]!==x||e[8]!==r?(J=r??(x?L=>l.retryDeadJob(L):void 0),e[6]=l,e[7]=x,e[8]=r,e[9]=J):J=e[9];let v=J,j;e[10]!==l||e[11]!==x||e[12]!==p?(j=p??(x?L=>l.removeDeadJob(L):void 0),e[10]=l,e[11]=x,e[12]=p,e[13]=j):j=e[13];let q=j,I;e[14]!==n?(I=c(()=>{n.refetch()},"J"),e[14]=n,e[15]=I):I=e[15],H(I,!0);let F;e[16]!==n?(F=c(async L=>{k(void 0);try{await L,n.refetch()}catch(ne){k(O(ne))}},"j"),e[16]=n,e[17]=F):F=e[17];let C=F,S=v!==void 0||q!==void 0,$;e[18]!==w?($=w!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:w}),e[18]=w,e[19]=$):$=e[19];let y;e[20]!==s?.length||e[21]!==o?(y=s?.length===0&&(0,t.jsx)(W,{description:o("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:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=y):y=e[22];let g;e[23]!==C||e[24]!==S||e[25]!==s||e[26]!==q||e[27]!==v||e[28]!==o?(g=s!==void 0&&s.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),S&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(L=>(0,t.jsxs)(M,{"data-testid":`dlq-row-${L.id}`,children:[(0,t.jsx)(f,{className:"font-mono text-xs",children:L.functionPath}),(0,t.jsx)(f,{className:"tabular-nums",children:L.attempts??0}),(0,t.jsx)(f,{className:"text-muted-foreground tabular-nums",children:fe(L.scheduledFor)}),(0,t.jsx)(f,{className:"font-mono text-xs",children:L.pool??""}),(0,t.jsx)(f,{children:L.shardKey??""}),(0,t.jsx)(f,{className:"font-mono text-xs",children:L.id}),S&&(0,t.jsx)(f,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${L.id}`,onClick:c(()=>{T(C(v(L.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),q!==void 0&&(0,t.jsx)(G,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{T(C(q(L.id)))},"onConfirm"),testId:`dlq-remove-${L.id}`,children:o("Drop")})]})})]},L.id))})]})})}),e[23]=C,e[24]=S,e[25]=s,e[26]=q,e[27]=v,e[28]=o,e[29]=g):g=e[29];let P;return e[30]!==g||e[31]!==$||e[32]!==y?(P=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,y,g]}),e[30]=g,e[31]=$,e[32]=y,e[33]=P):P=e[33],P},"ne");function ve(a,e){return(e.attempts??0)-(a.attempts??0)}c(ve,"ae");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:p}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==p?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:p}),e[2]=d,e[3]=p,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(B,{className:"flex-1 py-0",children:(0,t.jsxs)(D,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"F"),be=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,p=_(),r=A(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==p||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>p.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"k"),e[4]=p,e[5]=d,e[6]=N):N=e[6];let b=E(o,N),{data:n,error:s}=b,m;e[7]!==b?(m=c(()=>{b.refetch()},"s"),e[7]=b,e[8]=m):m=e[8],H(m,!0);let k;e[9]!==s?(k=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=k):k=e[10];let w;e[11]!==n||e[12]!==r?(w=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=w):w=e[13];let x;e[14]!==n?.pools.length||e[15]!==r?(x=n?.pools.length===0&&(0,t.jsx)(W,{description:r("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:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=x):x=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let v;return e[20]!==k||e[21]!==w||e[22]!==x||e[23]!==J?(v=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[k,w,x,J]}),e[20]=k,e[21]=w,e[22]=x,e[23]=J,e[24]=v):v=e[24],v},"de");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(M,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(f,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(f,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(f,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(f,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"se");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:p,scheduledLoad:r}=i,l=A(),[o,N]=(0,Y.useState)("jobs"),b;e[2]!==l?(b=l("Cron triggers"),e[2]=l,e[3]=b):b=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let k;e[10]!==b||e[11]!==n||e[12]!==s||e[13]!==m?(k={cron:b,dead:n,jobs:s,pools:m},e[10]=b,e[11]=n,e[12]=s,e[13]=m,e[14]=k):k=e[14];let w=k,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=c(y=>{N(y.currentTarget.dataset.view)},"u"),e[15]=x):x=e[15];let J=x,v;e[16]!==l?(v=l("Schedule view"),e[16]=l,e[17]=v):v=e[17];let j;e[18]!==o||e[19]!==w?(j=Ne.map(y=>(0,t.jsx)(ee,{"aria-selected":o===y,"data-testid":`schedule-view-${y}`,"data-view":y,onClick:J,role:"tab",size:"sm",type:"button",variant:o===y?"default":"outline",children:w[y]},y)),e[18]=o,e[19]=w,e[20]=j):j=e[20];let q;e[21]!==v||e[22]!==j?(q=(0,t.jsx)("div",{"aria-label":v,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=v,e[22]=j,e[23]=q):q=e[23];let I;e[24]!==p||e[25]!==r||e[26]!==o?(I=o==="jobs"&&(0,t.jsx)(de,{cancelJob:p,loadJobs:r}),e[24]=p,e[25]=r,e[26]=o,e[27]=I):I=e[27];let F;e[28]!==o?(F=o==="dead"&&(0,t.jsx)(pe,{}),e[28]=o,e[29]=F):F=e[29];let C;e[30]!==o?(C=o==="pools"&&(0,t.jsx)(be,{}),e[30]=o,e[31]=C):C=e[31];let S;e[32]!==d||e[33]!==o?(S=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=S):S=e[34];let $;return e[35]!==q||e[36]!==I||e[37]!==F||e[38]!==C||e[39]!==S?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[q,I,F,C,S]}),e[35]=q,e[36]=I,e[37]=F,e[38]=C,e[39]=S,e[40]=$):$=e[40],$},"Je");export{Ve as SchedulePanel};
@@ -1 +1 @@
1
- import{a as N}from"./chunk-EQZTSISX.js";import{a as z}from"./chunk-54MMVNPT.js";import{a as q}from"./chunk-3CWGJYBB.js";import{a as W}from"./chunk-X665E2HU.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as R}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as B}from"./chunk-LJIFMW67.js";import"./chunk-XXQUMVWH.js";import"./chunk-QWBRD6PX.js";import"./chunk-QLQADHFE.js";import{a as L}from"./chunk-VDW32UET.js";import{c as E}from"./chunk-SHMNA6UL.js";import"./chunk-V2U5CL3S.js";import"./chunk-XBDKZZ67.js";import{a as A}from"./chunk-XQCVZAGU.js";import{a as H,b as O,c as U,d as K,e as T,f as D}from"./chunk-MIQTKZAR.js";import{a as _}from"./chunk-UZERI5YC.js";import{d as j}from"./chunk-OG4N2XHD.js";import"./chunk-XNGYYOLS.js";import{a as M,e as F,g as V,h as X}from"./chunk-3XIESWL4.js";var P=F(V(),1);var t=F(X(),1);var G=M(n=>`${n.toString()} ms`,"D"),Q=M(n=>n.totalConnections===0&&n.shapePoke.passes===0&&n.whisper.passes===0,"z"),J=M(n=>{let e=(0,P.c)(48),{counters:r,includeTiming:s,prefix:l,t:o,title:b}=n,k=`${l}-section`,p;e[0]!==b?(p=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:b}),e[0]=b,e[1]=p):p=e[1];let a=`${l}-stats`,i;e[2]!==o?(i=o("Passes"),e[2]=o,e[3]=i):i=e[3];let I=`${l}-passes`,v;e[4]!==r.passes||e[5]!==i||e[6]!==I?(v=(0,t.jsx)(N,{label:i,testId:I,value:r.passes}),e[4]=r.passes,e[5]=i,e[6]=I,e[7]=v):v=e[7];let h;e[8]!==o?(h=o("Sockets iterated"),e[8]=o,e[9]=h):h=e[9];let x=`${l}-iterated`,c;e[10]!==r.socketsIterated||e[11]!==h||e[12]!==x?(c=(0,t.jsx)(N,{label:h,testId:x,value:r.socketsIterated}),e[10]=r.socketsIterated,e[11]=h,e[12]=x,e[13]=c):c=e[13];let d;e[14]!==o?(d=o("Delivered"),e[14]=o,e[15]=d):d=e[15];let y=`${l}-delivered`,m;e[16]!==r.socketsDelivered||e[17]!==d||e[18]!==y?(m=(0,t.jsx)(N,{label:d,testId:y,value:r.socketsDelivered}),e[16]=r.socketsDelivered,e[17]=d,e[18]=y,e[19]=m):m=e[19];let u;e[20]!==o?(u=o("Peak width"),e[20]=o,e[21]=u):u=e[21];let g=`${l}-peak`,f;e[22]!==r.peakSocketsIterated||e[23]!==u||e[24]!==g?(f=(0,t.jsx)(N,{label:u,testId:g,value:r.peakSocketsIterated}),e[22]=r.peakSocketsIterated,e[23]=u,e[24]=g,e[25]=f):f=e[25];let S;e[26]!==r.totalMs||e[27]!==s||e[28]!==l||e[29]!==o?(S=s&&(0,t.jsx)(N,{label:o("Total time"),testId:`${l}-total-ms`,value:G(r.totalMs)}),e[26]=r.totalMs,e[27]=s,e[28]=l,e[29]=o,e[30]=S):S=e[30];let C;e[31]!==r.maxMs||e[32]!==s||e[33]!==l||e[34]!==o?(C=s&&(0,t.jsx)(N,{label:o("Max time"),testId:`${l}-max-ms`,value:G(r.maxMs)}),e[31]=r.maxMs,e[32]=s,e[33]=l,e[34]=o,e[35]=C):C=e[35];let $;e[36]!==m||e[37]!==f||e[38]!==S||e[39]!==C||e[40]!==a||e[41]!==v||e[42]!==c?($=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":a,children:[v,c,m,f,S,C]}),e[36]=m,e[37]=f,e[38]=S,e[39]=C,e[40]=a,e[41]=v,e[42]=c,e[43]=$):$=e[43];let w;return e[44]!==k||e[45]!==$||e[46]!==p?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":k,children:[p,$]}),e[44]=k,e[45]=$,e[46]=p,e[47]=w):w=e[47],w},"F"),me=M(n=>{let e=(0,P.c)(31),{initialShardKey:r}=n,s=j(),{queryShardKey:l,setShardKey:o,shardKey:b}=q(r),k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={},e[0]=k):k=e[0];let p;e[1]!==l?(p={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=p):p=e[2];let{data:a,error:i,errorSource:I,refetch:v}=E(L.getFanoutMetrics,k,p);z(v,!0);let h;e[3]!==a?(h=a!==void 0&&Q(a),e[3]=a,e[4]=h):h=e[4];let x=h,c;e[5]!==o||e[6]!==b?(c=(0,t.jsx)(W,{onChange:o,testId:"fanout-shard-input",value:b}),e[5]=o,e[6]=b,e[7]=c):c=e[7];let d;e[8]!==a||e[9]!==s?(d=a!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[a.promoted&&(0,t.jsx)(R,{"data-testid":"fanout-promoted",variant:a.relayCount>=a.maxRelays?"destructive":"default",children:a.relayCount>=a.maxRelays?s("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:a.maxRelays,relayCount:a.relayCount}):s("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:a.maxRelays,relayCount:a.relayCount})}),(0,t.jsx)(R,{variant:"secondary",children:s("{count} connections",{count:a.totalConnections})}),(0,t.jsx)(R,{variant:"secondary",children:s("peak {count} subscribers",{count:a.peakSubscribers})})]}),e[8]=a,e[9]=s,e[10]=d):d=e[10];let y;e[11]!==c||e[12]!==d?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[11]=c,e[12]=d,e[13]=y):y=e[13];let m;e[14]!==i||e[15]!==I?(m=i!==null&&(0,t.jsx)(B,{error:I,testId:"fanout-error"}),e[14]=i,e[15]=I,e[16]=m):m=e[16];let u;e[17]!==i||e[18]!==x||e[19]!==s?(u=i===null&&x&&(0,t.jsx)(A,{description:s("Realtime fan-out cost and per-topic subscriber counts for this shard."),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 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:s("No fan-out activity yet.")}),e[17]=i,e[18]=x,e[19]=s,e[20]=u):u=e[20];let g;e[21]!==i||e[22]!==x||e[23]!==a||e[24]!==s?(g=i===null&&a!==void 0&&!x&&(0,t.jsxs)(t.Fragment,{children:[a.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:s("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(H,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(O,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:s("Topic")}),(0,t.jsx)(T,{children:s("Kind")}),(0,t.jsx)(T,{className:"text-right",children:s("Subscribers")})]})}),(0,t.jsx)(U,{children:a.topics.map(Y)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("Fan-out cost since this instance woke")}),(0,t.jsx)(J,{counters:a.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:s,title:s("Shape pokes")}),(0,t.jsx)(J,{counters:a.whisper,includeTiming:!1,prefix:"fanout-whisper",t:s,title:s("Whisper broadcasts")})]})]}),e[21]=i,e[22]=x,e[23]=a,e[24]=s,e[25]=g):g=e[25];let f;return e[26]!==y||e[27]!==m||e[28]!==u||e[29]!==g?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,m,u,g]}),e[26]=y,e[27]=m,e[28]=u,e[29]=g,e[30]=f):f=e[30],f},"me");function Y(n){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:n.topic}),(0,t.jsx)(D,{children:(0,t.jsx)(R,{variant:"outline",children:n.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:n.subscribers})]},`${n.kind}:${n.topic}`)}M(Y,"G");export{me as default};
1
+ import{a as N}from"./chunk-EQZTSISX.js";import{a as z}from"./chunk-54MMVNPT.js";import{a as q}from"./chunk-3CWGJYBB.js";import{a as W}from"./chunk-RMN2JN4S.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as R}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as B}from"./chunk-ZKTWHB7Q.js";import"./chunk-XXQUMVWH.js";import"./chunk-NH3VWHCL.js";import"./chunk-QLQADHFE.js";import{a as L}from"./chunk-VDW32UET.js";import{c as E}from"./chunk-4D7XIQ5Q.js";import"./chunk-DBWOWJYT.js";import"./chunk-XBDKZZ67.js";import{a as A}from"./chunk-XQCVZAGU.js";import{a as H,b as O,c as U,d as K,e as T,f as D}from"./chunk-MIQTKZAR.js";import{a as _}from"./chunk-UZERI5YC.js";import{d as j}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as M,e as F,g as V,h as X}from"./chunk-3XIESWL4.js";var P=F(V(),1);var t=F(X(),1);var G=M(n=>`${n.toString()} ms`,"D"),Q=M(n=>n.totalConnections===0&&n.shapePoke.passes===0&&n.whisper.passes===0,"z"),J=M(n=>{let e=(0,P.c)(48),{counters:r,includeTiming:s,prefix:l,t:o,title:b}=n,k=`${l}-section`,p;e[0]!==b?(p=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:b}),e[0]=b,e[1]=p):p=e[1];let a=`${l}-stats`,i;e[2]!==o?(i=o("Passes"),e[2]=o,e[3]=i):i=e[3];let I=`${l}-passes`,v;e[4]!==r.passes||e[5]!==i||e[6]!==I?(v=(0,t.jsx)(N,{label:i,testId:I,value:r.passes}),e[4]=r.passes,e[5]=i,e[6]=I,e[7]=v):v=e[7];let h;e[8]!==o?(h=o("Sockets iterated"),e[8]=o,e[9]=h):h=e[9];let x=`${l}-iterated`,c;e[10]!==r.socketsIterated||e[11]!==h||e[12]!==x?(c=(0,t.jsx)(N,{label:h,testId:x,value:r.socketsIterated}),e[10]=r.socketsIterated,e[11]=h,e[12]=x,e[13]=c):c=e[13];let d;e[14]!==o?(d=o("Delivered"),e[14]=o,e[15]=d):d=e[15];let y=`${l}-delivered`,m;e[16]!==r.socketsDelivered||e[17]!==d||e[18]!==y?(m=(0,t.jsx)(N,{label:d,testId:y,value:r.socketsDelivered}),e[16]=r.socketsDelivered,e[17]=d,e[18]=y,e[19]=m):m=e[19];let u;e[20]!==o?(u=o("Peak width"),e[20]=o,e[21]=u):u=e[21];let g=`${l}-peak`,f;e[22]!==r.peakSocketsIterated||e[23]!==u||e[24]!==g?(f=(0,t.jsx)(N,{label:u,testId:g,value:r.peakSocketsIterated}),e[22]=r.peakSocketsIterated,e[23]=u,e[24]=g,e[25]=f):f=e[25];let S;e[26]!==r.totalMs||e[27]!==s||e[28]!==l||e[29]!==o?(S=s&&(0,t.jsx)(N,{label:o("Total time"),testId:`${l}-total-ms`,value:G(r.totalMs)}),e[26]=r.totalMs,e[27]=s,e[28]=l,e[29]=o,e[30]=S):S=e[30];let C;e[31]!==r.maxMs||e[32]!==s||e[33]!==l||e[34]!==o?(C=s&&(0,t.jsx)(N,{label:o("Max time"),testId:`${l}-max-ms`,value:G(r.maxMs)}),e[31]=r.maxMs,e[32]=s,e[33]=l,e[34]=o,e[35]=C):C=e[35];let $;e[36]!==m||e[37]!==f||e[38]!==S||e[39]!==C||e[40]!==a||e[41]!==v||e[42]!==c?($=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":a,children:[v,c,m,f,S,C]}),e[36]=m,e[37]=f,e[38]=S,e[39]=C,e[40]=a,e[41]=v,e[42]=c,e[43]=$):$=e[43];let w;return e[44]!==k||e[45]!==$||e[46]!==p?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":k,children:[p,$]}),e[44]=k,e[45]=$,e[46]=p,e[47]=w):w=e[47],w},"F"),me=M(n=>{let e=(0,P.c)(31),{initialShardKey:r}=n,s=j(),{queryShardKey:l,setShardKey:o,shardKey:b}=q(r),k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={},e[0]=k):k=e[0];let p;e[1]!==l?(p={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=p):p=e[2];let{data:a,error:i,errorSource:I,refetch:v}=E(L.getFanoutMetrics,k,p);z(v,!0);let h;e[3]!==a?(h=a!==void 0&&Q(a),e[3]=a,e[4]=h):h=e[4];let x=h,c;e[5]!==o||e[6]!==b?(c=(0,t.jsx)(W,{onChange:o,testId:"fanout-shard-input",value:b}),e[5]=o,e[6]=b,e[7]=c):c=e[7];let d;e[8]!==a||e[9]!==s?(d=a!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[a.promoted&&(0,t.jsx)(R,{"data-testid":"fanout-promoted",variant:a.relayCount>=a.maxRelays?"destructive":"default",children:a.relayCount>=a.maxRelays?s("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:a.maxRelays,relayCount:a.relayCount}):s("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:a.maxRelays,relayCount:a.relayCount})}),(0,t.jsx)(R,{variant:"secondary",children:s("{count} connections",{count:a.totalConnections})}),(0,t.jsx)(R,{variant:"secondary",children:s("peak {count} subscribers",{count:a.peakSubscribers})})]}),e[8]=a,e[9]=s,e[10]=d):d=e[10];let y;e[11]!==c||e[12]!==d?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[11]=c,e[12]=d,e[13]=y):y=e[13];let m;e[14]!==i||e[15]!==I?(m=i!==null&&(0,t.jsx)(B,{error:I,testId:"fanout-error"}),e[14]=i,e[15]=I,e[16]=m):m=e[16];let u;e[17]!==i||e[18]!==x||e[19]!==s?(u=i===null&&x&&(0,t.jsx)(A,{description:s("Realtime fan-out cost and per-topic subscriber counts for this shard."),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 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:s("No fan-out activity yet.")}),e[17]=i,e[18]=x,e[19]=s,e[20]=u):u=e[20];let g;e[21]!==i||e[22]!==x||e[23]!==a||e[24]!==s?(g=i===null&&a!==void 0&&!x&&(0,t.jsxs)(t.Fragment,{children:[a.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:s("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(H,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(O,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:s("Topic")}),(0,t.jsx)(T,{children:s("Kind")}),(0,t.jsx)(T,{className:"text-right",children:s("Subscribers")})]})}),(0,t.jsx)(U,{children:a.topics.map(Y)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("Fan-out cost since this instance woke")}),(0,t.jsx)(J,{counters:a.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:s,title:s("Shape pokes")}),(0,t.jsx)(J,{counters:a.whisper,includeTiming:!1,prefix:"fanout-whisper",t:s,title:s("Whisper broadcasts")})]})]}),e[21]=i,e[22]=x,e[23]=a,e[24]=s,e[25]=g):g=e[25];let f;return e[26]!==y||e[27]!==m||e[28]!==u||e[29]!==g?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,m,u,g]}),e[26]=y,e[27]=m,e[28]=u,e[29]=g,e[30]=f):f=e[30],f},"me");function Y(n){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:n.topic}),(0,t.jsx)(D,{children:(0,t.jsx)(R,{variant:"outline",children:n.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:n.subscribers})]},`${n.kind}:${n.topic}`)}M(Y,"G");export{me as default};
@@ -1 +1 @@
1
- import{a as f}from"./chunk-5Y3QLNWX.js";import{a as U}from"./chunk-54MMVNPT.js";import{a as C}from"./chunk-QXXIJAD5.js";import{R as v}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as O}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as L}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as w}from"./chunk-VDW32UET.js";import{f as P}from"./chunk-V2U5CL3S.js";import"./chunk-XBDKZZ67.js";import{d as q,f as y,g as c,h,m as p}from"./chunk-OG4N2XHD.js";import"./chunk-XNGYYOLS.js";import{a as o,e as T,f as W,h as $}from"./chunk-3XIESWL4.js";var a=T(W(),1);var e=T($(),1);var R=y(w.getPitrBookmark),V=y(w.pitrRestore),ne=o(({initialShardKey:j})=>{let m=P(),r=q(),i=j??"",[z,x]=(0,a.useState)(null),[l,A]=(0,a.useState)(""),[B,I]=(0,a.useState)(null),[u,D]=(0,a.useState)(""),[k,E]=(0,a.useState)(!1),[s,K]=(0,a.useState)(null),[F,n]=(0,a.useState)(null),[b,d]=(0,a.useState)(!1),g=(0,a.useCallback)(async()=>{d(!0),n(null);try{let t=await m.query(R,{},c(i));x(t.current)}catch(t){n(h(t))}d(!1)},[m,i]);(0,a.useEffect)(()=>{p(g())},[g]),U(()=>{p((async()=>{try{let t=await m.query(R,{},c(i));x(t.current)}catch{}})())},!0);let M=o(t=>{A(t.target.value)},"U"),Z=o(t=>{D(t.target.value)},"j"),_=o(t=>{E(t.target.checked)},"M"),G=o(()=>{l.trim()!==""&&p((async()=>{d(!0),n(null);try{let t=await m.query(R,{time:l.trim()},c(i));I(t.forTime??null),x(t.current)}catch(t){I(null),n(h(t))}d(!1)})())},"z"),S=o(t=>{p((async()=>{d(!0),n(null);try{let N=await m.mutation(V,t,c(i));K(N),await g()}catch(N){n(h(N))}d(!1)})())},"R"),H=u.trim()!==""||l.trim()!=="",J=o(()=>{let t=k?{restart:!0}:{};u.trim()===""?t.time=l.trim():t.bookmark=u.trim(),S(t)},"$"),Q=o(()=>{s!==null&&S(k?{bookmark:s.undoBookmark,restart:!0}:{bookmark:s.undoBookmark})},"D");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r("Shard"),": ",(0,e.jsx)("span",{className:"font-mono",children:i===""?r("root"):i})]})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:r("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")}),F!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:F}),(0,e.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:r("Current bookmark")}),(0,e.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:z??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore")}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-time",children:r("Time (ISO or epoch-ms, last 30 days)")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(v,{"data-testid":"pitr-time",id:"pitr-time",onChange:M,placeholder:"2026-06-01T00:00:00.000Z",value:l}),(0,e.jsx)(O,{"data-testid":"pitr-preview",disabled:b||l.trim()==="",onClick:G,size:"sm",type:"button",variant:"outline",children:r("Preview")})]}),B!==null&&(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[r("Bookmark for that time"),": ",B]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-bookmark",children:r("Or an explicit bookmark (wins over time)")}),(0,e.jsx)(v,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:Z,placeholder:r("bookmark string"),value:u})]}),(0,e.jsxs)(f,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[(0,e.jsx)("input",{checked:k,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:_,type:"checkbox"}),r("Restart the shard now so recovery applies immediately")]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm restore"),disabled:b||!H,onConfirm:J,testId:"pitr-restore",children:r("Restore")})})]}),s!==null&&(0,e.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore armed")}),(0,e.jsx)(L,{variant:s.restarted?"destructive":"secondary",children:s.restarted?r("restarted now"):r("on next restart")})]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[r("Restored to"),": ",s.restoredTo]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[r("Undo bookmark"),": ",s.undoBookmark]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm undo"),disabled:b,onConfirm:Q,testId:"pitr-undo",children:r("Undo restore")})})]})]})},"de");export{ne as PitrPanel};
1
+ import{a as f}from"./chunk-5Y3QLNWX.js";import{a as U}from"./chunk-54MMVNPT.js";import{a as C}from"./chunk-AREBQI6D.js";import{R as v}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as O}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as L}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as w}from"./chunk-VDW32UET.js";import{f as P}from"./chunk-DBWOWJYT.js";import"./chunk-XBDKZZ67.js";import{d as q,f as y,g as c,h,o as p}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as o,e as T,f as W,h as $}from"./chunk-3XIESWL4.js";var a=T(W(),1);var e=T($(),1);var R=y(w.getPitrBookmark),V=y(w.pitrRestore),ne=o(({initialShardKey:j})=>{let m=P(),r=q(),i=j??"",[z,x]=(0,a.useState)(null),[l,A]=(0,a.useState)(""),[B,I]=(0,a.useState)(null),[u,D]=(0,a.useState)(""),[k,E]=(0,a.useState)(!1),[s,K]=(0,a.useState)(null),[F,n]=(0,a.useState)(null),[b,d]=(0,a.useState)(!1),g=(0,a.useCallback)(async()=>{d(!0),n(null);try{let t=await m.query(R,{},c(i));x(t.current)}catch(t){n(h(t))}d(!1)},[m,i]);(0,a.useEffect)(()=>{p(g())},[g]),U(()=>{p((async()=>{try{let t=await m.query(R,{},c(i));x(t.current)}catch{}})())},!0);let M=o(t=>{A(t.target.value)},"U"),Z=o(t=>{D(t.target.value)},"j"),_=o(t=>{E(t.target.checked)},"M"),G=o(()=>{l.trim()!==""&&p((async()=>{d(!0),n(null);try{let t=await m.query(R,{time:l.trim()},c(i));I(t.forTime??null),x(t.current)}catch(t){I(null),n(h(t))}d(!1)})())},"z"),S=o(t=>{p((async()=>{d(!0),n(null);try{let N=await m.mutation(V,t,c(i));K(N),await g()}catch(N){n(h(N))}d(!1)})())},"R"),H=u.trim()!==""||l.trim()!=="",J=o(()=>{let t=k?{restart:!0}:{};u.trim()===""?t.time=l.trim():t.bookmark=u.trim(),S(t)},"$"),Q=o(()=>{s!==null&&S(k?{bookmark:s.undoBookmark,restart:!0}:{bookmark:s.undoBookmark})},"D");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r("Shard"),": ",(0,e.jsx)("span",{className:"font-mono",children:i===""?r("root"):i})]})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:r("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")}),F!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:F}),(0,e.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:r("Current bookmark")}),(0,e.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:z??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore")}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-time",children:r("Time (ISO or epoch-ms, last 30 days)")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(v,{"data-testid":"pitr-time",id:"pitr-time",onChange:M,placeholder:"2026-06-01T00:00:00.000Z",value:l}),(0,e.jsx)(O,{"data-testid":"pitr-preview",disabled:b||l.trim()==="",onClick:G,size:"sm",type:"button",variant:"outline",children:r("Preview")})]}),B!==null&&(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[r("Bookmark for that time"),": ",B]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(f,{htmlFor:"pitr-bookmark",children:r("Or an explicit bookmark (wins over time)")}),(0,e.jsx)(v,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:Z,placeholder:r("bookmark string"),value:u})]}),(0,e.jsxs)(f,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[(0,e.jsx)("input",{checked:k,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:_,type:"checkbox"}),r("Restart the shard now so recovery applies immediately")]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm restore"),disabled:b||!H,onConfirm:J,testId:"pitr-restore",children:r("Restore")})})]}),s!==null&&(0,e.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:r("Restore armed")}),(0,e.jsx)(L,{variant:s.restarted?"destructive":"secondary",children:s.restarted?r("restarted now"):r("on next restart")})]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[r("Restored to"),": ",s.restoredTo]}),(0,e.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[r("Undo bookmark"),": ",s.undoBookmark]}),(0,e.jsx)("div",{children:(0,e.jsx)(C,{confirmLabel:r("Confirm undo"),disabled:b,onConfirm:Q,testId:"pitr-undo",children:r("Undo restore")})})]})]})},"de");export{ne as PitrPanel};
@@ -1 +1 @@
1
- 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 S}from"./chunk-LJIFMW67.js";import"./chunk-XXQUMVWH.js";import"./chunk-QWBRD6PX.js";import"./chunk-QLQADHFE.js";import{a as f}from"./chunk-VDW32UET.js";import{c as p}from"./chunk-SHMNA6UL.js";import"./chunk-V2U5CL3S.js";import"./chunk-XBDKZZ67.js";import{a as T}from"./chunk-XQCVZAGU.js";import{a as C,b as j,c as I,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{d as z,q as B}from"./chunk-OG4N2XHD.js";import"./chunk-XNGYYOLS.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"),K=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)(j,{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)(I,{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:K(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(K(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)(j,{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)(I,{children:E.map((r,d)=>{let c=l(r,"role")??"\u2014",g=re(r),V=l(r,"toolName"),y=l(r,"status"),N=K(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};
1
+ 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 S}from"./chunk-ZKTWHB7Q.js";import"./chunk-XXQUMVWH.js";import"./chunk-NH3VWHCL.js";import"./chunk-QLQADHFE.js";import{a as f}from"./chunk-VDW32UET.js";import{c as p}from"./chunk-4D7XIQ5Q.js";import"./chunk-DBWOWJYT.js";import"./chunk-XBDKZZ67.js";import{a as T}from"./chunk-XQCVZAGU.js";import{a as C,b as j,c as I,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{d as z,r as B}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.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"),K=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)(j,{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)(I,{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:K(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(K(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)(j,{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)(I,{children:E.map((r,d)=>{let c=l(r,"role")??"\u2014",g=re(r),V=l(r,"toolName"),y=l(r,"status"),N=K(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};
@@ -1 +1 @@
1
- import{a as y}from"./chunk-GRL5MG3Z.js";import{R as k}from"./chunk-CFPZYHPY.js";import{d as j}from"./chunk-OG4N2XHD.js";import{a as m,e as b,f as w,g as F,h as $}from"./chunk-3XIESWL4.js";var C=b(F(),1),h=b(w(),1);var a=b($(),1);var B=m(i=>{let t=(0,C.c)(21),{id:f,onChange:g,testId:e,value:v}=i,r=j(),u=(0,h.useId)(),[d]=(0,h.useState)(A),c;t[0]!==g?(c=m(S=>{g(S.target.value)},"m"),t[0]=g,t[1]=c):c=t[1];let x=c,s;t[2]!==r?(s=r("Shard key"),t[2]=r,t[3]=s):s=t[3];let I=d.length>0?u:void 0,o;t[4]!==r?(o=r("shard key (optional)"),t[4]=r,t[5]=o):o=t[5];let l;t[6]!==f||t[7]!==x||t[8]!==s||t[9]!==I||t[10]!==o||t[11]!==e||t[12]!==v?(l=(0,a.jsx)(k,{"aria-label":s,className:"h-8 w-48","data-testid":e,id:f,list:I,onChange:x,placeholder:o,value:v}),t[6]=f,t[7]=x,t[8]=s,t[9]=I,t[10]=o,t[11]=e,t[12]=v,t[13]=l):l=t[13];let n;t[14]!==u||t[15]!==d||t[16]!==e?(n=d.length>0&&(0,a.jsx)("datalist",{"data-testid":`${e}-recents`,id:u,children:d.map(N)}),t[14]=u,t[15]=d,t[16]=e,t[17]=n):n=t[17];let p;return t[18]!==l||t[19]!==n?(p=(0,a.jsxs)(a.Fragment,{children:[l,n]}),t[18]=l,t[19]=n,t[20]=p):p=t[20],p},"A");function A(){return y()}m(A,"F");function N(i){return(0,a.jsx)("option",{"aria-label":i,value:i},i)}m(N,"w");export{B as a};
1
+ import{a as y}from"./chunk-GRL5MG3Z.js";import{R as k}from"./chunk-CFPZYHPY.js";import{d as j}from"./chunk-IUYFXK4X.js";import{a as m,e as b,f as w,g as F,h as $}from"./chunk-3XIESWL4.js";var C=b(F(),1),h=b(w(),1);var a=b($(),1);var B=m(i=>{let t=(0,C.c)(21),{id:f,onChange:g,testId:e,value:v}=i,r=j(),u=(0,h.useId)(),[d]=(0,h.useState)(A),c;t[0]!==g?(c=m(S=>{g(S.target.value)},"m"),t[0]=g,t[1]=c):c=t[1];let x=c,s;t[2]!==r?(s=r("Shard key"),t[2]=r,t[3]=s):s=t[3];let I=d.length>0?u:void 0,o;t[4]!==r?(o=r("shard key (optional)"),t[4]=r,t[5]=o):o=t[5];let l;t[6]!==f||t[7]!==x||t[8]!==s||t[9]!==I||t[10]!==o||t[11]!==e||t[12]!==v?(l=(0,a.jsx)(k,{"aria-label":s,className:"h-8 w-48","data-testid":e,id:f,list:I,onChange:x,placeholder:o,value:v}),t[6]=f,t[7]=x,t[8]=s,t[9]=I,t[10]=o,t[11]=e,t[12]=v,t[13]=l):l=t[13];let n;t[14]!==u||t[15]!==d||t[16]!==e?(n=d.length>0&&(0,a.jsx)("datalist",{"data-testid":`${e}-recents`,id:u,children:d.map(N)}),t[14]=u,t[15]=d,t[16]=e,t[17]=n):n=t[17];let p;return t[18]!==l||t[19]!==n?(p=(0,a.jsxs)(a.Fragment,{children:[l,n]}),t[18]=l,t[19]=n,t[20]=p):p=t[20],p},"A");function A(){return y()}m(A,"F");function N(i){return(0,a.jsx)("option",{"aria-label":i,value:i},i)}m(N,"w");export{B as a};
@@ -1,4 +1,4 @@
1
- import{a as me}from"./chunk-XF2B7P5A.js";import{R as ne}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ee}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import"./chunk-XBDKZZ67.js";import{a as te,e as se}from"./chunk-UZERI5YC.js";import{d as Z,h as ie,m as de,o as ce}from"./chunk-OG4N2XHD.js";import{a as h,e as Y,f as ge,g as xe,h as ye}from"./chunk-3XIESWL4.js";var re=Y(xe(),1),K=Y(ge(),1);var s=Y(ye(),1);var be=h(e=>{let t=(0,re.c)(23),{destination:r}=e,f=Z(),g;t[0]!==r.snippet?(g=h(()=>{ce(r.snippet)},"g"),t[0]=r.snippet,t[1]=g):g=t[1];let m=g,a;t[2]!==r.title?(a=(0,s.jsx)("h4",{className:"text-sm font-semibold",children:r.title}),t[2]=r.title,t[3]=a):a=t[3];let o;t[4]!==r.description?(o=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.description}),t[4]=r.description,t[5]=o):o=t[5];let d;t[6]!==a||t[7]!==o?(d=(0,s.jsxs)("div",{children:[a,o]}),t[6]=a,t[7]=o,t[8]=d):d=t[8];let H=`drain-copy-${r.id}`,l;t[9]!==f?(l=f("Copy"),t[9]=f,t[10]=l):l=t[10];let n;t[11]!==m||t[12]!==H||t[13]!==l?(n=(0,s.jsx)(ee,{"data-testid":H,onClick:m,size:"sm",variant:"outline",children:l}),t[11]=m,t[12]=H,t[13]=l,t[14]=n):n=t[14];let i;t[15]!==d||t[16]!==n?(i=(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[d,n]}),t[15]=d,t[16]=n,t[17]=i):i=t[17];let c;t[18]!==r.snippet?(c=(0,s.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:r.snippet}),t[18]=r.snippet,t[19]=c):c=t[19];let x;return t[20]!==i||t[21]!==c?(x=(0,s.jsx)(te,{className:"py-0","data-testid":"drain-card",children:(0,s.jsxs)(se,{className:"p-3",children:[i,c]})}),t[20]=i,t[21]=c,t[22]=x):x=t[22],x},"he"),je=h(()=>{let e=(0,re.c)(88),t=Z(),r;e[0]!==t?(r=t("Stream every request log to R2, a SIEM, or a third-party log service."),e[0]=t,e[1]=r):r=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=["{",' "logpush": true',"}"],e[2]=f):f=e[2];let g=f.join(`
1
+ import{a as me}from"./chunk-XF2B7P5A.js";import{R as ne}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ee}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import"./chunk-XBDKZZ67.js";import{a as te,e as se}from"./chunk-UZERI5YC.js";import{d as Z,h as ie,o as de,q as ce}from"./chunk-IUYFXK4X.js";import{a as h,e as Y,f as ge,g as xe,h as ye}from"./chunk-3XIESWL4.js";var re=Y(xe(),1),K=Y(ge(),1);var s=Y(ye(),1);var be=h(e=>{let t=(0,re.c)(23),{destination:r}=e,f=Z(),g;t[0]!==r.snippet?(g=h(()=>{ce(r.snippet)},"g"),t[0]=r.snippet,t[1]=g):g=t[1];let m=g,a;t[2]!==r.title?(a=(0,s.jsx)("h4",{className:"text-sm font-semibold",children:r.title}),t[2]=r.title,t[3]=a):a=t[3];let o;t[4]!==r.description?(o=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.description}),t[4]=r.description,t[5]=o):o=t[5];let d;t[6]!==a||t[7]!==o?(d=(0,s.jsxs)("div",{children:[a,o]}),t[6]=a,t[7]=o,t[8]=d):d=t[8];let H=`drain-copy-${r.id}`,l;t[9]!==f?(l=f("Copy"),t[9]=f,t[10]=l):l=t[10];let n;t[11]!==m||t[12]!==H||t[13]!==l?(n=(0,s.jsx)(ee,{"data-testid":H,onClick:m,size:"sm",variant:"outline",children:l}),t[11]=m,t[12]=H,t[13]=l,t[14]=n):n=t[14];let i;t[15]!==d||t[16]!==n?(i=(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[d,n]}),t[15]=d,t[16]=n,t[17]=i):i=t[17];let c;t[18]!==r.snippet?(c=(0,s.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:r.snippet}),t[18]=r.snippet,t[19]=c):c=t[19];let x;return t[20]!==i||t[21]!==c?(x=(0,s.jsx)(te,{className:"py-0","data-testid":"drain-card",children:(0,s.jsxs)(se,{className:"p-3",children:[i,c]})}),t[20]=i,t[21]=c,t[22]=x):x=t[22],x},"he"),je=h(()=>{let e=(0,re.c)(88),t=Z(),r;e[0]!==t?(r=t("Stream every request log to R2, a SIEM, or a third-party log service."),e[0]=t,e[1]=r):r=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=["{",' "logpush": true',"}"],e[2]=f):f=e[2];let g=f.join(`
2
2
  `),m;e[3]!==t?(m=t("Logpush"),e[3]=t,e[4]=m):m=e[4];let a;e[5]!==r||e[6]!==m?(a={description:r,id:"logpush",snippet:g,title:m},e[5]=r,e[6]=m,e[7]=a):a=e[7];let o;e[8]!==t?(o=t("Send logs programmatically to a Worker for custom capture and forwarding."),e[8]=t,e[9]=o):o=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"],e[10]=d):d=e[10];let H=d.join(`
3
3
  `),l;e[11]!==t?(l=t("Tail Workers"),e[11]=t,e[12]=l):l=e[12];let n;e[13]!==o||e[14]!==l?(n={description:o,id:"tail-worker",snippet:H,title:l},e[13]=o,e[14]=l,e[15]=n):n=e[15];let i;e[16]!==t?(i=t("Retain and query recent request logs directly in Cloudflare's dashboard."),e[16]=t,e[17]=i):i=e[17];let c;e[18]===Symbol.for("react.memo_cache_sentinel")?(c=["{",' "observability": { "enabled": true }',"}"],e[18]=c):c=e[18];let x=c.join(`
4
4
  `),y;e[19]!==t?(y=t("Workers Logs"),e[19]=t,e[20]=y):y=e[20];let b;e[21]!==i||e[22]!==y?(b={description:i,id:"workers-logs",snippet:x,title:y},e[21]=i,e[22]=y,e[23]=b):b=e[23];let J;e[24]!==b||e[25]!==a||e[26]!==n?(J=[a,n,b],e[24]=b,e[25]=a,e[26]=n,e[27]=J):J=e[27];let Q=J,[p,pe]=(0,K.useState)(""),[k,ae]=(0,K.useState)(!1),[u,$]=(0,K.useState)(null),A;if(e[28]!==t||e[29]!==p){let V=h(async()=>{let oe=p.trim();if(oe==="")return;let le="fetch"in globalThis?globalThis.fetch:void 0;if(le===void 0){$({kind:"error",message:t("fetch is unavailable in this environment.")});return}let fe={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};ae(!0),$(null);let he=performance.now();try{let X=await le(oe,{body:JSON.stringify(fe),headers:{"Content-Type":"application/json"},method:"POST"});$({kind:"success",latencyMs:Math.round(performance.now()-he),status:X.status})}catch(X){$({kind:"error",message:ie(X)})}ae(!1)},"G");A=h(()=>{de(V())},"z"),e[28]=t,e[29]=p,e[30]=A}else A=e[30];let U=A,B;e[31]===Symbol.for("react.memo_cache_sentinel")?(B=h(V=>{pe(V.target.value)},"J"),e[31]=B):B=e[31];let ue=B,v;e[32]!==t?(v=t("Open in Cloudflare"),e[32]=t,e[33]=v):v=e[33];let w;e[34]!==v?(w=(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,s.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:me,rel:"noreferrer",target:"_blank",children:v})}),e[34]=v,e[35]=w):w=e[35];let N;e[36]!==t?(N=t("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector."),e[36]=t,e[37]=N):N=e[37];let S;e[38]!==N?(S=(0,s.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:N}),e[38]=N,e[39]=S):S=e[39];let _;e[40]!==t?(_=t("Cloudflare destinations"),e[40]=t,e[41]=_):_=e[41];let C;e[42]!==_?(C=(0,s.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_}),e[42]=_,e[43]=C):C=e[43];let j;e[44]!==Q?(j=Q.map(ke),e[44]=Q,e[45]=j):j=e[45];let T;e[46]!==C||e[47]!==j?(T=(0,s.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[C,j]}),e[46]=C,e[47]=j,e[48]=T):T=e[48];let q;e[49]!==t?(q=t("Webhook test"),e[49]=t,e[50]=q):q=e[50];let L;e[51]!==q?(L=(0,s.jsx)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:q}),e[51]=q,e[52]=L):L=e[52];let M;e[53]!==t?(M=t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable."),e[53]=t,e[54]=M):M=e[54];let O;e[55]!==M?(O=(0,s.jsx)("p",{className:"mb-2 text-sm text-muted-foreground",children:M}),e[55]=M,e[56]=O):O=e[56];let W;e[57]!==t?(W=t("https://example.com/logs"),e[57]=t,e[58]=W):W=e[58];let D;e[59]!==W||e[60]!==p?(D=(0,s.jsx)(ne,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:ue,placeholder:W,type:"url",value:p}),e[59]=W,e[60]=p,e[61]=D):D=e[61];let P;e[62]!==k||e[63]!==p?(P=k||p.trim()==="",e[62]=k,e[63]=p,e[64]=P):P=e[64];let R;e[65]!==k||e[66]!==t?(R=t(k?"Sending\u2026":"Send test event"),e[65]=k,e[66]=t,e[67]=R):R=e[67];let F;e[68]!==U||e[69]!==P||e[70]!==R?(F=(0,s.jsx)(ee,{"data-testid":"drain-webhook-test",disabled:P,onClick:U,children:R}),e[68]=U,e[69]=P,e[70]=R,e[71]=F):F=e[71];let I;e[72]!==D||e[73]!==F?(I=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[D,F]}),e[72]=D,e[73]=F,e[74]=I):I=e[74];let z;e[75]!==u||e[76]!==t?(z=u!==null&&(0,s.jsx)("p",{className:u.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:u.kind==="error"?"alert":void 0,children:u.kind==="success"?t("Delivered \u2014 status {status} in {latency}ms",{latency:u.latencyMs,status:u.status}):t("Failed: {message}",{message:u.message})}),e[75]=u,e[76]=t,e[77]=z):z=e[77];let E;e[78]!==L||e[79]!==O||e[80]!==I||e[81]!==z?(E=(0,s.jsx)(te,{className:"py-0",children:(0,s.jsx)(se,{className:"p-3",children:(0,s.jsxs)("section",{"data-testid":"drain-webhook",children:[L,O,I,z]})})}),e[78]=L,e[79]=O,e[80]=I,e[81]=z,e[82]=E):E=e[82];let G;return e[83]!==w||e[84]!==S||e[85]!==T||e[86]!==E?(G=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[w,S,T,E]}),e[83]=w,e[84]=S,e[85]=T,e[86]=E,e[87]=G):G=e[87],G},"_e");function ke(e){return(0,s.jsx)(be,{destination:e},e.id)}h(ke,"ge");export{je as LogDrainsPanel};