@lunora/studio 1.0.0-alpha.134 → 1.0.0-alpha.136
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-EVQ6LHI6.js → chunk-2I2F6IEF.js} +1 -1
- package/dist/standalone/{chunk-GSQURGCT.js → chunk-2KR32476.js} +1 -1
- package/dist/standalone/{chunk-HRD2DVIW.js → chunk-35O3VETX.js} +1 -1
- package/dist/standalone/{chunk-FDLSPDIC.js → chunk-3KLX63D7.js} +1 -1
- package/dist/standalone/{chunk-PSPJORP6.js → chunk-4U5PYZLE.js} +1 -1
- package/dist/standalone/{chunk-4ZCENYC3.js → chunk-54TELYX4.js} +1 -1
- package/dist/standalone/{chunk-362AVHNC.js → chunk-5BEXGGHV.js} +1 -1
- package/dist/standalone/{chunk-Y2YQITGI.js → chunk-5U6757U7.js} +1 -1
- package/dist/standalone/{chunk-MYFFCV2R.js → chunk-6DAH3SMG.js} +1 -1
- package/dist/standalone/{chunk-H7YVFLA5.js → chunk-6XME7G3Q.js} +1 -1
- package/dist/standalone/{chunk-6CBLYGXJ.js → chunk-AFH3KSFW.js} +1 -1
- package/dist/standalone/{chunk-KTXD2N6F.js → chunk-ATES7QMQ.js} +1 -1
- package/dist/standalone/{chunk-CSYDKCNQ.js → chunk-AVBOVXQK.js} +1 -1
- package/dist/standalone/{chunk-WXBTOI6T.js → chunk-B3QSXX4O.js} +1 -1
- package/dist/standalone/{chunk-CL76PTLM.js → chunk-BA6TK2PS.js} +1 -1
- package/dist/standalone/{chunk-6UPO6ELN.js → chunk-BGOEMFLU.js} +1 -1
- package/dist/standalone/{chunk-TV2M3PHL.js → chunk-BNNRPK47.js} +1 -1
- package/dist/standalone/{chunk-Z6SECRFO.js → chunk-BSACLUQK.js} +2 -2
- package/dist/standalone/{chunk-OEGE3YDK.js → chunk-CG5OTGTR.js} +2 -2
- package/dist/standalone/{chunk-3S4VZ2ZM.js → chunk-DBMUPDVJ.js} +1 -1
- package/dist/standalone/{chunk-NNLNQKT7.js → chunk-EGSG64TS.js} +1 -1
- package/dist/standalone/{chunk-NSOLPNU7.js → chunk-EHQU74ST.js} +1 -1
- package/dist/standalone/{chunk-333WFRWG.js → chunk-ENLQ6CZE.js} +1 -1
- package/dist/standalone/{chunk-2XOGZAF4.js → chunk-EQFBG7TB.js} +1 -1
- package/dist/standalone/{chunk-FB5DOMZF.js → chunk-EYENA7HZ.js} +1 -1
- package/dist/standalone/{chunk-VLW547U6.js → chunk-FUVCG23X.js} +1 -1
- package/dist/standalone/{chunk-EE63P4VX.js → chunk-GD4GUF75.js} +1 -1
- package/dist/standalone/{chunk-TVGQ7K5I.js → chunk-HOQ2PFO6.js} +1 -1
- package/dist/standalone/{chunk-77JLGJ7V.js → chunk-INFALEU6.js} +1 -1
- package/dist/standalone/{chunk-IZXGBTPE.js → chunk-IS2BTYON.js} +1 -1
- package/dist/standalone/{chunk-SQMJUXBA.js → chunk-ITNXWR5K.js} +1 -1
- package/dist/standalone/{chunk-TIANWRSD.js → chunk-K6O3UDLX.js} +1 -1
- package/dist/standalone/{chunk-BFCUKERU.js → chunk-K76OQSTQ.js} +1 -1
- package/dist/standalone/{chunk-WY33QRLH.js → chunk-KZ5V7F4W.js} +1 -1
- package/dist/standalone/{chunk-VHXQGKA7.js → chunk-L6DNHL3L.js} +1 -1
- package/dist/standalone/{chunk-MPYVZLYP.js → chunk-LJFIXPDF.js} +1 -1
- package/dist/standalone/{chunk-CA5ILAW2.js → chunk-LVZKEWNM.js} +1 -1
- package/dist/standalone/{chunk-4PZEPCO7.js → chunk-M3PFFLSD.js} +1 -1
- package/dist/standalone/{chunk-EBI7CCQQ.js → chunk-MIGH67EO.js} +1 -1
- package/dist/standalone/{chunk-5EW733RQ.js → chunk-MOVUB3HI.js} +1 -1
- package/dist/standalone/{chunk-RPCMQE4A.js → chunk-MSXT3KG5.js} +1 -1
- package/dist/standalone/{chunk-H3BH6X3G.js → chunk-N5OS5NUG.js} +1 -1
- package/dist/standalone/{chunk-RJINX3H6.js → chunk-NGQTRDBQ.js} +1 -1
- package/dist/standalone/{chunk-JHXEEPRG.js → chunk-NNJW6LZK.js} +1 -1
- package/dist/standalone/{chunk-ELO3V35K.js → chunk-OQOBY6X3.js} +1 -1
- package/dist/standalone/{chunk-SRQP7SLQ.js → chunk-Q7ZPWO67.js} +1 -1
- package/dist/standalone/{chunk-XNBAJ6XA.js → chunk-QO645HJU.js} +1 -1
- package/dist/standalone/{chunk-RLRTQOFQ.js → chunk-R7S3ICRW.js} +1 -1
- package/dist/standalone/{chunk-AXXNMZQ4.js → chunk-TRS5ABTX.js} +1 -1
- package/dist/standalone/{chunk-GIQDEWC4.js → chunk-U5D3ABAW.js} +1 -1
- package/dist/standalone/{chunk-2VGV6RPS.js → chunk-U6RNLNVU.js} +1 -1
- package/dist/standalone/{chunk-QO4SZ4WH.js → chunk-UUO257GV.js} +1 -1
- package/dist/standalone/{chunk-U7LNRJHZ.js → chunk-W7ETXRN4.js} +1 -1
- package/dist/standalone/{chunk-HAIBZTXF.js → chunk-WSNONR2E.js} +1 -1
- package/dist/standalone/{chunk-PQICDSPP.js → chunk-XLU6W4LI.js} +1 -1
- package/dist/standalone/{chunk-MSCK3V6U.js → chunk-XVJIEJ5R.js} +1 -1
- package/dist/standalone/{chunk-IE5S3JMD.js → chunk-XYD65F6K.js} +1 -1
- package/dist/standalone/{chunk-BUIAZFSC.js → chunk-XZBLPJZN.js} +1 -1
- package/dist/standalone/{chunk-SJ4CA7QG.js → chunk-YN4VXWMW.js} +1 -1
- package/dist/standalone/{chunk-MVZARXDR.js → chunk-YNZQSHFG.js} +1 -1
- package/dist/standalone/{chunk-3NXFFXQ2.js → chunk-ZJK2XCP3.js} +1 -1
- package/dist/standalone/{chunk-W2FXNIVC.js → chunk-ZZBE7O77.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Qe}from"./chunk-BFCUKERU.js";import{a as Me,b as Re}from"./chunk-7SROZWKL.js";import"./chunk-FJ6G6FNE.js";import"./chunk-CP4ZFBVW.js";import"./chunk-CN2AINNY.js";import{a as we}from"./chunk-NXXGISFB.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-JV7KTJPY.js";import{a as He}from"./chunk-CKTKI4IY.js";import{a as Xe}from"./chunk-TB5N24CM.js";import{b as Je}from"./chunk-KVSQKUWD.js";import{e as Ue}from"./chunk-4YTSKL4R.js";import"./chunk-ZHPDAJBM.js";import{P as Ae}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as me}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ze}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as je}from"./chunk-DZGOHOOE.js";import{f as Ve}from"./chunk-OEGE3YDK.js";import"./chunk-RCZTUWG3.js";import{a as We}from"./chunk-UANVABQG.js";import{a as qe,b as Pe,c as Ge,d as Ke,e as Le}from"./chunk-IYWVSMAY.js";import{d as Fe,f as Ee,g as $e,h as Oe,o as ue}from"./chunk-6ZPTNC34.js";import"./chunk-FDLSPDIC.js";import{a as r,d as Be,e as at,f as nt,g as st,i as De}from"./chunk-R5ZTCHCE.js";var Ce=Be(nt(),1);var x=Be(at(),1);var t=Be(st(),1);var rt=Ee(je.listTables),ot=Ee(je.listTableIndexes),it=Ee(je.readTablePage),dt=Ee(je.describeTables),ct={},Ye=[],mt=r(s=>{let e=(0,Ce.c)(74),{initialShardKey:u,initialTable:n}=s,l=Ve(),[a,m]=(0,x.useState)("graph"),{queryShardKey:c,setShardKey:d,shardKey:g}=He(u),[o,p]=(0,x.useState)(""),[i,v]=(0,x.useState)(null),[b,P]=(0,x.useState)(null),_;e[0]===Symbol.for("react.memo_cache_sentinel")?(_={},e[0]=_):_=e[0];let[L,y]=(0,x.useState)(_),G;e[1]===Symbol.for("react.memo_cache_sentinel")?(G={},e[1]=G):G=e[1];let[E,M]=(0,x.useState)(G),[S,C]=(0,x.useState)(null),F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={},e[2]=F):F=e[2];let[$,he]=(0,x.useState)(F),Q;e[3]===Symbol.for("react.memo_cache_sentinel")?(Q={},e[3]=Q):Q=e[3];let[I,K]=(0,x.useState)(Q),[k,pe]=(0,x.useState)(null),[B,oe]=(0,x.useState)(null),Y;e[4]===Symbol.for("react.memo_cache_sentinel")?(Y={},e[4]=Y):Y=e[4];let[W,xe]=(0,x.useState)(Y),[J,ie]=(0,x.useState)(null),ve;e[5]!==l?(ve=r(async h=>{P(null);try{let w=await l.query(rt,{},$e(h));Je(h),v(w),y({}),M({}),C(null),he(N=>Object.fromEntries(Object.entries(N).filter(q=>{let[A]=q;return A!==h}))),K(N=>Object.fromEntries(Object.entries(N).filter(q=>{let[A]=q;return A!==h})))}catch(w){let N=w;v(null),P(Oe(N))}},"ve"),e[5]=l,e[6]=ve):ve=e[6];let O=ve,Z;e[7]!==l?(Z=r(async()=>{oe(null);try{pe(await l.listGlobalTables())}catch(h){let w=h;pe(null),oe(Oe(w))}},"Z"),e[7]=l,e[8]=Z):Z=e[8];let ee=Z,de,D;e[9]!==c||e[10]!==O||e[11]!==ee?(de=r(()=>{ue(O(c)),ue(ee())},"de"),D=[O,ee,c],e[9]=c,e[10]=O,e[11]=ee,e[12]=de,e[13]=D):(de=e[12],D=e[13]),(0,x.useEffect)(de,D);let te;e[14]!==l||e[15]!==L||e[16]!==S||e[17]!==c?(te=r(async h=>{if(S===h){C(null);return}C(h);let w=`${c}:${h}`;if(L[w]!==void 0)return;let[N,q]=await Promise.allSettled([l.query(it,{limit:1,offset:0,table:h},$e(c)),l.query(ot,{table:h},$e(c))]);N.status==="fulfilled"?y(A=>({...A,[w]:N.value.columns})):P(Oe(N.reason)),q.status==="fulfilled"&&M(A=>({...A,[w]:q.value.indexes}))},"te"),e[14]=l,e[15]=L,e[16]=S,e[17]=c,e[18]=te):te=e[18];let j=te,ye;e[19]!==l||e[20]!==W||e[21]!==J?(ye=r(async h=>{if(J===h){ie(null);return}if(ie(h),W[h]===void 0)try{let w=await l.readGlobalTablePage({limit:1,offset:0,table:h});xe(N=>({...N,[h]:w.columns}))}catch(w){oe(Oe(w))}},"ye"),e[19]=l,e[20]=W,e[21]=J,e[22]=ye):ye=e[22];let ce=ye,be=(0,x.useRef)(void 0),R,X;e[23]!==n||e[24]!==i||e[25]!==j?(R=r(()=>{n===void 0||i===null||be.current===n||i.some(h=>h.name===n)&&(be.current=n,ue(j(n)))},"K"),X=[n,i,j],e[23]=n,e[24]=i,e[25]=j,e[26]=R,e[27]=X):(R=e[26],X=e[27]),(0,x.useEffect)(R,X);let V;e[28]!==l?(V=r(async(h,w,N)=>{let[q,A]=await Promise.all([Promise.allSettled([l.query(dt,{tables:[...w,...N]},$e(h))]),Promise.all(N.map(async T=>{let ge=await Promise.allSettled([l.readGlobalTablePage({limit:1,offset:0,table:T})]),Ie=ge[0].status==="fulfilled"?ge[0].value:void 0;return{columns:Ie?.columns??[],refs:Ie?.refs??{},table:T}}))]),Te=q[0].status==="fulfilled"?q[0].value?.columnsByTable??{}:{},Se=q[0].status==="rejected",_e=new Map(A.map(ut)),ke=[...w,...N].map(T=>{let ge=Te[T]??[];return[T,ge.length>0?ge:_e.get(T)??[]]});he(T=>({...T,[h]:Object.fromEntries(ke)})),K(T=>({...T,[h]:Se}))},"U"),e[28]=l,e[29]=V):V=e[29];let le=V,U,ae;e[30]!==B||e[31]!==k||e[32]!==le||e[33]!==c||e[34]!==$||e[35]!==i||e[36]!==a?(U=r(()=>{a!=="graph"||i===null||k===null&&B===null||$[c]!==void 0||ue(le(c,i.map(ht),(k??[]).map(pt)))},"V"),ae=[a,i,k,B,c,$,le],e[30]=B,e[31]=k,e[32]=le,e[33]=c,e[34]=$,e[35]=i,e[36]=a,e[37]=U,e[38]=ae):(U=e[37],ae=e[38]),(0,x.useEffect)(U,ae);let z=$[c]??ct,ne;if(e[39]!==z||e[40]!==k||e[41]!==i){let h;e[43]!==z?(h=r(A=>({columns:z[A.name]??Ye,name:A.name,tier:"shard"}),"u"),e[43]=z,e[44]=h):h=e[44];let w=(i??[]).map(h),N;e[45]!==z?(N=r(A=>({columns:z[A.name]??Ye,name:A.name,tier:"global"}),"x"),e[45]=z,e[46]=N):N=e[46];let q=(k??[]).map(N);ne=[...w,...q],e[39]=z,e[40]=k,e[41]=i,e[42]=ne}else ne=e[42];let se=ne,f;if(e[47]!==o||e[48]!==i){let h=o.trim().toLowerCase();f=(i??[]).filter(w=>w.name.toLowerCase().includes(h)),e[47]=o,e[48]=i,e[49]=f}else f=e[49];let re=f,H;if(e[50]!==k||e[51]!==o){let h=o.trim().toLowerCase();H=(k??[]).filter(w=>w.name.toLowerCase().includes(h)),e[50]=k,e[51]=o,e[52]=H}else H=e[52];let Ne=H,fe;return e[53]!==L||e[54]!==se||e[55]!==b||e[56]!==S||e[57]!==Ne||e[58]!==re||e[59]!==W||e[60]!==B||e[61]!==J||e[62]!==k||e[63]!==E||e[64]!==O||e[65]!==d||e[66]!==I||e[67]!==g||e[68]!==o||e[69]!==i||e[70]!==j||e[71]!==ce||e[72]!==a?(fe={columns:L,diagramTables:se,error:b,expanded:S,filteredGlobalTables:Ne,filteredTables:re,globalColumns:W,globalError:B,globalExpanded:J,globalTables:k,indexes:E,refresh:O,setShardKey:d,setTableFilter:p,setView:m,shardColumnsError:I,shardKey:g,tableFilter:o,tables:i,toggle:j,toggleGlobal:ce,view:a},e[53]=L,e[54]=se,e[55]=b,e[56]=S,e[57]=Ne,e[58]=re,e[59]=W,e[60]=B,e[61]=J,e[62]=k,e[63]=E,e[64]=O,e[65]=d,e[66]=I,e[67]=g,e[68]=o,e[69]=i,e[70]=j,e[71]=ce,e[72]=a,e[73]=fe):fe=e[73],fe},"ct");function ut(s){let{columns:e,refs:u,table:n}=s;return[n,e.map(l=>{let a=u[l];return a===void 0?{name:l,optional:!1,type:""}:{name:l,optional:!1,ref:a,type:"id"}})]}r(ut,"mt");function ht(s){return s.name}r(ht,"ut");function pt(s){return s.name}r(pt,"ft");var bt="/__lunora/schema-edit",ft=r(async s=>{let e=await fetch(bt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json","X-Lunora-Studio":"1"},method:"POST"}),u=await e.json();return u.needsMigration===!0?{kind:"needs-migration",message:u.message??"This edit needs a migration."}:e.ok&&u.tables!==void 0?{diagnostics:u.diagnostics??[],kind:"ok",tables:u.tables}:{kind:"error",message:u.error??`schema edit failed (${String(e.status)})`}},"pt"),gt=r(s=>{let e=(0,Ce.c)(32),{hasTables:u,mode:n,onAddColumn:l,onAddIndex:a,onAddTable:m,onDestructive:c}=s,d=Fe(),g=n==="addTable"?"default":"outline",o;e[0]!==d?(o=d("Add table"),e[0]=d,e[1]=o):o=e[1];let p;e[2]!==m||e[3]!==g||e[4]!==o?(p=(0,t.jsx)(me,{"data-testid":"sc-editor-add-table",onClick:m,size:"xs",type:"button",variant:g,children:o}),e[2]=m,e[3]=g,e[4]=o,e[5]=p):p=e[5];let i=!u,v=n==="addColumn"?"default":"outline",b;e[6]!==d?(b=d("Add column"),e[6]=d,e[7]=b):b=e[7];let P;e[8]!==l||e[9]!==i||e[10]!==v||e[11]!==b?(P=(0,t.jsx)(me,{"data-testid":"sc-editor-add-column",disabled:i,onClick:l,size:"xs",type:"button",variant:v,children:b}),e[8]=l,e[9]=i,e[10]=v,e[11]=b,e[12]=P):P=e[12];let _=!u,L=n==="addIndex"?"default":"outline",y;e[13]!==d?(y=d("Add index"),e[13]=d,e[14]=y):y=e[14];let G;e[15]!==a||e[16]!==y||e[17]!==_||e[18]!==L?(G=(0,t.jsx)(me,{"data-testid":"sc-editor-add-index",disabled:_,onClick:a,size:"xs",type:"button",variant:L,children:y}),e[15]=a,e[16]=y,e[17]=_,e[18]=L,e[19]=G):G=e[19];let E=!u,M=n==="destructive"?"default":"ghost",S;e[20]!==d?(S=d("Rename / drop / change type\u2026"),e[20]=d,e[21]=S):S=e[21];let C;e[22]!==c||e[23]!==E||e[24]!==M||e[25]!==S?(C=(0,t.jsx)(me,{"data-testid":"sc-editor-destructive",disabled:E,onClick:c,size:"xs",type:"button",variant:M,children:S}),e[22]=c,e[23]=E,e[24]=M,e[25]=S,e[26]=C):C=e[26];let F;return e[27]!==G||e[28]!==C||e[29]!==p||e[30]!==P?(F=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[p,P,G,C]}),e[27]=G,e[28]=C,e[29]=p,e[30]=P,e[31]=F):F=e[31],F},"gt"),xt=r(s=>{let e=(0,Ce.c)(28),{onOpenMigrations:u,result:n}=s,l=Fe();if(n===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[0]=o):o=e[0],o}if(n.kind==="error"){let o;return e[1]!==n.message?(o=(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=o):o=e[2],o}if(n.kind==="needs-migration"){let o;e[3]!==n.message||e[4]!==l?(o=n.message===""?l("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=l,e[5]=o):o=e[5];let p;e[6]!==o?(p=(0,t.jsx)("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=p):p=e[7];let i;e[8]!==l?(i=l("Open Migrations"),e[8]=l,e[9]=i):i=e[9];let v;e[10]!==u||e[11]!==i?(v=(0,t.jsx)(me,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:u,size:"xs",type:"button",variant:"outline",children:i}),e[10]=u,e[11]=i,e[12]=v):v=e[12];let b;return e[13]!==p||e[14]!==v?(b=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[p,v]}),e[13]=p,e[14]=v,e[15]=b):b=e[15],b}if(n.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[16]=o):o=e[16],o}let a;e[17]!==l?(a=l("Codegen reported diagnostics:"),e[17]=l,e[18]=a):a=e[18];let m;e[19]!==a?(m=(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=m):m=e[20];let c;e[21]!==n.diagnostics?(c=n.diagnostics.map(vt),e[21]=n.diagnostics,e[22]=c):c=e[22];let d;e[23]!==c?(d=(0,t.jsx)("ul",{className:"flex flex-col gap-0.5",children:c}),e[23]=c,e[24]=d):d=e[24];let g;return e[25]!==m||e[26]!==d?(g=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[m,d]}),e[25]=m,e[26]=d,e[27]=g):g=e[27],g},"bt");function vt(s){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}r(vt,"xt");var yt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.int64()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Nt="v.string()",Ct=r(s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),"Ct"),wt=r(s=>{let e=(0,Ce.c)(83),{onApplied:u,tableNames:n}=s,l=Fe(),a=Ue(),[m,c]=(0,x.useState)(null),[d,g]=(0,x.useState)(!1),[o,p]=(0,x.useState)(null),[i,v]=(0,x.useState)(""),[b,P]=(0,x.useState)(""),[_,L]=(0,x.useState)(Nt),[y,G]=(0,x.useState)(n[0]??""),[E,M]=(0,x.useState)(""),[S,C]=(0,x.useState)(""),[F,$]=(0,x.useState)(!1),he;e[0]===Symbol.for("react.memo_cache_sentinel")?(he=r(()=>{c(null),v(""),P(""),M(""),C(""),$(!1)},"me"),e[0]=he):he=e[0];let Q=he,I;e[1]!==u?(I=r(async T=>{g(!0),p(null);try{let ge=await ft(T);p(ge),ge.kind==="ok"&&(u(ge.tables),Q())}catch(ge){let Ie=ge;p({kind:"error",message:Ie instanceof Error?Ie.message:String(Ie)})}g(!1)},"I"),e[1]=u,e[2]=I):I=e[2];let K=I,k;e[3]!==K||e[4]!==i?(k=r(()=>{ue(K({kind:"addTable",table:i.trim()}))},"_"),e[3]=K,e[4]=i,e[5]=k):k=e[5];let pe=k,B;e[6]!==b||e[7]!==K||e[8]!==y||e[9]!==_?(B=r(()=>{ue(K({column:b.trim(),kind:"addOptionalColumn",table:y,validator:_}))},"j"),e[6]=b,e[7]=K,e[8]=y,e[9]=_,e[10]=B):B=e[10];let oe=B,Y;e[11]!==S||e[12]!==E||e[13]!==K||e[14]!==y||e[15]!==F?(Y=r(()=>{ue(K({fields:Ct(S),kind:"addIndex",name:E.trim(),table:y,unique:F}))},"Q"),e[11]=S,e[12]=E,e[13]=K,e[14]=y,e[15]=F,e[16]=Y):Y=e[16];let W=Y,xe;e[17]===Symbol.for("react.memo_cache_sentinel")?(xe=r(()=>{p(null),c("addTable")},"xe"),e[17]=xe):xe=e[17];let J=xe,ie;e[18]===Symbol.for("react.memo_cache_sentinel")?(ie=r(()=>{p(null),c("addColumn")},"re"),e[18]=ie):ie=e[18];let ve=ie,O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=r(()=>{p(null),c("addIndex")},"O"),e[19]=O):O=e[19];let Z=O,ee;e[20]!==l?(ee=r(()=>{c("destructive"),p({kind:"needs-migration",message:l("This edit changes stored data and must go through a migration. Review the migration before applying.")})},"ee"),e[20]=l,e[21]=ee):ee=e[21];let de=ee,D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=r(T=>{v(T.target.value)},"R"),e[22]=D):D=e[22];let te=D,j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=r(T=>{P(T.target.value)},"M"),e[23]=j):j=e[23];let ye=j,ce;e[24]===Symbol.for("react.memo_cache_sentinel")?(ce=r(T=>{L(T.target.value)},"ce"),e[24]=ce):ce=e[24];let be=ce,R;e[25]===Symbol.for("react.memo_cache_sentinel")?(R=r(T=>{G(T.target.value)},"K"),e[25]=R):R=e[25];let X=R,V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=r(T=>{M(T.target.value)},"U"),e[26]=V):V=e[26];let le=V,U;e[27]===Symbol.for("react.memo_cache_sentinel")?(U=r(T=>{C(T.target.value)},"V"),e[27]=U):U=e[27];let ae=U,z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=r(T=>{$(T.target.checked)},"$"),e[28]=z):z=e[28];let ne=z,se;e[29]!==a?(se=r(()=>{ue(a({to:"/migrations"}))},"ne"),e[29]=a,e[30]=se):se=e[30];let f=se,re;e[31]!==l?(re=l("Edit schema"),e[31]=l,e[32]=re):re=e[32];let H;e[33]!==re?(H=(0,t.jsx)(Ge,{children:re}),e[33]=re,e[34]=H):H=e[34];let Ne;e[35]!==l?(Ne=l("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=l,e[36]=Ne):Ne=e[36];let fe;e[37]!==Ne?(fe=(0,t.jsx)(Ke,{children:Ne}),e[37]=Ne,e[38]=fe):fe=e[38];let h;e[39]!==H||e[40]!==fe?(h=(0,t.jsxs)(Pe,{children:[H,fe]}),e[39]=H,e[40]=fe,e[41]=h):h=e[41];let w=n.length>0,N;e[42]!==m||e[43]!==de||e[44]!==w?(N=(0,t.jsx)(gt,{hasTables:w,mode:m,onAddColumn:ve,onAddIndex:Z,onAddTable:J,onDestructive:de}),e[42]=m,e[43]=de,e[44]=w,e[45]=N):N=e[45];let q;e[46]!==d||e[47]!==m||e[48]!==pe||e[49]!==l||e[50]!==i?(q=m==="addTable"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-table-name",children:l("Table name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:te,value:i})]}),(0,t.jsx)(me,{"data-testid":"sc-editor-table-apply",disabled:d||i.trim()==="",onClick:pe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[46]=d,e[47]=m,e[48]=pe,e[49]=l,e[50]=i,e[51]=q):q=e[51];let A;e[52]!==d||e[53]!==b||e[54]!==m||e[55]!==oe||e[56]!==l||e[57]!==n||e[58]!==y||e[59]!==_?(A=m==="addColumn"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:X,value:y,children:n.map(Tt)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-name",children:l("Column name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:ye,value:b})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-type",children:l("Column type")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:be,value:_,children:yt.map(St)})]}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l("Optional")}),(0,t.jsx)(me,{"data-testid":"sc-editor-column-apply",disabled:d||b.trim()===""||y==="",onClick:oe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[52]=d,e[53]=b,e[54]=m,e[55]=oe,e[56]=l,e[57]=n,e[58]=y,e[59]=_,e[60]=A):A=e[60];let Te;e[61]!==d||e[62]!==S||e[63]!==E||e[64]!==m||e[65]!==W||e[66]!==l||e[67]!==n||e[68]!==y||e[69]!==F?(Te=m==="addIndex"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:X,value:y,children:n.map(_t)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-name",children:l("Index name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:le,value:E})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-fields",children:l("Index fields (comma-separated)")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ae,value:S})]}),(0,t.jsxs)(we,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[(0,t.jsx)("input",{checked:F,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:ne,type:"checkbox"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:l("Unique")})]}),(0,t.jsx)(me,{"data-testid":"sc-editor-index-apply",disabled:d||E.trim()===""||S.trim()==="",onClick:W,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[61]=d,e[62]=S,e[63]=E,e[64]=m,e[65]=W,e[66]=l,e[67]=n,e[68]=y,e[69]=F,e[70]=Te):Te=e[70];let Se;e[71]!==f||e[72]!==o?(Se=(0,t.jsx)(xt,{onOpenMigrations:f,result:o}),e[71]=f,e[72]=o,e[73]=Se):Se=e[73];let _e;e[74]!==N||e[75]!==q||e[76]!==A||e[77]!==Te||e[78]!==Se?(_e=(0,t.jsxs)(Le,{children:[N,q,A,Te,Se]}),e[74]=N,e[75]=q,e[76]=A,e[77]=Te,e[78]=Se,e[79]=_e):_e=e[79];let ke;return e[80]!==h||e[81]!==_e?(ke=(0,t.jsxs)(qe,{"data-testid":"sc-editor",size:"sm",children:[h,_e]}),e[80]=h,e[81]=_e,e[82]=ke):ke=e[82],ke},"Nt");function Tt(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(Tt,"Tt");function St(s){return(0,t.jsx)("option",{value:s.validator,children:s.label},s.validator)}r(St,"St");function _t(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(_t,"wt");var Ze=[],kt=r(s=>{let e=(0,Ce.c)(5),{open:u}=s,n=u&&"rotate-90",l;e[0]!==n?(l=De("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let m;return e[3]!==l?(m=(0,t.jsx)("svg",{"aria-hidden":"true",className:l,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=l,e[4]=m):m=e[4],m},"_t"),et=r(s=>{let e=(0,Ce.c)(20),{children:u,expanded:n,name:l,onToggle:a,rowCount:m,rowTestId:c,toggleTestId:d}=s,g;e[0]!==n?(g=(0,t.jsx)(kt,{open:n}),e[0]=n,e[1]=g):g=e[1];let o;e[2]!==l?(o=(0,t.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:l,children:l}),e[2]=l,e[3]=o):o=e[3];let p;e[4]!==m?(p=(0,t.jsxs)("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",m,")"]}),e[4]=m,e[5]=p):p=e[5];let i;e[6]!==n||e[7]!==a||e[8]!==g||e[9]!==o||e[10]!==p||e[11]!==d?(i=(0,t.jsxs)("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":d,onClick:a,type:"button",children:[g,o," ",p]}),e[6]=n,e[7]=a,e[8]=g,e[9]=o,e[10]=p,e[11]=d,e[12]=i):i=e[12];let v;e[13]!==u||e[14]!==n?(v=n&&(0,t.jsx)("div",{className:"px-3 pb-3 ps-8",children:u}),e[13]=u,e[14]=n,e[15]=v):v=e[15];let b;return e[16]!==c||e[17]!==i||e[18]!==v?(b=(0,t.jsxs)("li",{className:"border-t border-border/60 first:border-t-0","data-testid":c,children:[i,v]}),e[16]=c,e[17]=i,e[18]=v,e[19]=b):b=e[19],b},"Ye"),tt=r(s=>{let e=(0,Ce.c)(5),{columns:u,testId:n}=s,l;e[0]!==u?(l=u.map(At),e[0]=u,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==n?(a=(0,t.jsx)("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:l}),e[2]=l,e[3]=n,e[4]=a):a=e[4],a},"He"),It=r(s=>{let e=(0,Ce.c)(10),{heading:u,indexes:n,testId:l}=s,a;e[0]!==u?(a=(0,t.jsx)("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=a):a=e[1];let m;e[2]!==n?(m=n.map(Ft),e[2]=n,e[3]=m):m=e[3];let c;e[4]!==m||e[5]!==l?(c=(0,t.jsx)("ul",{className:"flex flex-col gap-1","data-testid":l,children:m}),e[4]=m,e[5]=l,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=(0,t.jsxs)("div",{className:"pt-3",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9],d},"Et"),lt=r(s=>De("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Xe"),Xt=r(s=>{let e=(0,Ce.c)(85),{initialShardKey:u,initialTable:n,schemaEditable:l}=s,a=Fe(),m;e[0]!==u||e[1]!==n?(m={initialShardKey:u,initialTable:n},e[0]=u,e[1]=n,e[2]=m):m=e[2];let{columns:c,diagramTables:d,error:g,expanded:o,filteredGlobalTables:p,filteredTables:i,globalColumns:v,globalError:b,globalExpanded:P,globalTables:_,indexes:L,refresh:y,setShardKey:G,setTableFilter:E,setView:M,shardColumnsError:S,shardKey:C,tableFilter:F,tables:$,toggle:he,toggleGlobal:Q,view:I}=mt(m),K;e[3]!==M?(K=r(()=>{M("list")},"q"),e[3]=M,e[4]=K):K=e[4];let k=K,pe;e[5]!==M?(pe=r(()=>{M("graph")},"ue"),e[5]=M,e[6]=pe):pe=e[6];let B=pe,oe;e[7]!==E?(oe=r(f=>{E(f.target.value)},"ie"),e[7]=E,e[8]=oe):oe=e[8];let Y=oe,W;e[9]!==y||e[10]!==C?(W=r(f=>{ue(y(C))},"Y"),e[9]=y,e[10]=C,e[11]=W):W=e[11];let xe=W,J;e[12]!==$?(J=$??[],e[12]=$,e[13]=J):J=e[13];let ie;e[14]!==J?(ie=J.map(zt),e[14]=J,e[15]=ie):ie=e[15];let ve=ie,O;e[16]!==G||e[17]!==C?(O=(0,t.jsx)(Xe,{onChange:G,testId:"sc-shard-input",value:C}),e[16]=G,e[17]=C,e[18]=O):O=e[18];let Z;e[19]!==a?(Z=a("Schema view"),e[19]=a,e[20]=Z):Z=e[20];let ee=I==="graph",de=I==="graph",D;e[21]!==de?(D=lt(de),e[21]=de,e[22]=D):D=e[22];let te;e[23]!==a?(te=a("Graph"),e[23]=a,e[24]=te):te=e[24];let j;e[25]!==B||e[26]!==ee||e[27]!==D||e[28]!==te?(j=(0,t.jsx)("button",{"aria-selected":ee,className:D,"data-testid":"sc-view-graph",onClick:B,role:"tab",type:"button",children:te}),e[25]=B,e[26]=ee,e[27]=D,e[28]=te,e[29]=j):j=e[29];let ye=I==="list",ce=I==="list",be;e[30]!==ce?(be=lt(ce),e[30]=ce,e[31]=be):be=e[31];let R;e[32]!==a?(R=a("Table list"),e[32]=a,e[33]=R):R=e[33];let X;e[34]!==k||e[35]!==ye||e[36]!==be||e[37]!==R?(X=(0,t.jsx)("button",{"aria-selected":ye,className:be,"data-testid":"sc-view-list",onClick:k,role:"tab",type:"button",children:R}),e[34]=k,e[35]=ye,e[36]=be,e[37]=R,e[38]=X):X=e[38];let V;e[39]!==j||e[40]!==X||e[41]!==Z?(V=(0,t.jsxs)("div",{"aria-label":Z,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[j,X]}),e[39]=j,e[40]=X,e[41]=Z,e[42]=V):V=e[42];let le;e[43]!==V||e[44]!==O?(le=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[O,V]}),e[43]=V,e[44]=O,e[45]=le):le=e[45];let U;e[46]!==xe||e[47]!==l||e[48]!==ve?(U=l===!0&&(0,t.jsx)(wt,{onApplied:xe,tableNames:ve}),e[46]=xe,e[47]=l,e[48]=ve,e[49]=U):U=e[49];let ae;e[50]!==Y||e[51]!==a||e[52]!==F||e[53]!==I?(ae=I==="list"&&(0,t.jsx)(Ae,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:Y,placeholder:a("Filter tables"),value:F}),e[50]=Y,e[51]=a,e[52]=F,e[53]=I,e[54]=ae):ae=e[54];let z;e[55]!==d||e[56]!==g||e[57]!==b||e[58]!==S||e[59]!==C||e[60]!==I?(z=I==="graph"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:b}),(0,t.jsx)(Qe,{columnsError:S[C]===!0,tables:d,testIdPrefix:"sc-graph"})]}),e[55]=d,e[56]=g,e[57]=b,e[58]=S,e[59]=C,e[60]=I,e[61]=z):z=e[61];let ne;e[62]!==c||e[63]!==g||e[64]!==o||e[65]!==p||e[66]!==i||e[67]!==v||e[68]!==b||e[69]!==P||e[70]!==_||e[71]!==L||e[72]!==C||e[73]!==a||e[74]!==$||e[75]!==he||e[76]!==Q||e[77]!==I?(ne=I==="list"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(qe,{"data-testid":"sc-shard-section",size:"sm",children:[(0,t.jsxs)(Pe,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"shard"}),(0,t.jsx)(Ge,{children:a("Shard tables")}),$!==null&&(0,t.jsx)(ze,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),(0,t.jsx)(Ke,{children:Me.shard.hint})]}),(0,t.jsxs)(Le,{children:[g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),$!==null&&$.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),$!==null&&$.length>0&&i.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),i.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(f=>{let re=`${C}:${f.name}`,H=L[re]??[];return(0,t.jsxs)(et,{expanded:o===f.name,name:f.name,onToggle:r(()=>{ue(he(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-table-${f.name}`,toggleTestId:`sc-toggle-${f.name}`,children:[(0,t.jsx)(tt,{columns:c[re]??Ze,testId:`sc-columns-${f.name}`}),H.length>0&&(0,t.jsx)(It,{heading:a("Indexes"),indexes:H,testId:`sc-indexes-${f.name}`})]},f.name)})})]})]}),(0,t.jsxs)(qe,{"data-testid":"sc-global-section",size:"sm",children:[(0,t.jsxs)(Pe,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"global"}),(0,t.jsx)(Ge,{children:a("Global tables (D1)")}),_!==null&&(0,t.jsx)(ze,{className:"ms-auto tabular-nums",variant:"outline",children:p.length})]}),(0,t.jsx)(Ke,{children:Me.global.hint})]}),(0,t.jsxs)(Le,{children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:b}),_!==null&&_.length===0&&(0,t.jsx)(We,{description:Me.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),_!==null&&_.length>0&&p.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),p.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:p.map(f=>(0,t.jsx)(et,{expanded:P===f.name,name:f.name,onToggle:r(()=>{ue(Q(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-global-table-${f.name}`,toggleTestId:`sc-global-toggle-${f.name}`,children:(0,t.jsx)(tt,{columns:v[f.name]??Ze,testId:`sc-global-columns-${f.name}`})},f.name))})]})]})]}),e[62]=c,e[63]=g,e[64]=o,e[65]=p,e[66]=i,e[67]=v,e[68]=b,e[69]=P,e[70]=_,e[71]=L,e[72]=C,e[73]=a,e[74]=$,e[75]=he,e[76]=Q,e[77]=I,e[78]=ne):ne=e[78];let se;return e[79]!==le||e[80]!==U||e[81]!==ae||e[82]!==z||e[83]!==ne?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[le,U,ae,z,ne]}),e[79]=le,e[80]=U,e[81]=ae,e[82]=z,e[83]=ne,e[84]=se):se=e[84],se},"Wt");function At(s){return(0,t.jsx)("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}r(At,"It");function Ft(s){return(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,t.jsx)("span",{className:"font-mono",children:s.name}),(0,t.jsx)(ze,{variant:"outline",children:s.type}),s.unique===!0&&(0,t.jsx)(ze,{variant:"secondary",children:"unique"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}r(Ft,"kt");function zt(s){return s.name}r(zt,"At");export{Xt as SchemaViewer};
|
|
1
|
+
import{a as Qe}from"./chunk-K76OQSTQ.js";import{a as Me,b as Re}from"./chunk-7SROZWKL.js";import"./chunk-FJ6G6FNE.js";import"./chunk-CP4ZFBVW.js";import"./chunk-CN2AINNY.js";import{a as we}from"./chunk-NXXGISFB.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-JV7KTJPY.js";import{a as He}from"./chunk-CKTKI4IY.js";import{a as Xe}from"./chunk-TB5N24CM.js";import{b as Je}from"./chunk-KVSQKUWD.js";import{e as Ue}from"./chunk-4YTSKL4R.js";import"./chunk-ZHPDAJBM.js";import{P as Ae}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as me}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ze}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as je}from"./chunk-DZGOHOOE.js";import{f as Ve}from"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as We}from"./chunk-UANVABQG.js";import{a as qe,b as Pe,c as Ge,d as Ke,e as Le}from"./chunk-IYWVSMAY.js";import{d as Fe,f as Ee,g as $e,h as Oe,o as ue}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as r,d as Be,e as at,f as nt,g as st,i as De}from"./chunk-R5ZTCHCE.js";var Ce=Be(nt(),1);var x=Be(at(),1);var t=Be(st(),1);var rt=Ee(je.listTables),ot=Ee(je.listTableIndexes),it=Ee(je.readTablePage),dt=Ee(je.describeTables),ct={},Ye=[],mt=r(s=>{let e=(0,Ce.c)(74),{initialShardKey:u,initialTable:n}=s,l=Ve(),[a,m]=(0,x.useState)("graph"),{queryShardKey:c,setShardKey:d,shardKey:g}=He(u),[o,p]=(0,x.useState)(""),[i,v]=(0,x.useState)(null),[b,P]=(0,x.useState)(null),_;e[0]===Symbol.for("react.memo_cache_sentinel")?(_={},e[0]=_):_=e[0];let[L,y]=(0,x.useState)(_),G;e[1]===Symbol.for("react.memo_cache_sentinel")?(G={},e[1]=G):G=e[1];let[E,M]=(0,x.useState)(G),[S,C]=(0,x.useState)(null),F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={},e[2]=F):F=e[2];let[$,he]=(0,x.useState)(F),Q;e[3]===Symbol.for("react.memo_cache_sentinel")?(Q={},e[3]=Q):Q=e[3];let[I,K]=(0,x.useState)(Q),[k,pe]=(0,x.useState)(null),[B,oe]=(0,x.useState)(null),Y;e[4]===Symbol.for("react.memo_cache_sentinel")?(Y={},e[4]=Y):Y=e[4];let[W,xe]=(0,x.useState)(Y),[J,ie]=(0,x.useState)(null),ve;e[5]!==l?(ve=r(async h=>{P(null);try{let w=await l.query(rt,{},$e(h));Je(h),v(w),y({}),M({}),C(null),he(N=>Object.fromEntries(Object.entries(N).filter(q=>{let[A]=q;return A!==h}))),K(N=>Object.fromEntries(Object.entries(N).filter(q=>{let[A]=q;return A!==h})))}catch(w){let N=w;v(null),P(Oe(N))}},"ve"),e[5]=l,e[6]=ve):ve=e[6];let O=ve,Z;e[7]!==l?(Z=r(async()=>{oe(null);try{pe(await l.listGlobalTables())}catch(h){let w=h;pe(null),oe(Oe(w))}},"Z"),e[7]=l,e[8]=Z):Z=e[8];let ee=Z,de,D;e[9]!==c||e[10]!==O||e[11]!==ee?(de=r(()=>{ue(O(c)),ue(ee())},"de"),D=[O,ee,c],e[9]=c,e[10]=O,e[11]=ee,e[12]=de,e[13]=D):(de=e[12],D=e[13]),(0,x.useEffect)(de,D);let te;e[14]!==l||e[15]!==L||e[16]!==S||e[17]!==c?(te=r(async h=>{if(S===h){C(null);return}C(h);let w=`${c}:${h}`;if(L[w]!==void 0)return;let[N,q]=await Promise.allSettled([l.query(it,{limit:1,offset:0,table:h},$e(c)),l.query(ot,{table:h},$e(c))]);N.status==="fulfilled"?y(A=>({...A,[w]:N.value.columns})):P(Oe(N.reason)),q.status==="fulfilled"&&M(A=>({...A,[w]:q.value.indexes}))},"te"),e[14]=l,e[15]=L,e[16]=S,e[17]=c,e[18]=te):te=e[18];let j=te,ye;e[19]!==l||e[20]!==W||e[21]!==J?(ye=r(async h=>{if(J===h){ie(null);return}if(ie(h),W[h]===void 0)try{let w=await l.readGlobalTablePage({limit:1,offset:0,table:h});xe(N=>({...N,[h]:w.columns}))}catch(w){oe(Oe(w))}},"ye"),e[19]=l,e[20]=W,e[21]=J,e[22]=ye):ye=e[22];let ce=ye,be=(0,x.useRef)(void 0),R,X;e[23]!==n||e[24]!==i||e[25]!==j?(R=r(()=>{n===void 0||i===null||be.current===n||i.some(h=>h.name===n)&&(be.current=n,ue(j(n)))},"K"),X=[n,i,j],e[23]=n,e[24]=i,e[25]=j,e[26]=R,e[27]=X):(R=e[26],X=e[27]),(0,x.useEffect)(R,X);let V;e[28]!==l?(V=r(async(h,w,N)=>{let[q,A]=await Promise.all([Promise.allSettled([l.query(dt,{tables:[...w,...N]},$e(h))]),Promise.all(N.map(async T=>{let ge=await Promise.allSettled([l.readGlobalTablePage({limit:1,offset:0,table:T})]),Ie=ge[0].status==="fulfilled"?ge[0].value:void 0;return{columns:Ie?.columns??[],refs:Ie?.refs??{},table:T}}))]),Te=q[0].status==="fulfilled"?q[0].value?.columnsByTable??{}:{},Se=q[0].status==="rejected",_e=new Map(A.map(ut)),ke=[...w,...N].map(T=>{let ge=Te[T]??[];return[T,ge.length>0?ge:_e.get(T)??[]]});he(T=>({...T,[h]:Object.fromEntries(ke)})),K(T=>({...T,[h]:Se}))},"U"),e[28]=l,e[29]=V):V=e[29];let le=V,U,ae;e[30]!==B||e[31]!==k||e[32]!==le||e[33]!==c||e[34]!==$||e[35]!==i||e[36]!==a?(U=r(()=>{a!=="graph"||i===null||k===null&&B===null||$[c]!==void 0||ue(le(c,i.map(ht),(k??[]).map(pt)))},"V"),ae=[a,i,k,B,c,$,le],e[30]=B,e[31]=k,e[32]=le,e[33]=c,e[34]=$,e[35]=i,e[36]=a,e[37]=U,e[38]=ae):(U=e[37],ae=e[38]),(0,x.useEffect)(U,ae);let z=$[c]??ct,ne;if(e[39]!==z||e[40]!==k||e[41]!==i){let h;e[43]!==z?(h=r(A=>({columns:z[A.name]??Ye,name:A.name,tier:"shard"}),"u"),e[43]=z,e[44]=h):h=e[44];let w=(i??[]).map(h),N;e[45]!==z?(N=r(A=>({columns:z[A.name]??Ye,name:A.name,tier:"global"}),"x"),e[45]=z,e[46]=N):N=e[46];let q=(k??[]).map(N);ne=[...w,...q],e[39]=z,e[40]=k,e[41]=i,e[42]=ne}else ne=e[42];let se=ne,f;if(e[47]!==o||e[48]!==i){let h=o.trim().toLowerCase();f=(i??[]).filter(w=>w.name.toLowerCase().includes(h)),e[47]=o,e[48]=i,e[49]=f}else f=e[49];let re=f,H;if(e[50]!==k||e[51]!==o){let h=o.trim().toLowerCase();H=(k??[]).filter(w=>w.name.toLowerCase().includes(h)),e[50]=k,e[51]=o,e[52]=H}else H=e[52];let Ne=H,fe;return e[53]!==L||e[54]!==se||e[55]!==b||e[56]!==S||e[57]!==Ne||e[58]!==re||e[59]!==W||e[60]!==B||e[61]!==J||e[62]!==k||e[63]!==E||e[64]!==O||e[65]!==d||e[66]!==I||e[67]!==g||e[68]!==o||e[69]!==i||e[70]!==j||e[71]!==ce||e[72]!==a?(fe={columns:L,diagramTables:se,error:b,expanded:S,filteredGlobalTables:Ne,filteredTables:re,globalColumns:W,globalError:B,globalExpanded:J,globalTables:k,indexes:E,refresh:O,setShardKey:d,setTableFilter:p,setView:m,shardColumnsError:I,shardKey:g,tableFilter:o,tables:i,toggle:j,toggleGlobal:ce,view:a},e[53]=L,e[54]=se,e[55]=b,e[56]=S,e[57]=Ne,e[58]=re,e[59]=W,e[60]=B,e[61]=J,e[62]=k,e[63]=E,e[64]=O,e[65]=d,e[66]=I,e[67]=g,e[68]=o,e[69]=i,e[70]=j,e[71]=ce,e[72]=a,e[73]=fe):fe=e[73],fe},"ct");function ut(s){let{columns:e,refs:u,table:n}=s;return[n,e.map(l=>{let a=u[l];return a===void 0?{name:l,optional:!1,type:""}:{name:l,optional:!1,ref:a,type:"id"}})]}r(ut,"mt");function ht(s){return s.name}r(ht,"ut");function pt(s){return s.name}r(pt,"ft");var bt="/__lunora/schema-edit",ft=r(async s=>{let e=await fetch(bt,{body:JSON.stringify(s),headers:{"Content-Type":"application/json","X-Lunora-Studio":"1"},method:"POST"}),u=await e.json();return u.needsMigration===!0?{kind:"needs-migration",message:u.message??"This edit needs a migration."}:e.ok&&u.tables!==void 0?{diagnostics:u.diagnostics??[],kind:"ok",tables:u.tables}:{kind:"error",message:u.error??`schema edit failed (${String(e.status)})`}},"pt"),gt=r(s=>{let e=(0,Ce.c)(32),{hasTables:u,mode:n,onAddColumn:l,onAddIndex:a,onAddTable:m,onDestructive:c}=s,d=Fe(),g=n==="addTable"?"default":"outline",o;e[0]!==d?(o=d("Add table"),e[0]=d,e[1]=o):o=e[1];let p;e[2]!==m||e[3]!==g||e[4]!==o?(p=(0,t.jsx)(me,{"data-testid":"sc-editor-add-table",onClick:m,size:"xs",type:"button",variant:g,children:o}),e[2]=m,e[3]=g,e[4]=o,e[5]=p):p=e[5];let i=!u,v=n==="addColumn"?"default":"outline",b;e[6]!==d?(b=d("Add column"),e[6]=d,e[7]=b):b=e[7];let P;e[8]!==l||e[9]!==i||e[10]!==v||e[11]!==b?(P=(0,t.jsx)(me,{"data-testid":"sc-editor-add-column",disabled:i,onClick:l,size:"xs",type:"button",variant:v,children:b}),e[8]=l,e[9]=i,e[10]=v,e[11]=b,e[12]=P):P=e[12];let _=!u,L=n==="addIndex"?"default":"outline",y;e[13]!==d?(y=d("Add index"),e[13]=d,e[14]=y):y=e[14];let G;e[15]!==a||e[16]!==y||e[17]!==_||e[18]!==L?(G=(0,t.jsx)(me,{"data-testid":"sc-editor-add-index",disabled:_,onClick:a,size:"xs",type:"button",variant:L,children:y}),e[15]=a,e[16]=y,e[17]=_,e[18]=L,e[19]=G):G=e[19];let E=!u,M=n==="destructive"?"default":"ghost",S;e[20]!==d?(S=d("Rename / drop / change type\u2026"),e[20]=d,e[21]=S):S=e[21];let C;e[22]!==c||e[23]!==E||e[24]!==M||e[25]!==S?(C=(0,t.jsx)(me,{"data-testid":"sc-editor-destructive",disabled:E,onClick:c,size:"xs",type:"button",variant:M,children:S}),e[22]=c,e[23]=E,e[24]=M,e[25]=S,e[26]=C):C=e[26];let F;return e[27]!==G||e[28]!==C||e[29]!==p||e[30]!==P?(F=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[p,P,G,C]}),e[27]=G,e[28]=C,e[29]=p,e[30]=P,e[31]=F):F=e[31],F},"gt"),xt=r(s=>{let e=(0,Ce.c)(28),{onOpenMigrations:u,result:n}=s,l=Fe();if(n===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[0]=o):o=e[0],o}if(n.kind==="error"){let o;return e[1]!==n.message?(o=(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:n.message}),e[1]=n.message,e[2]=o):o=e[2],o}if(n.kind==="needs-migration"){let o;e[3]!==n.message||e[4]!==l?(o=n.message===""?l("This edit changes stored data and must go through a migration. Review the migration before applying."):n.message,e[3]=n.message,e[4]=l,e[5]=o):o=e[5];let p;e[6]!==o?(p=(0,t.jsx)("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=p):p=e[7];let i;e[8]!==l?(i=l("Open Migrations"),e[8]=l,e[9]=i):i=e[9];let v;e[10]!==u||e[11]!==i?(v=(0,t.jsx)(me,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:u,size:"xs",type:"button",variant:"outline",children:i}),e[10]=u,e[11]=i,e[12]=v):v=e[12];let b;return e[13]!==p||e[14]!==v?(b=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[p,v]}),e[13]=p,e[14]=v,e[15]=b):b=e[15],b}if(n.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(t.Fragment,{}),e[16]=o):o=e[16],o}let a;e[17]!==l?(a=l("Codegen reported diagnostics:"),e[17]=l,e[18]=a):a=e[18];let m;e[19]!==a?(m=(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:a}),e[19]=a,e[20]=m):m=e[20];let c;e[21]!==n.diagnostics?(c=n.diagnostics.map(vt),e[21]=n.diagnostics,e[22]=c):c=e[22];let d;e[23]!==c?(d=(0,t.jsx)("ul",{className:"flex flex-col gap-0.5",children:c}),e[23]=c,e[24]=d):d=e[24];let g;return e[25]!==m||e[26]!==d?(g=(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[m,d]}),e[25]=m,e[26]=d,e[27]=g):g=e[27],g},"bt");function vt(s){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:s},s)}r(vt,"xt");var yt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.int64()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],Nt="v.string()",Ct=r(s=>s.split(",").map(e=>e.trim()).filter(e=>e!==""),"Ct"),wt=r(s=>{let e=(0,Ce.c)(83),{onApplied:u,tableNames:n}=s,l=Fe(),a=Ue(),[m,c]=(0,x.useState)(null),[d,g]=(0,x.useState)(!1),[o,p]=(0,x.useState)(null),[i,v]=(0,x.useState)(""),[b,P]=(0,x.useState)(""),[_,L]=(0,x.useState)(Nt),[y,G]=(0,x.useState)(n[0]??""),[E,M]=(0,x.useState)(""),[S,C]=(0,x.useState)(""),[F,$]=(0,x.useState)(!1),he;e[0]===Symbol.for("react.memo_cache_sentinel")?(he=r(()=>{c(null),v(""),P(""),M(""),C(""),$(!1)},"me"),e[0]=he):he=e[0];let Q=he,I;e[1]!==u?(I=r(async T=>{g(!0),p(null);try{let ge=await ft(T);p(ge),ge.kind==="ok"&&(u(ge.tables),Q())}catch(ge){let Ie=ge;p({kind:"error",message:Ie instanceof Error?Ie.message:String(Ie)})}g(!1)},"I"),e[1]=u,e[2]=I):I=e[2];let K=I,k;e[3]!==K||e[4]!==i?(k=r(()=>{ue(K({kind:"addTable",table:i.trim()}))},"_"),e[3]=K,e[4]=i,e[5]=k):k=e[5];let pe=k,B;e[6]!==b||e[7]!==K||e[8]!==y||e[9]!==_?(B=r(()=>{ue(K({column:b.trim(),kind:"addOptionalColumn",table:y,validator:_}))},"j"),e[6]=b,e[7]=K,e[8]=y,e[9]=_,e[10]=B):B=e[10];let oe=B,Y;e[11]!==S||e[12]!==E||e[13]!==K||e[14]!==y||e[15]!==F?(Y=r(()=>{ue(K({fields:Ct(S),kind:"addIndex",name:E.trim(),table:y,unique:F}))},"Q"),e[11]=S,e[12]=E,e[13]=K,e[14]=y,e[15]=F,e[16]=Y):Y=e[16];let W=Y,xe;e[17]===Symbol.for("react.memo_cache_sentinel")?(xe=r(()=>{p(null),c("addTable")},"xe"),e[17]=xe):xe=e[17];let J=xe,ie;e[18]===Symbol.for("react.memo_cache_sentinel")?(ie=r(()=>{p(null),c("addColumn")},"re"),e[18]=ie):ie=e[18];let ve=ie,O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=r(()=>{p(null),c("addIndex")},"O"),e[19]=O):O=e[19];let Z=O,ee;e[20]!==l?(ee=r(()=>{c("destructive"),p({kind:"needs-migration",message:l("This edit changes stored data and must go through a migration. Review the migration before applying.")})},"ee"),e[20]=l,e[21]=ee):ee=e[21];let de=ee,D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=r(T=>{v(T.target.value)},"R"),e[22]=D):D=e[22];let te=D,j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=r(T=>{P(T.target.value)},"M"),e[23]=j):j=e[23];let ye=j,ce;e[24]===Symbol.for("react.memo_cache_sentinel")?(ce=r(T=>{L(T.target.value)},"ce"),e[24]=ce):ce=e[24];let be=ce,R;e[25]===Symbol.for("react.memo_cache_sentinel")?(R=r(T=>{G(T.target.value)},"K"),e[25]=R):R=e[25];let X=R,V;e[26]===Symbol.for("react.memo_cache_sentinel")?(V=r(T=>{M(T.target.value)},"U"),e[26]=V):V=e[26];let le=V,U;e[27]===Symbol.for("react.memo_cache_sentinel")?(U=r(T=>{C(T.target.value)},"V"),e[27]=U):U=e[27];let ae=U,z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=r(T=>{$(T.target.checked)},"$"),e[28]=z):z=e[28];let ne=z,se;e[29]!==a?(se=r(()=>{ue(a({to:"/migrations"}))},"ne"),e[29]=a,e[30]=se):se=e[30];let f=se,re;e[31]!==l?(re=l("Edit schema"),e[31]=l,e[32]=re):re=e[32];let H;e[33]!==re?(H=(0,t.jsx)(Ge,{children:re}),e[33]=re,e[34]=H):H=e[34];let Ne;e[35]!==l?(Ne=l("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=l,e[36]=Ne):Ne=e[36];let fe;e[37]!==Ne?(fe=(0,t.jsx)(Ke,{children:Ne}),e[37]=Ne,e[38]=fe):fe=e[38];let h;e[39]!==H||e[40]!==fe?(h=(0,t.jsxs)(Pe,{children:[H,fe]}),e[39]=H,e[40]=fe,e[41]=h):h=e[41];let w=n.length>0,N;e[42]!==m||e[43]!==de||e[44]!==w?(N=(0,t.jsx)(gt,{hasTables:w,mode:m,onAddColumn:ve,onAddIndex:Z,onAddTable:J,onDestructive:de}),e[42]=m,e[43]=de,e[44]=w,e[45]=N):N=e[45];let q;e[46]!==d||e[47]!==m||e[48]!==pe||e[49]!==l||e[50]!==i?(q=m==="addTable"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-table-name",children:l("Table name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:te,value:i})]}),(0,t.jsx)(me,{"data-testid":"sc-editor-table-apply",disabled:d||i.trim()==="",onClick:pe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[46]=d,e[47]=m,e[48]=pe,e[49]=l,e[50]=i,e[51]=q):q=e[51];let A;e[52]!==d||e[53]!==b||e[54]!==m||e[55]!==oe||e[56]!==l||e[57]!==n||e[58]!==y||e[59]!==_?(A=m==="addColumn"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:X,value:y,children:n.map(Tt)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-name",children:l("Column name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:ye,value:b})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-column-type",children:l("Column type")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:be,value:_,children:yt.map(St)})]}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:l("Optional")}),(0,t.jsx)(me,{"data-testid":"sc-editor-column-apply",disabled:d||b.trim()===""||y==="",onClick:oe,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[52]=d,e[53]=b,e[54]=m,e[55]=oe,e[56]=l,e[57]=n,e[58]=y,e[59]=_,e[60]=A):A=e[60];let Te;e[61]!==d||e[62]!==S||e[63]!==E||e[64]!==m||e[65]!==W||e[66]!==l||e[67]!==n||e[68]!==y||e[69]!==F?(Te=m==="addIndex"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-table",children:l("Table name")}),(0,t.jsx)("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:X,value:y,children:n.map(_t)})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-name",children:l("Index name")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:le,value:E})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(we,{htmlFor:"sc-editor-index-fields",children:l("Index fields (comma-separated)")}),(0,t.jsx)(Ae,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:ae,value:S})]}),(0,t.jsxs)(we,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[(0,t.jsx)("input",{checked:F,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:ne,type:"checkbox"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:l("Unique")})]}),(0,t.jsx)(me,{"data-testid":"sc-editor-index-apply",disabled:d||E.trim()===""||S.trim()==="",onClick:W,size:"xs",type:"button",children:l(d?"Applying\u2026":"Apply")}),(0,t.jsx)(me,{onClick:Q,size:"xs",type:"button",variant:"ghost",children:l("Cancel")})]}),e[61]=d,e[62]=S,e[63]=E,e[64]=m,e[65]=W,e[66]=l,e[67]=n,e[68]=y,e[69]=F,e[70]=Te):Te=e[70];let Se;e[71]!==f||e[72]!==o?(Se=(0,t.jsx)(xt,{onOpenMigrations:f,result:o}),e[71]=f,e[72]=o,e[73]=Se):Se=e[73];let _e;e[74]!==N||e[75]!==q||e[76]!==A||e[77]!==Te||e[78]!==Se?(_e=(0,t.jsxs)(Le,{children:[N,q,A,Te,Se]}),e[74]=N,e[75]=q,e[76]=A,e[77]=Te,e[78]=Se,e[79]=_e):_e=e[79];let ke;return e[80]!==h||e[81]!==_e?(ke=(0,t.jsxs)(qe,{"data-testid":"sc-editor",size:"sm",children:[h,_e]}),e[80]=h,e[81]=_e,e[82]=ke):ke=e[82],ke},"Nt");function Tt(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(Tt,"Tt");function St(s){return(0,t.jsx)("option",{value:s.validator,children:s.label},s.validator)}r(St,"St");function _t(s){return(0,t.jsx)("option",{value:s,children:s},s)}r(_t,"wt");var Ze=[],kt=r(s=>{let e=(0,Ce.c)(5),{open:u}=s,n=u&&"rotate-90",l;e[0]!==n?(l=De("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",n),e[0]=n,e[1]=l):l=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[2]=a):a=e[2];let m;return e[3]!==l?(m=(0,t.jsx)("svg",{"aria-hidden":"true",className:l,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a}),e[3]=l,e[4]=m):m=e[4],m},"_t"),et=r(s=>{let e=(0,Ce.c)(20),{children:u,expanded:n,name:l,onToggle:a,rowCount:m,rowTestId:c,toggleTestId:d}=s,g;e[0]!==n?(g=(0,t.jsx)(kt,{open:n}),e[0]=n,e[1]=g):g=e[1];let o;e[2]!==l?(o=(0,t.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:l,children:l}),e[2]=l,e[3]=o):o=e[3];let p;e[4]!==m?(p=(0,t.jsxs)("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",m,")"]}),e[4]=m,e[5]=p):p=e[5];let i;e[6]!==n||e[7]!==a||e[8]!==g||e[9]!==o||e[10]!==p||e[11]!==d?(i=(0,t.jsxs)("button",{"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":d,onClick:a,type:"button",children:[g,o," ",p]}),e[6]=n,e[7]=a,e[8]=g,e[9]=o,e[10]=p,e[11]=d,e[12]=i):i=e[12];let v;e[13]!==u||e[14]!==n?(v=n&&(0,t.jsx)("div",{className:"px-3 pb-3 ps-8",children:u}),e[13]=u,e[14]=n,e[15]=v):v=e[15];let b;return e[16]!==c||e[17]!==i||e[18]!==v?(b=(0,t.jsxs)("li",{className:"border-t border-border/60 first:border-t-0","data-testid":c,children:[i,v]}),e[16]=c,e[17]=i,e[18]=v,e[19]=b):b=e[19],b},"Ye"),tt=r(s=>{let e=(0,Ce.c)(5),{columns:u,testId:n}=s,l;e[0]!==u?(l=u.map(At),e[0]=u,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==n?(a=(0,t.jsx)("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":n,children:l}),e[2]=l,e[3]=n,e[4]=a):a=e[4],a},"He"),It=r(s=>{let e=(0,Ce.c)(10),{heading:u,indexes:n,testId:l}=s,a;e[0]!==u?(a=(0,t.jsx)("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=a):a=e[1];let m;e[2]!==n?(m=n.map(Ft),e[2]=n,e[3]=m):m=e[3];let c;e[4]!==m||e[5]!==l?(c=(0,t.jsx)("ul",{className:"flex flex-col gap-1","data-testid":l,children:m}),e[4]=m,e[5]=l,e[6]=c):c=e[6];let d;return e[7]!==a||e[8]!==c?(d=(0,t.jsxs)("div",{className:"pt-3",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9],d},"Et"),lt=r(s=>De("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",s?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Xe"),Xt=r(s=>{let e=(0,Ce.c)(85),{initialShardKey:u,initialTable:n,schemaEditable:l}=s,a=Fe(),m;e[0]!==u||e[1]!==n?(m={initialShardKey:u,initialTable:n},e[0]=u,e[1]=n,e[2]=m):m=e[2];let{columns:c,diagramTables:d,error:g,expanded:o,filteredGlobalTables:p,filteredTables:i,globalColumns:v,globalError:b,globalExpanded:P,globalTables:_,indexes:L,refresh:y,setShardKey:G,setTableFilter:E,setView:M,shardColumnsError:S,shardKey:C,tableFilter:F,tables:$,toggle:he,toggleGlobal:Q,view:I}=mt(m),K;e[3]!==M?(K=r(()=>{M("list")},"q"),e[3]=M,e[4]=K):K=e[4];let k=K,pe;e[5]!==M?(pe=r(()=>{M("graph")},"ue"),e[5]=M,e[6]=pe):pe=e[6];let B=pe,oe;e[7]!==E?(oe=r(f=>{E(f.target.value)},"ie"),e[7]=E,e[8]=oe):oe=e[8];let Y=oe,W;e[9]!==y||e[10]!==C?(W=r(f=>{ue(y(C))},"Y"),e[9]=y,e[10]=C,e[11]=W):W=e[11];let xe=W,J;e[12]!==$?(J=$??[],e[12]=$,e[13]=J):J=e[13];let ie;e[14]!==J?(ie=J.map(zt),e[14]=J,e[15]=ie):ie=e[15];let ve=ie,O;e[16]!==G||e[17]!==C?(O=(0,t.jsx)(Xe,{onChange:G,testId:"sc-shard-input",value:C}),e[16]=G,e[17]=C,e[18]=O):O=e[18];let Z;e[19]!==a?(Z=a("Schema view"),e[19]=a,e[20]=Z):Z=e[20];let ee=I==="graph",de=I==="graph",D;e[21]!==de?(D=lt(de),e[21]=de,e[22]=D):D=e[22];let te;e[23]!==a?(te=a("Graph"),e[23]=a,e[24]=te):te=e[24];let j;e[25]!==B||e[26]!==ee||e[27]!==D||e[28]!==te?(j=(0,t.jsx)("button",{"aria-selected":ee,className:D,"data-testid":"sc-view-graph",onClick:B,role:"tab",type:"button",children:te}),e[25]=B,e[26]=ee,e[27]=D,e[28]=te,e[29]=j):j=e[29];let ye=I==="list",ce=I==="list",be;e[30]!==ce?(be=lt(ce),e[30]=ce,e[31]=be):be=e[31];let R;e[32]!==a?(R=a("Table list"),e[32]=a,e[33]=R):R=e[33];let X;e[34]!==k||e[35]!==ye||e[36]!==be||e[37]!==R?(X=(0,t.jsx)("button",{"aria-selected":ye,className:be,"data-testid":"sc-view-list",onClick:k,role:"tab",type:"button",children:R}),e[34]=k,e[35]=ye,e[36]=be,e[37]=R,e[38]=X):X=e[38];let V;e[39]!==j||e[40]!==X||e[41]!==Z?(V=(0,t.jsxs)("div",{"aria-label":Z,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[j,X]}),e[39]=j,e[40]=X,e[41]=Z,e[42]=V):V=e[42];let le;e[43]!==V||e[44]!==O?(le=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[O,V]}),e[43]=V,e[44]=O,e[45]=le):le=e[45];let U;e[46]!==xe||e[47]!==l||e[48]!==ve?(U=l===!0&&(0,t.jsx)(wt,{onApplied:xe,tableNames:ve}),e[46]=xe,e[47]=l,e[48]=ve,e[49]=U):U=e[49];let ae;e[50]!==Y||e[51]!==a||e[52]!==F||e[53]!==I?(ae=I==="list"&&(0,t.jsx)(Ae,{"aria-label":a("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:Y,placeholder:a("Filter tables"),value:F}),e[50]=Y,e[51]=a,e[52]=F,e[53]=I,e[54]=ae):ae=e[54];let z;e[55]!==d||e[56]!==g||e[57]!==b||e[58]!==S||e[59]!==C||e[60]!==I?(z=I==="graph"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:b}),(0,t.jsx)(Qe,{columnsError:S[C]===!0,tables:d,testIdPrefix:"sc-graph"})]}),e[55]=d,e[56]=g,e[57]=b,e[58]=S,e[59]=C,e[60]=I,e[61]=z):z=e[61];let ne;e[62]!==c||e[63]!==g||e[64]!==o||e[65]!==p||e[66]!==i||e[67]!==v||e[68]!==b||e[69]!==P||e[70]!==_||e[71]!==L||e[72]!==C||e[73]!==a||e[74]!==$||e[75]!==he||e[76]!==Q||e[77]!==I?(ne=I==="list"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)(qe,{"data-testid":"sc-shard-section",size:"sm",children:[(0,t.jsxs)(Pe,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"shard"}),(0,t.jsx)(Ge,{children:a("Shard tables")}),$!==null&&(0,t.jsx)(ze,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),(0,t.jsx)(Ke,{children:Me.shard.hint})]}),(0,t.jsxs)(Le,{children:[g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:g}),$!==null&&$.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:a("No tables in this shard.")}),$!==null&&$.length>0&&i.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:a("No tables match your filter.")}),i.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(f=>{let re=`${C}:${f.name}`,H=L[re]??[];return(0,t.jsxs)(et,{expanded:o===f.name,name:f.name,onToggle:r(()=>{ue(he(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-table-${f.name}`,toggleTestId:`sc-toggle-${f.name}`,children:[(0,t.jsx)(tt,{columns:c[re]??Ze,testId:`sc-columns-${f.name}`}),H.length>0&&(0,t.jsx)(It,{heading:a("Indexes"),indexes:H,testId:`sc-indexes-${f.name}`})]},f.name)})})]})]}),(0,t.jsxs)(qe,{"data-testid":"sc-global-section",size:"sm",children:[(0,t.jsxs)(Pe,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Re,{tier:"global"}),(0,t.jsx)(Ge,{children:a("Global tables (D1)")}),_!==null&&(0,t.jsx)(ze,{className:"ms-auto tabular-nums",variant:"outline",children:p.length})]}),(0,t.jsx)(Ke,{children:Me.global.hint})]}),(0,t.jsxs)(Le,{children:[b!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:b}),_!==null&&_.length===0&&(0,t.jsx)(We,{description:Me.global.hint,testId:"sc-global-empty",title:a("No global tables.")}),_!==null&&_.length>0&&p.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:a("No tables match your filter.")}),p.length>0&&(0,t.jsx)("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:p.map(f=>(0,t.jsx)(et,{expanded:P===f.name,name:f.name,onToggle:r(()=>{ue(Q(f.name))},"onToggle"),rowCount:f.rowCount,rowTestId:`sc-global-table-${f.name}`,toggleTestId:`sc-global-toggle-${f.name}`,children:(0,t.jsx)(tt,{columns:v[f.name]??Ze,testId:`sc-global-columns-${f.name}`})},f.name))})]})]})]}),e[62]=c,e[63]=g,e[64]=o,e[65]=p,e[66]=i,e[67]=v,e[68]=b,e[69]=P,e[70]=_,e[71]=L,e[72]=C,e[73]=a,e[74]=$,e[75]=he,e[76]=Q,e[77]=I,e[78]=ne):ne=e[78];let se;return e[79]!==le||e[80]!==U||e[81]!==ae||e[82]!==z||e[83]!==ne?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[le,U,ae,z,ne]}),e[79]=le,e[80]=U,e[81]=ae,e[82]=z,e[83]=ne,e[84]=se):se=e[84],se},"Wt");function At(s){return(0,t.jsx)("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:s},s)}r(At,"It");function Ft(s){return(0,t.jsxs)("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[(0,t.jsx)("span",{className:"font-mono",children:s.name}),(0,t.jsx)(ze,{variant:"outline",children:s.type}),s.unique===!0&&(0,t.jsx)(ze,{variant:"secondary",children:"unique"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:s.fields.join(", ")})]},`${s.type}:${s.name}`)}r(Ft,"kt");function zt(s){return s.name}r(zt,"At");export{Xt as SchemaViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as y}from"./chunk-
|
|
1
|
+
import{b as u}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as y}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as N}from"./chunk-DZGOHOOE.js";import{c as v}from"./chunk-4U5PYZLE.js";import"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as g}from"./chunk-UANVABQG.js";import{a as w,b,c as S,d as c,e as s,f as o}from"./chunk-L4EZAHCD.js";import{a as f,e as x}from"./chunk-IYWVSMAY.js";import{d as p}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as n,d as R,g as T}from"./chunk-R5ZTCHCE.js";var e=R(T(),1);var $={active:"default",failing:"destructive",idle:"secondary"},j=n(a=>a===void 0?"\u2014":`${new Date(a).toISOString().slice(0,19).replace("T"," ")} UTC`,"I"),U=n(a=>{let t=a.runs+a.suppressed;return t===0?void 0:Math.round(a.suppressed/t*100)},"$"),F=n(({initialShardKey:a=""})=>{let t=p(),{data:l,error:E,errorSource:A,liveError:I}=v(N.listReactors,{},{live:!0,shardKey:a}),C=l!==void 0,i=Array.isArray(l?.reactors)?l.reactors:[],d;C&&i.length===0?d=(0,e.jsx)(g,{description:t("No reactor is declared in this deployment. Export an onQueryChange(select, handler) from lunora/ to run server-side logic when a query's result changes."),testId:"reactors-empty",title:t("No reactors declared")}):d=(0,e.jsx)(f,{className:"overflow-hidden py-0",children:(0,e.jsx)(x,{className:"px-0",children:(0,e.jsxs)(w,{"data-testid":"reactors-table",children:[(0,e.jsx)(b,{children:(0,e.jsxs)(c,{children:[(0,e.jsx)(s,{children:t("Reactor")}),(0,e.jsx)(s,{children:t("State")}),(0,e.jsx)(s,{children:t("Ran")}),(0,e.jsx)(s,{children:t("Suppressed")}),(0,e.jsx)(s,{children:t("Errors")}),(0,e.jsx)(s,{children:t("Watches")}),(0,e.jsx)(s,{children:t("Last dispatch")})]})}),(0,e.jsx)(S,{children:i.map(r=>{let m=U(r);return(0,e.jsxs)(c,{"data-testid":`reactors-row-${r.path}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:r.path}),(0,e.jsx)(o,{children:(0,e.jsx)(u,{"data-testid":`reactors-state-${r.path}`,variant:$[r.state],children:r.state})}),(0,e.jsx)(o,{className:"font-mono text-xs",children:r.runs}),(0,e.jsxs)(o,{className:"font-mono text-xs text-muted-foreground",children:[r.suppressed,m===void 0?"":` (${String(m)}%)`]}),(0,e.jsx)(o,{className:"font-mono text-xs",children:r.errors===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"0"}):(0,e.jsx)("span",{className:"text-destructive",children:r.errors})}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:r.tables===void 0||r.tables.length===0?"\u2014":r.tables.join(", ")}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:j(r.lastRanAt)})]},r.path)})})]})})});let h=i.filter(r=>r.state==="failing");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-reactors-panel",children:[E!==null&&(0,e.jsx)(y,{error:A,testId:"reactors-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("A reactor runs after a write flush, but only when the result of the query it watches actually changed \u2014 a trigger fires on a row write, a reactor fires on a result changing. Suppressed dispatches are the ones where the read re-ran and nothing had moved.")}),h.length>0&&(0,e.jsx)("div",{className:"flex flex-col gap-2","data-testid":"reactors-failing",children:h.map(r=>(0,e.jsxs)("p",{className:"text-xs text-destructive",role:"alert",children:[(0,e.jsx)("span",{className:"font-mono",children:r.path}),": ",r.lastError??t("last dispatch failed")]},r.path))}),I!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"reactors-live-error",role:"alert",children:t("Live updates unavailable; showing the last reading.")}),d]})},"U");export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as R}from"./chunk-
|
|
1
|
+
import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as R}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as v}from"./chunk-DZGOHOOE.js";import{c as $}from"./chunk-4U5PYZLE.js";import"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as S}from"./chunk-UANVABQG.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-L4EZAHCD.js";import{a as k,e as w}from"./chunk-IYWVSMAY.js";import{d as N}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as f,d as b,f as E,g as O}from"./chunk-R5ZTCHCE.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-VR3UJA7B.js";import"./chunk-AFKLFS74.js";import"./chunk-CP4ZFBVW.js";import{a as Ve}from"./chunk-V6QPVFDL.js";import{a as qe}from"./chunk-JURAVSE7.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as Le}from"./chunk-CKTKI4IY.js";import{a as _e}from"./chunk-TB5N24CM.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as ke}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as ie}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as me}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import"./chunk-F7JOSNAT.js";import{a as U}from"./chunk-DZGOHOOE.js";import{c as Ee}from"./chunk-PSPJORP6.js";import{f as Ne}from"./chunk-OEGE3YDK.js";import"./chunk-RCZTUWG3.js";import{a as Ae}from"./chunk-UANVABQG.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-L4EZAHCD.js";import{a as Me,e as Ce}from"./chunk-IYWVSMAY.js";import{d as ue,f as re,g as be,h as Ke,o as le,r as Te}from"./chunk-6ZPTNC34.js";import{a as Ie,b as $e}from"./chunk-FDLSPDIC.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-R5ZTCHCE.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(z,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(z,{children:(0,t.jsx)(ke,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==I||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ee(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,V)=>{L(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let I;e[32]!==g?(I=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(je,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
|
|
1
|
+
import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-VR3UJA7B.js";import"./chunk-AFKLFS74.js";import"./chunk-CP4ZFBVW.js";import{a as Ve}from"./chunk-V6QPVFDL.js";import{a as qe}from"./chunk-JURAVSE7.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as Le}from"./chunk-CKTKI4IY.js";import{a as _e}from"./chunk-TB5N24CM.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as ke}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as ie}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as me}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import"./chunk-F7JOSNAT.js";import{a as U}from"./chunk-DZGOHOOE.js";import{c as Ee}from"./chunk-4U5PYZLE.js";import{f as Ne}from"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as Ae}from"./chunk-UANVABQG.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-L4EZAHCD.js";import{a as Me,e as Ce}from"./chunk-IYWVSMAY.js";import{d as ue,f as re,g as be,h as Ke,o as le,r as Te}from"./chunk-6ZPTNC34.js";import{a as Ie,b as $e}from"./chunk-3KLX63D7.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-R5ZTCHCE.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(z,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(z,{children:(0,t.jsx)(ke,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==I||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ee(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,V)=>{L(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let I;e[32]!==g?(I=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(je,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as fe}from"./chunk-CYX3OHJ3.js";import"./chunk-AFKLFS74.js";import{a as ie}from"./chunk-CN2AINNY.js";import{a as pe}from"./chunk-WUW4ZHRL.js";import"./chunk-DUDQV6XJ.js";import{P as de}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as x}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ne}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as he}from"./chunk-
|
|
1
|
+
import{a as fe}from"./chunk-CYX3OHJ3.js";import"./chunk-AFKLFS74.js";import{a as ie}from"./chunk-CN2AINNY.js";import{a as pe}from"./chunk-WUW4ZHRL.js";import"./chunk-DUDQV6XJ.js";import{P as de}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as x}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ne}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as he}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as H}from"./chunk-DZGOHOOE.js";import{c as ue}from"./chunk-4U5PYZLE.js";import{f as le}from"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as ce}from"./chunk-UANVABQG.js";import{d as oe,f as Z,g as ee,h as te,o as ae,q as me,r as re}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as i,d as Y,e as ge,f as ve,g as Ne,i as se}from"./chunk-R5ZTCHCE.js";var t=Y(Ne(),1);var xe=Y(ve(),1);var N=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:se("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}i(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,be=i(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),y=i(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"N"),Ce=i(a=>{if(a!==void 0)return be(a.html)??be(a.text)},"Ne"),ke=i((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${y(o.to)} ${y(o.cc)}`.toLowerCase().includes(s))},"we"),Se=i((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"ye"),Te=Z(H.clearCapturedMail),Le=Z(H.sendTestMail),je=i(a=>{let e=(0,xe.c)(38),{limit:s}=a,o=le(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:q,error:w,errorSource:C,isLoading:g,refetch:n}=ue(H.getCapturedMail,p),[k,f]=(0,N.useState)(null),[D,S]=(0,N.useState)(null),[v,l]=(0,N.useState)("html"),[c,P]=(0,N.useState)(""),b=q?.entries??[],r=w??k,u=w===null?k:C,T;e[2]!==o||e[3]!==n?(T=i(async()=>{f(null);try{await o.query(Te,{},ee("")),S(null),n()}catch(m){f(te(m))}},"T"),e[2]=o,e[3]=n,e[4]=T):T=e[4];let R=T,L;e[5]!==o||e[6]!==n?(L=i(async()=>{f(null);try{await o.query(Le,{},ee("")),n()}catch(m){f(te(m))}},"k"),e[5]=o,e[6]=n,e[7]=L):L=e[7];let W=L,j;e[8]!==n?(j=i(()=>{n()},"L"),e[8]=n,e[9]=j):j=e[9],pe(j,!0);let M;e[10]!==R?(M=i(()=>{ae(R())},"A"),e[10]=R,e[11]=M):M=e[11];let U=M,_;e[12]!==W?(_=i(()=>{ae(W())},"E"),e[12]=W,e[13]=_):_=e[13];let G=_,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=i(m=>{P(m.currentTarget.value)},"_"),e[14]=z):z=e[14];let J=z,$;e[15]===Symbol.for("react.memo_cache_sentinel")?($=i(m=>{let{id:h}=m.currentTarget.dataset;h!==void 0&&S(h)},"M"),e[15]=$):$=e[15];let K=$,A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{let h=m.currentTarget.dataset.tab;(h==="headers"||h==="html"||h==="text")&&l(h)},"j"),e[16]=A):A=e[16];let Q=A,F=ke(b,c),O=Se(F,D),d=Ce(O),I;e[17]!==d?(I=i(()=>{d!==void 0&&me(d)},"z"),e[17]=d,e[18]=I):I=e[18];let V=I,B;e[19]!==d?(B=i(()=>{d!==void 0&&"window"in globalThis&&globalThis.window.open(d,"_blank","noopener")},"F"),e[19]=d,e[20]=B):B=e[20];let X=B,E;return e[21]!==b||e[22]!==r||e[23]!==u||e[24]!==c||e[25]!==g||e[26]!==d||e[27]!==U||e[28]!==V||e[29]!==J||e[30]!==X||e[31]!==K||e[32]!==Q||e[33]!==G||e[34]!==O||e[35]!==v||e[36]!==F?(E={entries:b,error:r,errorSource:u,filter:c,isLoading:g,link:d,onClear:U,onCopyLink:V,onFilterChange:J,onOpenLink:X,onSelectMessage:K,onSelectTab:Q,onSendTest:G,selected:O,tab:v,visible:F},e[21]=b,e[22]=r,e[23]=u,e[24]=c,e[25]=g,e[26]=d,e[27]=U,e[28]=V,e[29]=J,e[30]=X,e[31]=K,e[32]=Q,e[33]=G,e[34]=O,e[35]=v,e[36]=F,e[37]=E):E=e[37],E},"Te"),Me=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,_e=i(a=>`${Me}${a}`,"Le"),Je=i(({limit:a=100})=>{let e=oe(),{entries:s,error:o,errorSource:p,filter:q,isLoading:w,link:C,onClear:g,onCopyLink:n,onFilterChange:k,onOpenLink:f,onSelectMessage:D,onSelectTab:S,onSendTest:v,selected:l,tab:c,visible:P}=je({limit:a}),b=i(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"b");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(x,{"data-testid":"mail-send-test",onClick:v,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(x,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(ne,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(he,{error:p,testId:"mail-error"}),o===null&&!w&&s.length===0&&(0,t.jsx)(ce,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(de,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:k,placeholder:e("Filter messages"),type:"search",value:q}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:P.map(r=>{let u=r.id===l?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${u?"bg-muted":""}`,"data-active":u,"data-id":r.id,"data-testid":"mail-list-item",onClick:D,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:y(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),l!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:l.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:l.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.to)}),l.cc!==void 0&&l.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(l.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(x,{"data-testid":"mail-copy-link",disabled:C===void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(x,{"data-testid":"mail-open-link",disabled:C===void 0,onClick:f,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(x,{"aria-selected":c===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:S,role:"tab",size:"sm",type:"button",variant:c===r?"secondary":"ghost",children:b(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[c==="html"&&(l.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:_e(l.html),title:e("Email preview")})),c==="text"&&(l.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:l.text})),c==="headers"&&(l.headers===void 0||Object.keys(l.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(l.headers).map(([r,u])=>`${r}: ${u}`).join(`
|
|
2
2
|
`)}))]})]})]})]})},"We");export{Je as MailPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as R}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as B}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as S}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as q}from"./chunk-
|
|
1
|
+
import{P as R}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as B}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as S}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as q}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as U}from"./chunk-DZGOHOOE.js";import{c as O}from"./chunk-4U5PYZLE.js";import"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as D}from"./chunk-UANVABQG.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-L4EZAHCD.js";import{a as V,e as W}from"./chunk-IYWVSMAY.js";import{d as P,r as H}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as n,d as j,e as re,f as ae,g as ie}from"./chunk-R5ZTCHCE.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=P(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=O(U.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(R,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(D,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(V,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as W}from"./chunk-WUW4ZHRL.js";import{a as D}from"./chunk-CKTKI4IY.js";import{a as B}from"./chunk-TB5N24CM.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-XQS7KSHL.js";import{b as S}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as F}from"./chunk-
|
|
1
|
+
import{a as W}from"./chunk-WUW4ZHRL.js";import{a as D}from"./chunk-CKTKI4IY.js";import{a as B}from"./chunk-TB5N24CM.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-XQS7KSHL.js";import{b as S}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as F}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as _}from"./chunk-DZGOHOOE.js";import{c as E}from"./chunk-4U5PYZLE.js";import"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as j}from"./chunk-UANVABQG.js";import{a as L,b as O,c as P,d as C,e as h,f as p}from"./chunk-L4EZAHCD.js";import{a as T,e as $}from"./chunk-IYWVSMAY.js";import{d as M}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as N,d as A,f as H,g as J}from"./chunk-R5ZTCHCE.js";var R=A(H(),1);var t=A(J(),1);var q=80,U=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>q?`${e.slice(0,q)}\u2026`:e},"q"),Z=N(a=>{let e=[];for(let r of a){let n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((l,i)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${i.toString()}`,subscription:l})})}return e},"G"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),oe=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=M(),{queryShardKey:l,setShardKey:i,shardKey:u}=D(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==l?(b={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=b):b=e[2];let{data:s,error:o,errorSource:m,refetch:G}=E(_.listSubscriptions,f,b);W(G,!0);let x;if(e[3]!==o||e[4]!==m||e[5]!==s||e[6]!==i||e[7]!==u||e[8]!==n){let k=s===void 0?[]:Z(s.connections),c;e[10]!==i||e[11]!==u?(c=(0,t.jsx)(B,{onChange:i,testId:"subs-shard-input",value:u}),e[10]=i,e[11]=u,e[12]=c):c=e[12];let d;e[13]!==s||e[14]!==n?(d=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=d):d=e[15];let g;e[16]!==c||e[17]!==d?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[16]=c,e[17]=d,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==m?(v=o!==null&&(0,t.jsx)(F,{error:m,testId:"subs-error"}),e[19]=o,e[20]=m,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&s!==void 0&&k.length===0&&(0,t.jsx)(j,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&k.length>0&&(0,t.jsx)(T,{className:"overflow-hidden py-0",children:(0,t.jsx)($,{className:"px-0",children:(0,t.jsxs)(L,{"data-testid":"subs-table",children:[(0,t.jsx)(O,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(h,{children:n("Connection")}),(0,t.jsx)(h,{children:n("Function path")}),(0,t.jsx)(h,{children:n("Table")}),(0,t.jsx)(h,{children:n("Arguments")})]})}),(0,t.jsx)(P,{children:k.map(y=>{let{subscription:I}=y,K=U(I?.args);return(0,t.jsxs)(C,{"data-testid":"subs-row",children:[(0,t.jsx)(p,{className:"font-medium tabular-nums",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&(0,t.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,t.jsx)(p,{className:"font-mono text-xs",children:I?.functionPath??w}),(0,t.jsx)(p,{children:I?.table??w}),(0,t.jsx)(p,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:K||void 0,children:K||w})]},y.key)})})]})})})]}),e[3]=o,e[4]=m,e[5]=s,e[6]=i,e[7]=u,e[8]=n,e[9]=x}else x=e[9];return x},"oe");export{oe as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as nt}from"./chunk-TNKECJW4.js";import{e as Ve}from"./chunk-4YTSKL4R.js";import{a as Ue}from"./chunk-BWEXJENB.js";import{b as Fe}from"./chunk-SPDZUX4P.js";import{a as D}from"./chunk-DZGOHOOE.js";import{c as ke}from"./chunk-
|
|
1
|
+
import{a as nt}from"./chunk-TNKECJW4.js";import{e as Ve}from"./chunk-4YTSKL4R.js";import{a as Ue}from"./chunk-BWEXJENB.js";import{b as Fe}from"./chunk-SPDZUX4P.js";import{a as D}from"./chunk-DZGOHOOE.js";import{c as ke}from"./chunk-4U5PYZLE.js";import{f as Ee}from"./chunk-CG5OTGTR.js";import{a as Ye}from"./chunk-UANVABQG.js";import{a as T,e as He}from"./chunk-IYWVSMAY.js";import{d as $,f as Qe,g as Xe,l as et,o as Se,p as tt,q as at}from"./chunk-6ZPTNC34.js";import{a as m,d as Be,e as ct,f as dt,g as mt,i as We}from"./chunk-R5ZTCHCE.js";var S=Be(dt(),1);var I=Be(ct(),1);var n=Be(mt(),1);var ut=Qe(D.studioFeatures),it={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},pt=m(t=>{if(t===null||typeof t!="object")return it;let e=t,s=m(a=>typeof e[a]=="boolean"?e[a]:!0,"n");return{analytics:s("analytics"),auth:s("auth"),containers:s("containers"),flags:s("flags"),kv:s("kv"),mail:s("mail"),notifications:s("notifications"),payments:s("payments"),queues:s("queues"),scheduler:s("scheduler"),storage:s("storage"),vectors:s("vectors"),workflows:s("workflows")}},"mt"),ft=m(()=>{let t=(0,S.c)(3),e=Ee(),[s,a]=(0,I.useState)(it),r,l;return t[0]!==e?(r=m(()=>{Se((async()=>{try{a(pt(await e.query(ut,{},Xe(""))))}catch{}})())},"a"),l=[e],t[0]=e,t[1]=r,t[2]=l):(r=t[1],l=t[2]),(0,I.useEffect)(r,l),s},"ft"),ht=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"pt"),gt=m(t=>{let e=(0,S.c)(24),{group:s}=t,a=$(),r=Ve(),l;e[0]!==s.tab||e[1]!==r?(l=m(()=>{Se(r({to:`/${s.tab}`}))},"r"),e[0]=s.tab,e[1]=r,e[2]=l):l=e[2];let o=l,i=s.bindings.length,c;e[3]!==s.label?(c=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),e[3]=s.label,e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,n.jsx)(ht,{}),e[5]=p):p=e[5];let d;e[6]!==c?(d=(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[c,p]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==a?(f=i===1?a("1 binding"):a("{count} bindings",{count:i}),e[8]=i,e[9]=a,e[10]=f):f=e[10];let u;e[11]!==f?(u=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let h;e[13]!==i||e[14]!==s.bindings?(h=i>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.bindings.map(yt)}),e[13]=i,e[14]=s.bindings,e[15]=h):h=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==h?(g=(0,n.jsxs)(He,{className:"flex flex-col gap-2 py-4",children:[d,u,h]}),e[16]=d,e[17]=u,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==s.testId||e[21]!==o||e[22]!==g?(x=(0,n.jsx)(T,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":s.testId,onClick:o,children:g}),e[20]=s.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},"ht"),st=["kv","files","vectors"],xt=m((t,e)=>[...t.filter(s=>s.tab!==e.tab),e].toSorted((s,a)=>st.indexOf(s.tab)-st.indexOf(a.tab)),"gt"),bt=m(()=>{let t=(0,S.c)(19),e=Ee(),s=ft(),a=$(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];let[l,o]=(0,I.useState)(r),i,c;if(t[1]!==e||t[2]!==s.kv||t[3]!==s.storage||t[4]!==s.vectors||t[5]!==a?(i=m(()=>{let g={cancelled:!1},x=[{enabled:s.kv,label:a("KV Namespaces"),load:m(async()=>(await e.listKvNamespaces()).map(vt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:s.storage,label:a("R2 Buckets"),load:m(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:s.vectors,label:a("Vectorize Indexes"),load:m(async()=>(await e.listVectorIndexes()).map(Nt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Se((async()=>{try{let y=await b.load();if(!g.cancelled){let k={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(M=>xt(M,k))}}catch{}})());return()=>{g.cancelled=!0}},"i"),c=[e,s.kv,s.storage,s.vectors,a],t[1]=e,t[2]=s.kv,t[3]=s.storage,t[4]=s.vectors,t[5]=a,t[6]=i,t[7]=c):(i=t[6],c=t[7]),(0,I.useEffect)(i,c),l.length===0)return null;let p;t[8]!==a?(p=a("Bindings"),t[8]=a,t[9]=p):p=t[9];let d;t[10]!==p?(d=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:p}),t[10]=p,t[11]=d):d=t[11];let f;t[12]!==l?(f=l.map(_t),t[12]=l,t[13]=f):f=t[13];let u;t[14]!==f?(u=(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let h;return t[16]!==d||t[17]!==u?(h=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=h):h=t[18],h},"xt");function yt(t){return(0,n.jsx)(Fe,{variant:"secondary",children:t},t)}m(yt,"bt");function vt(t){return t.binding}m(vt,"yt");function Nt(t){return t.name}m(Nt,"vt");function _t(t){return(0,n.jsx)(gt,{group:t},t.tab)}m(_t,"Nt");var St=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],kt=m(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"St"),wt=m(t=>{let e=St.map(s=>`- ${s.name} \u2014 ${s.summary}`).join(`
|
|
2
2
|
`);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
|
|
3
|
-
`)},"kt"),Lt=1500,Ct=m(()=>{let t=(0,S.c)(35),e=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=tt(),t[0]=s):s=t[0];let a=s,[r,l]=(0,I.useState)(null),o,i;t[1]!==r?(o=m(()=>{if(r===null)return;let A=globalThis.setTimeout(()=>{l(null)},Lt);return()=>{globalThis.clearTimeout(A)}},"o"),i=[r],t[1]=r,t[2]=o,t[3]=i):(o=t[2],i=t[3]),(0,I.useEffect)(o,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=m((A,j)=>{at(j)&&l(A)},"c"),t[4]=c):c=t[4];let p=c,d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=m(()=>{p("config",kt(a))},"d"),t[5]=d):d=t[5];let f=d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m(()=>{p("prompt",wt(a))},"u"),t[6]=u):u=t[6];let h=u,g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let k;t[15]!==x||t[16]!==y?(k=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=k):k=t[17];let M;t[18]===Symbol.for("react.memo_cache_sentinel")?(M=(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=M):M=t[18];let w;t[19]!==r||t[20]!==e?(w=e(r==="config"?"Copied":"Copy MCP config"),t[19]=r,t[20]=e,t[21]=w):w=t[21];let v;t[22]!==w?(v=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:w}),t[22]=w,t[23]=v):v=t[23];let L;t[24]!==r||t[25]!==e?(L=e(r==="prompt"?"Copied":"Copy agent prompt"),t[24]=r,t[25]=e,t[26]=L):L=t[26];let C;t[27]!==L?(C=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-prompt",onClick:h,size:"xs",variant:"outline",children:L}),t[27]=L,t[28]=C):C=t[28];let N;t[29]!==v||t[30]!==C?(N=(0,n.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[M,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[v,C]})]}),t[29]=v,t[30]=C,t[31]=N):N=t[31];let _;return t[32]!==k||t[33]!==N?(_=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[k,N]}),t[32]=k,t[33]=N,t[34]=_):_=t[34],_},"wt"),It=(0,I.lazy)(()=>import("./chunk-SQMJUXBA.js")),Ze=m(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"qe"),Mt=m((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let a=Math.round(s/60);if(a<60)return`${String(a)}m ago`;let r=Math.round(a/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"At"),rt=m((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let a of t)s.set(a.bucketMs,(s.get(a.bucketMs)??0)+a[e]);return[...s.entries()].toSorted(([a],[r])=>a-r).map(([,a])=>a)},"Qe"),lt=m((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),a=t.slice(0,s).reduce((o,i)=>o+i,0),r=t.slice(s).reduce((o,i)=>o+i,0);if(a===0)return null;let l=(r-a)/a*100;return{positive:e?l>=0:l<=0,text:`${l>=0?"+":""}${l.toFixed(1)}%`}},"He"),Re=m(t=>{let e=(0,S.c)(24),{delta:s,footer:a,label:r,trend:l,unit:o,value:i}=t,c=$(),p;e[0]!==r?(p=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=p):p=e[1];let d;e[2]!==i?(d=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==o?(f=o!==void 0&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let h;e[9]!==l?(h=l!==void 0&&(0,n.jsx)(I.Suspense,{fallback:(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,n.jsx)(It,{data:l})}),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==u||e[12]!==h?(g=(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,h]}),e[11]=u,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==p||e[15]!==g?(x=(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]}),e[14]=p,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==a||e[19]!==c?(b=s==null?a!=null&&(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:a}):(0,n.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,n.jsx)("span",{className:We("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,n.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=a,e[19]=c,e[20]=b):b=e[20];let y;return e[21]!==x||e[22]!==b?(y=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},"Re"),At=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"Lt"),Je=m(t=>{let e=(0,S.c)(7),{command:s,label:a}=t,r;e[0]!==a?(r=(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:a})}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==s?(l=(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=l):l=e[3];let o;return e[4]!==r||e[5]!==l?(o=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,l]}),e[4]=r,e[5]=l,e[6]=o):o=e[6],o},"Fe"),ot=m(t=>{let e=(0,S.c)(18),{count:s,onView:a,testId:r,title:l}=t,o=$(),i;e[0]!==l?(i=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==o?(c=s===null?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o("No data yet")}):(0,n.jsx)(Fe,{variant:s>0?"destructive":"success",children:s>0?s:o("All clear")}),e[2]=s,e[3]=o,e[4]=c):c=e[4];let p;e[5]!==i||e[6]!==c?(p=(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=p):p=e[7];let d;e[8]!==o?(d=o("View"),e[8]=o,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)(At,{}),e[10]=f):f=e[10];let u;e[11]!==a||e[12]!==d?(u=(0,n.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:a,type:"button",children:[d,f]}),e[11]=a,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==p||e[15]!==u||e[16]!==r?(h=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[p,u]}),e[14]=p,e[15]=u,e[16]=r,e[17]=h):h=e[17],h},"Ge"),$t=m(t=>{let e=(0,S.c)(7),{functions:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=[...s].toSorted(Rt).slice(0,5),o;e[3]!==a?(o=a("Top functions"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,l.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No functions called yet.")}):(0,n.jsxs)("div",{className:"divide-y divide-border",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,n.jsx)("span",{children:a("Function")}),(0,n.jsx)("span",{className:"text-end",children:a("Calls")}),(0,n.jsx)("span",{className:"w-12 text-end",children:a("Avg")}),(0,n.jsx)("span",{className:"w-8 text-end",children:a("Err")})]}),l.map(qt)]})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Mt"),jt=m(t=>{let e=(0,S.c)(26),{subs:s}=t,a=$(),r;e[0]!==a?(r=a("Live connections"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=l):l=e[3];let o=s?.totalConnections??0,i;e[4]!==o?(i=o.toLocaleString(),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let p;e[8]!==a?(p=a("sockets"),e[8]=a,e[9]=p):p=e[9];let d;e[10]!==p?(d=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p}),e[10]=p,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];let u=s?.totalSubscriptions??0,h;e[15]!==u?(h=u.toLocaleString(),e[15]=u,e[16]=h):h=e[16];let g;e[17]!==a?(g=a("active subscriptions"),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,n.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==l||e[24]!==f?(b=(0,n.jsx)(T,{"data-testid":"home-live-connections",children:(0,n.jsxs)(He,{className:"flex flex-col gap-2.5 py-4",children:[l,f,x]})}),e[22]=x,e[23]=l,e[24]=f,e[25]=b):b=e[25],b},"It"),Tt=m(t=>{let e=(0,S.c)(7),{entries:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=Date.now(),o;e[3]!==a?(o=a("Recent activity"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,s.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No recent activity.")}):(0,n.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,n.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Mt(c.ts,l)})]},c.seq))})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Tt"),Ot=m(t=>{let e=t.reduce((s,a)=>s+a.calls,0);return e===0?null:t.reduce((s,a)=>s+a.totalDurationMs,0)/e},"Ot"),Gt=m(t=>{let e=(0,S.c)(151),{initialShardKey:s}=t,a=$(),r=Ve(),l=s??"",o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==l?(i={shardKey:l},e[1]=l,e[2]=i):i=e[2];let c=ke(D.getMetrics,o,i),p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={},e[3]=p):p=e[3];let d;e[4]!==l?(d={shardKey:l},e[4]=l,e[5]=d):d=e[5];let f=ke(D.getFunctionStats,p,d),u,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},h={shardKey:""},e[6]=u,e[7]=h):(u=e[6],h=e[7]);let g=ke(D.getSecurityAudit,u,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==l?(b={shardKey:l},e[9]=l,e[10]=b):b=e[10];let y=ke(D.listSubscriptions,x,b),k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k={},e[11]=k):k=e[11];let M;e[12]!==l?(M={shardKey:l},e[12]=l,e[13]=M):M=e[13];let w=ke(D.getAuditLog,k,M),v=c.data??null,L,C,N,_,A,j,P,O,R,B,E,V,q,K,W,F,U,H;if(e[14]!==w.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==r||e[19]!==f.data||e[20]!==y.data||e[21]!==a){_=Array.isArray(f.data?.functions)?f.data.functions:[],P=y.data??null;let Ie;e[40]!==w.data?(Ie=Array.isArray(w.data?.entries)?w.data.entries:[],e[40]=w.data,e[41]=Ie):Ie=e[41],C=Ie,A=c.data===void 0||f.data===void 0?null:nt(v,_).length,j=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Me;e[42]!==r?(Me=m(()=>{Se(r({to:"/security"}))},"Ae"),e[42]=r,e[43]=Me):Me=e[43],H=Me;let Ae;e[44]!==r?(Ae=m(()=>{Se(r({to:"/insights"}))},"Le"),e[44]=r,e[45]=Ae):Ae=e[45],U=Ae;let $e=rt(v?.history,"calls"),je=rt(v?.history,"errors"),Ge=Ot(_),Te=Math.max(0,..._.map(Kt)),z=v?.cache,Oe;e[46]!==z?(Oe=z!=null&&z.hits+z.misses>0?Math.round(z.hits/(z.hits+z.misses)*100):null,e[46]=z,e[47]=Oe):Oe=e[47],N=Oe,W="flex flex-col gap-6",F="lunora-home",E="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",V="home-health";let Ke=lt($e),ye;e[48]!==a?(ye=a("Requests"),e[48]=a,e[49]=ye):ye=e[49];let ze=v?.requests??0,ve;e[50]!==ze?(ve=ze.toLocaleString(),e[50]=ze,e[51]=ve):ve=e[51],e[52]!==$e||e[53]!==Ke||e[54]!==ye||e[55]!==ve?(q=(0,n.jsx)(Re,{delta:Ke,label:ye,trend:$e,value:ve}),e[52]=$e,e[53]=Ke,e[54]=ye,e[55]=ve,e[56]=q):q=e[56];let De=lt(je,!1),Ne;e[57]!==a?(Ne=a("Errors"),e[57]=a,e[58]=Ne):Ne=e[58];let Pe=v?.errors??0,_e;e[59]!==Pe?(_e=Pe.toLocaleString(),e[59]=Pe,e[60]=_e):_e=e[60],e[61]!==je||e[62]!==De||e[63]!==Ne||e[64]!==_e?(K=(0,n.jsx)(Re,{delta:De,label:Ne,trend:je,value:_e}),e[61]=je,e[62]=De,e[63]=Ne,e[64]=_e,e[65]=K):K=e[65],L=Re,e[66]!==Te||e[67]!==a?(O=Te>0?`${a("max")} ${Ze(Te)}`:void 0,e[66]=Te,e[67]=a,e[68]=O):O=e[68],e[69]!==a?(R=a("Avg latency"),e[69]=a,e[70]=R):R=e[70],B=Ge===null?"\u2014":Ze(Ge),e[14]=w.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=r,e[19]=f.data,e[20]=y.data,e[21]=a,e[22]=L,e[23]=C,e[24]=N,e[25]=_,e[26]=A,e[27]=j,e[28]=P,e[29]=O,e[30]=R,e[31]=B,e[32]=E,e[33]=V,e[34]=q,e[35]=K,e[36]=W,e[37]=F,e[38]=U,e[39]=H}else L=e[22],C=e[23],N=e[24],_=e[25],A=e[26],j=e[27],P=e[28],O=e[29],R=e[30],B=e[31],E=e[32],V=e[33],q=e[34],K=e[35],W=e[36],F=e[37],U=e[38],H=e[39];let J;e[71]!==L||e[72]!==O||e[73]!==R||e[74]!==B?(J=(0,n.jsx)(L,{footer:O,label:R,value:B}),e[71]=L,e[72]=O,e[73]=R,e[74]=B,e[75]=J):J=e[75];let Z;e[76]!==N||e[77]!==a?(Z=N===null?void 0:`${String(N)}% ${a("cache hit")}`,e[76]=N,e[77]=a,e[78]=Z):Z=e[78];let G;e[79]!==a?(G=a("Database size"),e[79]=a,e[80]=G):G=e[80];let qe=v?.databaseSize??null,Y;e[81]!==qe?(Y=et(qe),e[81]=qe,e[82]=Y):Y=e[82];let Q;e[83]!==Z||e[84]!==G||e[85]!==Y?(Q=(0,n.jsx)(Re,{footer:Z,label:G,value:Y}),e[83]=Z,e[84]=G,e[85]=Y,e[86]=Q):Q=e[86];let X;e[87]!==E||e[88]!==V||e[89]!==q||e[90]!==K||e[91]!==J||e[92]!==Q?(X=(0,n.jsxs)("div",{className:E,"data-testid":V,children:[q,K,J,Q]}),e[87]=E,e[88]=V,e[89]=q,e[90]=K,e[91]=J,e[92]=Q,e[93]=X):X=e[93];let we;e[94]===Symbol.for("react.memo_cache_sentinel")?(we=(0,n.jsx)(bt,{}),e[94]=we):we=e[94];let ee;e[95]!==_?(ee=(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)($t,{functions:_})}),e[95]=_,e[96]=ee):ee=e[96];let te;e[97]!==P?(te=(0,n.jsx)(jt,{subs:P}),e[97]=P,e[98]=te):te=e[98];let ae;e[99]!==C?(ae=(0,n.jsx)(Tt,{entries:C}),e[99]=C,e[100]=ae):ae=e[100];let ne;e[101]!==te||e[102]!==ae?(ne=(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[te,ae]}),e[101]=te,e[102]=ae,e[103]=ne):ne=e[103];let se;e[104]!==ee||e[105]!==ne?(se=(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[ee,ne]}),e[104]=ee,e[105]=ne,e[106]=se):se=e[106];let re;e[107]!==a?(re=a("Advisors"),e[107]=a,e[108]=re):re=e[108];let le;e[109]!==re?(le=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:re}),e[109]=re,e[110]=le):le=e[110];let oe;e[111]!==A||e[112]!==j||e[113]!==a||e[114]!==U||e[115]!==H?(oe=j===0&&A===0?(0,n.jsx)(Ye,{description:a("No security or performance issues detected."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,n.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:a("No issues found")}):(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(ot,{count:j,onView:H,testId:"home-security",title:a("Security findings")}),(0,n.jsx)(ot,{count:A,onView:U,testId:"home-performance",title:a("Performance issues")})]}),e[111]=A,e[112]=j,e[113]=a,e[114]=U,e[115]=H,e[116]=oe):oe=e[116];let ie;e[117]!==le||e[118]!==oe?(ie=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[le,oe]}),e[117]=le,e[118]=oe,e[119]=ie):ie=e[119];let ce;e[120]!==a?(ce=a("Get connected"),e[120]=a,e[121]=ce):ce=e[121];let de;e[122]!==ce?(de=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ce}),e[122]=ce,e[123]=de):de=e[123];let me;e[124]!==a?(me=a("Client SDK"),e[124]=a,e[125]=me):me=e[125];let ue;e[126]!==me?(ue=(0,n.jsx)(Je,{command:"npm i @lunora/client",label:me}),e[126]=me,e[127]=ue):ue=e[127];let pe;e[128]!==a?(pe=a("React"),e[128]=a,e[129]=pe):pe=e[129];let fe;e[130]!==pe?(fe=(0,n.jsx)(Je,{command:"npm i @lunora/react",label:pe}),e[130]=pe,e[131]=fe):fe=e[131];let he;e[132]!==a?(he=a("CLI"),e[132]=a,e[133]=he):he=e[133];let ge;e[134]!==he?(ge=(0,n.jsx)(Je,{command:"lunora dev",label:he}),e[134]=he,e[135]=ge):ge=e[135];let xe;e[136]!==ue||e[137]!==fe||e[138]!==ge?(xe=(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[ue,fe,ge]}),e[136]=ue,e[137]=fe,e[138]=ge,e[139]=xe):xe=e[139];let Le;e[140]===Symbol.for("react.memo_cache_sentinel")?(Le=(0,n.jsx)(Ct,{}),e[140]=Le):Le=e[140];let be;e[141]!==de||e[142]!==xe?(be=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[de,xe,Le]}),e[141]=de,e[142]=xe,e[143]=be):be=e[143];let Ce;return e[144]!==W||e[145]!==F||e[146]!==X||e[147]!==se||e[148]!==ie||e[149]!==be?(Ce=(0,n.jsxs)("div",{className:W,"data-testid":F,children:[X,we,se,ie,be]}),e[144]=W,e[145]=F,e[146]=X,e[147]=se,e[148]=ie,e[149]=be,e[150]=Ce):Ce=e[150],Ce},"Zt");function Rt(t,e){return e.calls-t.calls}m(Rt,"Rt");function qt(t){return(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,n.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,n.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,n.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Ze(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,n.jsx)("span",{className:We("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}m(qt,"Et");function Kt(t){return t.maxDurationMs}m(Kt,"jt");export{ft as a,Gt as b};
|
|
3
|
+
`)},"kt"),Lt=1500,Ct=m(()=>{let t=(0,S.c)(35),e=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=tt(),t[0]=s):s=t[0];let a=s,[r,l]=(0,I.useState)(null),o,i;t[1]!==r?(o=m(()=>{if(r===null)return;let A=globalThis.setTimeout(()=>{l(null)},Lt);return()=>{globalThis.clearTimeout(A)}},"o"),i=[r],t[1]=r,t[2]=o,t[3]=i):(o=t[2],i=t[3]),(0,I.useEffect)(o,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=m((A,j)=>{at(j)&&l(A)},"c"),t[4]=c):c=t[4];let p=c,d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=m(()=>{p("config",kt(a))},"d"),t[5]=d):d=t[5];let f=d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m(()=>{p("prompt",wt(a))},"u"),t[6]=u):u=t[6];let h=u,g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let k;t[15]!==x||t[16]!==y?(k=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=k):k=t[17];let M;t[18]===Symbol.for("react.memo_cache_sentinel")?(M=(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=M):M=t[18];let w;t[19]!==r||t[20]!==e?(w=e(r==="config"?"Copied":"Copy MCP config"),t[19]=r,t[20]=e,t[21]=w):w=t[21];let v;t[22]!==w?(v=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:w}),t[22]=w,t[23]=v):v=t[23];let L;t[24]!==r||t[25]!==e?(L=e(r==="prompt"?"Copied":"Copy agent prompt"),t[24]=r,t[25]=e,t[26]=L):L=t[26];let C;t[27]!==L?(C=(0,n.jsx)(Ue,{"data-testid":"home-connect-agent-copy-prompt",onClick:h,size:"xs",variant:"outline",children:L}),t[27]=L,t[28]=C):C=t[28];let N;t[29]!==v||t[30]!==C?(N=(0,n.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[M,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[v,C]})]}),t[29]=v,t[30]=C,t[31]=N):N=t[31];let _;return t[32]!==k||t[33]!==N?(_=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[k,N]}),t[32]=k,t[33]=N,t[34]=_):_=t[34],_},"wt"),It=(0,I.lazy)(()=>import("./chunk-ITNXWR5K.js")),Ze=m(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"qe"),Mt=m((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let a=Math.round(s/60);if(a<60)return`${String(a)}m ago`;let r=Math.round(a/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"At"),rt=m((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let a of t)s.set(a.bucketMs,(s.get(a.bucketMs)??0)+a[e]);return[...s.entries()].toSorted(([a],[r])=>a-r).map(([,a])=>a)},"Qe"),lt=m((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),a=t.slice(0,s).reduce((o,i)=>o+i,0),r=t.slice(s).reduce((o,i)=>o+i,0);if(a===0)return null;let l=(r-a)/a*100;return{positive:e?l>=0:l<=0,text:`${l>=0?"+":""}${l.toFixed(1)}%`}},"He"),Re=m(t=>{let e=(0,S.c)(24),{delta:s,footer:a,label:r,trend:l,unit:o,value:i}=t,c=$(),p;e[0]!==r?(p=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=p):p=e[1];let d;e[2]!==i?(d=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==o?(f=o!==void 0&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let h;e[9]!==l?(h=l!==void 0&&(0,n.jsx)(I.Suspense,{fallback:(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,n.jsx)(It,{data:l})}),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==u||e[12]!==h?(g=(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,h]}),e[11]=u,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==p||e[15]!==g?(x=(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]}),e[14]=p,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==a||e[19]!==c?(b=s==null?a!=null&&(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:a}):(0,n.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,n.jsx)("span",{className:We("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,n.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=a,e[19]=c,e[20]=b):b=e[20];let y;return e[21]!==x||e[22]!==b?(y=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},"Re"),At=m(()=>{let t=(0,S.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"Lt"),Je=m(t=>{let e=(0,S.c)(7),{command:s,label:a}=t,r;e[0]!==a?(r=(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:a})}),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==s?(l=(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=l):l=e[3];let o;return e[4]!==r||e[5]!==l?(o=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,l]}),e[4]=r,e[5]=l,e[6]=o):o=e[6],o},"Fe"),ot=m(t=>{let e=(0,S.c)(18),{count:s,onView:a,testId:r,title:l}=t,o=$(),i;e[0]!==l?(i=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==o?(c=s===null?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:o("No data yet")}):(0,n.jsx)(Fe,{variant:s>0?"destructive":"success",children:s>0?s:o("All clear")}),e[2]=s,e[3]=o,e[4]=c):c=e[4];let p;e[5]!==i||e[6]!==c?(p=(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=p):p=e[7];let d;e[8]!==o?(d=o("View"),e[8]=o,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)(At,{}),e[10]=f):f=e[10];let u;e[11]!==a||e[12]!==d?(u=(0,n.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:a,type:"button",children:[d,f]}),e[11]=a,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==p||e[15]!==u||e[16]!==r?(h=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[p,u]}),e[14]=p,e[15]=u,e[16]=r,e[17]=h):h=e[17],h},"Ge"),$t=m(t=>{let e=(0,S.c)(7),{functions:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=[...s].toSorted(Rt).slice(0,5),o;e[3]!==a?(o=a("Top functions"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,l.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No functions called yet.")}):(0,n.jsxs)("div",{className:"divide-y divide-border",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,n.jsx)("span",{children:a("Function")}),(0,n.jsx)("span",{className:"text-end",children:a("Calls")}),(0,n.jsx)("span",{className:"w-12 text-end",children:a("Avg")}),(0,n.jsx)("span",{className:"w-8 text-end",children:a("Err")})]}),l.map(qt)]})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Mt"),jt=m(t=>{let e=(0,S.c)(26),{subs:s}=t,a=$(),r;e[0]!==a?(r=a("Live connections"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=l):l=e[3];let o=s?.totalConnections??0,i;e[4]!==o?(i=o.toLocaleString(),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let p;e[8]!==a?(p=a("sockets"),e[8]=a,e[9]=p):p=e[9];let d;e[10]!==p?(d=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p}),e[10]=p,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];let u=s?.totalSubscriptions??0,h;e[15]!==u?(h=u.toLocaleString(),e[15]=u,e[16]=h):h=e[16];let g;e[17]!==a?(g=a("active subscriptions"),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,n.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==l||e[24]!==f?(b=(0,n.jsx)(T,{"data-testid":"home-live-connections",children:(0,n.jsxs)(He,{className:"flex flex-col gap-2.5 py-4",children:[l,f,x]})}),e[22]=x,e[23]=l,e[24]=f,e[25]=b):b=e[25],b},"It"),Tt=m(t=>{let e=(0,S.c)(7),{entries:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let l=Date.now(),o;e[3]!==a?(o=a("Recent activity"),e[3]=a,e[4]=o):o=e[4];let i;e[5]!==o?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,s.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No recent activity.")}):(0,n.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,n.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Mt(c.ts,l)})]},c.seq))})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Tt"),Ot=m(t=>{let e=t.reduce((s,a)=>s+a.calls,0);return e===0?null:t.reduce((s,a)=>s+a.totalDurationMs,0)/e},"Ot"),Gt=m(t=>{let e=(0,S.c)(151),{initialShardKey:s}=t,a=$(),r=Ve(),l=s??"",o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==l?(i={shardKey:l},e[1]=l,e[2]=i):i=e[2];let c=ke(D.getMetrics,o,i),p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={},e[3]=p):p=e[3];let d;e[4]!==l?(d={shardKey:l},e[4]=l,e[5]=d):d=e[5];let f=ke(D.getFunctionStats,p,d),u,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},h={shardKey:""},e[6]=u,e[7]=h):(u=e[6],h=e[7]);let g=ke(D.getSecurityAudit,u,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==l?(b={shardKey:l},e[9]=l,e[10]=b):b=e[10];let y=ke(D.listSubscriptions,x,b),k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k={},e[11]=k):k=e[11];let M;e[12]!==l?(M={shardKey:l},e[12]=l,e[13]=M):M=e[13];let w=ke(D.getAuditLog,k,M),v=c.data??null,L,C,N,_,A,j,P,O,R,B,E,V,q,K,W,F,U,H;if(e[14]!==w.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==r||e[19]!==f.data||e[20]!==y.data||e[21]!==a){_=Array.isArray(f.data?.functions)?f.data.functions:[],P=y.data??null;let Ie;e[40]!==w.data?(Ie=Array.isArray(w.data?.entries)?w.data.entries:[],e[40]=w.data,e[41]=Ie):Ie=e[41],C=Ie,A=c.data===void 0||f.data===void 0?null:nt(v,_).length,j=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Me;e[42]!==r?(Me=m(()=>{Se(r({to:"/security"}))},"Ae"),e[42]=r,e[43]=Me):Me=e[43],H=Me;let Ae;e[44]!==r?(Ae=m(()=>{Se(r({to:"/insights"}))},"Le"),e[44]=r,e[45]=Ae):Ae=e[45],U=Ae;let $e=rt(v?.history,"calls"),je=rt(v?.history,"errors"),Ge=Ot(_),Te=Math.max(0,..._.map(Kt)),z=v?.cache,Oe;e[46]!==z?(Oe=z!=null&&z.hits+z.misses>0?Math.round(z.hits/(z.hits+z.misses)*100):null,e[46]=z,e[47]=Oe):Oe=e[47],N=Oe,W="flex flex-col gap-6",F="lunora-home",E="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",V="home-health";let Ke=lt($e),ye;e[48]!==a?(ye=a("Requests"),e[48]=a,e[49]=ye):ye=e[49];let ze=v?.requests??0,ve;e[50]!==ze?(ve=ze.toLocaleString(),e[50]=ze,e[51]=ve):ve=e[51],e[52]!==$e||e[53]!==Ke||e[54]!==ye||e[55]!==ve?(q=(0,n.jsx)(Re,{delta:Ke,label:ye,trend:$e,value:ve}),e[52]=$e,e[53]=Ke,e[54]=ye,e[55]=ve,e[56]=q):q=e[56];let De=lt(je,!1),Ne;e[57]!==a?(Ne=a("Errors"),e[57]=a,e[58]=Ne):Ne=e[58];let Pe=v?.errors??0,_e;e[59]!==Pe?(_e=Pe.toLocaleString(),e[59]=Pe,e[60]=_e):_e=e[60],e[61]!==je||e[62]!==De||e[63]!==Ne||e[64]!==_e?(K=(0,n.jsx)(Re,{delta:De,label:Ne,trend:je,value:_e}),e[61]=je,e[62]=De,e[63]=Ne,e[64]=_e,e[65]=K):K=e[65],L=Re,e[66]!==Te||e[67]!==a?(O=Te>0?`${a("max")} ${Ze(Te)}`:void 0,e[66]=Te,e[67]=a,e[68]=O):O=e[68],e[69]!==a?(R=a("Avg latency"),e[69]=a,e[70]=R):R=e[70],B=Ge===null?"\u2014":Ze(Ge),e[14]=w.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=r,e[19]=f.data,e[20]=y.data,e[21]=a,e[22]=L,e[23]=C,e[24]=N,e[25]=_,e[26]=A,e[27]=j,e[28]=P,e[29]=O,e[30]=R,e[31]=B,e[32]=E,e[33]=V,e[34]=q,e[35]=K,e[36]=W,e[37]=F,e[38]=U,e[39]=H}else L=e[22],C=e[23],N=e[24],_=e[25],A=e[26],j=e[27],P=e[28],O=e[29],R=e[30],B=e[31],E=e[32],V=e[33],q=e[34],K=e[35],W=e[36],F=e[37],U=e[38],H=e[39];let J;e[71]!==L||e[72]!==O||e[73]!==R||e[74]!==B?(J=(0,n.jsx)(L,{footer:O,label:R,value:B}),e[71]=L,e[72]=O,e[73]=R,e[74]=B,e[75]=J):J=e[75];let Z;e[76]!==N||e[77]!==a?(Z=N===null?void 0:`${String(N)}% ${a("cache hit")}`,e[76]=N,e[77]=a,e[78]=Z):Z=e[78];let G;e[79]!==a?(G=a("Database size"),e[79]=a,e[80]=G):G=e[80];let qe=v?.databaseSize??null,Y;e[81]!==qe?(Y=et(qe),e[81]=qe,e[82]=Y):Y=e[82];let Q;e[83]!==Z||e[84]!==G||e[85]!==Y?(Q=(0,n.jsx)(Re,{footer:Z,label:G,value:Y}),e[83]=Z,e[84]=G,e[85]=Y,e[86]=Q):Q=e[86];let X;e[87]!==E||e[88]!==V||e[89]!==q||e[90]!==K||e[91]!==J||e[92]!==Q?(X=(0,n.jsxs)("div",{className:E,"data-testid":V,children:[q,K,J,Q]}),e[87]=E,e[88]=V,e[89]=q,e[90]=K,e[91]=J,e[92]=Q,e[93]=X):X=e[93];let we;e[94]===Symbol.for("react.memo_cache_sentinel")?(we=(0,n.jsx)(bt,{}),e[94]=we):we=e[94];let ee;e[95]!==_?(ee=(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)($t,{functions:_})}),e[95]=_,e[96]=ee):ee=e[96];let te;e[97]!==P?(te=(0,n.jsx)(jt,{subs:P}),e[97]=P,e[98]=te):te=e[98];let ae;e[99]!==C?(ae=(0,n.jsx)(Tt,{entries:C}),e[99]=C,e[100]=ae):ae=e[100];let ne;e[101]!==te||e[102]!==ae?(ne=(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[te,ae]}),e[101]=te,e[102]=ae,e[103]=ne):ne=e[103];let se;e[104]!==ee||e[105]!==ne?(se=(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[ee,ne]}),e[104]=ee,e[105]=ne,e[106]=se):se=e[106];let re;e[107]!==a?(re=a("Advisors"),e[107]=a,e[108]=re):re=e[108];let le;e[109]!==re?(le=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:re}),e[109]=re,e[110]=le):le=e[110];let oe;e[111]!==A||e[112]!==j||e[113]!==a||e[114]!==U||e[115]!==H?(oe=j===0&&A===0?(0,n.jsx)(Ye,{description:a("No security or performance issues detected."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,n.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:a("No issues found")}):(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(ot,{count:j,onView:H,testId:"home-security",title:a("Security findings")}),(0,n.jsx)(ot,{count:A,onView:U,testId:"home-performance",title:a("Performance issues")})]}),e[111]=A,e[112]=j,e[113]=a,e[114]=U,e[115]=H,e[116]=oe):oe=e[116];let ie;e[117]!==le||e[118]!==oe?(ie=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[le,oe]}),e[117]=le,e[118]=oe,e[119]=ie):ie=e[119];let ce;e[120]!==a?(ce=a("Get connected"),e[120]=a,e[121]=ce):ce=e[121];let de;e[122]!==ce?(de=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ce}),e[122]=ce,e[123]=de):de=e[123];let me;e[124]!==a?(me=a("Client SDK"),e[124]=a,e[125]=me):me=e[125];let ue;e[126]!==me?(ue=(0,n.jsx)(Je,{command:"npm i @lunora/client",label:me}),e[126]=me,e[127]=ue):ue=e[127];let pe;e[128]!==a?(pe=a("React"),e[128]=a,e[129]=pe):pe=e[129];let fe;e[130]!==pe?(fe=(0,n.jsx)(Je,{command:"npm i @lunora/react",label:pe}),e[130]=pe,e[131]=fe):fe=e[131];let he;e[132]!==a?(he=a("CLI"),e[132]=a,e[133]=he):he=e[133];let ge;e[134]!==he?(ge=(0,n.jsx)(Je,{command:"lunora dev",label:he}),e[134]=he,e[135]=ge):ge=e[135];let xe;e[136]!==ue||e[137]!==fe||e[138]!==ge?(xe=(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[ue,fe,ge]}),e[136]=ue,e[137]=fe,e[138]=ge,e[139]=xe):xe=e[139];let Le;e[140]===Symbol.for("react.memo_cache_sentinel")?(Le=(0,n.jsx)(Ct,{}),e[140]=Le):Le=e[140];let be;e[141]!==de||e[142]!==xe?(be=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[de,xe,Le]}),e[141]=de,e[142]=xe,e[143]=be):be=e[143];let Ce;return e[144]!==W||e[145]!==F||e[146]!==X||e[147]!==se||e[148]!==ie||e[149]!==be?(Ce=(0,n.jsxs)("div",{className:W,"data-testid":F,children:[X,we,se,ie,be]}),e[144]=W,e[145]=F,e[146]=X,e[147]=se,e[148]=ie,e[149]=be,e[150]=Ce):Ce=e[150],Ce},"Zt");function Rt(t,e){return e.calls-t.calls}m(Rt,"Rt");function qt(t){return(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,n.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,n.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,n.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Ze(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,n.jsx)("span",{className:We("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}m(qt,"Et");function Kt(t){return t.maxDurationMs}m(Kt,"jt");export{ft as a,Gt as b};
|