@lunora/studio 1.0.0-alpha.80 → 1.0.0-alpha.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +35 -6
- package/dist/index.js +1 -1
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.js +1 -0
- package/dist/packem_chunks/ApiTab.js +1 -1
- package/dist/packem_chunks/AuditPanel.js +1 -1
- package/dist/packem_chunks/ExportImportPanel.js +1 -1
- package/dist/packem_chunks/FileBrowser.js +1 -1
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
- package/dist/packem_chunks/HealthPanel.js +1 -1
- package/dist/packem_chunks/InsightsPanel.js +1 -1
- package/dist/packem_chunks/LogsPanel.js +1 -1
- package/dist/packem_chunks/MailPanel.js +2 -2
- package/dist/packem_chunks/MetricsPanel.js +1 -1
- package/dist/packem_chunks/NotificationsPanel.js +1 -1
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
- package/dist/packem_chunks/SettingsPanel.js +1 -1
- package/dist/packem_chunks/SqlEditorPanel.js +6 -6
- package/dist/packem_chunks/TableEditor.js +1 -1
- package/dist/packem_chunks/agents-panel.js +1 -1
- package/dist/packem_chunks/auth-audit-panel.js +1 -1
- package/dist/packem_chunks/containers-panel.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +1 -1
- package/dist/packem_chunks/fanout-panel.js +1 -1
- package/dist/packem_chunks/flags-panel.js +1 -1
- package/dist/packem_chunks/issues-panel.js +1 -1
- package/dist/packem_chunks/kv-browser.js +1 -1
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/migrations-route.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +1 -1
- package/dist/packem_chunks/payments-panel.js +1 -1
- package/dist/packem_chunks/permissions-panel.js +1 -1
- package/dist/packem_chunks/queues-panel.js +1 -1
- package/dist/packem_chunks/rls-panel.js +1 -1
- package/dist/packem_chunks/storage-rules-panel.js +1 -1
- package/dist/packem_chunks/subscriptions-panel.js +1 -1
- package/dist/packem_chunks/traces-panel.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +1 -1
- package/dist/packem_shared/ADMIN_FUNCTIONS-CZESgd10.js +1 -0
- package/dist/packem_shared/{ApiDocsPanel-DfUQ1ZAF.js → ApiDocsPanel-fYS9NiLg.js} +1 -1
- package/dist/packem_shared/DataBrowser-C4J4gVUu.js +1 -0
- package/dist/packem_shared/GlobalDataBrowser-CSttudUx.js +1 -0
- package/dist/packem_shared/{HomePanel-Dcs4a3Ax.js → HomePanel-BYsfMhKh.js} +1 -1
- package/dist/packem_shared/{MigrationsPanel-C2OnsqRb.js → MigrationsPanel-2JbQ2HwG.js} +1 -1
- package/dist/packem_shared/{Studio-B26_pT8J.js → Studio-Ba9x0dG_.js} +1 -1
- package/dist/packem_shared/{StudioApp-bXhJeLlZ.js → StudioApp-B_PRdg4h.js} +1 -1
- package/dist/packem_shared/{cf-links-gbDy51nR.js → cf-links-Dmg86v1D.js} +1 -1
- package/dist/packem_shared/{home-panel-CU6MWLHG.js → home-panel-B60-5YfI.js} +1 -1
- package/dist/packem_shared/stat-card-fm_TF1mo.js +1 -0
- package/dist/packem_shared/studio-CPuoAmjh.js +2 -0
- package/dist/packem_shared/table-list-sidebar-BRv3hTLX.js +1 -0
- package/dist/packem_shared/{use-sql-assistant-CHEu2-Rk.js → use-sql-assistant-BLG9unQN.js} +1 -1
- package/dist/standalone/{chunk-RQ7AFLIV.js → chunk-2QSHLBCO.js} +1 -1
- package/dist/standalone/{chunk-33CL6OHR.js → chunk-5SQRE3VR.js} +1 -1
- package/dist/standalone/{chunk-5CVJS7ON.js → chunk-6QP5N57V.js} +1 -1
- package/dist/standalone/chunk-73GRNONE.js +1 -0
- package/dist/standalone/{chunk-JRMMYIAF.js → chunk-74DN6HIE.js} +1 -1
- package/dist/standalone/{chunk-KZ3ALMMP.js → chunk-7H7LZRLP.js} +1 -1
- package/dist/standalone/{chunk-FOBRNWBG.js → chunk-7YKWP4QK.js} +1 -1
- package/dist/standalone/{chunk-T7IUZIF4.js → chunk-7ZUQE3KU.js} +1 -1
- package/dist/standalone/{chunk-P4YLIBCN.js → chunk-A3KUNMU6.js} +1 -1
- package/dist/standalone/{chunk-S2VVR7HI.js → chunk-B2H5DK55.js} +1 -1
- package/dist/standalone/{chunk-FNPJ7GJZ.js → chunk-BDJCCVB6.js} +1 -1
- package/dist/standalone/{chunk-KJB7YAKB.js → chunk-C7EOC2WS.js} +1 -1
- package/dist/standalone/{chunk-KLQYC6CC.js → chunk-CGLS2ILT.js} +1 -1
- package/dist/standalone/chunk-CPSGJSHY.js +1 -0
- package/dist/standalone/{chunk-RJP3WBZ4.js → chunk-CU6SCYQ7.js} +1 -1
- package/dist/standalone/chunk-DGBJE7YF.js +4 -0
- package/dist/standalone/{chunk-G6PSMGLD.js → chunk-DOZAODYC.js} +1 -1
- package/dist/standalone/chunk-EQZTSISX.js +1 -0
- package/dist/standalone/chunk-ERMTJYQF.js +1 -0
- package/dist/standalone/{chunk-QZGTH6WH.js → chunk-GB6LP6UJ.js} +1 -1
- package/dist/standalone/{chunk-GYKVBKT5.js → chunk-GM67EQJU.js} +1 -1
- package/dist/standalone/chunk-GN567L2T.js +1 -0
- package/dist/standalone/{chunk-L7R74G63.js → chunk-GWHM4C4N.js} +1 -1
- package/dist/standalone/{chunk-JLOWAJRR.js → chunk-GWQIPIYA.js} +1 -1
- package/dist/standalone/{chunk-6YTSSIEJ.js → chunk-HEB6GQQ6.js} +1 -1
- package/dist/standalone/chunk-HOR3JLUY.js +6 -0
- package/dist/standalone/{chunk-7LWMHTJ3.js → chunk-I6A5C46N.js} +1 -1
- package/dist/standalone/{chunk-H6YOWRFB.js → chunk-KAPSM6AI.js} +1 -1
- package/dist/standalone/{chunk-6NY7SPDL.js → chunk-KSRP7GZV.js} +1 -1
- package/dist/standalone/chunk-LLF5KWDZ.js +2 -0
- package/dist/standalone/chunk-NRCXRCJX.js +1 -0
- package/dist/standalone/chunk-OE465DVY.js +1 -0
- package/dist/standalone/{chunk-HJ3E4YF5.js → chunk-PXYWCZ7T.js} +1 -1
- package/dist/standalone/{chunk-PZVU2QMX.js → chunk-Q7QTRX2E.js} +1 -1
- package/dist/standalone/{chunk-E3NMX2VU.js → chunk-S4ILMYP5.js} +1 -1
- package/dist/standalone/{chunk-KC44QCN6.js → chunk-SDQBPFLO.js} +1 -1
- package/dist/standalone/chunk-SV52HB7D.js +1 -0
- package/dist/standalone/{chunk-WBYSSCV2.js → chunk-T242WITF.js} +1 -1
- package/dist/standalone/{chunk-VHWOCPRK.js → chunk-TBRZQICB.js} +1 -1
- package/dist/standalone/{chunk-6LNCYDZO.js → chunk-TQXZ7LG4.js} +1 -1
- package/dist/standalone/chunk-U457LHCO.js +1 -0
- package/dist/standalone/chunk-UBPYN4DU.js +1 -0
- package/dist/standalone/{chunk-34D36UCW.js → chunk-UDVB4URN.js} +1 -1
- package/dist/standalone/{chunk-6IKEW5LG.js → chunk-UETNCBWU.js} +1 -1
- package/dist/standalone/{chunk-OY2RVUZL.js → chunk-UU2QJMGJ.js} +1 -1
- package/dist/standalone/chunk-VC5SSRUP.js +1 -0
- package/dist/standalone/{chunk-GXSZH7VJ.js → chunk-VCXH5V3Z.js} +1 -1
- package/dist/standalone/{chunk-RNRJKBY3.js → chunk-VTLYN3CX.js} +1 -1
- package/dist/standalone/{chunk-3O3HAXW7.js → chunk-WDG4WFUV.js} +1 -1
- package/dist/standalone/{chunk-3STOIE7Q.js → chunk-WJGOI3FZ.js} +1 -1
- package/dist/standalone/{chunk-W6SAOXGH.js → chunk-WLZ7YPBH.js} +1 -1
- package/dist/standalone/{chunk-2VDFV5TD.js → chunk-WQVVA5NB.js} +1 -1
- package/dist/standalone/{chunk-TTGOOYLF.js → chunk-WZ3B3MEV.js} +1 -1
- package/dist/standalone/{chunk-SKW6J4VW.js → chunk-Y7A5NCXT.js} +1 -1
- package/dist/standalone/{chunk-IHQC7J35.js → chunk-YSRW5RNU.js} +1 -1
- package/dist/standalone/{chunk-GAX5IZYG.js → chunk-YTA2HGRD.js} +1 -1
- package/dist/standalone/chunk-ZHBIKP5G.js +1 -0
- package/dist/standalone/{chunk-CCVXYYPJ.js → chunk-ZK3XKFCI.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
- package/dist/packem_shared/ADMIN_FUNCTIONS-BnD4aovm.js +0 -1
- package/dist/packem_shared/DataBrowser-CuRlztBz.js +0 -1
- package/dist/packem_shared/GlobalDataBrowser-DB-vQ2_H.js +0 -1
- package/dist/packem_shared/studio-q-C-acL7.js +0 -2
- package/dist/packem_shared/table-list-sidebar-BFkSQwlB.js +0 -1
- package/dist/standalone/chunk-2GA4SHO7.js +0 -1
- package/dist/standalone/chunk-2WOIRKEI.js +0 -1
- package/dist/standalone/chunk-6PNPIW6I.js +0 -2
- package/dist/standalone/chunk-6YI4WJO4.js +0 -1
- package/dist/standalone/chunk-A74VSSA2.js +0 -4
- package/dist/standalone/chunk-CT5MMH4O.js +0 -1
- package/dist/standalone/chunk-GB6U2BPU.js +0 -1
- package/dist/standalone/chunk-GEDMLM4A.js +0 -6
- package/dist/standalone/chunk-S252DAFP.js +0 -1
- package/dist/standalone/chunk-XS5LDR52.js +0 -1
- package/dist/standalone/chunk-YJYTMQJI.js +0 -1
- package/dist/standalone/chunk-Z2V42P7J.js +0 -1
- /package/dist/standalone/{chunk-SKHEGARW.js → chunk-XF2B7P5A.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Et}from"./chunk-KUVMORDQ.js";import{a as me}from"./chunk-EQZTSISX.js";import{a as Lt,b as At,c as Kt,d as Ot,e as ot}from"./chunk-Y5Y7DHFW.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 wt,i as St}from"./chunk-CU55Y5TV.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.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{a as Mt}from"./chunk-LFKCLLPT.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 Ae}from"./chunk-ERMTJYQF.js";import{c as Ee}from"./chunk-XDAT7LHC.js";import{f as mt}from"./chunk-EN2QAEO4.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 je,e as de,f as B}from"./chunk-MIQTKZAR.js";import{a as fe,b as Ke,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-AADILRJW.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 j=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"),dt=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(d=>dt(d)).join(",")}]`;let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let d=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${d} 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 d of a){let i=l[d];i!==void 0&&r.push(`${JSON.stringify(d)}:${dt(i)}`)}return`{${r.join(",")}}`},"Ze"),Pt=o((s,e,l)=>`${s}:${e}:${dt(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"),ct=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,d=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}`,m;return e[3]!==n||e[4]!==u||e[5]!==r?(m=(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]=m):m=e[6],m}let w=`mt-instrument-trace-${l}`,x;e[7]!==a||e[8]!==r?(x=o(()=>{a(r)},"x"),e[7]=a,e[8]=r,e[9]=x):x=e[9];let S;e[10]!==d||e[11]!==r?(S=d("Open the exemplar trace {trace}",{trace:r}),e[10]=d,e[11]=r,e[12]=S):S=e[12];let f;return e[13]!==n||e[14]!==w||e[15]!==x||e[16]!==S?(f=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":w,onClick:x,title:S,type:"button",children:n}),e[13]=n,e[14]=w,e[15]=x,e[16]=S,e[17]=f):f=e[17],f},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=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:w,errorSource:x}=Ee(Ae.getMetricSeries,d,i),S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S={},e[3]=S):S=e[3];let f;e[4]!==a?(f={live:!0,shardKey:a},e[4]=a,e[5]=f):f=e[5];let{data:u}=Ee(Ae.getMetricHistory,S,f),m,M,b,q,_,c,g,p,k,$,y,D,I;if(e[6]!==n||e[7]!==w||e[8]!==x||e[9]!==u||e[10]!==l||e[11]!==r){p=Symbol.for("react.early_return_sentinel");e:{let K=Vt(n),E=vt(x)===Xt;if(w!==null&&!E){let h;e[25]!==r?(h=r("Instruments"),e[25]=r,e[26]=h):h=e[26];let P;e[27]!==h?(P=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:h}),e[27]=h,e[28]=P):P=e[28];let U;e[29]!==w||e[30]!==r?(U=r("Instruments unavailable: {error}",{error:w}),e[29]=w,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 ce;e[34]!==P||e[35]!==F?(ce=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[P,F]}),e[34]=P,e[35]=F,e[36]=ce):ce=e[36],p=ce;break e}if(K.length===0){p=null;break e}let J=Yt(u),L;e[37]!==r?(L=o(h=>r(h==="counter"?"Counter":h==="gauge"?"Gauge":"Histogram"),"L"),e[37]=r,e[38]=L):L=e[38];let H=L;_="flex flex-col gap-2",c="mt-instruments";let A;e[39]!==r?(A=r("Instruments"),e[39]=r,e[40]=A):A=e[40],e[41]!==A?(g=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:A}),e[41]=A,e[42]=g):g=e[42],q=fe,I="overflow-hidden py-0",b=pe,D="px-0",M=lt,$="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)(de,{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)(de,{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)(de,{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)(de,{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)(de,{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)(de,{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)(de,{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)(de,{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)(je,{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],m=it,k=K.map(h=>{let P=zt(h.attributes),U=Pt(h.kind,h.name,h.attributes),F=(J.get(U)??[]).map(ce=>Bt(h.kind,ce));return(0,t.jsxs)(je,{"data-testid":`mt-instrument-${h.name}`,children:[(0,t.jsx)(B,{className:"font-mono text-xs",title:h.functionPath,children:h.name}),(0,t.jsx)(B,{children:(0,t.jsx)(Be,{variant:Zt[h.kind],children:H(h.kind)})}),(0,t.jsx)(B,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${h.name}`,children:ct(Gt(h))}),(0,t.jsx)(B,{className:"text-right tabular-nums text-muted-foreground",children:h.count.toLocaleString()}),(0,t.jsx)(B,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:h.min===h.max?"\u2014":`${ct(h.min)}\u2013${ct(h.max)}`}),(0,t.jsx)(B,{children:F.length>=2?(0,t.jsx)(ot,{ariaLabel:r("{name} trend",{name:h.name}),className:"h-6 w-24 text-foreground",series:F,testId:`mt-instrument-trend-${h.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:h.name,onOpenTrace:l,traceId:h.exemplarTraceId})}),(0,t.jsx)(B,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:P,children:P===""?"\u2014":P})]},U)})}e[6]=n,e[7]=w,e[8]=x,e[9]=u,e[10]=l,e[11]=r,e[12]=m,e[13]=M,e[14]=b,e[15]=q,e[16]=_,e[17]=c,e[18]=g,e[19]=p,e[20]=k,e[21]=$,e[22]=y,e[23]=D,e[24]=I}else m=e[12],M=e[13],b=e[14],q=e[15],_=e[16],c=e[17],g=e[18],p=e[19],k=e[20],$=e[21],y=e[22],D=e[23],I=e[24];if(p!==Symbol.for("react.early_return_sentinel"))return p;let C;e[84]!==m||e[85]!==k?(C=(0,t.jsx)(m,{children:k}),e[84]=m,e[85]=k,e[86]=C):C=e[86];let T;e[87]!==M||e[88]!==C||e[89]!==$||e[90]!==y?(T=(0,t.jsxs)(M,{"data-testid":$,children:[y,C]}),e[87]=M,e[88]=C,e[89]=$,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]!==q||e[97]!==N||e[98]!==I?(v=(0,t.jsx)(q,{className:I,children:N}),e[96]=q,e[97]=N,e[98]=I,e[99]=v):v=e[99];let z;return e[100]!==_||e[101]!==c||e[102]!==g||e[103]!==v?(z=(0,t.jsxs)("section",{className:_,"data-testid":c,children:[g,v]}),e[100]=_,e[101]=c,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(),d;e[0]!==r?(d=r("Shards"),e[0]=r,e[1]=d):d=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]!==d||e[7]!==i?(n=(0,t.jsx)(me,{label:d,testId:"mt-agg-shards",value:i}),e[6]=d,e[7]=i,e[8]=n):n=e[8];let w;e[9]!==r?(w=r("Total requests"),e[9]=r,e[10]=w):w=e[10];let x;e[11]!==l.totalRequests||e[12]!==w?(x=(0,t.jsx)(me,{label:w,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=w,e[13]=x):x=e[13];let S;e[14]!==r?(S=r("Total errors"),e[14]=r,e[15]=S):S=e[15];let f;e[16]!==l.totalErrors||e[17]!==S?(f=(0,t.jsx)(me,{label:S,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=S,e[18]=f):f=e[18];let u;e[19]!==r?(u=r("Total database size"),e[19]=r,e[20]=u):u=e[20];let m;e[21]!==l.totalDatabaseSize?(m=Ge(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=m):m=e[22];let M;e[23]!==u||e[24]!==m?(M=(0,t.jsx)(me,{label:u,testId:"mt-agg-db-size",value:m}),e[23]=u,e[24]=m,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 q;e[28]!==l.hitRate||e[29]!==r?(q=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=q):q=e[30];let _;e[31]!==b||e[32]!==q?(_=(0,t.jsx)(me,{label:b,testId:"mt-agg-cache",value:q}),e[31]=b,e[32]=q,e[33]=_):_=e[33];let c;e[34]!==M||e[35]!==_||e[36]!==n||e[37]!==x||e[38]!==f?(c=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,x,f,M,_]}),e[34]=M,e[35]=_,e[36]=n,e[37]=x,e[38]=f,e[39]=c):c=e[39];let g;e[40]!==r?(g=r("shard"),e[40]=r,e[41]=g):g=e[41];let p;e[42]!==g?(p=(0,t.jsx)(de,{children:g}),e[42]=g,e[43]=p):p=e[43];let k;e[44]!==r?(k=r("requests"),e[44]=r,e[45]=k):k=e[45];let $;e[46]!==k?($=(0,t.jsx)(de,{children:k}),e[46]=k,e[47]=$):$=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)(de,{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)(de,{children:I}),e[54]=I,e[55]=C):C=e[55];let T;e[56]!==p||e[57]!==$||e[58]!==D||e[59]!==C?(T=(0,t.jsx)(nt,{children:(0,t.jsxs)(je,{children:[p,$,D,C]})}),e[56]=p,e[57]=$,e[58]=D,e[59]=C,e[60]=T):T=e[60];let N;if(e[61]!==a||e[62]!==r){let E;e[64]!==r?(E=o(J=>(0,t.jsxs)(je,{"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),"E"),e[64]=r,e[65]=E):E=e[65],N=a.map(E),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 K;return e[71]!==c||e[72]!==z?(K=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[c,z]}),e[71]=c,e[72]=z,e[73]=K):K=e[73],K},"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"),jt=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:d,metrics:i}=s,n=ge(),w;e[0]!==r||e[1]!==n?(w=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]=w):w=e[2];let x;e[3]!==l||e[4]!==r.length||e[5]!==n?(x=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]=x):x=e[6];let S;e[7]!==n?(S=n("Requests"),e[7]=n,e[8]=S):S=e[8];let f;e[9]!==i.requests||e[10]!==w||e[11]!==x||e[12]!==S?(f=(0,t.jsx)(me,{chart:w,footer:x,label:S,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=w,e[11]=x,e[12]=S,e[13]=f):f=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 m;e[17]!==n?(m=n("Errors"),e[17]=n,e[18]=m):m=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]!==m||e[24]!==M?(b=(0,t.jsx)(me,{footer:u,label:m,testId:"mt-errors",value:M}),e[22]=u,e[23]=m,e[24]=M,e[25]=b):b=e[25];let q;e[26]!==d.p90?(q=d.p90>0?`P90 ${jt(d.p90)}`:void 0,e[26]=d.p90,e[27]=q):q=e[27];let _;e[28]!==n?(_=n("P95 latency"),e[28]=n,e[29]=_):_=e[29];let c;e[30]!==d.p95?(c=d.p95>0?jt(d.p95):"\u2014",e[30]=d.p95,e[31]=c):c=e[31];let g;e[32]!==_||e[33]!==c||e[34]!==q?(g=(0,t.jsx)(me,{footer:q,label:_,testId:"mt-p95",value:c}),e[32]=_,e[33]=c,e[34]=q,e[35]=g):g=e[35];let p;e[36]!==i.cache||e[37]!==n?(p=i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${n("cache entries")}`,e[36]=i.cache,e[37]=n,e[38]=p):p=e[38];let k;e[39]!==n?(k=n("Database size"),e[39]=n,e[40]=k):k=e[40];let $;e[41]!==i.databaseSize?($=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=$):$=e[42];let y;e[43]!==p||e[44]!==k||e[45]!==$?(y=(0,t.jsx)(me,{footer:p,label:k,testId:"mt-db-size",value:$}),e[43]=p,e[44]=k,e[45]=$,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 K;e[64]!==v||e[65]!==z?(K=(0,t.jsx)(me,{label:v,testId:"mt-cache",value:z}),e[64]=v,e[65]=z,e[66]=K):K=e[66];let E;return e[67]!==g||e[68]!==y||e[69]!==I||e[70]!==N||e[71]!==K||e[72]!==f||e[73]!==b?(E=(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:[f,b,g,y,I,N,K]}),e[67]=g,e[68]=y,e[69]=I,e[70]=N,e[71]=K,e[72]=f,e[73]=b,e[74]=E):E=e[74],E},"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,d]=(0,j.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,w]=(0,j.useState)(i),x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=o(I=>{I!==null&&d(I)},"x"),e[1]=x):x=e[1];let S=x,f,u,m,M,b,q,_,c,g,p;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){m=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(cr),e[18]=l,e[19]=N):N=e[19];let v=N.length,z;e[20]!==l?(z=l.filter(dr),e[20]=l,e[21]=z):z=e[21];let K=z.length,E;e[22]===Symbol.for("react.memo_cache_sentinel")?(E=o(R=>{w(ue=>{let W=new Set(ue);return W.has(R)?W.delete(R):W.add(R),W})},"E"),e[22]=E):E=e[22];let J=E;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],m=We;break e}_="space-y-4",c="qi-root";let L;e[34]!==a?(L=a("Critical queries"),e[34]=a,e[35]=L):L=e[35];let H;e[36]!==L?(H=(0,t.jsx)(Ke,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:L})}),e[36]=L,e[37]=H):H=e[37];let A;e[38]!==T?(A=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:T}),e[38]=T,e[39]=A):A=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]!==A||e[45]!==G?(V=(0,t.jsxs)(pe,{children:[A,G]}),e[44]=A,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)(Ke,{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)(Ke,{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]!==K?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:K}),e[70]=K,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 h;e[76]!==ne||e[77]!==oe?(h=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=h):h=e[78];let P;e[79]!==le||e[80]!==h?(P=(0,t.jsxs)(fe,{children:[le,h]}),e[79]=le,e[80]=h,e[81]=P):P=e[81],e[82]!==X||e[83]!==ae||e[84]!==P?(g=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[X,ae,P]}),e[82]=X,e[83]=ae,e[84]=P,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 ce;e[90]!==r||e[91]!==a?(ce=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=ce):ce=e[92];let be;e[93]!==ce?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:ce}),e[93]=ce,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 we;e[102]!==a?(we=a("Sort queries by"),e[102]=a,e[103]=we):we=e[103];let Fe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Fe=(0,t.jsx)(Ct,{}),e[104]=Fe):Fe=e[104];let Se;e[105]!==we?(Se=(0,t.jsx)(Tt,{"aria-label":we,className:"w-[140px]","data-testid":"qi-sort",children:Fe}),e[105]=we,e[106]=Se):Se=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]!==Se||e[130]!==Te?(Re=(0,t.jsxs)(It,{onValueChange:S,value:r,children:[Se,Te]}),e[128]=r,e[129]=Se,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?(p=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,ze]}),e[135]=ve,e[136]=ze,e[137]=p):p=e[137],u=fe;let Le;e[138]!==a?(Le=a("Statements"),e[138]=a,e[139]=Le):Le=e[139];let Je;e[140]!==Le?(Je=(0,t.jsx)(Oe,{children:Le}),e[140]=Le,e[141]=Je):Je=e[141],q=(0,t.jsxs)(Ke,{children:[Je,(0,t.jsx)(gt,{children:a("{count} tracked statements",{count:I.length})})]}),f=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)},"Ke"),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]=f,e[7]=u,e[8]=m,e[9]=M,e[10]=b,e[11]=q,e[12]=_,e[13]=c,e[14]=g,e[15]=p}else f=e[6],u=e[7],m=e[8],M=e[9],b=e[10],q=e[11],_=e[12],c=e[13],g=e[14],p=e[15];if(m!==Symbol.for("react.early_return_sentinel"))return m;let k;e[145]!==M||e[146]!==b?(k=(0,t.jsx)("div",{className:M,children:b}),e[145]=M,e[146]=b,e[147]=k):k=e[147];let $;e[148]!==f||e[149]!==k?($=(0,t.jsx)(f,{children:k}),e[148]=f,e[149]=k,e[150]=$):$=e[150];let y;e[151]!==u||e[152]!==$||e[153]!==q?(y=(0,t.jsxs)(u,{children:[q,$]}),e[151]=u,e[152]=$,e[153]=q,e[154]=y):y=e[154];let D;return e[155]!==y||e[156]!==_||e[157]!==c||e[158]!==g||e[159]!==p?(D=(0,t.jsxs)("div",{className:_,"data-testid":c,children:[g,p,y]}),e[155]=y,e[156]=_,e[157]=c,e[158]=g,e[159]=p,e[160]=D):D=e[160],D},"ir");function or(s){return Xe(s.avgDurationMs)==="critical"}o(or,"or");function cr(s){return Xe(s.avgDurationMs)==="warning"}o(cr,"cr");function dr(s){return Xe(s.avgDurationMs)==="good"}o(dr,"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,j.useState)("15m"),r=Ee(Ae.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,d=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")})]}),d.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)(St,{data:d,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)(wt,{data:d,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(Ae.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),Pr=o(({initialShardKey:s})=>{let e=mt(),l=ge(),a=ut(),[r,d]=(0,j.useState)(s??""),[i,n]=(0,j.useState)("overview"),[w,x]=(0,j.useState)([]),S=(0,j.useRef)(null),f=(0,j.useRef)(null),u=(0,j.useRef)(!0);(0,j.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let m=Mt(r.trim(),400),M=o(L=>{Et({shardKey:m,traceId:L}),Qe(a({to:"/traces"}))},"M"),{data:b,error:q,liveError:_}=Ee(Ae.getMetrics,{},{live:!0,shardKey:m}),c=b??null;(0,j.useEffect)(()=>{if(b===void 0)return;kt(m);let L=b,H=S.current,A=f.current!==null&&f.current!==L.shard;if(f.current=L.shard,S.current=L.requests,A){x([]);return}H!==null&&L.requests>=H&&x(O=>[...O,L.requests-H].slice(-30))},[b,m]);let[g,p]=(0,j.useState)(null),[k,$]=(0,j.useState)(!1),y=o(async()=>{$(!0);let L=At(r,qt());try{let H=await Promise.all(L.map(async A=>{try{let O=await e.query(fr,{},xt(A));return{error:null,metrics:O,shard:A===""?O.shard:A}}catch(O){return{error:bt(O),metrics:null,shard:A===""?"__root__":A}}}));u.current&&p(H)}finally{u.current&&$(!1)}},"y"),D=g===null?null:Lt(g),I=c===null||c.requests===0?"\u2014":`${(c.errors/c.requests*100).toFixed(1)}%`,C=w.length>0?w.at(-1):0,T=c?Kt(c):{p90:0,p95:0},N=(0,j.useMemo)(()=>{if(!c||!("queryStats"in c))return;let L=c.queryStats;if(!(!L||!Array.isArray(L)))return Ot(L)},[c]),v=pr(N!==void 0,i),z=o(()=>{Qe(y())},"T"),K=o(()=>{p(null)},"z"),E=o(()=>{n("overview")},"E"),J=o(()=>{n("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:d,testId:"mt-shard-input",value:r}),(0,t.jsx)(_t,{message:_,prefix:"mt"}),(0,t.jsx)(Ze,{"data-testid":"mt-aggregate",disabled:k,onClick:z,size:"sm",type:"button",variant:"secondary",children:l(k?"Aggregating\u2026":"All shards")}),g!==null&&(0,t.jsx)(Ze,{"data-testid":"mt-aggregate-clear",onClick:K,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")})]}),q!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:q}),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:E,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:m}),v==="overview"&&c!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:w,latencyPercentiles:T,metrics:c}),v==="overview"&&c===null&&null,v==="overview"&&(0,t.jsx)(er,{onOpenTrace:M,shardKey:m}),v==="overview"&&D!==null&&g!==null&&(0,t.jsx)(tr,{aggregate:D,shardResults:g})]})},"Ur");export{Pr as MetricsPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Pe}from"./chunk-V53KNYRN.js";import{a as he}from"./chunk-5Y3QLNWX.js";import{
|
|
1
|
+
import{a as Pe}from"./chunk-V53KNYRN.js";import{a as he}from"./chunk-5Y3QLNWX.js";import{d as Ne,f as ke,g as we,k as oe}from"./chunk-QBWRC5YX.js";import{a as Q}from"./chunk-HPFLBYRI.js";import{a as Oe}from"./chunk-X665E2HU.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as ye}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as U}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as ve}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as Ie}from"./chunk-ERMTJYQF.js";import{f as H}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as B}from"./chunk-XQCVZAGU.js";import{d as E,e as Se,f as se,g as ie,h as le,m as $e,o as ae}from"./chunk-OG4N2XHD.js";import{c as be}from"./chunk-AADILRJW.js";import{a as u,e as K,f as ue,g as te,h as re,j as fe}from"./chunk-3XIESWL4.js";var Fe=K(te(),1),ge=K(ue(),1);var Z=K(te(),1);var X=K(ue(),1);var T=K(re(),1);var Ve=se(Ie.listTables),Qe=["react","client","cli"],Xe=!1,Ze={action:"action",mutation:"mutation",query:"query"},_e=u(t=>{let e=t.indexOf(":");return e===-1?{file:"",fn:t}:{file:t.slice(0,e),fn:t.slice(e+1)}},"J"),Ce=u(({file:t,fn:e,kind:a})=>`await client.${Ze[a]}(api.${t}.${e}, { /* args */ });`,"U"),Ye=u(t=>{let e=`api.${t.file}.${t.fn}`;switch(t.kind){case"action":return Ce(t);case"mutation":return`const ${t.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},"re"),et=u(({file:t,fn:e})=>`lunora run ${t}:${e} --args '{ }'`,"se"),tt=u(t=>["// Read rows",`const rows = await ctx.db.query("${t}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${t}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${t}">;`,`type RowId = Id<"${t}">;`].join(`
|
|
2
2
|
`),"de"),rt=u((t,e)=>{switch(t){case"cli":return et(e);case"client":return Ce(e);default:return Ye(e)}},"ce"),Te=u(t=>{let e=(0,Z.c)(19),{code:a,label:r,testId:n}=t,s=E(),o;e[0]!==a?(o=u(()=>{ae(a)},"s"),e[0]=a,e[1]=o):o=e[1];let i=o,d;e[2]!==r?(d=(0,T.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r}),e[2]=r,e[3]=d):d=e[3];let m=`${n}-copy`,l;e[4]!==s?(l=s("Copy"),e[4]=s,e[5]=l):l=e[5];let c;e[6]!==i||e[7]!==m||e[8]!==l?(c=(0,T.jsx)(U,{"data-testid":m,onClick:i,size:"xs",type:"button",variant:"ghost",children:l}),e[6]=i,e[7]=m,e[8]=l,e[9]=c):c=e[9];let f;e[10]!==d||e[11]!==c?(f=(0,T.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[d,c]}),e[10]=d,e[11]=c,e[12]=f):f=e[12];let x;e[13]!==a||e[14]!==n?(x=(0,T.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":n,children:a}),e[13]=a,e[14]=n,e[15]=x):x=e[15];let h;return e[16]!==f||e[17]!==x?(h=(0,T.jsxs)("div",{className:"flex flex-col gap-1.5",children:[f,x]}),e[16]=f,e[17]=x,e[18]=h):h=e[18],h},"V"),at=u(t=>{let e=(0,Z.c)(50),{file:a,fn:r,kind:n}=t,s=E(),[o,i]=(0,X.useState)("react"),d,m,l;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==s||e[4]!==o){let $={file:a,fn:r,kind:n},S;e[8]!==s?(S=s("CLI"),e[8]=s,e[9]=S):S=e[9];let C;e[10]!==s?(C=s("Client"),e[10]=s,e[11]=C):C=e[11];let A;e[12]!==s?(A=s("React"),e[12]=s,e[13]=A):A=e[13];let M;e[14]!==S||e[15]!==C||e[16]!==A?(M={cli:S,client:C,react:A},e[14]=S,e[15]=C,e[16]=A,e[17]=M):M=e[17],l=M;let _;e[18]===Symbol.for("react.memo_cache_sentinel")?(_=u(J=>{i(J.currentTarget.dataset.tab)},"D"),e[18]=_):_=e[18],d=_,m=rt(o,$),e[0]=a,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=d,e[6]=m,e[7]=l}else d=e[5],m=e[6],l=e[7];let c=m,f=n==="action"&&o==="react"&&!Xe,x=`api.${a}.${r}`,h;e[19]!==x?(h=(0,T.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:x}),e[19]=x,e[20]=h):h=e[20];let b;e[21]!==n||e[22]!==s?(b=s("Call this {kind} from your app.",{kind:n}),e[21]=n,e[22]=s,e[23]=b):b=e[23];let y;e[24]!==b?(y=(0,T.jsx)("p",{className:"text-xs text-muted-foreground",children:b}),e[24]=b,e[25]=y):y=e[25];let N;e[26]!==h||e[27]!==y?(N=(0,T.jsxs)("div",{children:[h,y]}),e[26]=h,e[27]=y,e[28]=N):N=e[28];let v;e[29]!==s?(v=s("Snippet flavour"),e[29]=s,e[30]=v):v=e[30];let g;e[31]!==d||e[32]!==o||e[33]!==l?(g=Qe.map($=>(0,T.jsx)(U,{"aria-selected":o===$,"data-tab":$,"data-testid":`api-tab-${$}`,onClick:d,role:"tab",size:"xs",type:"button",variant:o===$?"default":"outline",children:l[$]},$)),e[31]=d,e[32]=o,e[33]=l,e[34]=g):g=e[34];let k;e[35]!==v||e[36]!==g?(k=(0,T.jsx)("div",{"aria-label":v,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:g}),e[35]=v,e[36]=g,e[37]=k):k=e[37];let O=l[o],P=`api-snippet-${o}`,w;e[38]!==c||e[39]!==O||e[40]!==P?(w=(0,T.jsx)(Te,{code:c,label:O,testId:P}),e[38]=c,e[39]=O,e[40]=P,e[41]=w):w=e[41];let I;e[42]!==f||e[43]!==s?(I=f&&(0,T.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"api-action-note",children:s("Actions have no React hook \u2014 call them through the client.")}),e[42]=f,e[43]=s,e[44]=I):I=e[44];let j;return e[45]!==w||e[46]!==I||e[47]!==N||e[48]!==k?(j=(0,T.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[N,k,w,I]}),e[45]=w,e[46]=I,e[47]=N,e[48]=k,e[49]=j):j=e[49],j},"pe"),nt=u(t=>{let e=(0,Z.c)(19),{name:a}=t,r=E(),n;e[0]!==a?(n=tt(a),e[0]=a,e[1]=n):n=e[1];let s=n,o;e[2]!==a?(o=(0,T.jsx)("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:a}),e[2]=a,e[3]=o):o=e[3];let i;e[4]!==r?(i=r("Read and write this table through the typed data model."),e[4]=r,e[5]=i):i=e[5];let d;e[6]!==i?(d=(0,T.jsx)("p",{className:"text-xs text-muted-foreground",children:i}),e[6]=i,e[7]=d):d=e[7];let m;e[8]!==o||e[9]!==d?(m=(0,T.jsxs)("div",{children:[o,d]}),e[8]=o,e[9]=d,e[10]=m):m=e[10];let l;e[11]!==r?(l=r("Data model"),e[11]=r,e[12]=l):l=e[12];let c;e[13]!==s||e[14]!==l?(c=(0,T.jsx)(Te,{code:s,label:l,testId:"api-snippet-table"}),e[13]=s,e[14]=l,e[15]=c):c=e[15];let f;return e[16]!==m||e[17]!==c?(f=(0,T.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[m,c]}),e[16]=m,e[17]=c,e[18]=f):f=e[18],f},"fe"),je=u(t=>{let e=(0,Z.c)(8),{active:a,label:r,onSelect:n,testId:s,value:o}=t,i;e[0]!==n||e[1]!==o?(i=u(()=>{n(o)},"u"),e[0]=n,e[1]=o,e[2]=i):i=e[2];let d=i,m=a?"page":void 0,l;return e[3]!==r||e[4]!==d||e[5]!==m||e[6]!==s?(l=(0,T.jsx)("button",{"aria-current":m,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":s,onClick:d,type:"button",children:r}),e[3]=r,e[4]=d,e[5]=m,e[6]=s,e[7]=l):l=e[7],l},"G"),ot=u(t=>{let e=new Map;for(let a of t){let{file:r,fn:n}=_e(a.path),s=e.get(r)??[];s.push({fn:n,kind:a.kind,path:a.path}),e.set(r,s)}return[...e.entries()].map(([a,r])=>({file:a,items:r.toSorted((n,s)=>n.fn.localeCompare(s.fn))})).toSorted((a,r)=>a.file.localeCompare(r.file))},"me"),Ae=u(t=>{let e=(0,Z.c)(58),{functions:a,initialShardKey:r}=t,n=E(),s=H(),[o,i]=(0,X.useState)(null),[d,m]=(0,X.useState)(null),l,c;e[0]!==s||e[1]!==r?(l=u(()=>{let M=!1;return s.query(Ve,{},ie(r??"")).then(_=>(M||i(_),_)).catch(()=>{M||i([])}),()=>{M=!0}},"r"),c=[s,r],e[0]=s,e[1]=r,e[2]=l,e[3]=c):(l=e[2],c=e[3]),(0,X.useEffect)(l,c);let f,x,h,b,y,N,v,g,k,O;if(e[4]!==a||e[5]!==d||e[6]!==n||e[7]!==o){let M=a??[],_=ot(M),J=(o??[]).map(st).toSorted(it),R;e[18]===Symbol.for("react.memo_cache_sentinel")?(R=u(z=>{m({kind:"fn",path:z})},"F"),e[18]=R):R=e[18];let D=R,V;e[19]===Symbol.for("react.memo_cache_sentinel")?(V=u(z=>{m({kind:"table",name:z})},"H"),e[19]=V):V=e[19];let Ge=V;x=d?.kind==="fn"?M.find(z=>z.path===d.path):void 0,f=M.length>0||J.length>0,h=x===void 0?void 0:_e(x.path),k="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",O="lunora-api-docs",e[20]!==n?(b=n("API resources"),e[20]=n,e[21]=b):b=e[21],y="flex flex-col gap-4 overflow-y-auto",N="api-rail";let ne;e[22]!==d||e[23]!==n?(ne=u(z=>(0,T.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,T.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:z.file||n("(root)")}),z.items.map(ee=>(0,T.jsx)(je,{active:d?.kind==="fn"&&d.path===ee.path,label:ee.fn,onSelect:D,testId:`api-rail-fn-${ee.path}`,value:ee.path},ee.path))]},z.file),"K"),e[22]=d,e[23]=n,e[24]=ne):ne=e[24],v=_.map(ne),g=J.length>0&&(0,T.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,T.jsx)("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Tables")}),J.map(z=>(0,T.jsx)(je,{active:d?.kind==="table"&&d.name===z,label:z,onSelect:Ge,testId:`api-rail-table-${z}`,value:z},z))]}),e[4]=a,e[5]=d,e[6]=n,e[7]=o,e[8]=f,e[9]=x,e[10]=h,e[11]=b,e[12]=y,e[13]=N,e[14]=v,e[15]=g,e[16]=k,e[17]=O}else f=e[8],x=e[9],h=e[10],b=e[11],y=e[12],N=e[13],v=e[14],g=e[15],k=e[16],O=e[17];let P;e[25]!==f||e[26]!==n?(P=!f&&(0,T.jsx)("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:n("No functions or tables to document yet.")}),e[25]=f,e[26]=n,e[27]=P):P=e[27];let w;e[28]!==P||e[29]!==b||e[30]!==y||e[31]!==N||e[32]!==v||e[33]!==g?(w=(0,T.jsxs)("nav",{"aria-label":b,className:y,"data-testid":N,children:[v,g,P]}),e[28]=P,e[29]=b,e[30]=y,e[31]=N,e[32]=v,e[33]=g,e[34]=w):w=e[34];let I;e[35]!==d||e[36]!==n?(I=d===null&&(0,T.jsx)(B,{description:n("Select a function or table to see how to call it from your app."),testId:"api-empty",title:n("API usage snippets")}),e[35]=d,e[36]=n,e[37]=I):I=e[37];let j;e[38]!==d?.kind||e[39]!==x||e[40]!==h?(j=d?.kind==="fn"&&x!==void 0&&h!==void 0&&(0,T.jsx)(at,{file:h.file,fn:h.fn,kind:x.kind},x.path),e[38]=d?.kind,e[39]=x,e[40]=h,e[41]=j):j=e[41];let $;e[42]!==d?.kind||e[43]!==x||e[44]!==n?($=d?.kind==="fn"&&x===void 0&&(0,T.jsx)(B,{testId:"api-empty",title:n("API usage snippets")}),e[42]=d?.kind,e[43]=x,e[44]=n,e[45]=$):$=e[45];let S;e[46]!==d?(S=d?.kind==="table"&&(0,T.jsx)(nt,{name:d.name}),e[46]=d,e[47]=S):S=e[47];let C;e[48]!==I||e[49]!==j||e[50]!==$||e[51]!==S?(C=(0,T.jsxs)("div",{className:"min-w-0",children:[I,j,$,S]}),e[48]=I,e[49]=j,e[50]=$,e[51]=S,e[52]=C):C=e[52];let A;return e[53]!==w||e[54]!==C||e[55]!==k||e[56]!==O?(A=(0,T.jsxs)("div",{className:k,"data-testid":O,children:[w,C]}),e[53]=w,e[54]=C,e[55]=k,e[56]=O,e[57]=A):A=e[57],A},"Se");function st(t){return t.name}u(st,"ue");function it(t,e){return t.localeCompare(e)}u(it,"he");var We=K(te(),1);var q=K(te(),1),L=K(ue(),1);var p=K(re(),1);var pe=u(function(t,e,a){let r=(0,q.c)(10),n;r[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},r[0]=n):n=r[0];let[s,o]=(0,L.useState)(n),i,d;r[1]!==a||r[2]!==e||r[3]!==t?(i=u(()=>{if(t!==void 0)return;let l=!1;return e().then(c=>(l||o(a(c)),c)).catch(c=>{l||o({kind:"error",message:le(c)})}),()=>{l=!0}},"l"),d=[a,e,t],r[1]=a,r[2]=e,r[3]=t,r[4]=i,r[5]=d):(i=r[4],d=r[5]),(0,L.useEffect)(i,d);let m;return r[6]!==a||r[7]!==s||r[8]!==t?(m=t===void 0?s:a(t),r[6]=a,r[7]=s,r[8]=t,r[9]=m):m=r[9],m},"gt"),lt=u(t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string","$e"),Re=u(t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},"X"),ce=u(t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>ce(e)).join(" | "):t.type==="array"?`array<${ce(t.items)}>`:t.type??"any","B"),dt=u(t=>{let e=Re(t);return e!==void 0?t.type??lt(e[0]):ce(t)},"ke"),ct=u(t=>{let e=Re(t);return e===void 0?void 0:e.map(a=>JSON.stringify(a)).join(" | ")},"Se"),pt=u(t=>{let e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} \u2264`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);let a=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`\u2264 ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);let r=e.length>(a?2:1);return a||r?e.join(" "):void 0},"we"),mt=u(t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},"Oe"),Y=u(t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return Y(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{let e={};for(let[a,r]of Object.entries(t.properties??{}))e[a]=Y(r);return e}case"string":return"";default:return null}},"q"),de=u(t=>{let e=(0,q.c)(7),{label:a,value:r}=t,n;e[0]!==a?(n=(0,p.jsx)("span",{className:"text-muted-foreground",children:a}),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==r?(s=(0,p.jsx)("span",{className:"text-foreground",children:r}),e[2]=r,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,p.jsxs)("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"W"),ut=u(t=>{let e=(0,q.c)(40),{name:a,required:r,schema:n}=t,s=E(),o;e[0]!==n?(o=pt(n),e[0]=n,e[1]=o):o=e[1];let i=o,d;e[2]!==n?(d=ct(n),e[2]=n,e[3]=d):d=e[3];let m=d,l=n["x-lunora-table"],c=n.format!==void 0||i!==void 0||m!==void 0||l!==void 0,f;e[4]!==n?(f=mt(n),e[4]=n,e[5]=f):f=e[5];let x=f,h=r?"*":"?",b;e[6]!==h?(b=(0,p.jsx)("span",{className:"text-muted-foreground",children:h}),e[6]=h,e[7]=b):b=e[7];let y;e[8]!==a||e[9]!==b?(y=(0,p.jsxs)("span",{className:"font-mono text-foreground",children:[a,b]}),e[8]=a,e[9]=b,e[10]=y):y=e[10];let N;e[11]!==n?(N=dt(n),e[11]=n,e[12]=N):N=e[12];let v;e[13]!==N?(v=(0,p.jsx)("span",{className:"font-mono text-muted-foreground",children:N}),e[13]=N,e[14]=v):v=e[14];let g;e[15]!==y||e[16]!==v?(g=(0,p.jsxs)("div",{className:"flex items-baseline gap-2",children:[y,v]}),e[15]=y,e[16]=v,e[17]=g):g=e[17];let k;e[18]!==n.description?(k=n.description!==void 0&&(0,p.jsx)("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=k):k=e[19];let O;e[20]!==c||e[21]!==i||e[22]!==l||e[23]!==n.format||e[24]!==s||e[25]!==m?(O=c&&(0,p.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&(0,p.jsx)(de,{label:s("Format"),value:n.format}),i!==void 0&&(0,p.jsx)(de,{label:s("Range"),value:i}),m!==void 0&&(0,p.jsx)(de,{label:s("Value in"),value:m}),l!==void 0&&(0,p.jsx)(de,{label:s("relation"),value:l})]}),e[20]=c,e[21]=i,e[22]=l,e[23]=n.format,e[24]=s,e[25]=m,e[26]=O):O=e[26];let P;e[27]!==k||e[28]!==O||e[29]!==g?(P=(0,p.jsxs)("div",{className:"flex flex-col gap-1 py-2",children:[g,k,O]}),e[27]=k,e[28]=O,e[29]=g,e[30]=P):P=e[30];let w=P;if(x===void 0){let S;return e[31]!==w?(S=(0,p.jsx)("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=S):S=e[32],S}let I;e[33]!==w?(I=(0,p.jsx)("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=I):I=e[34];let j;e[35]!==x?(j=(0,p.jsx)("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:(0,p.jsx)(Je,{schema:x})}),e[35]=x,e[36]=j):j=e[36];let $;return e[37]!==I||e[38]!==j?($=(0,p.jsxs)("details",{className:"border-b border-border/50 last:border-b-0",children:[I,j]}),e[37]=I,e[38]=j,e[39]=$):$=e[39],$},"je"),Je=u(t=>{let e=(0,q.c)(7),{schema:a}=t,r;e[0]!==a.required?(r=new Set(a.required),e[0]=a.required,e[1]=r):r=e[1];let n=r,s;e[2]!==a.properties?(s=Object.entries(a.properties??{}),e[2]=a.properties,e[3]=s):s=e[3];let o=s,i;return e[4]!==n||e[5]!==o?(i=(0,p.jsx)("div",{className:"flex flex-col",children:o.map(d=>{let[m,l]=d;return(0,p.jsx)(ut,{name:m,required:n.has(m),schema:l},m)})}),e[4]=n,e[5]=o,e[6]=i):i=e[6],i},"Y"),Me=u(t=>{let e=(0,q.c)(10),{schema:a,testId:r}=t;if(a?.type!=="object"||Object.keys(a.properties??{}).length===0){let o;e[0]!==a?(o=ce(a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==o||e[3]!==r?(i=(0,p.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:o}),e[2]=o,e[3]=r,e[4]=i):i=e[4],i}let n;e[5]!==a?(n=(0,p.jsx)(Je,{schema:a}),e[5]=a,e[6]=n):n=e[6];let s;return e[7]!==n||e[8]!==r?(s=(0,p.jsx)("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=s):s=e[9],s},"G"),ft=["curl","javascript","lunora"],ht={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},xt=u(t=>`api.${t.replaceAll(/[/:]/g,".")}`,"Pe"),gt=u(t=>{let e=Y(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},"Te"),bt=u((t,e,a)=>{let r=`${a}${e.httpPath}`,n=JSON.stringify(gt(e),void 0,2),s=JSON.stringify(Y(e.argsSchema)??{},void 0,2);switch(t){case"curl":{let o=e.method!=="GET"&&e.method!=="HEAD",i=[`curl -X ${e.method} ${JSON.stringify(r)}`];return o&&i.push(' -H "Content-Type: application/json"',` -d '${n}'`),i.join(` \\
|
|
3
3
|
`)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
|
|
4
4
|
import { api } from "./_generated/api";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Ue}from"./chunk-
|
|
1
|
+
import{b as Ue}from"./chunk-WLZ7YPBH.js";import{c as _e}from"./chunk-XF2B7P5A.js";import"./chunk-7H7LZRLP.js";import"./chunk-SD4BERSA.js";import"./chunk-IC4L6G56.js";import{a as ye}from"./chunk-JN2Y24PY.js";import"./chunk-ESVP44Y3.js";import{a as Re}from"./chunk-54MMVNPT.js";import"./chunk-I6A5C46N.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import{a as Le}from"./chunk-QXXIJAD5.js";import{a as De}from"./chunk-X665E2HU.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as Ne}from"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{c as re}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as ae}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as be}from"./chunk-ERMTJYQF.js";import{f as Se}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as he}from"./chunk-XQCVZAGU.js";import{a as $e,b as Te,c as Fe,d as ce,e as ne,f as ee}from"./chunk-MIQTKZAR.js";import{a as je,e as ze}from"./chunk-UZERI5YC.js";import{d as Ce,f as me,g as ge,h as X,m as W,o as Ke,p as pe}from"./chunk-OG4N2XHD.js";import"./chunk-AADILRJW.js";import{a as g,e as fe,f as mt,g as gt,h as pt}from"./chunk-3XIESWL4.js";var M=fe(gt(),1),j=fe(mt(),1);var n=fe(pt(),1);var Oe=g((d,e,t)=>{let{onCopy:r,onDelete:s,onDownload:o,onToggleSelect:c}=t,i=g(()=>{r(d.key)},"i"),l=g(()=>{o(d.key)},"o"),u=g(()=>{s(d.key)},"u"),h=g(()=>{c(d.key)},"h");return{copy:i,download:l,name:d.key.slice(e.length),remove:u,toggle:h}},"Ke"),Me=g(d=>{let e=(0,M.c)(31),{busy:t,buttonClassName:r,copied:s,objectKey:o,onCopy:c,onDelete:i,onDownload:l,t:u}=d,h=`storage-copy-${o}`,f;e[0]!==s||e[1]!==u?(f=u(s?"Copied":"Copy URL"),e[0]=s,e[1]=u,e[2]=f):f=e[2];let m;e[3]!==t||e[4]!==r||e[5]!==c||e[6]!==h||e[7]!==f?(m=(0,n.jsx)(re,{className:r,"data-testid":h,disabled:t,onClick:c,size:"sm",type:"button",variant:"ghost",children:f}),e[3]=t,e[4]=r,e[5]=c,e[6]=h,e[7]=f,e[8]=m):m=e[8];let w=`storage-download-${o}`,a;e[9]!==u?(a=u("Download"),e[9]=u,e[10]=a):a=e[10];let k;e[11]!==t||e[12]!==r||e[13]!==l||e[14]!==w||e[15]!==a?(k=(0,n.jsx)(re,{className:r,"data-testid":w,disabled:t,onClick:l,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=t,e[12]=r,e[13]=l,e[14]=w,e[15]=a,e[16]=k):k=e[16];let C;e[17]!==u?(C=u("Delete object?"),e[17]=u,e[18]=C):C=e[18];let x=`storage-delete-${o}`,b;e[19]!==u?(b=u("Delete"),e[19]=u,e[20]=b):b=e[20];let v;e[21]!==t||e[22]!==i||e[23]!==C||e[24]!==x||e[25]!==b?(v=(0,n.jsx)(Le,{confirmLabel:C,disabled:t,onConfirm:i,testId:x,children:b}),e[21]=t,e[22]=i,e[23]=C,e[24]=x,e[25]=b,e[26]=v):v=e[26];let y;return e[27]!==v||e[28]!==m||e[29]!==k?(y=(0,n.jsxs)(n.Fragment,{children:[m,k,v]}),e[27]=v,e[28]=m,e[29]=k,e[30]=y):y=e[30],y},"De"),Ae=g(d=>{let e=(0,M.c)(14),{objectKey:t,references:r,t:s}=d;if(r===void 0)return null;if(r.length===0){let h=`storage-orphan-${t}`,f;e[0]!==s?(f=s("Orphan"),e[0]=s,e[1]=f):f=e[1];let m;return e[2]!==h||e[3]!==f?(m=(0,n.jsx)(ae,{"data-testid":h,variant:"warning",children:f}),e[2]=h,e[3]=f,e[4]=m):m=e[4],m}let o;e[5]!==r?(o=r.map(bt).join(`
|
|
2
2
|
`),e[5]=r,e[6]=o):o=e[6];let c=o,i=`storage-refs-${t}`,l;e[7]!==r.length||e[8]!==s?(l=r.length===1?s("1 record"):s("{count} records",{count:r.length}),e[7]=r.length,e[8]=s,e[9]=l):l=e[9];let u;return e[10]!==c||e[11]!==i||e[12]!==l?(u=(0,n.jsx)(ae,{"data-testid":i,title:c,variant:"secondary",children:l}),e[10]=c,e[11]=i,e[12]=l,e[13]=u):u=e[13],u},"Te"),Pe=g(d=>{let e=(0,M.c)(7),{objectKey:t,onToggle:r,selected:s,t:o}=d,c;e[0]!==o?(c=o("Select row"),e[0]=o,e[1]=c):c=e[1];let i=`storage-select-${t}`,l;return e[2]!==r||e[3]!==s||e[4]!==c||e[5]!==i?(l=(0,n.jsx)(ye,{"aria-label":c,checked:s,"data-testid":i,onCheckedChange:r}),e[2]=r,e[3]=s,e[4]=c,e[5]=i,e[6]=l):l=e[6],l},"Fe");function bt(d){return`${d.table}\xB7${d.id}`}g(bt,"yt");var yt=g(d=>{let e=(0,M.c)(10),{colSpan:t,name:r,onEnter:s}=d,o;e[0]!==r||e[1]!==s?(o=g(()=>{s(r)},"n"),e[0]=r,e[1]=s,e[2]=o):o=e[2];let c=o,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})}),e[3]=i):i=e[3];let l;e[4]!==c||e[5]!==r?(l=(0,n.jsxs)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:c,type:"button",children:[i,r]}),e[4]=c,e[5]=r,e[6]=l):l=e[6];let u;return e[7]!==t||e[8]!==l?(u=(0,n.jsx)(ce,{children:(0,n.jsx)(ee,{colSpan:t,children:l})}),e[7]=t,e[8]=l,e[9]=u):u=e[9],u},"xt"),xt=g(d=>{let e=(0,M.c)(37),{busy:t,copiedKey:r,handlers:s,object:o,prefix:c,references:i,selected:l,showReferences:u,t:h}=d,f;e[0]!==s||e[1]!==o||e[2]!==c?(f=Oe(o,c,s),e[0]=s,e[1]=o,e[2]=c,e[3]=f):f=e[3];let{copy:m,download:w,name:a,remove:k,toggle:C}=f,x;e[4]!==o.key||e[5]!==l||e[6]!==h||e[7]!==C?(x=(0,n.jsx)(ee,{className:"w-8",children:(0,n.jsx)(Pe,{objectKey:o.key,onToggle:C,selected:l,t:h})}),e[4]=o.key,e[5]=l,e[6]=h,e[7]=C,e[8]=x):x=e[8];let b;e[9]!==a?(b=(0,n.jsx)(ee,{className:"font-mono text-xs",children:a}),e[9]=a,e[10]=b):b=e[10];let v;e[11]!==o.size?(v=pe(o.size),e[11]=o.size,e[12]=v):v=e[12];let y;e[13]!==v?(y=(0,n.jsx)(ee,{className:"tabular-nums text-muted-foreground",children:v}),e[13]=v,e[14]=y):y=e[14];let z=o.httpMetadata?.contentType??"",S;e[15]!==z?(S=(0,n.jsx)(ee,{children:z}),e[15]=z,e[16]=S):S=e[16];let N;e[17]!==o.key||e[18]!==i||e[19]!==u||e[20]!==h?(N=u&&(0,n.jsx)(ee,{children:(0,n.jsx)(Ae,{objectKey:o.key,references:i,t:h})}),e[17]=o.key,e[18]=i,e[19]=u,e[20]=h,e[21]=N):N=e[21];let $=r===o.key,K;e[22]!==t||e[23]!==m||e[24]!==w||e[25]!==o.key||e[26]!==k||e[27]!==h||e[28]!==$?(K=(0,n.jsx)(ee,{className:"text-right",children:(0,n.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,n.jsx)(Me,{busy:t,copied:$,objectKey:o.key,onCopy:m,onDelete:k,onDownload:w,t:h})})}),e[22]=t,e[23]=m,e[24]=w,e[25]=o.key,e[26]=k,e[27]=h,e[28]=$,e[29]=K):K=e[29];let F;return e[30]!==K||e[31]!==x||e[32]!==b||e[33]!==y||e[34]!==S||e[35]!==N?(F=(0,n.jsxs)(ce,{"data-testid":"fb-row",children:[x,b,y,S,N,K]}),e[30]=K,e[31]=x,e[32]=b,e[33]=y,e[34]=S,e[35]=N,e[36]=F):F=e[36],F},"vt"),vt=g(d=>{let e=(0,M.c)(65),{allSelected:t,busy:r,copiedKey:s,files:o,folders:c,handlers:i,onEnterFolder:l,prefix:u,references:h,selected:f,showReferences:m,someSelected:w,t:a,toggleSelectAll:k}=d,C;e[0]!==a?(C=a("Select all rows"),e[0]=a,e[1]=C):C=e[1];let x;e[2]!==t||e[3]!==w||e[4]!==C||e[5]!==k?(x=(0,n.jsx)(ne,{className:"w-8",children:(0,n.jsx)(ye,{"aria-label":C,checked:t,"data-testid":"storage-select-all",indeterminate:w,onCheckedChange:k})}),e[2]=t,e[3]=w,e[4]=C,e[5]=k,e[6]=x):x=e[6];let b;e[7]!==a?(b=a("key"),e[7]=a,e[8]=b):b=e[8];let v;e[9]!==b?(v=(0,n.jsx)(ne,{children:b}),e[9]=b,e[10]=v):v=e[10];let y;e[11]!==a?(y=a("size"),e[11]=a,e[12]=y):y=e[12];let z;e[13]!==y?(z=(0,n.jsx)(ne,{children:y}),e[13]=y,e[14]=z):z=e[14];let S;e[15]!==a?(S=a("content-type"),e[15]=a,e[16]=S):S=e[16];let N;e[17]!==S?(N=(0,n.jsx)(ne,{children:S}),e[17]=S,e[18]=N):N=e[18];let $;e[19]!==m||e[20]!==a?($=m&&(0,n.jsx)(ne,{children:a("used by")}),e[19]=m,e[20]=a,e[21]=$):$=e[21];let K;e[22]!==a?(K=a("Actions"),e[22]=a,e[23]=K):K=e[23];let F;e[24]!==K?(F=(0,n.jsx)(ne,{"aria-label":K}),e[24]=K,e[25]=F):F=e[25];let T;e[26]!==F||e[27]!==x||e[28]!==v||e[29]!==z||e[30]!==N||e[31]!==$?(T=(0,n.jsx)(Te,{children:(0,n.jsxs)(ce,{children:[x,v,z,N,$,F]})}),e[26]=F,e[27]=x,e[28]=v,e[29]=z,e[30]=N,e[31]=$,e[32]=T):T=e[32];let L;if(e[33]!==c||e[34]!==l||e[35]!==m){let R;e[37]!==l||e[38]!==m?(R=g(_=>(0,n.jsx)(yt,{colSpan:m?6:5,name:_,onEnter:l},_),"R"),e[37]=l,e[38]=m,e[39]=R):R=e[39],L=c.map(R),e[33]=c,e[34]=l,e[35]=m,e[36]=L}else L=e[36];let B;if(e[40]!==r||e[41]!==s||e[42]!==o||e[43]!==i||e[44]!==u||e[45]!==h||e[46]!==f||e[47]!==m||e[48]!==a){let R;e[50]!==r||e[51]!==s||e[52]!==i||e[53]!==u||e[54]!==h||e[55]!==f||e[56]!==m||e[57]!==a?(R=g(_=>(0,n.jsx)(xt,{busy:r,copiedKey:s,handlers:i,object:_,prefix:u,references:h[_.key],selected:f.has(_.key),showReferences:m,t:a},_.key),"R"),e[50]=r,e[51]=s,e[52]=i,e[53]=u,e[54]=h,e[55]=f,e[56]=m,e[57]=a,e[58]=R):R=e[58],B=o.map(R),e[40]=r,e[41]=s,e[42]=o,e[43]=i,e[44]=u,e[45]=h,e[46]=f,e[47]=m,e[48]=a,e[49]=B}else B=e[49];let U;e[59]!==L||e[60]!==B?(U=(0,n.jsxs)(Fe,{children:[L,B]}),e[59]=L,e[60]=B,e[61]=U):U=e[61];let I;return e[62]!==T||e[63]!==U?(I=(0,n.jsx)(je,{className:"overflow-hidden py-0",children:(0,n.jsx)(ze,{className:"px-0",children:(0,n.jsxs)($e,{"data-testid":"fb-table",children:[T,U]})})}),e[62]=T,e[63]=U,e[64]=I):I=e[64],I},"kt"),kt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],wt=3600,Be=g((d,e)=>{if(e==="size")return d.size;if(e==="type")return d.httpMetadata?.contentType??"";if(e==="date"){if(d.uploaded===void 0)return 0;let t=new Date(d.uploaded).getTime();return Number.isNaN(t)?0:t}return e.startsWith("tag:")?d.customMetadata?.[e.slice(4)]??"":d.key},"ve"),St=g((d,e,t)=>{let r=t==="desc"?-1:1;return d.toSorted((s,o)=>{let c=Be(s,e),i=Be(o,e);return(typeof c=="number"&&typeof i=="number"?c-i:String(c).localeCompare(String(i)))*r})},"Nt"),Ct=g((d,e)=>{let t=new Set,r=[];for(let s of d){let o=s.key.slice(e.length),c=o.indexOf("/");c===-1?r.push(s):t.add(o.slice(0,c+1))}return{files:r,folders:[...t].toSorted((s,o)=>s.localeCompare(o))}},"Ct"),Nt=g(d=>{let e=(0,M.c)(59),{bucket:t,buckets:r,busy:s,draftPrefix:o,expiry:c,fileInputRef:i,onBucketChange:l,onExpiryChange:u,onFileChange:h,onList:f,onPrefixChange:m,onUploadClick:w,t:a}=d,k;e[0]!==m?(k=g(P=>{m(P.target.value)},"v"),e[0]=m,e[1]=k):k=e[1];let C=k,x;e[2]!==l?(x=g(P=>{l(P.target.value)},"y"),e[2]=l,e[3]=x):x=e[3];let b=x,v;e[4]!==u?(v=g(P=>{u(Number.parseInt(P.target.value,10))},"x"),e[4]=u,e[5]=v):v=e[5];let y=v,z;e[6]!==t||e[7]!==r||e[8]!==b||e[9]!==a?(z=r.length>0&&(0,n.jsx)("select",{"aria-label":a("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:b,value:t,children:r.map(zt)}),e[6]=t,e[7]=r,e[8]=b,e[9]=a,e[10]=z):z=e[10];let S;e[11]!==a?(S=a("Key prefix"),e[11]=a,e[12]=S):S=e[12];let N;e[13]!==a?(N=a("key prefix (optional)"),e[13]=a,e[14]=N):N=e[14];let $;e[15]!==o||e[16]!==C||e[17]!==S||e[18]!==N?($=(0,n.jsx)(Ne,{"aria-label":S,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:C,placeholder:N,value:o}),e[15]=o,e[16]=C,e[17]=S,e[18]=N,e[19]=$):$=e[19];let K;e[20]!==a?(K=a("List"),e[20]=a,e[21]=K):K=e[21];let F;e[22]!==s||e[23]!==f||e[24]!==K?(F=(0,n.jsx)(re,{"data-testid":"fb-list",disabled:s,onClick:f,size:"sm",type:"button",children:K}),e[22]=s,e[23]=f,e[24]=K,e[25]=F):F=e[25];let T;e[26]!==s||e[27]!==a?(T=a(s?"Uploading\u2026":"Upload"),e[26]=s,e[27]=a,e[28]=T):T=e[28];let L;e[29]!==s||e[30]!==w||e[31]!==T?(L=(0,n.jsx)(re,{"data-testid":"storage-upload",disabled:s,onClick:w,size:"sm",type:"button",variant:"outline",children:T}),e[29]=s,e[30]=w,e[31]=T,e[32]=L):L=e[32];let B;e[33]!==i||e[34]!==h?(B=(0,n.jsx)("input",{className:"hidden","data-testid":"storage-file-input",onChange:h,ref:i,type:"file"}),e[33]=i,e[34]=h,e[35]=B):B=e[35];let U;e[36]!==a?(U=a("Link expiry"),e[36]=a,e[37]=U):U=e[37];let I;e[38]!==a?(I=kt.map(P=>(0,n.jsx)("option",{value:P.seconds,children:a(P.label)},P.seconds)),e[38]=a,e[39]=I):I=e[39];let R;e[40]!==c||e[41]!==y||e[42]!==I?(R=(0,n.jsx)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:y,value:c,children:I}),e[40]=c,e[41]=y,e[42]=I,e[43]=R):R=e[43];let _;e[44]!==U||e[45]!==R?(_=(0,n.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[U,R]}),e[44]=U,e[45]=R,e[46]=_):_=e[46];let O;e[47]!==a?(O=a("Open in Cloudflare"),e[47]=a,e[48]=O):O=e[48];let A;e[49]!==O?(A=(0,n.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:_e,rel:"noreferrer",target:"_blank",children:O}),e[49]=O,e[50]=A):A=e[50];let G;return e[51]!==L||e[52]!==B||e[53]!==_||e[54]!==A||e[55]!==z||e[56]!==$||e[57]!==F?(G=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[z,$,F,L,B,_,A]}),e[51]=L,e[52]=B,e[53]=_,e[54]=A,e[55]=z,e[56]=$,e[57]=F,e[58]=G):G=e[58],G},"$t"),jt=g(d=>{let e=(0,M.c)(66),{onSortKeyChange:t,onThumbSizeChange:r,showGrid:s,showList:o,sortDirection:c,sortKey:i,t:l,tagKeys:u,thumbSize:h,toggleSortDirection:f,view:m}=d,w;e[0]!==t?(w=g(V=>{t(V.target.value)},"k"),e[0]=t,e[1]=w):w=e[1];let a=w,k;e[2]!==r?(k=g(V=>{r(Number.parseInt(V.target.value,10))},"v"),e[2]=r,e[3]=k):k=e[3];let C=k,x=m==="list",b;e[4]!==l?(b=l("List"),e[4]=l,e[5]=b):b=e[5];let v;e[6]!==o||e[7]!==x||e[8]!==b?(v=(0,n.jsx)("button",{"aria-pressed":x,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:o,type:"button",children:b}),e[6]=o,e[7]=x,e[8]=b,e[9]=v):v=e[9];let y=m==="grid",z;e[10]!==l?(z=l("Grid"),e[10]=l,e[11]=z):z=e[11];let S;e[12]!==s||e[13]!==y||e[14]!==z?(S=(0,n.jsx)("button",{"aria-pressed":y,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:s,type:"button",children:z}),e[12]=s,e[13]=y,e[14]=z,e[15]=S):S=e[15];let N;e[16]!==v||e[17]!==S?(N=(0,n.jsxs)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[v,S]}),e[16]=v,e[17]=S,e[18]=N):N=e[18];let $;e[19]!==l?($=l("Sort"),e[19]=l,e[20]=$):$=e[20];let K;e[21]!==l?(K=l("Name"),e[21]=l,e[22]=K):K=e[22];let F;e[23]!==K?(F=(0,n.jsx)("option",{value:"name",children:K}),e[23]=K,e[24]=F):F=e[24];let T;e[25]!==l?(T=l("size"),e[25]=l,e[26]=T):T=e[26];let L;e[27]!==T?(L=(0,n.jsx)("option",{value:"size",children:T}),e[27]=T,e[28]=L):L=e[28];let B;e[29]!==l?(B=l("Type"),e[29]=l,e[30]=B):B=e[30];let U;e[31]!==B?(U=(0,n.jsx)("option",{value:"type",children:B}),e[31]=B,e[32]=U):U=e[32];let I;e[33]!==l?(I=l("Modified"),e[33]=l,e[34]=I):I=e[34];let R;e[35]!==I?(R=(0,n.jsx)("option",{value:"date",children:I}),e[35]=I,e[36]=R):R=e[36];let _;e[37]!==u?(_=u.map(Kt),e[37]=u,e[38]=_):_=e[38];let O;e[39]!==a||e[40]!==i||e[41]!==F||e[42]!==L||e[43]!==U||e[44]!==R||e[45]!==_?(O=(0,n.jsxs)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:a,value:i,children:[F,L,U,R,_]}),e[39]=a,e[40]=i,e[41]=F,e[42]=L,e[43]=U,e[44]=R,e[45]=_,e[46]=O):O=e[46];let A;e[47]!==$||e[48]!==O?(A=(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[$,O]}),e[47]=$,e[48]=O,e[49]=A):A=e[49];let G;e[50]!==l?(G=l("Toggle sort direction"),e[50]=l,e[51]=G):G=e[51];let P=c==="asc"?"\u2191":"\u2193",H;e[52]!==G||e[53]!==P||e[54]!==f?(H=(0,n.jsx)("button",{"aria-label":G,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:f,type:"button",children:P}),e[52]=G,e[53]=P,e[54]=f,e[55]=H):H=e[55];let Y;e[56]!==C||e[57]!==l||e[58]!==h||e[59]!==m?(Y=m==="grid"&&(0,n.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[l("Thumbnail size"),(0,n.jsx)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:C,step:8,type:"range",value:h})]}),e[56]=C,e[57]=l,e[58]=h,e[59]=m,e[60]=Y):Y=e[60];let oe;return e[61]!==A||e[62]!==H||e[63]!==Y||e[64]!==N?(oe=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[N,A,H,Y]}),e[61]=A,e[62]=H,e[63]=Y,e[64]=N,e[65]=oe):oe=e[65],oe},"jt");function zt(d){return(0,n.jsx)("option",{value:d,children:d},d)}g(zt,"zt");function Kt(d){return(0,n.jsx)("option",{value:`tag:${d}`,children:d},d)}g(Kt,"Kt");var Dt=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,$t=g(d=>(d.httpMetadata?.contentType??"").startsWith("image/")||Dt.test(d.key),"Tt"),Tt=g(()=>{let d=(0,M.c)(1),e;return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"})}),d[0]=e):e=d[0],e},"Ft"),Ft=g(d=>{let e=(0,M.c)(13),{object:t,resolveUrl:r}=d,[s,o]=(0,j.useState)(null),[c,i]=(0,j.useState)(!1),l;e[0]!==t?(l=$t(t),e[0]=t,e[1]=l):l=e[1];let u=l,h,f;e[2]!==u||e[3]!==t.key||e[4]!==r?(h=g(()=>{if(!u)return;let k={cancelled:!1};return W((async()=>{try{let C=await r(t.key);k.cancelled||o(C)}catch{k.cancelled||i(!0)}})()),()=>{k.cancelled=!0}},"h"),f=[u,t.key,r],e[2]=u,e[3]=t.key,e[4]=r,e[5]=h,e[6]=f):(h=e[5],f=e[6]),(0,j.useEffect)(h,f);let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=g(()=>{i(!0)},"m"),e[7]=m):m=e[7];let w=m,a;return e[8]!==c||e[9]!==u||e[10]!==t.key||e[11]!==s?(a=(0,n.jsx)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:u&&s!==null&&!c?(0,n.jsx)("img",{alt:t.key,className:"size-full object-cover",loading:"lazy",onError:w,src:s}):(0,n.jsx)(Tt,{})}),e[8]=c,e[9]=u,e[10]=t.key,e[11]=s,e[12]=a):a=e[12],a},"Rt"),Lt=g(d=>{let e=(0,M.c)(42),{busy:t,copiedKey:r,handlers:s,object:o,prefix:c,references:i,resolveUrl:l,selected:u,showReferences:h,t:f}=d,m;e[0]!==s||e[1]!==o||e[2]!==c?(m=Oe(o,c,s),e[0]=s,e[1]=o,e[2]=c,e[3]=m):m=e[3];let{copy:w,download:a,name:k,remove:C,toggle:x}=m,b;e[4]!==o||e[5]!==l?(b=(0,n.jsx)(Ft,{object:o,resolveUrl:l}),e[4]=o,e[5]=l,e[6]=b):b=e[6];let v;e[7]!==o.key||e[8]!==u||e[9]!==f||e[10]!==x?(v=(0,n.jsx)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,n.jsx)(Pe,{objectKey:o.key,onToggle:x,selected:u,t:f})}),e[7]=o.key,e[8]=u,e[9]=f,e[10]=x,e[11]=v):v=e[11];let y;e[12]!==b||e[13]!==v?(y=(0,n.jsxs)("div",{className:"relative",children:[b,v]}),e[12]=b,e[13]=v,e[14]=y):y=e[14];let z;e[15]!==k?(z=(0,n.jsx)("p",{className:"truncate font-mono text-xs",title:k,children:k}),e[15]=k,e[16]=z):z=e[16];let S;e[17]!==o.size?(S=pe(o.size),e[17]=o.size,e[18]=S):S=e[18];let N;e[19]!==S?(N=(0,n.jsx)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:S}),e[19]=S,e[20]=N):N=e[20];let $;e[21]!==o.key||e[22]!==i||e[23]!==h||e[24]!==f?($=h&&(0,n.jsx)("div",{className:"mt-1",children:(0,n.jsx)(Ae,{objectKey:o.key,references:i,t:f})}),e[21]=o.key,e[22]=i,e[23]=h,e[24]=f,e[25]=$):$=e[25];let K;e[26]!==z||e[27]!==N||e[28]!==$?(K=(0,n.jsxs)("div",{className:"min-w-0",children:[z,N,$]}),e[26]=z,e[27]=N,e[28]=$,e[29]=K):K=e[29];let F=r===o.key,T;e[30]!==t||e[31]!==w||e[32]!==a||e[33]!==o.key||e[34]!==C||e[35]!==f||e[36]!==F?(T=(0,n.jsx)("div",{className:"flex items-center gap-1",children:(0,n.jsx)(Me,{busy:t,buttonClassName:"h-7 px-2 text-xs",copied:F,objectKey:o.key,onCopy:w,onDelete:C,onDownload:a,t:f})}),e[30]=t,e[31]=w,e[32]=a,e[33]=o.key,e[34]=C,e[35]=f,e[36]=F,e[37]=T):T=e[37];let L;return e[38]!==T||e[39]!==y||e[40]!==K?(L=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[y,K,T]}),e[38]=T,e[39]=y,e[40]=K,e[41]=L):L=e[41],L},"Lt"),Rt=g(d=>{let e=(0,M.c)(9),{name:t,onEnter:r}=d,s;e[0]!==t||e[1]!==r?(s=g(()=>{r(t)},"l"),e[0]=t,e[1]=r,e[2]=s):s=e[2];let o=s,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,n.jsx)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})})}),e[3]=c):c=e[3];let i;e[4]!==t?(i=(0,n.jsx)("span",{className:"truncate font-mono text-xs",title:t,children:t}),e[4]=t,e[5]=i):i=e[5];let l;return e[6]!==o||e[7]!==i?(l=(0,n.jsxs)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:o,type:"button",children:[c,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8],l},"Ot"),Ut=g(d=>{let e=(0,M.c)(34),{busy:t,copiedKey:r,files:s,folders:o,handlers:c,onEnterFolder:i,prefix:l,references:u,resolveUrl:h,selected:f,showReferences:m,size:w,t:a}=d,k;e[0]!==w?(k=w.toString(),e[0]=w,e[1]=k):k=e[1];let C=`repeat(auto-fill, minmax(${k}px, 1fr))`,x;e[2]!==C?(x={gridTemplateColumns:C},e[2]=C,e[3]=x):x=e[3];let b=x,v;if(e[4]!==o||e[5]!==i){let S;e[7]!==i?(S=g(N=>(0,n.jsx)(Rt,{name:N,onEnter:i},N),"w"),e[7]=i,e[8]=S):S=e[8],v=o.map(S),e[4]=o,e[5]=i,e[6]=v}else v=e[6];let y;if(e[9]!==t||e[10]!==r||e[11]!==s||e[12]!==c||e[13]!==l||e[14]!==u||e[15]!==h||e[16]!==f||e[17]!==m||e[18]!==a){let S;e[20]!==t||e[21]!==r||e[22]!==c||e[23]!==l||e[24]!==u||e[25]!==h||e[26]!==f||e[27]!==m||e[28]!==a?(S=g(N=>(0,n.jsx)(Lt,{busy:t,copiedKey:r,handlers:c,object:N,prefix:l,references:u[N.key],resolveUrl:h,selected:f.has(N.key),showReferences:m,t:a},N.key),"w"),e[20]=t,e[21]=r,e[22]=c,e[23]=l,e[24]=u,e[25]=h,e[26]=f,e[27]=m,e[28]=a,e[29]=S):S=e[29],y=s.map(S),e[9]=t,e[10]=r,e[11]=s,e[12]=c,e[13]=l,e[14]=u,e[15]=h,e[16]=f,e[17]=m,e[18]=a,e[19]=y}else y=e[19];let z;return e[30]!==b||e[31]!==v||e[32]!==y?(z=(0,n.jsxs)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[v,y]}),e[30]=b,e[31]=v,e[32]=y,e[33]=z):z=e[33],z},"Et"),_t=g(d=>{let e=(0,M.c)(23),{reference:t,t:r}=d,s=`fb-dangling-${t.table}-${t.id}-${t.column}`,o=`${t.table}\xB7${t.id}`,c;e[0]!==o?(c=(0,n.jsx)(ae,{variant:"secondary",children:o}),e[0]=o,e[1]=c):c=e[1];let i;e[2]!==t.column?(i=(0,n.jsx)("span",{className:"text-muted-foreground",children:t.column}),e[2]=t.column,e[3]=i):i=e[3];let l;e[4]!==r?(l=r("\u2192"),e[4]=r,e[5]=l):l=e[5];let u;e[6]!==l?(u=(0,n.jsx)("span",{className:"text-muted-foreground/60",children:l}),e[6]=l,e[7]=u):u=e[7];let h;e[8]!==t.key?(h=(0,n.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:t.key}),e[8]=t.key,e[9]=h):h=e[9];let f;e[10]!==c||e[11]!==i||e[12]!==u||e[13]!==h?(f=(0,n.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[c,i,u,h]}),e[10]=c,e[11]=i,e[12]=u,e[13]=h,e[14]=f):f=e[14];let m;e[15]!==r?(m=r("Missing object"),e[15]=r,e[16]=m):m=e[16];let w;e[17]!==m?(w=(0,n.jsx)(ae,{className:"border-destructive/40 text-destructive",variant:"outline",children:m}),e[17]=m,e[18]=w):w=e[18];let a;return e[19]!==s||e[20]!==w||e[21]!==f?(a=(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":s,children:[f,w]}),e[19]=s,e[20]=w,e[21]=f,e[22]=a):a=e[22],a},"Ut"),Bt=g(d=>{let e=(0,M.c)(37),{busy:t,onCheck:r,references:s,t:o,truncated:c}=d,i;e[0]!==o?(i=o("Integrity"),e[0]=o,e[1]=i):i=e[1];let l;e[2]!==i?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[2]=i,e[3]=l):l=e[3];let u;e[4]!==o?(u=o("Orphaned objects"),e[4]=o,e[5]=u):u=e[5];let h;e[6]!==u?(h=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:u}),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==o?(f=o("Find records whose file reference points at an object the bucket no longer has."),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[10]=f,e[11]=m):m=e[11];let w;e[12]!==l||e[13]!==h||e[14]!==m?(w=(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[l,h,m]}),e[12]=l,e[13]=h,e[14]=m,e[15]=w):w=e[15];let a;e[16]!==t||e[17]!==o?(a=o(t?"Checking\u2026":"Check for orphans"),e[16]=t,e[17]=o,e[18]=a):a=e[18];let k;e[19]!==t||e[20]!==r||e[21]!==a?(k=(0,n.jsx)(re,{"data-testid":"fb-orphans-check",disabled:t,onClick:r,size:"sm",type:"button",variant:"outline",children:a}),e[19]=t,e[20]=r,e[21]=a,e[22]=k):k=e[22];let C;e[23]!==w||e[24]!==k?(C=(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[w,k]}),e[23]=w,e[24]=k,e[25]=C):C=e[25];let x;e[26]!==s?.length||e[27]!==o?(x=s?.length===0&&(0,n.jsx)(he,{description:o("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:o("No dangling references.")}),e[26]=s?.length,e[27]=o,e[28]=x):x=e[28];let b;e[29]!==s||e[30]!==o||e[31]!==c?(b=s!==void 0&&s.length>0&&(0,n.jsxs)(n.Fragment,{children:[c&&(0,n.jsx)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:o("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:s.length})}),(0,n.jsx)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:s.map(y=>(0,n.jsx)(_t,{reference:y,t:o},`${y.table}\xB7${y.id}\xB7${y.column}`))})]}),e[29]=s,e[30]=o,e[31]=c,e[32]=b):b=e[32];let v;return e[33]!==C||e[34]!==x||e[35]!==b?(v=(0,n.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[C,x,b]}),e[33]=C,e[34]=x,e[35]=b,e[36]=v):v=e[36],v},"_t"),Et=g(function(d,e){let t=(0,M.c)(18),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,t[0]=r):r=t[0];let[s,o]=(0,j.useState)(r),c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=g(x=>{o(b=>{let v=new Set(b);return v.has(x)?v.delete(x):v.add(x),v})},"c"),t[1]=c):c=t[1];let i=c,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=g(()=>{o(new Set)},"o"),t[2]=l):l=t[2];let u=l,h,f,m;if(t[3]!==d||t[4]!==e||t[5]!==s){let x;t[9]!==e?(x=g(b=>e(b),"y"),t[9]=e,t[10]=x):x=t[10],f=d.map(x),h=f.length>0&&f.every(b=>s.has(b)),m=!h&&f.some(b=>s.has(b)),t[3]=d,t[4]=e,t[5]=s,t[6]=h,t[7]=f,t[8]=m}else h=t[6],f=t[7],m=t[8];let w=m,a;t[11]!==f?(a=g(()=>{o(x=>f.every(b=>x.has(b))?new Set:new Set(f))},"a"),t[11]=f,t[12]=a):a=t[12];let k=a,C;return t[13]!==h||t[14]!==s||t[15]!==w||t[16]!==k?(C={allSelected:h,clear:u,selected:s,someSelected:w,toggle:i,toggleAll:k},t[13]=h,t[14]=s,t[15]=w,t[16]=k,t[17]=C):C=t[17],C},"Bt"),It=me(be.storageReferences),Ot=me(be.storageOrphans),Ee=1e4,Mt=1e3,At=3600,Pt=g((d,e)=>{if(!("document"in globalThis))return;let t=globalThis.document.createElement("a");t.href=d,t.download=e,t.rel="noopener",globalThis.document.body.append(t),t.click(),t.remove()},"Wt"),Wt=g(d=>d.key,"qt"),Gt=g(({initialPrefix:d,pageSize:e})=>{let t=Se(),[r,s]=(0,j.useState)(d??""),[o,c]=(0,j.useState)(d??""),[i,l]=(0,j.useState)(wt),[u,h]=(0,j.useState)("list"),[f,m]=(0,j.useState)(128),[w,a]=(0,j.useState)("name"),[k,C]=(0,j.useState)("asc"),[x,b]=(0,j.useState)(void 0),[v,y]=(0,j.useState)(void 0),[z,S]=(0,j.useState)(!1),[N,$]=(0,j.useState)(void 0),[K,F]=(0,j.useState)(void 0),[T,L]=(0,j.useState)(""),[B,U]=(0,j.useState)({}),[I,R]=(0,j.useState)(!1),[_,O]=(0,j.useState)(void 0),[A,G]=(0,j.useState)(!1),[P,H]=(0,j.useState)(!1),[Y,oe]=(0,j.useState)([]),[V,xe]=(0,j.useState)(""),le=(0,j.useRef)(0),Q=(0,j.useRef)(0);(0,j.useEffect)(()=>{let p={cancelled:!1};return W((async()=>{try{let D=await t.listStorageBuckets();if(!p.cancelled){oe(D);let[E]=D;E!==void 0&&xe(q=>q===""?E:q)}}catch{}})()),()=>{p.cancelled=!0}},[t]);let Z=(0,j.useMemo)(()=>({list:g(p=>t.listStorageObjects({...p,bucket:V}),"list"),remove:g(p=>t.deleteStorageObject(p,{bucket:V}),"remove"),signedUrl:g((p,D)=>t.signedStorageUrl(p,{...D,bucket:V}),"signedUrl"),upload:g(p=>t.uploadStorageObject({...p,bucket:V}),"upload")}),[V,t]),J=(0,j.useCallback)(async(p,D,E)=>{le.current+=1;let q=le.current;y(void 0),S(!0);try{let te=await Z.list({cursor:D,limit:e,prefix:p});if(q!==le.current)return;b(we=>E&&we!==void 0?[...we,...te.objects]:te.objects),F(te.cursor)}catch(te){if(q!==le.current)return;E||b(void 0),y(X(te))}finally{q===le.current&&S(!1)}},[e,Z]);(0,j.useEffect)(()=>{W(J(d??"",void 0,!1))},[J,d]);let We=(x?.length??0)<=e;Re(()=>{W(J(r,void 0,!1))},We);let{files:de,folders:Ge}=Ct(x??[],r),He=(0,j.useMemo)(()=>{let p=new Set;for(let D of de)for(let E of Object.keys(D.customMetadata??{}))p.add(E);return[...p].toSorted((D,E)=>D.localeCompare(E))},[de]),ie=St(de,w,k),ue=(0,j.useMemo)(()=>[...new Set(ie.map(p=>p.key))].toSorted((p,D)=>p.localeCompare(D)).join(`
|
|
3
3
|
`),[ie]);(0,j.useEffect)(()=>{let p=ue===""?[]:ue.split(`
|
|
4
4
|
`);if(p.length===0){U({});return}let D={current:!0};return W((async()=>{try{let E=await t.query(It,{keys:p},ge(T));D.current&&(U(E.references??{}),R(Object.keys(E.storageColumns??{}).length>0))}catch{D.current&&(U({}),R(!1))}})()),()=>{D.current=!1}},[t,ue,T]);let{allSelected:qe,clear:se,selected:ve,someSelected:Ve,toggle:Ze,toggleAll:Je}=Et(ie,Wt),Ye=g(()=>{s(o),se(),W(J(o,void 0,!1))},"Ie"),Qe=g(()=>{W(J(r,K,!0))},"Me"),ke=g(p=>{s(p),c(p),se(),W(J(p,void 0,!1))},"be"),Xe=g(p=>{ke(`${r}${p}`)},"Ae"),et=g(p=>Z.signedUrl(p,{expiresInSeconds:At}),"Pe"),tt=g(()=>{h("list")},"We"),rt=g(()=>{h("grid")},"qe"),nt=g(p=>{a(p)},"Ge"),ot=g(()=>{C(p=>p==="asc"?"desc":"asc")},"He"),lt=g(p=>{m(p)},"Ze"),st=g(p=>{l(p)},"Ve"),at=g(()=>{y(void 0),S(!0),W((async()=>{try{for(let p of ve)await Z.remove(p);await J(r,void 0,!1),se()}catch(p){y(X(p))}S(!1)})())},"Xe"),it=g(p=>{y(void 0),W((async()=>{try{let D=await Z.signedUrl(p,{expiresInSeconds:i});Ke(D)&&$(p)}catch(D){y(X(D))}})())},"Ye"),ct=g(p=>{y(void 0),W((async()=>{try{let D=await Z.signedUrl(p,{expiresInSeconds:i}),E=p.slice(p.lastIndexOf("/")+1)||p;Pt(D,E)}catch(D){y(X(D))}})())},"Qe");(0,j.useEffect)(()=>{if(N===void 0)return;let p=globalThis.setTimeout(()=>{$(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[N]);let dt=g(p=>{y(void 0),S(!0),W((async()=>{try{await Z.remove(p),await J(r,void 0,!1)}catch(D){y(X(D))}S(!1)})())},"Je"),ut=g(p=>{let D=`${r}${p.name}`;y(void 0),S(!0),W((async()=>{try{let E=await p.arrayBuffer();await Z.upload({body:E,contentType:p.type===""?void 0:p.type,key:D}),await J(r,void 0,!1)}catch(E){y(X(E))}S(!1)})())},"et");(0,j.useEffect)(()=>{Q.current+=1,O(void 0),H(!1)},[T]);let ft=g(()=>{Q.current+=1;let p=Q.current;y(void 0),G(!0),W((async()=>{try{let D=[],E;do{let q=await Z.list({cursor:E,limit:Mt});for(let te of q.objects)D.push(te.key);E=D.length>=Ee?void 0:q.cursor}while(E!==void 0);if(D.length>=Ee)p===Q.current&&(O([]),H(!0));else{let q=await t.query(Ot,{liveKeys:D},ge(T));p===Q.current&&(O(q.references??[]),H(q.truncated===!0))}}catch(D){p===Q.current&&(O([]),H(!1),y(X(D)))}p===Q.current&&G(!1)})())},"tt"),ht=g(p=>{le.current+=1,Q.current+=1,xe(p),s(d??""),c(d??""),b(void 0),O(void 0),H(!1),se()},"rt");return{allSelected:qe,bucket:V,buckets:Y,bulkDelete:at,busy:z,checkOrphans:ft,clearSelection:se,copiedKey:N,danglingBusy:A,danglingReferences:_,danglingTruncated:P,draftPrefix:o,enterFolder:Xe,error:v,expiry:i,files:ie,folders:Ge,hasObjects:x!==void 0&&x.length>0,hasStorageColumns:I,listFirst:Ye,loaded:x!==void 0,loadMore:Qe,navigate:ke,nextCursor:K,onCopy:it,onDelete:dt,onDownload:ct,onExpiryChange:st,onFile:ut,onSortKeyChange:nt,onThumbSizeChange:lt,prefix:r,referenceShard:T,references:B,resolveUrl:et,selectBucket:ht,selected:ve,setDraftPrefix:c,setReferenceShard:L,showGrid:rt,showList:tt,someSelected:Ve,sortDirection:k,sortKey:w,tagKeys:He,thumbSize:f,toggleSelect:Ze,toggleSelectAll:Je,toggleSortDirection:ot,view:u}},"Gt"),Ht=100,Ie=g(d=>{let e=(0,M.c)(6),{label:t,onNavigate:r,target:s}=d,o;e[0]!==r||e[1]!==s?(o=g(()=>{r(s)},"n"),e[0]=r,e[1]=s,e[2]=o):o=e[2];let c=o,i;return e[3]!==c||e[4]!==t?(i=(0,n.jsx)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:c,type:"button",children:t}),e[3]=c,e[4]=t,e[5]=i):i=e[5],i},"we"),qt=g(d=>{let e=(0,M.c)(11),{onNavigate:t,prefix:r,t:s}=d,o;if(e[0]!==t||e[1]!==r||e[2]!==s){let c=r.split("/").filter(Vt),i;e[4]!==s?(i=s("Folder path"),e[4]=s,e[5]=i):i=e[5];let l;e[6]!==s?(l=s("root"),e[6]=s,e[7]=l):l=e[7];let u;e[8]!==t||e[9]!==l?(u=(0,n.jsx)(Ie,{label:l,onNavigate:t,target:""}),e[8]=t,e[9]=l,e[10]=u):u=e[10],o=(0,n.jsxs)("nav",{"aria-label":i,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[u,c.map((h,f)=>(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,n.jsx)(Ie,{label:h,onNavigate:t,target:`${c.slice(0,f+1).join("/")}/`})]},`${h}-${f.toString()}`))]}),e[0]=t,e[1]=r,e[2]=s,e[3]=o}else o=e[3];return o},"Zt"),ur=g(({initialPrefix:d,pageSize:e=Ht})=>{let t=Ce(),r=Gt({initialPrefix:d,pageSize:e}),s=(0,j.useRef)(null),{onCopy:o,onDelete:c,onDownload:i,onFile:l,toggleSelect:u}=r,h={onCopy:o,onDelete:c,onDownload:i,onToggleSelect:u},f=g(()=>{s.current?.click()},"f"),m=g(a=>{let k=a.target,C=k.files?.[0];k.value="",C&&l(C)},"m"),w=r.loaded&&!r.hasObjects;return(0,n.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,n.jsx)(Nt,{bucket:r.bucket,buckets:r.buckets,busy:r.busy,draftPrefix:r.draftPrefix,expiry:r.expiry,fileInputRef:s,onBucketChange:r.selectBucket,onExpiryChange:r.onExpiryChange,onFileChange:m,onList:r.listFirst,onPrefixChange:r.setDraftPrefix,onUploadClick:f,t}),r.loaded&&(0,n.jsx)(qt,{onNavigate:r.navigate,prefix:r.prefix,t}),r.hasObjects&&(0,n.jsx)(jt,{onSortKeyChange:r.onSortKeyChange,onThumbSizeChange:r.onThumbSizeChange,showGrid:r.showGrid,showList:r.showList,sortDirection:r.sortDirection,sortKey:r.sortKey,t,tagKeys:r.tagKeys,thumbSize:r.thumbSize,toggleSortDirection:r.toggleSortDirection,view:r.view}),r.hasStorageColumns&&(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:t("References shard")}),(0,n.jsx)(De,{id:"fb-reference-shard-input",onChange:r.setReferenceShard,testId:"fb-reference-shard-input",value:r.referenceShard}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:t("Which shard's records are checked for references to these files. Empty = root shard.")})]}),r.hasStorageColumns&&(0,n.jsx)(Bt,{busy:r.danglingBusy,onCheck:r.checkOrphans,references:r.danglingReferences,t,truncated:r.danglingTruncated}),r.selected.size>0&&(0,n.jsx)(Ue,{count:r.selected.size,editable:!0,onClear:r.clearSelection,onDelete:r.bulkDelete}),r.error!==void 0&&(0,n.jsx)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:r.error}),w&&(0,n.jsx)(he,{description:t("Objects you upload to your R2 buckets will appear here."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"}),(0,n.jsx)("path",{d:"M12 11v5m-2.5-2.5h5"})]}),testId:"fb-empty",title:t("No objects.")}),r.hasObjects&&r.view==="list"&&(0,n.jsx)(vt,{allSelected:r.allSelected,busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:h,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,selected:r.selected,showReferences:r.hasStorageColumns,someSelected:r.someSelected,t,toggleSelectAll:r.toggleSelectAll}),r.hasObjects&&r.view==="grid"&&(0,n.jsx)(Ut,{busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:h,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,resolveUrl:r.resolveUrl,selected:r.selected,showReferences:r.hasStorageColumns,size:r.thumbSize,t}),r.nextCursor!==void 0&&(0,n.jsx)("div",{children:(0,n.jsx)(re,{"data-testid":"fb-next",disabled:r.busy,onClick:r.loadMore,size:"sm",type:"button",variant:"outline",children:t("Load more")})})]})},"pr");function Vt(d){return d!==""}g(Vt,"Vt");export{ur as FileBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-X665E2HU.js";import{b as U}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as O}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as h}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as w}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-X665E2HU.js";import{b as U}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as O}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as h}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as w}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-ERMTJYQF.js";import{f as D}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{d as K,e as _,f as z,h as P,m as q,q as E}from"./chunk-OG4N2XHD.js";import"./chunk-AADILRJW.js";import{a as s,e as T,f as ie,h as oe}from"./chunk-3XIESWL4.js";var i=T(ie(),1);var e=T(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"ie"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"oe"),ue=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ce=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ue(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(M.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),c=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),x=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[u,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return c.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(P(d))}),()=>{t=!0}},[c,r]);let j=I===""?x[0]?.path??"":I,n=x.find(t=>t.path===j),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=u.trim()===""?{}:{shardKey:u.trim()},A=o?f.trim():"",J=s(l=>{Y(L=>[{argsText:m,at:Date.now(),id:(L[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:u,status:l},...L].slice(0,fe))},"A");p("running"),N(null);try{let l=A===""?await _(c,n.kind,d,t,R):await c.query(me,{args:t,functionPath:n.path,userId:A},R);U(u),y(l),p("success"),J("success")}catch(l){y(void 0),N(l.message),p("error"),J("error")}},"_"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"q"),te=s(t=>{S(t.target.value)},"B"),re=s(t=>{b(t.target.value)},"D"),ae=s(t=>{W(t.target.value)},"E"),se=s(()=>{q(Z())},"U"),ne=s(()=>{b(ce(n?.args))},"X");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(g,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:j,children:x.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(g,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(B,{onChange:F,testId:"shard-input",value:u}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(g,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:E(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ie");export{Fe as FunctionRunner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as le}from"./chunk-HPFLBYRI.js";import{b as re}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{d as de,f as oe}from"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as me}from"./chunk-XQCVZAGU.js";import{a as ae}from"./chunk-UZERI5YC.js";import{d as ce,q as pe}from"./chunk-OG4N2XHD.js";import"./chunk-AADILRJW.js";import{a as k,e as ie,g as xe,h as ge,j as Z}from"./chunk-3XIESWL4.js";var ne=ie(xe(),1);var a=ie(ge(),1);var ye="/_lunora/health",Ne="/_lunora/health/ready",ve=k((n,e)=>(n.endsWith("/")?n.slice(0,-1):n)+e,"xe"),be=k(()=>{let n=oe();return async e=>{let w=e==="ready"?Ne:ye,t=n.getAuthToken(),_=ve(n.url,w);try{let l=await fetch(_,{headers:t===null?{}:{authorization:`Bearer ${t}`}}),d=null;try{d=await l.json()}catch{d=null}return{body:d,ok:l.ok,status:l.status}}catch(l){return{body:null,error:l instanceof Error?l.message:String(l),ok:!1,status:0}}}},"Ne"),he={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ke={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},we=k(n=>n==="unhealthy"?"crit":n==="degraded"?"warn":"ok","ye"),ue=k(n=>{let e=(0,ne.c)(13),{label:w,level:t,testId:_,value:l}=n,d=he[t],o;e[0]!==d?(o=Z("size-1.5 shrink-0 rounded-full",d),e[0]=d,e[1]=o):o=e[1];let c;e[2]!==o?(c=(0,a.jsx)("span",{"aria-hidden":"true",className:o}),e[2]=o,e[3]=c):c=e[3];let x;e[4]!==w||e[5]!==c?(x=(0,a.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[c,w]}),e[4]=w,e[5]=c,e[6]=x):x=e[6];let g;e[7]!==_||e[8]!==l?(g=(0,a.jsx)("span",{className:"text-lg font-semibold text-foreground","data-testid":_,children:l}),e[7]=_,e[8]=l,e[9]=g):g=e[9];let u;return e[10]!==x||e[11]!==g?(u=(0,a.jsx)(ae,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[x,g]})}),e[10]=x,e[11]=g,e[12]=u):u=e[12],u},"ne"),De=k(n=>{let e=(0,ne.c)(115),{probe:w}=n,t=ce(),_=be(),l=w??_,d;e[0]!==l?(d=k(async()=>{let[s,i]=await Promise.all([l("live"),l("ready")]);return{live:s,ready:i}},"d"),e[0]=l,e[1]=d):d=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=["deployment-health"],e[2]=o):o=e[2];let c;e[3]!==d?(c={queryFn:d,queryKey:o},e[3]=d,e[4]=c):c=e[4];let{data:x,isPending:g}=de(c),u=x?.live??null,fe=x?.ready??null;if(g){let s;return e[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[(0,a.jsx)(le,{className:"h-16 w-full"}),(0,a.jsx)(le,{className:"h-40 w-full"})]}),e[5]=s):s=e[5],s}let r=u?.body??null;if(r===null){let s=u?.status===403,i;e[6]!==s||e[7]!==u?.error||e[8]!==t?(i=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:u?.error??t("no response")}),e[6]=s,e[7]=u?.error,e[8]=t,e[9]=i):i=e[9];let h;e[10]!==t?(h=t("Health endpoint unavailable"),e[10]=t,e[11]=h):h=e[11];let p;return e[12]!==i||e[13]!==h?(p=(0,a.jsx)(me,{description:i,testId:"deployment-health-error",title:h}),e[12]=i,e[13]=h,e[14]=p):p=e[14],p}let ee;e[15]!==r.status?(ee=we(r.status),e[15]=r.status,e[16]=ee):ee=e[16];let j=ee,m;if(r.status==="unhealthy"){let s;e[17]!==t?(s=t("Unhealthy"),e[17]=t,e[18]=s):s=e[18],m=s}else if(r.status==="degraded"){let s;e[19]!==t?(s=t("Degraded"),e[19]=t,e[20]=s):s=e[20],m=s}else{let s;e[21]!==t?(s=t("Healthy"),e[21]=t,e[22]=s):s=e[22],m=s}let C=fe?.ok??!1,Y=C?"ok":"crit",z,I,y,N,v,S,V,b,$,H;if(e[23]!==r.appName||e[24]!==r.appVersion||e[25]!==r.checks||e[26]!==r.timestamp||e[27]!==j||e[28]!==Y||e[29]!==C||e[30]!==m||e[31]!==t){let s=[...r.checks].toSorted(_e);H="flex flex-col gap-6",I="deployment-health";let i;e[42]!==t?(i=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint \u2014 wire an uptime monitor or a Cloudflare Health Check at it."),e[42]=t,e[43]=i):i=e[43],e[44]!==i?(y=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:i}),e[44]=i,e[45]=y):y=e[45];let h=ke[j],p;e[46]!==h?(p=Z("flex size-10 shrink-0 items-center justify-center rounded-full",h),e[46]=h,e[47]=p):p=e[47];let se=he[j],D;e[48]!==se?(D=Z("size-3 rounded-full",se),e[48]=se,e[49]=D):D=e[49];let L;e[50]!==D?(L=(0,a.jsx)("span",{className:D}),e[50]=D,e[51]=L):L=e[51];let T;e[52]!==p||e[53]!==L?(T=(0,a.jsx)("span",{"aria-hidden":"true",className:p,children:L}),e[52]=p,e[53]=L,e[54]=T):T=e[54];let q;e[55]!==m?(q=(0,a.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:m}),e[55]=m,e[56]=q):q=e[56];let E;e[57]!==r.appName||e[58]!==r.appVersion?(E=(0,a.jsxs)("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[r.appName," \xB7 ",r.appVersion]}),e[57]=r.appName,e[58]=r.appVersion,e[59]=E):E=e[59];let R;e[60]!==q||e[61]!==E?(R=(0,a.jsxs)("div",{className:"grid leading-tight",children:[q,E]}),e[60]=q,e[61]=E,e[62]=R):R=e[62];let U;e[63]!==T||e[64]!==R?(U=(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[T,R]}),e[63]=T,e[64]=R,e[65]=U):U=e[65];let A;e[66]!==t?(A=t("Checked"),e[66]=t,e[67]=A):A=e[67];let B;e[68]!==A?(B=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:A}),e[68]=A,e[69]=B):B=e[69];let F;e[70]!==r.timestamp?(F=pe(r.timestamp),e[70]=r.timestamp,e[71]=F):F=e[71];let K;e[72]!==F?(K=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:F}),e[72]=F,e[73]=K):K=e[73];let Q;e[74]!==B||e[75]!==K?(Q=(0,a.jsxs)("div",{className:"text-end",children:[B,K]}),e[74]=B,e[75]=K,e[76]=Q):Q=e[76],e[77]!==U||e[78]!==Q?(N=(0,a.jsx)(ae,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[U,Q]})}),e[77]=U,e[78]=Q,e[79]=N):N=e[79];let W;e[80]!==t?(W=t("Liveness"),e[80]=t,e[81]=W):W=e[81];let G;e[82]!==j||e[83]!==m||e[84]!==W?(G=(0,a.jsx)(ue,{label:W,level:j,testId:"dh-liveness",value:m}),e[82]=j,e[83]=m,e[84]=W,e[85]=G):G=e[85];let J;e[86]!==t?(J=t("Readiness"),e[86]=t,e[87]=J):J=e[87];let M;e[88]!==C||e[89]!==t?(M=t(C?"Ready":"Not ready"),e[88]=C,e[89]=t,e[90]=M):M=e[90];let O;e[91]!==Y||e[92]!==J||e[93]!==M?(O=(0,a.jsx)(ue,{label:J,level:Y,testId:"dh-readiness",value:M}),e[91]=Y,e[92]=J,e[93]=M,e[94]=O):O=e[94],e[95]!==G||e[96]!==O?(v=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[G,O]}),e[95]=G,e[96]=O,e[97]=v):v=e[97],z=ae,S="gap-0 py-0",V="dh-checks";let X;e[98]!==t?(X=t("Subsystem checks"),e[98]=t,e[99]=X):X=e[99],e[100]!==X?(b=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:X})}),e[100]=X,e[101]=b):b=e[101],$=s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.map(f=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${f.name}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:Z("size-1.5 shrink-0 rounded-full",f.status==="up"?"bg-success":"bg-destructive")}),(0,a.jsx)("span",{className:"font-mono text-foreground",children:f.name}),f.critical&&(0,a.jsx)(re,{variant:"outline",children:t("Critical")})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[f.message!==void 0&&(0,a.jsx)("span",{className:"text-muted-foreground",children:f.message}),(0,a.jsx)(re,{"data-testid":`dh-check-status-${f.name}`,variant:f.status==="up"?"secondary":"destructive",children:f.status==="up"?t("Up"):t("Down")})]})]},f.name))}),e[23]=r.appName,e[24]=r.appVersion,e[25]=r.checks,e[26]=r.timestamp,e[27]=j,e[28]=Y,e[29]=C,e[30]=m,e[31]=t,e[32]=z,e[33]=I,e[34]=y,e[35]=N,e[36]=v,e[37]=S,e[38]=V,e[39]=b,e[40]=$,e[41]=H}else z=e[32],I=e[33],y=e[34],N=e[35],v=e[36],S=e[37],V=e[38],b=e[39],$=e[40],H=e[41];let P;e[102]!==z||e[103]!==S||e[104]!==V||e[105]!==b||e[106]!==$?(P=(0,a.jsxs)(z,{className:S,"data-testid":V,children:[b,$]}),e[102]=z,e[103]=S,e[104]=V,e[105]=b,e[106]=$,e[107]=P):P=e[107];let te;return e[108]!==I||e[109]!==y||e[110]!==N||e[111]!==v||e[112]!==P||e[113]!==H?(te=(0,a.jsxs)("div",{className:H,"data-testid":I,children:[y,N,v,P]}),e[108]=I,e[109]=y,e[110]=N,e[111]=v,e[112]=P,e[113]=H,e[114]=te):te=e[114],te},"Ie");function _e(n,e){return n.name.localeCompare(e.name)}k(_e,"be");export{De as DeploymentHealthPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _,b as E,c as V,d as D,e as B,f as I,g as A,h as J}from"./chunk-
|
|
1
|
+
import{a as _,b as E,c as V,d as D,e as B,f as I,g as A,h as J}from"./chunk-7H7LZRLP.js";import{a as H}from"./chunk-ESVP44Y3.js";import{a as F}from"./chunk-QXXIJAD5.js";import{d as T,l as M,o as z}from"./chunk-OG4N2XHD.js";import{a as m,e as U,f as G,g as X,h as Y}from"./chunk-3XIESWL4.js";var L=U(X(),1),W=U(G(),1);var i=U(Y(),1);var j="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Z=/["\n,]/u,ee=/^[=+\-@\t\r]/u,K=m(t=>{if(t==null)return"";let e;return typeof t=="string"?e=ee.test(t)?` ${t}`:t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?e=String(t):e=JSON.stringify(t),Z.test(e)?`"${e.replaceAll('"','""')}"`:e},"E"),te=m((t,e)=>{let n=t.map(o=>K(o)).join(","),a=e.map(o=>t.map(l=>K(o[l])).join(","));return[n,...a].join(`
|
|
2
2
|
`)},"X"),le=m(t=>JSON.stringify(t,null,2),"Y"),P=500,Q=m(t=>`"${t.replaceAll('"','""')}"`,"J"),ne=m(t=>t==null?"NULL":typeof t=="number"?Number.isFinite(t)?String(t):"NULL":typeof t=="bigint"?String(t):typeof t=="boolean"?t?"1":"0":`'${(typeof t=="string"?t:JSON.stringify(t)).replaceAll("'","''")}'`,"Z"),oe=m((t,e,n)=>{if(e.length===0||n.length===0)return"";let a=e.map(l=>Q(l)).join(", "),o=[];for(let l=0;l<n.length;l+=P){let r=n.slice(l,l+P).map(s=>` (${e.map(c=>ne(s[c])).join(", ")})`).join(`,
|
|
3
3
|
`);o.push(`INSERT INTO ${Q(t)} (${a}) VALUES
|
|
4
4
|
${r};`)}return o.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as v,c as N,d as b,e as _,f as M}from"./chunk-MIQTKZAR.js";import{a as k}from"./chunk-UZERI5YC.js";import{
|
|
1
|
+
import{a as q}from"./chunk-XQCVZAGU.js";import{a as O,b as v,c as N,d as b,e as _,f as M}from"./chunk-MIQTKZAR.js";import{a as k}from"./chunk-UZERI5YC.js";import{d as g,h as w,l as I,m as T}from"./chunk-OG4N2XHD.js";import{c as L}from"./chunk-AADILRJW.js";import{a as u,e as x,f as P,g as U,h as W}from"./chunk-3XIESWL4.js";var $=x(U(),1);var F="https://api.cloudflare.com/client/v4/accounts",E=class extends L{static{u(this,"c")}constructor(t,m){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(t)}: ${m}`,{name:"AnalyticsSqlError",status:t})}},R=u(n=>{let t=n.fetch??globalThis.fetch,m=`${F}/${encodeURIComponent(n.accountId)}/analytics_engine/sql`;return{query:u(async p=>{let l=await t(m,{body:p,headers:{Authorization:`Bearer ${n.apiToken}`,"Content-Type":"text/plain"},method:"POST"});if(!l.ok)throw new E(l.status,await l.text());let r;try{r=await l.json()}catch{throw new E(l.status,"Analytics Engine SQL API returned a non-JSON body.")}let e=r,s=e.data??[];return{columns:e.meta??[],rowCount:e.rows??s.length,rows:s}},"query")}},"d");var y=x(P(),1);var a=x(W(),1);var H="ANALYTICS",D=[{key:"volume",sql:u(n=>`SELECT blob2 AS fn, count() AS calls FROM ${n} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:u(n=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${n} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:u(n=>`SELECT blob3 AS shard, count() AS calls FROM ${n} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},Q=u(n=>{let t=(0,$.c)(27),{state:m,title:p}=n,l=g(),{error:r,loading:e,result:s}=m,o=`analytics-panel-${p}`,c;t[0]!==l||t[1]!==p?(c=l(p),t[0]=l,t[1]=p,t[2]=c):c=t[2];let i;t[3]!==c?(i=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c})}),t[3]=c,t[4]=i):i=t[4];let d;t[5]!==e||t[6]!==l?(d=e&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:l("Loading\u2026")}),t[5]=e,t[6]=l,t[7]=d):d=t[7];let f;t[8]!==r||t[9]!==e?(f=!e&&r!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:r}),t[8]=r,t[9]=e,t[10]=f):f=t[10];let h;t[11]!==r||t[12]!==e||t[13]!==s||t[14]!==l?(h=!e&&r===null&&s!==null&&s.rows.length===0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:l("No data points yet.")}),t[11]=r,t[12]=e,t[13]=s,t[14]=l,t[15]=h):h=t[15];let A;t[16]!==r||t[17]!==e||t[18]!==s?(A=!e&&r===null&&s!==null&&s.rows.length>0&&(0,a.jsxs)(O,{children:[(0,a.jsx)(v,{children:(0,a.jsx)(b,{children:s.columns.map(G)})}),(0,a.jsx)(N,{children:s.rows.map((B,Y)=>(0,a.jsx)(b,{children:s.columns.map(C=>(0,a.jsx)(M,{className:"font-mono text-xs",children:I(B[C.name])},C.name))},Y))})]}),t[16]=r,t[17]=e,t[18]=s,t[19]=A):A=t[19];let S;return t[20]!==o||t[21]!==i||t[22]!==d||t[23]!==f||t[24]!==h||t[25]!==A?(S=(0,a.jsxs)(k,{className:"gap-0 py-0","data-testid":o,children:[i,d,f,h,A]}),t[20]=o,t[21]=i,t[22]=d,t[23]=f,t[24]=h,t[25]=A,t[26]=S):S=t[26],S},"U"),rt=u(({config:n,dataset:t=H,runQuery:m}={})=>{let p=g(),[l,r]=(0,y.useState)({}),e=(0,y.useMemo)(()=>{if(m!==void 0)return m;if(n===void 0)return null;let o=R({accountId:n.accountId,apiToken:n.apiToken});return c=>o.query(c)},[n,m]),s=(0,y.useCallback)(async o=>{if(e!==null)for(let c of D){if(o.cancelled)return;r(i=>({...i,[c.key]:{error:null,loading:!0,result:null}}));try{let i=await e(c.sql(t));o.cancelled||r(d=>({...d,[c.key]:{error:null,loading:!1,result:i}}))}catch(i){o.cancelled||r(d=>({...d,[c.key]:{error:w(i),loading:!1,result:null}}))}}},[e,t]);return(0,y.useEffect)(()=>{let o={cancelled:!1};return T(s(o)),()=>{o.cancelled=!0}},[s]),e===null?(0,a.jsx)(q,{description:p("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"})}),testId:"analytics-not-configured",title:p("Analytics is not configured.")}):(0,a.jsx)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:D.map(o=>(0,a.jsx)(Q,{state:l[o.key]??j,title:o.title},o.key))})},"Z");function G(n){return(0,a.jsx)(_,{children:n.name},n.name)}u(G,"H");export{rt as AnalyticsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as q,b as B}from"./chunk-AVAC26HJ.js";import{a as O}from"./chunk-CTNB2KIA.js";import{a as j}from"./chunk-X665E2HU.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{a as z}from"./chunk-LFKCLLPT.js";import{R as C}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as y}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as A}from"./chunk-53WEPGUD.js";import"./chunk-XXQUMVWH.js";import"./chunk-RNL6BSFM.js";import"./chunk-QLQADHFE.js";import{a as V}from"./chunk-ERMTJYQF.js";import{c as R}from"./chunk-XDAT7LHC.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as k}from"./chunk-XQCVZAGU.js";import{a as T,b as F,c as K,d as p,e as l,f as d}from"./chunk-MIQTKZAR.js";import{a as I,e as E}from"./chunk-UZERI5YC.js";import{d as L,q as M}from"./chunk-OG4N2XHD.js";import"./chunk-AADILRJW.js";import{a as o,e as b,f as ee,h as te}from"./chunk-3XIESWL4.js";var i=b(ee(),1);var e=b(te(),1);var D=80,re=o(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>D?`${t.slice(0,D)}\u2026`:t},"te"),ae=41,J=480,H=5,ie=o((s,t)=>q(s,n=>{t(n.height>0?n:{height:J,width:n.width})}),"ae"),Ne=o(({initialShardKey:s})=>{let t=L(),[n,P]=(0,i.useState)(s??""),[c,U]=(0,i.useState)(""),W=z(n.trim(),400),{data:f,error:g,errorSource:Z,isLoading:_,liveError:$}=R(V.getAuditLog,{},{live:!0,shardKey:W}),h=(0,i.useMemo)(()=>f?.entries??[],[f]),m=(0,i.useMemo)(()=>{let a=c.trim().toLowerCase();return a===""?h:h.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[h,c]),x=(0,i.useRef)(null),v=B({count:m.length,estimateSize:o(()=>ae,"estimateSize"),getScrollElement:o(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),G=v.getTotalSize(),N=u[0]?.start??0,w=G-(u.at(-1)?.end??0),Q={height:N},X={height:w},Y=o(a=>{U(a.target.value)},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(j,{onChange:P,testId:"au-shard-input",value:n}),(0,e.jsx)(O,{message:$,prefix:"au"}),(0,e.jsx)(C,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:c})]}),g!==null&&(0,e.jsx)(A,{error:Z,testId:"au-error"}),g===null&&!_&&m.length===0&&(0,e.jsx)(k,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),m.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(T,{"data-testid":"au-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(l,{children:t("time")}),(0,e.jsx)(l,{children:t("op")}),(0,e.jsx)(l,{children:t("table")}),(0,e.jsx)(l,{children:t("id")}),(0,e.jsx)(l,{children:t("detail")})]})}),(0,e.jsxs)(K,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Q})}),u.map(a=>{let r=m[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:M(r.ts,"\u2014")}),(0,e.jsx)(d,{children:(0,e.jsx)(y,{variant:"secondary",children:r.op})}),(0,e.jsx)(d,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})})]})]})})})]})},"we");export{Ne as AuditPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as J}from"./chunk-54MMVNPT.js";import{a as
|
|
1
|
+
import{a as J}from"./chunk-54MMVNPT.js";import{a as K}from"./chunk-X665E2HU.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{a as L}from"./chunk-LFKCLLPT.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as S}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as O}from"./chunk-53WEPGUD.js";import"./chunk-XXQUMVWH.js";import"./chunk-RNL6BSFM.js";import"./chunk-QLQADHFE.js";import{a as F}from"./chunk-ERMTJYQF.js";import{c as D}from"./chunk-XDAT7LHC.js";import"./chunk-EN2QAEO4.js";import"./chunk-XBDKZZ67.js";import{a as _}from"./chunk-XQCVZAGU.js";import{a as P,b as W,c as B,d as A,e as m,f as u}from"./chunk-MIQTKZAR.js";import{a as E,e as T}from"./chunk-UZERI5YC.js";import{d as j}from"./chunk-OG4N2XHD.js";import"./chunk-AADILRJW.js";import{a as N,e as C,f as X,g as q,h as z}from"./chunk-3XIESWL4.js";var U=C(q(),1),Z=C(X(),1);var e=C(z(),1);var R=80,G=N(a=>{if(a===void 0)return"";let t=JSON.stringify(a);return t.length>R?`${t.slice(0,R)}\u2026`:t},"X"),H=N(a=>{let t=[];for(let i of a){let n=i.id.toString();if(i.subscriptions.length===0){t.push({admin:i.admin,connectionId:i.id,key:`c${n}`,subscription:null});continue}i.subscriptions.forEach((s,y)=>{t.push({admin:i.admin,connectionId:i.id,key:`c${n}-s${y.toString()}`,subscription:s})})}return t},"Z"),M=(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),lt=N(a=>{let t=(0,U.c)(22),{initialShardKey:i}=a,n=j(),[s,y]=(0,Z.useState)(i??""),h;t[0]!==s?(h=s.trim(),t[0]=s,t[1]=h):h=t[1];let k=L(h,400),p;t[2]===Symbol.for("react.memo_cache_sentinel")?(p={},t[2]=p):p=t[2];let f;t[3]!==k?(f={keepPreviousData:!0,shardKey:k},t[3]=k,t[4]=f):f=t[4];let{data:r,error:o,errorSource:d,refetch:Q}=D(F.listSubscriptions,p,f);J(Q,!0);let b;if(t[5]!==o||t[6]!==d||t[7]!==r||t[8]!==s||t[9]!==n){let I=r===void 0?[]:H(r.connections),c;t[11]!==s?(c=(0,e.jsx)(K,{onChange:y,testId:"subs-shard-input",value:s}),t[11]=s,t[12]=c):c=t[12];let l;t[13]!==r||t[14]!==n?(l=r!==void 0&&(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,e.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:r.totalConnections})}),(0,e.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:r.totalSubscriptions})})]}),t[13]=r,t[14]=n,t[15]=l):l=t[15];let g;t[16]!==c||t[17]!==l?(g=(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,l]}),t[16]=c,t[17]=l,t[18]=g):g=t[18];let v;t[19]!==o||t[20]!==d?(v=o!==null&&(0,e.jsx)(O,{error:d,testId:"subs-error"}),t[19]=o,t[20]=d,t[21]=v):v=t[21],b=(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&r!==void 0&&I.length===0&&(0,e.jsx)(_,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&I.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(T,{className:"px-0",children:(0,e.jsxs)(P,{"data-testid":"subs-table",children:[(0,e.jsx)(W,{children:(0,e.jsxs)(A,{children:[(0,e.jsx)(m,{children:n("Connection")}),(0,e.jsx)(m,{children:n("Function path")}),(0,e.jsx)(m,{children:n("Table")}),(0,e.jsx)(m,{children:n("Arguments")})]})}),(0,e.jsx)(B,{children:I.map(x=>{let{subscription:w}=x,$=G(w?.args);return(0,e.jsxs)(A,{"data-testid":"subs-row",children:[(0,e.jsx)(u,{className:"font-medium tabular-nums",children:(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,e.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,e.jsx)(u,{className:"font-mono text-xs",children:w?.functionPath??M}),(0,e.jsx)(u,{children:w?.table??M}),(0,e.jsx)(u,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:$||void 0,children:$||M})]},x.key)})})]})})})]}),t[5]=o,t[6]=d,t[7]=r,t[8]=s,t[9]=n,t[10]=b}else b=t[10];return b},"at");export{lt as default};
|