@lunora/studio 1.0.0-alpha.176 → 1.0.0-alpha.178
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/standalone/{chunk-YKA2P52S.js → chunk-2ADU5FA5.js} +1 -1
- package/dist/standalone/{chunk-RH2G72SL.js → chunk-2NYASBOP.js} +1 -1
- package/dist/standalone/{chunk-Y3G2ZPOD.js → chunk-2W365SXI.js} +1 -1
- package/dist/standalone/{chunk-KSYIH3NO.js → chunk-2Y6PXGIS.js} +4 -4
- package/dist/standalone/{chunk-KRXDSPZ4.js → chunk-3JDH25N2.js} +1 -1
- package/dist/standalone/{chunk-L6W4QXGJ.js → chunk-5PBVNSPQ.js} +1 -1
- package/dist/standalone/{chunk-52Y5BCFW.js → chunk-5XRNQ732.js} +1 -1
- package/dist/standalone/{chunk-NXZGWCUN.js → chunk-6HVFOKP5.js} +1 -1
- package/dist/standalone/{chunk-KSRQTLE3.js → chunk-7HFDITXH.js} +1 -1
- package/dist/standalone/{chunk-3LGVSZ4D.js → chunk-AKG3SL2Z.js} +1 -1
- package/dist/standalone/{chunk-JWJFB4ZB.js → chunk-ANXXWNJG.js} +1 -1
- package/dist/standalone/{chunk-4OGX6UIE.js → chunk-BR64TOG4.js} +1 -1
- package/dist/standalone/{chunk-CO7D5QQA.js → chunk-CBNGOAD4.js} +1 -1
- package/dist/standalone/{chunk-V5PJJYCF.js → chunk-CXGPKEDJ.js} +1 -1
- package/dist/standalone/{chunk-F4W5DVWA.js → chunk-D2SSRZG5.js} +1 -1
- package/dist/standalone/{chunk-NZDNC4KZ.js → chunk-D7PVLNBP.js} +1 -1
- package/dist/standalone/{chunk-TX4KHOV2.js → chunk-E366YQXO.js} +1 -1
- package/dist/standalone/{chunk-CQ4VSTAW.js → chunk-FTR6JAWG.js} +1 -1
- package/dist/standalone/{chunk-MKRHFCPJ.js → chunk-G22LSAIH.js} +1 -1
- package/dist/standalone/{chunk-IMLGMLYE.js → chunk-GDYRC6T6.js} +1 -1
- package/dist/standalone/{chunk-4G7WDTSC.js → chunk-I3OOVU3O.js} +1 -1
- package/dist/standalone/{chunk-FKBX44FM.js → chunk-I5V3IHPF.js} +1 -1
- package/dist/standalone/{chunk-SPERI4DG.js → chunk-IBM6X4XI.js} +1 -1
- package/dist/standalone/{chunk-OS6CZ56E.js → chunk-IUKHT5XV.js} +1 -1
- package/dist/standalone/{chunk-HKPAFIMB.js → chunk-J3LCGEBD.js} +1 -1
- package/dist/standalone/{chunk-T6X7NXEE.js → chunk-KIEUFC6E.js} +1 -1
- package/dist/standalone/{chunk-X5AXABWH.js → chunk-KQMWK6QZ.js} +1 -1
- package/dist/standalone/{chunk-DL3DYOZA.js → chunk-KYMUE3MZ.js} +1 -1
- package/dist/standalone/{chunk-F7UZBTKS.js → chunk-KZDIKRZ3.js} +1 -1
- package/dist/standalone/{chunk-JXJZMINI.js → chunk-LKKZMIZK.js} +1 -1
- package/dist/standalone/{chunk-CQO3Z2AB.js → chunk-M7QQYXU4.js} +1 -1
- package/dist/standalone/{chunk-D6UKRXIS.js → chunk-MBP4SZYB.js} +1 -1
- package/dist/standalone/{chunk-5JHPL7FH.js → chunk-MNQSYFV6.js} +1 -1
- package/dist/standalone/{chunk-CWTUCGWD.js → chunk-MOMBFDIA.js} +1 -1
- package/dist/standalone/{chunk-KY7U3EOR.js → chunk-MOYNBJNW.js} +1 -1
- package/dist/standalone/{chunk-SZUW2MXD.js → chunk-MWUR2KP6.js} +1 -1
- package/dist/standalone/{chunk-GXVTU7FF.js → chunk-N2VWHDGA.js} +1 -1
- package/dist/standalone/{chunk-WDYULSDM.js → chunk-NLHKRU3D.js} +2 -2
- package/dist/standalone/{chunk-I3PD3ZML.js → chunk-P4V5VRUR.js} +1 -1
- package/dist/standalone/{chunk-XAGNBUL3.js → chunk-P6F4CNT5.js} +1 -1
- package/dist/standalone/{chunk-I4YTKLE7.js → chunk-PHYKYBCE.js} +1 -1
- package/dist/standalone/{chunk-RQPSYNGU.js → chunk-QCFJKKLX.js} +1 -1
- package/dist/standalone/{chunk-YYR4P344.js → chunk-RSULZ5QU.js} +1 -1
- package/dist/standalone/{chunk-KPISDHKV.js → chunk-RY66ZJJQ.js} +1 -1
- package/dist/standalone/{chunk-OBSMXNVJ.js → chunk-SA5SGD3V.js} +1 -1
- package/dist/standalone/{chunk-N3MMJZQW.js → chunk-TXLWUHAU.js} +1 -1
- package/dist/standalone/{chunk-XTC4KFYF.js → chunk-U2YJ64UT.js} +1 -1
- package/dist/standalone/{chunk-B62IS74K.js → chunk-U3T6FYYZ.js} +1 -1
- package/dist/standalone/{chunk-E67LBUZU.js → chunk-U7A2W7UG.js} +1 -1
- package/dist/standalone/{chunk-O7D7DJVB.js → chunk-URBHAYYZ.js} +1 -1
- package/dist/standalone/{chunk-KMLTYAJF.js → chunk-V5FOHTRB.js} +1 -1
- package/dist/standalone/{chunk-3UOVQ3YN.js → chunk-VR3OL4A6.js} +1 -1
- package/dist/standalone/{chunk-7PEQ4RPL.js → chunk-WHPKXZN2.js} +1 -1
- package/dist/standalone/{chunk-WWHDFIP5.js → chunk-WV2AW6IT.js} +1 -1
- package/dist/standalone/{chunk-VYLHUJVG.js → chunk-WX6MJS7P.js} +1 -1
- package/dist/standalone/{chunk-ERLNG3BC.js → chunk-Y5IE2W4U.js} +1 -1
- package/dist/standalone/{chunk-TPVTZE6M.js → chunk-YAAM5IKA.js} +1 -1
- package/dist/standalone/{chunk-KF2YSK5Z.js → chunk-YK7JO7NP.js} +1 -1
- package/dist/standalone/{chunk-JMXDVWZG.js → chunk-YRZFU7OM.js} +1 -1
- package/dist/standalone/chunk-Z7WCKAUJ.js +11 -0
- package/dist/standalone/{chunk-EFMYOSXQ.js → chunk-ZTA7WN4R.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
- package/dist/standalone/chunk-VWWJIICI.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as w}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as y}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as C}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as y}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as C}from"./chunk-KZDIKRZ3.js";import"./chunk-ULIQFBZU.js";import"./chunk-2W365SXI.js";import"./chunk-35DM4JJG.js";import{a as h}from"./chunk-4ZEL6BYL.js";import{c as u}from"./chunk-MBP4SZYB.js";import"./chunk-Z7WCKAUJ.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as T}from"./chunk-FKVZRPV5.js";import{a as S,b as K,c as $,d as g,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as A,e as k}from"./chunk-WUWBZPUK.js";import{d as M,r as D}from"./chunk-FODLDLE2.js";import{a as d,d as z,e as ae,g as re}from"./chunk-YKXDMIHQ.js";var O=z(ae(),1);var e=z(re(),1);var Q="agent_threads",se="agent_messages",F="agent_run_queue",R=100,ne=250,oe={},ie={filters:[],limit:R,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:Q},l=d((s,t)=>{let r=s[t];return typeof r=="string"?r:void 0},"i"),j=d((s,t)=>{let r=s[t];return typeof r=="number"?r:void 0},"A"),L=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:r}=t;return typeof r=="number"?r:void 0},"U"),de=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(r=>r!==null&&typeof r=="object"?r.name:void 0).filter(r=>typeof r=="string"):[]},"ne"),le=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"oe"),ce=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"de"),Ne=d(({initialShardKey:s=""})=>{let t=M(),[r,I]=(0,O.useState)(void 0),{data:c}=u(h.listTables,oe,{live:!0,shardKey:s}),G=c!==void 0,p=Array.isArray(c)&&c.some(a=>a.name===Q),H=Array.isArray(c)&&c.some(a=>a.name===F),{data:_,error:J,errorSource:V,liveError:W}=u(h.readTablePage,ie,{enabled:p,live:!0,shardKey:s}),X={filters:[{column:"threadKey",operator:"eq",value:r??""}],limit:ne,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:se},{data:q}=u(h.readTablePage,{limit:R,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:F},{enabled:H,live:!0,shardKey:s}),{data:B,error:Y,errorSource:Z}=u(h.readTablePage,X,{enabled:p&&r!==void 0,live:!0,shardKey:s}),v=Array.isArray(_?.rows)?_.rows:[],ee=Array.isArray(q?.rows)?q.rows:[],E=d(a=>ee.filter(n=>l(n,"threadKey")===a).length,"w"),P=Array.isArray(B?.rows)?B.rows:[],U=v.find(a=>l(a,"key")===r),f;return G&&!p?f=(0,e.jsx)(T,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):p&&v.length===0?f=(0,e.jsx)(T,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):f=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(A,{className:"overflow-hidden py-0",children:(0,e.jsx)(k,{className:"px-0",children:(0,e.jsxs)(S,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(o,{children:t("Agent")}),(0,e.jsx)(o,{children:t("Key")}),(0,e.jsx)(o,{children:t("Status")}),(0,e.jsx)(o,{children:t("Queued")}),(0,e.jsx)(o,{children:t("Messages")}),(0,e.jsx)(o,{children:t("Tokens")}),(0,e.jsx)(o,{children:t("Updated")}),(0,e.jsx)(o,{"aria-label":t("Actions")})]})}),(0,e.jsx)($,{children:v.map(a=>{let n=l(a,"key")??"",m=l(a,"status"),x=L(a);return(0,e.jsxs)(g,{"data-active":n===r?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:l(a,"agent")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(i,{children:(0,e.jsx)(y,{"data-testid":`agents-thread-status-${n}`,variant:le(m),children:m??"\u2014"})}),(0,e.jsx)(i,{className:"tabular-nums",children:E(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:E(n)})}),(0,e.jsx)(i,{className:"tabular-nums",children:j(a,"messageCount")??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums text-muted-foreground",children:x??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:D(j(a,"updatedAt"),"\u2014")}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsx)(w,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{I(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),Y!==null&&(0,e.jsx)(C,{error:Z,testId:"agents-messages-error"}),r!==void 0&&(0,e.jsx)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(k,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",r,U!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",L(U)??0," ",t("Tokens")]})]}),(0,e.jsx)(w,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{I(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),P.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(S,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(o,{children:t("Role")}),(0,e.jsx)(o,{children:t("Content")}),(0,e.jsx)(o,{children:t("Tool")}),(0,e.jsx)(o,{children:t("Approval")})]})}),(0,e.jsx)($,{children:P.map((a,n)=>{let m=l(a,"role")??"\u2014",x=de(a),te=l(a,"toolName"),b=l(a,"status"),N=j(a,"seq")??n;return(0,e.jsxs)(g,{"data-testid":`agents-message-${String(N)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:m}),(0,e.jsx)(i,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(a,"content")??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs align-top text-muted-foreground",children:te??(x.length>0?x.join(", "):"\u2014")}),(0,e.jsx)(i,{className:"align-top",children:b===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-message-approval-${String(N)}`,variant:ce(b),children:b})})]},l(a,"messageKey")??`${m}:${String(N)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[J!==null&&(0,e.jsx)(C,{error:V,testId:"agents-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),W!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),f]})},"be");export{Ne as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as Se,c as Ie}from"./chunk-YOB2X3FZ.js";import{a as we}from"./chunk-EA2JKR5D.js";import{a as ye}from"./chunk-PD6WIDY6.js";import{a as Ne}from"./chunk-2DX5MROH.js";import{b as pe}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as he}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{d as ge}from"./chunk-
|
|
1
|
+
import{b as Se,c as Ie}from"./chunk-YOB2X3FZ.js";import{a as we}from"./chunk-EA2JKR5D.js";import{a as ye}from"./chunk-PD6WIDY6.js";import{a as Ne}from"./chunk-2DX5MROH.js";import{b as pe}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as he}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{d as ge}from"./chunk-MBP4SZYB.js";import{f as xe}from"./chunk-Z7WCKAUJ.js";import"./chunk-FSRSK4LY.js";import{d as se}from"./chunk-2Y6PXGIS.js";import{a as ne,e as ie}from"./chunk-WUWBZPUK.js";import{d as be,f as ce,g as de,h as ee,o as me}from"./chunk-FODLDLE2.js";import{a as s,d as le,e as Ce,f as Te,g as Ee}from"./chunk-YKXDMIHQ.js";var ve=le(Te(),1);var g=le(Ce(),1);var r=le(Ee(),1);var Ae=ce(H.exportShard),Oe=ce(H.importShard),Le=s(x=>x.map(e=>JSON.stringify(Se(e))).join(`
|
|
2
2
|
`),"Ce"),Je=s(x=>{let e=[],te=x.split(`
|
|
3
3
|
`);for(let[n,N]of te.entries()){let t=N.trim();if(t==="")continue;let o=Ie(JSON.parse(t));if(typeof o!="object"||o===null)throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);let b=o;if(typeof b.table!="string"||typeof b.doc!="object"||b.doc===null||Array.isArray(b.doc))throw new se("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);e.push(b)}return e},"Te"),He=s(x=>{let e=(0,ve.c)(94),{initialShardKey:te}=x,n=xe(),N=ge(),t=be(),[o,b]=(0,g.useState)(te??""),[a,fe]=(0,g.useState)(""),[d,K]=(0,g.useState)(!1),[Q,M]=(0,g.useState)(null),[i,re]=(0,g.useState)(null),[y,ue]=(0,g.useState)(null),V;e[0]!==n||e[1]!==o?(V=s(async()=>{K(!0),M(null),re(null);try{let c=await n.query(Ae,{},de(o));pe(o),fe(Le(c.rows)),ue(c.rows.length)}catch(c){M(ee(c))}K(!1)},"G"),e[0]=n,e[1]=o,e[2]=V):V=e[2];let z=V,W;e[3]!==n||e[4]!==N||e[5]!==a||e[6]!==o||e[7]!==t?(W=s(async()=>{K(!0),M(null),re(null),ue(null);let c;try{c=Je(a)}catch(l){M(t("Invalid NDJSON: {message}",{message:ee(l)})),K(!1);return}try{let l=await n.query(Oe,{rows:c},de(o));pe(o),re(l),N(H.readTablePage),N(H.listTables)}catch(l){M(ee(l))}K(!1)},"Q"),e[3]=n,e[4]=N,e[5]=a,e[6]=o,e[7]=t,e[8]=W):W=e[8];let G=W,w,S,I,m,v,p,f,j,C,u,T;if(e[9]!==d||e[10]!==y||e[11]!==z||e[12]!==i||e[13]!==G||e[14]!==a||e[15]!==o||e[16]!==t){let c=i===null?0:Object.values(i.inserted).reduce(_e,0),l;e[28]!==z?(l=s(()=>{me(z())},"o"),e[28]=z,e[29]=l):l=e[29];let oe=l,Y;e[30]!==G?(Y=s(()=>{me(G())},"Y"),e[30]=G,e[31]=Y):Y=e[31];let ae=Y,Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=s(h=>{fe(h.target.value)},"Z"),e[32]=Z):Z=e[32];let je=Z;T="flex flex-col gap-4",I="lunora-export-import";let L;e[33]!==t?(L=t("Export"),e[33]=t,e[34]=L):L=e[34];let J;e[35]!==L?(J=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:L})}),e[35]=L,e[36]=J):J=e[36];let _;e[37]!==o?(_=(0,r.jsx)(Ne,{onChange:b,testId:"ei-shard-input",value:o}),e[37]=o,e[38]=_):_=e[38];let $;e[39]!==t?($=t("Export"),e[39]=t,e[40]=$):$=e[40];let k;e[41]!==d||e[42]!==oe||e[43]!==$?(k=(0,r.jsx)(he,{"data-testid":"ei-export",disabled:d,onClick:oe,type:"button",children:$}),e[41]=d,e[42]=oe,e[43]=$,e[44]=k):k=e[44];let D;e[45]!==_||e[46]!==k?(D=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,k]}),e[45]=_,e[46]=k,e[47]=D):D=e[47];let q;e[48]!==y||e[49]!==t?(q=y!==null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:t("Exported {count} rows.",{count:y})}),e[48]=y,e[49]=t,e[50]=q):q=e[50];let B;e[51]!==D||e[52]!==q?(B=(0,r.jsxs)(ie,{className:"flex flex-col gap-3 p-4",children:[D,q]}),e[51]=D,e[52]=q,e[53]=B):B=e[53],e[54]!==J||e[55]!==B?(m=(0,r.jsxs)(ne,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[J,B]}),e[54]=J,e[55]=B,e[56]=m):m=e[56],S=ne,C="gap-0 py-0 rounded-xl border border-border bg-card shadow-xs";let P;e[57]!==t?(P=t("Import"),e[57]=t,e[58]=P):P=e[58],e[59]!==P?(u=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:P})}),e[59]=P,e[60]=u):u=e[60],w=ie,v="flex flex-col gap-3 p-4",e[61]!==a?(p=(0,r.jsx)(we,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:je,placeholder:'{"table":"messages","doc":{\u2026}}',value:a}),e[61]=a,e[62]=p):p=e[62];let R;e[63]!==t?(R=t("Import (writes rows)?"),e[63]=t,e[64]=R):R=e[64];let U;e[65]!==d||e[66]!==a?(U=d||a.trim()==="",e[65]=d,e[66]=a,e[67]=U):U=e[67];let F;e[68]!==t?(F=t("Import"),e[68]=t,e[69]=F):F=e[69],e[70]!==ae||e[71]!==R||e[72]!==U||e[73]!==F?(f=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,r.jsx)(ye,{confirmLabel:R,disabled:U,onConfirm:ae,testId:"ei-import",children:F})}),e[70]=ae,e[71]=R,e[72]=U,e[73]=F,e[74]=f):f=e[74],j=i!==null&&(0,r.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:c})}),i.errors.length>0&&(0,r.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(h=>(0,r.jsx)("li",{className:"text-xs text-destructive",children:t("line {line} ({table}): {message}",{line:h.line,message:h.message,table:h.table})},`${h.table}-${h.line.toString()}`))})]}),e[9]=d,e[10]=y,e[11]=z,e[12]=i,e[13]=G,e[14]=a,e[15]=o,e[16]=t,e[17]=w,e[18]=S,e[19]=I,e[20]=m,e[21]=v,e[22]=p,e[23]=f,e[24]=j,e[25]=C,e[26]=u,e[27]=T}else w=e[17],S=e[18],I=e[19],m=e[20],v=e[21],p=e[22],f=e[23],j=e[24],C=e[25],u=e[26],T=e[27];let E;e[75]!==w||e[76]!==v||e[77]!==p||e[78]!==f||e[79]!==j?(E=(0,r.jsxs)(w,{className:v,children:[p,f,j]}),e[75]=w,e[76]=v,e[77]=p,e[78]=f,e[79]=j,e[80]=E):E=e[80];let A;e[81]!==S||e[82]!==E||e[83]!==C||e[84]!==u?(A=(0,r.jsxs)(S,{className:C,children:[u,E]}),e[81]=S,e[82]=E,e[83]=C,e[84]=u,e[85]=A):A=e[85];let O;e[86]!==Q?(O=Q!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:Q}),e[86]=Q,e[87]=O):O=e[87];let X;return e[88]!==I||e[89]!==m||e[90]!==A||e[91]!==O||e[92]!==T?(X=(0,r.jsxs)("div",{className:T,"data-testid":I,children:[m,A,O]}),e[88]=I,e[89]=m,e[90]=A,e[91]=O,e[92]=T,e[93]=X):X=e[93],X},"Ue");function _e(x,e){return x+e}s(_e,"Ae");export{He as ExportImportPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as Le}from"./chunk-QY4V5UOY.js";import{c as _e}from"./chunk-UYEZR3BI.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as ye}from"./chunk-3FBLWUXD.js";import"./chunk-XZMOZFE6.js";import{a as Ee}from"./chunk-66UGPQVC.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as Oe}from"./chunk-PD6WIDY6.js";import{a as Te}from"./chunk-2DX5MROH.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{W as Ce}from"./chunk-PLHA3OWK.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as te}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as ae}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as be}from"./chunk-4ZEL6BYL.js";import{f as Se}from"./chunk-
|
|
1
|
+
import{d as Le}from"./chunk-QY4V5UOY.js";import{c as _e}from"./chunk-UYEZR3BI.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as ye}from"./chunk-3FBLWUXD.js";import"./chunk-XZMOZFE6.js";import{a as Ee}from"./chunk-66UGPQVC.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as Oe}from"./chunk-PD6WIDY6.js";import{a as Te}from"./chunk-2DX5MROH.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{W as Ce}from"./chunk-PLHA3OWK.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as te}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as ae}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as be}from"./chunk-4ZEL6BYL.js";import{f as Se}from"./chunk-Z7WCKAUJ.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as he}from"./chunk-FKVZRPV5.js";import{a as $e,b as Ke,c as Fe,d as ie,e as re,f as ee}from"./chunk-HEAQVSNS.js";import{a as je,e as ze}from"./chunk-WUWBZPUK.js";import{d as Ne,f as me,g as pe,h as Q,l as ge,o as W,q as De}from"./chunk-FODLDLE2.js";import{a as m,d as fe,e as mt,f as pt,g as gt}from"./chunk-YKXDMIHQ.js";var M=fe(pt(),1),z=fe(mt(),1);var o=fe(gt(),1);var Ue=m((d,e,t)=>{let{onCopy:r,onDelete:l,onDownload:n,onToggleSelect:c}=t,i=m(()=>{r(d.key)},"c"),s=m(()=>{n(d.key)},"o"),u=m(()=>{l(d.key)},"f"),h=m(()=>{c(d.key)},"h");return{copy:i,download:s,name:d.key.slice(e.length),remove:u,toggle:h}},"Ee"),Me=m(d=>{let e=(0,M.c)(31),{busy:t,buttonClassName:r,copied:l,objectKey:n,onCopy:c,onDelete:i,onDownload:s,t:u}=d,h=`storage-copy-${n}`,f;e[0]!==l||e[1]!==u?(f=u(l?"Copied":"Copy URL"),e[0]=l,e[1]=u,e[2]=f):f=e[2];let p;e[3]!==t||e[4]!==r||e[5]!==c||e[6]!==h||e[7]!==f?(p=(0,o.jsx)(te,{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]=p):p=e[8];let w=`storage-download-${n}`,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]!==s||e[14]!==w||e[15]!==a?(k=(0,o.jsx)(te,{className:r,"data-testid":w,disabled:t,onClick:s,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=t,e[12]=r,e[13]=s,e[14]=w,e[15]=a,e[16]=k):k=e[16];let N;e[17]!==u?(N=u("Delete object?"),e[17]=u,e[18]=N):N=e[18];let v=`storage-delete-${n}`,b;e[19]!==u?(b=u("Delete"),e[19]=u,e[20]=b):b=e[20];let y;e[21]!==t||e[22]!==i||e[23]!==N||e[24]!==v||e[25]!==b?(y=(0,o.jsx)(Oe,{confirmLabel:N,disabled:t,onConfirm:i,testId:v,children:b}),e[21]=t,e[22]=i,e[23]=N,e[24]=v,e[25]=b,e[26]=y):y=e[26];let x;return e[27]!==y||e[28]!==p||e[29]!==k?(x=(0,o.jsxs)(o.Fragment,{children:[p,k,y]}),e[27]=y,e[28]=p,e[29]=k,e[30]=x):x=e[30],x},"$e"),Ae=m(d=>{let e=(0,M.c)(14),{objectKey:t,references:r,t:l}=d;if(r===void 0)return null;if(r.length===0){let h=`storage-orphan-${t}`,f;e[0]!==l?(f=l("Orphan"),e[0]=l,e[1]=f):f=e[1];let p;return e[2]!==h||e[3]!==f?(p=(0,o.jsx)(ae,{"data-testid":h,variant:"warning",children:f}),e[2]=h,e[3]=f,e[4]=p):p=e[4],p}let n;e[5]!==r?(n=r.map(bt).join(`
|
|
2
2
|
`),e[5]=r,e[6]=n):n=e[6];let c=n,i=`storage-refs-${t}`,s;e[7]!==r.length||e[8]!==l?(s=r.length===1?l("1 record"):l("{count} records",{count:r.length}),e[7]=r.length,e[8]=l,e[9]=s):s=e[9];let u;return e[10]!==c||e[11]!==i||e[12]!==s?(u=(0,o.jsx)(ae,{"data-testid":i,title:c,variant:"secondary",children:s}),e[10]=c,e[11]=i,e[12]=s,e[13]=u):u=e[13],u},"Fe"),Pe=m(d=>{let e=(0,M.c)(7),{objectKey:t,onToggle:r,selected:l,t:n}=d,c;e[0]!==n?(c=n("Select row"),e[0]=n,e[1]=c):c=e[1];let i=`storage-select-${t}`,s;return e[2]!==r||e[3]!==l||e[4]!==c||e[5]!==i?(s=(0,o.jsx)(ye,{"aria-label":c,checked:l,"data-testid":i,onCheckedChange:r}),e[2]=r,e[3]=l,e[4]=c,e[5]=i,e[6]=s):s=e[6],s},"Re");function bt(d){return`${d.table}\xB7${d.id}`}m(bt,"yt");var yt=m(d=>{let e=(0,M.c)(10),{colSpan:t,name:r,onEnter:l}=d,n;e[0]!==r||e[1]!==l?(n=m(()=>{l(r)},"l"),e[0]=r,e[1]=l,e[2]=n):n=e[2];let c=n,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.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,o.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 s;e[4]!==c||e[5]!==r?(s=(0,o.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]=s):s=e[6];let u;return e[7]!==t||e[8]!==s?(u=(0,o.jsx)(ie,{children:(0,o.jsx)(ee,{colSpan:t,children:s})}),e[7]=t,e[8]=s,e[9]=u):u=e[9],u},"xt"),xt=m(d=>{let e=(0,M.c)(37),{busy:t,copiedKey:r,handlers:l,object:n,prefix:c,references:i,selected:s,showReferences:u,t:h}=d,f;e[0]!==l||e[1]!==n||e[2]!==c?(f=Ue(n,c,l),e[0]=l,e[1]=n,e[2]=c,e[3]=f):f=e[3];let{copy:p,download:w,name:a,remove:k,toggle:N}=f,v;e[4]!==n.key||e[5]!==s||e[6]!==h||e[7]!==N?(v=(0,o.jsx)(ee,{className:"w-8",children:(0,o.jsx)(Pe,{objectKey:n.key,onToggle:N,selected:s,t:h})}),e[4]=n.key,e[5]=s,e[6]=h,e[7]=N,e[8]=v):v=e[8];let b;e[9]!==a?(b=(0,o.jsx)(ee,{className:"font-mono text-xs",children:a}),e[9]=a,e[10]=b):b=e[10];let y;e[11]!==n.size?(y=ge(n.size),e[11]=n.size,e[12]=y):y=e[12];let x;e[13]!==y?(x=(0,o.jsx)(ee,{className:"tabular-nums text-muted-foreground",children:y}),e[13]=y,e[14]=x):x=e[14];let j=n.httpMetadata?.contentType??"",S;e[15]!==j?(S=(0,o.jsx)(ee,{children:j}),e[15]=j,e[16]=S):S=e[16];let C;e[17]!==n.key||e[18]!==i||e[19]!==u||e[20]!==h?(C=u&&(0,o.jsx)(ee,{children:(0,o.jsx)(Ae,{objectKey:n.key,references:i,t:h})}),e[17]=n.key,e[18]=i,e[19]=u,e[20]=h,e[21]=C):C=e[21];let T=r===n.key,D;e[22]!==t||e[23]!==p||e[24]!==w||e[25]!==n.key||e[26]!==k||e[27]!==h||e[28]!==T?(D=(0,o.jsx)(ee,{className:"text-right",children:(0,o.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,o.jsx)(Me,{busy:t,copied:T,objectKey:n.key,onCopy:p,onDelete:k,onDownload:w,t:h})})}),e[22]=t,e[23]=p,e[24]=w,e[25]=n.key,e[26]=k,e[27]=h,e[28]=T,e[29]=D):D=e[29];let F;return e[30]!==D||e[31]!==v||e[32]!==b||e[33]!==x||e[34]!==S||e[35]!==C?(F=(0,o.jsxs)(ie,{"data-testid":"fb-row",children:[v,b,x,S,C,D]}),e[30]=D,e[31]=v,e[32]=b,e[33]=x,e[34]=S,e[35]=C,e[36]=F):F=e[36],F},"vt"),vt=m(d=>{let e=(0,M.c)(65),{allSelected:t,busy:r,copiedKey:l,files:n,folders:c,handlers:i,onEnterFolder:s,prefix:u,references:h,selected:f,showReferences:p,someSelected:w,t:a,toggleSelectAll:k}=d,N;e[0]!==a?(N=a("Select all rows"),e[0]=a,e[1]=N):N=e[1];let v;e[2]!==t||e[3]!==w||e[4]!==N||e[5]!==k?(v=(0,o.jsx)(re,{className:"w-8",children:(0,o.jsx)(ye,{"aria-label":N,checked:t,"data-testid":"storage-select-all",indeterminate:w,onCheckedChange:k})}),e[2]=t,e[3]=w,e[4]=N,e[5]=k,e[6]=v):v=e[6];let b;e[7]!==a?(b=a("key"),e[7]=a,e[8]=b):b=e[8];let y;e[9]!==b?(y=(0,o.jsx)(re,{children:b}),e[9]=b,e[10]=y):y=e[10];let x;e[11]!==a?(x=a("size"),e[11]=a,e[12]=x):x=e[12];let j;e[13]!==x?(j=(0,o.jsx)(re,{children:x}),e[13]=x,e[14]=j):j=e[14];let S;e[15]!==a?(S=a("content-type"),e[15]=a,e[16]=S):S=e[16];let C;e[17]!==S?(C=(0,o.jsx)(re,{children:S}),e[17]=S,e[18]=C):C=e[18];let T;e[19]!==p||e[20]!==a?(T=p&&(0,o.jsx)(re,{children:a("used by")}),e[19]=p,e[20]=a,e[21]=T):T=e[21];let D;e[22]!==a?(D=a("Actions"),e[22]=a,e[23]=D):D=e[23];let F;e[24]!==D?(F=(0,o.jsx)(re,{"aria-label":D}),e[24]=D,e[25]=F):F=e[25];let $;e[26]!==F||e[27]!==v||e[28]!==y||e[29]!==j||e[30]!==C||e[31]!==T?($=(0,o.jsx)(Ke,{children:(0,o.jsxs)(ie,{children:[v,y,j,C,T,F]})}),e[26]=F,e[27]=v,e[28]=y,e[29]=j,e[30]=C,e[31]=T,e[32]=$):$=e[32];let O;if(e[33]!==c||e[34]!==s||e[35]!==p){let E;e[37]!==s||e[38]!==p?(E=m(_=>(0,o.jsx)(yt,{colSpan:p?6:5,name:_,onEnter:s},_),"D"),e[37]=s,e[38]=p,e[39]=E):E=e[39],O=c.map(E),e[33]=c,e[34]=s,e[35]=p,e[36]=O}else O=e[36];let B;if(e[40]!==r||e[41]!==l||e[42]!==n||e[43]!==i||e[44]!==u||e[45]!==h||e[46]!==f||e[47]!==p||e[48]!==a){let E;e[50]!==r||e[51]!==l||e[52]!==i||e[53]!==u||e[54]!==h||e[55]!==f||e[56]!==p||e[57]!==a?(E=m(_=>(0,o.jsx)(xt,{busy:r,copiedKey:l,handlers:i,object:_,prefix:u,references:h[_.key],selected:f.has(_.key),showReferences:p,t:a},_.key),"D"),e[50]=r,e[51]=l,e[52]=i,e[53]=u,e[54]=h,e[55]=f,e[56]=p,e[57]=a,e[58]=E):E=e[58],B=n.map(E),e[40]=r,e[41]=l,e[42]=n,e[43]=i,e[44]=u,e[45]=h,e[46]=f,e[47]=p,e[48]=a,e[49]=B}else B=e[49];let L;e[59]!==O||e[60]!==B?(L=(0,o.jsxs)(Fe,{children:[O,B]}),e[59]=O,e[60]=B,e[61]=L):L=e[61];let I;return e[62]!==$||e[63]!==L?(I=(0,o.jsx)(je,{className:"overflow-hidden py-0",children:(0,o.jsx)(ze,{className:"px-0",children:(0,o.jsxs)($e,{"data-testid":"fb-table",children:[$,L]})})}),e[62]=$,e[63]=L,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=m((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=m((d,e,t)=>{let r=t==="desc"?-1:1;return d.toSorted((l,n)=>{let c=Be(l,e),i=Be(n,e);return(typeof c=="number"&&typeof i=="number"?c-i:String(c).localeCompare(String(i)))*r})},"Ct"),Nt=m((d,e)=>{let t=new Set,r=[];for(let l of d){let n=l.key.slice(e.length),c=n.indexOf("/");c===-1?r.push(l):t.add(n.slice(0,c+1))}return{files:r,folders:[...t].toSorted((l,n)=>l.localeCompare(n))}},"Nt"),Ct=m(d=>{let e=(0,M.c)(59),{bucket:t,buckets:r,busy:l,draftPrefix:n,expiry:c,fileInputRef:i,onBucketChange:s,onExpiryChange:u,onFileChange:h,onList:f,onPrefixChange:p,onUploadClick:w,t:a}=d,k;e[0]!==p?(k=m(P=>{p(P.target.value)},"v"),e[0]=p,e[1]=k):k=e[1];let N=k,v;e[2]!==s?(v=m(P=>{s(P.target.value)},"x"),e[2]=s,e[3]=v):v=e[3];let b=v,y;e[4]!==u?(y=m(P=>{u(Number.parseInt(P.target.value,10))},"b"),e[4]=u,e[5]=y):y=e[5];let x=y,j;e[6]!==t||e[7]!==r||e[8]!==b||e[9]!==a?(j=r.length>0&&(0,o.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]=j):j=e[10];let S;e[11]!==a?(S=a("Key prefix"),e[11]=a,e[12]=S):S=e[12];let C;e[13]!==a?(C=a("key prefix (optional)"),e[13]=a,e[14]=C):C=e[14];let T;e[15]!==n||e[16]!==N||e[17]!==S||e[18]!==C?(T=(0,o.jsx)(Ce,{"aria-label":S,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:N,placeholder:C,value:n}),e[15]=n,e[16]=N,e[17]=S,e[18]=C,e[19]=T):T=e[19];let D;e[20]!==a?(D=a("List"),e[20]=a,e[21]=D):D=e[21];let F;e[22]!==l||e[23]!==f||e[24]!==D?(F=(0,o.jsx)(te,{"data-testid":"fb-list",disabled:l,onClick:f,size:"sm",type:"button",children:D}),e[22]=l,e[23]=f,e[24]=D,e[25]=F):F=e[25];let $;e[26]!==l||e[27]!==a?($=a(l?"Uploading\u2026":"Upload"),e[26]=l,e[27]=a,e[28]=$):$=e[28];let O;e[29]!==l||e[30]!==w||e[31]!==$?(O=(0,o.jsx)(te,{"data-testid":"storage-upload",disabled:l,onClick:w,size:"sm",type:"button",variant:"outline",children:$}),e[29]=l,e[30]=w,e[31]=$,e[32]=O):O=e[32];let B;e[33]!==i||e[34]!==h?(B=(0,o.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 L;e[36]!==a?(L=a("Link expiry"),e[36]=a,e[37]=L):L=e[37];let I;e[38]!==a?(I=kt.map(P=>(0,o.jsx)("option",{value:P.seconds,children:a(P.label)},P.seconds)),e[38]=a,e[39]=I):I=e[39];let E;e[40]!==c||e[41]!==x||e[42]!==I?(E=(0,o.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:x,value:c,children:I}),e[40]=c,e[41]=x,e[42]=I,e[43]=E):E=e[43];let _;e[44]!==L||e[45]!==E?(_=(0,o.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[L,E]}),e[44]=L,e[45]=E,e[46]=_):_=e[46];let U;e[47]!==a?(U=a("Open in Cloudflare"),e[47]=a,e[48]=U):U=e[48];let A;e[49]!==U?(A=(0,o.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:_e,rel:"noreferrer",target:"_blank",children:U}),e[49]=U,e[50]=A):A=e[50];let H;return e[51]!==O||e[52]!==B||e[53]!==_||e[54]!==A||e[55]!==j||e[56]!==T||e[57]!==F?(H=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[j,T,F,O,B,_,A]}),e[51]=O,e[52]=B,e[53]=_,e[54]=A,e[55]=j,e[56]=T,e[57]=F,e[58]=H):H=e[58],H},"Tt"),jt=m(d=>{let e=(0,M.c)(66),{onSortKeyChange:t,onThumbSizeChange:r,showGrid:l,showList:n,sortDirection:c,sortKey:i,t:s,tagKeys:u,thumbSize:h,toggleSortDirection:f,view:p}=d,w;e[0]!==t?(w=m(G=>{t(G.target.value)},"k"),e[0]=t,e[1]=w):w=e[1];let a=w,k;e[2]!==r?(k=m(G=>{r(Number.parseInt(G.target.value,10))},"v"),e[2]=r,e[3]=k):k=e[3];let N=k,v=p==="list",b;e[4]!==s?(b=s("List"),e[4]=s,e[5]=b):b=e[5];let y;e[6]!==n||e[7]!==v||e[8]!==b?(y=(0,o.jsx)("button",{"aria-pressed":v,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:n,type:"button",children:b}),e[6]=n,e[7]=v,e[8]=b,e[9]=y):y=e[9];let x=p==="grid",j;e[10]!==s?(j=s("Grid"),e[10]=s,e[11]=j):j=e[11];let S;e[12]!==l||e[13]!==x||e[14]!==j?(S=(0,o.jsx)("button",{"aria-pressed":x,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:l,type:"button",children:j}),e[12]=l,e[13]=x,e[14]=j,e[15]=S):S=e[15];let C;e[16]!==y||e[17]!==S?(C=(0,o.jsxs)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[y,S]}),e[16]=y,e[17]=S,e[18]=C):C=e[18];let T;e[19]!==s?(T=s("Sort"),e[19]=s,e[20]=T):T=e[20];let D;e[21]!==s?(D=s("Name"),e[21]=s,e[22]=D):D=e[22];let F;e[23]!==D?(F=(0,o.jsx)("option",{value:"name",children:D}),e[23]=D,e[24]=F):F=e[24];let $;e[25]!==s?($=s("size"),e[25]=s,e[26]=$):$=e[26];let O;e[27]!==$?(O=(0,o.jsx)("option",{value:"size",children:$}),e[27]=$,e[28]=O):O=e[28];let B;e[29]!==s?(B=s("Type"),e[29]=s,e[30]=B):B=e[30];let L;e[31]!==B?(L=(0,o.jsx)("option",{value:"type",children:B}),e[31]=B,e[32]=L):L=e[32];let I;e[33]!==s?(I=s("Modified"),e[33]=s,e[34]=I):I=e[34];let E;e[35]!==I?(E=(0,o.jsx)("option",{value:"date",children:I}),e[35]=I,e[36]=E):E=e[36];let _;e[37]!==u?(_=u.map(Dt),e[37]=u,e[38]=_):_=e[38];let U;e[39]!==a||e[40]!==i||e[41]!==F||e[42]!==O||e[43]!==L||e[44]!==E||e[45]!==_?(U=(0,o.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,O,L,E,_]}),e[39]=a,e[40]=i,e[41]=F,e[42]=O,e[43]=L,e[44]=E,e[45]=_,e[46]=U):U=e[46];let A;e[47]!==T||e[48]!==U?(A=(0,o.jsxs)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[T,U]}),e[47]=T,e[48]=U,e[49]=A):A=e[49];let H;e[50]!==s?(H=s("Toggle sort direction"),e[50]=s,e[51]=H):H=e[51];let P=c==="asc"?"\u2191":"\u2193",q;e[52]!==H||e[53]!==P||e[54]!==f?(q=(0,o.jsx)("button",{"aria-label":H,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]=H,e[53]=P,e[54]=f,e[55]=q):q=e[55];let Y;e[56]!==N||e[57]!==s||e[58]!==h||e[59]!==p?(Y=p==="grid"&&(0,o.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[s("Thumbnail size"),(0,o.jsx)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:N,step:8,type:"range",value:h})]}),e[56]=N,e[57]=s,e[58]=h,e[59]=p,e[60]=Y):Y=e[60];let ne;return e[61]!==A||e[62]!==q||e[63]!==Y||e[64]!==C?(ne=(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[C,A,q,Y]}),e[61]=A,e[62]=q,e[63]=Y,e[64]=C,e[65]=ne):ne=e[65],ne},"_t");function zt(d){return(0,o.jsx)("option",{value:d,children:d},d)}m(zt,"Et");function Dt(d){return(0,o.jsx)("option",{value:`tag:${d}`,children:d},d)}m(Dt,"$t");var Tt=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,$t=m(d=>(d.httpMetadata?.contentType??"").startsWith("image/")||Tt.test(d.key),"Rt"),Kt=m(()=>{let d=(0,M.c)(1),e;return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,o.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,o.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},"zt"),Ft=m(d=>{let e=(0,M.c)(13),{object:t,resolveUrl:r}=d,[l,n]=(0,z.useState)(null),[c,i]=(0,z.useState)(!1),s;e[0]!==t?(s=$t(t),e[0]=t,e[1]=s):s=e[1];let u=s,h,f;e[2]!==u||e[3]!==t.key||e[4]!==r?(h=m(()=>{if(!u)return;let k={cancelled:!1};return W((async()=>{try{let N=await r(t.key);k.cancelled||n(N)}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,z.useEffect)(h,f);let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=m(()=>{i(!0)},"m"),e[7]=p):p=e[7];let w=p,a;return e[8]!==c||e[9]!==u||e[10]!==t.key||e[11]!==l?(a=(0,o.jsx)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:u&&l!==null&&!c?(0,o.jsx)("img",{alt:t.key,className:"size-full object-cover",loading:"lazy",onError:w,src:l}):(0,o.jsx)(Kt,{})}),e[8]=c,e[9]=u,e[10]=t.key,e[11]=l,e[12]=a):a=e[12],a},"Dt"),Ot=m(d=>{let e=(0,M.c)(42),{busy:t,copiedKey:r,handlers:l,object:n,prefix:c,references:i,resolveUrl:s,selected:u,showReferences:h,t:f}=d,p;e[0]!==l||e[1]!==n||e[2]!==c?(p=Ue(n,c,l),e[0]=l,e[1]=n,e[2]=c,e[3]=p):p=e[3];let{copy:w,download:a,name:k,remove:N,toggle:v}=p,b;e[4]!==n||e[5]!==s?(b=(0,o.jsx)(Ft,{object:n,resolveUrl:s}),e[4]=n,e[5]=s,e[6]=b):b=e[6];let y;e[7]!==n.key||e[8]!==u||e[9]!==f||e[10]!==v?(y=(0,o.jsx)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,o.jsx)(Pe,{objectKey:n.key,onToggle:v,selected:u,t:f})}),e[7]=n.key,e[8]=u,e[9]=f,e[10]=v,e[11]=y):y=e[11];let x;e[12]!==b||e[13]!==y?(x=(0,o.jsxs)("div",{className:"relative",children:[b,y]}),e[12]=b,e[13]=y,e[14]=x):x=e[14];let j;e[15]!==k?(j=(0,o.jsx)("p",{className:"truncate font-mono text-xs",title:k,children:k}),e[15]=k,e[16]=j):j=e[16];let S;e[17]!==n.size?(S=ge(n.size),e[17]=n.size,e[18]=S):S=e[18];let C;e[19]!==S?(C=(0,o.jsx)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:S}),e[19]=S,e[20]=C):C=e[20];let T;e[21]!==n.key||e[22]!==i||e[23]!==h||e[24]!==f?(T=h&&(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)(Ae,{objectKey:n.key,references:i,t:f})}),e[21]=n.key,e[22]=i,e[23]=h,e[24]=f,e[25]=T):T=e[25];let D;e[26]!==j||e[27]!==C||e[28]!==T?(D=(0,o.jsxs)("div",{className:"min-w-0",children:[j,C,T]}),e[26]=j,e[27]=C,e[28]=T,e[29]=D):D=e[29];let F=r===n.key,$;e[30]!==t||e[31]!==w||e[32]!==a||e[33]!==n.key||e[34]!==N||e[35]!==f||e[36]!==F?($=(0,o.jsx)("div",{className:"flex items-center gap-1",children:(0,o.jsx)(Me,{busy:t,buttonClassName:"h-7 px-2 text-xs",copied:F,objectKey:n.key,onCopy:w,onDelete:N,onDownload:a,t:f})}),e[30]=t,e[31]=w,e[32]=a,e[33]=n.key,e[34]=N,e[35]=f,e[36]=F,e[37]=$):$=e[37];let O;return e[38]!==$||e[39]!==x||e[40]!==D?(O=(0,o.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[x,D,$]}),e[38]=$,e[39]=x,e[40]=D,e[41]=O):O=e[41],O},"jt"),Et=m(d=>{let e=(0,M.c)(9),{name:t,onEnter:r}=d,l;e[0]!==t||e[1]!==r?(l=m(()=>{r(t)},"n"),e[0]=t,e[1]=r,e[2]=l):l=e[2];let n=l,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,o.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,o.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,o.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,o.jsx)("span",{className:"truncate font-mono text-xs",title:t,children:t}),e[4]=t,e[5]=i):i=e[5];let s;return e[6]!==n||e[7]!==i?(s=(0,o.jsxs)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:n,type:"button",children:[c,i]}),e[6]=n,e[7]=i,e[8]=s):s=e[8],s},"Kt"),Lt=m(d=>{let e=(0,M.c)(34),{busy:t,copiedKey:r,files:l,folders:n,handlers:c,onEnterFolder:i,prefix:s,references:u,resolveUrl:h,selected:f,showReferences:p,size:w,t:a}=d,k;e[0]!==w?(k=w.toString(),e[0]=w,e[1]=k):k=e[1];let N=`repeat(auto-fill, minmax(${k}px, 1fr))`,v;e[2]!==N?(v={gridTemplateColumns:N},e[2]=N,e[3]=v):v=e[3];let b=v,y;if(e[4]!==n||e[5]!==i){let S;e[7]!==i?(S=m(C=>(0,o.jsx)(Et,{name:C,onEnter:i},C),"S"),e[7]=i,e[8]=S):S=e[8],y=n.map(S),e[4]=n,e[5]=i,e[6]=y}else y=e[6];let x;if(e[9]!==t||e[10]!==r||e[11]!==l||e[12]!==c||e[13]!==s||e[14]!==u||e[15]!==h||e[16]!==f||e[17]!==p||e[18]!==a){let S;e[20]!==t||e[21]!==r||e[22]!==c||e[23]!==s||e[24]!==u||e[25]!==h||e[26]!==f||e[27]!==p||e[28]!==a?(S=m(C=>(0,o.jsx)(Ot,{busy:t,copiedKey:r,handlers:c,object:C,prefix:s,references:u[C.key],resolveUrl:h,selected:f.has(C.key),showReferences:p,t:a},C.key),"S"),e[20]=t,e[21]=r,e[22]=c,e[23]=s,e[24]=u,e[25]=h,e[26]=f,e[27]=p,e[28]=a,e[29]=S):S=e[29],x=l.map(S),e[9]=t,e[10]=r,e[11]=l,e[12]=c,e[13]=s,e[14]=u,e[15]=h,e[16]=f,e[17]=p,e[18]=a,e[19]=x}else x=e[19];let j;return e[30]!==b||e[31]!==y||e[32]!==x?(j=(0,o.jsxs)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[y,x]}),e[30]=b,e[31]=y,e[32]=x,e[33]=j):j=e[33],j},"Lt"),_t=m(d=>{let e=(0,M.c)(23),{reference:t,t:r}=d,l=`fb-dangling-${t.table}-${t.id}-${t.column}`,n=`${t.table}\xB7${t.id}`,c;e[0]!==n?(c=(0,o.jsx)(ae,{variant:"secondary",children:n}),e[0]=n,e[1]=c):c=e[1];let i;e[2]!==t.column?(i=(0,o.jsx)("span",{className:"text-muted-foreground",children:t.column}),e[2]=t.column,e[3]=i):i=e[3];let s;e[4]!==r?(s=r("\u2192"),e[4]=r,e[5]=s):s=e[5];let u;e[6]!==s?(u=(0,o.jsx)("span",{className:"text-muted-foreground/60",children:s}),e[6]=s,e[7]=u):u=e[7];let h;e[8]!==t.key?(h=(0,o.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,o.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 p;e[15]!==r?(p=r("Missing object"),e[15]=r,e[16]=p):p=e[16];let w;e[17]!==p?(w=(0,o.jsx)(ae,{className:"border-destructive/40 text-destructive",variant:"outline",children:p}),e[17]=p,e[18]=w):w=e[18];let a;return e[19]!==l||e[20]!==w||e[21]!==f?(a=(0,o.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":l,children:[f,w]}),e[19]=l,e[20]=w,e[21]=f,e[22]=a):a=e[22],a},"Bt"),Bt=m(d=>{let e=(0,M.c)(42),{busy:t,onCheck:r,references:l,t:n,truncated:c}=d,i;e[0]!==n?(i=n("Integrity"),e[0]=n,e[1]=i):i=e[1];let s;e[2]!==i?(s=(0,o.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[2]=i,e[3]=s):s=e[3];let u;e[4]!==n?(u=n("Orphaned objects"),e[4]=n,e[5]=u):u=e[5];let h;e[6]!==u?(h=(0,o.jsx)("span",{className:"text-sm font-medium text-foreground",children:u}),e[6]=u,e[7]=h):h=e[7];let f;e[8]!==n?(f=n("Find records whose file reference points at an object the bucket no longer has."),e[8]=n,e[9]=f):f=e[9];let p;e[10]!==f?(p=(0,o.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[10]=f,e[11]=p):p=e[11];let w;e[12]!==s||e[13]!==h||e[14]!==p?(w=(0,o.jsxs)("div",{className:"flex flex-col gap-1",children:[s,h,p]}),e[12]=s,e[13]=h,e[14]=p,e[15]=w):w=e[15];let a;e[16]!==t||e[17]!==n?(a=n(t?"Checking\u2026":"Check for orphans"),e[16]=t,e[17]=n,e[18]=a):a=e[18];let k;e[19]!==t||e[20]!==r||e[21]!==a?(k=(0,o.jsx)(te,{"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 N;e[23]!==w||e[24]!==k?(N=(0,o.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[w,k]}),e[23]=w,e[24]=k,e[25]=N):N=e[25];let v;e[26]!==l||e[27]!==n||e[28]!==c?(v=c&&(0,o.jsx)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:l===void 0||l.length===0?n("The bucket is larger than the scan's key limit, so dangling references could not be checked."):n("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:l.length})}),e[26]=l,e[27]=n,e[28]=c,e[29]=v):v=e[29];let b;e[30]!==l?.length||e[31]!==n||e[32]!==c?(b=l?.length===0&&!c&&(0,o.jsx)(he,{description:n("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:n("No dangling references.")}),e[30]=l?.length,e[31]=n,e[32]=c,e[33]=b):b=e[33];let y;e[34]!==l||e[35]!==n?(y=l!==void 0&&l.length>0&&(0,o.jsx)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:l.map(j=>(0,o.jsx)(_t,{reference:j,t:n},`${j.table}\xB7${j.id}\xB7${j.column}`))}),e[34]=l,e[35]=n,e[36]=y):y=e[36];let x;return e[37]!==N||e[38]!==v||e[39]!==b||e[40]!==y?(x=(0,o.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[N,v,b,y]}),e[37]=N,e[38]=v,e[39]=b,e[40]=y,e[41]=x):x=e[41],x},"It"),It=m(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[l,n]=(0,z.useState)(r),c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=m(v=>{n(b=>{let y=new Set(b);return y.has(v)?y.delete(v):y.add(v),y})},"a"),t[1]=c):c=t[1];let i=c,s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=m(()=>{n(new Set)},"o"),t[2]=s):s=t[2];let u=s,h,f,p;if(t[3]!==d||t[4]!==e||t[5]!==l){let v;t[9]!==e?(v=m(b=>e(b),"x"),t[9]=e,t[10]=v):v=t[10],f=d.map(v),h=f.length>0&&f.every(b=>l.has(b)),p=!h&&f.some(b=>l.has(b)),t[3]=d,t[4]=e,t[5]=l,t[6]=h,t[7]=f,t[8]=p}else h=t[6],f=t[7],p=t[8];let w=p,a;t[11]!==f?(a=m(()=>{n(v=>f.every(b=>v.has(b))?new Set:new Set(f))},"i"),t[11]=f,t[12]=a):a=t[12];let k=a,N;return t[13]!==h||t[14]!==l||t[15]!==w||t[16]!==k?(N={allSelected:h,clear:u,selected:l,someSelected:w,toggle:i,toggleAll:k},t[13]=h,t[14]=l,t[15]=w,t[16]=k,t[17]=N):N=t[17],N},"Ot"),Rt=me(be.storageReferences),Ut=me(be.storageOrphans),Ie=1e4,Mt=1e3,At=m(async d=>{let e=[],t,r=!0,l=!1;for(;r&&e.length<Ie;){let n=await d.list({cursor:t,limit:Mt}),c=Ie-e.length;for(let i of n.objects.slice(0,c))e.push(i.key);l||=n.objects.length>c,t=n.cursor,r=t!==void 0}return{liveKeys:e,truncated:l||r}},"Gt"),Pt=3600,Wt=m((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()},"Pt"),Ht=m(d=>d.key,"qt"),qt=m(({initialPrefix:d,pageSize:e})=>{let t=Se(),[r,l]=(0,z.useState)(d??""),[n,c]=(0,z.useState)(d??""),[i,s]=(0,z.useState)(wt),[u,h]=(0,z.useState)("list"),[f,p]=(0,z.useState)(128),[w,a]=(0,z.useState)("name"),[k,N]=(0,z.useState)("asc"),[v,b]=(0,z.useState)(void 0),[y,x]=(0,z.useState)(void 0),[j,S]=(0,z.useState)(!1),[C,T]=(0,z.useState)(void 0),[D,F]=(0,z.useState)(void 0),[$,O]=(0,z.useState)(""),[B,L]=(0,z.useState)({}),[I,E]=(0,z.useState)(!1),[_,U]=(0,z.useState)(void 0),[A,H]=(0,z.useState)(!1),[P,q]=(0,z.useState)(!1),[Y,ne]=(0,z.useState)([]),[G,xe]=(0,z.useState)(""),oe=(0,z.useRef)(0),J=(0,z.useRef)(0);(0,z.useEffect)(()=>{let g={cancelled:!1};return W((async()=>{try{let K=await t.listStorageBuckets();if(!g.cancelled){ne(K);let[R]=K;R!==void 0&&xe(X=>X===""?R:X)}}catch{}})()),()=>{g.cancelled=!0}},[t]);let V=(0,z.useMemo)(()=>({list:m(g=>t.listStorageObjects({...g,bucket:G}),"list"),remove:m(g=>t.deleteStorageObject(g,{bucket:G}),"remove"),signedUrl:m((g,K)=>t.signedStorageUrl(g,{...K,bucket:G}),"signedUrl"),upload:m(g=>t.uploadStorageObject({...g,bucket:G}),"upload")}),[G,t]),Z=(0,z.useCallback)(async(g,K,R)=>{oe.current+=1;let X=oe.current;x(void 0),S(!0);try{let se=await V.list({cursor:K,limit:e,prefix:g});if(X!==oe.current)return;b(we=>R&&we!==void 0?[...we,...se.objects]:se.objects),F(se.cursor)}catch(se){if(X!==oe.current)return;R||b(void 0),x(Q(se))}finally{X===oe.current&&S(!1)}},[e,V]);(0,z.useEffect)(()=>{W(Z(d??"",void 0,!1))},[Z,d]);let We=(v?.length??0)<=e;Ee(()=>{W(Z(r,void 0,!1))},We);let{files:de,folders:He}=Nt(v??[],r),qe=(0,z.useMemo)(()=>{let g=new Set;for(let K of de)for(let R of Object.keys(K.customMetadata??{}))g.add(R);return[...g].toSorted((K,R)=>K.localeCompare(R))},[de]),ce=St(de,w,k),ue=(0,z.useMemo)(()=>[...new Set(ce.map(g=>g.key))].toSorted((g,K)=>g.localeCompare(K)).join(`
|
|
3
3
|
`),[ce]);(0,z.useEffect)(()=>{let g=ue===""?[]:ue.split(`
|
|
4
4
|
`);if(g.length===0){L({});return}let K={current:!0};return W((async()=>{try{let R=await t.query(Rt,{keys:g},pe($));K.current&&(L(R.references??{}),E(Object.keys(R.storageColumns??{}).length>0))}catch{K.current&&(L({}),E(!1))}})()),()=>{K.current=!1}},[t,ue,$]);let{allSelected:Ge,clear:le,selected:ve,someSelected:Ve,toggle:Ze,toggleAll:Xe}=It(ce,Ht),Ye=m(()=>{l(n),le(),W(Z(n,void 0,!1))},"Oe"),Je=m(()=>{W(Z(r,D,!0))},"Ae"),ke=m(g=>{l(g),c(g),le(),W(Z(g,void 0,!1))},"be"),Qe=m(g=>{ke(`${r}${g}`)},"Ue"),et=m(g=>V.signedUrl(g,{expiresInSeconds:Pt}),"Me"),tt=m(()=>{h("list")},"Ge"),rt=m(()=>{h("grid")},"He"),nt=m(g=>{a(g)},"Pe"),ot=m(()=>{N(g=>g==="asc"?"desc":"asc")},"qe"),lt=m(g=>{p(g)},"Ve"),st=m(g=>{s(g)},"We"),at=m(()=>{x(void 0),S(!0),W((async()=>{try{for(let g of ve)await V.remove(g);await Z(r,void 0,!1),le()}catch(g){x(Q(g))}S(!1)})())},"Ze"),ct=m(g=>{x(void 0),W((async()=>{try{let K=await V.signedUrl(g,{expiresInSeconds:i});De(K)&&T(g)}catch(K){x(Q(K))}})())},"Xe"),it=m(g=>{x(void 0),W((async()=>{try{let K=await V.signedUrl(g,{expiresInSeconds:i}),R=g.slice(g.lastIndexOf("/")+1)||g;Wt(K,R)}catch(K){x(Q(K))}})())},"Ye");(0,z.useEffect)(()=>{if(C===void 0)return;let g=globalThis.setTimeout(()=>{T(void 0)},2e3);return()=>{globalThis.clearTimeout(g)}},[C]);let dt=m(g=>{x(void 0),S(!0),W((async()=>{try{await V.remove(g),await Z(r,void 0,!1)}catch(K){x(Q(K))}S(!1)})())},"Je"),ut=m(g=>{let K=`${r}${g.name}`;x(void 0),S(!0),W((async()=>{try{let R=await g.arrayBuffer();await V.upload({body:R,contentType:g.type===""?void 0:g.type,key:K}),await Z(r,void 0,!1)}catch(R){x(Q(R))}S(!1)})())},"Qe");(0,z.useEffect)(()=>{J.current+=1,U(void 0),q(!1)},[$]);let ft=m(()=>{J.current+=1;let g=J.current;x(void 0),H(!0),W((async()=>{try{let{liveKeys:K,truncated:R}=await At(V);if(R)g===J.current&&(U(void 0),q(!0));else{let X=await t.query(Ut,{liveKeys:K},pe($));g===J.current&&(U(X.references??[]),q(X.truncated===!0))}}catch(K){g===J.current&&(U(void 0),q(!1),x(Q(K)))}g===J.current&&H(!1)})())},"et"),ht=m(g=>{oe.current+=1,J.current+=1,xe(g),l(d??""),c(d??""),b(void 0),U(void 0),q(!1),le()},"tt");return{allSelected:Ge,bucket:G,buckets:Y,bulkDelete:at,busy:j,checkOrphans:ft,clearSelection:le,copiedKey:C,danglingBusy:A,danglingReferences:_,danglingTruncated:P,draftPrefix:n,enterFolder:Qe,error:y,expiry:i,files:ce,folders:He,hasObjects:v!==void 0&&v.length>0,hasStorageColumns:I,listFirst:Ye,loaded:v!==void 0,loadMore:Je,navigate:ke,nextCursor:D,onCopy:ct,onDelete:dt,onDownload:it,onExpiryChange:st,onFile:ut,onSortKeyChange:nt,onThumbSizeChange:lt,prefix:r,referenceShard:$,references:B,resolveUrl:et,selectBucket:ht,selected:ve,setDraftPrefix:c,setReferenceShard:O,showGrid:rt,showList:tt,someSelected:Ve,sortDirection:k,sortKey:w,tagKeys:qe,thumbSize:f,toggleSelect:Ze,toggleSelectAll:Xe,toggleSortDirection:ot,view:u}},"Vt"),Gt=100,Re=m(d=>{let e=(0,M.c)(6),{label:t,onNavigate:r,target:l}=d,n;e[0]!==r||e[1]!==l?(n=m(()=>{r(l)},"l"),e[0]=r,e[1]=l,e[2]=n):n=e[2];let c=n,i;return e[3]!==c||e[4]!==t?(i=(0,o.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},"Se"),Vt=m(d=>{let e=(0,M.c)(11),{onNavigate:t,prefix:r,t:l}=d,n;if(e[0]!==t||e[1]!==r||e[2]!==l){let c=r.split("/").filter(Zt),i;e[4]!==l?(i=l("Folder path"),e[4]=l,e[5]=i):i=e[5];let s;e[6]!==l?(s=l("root"),e[6]=l,e[7]=s):s=e[7];let u;e[8]!==t||e[9]!==s?(u=(0,o.jsx)(Re,{label:s,onNavigate:t,target:""}),e[8]=t,e[9]=s,e[10]=u):u=e[10],n=(0,o.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,o.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,o.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,o.jsx)(Re,{label:h,onNavigate:t,target:`${c.slice(0,f+1).join("/")}/`})]},`${h}-${f.toString()}`))]}),e[0]=t,e[1]=r,e[2]=l,e[3]=n}else n=e[3];return n},"Zt"),fr=m(({initialPrefix:d,pageSize:e=Gt})=>{let t=Ne(),r=qt({initialPrefix:d,pageSize:e}),l=(0,z.useRef)(null),{onCopy:n,onDelete:c,onDownload:i,onFile:s,toggleSelect:u}=r,h={onCopy:n,onDelete:c,onDownload:i,onToggleSelect:u},f=m(()=>{l.current?.click()},"u"),p=m(a=>{let k=a.target,N=k.files?.[0];k.value="",N&&s(N)},"m"),w=r.loaded&&!r.hasObjects;return(0,o.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,o.jsx)(Ct,{bucket:r.bucket,buckets:r.buckets,busy:r.busy,draftPrefix:r.draftPrefix,expiry:r.expiry,fileInputRef:l,onBucketChange:r.selectBucket,onExpiryChange:r.onExpiryChange,onFileChange:p,onList:r.listFirst,onPrefixChange:r.setDraftPrefix,onUploadClick:f,t}),r.loaded&&(0,o.jsx)(Vt,{onNavigate:r.navigate,prefix:r.prefix,t}),r.hasObjects&&(0,o.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,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,o.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:t("References shard")}),(0,o.jsx)(Te,{id:"fb-reference-shard-input",onChange:r.setReferenceShard,testId:"fb-reference-shard-input",value:r.referenceShard}),(0,o.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,o.jsx)(Bt,{busy:r.danglingBusy,onCheck:r.checkOrphans,references:r.danglingReferences,t,truncated:r.danglingTruncated}),r.selected.size>0&&(0,o.jsx)(Le,{count:r.selected.size,editable:!0,onClear:r.clearSelection,onDelete:r.bulkDelete}),r.error!==void 0&&(0,o.jsx)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:r.error}),w&&(0,o.jsx)(he,{description:t("Objects you upload to your R2 buckets will appear here."),icon:(0,o.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,o.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,o.jsx)("path",{d:"M12 11v5m-2.5-2.5h5"})]}),testId:"fb-empty",title:t("No objects.")}),r.hasObjects&&r.view==="list"&&(0,o.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,o.jsx)(Lt,{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,o.jsx)("div",{children:(0,o.jsx)(te,{"data-testid":"fb-next",disabled:r.busy,onClick:r.loadMore,size:"sm",type:"button",variant:"outline",children:t("Load more")})})]})},"ps");function Zt(d){return d!==""}m(Zt,"Xt");export{fr as FileBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as h}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{b as A}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{b as A}from"./chunk-MBP4SZYB.js";import{f as k}from"./chunk-Z7WCKAUJ.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as y,e as S}from"./chunk-WUWBZPUK.js";import{d as I}from"./chunk-FODLDLE2.js";import{a as u,d as w,f as z,g as P}from"./chunk-YKXDMIHQ.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(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:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(L)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as h,n as v}from"./chunk-
|
|
1
|
+
import{m as h,n as v}from"./chunk-URBHAYYZ.js";import{a as u,d as p,f as x,g as y,i as g}from"./chunk-YKXDMIHQ.js";var b=p(x(),1);var n=p(y(),1);var w={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},j=u(i=>{let a=(0,b.c)(12),{ariaLabel:c,className:m,series:l,testId:d}=i;if(l.length<2)return null;let t;a[0]!==l?(t=l.slice(-40).map(N),a[0]=l,a[1]=t):t=a[1];let f=t,e;a[2]!==m?(e=g("h-6 w-[120px]",m),a[2]=m,a[3]=e):e=a[3];let o;a[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(v,{dataKey:"value"}),a[4]=o):o=a[4];let r;a[5]!==f?(r=(0,n.jsx)(h,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:w,data:f,children:o}),a[5]=f,a[6]=r):r=a[6];let s;return a[7]!==c||a[8]!==e||a[9]!==r||a[10]!==d?(s=(0,n.jsx)("div",{"aria-label":c,className:e,"data-testid":d,role:"img",children:r}),a[7]=c,a[8]=e,a[9]=r,a[10]=d,a[11]=s):s=a[11],s},"w");function N(i,a){return{index:a,value:i}}u(N,"b");export{j as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as C}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as J}from"./chunk-
|
|
1
|
+
import{b as C}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as J}from"./chunk-KZDIKRZ3.js";import"./chunk-ULIQFBZU.js";import"./chunk-2W365SXI.js";import"./chunk-35DM4JJG.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{c as z}from"./chunk-MBP4SZYB.js";import"./chunk-Z7WCKAUJ.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as E}from"./chunk-FKVZRPV5.js";import{a as G,b as M,c as U,d as P,e as d,f as c}from"./chunk-HEAQVSNS.js";import{a as D,e as _}from"./chunk-WUWBZPUK.js";import{d as q}from"./chunk-FODLDLE2.js";import{a as S,d as O,f as Q,g as V}from"./chunk-YKXDMIHQ.js";var L=O(Q(),1);var r=O(V(),1);var K=["read","insert","update","delete"],B=S((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"z"),W=S(e=>{let s=new Map;for(let a of e){let t=s.get(a.table)??{operations:new Set,procedures:new Set,table:a.table};t.operations.add(a.on),t.procedures.add(a.procedure),s.set(a.table,t)}return[...s.values()].toSorted((a,t)=>a.table.localeCompare(t.table))},"J"),ie=S(()=>{let e=(0,L.c)(49),s=q(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:t,error:R,errorSource:k}=z(H.rlsPolicies,a),p=t!==void 0,m,n,h,l,f,u,x,b,o;if(e[1]!==t||e[2]!==R||e[3]!==k||e[4]!==p||e[5]!==s){let $=W(Array.isArray(t?.policies)?t.policies:[]),j;e[15]!==t?(j=Array.isArray(t?.roles)?t.roles:[],e[15]=t,e[16]=j):j=e[16],n=j,x="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==R||e[18]!==k?(o=R!==null&&(0,r.jsx)(J,{error:k,testId:"rls-error"}),e[17]=R,e[18]=k,e[19]=o):o=e[19],u="flex flex-col gap-2",m=D,h="overflow-hidden py-0";let I;e[20]!==s?(I=s("Policies"),e[20]=s,e[21]=I):I=e[21],e[22]!==I?(l=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:I})}),e[22]=I,e[23]=l):l=e[23],f=p&&$.length===0?(0,r.jsx)(E,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Table")}),K.map(i=>(0,r.jsx)(d,{children:B(s,i)},i)),(0,r.jsx)(d,{children:s("Guarded by")})]})}),(0,r.jsx)(U,{children:$.map(i=>(0,r.jsxs)(P,{"data-testid":`rls-table-${i.table}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:i.table}),K.map(F=>(0,r.jsx)(c,{children:i.operations.has(F)?(0,r.jsx)(C,{variant:"secondary",children:s("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},F)),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:[...i.procedures].join(", ")})]},i.table))})]})}),e[1]=t,e[2]=R,e[3]=k,e[4]=p,e[5]=s,e[6]=m,e[7]=n,e[8]=h,e[9]=l,e[10]=f,e[11]=u,e[12]=x,e[13]=b,e[14]=o}else m=e[6],n=e[7],h=e[8],l=e[9],f=e[10],u=e[11],x=e[12],b=e[13],o=e[14];let N;e[24]!==m||e[25]!==h||e[26]!==l||e[27]!==f?(N=(0,r.jsxs)(m,{className:h,children:[l,f]}),e[24]=m,e[25]=h,e[26]=l,e[27]=f,e[28]=N):N=e[28];let g;e[29]!==u||e[30]!==N?(g=(0,r.jsx)("section",{className:u,children:N}),e[29]=u,e[30]=N,e[31]=g):g=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let w;e[34]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=w):w=e[35];let v;e[36]!==p||e[37]!==n||e[38]!==s?(v=p&&n.length===0?(0,r.jsx)(E,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Role")}),(0,r.jsx)(d,{children:s("Description")}),(0,r.jsx)(d,{children:s("Permissions")})]})}),(0,r.jsx)(U,{children:n.map(Y)})]})}),e[36]=p,e[37]=n,e[38]=s,e[39]=v):v=e[39];let A;e[40]!==w||e[41]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[40]=w,e[41]=v,e[42]=A):A=e[42];let T;return e[43]!==A||e[44]!==x||e[45]!==b||e[46]!==o||e[47]!==g?(T=(0,r.jsxs)("div",{className:x,"data-testid":b,children:[o,g,A]}),e[43]=A,e[44]=x,e[45]=b,e[46]=o,e[47]=g,e[48]=T):T=e[48],T},"oe");function X(e){return(0,r.jsx)(C,{variant:"outline",children:e},e)}S(X,"K");function Y(e){return(0,r.jsxs)(P,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(c,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(c,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)})})]},e.name)}S(Y,"V");export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te}from"./chunk-EA2JKR5D.js";import{W as Z}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as O}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as K}from"./chunk-4ZEL6BYL.js";import{c as ee}from"./chunk-D6UKRXIS.js";import{f as M}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as P}from"./chunk-FKVZRPV5.js";import{a as D,b as F,c as L,d as h,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as E,e as _}from"./chunk-WUWBZPUK.js";import{d as H,f as Q,g as V,h as W,o as $}from"./chunk-FODLDLE2.js";import{a as n,d as Y,e as ne,g as le}from"./chunk-YKXDMIHQ.js";var c=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(l=>typeof l=="object"&&l!==null&&l.code===de,"ie"),me=n(l=>{let r=l.error??l.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"de"),ue=n(({loadDetail:l,loadInstances:r,readOnly:N,runAction:j,workflowName:g})=>{let A=M(),s=H(),[p,k]=(0,c.useState)(null),[S,C]=(0,c.useState)(null),[v,z]=(0,c.useState)(""),[b,f]=(0,c.useState)(null),[J,I]=(0,c.useState)(!1),[R,U]=(0,c.useState)(null),x=l??(a=>A.getWorkflowInstance(a)),w=N?void 0:j??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{f(null),I(!1);let a=v===""?void 0:v;try{if(r===void 0){let d=await A.listWorkflowInstances({name:g,status:a});if(d.configured===!1){k(null),I(!0);return}k(d.instances);return}k(await r({name:g,status:a}))}catch(d){k(null),ce(d)?I(!0):f(W(d))}},"L");(0,c.useEffect)(()=>{C(null),$(T())},[g,v]);let q=n(async a=>{f(null);try{C(await x({id:a,name:g}))}catch(d){f(W(d))}},"K"),B=n(async(a,d)=>{if(w!==void 0){U(a),f(null);try{await w({action:d,id:a,name:g}),await T()}catch(G){f(W(G))}U(null)}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{z(a.target.value)},"onChange"),value:v,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),b!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),J&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!J&&p!==null&&p.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Instance id")}),(0,e.jsx)(o,{children:s("Status")}),(0,e.jsx)(o,{children:s("Created")}),(0,e.jsx)(o,{children:s("Ended")}),(0,e.jsx)(o,{"aria-label":s("Actions")})]})}),(0,e.jsx)(L,{children:p.map(a=>(0,e.jsxs)(h,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(O,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),w!==void 0&&ie.map(d=>(0,e.jsx)(O,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(B(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(O,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{C(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(D,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Step")}),(0,e.jsx)(o,{children:s("Type")}),(0,e.jsx)(o,{children:s("Attempts")}),(0,e.jsx)(o,{children:s("Started")}),(0,e.jsx)(o,{children:s("Output")})]})}),(0,e.jsx)(L,{children:S.steps.map((a,d)=>(0,e.jsxs)(h,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"ce"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output)}catch{return"(unserializable)"}},"fe"),xe=n((l,r)=>l.some(N=>N.exportName===r)?r:l[0]?.exportName??"","he"),We=n(()=>{let l=M(),r=H(),{data:N,error:j}=ee(K.listWorkflows,{}),[g,A]=(0,c.useState)(""),[s,p]=(0,c.useState)(""),[k,S]=(0,c.useState)(""),[C,v]=(0,c.useState)(!1),[z,b]=(0,c.useState)(null),[f,J]=(0,c.useState)([]),[I,R]=(0,c.useState)(null),U=N!==void 0,x=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=xe(x,g),T=x.find(t=>t.exportName===w),q=n(t=>{J(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"C"),B=n(async()=>{let t=w;if(t==="")return;let u,m=k.trim();if(m!=="")try{u=JSON.parse(m)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{let y=s.trim(),X=await l.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),p("")}catch(y){b(W(y))}v(!1)},"L"),a=n(()=>{$(B())},"K"),d=n(async(t,u)=>{R(u);try{let m=await l.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){b(W(m))}R(null)},"q"),G=n(t=>{A(t.target.value)},"r"),ae=n(t=>{p(t.target.value)},"l"),re=n(t=>{S(t.target.value)},"G"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"ee");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:j}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&x.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Export")}),(0,e.jsx)(o,{children:r("Name")}),(0,e.jsx)(o,{children:r("Class")}),(0,e.jsx)(o,{children:r("Binding")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),x.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:G,value:w,children:x.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(O,{"data-testid":"workflows-start-button",disabled:C||w==="",onClick:a,children:r(C?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Workflow")}),(0,e.jsx)(o,{children:r("Instance id")}),(0,e.jsx)(o,{children:r("Status")}),(0,e.jsx)(o,{children:r("Output")}),(0,e.jsx)(o,{})]})}),(0,e.jsx)(L,{children:f.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(i,{children:(0,e.jsx)(O,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:I===t.id,onClick:se,size:"xs",variant:"outline",children:I===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Te");export{We as default};
|
|
1
|
+
import{a as te}from"./chunk-EA2JKR5D.js";import{W as Z}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as O}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{a as K}from"./chunk-4ZEL6BYL.js";import{c as ee}from"./chunk-MBP4SZYB.js";import{f as M}from"./chunk-Z7WCKAUJ.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as P}from"./chunk-FKVZRPV5.js";import{a as D,b as F,c as L,d as h,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as E,e as _}from"./chunk-WUWBZPUK.js";import{d as H,f as Q,g as V,h as W,o as $}from"./chunk-FODLDLE2.js";import{a as n,d as Y,e as ne,g as le}from"./chunk-YKXDMIHQ.js";var c=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(l=>typeof l=="object"&&l!==null&&l.code===de,"ie"),me=n(l=>{let r=l.error??l.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"de"),ue=n(({loadDetail:l,loadInstances:r,readOnly:N,runAction:j,workflowName:g})=>{let A=M(),s=H(),[p,k]=(0,c.useState)(null),[S,C]=(0,c.useState)(null),[v,z]=(0,c.useState)(""),[b,f]=(0,c.useState)(null),[J,I]=(0,c.useState)(!1),[R,U]=(0,c.useState)(null),x=l??(a=>A.getWorkflowInstance(a)),w=N?void 0:j??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{f(null),I(!1);let a=v===""?void 0:v;try{if(r===void 0){let d=await A.listWorkflowInstances({name:g,status:a});if(d.configured===!1){k(null),I(!0);return}k(d.instances);return}k(await r({name:g,status:a}))}catch(d){k(null),ce(d)?I(!0):f(W(d))}},"L");(0,c.useEffect)(()=>{C(null),$(T())},[g,v]);let q=n(async a=>{f(null);try{C(await x({id:a,name:g}))}catch(d){f(W(d))}},"K"),B=n(async(a,d)=>{if(w!==void 0){U(a),f(null);try{await w({action:d,id:a,name:g}),await T()}catch(G){f(W(G))}U(null)}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{z(a.target.value)},"onChange"),value:v,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),b!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),J&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!J&&p!==null&&p.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Instance id")}),(0,e.jsx)(o,{children:s("Status")}),(0,e.jsx)(o,{children:s("Created")}),(0,e.jsx)(o,{children:s("Ended")}),(0,e.jsx)(o,{"aria-label":s("Actions")})]})}),(0,e.jsx)(L,{children:p.map(a=>(0,e.jsxs)(h,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(O,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),w!==void 0&&ie.map(d=>(0,e.jsx)(O,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(B(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(O,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{C(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(D,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Step")}),(0,e.jsx)(o,{children:s("Type")}),(0,e.jsx)(o,{children:s("Attempts")}),(0,e.jsx)(o,{children:s("Started")}),(0,e.jsx)(o,{children:s("Output")})]})}),(0,e.jsx)(L,{children:S.steps.map((a,d)=>(0,e.jsxs)(h,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"ce"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output)}catch{return"(unserializable)"}},"fe"),xe=n((l,r)=>l.some(N=>N.exportName===r)?r:l[0]?.exportName??"","he"),We=n(()=>{let l=M(),r=H(),{data:N,error:j}=ee(K.listWorkflows,{}),[g,A]=(0,c.useState)(""),[s,p]=(0,c.useState)(""),[k,S]=(0,c.useState)(""),[C,v]=(0,c.useState)(!1),[z,b]=(0,c.useState)(null),[f,J]=(0,c.useState)([]),[I,R]=(0,c.useState)(null),U=N!==void 0,x=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=xe(x,g),T=x.find(t=>t.exportName===w),q=n(t=>{J(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"C"),B=n(async()=>{let t=w;if(t==="")return;let u,m=k.trim();if(m!=="")try{u=JSON.parse(m)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{let y=s.trim(),X=await l.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),p("")}catch(y){b(W(y))}v(!1)},"L"),a=n(()=>{$(B())},"K"),d=n(async(t,u)=>{R(u);try{let m=await l.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){b(W(m))}R(null)},"q"),G=n(t=>{A(t.target.value)},"r"),ae=n(t=>{p(t.target.value)},"l"),re=n(t=>{S(t.target.value)},"G"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"ee");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:j}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&x.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Export")}),(0,e.jsx)(o,{children:r("Name")}),(0,e.jsx)(o,{children:r("Class")}),(0,e.jsx)(o,{children:r("Binding")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),x.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:G,value:w,children:x.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(O,{"data-testid":"workflows-start-button",disabled:C||w==="",onClick:a,children:r(C?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Workflow")}),(0,e.jsx)(o,{children:r("Instance id")}),(0,e.jsx)(o,{children:r("Status")}),(0,e.jsx)(o,{children:r("Output")}),(0,e.jsx)(o,{})]})}),(0,e.jsx)(L,{children:f.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(i,{children:(0,e.jsx)(O,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:I===t.id,onClick:se,size:"xs",variant:"outline",children:I===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Te");export{We as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as me}from"./chunk-F7UC63UN.js";import{a as Ot,b as zt,c as At,d as Kt}from"./chunk-SUDJTC4S.js";import{a as it}from"./chunk-CO7D5QQA.js";import{a as Dt,b as Ct,c as It,d as Ft,e as Pe}from"./chunk-IHMGCHAA.js";import{a as Tt}from"./chunk-RPQL45FL.js";import{a as Rt}from"./chunk-GGPSI4ZR.js";import"./chunk-4GTO7FL5.js";import"./chunk-4JLGLPWV.js";import{e as $t}from"./chunk-UYEZR3BI.js";import"./chunk-V3CZW3JB.js";import{a as _t}from"./chunk-BOTGXX4H.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as Ee,b as et,c as tt,d as vt,e as yt,f as rt,g as at,h as Nt,i as St}from"./chunk-O7D7DJVB.js";import"./chunk-5JDWLCSH.js";import"./chunk-EVTM6Q43.js";import{a as kt}from"./chunk-S3CRZLGS.js";import{a as Mt}from"./chunk-2DX5MROH.js";import{a as wt,b as qt}from"./chunk-OGUKYRFM.js";import"./chunk-6D6Z2KXU.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as Ze}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as We}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import"./chunk-35DM4JJG.js";import{a as ze}from"./chunk-4ZEL6BYL.js";import{c as Le}from"./chunk-D6UKRXIS.js";import{f as ct}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as ht}from"./chunk-FKVZRPV5.js";import{a as st,b as lt,c as nt,d as je,e as ce,f as U}from"./chunk-HEAQVSNS.js";import{a as fe,b as Ae,c as Ke,d as ut,e as pe}from"./chunk-WUWBZPUK.js";import{d as ge,f as gt,g as ft,h as pt,i as xt,l as Ge,o as bt}from"./chunk-FODLDLE2.js";import{a as o,d as Ye,e as Jt,f as Bt,g as Ht,i as mt}from"./chunk-YKXDMIHQ.js";var P=Ye(Jt(),1);var xe=Ye(Bt(),1);var t=Ye(Ht(),1);var Ut=/["\\\u0000-\u001F\uD800-\uDFFF]/,Lt=o(s=>Ut.test(s)?JSON.stringify(s):`"${s}"`,"ot"),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(typeof s=="number"){if(Number.isNaN(s))return"nan";if(s===1/0)return"inf";if(s===-1/0)return"-inf";if(Object.is(s,-0))return"-0"}if(typeof s=="string")return Lt(s);if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s)){let i="[";for(let n=0;n<s.length;n++)n>0&&(i+=","),i+=dt(s[n]);return i+"]"}let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let i=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${i} 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).sort(),r="{",u=!0;for(let i of a){let n=l[i];n!==void 0&&(u?u=!1:r+=",",r+=Lt(i),r+=":",r+=dt(n))}return r+"}"},"Ze"),Pt=o((s,e,l)=>`${s}:${e}:${dt(l??{})}`,"ht"),Qt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"gt"),Wt=o((s,e)=>Qt(s,e),"Jt"),Gt=o(s=>Qt(s.kind,s),"Vt"),ot=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"We"),Vt=o(s=>Array.isArray(s?.series)?s.series:[],"Gt"),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},"Xt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},Et=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,u=ge();if(r===void 0){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=c):c=e[0],c}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 c=`mt-instrument-trace-${l}`,f;return e[3]!==n||e[4]!==c||e[5]!==r?(f=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":c,title:r,children:n}),e[3]=n,e[4]=c,e[5]=r,e[6]=f):f=e[6],f}let h=`mt-instrument-trace-${l}`,y;e[7]!==a||e[8]!==r?(y=o(()=>{a(r)},"v"),e[7]=a,e[8]=r,e[9]=y):y=e[9];let w;e[10]!==u||e[11]!==r?(w=u("Open the exemplar trace {trace}",{trace:r}),e[10]=u,e[11]=r,e[12]=w):w=e[12];let g;return e[13]!==n||e[14]!==h||e[15]!==y||e[16]!==w?(g=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":h,onClick:y,title:w,type:"button",children:n}),e[13]=n,e[14]=h,e[15]=y,e[16]=w,e[17]=g):g=e[17],g},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=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:h,errorSource:y}=Le(ze.getMetricSeries,u,i),w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let g;e[4]!==a?(g={live:!0,shardKey:a},e[4]=a,e[5]=g):g=e[5];let{data:c}=Le(ze.getMetricHistory,w,g),f,N,q,_,d,x,p,b,M,$,S,I,C;if(e[6]!==n||e[7]!==h||e[8]!==y||e[9]!==c||e[10]!==l||e[11]!==r){b=Symbol.for("react.early_return_sentinel");e:{let z=Vt(n),A=xt(y)===Xt;if(h!==null&&!A){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let j;e[27]!==m?(j=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=j):j=e[28];let J;e[29]!==h||e[30]!==r?(J=r("Instruments unavailable: {error}",{error:h}),e[29]=h,e[30]=r,e[31]=J):J=e[31];let B;e[32]!==J?(B=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:J}),e[32]=J,e[33]=B):B=e[33];let de;e[34]!==j||e[35]!==B?(de=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[j,B]}),e[34]=j,e[35]=B,e[36]=de):de=e[36],b=de;break e}if(z.length===0){b=null;break e}let D=Yt(c),L;e[37]!==r?(L=o(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"z"),e[37]=r,e[38]=L):L=e[38];let Q=L;d="flex flex-col gap-2",x="mt-instruments";let K;e[39]!==r?(K=r("Instruments"),e[39]=r,e[40]=K):K=e[40],e[41]!==K?(p=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:K}),e[41]=K,e[42]=p):p=e[42],_=fe,C="overflow-hidden py-0",q=pe,I="px-0",N=st,$="mt-instruments-table";let W;e[43]!==r?(W=r("name"),e[43]=r,e[44]=W):W=e[44];let G;e[45]!==W?(G=(0,t.jsx)(ce,{children:W}),e[45]=W,e[46]=G):G=e[46];let V;e[47]!==r?(V=r("kind"),e[47]=r,e[48]=V):V=e[48];let X;e[49]!==V?(X=(0,t.jsx)(ce,{children:V}),e[49]=V,e[50]=X):X=e[50];let Y;e[51]!==r?(Y=r("value"),e[51]=r,e[52]=Y):Y=e[52];let Z;e[53]!==Y?(Z=(0,t.jsx)(ce,{className:"text-right",children:Y}),e[53]=Y,e[54]=Z):Z=e[54];let E;e[55]!==r?(E=r("count"),e[55]=r,e[56]=E):E=e[56];let ee;e[57]!==E?(ee=(0,t.jsx)(ce,{className:"text-right",children:E}),e[57]=E,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(ce,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(ce,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(ce,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(ce,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==G||e[76]!==X||e[77]!==Z||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(S=(0,t.jsx)(lt,{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]=S):S=e[83],f=nt,M=z.map(m=>{let j=Tt(m.attributes),J=Pt(m.kind,m.name,m.attributes),B=(D.get(J)??[]).map(de=>Wt(m.kind,de));return(0,t.jsxs)(je,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(U,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(U,{children:(0,t.jsx)(We,{variant:Zt[m.kind],children:Q(m.kind)})}),(0,t.jsx)(U,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:ot(Gt(m))}),(0,t.jsx)(U,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(U,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${ot(m.min)}\u2013${ot(m.max)}`}),(0,t.jsx)(U,{children:B.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:B,testId:`mt-instrument-trend-${m.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(U,{className:"font-mono text-xs",children:(0,t.jsx)(Et,{name:m.name,onOpenTrace:l,traceId:m.exemplarTraceId})}),(0,t.jsx)(U,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:j,children:j===""?"\u2014":j})]},J)})}e[6]=n,e[7]=h,e[8]=y,e[9]=c,e[10]=l,e[11]=r,e[12]=f,e[13]=N,e[14]=q,e[15]=_,e[16]=d,e[17]=x,e[18]=p,e[19]=b,e[20]=M,e[21]=$,e[22]=S,e[23]=I,e[24]=C}else f=e[12],N=e[13],q=e[14],_=e[15],d=e[16],x=e[17],p=e[18],b=e[19],M=e[20],$=e[21],S=e[22],I=e[23],C=e[24];if(b!==Symbol.for("react.early_return_sentinel"))return b;let F;e[84]!==f||e[85]!==M?(F=(0,t.jsx)(f,{children:M}),e[84]=f,e[85]=M,e[86]=F):F=e[86];let k;e[87]!==N||e[88]!==F||e[89]!==$||e[90]!==S?(k=(0,t.jsxs)(N,{"data-testid":$,children:[S,F]}),e[87]=N,e[88]=F,e[89]=$,e[90]=S,e[91]=k):k=e[91];let v;e[92]!==q||e[93]!==k||e[94]!==I?(v=(0,t.jsx)(q,{className:I,children:k}),e[92]=q,e[93]=k,e[94]=I,e[95]=v):v=e[95];let T;e[96]!==_||e[97]!==v||e[98]!==C?(T=(0,t.jsx)(_,{className:C,children:v}),e[96]=_,e[97]=v,e[98]=C,e[99]=T):T=e[99];let O;return e[100]!==d||e[101]!==x||e[102]!==p||e[103]!==T?(O=(0,t.jsxs)("section",{className:d,"data-testid":x,children:[p,T]}),e[100]=d,e[101]=x,e[102]=p,e[103]=T,e[104]=O):O=e[104],O},"er"),tr=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),u;e[0]!==r?(u=r("Shards"),e[0]=r,e[1]=u):u=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]!==u||e[7]!==i?(n=(0,t.jsx)(me,{label:u,testId:"mt-agg-shards",value:i}),e[6]=u,e[7]=i,e[8]=n):n=e[8];let h;e[9]!==r?(h=r("Total requests"),e[9]=r,e[10]=h):h=e[10];let y;e[11]!==l.totalRequests||e[12]!==h?(y=(0,t.jsx)(me,{label:h,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=h,e[13]=y):y=e[13];let w;e[14]!==r?(w=r("Total errors"),e[14]=r,e[15]=w):w=e[15];let g;e[16]!==l.totalErrors||e[17]!==w?(g=(0,t.jsx)(me,{label:w,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=w,e[18]=g):g=e[18];let c;e[19]!==r?(c=r("Total database size"),e[19]=r,e[20]=c):c=e[20];let f;e[21]!==l.totalDatabaseSize?(f=Ge(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=f):f=e[22];let N;e[23]!==c||e[24]!==f?(N=(0,t.jsx)(me,{label:c,testId:"mt-agg-db-size",value:f}),e[23]=c,e[24]=f,e[25]=N):N=e[25];let q;e[26]!==r?(q=r("Combined cache hit rate"),e[26]=r,e[27]=q):q=e[27];let _;e[28]!==l.hitRate||e[29]!==r?(_=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=_):_=e[30];let d;e[31]!==q||e[32]!==_?(d=(0,t.jsx)(me,{label:q,testId:"mt-agg-cache",value:_}),e[31]=q,e[32]=_,e[33]=d):d=e[33];let x;e[34]!==N||e[35]!==d||e[36]!==n||e[37]!==y||e[38]!==g?(x=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,y,g,N,d]}),e[34]=N,e[35]=d,e[36]=n,e[37]=y,e[38]=g,e[39]=x):x=e[39];let p;e[40]!==r?(p=r("shard"),e[40]=r,e[41]=p):p=e[41];let b;e[42]!==p?(b=(0,t.jsx)(ce,{children:p}),e[42]=p,e[43]=b):b=e[43];let M;e[44]!==r?(M=r("requests"),e[44]=r,e[45]=M):M=e[45];let $;e[46]!==M?($=(0,t.jsx)(ce,{children:M}),e[46]=M,e[47]=$):$=e[47];let S;e[48]!==r?(S=r("errors"),e[48]=r,e[49]=S):S=e[49];let I;e[50]!==S?(I=(0,t.jsx)(ce,{children:S}),e[50]=S,e[51]=I):I=e[51];let C;e[52]!==r?(C=r("db size"),e[52]=r,e[53]=C):C=e[53];let F;e[54]!==C?(F=(0,t.jsx)(ce,{children:C}),e[54]=C,e[55]=F):F=e[55];let k;e[56]!==b||e[57]!==$||e[58]!==I||e[59]!==F?(k=(0,t.jsx)(lt,{children:(0,t.jsxs)(je,{children:[b,$,I,F]})}),e[56]=b,e[57]=$,e[58]=I,e[59]=F,e[60]=k):k=e[60];let v;if(e[61]!==a||e[62]!==r){let A;e[64]!==r?(A=o(D=>(0,t.jsxs)(je,{"data-testid":`mt-agg-row-${D.shard}`,children:[(0,t.jsx)(U,{children:D.shard}),D.metrics===null?(0,t.jsx)(U,{className:"text-destructive",colSpan:3,children:D.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(U,{className:"tabular-nums",children:D.metrics.requests}),(0,t.jsx)(U,{className:"tabular-nums",children:D.metrics.errors}),(0,t.jsx)(U,{className:"tabular-nums",children:Ge(D.metrics.databaseSize)})]})]},D.shard),"O"),e[64]=r,e[65]=A):A=e[65],v=a.map(A),e[61]=a,e[62]=r,e[63]=v}else v=e[63];let T;e[66]!==v?(T=(0,t.jsx)(nt,{children:v}),e[66]=v,e[67]=T):T=e[67];let O;e[68]!==k||e[69]!==T?(O=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(st,{"data-testid":"mt-agg-table",children:[k,T]})})}),e[68]=k,e[69]=T,e[70]=O):O=e[70];let z;return e[71]!==x||e[72]!==O?(z=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[x,O]}),e[71]=x,e[72]=O,e[73]=z):z=e[73],z},"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)}%`},"sr"),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:u,metrics:i}=s,n=ge(),{cache:h}=i,y;e[0]!==r||e[1]!==n?(y=r.length>=2?(0,t.jsx)(it,{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]=y):y=e[2];let w;e[3]!==l||e[4]!==r.length||e[5]!==n?(w=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]=w):w=e[6];let g;e[7]!==n?(g=n("Requests"),e[7]=n,e[8]=g):g=e[8];let c;e[9]!==i.requests||e[10]!==y||e[11]!==w||e[12]!==g?(c=(0,t.jsx)(me,{chart:y,footer:w,label:g,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=y,e[11]=w,e[12]=g,e[13]=c):c=e[13];let f;e[14]!==a||e[15]!==n?(f=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=f):f=e[16];let N;e[17]!==n?(N=n("Errors"),e[17]=n,e[18]=N):N=e[18];let q;e[19]!==a||e[20]!==i.errors?(q=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=q):q=e[21];let _;e[22]!==f||e[23]!==N||e[24]!==q?(_=(0,t.jsx)(me,{footer:f,label:N,testId:"mt-errors",value:q}),e[22]=f,e[23]=N,e[24]=q,e[25]=_):_=e[25];let d;e[26]!==u.p90?(d=u.p90>0?`P90 ${jt(u.p90)}`:void 0,e[26]=u.p90,e[27]=d):d=e[27];let x;e[28]!==n?(x=n("P95 latency"),e[28]=n,e[29]=x):x=e[29];let p;e[30]!==u.p95?(p=u.p95>0?jt(u.p95):"\u2014",e[30]=u.p95,e[31]=p):p=e[31];let b;e[32]!==x||e[33]!==p||e[34]!==d?(b=(0,t.jsx)(me,{footer:d,label:x,testId:"mt-p95",value:p}),e[32]=x,e[33]=p,e[34]=d,e[35]=b):b=e[35];let M;e[36]!==h||e[37]!==n?(M=h?`${h.entries.toLocaleString()} ${n("cache entries")}`:void 0,e[36]=h,e[37]=n,e[38]=M):M=e[38];let $;e[39]!==n?($=n("Database size"),e[39]=n,e[40]=$):$=e[40];let S;e[41]!==i.databaseSize?(S=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=S):S=e[42];let I;e[43]!==M||e[44]!==$||e[45]!==S?(I=(0,t.jsx)(me,{footer:M,label:$,testId:"mt-db-size",value:S}),e[43]=M,e[44]=$,e[45]=S,e[46]=I):I=e[46];let C;e[47]!==n?(C=n("Shard"),e[47]=n,e[48]=C):C=e[48];let F;e[49]!==i.shard||e[50]!==C?(F=(0,t.jsx)(me,{label:C,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=C,e[51]=F):F=e[51];let k;e[52]!==n?(k=n("Uptime"),e[52]=n,e[53]=k):k=e[53];let v;e[54]!==i.uptimeMs?(v=rr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=v):v=e[55];let T;e[56]!==k||e[57]!==v?(T=(0,t.jsx)(me,{label:k,testId:"mt-uptime",value:v}),e[56]=k,e[57]=v,e[58]=T):T=e[58];let O;e[59]!==n?(O=n("Cache hit rate"),e[59]=n,e[60]=O):O=e[60];let z;e[61]!==h||e[62]!==n?(z=h?n("{rate} ({count} entries)",{count:h.entries,rate:ar(h.hits,h.misses)}):n("no cache configured"),e[61]=h,e[62]=n,e[63]=z):z=e[63];let A;e[64]!==O||e[65]!==z?(A=(0,t.jsx)(me,{label:O,testId:"mt-cache",value:z}),e[64]=O,e[65]=z,e[66]=A):A=e[66];let D;return e[67]!==b||e[68]!==I||e[69]!==F||e[70]!==T||e[71]!==A||e[72]!==c||e[73]!==_?(D=(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:[c,_,b,I,F,T,A]}),e[67]=b,e[68]=I,e[69]=F,e[70]=T,e[71]=A,e[72]=c,e[73]=_,e[74]=D):D=e[74],D},"lr"),Xe=o(s=>s>=100?"critical":s>=50?"warning":"good","Ve"),Qe=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Ae"),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(),"He"),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)(We,{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},"ir"),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},"ar"),ir=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,u]=(0,P.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,h]=(0,P.useState)(i),y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=o(C=>{C!==null&&u(C)},"v"),e[1]=y):y=e[1];let w=y,g,c,f,N,q,_,d,x,p,b;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){f=Symbol.for("react.early_return_sentinel");e:{let C=nr(l,r),F;e[16]!==l?(F=l.filter(or),e[16]=l,e[17]=F):F=e[17];let k=F.length,v;e[18]!==l?(v=l.filter(dr),e[18]=l,e[19]=v):v=e[19];let T=v.length,O;e[20]!==l?(O=l.filter(cr),e[20]=l,e[21]=O):O=e[21];let z=O.length,A;e[22]===Symbol.for("react.memo_cache_sentinel")?(A=o(R=>{h(ue=>{let H=new Set(ue);return H.has(R)?H.delete(R):H.add(R),H})},"O"),e[22]=A):A=e[22];let D=A;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 H;e[27]!==a?(H=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=H):H=e[28];let he;e[29]!==H?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:H}),e[29]=H,e[30]=he):he=e[30];let Ue;e[31]!==ue||e[32]!==he?(Ue=(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]=Ue):Ue=e[33],f=Ue;break e}d="space-y-4",x="qi-root";let L;e[34]!==a?(L=a("Critical queries"),e[34]=a,e[35]=L):L=e[35];let Q;e[36]!==L?(Q=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:L})}),e[36]=L,e[37]=Q):Q=e[37];let K;e[38]!==k?(K=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:k}),e[38]=k,e[39]=K):K=e[39];let W;e[40]!==a?(W=a(">100ms avg execution"),e[40]=a,e[41]=W):W=e[41];let G;e[42]!==W?(G=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:W}),e[42]=W,e[43]=G):G=e[43];let V;e[44]!==K||e[45]!==G?(V=(0,t.jsxs)(pe,{children:[K,G]}),e[44]=K,e[45]=G,e[46]=V):V=e[46];let X;e[47]!==Q||e[48]!==V?(X=(0,t.jsxs)(fe,{children:[Q,V]}),e[47]=Q,e[48]=V,e[49]=X):X=e[49];let Y;e[50]!==a?(Y=a("Moderate queries"),e[50]=a,e[51]=Y):Y=e[51];let Z;e[52]!==Y?(Z=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:Y})}),e[52]=Y,e[53]=Z):Z=e[53];let E;e[54]!==T?(E=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:T}),e[54]=T,e[55]=E):E=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]!==E||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[E,te]}),e[60]=E,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Z||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Z,re]}),e[63]=Z,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==z?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:z}),e[70]=z,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let j;e[79]!==le||e[80]!==m?(j=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=j):j=e[81],e[82]!==X||e[83]!==ae||e[84]!==j?(p=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[X,ae,j]}),e[82]=X,e[83]=ae,e[84]=j,e[85]=p):p=e[85];let J;e[86]!==a?(J=a("Query leaderboard"),e[86]=a,e[87]=J):J=e[87];let B;e[88]!==J?(B=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:J}),e[88]=J,e[89]=B):B=e[89];let de;e[90]!==r||e[91]!==a?(de=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=de):de=e[92];let be;e[93]!==de?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:de}),e[93]=de,e[94]=be):be=e[94];let ve;e[95]!==B||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[B,be]}),e[95]=B,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Je;e[104]===Symbol.for("react.memo_cache_sentinel")?(Je=(0,t.jsx)(Ct,{}),e[104]=Je):Je=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(It,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Je}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let Me;e[109]!==qe?(Me=(0,t.jsx)(Pe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=Me):Me=e[110];let ke;e[111]!==a?(ke=a("Avg time"),e[111]=a,e[112]=ke):ke=e[112];let _e;e[113]!==ke?(_e=(0,t.jsx)(Pe,{value:"avgTime",children:ke}),e[113]=ke,e[114]=_e):_e=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 Ce;e[119]!==a?(Ce=a("Rows read"),e[119]=a,e[120]=Ce):Ce=e[120];let Ie;e[121]!==Ce?(Ie=(0,t.jsx)(Pe,{value:"rowsRead",children:Ce}),e[121]=Ce,e[122]=Ie):Ie=e[122];let Fe;e[123]!==Me||e[124]!==_e||e[125]!==De||e[126]!==Ie?(Fe=(0,t.jsxs)(Ft,{children:[Me,_e,De,Ie]}),e[123]=Me,e[124]=_e,e[125]=De,e[126]=Ie,e[127]=Fe):Fe=e[127];let Te;e[128]!==r||e[129]!==we||e[130]!==Fe?(Te=(0,t.jsxs)(Dt,{onValueChange:w,value:r,children:[we,Fe]}),e[128]=r,e[129]=we,e[130]=Fe,e[131]=Te):Te=e[131];let Re;e[132]!==Ne||e[133]!==Te?(Re=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Te]}),e[132]=Ne,e[133]=Te,e[134]=Re):Re=e[134],e[135]!==ve||e[136]!==Re?(b=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,Re]}),e[135]=ve,e[136]=Re,e[137]=b):b=e[137],c=fe;let Oe;e[138]!==a?(Oe=a("Statements"),e[138]=a,e[139]=Oe):Oe=e[139];let Be;e[140]!==Oe?(Be=(0,t.jsx)(Ke,{children:Oe}),e[140]=Oe,e[141]=Be):Be=e[141],_=(0,t.jsxs)(Ae,{children:[Be,(0,t.jsx)(ut,{children:a("{count} tracked statements",{count:C.length})})]}),g=pe,N="space-y-2";let He;e[142]!==n||e[143]!==a?(He=o(R=>{let ue=R.normalizedSql,H=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":H,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{D(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:Qe(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:Qe(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:Qe(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")})]})]})]}),H&&(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:Qe(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:Qe(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],q=C.map(He)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=g,e[7]=c,e[8]=f,e[9]=N,e[10]=q,e[11]=_,e[12]=d,e[13]=x,e[14]=p,e[15]=b}else g=e[6],c=e[7],f=e[8],N=e[9],q=e[10],_=e[11],d=e[12],x=e[13],p=e[14],b=e[15];if(f!==Symbol.for("react.early_return_sentinel"))return f;let M;e[145]!==N||e[146]!==q?(M=(0,t.jsx)("div",{className:N,children:q}),e[145]=N,e[146]=q,e[147]=M):M=e[147];let $;e[148]!==g||e[149]!==M?($=(0,t.jsx)(g,{children:M}),e[148]=g,e[149]=M,e[150]=$):$=e[150];let S;e[151]!==c||e[152]!==$||e[153]!==_?(S=(0,t.jsxs)(c,{children:[_,$]}),e[151]=c,e[152]=$,e[153]=_,e[154]=S):S=e[154];let I;return e[155]!==S||e[156]!==d||e[157]!==x||e[158]!==p||e[159]!==b?(I=(0,t.jsxs)("div",{className:d,"data-testid":x,children:[p,b,S]}),e[155]=S,e[156]=d,e[157]=x,e[158]=p,e[159]=b,e[160]=I):I=e[160],I},"nr");function or(s){return Xe(s.avgDurationMs)==="critical"}o(or,"or");function dr(s){return Xe(s.avgDurationMs)==="warning"}o(dr,"cr");function cr(s){return Xe(s.avgDurationMs)==="good"}o(cr,"dr");var mr=["1m","5m","15m","1h"],ur=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ur"),hr=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),"fr"),gr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,P.useState)("15m"),r=Le(ze.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,u=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:mt("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)(We,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),u.length===0?(0,t.jsx)(ht,{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)(Ee,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:u,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(yt,{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)(Ee,{height:140,width:"100%",children:(0,t.jsxs)(Nt,{data:u,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(vt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(ir,{queryStats:r?.entries??[]})]})},"hr"),fr=gt(ze.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),jr=o(({initialShardKey:s})=>{let e=ct(),l=ge(),{queryShardKey:a,setShardKey:r,shardKey:u}=kt(s),[i,n]=(0,P.useState)("overview"),[h,y]=(0,P.useState)([]),w=(0,P.useRef)(null),g=(0,P.useRef)(null),c=(0,P.useRef)(!0);(0,P.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let f=Rt(a),{data:N,error:q,liveError:_}=Le(ze.getMetrics,{},{live:!0,shardKey:a}),d=N??null;(0,P.useEffect)(()=>{if(N===void 0)return;qt(a);let D=N,L=w.current,Q=g.current!==null&&g.current!==D.shard;if(g.current=D.shard,w.current=D.requests,Q){y([]);return}L!==null&&D.requests>=L&&y(K=>[...K,D.requests-L].slice(-30))},[N,a]);let[x,p]=(0,P.useState)(null),[b,M]=(0,P.useState)(!1),$=o(async()=>{M(!0);let D=zt(u,wt());try{let L=await Promise.all(D.map(async Q=>{try{let K=await e.query(fr,{},ft(Q));return{error:null,metrics:K,shard:Q===""?K.shard:Q}}catch(K){return{error:pt(K),metrics:null,shard:Q===""?"__root__":Q}}}));c.current&&p(L)}finally{c.current&&M(!1)}},"R"),S=x===null?null:Ot(x),I=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,C=h.length>0?h.at(-1):0,F=d?At(d):{p90:0,p95:0},k=(0,P.useMemo)(()=>{if(!d||!("queryStats"in d))return;let D=d.queryStats;if(!(!D||!Array.isArray(D)))return Kt(D)},[d]),v=pr(k!==void 0,i),T=o(()=>{bt($())},"D"),O=o(()=>{p(null)},"F"),z=o(()=>{n("overview")},"A"),A=o(()=>{n("query-insights")},"O");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)(Mt,{onChange:r,testId:"mt-shard-input",value:u}),(0,t.jsx)(_t,{message:_,prefix:"mt"}),(0,t.jsx)(Ze,{"data-testid":"mt-aggregate",disabled:b,onClick:T,size:"sm",type:"button",variant:"secondary",children:l(b?"Aggregating\u2026":"All shards")}),x!==null&&(0,t.jsx)(Ze,{"data-testid":"mt-aggregate-clear",onClick:O,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:$t,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}),k!==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:z,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:A,type:"button",children:[l("Query insights"),k.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:k.length})]})]}),v==="query-insights"&&k!==void 0&&(0,t.jsx)(gr,{shardKey:a}),v==="overview"&&d!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:h,latencyPercentiles:F,metrics:d}),v==="overview"&&d===null&&null,v==="overview"&&(0,t.jsx)(er,{onOpenTrace:f,shardKey:a}),v==="overview"&&S!==null&&x!==null&&(0,t.jsx)(tr,{aggregate:S,shardResults:x})]})},"jr");export{jr as MetricsPanel};
|
|
1
|
+
import{a as me}from"./chunk-F7UC63UN.js";import{a as Ot,b as zt,c as At,d as Kt}from"./chunk-SUDJTC4S.js";import{a as it}from"./chunk-CBNGOAD4.js";import{a as Dt,b as Ct,c as It,d as Ft,e as Pe}from"./chunk-IHMGCHAA.js";import{a as Tt}from"./chunk-RPQL45FL.js";import{a as Rt}from"./chunk-GGPSI4ZR.js";import"./chunk-4GTO7FL5.js";import"./chunk-4JLGLPWV.js";import{e as $t}from"./chunk-UYEZR3BI.js";import"./chunk-V3CZW3JB.js";import{a as _t}from"./chunk-BOTGXX4H.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import{a as Ee,b as et,c as tt,d as vt,e as yt,f as rt,g as at,h as Nt,i as St}from"./chunk-URBHAYYZ.js";import"./chunk-5JDWLCSH.js";import"./chunk-EVTM6Q43.js";import{a as kt}from"./chunk-S3CRZLGS.js";import{a as Mt}from"./chunk-2DX5MROH.js";import{a as wt,b as qt}from"./chunk-OGUKYRFM.js";import"./chunk-6D6Z2KXU.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as Ze}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as We}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import"./chunk-35DM4JJG.js";import{a as ze}from"./chunk-4ZEL6BYL.js";import{c as Le}from"./chunk-MBP4SZYB.js";import{f as ct}from"./chunk-Z7WCKAUJ.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as ht}from"./chunk-FKVZRPV5.js";import{a as st,b as lt,c as nt,d as je,e as ce,f as U}from"./chunk-HEAQVSNS.js";import{a as fe,b as Ae,c as Ke,d as ut,e as pe}from"./chunk-WUWBZPUK.js";import{d as ge,f as gt,g as ft,h as pt,i as xt,l as Ge,o as bt}from"./chunk-FODLDLE2.js";import{a as o,d as Ye,e as Jt,f as Bt,g as Ht,i as mt}from"./chunk-YKXDMIHQ.js";var P=Ye(Jt(),1);var xe=Ye(Bt(),1);var t=Ye(Ht(),1);var Ut=/["\\\u0000-\u001F\uD800-\uDFFF]/,Lt=o(s=>Ut.test(s)?JSON.stringify(s):`"${s}"`,"ot"),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(typeof s=="number"){if(Number.isNaN(s))return"nan";if(s===1/0)return"inf";if(s===-1/0)return"-inf";if(Object.is(s,-0))return"-0"}if(typeof s=="string")return Lt(s);if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s)){let i="[";for(let n=0;n<s.length;n++)n>0&&(i+=","),i+=dt(s[n]);return i+"]"}let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let i=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${i} 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).sort(),r="{",u=!0;for(let i of a){let n=l[i];n!==void 0&&(u?u=!1:r+=",",r+=Lt(i),r+=":",r+=dt(n))}return r+"}"},"Ze"),Pt=o((s,e,l)=>`${s}:${e}:${dt(l??{})}`,"ht"),Qt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"gt"),Wt=o((s,e)=>Qt(s,e),"Jt"),Gt=o(s=>Qt(s.kind,s),"Vt"),ot=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"We"),Vt=o(s=>Array.isArray(s?.series)?s.series:[],"Gt"),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},"Xt"),Zt={counter:"secondary",gauge:"default",histogram:"outline"},Et=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,u=ge();if(r===void 0){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=c):c=e[0],c}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 c=`mt-instrument-trace-${l}`,f;return e[3]!==n||e[4]!==c||e[5]!==r?(f=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":c,title:r,children:n}),e[3]=n,e[4]=c,e[5]=r,e[6]=f):f=e[6],f}let h=`mt-instrument-trace-${l}`,y;e[7]!==a||e[8]!==r?(y=o(()=>{a(r)},"v"),e[7]=a,e[8]=r,e[9]=y):y=e[9];let w;e[10]!==u||e[11]!==r?(w=u("Open the exemplar trace {trace}",{trace:r}),e[10]=u,e[11]=r,e[12]=w):w=e[12];let g;return e[13]!==n||e[14]!==h||e[15]!==y||e[16]!==w?(g=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":h,onClick:y,title:w,type:"button",children:n}),e[13]=n,e[14]=h,e[15]=y,e[16]=w,e[17]=g):g=e[17],g},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=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:h,errorSource:y}=Le(ze.getMetricSeries,u,i),w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let g;e[4]!==a?(g={live:!0,shardKey:a},e[4]=a,e[5]=g):g=e[5];let{data:c}=Le(ze.getMetricHistory,w,g),f,N,q,_,d,x,p,b,M,$,S,I,C;if(e[6]!==n||e[7]!==h||e[8]!==y||e[9]!==c||e[10]!==l||e[11]!==r){b=Symbol.for("react.early_return_sentinel");e:{let z=Vt(n),A=xt(y)===Xt;if(h!==null&&!A){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let j;e[27]!==m?(j=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=j):j=e[28];let J;e[29]!==h||e[30]!==r?(J=r("Instruments unavailable: {error}",{error:h}),e[29]=h,e[30]=r,e[31]=J):J=e[31];let B;e[32]!==J?(B=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:J}),e[32]=J,e[33]=B):B=e[33];let de;e[34]!==j||e[35]!==B?(de=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[j,B]}),e[34]=j,e[35]=B,e[36]=de):de=e[36],b=de;break e}if(z.length===0){b=null;break e}let D=Yt(c),L;e[37]!==r?(L=o(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"z"),e[37]=r,e[38]=L):L=e[38];let Q=L;d="flex flex-col gap-2",x="mt-instruments";let K;e[39]!==r?(K=r("Instruments"),e[39]=r,e[40]=K):K=e[40],e[41]!==K?(p=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:K}),e[41]=K,e[42]=p):p=e[42],_=fe,C="overflow-hidden py-0",q=pe,I="px-0",N=st,$="mt-instruments-table";let W;e[43]!==r?(W=r("name"),e[43]=r,e[44]=W):W=e[44];let G;e[45]!==W?(G=(0,t.jsx)(ce,{children:W}),e[45]=W,e[46]=G):G=e[46];let V;e[47]!==r?(V=r("kind"),e[47]=r,e[48]=V):V=e[48];let X;e[49]!==V?(X=(0,t.jsx)(ce,{children:V}),e[49]=V,e[50]=X):X=e[50];let Y;e[51]!==r?(Y=r("value"),e[51]=r,e[52]=Y):Y=e[52];let Z;e[53]!==Y?(Z=(0,t.jsx)(ce,{className:"text-right",children:Y}),e[53]=Y,e[54]=Z):Z=e[54];let E;e[55]!==r?(E=r("count"),e[55]=r,e[56]=E):E=e[56];let ee;e[57]!==E?(ee=(0,t.jsx)(ce,{className:"text-right",children:E}),e[57]=E,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(ce,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(ce,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(ce,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(ce,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==G||e[76]!==X||e[77]!==Z||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(S=(0,t.jsx)(lt,{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]=S):S=e[83],f=nt,M=z.map(m=>{let j=Tt(m.attributes),J=Pt(m.kind,m.name,m.attributes),B=(D.get(J)??[]).map(de=>Wt(m.kind,de));return(0,t.jsxs)(je,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(U,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(U,{children:(0,t.jsx)(We,{variant:Zt[m.kind],children:Q(m.kind)})}),(0,t.jsx)(U,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:ot(Gt(m))}),(0,t.jsx)(U,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(U,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${ot(m.min)}\u2013${ot(m.max)}`}),(0,t.jsx)(U,{children:B.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:B,testId:`mt-instrument-trend-${m.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(U,{className:"font-mono text-xs",children:(0,t.jsx)(Et,{name:m.name,onOpenTrace:l,traceId:m.exemplarTraceId})}),(0,t.jsx)(U,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:j,children:j===""?"\u2014":j})]},J)})}e[6]=n,e[7]=h,e[8]=y,e[9]=c,e[10]=l,e[11]=r,e[12]=f,e[13]=N,e[14]=q,e[15]=_,e[16]=d,e[17]=x,e[18]=p,e[19]=b,e[20]=M,e[21]=$,e[22]=S,e[23]=I,e[24]=C}else f=e[12],N=e[13],q=e[14],_=e[15],d=e[16],x=e[17],p=e[18],b=e[19],M=e[20],$=e[21],S=e[22],I=e[23],C=e[24];if(b!==Symbol.for("react.early_return_sentinel"))return b;let F;e[84]!==f||e[85]!==M?(F=(0,t.jsx)(f,{children:M}),e[84]=f,e[85]=M,e[86]=F):F=e[86];let k;e[87]!==N||e[88]!==F||e[89]!==$||e[90]!==S?(k=(0,t.jsxs)(N,{"data-testid":$,children:[S,F]}),e[87]=N,e[88]=F,e[89]=$,e[90]=S,e[91]=k):k=e[91];let v;e[92]!==q||e[93]!==k||e[94]!==I?(v=(0,t.jsx)(q,{className:I,children:k}),e[92]=q,e[93]=k,e[94]=I,e[95]=v):v=e[95];let T;e[96]!==_||e[97]!==v||e[98]!==C?(T=(0,t.jsx)(_,{className:C,children:v}),e[96]=_,e[97]=v,e[98]=C,e[99]=T):T=e[99];let O;return e[100]!==d||e[101]!==x||e[102]!==p||e[103]!==T?(O=(0,t.jsxs)("section",{className:d,"data-testid":x,children:[p,T]}),e[100]=d,e[101]=x,e[102]=p,e[103]=T,e[104]=O):O=e[104],O},"er"),tr=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),u;e[0]!==r?(u=r("Shards"),e[0]=r,e[1]=u):u=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]!==u||e[7]!==i?(n=(0,t.jsx)(me,{label:u,testId:"mt-agg-shards",value:i}),e[6]=u,e[7]=i,e[8]=n):n=e[8];let h;e[9]!==r?(h=r("Total requests"),e[9]=r,e[10]=h):h=e[10];let y;e[11]!==l.totalRequests||e[12]!==h?(y=(0,t.jsx)(me,{label:h,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=h,e[13]=y):y=e[13];let w;e[14]!==r?(w=r("Total errors"),e[14]=r,e[15]=w):w=e[15];let g;e[16]!==l.totalErrors||e[17]!==w?(g=(0,t.jsx)(me,{label:w,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=w,e[18]=g):g=e[18];let c;e[19]!==r?(c=r("Total database size"),e[19]=r,e[20]=c):c=e[20];let f;e[21]!==l.totalDatabaseSize?(f=Ge(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=f):f=e[22];let N;e[23]!==c||e[24]!==f?(N=(0,t.jsx)(me,{label:c,testId:"mt-agg-db-size",value:f}),e[23]=c,e[24]=f,e[25]=N):N=e[25];let q;e[26]!==r?(q=r("Combined cache hit rate"),e[26]=r,e[27]=q):q=e[27];let _;e[28]!==l.hitRate||e[29]!==r?(_=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=_):_=e[30];let d;e[31]!==q||e[32]!==_?(d=(0,t.jsx)(me,{label:q,testId:"mt-agg-cache",value:_}),e[31]=q,e[32]=_,e[33]=d):d=e[33];let x;e[34]!==N||e[35]!==d||e[36]!==n||e[37]!==y||e[38]!==g?(x=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,y,g,N,d]}),e[34]=N,e[35]=d,e[36]=n,e[37]=y,e[38]=g,e[39]=x):x=e[39];let p;e[40]!==r?(p=r("shard"),e[40]=r,e[41]=p):p=e[41];let b;e[42]!==p?(b=(0,t.jsx)(ce,{children:p}),e[42]=p,e[43]=b):b=e[43];let M;e[44]!==r?(M=r("requests"),e[44]=r,e[45]=M):M=e[45];let $;e[46]!==M?($=(0,t.jsx)(ce,{children:M}),e[46]=M,e[47]=$):$=e[47];let S;e[48]!==r?(S=r("errors"),e[48]=r,e[49]=S):S=e[49];let I;e[50]!==S?(I=(0,t.jsx)(ce,{children:S}),e[50]=S,e[51]=I):I=e[51];let C;e[52]!==r?(C=r("db size"),e[52]=r,e[53]=C):C=e[53];let F;e[54]!==C?(F=(0,t.jsx)(ce,{children:C}),e[54]=C,e[55]=F):F=e[55];let k;e[56]!==b||e[57]!==$||e[58]!==I||e[59]!==F?(k=(0,t.jsx)(lt,{children:(0,t.jsxs)(je,{children:[b,$,I,F]})}),e[56]=b,e[57]=$,e[58]=I,e[59]=F,e[60]=k):k=e[60];let v;if(e[61]!==a||e[62]!==r){let A;e[64]!==r?(A=o(D=>(0,t.jsxs)(je,{"data-testid":`mt-agg-row-${D.shard}`,children:[(0,t.jsx)(U,{children:D.shard}),D.metrics===null?(0,t.jsx)(U,{className:"text-destructive",colSpan:3,children:D.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(U,{className:"tabular-nums",children:D.metrics.requests}),(0,t.jsx)(U,{className:"tabular-nums",children:D.metrics.errors}),(0,t.jsx)(U,{className:"tabular-nums",children:Ge(D.metrics.databaseSize)})]})]},D.shard),"O"),e[64]=r,e[65]=A):A=e[65],v=a.map(A),e[61]=a,e[62]=r,e[63]=v}else v=e[63];let T;e[66]!==v?(T=(0,t.jsx)(nt,{children:v}),e[66]=v,e[67]=T):T=e[67];let O;e[68]!==k||e[69]!==T?(O=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(st,{"data-testid":"mt-agg-table",children:[k,T]})})}),e[68]=k,e[69]=T,e[70]=O):O=e[70];let z;return e[71]!==x||e[72]!==O?(z=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[x,O]}),e[71]=x,e[72]=O,e[73]=z):z=e[73],z},"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)}%`},"sr"),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:u,metrics:i}=s,n=ge(),{cache:h}=i,y;e[0]!==r||e[1]!==n?(y=r.length>=2?(0,t.jsx)(it,{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]=y):y=e[2];let w;e[3]!==l||e[4]!==r.length||e[5]!==n?(w=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]=w):w=e[6];let g;e[7]!==n?(g=n("Requests"),e[7]=n,e[8]=g):g=e[8];let c;e[9]!==i.requests||e[10]!==y||e[11]!==w||e[12]!==g?(c=(0,t.jsx)(me,{chart:y,footer:w,label:g,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=y,e[11]=w,e[12]=g,e[13]=c):c=e[13];let f;e[14]!==a||e[15]!==n?(f=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=f):f=e[16];let N;e[17]!==n?(N=n("Errors"),e[17]=n,e[18]=N):N=e[18];let q;e[19]!==a||e[20]!==i.errors?(q=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=q):q=e[21];let _;e[22]!==f||e[23]!==N||e[24]!==q?(_=(0,t.jsx)(me,{footer:f,label:N,testId:"mt-errors",value:q}),e[22]=f,e[23]=N,e[24]=q,e[25]=_):_=e[25];let d;e[26]!==u.p90?(d=u.p90>0?`P90 ${jt(u.p90)}`:void 0,e[26]=u.p90,e[27]=d):d=e[27];let x;e[28]!==n?(x=n("P95 latency"),e[28]=n,e[29]=x):x=e[29];let p;e[30]!==u.p95?(p=u.p95>0?jt(u.p95):"\u2014",e[30]=u.p95,e[31]=p):p=e[31];let b;e[32]!==x||e[33]!==p||e[34]!==d?(b=(0,t.jsx)(me,{footer:d,label:x,testId:"mt-p95",value:p}),e[32]=x,e[33]=p,e[34]=d,e[35]=b):b=e[35];let M;e[36]!==h||e[37]!==n?(M=h?`${h.entries.toLocaleString()} ${n("cache entries")}`:void 0,e[36]=h,e[37]=n,e[38]=M):M=e[38];let $;e[39]!==n?($=n("Database size"),e[39]=n,e[40]=$):$=e[40];let S;e[41]!==i.databaseSize?(S=Ge(i.databaseSize),e[41]=i.databaseSize,e[42]=S):S=e[42];let I;e[43]!==M||e[44]!==$||e[45]!==S?(I=(0,t.jsx)(me,{footer:M,label:$,testId:"mt-db-size",value:S}),e[43]=M,e[44]=$,e[45]=S,e[46]=I):I=e[46];let C;e[47]!==n?(C=n("Shard"),e[47]=n,e[48]=C):C=e[48];let F;e[49]!==i.shard||e[50]!==C?(F=(0,t.jsx)(me,{label:C,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=C,e[51]=F):F=e[51];let k;e[52]!==n?(k=n("Uptime"),e[52]=n,e[53]=k):k=e[53];let v;e[54]!==i.uptimeMs?(v=rr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=v):v=e[55];let T;e[56]!==k||e[57]!==v?(T=(0,t.jsx)(me,{label:k,testId:"mt-uptime",value:v}),e[56]=k,e[57]=v,e[58]=T):T=e[58];let O;e[59]!==n?(O=n("Cache hit rate"),e[59]=n,e[60]=O):O=e[60];let z;e[61]!==h||e[62]!==n?(z=h?n("{rate} ({count} entries)",{count:h.entries,rate:ar(h.hits,h.misses)}):n("no cache configured"),e[61]=h,e[62]=n,e[63]=z):z=e[63];let A;e[64]!==O||e[65]!==z?(A=(0,t.jsx)(me,{label:O,testId:"mt-cache",value:z}),e[64]=O,e[65]=z,e[66]=A):A=e[66];let D;return e[67]!==b||e[68]!==I||e[69]!==F||e[70]!==T||e[71]!==A||e[72]!==c||e[73]!==_?(D=(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:[c,_,b,I,F,T,A]}),e[67]=b,e[68]=I,e[69]=F,e[70]=T,e[71]=A,e[72]=c,e[73]=_,e[74]=D):D=e[74],D},"lr"),Xe=o(s=>s>=100?"critical":s>=50?"warning":"good","Ve"),Qe=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Ae"),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(),"He"),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)(We,{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},"ir"),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},"ar"),ir=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,u]=(0,P.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,h]=(0,P.useState)(i),y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=o(C=>{C!==null&&u(C)},"v"),e[1]=y):y=e[1];let w=y,g,c,f,N,q,_,d,x,p,b;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){f=Symbol.for("react.early_return_sentinel");e:{let C=nr(l,r),F;e[16]!==l?(F=l.filter(or),e[16]=l,e[17]=F):F=e[17];let k=F.length,v;e[18]!==l?(v=l.filter(dr),e[18]=l,e[19]=v):v=e[19];let T=v.length,O;e[20]!==l?(O=l.filter(cr),e[20]=l,e[21]=O):O=e[21];let z=O.length,A;e[22]===Symbol.for("react.memo_cache_sentinel")?(A=o(R=>{h(ue=>{let H=new Set(ue);return H.has(R)?H.delete(R):H.add(R),H})},"O"),e[22]=A):A=e[22];let D=A;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 H;e[27]!==a?(H=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=H):H=e[28];let he;e[29]!==H?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:H}),e[29]=H,e[30]=he):he=e[30];let Ue;e[31]!==ue||e[32]!==he?(Ue=(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]=Ue):Ue=e[33],f=Ue;break e}d="space-y-4",x="qi-root";let L;e[34]!==a?(L=a("Critical queries"),e[34]=a,e[35]=L):L=e[35];let Q;e[36]!==L?(Q=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:L})}),e[36]=L,e[37]=Q):Q=e[37];let K;e[38]!==k?(K=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:k}),e[38]=k,e[39]=K):K=e[39];let W;e[40]!==a?(W=a(">100ms avg execution"),e[40]=a,e[41]=W):W=e[41];let G;e[42]!==W?(G=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:W}),e[42]=W,e[43]=G):G=e[43];let V;e[44]!==K||e[45]!==G?(V=(0,t.jsxs)(pe,{children:[K,G]}),e[44]=K,e[45]=G,e[46]=V):V=e[46];let X;e[47]!==Q||e[48]!==V?(X=(0,t.jsxs)(fe,{children:[Q,V]}),e[47]=Q,e[48]=V,e[49]=X):X=e[49];let Y;e[50]!==a?(Y=a("Moderate queries"),e[50]=a,e[51]=Y):Y=e[51];let Z;e[52]!==Y?(Z=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:Y})}),e[52]=Y,e[53]=Z):Z=e[53];let E;e[54]!==T?(E=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:T}),e[54]=T,e[55]=E):E=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]!==E||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[E,te]}),e[60]=E,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Z||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Z,re]}),e[63]=Z,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==z?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:z}),e[70]=z,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let j;e[79]!==le||e[80]!==m?(j=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=j):j=e[81],e[82]!==X||e[83]!==ae||e[84]!==j?(p=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[X,ae,j]}),e[82]=X,e[83]=ae,e[84]=j,e[85]=p):p=e[85];let J;e[86]!==a?(J=a("Query leaderboard"),e[86]=a,e[87]=J):J=e[87];let B;e[88]!==J?(B=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:J}),e[88]=J,e[89]=B):B=e[89];let de;e[90]!==r||e[91]!==a?(de=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=de):de=e[92];let be;e[93]!==de?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:de}),e[93]=de,e[94]=be):be=e[94];let ve;e[95]!==B||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[B,be]}),e[95]=B,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Je;e[104]===Symbol.for("react.memo_cache_sentinel")?(Je=(0,t.jsx)(Ct,{}),e[104]=Je):Je=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(It,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Je}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let Me;e[109]!==qe?(Me=(0,t.jsx)(Pe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=Me):Me=e[110];let ke;e[111]!==a?(ke=a("Avg time"),e[111]=a,e[112]=ke):ke=e[112];let _e;e[113]!==ke?(_e=(0,t.jsx)(Pe,{value:"avgTime",children:ke}),e[113]=ke,e[114]=_e):_e=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 Ce;e[119]!==a?(Ce=a("Rows read"),e[119]=a,e[120]=Ce):Ce=e[120];let Ie;e[121]!==Ce?(Ie=(0,t.jsx)(Pe,{value:"rowsRead",children:Ce}),e[121]=Ce,e[122]=Ie):Ie=e[122];let Fe;e[123]!==Me||e[124]!==_e||e[125]!==De||e[126]!==Ie?(Fe=(0,t.jsxs)(Ft,{children:[Me,_e,De,Ie]}),e[123]=Me,e[124]=_e,e[125]=De,e[126]=Ie,e[127]=Fe):Fe=e[127];let Te;e[128]!==r||e[129]!==we||e[130]!==Fe?(Te=(0,t.jsxs)(Dt,{onValueChange:w,value:r,children:[we,Fe]}),e[128]=r,e[129]=we,e[130]=Fe,e[131]=Te):Te=e[131];let Re;e[132]!==Ne||e[133]!==Te?(Re=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Te]}),e[132]=Ne,e[133]=Te,e[134]=Re):Re=e[134],e[135]!==ve||e[136]!==Re?(b=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,Re]}),e[135]=ve,e[136]=Re,e[137]=b):b=e[137],c=fe;let Oe;e[138]!==a?(Oe=a("Statements"),e[138]=a,e[139]=Oe):Oe=e[139];let Be;e[140]!==Oe?(Be=(0,t.jsx)(Ke,{children:Oe}),e[140]=Oe,e[141]=Be):Be=e[141],_=(0,t.jsxs)(Ae,{children:[Be,(0,t.jsx)(ut,{children:a("{count} tracked statements",{count:C.length})})]}),g=pe,N="space-y-2";let He;e[142]!==n||e[143]!==a?(He=o(R=>{let ue=R.normalizedSql,H=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":H,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{D(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:Qe(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:Qe(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:Qe(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")})]})]})]}),H&&(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:Qe(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:Qe(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],q=C.map(He)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=g,e[7]=c,e[8]=f,e[9]=N,e[10]=q,e[11]=_,e[12]=d,e[13]=x,e[14]=p,e[15]=b}else g=e[6],c=e[7],f=e[8],N=e[9],q=e[10],_=e[11],d=e[12],x=e[13],p=e[14],b=e[15];if(f!==Symbol.for("react.early_return_sentinel"))return f;let M;e[145]!==N||e[146]!==q?(M=(0,t.jsx)("div",{className:N,children:q}),e[145]=N,e[146]=q,e[147]=M):M=e[147];let $;e[148]!==g||e[149]!==M?($=(0,t.jsx)(g,{children:M}),e[148]=g,e[149]=M,e[150]=$):$=e[150];let S;e[151]!==c||e[152]!==$||e[153]!==_?(S=(0,t.jsxs)(c,{children:[_,$]}),e[151]=c,e[152]=$,e[153]=_,e[154]=S):S=e[154];let I;return e[155]!==S||e[156]!==d||e[157]!==x||e[158]!==p||e[159]!==b?(I=(0,t.jsxs)("div",{className:d,"data-testid":x,children:[p,b,S]}),e[155]=S,e[156]=d,e[157]=x,e[158]=p,e[159]=b,e[160]=I):I=e[160],I},"nr");function or(s){return Xe(s.avgDurationMs)==="critical"}o(or,"or");function dr(s){return Xe(s.avgDurationMs)==="warning"}o(dr,"cr");function cr(s){return Xe(s.avgDurationMs)==="good"}o(cr,"dr");var mr=["1m","5m","15m","1h"],ur=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ur"),hr=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),"fr"),gr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,P.useState)("15m"),r=Le(ze.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,u=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:mt("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)(We,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),u.length===0?(0,t.jsx)(ht,{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)(Ee,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:u,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(yt,{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)(Ee,{height:140,width:"100%",children:(0,t.jsxs)(Nt,{data:u,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(vt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(ir,{queryStats:r?.entries??[]})]})},"hr"),fr=gt(ze.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),jr=o(({initialShardKey:s})=>{let e=ct(),l=ge(),{queryShardKey:a,setShardKey:r,shardKey:u}=kt(s),[i,n]=(0,P.useState)("overview"),[h,y]=(0,P.useState)([]),w=(0,P.useRef)(null),g=(0,P.useRef)(null),c=(0,P.useRef)(!0);(0,P.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let f=Rt(a),{data:N,error:q,liveError:_}=Le(ze.getMetrics,{},{live:!0,shardKey:a}),d=N??null;(0,P.useEffect)(()=>{if(N===void 0)return;qt(a);let D=N,L=w.current,Q=g.current!==null&&g.current!==D.shard;if(g.current=D.shard,w.current=D.requests,Q){y([]);return}L!==null&&D.requests>=L&&y(K=>[...K,D.requests-L].slice(-30))},[N,a]);let[x,p]=(0,P.useState)(null),[b,M]=(0,P.useState)(!1),$=o(async()=>{M(!0);let D=zt(u,wt());try{let L=await Promise.all(D.map(async Q=>{try{let K=await e.query(fr,{},ft(Q));return{error:null,metrics:K,shard:Q===""?K.shard:Q}}catch(K){return{error:pt(K),metrics:null,shard:Q===""?"__root__":Q}}}));c.current&&p(L)}finally{c.current&&M(!1)}},"R"),S=x===null?null:Ot(x),I=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,C=h.length>0?h.at(-1):0,F=d?At(d):{p90:0,p95:0},k=(0,P.useMemo)(()=>{if(!d||!("queryStats"in d))return;let D=d.queryStats;if(!(!D||!Array.isArray(D)))return Kt(D)},[d]),v=pr(k!==void 0,i),T=o(()=>{bt($())},"D"),O=o(()=>{p(null)},"F"),z=o(()=>{n("overview")},"A"),A=o(()=>{n("query-insights")},"O");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)(Mt,{onChange:r,testId:"mt-shard-input",value:u}),(0,t.jsx)(_t,{message:_,prefix:"mt"}),(0,t.jsx)(Ze,{"data-testid":"mt-aggregate",disabled:b,onClick:T,size:"sm",type:"button",variant:"secondary",children:l(b?"Aggregating\u2026":"All shards")}),x!==null&&(0,t.jsx)(Ze,{"data-testid":"mt-aggregate-clear",onClick:O,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:$t,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}),k!==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:z,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:A,type:"button",children:[l("Query insights"),k.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:k.length})]})]}),v==="query-insights"&&k!==void 0&&(0,t.jsx)(gr,{shardKey:a}),v==="overview"&&d!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:h,latencyPercentiles:F,metrics:d}),v==="overview"&&d===null&&null,v==="overview"&&(0,t.jsx)(er,{onOpenTrace:f,shardKey:a}),v==="overview"&&S!==null&&x!==null&&(0,t.jsx)(tr,{aggregate:S,shardResults:x})]})},"jr");export{jr as MetricsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c}from"./chunk-
|
|
1
|
+
import{b as c}from"./chunk-MBP4SZYB.js";import{f as l}from"./chunk-Z7WCKAUJ.js";import{a as r,d as f,f as g}from"./chunk-YKXDMIHQ.js";var m=f(g(),1);var p={capabilities:{accounts:!0,admin:!0,inviteOnly:!1,organization:!1,passkey:!1,twoFactor:!1},emailAndPassword:!1,organization:{enabled:!1,roles:!1,teams:!1},plugins:[],rateLimit:{enabled:!1},session:{},socialProviders:[],userFields:[]},h=r(()=>{let a=(0,m.c)(6),s=l(),o;a[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-auth-config"],a[0]=o):o=a[0];let e;a[1]!==s?(e=r(()=>s.getAuthConfig(),"t"),a[1]=s,a[2]=e):e=a[2];let{data:u,isLoading:d}=c(o,e),t=u??p,n=!d,i;return a[3]!==t||a[4]!==n?(i={config:t,ready:n},a[3]=t,a[4]=n,a[5]=i):i=a[5],i},"b");export{p as a,h as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"./chunk-BOTGXX4H.js";import{b as C}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import"./chunk-35DM4JJG.js";import{a as L}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-BOTGXX4H.js";import{b as C}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import"./chunk-35DM4JJG.js";import{a as L}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-MBP4SZYB.js";import"./chunk-Z7WCKAUJ.js";import"./chunk-FSRSK4LY.js";import"./chunk-2Y6PXGIS.js";import{a as I}from"./chunk-FKVZRPV5.js";import{a as T,b as k,c as A,d as g,e as c,f as l}from"./chunk-HEAQVSNS.js";import{a as b,e as S}from"./chunk-WUWBZPUK.js";import{d as w}from"./chunk-FODLDLE2.js";import{a as f,d as y,f as _,g as j}from"./chunk-YKXDMIHQ.js";var O=y(_(),1);var t=y(j(),1);var E="container:",M={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=f(e=>{let n=e.indexOf(":");if(n===-1)return{event:e.trim()};let r=e.slice(n+1).trim(),a=e.slice(0,n).trim();return r===""?{event:a}:{detail:r,event:a}},"B"),P=f(e=>{let n=new Map;for(let r of e){let a=r.functionPath??"";if(!a.startsWith(E))continue;let i=a.slice(E.length);if(i==="")continue;let s=JSON.stringify([i,r.instance??""]),o=n.get(s);if(o!==void 0&&o.timestamp>=r.timestamp)continue;let{detail:p,event:d}=B(r.message);n.set(s,{detail:p,event:d,exitCode:r.exitCode,instance:r.instance,level:r.level,name:i,state:M[d]??"unknown",timestamp:r.timestamp})}return[...n.values()].toSorted((r,a)=>r.name.localeCompare(a.name)||(r.instance??"").localeCompare(a.instance??""))},"D"),W={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},q=f(e=>{let{entries:n}=e??{};return Array.isArray(n)?n:[]},"P"),V=f(()=>{let e=(0,O.c)(19),n=w(),r,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},a={live:!0,shardKey:""},e[0]=r,e[1]=a):(r=e[0],a=e[1]);let{data:i,error:s,liveError:o}=$(L.getLogs,r,a),p=i!==void 0,d;if(e[2]!==i||e[3]!==s||e[4]!==o||e[5]!==p||e[6]!==n){let N=P(q(i)),x;e[8]!==s?(x=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:s}),e[8]=s,e[9]=x):x=e[9];let m;e[10]!==n?(m=n("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance \u2014 ports and health checks aren't carried in that stream."),e[10]=n,e[11]=m):m=e[11];let u;e[12]!==m?(u=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=u):u=e[13];let h;e[14]!==o?(h=(0,t.jsx)(D,{message:o,prefix:"containers"}),e[14]=o,e[15]=h):h=e[15];let v;e[16]!==u||e[17]!==h?(v=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,h]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],d=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,p&&N.length===0?(0,t.jsx)(I,{description:n("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:n("No container activity")}):(0,t.jsx)(b,{className:"overflow-hidden py-0",children:(0,t.jsx)(S,{className:"px-0",children:(0,t.jsxs)(T,{"data-testid":"containers-table",children:[(0,t.jsx)(k,{children:(0,t.jsxs)(g,{children:[(0,t.jsx)(c,{children:n("Container")}),(0,t.jsx)(c,{children:n("Instance")}),(0,t.jsx)(c,{children:n("State")}),(0,t.jsx)(c,{children:n("Last event")}),(0,t.jsx)(c,{children:n("Detail")}),(0,t.jsx)(c,{children:n("Exit")}),(0,t.jsx)(c,{children:n("When")})]})}),(0,t.jsx)(A,{children:N.map(F)})]})})})]}),e[2]=i,e[3]=s,e[4]=o,e[5]=p,e[6]=n,e[7]=d}else d=e[7];return d},"q");function F(e){return(0,t.jsxs)(g,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[(0,t.jsx)(l,{className:"font-mono text-xs",children:e.name}),(0,t.jsx)(l,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"\u2014"}),(0,t.jsx)(l,{children:(0,t.jsx)(C,{variant:W[e.state],children:e.state})}),(0,t.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:e.event}),(0,t.jsx)(l,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"\u2014"}),(0,t.jsx)(l,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"\u2014"}),(0,t.jsx)(l,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}f(F,"j");export{V as default};
|